Re: [PATCH v2 00/16] pxe: Allow extlinux booting without CMDLINE enabled
Hi Tom and Simon, On 2024-04-18 20:13, Tom Rini wrote: > On Sun, Apr 14, 2024 at 06:58:03PM +0200, Jonas Karlman wrote: >> Hi Tom and Simon, >> >> On 2024-04-11 03:45, Tom Rini wrote: >>> On Thu, 14 Dec 2023 21:18:58 -0700, Simon Glass wrote: >>> This series is the culmanation of the current line of refactoring series. It adjusts pxe to call the booting functionality directly rather than going through the command-line interface. With this is is possible to boot using the extlinux bootmeth without the command line enabled. [...] >>> >>> Applied to u-boot/master, thanks! >>> >> >> This series is causing boot issues using extlinux in bootm_run_states(): >> >> ERROR: booting os 'Invalid OS' (0) is not supported >> >> Following extlinux.conf was used: >> >> label linux >> kernel /Image.gz >> initrd /initramfs.cpio.gz >> >> Before this series booting works, bootm_run_states() is first called >> with states=0x1 (BOOTM_STATE_START): >> >> Scanning bootdev 'mmc@fe2b.bootdev': >> 1 extlinux ready mmc 1 m...@fe2b.bootdev.part >> /extlinux/extlinux.conf >> ** Booting bootflow 'mmc@fe2b.bootdev.part_1' with extlinux >> 1: linux >> Retrieving file: /Image.gz >> Retrieving file: /initramfs.cpio.gz >> bootm_run_states(): images->state: 0, states: 1 >> bootm_run_states(): images->os.os: 0 >> bootm_run_states(): images->os.arch: 0 >> bootm_run_states(): boot_fn: , need_boot_fn: 0 >> Uncompressing Kernel Image to 0 >> ## Flattened Device Tree blob at edef8410 >> Booting using the fdt blob at 0xedef8410 >> Working FDT set to edef8410 >> bootm_run_states(): images->state: 1, states: 1710 >> Loading Ramdisk to ecdfd000, end eceb274d ... OK >> bootm_run_states(): images->os.os: 5 >> bootm_run_states(): images->os.arch: 16 >> boot_fn: eff2b83c, need_boot_fn: 0 >> Loading Device Tree to ecde8000, end ecdfc97f ... OK >> Working FDT set to ecde8000 >> >> After this series booting fails, bootm_run_states() is first called >> with states=0x1710. >> >> Scanning bootdev 'mmc@fe2b.bootdev': >> 1 extlinux ready mmc 1 m...@fe2b.bootdev.part >> /extlinux/extlinux.conf >> ** Booting bootflow 'mmc@fe2b.bootdev.part_1' with extlinux >> 1: linux >> Retrieving file: /Image.gz >> Retrieving file: /initramfs.cpio.gz >> bootm_run_states(): images->state: 0, states: 1710 >> bootm_run_states(): images->os.os: 0 >> bootm_run_states(): images->os.arch: 0 >> bootm_run_states(): boot_fn: , need_boot_fn: 0 >> ERROR: booting os 'Invalid OS' (0) is not supported >> Boot failed (err=-14) >> >> Looks like booti_start() -> bootm_run_states(bmi, BOOTM_STATE_START) is >> no longer called due to changes in this series. > > I think the problem is with: > commit 6d803ec9cc757bda0c48f2fd419cb6878eab92c4 > Author: Simon Glass > Date: Thu Dec 14 21:19:12 2023 -0700 > > pxe: Allow booting without CMDLINE for bootm methods > > Use bootm_run() and booti_run() to boot rather than the command line. > This allows extlinux to be used without CMDLINE being enabled. > > Collect any error but do not return it, to match the existing code. > > Signed-off-by: Simon Glass > > diff --git a/boot/pxe_utils.c b/boot/pxe_utils.c > [snip] > @@ -641,23 +644,18 @@ static int label_run_boot(struct pxe_context *ctx, > struct pxe_label *label, > if (!fdt_addr && genimg_get_format(buf) != IMAGE_FORMAT_FIT) > fdt_addr = env_get("fdtcontroladdr"); > > - if (fdt_addr) { > - if (!bootm_argv[2]) > - bootm_argv[2] = "-"; > - bootm_argc = 4; > - } > - bootm_argv[3] = (char *)fdt_addr; > + bmi.conf_fdt = fdt_addr; > > /* Try bootm for legacy and FIT format image */ > if (genimg_get_format(buf) != IMAGE_FORMAT_INVALID && > -IS_ENABLED(CONFIG_CMD_BOOTM)) > - do_bootm(ctx->cmdtp, 0, bootm_argc, bootm_argv); > + IS_ENABLED(CONFIG_BOOTM)) > + ret = bootm_run(); > /* Try booting an AArch64 Linux kernel image */ > - else if (IS_ENABLED(CONFIG_CMD_BOOTI)) > - do_booti(ctx->cmdtp, 0, bootm_argc, bootm_argv); > + else if (IS_ENABLED(CONFIG_BOOTM)) > + ret = booti_run(); > /* Try booting a Image */ > - else if (IS_ENABLED(CONFIG_CMD_BOOTZ)) > - do_bootz(ctx->cmdtp, 0, bootm_argc, bootm_argv); > + else if (IS_ENABLED(CONFIG_BOOTM)) > + ret = bootz_run(); > /* Try booting an x86_64 Linux kernel image */ > else if (IS_ENABLED(CONFIG_CMD_ZBOOT)) > do_zboot_parent(ctx->cmdtp, 0, zboot_argc, zboot_argv, NULL); > > And this doesn't seem equivalent really. The logic used to be checking > if we had bootm/booti/bootz and now it's always checking for > CONFIG_BOOTM. Jonas, can you
Re: [PATCH v2 00/16] pxe: Allow extlinux booting without CMDLINE enabled
On Sun, Apr 14, 2024 at 06:58:03PM +0200, Jonas Karlman wrote: > Hi Tom and Simon, > > On 2024-04-11 03:45, Tom Rini wrote: > > On Thu, 14 Dec 2023 21:18:58 -0700, Simon Glass wrote: > > > >> This series is the culmanation of the current line of refactoring > >> series. It adjusts pxe to call the booting functionality directly > >> rather than going through the command-line interface. > >> > >> With this is is possible to boot using the extlinux bootmeth without > >> the command line enabled. > >> > >> [...] > > > > Applied to u-boot/master, thanks! > > > > This series is causing boot issues using extlinux in bootm_run_states(): > > ERROR: booting os 'Invalid OS' (0) is not supported > > Following extlinux.conf was used: > > label linux > kernel /Image.gz > initrd /initramfs.cpio.gz > > Before this series booting works, bootm_run_states() is first called > with states=0x1 (BOOTM_STATE_START): > > Scanning bootdev 'mmc@fe2b.bootdev': > 1 extlinux ready mmc 1 m...@fe2b.bootdev.part > /extlinux/extlinux.conf > ** Booting bootflow 'mmc@fe2b.bootdev.part_1' with extlinux > 1: linux > Retrieving file: /Image.gz > Retrieving file: /initramfs.cpio.gz > bootm_run_states(): images->state: 0, states: 1 > bootm_run_states(): images->os.os: 0 > bootm_run_states(): images->os.arch: 0 > bootm_run_states(): boot_fn: , need_boot_fn: 0 > Uncompressing Kernel Image to 0 > ## Flattened Device Tree blob at edef8410 > Booting using the fdt blob at 0xedef8410 > Working FDT set to edef8410 > bootm_run_states(): images->state: 1, states: 1710 > Loading Ramdisk to ecdfd000, end eceb274d ... OK > bootm_run_states(): images->os.os: 5 > bootm_run_states(): images->os.arch: 16 > boot_fn: eff2b83c, need_boot_fn: 0 > Loading Device Tree to ecde8000, end ecdfc97f ... OK > Working FDT set to ecde8000 > > After this series booting fails, bootm_run_states() is first called > with states=0x1710. > > Scanning bootdev 'mmc@fe2b.bootdev': > 1 extlinux ready mmc 1 m...@fe2b.bootdev.part > /extlinux/extlinux.conf > ** Booting bootflow 'mmc@fe2b.bootdev.part_1' with extlinux > 1: linux > Retrieving file: /Image.gz > Retrieving file: /initramfs.cpio.gz > bootm_run_states(): images->state: 0, states: 1710 > bootm_run_states(): images->os.os: 0 > bootm_run_states(): images->os.arch: 0 > bootm_run_states(): boot_fn: , need_boot_fn: 0 > ERROR: booting os 'Invalid OS' (0) is not supported > Boot failed (err=-14) > > Looks like booti_start() -> bootm_run_states(bmi, BOOTM_STATE_START) is > no longer called due to changes in this series. I think the problem is with: commit 6d803ec9cc757bda0c48f2fd419cb6878eab92c4 Author: Simon Glass Date: Thu Dec 14 21:19:12 2023 -0700 pxe: Allow booting without CMDLINE for bootm methods Use bootm_run() and booti_run() to boot rather than the command line. This allows extlinux to be used without CMDLINE being enabled. Collect any error but do not return it, to match the existing code. Signed-off-by: Simon Glass diff --git a/boot/pxe_utils.c b/boot/pxe_utils.c [snip] @@ -641,23 +644,18 @@ static int label_run_boot(struct pxe_context *ctx, struct pxe_label *label, if (!fdt_addr && genimg_get_format(buf) != IMAGE_FORMAT_FIT) fdt_addr = env_get("fdtcontroladdr"); - if (fdt_addr) { - if (!bootm_argv[2]) - bootm_argv[2] = "-"; - bootm_argc = 4; - } - bootm_argv[3] = (char *)fdt_addr; + bmi.conf_fdt = fdt_addr; /* Try bootm for legacy and FIT format image */ if (genimg_get_format(buf) != IMAGE_FORMAT_INVALID && -IS_ENABLED(CONFIG_CMD_BOOTM)) - do_bootm(ctx->cmdtp, 0, bootm_argc, bootm_argv); + IS_ENABLED(CONFIG_BOOTM)) + ret = bootm_run(); /* Try booting an AArch64 Linux kernel image */ - else if (IS_ENABLED(CONFIG_CMD_BOOTI)) - do_booti(ctx->cmdtp, 0, bootm_argc, bootm_argv); + else if (IS_ENABLED(CONFIG_BOOTM)) + ret = booti_run(); /* Try booting a Image */ - else if (IS_ENABLED(CONFIG_CMD_BOOTZ)) - do_bootz(ctx->cmdtp, 0, bootm_argc, bootm_argv); + else if (IS_ENABLED(CONFIG_BOOTM)) + ret = bootz_run(); /* Try booting an x86_64 Linux kernel image */ else if (IS_ENABLED(CONFIG_CMD_ZBOOT)) do_zboot_parent(ctx->cmdtp, 0, zboot_argc, zboot_argv, NULL); And this doesn't seem equivalent really. The logic used to be checking if we had bootm/booti/bootz and now it's always checking for CONFIG_BOOTM. Jonas, can you please share the defconfig you used here as well? But I think for now reverting the series is the best path forward, unfortunately. -- Tom signature.asc
Re: [PATCH v2 00/16] pxe: Allow extlinux booting without CMDLINE enabled
Hi Tom and Simon, On 2024-04-11 03:45, Tom Rini wrote: > On Thu, 14 Dec 2023 21:18:58 -0700, Simon Glass wrote: > >> This series is the culmanation of the current line of refactoring >> series. It adjusts pxe to call the booting functionality directly >> rather than going through the command-line interface. >> >> With this is is possible to boot using the extlinux bootmeth without >> the command line enabled. >> >> [...] > > Applied to u-boot/master, thanks! > This series is causing boot issues using extlinux in bootm_run_states(): ERROR: booting os 'Invalid OS' (0) is not supported Following extlinux.conf was used: label linux kernel /Image.gz initrd /initramfs.cpio.gz Before this series booting works, bootm_run_states() is first called with states=0x1 (BOOTM_STATE_START): Scanning bootdev 'mmc@fe2b.bootdev': 1 extlinux ready mmc 1 m...@fe2b.bootdev.part /extlinux/extlinux.conf ** Booting bootflow 'mmc@fe2b.bootdev.part_1' with extlinux 1: linux Retrieving file: /Image.gz Retrieving file: /initramfs.cpio.gz bootm_run_states(): images->state: 0, states: 1 bootm_run_states(): images->os.os: 0 bootm_run_states(): images->os.arch: 0 bootm_run_states(): boot_fn: , need_boot_fn: 0 Uncompressing Kernel Image to 0 ## Flattened Device Tree blob at edef8410 Booting using the fdt blob at 0xedef8410 Working FDT set to edef8410 bootm_run_states(): images->state: 1, states: 1710 Loading Ramdisk to ecdfd000, end eceb274d ... OK bootm_run_states(): images->os.os: 5 bootm_run_states(): images->os.arch: 16 boot_fn: eff2b83c, need_boot_fn: 0 Loading Device Tree to ecde8000, end ecdfc97f ... OK Working FDT set to ecde8000 After this series booting fails, bootm_run_states() is first called with states=0x1710. Scanning bootdev 'mmc@fe2b.bootdev': 1 extlinux ready mmc 1 m...@fe2b.bootdev.part /extlinux/extlinux.conf ** Booting bootflow 'mmc@fe2b.bootdev.part_1' with extlinux 1: linux Retrieving file: /Image.gz Retrieving file: /initramfs.cpio.gz bootm_run_states(): images->state: 0, states: 1710 bootm_run_states(): images->os.os: 0 bootm_run_states(): images->os.arch: 0 bootm_run_states(): boot_fn: , need_boot_fn: 0 ERROR: booting os 'Invalid OS' (0) is not supported Boot failed (err=-14) Looks like booti_start() -> bootm_run_states(bmi, BOOTM_STATE_START) is no longer called due to changes in this series. Regards, Jonas
Re: [PATCH v2 00/16] pxe: Allow extlinux booting without CMDLINE enabled
On Thu, 14 Dec 2023 21:18:58 -0700, Simon Glass wrote: > This series is the culmanation of the current line of refactoring > series. It adjusts pxe to call the booting functionality directly > rather than going through the command-line interface. > > With this is is possible to boot using the extlinux bootmeth without > the command line enabled. > > [...] Applied to u-boot/master, thanks! -- Tom
[PATCH v2 00/16] pxe: Allow extlinux booting without CMDLINE enabled
This series is the culmanation of the current line of refactoring series. It adjusts pxe to call the booting functionality directly rather than going through the command-line interface. With this is is possible to boot using the extlinux bootmeth without the command line enabled. It also updates fastboot to do a similar thing. This is cmdf (part f of CMDLINE refactoring) It depends on dm/cmde-working which depends on dm/cmdd-working which depends on dm/bootstda-working which depends on dm/cmdc-working Changes in v2: - Use unmap_sysmem() too - Drop check for NULL with env_set() - Avoid changing the logic when a command is not set - Split out the strlcpy() change into its own patch - Update commit message to mention booti - Use bootm_init() instead of memset() Simon Glass (16): boot: Reorder FIT and BOOTSTD to be first bootm: Add a Kconfig option for bootm functionality bootm: Make OS booting dependent on BOOTM treewide: Make arch-specific bootm code depend on BOOTM boot: Update SYS_BOOTM_LEN to depend on BOOTM fastboot: Change fastboot_buf_addr to an address bootm: Make cmdline optional with bootm_boot_start() fastboot: Remove dependencies on CMDLINE doc: Mention fastboot dependency on CMDLINE pxe: Use strlcpy() instead of strcpy() in label_boot() pxe: Refactor to reduce the size of label_boot() pxe: Refactor to avoid over-using bootm_argv pxe: Move calculation of FDT file into a function pxe: Allow booting without CMDLINE for bootm methods pxe: Allow booting without CMDLINE for the zboot method x86: Drop message about features being missing with 64-bit arch/arc/lib/Makefile | 2 +- arch/arm/lib/Makefile | 2 +- arch/m68k/lib/Makefile| 2 +- arch/microblaze/lib/Makefile | 2 +- arch/mips/lib/Makefile| 2 +- arch/nios2/lib/Makefile | 2 +- arch/powerpc/lib/Makefile | 2 +- arch/riscv/lib/Makefile | 2 +- arch/sandbox/lib/Makefile | 2 +- arch/sh/lib/Makefile | 2 +- arch/x86/lib/Makefile | 2 +- arch/x86/lib/spl.c| 2 +- arch/xtensa/lib/Makefile | 2 +- boot/Kconfig | 99 - boot/Makefile | 2 +- boot/pxe_utils.c | 360 ++ cmd/Kconfig | 50 +-- cmd/fastboot.c| 2 +- configs/colibri_vf_defconfig | 2 +- configs/iot_devkit_defconfig | 2 +- configs/mx6memcal_defconfig | 2 +- configs/tools-only_defconfig | 2 +- configs/xilinx_versal_mini_defconfig | 2 +- configs/xilinx_versal_mini_emmc0_defconfig| 2 +- configs/xilinx_versal_mini_emmc1_defconfig| 2 +- configs/xilinx_versal_mini_ospi_defconfig | 2 +- configs/xilinx_versal_mini_qspi_defconfig | 2 +- configs/xilinx_versal_net_mini_defconfig | 2 +- configs/xilinx_versal_net_mini_emmc_defconfig | 2 +- configs/xilinx_versal_net_mini_ospi_defconfig | 2 +- configs/xilinx_versal_net_mini_qspi_defconfig | 2 +- configs/xilinx_zynqmp_mini_defconfig | 2 +- configs/xilinx_zynqmp_mini_emmc0_defconfig| 2 +- configs/xilinx_zynqmp_mini_emmc1_defconfig| 2 +- configs/xilinx_zynqmp_mini_nand_defconfig | 2 +- .../xilinx_zynqmp_mini_nand_single_defconfig | 2 +- configs/xilinx_zynqmp_mini_qspi_defconfig | 2 +- configs/zynq_cse_nand_defconfig | 2 +- configs/zynq_cse_nor_defconfig| 2 +- configs/zynq_cse_qspi_defconfig | 2 +- doc/android/fastboot.rst | 1 + doc/board/emulation/qemu-x86.rst | 2 +- drivers/fastboot/Kconfig | 1 - drivers/fastboot/fb_command.c | 17 +- drivers/fastboot/fb_common.c | 37 +- include/bootm.h | 2 +- include/fastboot-internal.h | 2 +- include/fastboot.h| 6 +- 48 files changed, 350 insertions(+), 301 deletions(-) -- 2.43.0.472.g3155946c3a-goog