summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/Kconfig25
-rw-r--r--cmd/bootefi.c1
-rw-r--r--cmd/booti.c7
-rw-r--r--cmd/eficonfig.c5
-rw-r--r--cmd/efidebug.c7
-rw-r--r--cmd/elf.c2
-rw-r--r--cmd/net.c2
-rw-r--r--cmd/pxe.c3
-rw-r--r--cmd/test.c19
-rw-r--r--cmd/tlv_eeprom.c1
-rw-r--r--cmd/ximg.c18
11 files changed, 76 insertions, 14 deletions
diff --git a/cmd/Kconfig b/cmd/Kconfig
index f21d27cb27f..9a70c7a0b83 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
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/booti.c b/cmd/booti.c
index 7e6d9426299..f5ae58139da 100644
--- a/cmd/booti.c
+++ b/cmd/booti.c
@@ -131,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/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/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/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/test.c b/cmd/test.c
index 4774d296487..a9ac07e6143 100644
--- a/cmd/test.c
+++ b/cmd/test.c
@@ -7,6 +7,7 @@
#include <command.h>
#include <fs.h>
#include <log.h>
+#include <slre.h>
#include <vsprintf.h>
#include <linux/string.h>
@@ -27,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;
@@ -50,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,
@@ -142,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/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/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