bootstd: Add a bootmeth for ChromiumOS on x86
Subsystems (5)
v3 cover bootstd: Add a bootmeth for ChromiumOS on x86
This series adds a simple bootmeth for ChromiumOS on x86. It uses zimage to boot the kernel.
Full verified boot is not included at this stage - that is still a separate chunk of code to be brought into standard boot at some point. For now it just obtains the kernel and command line and boots. This should be enough to boot Chrome OS from coreboot on all x86 machines in circulation, although only Brya (2022) and Coral (2017) have been tested.
ChromiumOS needs quite large kernel parameters, to hold the DM verity settings and other pieces. This makes it painful to modify just one parameter, since the whole cmdline must be adjusted at once. To cope with this, a new cmdline-editing feature is provided: the 'bootflow cmdline' command allows individual parameters to be added, modified and deleted.
To deal with enabling debug console, a variant supports setting 'earlycon' and 'console' automatically. The 'bdinfo' command is updated to show serial-port info also.
Booting the zimage is now done programmatically, rather than running through the command-line interface. Minor tweaks are made to the coreboot and coral config so that booting works correctly.
Note that the ACPI tables are not updated with the required firmware information in this series, so a warning is shown on boot. This will be addressed later since it requires quite a bit of configuration.
Finally, this fixes a recently introduced bug in unit testing and updates the algorithm to avoid running flat-tree tests which don't actually use the devicetree.
Changes in v3:
- Drop CONFIG_MISC and CONFIG_NVMEM
- Update commit message
- Separate out patch to restore test behaviour on failure
Changes in v2:
- Update host_bootdev.c too
- Correct 'it not known' typo
- Explain why the setup information is not behind an #ifdef
- Add comment for copy_in()
- Avoid multiplication on a boolean
- Add a comment as to why @len is needed
- Show error messages when something goes wrong
- Add new patch to create a little more room for U-Boot on qemu-x86_64
- Add new patch to switch x86 qemu to standard boot
- Drop mention of NVMe support
Simon Glass (18):
test: Skip flat-tree tests if devicetree is not used
bootstd: Correct the name of the QEMU bootmeth
bootstd: Use bootdev instead of bootdevice
bootstd: Correct baudrate typo
bootstd: Allow storing the OS command line in the bootflow
bootstd: Use the bootargs env var for changing the cmdline
bootstd: Allow storing x86 setup information
bdinfo: Show information about the serial port
bootstd: Add a function to update a command line
bootstd: Add support for updating elements of the cmdline
x86: qemu: Create a little more room for U-Boot
x86: qemu: Switch to standard boot
bootstd: Support automatically setting Linux parameters
x86: Add a function to boot a zimage
x86: zimage: Export the function to obtain the cmdline
bootstd: Add a simple bootmeth for ChromiumOS
x86: coreboot: Adjust various config options
x86: coral: Adjust various config options
arch/x86/include/asm/zimage.h | 27 +++ arch/x86/lib/zimage.c | 93 ++++++-- boot/Kconfig | 11 + boot/Makefile | 1 + boot/bootflow.c | 339 ++++++++++++++++++++++++++++- boot/bootmeth-uclass.c | 2 +- boot/bootmeth_cros.c | 212 ++++++++++++++++++ boot/bootmeth_qfw.c | 2 +- cmd/bdinfo.c | 21 ++ cmd/bootflow.c | 87 +++++++- configs/chromebook_coral_defconfig | 10 +- configs/coreboot_defconfig | 14 +- configs/qemu-x86_64_defconfig | 5 +- configs/qemu-x86_defconfig | 2 +- configs/tools-only_defconfig | 1 + doc/usage/cmd/bootflow.rst | 100 ++++++++- drivers/mmc/mmc_bootdev.c | 2 +- drivers/scsi/scsi_bootdev.c | 2 +- drivers/usb/host/usb_bootdev.c | 2 +- fs/sandbox/host_bootdev.c | 2 +- include/bootdev.h | 2 +- include/bootflow.h | 100 ++++++++- include/configs/qemu-x86.h | 8 - include/env_callback.h | 6 +- net/eth_bootdev.c | 2 +- test/boot/bootflow.c | 263 ++++++++++++++++++++++ test/test-main.c | 3 +- 27 files changed, 1263 insertions(+), 56 deletions(-) create mode 100644 boot/bootmeth_cros.c
Signature · 1 line
2.41.0.390.g38632f3daf-goog
PATCH v3 1/18 test: Skip flat-tree tests if devicetree is not used
Many tests don't actually use the devicetree at all so there is no point in running the tests both with livetree and flat tree. Check for this and skip the flat tree test in that case.
---
(no changes since v1)
test/test-main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
test/test-main.c +2 -1
@@ -476,7 +476,8 @@ static int ut_run_test_live_flat(struct unit_test_state *uts,* (for sandbox we handle this by copying the tree, but not for other * boards) */ - if (!(test->flags & UT_TESTF_LIVE_TREE) && + if ((test->flags & UT_TESTF_SCAN_FDT) && + !(test->flags & UT_TESTF_LIVE_TREE) && (CONFIG_IS_ENABLED(OFNODE_MULTI_TREE) || !(test->flags & UT_TESTF_OTHER_FDT)) && (!runs || ut_test_run_on_flattree(test)) &&
Signature · 1 line
2.41.0.390.g38632f3daf-goog
PATCH v3 2/18 bootstd: Correct the name of the QEMU bootmeth
In reply to Simon GlassThis does not relate to sandbox. Correct the name.
---
(no changes since v1)
boot/bootmeth_qfw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
boot/bootmeth_qfw.c +1 -1
@@ -76,7 +76,7 @@ static int qfw_bootmeth_bind(struct udevice *dev) {struct bootmeth_uc_plat *plat =dev_get_uclass_plat (dev); - plat->desc ="Sandbox boot for testing" ; + plat->desc ="QEMU boot using firmware interface" ;return 0 ; }
Signature · 1 line
2.41.0.390.g38632f3daf-goog
PATCH v3 3/18 bootstd: Use bootdev instead of bootdevice
In reply to Simon GlassIt seems better to call this a 'bootdev' since this is name used in the documentation. The older 'Bootdevice' name is no-longer used and may cause confusion with the 'bootdevice' environment variable.
Update throughout to use bootdev.
---
(no changes since v2)
Changes in v2:
- Update host_bootdev.c too
boot/bootflow.c | 4 ++-- drivers/mmc/mmc_bootdev.c | 2 +- drivers/scsi/scsi_bootdev.c | 2 +- drivers/usb/host/usb_bootdev.c | 2 +- fs/sandbox/host_bootdev.c | 2 +- include/bootdev.h | 2 +- include/bootflow.h | 2 +- net/eth_bootdev.c | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-)
boot/bootflow.c +2 -2
@@ -315,14 +315,14 @@ static int bootflow_check(struct bootflow_iter *iter, struct bootflow *bflow)/* If we got a valid bootflow, return it */ if (!ret) { -log_debug ("Bootdevice '%s' part %d method '%s': Found bootflow\n" , +log_debug ("Bootdev '%s' part %d method '%s': Found bootflow\n" , dev->name, iter->part, iter->method->name);return 0 ; }/* Unless there is nothing more to try, move to the next device */ else if (ret !=BF_NO_MORE_PARTS && ret != -ENOSYS ) { -log_debug ("Bootdevice '%s' part %d method '%s': Error %d\n" , +log_debug ("Bootdev '%s' part %d method '%s': Error %d\n" , dev->name, iter->part, iter->method->name, ret);/* * For 'all' we return all bootflows, even
drivers/mmc/mmc_bootdev.c +1 -1
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0+ /* -* Bootdevice for MMC +* Bootdev for MMC * * Copyright 2021 Google LLC * Written by Simon Glass <[email protected]>
drivers/scsi/scsi_bootdev.c +1 -1
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0+ /* -* Bootdevice for USB +* Bootdev for SCSI * * Copyright 2021 Google LLC * Written by Simon Glass <[email protected]>
drivers/usb/host/usb_bootdev.c +1 -1
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0+ /* -* Bootdevice for USB +* Bootdev for USB * * Copyright 2021 Google LLC * Written by Simon Glass <[email protected]>
fs/sandbox/host_bootdev.c +1 -1
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0+ /* -* Bootdevice for MMC +* Bootdev for sandbox host * * Copyright 2021 Google LLC * Written by Simon Glass <[email protected]>
include/bootdev.h +1 -1
@@ -200,7 +200,7 @@ void bootdev_clear_bootflows(struct udevice *dev);* All fields in @bflow must be set up. Note that @bflow->dev is used to add the * bootflow to that device. * -* @dev: Bootdevice device to add to +* @dev: Bootdev device to add to * @bflow: Bootflow to add. Note that fields within bflow must be allocated * since this function takes over ownership of these. This functions makes * a copy of @bflow itself (without allocating its fields again), so the
include/bootflow.h +1 -1
@@ -58,7 +58,7 @@ enum bootflow_flags_t {* * @bm_node: Points to siblings in the same bootdev * @glob_node: Points to siblings in the global list (all bootdev) -* @dev: Bootdevice device which produced this bootflow +* @dev: Bootdev device which produced this bootflow * @blk: Block device which contains this bootflow, NULL if this is a network * device or sandbox 'host' device * @part: Partition number (0 for whole device)
net/eth_bootdev.c +1 -1
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0+ /* -* Bootdevice for ethernet (uses PXE) +* Bootdev for ethernet (uses PXE) * * Copyright 2021 Google LLC * Written by Simon Glass <[email protected]>
Signature · 1 line
2.41.0.390.g38632f3daf-goog
PATCH v3 4/18 bootstd: Correct baudrate typo
In reply to Simon GlassThis is a copy error. Fix it.
---
(no changes since v1)
boot/bootmeth-uclass.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
boot/bootmeth-uclass.c +1 -1
@@ -421,7 +421,7 @@ int bootmeth_common_read_file(struct udevice *dev, struct bootflow *bflow,/** * on_bootmeths() - Update the bootmeth order * -* This will check for a valid baudrate and only apply it if valid. +* This will check for a valid list of bootmeths and only apply it if valid. */ static int on_bootmeths (const char *name,const char *value,enum env_op op,int flags)
Signature · 1 line
2.41.0.390.g38632f3daf-goog
PATCH v3 5/18 bootstd: Allow storing the OS command line in the bootflow
In reply to Simon GlassSome operating systems have a command line which can be adjusted before booting. Store this in the bootflow so it can be controlled within U-Boot.
Fix up the example output while we are here, since there are a few new items.
---
(no changes since v2)
Changes in v2:
- Correct 'it not known' typo
cmd/bootflow.c | 6 ++++++ doc/usage/cmd/bootflow.rst | 5 ++++- include/bootflow.h | 2 ++ test/boot/bootflow.c | 1 + 4 files changed, 13 insertions(+), 1 deletion(-)
cmd/bootflow.c +6 -0
@@ -324,6 +324,12 @@ static int do_bootflow_info(struct cmd_tbl *cmdtp, int flag, int argc,printf ("Buffer: %lx\n" , (ulong )map_to_sysmem (bflow->buf));printf ("Size: %x (%d bytes)\n" , bflow->size, bflow->size);printf ("OS: %s\n" , bflow->os_name ? bflow->os_name :"(none)" ); +printf ("Cmdline: " ); +if (bflow->cmdline) +puts (bflow->cmdline); +else +puts ("(none)" ); +putc ('\n' );printf ("Logo: %s\n" , bflow->logo ?simple_xtoa ((ulong )map_to_sysmem (bflow->logo)) :"(none)" );if (bflow->logo) {
doc/usage/cmd/bootflow.rst +4 -1
@@ -258,7 +258,6 @@ displayed and booted:: Name: [email protected]_2 Device: [email protected] Block dev: [email protected] - Sequence: 1 Method: distro State: ready Partition: 2
@@ -266,6 +265,10 @@ displayed and booted:: Filename: extlinux/extlinux.conf Buffer: 3db7ae88 Size: 232 (562 bytes) + OS: Fedora-Workstation-armhfp-31-1.9 (5.3.7-301.fc31.armv7hl) + Cmdline: (none) + Logo: (none) + FDT: <NULL> Error: 0 U-Boot> bootflow boot ** Booting bootflow 'smsc95xx_eth.bootdev.0'
include/bootflow.h +2 -0
@@ -81,6 +81,7 @@ enum bootflow_flags_t {* @fdt_size: Size of FDT file * @fdt_addr: Address of loaded fdt * @flags: Flags for the bootflow (see enum bootflow_flags_t) +* @cmdline: OS command line, or NULL if not known (allocated) */ struct bootflow {struct list_head bm_node;
@@ -104,6 +105,7 @@ struct bootflow {int fdt_size;ulong fdt_addr;int flags; +char *cmdline; };/**
test/boot/bootflow.c +1 -0
@@ -226,6 +226,7 @@ static int bootflow_cmd_info(struct unit_test_state *uts)ut_assert_nextlinen ("Buffer: " );ut_assert_nextline ("Size: 253 (595 bytes)" );ut_assert_nextline ("OS: Fedora-Workstation-armhfp-31-1.9 (5.3.7-301.fc31.armv7hl)" ); +ut_assert_nextline ("Cmdline: (none)" );ut_assert_nextline ("Logo: (none)" );ut_assert_nextline ("FDT: <NULL>" );ut_assert_nextline ("Error: 0" );
Signature · 1 line
2.41.0.390.g38632f3daf-goog
PATCH v3 6/18 bootstd: Use the bootargs env var for changing the cmdline
In reply to Simon GlassThe "bootargs" environment variable is used to set the command-line arguments to pass to the OS. Use this same mechanism with bootstd as well. When the variable is updated, it is written to the current bootflow. When the current bootflow is updated, the environment variable is updated too.
---
(no changes since v1)
boot/bootflow.c | 59 ++++++++++++++++++++++++++++++++++++++++++ cmd/bootflow.c | 6 +++++ include/env_callback.h | 6 +++-- 3 files changed, 69 insertions(+), 2 deletions(-)
boot/bootflow.c +59 -0
@@ -12,6 +12,7 @@#include <bootmeth.h> #include <bootstd.h> #include <dm.h> +#include <env_internal.h> #include <malloc.h> #include <dm/device-internal.h> #include <dm/uclass-internal.h>
@@ -552,3 +553,61 @@ int bootflow_iter_check_system(const struct bootflow_iter *iter)return -ENOTSUPP ; } + +/** +* bootflow_cmdline_set() - Set the command line for a bootflow +* +* @value: New command-line string +* Returns 0 if OK, -ENOENT if no current bootflow, -ENOMEM if out of memory +*/ +int bootflow_cmdline_set (struct bootflow *bflow,const char *value) +{ +char *cmdline =NULL ; + +if (value) { + cmdline =strdup (value); +if (!cmdline) +return -ENOMEM ; + } + +free (bflow->cmdline); + bflow->cmdline = cmdline; + +return 0 ; +} + +#ifdef CONFIG_BOOTSTD_FULL +/** +* on_bootargs() - Update the cmdline of a bootflow +*/ +static int on_bootargs (const char *name,const char *value,enum env_op op, +int flags) +{ +struct bootstd_priv *std; +struct bootflow *bflow; +int ret; + + ret =bootstd_get_priv (&std); +if (ret) +return 0 ; + bflow = std->cur_bootflow; +if (!bflow) +return 0 ; + +switch (op) { +case env_op_create: +case env_op_overwrite: + ret =bootflow_cmdline_set (bflow, value); +if (ret && ret !=ENOENT ) +return 1 ; +return 0 ; +case env_op_delete: +bootflow_cmdline_set (bflow,NULL ); + fallthrough; +default : +return 0 ; + } +} +U_BOOT_ENV_CALLBACK (bootargs, on_bootargs); +#endif +
cmd/bootflow.c +6 -0
@@ -288,6 +288,12 @@ static int do_bootflow_select(struct cmd_tbl *cmdtp, int flag, int argc,return CMD_RET_FAILURE ; } std->cur_bootflow = found; +if (IS_ENABLED (CONFIG_BOOTSTD_FULL )) { +if (env_set ("bootargs" , found->cmdline)) { +printf ("Cannot set bootargs\n" ); +return CMD_RET_FAILURE ; + } + }return 0 ; }
include/env_callback.h +4 -2
@@ -60,8 +60,10 @@#define NET6_CALLBACKS #endif -#ifdef CONFIG_BOOTSTD -#define BOOTSTD_CALLBACK "bootmeths:bootmeths," +#ifdef CONFIG_BOOTSTD_FULL +#define BOOTSTD_CALLBACK \ + "bootmeths:bootmeths," \ + "bootargs:bootargs,"#else #define BOOTSTD_CALLBACK #endif
Signature · 1 line
2.41.0.390.g38632f3daf-goog
PATCH v3 7/18 bootstd: Allow storing x86 setup information
In reply to Simon GlassOn x86 boards Linux uses a block of binary data to provide information about the command line, memory map, etc. Provide a way to store this in the bootflow so it can be passed on to the OS.
No attempt is made to generalise the code, since other archs don't need this information. The field is present always, though, to avoid needing accessors or #ifdefs when building code on other archs.
---
(no changes since v2)
Changes in v2:
- Explain why the setup information is not behind an #ifdef
cmd/bootflow.c | 2 ++ include/bootflow.h | 2 ++ 2 files changed, 4 insertions(+)
cmd/bootflow.c +2 -0
@@ -336,6 +336,8 @@ static int do_bootflow_info(struct cmd_tbl *cmdtp, int flag, int argc,else puts ("(none)" );putc ('\n' ); +if (bflow->x86_setup) +printf ("X86 setup: %p\n" , bflow->x86_setup);printf ("Logo: %s\n" , bflow->logo ?simple_xtoa ((ulong )map_to_sysmem (bflow->logo)) :"(none)" );if (bflow->logo) {
include/bootflow.h +2 -0
@@ -82,6 +82,7 @@ enum bootflow_flags_t {* @fdt_addr: Address of loaded fdt * @flags: Flags for the bootflow (see enum bootflow_flags_t) * @cmdline: OS command line, or NULL if not known (allocated) +* @x86_setup: Pointer to x86 setup block inside @buf, NULL if not present */ struct bootflow {struct list_head bm_node;
@@ -106,6 +107,7 @@ struct bootflow {ulong fdt_addr;int flags;char *cmdline; +char *x86_setup; };/**
Signature · 1 line
2.41.0.390.g38632f3daf-goog
PATCH v3 8/18 bdinfo: Show information about the serial port
In reply to Simon GlassIt is useful to see the detailed setting of the serial port, e.g. to allow setting up earlycon or console for Linux. Add this output to the 'bdinfo' command.
---
(no changes since v1)
cmd/bdinfo.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
cmd/bdinfo.c +21 -0
@@ -13,6 +13,7 @@#include <lmb.h> #include <mapmem.h> #include <net.h> +#include <serial.h> #include <video.h> #include <vsprintf.h> #include <asm/cache.h>
@@ -113,6 +114,25 @@ static void show_video_info(void) } } +static void print_serial (struct udevice *dev) +{ +struct serial_device_info info; +int ret; + +if (!dev || !IS_ENABLED (CONFIG_DM_SERIAL )) +return ; + + ret =serial_getinfo (dev, &info); +if (ret) +return ; + +bdinfo_print_num_l ("serial addr" , info.addr); +bdinfo_print_num_l (" width" , info.reg_width); +bdinfo_print_num_l (" shift" , info.reg_shift); +bdinfo_print_num_l (" offset" , info.reg_offset); +bdinfo_print_num_l (" clock" , info.clock); +} +int do_bdinfo (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) {struct bd_info *bd = gd->bd;
@@ -151,6 +171,7 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])if (IS_ENABLED (CONFIG_OF_REAL ))printf ("devicetree = %s\n" ,fdtdec_get_srcname ()); } +print_serial (gd->cur_serial_dev);arch_print_bdinfo ();
Signature · 1 line
2.41.0.390.g38632f3daf-goog
PATCH v3 9/18 bootstd: Add a function to update a command line
In reply to Simon GlassThe Linux command line consists of a number of words with optional values. At present U-Boot allows this to be changed using the bootargs environment variable.
But this is quite painful, since the command line can be very long.
Add a function which can adjust a single field in the command line, so that it is easier to make changes before booting.
---
(no changes since v2)
Changes in v2:
- Add comment for copy_in()
- Avoid multiplication on a boolean
- Add a comment as to why @len is needed
boot/bootflow.c | 190 +++++++++++++++++++++++++++++++++++++++++++ include/bootflow.h | 40 +++++++++ test/boot/bootflow.c | 154 +++++++++++++++++++++++++++++++++++ 3 files changed, 384 insertions(+)
boot/bootflow.c +190 -0
@@ -611,3 +611,193 @@ static int on_bootargs(const char *name, const char *value, enum env_op op,U_BOOT_ENV_CALLBACK (bootargs, on_bootargs);#endif +/** +* copy_in() - Copy a string into a cmdline buffer +* +* @buf: Buffer to copy into +* @end: End of buffer (pointer to char after the end) +* @arg: String to copy from +* @len: Number of chars to copy from @arg (note that this is not usually the +* sane as strlen(arg) since the string may contain following arguments) +* @new_val: Value to put after arg, or BOOTFLOWCL_EMPTY to use an empty value +* with no '=' sign +* Returns: Number of chars written to @buf +*/ +static int copy_in (char *buf,char *end,const char *arg,int len, +const char *new_val) +{ +char *to = buf; + +/* copy the arg name */ +if (to + len >= end) +return -E2BIG ; +memcpy (to, arg, len); + to += len; + +if (new_val ==BOOTFLOWCL_EMPTY ) { +/* no value */ + }else { +bool need_quote =strchr (new_val,' ' ); + len =strlen (new_val); + +/* need space for value, equals sign and maybe two quotes */ +if (to +1 + (need_quote ?2 :0 ) + len >= end) +return -E2BIG ; + *to++ ='=' ; +if (need_quote) + *to++ ='"' ; +memcpy (to, new_val, len); + to += len; +if (need_quote) + *to++ ='"' ; + } + +return to - buf; +} + +int cmdline_set_arg (char *buf,int maxlen,const char *cmdline, +const char *set_arg,const char *new_val,int *posp) +{ +bool found_arg = false; +const char *from; +char *to, *end; +int set_arg_len; +char empty ='\0' ; +int ret; + + from = cmdline ?: ∅ + +/* check if the value has quotes inside */ +if (new_val && new_val !=BOOTFLOWCL_EMPTY &&strchr (new_val,'"' )) +return -EBADF ; + + set_arg_len =strlen (set_arg); +for (to = buf, end = buf + maxlen; *from;) { +const char *val, *arg_end, *val_end, *p; +bool in_quote; + +if (to >= end) +return -E2BIG ; +while (*from ==' ' ) + from++; +if (!*from) +break ; + +/* find the end of this arg */ + val =NULL ; + arg_end =NULL ; + val_end =NULL ; + in_quote = false; +for (p = from;; p++) { +if (in_quote) { +if (!*p) +return -EINVAL ; +if (*p =='"' ) + in_quote = false; +continue ; + } +if (*p =='=' ) { + arg_end = p; + val = p +1 ; + }else if (*p =='"' ) { + in_quote = true; + }else if (!*p || *p ==' ' ) { + val_end = p; +if (!arg_end) + arg_end = p; +break ; + } + } +/* +* At this point val_end points to the end of the value, or the +* last char after the arg name, if there is no label. +* arg_end is the char after the arg name +* val points to the value, or NULL if there is none +* char after the value. +* +* fred=1234 +* ^ ^^ ^ +* from || | +* / \ \ +* arg_end val val_end +*/ +log_debug ("from %s arg_end %ld val %ld val_end %ld\n" , from, + (long )(arg_end - from), (long )(val - from), + (long )(val_end - from)); + +if (to != buf) { +if (to >= end) +return -E2BIG ; + *to++ =' ' ; + } + +/* if this is the target arg, update it */ +if (!strncmp (from, set_arg, arg_end - from)) { +if (!buf) { +bool has_quote = val_end[-1 ] =='"' ; + +/* +* exclude any start/end quotes from +* calculations +*/ +if (!val) + val = val_end; + *posp = val - cmdline + has_quote; +return val_end - val -2 * has_quote; + } + found_arg = true; +if (!new_val) { +/* delete this arg */ + from = val_end + (*val_end ==' ' ); +log_debug ("delete from: %s\n" , from); +if (to != buf) + to--;/* drop the space we added */ +continue ; + } + + ret =copy_in (to, end, from, arg_end - from, new_val); +if (ret <0 ) +return ret; + to += ret; + +/* if not the target arg, copy it unchanged */ + }else if (to) { +int len; + + len = val_end - from; +if (to + len >= end) +return -E2BIG ; +memcpy (to, from, len); + to += len; + } + from = val_end; + } + +/* If we didn't find the arg, add it */ +if (!found_arg) { +/* trying to delete something that is not there */ +if (!new_val || !buf) +return -ENOENT ; +if (to >= end) +return -E2BIG ; + +/* add a space to separate it from the previous arg */ +if (to != buf && to[-1 ] !=' ' ) + *to++ =' ' ; + ret =copy_in (to, end, set_arg, set_arg_len, new_val); +log_debug ("ret=%d, to: %s buf: %s\n" , ret, to, buf); +if (ret <0 ) +return ret; + to += ret; + } + +/* delete any trailing space */ +if (to > buf && to[-1 ] ==' ' ) + to--; + +if (to >= end) +return -E2BIG ; + *to++ ='\0' ; + +return to - buf; +}
include/bootflow.h +40 -0
@@ -444,4 +444,44 @@ int bootflow_menu_apply_theme(struct expo *exp, ofnode node);int bootflow_menu_run (struct bootstd_priv *std,bool text_mode,struct bootflow **bflowp); +#define BOOTFLOWCL_EMPTY ((void *)1) + +/** +* cmdline_set_arg() - Update or read an argument in a cmdline string +* +* Handles updating a single arg in a cmdline string, returning it in a supplied +* buffer; also reading an arg from a cmdline string +* +* When updating, consecutive spaces are squashed as are spaces at the start and +* end. +* +* @buf: Working buffer to use (initial contents are ignored). Use NULL when +* reading +* @maxlen: Length of working buffer. Use 0 when reading +* @cmdline: Command line to update, in the form: +* +* fred mary= jane=123 john="has spaces" +* +* @set_arg: Argument to set or read (may or may not exist) +* @new_val: Value for the new argument. May not include quotes (") but may +* include embedded spaces, in which case it will be quoted when added to the +* command line. Use NULL to delete the argument from @cmdline, BOOTFLOWCL_EMPTY +* to set it to an empty value (no '=' sign after arg), "" to add an '=' sign +* but with an empty value. Use NULL when reading. +* @posp: Ignored when setting an argument; when getting an argument, returns +* the start position of its value in @cmdline, after the first quote, if any +* +* Return: +* For updating: +* length of new buffer (including \0 terminator) on success, -ENOENT if +* @new_val is NULL and @set_arg does not exist in @from, -EINVAL if a +* quoted arg-value in @from is not terminated with a quote, -EBADF if +* @new_val has spaces but does not start and end with quotes (or it has +* quotes in the middle of the string), -E2BIG if @maxlen is too small +* For reading: +* length of arg value (excluding quotes), -ENOENT if not found +*/ +int cmdline_set_arg (char *buf,int maxlen,const char *cmdline, +const char *set_arg,const char *new_val,int *posp); +#endif
test/boot/bootflow.c +154 -0
157 lines not on this page · raw message
Signature · 1 line
2.41.0.390.g38632f3daf-goog
PATCH v3 10/18 bootstd: Add support for updating elements of the cmdline
In reply to Simon GlassAdd a bootflow command to update the command line more easily. This allows changing a particular parameter rather than editing a very long strings. It is also easier to handle with scripting.
The new 'bootflow cmdline' command allows getting and setting single parameters.
Fix up the example output while we are here, since there are a few new items.
---
(no changes since v2)
Changes in v2:
- Show error messages when something goes wrong
boot/bootflow.c | 53 ++++++++++++++++++ cmd/bootflow.c | 70 +++++++++++++++++++++++- doc/usage/cmd/bootflow.rst | 22 +++++++- include/bootflow.h | 42 +++++++++++++++ test/boot/bootflow.c | 108 +++++++++++++++++++++++++++++++++++++ 5 files changed, 293 insertions(+), 2 deletions(-)
boot/bootflow.c +53 -0
@@ -801,3 +801,56 @@ int cmdline_set_arg(char *buf, int maxlen, const char *cmdline,return to - buf; } + +int bootflow_cmdline_set_arg (struct bootflow *bflow,const char *set_arg, +const char *new_val,bool set_env) +{ +char buf[2048 ]; +char *cmd =NULL ; +int ret; + + ret =cmdline_set_arg (buf,sizeof (buf), bflow->cmdline, set_arg, + new_val,NULL ); +if (ret <0 ) +return ret; + + ret =bootflow_cmdline_set (bflow, buf); +if (*buf) { + cmd =strdup (buf); +if (!cmd) +return -ENOMEM ; + } +free (bflow->cmdline); + bflow->cmdline = cmd; + +if (set_env) { + ret =env_set ("bootargs" , bflow->cmdline); +if (ret) +return ret; + } + +return 0 ; +} + +int cmdline_get_arg (const char *cmdline,const char *arg,int *posp) +{ +int ret; + + ret =cmdline_set_arg (NULL ,1 , cmdline, arg,NULL , posp); + +return ret; +} + +int bootflow_cmdline_get_arg (struct bootflow *bflow,const char *arg, +const char **val) +{ +int ret; +int pos; + + ret =cmdline_get_arg (bflow->cmdline, arg, &pos); +if (ret <0 ) +return ret; + *val = bflow->cmdline + pos; + +return ret; +}
cmd/bootflow.c +69 -1
87 lines not on this page · raw message
doc/usage/cmd/bootflow.rst +21 -1
@@ -13,7 +13,7 @@ Synopis bootflow select [<num|name>] bootflow info [-d] bootflow boot - + bootflow cmdline [set|get|clear|delete] <param> [<value>] Description -----------
@@ -198,6 +198,26 @@ bootflow boot This boots the current bootflow. +bootflow cmdline +~~~~~~~~~~~~~~~~ + +Some bootmeths can obtain the OS command line since it is stored with the OS. +In that case, you can use `bootflow cmdline` to adjust this. The command line +is assumed to be in the format used by Linux, i.e. a space-separated set of +parameters with optional values, e.g. "noinitrd console=/dev/tty0". + +To change or add a parameter, use:: + + bootflow cmdline set <param> <value> + +To clear a parameter value to empty you can use "" for the value, or use:: + + bootflow cmdline clear <param> + +To delete a parameter entirely, use:: + + bootflow cmdline delete <param> + Example -------
include/bootflow.h +42 -0
46 lines not on this page · raw message
test/boot/bootflow.c +108 -0
111 lines not on this page · raw message
Signature · 1 line
2.41.0.390.g38632f3daf-goog
PATCH v3 11/18 x86: qemu: Create a little more room for U-Boot
In reply to Simon GlassWe want to enable some of the more interesting bootstd features. Move SPL up to create some room for the larger U-Boot binary. Also disable microcode since this is not needed
---
(no changes since v2)
Changes in v2:
- Add new patch to create a little more room for U-Boot on qemu-x86_64
configs/qemu-x86_64_defconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
configs/qemu-x86_64_defconfig +2 -1
@@ -6,12 +6,13 @@ CONFIG_ENV_SIZE=0x40000 CONFIG_MAX_CPUS=2 CONFIG_SPL_DM_SPI=y CONFIG_DEFAULT_DEVICE_TREE="qemu-x86_i440fx" -CONFIG_SPL_TEXT_BASE=0xfffd0000 +CONFIG_SPL_TEXT_BASE=0xfffd8000 CONFIG_DEBUG_UART_BASE=0x3f8 CONFIG_DEBUG_UART_CLOCK=1843200 CONFIG_X86_RUN_64BIT=y CONFIG_TARGET_QEMU_X86_64=y CONFIG_DEBUG_UART=y +# CONFIG_HAVE_MICROCODE is not set CONFIG_SMP=y CONFIG_GENERATE_PIRQ_TABLE=y CONFIG_GENERATE_MP_TABLE=y
Signature · 1 line
2.41.0.390.g38632f3daf-goog
PATCH v3 12/18 x86: qemu: Switch to standard boot
In reply to Simon GlassDrop use of the distro boot script and use standard boot instead.
Moving to a text-based environment would be desirable also, but requires additional work.
---
(no changes since v2)
Changes in v2:
- Add new patch to switch x86 qemu to standard boot
configs/qemu-x86_64_defconfig | 2 +- configs/qemu-x86_defconfig | 2 +- include/configs/qemu-x86.h | 8 -------- 3 files changed, 2 insertions(+), 10 deletions(-)
configs/qemu-x86_64_defconfig +1 -1
@@ -20,7 +20,7 @@ CONFIG_X86_OFFSET_U_BOOT=0xfff00000 CONFIG_FIT=y CONFIG_SPL_LOAD_FIT=y CONFIG_SYS_MONITOR_BASE=0x01110000 -CONFIG_DISTRO_DEFAULTS=y +CONFIG_BOOTSTD_DEFAULTS=y CONFIG_BOOTSTAGE=y CONFIG_BOOTSTAGE_REPORT=y CONFIG_SHOW_BOOT_PROGRESS=y
configs/qemu-x86_defconfig +1 -1
@@ -9,7 +9,7 @@ CONFIG_SMP=y CONFIG_GENERATE_PIRQ_TABLE=y CONFIG_GENERATE_MP_TABLE=y CONFIG_FIT=y -CONFIG_DISTRO_DEFAULTS=y +CONFIG_BOOTSTD_DEFAULTS=y CONFIG_BOOTSTAGE=y CONFIG_BOOTSTAGE_REPORT=y CONFIG_SHOW_BOOT_PROGRESS=y
include/configs/qemu-x86.h +0 -8
@@ -12,14 +12,6 @@#include <linux/sizes.h> -#define BOOT_TARGET_DEVICES (func) \ - func(USB, usb, 0) \ - func(SCSI, scsi, 0) \ - func(VIRTIO, virtio, 0) \ - func(IDE, ide, 0) \ - func(DHCP, dhcp, na) - -#include <config_distro_bootcmd.h> #include <configs/x86-common.h> #define CFG_STD_DEVICES_SETTINGS "stdin=serial,i8042-kbd\0" \
Signature · 1 line
2.41.0.390.g38632f3daf-goog
PATCH v3 13/18 bootstd: Support automatically setting Linux parameters
In reply to Simon GlassSome Linux parameters can be set automatically by U-Boot, if it knows the device being used. For example, since U-Boot knows the serial console being used, it can add parameters for earlycon and console.
Add support for this.
Note that this is an experimental feature and we will see how useful it turns out to be. It is very handy for ChromeOS, since otherwise it is very difficult to manually determine the UART address or port number, particularly in a script.
Provide an example of how this is used with ChromeOS.
---
(no changes since v1)
boot/bootflow.c | 33 +++++++++++++++++ cmd/bootflow.c | 5 ++- doc/usage/cmd/bootflow.rst | 75 +++++++++++++++++++++++++++++++++++++- include/bootflow.h | 12 ++++++ 4 files changed, 123 insertions(+), 2 deletions(-)
boot/bootflow.c +33 -0
@@ -14,6 +14,7 @@#include <dm.h> #include <env_internal.h> #include <malloc.h> +#include <serial.h> #include <dm/device-internal.h> #include <dm/uclass-internal.h>
@@ -854,3 +855,35 @@ int bootflow_cmdline_get_arg(struct bootflow *bflow, const char *arg,return ret; } + +int bootflow_cmdline_auto (struct bootflow *bflow,const char *arg) +{ +struct serial_device_info info; +char buf[50 ]; +int ret; + + ret =serial_getinfo (gd->cur_serial_dev, &info); +if (ret) +return ret; + + *buf ='\0' ; +if (!strcmp ("earlycon" , arg)) { +snprintf (buf,sizeof (buf), +"uart8250,mmio32,%#lx,%dn8" , info.addr, + info.baudrate); + }else if (!strcmp ("console" , arg)) { +snprintf (buf,sizeof (buf), +"ttyS0,%dn8" , info.baudrate); + } + +if (!*buf) { +printf ("Unknown param '%s\n" , arg); +return -ENOENT ; + } + + ret =bootflow_cmdline_set_arg (bflow, arg, buf, true); +if (ret) +return ret; + +return 0 ; +}
cmd/bootflow.c +4 -1
@@ -474,6 +474,9 @@ static int do_bootflow_cmdline(struct cmd_tbl *cmdtp, int flag, int argc,if (ret >=0 )printf ("%.*s\n" , ret, val);break ; +case 'a' :/* auto */ + ret =bootflow_cmdline_auto (bflow, arg); +break ; }switch (ret) {case -E2BIG :
@@ -508,7 +511,7 @@ static char bootflow_help_text[] ="bootflow info [-d] - show info on current bootflow (-d dump bootflow)\n" "bootflow boot - boot current bootflow (or first available if none selected)\n" "bootflow menu [-t] - show a menu of available bootflows\n" -"bootflow cmdline [set|get|clear|delete] <param> [<value>] - update cmdline" ; +"bootflow cmdline [set|get|clear|delete|auto] <param> [<value>] - update cmdline" ;#else "scan - boot first available bootflow\n" ;#endif
doc/usage/cmd/bootflow.rst +74 -1
93 lines not on this page · raw message
include/bootflow.h +12 -0
@@ -526,4 +526,16 @@ int cmdline_get_arg(const char *cmdline, const char *arg, int *posp);int bootflow_cmdline_get_arg (struct bootflow *bflow,const char *arg,const char **val); +/** +* bootflow_cmdline_auto() - Automatically set a value for a known argument +* +* This handles a small number of known arguments, for Linux in particular. It +* adds suitable kernel parameters automatically, e.g. to enable the console. +* +* @bflow: Bootflow to update +* @arg: Name of argument to set (e.g. "earlycon" or "console") +* Return: 0 if OK -ve on error +*/ +int bootflow_cmdline_auto (struct bootflow *bflow,const char *arg); +#endif
Signature · 1 line
2.41.0.390.g38632f3daf-goog
PATCH v3 14/18 x86: Add a function to boot a zimage
In reply to Simon GlassAdd a direct interface to booting a zimage, so that bootstd can call it without going through the command-line interface.
---
(no changes since v1)
arch/x86/include/asm/zimage.h | 17 ++++++++ arch/x86/lib/zimage.c | 82 ++++++++++++++++++++++++++++++----- 2 files changed, 88 insertions(+), 11 deletions(-)
arch/x86/include/asm/zimage.h +17 -0
@@ -72,4 +72,21 @@ int setup_zimage(struct boot_params *setup_base, char *cmd_line, int auto_boot,*/ void zimage_dump (struct boot_params *base_ptr); +/** +* zboot_start() - Boot a zimage +* +* Boot a zimage, given the component parts +* +* @addr: Address where the bzImage is moved before booting, either +* BZIMAGE_LOAD_ADDR or ZIMAGE_LOAD_ADDR +* @base: Pointer to the boot parameters, typically at address +* DEFAULT_SETUP_BASE +* @initrd: Address of the initial ramdisk, or 0 if none +* @initrd_size: Size of the initial ramdisk, or 0 if none +* @cmdline: Command line to use for booting +* Return: -EFAULT on error (normally it does not return) +*/ +int zboot_start (ulong addr,ulong size,ulong initrd,ulong initrd_size, +ulong base,char *cmdline); +#endif
arch/x86/lib/zimage.c +71 -11
135 lines not on this page · raw message
Signature · 1 line
2.41.0.390.g38632f3daf-goog
PATCH v3 15/18 x86: zimage: Export the function to obtain the cmdline
In reply to Simon GlassAllow reading the command line from a zimage, so that it can be recorded in the bootflow.
---
(no changes since v1)
arch/x86/include/asm/zimage.h | 10 ++++++++++ arch/x86/lib/zimage.c | 11 ++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-)
arch/x86/include/asm/zimage.h +10 -0
@@ -89,4 +89,14 @@ void zimage_dump(struct boot_params *base_ptr);int zboot_start (ulong addr,ulong size,ulong initrd,ulong initrd_size,ulong base,char *cmdline); +/* +* zimage_get_kernel_version() - Get the version string from a kernel +* +* @params: boot_params pointer +* @kernel_base: base address of kernel +* Return: Kernel version as a NUL-terminated string +*/ +const char *zimage_get_kernel_version (struct boot_params *params, +void *kernel_base); +#endif
arch/x86/lib/zimage.c +8 -3
@@ -181,7 +181,7 @@ static int setup_device_tree(struct setup_header *hdr, const void *fdt_blob)return 0 ; } -static const char *get_kernel_version (struct boot_params *params, +const char *zimage_get_kernel_version (struct boot_params *params,void *kernel_base) {struct setup_header *hdr = ¶ms->hdr;
@@ -189,10 +189,14 @@ static const char *get_kernel_version(struct boot_params *params,const char *s, *end; bootproto =get_boot_protocol (hdr, false); +log_debug ("bootproto %x, hdr->setup_sects %x\n" , bootproto, + hdr->setup_sects);if (bootproto <0x0200 || hdr->setup_sects <15 )return NULL ;/* sanity-check the kernel version in case it is missing */ +log_debug ("hdr->kernel_version %x, str at %p\n" , hdr->kernel_version, + kernel_base + hdr->kernel_version +0x200 );for (s = kernel_base + hdr->kernel_version +0x200 , end = s +0x100 ; *s; s++) {if (!isprint (*s))
@@ -239,7 +243,7 @@ struct boot_params *load_zimage(char *image, unsigned long kernel_size,log_debug ("Using boot protocol version %x.%02x\n" , (bootproto &0xff00 ) >>8 , bootproto &0xff ); - version =get_kernel_version (params, image); + version =zimage_get_kernel_version (params, image);if (version)printf ("Linux kernel version %s\n" , version);else
@@ -728,7 +732,8 @@ void zimage_dump(struct boot_params *base_ptr)print_num ("Real mode switch" , hdr->realmode_swtch);print_num ("Start sys seg" , hdr->start_sys_seg);print_num ("Kernel version" , hdr->kernel_version); - version =get_kernel_version (base_ptr, (void *)state.bzimage_addr); + version =zimage_get_kernel_version (base_ptr, + (void *)state.bzimage_addr);if (version)printf (" @%p: %s\n" , version, version);print_num ("Type of loader" , hdr->type_of_loader);
Signature · 1 line
2.41.0.390.g38632f3daf-goog
PATCH v3 16/18 bootstd: Add a simple bootmeth for ChromiumOS
In reply to Simon GlassIt is possible to boot x86-based ChromeOS machines by parsing a table and locating the kernel and command line. Add a bootmeth for this.
---
(no changes since v1)
boot/Kconfig | 11 ++ boot/Makefile | 1 + boot/bootmeth_cros.c | 212 +++++++++++++++++++++++++++++++++++ configs/tools-only_defconfig | 1 + 4 files changed, 225 insertions(+) create mode 100644 boot/bootmeth_cros.c
boot/Kconfig +11 -0
@@ -463,6 +463,17 @@ config BOOTMETH_GLOBAL EFI bootmgr, since they take full control over which bootdevs are selected to boot. +config BOOTMETH_CROS + bool "Bootdev support for Chromium OS" + depends on X86 || SANDBOX + default y + help + Enables support for booting Chromium OS using bootdevs. This uses the + kernel A slot and obtains the kernel command line from the parameters + provided there. + + Note that only x86 devices are supported at present. + config BOOTMETH_EXTLINUX bool "Bootdev support for extlinux boot" select PXE_UTILS
boot/Makefile +1 -0
@@ -27,6 +27,7 @@ obj-$(CONFIG_$(SPL_TPL_)BOOTSTD) += bootstd-uclass.o obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_EXTLINUX) += bootmeth_extlinux.o obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_EXTLINUX_PXE) += bootmeth_pxe.o obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_EFILOADER) += bootmeth_efi.o +obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_CROS) += bootmeth_cros.o obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_SANDBOX) += bootmeth_sandbox.o obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_SCRIPT) += bootmeth_script.o ifdef CONFIG_$(SPL_TPL_)BOOTSTD_FULL
boot/bootmeth_cros.c new file +212 -0
212 lines not on this page · raw message
configs/tools-only_defconfig +1 -0
@@ -10,6 +10,7 @@ CONFIG_FIT=y CONFIG_TIMESTAMP=y CONFIG_FIT_SIGNATURE=y # CONFIG_BOOTSTD_FULL is not set +# CONFIG_BOOTMETH_CROS is not set # CONFIG_BOOTMETH_VBE is not set CONFIG_USE_BOOTCOMMAND=y CONFIG_BOOTCOMMAND="run distro_bootcmd"
Signature · 1 line
2.41.0.390.g38632f3daf-goog
PATCH v3 17/18 x86: coreboot: Adjust various config options
In reply to Simon GlassDrop IDE and add NVME since this is more common now.
Add ms so it is easier to search for tables in memory.
Expand the command-line and print buffers so that we can deal with the very long ChromeOS command lines. (typically 700 characters).
Enable BOOTSTD_FULL to get the full set up standard-boot options.
Finally, expand the malloc() space so we can read large kernels into a bootflow.
---
Changes in v3:
- Drop CONFIG_MISC and CONFIG_NVMEM
- Update commit message
configs/coreboot_defconfig | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-)
configs/coreboot_defconfig +2 -12
@@ -1,5 +1,6 @@ CONFIG_X86=y CONFIG_TEXT_BASE=0x1110000 +CONFIG_SYS_MALLOC_LEN=0x2000000 CONFIG_NR_DRAM_BANKS=8 CONFIG_ENV_SIZE=0x1000 CONFIG_DEFAULT_DEVICE_TREE="coreboot"
@@ -8,12 +9,11 @@ CONFIG_VENDOR_COREBOOT=y CONFIG_TARGET_COREBOOT=y CONFIG_FIT=y CONFIG_FIT_SIGNATURE=y +CONFIG_BOOTSTD_FULL=y CONFIG_SYS_MONITOR_BASE=0x01110000 CONFIG_SHOW_BOOT_PROGRESS=y CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="root=/dev/sdb3 init=/sbin/init rootwait ro" -CONFIG_USE_BOOTCOMMAND=y -CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000" CONFIG_PRE_CONSOLE_BUFFER=y CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_LOG=y
@@ -23,9 +23,6 @@ CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_LAST_STAGE_INIT=y CONFIG_PCI_INIT_R=y CONFIG_HUSH_PARSER=y -CONFIG_SYS_PBSIZE=532 -CONFIG_CMD_MEM_SEARCH=y -CONFIG_CMD_IDE=y CONFIG_CMD_MMC=y CONFIG_CMD_PART=y CONFIG_CMD_USB=y
@@ -53,13 +50,6 @@ CONFIG_USE_ROOTPATH=y CONFIG_REGMAP=y CONFIG_SYSCON=y # CONFIG_ACPIGEN is not set -CONFIG_SYS_IDE_MAXDEVICE=4 -CONFIG_SYS_ATA_DATA_OFFSET=0 -CONFIG_SYS_ATA_REG_OFFSET=0 -CONFIG_SYS_ATA_ALT_OFFSET=0 -CONFIG_ATAPI=y -CONFIG_LBA48=y -CONFIG_SYS_64BIT_LBA=y CONFIG_NVME_PCI=y # CONFIG_PCI_PNP is not set CONFIG_SOUND=y
Signature · 1 line
2.41.0.390.g38632f3daf-goog
PATCH v3 18/18 x86: coral: Adjust various config options
In reply to Simon GlassAdd ms so it is easier to search for tables in memory.
Expand the command-line and print buffers so that we can deal with the very long ChromeOS command lines. (typically 700 characters).
Enable BOOTSTD_FULL to get the full set of standard-boot options.
Replace the existing manual script with 'bootflow scan', since it can find and boot the OS.
Finally, expand the malloc() space so we can read large kernels into a bootflow.
---
Changes in v3:
- Separate out patch to restore test behaviour on failure
Changes in v2:
- Drop mention of NVMe support
configs/chromebook_coral_defconfig | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
configs/chromebook_coral_defconfig +8 -2
@@ -1,5 +1,6 @@ CONFIG_X86=y CONFIG_TEXT_BASE=0x1110000 +CONFIG_SYS_MALLOC_LEN=0x2000000 CONFIG_SYS_MALLOC_F_LEN=0x3d00 CONFIG_NR_DRAM_BANKS=8 CONFIG_MAX_CPUS=8
@@ -22,6 +23,7 @@ CONFIG_X86_OFFSET_U_BOOT=0xffd00000 CONFIG_X86_OFFSET_SPL=0xffe80000 CONFIG_INTEL_ACPIGEN=y CONFIG_INTEL_GENERIC_WIFI=y +CONFIG_BOOTSTD_FULL=y CONFIG_SYS_MONITOR_BASE=0x01110000 CONFIG_CHROMEOS=y CONFIG_BOOTSTAGE=y
@@ -33,8 +35,10 @@ CONFIG_BOOTSTAGE_STASH=y CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS_SUBST=y CONFIG_USE_BOOTCOMMAND=y -CONFIG_BOOTCOMMAND="tpm init; tpm startup TPM2_SU_CLEAR; read mmc 0:2 100000 0 80; setexpr loader *001004f0; setexpr size *00100518; setexpr blocks $size / 200; read mmc 0:2 100000 80 $blocks; setexpr setup $loader - 1000; setexpr cmdline_ptr $loader - 2000; setexpr.s cmdline *$cmdline_ptr; setexpr cmdline gsub %U \\\\${uuid}; if part uuid mmc 0:2 uuid; then zboot start 100000 0 0 0 $setup cmdline; zboot load; zboot setup; zboot dump; zboot go;fi" +CONFIG_BOOTCOMMAND="tpm init; tpm startup TPM2_SU_CLEAR; bootflow scan -lb" CONFIG_SYS_CONSOLE_INFO_QUIET=y +CONFIG_LOG=y +CONFIG_LOGF_FUNC=y CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_LAST_STAGE_INIT=y CONFIG_BLOBLIST=y
@@ -52,9 +56,11 @@ CONFIG_SPL_POWER=y CONFIG_TPL_SYS_MALLOC_SIMPLE=y CONFIG_TPL_POWER=y CONFIG_HUSH_PARSER=y -CONFIG_SYS_PBSIZE=532 +CONFIG_SYS_CBSIZE=1024 +CONFIG_SYS_PBSIZE=1024 CONFIG_CMD_CPU=y CONFIG_CMD_PMC=y +CONFIG_CMD_MEM_SEARCH=y CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_CMD_PART=y
Signature · 1 line
2.41.0.390.g38632f3daf-goog
Quoted 28 lines · Simon Glass
This series adds a simple bootmeth for ChromiumOS on x86. It uses zimage to boot the kernel.
Full verified boot is not included at this stage - that is still a separate chunk of code to be brought into standard boot at some point. For now it just obtains the kernel and command line and boots. This should be enough to boot Chrome OS from coreboot on all x86 machines in circulation, although only Brya (2022) and Coral (2017) have been tested.
ChromiumOS needs quite large kernel parameters, to hold the DM verity settings and other pieces. This makes it painful to modify just one parameter, since the whole cmdline must be adjusted at once. To cope with this, a new cmdline-editing feature is provided: the 'bootflow cmdline' command allows individual parameters to be added, modified and deleted.
To deal with enabling debug console, a variant supports setting 'earlycon' and 'console' automatically. The 'bdinfo' command is updated to show serial-port info also.
Booting the zimage is now done programmatically, rather than running through the command-line interface. Minor tweaks are made to the coreboot and coral config so that booting works correctly.
Note that the ACPI tables are not updated with the required firmware information in this series, so a warning is shown on boot. This will be addressed later since it requires quite a bit of configuration.
Quoted 9 lines
Finally, this fixes a recently introduced bug in unit testing and updates the algorithm to avoid running flat-tree tests which don't actually use the devicetree.
Changes in v3:
- DropCONFIG_MISCandCONFIG_NVMEM
- Update commit message
- Separate out patch to restore test behaviour on failure
series applied to u-boot-x86, thanks!
Hi Simon,
Quoted 34 lines · Bin Meng
Quoted 32 lines · Simon Glass
This series adds a simple bootmeth for ChromiumOS on x86. It uses zimage to boot the kernel.
Full verified boot is not included at this stage - that is still a separate chunk of code to be brought into standard boot at some point. For now it just obtains the kernel and command line and boots. This should be enough to boot Chrome OS from coreboot on all x86 machines in circulation, although only Brya (2022) and Coral (2017) have been tested.
ChromiumOS needs quite large kernel parameters, to hold the DM verity settings and other pieces. This makes it painful to modify just one parameter, since the whole cmdline must be adjusted at once. To cope with this, a new cmdline-editing feature is provided: the 'bootflow cmdline' command allows individual parameters to be added, modified and deleted.
To deal with enabling debug console, a variant supports setting 'earlycon' and 'console' automatically. The 'bdinfo' command is updated to show serial-port info also.
Booting the zimage is now done programmatically, rather than running through the command-line interface. Minor tweaks are made to the coreboot and coral config so that booting works correctly.
Note that the ACPI tables are not updated with the required firmware information in this series, so a warning is shown on boot. This will be addressed later since it requires quite a bit of configuration.
Finally, this fixes a recently introduced bug in unit testing and updates the algorithm to avoid running flat-tree tests which don't actually use the devicetree.
Quoted 7 lines
Quoted 5 lines
Changes in v3:
- DropCONFIG_MISCandCONFIG_NVMEM
- Update commit message
- Separate out patch to restore test behaviour on failureseries applied to u-boot-x86, thanks!
Could you please look at the CI failure?
https://source.denx.de/u-boot/custodians/u-boot-x86/-/pipelines/16890/failures
Regards,
Bin
Quoted 43 lines · Bin Meng
Hi Simon,
Quoted 40 lines · Bin Meng
Quoted 37 lines · Simon Glass
This series adds a simple bootmeth for ChromiumOS on x86. It uses zimage to boot the kernel.
Full verified boot is not included at this stage - that is still a separate chunk of code to be brought into standard boot at some point. For now it just obtains the kernel and command line and boots. This should be enough to boot Chrome OS from coreboot on all x86 machines in circulation, although only Brya (2022) and Coral (2017) have been tested.
ChromiumOS needs quite large kernel parameters, to hold the DM verity settings and other pieces. This makes it painful to modify just one parameter, since the whole cmdline must be adjusted at once. To cope with this, a new cmdline-editing feature is provided: the 'bootflow cmdline' command allows individual parameters to be added, modified and deleted.
To deal with enabling debug console, a variant supports setting 'earlycon' and 'console' automatically. The 'bdinfo' command is updated to show serial-port info also.
Booting the zimage is now done programmatically, rather than running through the command-line interface. Minor tweaks are made to the coreboot and coral config so that booting works correctly.
Note that the ACPI tables are not updated with the required firmware information in this series, so a warning is shown on boot. This will be addressed later since it requires quite a bit of configuration.
Finally, this fixes a recently introduced bug in unit testing and updates the algorithm to avoid running flat-tree tests which don't actually use the devicetree.
Changes in v3:
- DropCONFIG_MISCandCONFIG_NVMEM
- Update commit message
- Separate out patch to restore test behaviour on failure
Quoted 4 lines
Quoted 1 line
series applied to u-boot-x86, thanks!
Could you please look at the CI failure?
https://source.denx.de/u-boot/custodians/u-boot-x86/-/pipelines/16890/failures
I _think_ if you rebase on master this should be fixed with
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
applied.
Signature · 1 line
Tom
Hi Tom,
Quoted 45 lines · Tom Rini
Quoted 43 lines · Bin Meng
Hi Simon,
Quoted 40 lines · Bin Meng
Quoted 37 lines · Simon Glass
This series adds a simple bootmeth for ChromiumOS on x86. It uses zimage to boot the kernel.
Full verified boot is not included at this stage - that is still a separate chunk of code to be brought into standard boot at some point. For now it just obtains the kernel and command line and boots. This should be enough to boot Chrome OS from coreboot on all x86 machines in circulation, although only Brya (2022) and Coral (2017) have been tested.
ChromiumOS needs quite large kernel parameters, to hold the DM verity settings and other pieces. This makes it painful to modify just one parameter, since the whole cmdline must be adjusted at once. To cope with this, a new cmdline-editing feature is provided: the 'bootflow cmdline' command allows individual parameters to be added, modified and deleted.
To deal with enabling debug console, a variant supports setting 'earlycon' and 'console' automatically. The 'bdinfo' command is updated to show serial-port info also.
Booting the zimage is now done programmatically, rather than running through the command-line interface. Minor tweaks are made to the coreboot and coral config so that booting works correctly.
Note that the ACPI tables are not updated with the required firmware information in this series, so a warning is shown on boot. This will be addressed later since it requires quite a bit of configuration.
Finally, this fixes a recently introduced bug in unit testing and updates the algorithm to avoid running flat-tree tests which don't actually use the devicetree.
Changes in v3:
- DropCONFIG_MISCandCONFIG_NVMEM
- Update commit message
- Separate out patch to restore test behaviour on failure
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
series applied to u-boot-x86, thanks!
Could you please look at the CI failure?
https://source.denx.de/u-boot/custodians/u-boot-x86/-/pipelines/16890/failuresI _think_ if you rebase on master this should be fixed with
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
applied.
Yes it should be.
Regards,
Simon
Hi Tom and Simon,
Quoted 51 lines · Simon Glass
Hi Tom,
Quoted 47 lines · Tom Rini
Quoted 45 lines · Bin Meng
Hi Simon,
Quoted 41 lines · Bin Meng
Quoted 28 lines · Simon Glass
This series adds a simple bootmeth for ChromiumOS on x86. It uses zimage to boot the kernel.
Full verified boot is not included at this stage - that is still a separate chunk of code to be brought into standard boot at some point. For now it just obtains the kernel and command line and boots. This should be enough to boot Chrome OS from coreboot on all x86 machines in circulation, although only Brya (2022) and Coral (2017) have been tested.
ChromiumOS needs quite large kernel parameters, to hold the DM verity settings and other pieces. This makes it painful to modify just one parameter, since the whole cmdline must be adjusted at once. To cope with this, a new cmdline-editing feature is provided: the 'bootflow cmdline' command allows individual parameters to be added, modified and deleted.
To deal with enabling debug console, a variant supports setting 'earlycon' and 'console' automatically. The 'bdinfo' command is updated to show serial-port info also.
Booting the zimage is now done programmatically, rather than running through the command-line interface. Minor tweaks are made to the coreboot and coral config so that booting works correctly.
Note that the ACPI tables are not updated with the required firmware information in this series, so a warning is shown on boot. This will be addressed later since it requires quite a bit of configuration.
Quoted 9 lines
Finally, this fixes a recently introduced bug in unit testing and updates the algorithm to avoid running flat-tree tests which don't actually use the devicetree.
Changes in v3:
- DropCONFIG_MISCandCONFIG_NVMEM
- Update commit message
- Separate out patch to restore test behaviour on failureseries applied to u-boot-x86, thanks!
Quoted 9 lines
Quoted 6 lines
Quoted 2 lines
Could you please look at the CI failure?
https://source.denx.de/u-boot/custodians/u-boot-x86/-/pipelines/16890/failuresI _think_ if you rebase on master this should be fixed with
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
applied.Yes it should be.
Rebased u-boot-x86 against u-boot/master, but CI still has these sandbox failures.
https://source.denx.de/u-boot/custodians/u-boot-x86/-/pipelines/16920/failures
Regards,
Bin
Hi Tom and Bin,
I've already sent a patch in the new series that fixes bdinfo. Please take a look.
Thanks,
Simon
Quoted 93 lines · On Sun, Jul 16, 2023, 20:13 Bin Meng <[email protected]> wrote:
Hi Tom and Simon,
Quoted 11 lines · Simon Glass
Hi Tom,
Quoted 7 lines · Tom Rini
Quoted 5 lines · Bin Meng
Hi Simon,
Quoted 2 lines · Bin Meng
On Wed, Jul 12, 2023 at 11:04 PM Simon Glass <[email protected]>
Quoted 2 lines · wrote:
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
This series adds a simple bootmeth for ChromiumOS on x86. It
uses zimage
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
to boot the kernel.
Full verified boot is not included at this stage - that is still
a
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
separate chunk of code to be brought into standard boot at some
point.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
For now it just obtains the kernel and command line and boots.
This should
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
be enough to boot Chrome OS from coreboot on all x86 machines in circulation, although only Brya (2022) and Coral (2017) have
been tested.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
ChromiumOS needs quite large kernel parameters, to hold the DM
verity
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
settings and other pieces. This makes it painful to modify just
one
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
parameter, since the whole cmdline must be adjusted at once. To
cope with
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
this, a new cmdline-editing feature is provided: the 'bootflow
cmdline'
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
command allows individual parameters to be added, modified and
deleted.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
To deal with enabling debug console, a variant supports setting
'earlycon'
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
and 'console' automatically. The 'bdinfo' command is updated to
show
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
serial-port info also.
Booting the zimage is now done programmatically, rather than
running
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
through the command-line interface. Minor tweaks are made to the
coreboot
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
and coral config so that booting works correctly.
Note that the ACPI tables are not updated with the required
firmware
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
information in this series, so a warning is shown on boot. This
will be
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
addressed later since it requires quite a bit of configuration.
Finally, this fixes a recently introduced bug in unit testing
and updates
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
the algorithm to avoid running flat-tree tests which don't
actually use
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
the devicetree.
Changes in v3:
- DropCONFIG_MISCandCONFIG_NVMEM
- Update commit message
- Separate out patch to restore test behaviour on failureQuoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
series applied to u-boot-x86, thanks!
Could you please look at the CI failure?
https://source.denx.de/u-boot/custodians/u-boot-x86/-/pipelines/16890/failures
Quoted 3 lines
Quoted 3 lines
I _think_ if you rebase on master this should be fixed with
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
Quoted 4 lines
Quoted 1 line
applied.
Yes it should be.
Rebased u-boot-x86 against u-boot/master, but CI still has these sandbox failures.
https://source.denx.de/u-boot/custodians/u-boot-x86/-/pipelines/16920/failures
Regards,
Bin
Hi Simon,
Quoted 5 lines · Simon Glass
Hi Tom and Bin,
I've already sent a patch in the new series that fixes bdinfo. Please take a look.
Are these sandbox failures regressions? Or issues introduced in your series?
If the latter, I think we should squash the patch into one of your series.
BTW please provide the patch link so that I can verify the CI build locally.
Regards,
Bin
Hi Bin,
Quoted 11 lines · Bin Meng
Hi Simon,
Quoted 5 lines · Simon Glass
Hi Tom and Bin,
I've already sent a patch in the new series that fixes bdinfo. Please take a look.
Are these sandbox failures regressions? Or issues introduced in your series?
It is a race between my series (which has been sitting for a while) and a new test written by Marek.
Quoted 5 lines
If the latter, I think we should squash the patch into one of your series.
BTW please provide the patch link so that I can verify the CI build locally.
It is:
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
Regards,
Simon