Initial implementation of standard boot
Subsystems (7)
v4 cover Initial implementation of standard boot
The bootflow feature provide a built-in way for U-Boot to automatically boot an Operating System without custom scripting and other customisation. This is called 'standard boot' since it provides a standard way for U-Boot to boot a distro, without scripting.
It introduces the following concepts:
- bootdev - a device which can hold a distro
- bootmeth - a method to scan a bootdev to find bootflows (owned by
U-Boot)
- bootflow - a description of how to boot (owned by the distro)
This series provides an implementation of these, enabled to scan for bootflows from MMC, USB and Ethernet. It supports the existing distro boot as well as the EFI loader flow (bootefi/bootmgr). It works similiarly to the existing script-based approach, but is native to U-Boot.
With this we can boot on a Raspberry Pi 3 with just one command:
bootflow scan -lb
which means to scan, listing (-l) each bootflow and trying to boot each one (-b). The final patch shows this.
With a standard way to identify boot devices, booting become easier. It also should be possible to support U-Boot scripts, for backwards compatibility only.
This series relies on the PXE clean-up series, posted here:
https://patchwork.ozlabs.org/project/uboot/list/?series=267078
For documentation, see the 'doc' patch.
For version 2, a new naming scheme is used as above:
- bootdev is used instead of bootdevice, because 'device' is overused, is everywhere in U-Boot, can be confused with udevice
- bootmeth - because 'method' is too vanilla, appears 1300 times in U-Boot
Also in version 2, drivers are introduced for the boot methods, to make it more extensible. Booting a custom OS is simply a matter of creating a bootmeth for it and implementing the read_file() and boot() methods.
Version 4 makes some minor improvements and leaves out the RFC patch for rpi conversion, in the hope of getting the base support applied sooner rather than later.
The design is described in these two documents:
https://drive.google.com/file/d/1ggW0KJpUOR__vBkj3l61L2dav4ZkNC12/view?usp=sharing
https://drive.google.com/file/d/1kTrflO9vvGlKp-ZH_jlgb9TY3WYG6FF9/view?usp=sharing
Overall size increment on rpi_3_32b is 6.75KB.
The series is available at u-boot-dm/bme-working
Sample log on rpi_3_32b:
U-Boot 2021.10-rc2-00043-gccd453aa918-dirty (Aug 28 2021 - 13:58:46 -0600)
DRAM: 992 MiB
RPI 3 Model B (0xa22082)
MMC: mmc@7e202000: 0, sdhci@7e300000: 1
Loading Environment from FAT... Unable to read "uboot.env" from mmc0:1... In: serial
Out: vidconsole Err: vidconsole Net: No ethernet found.
starting USB...
Bus usb@7e980000: USB DWC2
scanning bus usb@7e980000 for devices... usb_kbd usb_kbd: Timeout poll on interrupt endpoint Failed to get keyboard state from device 0c40:8000
4 USB Device(s) found
scanning usb for storage devices... 0 Storage Device(s) found
Hit any key to stop autoboot: 0
Scanning for bootflows in all bootmethods
Seq Type State Uclass Part Name Filename
--- ----------- ------ -------- ---- ------------------------ ---------------- Scanning bootmethod '[email protected]':
0 efi-loader loaded mmc 1 [email protected] efi/boot/bootarm.efi
** Booting bootflow '[email protected]_1'
Scanning disk [email protected]...
** Unrecognized filesystem type **
Card did not respond to voltage select! : -110
Scanning disk [email protected]...
Disk [email protected] not ready
Found 4 disks
No EFI system partition
Booting /efi\boot
Waiting for Ethernet connection... done.
Fedora (5.11.12-300.fc34.armv7hl) 34 (Workstation Edition) UEFI Firmware Settings
Use the ▲ and ▼ keys to change the selection.
Press 'e' to edit the selected item, or 'c' for a command prompt. Press Escape to return to the previous menu.
The selected entry will be started automatically in 0s.
Changes in v4:
- Add a new fs_type field for use with sandbox
- Add a test also
- Add new patch to correct comment formatting to avoid sphinx errors
- Add new patch with a function to set the filesystem type
- Allow use without a block device
- Correct bug in this function and add test
- Correct the commit tag
- Fix 'a' typo
- Improve debugging in efiload_read_file()
- Make CMD_BOOTSTD_FULL depend on BOOTSTD_FULL
- NULL-terminate the default prefix list
- Reword the commit message
- Show the bootmeth name when booting
- Split out the file setup into into its own function
- Update docs for typos that have been fixed
- Update tests for code changes
- Update the function comment to clarify its intert / limitations
- Use new Return style in function comments
- Use new sphynx Return style
- Warn when trying to use the full bootflow command but it is not enabled
Changes in v3:
- Add CONFIG_BOOTSTD_FULL to enable the full feature set
- Add a log category
- Add bootdev_get_from_blk() function
- Add new patch to rename uclass_get_by_name_len()
- Add new patch to support finding a uclass device by partial name
- Add some more common functions
- Add some tests, including one for 'abc123def456'
- Add support for script boot
- Add tests for the "bootmeths" env var
- Adjust for new blk_find_device() function
- Align the EFI load address
- Change the function to return a pointer to the first digit
- Explain why it is OK to use "?" as an unknown bootflow state
- Mention bootflow_state[] in enum bootflow_state_t
- Move bootdev ordering into the uclass
- Move bootmeth ordering into the uclass
- Move bootmeth/bootdev ordering into the uclass
- Point to the header file for bootflow_state[] docs
- Put some features behind CONFIG_BOOTFLOW_FULL
- Support "bootmeths" env var
- Support bootdev-order and filename-prefixes only with CONFIG_BOOTSTD_FULL
- Update bootdev_test_order() for boot_targets env var
- Update docs for "bootmeths" and "boot_targets" env vars
- Update for the new trailing_strtoln_end()
- Update test condition to use CMD_BOOTFLOW
- Update tests for the new 'bootmeth order' syntax
- Use a short name when BOOTSTD_FULL is not enabled
- Use blk_find_device() to find the block device for a media device
- Use common bootmeth functions
- Use new bootmeth_try_file() function
- Use separate Kconfig options for each command
Simon Glass (33):
lib: Move string tests to the string module
test: Add tests for trailing_strtol()
lib: Correct comment formatting to avoid sphinx problems
lib: Fix a few bugs in trailing_strtoln()
lib: Add a way to find the postiion of a trailing number
dm: core: Rename and fix uclass_get_by_name_len()
dm: core: Allow finding a uclass device by partial name
test: fastboot: Avoid using mmc1
test: dm: Restart USB before assuming it is stopped
dm: blk: Add a function to return the device type
fs: Add a function to set the filesystem type
bootstd: Add the concept of a bootflow
bootstd: Add the bootstd uclass and core implementation
bootstd: Add the bootdev uclass
bootstd: Add the bootmeth uclass and helpers
bootstd: Add support for bootflows
bootstd: Add a bootdev command
bootstd: Add a bootflow command
bootstd: Add a bootmeth command
bootstd: Add an implementation of distro boot
bootstd: mmc: Add a bootdev driver
bootstd: ethernet: Add a bootdev driver
bootstd: Add an implementation of distro PXE boot
bootstd: Add an implementation of EFI boot
bootstd: Add a system bootdev for strange boot methods
bootstd: Add an implementation of EFI bootmgr
bootstd: Add a sandbox bootmeth driver
bootstd: sandbox: Add a hostfs bootdev
bootstd: Add an implementation of script boot
bootstd: usb: Add a bootdev driver
bootstd: Add tests for bootstd including all uclasses
bootstd: Add setup for the bootflow tests
bootstd: doc: Add documentation
MAINTAINERS | 21 + arch/sandbox/dts/sandbox.dts | 4 + arch/sandbox/dts/sandbox.dtsi | 5 + arch/sandbox/dts/test.dts | 18 + boot/Kconfig | 98 ++++ boot/Makefile | 15 + boot/bootdev-uclass.c | 649 ++++++++++++++++++++++++++ boot/bootflow.c | 411 ++++++++++++++++ boot/bootmeth-uclass.c | 333 +++++++++++++ boot/bootmeth_distro.c | 143 ++++++ boot/bootmeth_efi.c | 188 ++++++++ boot/bootmeth_efi_mgr.c | 86 ++++ boot/bootmeth_pxe.c | 186 ++++++++ boot/bootmeth_sandbox.c | 69 +++ boot/bootmeth_script.c | 139 ++++++ boot/bootstd-uclass.c | 183 ++++++++ boot/system_bootdev.c | 66 +++ cmd/Kconfig | 39 ++ cmd/Makefile | 3 + cmd/bootdev.c | 120 +++++ cmd/bootflow.c | 404 ++++++++++++++++ cmd/bootmeth.c | 113 +++++ common/usb_storage.c | 12 + configs/amcore_defconfig | 1 + configs/rcar3_salvator-x_defconfig | 1 + configs/sandbox_defconfig | 3 +- configs/sandbox_flattree_defconfig | 3 +- configs/tbs2910_defconfig | 1 + doc/develop/bootstd.rst | 638 +++++++++++++++++++++++++ doc/develop/distro.rst | 3 + doc/develop/index.rst | 1 + doc/device-tree-bindings/bootdev.txt | 26 ++ doc/device-tree-bindings/bootmeth.txt | 31 ++ doc/device-tree-bindings/bootstd.txt | 36 ++ doc/usage/bootdev.rst | 135 ++++++ doc/usage/bootflow.rst | 427 +++++++++++++++++ doc/usage/bootmeth.rst | 108 +++++ doc/usage/index.rst | 3 + drivers/block/blk-uclass.c | 7 + drivers/core/uclass.c | 20 +- drivers/mmc/Makefile | 5 + drivers/mmc/mmc-uclass.c | 23 + drivers/mmc/mmc_bootdev.c | 62 +++ drivers/usb/host/Makefile | 4 + drivers/usb/host/usb_bootdev.c | 61 +++ fs/Kconfig | 2 + fs/fs.c | 5 + fs/sandbox/Kconfig | 2 + fs/sandbox/Makefile | 1 + fs/sandbox/host_bootdev.c | 56 +++ include/blk.h | 8 + include/bootdev.h | 275 +++++++++++ include/bootflow.h | 310 ++++++++++++ include/bootmeth.h | 234 ++++++++++ include/bootstd.h | 80 ++++ include/distro.h | 24 + include/dm/device.h | 2 +- include/dm/uclass-id.h | 3 + include/dm/uclass-internal.h | 16 + include/dm/uclass.h | 6 +- include/env_callback.h | 7 + include/fs.h | 11 + include/mmc.h | 12 +- include/test/suites.h | 2 + include/vsprintf.h | 117 +++-- lib/strto.c | 23 +- net/Kconfig | 9 + net/Makefile | 1 + net/eth-uclass.c | 8 + net/eth_bootdev.c | 101 ++++ test/Makefile | 1 + test/boot/Makefile | 5 + test/boot/bootdev.c | 223 +++++++++ test/boot/bootflow.c | 400 ++++++++++++++++ test/boot/bootmeth.c | 122 +++++ test/boot/bootstd_common.c | 35 ++ test/boot/bootstd_common.h | 27 ++ test/cmd_ut.c | 7 + test/dm/blk.c | 6 + test/dm/core.c | 17 + test/dm/fastboot.c | 4 +- test/print_ut.c | 40 -- test/py/tests/bootstd/mmc1.img.xz | Bin 0 -> 4448 bytes test/py/tests/test_ut.py | 103 ++++ test/str_ut.c | 72 +++ 85 files changed, 7172 insertions(+), 109 deletions(-) create mode 100644 boot/bootdev-uclass.c create mode 100644 boot/bootflow.c create mode 100644 boot/bootmeth-uclass.c create mode 100644 boot/bootmeth_distro.c create mode 100644 boot/bootmeth_efi.c create mode 100644 boot/bootmeth_efi_mgr.c create mode 100644 boot/bootmeth_pxe.c create mode 100644 boot/bootmeth_sandbox.c create mode 100644 boot/bootmeth_script.c create mode 100644 boot/bootstd-uclass.c create mode 100644 boot/system_bootdev.c create mode 100644 cmd/bootdev.c create mode 100644 cmd/bootflow.c create mode 100644 cmd/bootmeth.c create mode 100644 doc/develop/bootstd.rst create mode 100644 doc/device-tree-bindings/bootdev.txt create mode 100644 doc/device-tree-bindings/bootmeth.txt create mode 100644 doc/device-tree-bindings/bootstd.txt create mode 100644 doc/usage/bootdev.rst create mode 100644 doc/usage/bootflow.rst create mode 100644 doc/usage/bootmeth.rst create mode 100644 drivers/mmc/mmc_bootdev.c create mode 100644 drivers/usb/host/usb_bootdev.c create mode 100644 fs/sandbox/Kconfig create mode 100644 fs/sandbox/host_bootdev.c create mode 100644 include/bootdev.h create mode 100644 include/bootflow.h create mode 100644 include/bootmeth.h create mode 100644 include/bootstd.h create mode 100644 include/distro.h create mode 100644 net/eth_bootdev.c create mode 100644 test/boot/Makefile create mode 100644 test/boot/bootdev.c create mode 100644 test/boot/bootflow.c create mode 100644 test/boot/bootmeth.c create mode 100644 test/boot/bootstd_common.c create mode 100644 test/boot/bootstd_common.h create mode 100644 test/py/tests/bootstd/mmc1.img.xz
Signature · 1 line
2.35.1.616.g0bdcbb4464-goog
PATCH v4 1/33 lib: Move string tests to the string module
A few string tests were added to the print module by mistake. Move them.
---
Changes in v4:
- Correct the commit tag
test/print_ut.c | 40 ---------------------------------------- test/str_ut.c | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 40 deletions(-)
test/print_ut.c +0 -40
@@ -345,26 +345,6 @@ static int print_do_hex_dump(struct unit_test_state *uts) }PRINT_TEST (print_do_hex_dump,UT_TESTF_CONSOLE_REC ); -static int print_itoa (struct unit_test_state *uts) -{ -ut_asserteq_str ("123" ,simple_itoa (123 )); -ut_asserteq_str ("0" ,simple_itoa (0 )); -ut_asserteq_str ("2147483647" ,simple_itoa (0x7fffffff )); -ut_asserteq_str ("4294967295" ,simple_itoa (0xffffffff )); - -/* Use #ifdef here to avoid a compiler warning on 32-bit machines */ -#ifdef CONFIG_PHYS_64BIT -if (sizeof (ulong) ==8 ) { -ut_asserteq_str ("9223372036854775807" , -simple_itoa ((1UL <<63 ) -1 )); -ut_asserteq_str ("18446744073709551615" ,simple_itoa (-1 )); - } -#endif /* CONFIG_PHYS_64BIT */ - -return 0 ; -} -PRINT_TEST (print_itoa,0 ); -static int snprint (struct unit_test_state *uts) {char buf[10 ] ="xxxxxxxxx" ;
@@ -391,26 +371,6 @@ static int snprint(struct unit_test_state *uts) }PRINT_TEST (snprint,0 ); -static int print_xtoa (struct unit_test_state *uts) -{ -ut_asserteq_str ("7f" ,simple_xtoa (127 )); -ut_asserteq_str ("00" ,simple_xtoa (0 )); -ut_asserteq_str ("7fffffff" ,simple_xtoa (0x7fffffff )); -ut_asserteq_str ("ffffffff" ,simple_xtoa (0xffffffff )); - -/* Use #ifdef here to avoid a compiler warning on 32-bit machines */ -#ifdef CONFIG_PHYS_64BIT -if (sizeof (ulong) ==8 ) { -ut_asserteq_str ("7fffffffffffffff" , -simple_xtoa ((1UL <<63 ) -1 )); -ut_asserteq_str ("ffffffffffffffff" ,simple_xtoa (-1 )); - } -#endif /* CONFIG_PHYS_64BIT */ - -return 0 ; -} -PRINT_TEST (print_xtoa,0 ); -int do_ut_print (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) {struct unit_test *tests =UNIT_TEST_SUITE_START (print_test);
test/str_ut.c +40 -0
@@ -202,6 +202,46 @@ static int str_dectoul(struct unit_test_state *uts) }STR_TEST (str_dectoul,0 ); +static int str_itoa (struct unit_test_state *uts) +{ +ut_asserteq_str ("123" ,simple_itoa (123 )); +ut_asserteq_str ("0" ,simple_itoa (0 )); +ut_asserteq_str ("2147483647" ,simple_itoa (0x7fffffff )); +ut_asserteq_str ("4294967295" ,simple_itoa (0xffffffff )); + +/* Use #ifdef here to avoid a compiler warning on 32-bit machines */ +#ifdef CONFIG_PHYS_64BIT +if (sizeof (ulong) ==8 ) { +ut_asserteq_str ("9223372036854775807" , +simple_itoa ((1UL <<63 ) -1 )); +ut_asserteq_str ("18446744073709551615" ,simple_itoa (-1 )); + } +#endif /* CONFIG_PHYS_64BIT */ + +return 0 ; +} +STR_TEST (str_itoa,0 ); + +static int str_xtoa (struct unit_test_state *uts) +{ +ut_asserteq_str ("7f" ,simple_xtoa (127 )); +ut_asserteq_str ("00" ,simple_xtoa (0 )); +ut_asserteq_str ("7fffffff" ,simple_xtoa (0x7fffffff )); +ut_asserteq_str ("ffffffff" ,simple_xtoa (0xffffffff )); + +/* Use #ifdef here to avoid a compiler warning on 32-bit machines */ +#ifdef CONFIG_PHYS_64BIT +if (sizeof (ulong) ==8 ) { +ut_asserteq_str ("7fffffffffffffff" , +simple_xtoa ((1UL <<63 ) -1 )); +ut_asserteq_str ("ffffffffffffffff" ,simple_xtoa (-1 )); + } +#endif /* CONFIG_PHYS_64BIT */ + +return 0 ; +} +STR_TEST (str_xtoa,0 ); +int do_ut_str (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) {struct unit_test *tests =UNIT_TEST_SUITE_START (str_test);
Signature · 1 line
2.35.1.616.g0bdcbb4464-goog
PATCH v4 2/33 test: Add tests for trailing_strtol()
In reply to Simon GlassThis function currently has no tests. Add some.
---
Changes in v4:
- Use new Return style in function comments
include/vsprintf.h | 4 ++-- test/str_ut.c | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-)
include/vsprintf.h +2 -2
@@ -99,7 +99,7 @@ long long simple_strtoll(const char *cp, char **endp, unsigned int base);* For example, "abc123" would return 123. * * @str: String to exxamine -* Return: training number if found, else -1 +* Return: trailing number if found, else -1 */ long trailing_strtol (const char *str);
@@ -114,7 +114,7 @@ long trailing_strtol(const char *str);* @str: String to exxamine * @end: Pointer to end of string to examine, or NULL to use the * whole string -* Return: training number if found, else -1 +* Return: trailing number if found, else -1 */ long trailing_strtoln (const char *str,const char *end);
test/str_ut.c +19 -0
@@ -242,6 +242,25 @@ static int str_xtoa(struct unit_test_state *uts) }STR_TEST (str_xtoa,0 ); +static int str_trailing (struct unit_test_state *uts) +{ +char str1[] ="abc123def" ; + +ut_asserteq (-1 ,trailing_strtol ("" )); +ut_asserteq (-1 ,trailing_strtol ("123" )); +ut_asserteq (123 ,trailing_strtol ("abc123" )); +ut_asserteq (4 ,trailing_strtol ("12c4" )); +ut_asserteq (-1 ,trailing_strtol ("abd" )); +ut_asserteq (-1 ,trailing_strtol ("abc123def" )); + +ut_asserteq (-1 ,trailing_strtoln (str1,NULL )); +ut_asserteq (123 ,trailing_strtoln (str1, str1 +6 )); +ut_asserteq (-1 ,trailing_strtoln (str1, str1 +9 )); + +return 0 ; +} +STR_TEST (str_trailing,0 ); +int do_ut_str (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) {struct unit_test *tests =UNIT_TEST_SUITE_START (str_test);
Signature · 1 line
2.35.1.616.g0bdcbb4464-goog
PATCH v4 3/33 lib: Correct comment formatting to avoid sphinx problems
In reply to Simon GlassTweak a few comments to kep sphinx happy, in case we want to include this file one day.
Also fix the 'exxamine' typo.
Patch-notes:
This uses:
sed -i 's/@param \(\S*\)\s*/@\1: /' include/vsprintf.h
to convert the @param to the new format.
---
Changes in v4:
- Add new patch to correct comment formatting to avoid sphinx errors
- Correct the commit tag
include/vsprintf.h | 92 +++++++++++++++++++++++----------------------- 1 file changed, 46 insertions(+), 46 deletions(-)
include/vsprintf.h +46 -46
@@ -13,9 +13,9 @@/** * simple_strtoul - convert a string to an unsigned long * -* @param cp The string to be converted -* @param endp Updated to point to the first character not converted -* @param base The number base to use (0 for the default) +* @cp: The string to be converted +* @endp: Updated to point to the first character not converted +* @base: The number base to use (0 for the default) * Return: value decoded from string (0 if invalid) * * Converts a string to an unsigned long. If there are invalid characters at
@@ -34,8 +34,8 @@ ulong simple_strtoul(const char *cp, char **endp, unsigned int base);/** * hex_strtoul - convert a string in hex to an unsigned long * -* @param cp The string to be converted -* @param endp Updated to point to the first character not converted +* @cp: The string to be converted +* @endp: Updated to point to the first character not converted * Return: value decoded from string (0 if invalid) * * Converts a hex string to an unsigned long. If there are invalid characters at
@@ -47,8 +47,8 @@ unsigned long hextoul(const char *cp, char **endp);/** * dec_strtoul - convert a string in decimal to an unsigned long * -* @param cp The string to be converted -* @param endp Updated to point to the first character not converted +* @cp: The string to be converted +* @endp: Updated to point to the first character not converted * Return: value decoded from string (0 if invalid) * * Converts a decimal string to an unsigned long. If there are invalid
@@ -59,11 +59,11 @@ unsigned long dectoul(const char *cp, char **endp);/** * strict_strtoul - convert a string to an unsigned long strictly -* @param cp The string to be converted -* @param base The number base to use (0 for the default) -* @param res The converted result value -* Return: 0 if conversion is successful and *res is set to the converted -* value, otherwise it returns -EINVAL and *res is set to 0. +* @cp: The string to be converted +* @base: The number base to use (0 for the default) +* @res: The converted result value +* Return: 0 if conversion is successful and `*res` is set to the converted +* value, otherwise it returns -EINVAL and `*res` is set to 0. * * strict_strtoul converts a string to an unsigned long only if the * string is really an unsigned long string, any string containing
@@ -98,7 +98,7 @@ long long simple_strtoll(const char *cp, char **endp, unsigned int base);* Given a string this finds a trailing number on the string and returns it. * For example, "abc123" would return 123. * -* @str: String to exxamine +* @str: String to examine * Return: trailing number if found, else -1 */ long trailing_strtol (const char *str);
@@ -111,7 +111,7 @@ long trailing_strtol(const char *str);* characters between @str and @end - 1 are examined. If @end is NULL, it is * set to str + strlen(str). * -* @str: String to exxamine +* @str: String to examine * @end: Pointer to end of string to examine, or NULL to use the * whole string * Return: trailing number if found, else -1
@@ -124,7 +124,7 @@ long trailing_strtoln(const char *str, const char *end);* Prints a message on the console(s) and then resets. If CONFIG_PANIC_HANG is * defined, then it will hang instead of resetting. * -* @param fmt: printf() format string for message, which should not include +* @fmt: printf() format string for message, which should not include * \n, followed by arguments */ void panic (const char *fmt, ...)
@@ -139,16 +139,16 @@ void panic(const char *fmt, ...)* This function can be used instead of panic() when your board does not * already use printf(), * to keep code size small. * -* @param fmt: string to display, which should not include \n +* @str: string to display, which should not include \n */ void panic_str (const char *str) __attribute__ ((noreturn));/** * Format a string and place it in a buffer * -* @param buf The buffer to place the result into -* @param fmt The format string to use -* @param ... Arguments for the format string +* @buf: The buffer to place the result into +* @fmt: The format string to use +* @...: Arguments for the format string * * The function returns the number of characters written * into @buf.
@@ -161,9 +161,9 @@ int sprintf(char *buf, const char *fmt, ...)/** * Format a string and place it in a buffer (va_list version) * -* @param buf The buffer to place the result into -* @param fmt The format string to use -* @param args Arguments for the format string +* @buf: The buffer to place the result into +* @fmt: The format string to use +* @args: Arguments for the format string * Return: the number of characters which have been written into * the @buf not including the trailing '\0'. *
@@ -178,7 +178,7 @@ int vsprintf(char *buf, const char *fmt, va_list args);* * This returns a static string containing the decimal representation of the * given value. The returned value may be overwritten by other calls to other -* simple_... functions, so should be used immediately +* simple... functions, so should be used immediately * * @val: Value to convert * Return: string containing the decimal representation of @val
@@ -190,9 +190,9 @@ char *simple_itoa(ulong val);* * This returns a static string containing the hexadecimal representation of the * given value. The returned value may be overwritten by other calls to other -* simple_... functions, so should be used immediately +* simple... functions, so should be used immediately * -* @val: Value to convert +* @num: Value to convert * Return: string containing the hexecimal representation of @val */ char *simple_xtoa (ulong num);
@@ -200,10 +200,10 @@ char *simple_xtoa(ulong num);/** * Format a string and place it in a buffer * -* @param buf The buffer to place the result into -* @param size The size of the buffer, including the trailing null space -* @param fmt The format string to use -* @param ... Arguments for the format string +* @buf: The buffer to place the result into +* @size: The size of the buffer, including the trailing null space +* @fmt: The format string to use +* @...: Arguments for the format string * Return: the number of characters which would be * generated for the given input, excluding the trailing null, * as per ISO C99. If the return is greater than or equal to
@@ -217,10 +217,10 @@ int snprintf(char *buf, size_t size, const char *fmt, ...)/** * Format a string and place it in a buffer * -* @param buf The buffer to place the result into -* @param size The size of the buffer, including the trailing null space -* @param fmt The format string to use -* @param ... Arguments for the format string +* @buf: The buffer to place the result into +* @size: The size of the buffer, including the trailing null space +* @fmt: The format string to use +* @...: Arguments for the format string * * The return value is the number of characters written into @buf not including * the trailing '\0'. If @size is == 0 the function returns 0.
@@ -233,10 +233,10 @@ int scnprintf(char *buf, size_t size, const char *fmt, ...)/** * Format a string and place it in a buffer (base function) * -* @param buf The buffer to place the result into -* @param size The size of the buffer, including the trailing null space -* @param fmt The format string to use -* @param args Arguments for the format string +* @buf: The buffer to place the result into +* @size: The size of the buffer, including the trailing null space +* @fmt: The format string to use +* @args: Arguments for the format string * Return: The number characters which would be generated for the given * input, excluding the trailing '\0', as per ISO C99. Note that fewer * characters may be written if this number of characters is >= size.
@@ -258,10 +258,10 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args);/** * Format a string and place it in a buffer (va_list version) * -* @param buf The buffer to place the result into -* @param size The size of the buffer, including the trailing null space -* @param fmt The format string to use -* @param args Arguments for the format string +* @buf: The buffer to place the result into +* @size: The size of the buffer, including the trailing null space +* @fmt: The format string to use +* @args: Arguments for the format string * Return: the number of characters which have been written into * the @buf not including the trailing '\0'. If @size is == 0 the function * returns 0.
@@ -278,8 +278,8 @@ int vscnprintf(char *buf, size_t size, const char *fmt, va_list args);* This prints a value with grouped digits, like 12,345,678 to make it easier * to read. * -* @val: Value to print -* @digits: Number of digiits to print +* @int_val: Value to print +* @digits: Number of digiits to print */ void print_grouped_ull (unsigned long long int_val,int digits);
@@ -309,9 +309,9 @@ void str_to_upper(const char *in, char *out, size_t len);/** * vsscanf - Unformat a buffer into a list of arguments -* @buf: input buffer -* @fmt: format of buffer -* @args: arguments +* @inp: input buffer +* @fmt0: format of buffer +* @ap: arguments */ int vsscanf (const char *inp,char const *fmt0,va_list ap);
Signature · 1 line
2.35.1.616.g0bdcbb4464-goog
PATCH v4 4/33 lib: Fix a few bugs in trailing_strtoln()
In reply to Simon GlassAt present this has a minor bug in that it reads the byte before the start of the string, if it is empty. Also it doesn't handle a non-numeric prefix which is only one character long.
Fix these bugs with a reworked implementation. Add a test for the second case. The first one is hard to test.
---
Changes in v4:
- Correct the commit tag
- Reword the commit message
- Update the function comment to clarify its intert / limitations
include/vsprintf.h | 3 +++ lib/strto.c | 11 ++++++----- test/str_ut.c | 2 ++ 3 files changed, 11 insertions(+), 5 deletions(-)
include/vsprintf.h +3 -0
@@ -98,6 +98,9 @@ long long simple_strtoll(const char *cp, char **endp, unsigned int base);* Given a string this finds a trailing number on the string and returns it. * For example, "abc123" would return 123. * +* Note that this does not handle a string without a prefix. See dectoul() for +* that case. +* * @str: String to examine * Return: trailing number if found, else -1 */
lib/strto.c +6 -5
@@ -189,11 +189,12 @@ long trailing_strtoln(const char *str, const char *end)if (!end) end = str +strlen (str); -if (isdigit (end[-1 ])) { -for (p = end -1 ; p > str; p--) { -if (!isdigit (*p)) -return dectoul (p +1 ,NULL ); - } + p = end -1 ; +if (p > str &&isdigit (*p)) { +do { +if (!isdigit (p[-1 ])) +return dectoul (p,NULL ); + }while (--p > str); }return -1 ;
test/str_ut.c +2 -0
@@ -257,6 +257,8 @@ static int str_trailing(struct unit_test_state *uts)ut_asserteq (123 ,trailing_strtoln (str1, str1 +6 ));ut_asserteq (-1 ,trailing_strtoln (str1, str1 +9 )); +ut_asserteq (3 ,trailing_strtol ("a3" )); +return 0 ; }STR_TEST (str_trailing,0 );
Signature · 1 line
2.35.1.616.g0bdcbb4464-goog
PATCH v4 5/33 lib: Add a way to find the postiion of a trailing number
In reply to Simon GlassAt present it is not possible to find out which part of the string is the number part and which is before it. Add a new variant which provides this feature, so we can separate the two in the caller.
---
Changes in v4:
- Use new Return style in function comments
Changes in v3:
- Add some tests, including one for 'abc123def456'
- Change the function to return a pointer to the first digit
include/vsprintf.h | 18 ++++++++++++++++++ lib/strto.c | 14 ++++++++++++-- test/str_ut.c | 13 ++++++++++++- 3 files changed, 42 insertions(+), 3 deletions(-)
include/vsprintf.h +18 -0
@@ -121,6 +121,24 @@ long trailing_strtol(const char *str);*/ long trailing_strtoln (const char *str,const char *end); +/** +* trailing_strtoln_end() - extract trailing integer from a fixed-length string +* +* Given a fixed-length string this finds a trailing number on the string +* and returns it. For example, "abc123" would return 123. Only the +* characters between @str and @end - 1 are examined. If @end is NULL, it is +* set to str + strlen(str). +* +* @str: String to examine +* @end: Pointer to end of string to examine, or NULL to use the +* whole string +* @endp: If non-NULL, this is set to point to the character where the +* number starts, e.g. for "mmc0" this would be point to the '0'; if no +* trailing number is found, it is set to the end of the string +* Return: training number if found, else -1 +*/ +long trailing_strtoln_end (const char *str,const char *end,char const **endp); +/** * panic() - Print a message and reset/hang *
lib/strto.c +12 -2
@@ -183,7 +183,7 @@ long long simple_strtoll(const char *cp, char **endp, unsigned int base)return simple_strtoull (cp, endp, base); } -long trailing_strtoln (const char *str,const char *end) +long trailing_strtoln_end (const char *str,const char *end,char const **endp) {const char *p;
@@ -192,14 +192,24 @@ long trailing_strtoln(const char *str, const char *end) p = end -1 ;if (p > str &&isdigit (*p)) {do { -if (!isdigit (p[-1 ])) +if (!isdigit (p[-1 ])) { +if (endp) + *endp = p;return dectoul (p,NULL ); + } }while (--p > str); } +if (endp) + *endp = end;return -1 ; } +long trailing_strtoln (const char *str,const char *end) +{ +return trailing_strtoln_end (str, end,NULL ); +} +long trailing_strtol (const char *str) {return trailing_strtoln (str,NULL );
test/str_ut.c +12 -1
@@ -244,7 +244,9 @@ STR_TEST(str_xtoa, 0);static int str_trailing (struct unit_test_state *uts) { -char str1[] ="abc123def" ; +const char str1[] ="abc123def" ; +const char str2[] ="abc123def456" ; +const char *end;ut_asserteq (-1 ,trailing_strtol ("" ));ut_asserteq (-1 ,trailing_strtol ("123" ));
@@ -259,6 +261,15 @@ static int str_trailing(struct unit_test_state *uts)ut_asserteq (3 ,trailing_strtol ("a3" )); +ut_asserteq (123 ,trailing_strtoln_end (str1, str1 +6 , &end)); +ut_asserteq (3 , end - str1); + +ut_asserteq (-1 ,trailing_strtoln_end (str1, str1 +7 , &end)); +ut_asserteq (7 , end - str1); + +ut_asserteq (456 ,trailing_strtoln_end (str2,NULL , &end)); +ut_asserteq (9 , end - str2); +return 0 ; }STR_TEST (str_trailing,0 );
Signature · 1 line
2.35.1.616.g0bdcbb4464-goog
PATCH v4 6/33 dm: core: Rename and fix uclass_get_by_name_len()
In reply to Simon GlassIt seems that namelen is more common in U-Boot. Rename this function to fit in better. Also fix a bug where it breaks the operation of uclass_get_by_name() and add a test.
---
Changes in v4:
- Correct bug in this function and add test
- Use new sphynx Return style
Changes in v3:
- Add new patch to rename uclass_get_by_name_len()
drivers/core/uclass.c | 7 ++++--- include/dm/uclass.h | 6 +++--- test/dm/core.c | 2 ++ 3 files changed, 9 insertions(+), 6 deletions(-)
drivers/core/uclass.c +4 -3
@@ -180,14 +180,15 @@ void uclass_set_priv(struct uclass *uc, void *priv) uc->priv_ = priv; } -enum uclass_id uclass_get_by_name_len (const char *name,int len) +enum uclass_id uclass_get_by_namelen (const char *name,int len) {int i;for (i =0 ; i <UCLASS_COUNT ; i++) {struct uclass_driver *uc_drv =lists_uclass_lookup (i); -if (uc_drv && !strncmp (uc_drv->name, name, len)) +if (uc_drv && !strncmp (uc_drv->name, name, len) && +strlen (uc_drv->name) == len)return i; }
@@ -196,7 +197,7 @@ enum uclass_id uclass_get_by_name_len(const char *name, int len)enum uclass_id uclass_get_by_name (const char *name) { -return uclass_get_by_name_len (name,strlen (name)); +return uclass_get_by_namelen (name,strlen (name)); }int dev_get_uclass_index (struct udevice *dev,struct uclass **ucp)
include/dm/uclass.h +3 -3
@@ -173,13 +173,13 @@ int uclass_get(enum uclass_id key, struct uclass **ucp);const char *uclass_get_name (enum uclass_id id);/** -* uclass_get_by_name_len() - Look up a uclass by its partial driver name +* uclass_get_by_namelen() - Look up a uclass by its driver name * * @name: Name to look up -* @len: Length of the partial name +* @len: Length of @name (the uclass driver name must have the same length) * Return: the associated uclass ID, or UCLASS_INVALID if not found */ -enum uclass_id uclass_get_by_name_len (const char *name,int len); +enum uclass_id uclass_get_by_namelen (const char *name,int len);/** * uclass_get_by_name() - Look up a uclass by its driver name
test/dm/core.c +2 -0
@@ -1161,6 +1161,8 @@ static int dm_test_uclass_names(struct unit_test_state *uts)ut_asserteq_str ("test" ,uclass_get_name (UCLASS_TEST ));ut_asserteq (UCLASS_TEST ,uclass_get_by_name ("test" )); +ut_asserteq (UCLASS_SPI ,uclass_get_by_name ("spi" )); +return 0 ; }DM_TEST (dm_test_uclass_names,UT_TESTF_SCAN_PDATA );
Signature · 1 line
2.35.1.616.g0bdcbb4464-goog
PATCH v4 7/33 dm: core: Allow finding a uclass device by partial name
In reply to Simon GlassIn some cases two devices are related and the only way to tell is to check that the names partially patch. Add a way to check this without needing to create a new string for the comparison.
Fix the comment for device_find_child_by_namelen() while we are here.
---
Changes in v4:
- Add a test also
- Use new sphynx Return style
Changes in v3:
- Add new patch to support finding a uclass device by partial name
drivers/core/uclass.c | 13 ++++++++++--- include/dm/device.h | 2 +- include/dm/uclass-internal.h | 16 ++++++++++++++++ test/dm/core.c | 15 +++++++++++++++ 4 files changed, 42 insertions(+), 4 deletions(-)
drivers/core/uclass.c +10 -3
@@ -274,8 +274,8 @@ int uclass_find_next_device(struct udevice **devp)return 0 ; } -int uclass_find_device_by_name (enum uclass_id id,const char *name, -struct udevice **devp) +int uclass_find_device_by_namelen (enum uclass_id id,const char *name,int len, +struct udevice **devp) {struct uclass *uc;struct udevice *dev;
@@ -289,7 +289,8 @@ int uclass_find_device_by_name(enum uclass_id id, const char *name,return ret; uclass_foreach_dev(dev, uc) { -if (!strcmp (dev->name, name)) { +if (!strncmp (dev->name, name, len) && +strlen (dev->name) == len) { *devp = dev;return 0 ; }
@@ -298,6 +299,12 @@ int uclass_find_device_by_name(enum uclass_id id, const char *name,return -ENODEV ; } +int uclass_find_device_by_name (enum uclass_id id,const char *name, +struct udevice **devp) +{ +return uclass_find_device_by_namelen (id, name,strlen (name), devp); +} +int uclass_find_next_free_seq (struct uclass *uc) {struct udevice *dev;
include/dm/device.h +1 -1
@@ -791,7 +791,7 @@ int device_find_first_child_by_uclass(const struct udevice *parent, struct udevice **devp);/** -* device_find_child_by_name() - Find a child by device name +* device_find_child_by_namelen() - Find a child by device name * * @parent: Parent device to search * @name: Name to look for
include/dm/uclass-internal.h +16 -0
@@ -154,6 +154,22 @@ int uclass_find_first_device(enum uclass_id id, struct udevice **devp);*/ int uclass_find_next_device (struct udevice **devp); +/** +* uclass_find_device_by_namelen() - Find uclass device based on ID and name +* +* This searches for a device with the exactly given name. +* +* The device is NOT probed, it is merely returned. +* +* @id: ID to look up +* @name: name of a device to find +* @len: Length of @name (the uclass driver name must have the same length) +* @devp: Returns pointer to device (the first one with the name) +* Return: 0 if OK, -ve on error +*/ +int uclass_find_device_by_namelen (enum uclass_id id,const char *name,int len, +struct udevice **devp); +/** * uclass_find_device_by_name() - Find uclass device based on ID and name *
test/dm/core.c +15 -0
@@ -1260,3 +1260,18 @@ static int dm_test_get_stats(struct unit_test_state *uts)return 0 ; }DM_TEST (dm_test_get_stats,UT_TESTF_SCAN_FDT ); + +/* Test uclass_find_device_by_name() */ +static int dm_test_uclass_find_device (struct unit_test_state *uts) +{ +struct udevice *dev; + +ut_assertok (uclass_find_device_by_name (UCLASS_I2C ,"i2c@0" , &dev)); +ut_asserteq (-ENODEV , +uclass_find_device_by_name (UCLASS_I2C ,"i2c@0x" , &dev)); +ut_assertok (uclass_find_device_by_namelen (UCLASS_I2C ,"i2c@0x" ,5 , + &dev)); + +return 0 ; +} +DM_TEST (dm_test_uclass_find_device,UT_TESTF_SCAN_FDT );
Signature · 1 line
2.35.1.616.g0bdcbb4464-goog
PATCH v4 8/33 test: fastboot: Avoid using mmc1
In reply to Simon GlassThe bootflow tests need to use an MMC with an associated backing file containing a filesystem. Update the fastboot tests to cope with this.
---
(no changes since v1)
test/dm/fastboot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
test/dm/fastboot.c +2 -2
@@ -81,9 +81,9 @@ static int dm_test_fastboot_mmc_part(struct unit_test_state *uts) &part_info, response));ut_asserteq (0 ,fastboot_mmc_get_part_info ("0.0:0" , &fb_dev_desc, &part_info, response)); -ut_asserteq (0 ,fastboot_mmc_get_part_info ("1" , &fb_dev_desc, +ut_asserteq (0 ,fastboot_mmc_get_part_info ("2" , &fb_dev_desc, &part_info, response)); -ut_asserteq (0 ,fastboot_mmc_get_part_info ("1.0" , &fb_dev_desc, +ut_asserteq (0 ,fastboot_mmc_get_part_info ("2.0" , &fb_dev_desc, &part_info, response));ut_asserteq (1 ,fastboot_mmc_get_part_info (":1" , &fb_dev_desc, &part_info, response));
Signature · 1 line
2.35.1.616.g0bdcbb4464-goog
PATCH v4 9/33 test: dm: Restart USB before assuming it is stopped
In reply to Simon GlassUpdate the blk test to stop USB first, in case another test has started it.
---
(no changes since v1)
test/dm/blk.c | 6 ++++++ 1 file changed, 6 insertions(+)
test/dm/blk.c +6 -0
@@ -15,6 +15,9 @@DECLARE_GLOBAL_DATA_PTR ; +/* Allow resetting the USB-started flag */ +extern char usb_started; +/* Test that block devices can be created */ static int dm_test_blk_base (struct unit_test_state *uts) {
@@ -66,8 +69,11 @@ static int dm_test_blk_usb(struct unit_test_state *uts)struct udevice *usb_dev, *dev;struct blk_desc *dev_desc; + usb_started = false; +/* Get a flash device */ state_set_skip_delays (true); +ut_assertok (usb_stop ());ut_assertok (usb_init ());ut_assertok (uclass_get_device (UCLASS_MASS_STORAGE ,0 , &usb_dev));ut_assertok (blk_get_device_by_str ("usb" ,"0" , &dev_desc));
Signature · 1 line
2.35.1.616.g0bdcbb4464-goog
PATCH v4 10/33 dm: blk: Add a function to return the device type
In reply to Simon GlassUse the uclass name to get the device type for a block device.
---
Changes in v4:
- Use new sphynx Return style
drivers/block/blk-uclass.c | 7 +++++++ include/blk.h | 8 ++++++++ 2 files changed, 15 insertions(+)
drivers/block/blk-uclass.c +7 -0
@@ -509,6 +509,13 @@ int blk_get_from_parent(struct udevice *parent, struct udevice **devp)return 0 ; } +const char *blk_get_devtype (struct udevice *dev) +{ +struct udevice *parent =dev_get_parent (dev); + +return uclass_get_name (device_get_uclass_id (parent)); +}; +int blk_find_max_devnum (enum if_type if_type) {struct udevice *dev;
include/blk.h +8 -0
@@ -433,6 +433,14 @@ int blk_select_hwpart(struct udevice *dev, int hwpart);*/ int blk_get_from_parent (struct udevice *parent,struct udevice **devp); +/** +* blk_get_devtype() - Get the device type of a block device +* +* @dev: Block device to check +* Return: device tree, i.e. the uclass name of its parent, e.g. "mmc" +*/ +const char *blk_get_devtype (struct udevice *dev); +/** * blk_get_by_device() - Get the block device descriptor for the given device * @dev: Instance of a storage device
Signature · 1 line
2.35.1.616.g0bdcbb4464-goog
PATCH v4 11/33 fs: Add a function to set the filesystem type
In reply to Simon GlassWhen sandbox is used with hostfs we won't have a block device, but still must set up the filesystem type before any filesystem operation, such as loading a file. Add a function to handle this.
---
Changes in v4:
- Add new patch with a function to set the filesystem type
fs/fs.c | 5 +++++ include/fs.h | 11 +++++++++++ 2 files changed, 16 insertions(+)
fs/fs.c +5 -0
@@ -34,6 +34,11 @@ static int fs_dev_part;static struct disk_partition fs_partition;static int fs_type =FS_TYPE_ANY ; +void fs_set_type (int type) +{ + fs_type = type; +} +static inline int fs_probe_unsupported (struct blk_desc *fs_dev_desc,struct disk_partition *fs_partition) {
include/fs.h +11 -0
@@ -55,6 +55,17 @@ int do_ext2load(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);*/ int fs_set_blk_dev (const char *ifname,const char *dev_part_str,int fstype); +/** +* fs_set_type() - Tell fs layer which filesystem type is used +* +* This is needed when reading from a non-block device such as sandbox. It does +* a similar job to fs_set_blk_dev() but just sets the filesystem type instead +* of detecting it and loading it on the block device +* +* @type: Filesystem type to use (FS_TYPE...) +*/ +void fs_set_type (int type); +/* * fs_set_blk_dev_with_part - Set current block device + partition *
Signature · 1 line
2.35.1.616.g0bdcbb4464-goog
PATCH v4 12/33 bootstd: Add the concept of a bootflow
In reply to Simon GlassA bootflow encapsulates the process used to boot an operating system. It typically has a control file (such as extlinux.conf) and information about which 'bootdev' it came from.
Add the header file for this first, since it is needed by all other files.
---
Changes in v4:
- Add a new fs_type field for use with sandbox
- Use new Return style in function comments
Changes in v3:
- Mention bootflow_state[] in enum bootflow_state_t
MAINTAINERS | 5 + include/bootflow.h | 260 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 265 insertions(+) create mode 100644 include/bootflow.h
MAINTAINERS +5 -0
@@ -682,6 +682,11 @@ M: Simon Glass <[email protected]> S: Maintained F: tools/binman/ +BOOTDEVICE +M: Simon Glass <[email protected]> +S: Maintained +F: include/bootflow.h + BTRFS M: Marek Behun <[email protected]> R: Qu Wenruo <[email protected]>
include/bootflow.h new file +260 -0
260 lines not on this page · raw message
Signature · 1 line
2.35.1.616.g0bdcbb4464-goog
PATCH v4 13/33 bootstd: Add the bootstd uclass and core implementation
In reply to Simon GlassThe 'bootstd' device provides the central information about U-Boot standard boot.
Add a uclass for bootstd and the various helpers needed to make it work. Also add a binding file.
---
Changes in v4:
- NULL-terminate the default prefix list
- Use new Return style in function comments
Changes in v3:
- Add CONFIG_BOOTSTD_FULL to enable the full feature set
- Support bootdev-order and filename-prefixes only with CONFIG_BOOTSTD_FULL
MAINTAINERS | 2 + boot/Kconfig | 34 ++++++ boot/Makefile | 3 + boot/bootstd-uclass.c | 152 +++++++++++++++++++++++++++ doc/device-tree-bindings/bootstd.txt | 28 +++++ include/bootstd.h | 80 ++++++++++++++ include/dm/uclass-id.h | 1 + 7 files changed, 300 insertions(+) create mode 100644 boot/bootstd-uclass.c create mode 100644 doc/device-tree-bindings/bootstd.txt create mode 100644 include/bootstd.h
MAINTAINERS +2 -0
@@ -685,6 +685,8 @@ F: tools/binman/ BOOTDEVICE M: Simon Glass <[email protected]> S: Maintained +F: boot/bootstd.c +F: include/bootstd.h F: include/bootflow.h BTRFS
boot/Kconfig +34 -0
@@ -292,6 +292,40 @@ endif # SPL endif # FIT +config BOOTSTD + bool "Standard boot support" + default y + depends on DM && OF_CONTROL && BLK + help + U-Boot supports a standard way of locating something to boot, + typically an Operating System such as Linux, provided by a distro such + as Arch Linux or Debian. Enable this to support iterating through + available bootdevs and using bootmeths to find bootflows suitable for + booting. + + Standard boot is not a standard way of booting, just a framework + within U-Boot for supporting all the different ways that exist. + + Terminology: + + - bootdev - a device which can hold a distro (e.g. MMC) + - bootmeth - a method to scan a bootdev to find bootflows (owned by + U-Boot) + - bootflow - a description of how to boot (owned by the distro) + +config BOOTSTD_FULL + bool "Enhanced features for standard boot" + default y if SANDBOX + help + This enables various useful features for standard boot, which are not + essential for operation: + + - bootdev, bootmeth commands + - extra features in the bootflow command + - support for selecting the ordering of bootmeths ("bootmeth order") + - support for selecting the ordering of bootdevs using the devicetree + as well as the "boot_targets" environment variable + config LEGACY_IMAGE_FORMAT bool "Enable support for the legacy image format" default y if !FIT_SIGNATURE
boot/Makefile +3 -0
@@ -22,6 +22,9 @@ endif obj-y += image.o image-board.o obj-$(CONFIG_ANDROID_AB) += android_ab.o obj-$(CONFIG_ANDROID_BOOT_IMAGE) += image-android.o image-android-dt.o + +obj-$(CONFIG_$(SPL_TPL_)BOOTSTD) += bootstd-uclass.o + obj-$(CONFIG_$(SPL_TPL_)OF_LIBFDT) += image-fdt.o obj-$(CONFIG_$(SPL_TPL_)FIT_SIGNATURE) += fdt_region.o obj-$(CONFIG_$(SPL_TPL_)FIT) += image-fit.o
boot/bootstd-uclass.c new file +152 -0
152 lines not on this page · raw message
doc/device-tree-bindings/bootstd.txt new file +28 -0
@@ -0,0 +1,28 @@ +U-Boot standard boot device (bootstd) +===================================== + +This is the controlling device for U-Boot standard boot, providing a way to +boot operating systems in a way that can be controlled by distros. + +Required properties: + +compatible: "u-boot,boot-std" + +Optional properties: + +filename-prefixes: + List of strings, each a directory to search for bootflow files + +bootdev-order: + List of bootdevs to check for bootflows, each a bootdev label (the media + uclass followed by the numeric sequence number of the media device) + + +Example: + + bootstd { + compatible = "u-boot,boot-std"; + + filename-prefixes = "/", "/boot/"; + bootdev-order = "mmc2", "mmc1"; + };
include/bootstd.h new file +80 -0
80 lines not on this page · raw message
include/dm/uclass-id.h +1 -0
@@ -38,6 +38,7 @@ enum uclass_id {UCLASS_AXI ,/* AXI bus */ UCLASS_BLK ,/* Block device */ UCLASS_BOOTCOUNT ,/* Bootcount backing store */ +UCLASS_BOOTSTD ,/* Standard boot driver */ UCLASS_BUTTON ,/* Button */ UCLASS_CACHE ,/* Cache controller */ UCLASS_CLK, /* Clock source, e.g. used by peripherals */
Signature · 1 line
2.35.1.616.g0bdcbb4464-goog
Re: [PATCH v4 13/33] bootstd: Add the bootstd uclass and core implementation
Hi Simon,
+
Quoted 50 lines
boot/bootstd-uclass.c new file +44
-0+/* For now, bind the boormethod device if none are found in the devicetree */ +int dm_scan_other (bool pre_reloc_only) +{ +struct udevice *bootstd; +int ret; + +/* These are not needed before relocation */ +if (!(gd->flags &GD_FLG_RELOC )) +return 0 ; + +/* Create a bootstd device if needed */ +uclass_find_first_device (UCLASS_BOOTSTD , &bootstd); +if (!bootstd) { + ret =device_bind_driver (gd->dm_root,"bootstd_drv" ,"bootstd" , + &bootstd); +if (ret) +return log_msg_ret ("bootstd" , ret); + } + +return 0 ; +} + +static const struct udevice_id bootstd_ids[] = { + { .compatible ="u-boot,boot-std" }, + { } +}; + +U_BOOT_DRIVER (bootstd_drv) = { + .id =UCLASS_BOOTSTD , + .name ="bootstd_drv" , + .of_to_plat = bootstd_of_to_plat, + .probe = bootstd_probe, + .remove = bootstd_remove, + .of_match = bootstd_ids, + .priv_auto =sizeof (struct bootstd_priv ), +}; + +UCLASS_DRIVER (bootstd) = { + .id =UCLASS_BOOTSTD , + .name ="bootstd" , +#if CONFIG_IS_ENABLED(OF_REAL) + .post_bind = dm_scan_fdt_dev, +#endif +};doc/device-tree-bindings/bootstd.txt new file +0
-0
doc/device-tree-bindings/bootstd.txt line 5
Quoted 5 lines
doc/device-tree-bindings/bootstd.txt new file +5
-0@@ -0,0 +1,28 @@ +U-Boot standard boot device (bootstd) +===================================== + +This is the controlling device for U-Boot standard boot, providing a way to +boot operating systems in a way that can be controlled by distros.
A bit more info on how this can be controlled by distros would be helpful. What are you expecting from distros here? Most of the current installers (at least on x86 and armv8) set the Boot0000 to SHIM and assume the efibootmgr will take care of that.
doc/device-tree-bindings/bootstd.txt line 9
Quoted 4 lines
doc/device-tree-bindings/bootstd.txt new file +4
-0+ +Required properties: + +compatible: "u-boot,boot-std"
This needs to end up on every board controldtb? Or is there another way of defining those nodes?
Quoted 9 lines
doc/device-tree-bindings/bootstd.txt new file +9
-0+ +Optional properties: + +filename-prefixes: + List of strings, each a directory to search for bootflow files + +bootdev-order: + List of bootdevs to check for bootflows, each a bootdev label (the media + uclass followed by the numeric sequence number of the media device)
doc/device-tree-bindings/bootstd.txt line 28
Quoted 10 lines
doc/device-tree-bindings/bootstd.txt new file +10
-0+ + +Example: + + bootstd { + compatible = "u-boot,boot-std"; + + filename-prefixes = "/", "/boot/"; + bootdev-order = "mmc2", "mmc1"; + };
[...]
Thanks
/Ilias
Re: [PATCH v4 13/33] bootstd: Add the bootstd uclass and core implementation
Hi Ilias,
Quoted 56 lines · Ilias Apalodimas
Hi Simon,
+
Quoted 52 lines
boot/bootstd-uclass.c new file +44
-0+/* For now, bind the boormethod device if none are found in the devicetree */ +int dm_scan_other (bool pre_reloc_only) +{ +struct udevice *bootstd; +int ret; + +/* These are not needed before relocation */ +if (!(gd->flags &GD_FLG_RELOC )) +return 0 ; + +/* Create a bootstd device if needed */ +uclass_find_first_device (UCLASS_BOOTSTD , &bootstd); +if (!bootstd) { + ret =device_bind_driver (gd->dm_root,"bootstd_drv" ,"bootstd" , + &bootstd); +if (ret) +return log_msg_ret ("bootstd" , ret); + } + +return 0 ; +} + +static const struct udevice_id bootstd_ids[] = { + { .compatible ="u-boot,boot-std" }, + { } +}; + +U_BOOT_DRIVER (bootstd_drv) = { + .id =UCLASS_BOOTSTD , + .name ="bootstd_drv" , + .of_to_plat = bootstd_of_to_plat, + .probe = bootstd_probe, + .remove = bootstd_remove, + .of_match = bootstd_ids, + .priv_auto =sizeof (struct bootstd_priv ), +}; + +UCLASS_DRIVER (bootstd) = { + .id =UCLASS_BOOTSTD , + .name ="bootstd" , +#if CONFIG_IS_ENABLED(OF_REAL) + .post_bind = dm_scan_fdt_dev, +#endif +};doc/device-tree-bindings/bootstd.txt new file +2
-0@@ -0,0 +1,28 @@ +U-Boot standard boot device (bootstd) +=====================================
Quoted 8 lines
doc/device-tree-bindings/bootstd.txt line 5
Quoted 3 lines
doc/device-tree-bindings/bootstd.txt new file +3
-0+ +This is the controlling device for U-Boot standard boot, providing a way to +boot operating systems in a way that can be controlled by distros.A bit more info on how this can be controlled by distros would be helpful. What are you expecting from distros here? Most of the current installers (at least on x86 and armv8) set the Boot0000 to SHIM and assume the efibootmgr will take care of that.
Well then it would use the bootmgr bootmeth, which is included in this series. Most of the code here is related to moving on from the current scripts.
Quoted 7 lines
doc/device-tree-bindings/bootstd.txt line 9
Quoted 4 lines
doc/device-tree-bindings/bootstd.txt new file +4
-0+ +Required properties: + +compatible: "u-boot,boot-std"This needs to end up on every board controldtb? Or is there another way of defining those nodes?
No, this node is optional.
Quoted 14 lines
Quoted 14 lines
doc/device-tree-bindings/bootstd.txt new file +13
-0+ +Optional properties: + +filename-prefixes: + List of strings, each a directory to search for bootflow files + +bootdev-order: + List of bootdevs to check for bootflows, each a bootdev label (the media + uclass followed by the numeric sequence number of the media device) + + +Example: +
Quoted 8 lines
Quoted 6 lines
doc/device-tree-bindings/bootstd.txt new file +6
-0+ bootstd { + compatible = "u-boot,boot-std"; + + filename-prefixes = "/", "/boot/"; + bootdev-order = "mmc2", "mmc1"; + };[...]
Regards,
Simon
PATCH v4 14/33 bootstd: Add the bootdev uclass
In reply to Simon GlassA 'bootdev' is a device which can be used to boot an operating system. It is a child of the media device (e.g. MMC) which handles reading files from that device, such as a bootflow file.
Add a uclass for bootdev and the various helpers needed to make it work. Also add a binding file, empty for now.
---
Changes in v4:
- Use new Return style in function comments
Changes in v3:
- Add bootdev_get_from_blk() function
- Move bootdev ordering into the uclass
- Update for the new trailing_strtoln_end()
- Use blk_find_device() to find the block device for a media device
MAINTAINERS | 4 +- boot/Makefile | 1 + boot/bootdev-uclass.c | 640 +++++++++++++++++++++++++++ doc/device-tree-bindings/bootdev.txt | 8 + include/bootdev.h | 275 ++++++++++++ include/dm/uclass-id.h | 1 + 6 files changed, 928 insertions(+), 1 deletion(-) create mode 100644 boot/bootdev-uclass.c create mode 100644 doc/device-tree-bindings/bootdev.txt create mode 100644 include/bootdev.h
MAINTAINERS +3 -1
@@ -685,9 +685,11 @@ F: tools/binman/ BOOTDEVICE M: Simon Glass <[email protected]> S: Maintained +F: boot/bootdev*.c F: boot/bootstd.c -F: include/bootstd.h +F: include/bootdev*.h F: include/bootflow.h +F: include/bootstd.h BTRFS M: Marek Behun <[email protected]>
boot/Makefile +1 -0
@@ -23,6 +23,7 @@ obj-y += image.o image-board.o obj-$(CONFIG_ANDROID_AB) += android_ab.o obj-$(CONFIG_ANDROID_BOOT_IMAGE) += image-android.o image-android-dt.o +obj-$(CONFIG_$(SPL_TPL_)BOOTSTD) += bootdev-uclass.o obj-$(CONFIG_$(SPL_TPL_)BOOTSTD) += bootstd-uclass.o obj-$(CONFIG_$(SPL_TPL_)OF_LIBFDT) += image-fdt.o
boot/bootdev-uclass.c new file +640 -0
640 lines not on this page · raw message
doc/device-tree-bindings/bootdev.txt new file +8 -0
@@ -0,0 +1,8 @@ +U-Boot boot device (bootdev) +============================ + +A bootdev provides a way to obtain a bootflow file from a device. It is a +child of the media device (UCLASS_MMC, UCLASS_SPI_FLASH, etc.) + +The bootdev driver is provided by the media devices. The bindings for each +are described in this file (to come).
include/bootdev.h new file +275 -0
275 lines not on this page · raw message
include/dm/uclass-id.h +1 -0
@@ -38,6 +38,7 @@ enum uclass_id {UCLASS_AXI ,/* AXI bus */ UCLASS_BLK ,/* Block device */ UCLASS_BOOTCOUNT ,/* Bootcount backing store */ +UCLASS_BOOTDEV ,/* Boot device for locating an OS to boot */ UCLASS_BOOTSTD ,/* Standard boot driver */ UCLASS_BUTTON ,/* Button */ UCLASS_CACHE, /* Cache controller */
Signature · 1 line
2.35.1.616.g0bdcbb4464-goog
PATCH v4 15/33 bootstd: Add the bootmeth uclass and helpers
In reply to Simon GlassA bootmeth is a method of locating an operating system. For now, just add the uclass itself. Drivers for particular bootmeths are added later.
If no bootmeths devices are included in the devicetree, create them automatically. This avoids the need for boilerplate in the devicetree files.
---
Changes in v4:
- Split out the file setup into into its own function
- Use new Return style in function comments
Changes in v3:
- Add some more common functions
- Move bootmeth ordering into the uclass
- Support "bootmeths" env var
MAINTAINERS | 2 + boot/Makefile | 1 + boot/bootmeth-uclass.c | 333 +++++++++++++++++++++++++++++++++++++++++ boot/bootstd-uclass.c | 29 +++- include/bootmeth.h | 234 +++++++++++++++++++++++++++++ include/dm/uclass-id.h | 1 + include/env_callback.h | 7 + 7 files changed, 605 insertions(+), 2 deletions(-) create mode 100644 boot/bootmeth-uclass.c create mode 100644 include/bootmeth.h
MAINTAINERS +2 -0
@@ -685,10 +685,12 @@ F: tools/binman/ BOOTDEVICE M: Simon Glass <[email protected]> S: Maintained +F: boot/bootmeth*.c F: boot/bootdev*.c F: boot/bootstd.c F: include/bootdev*.h F: include/bootflow.h +F: include/bootmeth.h F: include/bootstd.h BTRFS
boot/Makefile +1 -0
@@ -24,6 +24,7 @@ obj-$(CONFIG_ANDROID_AB) += android_ab.o obj-$(CONFIG_ANDROID_BOOT_IMAGE) += image-android.o image-android-dt.o obj-$(CONFIG_$(SPL_TPL_)BOOTSTD) += bootdev-uclass.o +obj-$(CONFIG_$(SPL_TPL_)BOOTSTD) += bootmeth-uclass.o obj-$(CONFIG_$(SPL_TPL_)BOOTSTD) += bootstd-uclass.o obj-$(CONFIG_$(SPL_TPL_)OF_LIBFDT) += image-fdt.o
boot/bootmeth-uclass.c new file +333 -0
333 lines not on this page · raw message
boot/bootstd-uclass.c +27 -2
@@ -109,8 +109,10 @@ static int bootstd_probe(struct udevice *dev)/* For now, bind the boormethod device if none are found in the devicetree */ int dm_scan_other (bool pre_reloc_only) { -struct udevice *bootstd; -int ret; + struct driver *drv = ll_entry_start(struct driver, driver); + const int n_ents = ll_entry_count(struct driver, driver); +struct udevice *dev, *bootstd; +int i, ret;/* These are not needed before relocation */ if (!(gd->flags &GD_FLG_RELOC ))
@@ -125,6 +127,29 @@ int dm_scan_other(bool pre_reloc_only)return log_msg_ret ("bootstd" , ret); } +/* If there are no bootmeth devices, create them */ +uclass_find_first_device (UCLASS_BOOTMETH , &dev); +if (dev) +return 0 ; + +for (i =0 ; i < n_ents; i++, drv++) { +/* +* Disable EFI Manager for now as no one uses it so it is +* confusing +*/ +if (drv->id ==UCLASS_BOOTMETH && +strcmp ("efi_mgr_bootmeth" , drv->name)) { +const char *name = drv->name; + +if (!strncmp ("bootmeth_" , name,9 )) + name +=9 ; + ret =device_bind (bootstd, drv, name,0 ,ofnode_null (), + &dev); +if (ret) +return log_msg_ret ("meth" , ret); + } + } +return 0 ; }
include/bootmeth.h new file +234 -0
234 lines not on this page · raw message
include/dm/uclass-id.h +1 -0
@@ -39,6 +39,7 @@ enum uclass_id {UCLASS_BLK ,/* Block device */ UCLASS_BOOTCOUNT ,/* Bootcount backing store */ UCLASS_BOOTDEV ,/* Boot device for locating an OS to boot */ +UCLASS_BOOTMETH ,/* Bootmethod for booting an OS */ UCLASS_BOOTSTD ,/* Standard boot driver */ UCLASS_BUTTON ,/* Button */ UCLASS_CACHE, /* Cache controller */
include/env_callback.h +7 -0
@@ -57,6 +57,12 @@#define NET_CALLBACKS #endif +#ifdef CONFIG_BOOTSTD +#define BOOTSTD_CALLBACK "bootmeths:bootmeths," +#else +#define BOOTSTD_CALLBACK +#endif +/* * This list of callback bindings is static, but may be overridden by defining * a new association in the ".callbacks" environment variable.
@@ -65,6 +71,7 @@ ENV_DOT_ESCAPE ENV_FLAGS_VAR ":flags," \"baudrate:baudrate," \NET_CALLBACKS \ +BOOTSTD_CALLBACK \"loadaddr:loadaddr," \SILENT_CALLBACK \SPLASHIMAGE_CALLBACK \
Signature · 1 line
2.35.1.616.g0bdcbb4464-goog
PATCH v4 16/33 bootstd: Add support for bootflows
In reply to Simon GlassAdd support for bootflows, including maintaining a list of them and iterating to find them.
---
Changes in v4:
- Show the bootmeth name when booting
- Use new Return style in function comments
Changes in v3:
- Explain why it is OK to use "?" as an unknown bootflow state
- Move bootmeth/bootdev ordering into the uclass
- Point to the header file for bootflow_state[] docs
MAINTAINERS | 3 +- boot/Makefile | 1 + boot/bootdev-uclass.c | 11 +- boot/bootflow.c | 411 ++++++++++++++++++++++++++++++++++++++++++ boot/bootstd-uclass.c | 2 +- include/bootflow.h | 50 +++++ 6 files changed, 475 insertions(+), 3 deletions(-) create mode 100644 boot/bootflow.c
MAINTAINERS +2 -1
@@ -685,8 +685,9 @@ F: tools/binman/ BOOTDEVICE M: Simon Glass <[email protected]> S: Maintained -F: boot/bootmeth*.c F: boot/bootdev*.c +F: boot/bootflow.c +F: boot/bootmeth*.c F: boot/bootstd.c F: include/bootdev*.h F: include/bootflow.h
boot/Makefile +1 -0
@@ -24,6 +24,7 @@ obj-$(CONFIG_ANDROID_AB) += android_ab.o obj-$(CONFIG_ANDROID_BOOT_IMAGE) += image-android.o image-android-dt.o obj-$(CONFIG_$(SPL_TPL_)BOOTSTD) += bootdev-uclass.o +obj-$(CONFIG_$(SPL_TPL_)BOOTSTD) += bootflow.o obj-$(CONFIG_$(SPL_TPL_)BOOTSTD) += bootmeth-uclass.o obj-$(CONFIG_$(SPL_TPL_)BOOTSTD) += bootstd-uclass.o
boot/bootdev-uclass.c +10 -1
@@ -10,6 +10,7 @@#include <dm.h> #include <bootdev.h> #include <bootflow.h> +#include <bootmeth.h> #include <bootstd.h> #include <env.h> #include <fs.h>
@@ -130,6 +131,10 @@ int bootdev_find_in_blk(struct udevice *dev, struct udevice *blk, bflow->part = iter->part; + ret =bootmeth_check (bflow->method, iter); +if (ret) +return log_msg_ret ("check" , ret); +/* * partition numbers start at 0 so this cannot succeed, but it can tell * us whether there is valid media there
@@ -171,6 +176,10 @@ int bootdev_find_in_blk(struct udevice *dev, struct udevice *blk, bflow->state =BOOTFLOWST_FS ; } + ret =bootmeth_read_bootflow (bflow->method, bflow); +if (ret) +return log_msg_ret ("method" , ret); +return 0 ; }
@@ -445,7 +454,7 @@ void bootdev_clear_bootflows(struct udevice *dev) bflow = list_first_entry(&ucp->bootflow_head, struct bootflow, bm_node); -/* later bootflow_remove(bflow); */ +bootflow_remove (bflow); } }
boot/bootflow.c new file +411 -0
411 lines not on this page · raw message
boot/bootstd-uclass.c +1 -1
@@ -45,7 +45,7 @@ static void bootstd_clear_glob_(struct bootstd_priv *priv) bflow = list_first_entry(&priv->glob_head, struct bootflow, glob_node); -/* add later bootflow_remove(bflow); */ +bootflow_remove (bflow); } }
include/bootflow.h +50 -0
60 lines not on this page · raw message
Signature · 1 line
2.35.1.616.g0bdcbb4464-goog
PATCH v4 17/33 bootstd: Add a bootdev command
In reply to Simon GlassAdd a 'bootdev' command to handle listing and selection of bootdevs.
Disable standard boot for a few boards which otherwise run out of space.
---
(no changes since v3)
Changes in v3:
- Use separate Kconfig options for each command
MAINTAINERS | 1 + cmd/Kconfig | 10 +++ cmd/Makefile | 1 + cmd/bootdev.c | 120 +++++++++++++++++++++++++++++ configs/amcore_defconfig | 1 + configs/rcar3_salvator-x_defconfig | 1 + configs/tbs2910_defconfig | 1 + 7 files changed, 135 insertions(+) create mode 100644 cmd/bootdev.c
MAINTAINERS +1 -0
@@ -689,6 +689,7 @@ F: boot/bootdev*.c F: boot/bootflow.c F: boot/bootmeth*.c F: boot/bootstd.c +F: cmd/bootdev.c F: include/bootdev*.h F: include/bootflow.h F: include/bootmeth.h
cmd/Kconfig +10 -0
@@ -194,6 +194,16 @@ config CMD_BOOTM help Boot an application image from the memory. +config CMD_BOOTDEV + bool "bootdev" + depends on BOOTSTD + default y if BOOTSTD_FULL + help + Support listing available bootdevs (boot devices) which can provide an + OS to boot, as well as showing information about a particular one. + + This command is not necessary for bootstd to work. + config BOOTM_EFI bool "Support booting UEFI FIT images" depends on CMD_BOOTEFI && CMD_BOOTM && FIT
cmd/Makefile +1 -0
@@ -19,6 +19,7 @@ obj-$(CONFIG_CMD_AB_SELECT) += ab_select.o obj-$(CONFIG_CMD_ADC) += adc.o obj-$(CONFIG_CMD_ARMFLASH) += armflash.o obj-$(CONFIG_HAVE_BLOCK_DEVICE) += blk_common.o +obj-$(CONFIG_CMD_BOOTDEV) += bootdev.o obj-$(CONFIG_CMD_SOURCE) += source.o obj-$(CONFIG_CMD_BCB) += bcb.o obj-$(CONFIG_CMD_BDI) += bdinfo.o
cmd/bootdev.c new file +120 -0
120 lines not on this page · raw message
configs/amcore_defconfig +1 -0
@@ -7,6 +7,7 @@ CONFIG_ENV_SECT_SIZE=0x1000 CONFIG_DEFAULT_DEVICE_TREE="amcore" CONFIG_TARGET_AMCORE=y CONFIG_SYS_LOAD_ADDR=0x20000 +# CONFIG_BOOTSTD is not set CONFIG_BOOTDELAY=1 CONFIG_USE_BOOTCOMMAND=y CONFIG_BOOTCOMMAND="bootm ffc20000"
configs/rcar3_salvator-x_defconfig +1 -0
@@ -12,6 +12,7 @@ CONFIG_TARGET_SALVATOR_X=y CONFIG_REMAKE_ELF=y CONFIG_SYS_LOAD_ADDR=0x58000000 CONFIG_FIT=y +# CONFIG_BOOTSTD is not set CONFIG_SUPPORT_RAW_INITRD=y CONFIG_USE_BOOTARGS=y CONFIG_USE_BOOTCOMMAND=y
configs/tbs2910_defconfig +1 -0
@@ -14,6 +14,7 @@ CONFIG_DEFAULT_DEVICE_TREE="imx6q-tbs2910" CONFIG_PRE_CON_BUF_ADDR=0x7c000000 CONFIG_CMD_HDMIDETECT=y CONFIG_AHCI=y +# CONFIG_BOOTSTD is not set CONFIG_SUPPORT_RAW_INITRD=y CONFIG_BOOTDELAY=3 CONFIG_USE_BOOTCOMMAND=y
Signature · 1 line
2.35.1.616.g0bdcbb4464-goog
PATCH v4 19/33 bootstd: Add a bootmeth command
In reply to Simon GlassAdd a 'bootmeth' command to handle listing and ordering of boot methods.
---
(no changes since v3)
Changes in v3:
- Move bootmeth ordering into the uclass
cmd/Kconfig | 11 +++++ cmd/Makefile | 1 + cmd/bootmeth.c | 113 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 125 insertions(+) create mode 100644 cmd/bootmeth.c
cmd/Kconfig +11 -0
@@ -222,6 +222,17 @@ config CMD_BOOTFLOW_FULL This command is not necessary for bootstd to work. +config CMD_BOOTMETH + bool "bootmeth" + depends on BOOTSTD + default y if BOOTSTD_FULL + help + Support listing available bootmethds (methods used to boot an + Operating System), as well as selecting the order that the bootmeths + are used. + + This command is not necessary for bootstd to work. + config BOOTM_EFI bool "Support booting UEFI FIT images" depends on CMD_BOOTEFI && CMD_BOOTM && FIT
cmd/Makefile +1 -0
@@ -21,6 +21,7 @@ obj-$(CONFIG_CMD_ARMFLASH) += armflash.o obj-$(CONFIG_HAVE_BLOCK_DEVICE) += blk_common.o obj-$(CONFIG_CMD_BOOTDEV) += bootdev.o obj-$(CONFIG_CMD_BOOTFLOW) += bootflow.o +obj-$(CONFIG_CMD_BOOTMETH) += bootmeth.o obj-$(CONFIG_CMD_SOURCE) += source.o obj-$(CONFIG_CMD_BCB) += bcb.o obj-$(CONFIG_CMD_BDI) += bdinfo.o
cmd/bootmeth.c new file +113 -0
113 lines not on this page · raw message
Signature · 1 line
2.35.1.616.g0bdcbb4464-goog
PATCH v4 21/33 bootstd: mmc: Add a bootdev driver
In reply to Simon GlassAdd a bootdev driver for MMC. It mostly just calls the bootdev helper function.
Add a function to obtain the block device for an MMC controller.
Fix up the comment for mmc_get_blk_desc() while we are here.
---
Changes in v4:
- Use new Return style in function comments
Changes in v3:
- Adjust for new blk_find_device() function
MAINTAINERS | 1 + drivers/mmc/Makefile | 5 ++++ drivers/mmc/mmc-uclass.c | 23 +++++++++++++++ drivers/mmc/mmc_bootdev.c | 62 +++++++++++++++++++++++++++++++++++++++ include/mmc.h | 12 +++++++- 5 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 drivers/mmc/mmc_bootdev.c
MAINTAINERS +1 -0
@@ -691,6 +691,7 @@ F: boot/bootmeth*.c F: boot/bootstd.c F: cmd/bootdev.c F: cmd/bootflow.c +F: drivers/mmc/mmc_bootdev.c F: include/bootdev.h F: include/bootflow.h F: include/bootmeth.h
drivers/mmc/Makefile +5 -0
@@ -5,6 +5,11 @@ obj-y += mmc.o obj-$(CONFIG_$(SPL_)DM_MMC) += mmc-uclass.o + +ifdef CONFIG_$(SPL_TPL_)DM_MMC +obj-$(CONFIG_$(SPL_TPL_)BOOTSTD) += mmc_bootdev.o +endif + obj-$(CONFIG_$(SPL_)MMC_WRITE) += mmc_write.o obj-$(CONFIG_MMC_PWRSEQ) += mmc-pwrseq.o obj-$(CONFIG_MMC_SDHCI_ADMA_HELPERS) += sdhci-adma.o
drivers/mmc/mmc-uclass.c +23 -0
@@ -8,6 +8,7 @@#define LOG_CATEGORY UCLASS_MMC#include <common.h> +#include <bootdev.h> #include <log.h> #include <mmc.h> #include <dm.h>
@@ -315,6 +316,20 @@ int mmc_get_next_devnum(void)return blk_find_max_devnum (IF_TYPE_MMC ); } +int mmc_get_blk (struct udevice *dev,struct udevice **blkp) +{ +struct udevice *blk; +int ret; + +device_find_first_child_by_uclass (dev,UCLASS_BLK , &blk); + ret =device_probe (blk); +if (ret) +return ret; + *blkp = blk; + +return 0 ; +} +struct blk_desc *mmc_get_blk_desc (struct mmc *mmc) {struct blk_desc *desc;
@@ -406,6 +421,10 @@ int mmc_bind(struct udevice *dev, struct mmc *mmc, const struct mmc_config *cfg) mmc->cfg = cfg; mmc->priv = dev; + ret =bootdev_setup_for_dev (dev,"mmc_bootdev" ); +if (ret) +return log_msg_ret ("bootdev" , ret); +/* the following chunk was from mmc_register() */ /* Setup dsr related values */
@@ -424,12 +443,16 @@ int mmc_bind(struct udevice *dev, struct mmc *mmc, const struct mmc_config *cfg)int mmc_unbind (struct udevice *dev) {struct udevice *bdev; +int ret;device_find_first_child_by_uclass (dev,UCLASS_BLK , &bdev);if (bdev) {device_remove (bdev,DM_REMOVE_NORMAL );device_unbind (bdev); } + ret =bootdev_unbind_dev (dev); +if (ret) +return log_msg_ret ("bootdev" , ret);return 0 ; }
drivers/mmc/mmc_bootdev.c new file +62 -0
62 lines not on this page · raw message
include/mmc.h +11 -1
@@ -956,10 +956,20 @@ int mmc_get_env_dev(void);* mmc_get_blk_desc() - Get the block descriptor for an MMC device * * @mmc: MMC device -* Return: block device if found, else NULL +* Return: block descriptor if found, else NULL */ struct blk_desc *mmc_get_blk_desc (struct mmc *mmc); +/** +* mmc_get_blk() - Get the block device for an MMC device +* +* @dev: MMC device +* @blkp: Returns pointer to probed block device on sucesss +* +* Return: 0 on success, -ve on error +*/ +int mmc_get_blk (struct udevice *dev,struct udevice **blkp); +/** * mmc_send_ext_csd() - read the extended CSD register *
Signature · 1 line
2.35.1.616.g0bdcbb4464-goog
PATCH v4 22/33 bootstd: ethernet: Add a bootdev driver
In reply to Simon GlassAdd a bootdev driver for Ethernet. It can use the PXE boot mechanism to locate a file, added later.
---
(no changes since v1)
MAINTAINERS | 1 + net/Kconfig | 9 +++++ net/Makefile | 1 + net/eth-uclass.c | 8 ++++ net/eth_bootdev.c | 101 ++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 120 insertions(+) create mode 100644 net/eth_bootdev.c
MAINTAINERS +1 -0
@@ -696,6 +696,7 @@ F: include/bootdev.h F: include/bootflow.h F: include/bootmeth.h F: include/bootstd.h +F: net/eth_bootdevice.c BTRFS M: Marek Behun <[email protected]>
net/Kconfig +9 -0
@@ -14,6 +14,15 @@ config PROT_UDP Enable a generic udp framework that allows defining a custom handler for udp protocol. +config BOOTDEV_ETH + bool "Enable bootdev for ethernet" + depends on BOOTSTD + default y + help + Provide a bootdev for ethernet so that is it possible to boot + an operationg system over the network, using the PXE (Preboot + Execution Environment) protocol. + config BOOTP_SEND_HOSTNAME bool "Send hostname to DNS server" help
net/Makefile +1 -0
@@ -12,6 +12,7 @@ obj-$(CONFIG_CMD_DNS) += dns.o obj-$(CONFIG_DM_DSA) += dsa-uclass.o ifdef CONFIG_DM_ETH obj-$(CONFIG_NET) += eth-uclass.o +obj-$(CONFIG_$(SPL_TPL_)BOOTDEV_ETH) += eth_bootdev.o else obj-$(CONFIG_NET) += eth_legacy.o endif
net/eth-uclass.c +8 -0
@@ -8,6 +8,7 @@#define LOG_CATEGORY UCLASS_ETH#include <common.h> +#include <bootdev.h> #include <bootstage.h> #include <dm.h> #include <env.h>
@@ -473,6 +474,8 @@ int eth_initialize(void)static int eth_post_bind (struct udevice *dev) { +int ret; +if (strchr (dev->name,' ' )) {printf ("\nError: eth device name \"%s\" has a space!\n" , dev->name);
@@ -482,6 +485,11 @@ static int eth_post_bind(struct udevice *dev)#ifdef CONFIG_DM_ETH_PHY eth_phy_binds_nodes (dev);#endif +if (CONFIG_IS_ENABLED (BOOTDEV_ETH )) { + ret =bootdev_setup_for_dev (dev,"eth_bootdev" ); +if (ret) +return log_msg_ret ("bootdev" , ret); + }return 0 ; }
net/eth_bootdev.c new file +101 -0
101 lines not on this page · raw message
Signature · 1 line
2.35.1.616.g0bdcbb4464-goog
PATCH v4 23/33 bootstd: Add an implementation of distro PXE boot
In reply to Simon GlassAdd a bootmeth driver which handles distro boot from a network device, so we can boot a bootflow using this commonly used mechanism.
In effect, this provides the same functionality as the 'pxe' command and shares the same code. But the interface into it is via a bootmeth.
For now this requires the 'pxe' command be enabled. Future work may tidy this up so that it can be used without CONFIG_CMDLINE being enabled.
---
(no changes since v3)
Changes in v3:
- Add a log category
- Use a short name when BOOTSTD_FULL is not enabled
boot/Kconfig | 10 +++ boot/Makefile | 1 + boot/bootmeth_pxe.c | 186 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 197 insertions(+) create mode 100644 boot/bootmeth_pxe.c
boot/Kconfig +10 -0
@@ -339,6 +339,16 @@ config BOOTMETH_DISTRO This provides a way to try out standard boot on an existing boot flow. +config BOOTMETH_DISTRO_PXE + bool "Bootdev support for distro boot over network" + depends on CMD_PXE && CMD_NET && DM_ETH + default y + help + Enables support for distro boot using bootdevs. This makes the + bootdevs look for a 'extlinux/extlinux.conf' on the tftp server. + + This provides a way to try out standard boot on an existing boot flow. + endif config LEGACY_IMAGE_FORMAT
boot/Makefile +1 -0
@@ -29,6 +29,7 @@ obj-$(CONFIG_$(SPL_TPL_)BOOTSTD) += bootmeth-uclass.o obj-$(CONFIG_$(SPL_TPL_)BOOTSTD) += bootstd-uclass.o obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_DISTRO) += bootmeth_distro.o +obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_DISTRO_PXE) += bootmeth_pxe.o obj-$(CONFIG_$(SPL_TPL_)OF_LIBFDT) += image-fdt.o obj-$(CONFIG_$(SPL_TPL_)FIT_SIGNATURE) += fdt_region.o
boot/bootmeth_pxe.c new file +186 -0
186 lines not on this page · raw message
Signature · 1 line
2.35.1.616.g0bdcbb4464-goog
PATCH v4 24/33 bootstd: Add an implementation of EFI boot
In reply to Simon GlassAdd a bootmeth driver which handles EFI boot, using EFI_LOADER.
In effect, this provides the same functionality as the 'bootefi' command and shares the same code. But the interface into it is via a bootmeth, so it does not require any special scripts, etc.
For now this requires the 'bootefi' command be enabled. Future work may tidy this up so that it can be used without CONFIG_CMDLINE being enabled.
There was much discussion about whether this is needed, but it seems that it is, at least for now.
---
Changes in v4:
- Allow use without a block device
- Fix 'a' typo
- Improve debugging in efiload_read_file()
Changes in v3:
- Add a log category
- Align the EFI load address
- Use a short name when BOOTSTD_FULL is not enabled
- Use common bootmeth functions
boot/Kconfig | 21 +++++ boot/Makefile | 1 + boot/bootmeth_efi.c | 188 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 210 insertions(+) create mode 100644 boot/bootmeth_efi.c
boot/Kconfig +21 -0
@@ -349,6 +349,27 @@ config BOOTMETH_DISTRO_PXE This provides a way to try out standard boot on an existing boot flow. +config BOOTMETH_EFILOADER + bool "Bootdev support for EFI boot" + depends on CMD_BOOTEFI + default y + help + Enables support for EFI boot using bootdevs. This makes the + bootdevs look for a 'boot<arch>.efi' on each filesystem + they scan. The resulting file is booted after enabling U-Boot's + EFI loader support. + + The <arch> depends on the architecture of the board: + + aa64 - aarch64 (ARM 64-bit) + arm - ARM 32-bit + ia32 - x86 32-bit + x64 - x86 64-bit + riscv32 - RISC-V 32-bit + riscv64 - RISC-V 64-bit + + This provides a way to try out standard boot on an existing boot flow. + endif config LEGACY_IMAGE_FORMAT
boot/Makefile +1 -0
@@ -30,6 +30,7 @@ obj-$(CONFIG_$(SPL_TPL_)BOOTSTD) += bootstd-uclass.o obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_DISTRO) += bootmeth_distro.o obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_DISTRO_PXE) += bootmeth_pxe.o +obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_EFILOADER) += bootmeth_efi.o obj-$(CONFIG_$(SPL_TPL_)OF_LIBFDT) += image-fdt.o obj-$(CONFIG_$(SPL_TPL_)FIT_SIGNATURE) += fdt_region.o
boot/bootmeth_efi.c new file +188 -0
188 lines not on this page · raw message
Signature · 1 line
2.35.1.616.g0bdcbb4464-goog
PATCH v4 25/33 bootstd: Add a system bootdev for strange boot methods
In reply to Simon GlassSome boot methods don't act on a single bootdev but instead do their own thing. An example is EFI bootmgr which scan various devices using its own logic. Add a bootdev to handle this.
---
(no changes since v3)
Changes in v3:
- Add a log category
boot/Makefile | 2 +- boot/bootstd-uclass.c | 6 ++++ boot/system_bootdev.c | 66 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 boot/system_bootdev.c
boot/Makefile +1 -1
@@ -23,7 +23,7 @@ obj-y += image.o image-board.o obj-$(CONFIG_ANDROID_AB) += android_ab.o obj-$(CONFIG_ANDROID_BOOT_IMAGE) += image-android.o image-android-dt.o -obj-$(CONFIG_$(SPL_TPL_)BOOTSTD) += bootdev-uclass.o +obj-$(CONFIG_$(SPL_TPL_)BOOTSTD) += bootdev-uclass.o system_bootdev.o obj-$(CONFIG_$(SPL_TPL_)BOOTSTD) += bootflow.o obj-$(CONFIG_$(SPL_TPL_)BOOTSTD) += bootmeth-uclass.o obj-$(CONFIG_$(SPL_TPL_)BOOTSTD) += bootstd-uclass.o
boot/bootstd-uclass.c +6 -0
@@ -150,6 +150,12 @@ int dm_scan_other(bool pre_reloc_only) } } +/* Create the system bootdev too */ + ret =device_bind_driver (bootstd,"system_bootdev" ,"system-bootdev" , + &dev); +if (ret) +return log_msg_ret ("sys" , ret); +return 0 ; }
boot/system_bootdev.c new file +66 -0
66 lines not on this page · raw message
Signature · 1 line
2.35.1.616.g0bdcbb4464-goog
PATCH v4 27/33 bootstd: Add a sandbox bootmeth driver
In reply to Simon GlassAdd a bootmeth driver for sandbox, used for testing.
---
(no changes since v3)
Changes in v3:
- Add a log category
boot/Kconfig | 7 +++++ boot/Makefile | 1 + boot/bootmeth_sandbox.c | 69 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+) create mode 100644 boot/bootmeth_sandbox.c
boot/Kconfig +7 -0
@@ -370,6 +370,13 @@ config BOOTMETH_EFILOADER This provides a way to try out standard boot on an existing boot flow. +config BOOTMETH_SANDBOX + def_bool y + depends on SANDBOX + help + This is a sandbox bootmeth driver used for testing. It always returns + -ENOTSUPP when attempting to boot. + endif config LEGACY_IMAGE_FORMAT
boot/Makefile +1 -0
@@ -31,6 +31,7 @@ obj-$(CONFIG_$(SPL_TPL_)BOOTSTD) += bootstd-uclass.o obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_DISTRO) += bootmeth_distro.o obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_DISTRO_PXE) += bootmeth_pxe.o obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_EFILOADER) += bootmeth_efi.o +obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_SANDBOX) += bootmeth_sandbox.o ifdef CONFIG_$(SPL_TPL_)BOOTSTD_FULL obj-$(CONFIG_$(SPL_TPL_)CMD_BOOTEFI_BOOTMGR) += bootmeth_efi_mgr.o endif
boot/bootmeth_sandbox.c new file +69 -0
69 lines not on this page · raw message
Signature · 1 line
2.35.1.616.g0bdcbb4464-goog
PATCH v4 28/33 bootstd: sandbox: Add a hostfs bootdev
In reply to Simon GlassIt is helpful to be able to try out bootstd on sandbox, using host files. This is easier than using a block device, which must have a filesystem, partition table, etc.
Add a new driver which provides this feature. For now it is not used in tests, but it is likely to be useful.
Add notes in the devicetree also, but don't disturb the tests.
---
(no changes since v1)
arch/sandbox/dts/sandbox.dts | 4 +++ arch/sandbox/dts/sandbox.dtsi | 5 ++++ fs/Kconfig | 2 ++ fs/sandbox/Kconfig | 2 ++ fs/sandbox/Makefile | 1 + fs/sandbox/host_bootdev.c | 56 +++++++++++++++++++++++++++++++++++ 6 files changed, 70 insertions(+) create mode 100644 fs/sandbox/Kconfig create mode 100644 fs/sandbox/host_bootdev.c
arch/sandbox/dts/sandbox.dts +4 -0
@@ -66,6 +66,10 @@ fake-host-hwaddr = [00 00 66 44 22 00]; }; + host-fs { + compatible = "sandbox,bootdev-host"; + }; + i2c_0: i2c@0 { #address-cells = <1>; #size-cells = <0>;
arch/sandbox/dts/sandbox.dtsi +5 -0
@@ -16,6 +16,11 @@ #sound-dai-cells = <1>; }; + bootstd { + compatible = "u-boot,boot-std"; + filename-prefixes = "./"; + }; + buttons { compatible = "gpio-keys";
fs/Kconfig +2 -0
@@ -16,6 +16,8 @@ source "fs/fat/Kconfig" source "fs/jffs2/Kconfig" +source "fs/sandbox/Kconfig" + source "fs/ubifs/Kconfig" source "fs/cramfs/Kconfig"
fs/sandbox/Kconfig new file +2 -0
@@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0+ +#
fs/sandbox/Makefile +1 -0
@@ -9,3 +9,4 @@ # Pavel Bartusek, Sysgo Real-Time Solutions AG, [email protected] obj-y := sandboxfs.o +obj-$(CONFIG_$(SPL_TPL_)BOOTSTD) += host_bootdev.o
fs/sandbox/host_bootdev.c new file +56 -0
56 lines not on this page · raw message
Signature · 1 line
2.35.1.616.g0bdcbb4464-goog
PATCH v4 30/33 bootstd: usb: Add a bootdev driver
In reply to Simon GlassAdd a bootdev driver for USB host. It can use the distro boot mechanism to locate a file, or any other available bootmeth.
---
(no changes since v1)
common/usb_storage.c | 12 +++++++ drivers/usb/host/Makefile | 4 +++ drivers/usb/host/usb_bootdev.c | 61 ++++++++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+) create mode 100644 drivers/usb/host/usb_bootdev.c
common/usb_storage.c +12 -0
@@ -34,6 +34,7 @@#include <common.h> #include <blk.h> +#include <bootdev.h> #include <command.h> #include <dm.h> #include <errno.h>
@@ -239,6 +240,17 @@ static int usb_stor_probe_device(struct usb_device *udev)if (ret) return ret; } + + ret =bootdev_setup_sibling_blk (dev,"usb_bootdev" ); +if (ret) { +int ret2; + + ret2 =device_unbind (dev); +if (ret2) +return log_msg_ret ("bootdev" , ret2); +return log_msg_ret ("bootdev" , ret); + } + }#else /* We don't have space to even probe if we hit the maximum */
drivers/usb/host/Makefile +4 -0
@@ -8,6 +8,10 @@ obj-y += usb-uclass.o obj-$(CONFIG_SANDBOX) += usb-sandbox.o endif +ifdef CONFIG_$(SPL_TPL_)USB_STORAGE +obj-$(CONFIG_$(SPL_TPL_)BOOTSTD) += usb_bootdev.o +endif + # ohci obj-$(CONFIG_USB_OHCI_NEW) += ohci-hcd.o obj-$(CONFIG_USB_ATMEL) += ohci-at91.o
drivers/usb/host/usb_bootdev.c new file +61 -0
61 lines not on this page · raw message
Signature · 1 line
2.35.1.616.g0bdcbb4464-goog
PATCH v4 31/33 bootstd: Add tests for bootstd including all uclasses
In reply to Simon GlassAdd a set of combined tests for the bootdev, bootflow and bootmeth commands, along with associated functionality.
Expand the sandbox console-recording limit so that these can work.
These tests rely on a filesystem script which is not yet added to the Python tests. It is included here as a shell script.
---
Changes in v4:
- Update tests for code changes
Changes in v3:
- Add tests for the "bootmeths" env var
- Update bootdev_test_order() for boot_targets env var
- Update tests for the new 'bootmeth order' syntax
MAINTAINERS | 1 + arch/sandbox/dts/test.dts | 18 ++ configs/sandbox_defconfig | 3 +- configs/sandbox_flattree_defconfig | 3 +- include/test/suites.h | 2 + test/Makefile | 1 + test/boot/Makefile | 5 + test/boot/bootdev.c | 223 ++++++++++++++++ test/boot/bootflow.c | 400 +++++++++++++++++++++++++++++ test/boot/bootmeth.c | 122 +++++++++ test/boot/bootstd_common.c | 35 +++ test/boot/bootstd_common.h | 27 ++ test/cmd_ut.c | 7 + 13 files changed, 845 insertions(+), 2 deletions(-) create mode 100644 test/boot/Makefile create mode 100644 test/boot/bootdev.c create mode 100644 test/boot/bootflow.c create mode 100644 test/boot/bootmeth.c create mode 100644 test/boot/bootstd_common.c create mode 100644 test/boot/bootstd_common.h
MAINTAINERS +1 -0
@@ -697,6 +697,7 @@ F: include/bootflow.h F: include/bootmeth.h F: include/bootstd.h F: net/eth_bootdevice.c +F: test/boot/ BTRFS M: Marek Behun <[email protected]>
arch/sandbox/dts/test.dts +18 -0
@@ -71,6 +71,21 @@ }; }; + bootstd { + compatible = "u-boot,boot-std"; + + filename-prefixes = "/", "/boot/"; + bootdev-order = "mmc2", "mmc1"; + + syslinux { + compatible = "u-boot,distro-syslinux"; + }; + + efi { + compatible = "u-boot,distro-efi"; + }; + }; + reboot-mode0 { compatible = "reboot-mode-gpio"; gpios = <&gpio_c 0 GPIO_ACTIVE_HIGH>, <&gpio_c 1 GPIO_ACTIVE_HIGH>;
@@ -880,10 +895,13 @@ non-removable; }; + /* This is used for the bootdev tests */ mmc1 { compatible = "sandbox,mmc"; + filename = "mmc1.img"; }; + /* This is used for the fastboot tests */ mmc0 { compatible = "sandbox,mmc"; };
configs/sandbox_defconfig +2 -1
@@ -28,7 +28,7 @@ CONFIG_AUTOBOOT_NEVER_TIMEOUT=y CONFIG_AUTOBOOT_STOP_STR_ENABLE=y CONFIG_AUTOBOOT_STOP_STR_CRYPT="$5$rounds=640000$HrpE65IkB8CM5nCL$BKT3QdF98Bo8fJpTr9tjZLZQyzqPASBY20xuK5Rent9" CONFIG_CONSOLE_RECORD=y -CONFIG_CONSOLE_RECORD_OUT_SIZE=0x1000 +CONFIG_CONSOLE_RECORD_OUT_SIZE=0x6000 CONFIG_PRE_CONSOLE_BUFFER=y CONFIG_LOG=y CONFIG_DISPLAY_BOARDINFO_LATE=y
@@ -118,6 +118,7 @@ CONFIG_ENV_IS_IN_EXT4=y CONFIG_ENV_EXT4_INTERFACE="host" CONFIG_ENV_EXT4_DEVICE_AND_PART="0:0" CONFIG_ENV_IMPORT_FDT=y +# CONFIG_BOOTDEV_ETH is not set CONFIG_BOOTP_SEND_HOSTNAME=y CONFIG_NETCONSOLE=y CONFIG_IP_DEFRAG=y
configs/sandbox_flattree_defconfig +2 -1
@@ -18,7 +18,7 @@ CONFIG_BOOTSTAGE_FDT=y CONFIG_BOOTSTAGE_STASH=y CONFIG_BOOTSTAGE_STASH_SIZE=0x4096 CONFIG_CONSOLE_RECORD=y -CONFIG_CONSOLE_RECORD_OUT_SIZE=0x1000 +CONFIG_CONSOLE_RECORD_OUT_SIZE=0x6000 CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_MISC_INIT_F=y CONFIG_CMD_CPU=y
@@ -73,6 +73,7 @@ CONFIG_ENV_IS_NOWHERE=y CONFIG_ENV_IS_IN_EXT4=y CONFIG_ENV_EXT4_INTERFACE="host" CONFIG_ENV_EXT4_DEVICE_AND_PART="0:0" +# CONFIG_BOOTDEV_ETH is not set CONFIG_BOOTP_SEND_HOSTNAME=y CONFIG_NETCONSOLE=y CONFIG_IP_DEFRAG=y
include/test/suites.h +2 -0
@@ -29,6 +29,8 @@ int cmd_ut_category(const char *name, const char *prefix,int do_ut_addrmap (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_bootm (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]); +int do_ut_bootstd (struct cmd_tbl *cmdtp,int flag,int argc, +char *const argv[]);int do_ut_bloblist (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_common (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);
test/Makefile +1 -0
@@ -22,6 +22,7 @@ obj-$(CONFIG_UT_TIME) += time_ut.o obj-y += ut.o ifeq ($(CONFIG_SPL_BUILD),) +obj-$(CONFIG_UNIT_TEST) += boot/ obj-$(CONFIG_UNIT_TEST) += common/ obj-$(CONFIG_UNIT_TEST) += lib/ obj-y += log/
test/boot/Makefile new file +5 -0
@@ -0,0 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright 2021 Google LLC + +obj-$(CONFIG_BOOTSTD) += bootdev.o bootstd_common.o bootflow.o bootmeth.o
test/boot/bootdev.c new file +223 -0
223 lines not on this page · raw message
test/boot/bootflow.c new file +400 -0
400 lines not on this page · raw message
test/boot/bootmeth.c new file +122 -0
122 lines not on this page · raw message
test/boot/bootstd_common.c new file +35 -0
@@ -0,0 +1,35 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Test for bootdev functions. All start with 'bootdev' +* +* Copyright 2021 Google LLC +* Written by Simon Glass <[email protected]> +*/ + +#include <common.h> +#include <bootstd.h> +#include <dm.h> +#include <test/suites.h> +#include <test/ut.h> +#include "bootstd_common.h" + +int bootstd_test_drop_bootdev_order (struct unit_test_state *uts) +{ +struct bootstd_priv *priv; +struct udevice *bootstd; + +ut_assertok (uclass_first_device_err (UCLASS_BOOTSTD , &bootstd)); + priv =dev_get_priv (bootstd); + priv->bootdev_order =NULL ; + +return 0 ; +} + +int do_ut_bootstd (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) +{ +struct unit_test *tests =UNIT_TEST_SUITE_START (bootstd_test); +const int n_ents =UNIT_TEST_SUITE_COUNT (bootstd_test); + +return cmd_ut_category ("bootstd" ,"bootstd_test_" , + tests, n_ents, argc, argv); +}
test/boot/bootstd_common.h new file +27 -0
@@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Common header file for bootdev, bootflow, bootmeth tests +* +* Copyright 2021 Google LLC +* Written by Simon Glass <[email protected]> +*/ + +#ifndef __bootstd_common_h +#define __bootstd_common_h + +/* Declare a new bootdev test */ +#define BOOTSTD_TEST (_name, _flags) \ + UNIT_TEST(_name, _flags, bootstd_test) + +struct unit_test_state ; + +/** +* bootstd_test_drop_bootdev_order() - Remove the existing boot order +* +* Drop the boot order so that all bootdevs are used in their alias order +* +* @uts: Unit test state to use for ut_assert...() functions +*/ +int bootstd_test_drop_bootdev_order (struct unit_test_state *uts); + +#endif
test/cmd_ut.c +7 -0
@@ -28,6 +28,10 @@ int cmd_ut_category(const char *name, const char *prefix,static struct cmd_tbl cmd_ut_sub[] = {U_BOOT_CMD_MKENT (all,CONFIG_SYS_MAXARGS ,1 , do_ut_all,"" ,"" ), +#ifdef CONFIG_BOOTSTD +U_BOOT_CMD_MKENT (bootstd,CONFIG_SYS_MAXARGS ,1 , do_ut_bootstd, +"" ,"" ), +#endifU_BOOT_CMD_MKENT (common,CONFIG_SYS_MAXARGS ,1 , do_ut_common,"" ,"" ), #if defined(CONFIG_UT_DM) U_BOOT_CMD_MKENT(dm, CONFIG_SYS_MAXARGS, 1, do_ut_dm, "", ""),
@@ -115,6 +119,9 @@ static char ut_help_text[] ="ut bloblist - Test bloblist implementation\n" "ut compression - Test compressors and bootm decompression\n"#endif +#ifdef CONFIG_BOOTSTD + "ut bootstd - Test standard boot implementation\n" +#endif #ifdef CONFIG_UT_DM "ut dm [test-name]\n"#endif
Signature · 1 line
2.35.1.616.g0bdcbb4464-goog
PATCH v4 32/33 bootstd: Add setup for the bootflow tests
In reply to Simon GlassWe need to create a disk image with a partition table and a DOS-format filesystem containing a few files. Provide a fallback binary for CI since it does not seem able to detect the loopback partitions.
Add this to a dm_init test so that it happens when needed.
---
(no changes since v3)
Changes in v3:
- Update test condition to use CMD_BOOTFLOW
test/py/tests/bootstd/mmc1.img.xz | Bin 0 -> 4448 bytes test/py/tests/test_ut.py | 103 ++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+) create mode 100644 test/py/tests/bootstd/mmc1.img.xz
test/py/tests/bootstd/mmc1.img.xz new file binary +0 -0
test/py/tests/test_ut.py +103 -0
118 lines not on this page · raw message
Signature · 1 line
2.35.1.616.g0bdcbb4464-goog
PATCH v4 33/33 bootstd: doc: Add documentation
In reply to Simon GlassAdd documentation for this feature, including the commands and full devicetree bindings.
---
Changes in v4:
- Update docs for typos that have been fixed
Changes in v3:
- Update docs for "bootmeths" and "boot_targets" env vars
MAINTAINERS | 4 + doc/develop/bootstd.rst | 638 ++++++++++++++++++++++++++ doc/develop/distro.rst | 3 + doc/develop/index.rst | 1 + doc/device-tree-bindings/bootdev.txt | 18 + doc/device-tree-bindings/bootmeth.txt | 31 ++ doc/device-tree-bindings/bootstd.txt | 8 + doc/usage/bootdev.rst | 135 ++++++ doc/usage/bootflow.rst | 427 +++++++++++++++++ doc/usage/bootmeth.rst | 108 +++++ doc/usage/index.rst | 3 + 11 files changed, 1376 insertions(+) create mode 100644 doc/develop/bootstd.rst create mode 100644 doc/device-tree-bindings/bootmeth.txt create mode 100644 doc/usage/bootdev.rst create mode 100644 doc/usage/bootflow.rst create mode 100644 doc/usage/bootmeth.rst
MAINTAINERS +4 -0
@@ -691,6 +691,10 @@ F: boot/bootmeth*.c F: boot/bootstd.c F: cmd/bootdev.c F: cmd/bootflow.c +F: doc/develop/bootstd.rst +F: doc/usage/bootdev.rst +F: doc/usage/bootflow.rst +F: doc/usage/bootmeth.rst F: drivers/mmc/mmc_bootdev.c F: include/bootdev.h F: include/bootflow.h
doc/develop/bootstd.rst new file +638 -0
638 lines not on this page · raw message
doc/develop/distro.rst +3 -0
@@ -157,6 +157,9 @@ a line with "CONFIG_DISTRO_DEFAULTS=y". If you want to enable this from Kconfig itself, for e.g. all boards using a specific SoC then add a "imply DISTRO_DEFAULTS" to your SoC CONFIG option. + +TO BE UPDATED: + In your board configuration file, include the following:: #ifndef CONFIG_SPL_BUILD
doc/develop/index.rst +1 -0
@@ -10,6 +10,7 @@ Implementation :maxdepth: 1 bloblist + bootstd ci_testing commands config_binding
doc/device-tree-bindings/bootdev.txt +18 -0
@@ -6,3 +6,21 @@ child of the media device (UCLASS_MMC, UCLASS_SPI_FLASH, etc.) The bootdev driver is provided by the media devices. The bindings for each are described in this file (to come). + +Required properties: + +compatible: + "u-boot,bootdev-eth" - Ethernet bootdev + "u-boot,bootdev-mmc" - MMC bootdev + "u-boot,bootdev-usb" - USB bootdev + + +Example: + + mmc1 { + compatible = "sandbox,mmc"; + + mmc-bootdev { + compatible = "u-boot,bootdev-eth"; + }; + };
doc/device-tree-bindings/bootmeth.txt new file +31 -0
@@ -0,0 +1,31 @@ +U-Boot standard boot methods (bootmeth) +====================================== + +This provides methods (called bootmeths) for locating bootflows on a boot +device (bootdev). These are normally created as children of the bootstd device. + +Required properties: + +compatible: + "u-boot,distro-syslinux" - distro boot from a block device + "u-boot,distro-pxe" - distro boot from a network device + "u-boot,distro-efi" - EFI boot from an .efi file + "u-boot,efi-bootmgr" - EFI boot using boot manager (bootmgr) + + +Example: + + bootstd { + compatible = "u-boot,boot-std"; + + filename-prefixes = "/", "/boot/"; + bootdev-order = "mmc2", "mmc1"; + + syslinux { + compatible = "u-boot,distro-syslinux"; + }; + + efi { + compatible = "u-boot,distro-efi"; + }; + };
doc/device-tree-bindings/bootstd.txt +8 -0
@@ -25,4 +25,12 @@ Example: filename-prefixes = "/", "/boot/"; bootdev-order = "mmc2", "mmc1"; + + syslinux { + compatible = "u-boot,distro-syslinux"; + }; + + efi { + compatible = "u-boot,distro-efi"; + }; };
doc/usage/bootdev.rst new file +135 -0
135 lines not on this page · raw message
doc/usage/bootflow.rst new file +427 -0
427 lines not on this page · raw message
doc/usage/bootmeth.rst new file +108 -0
108 lines not on this page · raw message
doc/usage/index.rst +3 -0
@@ -22,9 +22,12 @@ Shell commands addrmap askenv base + bootdev bootefi + bootflow booti bootmenu + bootmeth button x86/cbsysinfo conitrace
Signature · 1 line
2.35.1.616.g0bdcbb4464-goog
Quoted 23 lines
From: Simon Glass <[email protected]>
Date: Sun, 6 Mar 2022 05:49:43 -0700The bootflow feature provide a built-in way for U-Boot to automatically boot an Operating System without custom scripting and other customisation. This is called 'standard boot' since it provides a standard way for U-Boot to boot a distro, without scripting.
It introduces the following concepts:
- bootdev - a device which can hold a distro
- bootmeth - a method to scan a bootdev to find bootflows (owned byU-Boot)- bootflow - a description of how to boot (owned by the distro)
This series provides an implementation of these, enabled to scan for bootflows from MMC, USB and Ethernet. It supports the existing distro boot as well as the EFI loader flow (bootefi/bootmgr). It works similiarly to the existing script-based approach, but is native to U-Boot.
With this we can boot on a Raspberry Pi 3 with just one command:
Quoted 8 lines
bootflow scan -lb
which means to scan, listing (-l) each bootflow and trying to boot each one (-b). The final patch shows this.
With a standard way to identify boot devices, booting become easier. It also should be possible to support U-Boot scripts, for backwards compatibility only.
For the record. In its current state this series breaks booting on Apple M1:
Hit any key to stop autoboot: 0
Flags not supported: enable CONFIG_BOOTFLOW_FULL bootflow - Boot flows
Usage:
bootflow scan - boot first available bootflow
=>
I'll see if I can actually convert this board to "standard boot". But I think this means that this breaks the majority of the boards currently in the tree.
Hi Mark,
Quoted 40 lines · Mark Kettenis
Quoted 24 lines
From: Simon Glass <[email protected]>
Date: Sun, 6 Mar 2022 05:49:43 -0700The bootflow feature provide a built-in way for U-Boot to automatically boot an Operating System without custom scripting and other customisation. This is called 'standard boot' since it provides a standard way for U-Boot to boot a distro, without scripting.
It introduces the following concepts:
- bootdev - a device which can hold a distro
- bootmeth - a method to scan a bootdev to find bootflows (owned byU-Boot)- bootflow - a description of how to boot (owned by the distro)
This series provides an implementation of these, enabled to scan for bootflows from MMC, USB and Ethernet. It supports the existing distro boot as well as the EFI loader flow (bootefi/bootmgr). It works similiarly to the existing script-based approach, but is native to U-Boot.
With this we can boot on a Raspberry Pi 3 with just one command:
Quoted 8 lines
bootflow scan -lb
which means to scan, listing (-l) each bootflow and trying to boot each one (-b). The final patch shows this.
With a standard way to identify boot devices, booting become easier. It also should be possible to support U-Boot scripts, for backwards compatibility only.
For the record. In its current state this series breaks booting on Apple M1:
Hit any key to stop autoboot: 0
Flags not supported: enableCONFIG_BOOTFLOW_FULLbootflow - Boot flows
Quoted 8 lines
Usage:
bootflow scan - boot first available bootflow=>
I'll see if I can actually convert this board to "standard boot". But I think this means that this breaks the majority of the boards currently in the tree.
Ah yes, I put an error on that command when flags are given. You can enable CONFIG_BOOTFLOW_FULL to get that back. For now, 'bootflow scan' just scans and boots and does not support args. See do_bootflow_scan().
I will update the cover letter so it just says 'bootflow scan'.
Regards,
SImon
Quoted 51 lines · Simon Glass
The bootflow feature provide a built-in way for U-Boot to automatically boot an Operating System without custom scripting and other customisation. This is called 'standard boot' since it provides a standard way for U-Boot to boot a distro, without scripting.
It introduces the following concepts:
- bootdev - a device which can hold a distro
- bootmeth - a method to scan a bootdev to find bootflows (owned byU-Boot)- bootflow - a description of how to boot (owned by the distro)
This series provides an implementation of these, enabled to scan for bootflows from MMC, USB and Ethernet. It supports the existing distro boot as well as the EFI loader flow (bootefi/bootmgr). It works similiarly to the existing script-based approach, but is native to U-Boot.
With this we can boot on a Raspberry Pi 3 with just one command:
bootflow scan -lb
which means to scan, listing (-l) each bootflow and trying to boot each one (-b). The final patch shows this.
With a standard way to identify boot devices, booting become easier. It also should be possible to support U-Boot scripts, for backwards compatibility only.
This series relies on the PXE clean-up series, posted here:
https://patchwork.ozlabs.org/project/uboot/list/?series=267078For documentation, see the 'doc' patch.
For version 2, a new naming scheme is used as above:
- bootdev is used instead of bootdevice, because 'device' is overused, is everywhere in U-Boot, can be confused with udevice
- bootmeth - because 'method' is too vanilla, appears 1300 times in U-BootAlso in version 2, drivers are introduced for the boot methods, to make it more extensible. Booting a custom OS is simply a matter of creating a bootmeth for it and implementing the
read_file()andboot()methods.Version 4 makes some minor improvements and leaves out the RFC patch for rpi conversion, in the hope of getting the base support applied sooner rather than later.
Quoted 5 lines
The design is described in these two documents:
https://drive.google.com/file/d/1ggW0KJpUOR__vBkj3l61L2dav4ZkNC12/view?usp=sharing
https://drive.google.com/file/d/1kTrflO9vvGlKp-ZH_jlgb9TY3WYG6FF9/view?usp=sharing
I keep putting off commenting more here, but, I still feel this is the wrong direction. What problems do we have today with distro boot? Well, we haven't figured out how to move configuring it out of the board config.h file. But that's just one of a half dozen or so examples of how we haven't figured out a good solution to configuring the default environment. And only some of those other examples are boot related (the NXP chain of trust booting stuff is another boot example, ETHPRIME, HOSTNAME, etc, are non-boot examples).
We also aren't improving testing of "can we boot" here, because what THAT needs is setting up LAVA and booting some installers on some hardware (and some QEMU). That's testing that Linux boot works. Today we have tests for hush parsing, and if distro boot makes use of something we don't have a test for, we need a test for it. This adds tests for itself, which is good.
And I still don't see an example of where this demonstrates that existing non-UEFI boot cases are now easier to handle or cleaner to handle or otherwise better.
In that this is an attempt to tackle one of the long standing needed migrations (be able to drop board config.h files), something here needs doing. But I don't see this as the right direction, sorry.
Signature · 1 line
Tom
Hi Tom,
Quoted 75 lines · Tom Rini
Quoted 51 lines · Simon Glass
The bootflow feature provide a built-in way for U-Boot to automatically boot an Operating System without custom scripting and other customisation. This is called 'standard boot' since it provides a standard way for U-Boot to boot a distro, without scripting.
It introduces the following concepts:
- bootdev - a device which can hold a distro
- bootmeth - a method to scan a bootdev to find bootflows (owned byU-Boot)- bootflow - a description of how to boot (owned by the distro)
This series provides an implementation of these, enabled to scan for bootflows from MMC, USB and Ethernet. It supports the existing distro boot as well as the EFI loader flow (bootefi/bootmgr). It works similiarly to the existing script-based approach, but is native to U-Boot.
With this we can boot on a Raspberry Pi 3 with just one command:
bootflow scan -lb
which means to scan, listing (-l) each bootflow and trying to boot each one (-b). The final patch shows this.
With a standard way to identify boot devices, booting become easier. It also should be possible to support U-Boot scripts, for backwards compatibility only.
This series relies on the PXE clean-up series, posted here:
https://patchwork.ozlabs.org/project/uboot/list/?series=267078For documentation, see the 'doc' patch.
For version 2, a new naming scheme is used as above:
- bootdev is used instead of bootdevice, because 'device' is overused, is everywhere in U-Boot, can be confused with udevice
- bootmeth - because 'method' is too vanilla, appears 1300 times in U-BootAlso in version 2, drivers are introduced for the boot methods, to make it more extensible. Booting a custom OS is simply a matter of creating a bootmeth for it and implementing the
read_file()andboot()methods.Version 4 makes some minor improvements and leaves out the RFC patch for rpi conversion, in the hope of getting the base support applied sooner rather than later.
Quoted 5 lines
The design is described in these two documents:
https://drive.google.com/file/d/1ggW0KJpUOR__vBkj3l61L2dav4ZkNC12/view?usp=sharing
https://drive.google.com/file/d/1kTrflO9vvGlKp-ZH_jlgb9TY3WYG6FF9/view?usp=sharing
I keep putting off commenting more here, but, I still feel this is the wrong direction. What problems do we have today with distro boot? Well, we haven't figured out how to move configuring it out of the board
config.hfile. But that's just one of a half dozen or so examples of how we haven't figured out a good solution to configuring the default environment. And only some of those other examples are boot related (the NXP chain of trust booting stuff is another boot example, ETHPRIME, HOSTNAME, etc, are non-boot examples).We also aren't improving testing of "can we boot" here, because what THAT needs is setting up LAVA and booting some installers on some hardware (and some QEMU). That's testing that Linux boot works. Today we have tests for hush parsing, and if distro boot makes use of something we don't have a test for, we need a test for it. This adds tests for itself, which is good.
Quoted 7 lines
And I still don't see an example of where this demonstrates that existing non-UEFI boot cases are now easier to handle or cleaner to handle or otherwise better.
In that this is an attempt to tackle one of the long standing needed migrations (be able to drop board
config.hfiles), something here needs doing. But I don't see this as the right direction, sorry.
Does anyone have a better idea for all of this? This is a solid base we can build on but we can't make any progress while this is just patches. What not apply it and we can move forward?
- solves the env problem for distro boot in that we don't need the scripts
- gets rid of the scripts which are a confusing mess
- provides proper high-level concepts of boot device and boot method
- allows testing of the U-Boot part of 'can we boot' because we have tests for all the cases - we can expand this over time
- allows non-UEFI boot cases like Chrome OS, which is currently just a hack for one board[1]
- provides a programmatic base for A/B boot, etc.
I feel the same way with Takahiro's series, which has been out-of-tree for too long.
Please reconsider this. What do we have to lose?
Regards,
Simon
[1] 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"
-----BEGIN PGP SIGNATURE-----
iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmI7KQkACgkQFHw5/5Y0 tywxgAv/ca2oJR36F+jOsNVe+zz5P1OSrHl/nAzMtnURaVR8B5jknUuyQZA63agc BvSqnhjvwC4OsHyz602fvFMgldH/b7913WGjgfmKfuaS/6iTV1bbQmKT4W2otQJv wnwRw89kkAbQFGKAuPbUn2DCCqxG81vB4bdoRQ04WetTD8S+SPd0cbgAQgSNQUC8 8wa+a1jbF8F3EdaHU15pnHKtL6u0ivsj8HYMkACUkmlNABYhfphxV6sWWoZDRchz AUBjSLmYa4zM4eh7sZgtl8kK1LdbErIUoGApP4yerjBZw9rK4muD0xWvXcu3wjwD Sj0F8x/GkJdwQ94CKqMvXApTrMTw0xJkpR7rV7Hv/47rM4zUi7MS5LwNgwKWWmEw b2lb7SMp6HH21nQTU6u+n2rv49bZVOUZ3C/jW4w1vpP1KyONPiOcUF9QsYMCbQXA 9RhX6g7m0UpqF/0Hqy7kewWai3MGRi0PIJZp26axIdZIWuGre9JEDZiyiS/L8f2w 1b2RsQ21
=8Dmz
-----END PGP SIGNATURE-----
Hi Tom
Quoted 83 lines · Simon Glass
Hi Tom,
Quoted 79 lines · Tom Rini
Quoted 51 lines · Simon Glass
The bootflow feature provide a built-in way for U-Boot to automatically boot an Operating System without custom scripting and other customisation. This is called 'standard boot' since it provides a standard way for U-Boot to boot a distro, without scripting.
It introduces the following concepts:
- bootdev - a device which can hold a distro
- bootmeth - a method to scan a bootdev to find bootflows (owned byU-Boot)- bootflow - a description of how to boot (owned by the distro)
This series provides an implementation of these, enabled to scan for bootflows from MMC, USB and Ethernet. It supports the existing distro boot as well as the EFI loader flow (bootefi/bootmgr). It works similiarly to the existing script-based approach, but is native to U-Boot.
With this we can boot on a Raspberry Pi 3 with just one command:
bootflow scan -lb
which means to scan, listing (-l) each bootflow and trying to boot each one (-b). The final patch shows this.
With a standard way to identify boot devices, booting become easier. It also should be possible to support U-Boot scripts, for backwards compatibility only.
This series relies on the PXE clean-up series, posted here:
https://patchwork.ozlabs.org/project/uboot/list/?series=267078For documentation, see the 'doc' patch.
For version 2, a new naming scheme is used as above:
- bootdev is used instead of bootdevice, because 'device' is overused, is everywhere in U-Boot, can be confused with udevice
- bootmeth - because 'method' is too vanilla, appears 1300 times in U-BootAlso in version 2, drivers are introduced for the boot methods, to make it more extensible. Booting a custom OS is simply a matter of creating a bootmeth for it and implementing the
read_file()andboot()methods.Version 4 makes some minor improvements and leaves out the RFC patch for rpi conversion, in the hope of getting the base support applied sooner rather than later.
Quoted 5 lines
The design is described in these two documents:
https://drive.google.com/file/d/1ggW0KJpUOR__vBkj3l61L2dav4ZkNC12/view?usp=sharing
https://drive.google.com/file/d/1kTrflO9vvGlKp-ZH_jlgb9TY3WYG6FF9/view?usp=sharing
I keep putting off commenting more here, but, I still feel this is the wrong direction. What problems do we have today with distro boot? Well, we haven't figured out how to move configuring it out of the board
config.hfile. But that's just one of a half dozen or so examples of how we haven't figured out a good solution to configuring the default environment. And only some of those other examples are boot related (the NXP chain of trust booting stuff is another boot example, ETHPRIME, HOSTNAME, etc, are non-boot examples).We also aren't improving testing of "can we boot" here, because what THAT needs is setting up LAVA and booting some installers on some hardware (and some QEMU). That's testing that Linux boot works. Today we have tests for hush parsing, and if distro boot makes use of something we don't have a test for, we need a test for it. This adds tests for itself, which is good.
And I still don't see an example of where this demonstrates that existing non-UEFI boot cases are now easier to handle or cleaner to handle or otherwise better.
Quoted 8 lines
Quoted 3 lines
In that this is an attempt to tackle one of the long standing needed migrations (be able to drop board
config.hfiles), something here needs doing. But I don't see this as the right direction, sorry.Does anyone have a better idea for all of this? This is a solid base we can build on but we can't make any progress while this is just patches. What not apply it and we can move forward?
I agree with Simon. Having a well documented flow, help to integrate products and have a standard
way to handle the booting flow
Quoted 11 lines
- solves the env problem for distro boot in that we don't need the scripts
- gets rid of the scripts which are a confusing mess
- provides proper high-level concepts of boot device and boot method
- allows testing of the U-Boot part of 'can we boot' because we have tests for all the cases - we can expand this over time
- allows non-UEFI boot cases like Chrome OS, which is currently just a hack for one board[1]
- provides a programmatic base for A/B boot, etc.I feel the same way with Takahiro's series, which has been out-of-tree for too long.
I don't see the problem in having it merged. I'm dealing every day with crazy script
to handle situation like [1] and I think that company that integrates their product can
benefits on those changes. They can be improved with other people wants to use it
in their products.
Michael
Quoted 13 lines
Please reconsider this. What do we have to lose?
Regards,
Simon[1]
CONFIG_BOOTCOMMAND="tpminit; tpm startupTPM2_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; setexprcmdline_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"
Signature · 11 lines
Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 [email protected] __________________________________ Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 [email protected] www.amarulasolutions.com
Quoted 119 lines · Michael Nazzareno Trimarchi
Hi Tom
Quoted 83 lines · Simon Glass
Hi Tom,
Quoted 79 lines · Tom Rini
Quoted 51 lines · Simon Glass
The bootflow feature provide a built-in way for U-Boot to automatically boot an Operating System without custom scripting and other customisation. This is called 'standard boot' since it provides a standard way for U-Boot to boot a distro, without scripting.
It introduces the following concepts:
- bootdev - a device which can hold a distro
- bootmeth - a method to scan a bootdev to find bootflows (owned byU-Boot)- bootflow - a description of how to boot (owned by the distro)
This series provides an implementation of these, enabled to scan for bootflows from MMC, USB and Ethernet. It supports the existing distro boot as well as the EFI loader flow (bootefi/bootmgr). It works similiarly to the existing script-based approach, but is native to U-Boot.
With this we can boot on a Raspberry Pi 3 with just one command:
bootflow scan -lb
which means to scan, listing (-l) each bootflow and trying to boot each one (-b). The final patch shows this.
With a standard way to identify boot devices, booting become easier. It also should be possible to support U-Boot scripts, for backwards compatibility only.
This series relies on the PXE clean-up series, posted here:
https://patchwork.ozlabs.org/project/uboot/list/?series=267078For documentation, see the 'doc' patch.
For version 2, a new naming scheme is used as above:
- bootdev is used instead of bootdevice, because 'device' is overused, is everywhere in U-Boot, can be confused with udevice
- bootmeth - because 'method' is too vanilla, appears 1300 times in U-BootAlso in version 2, drivers are introduced for the boot methods, to make it more extensible. Booting a custom OS is simply a matter of creating a bootmeth for it and implementing the
read_file()andboot()methods.Version 4 makes some minor improvements and leaves out the RFC patch for rpi conversion, in the hope of getting the base support applied sooner rather than later.
Quoted 5 lines
The design is described in these two documents:
https://drive.google.com/file/d/1ggW0KJpUOR__vBkj3l61L2dav4ZkNC12/view?usp=sharing
https://drive.google.com/file/d/1kTrflO9vvGlKp-ZH_jlgb9TY3WYG6FF9/view?usp=sharing
I keep putting off commenting more here, but, I still feel this is the wrong direction. What problems do we have today with distro boot? Well, we haven't figured out how to move configuring it out of the board
config.hfile. But that's just one of a half dozen or so examples of how we haven't figured out a good solution to configuring the default environment. And only some of those other examples are boot related (the NXP chain of trust booting stuff is another boot example, ETHPRIME, HOSTNAME, etc, are non-boot examples).We also aren't improving testing of "can we boot" here, because what THAT needs is setting up LAVA and booting some installers on some hardware (and some QEMU). That's testing that Linux boot works. Today we have tests for hush parsing, and if distro boot makes use of something we don't have a test for, we need a test for it. This adds tests for itself, which is good.
And I still don't see an example of where this demonstrates that existing non-UEFI boot cases are now easier to handle or cleaner to handle or otherwise better.
Quoted 8 lines
Quoted 3 lines
In that this is an attempt to tackle one of the long standing needed migrations (be able to drop board
config.hfiles), something here needs doing. But I don't see this as the right direction, sorry.Does anyone have a better idea for all of this? This is a solid base we can build on but we can't make any progress while this is just patches. What not apply it and we can move forward?
I agree with Simon. Having a well documented flow, help to integrate products and have a standard
way to handle the booting flowQuoted 11 lines
- solves the env problem for distro boot in that we don't need the scripts
- gets rid of the scripts which are a confusing mess
- provides proper high-level concepts of boot device and boot method
- allows testing of the U-Boot part of 'can we boot' because we have tests for all the cases - we can expand this over time
- allows non-UEFI boot cases like Chrome OS, which is currently just a hack for one board[1]
- provides a programmatic base for A/B boot, etc.I feel the same way with Takahiro's series, which has been out-of-tree for too long.
I don't see the problem in having it merged. I'm dealing every day with crazy script
to handle situation like [1] and I think that company that integrates their product can
benefits on those changes. They can be improved with other people wants to use it
in their products.
Quoted 15 lines
Michael
Quoted 13 lines
Please reconsider this. What do we have to lose?
Regards,
Simon[1]
CONFIG_BOOTCOMMAND="tpminit; tpm startupTPM2_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; setexprcmdline_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"
OK, and what does your example here look like on top of Simon's series? Or do you just mean ChromeOS boot?
Signature · 1 line
Tom
Hi Tom
Quoted 137 lines · Tom Rini
Quoted 119 lines · Michael Nazzareno Trimarchi
Hi Tom
Quoted 83 lines · Simon Glass
Hi Tom,
Quoted 79 lines · Tom Rini
Quoted 51 lines · Simon Glass
The bootflow feature provide a built-in way for U-Boot to automatically boot an Operating System without custom scripting and other customisation. This is called 'standard boot' since it provides a standard way for U-Boot to boot a distro, without scripting.
It introduces the following concepts:
- bootdev - a device which can hold a distro
- bootmeth - a method to scan a bootdev to find bootflows (owned byU-Boot)- bootflow - a description of how to boot (owned by the distro)
This series provides an implementation of these, enabled to scan for bootflows from MMC, USB and Ethernet. It supports the existing distro boot as well as the EFI loader flow (bootefi/bootmgr). It works similiarly to the existing script-based approach, but is native to U-Boot.
With this we can boot on a Raspberry Pi 3 with just one command:
bootflow scan -lb
which means to scan, listing (-l) each bootflow and trying to boot each one (-b). The final patch shows this.
With a standard way to identify boot devices, booting become easier. It also should be possible to support U-Boot scripts, for backwards compatibility only.
This series relies on the PXE clean-up series, posted here:
https://patchwork.ozlabs.org/project/uboot/list/?series=267078For documentation, see the 'doc' patch.
For version 2, a new naming scheme is used as above:
- bootdev is used instead of bootdevice, because 'device' is overused, is everywhere in U-Boot, can be confused with udevice
- bootmeth - because 'method' is too vanilla, appears 1300 times in U-BootAlso in version 2, drivers are introduced for the boot methods, to make it more extensible. Booting a custom OS is simply a matter of creating a bootmeth for it and implementing the
read_file()andboot()methods.Version 4 makes some minor improvements and leaves out the RFC patch for rpi conversion, in the hope of getting the base support applied sooner rather than later.
Quoted 5 lines
The design is described in these two documents:
https://drive.google.com/file/d/1ggW0KJpUOR__vBkj3l61L2dav4ZkNC12/view?usp=sharing
https://drive.google.com/file/d/1kTrflO9vvGlKp-ZH_jlgb9TY3WYG6FF9/view?usp=sharing
I keep putting off commenting more here, but, I still feel this is the wrong direction. What problems do we have today with distro boot? Well, we haven't figured out how to move configuring it out of the board
config.hfile. But that's just one of a half dozen or so examples of how we haven't figured out a good solution to configuring the default environment. And only some of those other examples are boot related (the NXP chain of trust booting stuff is another boot example, ETHPRIME, HOSTNAME, etc, are non-boot examples).We also aren't improving testing of "can we boot" here, because what THAT needs is setting up LAVA and booting some installers on some hardware (and some QEMU). That's testing that Linux boot works. Today we have tests for hush parsing, and if distro boot makes use of something we don't have a test for, we need a test for it. This adds tests for itself, which is good.
And I still don't see an example of where this demonstrates that existing non-UEFI boot cases are now easier to handle or cleaner to handle or otherwise better.
Quoted 8 lines
Quoted 3 lines
In that this is an attempt to tackle one of the long standing needed migrations (be able to drop board
config.hfiles), something here needs doing. But I don't see this as the right direction, sorry.Does anyone have a better idea for all of this? This is a solid base we can build on but we can't make any progress while this is just patches. What not apply it and we can move forward?
I agree with Simon. Having a well documented flow, help to integrate products and have a standard
way to handle the booting flowQuoted 11 lines
- solves the env problem for distro boot in that we don't need the scripts
- gets rid of the scripts which are a confusing mess
- provides proper high-level concepts of boot device and boot method
- allows testing of the U-Boot part of 'can we boot' because we have tests for all the cases - we can expand this over time
- allows non-UEFI boot cases like Chrome OS, which is currently just a hack for one board[1]
- provides a programmatic base for A/B boot, etc.I feel the same way with Takahiro's series, which has been out-of-tree for too long.
I don't see the problem in having it merged. I'm dealing every day with crazy script
to handle situation like [1] and I think that company that integrates their product can
benefits on those changes. They can be improved with other people wants to use it
in their products.Quoted 15 lines
Michael
Quoted 13 lines
Please reconsider this. What do we have to lose?
Regards,
Simon[1]
CONFIG_BOOTCOMMAND="tpminit; tpm startupTPM2_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; setexprcmdline_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"
Quoted 2 lines
OK, and what does your example here look like on top of Simon's series? Or do you just mean ChromeOS boot?
I can use some of our boards and move on to the Simon patchset. In that case, are you happy with it?
Michael
Quoted 3 lines
--
Tom
Signature · 11 lines
Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 [email protected] __________________________________ Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 [email protected] www.amarulasolutions.com
Quoted 140 lines · Michael Nazzareno Trimarchi
Hi Tom
Quoted 137 lines · Tom Rini
Quoted 134 lines · Michael Nazzareno Trimarchi
Hi Tom
Quoted 83 lines · Simon Glass
Hi Tom,
Quoted 79 lines · Tom Rini
Quoted 51 lines · Simon Glass
The bootflow feature provide a built-in way for U-Boot to automatically boot an Operating System without custom scripting and other customisation. This is called 'standard boot' since it provides a standard way for U-Boot to boot a distro, without scripting.
It introduces the following concepts:
- bootdev - a device which can hold a distro
- bootmeth - a method to scan a bootdev to find bootflows (owned byU-Boot)- bootflow - a description of how to boot (owned by the distro)
This series provides an implementation of these, enabled to scan for bootflows from MMC, USB and Ethernet. It supports the existing distro boot as well as the EFI loader flow (bootefi/bootmgr). It works similiarly to the existing script-based approach, but is native to U-Boot.
With this we can boot on a Raspberry Pi 3 with just one command:
bootflow scan -lb
which means to scan, listing (-l) each bootflow and trying to boot each one (-b). The final patch shows this.
With a standard way to identify boot devices, booting become easier. It also should be possible to support U-Boot scripts, for backwards compatibility only.
This series relies on the PXE clean-up series, posted here:
https://patchwork.ozlabs.org/project/uboot/list/?series=267078For documentation, see the 'doc' patch.
For version 2, a new naming scheme is used as above:
- bootdev is used instead of bootdevice, because 'device' is overused, is everywhere in U-Boot, can be confused with udevice
- bootmeth - because 'method' is too vanilla, appears 1300 times in U-BootAlso in version 2, drivers are introduced for the boot methods, to make it more extensible. Booting a custom OS is simply a matter of creating a bootmeth for it and implementing the
read_file()andboot()methods.Version 4 makes some minor improvements and leaves out the RFC patch for rpi conversion, in the hope of getting the base support applied sooner rather than later.
Quoted 5 lines
The design is described in these two documents:
https://drive.google.com/file/d/1ggW0KJpUOR__vBkj3l61L2dav4ZkNC12/view?usp=sharing
https://drive.google.com/file/d/1kTrflO9vvGlKp-ZH_jlgb9TY3WYG6FF9/view?usp=sharing
I keep putting off commenting more here, but, I still feel this is the wrong direction. What problems do we have today with distro boot? Well, we haven't figured out how to move configuring it out of the board
config.hfile. But that's just one of a half dozen or so examples of how we haven't figured out a good solution to configuring the default environment. And only some of those other examples are boot related (the NXP chain of trust booting stuff is another boot example, ETHPRIME, HOSTNAME, etc, are non-boot examples).We also aren't improving testing of "can we boot" here, because what THAT needs is setting up LAVA and booting some installers on some hardware (and some QEMU). That's testing that Linux boot works. Today we have tests for hush parsing, and if distro boot makes use of something we don't have a test for, we need a test for it. This adds tests for itself, which is good.
And I still don't see an example of where this demonstrates that existing non-UEFI boot cases are now easier to handle or cleaner to handle or otherwise better.
Quoted 8 lines
Quoted 3 lines
In that this is an attempt to tackle one of the long standing needed migrations (be able to drop board
config.hfiles), something here needs doing. But I don't see this as the right direction, sorry.Does anyone have a better idea for all of this? This is a solid base we can build on but we can't make any progress while this is just patches. What not apply it and we can move forward?
I agree with Simon. Having a well documented flow, help to integrate products and have a standard
way to handle the booting flowQuoted 11 lines
- solves the env problem for distro boot in that we don't need the scripts
- gets rid of the scripts which are a confusing mess
- provides proper high-level concepts of boot device and boot method
- allows testing of the U-Boot part of 'can we boot' because we have tests for all the cases - we can expand this over time
- allows non-UEFI boot cases like Chrome OS, which is currently just a hack for one board[1]
- provides a programmatic base for A/B boot, etc.I feel the same way with Takahiro's series, which has been out-of-tree for too long.
I don't see the problem in having it merged. I'm dealing every day with crazy script
to handle situation like [1] and I think that company that integrates their product can
benefits on those changes. They can be improved with other people wants to use it
in their products.Michael
Quoted 13 lines
Please reconsider this. What do we have to lose?
Regards,
Simon[1]
CONFIG_BOOTCOMMAND="tpminit; tpm startupTPM2_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; setexprcmdline_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"
Quoted 5 lines
Quoted 2 lines
OK, and what does your example here look like on top of Simon's series? Or do you just mean ChromeOS boot?
I can use some of our boards and move on to the Simon patchset. In that case, are you happy with it?
No, I'm not saying I'll take this if someone uses it somewhere. But I've been asking for in previous iterations for showing that it makes some existing use case easier. And I don't see any implementations of that in v4. Adding UEFI boot to this isn't a good example since that's already being re-done via the UEFI boot manager series that implements what the spec says to do for that.
Signature · 1 line
Tom
Hi Tom
Quoted 148 lines · Tom Rini
Quoted 140 lines · Michael Nazzareno Trimarchi
Hi Tom
Quoted 137 lines · Tom Rini
Quoted 134 lines · Michael Nazzareno Trimarchi
Hi Tom
Quoted 83 lines · Simon Glass
Hi Tom,
Quoted 79 lines · Tom Rini
Quoted 51 lines · Simon Glass
The bootflow feature provide a built-in way for U-Boot to automatically boot an Operating System without custom scripting and other customisation. This is called 'standard boot' since it provides a standard way for U-Boot to boot a distro, without scripting.
It introduces the following concepts:
- bootdev - a device which can hold a distro
- bootmeth - a method to scan a bootdev to find bootflows (owned byU-Boot)- bootflow - a description of how to boot (owned by the distro)
This series provides an implementation of these, enabled to scan for bootflows from MMC, USB and Ethernet. It supports the existing distro boot as well as the EFI loader flow (bootefi/bootmgr). It works similiarly to the existing script-based approach, but is native to U-Boot.
With this we can boot on a Raspberry Pi 3 with just one command:
bootflow scan -lb
which means to scan, listing (-l) each bootflow and trying to boot each one (-b). The final patch shows this.
With a standard way to identify boot devices, booting become easier. It also should be possible to support U-Boot scripts, for backwards compatibility only.
This series relies on the PXE clean-up series, posted here:
https://patchwork.ozlabs.org/project/uboot/list/?series=267078For documentation, see the 'doc' patch.
For version 2, a new naming scheme is used as above:
- bootdev is used instead of bootdevice, because 'device' is overused, is everywhere in U-Boot, can be confused with udevice
- bootmeth - because 'method' is too vanilla, appears 1300 times in U-BootAlso in version 2, drivers are introduced for the boot methods, to make it more extensible. Booting a custom OS is simply a matter of creating a bootmeth for it and implementing the
read_file()andboot()methods.Version 4 makes some minor improvements and leaves out the RFC patch for rpi conversion, in the hope of getting the base support applied sooner rather than later.
Quoted 5 lines
The design is described in these two documents:
https://drive.google.com/file/d/1ggW0KJpUOR__vBkj3l61L2dav4ZkNC12/view?usp=sharing
https://drive.google.com/file/d/1kTrflO9vvGlKp-ZH_jlgb9TY3WYG6FF9/view?usp=sharing
I keep putting off commenting more here, but, I still feel this is the wrong direction. What problems do we have today with distro boot? Well, we haven't figured out how to move configuring it out of the board
config.hfile. But that's just one of a half dozen or so examples of how we haven't figured out a good solution to configuring the default environment. And only some of those other examples are boot related (the NXP chain of trust booting stuff is another boot example, ETHPRIME, HOSTNAME, etc, are non-boot examples).We also aren't improving testing of "can we boot" here, because what THAT needs is setting up LAVA and booting some installers on some hardware (and some QEMU). That's testing that Linux boot works. Today we have tests for hush parsing, and if distro boot makes use of something we don't have a test for, we need a test for it. This adds tests for itself, which is good.
And I still don't see an example of where this demonstrates that existing non-UEFI boot cases are now easier to handle or cleaner to handle or otherwise better.
Quoted 8 lines
Quoted 3 lines
In that this is an attempt to tackle one of the long standing needed migrations (be able to drop board
config.hfiles), something here needs doing. But I don't see this as the right direction, sorry.Does anyone have a better idea for all of this? This is a solid base we can build on but we can't make any progress while this is just patches. What not apply it and we can move forward?
I agree with Simon. Having a well documented flow, help to integrate products and have a standard
way to handle the booting flowQuoted 11 lines
- solves the env problem for distro boot in that we don't need the scripts
- gets rid of the scripts which are a confusing mess
- provides proper high-level concepts of boot device and boot method
- allows testing of the U-Boot part of 'can we boot' because we have tests for all the cases - we can expand this over time
- allows non-UEFI boot cases like Chrome OS, which is currently just a hack for one board[1]
- provides a programmatic base for A/B boot, etc.I feel the same way with Takahiro's series, which has been out-of-tree for too long.
I don't see the problem in having it merged. I'm dealing every day with crazy script
to handle situation like [1] and I think that company that integrates their product can
benefits on those changes. They can be improved with other people wants to use it
in their products.Michael
Quoted 13 lines
Please reconsider this. What do we have to lose?
Regards,
Simon[1]
CONFIG_BOOTCOMMAND="tpminit; tpm startupTPM2_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; setexprcmdline_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"Quoted 5 lines
Quoted 2 lines
OK, and what does your example here look like on top of Simon's series? Or do you just mean ChromeOS boot?
I can use some of our boards and move on to the Simon patchset. In that case, are you happy with it?
Quoted 6 lines
No, I'm not saying I'll take this if someone uses it somewhere. But I've been asking for in previous iterations for showing that it makes some existing use case easier. And I don't see any implementations of that in v4. Adding UEFI boot to this isn't a good example since that's already being re-done via the UEFI boot manager series that implements what the spec says to do for that.
I don't think that a lot of real use cases in embedded devices are using distro boot but
they have proper customized boot flow and update, recovery. What you call A, B and C.
Then we have a special recovery path that instead of using emmc , uses a usb pen drive. Having
some more structure boot flow with documentation and some use cases will help to have in uboot what it's in
private repositories.
Michael
Quoted 3 lines
--
Tom
--
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
[email protected]
__________________________________
Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
T. +31 (0)85 111 9172
[email protected]
www.amarulasolutions.com
Quoted 159 lines · Michael Nazzareno Trimarchi
Hi Tom
Quoted 148 lines · Tom Rini
Quoted 140 lines · Michael Nazzareno Trimarchi
Hi Tom
Quoted 137 lines · Tom Rini
Quoted 134 lines · Michael Nazzareno Trimarchi
Hi Tom
Quoted 83 lines · Simon Glass
Hi Tom,
Quoted 79 lines · Tom Rini
Quoted 51 lines · Simon Glass
The bootflow feature provide a built-in way for U-Boot to automatically boot an Operating System without custom scripting and other customisation. This is called 'standard boot' since it provides a standard way for U-Boot to boot a distro, without scripting.
It introduces the following concepts:
- bootdev - a device which can hold a distro
- bootmeth - a method to scan a bootdev to find bootflows (owned byU-Boot)- bootflow - a description of how to boot (owned by the distro)
This series provides an implementation of these, enabled to scan for bootflows from MMC, USB and Ethernet. It supports the existing distro boot as well as the EFI loader flow (bootefi/bootmgr). It works similiarly to the existing script-based approach, but is native to U-Boot.
With this we can boot on a Raspberry Pi 3 with just one command:
bootflow scan -lb
which means to scan, listing (-l) each bootflow and trying to boot each one (-b). The final patch shows this.
With a standard way to identify boot devices, booting become easier. It also should be possible to support U-Boot scripts, for backwards compatibility only.
This series relies on the PXE clean-up series, posted here:
https://patchwork.ozlabs.org/project/uboot/list/?series=267078For documentation, see the 'doc' patch.
For version 2, a new naming scheme is used as above:
- bootdev is used instead of bootdevice, because 'device' is overused, is everywhere in U-Boot, can be confused with udevice
- bootmeth - because 'method' is too vanilla, appears 1300 times in U-BootAlso in version 2, drivers are introduced for the boot methods, to make it more extensible. Booting a custom OS is simply a matter of creating a bootmeth for it and implementing the
read_file()andboot()methods.Version 4 makes some minor improvements and leaves out the RFC patch for rpi conversion, in the hope of getting the base support applied sooner rather than later.
Quoted 5 lines
The design is described in these two documents:
https://drive.google.com/file/d/1ggW0KJpUOR__vBkj3l61L2dav4ZkNC12/view?usp=sharing
https://drive.google.com/file/d/1kTrflO9vvGlKp-ZH_jlgb9TY3WYG6FF9/view?usp=sharing
I keep putting off commenting more here, but, I still feel this is the wrong direction. What problems do we have today with distro boot? Well, we haven't figured out how to move configuring it out of the board
config.hfile. But that's just one of a half dozen or so examples of how we haven't figured out a good solution to configuring the default environment. And only some of those other examples are boot related (the NXP chain of trust booting stuff is another boot example, ETHPRIME, HOSTNAME, etc, are non-boot examples).We also aren't improving testing of "can we boot" here, because what THAT needs is setting up LAVA and booting some installers on some hardware (and some QEMU). That's testing that Linux boot works. Today we have tests for hush parsing, and if distro boot makes use of something we don't have a test for, we need a test for it. This adds tests for itself, which is good.
And I still don't see an example of where this demonstrates that existing non-UEFI boot cases are now easier to handle or cleaner to handle or otherwise better.
Quoted 8 lines
Quoted 3 lines
In that this is an attempt to tackle one of the long standing needed migrations (be able to drop board
config.hfiles), something here needs doing. But I don't see this as the right direction, sorry.Does anyone have a better idea for all of this? This is a solid base we can build on but we can't make any progress while this is just patches. What not apply it and we can move forward?
I agree with Simon. Having a well documented flow, help to integrate products and have a standard
way to handle the booting flowQuoted 11 lines
- solves the env problem for distro boot in that we don't need the scripts
- gets rid of the scripts which are a confusing mess
- provides proper high-level concepts of boot device and boot method
- allows testing of the U-Boot part of 'can we boot' because we have tests for all the cases - we can expand this over time
- allows non-UEFI boot cases like Chrome OS, which is currently just a hack for one board[1]
- provides a programmatic base for A/B boot, etc.I feel the same way with Takahiro's series, which has been out-of-tree for too long.
I don't see the problem in having it merged. I'm dealing every day with crazy script
to handle situation like [1] and I think that company that integrates their product can
benefits on those changes. They can be improved with other people wants to use it
in their products.Michael
Quoted 13 lines
Please reconsider this. What do we have to lose?
Regards,
Simon[1]
CONFIG_BOOTCOMMAND="tpminit; tpm startupTPM2_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; setexprcmdline_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"Quoted 5 lines
Quoted 2 lines
OK, and what does your example here look like on top of Simon's series? Or do you just mean ChromeOS boot?
I can use some of our boards and move on to the Simon patchset. In that case, are you happy with it?
Quoted 6 lines
No, I'm not saying I'll take this if someone uses it somewhere. But I've been asking for in previous iterations for showing that it makes some existing use case easier. And I don't see any implementations of that in v4. Adding UEFI boot to this isn't a good example since that's already being re-done via the UEFI boot manager series that implements what the spec says to do for that.
Quoted 9 lines
I don't think that a lot of real use cases in embedded devices are using distro boot but
they have proper customized boot flow and update, recovery. What you call A, B and C.
Then we have a special recovery path that instead of using emmc , uses a usb pen drive. Having
some more structure boot flow with documentation and some use cases will help to have in uboot what it's in
private repositories.
Exactly. My concern is that this does, or will end up, spending a lot of effort to replicate the "find an arbitrary bootable thing" logic the UEFI boot manager stuff has to do to that spec rather than making it easier to handle the common everything else cases where the developer knows the valid cases for normal boot and recovery boot and needs to do whatever validation is required there. Maybe that's where some of the hang up is.
Signature · 1 line
Tom
Hi Tom,
Quoted 171 lines · Tom Rini
Quoted 159 lines · Michael Nazzareno Trimarchi
Hi Tom
Quoted 148 lines · Tom Rini
Quoted 140 lines · Michael Nazzareno Trimarchi
Hi Tom
Quoted 137 lines · Tom Rini
Quoted 134 lines · Michael Nazzareno Trimarchi
Hi Tom
Quoted 83 lines · Simon Glass
Hi Tom,
Quoted 79 lines · Tom Rini
Quoted 51 lines · Simon Glass
The bootflow feature provide a built-in way for U-Boot to automatically boot an Operating System without custom scripting and other customisation. This is called 'standard boot' since it provides a standard way for U-Boot to boot a distro, without scripting.
It introduces the following concepts:
- bootdev - a device which can hold a distro
- bootmeth - a method to scan a bootdev to find bootflows (owned byU-Boot)- bootflow - a description of how to boot (owned by the distro)
This series provides an implementation of these, enabled to scan for bootflows from MMC, USB and Ethernet. It supports the existing distro boot as well as the EFI loader flow (bootefi/bootmgr). It works similiarly to the existing script-based approach, but is native to U-Boot.
With this we can boot on a Raspberry Pi 3 with just one command:
bootflow scan -lb
which means to scan, listing (-l) each bootflow and trying to boot each one (-b). The final patch shows this.
With a standard way to identify boot devices, booting become easier. It also should be possible to support U-Boot scripts, for backwards compatibility only.
This series relies on the PXE clean-up series, posted here:
https://patchwork.ozlabs.org/project/uboot/list/?series=267078For documentation, see the 'doc' patch.
For version 2, a new naming scheme is used as above:
- bootdev is used instead of bootdevice, because 'device' is overused, is everywhere in U-Boot, can be confused with udevice
- bootmeth - because 'method' is too vanilla, appears 1300 times in U-BootAlso in version 2, drivers are introduced for the boot methods, to make it more extensible. Booting a custom OS is simply a matter of creating a bootmeth for it and implementing the
read_file()andboot()methods.Version 4 makes some minor improvements and leaves out the RFC patch for rpi conversion, in the hope of getting the base support applied sooner rather than later.
Quoted 5 lines
The design is described in these two documents:
https://drive.google.com/file/d/1ggW0KJpUOR__vBkj3l61L2dav4ZkNC12/view?usp=sharing
https://drive.google.com/file/d/1kTrflO9vvGlKp-ZH_jlgb9TY3WYG6FF9/view?usp=sharing
I keep putting off commenting more here, but, I still feel this is the wrong direction. What problems do we have today with distro boot? Well, we haven't figured out how to move configuring it out of the board
config.hfile. But that's just one of a half dozen or so examples of how we haven't figured out a good solution to configuring the default environment. And only some of those other examples are boot related (the NXP chain of trust booting stuff is another boot example, ETHPRIME, HOSTNAME, etc, are non-boot examples).We also aren't improving testing of "can we boot" here, because what THAT needs is setting up LAVA and booting some installers on some hardware (and some QEMU). That's testing that Linux boot works. Today we have tests for hush parsing, and if distro boot makes use of something we don't have a test for, we need a test for it. This adds tests for itself, which is good.
And I still don't see an example of where this demonstrates that existing non-UEFI boot cases are now easier to handle or cleaner to handle or otherwise better.
Quoted 8 lines
Quoted 3 lines
In that this is an attempt to tackle one of the long standing needed migrations (be able to drop board
config.hfiles), something here needs doing. But I don't see this as the right direction, sorry.Does anyone have a better idea for all of this? This is a solid base we can build on but we can't make any progress while this is just patches. What not apply it and we can move forward?
I agree with Simon. Having a well documented flow, help to integrate products and have a standard
way to handle the booting flowQuoted 11 lines
- solves the env problem for distro boot in that we don't need the scripts
- gets rid of the scripts which are a confusing mess
- provides proper high-level concepts of boot device and boot method
- allows testing of the U-Boot part of 'can we boot' because we have tests for all the cases - we can expand this over time
- allows non-UEFI boot cases like Chrome OS, which is currently just a hack for one board[1]
- provides a programmatic base for A/B boot, etc.I feel the same way with Takahiro's series, which has been out-of-tree for too long.
I don't see the problem in having it merged. I'm dealing every day with crazy script
to handle situation like [1] and I think that company that integrates their product can
benefits on those changes. They can be improved with other people wants to use it
in their products.Michael
Quoted 13 lines
Please reconsider this. What do we have to lose?
Regards,
Simon[1]
CONFIG_BOOTCOMMAND="tpminit; tpm startupTPM2_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; setexprcmdline_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"Quoted 5 lines
Quoted 2 lines
OK, and what does your example here look like on top of Simon's series? Or do you just mean ChromeOS boot?
I can use some of our boards and move on to the Simon patchset. In that case, are you happy with it?
Quoted 6 lines
No, I'm not saying I'll take this if someone uses it somewhere. But I've been asking for in previous iterations for showing that it makes some existing use case easier. And I don't see any implementations of that in v4. Adding UEFI boot to this isn't a good example since that's already being re-done via the UEFI boot manager series that implements what the spec says to do for that.
Quoted 9 lines
I don't think that a lot of real use cases in embedded devices are using distro boot but
they have proper customized boot flow and update, recovery. What you call A, B and C.
Then we have a special recovery path that instead of using emmc , uses a usb pen drive. Having
some more structure boot flow with documentation and some use cases will help to have in uboot what it's in
private repositories.
Quoted 7 lines
Exactly. My concern is that this does, or will end up, spending a lot of effort to replicate the "find an arbitrary bootable thing" logic the UEFI boot manager stuff has to do to that spec rather than making it easier to handle the common everything else cases where the developer knows the valid cases for normal boot and recovery boot and needs to do whatever validation is required there. Maybe that's where some of the hang up is.
I'm actually not sure where the hang-up is. We seem to be enforcing UEFI everywhere in U-Boot. That must make some people very happy, but it is not the right approach to take for a general purpose, open-source, Universal Boot Loader.
If U-Boot is to remain a boot loader for non-UEFI cases, then I think bootstd is an important step forward. There is more work to do, but it sets up the basic abstractions and is a strong base to work from.
Or is U-Boot for UEFI only, with only 'boot manager' allowed to have a structured boot?
I hope not, but I'm struggling to read much else from this thread.
Regards,
Simon
Quoted 187 lines · Simon Glass
Hi Tom,
Quoted 171 lines · Tom Rini
Quoted 159 lines · Michael Nazzareno Trimarchi
Hi Tom
Quoted 148 lines · Tom Rini
Quoted 140 lines · Michael Nazzareno Trimarchi
Hi Tom
Quoted 137 lines · Tom Rini
Quoted 134 lines · Michael Nazzareno Trimarchi
Hi Tom
Quoted 83 lines · Simon Glass
Hi Tom,
Quoted 79 lines · Tom Rini
Quoted 51 lines · Simon Glass
The bootflow feature provide a built-in way for U-Boot to automatically boot an Operating System without custom scripting and other customisation. This is called 'standard boot' since it provides a standard way for U-Boot to boot a distro, without scripting.
It introduces the following concepts:
- bootdev - a device which can hold a distro
- bootmeth - a method to scan a bootdev to find bootflows (owned byU-Boot)- bootflow - a description of how to boot (owned by the distro)
This series provides an implementation of these, enabled to scan for bootflows from MMC, USB and Ethernet. It supports the existing distro boot as well as the EFI loader flow (bootefi/bootmgr). It works similiarly to the existing script-based approach, but is native to U-Boot.
With this we can boot on a Raspberry Pi 3 with just one command:
bootflow scan -lb
which means to scan, listing (-l) each bootflow and trying to boot each one (-b). The final patch shows this.
With a standard way to identify boot devices, booting become easier. It also should be possible to support U-Boot scripts, for backwards compatibility only.
This series relies on the PXE clean-up series, posted here:
https://patchwork.ozlabs.org/project/uboot/list/?series=267078For documentation, see the 'doc' patch.
For version 2, a new naming scheme is used as above:
- bootdev is used instead of bootdevice, because 'device' is overused, is everywhere in U-Boot, can be confused with udevice
- bootmeth - because 'method' is too vanilla, appears 1300 times in U-BootAlso in version 2, drivers are introduced for the boot methods, to make it more extensible. Booting a custom OS is simply a matter of creating a bootmeth for it and implementing the
read_file()andboot()methods.Version 4 makes some minor improvements and leaves out the RFC patch for rpi conversion, in the hope of getting the base support applied sooner rather than later.
Quoted 5 lines
The design is described in these two documents:
https://drive.google.com/file/d/1ggW0KJpUOR__vBkj3l61L2dav4ZkNC12/view?usp=sharing
https://drive.google.com/file/d/1kTrflO9vvGlKp-ZH_jlgb9TY3WYG6FF9/view?usp=sharing
I keep putting off commenting more here, but, I still feel this is the wrong direction. What problems do we have today with distro boot? Well, we haven't figured out how to move configuring it out of the board
config.hfile. But that's just one of a half dozen or so examples of how we haven't figured out a good solution to configuring the default environment. And only some of those other examples are boot related (the NXP chain of trust booting stuff is another boot example, ETHPRIME, HOSTNAME, etc, are non-boot examples).We also aren't improving testing of "can we boot" here, because what THAT needs is setting up LAVA and booting some installers on some hardware (and some QEMU). That's testing that Linux boot works. Today we have tests for hush parsing, and if distro boot makes use of something we don't have a test for, we need a test for it. This adds tests for itself, which is good.
And I still don't see an example of where this demonstrates that existing non-UEFI boot cases are now easier to handle or cleaner to handle or otherwise better.
Quoted 8 lines
Quoted 3 lines
In that this is an attempt to tackle one of the long standing needed migrations (be able to drop board
config.hfiles), something here needs doing. But I don't see this as the right direction, sorry.Does anyone have a better idea for all of this? This is a solid base we can build on but we can't make any progress while this is just patches. What not apply it and we can move forward?
I agree with Simon. Having a well documented flow, help to integrate products and have a standard
way to handle the booting flowQuoted 11 lines
- solves the env problem for distro boot in that we don't need the scripts
- gets rid of the scripts which are a confusing mess
- provides proper high-level concepts of boot device and boot method
- allows testing of the U-Boot part of 'can we boot' because we have tests for all the cases - we can expand this over time
- allows non-UEFI boot cases like Chrome OS, which is currently just a hack for one board[1]
- provides a programmatic base for A/B boot, etc.I feel the same way with Takahiro's series, which has been out-of-tree for too long.
I don't see the problem in having it merged. I'm dealing every day with crazy script
to handle situation like [1] and I think that company that integrates their product can
benefits on those changes. They can be improved with other people wants to use it
in their products.Michael
Quoted 13 lines
Please reconsider this. What do we have to lose?
Regards,
Simon[1]
CONFIG_BOOTCOMMAND="tpminit; tpm startupTPM2_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; setexprcmdline_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"Quoted 5 lines
Quoted 2 lines
OK, and what does your example here look like on top of Simon's series? Or do you just mean ChromeOS boot?
I can use some of our boards and move on to the Simon patchset. In that case, are you happy with it?
Quoted 6 lines
No, I'm not saying I'll take this if someone uses it somewhere. But I've been asking for in previous iterations for showing that it makes some existing use case easier. And I don't see any implementations of that in v4. Adding UEFI boot to this isn't a good example since that's already being re-done via the UEFI boot manager series that implements what the spec says to do for that.
Quoted 9 lines
I don't think that a lot of real use cases in embedded devices are using distro boot but
they have proper customized boot flow and update, recovery. What you call A, B and C.
Then we have a special recovery path that instead of using emmc , uses a usb pen drive. Having
some more structure boot flow with documentation and some use cases will help to have in uboot what it's in
private repositories.Quoted 7 lines
Exactly. My concern is that this does, or will end up, spending a lot of effort to replicate the "find an arbitrary bootable thing" logic the UEFI boot manager stuff has to do to that spec rather than making it easier to handle the common everything else cases where the developer knows the valid cases for normal boot and recovery boot and needs to do whatever validation is required there. Maybe that's where some of the hang up is.
I'm actually not sure where the hang-up is. We seem to be enforcing UEFI everywhere in U-Boot. That must make some people very happy, but it is not the right approach to take for a general purpose, open-source, Universal Boot Loader.
Quoted 8 lines
If U-Boot is to remain a boot loader for non-UEFI cases, then I think bootstd is an important step forward. There is more work to do, but it sets up the basic abstractions and is a strong base to work from.
Or is U-Boot for UEFI only, with only 'boot manager' allowed to have a structured boot?
I hope not, but I'm struggling to read much else from this thread.
Perhaps you and I need to have a call at some point soon then? It is not my intention to make UEFI the only, or only well supported, way of booting things.
Signature · 1 line
Tom
Hi Tom,
Quoted 193 lines · Tom Rini
Quoted 191 lines · Simon Glass
Hi Tom,
Quoted 171 lines · Tom Rini
Quoted 159 lines · Michael Nazzareno Trimarchi
Hi Tom
Quoted 148 lines · Tom Rini
Quoted 140 lines · Michael Nazzareno Trimarchi
Hi Tom
Quoted 137 lines · Tom Rini
Quoted 134 lines · Michael Nazzareno Trimarchi
Hi Tom
Quoted 83 lines · Simon Glass
Hi Tom,
Quoted 79 lines · Tom Rini
Quoted 51 lines · Simon Glass
The bootflow feature provide a built-in way for U-Boot to automatically boot an Operating System without custom scripting and other customisation. This is called 'standard boot' since it provides a standard way for U-Boot to boot a distro, without scripting.
It introduces the following concepts:
- bootdev - a device which can hold a distro
- bootmeth - a method to scan a bootdev to find bootflows (owned byU-Boot)- bootflow - a description of how to boot (owned by the distro)
This series provides an implementation of these, enabled to scan for bootflows from MMC, USB and Ethernet. It supports the existing distro boot as well as the EFI loader flow (bootefi/bootmgr). It works similiarly to the existing script-based approach, but is native to U-Boot.
With this we can boot on a Raspberry Pi 3 with just one command:
bootflow scan -lb
which means to scan, listing (-l) each bootflow and trying to boot each one (-b). The final patch shows this.
With a standard way to identify boot devices, booting become easier. It also should be possible to support U-Boot scripts, for backwards compatibility only.
This series relies on the PXE clean-up series, posted here:
https://patchwork.ozlabs.org/project/uboot/list/?series=267078For documentation, see the 'doc' patch.
For version 2, a new naming scheme is used as above:
- bootdev is used instead of bootdevice, because 'device' is overused, is everywhere in U-Boot, can be confused with udevice
- bootmeth - because 'method' is too vanilla, appears 1300 times in U-BootAlso in version 2, drivers are introduced for the boot methods, to make it more extensible. Booting a custom OS is simply a matter of creating a bootmeth for it and implementing the
read_file()andboot()methods.Version 4 makes some minor improvements and leaves out the RFC patch for rpi conversion, in the hope of getting the base support applied sooner rather than later.
Quoted 5 lines
The design is described in these two documents:
https://drive.google.com/file/d/1ggW0KJpUOR__vBkj3l61L2dav4ZkNC12/view?usp=sharing
https://drive.google.com/file/d/1kTrflO9vvGlKp-ZH_jlgb9TY3WYG6FF9/view?usp=sharing
I keep putting off commenting more here, but, I still feel this is the wrong direction. What problems do we have today with distro boot? Well, we haven't figured out how to move configuring it out of the board
config.hfile. But that's just one of a half dozen or so examples of how we haven't figured out a good solution to configuring the default environment. And only some of those other examples are boot related (the NXP chain of trust booting stuff is another boot example, ETHPRIME, HOSTNAME, etc, are non-boot examples).We also aren't improving testing of "can we boot" here, because what THAT needs is setting up LAVA and booting some installers on some hardware (and some QEMU). That's testing that Linux boot works. Today we have tests for hush parsing, and if distro boot makes use of something we don't have a test for, we need a test for it. This adds tests for itself, which is good.
And I still don't see an example of where this demonstrates that existing non-UEFI boot cases are now easier to handle or cleaner to handle or otherwise better.
Quoted 8 lines
Quoted 3 lines
In that this is an attempt to tackle one of the long standing needed migrations (be able to drop board
config.hfiles), something here needs doing. But I don't see this as the right direction, sorry.Does anyone have a better idea for all of this? This is a solid base we can build on but we can't make any progress while this is just patches. What not apply it and we can move forward?
I agree with Simon. Having a well documented flow, help to integrate products and have a standard
way to handle the booting flowQuoted 11 lines
- solves the env problem for distro boot in that we don't need the scripts
- gets rid of the scripts which are a confusing mess
- provides proper high-level concepts of boot device and boot method
- allows testing of the U-Boot part of 'can we boot' because we have tests for all the cases - we can expand this over time
- allows non-UEFI boot cases like Chrome OS, which is currently just a hack for one board[1]
- provides a programmatic base for A/B boot, etc.I feel the same way with Takahiro's series, which has been out-of-tree for too long.
I don't see the problem in having it merged. I'm dealing every day with crazy script
to handle situation like [1] and I think that company that integrates their product can
benefits on those changes. They can be improved with other people wants to use it
in their products.Michael
Quoted 13 lines
Please reconsider this. What do we have to lose?
Regards,
Simon[1]
CONFIG_BOOTCOMMAND="tpminit; tpm startupTPM2_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; setexprcmdline_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"Quoted 5 lines
Quoted 2 lines
OK, and what does your example here look like on top of Simon's series? Or do you just mean ChromeOS boot?
I can use some of our boards and move on to the Simon patchset. In that case, are you happy with it?
Quoted 6 lines
No, I'm not saying I'll take this if someone uses it somewhere. But I've been asking for in previous iterations for showing that it makes some existing use case easier. And I don't see any implementations of that in v4. Adding UEFI boot to this isn't a good example since that's already being re-done via the UEFI boot manager series that implements what the spec says to do for that.
Quoted 9 lines
I don't think that a lot of real use cases in embedded devices are using distro boot but
they have proper customized boot flow and update, recovery. What you call A, B and C.
Then we have a special recovery path that instead of using emmc , uses a usb pen drive. Having
some more structure boot flow with documentation and some use cases will help to have in uboot what it's in
private repositories.Quoted 7 lines
Exactly. My concern is that this does, or will end up, spending a lot of effort to replicate the "find an arbitrary bootable thing" logic the UEFI boot manager stuff has to do to that spec rather than making it easier to handle the common everything else cases where the developer knows the valid cases for normal boot and recovery boot and needs to do whatever validation is required there. Maybe that's where some of the hang up is.
I'm actually not sure where the hang-up is. We seem to be enforcing UEFI everywhere in U-Boot. That must make some people very happy, but it is not the right approach to take for a general purpose, open-source, Universal Boot Loader.
If U-Boot is to remain a boot loader for non-UEFI cases, then I think bootstd is an important step forward. There is more work to do, but it sets up the basic abstractions and is a strong base to work from.
Quoted 8 lines
Quoted 4 lines
Or is U-Boot for UEFI only, with only 'boot manager' allowed to have a structured boot?
I hope not, but I'm struggling to read much else from this thread.
Perhaps you and I need to have a call at some point soon then? It is not my intention to make UEFI the only, or only well supported, way of booting things.
Sure, I could do this time tomorrow or 2-3 hours earlier / later. I am around on irc.
Regards,
Simon
Quoted 3 lines
--
Tom
HI Simon
Quoted 200 lines · Simon Glass
Hi Tom,
Quoted 196 lines · Tom Rini
Quoted 194 lines · Simon Glass
Hi Tom,
Quoted 171 lines · Tom Rini
Quoted 159 lines · Michael Nazzareno Trimarchi
Hi Tom
Quoted 148 lines · Tom Rini
Quoted 140 lines · Michael Nazzareno Trimarchi
Hi Tom
Quoted 137 lines · Tom Rini
Quoted 134 lines · Michael Nazzareno Trimarchi
Hi Tom
Quoted 83 lines · Simon Glass
Hi Tom,
Quoted 79 lines · Tom Rini
Quoted 51 lines · Simon Glass
The bootflow feature provide a built-in way for U-Boot to automatically boot an Operating System without custom scripting and other customisation. This is called 'standard boot' since it provides a standard way for U-Boot to boot a distro, without scripting.
It introduces the following concepts:
- bootdev - a device which can hold a distro
- bootmeth - a method to scan a bootdev to find bootflows (owned byU-Boot)- bootflow - a description of how to boot (owned by the distro)
This series provides an implementation of these, enabled to scan for bootflows from MMC, USB and Ethernet. It supports the existing distro boot as well as the EFI loader flow (bootefi/bootmgr). It works similiarly to the existing script-based approach, but is native to U-Boot.
With this we can boot on a Raspberry Pi 3 with just one command:
bootflow scan -lb
which means to scan, listing (-l) each bootflow and trying to boot each one (-b). The final patch shows this.
With a standard way to identify boot devices, booting become easier. It also should be possible to support U-Boot scripts, for backwards compatibility only.
This series relies on the PXE clean-up series, posted here:
https://patchwork.ozlabs.org/project/uboot/list/?series=267078For documentation, see the 'doc' patch.
For version 2, a new naming scheme is used as above:
- bootdev is used instead of bootdevice, because 'device' is overused, is everywhere in U-Boot, can be confused with udevice
- bootmeth - because 'method' is too vanilla, appears 1300 times in U-BootAlso in version 2, drivers are introduced for the boot methods, to make it more extensible. Booting a custom OS is simply a matter of creating a bootmeth for it and implementing the
read_file()andboot()methods.Version 4 makes some minor improvements and leaves out the RFC patch for rpi conversion, in the hope of getting the base support applied sooner rather than later.
Quoted 5 lines
The design is described in these two documents:
https://drive.google.com/file/d/1ggW0KJpUOR__vBkj3l61L2dav4ZkNC12/view?usp=sharing
https://drive.google.com/file/d/1kTrflO9vvGlKp-ZH_jlgb9TY3WYG6FF9/view?usp=sharing
I keep putting off commenting more here, but, I still feel this is the wrong direction. What problems do we have today with distro boot? Well, we haven't figured out how to move configuring it out of the board
config.hfile. But that's just one of a half dozen or so examples of how we haven't figured out a good solution to configuring the default environment. And only some of those other examples are boot related (the NXP chain of trust booting stuff is another boot example, ETHPRIME, HOSTNAME, etc, are non-boot examples).We also aren't improving testing of "can we boot" here, because what THAT needs is setting up LAVA and booting some installers on some hardware (and some QEMU). That's testing that Linux boot works. Today we have tests for hush parsing, and if distro boot makes use of something we don't have a test for, we need a test for it. This adds tests for itself, which is good.
And I still don't see an example of where this demonstrates that existing non-UEFI boot cases are now easier to handle or cleaner to handle or otherwise better.
Quoted 8 lines
Quoted 3 lines
In that this is an attempt to tackle one of the long standing needed migrations (be able to drop board
config.hfiles), something here needs doing. But I don't see this as the right direction, sorry.Does anyone have a better idea for all of this? This is a solid base we can build on but we can't make any progress while this is just patches. What not apply it and we can move forward?
I agree with Simon. Having a well documented flow, help to integrate products and have a standard
way to handle the booting flowQuoted 11 lines
- solves the env problem for distro boot in that we don't need the scripts
- gets rid of the scripts which are a confusing mess
- provides proper high-level concepts of boot device and boot method
- allows testing of the U-Boot part of 'can we boot' because we have tests for all the cases - we can expand this over time
- allows non-UEFI boot cases like Chrome OS, which is currently just a hack for one board[1]
- provides a programmatic base for A/B boot, etc.I feel the same way with Takahiro's series, which has been out-of-tree for too long.
I don't see the problem in having it merged. I'm dealing every day with crazy script
to handle situation like [1] and I think that company that integrates their product can
benefits on those changes. They can be improved with other people wants to use it
in their products.Michael
Quoted 13 lines
Please reconsider this. What do we have to lose?
Regards,
Simon[1]
CONFIG_BOOTCOMMAND="tpminit; tpm startupTPM2_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; setexprcmdline_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"Quoted 5 lines
Quoted 2 lines
OK, and what does your example here look like on top of Simon's series? Or do you just mean ChromeOS boot?
I can use some of our boards and move on to the Simon patchset. In that case, are you happy with it?
Quoted 6 lines
No, I'm not saying I'll take this if someone uses it somewhere. But I've been asking for in previous iterations for showing that it makes some existing use case easier. And I don't see any implementations of that in v4. Adding UEFI boot to this isn't a good example since that's already being re-done via the UEFI boot manager series that implements what the spec says to do for that.
Quoted 9 lines
I don't think that a lot of real use cases in embedded devices are using distro boot but
they have proper customized boot flow and update, recovery. What you call A, B and C.
Then we have a special recovery path that instead of using emmc , uses a usb pen drive. Having
some more structure boot flow with documentation and some use cases will help to have in uboot what it's in
private repositories.Quoted 7 lines
Exactly. My concern is that this does, or will end up, spending a lot of effort to replicate the "find an arbitrary bootable thing" logic the UEFI boot manager stuff has to do to that spec rather than making it easier to handle the common everything else cases where the developer knows the valid cases for normal boot and recovery boot and needs to do whatever validation is required there. Maybe that's where some of the hang up is.
I'm actually not sure where the hang-up is. We seem to be enforcing UEFI everywhere in U-Boot. That must make some people very happy, but it is not the right approach to take for a general purpose, open-source, Universal Boot Loader.
If U-Boot is to remain a boot loader for non-UEFI cases, then I think bootstd is an important step forward. There is more work to do, but it sets up the basic abstractions and is a strong base to work from.
Or is U-Boot for UEFI only, with only 'boot manager' allowed to have a structured boot?
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
I hope not, but I'm struggling to read much else from this thread.
Perhaps you and I need to have a call at some point soon then? It is not my intention to make UEFI the only, or only well supported, way of booting things.
Sure, I could do this time tomorrow or 2-3 hours earlier / later. I am around on irc.
Can this happen in regular meetings?
Michael
Quoted 7 lines
Regards,
SimonQuoted 3 lines
--
Tom
Signature · 11 lines
Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 [email protected] __________________________________ Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 [email protected] www.amarulasolutions.com
Quoted 199 lines · Simon Glass
Hi Tom,
Quoted 196 lines · Tom Rini
Quoted 194 lines · Simon Glass
Hi Tom,
Quoted 171 lines · Tom Rini
Quoted 159 lines · Michael Nazzareno Trimarchi
Hi Tom
Quoted 148 lines · Tom Rini
Quoted 140 lines · Michael Nazzareno Trimarchi
Hi Tom
Quoted 137 lines · Tom Rini
Quoted 134 lines · Michael Nazzareno Trimarchi
Hi Tom
Quoted 83 lines · Simon Glass
Hi Tom,
Quoted 79 lines · Tom Rini
Quoted 51 lines · Simon Glass
The bootflow feature provide a built-in way for U-Boot to automatically boot an Operating System without custom scripting and other customisation. This is called 'standard boot' since it provides a standard way for U-Boot to boot a distro, without scripting.
It introduces the following concepts:
- bootdev - a device which can hold a distro
- bootmeth - a method to scan a bootdev to find bootflows (owned byU-Boot)- bootflow - a description of how to boot (owned by the distro)
This series provides an implementation of these, enabled to scan for bootflows from MMC, USB and Ethernet. It supports the existing distro boot as well as the EFI loader flow (bootefi/bootmgr). It works similiarly to the existing script-based approach, but is native to U-Boot.
With this we can boot on a Raspberry Pi 3 with just one command:
bootflow scan -lb
which means to scan, listing (-l) each bootflow and trying to boot each one (-b). The final patch shows this.
With a standard way to identify boot devices, booting become easier. It also should be possible to support U-Boot scripts, for backwards compatibility only.
This series relies on the PXE clean-up series, posted here:
https://patchwork.ozlabs.org/project/uboot/list/?series=267078For documentation, see the 'doc' patch.
For version 2, a new naming scheme is used as above:
- bootdev is used instead of bootdevice, because 'device' is overused, is everywhere in U-Boot, can be confused with udevice
- bootmeth - because 'method' is too vanilla, appears 1300 times in U-BootAlso in version 2, drivers are introduced for the boot methods, to make it more extensible. Booting a custom OS is simply a matter of creating a bootmeth for it and implementing the
read_file()andboot()methods.Version 4 makes some minor improvements and leaves out the RFC patch for rpi conversion, in the hope of getting the base support applied sooner rather than later.
Quoted 5 lines
The design is described in these two documents:
https://drive.google.com/file/d/1ggW0KJpUOR__vBkj3l61L2dav4ZkNC12/view?usp=sharing
https://drive.google.com/file/d/1kTrflO9vvGlKp-ZH_jlgb9TY3WYG6FF9/view?usp=sharing
I keep putting off commenting more here, but, I still feel this is the wrong direction. What problems do we have today with distro boot? Well, we haven't figured out how to move configuring it out of the board
config.hfile. But that's just one of a half dozen or so examples of how we haven't figured out a good solution to configuring the default environment. And only some of those other examples are boot related (the NXP chain of trust booting stuff is another boot example, ETHPRIME, HOSTNAME, etc, are non-boot examples).We also aren't improving testing of "can we boot" here, because what THAT needs is setting up LAVA and booting some installers on some hardware (and some QEMU). That's testing that Linux boot works. Today we have tests for hush parsing, and if distro boot makes use of something we don't have a test for, we need a test for it. This adds tests for itself, which is good.
And I still don't see an example of where this demonstrates that existing non-UEFI boot cases are now easier to handle or cleaner to handle or otherwise better.
Quoted 8 lines
Quoted 3 lines
In that this is an attempt to tackle one of the long standing needed migrations (be able to drop board
config.hfiles), something here needs doing. But I don't see this as the right direction, sorry.Does anyone have a better idea for all of this? This is a solid base we can build on but we can't make any progress while this is just patches. What not apply it and we can move forward?
I agree with Simon. Having a well documented flow, help to integrate products and have a standard
way to handle the booting flowQuoted 11 lines
- solves the env problem for distro boot in that we don't need the scripts
- gets rid of the scripts which are a confusing mess
- provides proper high-level concepts of boot device and boot method
- allows testing of the U-Boot part of 'can we boot' because we have tests for all the cases - we can expand this over time
- allows non-UEFI boot cases like Chrome OS, which is currently just a hack for one board[1]
- provides a programmatic base for A/B boot, etc.I feel the same way with Takahiro's series, which has been out-of-tree for too long.
I don't see the problem in having it merged. I'm dealing every day with crazy script
to handle situation like [1] and I think that company that integrates their product can
benefits on those changes. They can be improved with other people wants to use it
in their products.Michael
Quoted 13 lines
Please reconsider this. What do we have to lose?
Regards,
Simon[1]
CONFIG_BOOTCOMMAND="tpminit; tpm startupTPM2_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; setexprcmdline_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"Quoted 5 lines
Quoted 2 lines
OK, and what does your example here look like on top of Simon's series? Or do you just mean ChromeOS boot?
I can use some of our boards and move on to the Simon patchset. In that case, are you happy with it?
Quoted 6 lines
No, I'm not saying I'll take this if someone uses it somewhere. But I've been asking for in previous iterations for showing that it makes some existing use case easier. And I don't see any implementations of that in v4. Adding UEFI boot to this isn't a good example since that's already being re-done via the UEFI boot manager series that implements what the spec says to do for that.
Quoted 9 lines
I don't think that a lot of real use cases in embedded devices are using distro boot but
they have proper customized boot flow and update, recovery. What you call A, B and C.
Then we have a special recovery path that instead of using emmc , uses a usb pen drive. Having
some more structure boot flow with documentation and some use cases will help to have in uboot what it's in
private repositories.Quoted 7 lines
Exactly. My concern is that this does, or will end up, spending a lot of effort to replicate the "find an arbitrary bootable thing" logic the UEFI boot manager stuff has to do to that spec rather than making it easier to handle the common everything else cases where the developer knows the valid cases for normal boot and recovery boot and needs to do whatever validation is required there. Maybe that's where some of the hang up is.
I'm actually not sure where the hang-up is. We seem to be enforcing UEFI everywhere in U-Boot. That must make some people very happy, but it is not the right approach to take for a general purpose, open-source, Universal Boot Loader.
If U-Boot is to remain a boot loader for non-UEFI cases, then I think bootstd is an important step forward. There is more work to do, but it sets up the basic abstractions and is a strong base to work from.
Or is U-Boot for UEFI only, with only 'boot manager' allowed to have a structured boot?
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
I hope not, but I'm struggling to read much else from this thread.
Perhaps you and I need to have a call at some point soon then? It is not my intention to make UEFI the only, or only well supported, way of booting things.
Sure, I could do this time tomorrow or 2-3 hours earlier / later. I am around on irc.
Sorry, my time over the weekend got away from me.
Perhaps instructive of where I'm coming from is illustrated by what happened to me, today, with my x86-64 build box and modern UEFI firmware. It doesn't reliably reboot. Today I had to reboot, it didn't come back up and I had a few minutes to dig. The problem? UEFI heuristic booting logic decided the assorted USB drives attached to the machine had a higher priority, picked some random ESP (with Aarch64 stuff in it only) and just stopped there. Easily enough fixed, but not at all what I expected. Logic for "do what the user thinks they want" fails more often than it should. I don't like it, but it's a defined and popular specification, so, OK.
Should it be easier to implemented defined, structured boot flows in U-Boot, for things resembling a known and defined set of choices (even allowing user input as a choice)? Yes. But I am really skeptical of "do what the user thinks they want" implementations. But I also think where that's the right path to try is not the frequent case where U-Boot is concerned.
But also, frankly, there's more than enough places in U-Boot where you're the person that understands critical parts of the world the best, so if the price is you're going to implemented a better heuristic boot too, well, alright.
Signature · 1 line
Tom
Quoted 111 lines
From: Michael Nazzareno Trimarchi <[email protected]>
Date: Wed, 23 Mar 2022 20:21:22 +0100Hi Tom
Quoted 83 lines · Simon Glass
Hi Tom,
Quoted 79 lines · Tom Rini
Quoted 51 lines · Simon Glass
The bootflow feature provide a built-in way for U-Boot to automatically boot an Operating System without custom scripting and other customisation. This is called 'standard boot' since it provides a standard way for U-Boot to boot a distro, without scripting.
It introduces the following concepts:
- bootdev - a device which can hold a distro
- bootmeth - a method to scan a bootdev to find bootflows (owned byU-Boot)- bootflow - a description of how to boot (owned by the distro)
This series provides an implementation of these, enabled to scan for bootflows from MMC, USB and Ethernet. It supports the existing distro boot as well as the EFI loader flow (bootefi/bootmgr). It works similiarly to the existing script-based approach, but is native to U-Boot.
With this we can boot on a Raspberry Pi 3 with just one command:
bootflow scan -lb
which means to scan, listing (-l) each bootflow and trying to boot each one (-b). The final patch shows this.
With a standard way to identify boot devices, booting become easier. It also should be possible to support U-Boot scripts, for backwards compatibility only.
This series relies on the PXE clean-up series, posted here:
https://patchwork.ozlabs.org/project/uboot/list/?series=267078For documentation, see the 'doc' patch.
For version 2, a new naming scheme is used as above:
- bootdev is used instead of bootdevice, because 'device' is overused, is everywhere in U-Boot, can be confused with udevice
- bootmeth - because 'method' is too vanilla, appears 1300 times in U-BootAlso in version 2, drivers are introduced for the boot methods, to make it more extensible. Booting a custom OS is simply a matter of creating a bootmeth for it and implementing the
read_file()andboot()methods.Version 4 makes some minor improvements and leaves out the RFC patch for rpi conversion, in the hope of getting the base support applied sooner rather than later.
Quoted 5 lines
The design is described in these two documents:
https://drive.google.com/file/d/1ggW0KJpUOR__vBkj3l61L2dav4ZkNC12/view?usp=sharing
https://drive.google.com/file/d/1kTrflO9vvGlKp-ZH_jlgb9TY3WYG6FF9/view?usp=sharing
I keep putting off commenting more here, but, I still feel this is the wrong direction. What problems do we have today with distro boot? Well, we haven't figured out how to move configuring it out of the board
config.hfile. But that's just one of a half dozen or so examples of how we haven't figured out a good solution to configuring the default environment. And only some of those other examples are boot related (the NXP chain of trust booting stuff is another boot example, ETHPRIME, HOSTNAME, etc, are non-boot examples).We also aren't improving testing of "can we boot" here, because what THAT needs is setting up LAVA and booting some installers on some hardware (and some QEMU). That's testing that Linux boot works. Today we have tests for hush parsing, and if distro boot makes use of something we don't have a test for, we need a test for it. This adds tests for itself, which is good.
And I still don't see an example of where this demonstrates that existing non-UEFI boot cases are now easier to handle or cleaner to handle or otherwise better.
Quoted 8 lines
Quoted 3 lines
In that this is an attempt to tackle one of the long standing needed migrations (be able to drop board
config.hfiles), something here needs doing. But I don't see this as the right direction, sorry.Does anyone have a better idea for all of this? This is a solid base we can build on but we can't make any progress while this is just patches. What not apply it and we can move forward?
I agree with Simon. Having a well documented flow, help to integrate products and have a standard
way to handle the booting flowQuoted 9 lines
- solves the env problem for distro boot in that we don't need the scripts
- gets rid of the scripts which are a confusing mess
- provides proper high-level concepts of boot device and boot method
- allows testing of the U-Boot part of 'can we boot' because we have tests for all the cases - we can expand this over time
- allows non-UEFI boot cases like Chrome OS, which is currently just a hack for one board[1]
- provides a programmatic base for A/B boot, etc.
Quoted 8 lines
Quoted 2 lines
I feel the same way with Takahiro's series, which has been out-of-tree for too long.
I don't see the problem in having it merged. I'm dealing every day with crazy script to handle situation like [1] and I think that company that integrates their product can benefits on those changes. They can be improved with other people wants to use it in their products.
Well, I've tried to convert Apple M1 over to standard boot but failed. That may be because the current implementation lacks NVMe support. But to me that indicates that the coee is incomplete and not ready to be merged.
Quoted 28 lines
Quoted 12 lines
Please reconsider this. What do we have to lose?
Regards,
Simon[1]
CONFIG_BOOTCOMMAND="tpminit; tpm startupTPM2_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; setexprcmdline_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"Signature · 11 lines
Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 [email protected] __________________________________ Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 [email protected] www.amarulasolutions.com
Hi Mark,
Quoted 121 lines · Mark Kettenis
Quoted 112 lines
From: Michael Nazzareno Trimarchi <[email protected]>
Date: Wed, 23 Mar 2022 20:21:22 +0100Hi Tom
Quoted 83 lines · Simon Glass
Hi Tom,
Quoted 79 lines · Tom Rini
Quoted 51 lines · Simon Glass
The bootflow feature provide a built-in way for U-Boot to automatically boot an Operating System without custom scripting and other customisation. This is called 'standard boot' since it provides a standard way for U-Boot to boot a distro, without scripting.
It introduces the following concepts:
- bootdev - a device which can hold a distro
- bootmeth - a method to scan a bootdev to find bootflows (owned byU-Boot)- bootflow - a description of how to boot (owned by the distro)
This series provides an implementation of these, enabled to scan for bootflows from MMC, USB and Ethernet. It supports the existing distro boot as well as the EFI loader flow (bootefi/bootmgr). It works similiarly to the existing script-based approach, but is native to U-Boot.
With this we can boot on a Raspberry Pi 3 with just one command:
bootflow scan -lb
which means to scan, listing (-l) each bootflow and trying to boot each one (-b). The final patch shows this.
With a standard way to identify boot devices, booting become easier. It also should be possible to support U-Boot scripts, for backwards compatibility only.
This series relies on the PXE clean-up series, posted here:
https://patchwork.ozlabs.org/project/uboot/list/?series=267078For documentation, see the 'doc' patch.
For version 2, a new naming scheme is used as above:
- bootdev is used instead of bootdevice, because 'device' is overused, is everywhere in U-Boot, can be confused with udevice
- bootmeth - because 'method' is too vanilla, appears 1300 times in U-BootAlso in version 2, drivers are introduced for the boot methods, to make it more extensible. Booting a custom OS is simply a matter of creating a bootmeth for it and implementing the
read_file()andboot()methods.Version 4 makes some minor improvements and leaves out the RFC patch for rpi conversion, in the hope of getting the base support applied sooner rather than later.
Quoted 5 lines
The design is described in these two documents:
https://drive.google.com/file/d/1ggW0KJpUOR__vBkj3l61L2dav4ZkNC12/view?usp=sharing
https://drive.google.com/file/d/1kTrflO9vvGlKp-ZH_jlgb9TY3WYG6FF9/view?usp=sharing
I keep putting off commenting more here, but, I still feel this is the wrong direction. What problems do we have today with distro boot? Well, we haven't figured out how to move configuring it out of the board
config.hfile. But that's just one of a half dozen or so examples of how we haven't figured out a good solution to configuring the default environment. And only some of those other examples are boot related (the NXP chain of trust booting stuff is another boot example, ETHPRIME, HOSTNAME, etc, are non-boot examples).We also aren't improving testing of "can we boot" here, because what THAT needs is setting up LAVA and booting some installers on some hardware (and some QEMU). That's testing that Linux boot works. Today we have tests for hush parsing, and if distro boot makes use of something we don't have a test for, we need a test for it. This adds tests for itself, which is good.
And I still don't see an example of where this demonstrates that existing non-UEFI boot cases are now easier to handle or cleaner to handle or otherwise better.
Quoted 8 lines
Quoted 3 lines
In that this is an attempt to tackle one of the long standing needed migrations (be able to drop board
config.hfiles), something here needs doing. But I don't see this as the right direction, sorry.Does anyone have a better idea for all of this? This is a solid base we can build on but we can't make any progress while this is just patches. What not apply it and we can move forward?
I agree with Simon. Having a well documented flow, help to integrate products and have a standard
way to handle the booting flowQuoted 9 lines
- solves the env problem for distro boot in that we don't need the scripts
- gets rid of the scripts which are a confusing mess
- provides proper high-level concepts of boot device and boot method
- allows testing of the U-Boot part of 'can we boot' because we have tests for all the cases - we can expand this over time
- allows non-UEFI boot cases like Chrome OS, which is currently just a hack for one board[1]
- provides a programmatic base for A/B boot, etc.Quoted 8 lines
Quoted 2 lines
I feel the same way with Takahiro's series, which has been out-of-tree for too long.
I don't see the problem in having it merged. I'm dealing every day with crazy script to handle situation like [1] and I think that company that integrates their product can benefits on those changes. They can be improved with other people wants to use it in their products.
Quoted 4 lines
Well, I've tried to convert Apple M1 over to standard boot but failed. That may be because the current implementation lacks NVMe support. But to me that indicates that the coee is incomplete and not ready to be merged.
If that would change your mind I would be happy to do that work. I added USB for this series since someone asked about that. NVMe is an interesting case since there are multiple LUNs, as I understand it.
But there is a lot more to this series than just doing things a different way...
Regards,
Simon
Quoted 29 lines
Quoted 29 lines
Quoted 6 lines
Please reconsider this. What do we have to lose?
Regards,
SimonQuoted 7 lines
[1]
CONFIG_BOOTCOMMAND="tpminit; tpm startupTPM2_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; setexprcmdline_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"--
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
[email protected]
__________________________________Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
T. +31 (0)85 111 9172
[email protected]
www.amarulasolutions.com
Quoted 86 lines · Simon Glass
Hi Tom,
Quoted 75 lines · Tom Rini
Quoted 51 lines · Simon Glass
The bootflow feature provide a built-in way for U-Boot to automatically boot an Operating System without custom scripting and other customisation. This is called 'standard boot' since it provides a standard way for U-Boot to boot a distro, without scripting.
It introduces the following concepts:
- bootdev - a device which can hold a distro
- bootmeth - a method to scan a bootdev to find bootflows (owned byU-Boot)- bootflow - a description of how to boot (owned by the distro)
This series provides an implementation of these, enabled to scan for bootflows from MMC, USB and Ethernet. It supports the existing distro boot as well as the EFI loader flow (bootefi/bootmgr). It works similiarly to the existing script-based approach, but is native to U-Boot.
With this we can boot on a Raspberry Pi 3 with just one command:
bootflow scan -lb
which means to scan, listing (-l) each bootflow and trying to boot each one (-b). The final patch shows this.
With a standard way to identify boot devices, booting become easier. It also should be possible to support U-Boot scripts, for backwards compatibility only.
This series relies on the PXE clean-up series, posted here:
https://patchwork.ozlabs.org/project/uboot/list/?series=267078For documentation, see the 'doc' patch.
For version 2, a new naming scheme is used as above:
- bootdev is used instead of bootdevice, because 'device' is overused, is everywhere in U-Boot, can be confused with udevice
- bootmeth - because 'method' is too vanilla, appears 1300 times in U-BootAlso in version 2, drivers are introduced for the boot methods, to make it more extensible. Booting a custom OS is simply a matter of creating a bootmeth for it and implementing the
read_file()andboot()methods.Version 4 makes some minor improvements and leaves out the RFC patch for rpi conversion, in the hope of getting the base support applied sooner rather than later.
Quoted 5 lines
The design is described in these two documents:
https://drive.google.com/file/d/1ggW0KJpUOR__vBkj3l61L2dav4ZkNC12/view?usp=sharing
https://drive.google.com/file/d/1kTrflO9vvGlKp-ZH_jlgb9TY3WYG6FF9/view?usp=sharing
I keep putting off commenting more here, but, I still feel this is the wrong direction. What problems do we have today with distro boot? Well, we haven't figured out how to move configuring it out of the board
config.hfile. But that's just one of a half dozen or so examples of how we haven't figured out a good solution to configuring the default environment. And only some of those other examples are boot related (the NXP chain of trust booting stuff is another boot example, ETHPRIME, HOSTNAME, etc, are non-boot examples).We also aren't improving testing of "can we boot" here, because what THAT needs is setting up LAVA and booting some installers on some hardware (and some QEMU). That's testing that Linux boot works. Today we have tests for hush parsing, and if distro boot makes use of something we don't have a test for, we need a test for it. This adds tests for itself, which is good.
Quoted 7 lines
And I still don't see an example of where this demonstrates that existing non-UEFI boot cases are now easier to handle or cleaner to handle or otherwise better.
In that this is an attempt to tackle one of the long standing needed migrations (be able to drop board
config.hfiles), something here needs doing. But I don't see this as the right direction, sorry.
Quoted 5 lines
Does anyone have a better idea for all of this? This is a solid base we can build on but we can't make any progress while this is just patches. What not apply it and we can move forward?
- solves the env problem for distro boot in that we don't need the scripts
Solves what problem? That distro boot is done in hush? Yes, we have many examples of needing to define the default environment in a non-static way. This is not a solution to that problem.
Quoted 1 line
- gets rid of the scripts which are a confusing mess
Yes, a generic "figure out where a bootable might be, boot it" is complex. That's basically why the UEFI boot manager code exists, and replaces that logic.
Quoted 1 line
- provides proper high-level concepts of boot device and boot method
I don't see the inherent value. Or maybe to put things another way, the "now go boot" API has always been implemented via hush, even when the interactive part is disabled. You're providing a programatic way of doing it instead. And I'm not seeing it being more flexible / easier to implement. It's really sounded harder, not easier, than #define BOOT_TARGET_DEVICES.
Quoted 2 lines
- allows testing of the U-Boot part of 'can we boot' because we have tests for all the cases - we can expand this over time
No, it doesn't. It provides a different interface and tests for itself. If it's not LAVA (or something like that) booting real Linux distribution images it's not a real can we boot test.
Quoted 2 lines
- allows non-UEFI boot cases like Chrome OS, which is currently just a hack for one board[1]
I don't see a Chrome OS example in your series.
Quoted 1 line
- provides a programmatic base for A/B boot, etc.
And I've noted before that I don't see how this makes life easier for any of the existing A/B mechanisms. Some of which are just going with "Hey, just UEFI boot and let grub deal with it".
Quoted 4 lines
I feel the same way with Takahiro's series, which has been out-of-tree for too long.
Please reconsider this. What do we have to lose?
What we'll gain seems to be another chunk of code that needs boards to migrate to, maybe. And I don't see examples where this, now, or in the next iteration, provides a smaller, or clearer implementation of something.
Signature · 1 line
Tom
Hi Tom,
Quoted 92 lines · Tom Rini
Quoted 90 lines · Simon Glass
Hi Tom,
Quoted 75 lines · Tom Rini
Quoted 51 lines · Simon Glass
The bootflow feature provide a built-in way for U-Boot to automatically boot an Operating System without custom scripting and other customisation. This is called 'standard boot' since it provides a standard way for U-Boot to boot a distro, without scripting.
It introduces the following concepts:
- bootdev - a device which can hold a distro
- bootmeth - a method to scan a bootdev to find bootflows (owned byU-Boot)- bootflow - a description of how to boot (owned by the distro)
This series provides an implementation of these, enabled to scan for bootflows from MMC, USB and Ethernet. It supports the existing distro boot as well as the EFI loader flow (bootefi/bootmgr). It works similiarly to the existing script-based approach, but is native to U-Boot.
With this we can boot on a Raspberry Pi 3 with just one command:
bootflow scan -lb
which means to scan, listing (-l) each bootflow and trying to boot each one (-b). The final patch shows this.
With a standard way to identify boot devices, booting become easier. It also should be possible to support U-Boot scripts, for backwards compatibility only.
This series relies on the PXE clean-up series, posted here:
https://patchwork.ozlabs.org/project/uboot/list/?series=267078For documentation, see the 'doc' patch.
For version 2, a new naming scheme is used as above:
- bootdev is used instead of bootdevice, because 'device' is overused, is everywhere in U-Boot, can be confused with udevice
- bootmeth - because 'method' is too vanilla, appears 1300 times in U-BootAlso in version 2, drivers are introduced for the boot methods, to make it more extensible. Booting a custom OS is simply a matter of creating a bootmeth for it and implementing the
read_file()andboot()methods.Version 4 makes some minor improvements and leaves out the RFC patch for rpi conversion, in the hope of getting the base support applied sooner rather than later.
Quoted 5 lines
The design is described in these two documents:
https://drive.google.com/file/d/1ggW0KJpUOR__vBkj3l61L2dav4ZkNC12/view?usp=sharing
https://drive.google.com/file/d/1kTrflO9vvGlKp-ZH_jlgb9TY3WYG6FF9/view?usp=sharing
I keep putting off commenting more here, but, I still feel this is the wrong direction. What problems do we have today with distro boot? Well, we haven't figured out how to move configuring it out of the board
config.hfile. But that's just one of a half dozen or so examples of how we haven't figured out a good solution to configuring the default environment. And only some of those other examples are boot related (the NXP chain of trust booting stuff is another boot example, ETHPRIME, HOSTNAME, etc, are non-boot examples).We also aren't improving testing of "can we boot" here, because what THAT needs is setting up LAVA and booting some installers on some hardware (and some QEMU). That's testing that Linux boot works. Today we have tests for hush parsing, and if distro boot makes use of something we don't have a test for, we need a test for it. This adds tests for itself, which is good.
Quoted 7 lines
And I still don't see an example of where this demonstrates that existing non-UEFI boot cases are now easier to handle or cleaner to handle or otherwise better.
In that this is an attempt to tackle one of the long standing needed migrations (be able to drop board
config.hfiles), something here needs doing. But I don't see this as the right direction, sorry.Does anyone have a better idea for all of this? This is a solid base we can build on but we can't make any progress while this is just patches. What not apply it and we can move forward?
Quoted 5 lines
Quoted 1 line
- solves the env problem for distro boot in that we don't need the scripts
Solves what problem? That distro boot is done in hush? Yes, we have many examples of needing to define the default environment in a non-static way. This is not a solution to that problem.
It removes the need for the boot scripts that are currently in the environment. I'm not sure what you mean by defining a default environment in a non-static way.
Quoted 6 lines
Quoted 2 lines
- gets rid of the scripts which are a confusing mess
Yes, a generic "figure out where a bootable might be, boot it" is complex. That's basically why the UEFI boot manager code exists, and replaces that logic.
I thought we already decided that U-Boot was going to continue to support non-UEFI booting?
Quoted 9 lines
Quoted 2 lines
- provides proper high-level concepts of boot device and boot method
I don't see the inherent value. Or maybe to put things another way, the "now go boot" API has always been implemented via hush, even when the interactive part is disabled. You're providing a programatic way of doing it instead. And I'm not seeing it being more flexible / easier to implement. It's really sounded harder, not easier, than #define
BOOT_TARGET_DEVICES.
It is easier in that you don't need to define the boot targets. It is done automatically using the devices that are available.
Quoted 7 lines
Quoted 3 lines
- allows testing of the U-Boot part of 'can we boot' because we have tests for all the cases - we can expand this over time
No, it doesn't. It provides a different interface and tests for itself. If it's not LAVA (or something like that) booting real Linux distribution images it's not a real can we boot test.
I didn't say it would test booting linux or real distros. You obviously need LAVA (or something like that) for doing that.
But it does provide tests for the boot flow which are completely lacking at present. So at least we are testing the code booting code.
Quoted 5 lines
Quoted 3 lines
- allows non-UEFI boot cases like Chrome OS, which is currently just a hack for one board[1]
I don't see a Chrome OS example in your series.
Would that help? I don't mind doing it if we can make some progress, but your previous objection was about code size. I addressed that and have not heard any comment about that.
Quoted 6 lines
Quoted 2 lines
- provides a programmatic base for A/B boot, etc.
And I've noted before that I don't see how this makes life easier for any of the existing A/B mechanisms. Some of which are just going with "Hey, just UEFI boot and let grub deal with it".
It makes it much easier since we now have the means to locate and read in boot flows. Then it is just a case of selecting the one we want, e.g. by examining the list of bootflows and selecting one. It is a helpful division of labour.
Quoted 10 lines
Quoted 5 lines
I feel the same way with Takahiro's series, which has been out-of-tree for too long.
Please reconsider this. What do we have to lose?
What we'll gain seems to be another chunk of code that needs boards to migrate to, maybe. And I don't see examples where this, now, or in the next iteration, provides a smaller, or clearer implementation of something.
Yes it requires boards to migrate, although in fact the migration can be driven by features rather than board-by-board. For example, we could migrate boards that use USB, MMC, etc. first, and then migrate more as we add more features.
But at least it is a chunk of code, with full tests. The scripts are just a pain.
Regards,
Simon
Quoted 97 lines · Simon Glass
Hi Tom,
Quoted 94 lines · Tom Rini
Quoted 91 lines · Simon Glass
Hi Tom,
Quoted 75 lines · Tom Rini
Quoted 51 lines · Simon Glass
The bootflow feature provide a built-in way for U-Boot to automatically boot an Operating System without custom scripting and other customisation. This is called 'standard boot' since it provides a standard way for U-Boot to boot a distro, without scripting.
It introduces the following concepts:
- bootdev - a device which can hold a distro
- bootmeth - a method to scan a bootdev to find bootflows (owned byU-Boot)- bootflow - a description of how to boot (owned by the distro)
This series provides an implementation of these, enabled to scan for bootflows from MMC, USB and Ethernet. It supports the existing distro boot as well as the EFI loader flow (bootefi/bootmgr). It works similiarly to the existing script-based approach, but is native to U-Boot.
With this we can boot on a Raspberry Pi 3 with just one command:
bootflow scan -lb
which means to scan, listing (-l) each bootflow and trying to boot each one (-b). The final patch shows this.
With a standard way to identify boot devices, booting become easier. It also should be possible to support U-Boot scripts, for backwards compatibility only.
This series relies on the PXE clean-up series, posted here:
https://patchwork.ozlabs.org/project/uboot/list/?series=267078For documentation, see the 'doc' patch.
For version 2, a new naming scheme is used as above:
- bootdev is used instead of bootdevice, because 'device' is overused, is everywhere in U-Boot, can be confused with udevice
- bootmeth - because 'method' is too vanilla, appears 1300 times in U-BootAlso in version 2, drivers are introduced for the boot methods, to make it more extensible. Booting a custom OS is simply a matter of creating a bootmeth for it and implementing the
read_file()andboot()methods.Version 4 makes some minor improvements and leaves out the RFC patch for rpi conversion, in the hope of getting the base support applied sooner rather than later.
Quoted 5 lines
The design is described in these two documents:
https://drive.google.com/file/d/1ggW0KJpUOR__vBkj3l61L2dav4ZkNC12/view?usp=sharing
https://drive.google.com/file/d/1kTrflO9vvGlKp-ZH_jlgb9TY3WYG6FF9/view?usp=sharing
I keep putting off commenting more here, but, I still feel this is the wrong direction. What problems do we have today with distro boot? Well, we haven't figured out how to move configuring it out of the board
config.hfile. But that's just one of a half dozen or so examples of how we haven't figured out a good solution to configuring the default environment. And only some of those other examples are boot related (the NXP chain of trust booting stuff is another boot example, ETHPRIME, HOSTNAME, etc, are non-boot examples).We also aren't improving testing of "can we boot" here, because what THAT needs is setting up LAVA and booting some installers on some hardware (and some QEMU). That's testing that Linux boot works. Today we have tests for hush parsing, and if distro boot makes use of something we don't have a test for, we need a test for it. This adds tests for itself, which is good.
Quoted 7 lines
And I still don't see an example of where this demonstrates that existing non-UEFI boot cases are now easier to handle or cleaner to handle or otherwise better.
In that this is an attempt to tackle one of the long standing needed migrations (be able to drop board
config.hfiles), something here needs doing. But I don't see this as the right direction, sorry.Does anyone have a better idea for all of this? This is a solid base we can build on but we can't make any progress while this is just patches. What not apply it and we can move forward?
- solves the env problem for distro boot in that we don't need the scripts
Quoted 7 lines
Quoted 3 lines
Solves what problem? That distro boot is done in hush? Yes, we have many examples of needing to define the default environment in a non-static way. This is not a solution to that problem.
It removes the need for the boot scripts that are currently in the environment. I'm not sure what you mean by defining a default environment in a non-static way.
I'm not sure what you're missing. We have a number of examples today of modifying the default environment based on CONFIG options. How we do the generic distro boot is one of those examples, and you're trying to replace it. It should be able to address the NXP (fsl_...) secure boot scripts as well. It doesn't address at all the non-boot related things.
Quoted 9 lines
Quoted 6 lines
Quoted 2 lines
- gets rid of the scripts which are a confusing mess
Yes, a generic "figure out where a bootable might be, boot it" is complex. That's basically why the UEFI boot manager code exists, and replaces that logic.
I thought we already decided that U-Boot was going to continue to support non-UEFI booting?
Yes? CONFIG_BOOTCOMMAND can be whatever you like. No one is talking at all anywhere about removing anything that's not bootefi. I don't understand your point here.
Quoted 11 lines
Quoted 8 lines
Quoted 1 line
- provides proper high-level concepts of boot device and boot method
I don't see the inherent value. Or maybe to put things another way, the "now go boot" API has always been implemented via hush, even when the interactive part is disabled. You're providing a programatic way of doing it instead. And I'm not seeing it being more flexible / easier to implement. It's really sounded harder, not easier, than #define
BOOT_TARGET_DEVICES.It is easier in that you don't need to define the boot targets. It is done automatically using the devices that are available.
So you're replacing defining the system to be correct with heuristics to guess that it's correct?
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
- allows testing of the U-Boot part of 'can we boot' because we have tests for all the cases - we can expand this over time
No, it doesn't. It provides a different interface and tests for itself. If it's not LAVA (or something like that) booting real Linux distribution images it's not a real can we boot test.
Quoted 5 lines
I didn't say it would test booting linux or real distros. You obviously need LAVA (or something like that) for doing that.
But it does provide tests for the boot flow which are completely lacking at present. So at least we are testing the code booting code.
We have hush tests, the distro boot logic is therefore tested as well as what you're adding here as neither of them are today testing that we can actually boot something.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
- allows non-UEFI boot cases like Chrome OS, which is currently just a hack for one board[1]
I don't see a Chrome OS example in your series.
Would that help? I don't mind doing it if we can make some progress, but your previous objection was about code size. I addressed that and have not heard any comment about that.
I object to the whole thing. The lack of implementations where this is showing that it's actually better than what we have today is just one of the problems. That we replace something that's basically size-free and replace it with several kilobytes is another problem.
Quoted 10 lines
Quoted 5 lines
Quoted 1 line
- provides a programmatic base for A/B boot, etc.
And I've noted before that I don't see how this makes life easier for any of the existing A/B mechanisms. Some of which are just going with "Hey, just UEFI boot and let grub deal with it".
It makes it much easier since we now have the means to locate and read in boot flows. Then it is just a case of selecting the one we want, e.g. by examining the list of bootflows and selecting one. It is a helpful division of labour.
That's not the hard part of integrating an A/B update mechanism or implementing it for a given board.
Quoted 10 lines
Quoted 9 lines
Quoted 4 lines
I feel the same way with Takahiro's series, which has been out-of-tree for too long.
Please reconsider this. What do we have to lose?
What we'll gain seems to be another chunk of code that needs boards to migrate to, maybe. And I don't see examples where this, now, or in the next iteration, provides a smaller, or clearer implementation of something.
Quoted 7 lines
Yes it requires boards to migrate, although in fact the migration can be driven by features rather than board-by-board. For example, we could migrate boards that use USB, MMC, etc. first, and then migrate more as we add more features.
But at least it is a chunk of code, with full tests. The scripts are just a pain.
So we just add unused code until someone makes use of it? We already have that with the environment rework that can't be really used because it doesn't handle distro boot support, which this attempts to handle by removing that functionality from the environment and to C code.
And as I'm testing some Kconfig migrations in another window and seeing what feels like an endless scroll of "migrate to ..." messages flow by, I have little confidence in more than a few boards getting migrated to this functionality, while leaving the to me bigger problems entirely unresolved (how do we delete board config.h files when the environment needs CONFIG based tweaking, which is more than just distro boot).
Signature · 1 line
Tom
Hi Tom,
Quoted 107 lines · Tom Rini
Quoted 97 lines · Simon Glass
Hi Tom,
Quoted 94 lines · Tom Rini
Quoted 91 lines · Simon Glass
Hi Tom,
Quoted 75 lines · Tom Rini
Quoted 51 lines · Simon Glass
The bootflow feature provide a built-in way for U-Boot to automatically boot an Operating System without custom scripting and other customisation. This is called 'standard boot' since it provides a standard way for U-Boot to boot a distro, without scripting.
It introduces the following concepts:
- bootdev - a device which can hold a distro
- bootmeth - a method to scan a bootdev to find bootflows (owned byU-Boot)- bootflow - a description of how to boot (owned by the distro)
This series provides an implementation of these, enabled to scan for bootflows from MMC, USB and Ethernet. It supports the existing distro boot as well as the EFI loader flow (bootefi/bootmgr). It works similiarly to the existing script-based approach, but is native to U-Boot.
With this we can boot on a Raspberry Pi 3 with just one command:
bootflow scan -lb
which means to scan, listing (-l) each bootflow and trying to boot each one (-b). The final patch shows this.
With a standard way to identify boot devices, booting become easier. It also should be possible to support U-Boot scripts, for backwards compatibility only.
This series relies on the PXE clean-up series, posted here:
https://patchwork.ozlabs.org/project/uboot/list/?series=267078For documentation, see the 'doc' patch.
For version 2, a new naming scheme is used as above:
- bootdev is used instead of bootdevice, because 'device' is overused, is everywhere in U-Boot, can be confused with udevice
- bootmeth - because 'method' is too vanilla, appears 1300 times in U-BootAlso in version 2, drivers are introduced for the boot methods, to make it more extensible. Booting a custom OS is simply a matter of creating a bootmeth for it and implementing the
read_file()andboot()methods.Version 4 makes some minor improvements and leaves out the RFC patch for rpi conversion, in the hope of getting the base support applied sooner rather than later.
Quoted 5 lines
The design is described in these two documents:
https://drive.google.com/file/d/1ggW0KJpUOR__vBkj3l61L2dav4ZkNC12/view?usp=sharing
https://drive.google.com/file/d/1kTrflO9vvGlKp-ZH_jlgb9TY3WYG6FF9/view?usp=sharing
I keep putting off commenting more here, but, I still feel this is the wrong direction. What problems do we have today with distro boot? Well, we haven't figured out how to move configuring it out of the board
config.hfile. But that's just one of a half dozen or so examples of how we haven't figured out a good solution to configuring the default environment. And only some of those other examples are boot related (the NXP chain of trust booting stuff is another boot example, ETHPRIME, HOSTNAME, etc, are non-boot examples).We also aren't improving testing of "can we boot" here, because what THAT needs is setting up LAVA and booting some installers on some hardware (and some QEMU). That's testing that Linux boot works. Today we have tests for hush parsing, and if distro boot makes use of something we don't have a test for, we need a test for it. This adds tests for itself, which is good.
Quoted 7 lines
And I still don't see an example of where this demonstrates that existing non-UEFI boot cases are now easier to handle or cleaner to handle or otherwise better.
In that this is an attempt to tackle one of the long standing needed migrations (be able to drop board
config.hfiles), something here needs doing. But I don't see this as the right direction, sorry.Does anyone have a better idea for all of this? This is a solid base we can build on but we can't make any progress while this is just patches. What not apply it and we can move forward?
- solves the env problem for distro boot in that we don't need the scripts
Quoted 7 lines
Quoted 3 lines
Solves what problem? That distro boot is done in hush? Yes, we have many examples of needing to define the default environment in a non-static way. This is not a solution to that problem.
It removes the need for the boot scripts that are currently in the environment. I'm not sure what you mean by defining a default environment in a non-static way.
Quoted 5 lines
I'm not sure what you're missing. We have a number of examples today of modifying the default environment based on CONFIG options. How we do the generic distro boot is one of those examples, and you're trying to replace it. It should be able to address the NXP (
fsl_...) secure boot scripts as well. It doesn't address at all the non-boot related things.
The text environment does support CONFIG options.
Quoted 90 lines
Quoted 10 lines
Quoted 7 lines
Quoted 3 lines
- gets rid of the scripts which are a confusing mess
Yes, a generic "figure out where a bootable might be, boot it" is complex. That's basically why the UEFI boot manager code exists, and replaces that logic.
I thought we already decided that U-Boot was going to continue to support non-UEFI booting?
Yes?
CONFIG_BOOTCOMMANDcan be whatever you like. No one is talking at all anywhere about removing anything that's not bootefi. I don't understand your point here.Quoted 11 lines
Quoted 8 lines
Quoted 1 line
- provides proper high-level concepts of boot device and boot method
I don't see the inherent value. Or maybe to put things another way, the "now go boot" API has always been implemented via hush, even when the interactive part is disabled. You're providing a programatic way of doing it instead. And I'm not seeing it being more flexible / easier to implement. It's really sounded harder, not easier, than #define
BOOT_TARGET_DEVICES.It is easier in that you don't need to define the boot targets. It is done automatically using the devices that are available.
So you're replacing defining the system to be correct with heuristics to guess that it's correct?
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
- allows testing of the U-Boot part of 'can we boot' because we have tests for all the cases - we can expand this over time
No, it doesn't. It provides a different interface and tests for itself. If it's not LAVA (or something like that) booting real Linux distribution images it's not a real can we boot test.
Quoted 5 lines
I didn't say it would test booting linux or real distros. You obviously need LAVA (or something like that) for doing that.
But it does provide tests for the boot flow which are completely lacking at present. So at least we are testing the code booting code.
We have hush tests, the distro boot logic is therefore tested as well as what you're adding here as neither of them are today testing that we can actually boot something.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
- allows non-UEFI boot cases like Chrome OS, which is currently just a hack for one board[1]
I don't see a Chrome OS example in your series.
Would that help? I don't mind doing it if we can make some progress, but your previous objection was about code size. I addressed that and have not heard any comment about that.
I object to the whole thing. The lack of implementations where this is showing that it's actually better than what we have today is just one of the problems. That we replace something that's basically size-free and replace it with several kilobytes is another problem.
Quoted 10 lines
Quoted 5 lines
Quoted 1 line
- provides a programmatic base for A/B boot, etc.
And I've noted before that I don't see how this makes life easier for any of the existing A/B mechanisms. Some of which are just going with "Hey, just UEFI boot and let grub deal with it".
It makes it much easier since we now have the means to locate and read in boot flows. Then it is just a case of selecting the one we want, e.g. by examining the list of bootflows and selecting one. It is a helpful division of labour.
That's not the hard part of integrating an A/B update mechanism or implementing it for a given board.
Quoted 15 lines
Quoted 9 lines
Quoted 4 lines
I feel the same way with Takahiro's series, which has been out-of-tree for too long.
Please reconsider this. What do we have to lose?
What we'll gain seems to be another chunk of code that needs boards to migrate to, maybe. And I don't see examples where this, now, or in the next iteration, provides a smaller, or clearer implementation of something.
Yes it requires boards to migrate, although in fact the migration can be driven by features rather than board-by-board. For example, we could migrate boards that use USB, MMC, etc. first, and then migrate more as we add more features.
Quoted 7 lines
Quoted 2 lines
But at least it is a chunk of code, with full tests. The scripts are just a pain.
So we just add unused code until someone makes use of it? We already have that with the environment rework that can't be really used because it doesn't handle distro boot support, which this attempts to handle by removing that functionality from the environment and to C code.
My summary of the above is that you see a lot of other/bigger problems and want to solve those instead. But that is not the purpose of this series.
Quoted 7 lines
And as I'm testing some
Kconfigmigrations in another window and seeing what feels like an endless scroll of "migrate to ..." messages flow by, I have little confidence in more than a few boards getting migrated to this functionality, while leaving the to me bigger problems entirely unresolved (how do we delete boardconfig.hfiles when the environment needs CONFIG based tweaking, which is more than just distro boot).
This seems to be the nub of it. I am reluctant to invest more time in this when there is so little mindshare about the problems we face. You are reluctant to move it forward when you worry it will just be another migration effort that leads nowhere.
I am more than happy to commit to migrating all boards over to bootstd and removing the distro scripts from the environment. This is a per-feature migration, rather than per-board.
Does that help?
Regards,
Simon
Quoted 110 lines · Simon Glass
Hi Tom,
Quoted 107 lines · Tom Rini
Quoted 104 lines · Simon Glass
Hi Tom,
Quoted 92 lines · Tom Rini
Quoted 90 lines · Simon Glass
Hi Tom,
Quoted 75 lines · Tom Rini
Quoted 51 lines · Simon Glass
The bootflow feature provide a built-in way for U-Boot to automatically boot an Operating System without custom scripting and other customisation. This is called 'standard boot' since it provides a standard way for U-Boot to boot a distro, without scripting.
It introduces the following concepts:
- bootdev - a device which can hold a distro
- bootmeth - a method to scan a bootdev to find bootflows (owned byU-Boot)- bootflow - a description of how to boot (owned by the distro)
This series provides an implementation of these, enabled to scan for bootflows from MMC, USB and Ethernet. It supports the existing distro boot as well as the EFI loader flow (bootefi/bootmgr). It works similiarly to the existing script-based approach, but is native to U-Boot.
With this we can boot on a Raspberry Pi 3 with just one command:
bootflow scan -lb
which means to scan, listing (-l) each bootflow and trying to boot each one (-b). The final patch shows this.
With a standard way to identify boot devices, booting become easier. It also should be possible to support U-Boot scripts, for backwards compatibility only.
This series relies on the PXE clean-up series, posted here:
https://patchwork.ozlabs.org/project/uboot/list/?series=267078For documentation, see the 'doc' patch.
For version 2, a new naming scheme is used as above:
- bootdev is used instead of bootdevice, because 'device' is overused, is everywhere in U-Boot, can be confused with udevice
- bootmeth - because 'method' is too vanilla, appears 1300 times in U-BootAlso in version 2, drivers are introduced for the boot methods, to make it more extensible. Booting a custom OS is simply a matter of creating a bootmeth for it and implementing the
read_file()andboot()methods.Version 4 makes some minor improvements and leaves out the RFC patch for rpi conversion, in the hope of getting the base support applied sooner rather than later.
Quoted 5 lines
The design is described in these two documents:
https://drive.google.com/file/d/1ggW0KJpUOR__vBkj3l61L2dav4ZkNC12/view?usp=sharing
https://drive.google.com/file/d/1kTrflO9vvGlKp-ZH_jlgb9TY3WYG6FF9/view?usp=sharing
I keep putting off commenting more here, but, I still feel this is the wrong direction. What problems do we have today with distro boot? Well, we haven't figured out how to move configuring it out of the board
config.hfile. But that's just one of a half dozen or so examples of how we haven't figured out a good solution to configuring the default environment. And only some of those other examples are boot related (the NXP chain of trust booting stuff is another boot example, ETHPRIME, HOSTNAME, etc, are non-boot examples).We also aren't improving testing of "can we boot" here, because what THAT needs is setting up LAVA and booting some installers on some hardware (and some QEMU). That's testing that Linux boot works. Today we have tests for hush parsing, and if distro boot makes use of something we don't have a test for, we need a test for it. This adds tests for itself, which is good.
Quoted 7 lines
And I still don't see an example of where this demonstrates that existing non-UEFI boot cases are now easier to handle or cleaner to handle or otherwise better.
In that this is an attempt to tackle one of the long standing needed migrations (be able to drop board
config.hfiles), something here needs doing. But I don't see this as the right direction, sorry.Does anyone have a better idea for all of this? This is a solid base we can build on but we can't make any progress while this is just patches. What not apply it and we can move forward?
Quoted 5 lines
Quoted 1 line
- solves the env problem for distro boot in that we don't need the scripts
Solves what problem? That distro boot is done in hush? Yes, we have many examples of needing to define the default environment in a non-static way. This is not a solution to that problem.
It removes the need for the boot scripts that are currently in the environment. I'm not sure what you mean by defining a default environment in a non-static way.
Quoted 7 lines
Quoted 5 lines
I'm not sure what you're missing. We have a number of examples today of modifying the default environment based on CONFIG options. How we do the generic distro boot is one of those examples, and you're trying to replace it. It should be able to address the NXP (
fsl_...) secure boot scripts as well. It doesn't address at all the non-boot related things.The text environment does support CONFIG options.
Then I misremembered or misunderstood something you had said previously, sorry.
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 1 line
- gets rid of the scripts which are a confusing mess
Yes, a generic "figure out where a bootable might be, boot it" is complex. That's basically why the UEFI boot manager code exists, and replaces that logic.
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
I thought we already decided that U-Boot was going to continue to support non-UEFI booting?
Yes?
CONFIG_BOOTCOMMANDcan be whatever you like. No one is talking at all anywhere about removing anything that's not bootefi. I don't understand your point here.
I want to come back here for a moment because maybe we're talking at cross purposes. I absolutely want there to be CONFIG_BOOTCOMMAND and/or non-hush-based (for device security) ways to run whatever, to boot the OS/next stage.
But for something to deal with the combinatorial matrix hell of heuristic and then some configurability (or not!) of find out which arbitrary devices to boot from, or not boot from, or override booting from and so on, no, I don't want to DIY something, I want the UEFI standard for that. If there's some other standard for dealing with all of that as well, OK, lets talk about implementing it. If UEFI standard could be improved in some way, well, lets push back and get it improved. But I do not want another implementation of find an arbitrary thing and boot it. I'm not sure who is asking for that, either.
Quoted 100 lines
Quoted 75 lines
Quoted 11 lines
Quoted 8 lines
Quoted 1 line
- provides proper high-level concepts of boot device and boot method
I don't see the inherent value. Or maybe to put things another way, the "now go boot" API has always been implemented via hush, even when the interactive part is disabled. You're providing a programatic way of doing it instead. And I'm not seeing it being more flexible / easier to implement. It's really sounded harder, not easier, than #define
BOOT_TARGET_DEVICES.It is easier in that you don't need to define the boot targets. It is done automatically using the devices that are available.
So you're replacing defining the system to be correct with heuristics to guess that it's correct?
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
- allows testing of the U-Boot part of 'can we boot' because we have tests for all the cases - we can expand this over time
No, it doesn't. It provides a different interface and tests for itself. If it's not LAVA (or something like that) booting real Linux distribution images it's not a real can we boot test.
Quoted 5 lines
I didn't say it would test booting linux or real distros. You obviously need LAVA (or something like that) for doing that.
But it does provide tests for the boot flow which are completely lacking at present. So at least we are testing the code booting code.
We have hush tests, the distro boot logic is therefore tested as well as what you're adding here as neither of them are today testing that we can actually boot something.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
- allows non-UEFI boot cases like Chrome OS, which is currently just a hack for one board[1]
I don't see a Chrome OS example in your series.
Would that help? I don't mind doing it if we can make some progress, but your previous objection was about code size. I addressed that and have not heard any comment about that.
I object to the whole thing. The lack of implementations where this is showing that it's actually better than what we have today is just one of the problems. That we replace something that's basically size-free and replace it with several kilobytes is another problem.
Quoted 10 lines
Quoted 5 lines
Quoted 1 line
- provides a programmatic base for A/B boot, etc.
And I've noted before that I don't see how this makes life easier for any of the existing A/B mechanisms. Some of which are just going with "Hey, just UEFI boot and let grub deal with it".
It makes it much easier since we now have the means to locate and read in boot flows. Then it is just a case of selecting the one we want, e.g. by examining the list of bootflows and selecting one. It is a helpful division of labour.
That's not the hard part of integrating an A/B update mechanism or implementing it for a given board.
Quoted 15 lines
Quoted 9 lines
Quoted 4 lines
I feel the same way with Takahiro's series, which has been out-of-tree for too long.
Please reconsider this. What do we have to lose?
What we'll gain seems to be another chunk of code that needs boards to migrate to, maybe. And I don't see examples where this, now, or in the next iteration, provides a smaller, or clearer implementation of something.
Yes it requires boards to migrate, although in fact the migration can be driven by features rather than board-by-board. For example, we could migrate boards that use USB, MMC, etc. first, and then migrate more as we add more features.
Quoted 7 lines
Quoted 2 lines
But at least it is a chunk of code, with full tests. The scripts are just a pain.
So we just add unused code until someone makes use of it? We already have that with the environment rework that can't be really used because it doesn't handle distro boot support, which this attempts to handle by removing that functionality from the environment and to C code.
My summary of the above is that you see a lot of other/bigger problems and want to solve those instead. But that is not the purpose of this series.
Quoted 7 lines
And as I'm testing some
Kconfigmigrations in another window and seeing what feels like an endless scroll of "migrate to ..." messages flow by, I have little confidence in more than a few boards getting migrated to this functionality, while leaving the to me bigger problems entirely unresolved (how do we delete boardconfig.hfiles when the environment needs CONFIG based tweaking, which is more than just distro boot).This seems to be the nub of it. I am reluctant to invest more time in this when there is so little mindshare about the problems we face. You are reluctant to move it forward when you worry it will just be another migration effort that leads nowhere.
Quoted 5 lines
I am more than happy to commit to migrating all boards over to bootstd and removing the distro scripts from the environment. This is a per-feature migration, rather than per-board.
Does that help?
I see a large number of problems that need to be solved, most urgently, in U-Boot. A good subset of these are DM migration related and you're in the best position to make some initial passes at. I'm also not convinced that this series has been worked far enough to be an improvement on the boot cases that are NOT "just use UEFI boot manager". And the time / effort for getting there I'd personally rather see put in to some other migrations / improvements on the DM front.
Signature · 1 line
Tom
Hi Tom,
Quoted 141 lines · Tom Rini
Quoted 110 lines · Simon Glass
Hi Tom,
Quoted 107 lines · Tom Rini
Quoted 104 lines · Simon Glass
Hi Tom,
Quoted 92 lines · Tom Rini
Quoted 90 lines · Simon Glass
Hi Tom,
Quoted 75 lines · Tom Rini
Quoted 51 lines · Simon Glass
The bootflow feature provide a built-in way for U-Boot to automatically boot an Operating System without custom scripting and other customisation. This is called 'standard boot' since it provides a standard way for U-Boot to boot a distro, without scripting.
It introduces the following concepts:
- bootdev - a device which can hold a distro
- bootmeth - a method to scan a bootdev to find bootflows (owned byU-Boot)- bootflow - a description of how to boot (owned by the distro)
This series provides an implementation of these, enabled to scan for bootflows from MMC, USB and Ethernet. It supports the existing distro boot as well as the EFI loader flow (bootefi/bootmgr). It works similiarly to the existing script-based approach, but is native to U-Boot.
With this we can boot on a Raspberry Pi 3 with just one command:
bootflow scan -lb
which means to scan, listing (-l) each bootflow and trying to boot each one (-b). The final patch shows this.
With a standard way to identify boot devices, booting become easier. It also should be possible to support U-Boot scripts, for backwards compatibility only.
This series relies on the PXE clean-up series, posted here:
https://patchwork.ozlabs.org/project/uboot/list/?series=267078For documentation, see the 'doc' patch.
For version 2, a new naming scheme is used as above:
- bootdev is used instead of bootdevice, because 'device' is overused, is everywhere in U-Boot, can be confused with udevice
- bootmeth - because 'method' is too vanilla, appears 1300 times in U-BootAlso in version 2, drivers are introduced for the boot methods, to make it more extensible. Booting a custom OS is simply a matter of creating a bootmeth for it and implementing the
read_file()andboot()methods.Version 4 makes some minor improvements and leaves out the RFC patch for rpi conversion, in the hope of getting the base support applied sooner rather than later.
Quoted 5 lines
The design is described in these two documents:
https://drive.google.com/file/d/1ggW0KJpUOR__vBkj3l61L2dav4ZkNC12/view?usp=sharing
https://drive.google.com/file/d/1kTrflO9vvGlKp-ZH_jlgb9TY3WYG6FF9/view?usp=sharing
I keep putting off commenting more here, but, I still feel this is the wrong direction. What problems do we have today with distro boot? Well, we haven't figured out how to move configuring it out of the board
config.hfile. But that's just one of a half dozen or so examples of how we haven't figured out a good solution to configuring the default environment. And only some of those other examples are boot related (the NXP chain of trust booting stuff is another boot example, ETHPRIME, HOSTNAME, etc, are non-boot examples).We also aren't improving testing of "can we boot" here, because what THAT needs is setting up LAVA and booting some installers on some hardware (and some QEMU). That's testing that Linux boot works. Today we have tests for hush parsing, and if distro boot makes use of something we don't have a test for, we need a test for it. This adds tests for itself, which is good.
Quoted 7 lines
And I still don't see an example of where this demonstrates that existing non-UEFI boot cases are now easier to handle or cleaner to handle or otherwise better.
In that this is an attempt to tackle one of the long standing needed migrations (be able to drop board
config.hfiles), something here needs doing. But I don't see this as the right direction, sorry.Does anyone have a better idea for all of this? This is a solid base we can build on but we can't make any progress while this is just patches. What not apply it and we can move forward?
Quoted 5 lines
Quoted 1 line
- solves the env problem for distro boot in that we don't need the scripts
Solves what problem? That distro boot is done in hush? Yes, we have many examples of needing to define the default environment in a non-static way. This is not a solution to that problem.
It removes the need for the boot scripts that are currently in the environment. I'm not sure what you mean by defining a default environment in a non-static way.
Quoted 7 lines
Quoted 5 lines
I'm not sure what you're missing. We have a number of examples today of modifying the default environment based on CONFIG options. How we do the generic distro boot is one of those examples, and you're trying to replace it. It should be able to address the NXP (
fsl_...) secure boot scripts as well. It doesn't address at all the non-boot related things.The text environment does support CONFIG options.
Then I misremembered or misunderstood something you had said previously, sorry.
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 1 line
- gets rid of the scripts which are a confusing mess
Yes, a generic "figure out where a bootable might be, boot it" is complex. That's basically why the UEFI boot manager code exists, and replaces that logic.
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
I thought we already decided that U-Boot was going to continue to support non-UEFI booting?
Yes?
CONFIG_BOOTCOMMANDcan be whatever you like. No one is talking at all anywhere about removing anything that's not bootefi. I don't understand your point here.I want to come back here for a moment because maybe we're talking at cross purposes. I absolutely want there to be
CONFIG_BOOTCOMMANDand/or non-hush-based (for device security) ways to run whatever, to boot the OS/next stage.
Quoted 9 lines
But for something to deal with the combinatorial matrix hell of heuristic and then some configurability (or not!) of find out which arbitrary devices to boot from, or not boot from, or override booting from and so on, no, I don't want to DIY something, I want the UEFI standard for that. If there's some other standard for dealing with all of that as well, OK, lets talk about implementing it. If UEFI standard could be improved in some way, well, lets push back and get it improved. But I do not want another implementation of find an arbitrary thing and boot it. I'm not sure who is asking for that, either.
That is quite a change in what I thought you meant, but of course email is a terrible medium for this sort of thing. What you say seems to rule out bootstd, because the goal there is to provide a means to systematically boot things that might be UEFI, but might not be. The UEFI boot manager will presumably grow in usage, but it only covers UEFI cases. Even that is not good IMO because the current implementation is a bit of a mess, e.g. the hacks to decide on boot devices and detect when things are loaded. I believe bootstd can improve those bottom-level pieces of UEFI. Anyway, for everything else, UEFI is not useful.
So please let's be clear about this. I suspect I would struggle to maintain any professional or personal interest in a UEFI-only bootloader, or where the only innovation going on is on the UEFI side.
Quoted 107 lines
Quoted 101 lines
Quoted 76 lines
Quoted 10 lines
Quoted 9 lines
Quoted 2 lines
- provides proper high-level concepts of boot device and boot method
I don't see the inherent value. Or maybe to put things another way, the "now go boot" API has always been implemented via hush, even when the interactive part is disabled. You're providing a programatic way of doing it instead. And I'm not seeing it being more flexible / easier to implement. It's really sounded harder, not easier, than #define
BOOT_TARGET_DEVICES.Quoted 2 lines
It is easier in that you don't need to define the boot targets. It is done automatically using the devices that are available.
So you're replacing defining the system to be correct with heuristics to guess that it's correct?
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
- allows testing of the U-Boot part of 'can we boot' because we have tests for all the cases - we can expand this over time
No, it doesn't. It provides a different interface and tests for itself. If it's not LAVA (or something like that) booting real Linux distribution images it's not a real can we boot test.
Quoted 5 lines
I didn't say it would test booting linux or real distros. You obviously need LAVA (or something like that) for doing that.
But it does provide tests for the boot flow which are completely lacking at present. So at least we are testing the code booting code.
We have hush tests, the distro boot logic is therefore tested as well as what you're adding here as neither of them are today testing that we can actually boot something.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
- allows non-UEFI boot cases like Chrome OS, which is currently just a hack for one board[1]
I don't see a Chrome OS example in your series.
Would that help? I don't mind doing it if we can make some progress, but your previous objection was about code size. I addressed that and have not heard any comment about that.
I object to the whole thing. The lack of implementations where this is showing that it's actually better than what we have today is just one of the problems. That we replace something that's basically size-free and replace it with several kilobytes is another problem.
Quoted 10 lines
Quoted 5 lines
Quoted 1 line
- provides a programmatic base for A/B boot, etc.
And I've noted before that I don't see how this makes life easier for any of the existing A/B mechanisms. Some of which are just going with "Hey, just UEFI boot and let grub deal with it".
It makes it much easier since we now have the means to locate and read in boot flows. Then it is just a case of selecting the one we want, e.g. by examining the list of bootflows and selecting one. It is a helpful division of labour.
That's not the hard part of integrating an A/B update mechanism or implementing it for a given board.
Quoted 15 lines
Quoted 9 lines
Quoted 4 lines
I feel the same way with Takahiro's series, which has been out-of-tree for too long.
Please reconsider this. What do we have to lose?
What we'll gain seems to be another chunk of code that needs boards to migrate to, maybe. And I don't see examples where this, now, or in the next iteration, provides a smaller, or clearer implementation of something.
Yes it requires boards to migrate, although in fact the migration can be driven by features rather than board-by-board. For example, we could migrate boards that use USB, MMC, etc. first, and then migrate more as we add more features.
Quoted 7 lines
Quoted 2 lines
But at least it is a chunk of code, with full tests. The scripts are just a pain.
So we just add unused code until someone makes use of it? We already have that with the environment rework that can't be really used because it doesn't handle distro boot support, which this attempts to handle by removing that functionality from the environment and to C code.
My summary of the above is that you see a lot of other/bigger problems and want to solve those instead. But that is not the purpose of this series.
Quoted 7 lines
And as I'm testing some
Kconfigmigrations in another window and seeing what feels like an endless scroll of "migrate to ..." messages flow by, I have little confidence in more than a few boards getting migrated to this functionality, while leaving the to me bigger problems entirely unresolved (how do we delete boardconfig.hfiles when the environment needs CONFIG based tweaking, which is more than just distro boot).This seems to be the nub of it. I am reluctant to invest more time in this when there is so little mindshare about the problems we face. You are reluctant to move it forward when you worry it will just be another migration effort that leads nowhere.
Quoted 5 lines
I am more than happy to commit to migrating all boards over to bootstd and removing the distro scripts from the environment. This is a per-feature migration, rather than per-board.
Does that help?
Quoted 7 lines
I see a large number of problems that need to be solved, most urgently, in U-Boot. A good subset of these are DM migration related and you're in the best position to make some initial passes at. I'm also not convinced that this series has been worked far enough to be an improvement on the boot cases that are NOT "just use UEFI boot manager". And the time / effort for getting there I'd personally rather see put in to some other migrations / improvements on the DM front.
This is off-topic, but I'm not even sure what the DM issues are. Perhaps you could provide a list here, or perhaps in the issue tracker if you like. To me, a big challenge is that we are slow to finish migrations like Kconfig and relaxed about boards which miss the deadlines. For example, if we could just get the CONFIG_SPL stuff finished then we could migrate away from the SPL_TPL_ / CONFIG_IS_ENABLED() stuff. Surely no one expected the Kconfig migration to take 8 years...
Re bootstd it seems completely obvious to me that U-Boot needs this since it creates a much-needed structure for finding and configuring boot devices and things to boot. That is perhaps why I am so lost here. I think UEFI is muddying the waters hugely, so perhaps this would have been a much easier discussion 5 years ago.
Regards,
Simon
Quoted 165 lines · Simon Glass
Hi Tom,
Quoted 141 lines · Tom Rini
Quoted 110 lines · Simon Glass
Hi Tom,
Quoted 107 lines · Tom Rini
Quoted 104 lines · Simon Glass
Hi Tom,
Quoted 92 lines · Tom Rini
Quoted 90 lines · Simon Glass
Hi Tom,
Quoted 75 lines · Tom Rini
Quoted 51 lines · Simon Glass
The bootflow feature provide a built-in way for U-Boot to automatically boot an Operating System without custom scripting and other customisation. This is called 'standard boot' since it provides a standard way for U-Boot to boot a distro, without scripting.
It introduces the following concepts:
- bootdev - a device which can hold a distro
- bootmeth - a method to scan a bootdev to find bootflows (owned byU-Boot)- bootflow - a description of how to boot (owned by the distro)
This series provides an implementation of these, enabled to scan for bootflows from MMC, USB and Ethernet. It supports the existing distro boot as well as the EFI loader flow (bootefi/bootmgr). It works similiarly to the existing script-based approach, but is native to U-Boot.
With this we can boot on a Raspberry Pi 3 with just one command:
bootflow scan -lb
which means to scan, listing (-l) each bootflow and trying to boot each one (-b). The final patch shows this.
With a standard way to identify boot devices, booting become easier. It also should be possible to support U-Boot scripts, for backwards compatibility only.
This series relies on the PXE clean-up series, posted here:
https://patchwork.ozlabs.org/project/uboot/list/?series=267078For documentation, see the 'doc' patch.
For version 2, a new naming scheme is used as above:
- bootdev is used instead of bootdevice, because 'device' is overused, is everywhere in U-Boot, can be confused with udevice
- bootmeth - because 'method' is too vanilla, appears 1300 times in U-BootAlso in version 2, drivers are introduced for the boot methods, to make it more extensible. Booting a custom OS is simply a matter of creating a bootmeth for it and implementing the
read_file()andboot()methods.Version 4 makes some minor improvements and leaves out the RFC patch for rpi conversion, in the hope of getting the base support applied sooner rather than later.
Quoted 5 lines
The design is described in these two documents:
https://drive.google.com/file/d/1ggW0KJpUOR__vBkj3l61L2dav4ZkNC12/view?usp=sharing
https://drive.google.com/file/d/1kTrflO9vvGlKp-ZH_jlgb9TY3WYG6FF9/view?usp=sharing
I keep putting off commenting more here, but, I still feel this is the wrong direction. What problems do we have today with distro boot? Well, we haven't figured out how to move configuring it out of the board
config.hfile. But that's just one of a half dozen or so examples of how we haven't figured out a good solution to configuring the default environment. And only some of those other examples are boot related (the NXP chain of trust booting stuff is another boot example, ETHPRIME, HOSTNAME, etc, are non-boot examples).We also aren't improving testing of "can we boot" here, because what THAT needs is setting up LAVA and booting some installers on some hardware (and some QEMU). That's testing that Linux boot works. Today we have tests for hush parsing, and if distro boot makes use of something we don't have a test for, we need a test for it. This adds tests for itself, which is good.
Quoted 7 lines
And I still don't see an example of where this demonstrates that existing non-UEFI boot cases are now easier to handle or cleaner to handle or otherwise better.
In that this is an attempt to tackle one of the long standing needed migrations (be able to drop board
config.hfiles), something here needs doing. But I don't see this as the right direction, sorry.Does anyone have a better idea for all of this? This is a solid base we can build on but we can't make any progress while this is just patches. What not apply it and we can move forward?
Quoted 5 lines
Quoted 1 line
- solves the env problem for distro boot in that we don't need the scripts
Solves what problem? That distro boot is done in hush? Yes, we have many examples of needing to define the default environment in a non-static way. This is not a solution to that problem.
It removes the need for the boot scripts that are currently in the environment. I'm not sure what you mean by defining a default environment in a non-static way.
Quoted 7 lines
Quoted 5 lines
I'm not sure what you're missing. We have a number of examples today of modifying the default environment based on CONFIG options. How we do the generic distro boot is one of those examples, and you're trying to replace it. It should be able to address the NXP (
fsl_...) secure boot scripts as well. It doesn't address at all the non-boot related things.The text environment does support CONFIG options.
Then I misremembered or misunderstood something you had said previously, sorry.
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 1 line
- gets rid of the scripts which are a confusing mess
Yes, a generic "figure out where a bootable might be, boot it" is complex. That's basically why the UEFI boot manager code exists, and replaces that logic.
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
I thought we already decided that U-Boot was going to continue to support non-UEFI booting?
Yes?
CONFIG_BOOTCOMMANDcan be whatever you like. No one is talking at all anywhere about removing anything that's not bootefi. I don't understand your point here.I want to come back here for a moment because maybe we're talking at cross purposes. I absolutely want there to be
CONFIG_BOOTCOMMANDand/or non-hush-based (for device security) ways to run whatever, to boot the OS/next stage.Quoted 9 lines
But for something to deal with the combinatorial matrix hell of heuristic and then some configurability (or not!) of find out which arbitrary devices to boot from, or not boot from, or override booting from and so on, no, I don't want to DIY something, I want the UEFI standard for that. If there's some other standard for dealing with all of that as well, OK, lets talk about implementing it. If UEFI standard could be improved in some way, well, lets push back and get it improved. But I do not want another implementation of find an arbitrary thing and boot it. I'm not sure who is asking for that, either.
That is quite a change in what I thought you meant, but of course email is a terrible medium for this sort of thing. What you say seems to rule out bootstd, because the goal there is to provide a means to systematically boot things that might be UEFI, but might not be. The UEFI boot manager will presumably grow in usage, but it only covers UEFI cases. Even that is not good IMO because the current implementation is a bit of a mess, e.g. the hacks to decide on boot devices and detect when things are loaded. I believe bootstd can improve those bottom-level pieces of UEFI. Anyway, for everything else, UEFI is not useful.
Quoted 3 lines
So please let's be clear about this. I suspect I would struggle to maintain any professional or personal interest in a UEFI-only bootloader, or where the only innovation going on is on the UEFI side.
Then perhaps we need to step back and figure out what to move forward on. The combinational nightmare that is an arbitrary set of devices times permissions times override times per device / SoC limitations is something I want to avoid duplication of. But I also think in some ways, that's the less interesting case. Embedded devices tend to boot from point A (or point B, or perhaps golden master point C), which doesn't require massive loads of discovery and probing work. Of course, which SDIO is an eMMC vs an SD slot vs a WiFi card is per-board.
Quoted 114 lines
Quoted 106 lines
Quoted 100 lines
Quoted 75 lines
Quoted 11 lines
Quoted 8 lines
Quoted 1 line
- provides proper high-level concepts of boot device and boot method
I don't see the inherent value. Or maybe to put things another way, the "now go boot" API has always been implemented via hush, even when the interactive part is disabled. You're providing a programatic way of doing it instead. And I'm not seeing it being more flexible / easier to implement. It's really sounded harder, not easier, than #define
BOOT_TARGET_DEVICES.It is easier in that you don't need to define the boot targets. It is done automatically using the devices that are available.
So you're replacing defining the system to be correct with heuristics to guess that it's correct?
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
- allows testing of the U-Boot part of 'can we boot' because we have tests for all the cases - we can expand this over time
No, it doesn't. It provides a different interface and tests for itself. If it's not LAVA (or something like that) booting real Linux distribution images it's not a real can we boot test.
Quoted 5 lines
I didn't say it would test booting linux or real distros. You obviously need LAVA (or something like that) for doing that.
But it does provide tests for the boot flow which are completely lacking at present. So at least we are testing the code booting code.
We have hush tests, the distro boot logic is therefore tested as well as what you're adding here as neither of them are today testing that we can actually boot something.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
- allows non-UEFI boot cases like Chrome OS, which is currently just a hack for one board[1]
I don't see a Chrome OS example in your series.
Would that help? I don't mind doing it if we can make some progress, but your previous objection was about code size. I addressed that and have not heard any comment about that.
I object to the whole thing. The lack of implementations where this is showing that it's actually better than what we have today is just one of the problems. That we replace something that's basically size-free and replace it with several kilobytes is another problem.
Quoted 10 lines
Quoted 5 lines
Quoted 1 line
- provides a programmatic base for A/B boot, etc.
And I've noted before that I don't see how this makes life easier for any of the existing A/B mechanisms. Some of which are just going with "Hey, just UEFI boot and let grub deal with it".
It makes it much easier since we now have the means to locate and read in boot flows. Then it is just a case of selecting the one we want, e.g. by examining the list of bootflows and selecting one. It is a helpful division of labour.
That's not the hard part of integrating an A/B update mechanism or implementing it for a given board.
Quoted 15 lines
Quoted 9 lines
Quoted 4 lines
I feel the same way with Takahiro's series, which has been out-of-tree for too long.
Please reconsider this. What do we have to lose?
What we'll gain seems to be another chunk of code that needs boards to migrate to, maybe. And I don't see examples where this, now, or in the next iteration, provides a smaller, or clearer implementation of something.
Yes it requires boards to migrate, although in fact the migration can be driven by features rather than board-by-board. For example, we could migrate boards that use USB, MMC, etc. first, and then migrate more as we add more features.
Quoted 7 lines
Quoted 2 lines
But at least it is a chunk of code, with full tests. The scripts are just a pain.
So we just add unused code until someone makes use of it? We already have that with the environment rework that can't be really used because it doesn't handle distro boot support, which this attempts to handle by removing that functionality from the environment and to C code.
My summary of the above is that you see a lot of other/bigger problems and want to solve those instead. But that is not the purpose of this series.
Quoted 7 lines
And as I'm testing some
Kconfigmigrations in another window and seeing what feels like an endless scroll of "migrate to ..." messages flow by, I have little confidence in more than a few boards getting migrated to this functionality, while leaving the to me bigger problems entirely unresolved (how do we delete boardconfig.hfiles when the environment needs CONFIG based tweaking, which is more than just distro boot).This seems to be the nub of it. I am reluctant to invest more time in this when there is so little mindshare about the problems we face. You are reluctant to move it forward when you worry it will just be another migration effort that leads nowhere.
Quoted 5 lines
I am more than happy to commit to migrating all boards over to bootstd and removing the distro scripts from the environment. This is a per-feature migration, rather than per-board.
Does that help?
Quoted 7 lines
I see a large number of problems that need to be solved, most urgently, in U-Boot. A good subset of these are DM migration related and you're in the best position to make some initial passes at. I'm also not convinced that this series has been worked far enough to be an improvement on the boot cases that are NOT "just use UEFI boot manager". And the time / effort for getting there I'd personally rather see put in to some other migrations / improvements on the DM front.
Quoted 1 line
This is off-topic, but I'm not even sure what the DM issues are.
High level, memory pressure. As talked about in that thread about SYS_MALLOC_F_LEN, we have many SoCs that defaulted to 0x1000/0x2000 are increasing it well past that on some boards, but not all. A 'git log' checking for commits that increase SYS_MALLOC_F_LEN shows it's not just the specific clock tree changes doing it.
Quoted 7 lines
Perhaps you could provide a list here, or perhaps in the issue tracker if you like. To me, a big challenge is that we are slow to finish migrations like
Kconfigand relaxed about boards which miss the deadlines. For example, if we could just get theCONFIG_SPLstuff finished then we could migrate away from theSPL_TPL_/CONFIG_IS_ENABLED()stuff. Surely no one expected theKconfigmigration to take 8 years...
So yes, no one expected Kconfig to take so long to migrate to, I had hoped for more people to pick up and move values. The problem being a lot of them are hard. I just today finished doing CONFIG_SYS_MONITOR_BASE so that we could kill off CONFIG_SYS_EXTRA_OPTIONS and that required dropping in CONFIG_VAL() usage for MPC85xx. I'm confident enough I got things right, but there's a bunch of little changes this also introduces as platforms had been doing stuff like:
#ifdef CONFIG_SPL_BUILD
#define CONFIG_SYS_MONITOR_BASE ...
#endif
and (a) not strictly needing the value I think and (b) also missing out on the places in generic code where we check for that value.
And frankly, at this point I'd rather see some blind but should work conversions of boards / drivers because given our long standing well defined release schedule, if a broken migration comes in to when the -next merge window opens, and it's not found to be a problem until after the release, that speaks to a need to have vendors boards more, especially so long as the migration patches cc the maintainers, since every defconfig has a maintainer these days.
Quoted 5 lines
Re bootstd it seems completely obvious to me that U-Boot needs this since it creates a much-needed structure for finding and configuring boot devices and things to boot. That is perhaps why I am so lost here. I think UEFI is muddying the waters hugely, so perhaps this would have been a much easier discussion 5 years ago.
Perhaps? In my mind the hard part about "things to boot" is when you want something to work for some arbitrary set of board and storages. But every board knows what storages are possibly valid. And that's part of "treat this like a desktop PeeCee" rather than an embedded device. My thermostat (which has an imx6 in it) doesn't need to figure out what's where, it knows which SDIO has an eMMC (I think, haven't dared crack it open) and which is probably a wilink.
Which is why I guess I keep coming back to things like the existing off the shelf update mechanisms. The pain points to any of them aren't figuring out which device / partition to use (since much of that has to be configured so the mechanism knows where to write things to) but rather integration of the environment and ensuring required support is enabled and so forth.
The use case of "I want to boot $BIGNAME_DISTRO on $RANDOM_SBC_EVAL" has seemingly all of the people in the former asking for UEFI bootmanager booting since that defines all of the hows and whys to find things on the latter. But that leaves what I tend to think of has a rather huge swath of use cases unhandled.
Signature · 1 line
Tom