diff options
Diffstat (limited to 'cmd')
50 files changed, 151 insertions, 28 deletions
diff --git a/cmd/2048.c b/cmd/2048.c index 42cd171b0e4..aa0f82721dc 100644 --- a/cmd/2048.c +++ b/cmd/2048.c @@ -8,6 +8,7 @@ #include <rand.h> #include <vsprintf.h> #include <linux/delay.h> +#include <linux/string.h> #define SIZE 4 static uint score; diff --git a/cmd/Kconfig b/cmd/Kconfig index f21d27cb27f..ed741d43cea 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -1986,6 +1986,7 @@ config BOOTP_PXE_CLIENTARCH config BOOTP_PXE_DHCP_OPTION bool "Request & store 'pxe_configfile' from BOOTP/DHCP server" + default y depends on BOOTP_PXE config BOOTP_VCI_STRING @@ -1996,6 +1997,30 @@ config BOOTP_VCI_STRING default "U-Boot.arm" if ARM default "U-Boot" +config BOOTP_RANDOM_XID + bool "Send random transaction ID to BOOTP/DHCP server" + depends on CMD_BOOTP && (LIB_RAND || LIB_HW_RAND) + help + Selecting this will allow for a random transaction ID to get + selected for each BOOTP/DHCPv4 exchange. + +if CMD_DHCP6 + +config DHCP6_PXE_CLIENTARCH + hex + default 0x16 if ARM64 + default 0x15 if ARM + default 0xFF + +config DHCP6_PXE_DHCP_OPTION + bool "Request & store 'pxe_configfile' from DHCP6 server" + +config DHCP6_ENTERPRISE_ID + int "Enterprise ID to send in DHCPv6 Vendor Class Option" + default 0 + +endif + config CMD_TFTPPUT bool "tftp put" depends on CMD_TFTPBOOT @@ -2153,7 +2178,7 @@ config CMD_TFTPBOOT config CMD_WGET bool "wget" - default y if SANDBOX + default y if SANDBOX || ARCH_QEMU select WGET help wget is a simple command to download kernel, or other files, diff --git a/cmd/abootimg.c b/cmd/abootimg.c index ae7a1a7c83b..44de00fb9c9 100644 --- a/cmd/abootimg.c +++ b/cmd/abootimg.c @@ -6,6 +6,7 @@ #include <android_image.h> #include <command.h> +#include <env.h> #include <image.h> #include <mapmem.h> diff --git a/cmd/adc.c b/cmd/adc.c index 4d3b5b61f6f..334ba7fdeca 100644 --- a/cmd/adc.c +++ b/cmd/adc.c @@ -5,6 +5,7 @@ */ #include <command.h> #include <dm.h> +#include <env.h> #include <adc.h> #include <linux/printk.h> diff --git a/cmd/armflash.c b/cmd/armflash.c index e292cf85c45..cde275c881b 100644 --- a/cmd/armflash.c +++ b/cmd/armflash.c @@ -7,8 +7,10 @@ */ #include <command.h> #include <console.h> +#include <env.h> #include <flash.h> #include <vsprintf.h> +#include <linux/string.h> #include <asm/io.h> #define MAX_REGIONS 4 diff --git a/cmd/bcb.c b/cmd/bcb.c index 16eabfe00f5..d6d944bd6b3 100644 --- a/cmd/bcb.c +++ b/cmd/bcb.c @@ -8,6 +8,7 @@ #include <android_bootloader_message.h> #include <bcb.h> #include <command.h> +#include <env.h> #include <android_ab.h> #include <display_options.h> #include <log.h> diff --git a/cmd/blkmap.c b/cmd/blkmap.c index 86a123b1cd3..65edec899e2 100644 --- a/cmd/blkmap.c +++ b/cmd/blkmap.c @@ -7,6 +7,7 @@ #include <blk.h> #include <blkmap.h> #include <command.h> +#include <env.h> #include <malloc.h> #include <dm/device.h> diff --git a/cmd/bootefi.c b/cmd/bootefi.c index cea6d356ee6..8e8752127ed 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -9,6 +9,7 @@ #include <command.h> #include <efi.h> +#include <efi_device_path.h> #include <efi_loader.h> #include <exports.h> #include <log.h> diff --git a/cmd/bootflow.c b/cmd/bootflow.c index a1fd59a69f4..551dffbb8b8 100644 --- a/cmd/bootflow.c +++ b/cmd/bootflow.c @@ -13,6 +13,9 @@ #include <command.h> #include <console.h> #include <dm.h> +#include <env.h> +#include <expo.h> +#include <log.h> #include <mapmem.h> /** @@ -104,24 +107,39 @@ __maybe_unused static int bootflow_handle_menu(struct bootstd_priv *std, bool text_mode, struct bootflow **bflowp) { + struct expo *exp; struct bootflow *bflow; - int ret; + int ret, seq; - ret = bootflow_menu_run(std, text_mode, &bflow); - if (ret) { - if (ret == -EAGAIN) { - printf("Nothing chosen\n"); - std->cur_bootflow = NULL; - } else { - printf("Menu failed (err=%d)\n", ret); + ret = bootflow_menu_start(std, text_mode, &exp); + if (ret) + return log_msg_ret("bhs", ret); + + ret = -ERESTART; + do { + if (ret == -ERESTART) { + ret = expo_render(exp); + if (ret) + return log_msg_ret("bhr", ret); } + ret = bootflow_menu_poll(exp, &seq); + } while (ret == -EAGAIN || ret == -ERESTART); - return ret; + if (ret == -EPIPE) { + printf("Nothing chosen\n"); + std->cur_bootflow = NULL; + } else if (ret) { + printf("Menu failed (err=%d)\n", ret); + } else { + bflow = alist_getw(&std->bootflows, seq, struct bootflow); + printf("Selected: %s\n", bflow->os_name ? bflow->os_name : + bflow->name); + std->cur_bootflow = bflow; + *bflowp = bflow; } - - printf("Selected: %s\n", bflow->os_name ? bflow->os_name : bflow->name); - std->cur_bootflow = bflow; - *bflowp = bflow; + expo_destroy(exp); + if (ret) + return ret; return 0; } diff --git a/cmd/booti.c b/cmd/booti.c index 1a57fe91397..f5ae58139da 100644 --- a/cmd/booti.c +++ b/cmd/booti.c @@ -6,6 +6,7 @@ #include <bootm.h> #include <command.h> +#include <env.h> #include <image.h> #include <irq_func.h> #include <lmb.h> @@ -130,8 +131,11 @@ int do_booti(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) bootm_disable_interrupts(); images.os.os = IH_OS_LINUX; - if (IS_ENABLED(CONFIG_RISCV_SMODE)) - images.os.arch = IH_ARCH_RISCV; + if (IS_ENABLED(CONFIG_RISCV)) + if (IS_ENABLED(CONFIG_64BIT)) + images.os.arch = IH_ARCH_RISCV64; + else + images.os.arch = IH_ARCH_RISCV; else if (IS_ENABLED(CONFIG_ARM64)) images.os.arch = IH_ARCH_ARM64; diff --git a/cmd/bootmeth.c b/cmd/bootmeth.c index 2f41fa1bec6..ea4b3f47db8 100644 --- a/cmd/bootmeth.c +++ b/cmd/bootmeth.c @@ -11,6 +11,7 @@ #include <bootstd.h> #include <command.h> #include <dm.h> +#include <env.h> #include <malloc.h> #include <dm/uclass-internal.h> diff --git a/cmd/bootstage.c b/cmd/bootstage.c index 8248c41ca82..5c6d5a3ab45 100644 --- a/cmd/bootstage.c +++ b/cmd/bootstage.c @@ -6,6 +6,7 @@ #include <bootstage.h> #include <command.h> #include <vsprintf.h> +#include <linux/string.h> static int do_bootstage_report(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) diff --git a/cmd/broadcom/nitro_image_load.c b/cmd/broadcom/nitro_image_load.c index 289b184e9af..fe08679840e 100644 --- a/cmd/broadcom/nitro_image_load.c +++ b/cmd/broadcom/nitro_image_load.c @@ -4,6 +4,7 @@ */ #include <command.h> +#include <env.h> #include <vsprintf.h> #define FW_IMAGE_SIG 0xff123456 diff --git a/cmd/cache.c b/cmd/cache.c index 3049f5c305f..b7007877ab0 100644 --- a/cmd/cache.c +++ b/cmd/cache.c @@ -10,6 +10,7 @@ #include <command.h> #include <cpu_func.h> #include <linux/compiler.h> +#include <linux/string.h> static int parse_argv(const char *); diff --git a/cmd/cedit.c b/cmd/cedit.c index f696356419e..20f48ae0007 100644 --- a/cmd/cedit.c +++ b/cmd/cedit.c @@ -287,6 +287,8 @@ static int do_cedit_run(struct cmd_tbl *cmdtp, int flag, int argc, log_err("Failed (err=%dE)\n", ret); return CMD_RET_FAILURE; } + expo_destroy(cur_exp); + cur_exp = NULL; return 0; } diff --git a/cmd/diag.c b/cmd/diag.c index c6da5aae3fc..4a88ab00a07 100644 --- a/cmd/diag.c +++ b/cmd/diag.c @@ -9,6 +9,7 @@ */ #include <command.h> #include <post.h> +#include <linux/string.h> int do_diag(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { @@ -9,6 +9,7 @@ #include <command.h> #include <dm/root.h> #include <dm/util.h> +#include <linux/string.h> static int do_dm_dump_driver_compat(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[]) diff --git a/cmd/echo.c b/cmd/echo.c index 973213a03a6..d1346504cfb 100644 --- a/cmd/echo.c +++ b/cmd/echo.c @@ -5,6 +5,7 @@ */ #include <command.h> +#include <linux/string.h> static int do_echo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) diff --git a/cmd/eficonfig.c b/cmd/eficonfig.c index 629bf1b82c7..6e14d34a6bd 100644 --- a/cmd/eficonfig.c +++ b/cmd/eficonfig.c @@ -8,6 +8,7 @@ #include <ansi.h> #include <cli.h> #include <charset.h> +#include <efi_device_path.h> #include <efi_loader.h> #include <efi_load_initrd.h> #include <efi_config.h> @@ -514,7 +515,7 @@ struct efi_device_path *eficonfig_create_device_path(struct efi_device_path *dp_ struct efi_device_path_file_path *fp; fp_size = sizeof(struct efi_device_path) + u16_strsize(current_path); - buf = calloc(1, fp_size + sizeof(END)); + buf = calloc(1, fp_size + sizeof(EFI_DP_END)); if (!buf) return NULL; @@ -526,7 +527,7 @@ struct efi_device_path *eficonfig_create_device_path(struct efi_device_path *dp_ p = buf; p += fp_size; - *((struct efi_device_path *)p) = END; + *((struct efi_device_path *)p) = EFI_DP_END; dp = efi_dp_shorten(dp_volume); if (!dp) diff --git a/cmd/efidebug.c b/cmd/efidebug.c index 2461425e291..109496d9e95 100644 --- a/cmd/efidebug.c +++ b/cmd/efidebug.c @@ -8,6 +8,7 @@ #include <charset.h> #include <command.h> #include <dm/device.h> +#include <efi_device_path.h> #include <efi_dt_fixup.h> #include <efi_load_initrd.h> #include <efi_loader.h> @@ -812,7 +813,7 @@ static int efi_boot_add_uri(int argc, char *const argv[], u16 *var_name16, lo->label = label; uridp_len = sizeof(struct efi_device_path) + strlen(argv[3]) + 1; - uridp = efi_alloc(uridp_len + sizeof(END)); + uridp = efi_alloc(uridp_len + sizeof(EFI_DP_END)); if (!uridp) { log_err("Out of memory\n"); return CMD_RET_FAILURE; @@ -822,10 +823,10 @@ static int efi_boot_add_uri(int argc, char *const argv[], u16 *var_name16, uridp->dp.length = uridp_len; strcpy(uridp->uri, argv[3]); pos = (char *)uridp + uridp_len; - memcpy(pos, &END, sizeof(END)); + memcpy(pos, &EFI_DP_END, sizeof(EFI_DP_END)); *file_path = &uridp->dp; - *fp_size += uridp_len + sizeof(END); + *fp_size += uridp_len + sizeof(EFI_DP_END); return CMD_RET_SUCCESS; } diff --git a/cmd/elf.c b/cmd/elf.c index 6b49c613703..5e0ee30a7c8 100644 --- a/cmd/elf.c +++ b/cmd/elf.c @@ -247,7 +247,7 @@ int do_bootvx(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) ptr += sprintf(build_buf + ptr, "e=%s", tmp); tmp = env_get("netmask"); if (tmp) { - u32 mask = env_get_ip("netmask").s_addr; + u32 mask = string_to_ip(tmp).s_addr; ptr += sprintf(build_buf + ptr, ":%08x ", ntohl(mask)); } else { diff --git a/cmd/extension_board.c b/cmd/extension_board.c index 6c14d0ddebd..317b260bf36 100644 --- a/cmd/extension_board.c +++ b/cmd/extension_board.c @@ -7,6 +7,7 @@ #include <bootdev.h> #include <command.h> #include <dm.h> +#include <env.h> #include <malloc.h> #include <extension_board.h> #include <mapmem.h> diff --git a/cmd/flash.c b/cmd/flash.c index fd660ec477c..76aa387ba59 100644 --- a/cmd/flash.c +++ b/cmd/flash.c @@ -10,6 +10,7 @@ #include <command.h> #include <log.h> #include <vsprintf.h> +#include <linux/string.h> #include <u-boot/uuid.h> #if defined(CONFIG_CMD_MTDPARTS) diff --git a/cmd/fuse.c b/cmd/fuse.c index 6c42c096809..e2206cdf0d5 100644 --- a/cmd/fuse.c +++ b/cmd/fuse.c @@ -14,6 +14,7 @@ #include <mapmem.h> #include <vsprintf.h> #include <linux/errno.h> +#include <linux/string.h> static int confirm_prog(void) { diff --git a/cmd/hash.c b/cmd/hash.c index 5b40982b098..96d0e443a5b 100644 --- a/cmd/hash.c +++ b/cmd/hash.c @@ -10,6 +10,7 @@ */ #include <command.h> +#include <env.h> #include <hash.h> #include <linux/ctype.h> diff --git a/cmd/irq.c b/cmd/irq.c index da223b4b2cc..58483d04de8 100644 --- a/cmd/irq.c +++ b/cmd/irq.c @@ -6,6 +6,7 @@ #include <config.h> #include <command.h> #include <irq_func.h> +#include <linux/string.h> static int do_interrupts(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) diff --git a/cmd/legacy_led.c b/cmd/legacy_led.c index 50de7e89d8f..db312ae6e2d 100644 --- a/cmd/legacy_led.c +++ b/cmd/legacy_led.c @@ -12,6 +12,7 @@ #include <command.h> #include <status_led.h> #include <vsprintf.h> +#include <linux/string.h> struct led_tbl_s { char *string; /* String for use in the command */ diff --git a/cmd/mbr.c b/cmd/mbr.c index 7e1f92a13bb..7fe6c9e103a 100644 --- a/cmd/mbr.c +++ b/cmd/mbr.c @@ -10,6 +10,7 @@ #include <blk.h> #include <command.h> +#include <env.h> #include <malloc.h> #include <part.h> #include <vsprintf.h> diff --git a/cmd/mem.c b/cmd/mem.c index 9e716776393..b8afe62e474 100644 --- a/cmd/mem.c +++ b/cmd/mem.c @@ -14,8 +14,10 @@ #include <bootretry.h> #include <cli.h> #include <command.h> +#include <compiler.h> #include <console.h> #include <display_options.h> +#include <env.h> #ifdef CONFIG_MTD_NOR_FLASH #include <flash.h> #endif diff --git a/cmd/mmc.c b/cmd/mmc.c index fe7899ec793..5340a58be8e 100644 --- a/cmd/mmc.c +++ b/cmd/mmc.c @@ -8,6 +8,7 @@ #include <command.h> #include <console.h> #include <display_options.h> +#include <env.h> #include <mapmem.h> #include <memalign.h> #include <mmc.h> @@ -6,6 +6,7 @@ #include <command.h> #include <cpu_func.h> #include <vsprintf.h> +#include <linux/string.h> static int cpu_status_all(void) { diff --git a/cmd/net.c b/cmd/net.c index eaa1de5295f..886735ea14f 100644 --- a/cmd/net.c +++ b/cmd/net.c @@ -564,7 +564,7 @@ int do_sntp(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) char *toff; if (argc < 2) { - net_ntp_server = env_get_ip("ntpserverip"); + net_ntp_server = string_to_ip(env_get("ntpserverip")); if (net_ntp_server.s_addr == 0) { printf("ntpserverip not set\n"); return CMD_RET_FAILURE; diff --git a/cmd/optee.c b/cmd/optee.c index e3aae5e9f9b..155c9f1bb73 100644 --- a/cmd/optee.c +++ b/cmd/optee.c @@ -6,6 +6,7 @@ #include <errno.h> #include <tee.h> #include <vsprintf.h> +#include <linux/string.h> #define TA_HELLO_WORLD_CMD_INC_VALUE 0 /* This needs to match the UUID of the Hello World TA. */ diff --git a/cmd/pxe.c b/cmd/pxe.c index 0f26b3b4219..3deae5e6d47 100644 --- a/cmd/pxe.c +++ b/cmd/pxe.c @@ -5,6 +5,7 @@ */ #include <command.h> +#include <env.h> #include <fs.h> #include <net.h> #include <net6.h> @@ -64,6 +65,8 @@ static int pxe_dhcp_option_path(struct pxe_context *ctx, unsigned long pxefile_a int ret = get_pxe_file(ctx, pxelinux_configfile, pxefile_addr_r); free(pxelinux_configfile); + /* set to NULL to avoid double-free if DHCP is tried again */ + pxelinux_configfile = NULL; return ret; } diff --git a/cmd/sandbox/exception.c b/cmd/sandbox/exception.c index f9c847d8ff2..e015acf60e2 100644 --- a/cmd/sandbox/exception.c +++ b/cmd/sandbox/exception.c @@ -6,6 +6,7 @@ */ #include <command.h> +#include <env.h> static int do_sigsegv(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) diff --git a/cmd/seama.c b/cmd/seama.c index 3c8e8199234..d6287978090 100644 --- a/cmd/seama.c +++ b/cmd/seama.c @@ -5,6 +5,7 @@ */ #include <command.h> +#include <env.h> #include <nand.h> /* diff --git a/cmd/sha1sum.c b/cmd/sha1sum.c index 52aa26c78d2..f2757146bba 100644 --- a/cmd/sha1sum.c +++ b/cmd/sha1sum.c @@ -9,6 +9,7 @@ #include <command.h> #include <hash.h> +#include <linux/string.h> #include <u-boot/sha1.h> int do_sha1sum(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) diff --git a/cmd/sleep.c b/cmd/sleep.c index 7616fed7556..a8c896e0c5e 100644 --- a/cmd/sleep.c +++ b/cmd/sleep.c @@ -9,6 +9,7 @@ #include <time.h> #include <vsprintf.h> #include <linux/delay.h> +#include <linux/string.h> static int do_sleep(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) diff --git a/cmd/smccc.c b/cmd/smccc.c index 3a4d885e37e..fa04bb05ca4 100644 --- a/cmd/smccc.c +++ b/cmd/smccc.c @@ -9,6 +9,7 @@ #include <linux/arm-smccc.h> #include <linux/compiler.h> #include <linux/psci.h> +#include <linux/string.h> static int do_call(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) diff --git a/cmd/spawn.c b/cmd/spawn.c index 37737b8627c..8829aa9728d 100644 --- a/cmd/spawn.c +++ b/cmd/spawn.c @@ -5,6 +5,7 @@ #include <command.h> #include <console.h> +#include <env.h> #include <malloc.h> #include <vsprintf.h> #include <uthread.h> diff --git a/cmd/stackprot_test.c b/cmd/stackprot_test.c index e7ff4a06158..78e9beba5bf 100644 --- a/cmd/stackprot_test.c +++ b/cmd/stackprot_test.c @@ -4,6 +4,7 @@ */ #include <command.h> +#include <linux/string.h> static int do_test_stackprot_fail(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) diff --git a/cmd/strings.c b/cmd/strings.c index 5bcb0f2b567..beac2a6e6b3 100644 --- a/cmd/strings.c +++ b/cmd/strings.c @@ -9,6 +9,7 @@ #include <config.h> #include <command.h> #include <vsprintf.h> +#include <linux/string.h> static char *start_addr, *last_addr; diff --git a/cmd/test.c b/cmd/test.c index b4c3eabf9f6..a9ac07e6143 100644 --- a/cmd/test.c +++ b/cmd/test.c @@ -7,7 +7,9 @@ #include <command.h> #include <fs.h> #include <log.h> +#include <slre.h> #include <vsprintf.h> +#include <linux/string.h> #define OP_INVALID 0 #define OP_NOT 1 @@ -26,6 +28,7 @@ #define OP_INT_GT 14 #define OP_INT_GE 15 #define OP_FILE_EXISTS 16 +#define OP_REGEX 17 const struct { int arg; @@ -49,6 +52,9 @@ const struct { {0, "-z", OP_STR_EMPTY, 2}, {0, "-n", OP_STR_NEMPTY, 2}, {0, "-e", OP_FILE_EXISTS, 4}, +#ifdef CONFIG_REGEX + {1, "=~", OP_REGEX, 3}, +#endif }; static int do_test(struct cmd_tbl *cmdtp, int flag, int argc, @@ -141,6 +147,20 @@ static int do_test(struct cmd_tbl *cmdtp, int flag, int argc, case OP_FILE_EXISTS: expr = file_exists(ap[1], ap[2], ap[3], FS_TYPE_ANY); break; +#ifdef CONFIG_REGEX + case OP_REGEX: { + struct slre slre; + + if (slre_compile(&slre, ap[2]) == 0) { + printf("Error compiling regex: %s\n", slre.err_str); + expr = 0; + break; + } + + expr = slre_match(&slre, ap[0], strlen(ap[0]), NULL); + break; + } +#endif } switch (op) { diff --git a/cmd/timer.c b/cmd/timer.c index 04fcd84ac6a..427309e108d 100644 --- a/cmd/timer.c +++ b/cmd/timer.c @@ -6,6 +6,7 @@ #include <command.h> #include <time.h> +#include <linux/string.h> static int do_timer(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) diff --git a/cmd/tlv_eeprom.c b/cmd/tlv_eeprom.c index 0aec7521770..d7c229e5441 100644 --- a/cmd/tlv_eeprom.c +++ b/cmd/tlv_eeprom.c @@ -476,6 +476,7 @@ int do_tlv_eeprom(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) printf("EEPROM data loaded from device to memory.\n"); has_been_read = 1; + return 0; } // Subsequent commands require that the EEPROM has already been read. diff --git a/cmd/ufs.c b/cmd/ufs.c index 6e21fbb1685..790dab50f18 100644 --- a/cmd/ufs.c +++ b/cmd/ufs.c @@ -8,6 +8,7 @@ #include <command.h> #include <ufs.h> #include <vsprintf.h> +#include <linux/string.h> static int do_ufs(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { diff --git a/cmd/upl.c b/cmd/upl.c index c9a823bbc06..ef2183d8528 100644 --- a/cmd/upl.c +++ b/cmd/upl.c @@ -12,6 +12,7 @@ #include <alist.h> #include <command.h> #include <display_options.h> +#include <env.h> #include <mapmem.h> #include <string.h> #include <upl.h> diff --git a/cmd/x86/mtrr.c b/cmd/x86/mtrr.c index 289865515ef..91130453039 100644 --- a/cmd/x86/mtrr.c +++ b/cmd/x86/mtrr.c @@ -6,6 +6,7 @@ #include <command.h> #include <log.h> #include <vsprintf.h> +#include <linux/string.h> #include <asm/msr.h> #include <asm/mp.h> #include <asm/mtrr.h> diff --git a/cmd/x86/zboot.c b/cmd/x86/zboot.c index 94e602b8a5b..3876d163236 100644 --- a/cmd/x86/zboot.c +++ b/cmd/x86/zboot.c @@ -8,6 +8,7 @@ #define LOG_CATEGORY LOGC_BOOT #include <command.h> +#include <env.h> #include <mapmem.h> #include <vsprintf.h> #include <asm/zimage.h> diff --git a/cmd/ximg.c b/cmd/ximg.c index 29d7c3279b3..e97167a79cc 100644 --- a/cmd/ximg.c +++ b/cmd/ximg.c @@ -27,6 +27,7 @@ #include <asm/byteorder.h> #include <asm/cache.h> #include <asm/io.h> +#include <u-boot/zlib.h> static int do_imgextract(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) @@ -206,11 +207,18 @@ do_imgextract(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) break; #ifdef CONFIG_GZIP case IH_COMP_GZIP: - printf(" Uncompressing part %d ... ", part); - if (gunzip((void *) dest, unc_len, - (uchar *) data, &len) != 0) { - puts("GUNZIP ERROR - image not loaded\n"); - return 1; + { + int ret = 0; + printf(" Uncompressing part %d ... ", part); + ret = gunzip((void *)dest, unc_len, + (uchar *)data, &len); + if (ret == Z_BUF_ERROR) { + puts("Image too large: increase CONFIG_SYS_XIMG_LEN\n"); + return 1; + } else if (ret != 0) { + puts("GUNZIP ERROR - image not loaded\n"); + return 1; + } } break; #endif |