From 563b4a743be9f0a22416446f9acb50925e09065d Mon Sep 17 00:00:00 2001 From: Tobias Waldekranz Date: Thu, 17 Oct 2024 15:11:12 +0200 Subject: [PATCH 1/2] uboot: Settle for only ipaddr being set to skip DHCP This puts the responsibility on the user to set the appropriate static parameters. On the plus side, we avoid requiring redundant information when the `proto://path` format is used in `bootfile` --- board/common/uboot/scripts/ixprepdhcp.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/board/common/uboot/scripts/ixprepdhcp.sh b/board/common/uboot/scripts/ixprepdhcp.sh index 935a1a84..4d89d543 100644 --- a/board/common/uboot/scripts/ixprepdhcp.sh +++ b/board/common/uboot/scripts/ixprepdhcp.sh @@ -1,6 +1,6 @@ setenv autoload no -if test -n "${ipaddr}" -a -n "${netmask}" -a -n "${serverip}" -a -n "${bootfile}" || dhcp; then +if test -n "${ipaddr}" || dhcp; then setenv proto tftp setenv dltool tftpboot From c1dfdd92b073113065bc77042b6c302379aba51d Mon Sep 17 00:00:00 2001 From: Tobias Waldekranz Date: Thu, 17 Oct 2024 15:13:49 +0200 Subject: [PATCH 2/2] uboot: Fix repeated calls to boot_net in combination with HTTP Previously, when the `proto://path` format of `bootfile` was used, the transformed argument sent to either tftp or wget would also be stored in `bootfile` overriding the original value set by the user. If the first boot attempt failed for some reason, the protocol information was stripped from `bootfile` and the second attempt would then default to TFTP, even if the user had originally specified `http://...`. Therefore, store the transformed value in a separate variable. For some reason, setexpr's parsing of regex escapes changes when this mode is used, so we need double backslashes to fetch match groups instead of 1. Yikes. Fixes #724 --- board/common/uboot/scripts/ixprepdhcp.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/board/common/uboot/scripts/ixprepdhcp.sh b/board/common/uboot/scripts/ixprepdhcp.sh index 4d89d543..93e6c97a 100644 --- a/board/common/uboot/scripts/ixprepdhcp.sh +++ b/board/common/uboot/scripts/ixprepdhcp.sh @@ -3,17 +3,18 @@ setenv autoload no if test -n "${ipaddr}" || dhcp; then setenv proto tftp setenv dltool tftpboot + setenv dlfile "${bootfile}" if setexpr proto sub "^(http|tftp)://.*" "\\1" "${bootfile}"; then if test "${proto}" = "http"; then setenv dltool wget - setexpr bootfile sub "^http://([^/]+?)/(.*)" "\1:/\2" + setexpr dlfile sub "^http://([^/]+?)/(.*)" "\\1:/\\2" "${bootfile}" else - setexpr bootfile sub "^tftp://([^/]+?)/(.*)" "\1:\2" + setexpr dlfile sub "^tftp://([^/]+?)/(.*)" "\\1:\\2" "${bootfile}" fi fi - if ${dltool} ${ramdisk_addr_r} "${bootfile}"; then + if ${dltool} ${ramdisk_addr_r} "${dlfile}"; then setenv old_fdt_addr ${fdt_addr} if fdt addr ${ramdisk_addr_r}; then fdt get value sqoffs /images/rootfs data-position