mirror of
https://github.com/kernelkit/infix.git
synced 2026-08-03 14:23:02 +02:00
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
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user