2 * Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file.
7 #ifndef __configs_chromeos_h__
8 #define __configs_chromeos_h__
11 * This config file defines platform-independent settings that a verified boot
15 /* Stringify a token */
16 #define _STRINGIFY(x) #x
17 #define STRINGIFY(x) _STRINGIFY(x)
19 /* Enable verified boot */
20 #define CONFIG_CHROMEOS
22 /* Enable test codes */
24 #define CONFIG_CHROMEOS_TEST
25 #endif /* VBOOT_DEBUG */
27 /* Enable graphics display */
28 #define CONFIG_LCD_BMP_RLE8
30 #define CONFIG_SPLASH_SCREEN
32 /* Support constant vboot flag from fdt */
33 #define CONFIG_CHROMEOS_CONST_FLAG
36 * Use the fdt to decide whether to load the environment early in start-up
37 * (even before we decide if we're entering developer mode).
39 #define CONFIG_OF_LOAD_ENVIRONMENT
42 * Enable this feature to embed crossystem data into device tree before booting
46 * TODO If x86 firmware does not embedding crossystem data in a device tree (and
47 * pass the tree to kernel) but uses ACPI or whatever instead, move this to
48 * chromeos_tegra2_twostop.h.
50 #define CONFIG_OF_UPDATE_FDT_BEFORE_BOOT
53 * This is the default kernel command line to a Chrome OS kernel. An ending
54 * space character helps us concatenate more arguments.
56 #ifndef CONFIG_BOOTARGS
57 #define CONFIG_BOOTARGS
59 #define CHROMEOS_BOOTARGS "cros_secure " CONFIG_BOOTARGS " "
61 /*******************************************************************************
62 * Non-verified boot script *
63 ******************************************************************************/
66 * Defines the regen_all variable, which is used by other commands
67 * defined in this file. Usage is to override one or more of the environment
68 * variables and then run regen_all to regenerate the environment.
70 * Args from other scipts in this file:
71 * bootdev_bootargs: Filled in by other commands below based on the boot
75 * common_bootargs: A copy of the default bootargs so we can run regen_all
77 * dev_extras: Placeholder space for developers to put their own boot args.
78 * extra_bootargs: Filled in by update_firmware_vars.py script in some cases.
80 #define CONFIG_REGEN_ALL_SETTINGS \
81 "common_bootargs=cros_legacy " CONFIG_DIRECT_BOOTARGS "\0" \
85 "bootdev_bootargs=\0" \
89 "${common_bootargs} " \
91 "${extra_bootargs} " \
92 "${bootdev_bootargs}\0"
95 * Defines ext2_boot and run_disk_boot_script.
97 * The run_disk_boot_script runs a u-boot script on the boot disk. At the
98 * moment this is used to allow the boot disk to choose a partion to boot from,
99 * but could theoretically be used for more complicated things.
101 * The ext2_boot script boots from an ext2 device.
103 * Args from other scipts in this file:
104 * devtype: The device type we're booting from, like "usb" or "mmc"
105 * devnum: The device number (depends on devtype). If we're booting from
106 * extranal MMC (for instance), this would be 1
107 * devname: The linux device name that will be assigned, like "sda" or
110 * Args expected to be set by the u-boot script in /u-boot/boot.scr.uimg:
111 * rootpart: The root filesystem partion; we default to 3 in case there are
112 * problems reading the boot script.
113 * cros_bootfile: The name of the kernel in the root partition; we default to
114 * "/boot/vmlinux.uimg"
117 * script_part: The FAT partion we'll look for a boot script in.
118 * script_img: The name of the u-boot script.
120 * When we boot from an ext2 device, we will look at partion 12 (0x0c) to find
121 * a u-boot script (as /u-boot/boot.scr.uimg). That script is expected to
122 * override "rootpart" and "cros_bootfile" as needed to select which partition
125 * USB download support:
127 * Once we have loaded the kernel from the selected device successfully,
128 * we check whether a kernel has in fact been provided through the USB
129 * download feature. In that case the kernaddr environment variable will
130 * be set. It might seem strange that we load the original kernel and
131 * then ignore it, but we try to load the kernel from a number of different
132 * places. If the USB disk fails (because there is no disk inserted or
133 * it is invalid) we don't want to pull in the kernaddr kernel and boot it
134 * with USB as the root disk. So allow the normal boot failover to occur,
135 * and only insert the kernaddr kernel when we actually have decided
138 #define CONFIG_EXT2_BOOT_HELPER_SETTINGS \
140 "cros_bootfile=/boot/vmlinux.uimg\0" \
143 "script_img=/u-boot/boot.scr.uimg\0" \
145 "run_disk_boot_script=" \
146 "if fatload ${devtype} ${devnum}:${script_part} " \
147 "${loadaddr} ${script_img}; then " \
148 "source ${loadaddr}; " \
151 "regen_ext2_bootargs=" \
152 "setenv bootdev_bootargs " \
153 "root=/dev/${devname}${rootpart} rootwait ro; " \
157 "run regen_ext2_bootargs; " \
158 "if ext2load ${devtype} ${devnum}:${rootpart} " \
159 "${loadaddr} ${cros_bootfile}; then " \
160 "if test ${kernaddr} != \"\"; then "\
161 "echo \"Using bundled kernel\"; "\
162 "bootm ${kernaddr};" \
164 "bootm ${loadaddr};" \
168 * Network-boot related settings.
170 * At the moment, we support full network root booting (tftp kernel and initial
171 * ramdisk) as well as nfs booting (tftp kernel and point root to NFS).
173 * Network booting is enabled if you have an ethernet adapter plugged in at boot
174 * and also have set tftpserverip/nfsserverip to something other than 0.0.0.0.
175 * For full network booting you just need tftpserverip. For full NFS root
176 * you neet to set both.
178 #define CONFIG_NETBOOT_SETTINGS \
179 "tftpserverip=0.0.0.0\0" \
180 "nfsserverip=0.0.0.0\0" \
182 "rootaddr=" STRINGIFY(CONFIG_INITRD_ADDRESS) "\0" \
183 "initrd_high=0xffffffff\0" \
185 "regen_nfsroot_bootargs=" \
186 "setenv bootdev_bootargs " \
187 "dev=/dev/nfs4 rw nfsroot=${nfsserverip}:${rootpath} " \
188 "ip=dhcp noinitrd; " \
190 "regen_initrdroot_bootargs=" \
191 "setenv bootdev_bootargs " \
192 "rw root=/dev/ram0 ramdisk_size=294912; " \
196 "setenv tftpkernelpath " \
197 "/tftpboot/vmlinux.uimg; " \
198 "setenv tftprootpath " \
199 "/tftpboot/initrd.uimg; " \
201 "/export/nfsroot; " \
202 "setenv autoload n\0" \
205 "run regen_initrdroot_bootargs; " \
207 "if tftpboot ${rootaddr} ${tftpserverip}:${tftprootpath} && " \
208 " tftpboot ${loadaddr} ${tftpserverip}:${tftpkernelpath}; " \
210 "bootm ${loadaddr} ${rootaddr}; " \
212 "echo 'ERROR: Could not load root/kernel from TFTP'; " \
217 "run regen_ext2_bootargs; " \
219 "if tftpboot ${loadaddr} ${tftpserverip}:${tftpkernelpath}; " \
221 "bootm ${loadaddr}; " \
223 "echo 'ERROR: Could not load kernel from TFTP'; " \
228 "run regen_nfsroot_bootargs; " \
230 "if tftpboot ${loadaddr} ${tftpserverip}:${tftpkernelpath}; " \
232 "bootm ${loadaddr}; " \
234 "echo 'ERROR: Could not load kernel from TFTP'; " \
239 "if test ${ethact} != \"\"; then " \
240 "if test ${tftpserverip} != \"0.0.0.0\"; then " \
241 "run initrdroot_boot; " \
242 "if test ${nfsserverip} != \"0.0.0.0\"; then " \
243 "run nfsroot_boot; " \
249 * Our full set of extra enviornment variables.
252 * - Right now, we can only boot from one USB device. Need to fix this once
254 * - We define "non_verified_boot", which is the normal boot command unless
255 * it is overridden in the FDT.
256 * - When we're running securely, the FDT will specify to call vboot_twostop
260 #define CONFIG_CHROMEOS_EXTRA_ENV_SETTINGS \
261 CONFIG_STD_DEVICES_SETTINGS \
262 CONFIG_REGEN_ALL_SETTINGS \
263 CONFIG_EXT2_BOOT_HELPER_SETTINGS \
264 CONFIG_NETBOOT_SETTINGS \
266 "usb_boot=setenv devtype usb; " \
267 "setenv devnum 0; " \
268 "setenv devname sda; " \
269 "run run_disk_boot_script;" \
273 "mmc dev ${devnum}; " \
274 "mmc rescan ${devnum}; " \
275 "setenv devtype mmc; " \
276 "setenv devname mmcblk${devnum}p\0" \
279 "run run_disk_boot_script;" \
281 "mmc0_boot=setenv devnum 0; " \
283 "mmc1_boot=setenv devnum 1; " \
285 "mmc0_tftpboot=setenv devnum 0; " \
287 "run tftp_ext2_boot\0" \
289 "non_verified_boot=" \
297 #define CONFIG_NON_VERIFIED_BOOTCOMMAND "run non_verified_boot"
299 #endif /* __configs_chromeos_h__ */