diff options
author | Tom Rini <trini@konsulko.com> | 2024-04-18 08:29:35 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2024-04-18 08:29:35 -0600 |
commit | cdd20e3f66fe910da0545d3615decf511519b4a6 (patch) | |
tree | 9162980e2293b2a2405060f44529fe7a25cd0e1e | |
parent | 3434b88d2c2fdad3cc947f9e9b03dabfdd3feb5c (diff) | |
download | u-boot-cdd20e3f66fe910da0545d3615decf511519b4a6.zip u-boot-cdd20e3f66fe910da0545d3615decf511519b4a6.tar.gz u-boot-cdd20e3f66fe910da0545d3615decf511519b4a6.tar.bz2 |
Revert "Merge patch series "pxe: Allow extlinux booting without CMDLINE enabled""
As reported by Jonas Karlman this series breaks booting on some AArch64
platforms with common use cases. For now the best path forward is to
revert the series.
This reverts commit 777c28460947371ada40868dc994dfe8537d7115, reversing
changes made to ab3453e7b12daef47b9e91da2a2a3d48615dc6fc.
Link: https://lore.kernel.org/u-boot/50dfa3d6-a1ca-4492-a3fc-8d8c56b40b43@kwiboo.se/
Signed-off-by: Tom Rini <trini@konsulko.com>
48 files changed, 338 insertions, 387 deletions
diff --git a/arch/arc/lib/Makefile b/arch/arc/lib/Makefile index bde1c3d..0eb44bc 100644 --- a/arch/arc/lib/Makefile +++ b/arch/arc/lib/Makefile @@ -12,6 +12,6 @@ obj-y += reset.o obj-y += ints_low.o obj-y += init_helpers.o -obj-$(CONFIG_BOOTM) += bootm.o +obj-$(CONFIG_CMD_BOOTM) += bootm.o lib-$(CONFIG_USE_PRIVATE_LIBGCC) += _millicodethunk.o libgcc2.o diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile index b55167e..67275fb 100644 --- a/arch/arm/lib/Makefile +++ b/arch/arm/lib/Makefile @@ -31,7 +31,7 @@ endif obj-$(CONFIG_CPU_V7M) += cmd_boot.o obj-$(CONFIG_OF_LIBFDT) += bootm-fdt.o obj-$(CONFIG_CMD_BOOTI) += bootm.o image.o -obj-$(CONFIG_BOOTM) += bootm.o +obj-$(CONFIG_CMD_BOOTM) += bootm.o obj-$(CONFIG_CMD_BOOTZ) += bootm.o zimage.o else obj-$(CONFIG_$(SPL_TPL_)FRAMEWORK) += spl.o diff --git a/arch/m68k/lib/Makefile b/arch/m68k/lib/Makefile index 5ccd954..6e1fd93 100644 --- a/arch/m68k/lib/Makefile +++ b/arch/m68k/lib/Makefile @@ -8,7 +8,7 @@ lib-$(CONFIG_USE_PRIVATE_LIBGCC) += lshrdi3.o muldi3.o ashldi3.o ashrdi3.o obj-y += bdinfo.o -obj-$(CONFIG_BOOTM) += bootm.o +obj-$(CONFIG_CMD_BOOTM) += bootm.o obj-y += cache.o obj-y += interrupts.o obj-y += time.o diff --git a/arch/microblaze/lib/Makefile b/arch/microblaze/lib/Makefile index 2f23482..dfd8135 100644 --- a/arch/microblaze/lib/Makefile +++ b/arch/microblaze/lib/Makefile @@ -3,6 +3,6 @@ # (C) Copyright 2003-2006 # Wolfgang Denk, DENX Software Engineering, wd@denx.de. -obj-$(CONFIG_BOOTM) += bootm.o +obj-$(CONFIG_CMD_BOOTM) += bootm.o obj-$(CONFIG_CMD_BDI) += bdinfo.o obj-y += muldi3.o diff --git a/arch/mips/lib/Makefile b/arch/mips/lib/Makefile index 4386eb4..1621cc9 100644 --- a/arch/mips/lib/Makefile +++ b/arch/mips/lib/Makefile @@ -10,7 +10,7 @@ obj-y += reloc.o obj-y += stack.o obj-y += traps.o -obj-$(CONFIG_BOOTM) += bootm.o +obj-$(CONFIG_CMD_BOOTM) += bootm.o obj-$(CONFIG_CMD_GO) += boot.o obj-$(CONFIG_SPL_BUILD) += spl.o diff --git a/arch/nios2/lib/Makefile b/arch/nios2/lib/Makefile index 68a5ca0..a9f3c71 100644 --- a/arch/nios2/lib/Makefile +++ b/arch/nios2/lib/Makefile @@ -4,5 +4,5 @@ # Wolfgang Denk, DENX Software Engineering, wd@denx.de. obj-y += cache.o -obj-$(CONFIG_BOOTM) += bootm.o +obj-$(CONFIG_CMD_BOOTM) += bootm.o obj-y += libgcc.o diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile index dcce983..bb819dc 100644 --- a/arch/powerpc/lib/Makefile +++ b/arch/powerpc/lib/Makefile @@ -34,7 +34,7 @@ obj-y += ticks.o endif obj-y += reloc.o -obj-$(CONFIG_BOOTM) += bootm.o +obj-$(CONFIG_CMD_BOOTM) += bootm.o obj-y += cache.o obj-y += extable.o obj-y += interrupts.o diff --git a/arch/riscv/lib/Makefile b/arch/riscv/lib/Makefile index 0b2c88d..9a05b66 100644 --- a/arch/riscv/lib/Makefile +++ b/arch/riscv/lib/Makefile @@ -6,7 +6,7 @@ # Copyright (C) 2017 Andes Technology Corporation # Rick Chen, Andes Technology Corporation <rick@andestech.com> -obj-$(CONFIG_BOOTM) += bootm.o +obj-$(CONFIG_CMD_BOOTM) += bootm.o obj-$(CONFIG_CMD_BOOTI) += bootm.o image.o obj-$(CONFIG_CMD_GO) += boot.o obj-y += cache.o diff --git a/arch/sandbox/lib/Makefile b/arch/sandbox/lib/Makefile index c4924b2..a2bc5a7 100644 --- a/arch/sandbox/lib/Makefile +++ b/arch/sandbox/lib/Makefile @@ -7,5 +7,5 @@ obj-y += fdt_fixup.o interrupts.o sections.o obj-$(CONFIG_PCI) += pci_io.o -obj-$(CONFIG_BOOTM) += bootm.o +obj-$(CONFIG_CMD_BOOTM) += bootm.o obj-$(CONFIG_CMD_BOOTZ) += bootm.o diff --git a/arch/sh/lib/Makefile b/arch/sh/lib/Makefile index 8c3c302..e7520a3 100644 --- a/arch/sh/lib/Makefile +++ b/arch/sh/lib/Makefile @@ -6,7 +6,7 @@ extra-y += start.o obj-y += board.o -obj-$(CONFIG_BOOTM) += bootm.o +obj-$(CONFIG_CMD_BOOTM) += bootm.o obj-y += time.o obj-$(CONFIG_CMD_SH_ZIMAGEBOOT) += zimageboot.o diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile index 94aa335..8fc35e1 100644 --- a/arch/x86/lib/Makefile +++ b/arch/x86/lib/Makefile @@ -16,7 +16,7 @@ obj-$(CONFIG_X86_32BIT_INIT) += string.o endif ifndef CONFIG_SPL_BUILD -obj-$(CONFIG_BOOTM) += bootm.o +obj-$(CONFIG_CMD_BOOTM) += bootm.o endif obj-y += cmd_boot.o obj-$(CONFIG_$(SPL_)COREBOOT_SYSINFO) += coreboot/ diff --git a/arch/x86/lib/spl.c b/arch/x86/lib/spl.c index 4e4cf18..c15f11f 100644 --- a/arch/x86/lib/spl.c +++ b/arch/x86/lib/spl.c @@ -283,7 +283,7 @@ void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image) { int ret; - printf("Jumping to 64-bit U-Boot\n"); + printf("Jumping to 64-bit U-Boot: Note many features are missing\n"); ret = cpu_jump_to_64bit_uboot(spl_image->entry_point); debug("ret=%d\n", ret); hang(); diff --git a/arch/xtensa/lib/Makefile b/arch/xtensa/lib/Makefile index bb9157f..ad4fe32 100644 --- a/arch/xtensa/lib/Makefile +++ b/arch/xtensa/lib/Makefile @@ -3,6 +3,6 @@ # (C) Copyright 2007 - 2013 Tensilica Inc. # (C) Copyright 2014 - 2016 Cadence Design Systems Inc. -obj-$(CONFIG_BOOTM) += bootm.o +obj-$(CONFIG_CMD_BOOTM) += bootm.o obj-y += cache.o misc.o relocate.o time.o diff --git a/boot/Kconfig b/boot/Kconfig index 777e408..d9a6c27 100644 --- a/boot/Kconfig +++ b/boot/Kconfig @@ -2,6 +2,39 @@ menu "Boot options" menu "Boot images" +config ANDROID_BOOT_IMAGE + bool "Android Boot Images" + default y if FASTBOOT + help + This enables support for booting images which use the Android + image format header. + +config TIMESTAMP + bool "Show image date and time when displaying image information" + default y if CMD_DATE + help + When CONFIG_TIMESTAMP is selected, the timestamp (date and time) of + an image is printed by image commands like bootm or iminfo. This + is shown as 'Timestamp: xxx' and 'Created: xxx'. If this option is + enabled, then U-Boot requires FITs to have a timestamp. If a FIT is + loaded that does not, the message 'Wrong FIT format: no timestamp' + is shown. + +config BUTTON_CMD + bool "Support for running a command if a button is held during boot" + depends on CMDLINE + depends on BUTTON + help + For many embedded devices it's useful to enter a special flashing mode + such as fastboot mode when a button is held during boot. This option + allows arbitrary commands to be assigned to specific buttons. These will + be run after "preboot" if the button is held. Configuration is done via + the environment variables "button_cmd_N_name" and "button_cmd_N" where n is + the button number (starting from 0). e.g: + + "button_cmd_0_name=vol_down" + "button_cmd_0=fastboot usb 0" + menuconfig FIT bool "Flattened Image Tree (FIT)" select HASH @@ -688,100 +721,6 @@ config BOOTMETH_SCRIPT endif # BOOTSTD -config BOOTM - bool "Support booting an application image from memory" - default y - help - This is the main boot implementation in U-Boot, supporting a wide - variety of features including FIT and legacy-image boot, kernel and - FDT selection, setting up of the command line for the OS and many - other features. - - This option should normally be enabled. It is used to implement the - 'bootm' command. - -config BOOTM_LINUX - bool "Support booting Linux OS images" - depends on BOOTM || CMD_BOOTZ || CMD_BOOTI - default y - help - Support booting the Linux kernel directly via a command such as bootm - or booti or bootz. - -config BOOTM_NETBSD - bool "Support booting NetBSD (non-EFI) loader images" - depends on BOOTM - default y - help - Support booting NetBSD via the bootm command. - -config BOOTM_OPENRTOS - bool "Support booting OPENRTOS / FreeRTOS images" - depends on BOOTM - help - Support booting OPENRTOS / FreeRTOS via the bootm command. - -config BOOTM_OSE - bool "Support booting Enea OSE images" - depends on (ARM && (ARM64 || CPU_V7A || CPU_V7R) || SANDBOX || PPC || X86) - depends on BOOTM - help - Support booting Enea OSE images via the bootm command. - -config BOOTM_PLAN9 - bool "Support booting Plan9 OS images" - depends on BOOTM - default y - help - Support booting Plan9 images via the bootm command. - -config BOOTM_RTEMS - bool "Support booting RTEMS OS images" - depends on BOOTM - default y - help - Support booting RTEMS images via the bootm command. - -config BOOTM_VXWORKS - bool "Support booting VxWorks OS images" - depends on BOOTM - default y - help - Support booting VxWorks images via the bootm command. - -config ANDROID_BOOT_IMAGE - bool "Android Boot Images" - default y if FASTBOOT - help - This enables support for booting images which use the Android - image format header. - -config TIMESTAMP - bool "Show image date and time when displaying image information" - default y if CMD_DATE - help - When CONFIG_TIMESTAMP is selected, the timestamp (date and time) of - an image is printed by image commands like bootm or iminfo. This - is shown as 'Timestamp: xxx' and 'Created: xxx'. If this option is - enabled, then U-Boot requires FITs to have a timestamp. If a FIT is - loaded that does not, the message 'Wrong FIT format: no timestamp' - is shown. - -config BUTTON_CMD - bool "Support for running a command if a button is held during boot" - depends on CMDLINE - depends on BUTTON - help - For many embedded devices it's useful to enter a special flashing mode - such as fastboot mode when a button is held during boot. This option - allows arbitrary commands to be assigned to specific buttons. These will - be run after "preboot" if the button is held. Configuration is done via - the environment variables "button_cmd_N_name" and "button_cmd_N" where n is - the button number (starting from 0). e.g: - - "button_cmd_0_name=vol_down" - "button_cmd_0=fastboot usb 0" - config LEGACY_IMAGE_FORMAT bool "Enable support for the legacy image format" default y if !FIT_SIGNATURE && !TI_SECURE_DEVICE @@ -826,7 +765,7 @@ endif # MEASURED_BOOT config SYS_BOOTM_LEN hex "Maximum size of a decompresed OS image" - depends on BOOTM || CMD_BOOTI || CMD_BOOTZ || \ + depends on CMD_BOOTM || CMD_BOOTI || CMD_BOOTZ || \ LEGACY_IMAGE_FORMAT || SPL_LEGACY_IMAGE_FORMAT default 0x4000000 if PPC || ARM64 default 0x1000000 if X86 || ARCH_MX6 || ARCH_MX7 diff --git a/boot/Makefile b/boot/Makefile index bf767fd..84ccfea 100644 --- a/boot/Makefile +++ b/boot/Makefile @@ -6,7 +6,7 @@ ifndef CONFIG_SPL_BUILD obj-$(CONFIG_BOOT_RETRY) += bootretry.o -obj-$(CONFIG_BOOTM) += bootm.o bootm_os.o +obj-$(CONFIG_CMD_BOOTM) += bootm.o bootm_os.o obj-$(CONFIG_CMD_BOOTZ) += bootm.o bootm_os.o obj-$(CONFIG_CMD_BOOTI) += bootm.o bootm_os.o diff --git a/boot/pxe_utils.c b/boot/pxe_utils.c index d5e1bea..9620562 100644 --- a/boot/pxe_utils.c +++ b/boot/pxe_utils.c @@ -5,7 +5,6 @@ */ #include <common.h> -#include <bootm.h> #include <command.h> #include <dm.h> #include <env.h> @@ -471,220 +470,6 @@ skip_overlay: #endif /** - * calc_fdt_fname() - Figure out the filename to use for the FDT - * - * Determine the path to the FDT filename, based on the "fdtfile" environment - * variable. Use <soc>-<board>.dtb as a fallback - * - * @fdtdir: Directory to use for the FDT file - * Return: allocated filename (including directory), or NULL if out of memory - */ -static char *calc_fdt_fname(const char *fdtdir) -{ - char *fdtfile; - char *f1, *f2, *f3, *f4, *slash; - int len; - - f1 = env_get("fdtfile"); - if (f1) { - f2 = ""; - f3 = ""; - f4 = ""; - } else { - /* - * For complex cases where this code doesn't generate the - * correct filename, the board code should set $fdtfile during - * early boot, or the boot scripts should set $fdtfile before - * invoking "pxe" or "sysboot". - */ - f1 = env_get("soc"); - f2 = "-"; - f3 = env_get("board"); - f4 = ".dtb"; - if (!f1) { - f1 = ""; - f2 = ""; - } - if (!f3) { - f2 = ""; - f3 = ""; - } - } - - len = strlen(fdtdir); - if (!len) - slash = "./"; - else if (fdtdir[len - 1] != '/') - slash = "/"; - else - slash = ""; - - len = strlen(fdtdir) + strlen(slash) + strlen(f1) + strlen(f2) + - strlen(f3) + strlen(f4) + 1; - fdtfile = malloc(len); - if (!fdtfile) { - printf("malloc fail (FDT filename)\n"); - return NULL; - } - - snprintf(fdtfile, len, "%s%s%s%s%s%s", fdtdir, slash, f1, f2, f3, f4); - - return fdtfile; -} - -/** - * label_run_boot() - Run the correct boot procedure - * - * fdt usage is optional: - * It handles the following scenarios. - * - * Scenario 1: If fdt_addr_r specified and "fdt" or "fdtdir" label is - * defined in pxe file, retrieve fdt blob from server. Pass fdt_addr_r to - * bootm, and adjust argc appropriately. - * - * If retrieve fails and no exact fdt blob is specified in pxe file with - * "fdt" label, try Scenario 2. - * - * Scenario 2: If there is an fdt_addr specified, pass it along to - * bootm, and adjust argc appropriately. - * - * Scenario 3: If there is an fdtcontroladdr specified, pass it along to - * bootm, and adjust argc appropriately, unless the image type is fitImage. - * - * Scenario 4: fdt blob is not available. - * - * @ctx: PXE context - * @label: Label to process - * @kernel_addr: string containing the kernel address / config - * @initrd_str: string containing the initrd address / size - * @initrd_addr_str: initrd address, or NULL if none - * @initrd_filesize: initrd size in bytes; only valid if initrd_addr_str is not - * NULL - * Returns does not return on success, otherwise returns 0 if a localboot - * label was processed, or 1 on error - */ -static int label_run_boot(struct pxe_context *ctx, struct pxe_label *label, - char *kernel_addr, char *initrd_str, - char *initrd_addr_str, char *initrd_filesize) -{ - struct bootm_info bmi; - const char *fdt_addr; - ulong kernel_addr_r; - void *buf; - int ret; - - if (IS_ENABLED(CONFIG_BOOTM)) - bootm_init(&bmi); - - fdt_addr = env_get("fdt_addr_r"); - - /* For FIT, the label can be identical to kernel one */ - if (label->fdt && !strcmp(label->kernel_label, label->fdt)) { - fdt_addr = kernel_addr; - /* if fdt label is defined then get fdt from server */ - } else if (fdt_addr) { - char *fdtfile = NULL; - char *fdtfilefree = NULL; - - if (label->fdt) { - if (IS_ENABLED(CONFIG_SUPPORT_PASSING_ATAGS)) { - if (strcmp("-", label->fdt)) - fdtfile = label->fdt; - } else { - fdtfile = label->fdt; - } - } else if (label->fdtdir) { - fdtfilefree = calc_fdt_fname(label->fdtdir); - if (!fdtfilefree) - return -ENOMEM; - fdtfile = fdtfilefree; - } - - if (fdtfile) { - int err = get_relfile_envaddr(ctx, fdtfile, - "fdt_addr_r", NULL); - - free(fdtfilefree); - if (err < 0) { - fdt_addr = NULL; - - if (label->fdt) { - printf("Skipping %s for failure retrieving FDT\n", - label->name); - return -ENOENT; - } - - if (label->fdtdir) { - printf("Skipping fdtdir %s for failure retrieving dts\n", - label->fdtdir); - } - } - - if (label->kaslrseed) - label_boot_kaslrseed(); - -#ifdef CONFIG_OF_LIBFDT_OVERLAY - if (label->fdtoverlays) - label_boot_fdtoverlay(ctx, label); -#endif - } else { - fdt_addr = NULL; - } - } - - bmi.addr_img = kernel_addr; - - if (initrd_addr_str) - bmi.conf_ramdisk = initrd_str; - - if (!fdt_addr) { - if (IS_ENABLED(CONFIG_SUPPORT_PASSING_ATAGS)) { - if (strcmp("-", label->fdt)) - fdt_addr = env_get("fdt_addr"); - } else { - fdt_addr = env_get("fdt_addr"); - } - } - - kernel_addr_r = genimg_get_kernel_addr(kernel_addr); - buf = map_sysmem(kernel_addr_r, 0); - - if (!fdt_addr && genimg_get_format(buf) != IMAGE_FORMAT_FIT) { - if (IS_ENABLED(CONFIG_SUPPORT_PASSING_ATAGS)) { - if (strcmp("-", label->fdt)) - fdt_addr = env_get("fdtcontroladdr"); - } else { - fdt_addr = env_get("fdtcontroladdr"); - } - } - - bmi.conf_fdt = fdt_addr; - - /* Try bootm for legacy and FIT format image */ - if (genimg_get_format(buf) != IMAGE_FORMAT_INVALID && - IS_ENABLED(CONFIG_BOOTM)) - ret = bootm_run(&bmi); - /* Try booting an AArch64 Linux kernel image */ - else if (IS_ENABLED(CONFIG_BOOTM)) - ret = booti_run(&bmi); - /* Try booting a Image */ - else if (IS_ENABLED(CONFIG_BOOTM)) - ret = bootz_run(&bmi); - /* Try booting an x86_64 Linux kernel image */ - else if (IS_ENABLED(CONFIG_ZBOOT)) - ret = zboot_run(hextoul(kernel_addr, NULL), 0, - initrd_addr_str ? - hextoul(initrd_addr_str, NULL) : 0, - initrd_addr_str ? - hextoul(initrd_filesize, NULL) : 0, - 0, NULL); - - unmap_sysmem(buf); - - return 0; -} - -/** * label_boot() - Boot according to the contents of a pxe_label * * If we can't boot for any reason, we return. A successful boot never @@ -706,6 +491,8 @@ static int label_run_boot(struct pxe_context *ctx, struct pxe_label *label, */ static int label_boot(struct pxe_context *ctx, struct pxe_label *label) { + char *bootm_argv[] = { "bootm", NULL, NULL, NULL, NULL }; + char *zboot_argv[] = { "zboot", NULL, "0", NULL, NULL }; char *kernel_addr = NULL; char *initrd_addr_str = NULL; char initrd_filesize[10]; @@ -713,7 +500,11 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label) char mac_str[29] = ""; char ip_str[68] = ""; char *fit_addr = NULL; - int ret; + int bootm_argc = 2; + int zboot_argc = 3; + int len = 0; + ulong kernel_addr_r; + void *buf; label_print(label); @@ -754,10 +545,9 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label) /* For FIT, the label can be identical to kernel one */ if (label->initrd && !strcmp(label->kernel_label, label->initrd)) { - initrd_addr_str = kernel_addr; + initrd_addr_str = kernel_addr; } else if (label->initrd) { ulong size; - if (get_relfile_envaddr(ctx, label->initrd, "ramdisk_addr_r", &size) < 0) { printf("Skipping %s for failure retrieving initrd\n", @@ -803,7 +593,7 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label) } if (label->append) - strlcpy(bootargs, label->append, sizeof(bootargs)); + strncpy(bootargs, label->append, sizeof(bootargs)); strcat(bootargs, ip_str); strcat(bootargs, mac_str); @@ -814,8 +604,180 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label) printf("append: %s\n", finalbootargs); } - ret = label_run_boot(ctx, label, kernel_addr, initrd_str, - initrd_addr_str, initrd_filesize); + /* + * fdt usage is optional: + * It handles the following scenarios. + * + * Scenario 1: If fdt_addr_r specified and "fdt" or "fdtdir" label is + * defined in pxe file, retrieve fdt blob from server. Pass fdt_addr_r to + * bootm, and adjust argc appropriately. + * + * If retrieve fails and no exact fdt blob is specified in pxe file with + * "fdt" label, try Scenario 2. + * + * Scenario 2: If there is an fdt_addr specified, pass it along to + * bootm, and adjust argc appropriately. + * + * Scenario 3: If there is an fdtcontroladdr specified, pass it along to + * bootm, and adjust argc appropriately, unless the image type is fitImage. + * + * Scenario 4: fdt blob is not available. + */ + bootm_argv[3] = env_get("fdt_addr_r"); + + /* For FIT, the label can be identical to kernel one */ + if (label->fdt && !strcmp(label->kernel_label, label->fdt)) { + bootm_argv[3] = kernel_addr; + /* if fdt label is defined then get fdt from server */ + } else if (bootm_argv[3]) { + char *fdtfile = NULL; + char *fdtfilefree = NULL; + + if (label->fdt) { + if (IS_ENABLED(CONFIG_SUPPORT_PASSING_ATAGS)) { + if (strcmp("-", label->fdt)) + fdtfile = label->fdt; + } else { + fdtfile = label->fdt; + } + } else if (label->fdtdir) { + char *f1, *f2, *f3, *f4, *slash; + + f1 = env_get("fdtfile"); + if (f1) { + f2 = ""; + f3 = ""; + f4 = ""; + } else { + /* + * For complex cases where this code doesn't + * generate the correct filename, the board + * code should set $fdtfile during early boot, + * or the boot scripts should set $fdtfile + * before invoking "pxe" or "sysboot". + */ + f1 = env_get("soc"); + f2 = "-"; + f3 = env_get("board"); + f4 = ".dtb"; + if (!f1) { + f1 = ""; + f2 = ""; + } + if (!f3) { + f2 = ""; + f3 = ""; + } + } + + len = strlen(label->fdtdir); + if (!len) + slash = "./"; + else if (label->fdtdir[len - 1] != '/') + slash = "/"; + else + slash = ""; + + len = strlen(label->fdtdir) + strlen(slash) + + strlen(f1) + strlen(f2) + strlen(f3) + + strlen(f4) + 1; + fdtfilefree = malloc(len); + if (!fdtfilefree) { + printf("malloc fail (FDT filename)\n"); + goto cleanup; + } + + snprintf(fdtfilefree, len, "%s%s%s%s%s%s", + label->fdtdir, slash, f1, f2, f3, f4); + fdtfile = fdtfilefree; + } + + if (fdtfile) { + int err = get_relfile_envaddr(ctx, fdtfile, + "fdt_addr_r", NULL); + + free(fdtfilefree); + if (err < 0) { + bootm_argv[3] = NULL; + + if (label->fdt) { + printf("Skipping %s for failure retrieving FDT\n", + label->name); + goto cleanup; + } + + if (label->fdtdir) { + printf("Skipping fdtdir %s for failure retrieving dts\n", + label->fdtdir); + } + } + + if (label->kaslrseed) + label_boot_kaslrseed(); + +#ifdef CONFIG_OF_LIBFDT_OVERLAY + if (label->fdtoverlays) + label_boot_fdtoverlay(ctx, label); +#endif + } else { + bootm_argv[3] = NULL; + } + } + + bootm_argv[1] = kernel_addr; + zboot_argv[1] = kernel_addr; + + if (initrd_addr_str) { + bootm_argv[2] = initrd_str; + bootm_argc = 3; + + zboot_argv[3] = initrd_addr_str; + zboot_argv[4] = initrd_filesize; + zboot_argc = 5; + } + + if (!bootm_argv[3]) { + if (IS_ENABLED(CONFIG_SUPPORT_PASSING_ATAGS)) { + if (strcmp("-", label->fdt)) + bootm_argv[3] = env_get("fdt_addr"); + } else { + bootm_argv[3] = env_get("fdt_addr"); + } + } + + kernel_addr_r = genimg_get_kernel_addr(kernel_addr); + buf = map_sysmem(kernel_addr_r, 0); + + if (!bootm_argv[3] && genimg_get_format(buf) != IMAGE_FORMAT_FIT) { + if (IS_ENABLED(CONFIG_SUPPORT_PASSING_ATAGS)) { + if (strcmp("-", label->fdt)) + bootm_argv[3] = env_get("fdtcontroladdr"); + } else { + bootm_argv[3] = env_get("fdtcontroladdr"); + } + } + + if (bootm_argv[3]) { + if (!bootm_argv[2]) + bootm_argv[2] = "-"; + bootm_argc = 4; + } + + /* 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); + /* Try booting an AArch64 Linux kernel image */ + else if (IS_ENABLED(CONFIG_CMD_BOOTI)) + do_booti(ctx->cmdtp, 0, bootm_argc, bootm_argv); + /* Try booting a Image */ + else if (IS_ENABLED(CONFIG_CMD_BOOTZ)) + do_bootz(ctx->cmdtp, 0, bootm_argc, bootm_argv); + /* 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); + + unmap_sysmem(buf); cleanup: free(fit_addr); diff --git a/cmd/Kconfig b/cmd/Kconfig index 8eeb99e..126bdee 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -262,7 +262,6 @@ config CMD_BOOTD config CMD_BOOTM bool "bootm" - depends on BOOTM default y help Boot an application image from the memory. @@ -334,6 +333,48 @@ config CMD_BOOTI help Boot an AArch64 Linux Kernel image from memory. +config BOOTM_LINUX + bool "Support booting Linux OS images" + depends on CMD_BOOTM || CMD_BOOTZ || CMD_BOOTI + default y + help + Support booting the Linux kernel directly via a command such as bootm + or booti or bootz. + +config BOOTM_NETBSD + bool "Support booting NetBSD (non-EFI) loader images" + depends on CMD_BOOTM + default y + help + Support booting NetBSD via the bootm command. + +config BOOTM_OPENRTOS + bool "Support booting OPENRTOS / FreeRTOS images" + depends on CMD_BOOTM + help + Support booting OPENRTOS / FreeRTOS via the bootm command. + +config BOOTM_OSE + bool "Support booting Enea OSE images" + depends on (ARM && (ARM64 || CPU_V7A || CPU_V7R) || SANDBOX || PPC || X86) + depends on CMD_BOOTM + help + Support booting Enea OSE images via the bootm command. + +config BOOTM_PLAN9 + bool "Support booting Plan9 OS images" + depends on CMD_BOOTM + default y + help + Support booting Plan9 images via the bootm command. + +config BOOTM_RTEMS + bool "Support booting RTEMS OS images" + depends on CMD_BOOTM + default y + help + Support booting RTEMS images via the bootm command. + config CMD_SEAMA bool "Support read SEAMA NAND images" depends on MTD_RAW_NAND @@ -350,6 +391,13 @@ config CMD_VBE is used to boot. Updating the parameters is not currently supported. +config BOOTM_VXWORKS + bool "Support booting VxWorks OS images" + depends on CMD_BOOTM + default y + help + Support booting VxWorks images via the bootm command. + config CMD_BOOTEFI bool "bootefi" depends on EFI_LOADER diff --git a/cmd/fastboot.c b/cmd/fastboot.c index 792e83d..c3c1923 100644 --- a/cmd/fastboot.c +++ b/cmd/fastboot.c @@ -159,7 +159,7 @@ NXTARG: return CMD_RET_USAGE; } - fastboot_init(buf_addr, buf_size); + fastboot_init((void *)buf_addr, buf_size); if (!strcmp(argv[1], "udp")) return do_fastboot_udp(argc, argv, buf_addr, buf_size); diff --git a/configs/colibri_vf_defconfig b/configs/colibri_vf_defconfig index 0249dc3..a5e6bcb 100644 --- a/configs/colibri_vf_defconfig +++ b/configs/colibri_vf_defconfig @@ -17,7 +17,6 @@ CONFIG_SYS_MEMTEST_END=0x87c00000 CONFIG_ENV_VARS_UBOOT_CONFIG=y CONFIG_HAS_BOARD_SIZE_LIMIT=y CONFIG_BOARD_SIZE_LIMIT=520192 -# CONFIG_BOOTM is not set CONFIG_BOOTDELAY=1 CONFIG_FDT_FIXUP_PARTITIONS=y CONFIG_USE_BOOTCOMMAND=y @@ -34,6 +33,7 @@ CONFIG_HUSH_PARSER=y # CONFIG_SYS_LONGHELP is not set CONFIG_SYS_PROMPT="Colibri VFxx # " # CONFIG_CMD_BOOTD is not set +# CONFIG_CMD_BOOTM is not set CONFIG_CMD_BOOTZ=y # CONFIG_CMD_ELF is not set # CONFIG_CMD_IMI is not set diff --git a/configs/iot_devkit_defconfig b/configs/iot_devkit_defconfig index d02a28a..c492005 100644 --- a/configs/iot_devkit_defconfig +++ b/configs/iot_devkit_defconfig @@ -14,12 +14,12 @@ CONFIG_DEFAULT_DEVICE_TREE="iot_devkit" CONFIG_SYS_CLK_FREQ=16000000 CONFIG_SYS_LOAD_ADDR=0x30000000 CONFIG_LOCALVERSION="-iotdk-1.0" -# CONFIG_BOOTM is not set # CONFIG_ARCH_FIXUP_FDT_MEMORY is not set CONFIG_SYS_CBSIZE=256 CONFIG_SYS_PBSIZE=280 CONFIG_SYS_PROMPT="IoTDK# " # CONFIG_CMD_BOOTD is not set +# CONFIG_CMD_BOOTM is not set # CONFIG_CMD_ELF is not set # CONFIG_CMD_XIMG is not set # CONFIG_CMD_LOADB is not set diff --git a/configs/mx6memcal_defconfig b/configs/mx6memcal_defconfig index 6c5481c..7f11e6f 100644 --- a/configs/mx6memcal_defconfig +++ b/configs/mx6memcal_defconfig @@ -14,7 +14,6 @@ CONFIG_SPL_SERIAL=y CONFIG_SPL=y CONFIG_SYS_MEMTEST_START=0x10000000 CONFIG_SYS_MEMTEST_END=0x20000000 -# CONFIG_BOOTM is not set CONFIG_SUPPORT_RAW_INITRD=y CONFIG_SYS_PBSIZE=528 CONFIG_SPL_SYS_MALLOC=y @@ -22,6 +21,7 @@ CONFIG_SPL_WATCHDOG=y CONFIG_HUSH_PARSER=y CONFIG_SYS_MAXARGS=32 # CONFIG_CMD_BOOTD is not set +# CONFIG_CMD_BOOTM is not set # CONFIG_CMD_ELF is not set # CONFIG_CMD_IMI is not set # CONFIG_CMD_XIMG is not set diff --git a/configs/tools-only_defconfig b/configs/tools-only_defconfig index 5de482a..b54d2ce 100644 --- a/configs/tools-only_defconfig +++ b/configs/tools-only_defconfig @@ -12,10 +12,10 @@ CONFIG_FIT_SIGNATURE=y # CONFIG_BOOTSTD_FULL is not set # CONFIG_BOOTMETH_CROS is not set # CONFIG_BOOTMETH_VBE is not set -# CONFIG_BOOTM is not set CONFIG_USE_BOOTCOMMAND=y CONFIG_BOOTCOMMAND="run distro_bootcmd" # CONFIG_CMD_BOOTD is not set +# CONFIG_CMD_BOOTM is not set # CONFIG_CMD_BOOTI is not set # CONFIG_CMD_ELF is not set # CONFIG_CMD_EXTENSION is not set diff --git a/configs/xilinx_versal_mini_defconfig b/configs/xilinx_versal_mini_defconfig index 143d262..9d3924c 100644 --- a/configs/xilinx_versal_mini_defconfig +++ b/configs/xilinx_versal_mini_defconfig @@ -18,7 +18,6 @@ CONFIG_SYS_MEMTEST_START=0x00000000 CONFIG_SYS_MEMTEST_END=0x00001000 # CONFIG_EXPERT is not set CONFIG_REMAKE_ELF=y -# CONFIG_BOOTM is not set # CONFIG_LEGACY_IMAGE_FORMAT is not set # CONFIG_AUTOBOOT is not set CONFIG_SYS_CBSIZE=1024 @@ -34,6 +33,7 @@ CONFIG_CLOCKS=y CONFIG_SYS_PROMPT="Versal> " # CONFIG_CMD_CONSOLE is not set # CONFIG_CMD_BOOTD is not set +# CONFIG_CMD_BOOTM is not set # CONFIG_CMD_BOOTI is not set # CONFIG_CMD_ELF is not set # CONFIG_CMD_FDT is not set diff --git a/configs/xilinx_versal_mini_emmc0_defconfig b/configs/xilinx_versal_mini_emmc0_defconfig index b0e3462..5c949e3 100644 --- a/configs/xilinx_versal_mini_emmc0_defconfig +++ b/configs/xilinx_versal_mini_emmc0_defconfig @@ -15,7 +15,6 @@ CONFIG_DEFAULT_DEVICE_TREE="versal-mini-emmc0" CONFIG_SYS_LOAD_ADDR=0x8000000 # CONFIG_EXPERT is not set CONFIG_REMAKE_ELF=y -# CONFIG_BOOTM is not set # CONFIG_AUTOBOOT is not set CONFIG_SYS_CBSIZE=1024 CONFIG_SYS_PBSIZE=1049 @@ -31,6 +30,7 @@ CONFIG_SYS_PROMPT="Versal> " # CONFIG_CMD_BDI is not set # CONFIG_CMD_CONSOLE is not set # CONFIG_CMD_BOOTD is not set +# CONFIG_CMD_BOOTM is not set # CONFIG_CMD_BOOTI is not set # CONFIG_CMD_ELF is not set # CONFIG_CMD_FDT is not set diff --git a/configs/xilinx_versal_mini_emmc1_defconfig b/configs/xilinx_versal_mini_emmc1_defconfig index 559b32c..04cba5b 100644 --- a/configs/xilinx_versal_mini_emmc1_defconfig +++ b/configs/xilinx_versal_mini_emmc1_defconfig @@ -15,7 +15,6 @@ CONFIG_DEFAULT_DEVICE_TREE="versal-mini-emmc1" CONFIG_SYS_LOAD_ADDR=0x8000000 # CONFIG_EXPERT is not set CONFIG_REMAKE_ELF=y -# CONFIG_BOOTM is not set # CONFIG_AUTOBOOT is not set CONFIG_SYS_CBSIZE=1024 CONFIG_SYS_PBSIZE=1049 @@ -31,6 +30,7 @@ CONFIG_SYS_PROMPT="Versal> " # CONFIG_CMD_BDI is not set # CONFIG_CMD_CONSOLE is not set # CONFIG_CMD_BOOTD is not set +# CONFIG_CMD_BOOTM is not set # CONFIG_CMD_BOOTI is not set # CONFIG_CMD_ELF is not set # CONFIG_CMD_FDT is not set diff --git a/configs/xilinx_versal_mini_ospi_defconfig b/configs/xilinx_versal_mini_ospi_defconfig index c02c6ba..7a11035 100644 --- a/configs/xilinx_versal_mini_ospi_defconfig +++ b/configs/xilinx_versal_mini_ospi_defconfig @@ -19,7 +19,6 @@ CONFIG_SYS_LOAD_ADDR=0x8000000 CONFIG_LTO=y # CONFIG_EXPERT is not set CONFIG_REMAKE_ELF=y -# CONFIG_BOOTM is not set # CONFIG_AUTOBOOT is not set CONFIG_SYS_CONSOLE_INFO_QUIET=y # CONFIG_DISPLAY_CPUINFO is not set @@ -32,6 +31,7 @@ CONFIG_SYS_PROMPT="Versal> " # CONFIG_CMD_BDI is not set # CONFIG_CMD_CONSOLE is not set # CONFIG_CMD_BOOTD is not set +# CONFIG_CMD_BOOTM is not set # CONFIG_CMD_BOOTI is not set # CONFIG_CMD_ELF is not set # CONFIG_CMD_FDT is not set diff --git a/configs/xilinx_versal_mini_qspi_defconfig b/configs/xilinx_versal_mini_qspi_defconfig index 4d4b59a..58945a1 100644 --- a/configs/xilinx_versal_mini_qspi_defconfig +++ b/configs/xilinx_versal_mini_qspi_defconfig @@ -17,7 +17,6 @@ CONFIG_SYS_LOAD_ADDR=0x8000000 CONFIG_LTO=y # CONFIG_EXPERT is not set CONFIG_REMAKE_ELF=y -# CONFIG_BOOTM is not set # CONFIG_AUTOBOOT is not set # CONFIG_ARCH_FIXUP_FDT_MEMORY is not set CONFIG_LOGLEVEL=0 @@ -33,6 +32,7 @@ CONFIG_SYS_PROMPT="Versal> " # CONFIG_CMD_BDI is not set # CONFIG_CMD_CONSOLE is not set # CONFIG_CMD_BOOTD is not set +# CONFIG_CMD_BOOTM is not set # CONFIG_CMD_BOOTI is not set # CONFIG_CMD_ELF is not set # CONFIG_CMD_FDT is not set diff --git a/configs/xilinx_versal_net_mini_defconfig b/configs/xilinx_versal_net_mini_defconfig index 317fc8e..7dac1ec 100644 --- a/configs/xilinx_versal_net_mini_defconfig +++ b/configs/xilinx_versal_net_mini_defconfig @@ -20,7 +20,6 @@ CONFIG_SYS_MEMTEST_START=0x00000000 CONFIG_SYS_MEMTEST_END=0x00001000 # CONFIG_EXPERT is not set CONFIG_REMAKE_ELF=y -# CONFIG_BOOTM is not set # CONFIG_LEGACY_IMAGE_FORMAT is not set # CONFIG_AUTOBOOT is not set # CONFIG_ARCH_FIXUP_FDT_MEMORY is not set @@ -34,6 +33,7 @@ CONFIG_BOARD_EARLY_INIT_R=y CONFIG_SYS_PROMPT="Versal NET> " # CONFIG_CMD_CONSOLE is not set # CONFIG_CMD_BOOTD is not set +# CONFIG_CMD_BOOTM is not set # CONFIG_CMD_BOOTI is not set # CONFIG_CMD_ELF is not set # CONFIG_CMD_FDT is not set diff --git a/configs/xilinx_versal_net_mini_emmc_defconfig b/configs/xilinx_versal_net_mini_emmc_defconfig index 31c4432..fc88eee 100644 --- a/configs/xilinx_versal_net_mini_emmc_defconfig +++ b/configs/xilinx_versal_net_mini_emmc_defconfig @@ -25,7 +25,7 @@ CONFIG_SYS_PROMPT="Versal NET> " # CONFIG_CMD_BDI is not set # CONFIG_CMD_CONSOLE is not set # CONFIG_CMD_BOOTD is not set -# CONFIG_BOOTM is not set +# CONFIG_CMD_BOOTM is not set # CONFIG_CMD_BOOTI is not set # CONFIG_CMD_ELF is not set # CONFIG_CMD_FDT is not set diff --git a/configs/xilinx_versal_net_mini_ospi_defconfig b/configs/xilinx_versal_net_mini_ospi_defconfig index d0d91f9..d78c9f8 100644 --- a/configs/xilinx_versal_net_mini_ospi_defconfig +++ b/configs/xilinx_versal_net_mini_ospi_defconfig @@ -30,7 +30,7 @@ CONFIG_SYS_PROMPT="Versal NET> " # CONFIG_CMD_BDI is not set # CONFIG_CMD_CONSOLE is not set # CONFIG_CMD_BOOTD is not set -# CONFIG_BOOTM is not set +# CONFIG_CMD_BOOTM is not set # CONFIG_CMD_BOOTI is not set # CONFIG_CMD_ELF is not set # CONFIG_CMD_FDT is not set diff --git a/configs/xilinx_versal_net_mini_qspi_defconfig b/configs/xilinx_versal_net_mini_qspi_defconfig index 48b6d86..b0567f8 100644 --- a/configs/xilinx_versal_net_mini_qspi_defconfig +++ b/configs/xilinx_versal_net_mini_qspi_defconfig @@ -31,7 +31,7 @@ CONFIG_SYS_PROMPT="Versal NET> " # CONFIG_CMD_BDI is not set # CONFIG_CMD_CONSOLE is not set # CONFIG_CMD_BOOTD is not set -# CONFIG_BOOTM is not set +# CONFIG_CMD_BOOTM is not set # CONFIG_CMD_BOOTI is not set # CONFIG_CMD_ELF is not set # CONFIG_CMD_FDT is not set diff --git a/configs/xilinx_zynqmp_mini_defconfig b/configs/xilinx_zynqmp_mini_defconfig index 40d4a4a..7fdd2ee 100644 --- a/configs/xilinx_zynqmp_mini_defconfig +++ b/configs/xilinx_zynqmp_mini_defconfig @@ -13,7 +13,6 @@ CONFIG_SYS_LOAD_ADDR=0x8000000 CONFIG_SYS_MEMTEST_START=0x00000000 CONFIG_SYS_MEMTEST_END=0x00001000 CONFIG_REMAKE_ELF=y -# CONFIG_BOOTM is not set # CONFIG_LEGACY_IMAGE_FORMAT is not set # CONFIG_AUTOBOOT is not set CONFIG_SYS_CBSIZE=1024 @@ -27,6 +26,7 @@ CONFIG_CLOCKS=y # CONFIG_CMD_BDI is not set # CONFIG_CMD_CONSOLE is not set # CONFIG_CMD_BOOTD is not set +# CONFIG_CMD_BOOTM is not set # CONFIG_CMD_BOOTI is not set # CONFIG_CMD_ELF is not set # CONFIG_CMD_FDT is not set diff --git a/configs/xilinx_zynqmp_mini_emmc0_defconfig b/configs/xilinx_zynqmp_mini_emmc0_defconfig index 9cccf5d..bf34832 100644 --- a/configs/xilinx_zynqmp_mini_emmc0_defconfig +++ b/configs/xilinx_zynqmp_mini_emmc0_defconfig @@ -17,7 +17,6 @@ CONFIG_SYS_LOAD_ADDR=0x8000000 CONFIG_REMAKE_ELF=y # CONFIG_MP is not set CONFIG_FIT=y -# CONFIG_BOOTM is not set CONFIG_SUPPORT_RAW_INITRD=y # CONFIG_AUTOBOOT is not set CONFIG_SYS_CBSIZE=1024 @@ -38,6 +37,7 @@ CONFIG_SPL_SYS_MALLOC_SIZE=0x1000000 # CONFIG_CMD_BDI is not set # CONFIG_CMD_CONSOLE is not set # CONFIG_CMD_BOOTD is not set +# CONFIG_CMD_BOOTM is not set # CONFIG_CMD_BOOTI is not set # CONFIG_CMD_ELF is not set # CONFIG_CMD_FDT is not set diff --git a/configs/xilinx_zynqmp_mini_emmc1_defconfig b/configs/xilinx_zynqmp_mini_emmc1_defconfig index 3919e23..af70ccf 100644 --- a/configs/xilinx_zynqmp_mini_emmc1_defconfig +++ b/configs/xilinx_zynqmp_mini_emmc1_defconfig @@ -17,7 +17,6 @@ CONFIG_SYS_LOAD_ADDR=0x8000000 CONFIG_REMAKE_ELF=y # CONFIG_MP is not set CONFIG_FIT=y -# CONFIG_BOOTM is not set CONFIG_SUPPORT_RAW_INITRD=y # CONFIG_AUTOBOOT is not set CONFIG_SYS_CBSIZE=1024 @@ -38,6 +37,7 @@ CONFIG_SPL_SYS_MALLOC_SIZE=0x1000000 # CONFIG_CMD_BDI is not set # CONFIG_CMD_CONSOLE is not set # CONFIG_CMD_BOOTD is not set +# CONFIG_CMD_BOOTM is not set # CONFIG_CMD_BOOTI is not set # CONFIG_CMD_ELF is not set # CONFIG_CMD_FDT is not set diff --git a/configs/xilinx_zynqmp_mini_nand_defconfig b/configs/xilinx_zynqmp_mini_nand_defconfig index ae0c3ae..d2e920f 100644 --- a/configs/xilinx_zynqmp_mini_nand_defconfig +++ b/configs/xilinx_zynqmp_mini_nand_defconfig @@ -13,7 +13,6 @@ CONFIG_SYS_LOAD_ADDR=0x8000000 CONFIG_REMAKE_ELF=y # CONFIG_MP is not set CONFIG_FIT=y -# CONFIG_BOOTM is not set CONFIG_SUPPORT_RAW_INITRD=y # CONFIG_AUTOBOOT is not set CONFIG_SYS_CBSIZE=1024 @@ -28,6 +27,7 @@ CONFIG_CLOCKS=y # CONFIG_CMD_BDI is not set # CONFIG_CMD_CONSOLE is not set # CONFIG_CMD_BOOTD is not set +# CONFIG_CMD_BOOTM is not set # CONFIG_CMD_BOOTI is not set # CONFIG_CMD_GO is not set # CONFIG_CMD_RUN is not set diff --git a/configs/xilinx_zynqmp_mini_nand_single_defconfig b/configs/xilinx_zynqmp_mini_nand_single_defconfig index 15d471c..31f6473 100644 --- a/configs/xilinx_zynqmp_mini_nand_single_defconfig +++ b/configs/xilinx_zynqmp_mini_nand_single_defconfig @@ -13,7 +13,6 @@ CONFIG_SYS_LOAD_ADDR=0x8000000 CONFIG_REMAKE_ELF=y # CONFIG_MP is not set CONFIG_FIT=y -# CONFIG_BOOTM is not set CONFIG_SUPPORT_RAW_INITRD=y # CONFIG_AUTOBOOT is not set CONFIG_SYS_CBSIZE=1024 @@ -28,6 +27,7 @@ CONFIG_CLOCKS=y # CONFIG_CMD_BDI is not set # CONFIG_CMD_CONSOLE is not set # CONFIG_CMD_BOOTD is not set +# CONFIG_CMD_BOOTM is not set # CONFIG_CMD_BOOTI is not set # CONFIG_CMD_GO is not set # CONFIG_CMD_RUN is not set diff --git a/configs/xilinx_zynqmp_mini_qspi_defconfig b/configs/xilinx_zynqmp_mini_qspi_defconfig index 071784c..096feeb 100644 --- a/configs/xilinx_zynqmp_mini_qspi_defconfig +++ b/configs/xilinx_zynqmp_mini_qspi_defconfig @@ -19,7 +19,6 @@ CONFIG_ZYNQMP_NO_DDR=y CONFIG_SYS_LOAD_ADDR=0x8000000 # CONFIG_EXPERT is not set CONFIG_REMAKE_ELF=y -# CONFIG_BOOTM is not set # CONFIG_LEGACY_IMAGE_FORMAT is not set # CONFIG_AUTOBOOT is not set # CONFIG_ARCH_FIXUP_FDT_MEMORY is not set @@ -42,6 +41,7 @@ CONFIG_SPL_SYS_MALLOC_SIZE=0x1000000 # CONFIG_CMD_BDI is not set # CONFIG_CMD_CONSOLE is not set # CONFIG_CMD_BOOTD is not set +# CONFIG_CMD_BOOTM is not set # CONFIG_CMD_BOOTI is not set # CONFIG_CMD_ELF is not set # CONFIG_CMD_FDT is not set diff --git a/configs/zynq_cse_nand_defconfig b/configs/zynq_cse_nand_defconfig index 982777b..0dbc804 100644 --- a/configs/zynq_cse_nand_defconfig +++ b/configs/zynq_cse_nand_defconfig @@ -19,7 +19,6 @@ CONFIG_SYS_LOAD_ADDR=0x0 CONFIG_REMAKE_ELF=y CONFIG_SYS_CUSTOM_LDSCRIPT=y CONFIG_SYS_LDSCRIPT="arch/arm/mach-zynq/u-boot.lds" -# CONFIG_BOOTM is not set # CONFIG_AUTOBOOT is not set CONFIG_USE_PREBOOT=y CONFIG_SYS_CBSIZE=1024 @@ -44,6 +43,7 @@ CONFIG_SYS_MAXARGS=32 # CONFIG_CMD_BDI is not set # CONFIG_CMD_CONSOLE is not set # CONFIG_CMD_BOOTD is not set +# CONFIG_CMD_BOOTM is not set # CONFIG_CMD_ELF is not set # CONFIG_CMD_FDT is not set # CONFIG_CMD_GO is not set diff --git a/configs/zynq_cse_nor_defconfig b/configs/zynq_cse_nor_defconfig index 7d70dae..d95f760 100644 --- a/configs/zynq_cse_nor_defconfig +++ b/configs/zynq_cse_nor_defconfig @@ -19,7 +19,6 @@ CONFIG_SYS_LOAD_ADDR=0x0 CONFIG_REMAKE_ELF=y CONFIG_SYS_CUSTOM_LDSCRIPT=y CONFIG_SYS_LDSCRIPT="arch/arm/mach-zynq/u-boot.lds" -# CONFIG_BOOTM is not set # CONFIG_AUTOBOOT is not set CONFIG_USE_PREBOOT=y CONFIG_SYS_CBSIZE=1024 @@ -44,6 +43,7 @@ CONFIG_SYS_MAXARGS=32 # CONFIG_CMD_BDI is not set # CONFIG_CMD_CONSOLE is not set # CONFIG_CMD_BOOTD is not set +# CONFIG_CMD_BOOTM is not set # CONFIG_CMD_ELF is not set # CONFIG_CMD_FDT is not set # CONFIG_CMD_GO is not set diff --git a/configs/zynq_cse_qspi_defconfig b/configs/zynq_cse_qspi_defconfig index c7477aa..dd7f978 100644 --- a/configs/zynq_cse_qspi_defconfig +++ b/configs/zynq_cse_qspi_defconfig @@ -25,7 +25,6 @@ CONFIG_DEBUG_UART=y CONFIG_REMAKE_ELF=y CONFIG_SYS_CUSTOM_LDSCRIPT=y CONFIG_SYS_LDSCRIPT="arch/arm/mach-zynq/u-boot.lds" -# CONFIG_BOOTM is not set # CONFIG_AUTOBOOT is not set # CONFIG_ARCH_FIXUP_FDT_MEMORY is not set CONFIG_USE_PREBOOT=y @@ -53,6 +52,7 @@ CONFIG_SYS_MAXARGS=32 # CONFIG_CMD_BDI is not set # CONFIG_CMD_CONSOLE is not set # CONFIG_CMD_BOOTD is not set +# CONFIG_CMD_BOOTM is not set # CONFIG_CMD_ELF is not set # CONFIG_CMD_FDT is not set # CONFIG_CMD_GO is not set diff --git a/doc/android/fastboot.rst b/doc/android/fastboot.rst index 9e337ca..05d8f77 100644 --- a/doc/android/fastboot.rst +++ b/doc/android/fastboot.rst @@ -128,7 +128,6 @@ Boot command When executing the fastboot ``boot`` command, if ``fastboot_bootcmd`` is set then that will be executed in place of ``bootm <CONFIG_FASTBOOT_BUF_ADDR>``. -This is supported if CONFIG_CMDLINE is enabled, which it normally is. Partition Names --------------- diff --git a/doc/board/emulation/qemu-x86.rst b/doc/board/emulation/qemu-x86.rst index 4eeba46..c604e42 100644 --- a/doc/board/emulation/qemu-x86.rst +++ b/doc/board/emulation/qemu-x86.rst @@ -134,7 +134,7 @@ The output will be something like this:: U-Boot SPL 2023.07 (Jul 23 2023 - 08:00:12 -0600) Trying to boot from SPI - Jumping to 64-bit U-Boot + Jumping to 64-bit U-Boot: Note many features are missing U-Boot 2023.07 (Jul 23 2023 - 08:00:12 -0600) diff --git a/drivers/fastboot/Kconfig b/drivers/fastboot/Kconfig index d6e2be0..b9e51bd 100644 --- a/drivers/fastboot/Kconfig +++ b/drivers/fastboot/Kconfig @@ -1,4 +1,5 @@ menu "Fastboot support" + depends on CMDLINE config FASTBOOT bool diff --git a/drivers/fastboot/fb_command.c b/drivers/fastboot/fb_command.c index b8782bf..f95f4e4 100644 --- a/drivers/fastboot/fb_command.c +++ b/drivers/fastboot/fb_command.c @@ -11,7 +11,6 @@ #include <fastboot-internal.h> #include <fb_mmc.h> #include <fb_nand.h> -#include <mapmem.h> #include <part.h> #include <stdlib.h> #include <linux/printk.h> @@ -279,7 +278,6 @@ void fastboot_data_download(const void *fastboot_data, { #define BYTES_PER_DOT 0x20000 u32 pre_dot_num, now_dot_num; - void *buf; if (fastboot_data_len == 0 || (fastboot_bytes_received + fastboot_data_len) > @@ -289,10 +287,8 @@ void fastboot_data_download(const void *fastboot_data, return; } /* Download data to fastboot_buf_addr */ - buf = map_sysmem(fastboot_buf_addr, 0); - memcpy(buf + fastboot_bytes_received, + memcpy(fastboot_buf_addr + fastboot_bytes_received, fastboot_data, fastboot_data_len); - unmap_sysmem(buf); pre_dot_num = fastboot_bytes_received / BYTES_PER_DOT; fastboot_bytes_received += fastboot_data_len; @@ -335,16 +331,13 @@ void fastboot_data_complete(char *response) */ static void __maybe_unused flash(char *cmd_parameter, char *response) { - void *buf = map_sysmem(fastboot_buf_addr, 0); - if (IS_ENABLED(CONFIG_FASTBOOT_FLASH_MMC)) - fastboot_mmc_flash_write(cmd_parameter, buf, image_size, - response); + fastboot_mmc_flash_write(cmd_parameter, fastboot_buf_addr, + image_size, response); if (IS_ENABLED(CONFIG_FASTBOOT_FLASH_NAND)) - fastboot_nand_flash_write(cmd_parameter, buf, image_size, - response); - unmap_sysmem(buf); + fastboot_nand_flash_write(cmd_parameter, fastboot_buf_addr, + image_size, response); } /** diff --git a/drivers/fastboot/fb_common.c b/drivers/fastboot/fb_common.c index 5959545..3576b06 100644 --- a/drivers/fastboot/fb_common.c +++ b/drivers/fastboot/fb_common.c @@ -11,7 +11,6 @@ */ #include <bcb.h> -#include <bootm.h> #include <common.h> #include <command.h> #include <env.h> @@ -21,7 +20,7 @@ /** * fastboot_buf_addr - base address of the fastboot download buffer */ -ulong fastboot_buf_addr; +void *fastboot_buf_addr; /** * fastboot_buf_size - size of the fastboot download buffer @@ -143,19 +142,22 @@ void (*fastboot_get_progress_callback(void))(const char *) */ void fastboot_boot(void) { - char *s = NULL; + char *s; - if (IS_ENABLED(CONFIG_CMDLINE)) { - s = env_get("fastboot_bootcmd"); - if (s) - run_command(s, CMD_FLAG_ENV); - } + s = env_get("fastboot_bootcmd"); + if (s) { + run_command(s, CMD_FLAG_ENV); + } else if (IS_ENABLED(CONFIG_CMD_BOOTM)) { + static char boot_addr_start[20]; + static char *const bootm_args[] = { + "bootm", boot_addr_start, NULL + }; - if (!s && IS_ENABLED(CONFIG_BOOTM)) { - int ret; + snprintf(boot_addr_start, sizeof(boot_addr_start) - 1, + "0x%p", fastboot_buf_addr); + printf("Booting kernel at %s...\n\n\n", boot_addr_start); - printf("Booting kernel at %lx...\n\n\n", fastboot_buf_addr); - ret = bootm_boot_start(fastboot_buf_addr, NULL); + do_bootm(NULL, 0, 2, bootm_args); /* * This only happens if image is somehow faulty so we start @@ -212,9 +214,16 @@ void fastboot_set_progress_callback(void (*progress)(const char *msg)) fastboot_progress_callback = progress; } -void fastboot_init(ulong buf_addr, u32 buf_size) +/* + * fastboot_init() - initialise new fastboot protocol session + * + * @buf_addr: Pointer to download buffer, or NULL for default + * @buf_size: Size of download buffer, or zero for default + */ +void fastboot_init(void *buf_addr, u32 buf_size) { - fastboot_buf_addr = buf_addr ? buf_addr : CONFIG_FASTBOOT_BUF_ADDR; + fastboot_buf_addr = buf_addr ? buf_addr : + (void *)CONFIG_FASTBOOT_BUF_ADDR; fastboot_buf_size = buf_size ? buf_size : CONFIG_FASTBOOT_BUF_SIZE; fastboot_set_progress_callback(NULL); } diff --git a/include/bootm.h b/include/bootm.h index 6983375..6116070 100644 --- a/include/bootm.h +++ b/include/bootm.h @@ -317,7 +317,7 @@ void zimage_dump(struct boot_params *base_ptr, bool show_cmdline); * bootm_boot_start() - Boot an image at the given address * * @addr: Image address - * @cmdline: Command line to set, NULL for default + * @cmdline: Command line to set */ int bootm_boot_start(ulong addr, const char *cmdline); diff --git a/include/fastboot-internal.h b/include/fastboot-internal.h index e59c187..610d4f9 100644 --- a/include/fastboot-internal.h +++ b/include/fastboot-internal.h @@ -6,7 +6,7 @@ /** * fastboot_buf_addr - base address of the fastboot download buffer */ -extern ulong fastboot_buf_addr; +extern void *fastboot_buf_addr; /** * fastboot_buf_size - size of the fastboot download buffer diff --git a/include/fastboot.h b/include/fastboot.h index c75184c..1e7920e 100644 --- a/include/fastboot.h +++ b/include/fastboot.h @@ -114,13 +114,13 @@ int fastboot_set_reboot_flag(enum fastboot_reboot_reason reason); */ void fastboot_set_progress_callback(void (*progress)(const char *msg)); -/** +/* * fastboot_init() - initialise new fastboot protocol session * - * @buf_addr: Address of download buffer, or 0 for default + * @buf_addr: Pointer to download buffer, or NULL for default * @buf_size: Size of download buffer, or zero for default */ -void fastboot_init(ulong buf_addr, u32 buf_size); +void fastboot_init(void *buf_addr, u32 buf_size); /** * fastboot_boot() - Execute fastboot boot command |