Create legacy config
This commit:
* creates legacy config, which is now a copy of developer config and
needs to be further polished
* switches developer firmware in developer config to default (which was
not default)
BUG=chromium-os:15527
TEST=manual
1. build cleanly
(chroot) $ emerge-${BOARD} u-boot-config u-boot chromeos-bios
2. test official firmware
(chroot) $ cros_write_firmware --board ${BOARD}
Then you should be able to load:
* normal firmware when dev switch is off
* developer firmware when dev switch is on
* recovery firmware when recovery button is pressed
3. test legacy firmware
(chroot) $ cros_write_firmware --board ${BOARD} --firmware /build/tegra2_seaboard/u-boot/legacy_bootstub.bin
Then you should be able to boot from network, SD card, USB key, and eMMC.
Change-Id: I6320b89ea7d688478121dc5b42b27e7bbbcda7fc
Reviewed-on: http://gerrit.chromium.org/gerrit/1171
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
diff --git a/legacy.h b/legacy.h
new file mode 100644
index 0000000..2d3c643
--- /dev/null
+++ b/legacy.h
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef __configs_chromeos_legacy_h__
+#define __configs_chromeos_legacy_h__
+
+#include <configs/chromeos/common.h>
+
+#define CONFIG_CMD_ASKENV
+#define CONFIG_CMD_AUTOSCRIPT
+#define CONFIG_CMD_BDI
+#define CONFIG_CMD_BOOTD
+#define CONFIG_CMD_CONSOLE
+#define CONFIG_CMD_CROS
+#define CONFIG_CMD_CROS_BOOTSTUB
+#define CONFIG_CMD_CROS_DEVELOPER_FIRMWARE
+#define CONFIG_CMD_CROS_NORMAL_FIRMWARE
+#define CONFIG_CMD_CROS_REC
+#define CONFIG_CMD_ECHO
+#define CONFIG_CMD_FPGA
+#define CONFIG_CMD_IMI
+#define CONFIG_CMD_ITEST
+#define CONFIG_CMD_LOADB
+#define CONFIG_CMD_LOADS
+#define CONFIG_CMD_READ
+#define CONFIG_CMD_MISC
+#define CONFIG_CMD_SETGETDCR
+#define CONFIG_CMD_XIMG
+
+#define CONFIG_MMC
+#define CONFIG_EFI_PARTITION
+#define CONFIG_DOS_PARTITION
+
+#define CONFIG_CHROMEOS
+
+/* Needed by recovery firmware */
+#define CONFIG_CHROMEOS_BMPBLK
+#define CONFIG_CMD_BMP
+#define CONFIG_LCD_BMP_RLE8
+#define CONFIG_LZMA
+
+#define CONFIG_CHROMEOS_FIRMWARE_STORAGE_RAM
+
+#define CONFIG_CMD_READ
+#define CONFIG_CMD_MMC
+#define CONFIG_CMD_EXT2
+#define CONFIG_CMD_FAT
+
+#define CONFIG_CMD_MEMORY
+
+/*
+ * The following make using the console nicer.
+ */
+#define CONFIG_DISPLAY_CPUINFO 1
+
+#define CONFIG_SYS_LONGHELP 1
+#define CONFIG_CMDLINE_EDITING 1
+#define CONFIG_COMMAND_HISTORY 1
+#define CONFIG_AUTOCOMPLETE 1
+#define CONFIG_SYS_HUSH_PARSER 1
+#define CONFIG_SYS_PROMPT_HUSH_PS2 "> "
+
+/*
+ * Recovery, normal and stub configs define CONFIG_ENV_IS_NOWHERE, but this
+ * legacy config requires a saved environment. The legacy header file
+ * in include/config/chromeos/<arch>/legacy.h should define where the
+ * environment is, for example CONFIG_ENV_IS_IN_SPI_FLASH for SPI flash.
+ * If a saved environment is not available for a particular architecture or
+ * board, you can define CONFIG_ENV_IS_NOWHERE in that header file instead.
+ */
+#define CONFIG_CMD_SAVEENV
+
+/* Enable USB Ethernet dongles */
+#define CONFIG_USB_HOST_ETHER
+#define CONFIG_USB_ETHER_ASIX
+#define CONFIG_USB_ETHER_SMSC95XX
+
+/*
+ * Ethernet support
+ */
+#define CONFIG_CMD_NET
+#define CONFIG_NET_MULTI
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_DHCP
+
+/*
+ * BOOTP options
+ */
+#define CONFIG_BOOTP_SUBNETMASK
+#define CONFIG_BOOTP_GATEWAY
+#define CONFIG_BOOTP_HOSTNAME
+#define CONFIG_BOOTP_BOOTPATH
+#define CONFIG_TFTP_TSIZE
+
+#define CONFIG_IPADDR 10.0.0.2
+#define CONFIG_SERVERIP 10.0.0.1
+#define CONFIG_BOOTFILE uImage
+
+/*
+ * INITRD support
+ */
+#define CONFIG_INITRD_TAG
+
+/*
+ * We decorate the nfsroot name so that multiple users / boards can easily
+ * share an NFS server:
+ * user - username, e.g. 'frank'
+ * board - board, e.g. 'seaboard'
+ * serial - serial number, e.g. '1234'
+ */
+#define CONFIG_ROOTPATH "/export/nfsroot-${user}-${board}-${serial#}"
+
+
+
+#endif //__configs_chromeos_legacy_h__
diff --git a/tegra2/aebl/legacy.h b/tegra2/aebl/legacy.h
new file mode 100644
index 0000000..6163b99
--- /dev/null
+++ b/tegra2/aebl/legacy.h
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef __configs_chromeos_tegra2_aebl_legacy_h__
+#define __configs_chromeos_tegra2_aebl_legacy_h__
+
+#include <configs/chromeos/tegra2/legacy.h>
+#include <configs/chromeos/tegra2/aebl/common.h>
+
+#include <configs/chromeos/tegra2/aebl/parts/usb.h>
+
+#define CONFIG_CMD_CROS_TPM
+
+#endif /*__configs_chromeos_tegra2_aebl_legacy_h__*/
diff --git a/tegra2/arthur/legacy.h b/tegra2/arthur/legacy.h
new file mode 100644
index 0000000..809d933
--- /dev/null
+++ b/tegra2/arthur/legacy.h
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef __configs_chromeos_tegra2_arthur_legacy_h__
+#define __configs_chromeos_tegra2_arthur_legacy_h__
+
+#include <configs/chromeos/tegra2/legacy.h>
+#include <configs/chromeos/tegra2/arthur/common.h>
+
+#include <configs/chromeos/tegra2/arthur/parts/usb.h>
+
+#define CONFIG_CMD_CROS_TPM
+
+#endif /*__configs_chromeos_tegra2_arthur_legacy_h__*/
diff --git a/tegra2/developer.h b/tegra2/developer.h
index dc310db..157952d 100644
--- a/tegra2/developer.h
+++ b/tegra2/developer.h
@@ -148,19 +148,7 @@
* usb 0 will override a network adapter on usb 1. For now, we'll have to
* live with that.
*/
-#define CONFIG_BOOTCOMMAND \
- "usb start 0 ; " \
- "run net_boot ; " \
- "run usb_boot ; " \
- \
- "setenv ethact '' ; " \
- "if usb start 1 ; then " \
- "run net_boot ; " \
- "run usb_boot ; " \
- "fi ; " \
- \
- "run mmc1_boot ; " \
- "run mmc0_boot"
+#define CONFIG_BOOTCOMMAND "cros_developer_firmware"
#endif //__configs_chromeos_tegra2_developer_h__
diff --git a/tegra2/generic/legacy.h b/tegra2/generic/legacy.h
new file mode 100644
index 0000000..716eca4
--- /dev/null
+++ b/tegra2/generic/legacy.h
@@ -0,0 +1,18 @@
+/*
+ * Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef __configs_chromeos_tegra2_generic_legacy_h__
+#define __configs_chromeos_tegra2_generic_legacy_h__
+
+#include <configs/chromeos/tegra2/legacy.h>
+#include <configs/chromeos/tegra2/generic/common.h>
+
+#include <configs/chromeos/tegra2/generic/parts/usb.h>
+
+/* We don't have environment support on the Generic build yet */
+#define CONFIG_ENV_IS_NOWHERE
+
+#endif /*__configs_chromeos_tegra2_generic_legacy_h__*/
diff --git a/tegra2/harmony/legacy.h b/tegra2/harmony/legacy.h
new file mode 100644
index 0000000..5eabc80
--- /dev/null
+++ b/tegra2/harmony/legacy.h
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef __configs_chromeos_tegra2_harmony_legacy_h__
+#define __configs_chromeos_tegra2_harmony_legacy_h__
+
+#include <configs/chromeos/tegra2/legacy.h>
+#include <configs/chromeos/tegra2/harmony/common.h>
+
+#include <configs/chromeos/tegra2/harmony/parts/nand.h>
+#include <configs/chromeos/tegra2/harmony/parts/usb.h>
+
+/* We don't have environment support on Harmony yet */
+#define CONFIG_ENV_IS_NOWHERE
+
+#endif /*__configs_chromeos_tegra2_harmony_legacy_h__*/
diff --git a/tegra2/kaen/legacy.h b/tegra2/kaen/legacy.h
new file mode 100644
index 0000000..fd9001d
--- /dev/null
+++ b/tegra2/kaen/legacy.h
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef __configs_chromeos_tegra2_kaen_legacy_h__
+#define __configs_chromeos_tegra2_kaen_legacy_h__
+
+#include <configs/chromeos/tegra2/legacy.h>
+#include <configs/chromeos/tegra2/kaen/common.h>
+
+#include <configs/chromeos/tegra2/kaen/parts/usb.h>
+
+#define CONFIG_CMD_CROS_TPM
+
+#endif /*__configs_chromeos_tegra2_kaen_legacy_h__*/
diff --git a/tegra2/legacy.h b/tegra2/legacy.h
new file mode 100644
index 0000000..1cc4d20
--- /dev/null
+++ b/tegra2/legacy.h
@@ -0,0 +1,166 @@
+/*
+ * Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef __configs_chromeos_tegra2_legacy_h__
+#define __configs_chromeos_tegra2_legacy_h__
+
+#include <configs/chromeos/legacy.h>
+#include <configs/chromeos/tegra2/common.h>
+
+#include <configs/chromeos/tegra2/parts/nand.h>
+#include <configs/chromeos/tegra2/parts/usb.h>
+
+/*
+ * We expect all Tegra2 machines to have SPI flash as defined by the
+ * firmware_layout.h config file. The environment will go there.
+ */
+#define CONFIG_ENV_IS_IN_SPI_FLASH 1
+
+#define CONFIG_ENV_SECT_SIZE CONFIG_LENGTH_ENV
+#define CONFIG_ENV_OFFSET CONFIG_OFFSET_ENV
+
+/* Override the environment size, since we only need a small area */
+#undef CONFIG_ENV_SIZE
+#define CONFIG_ENV_SIZE CONFIG_LENGTH_ENV
+
+#define CONFIG_SYS_MEMTEST_START 0x0000
+#define CONFIG_SYS_MEMTEST_END 0x1000
+
+/*
+ * Developer-friendly booting options:
+ *
+ * dhcp_boot: get IP address from DHCP, download kernel from TFTP, then boot
+ * with NFS root.
+ * netroot_boot: get IP address from DHCP, download kernel and rootfs from
+ * TFTP, then boot.
+ * keynfs_boot: get kernel from USB stick ext2 partition 1, then NFS root.
+ * NOTE: not in the boot command by default.
+ * usb_boot: boot from a USB image made with image_to_usb.sh.
+ * mmc1_boot: boot from an SD card made with image_to_usb.sh.
+ * mmc0_boot: boot from an image installed in eMMC.
+ *
+ * regen_all sets up the bootargs, so must be run after any change to
+ * environment variables.
+ *
+ * The network adapter must be available before starting an dhcp_boot. You
+ * may need to use 'usb start' first if you are using a USB ethernet adapter.
+ * The same applies for usb_boot.
+ */
+
+#define CONFIG_EXTRA_ENV_SETTINGS_ARCH \
+ "console=ttyS0,115200n8\0"\
+ "cros_bootfile=/boot/vmlinux.uimg\0"\
+ "user=user\0"\
+ "board=arm\0"\
+ "serial#=1\0"\
+ "tftpkernelpath=/tftpboot/uImage\0"\
+ "tftprootpath=/tftpboot/initrd\0"\
+ "tftpserverip=0.0.0.0\0"\
+ "nfsserverip=0.0.0.0\0"\
+ "rootaddr=0x12008000\0"\
+ "setup_shared_mem="\
+ "setenv bypass_load_kernel 1; "\
+ "cros load_k 1 2\0"\
+ "regen_all="\
+ "setenv common_bootargs console=${console} "\
+ "${platform_extras}; "\
+ "setenv bootargs ${common_bootargs} ${extra_bootargs} "\
+ "${bootdev_bootargs}\0"\
+ "regen_nfsroot_bootargs=setenv bootdev_bootargs "\
+ "dev=/dev/nfs4 rw nfsroot=${nfsserverip}:${rootpath} "\
+ "ip=dhcp noinitrd; "\
+ "run regen_all\0"\
+ "regen_initrdroot_bootargs=setenv bootdev_bootargs "\
+ "rw root=/dev/ram0 ramdisk_size=294912; "\
+ "run regen_all\0"\
+ \
+ "dhcp_setup=setenv tftpkernelpath "\
+ "/tftpboot/uImage-${user}-${board}-${serial#}; "\
+ "setenv tftprootpath "\
+ "/tftpboot/initrd-${user}-${board}-${serial#}; "\
+ "setenv rootpath " CONFIG_ROOTPATH "; "\
+ "setenv autoload n\0"\
+ "dhcp_boot=run dhcp_setup; "\
+ "run regen_nfsroot_bootargs; "\
+ "bootp; "\
+ "if tftpboot ${loadaddr} ${tftpserverip}:${tftpkernelpath}; "\
+ "then "\
+ "run setup_shared_mem; "\
+ "bootm ${loadaddr}; "\
+ "fi\0"\
+ "netroot_boot=run dhcp_setup; "\
+ "run regen_initrdroot_bootargs; "\
+ "bootp; "\
+ "if tftpboot ${rootaddr} ${tftpserverip}:${tftprootpath} && "\
+ " tftpboot ${loadaddr} ${tftpserverip}:${tftpkernelpath}; "\
+ "then "\
+ "run setup_shared_mem; "\
+ "bootm ${loadaddr} ${rootaddr}; "\
+ "fi\0"\
+ \
+ "ext2_boot=setenv bootdev_bootargs root=/dev/${devname}3 rootwait ro; "\
+ "run regen_all; "\
+ "if ext2load ${devtype} ${devnum}:3 "\
+ "${loadaddr} ${cros_bootfile}; then "\
+ "run setup_shared_mem; "\
+ "bootm ${loadaddr};" \
+ "fi\0" \
+ \
+ "keynfs_setup="\
+ "setenv rootpath " CONFIG_ROOTPATH "; "\
+ "run regen_nfsroot_bootargs\0" \
+ "keynfs_boot=run keynfs_setup; "\
+ "if ext2load usb 0:1 ${loadaddr} uImage; then "\
+ "run setup_shared_mem; "\
+ "bootm ${loadaddr};" \
+ "fi\0" \
+ \
+ "usb_boot=setenv devtype usb; "\
+ "setenv devnum 0; "\
+ "setenv devname sda; "\
+ "run ext2_boot\0" \
+ \
+ "net_boot=if test ${tftpserverip} != \"0.0.0.0\"; then "\
+ "if test ${ethact} != \"\"; then " \
+ "run netroot_boot ; " \
+ "run dhcp_boot ; " \
+ "fi ; " \
+ "fi\0" \
+ \
+ "mmc_boot=mmc init ${devnum}; "\
+ "setenv devtype mmc; "\
+ "setenv devname mmcblk${devnum}p; "\
+ "run ext2_boot\0"\
+ "mmc0_boot=setenv devnum 0; "\
+ "run mmc_boot\0"\
+ "mmc1_boot=setenv devnum 1; "\
+ "run mmc_boot\0"
+
+/*
+ * Our developer-friendly boot process tries a number of things in sequence
+ * until it finds a kernel. Network booting is tried first if we have Ethernet.
+ *
+ * NOTE: we purposely only issue a 'usb start' once per USB port to avoid
+ * <http://crosbug.com/15206>. This has the side effect that a USB stick on
+ * usb 0 will override a network adapter on usb 1. For now, we'll have to
+ * live with that.
+ */
+#define CONFIG_BOOTCOMMAND \
+ "usb start 0 ; " \
+ "run net_boot ; " \
+ "run usb_boot ; " \
+ \
+ "setenv ethact '' ; " \
+ "if usb start 1 ; then " \
+ "run net_boot ; " \
+ "run usb_boot ; " \
+ "fi ; " \
+ \
+ "run mmc1_boot ; " \
+ "run mmc0_boot"
+
+
+#endif //__configs_chromeos_tegra2_legacy_h__
diff --git a/tegra2/seaboard/legacy.h b/tegra2/seaboard/legacy.h
new file mode 100644
index 0000000..0504e08
--- /dev/null
+++ b/tegra2/seaboard/legacy.h
@@ -0,0 +1,18 @@
+/*
+ * Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef __configs_chromeos_tegra2_seaboard_legacy_h__
+#define __configs_chromeos_tegra2_seaboard_legacy_h__
+
+#include <configs/chromeos/tegra2/legacy.h>
+#include <configs/chromeos/tegra2/seaboard/common.h>
+
+#include <configs/chromeos/tegra2/seaboard/parts/nand.h>
+#include <configs/chromeos/tegra2/seaboard/parts/usb.h>
+
+#define CONFIG_CMD_CROS_TPM
+
+#endif /*__configs_chromeos_tegra2_seaboard_legacy_h__*/
diff --git a/tegra2/wario/legacy.h b/tegra2/wario/legacy.h
new file mode 100644
index 0000000..1d1fa2d
--- /dev/null
+++ b/tegra2/wario/legacy.h
@@ -0,0 +1,15 @@
+/*
+ * Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef __configs_chromeos_tegra2_wario_legacy_h__
+#define __configs_chromeos_tegra2_wario_legacy_h__
+
+#include <configs/chromeos/tegra2/legacy.h>
+#include <configs/chromeos/tegra2/wario/common.h>
+
+#include <configs/chromeos/tegra2/wario/parts/usb.h>
+
+#endif /*__configs_chromeos_tegra2_wario_legacy_h__*/