distro_boot: Fix bootfile env after calling boot_extlinux
PATCH 1/1 distro_boot: Fix bootfile env after calling boot_extlinux
Problem
PXE cannot boot normally after Sysboot changed the bootfile env (called from boot_extlinux) from the default "boot.scr.uimg" to "/boot/extlinux/extlinux.conf".
In addition, an unbootable extlinux configuration will also make the PXE boot unbootable, because it will use the incorrect path "/boot/extlinux/" from the bootfile env.
Solution
Save and restore default bootfile env value when boot_extlinux is used.
Example
================================================================
Hit SPACE in 2 seconds to stop autoboot
... is now current device
Found /boot/extlinux/extlinux.conf
Retrieving file: /boot/extlinux/extlinux.conf
413 bytes read in 2 ms (201.2 KiB/s)
Skipping Krescue for failure retrieving kernel
SCRIPT FAILED: continuing...
...
Speed: 1000, full duplex
BOOTP broadcast 1
DHCP client bound to address 192.168.11.151 (8 ms) Using ethernet@ff3f0000 device
TFTP from server 192.168.11.1; our IP address is 192.168.11.151 Filename '/boot/extlinux/pxelinux.cfg/default'.
Not retrying...
================================================================
--- include/config_distro_bootcmd.h | 2 ++ 1 file changed, 2 insertions(+)
include/config_distro_bootcmd.h +2 -0
@@ -445,7 +445,9 @@"${devnum}:${distro_bootpart} " \"${prefix}${boot_syslinux_conf}; then " \"echo Found ${prefix}${boot_syslinux_conf}; " \ +"bootfile_bak=${bootfile}; " \"run boot_extlinux; " \ +"setenv bootfile ${bootfile_bak}; " \"echo SCRIPT FAILED: continuing...; " \"fi\0" \ \
Signature · 1 line
2.25.1
Quoted 43 lines · Artem Lapkin
Problem
PXE cannot boot normally after Sysboot changed the bootfile env (called from
boot_extlinux) from the default "boot.scr.uimg" to "/boot/extlinux/extlinux.conf".In addition, an unbootable extlinux configuration will also make the PXE boot unbootable, because it will use the incorrect path "
/boot/extlinux/" from the bootfile env.Solution
Save and restore default bootfile env value when
boot_extlinuxis used.Example
================================================================
Hit SPACE in 2 seconds to stop autoboot
... is now current device
Found/boot/extlinux/extlinux.conf
Retrieving file:/boot/extlinux/extlinux.conf
413 bytes read in 2 ms (201.2 KiB/s)
Skipping Krescue for failure retrieving kernel
SCRIPT FAILED: continuing...
...
Speed: 1000, full duplex
BOOTP broadcast 1
DHCP client bound to address 192.168.11.151 (8 ms) Using ethernet@ff3f0000 device
TFTP from server 192.168.11.1; our IP address is 192.168.11.151 Filename '/boot/extlinux/pxelinux.cfg/default'.
Not retrying...
================================================================Signed-off-by Artem Lapkin <[email protected]>--- include/config_distro_bootcmd.h | 2 ++ 1 file changed, 2 insertions(+)include/config_distro_bootcmd.h +0
-0
include/config_distro_bootcmd.h line 453
Quoted 9 lines
include/config_distro_bootcmd.h +2
-0@@ -445,7 +445,9 @@"${devnum}:${distro_bootpart} " \"${prefix}${boot_syslinux_conf}; then " \"echo Found ${prefix}${boot_syslinux_conf}; " \ +"bootfile_bak=${bootfile}; " \"run boot_extlinux; " \ +"setenv bootfile ${bootfile_bak}; " \"echo SCRIPT FAILED: continuing...; " \"fi\0" \ \
We've had this kind of problem before, and the answer is that variables should be local, not global in scope. In this case, I see that the way the pxe/sysboot code works is that we have to env_set("..") in one place to env_get("..") in another, so I don't see a way around this.
Signature · 1 line
Tom
Simon Glass
Reviewed-byHi Tom,
Quoted 61 lines · Tom Rini
Quoted 43 lines · Artem Lapkin
Problem
PXE cannot boot normally after Sysboot changed the bootfile env (called from
boot_extlinux) from the default "boot.scr.uimg" to "/boot/extlinux/extlinux.conf".In addition, an unbootable extlinux configuration will also make the PXE boot unbootable, because it will use the incorrect path "
/boot/extlinux/" from the bootfile env.Solution
Save and restore default bootfile env value when
boot_extlinuxis used.Example
================================================================
Hit SPACE in 2 seconds to stop autoboot
... is now current device
Found/boot/extlinux/extlinux.conf
Retrieving file:/boot/extlinux/extlinux.conf
413 bytes read in 2 ms (201.2 KiB/s)
Skipping Krescue for failure retrieving kernel
SCRIPT FAILED: continuing...
...
Speed: 1000, full duplex
BOOTP broadcast 1
DHCP client bound to address 192.168.11.151 (8 ms) Using ethernet@ff3f0000 device
TFTP from server 192.168.11.1; our IP address is 192.168.11.151 Filename '/boot/extlinux/pxelinux.cfg/default'.
Not retrying...
================================================================Signed-off-by Artem Lapkin <[email protected]>--- include/config_distro_bootcmd.h | 2 ++ 1 file changed, 2 insertions(+)include/config_distro_bootcmd.h +0
-0include/config_distro_bootcmd.h line 453
Quoted 9 lines
include/config_distro_bootcmd.h +2
-0@@ -445,7 +445,9 @@"${devnum}:${distro_bootpart} " \"${prefix}${boot_syslinux_conf}; then " \"echo Found ${prefix}${boot_syslinux_conf}; " \ +"bootfile_bak=${bootfile}; " \"run boot_extlinux; " \ +"setenv bootfile ${bootfile_bak}; " \"echo SCRIPT FAILED: continuing...; " \"fi\0" \ \We've had this kind of problem before, and the answer is that variables should be local, not global in scope. In this case, I see that the way the pxe/sysboot code works is that we have to
env_set("..")in one place toenv_get("..")in another, so I don't see a way around this.
Quoted 1 line
Reviewed-by Tom Rini <[email protected]>
IMO a better approach will be the bootflow implementation. I hope to get v2 out early next week.
Regards,
Simon
Quoted 64 lines · Simon Glass
Hi Tom,
Quoted 61 lines · Tom Rini
Quoted 43 lines · Artem Lapkin
Problem
PXE cannot boot normally after Sysboot changed the bootfile env (called from
boot_extlinux) from the default "boot.scr.uimg" to "/boot/extlinux/extlinux.conf".In addition, an unbootable extlinux configuration will also make the PXE boot unbootable, because it will use the incorrect path "
/boot/extlinux/" from the bootfile env.Solution
Save and restore default bootfile env value when
boot_extlinuxis used.Example
================================================================
Hit SPACE in 2 seconds to stop autoboot
... is now current device
Found/boot/extlinux/extlinux.conf
Retrieving file:/boot/extlinux/extlinux.conf
413 bytes read in 2 ms (201.2 KiB/s)
Skipping Krescue for failure retrieving kernel
SCRIPT FAILED: continuing...
...
Speed: 1000, full duplex
BOOTP broadcast 1
DHCP client bound to address 192.168.11.151 (8 ms) Using ethernet@ff3f0000 device
TFTP from server 192.168.11.1; our IP address is 192.168.11.151 Filename '/boot/extlinux/pxelinux.cfg/default'.
Not retrying...
================================================================Signed-off-by Artem Lapkin <[email protected]>--- include/config_distro_bootcmd.h | 2 ++ 1 file changed, 2 insertions(+)include/config_distro_bootcmd.h +0
-0include/config_distro_bootcmd.h line 453
Quoted 9 lines
include/config_distro_bootcmd.h +2
-0@@ -445,7 +445,9 @@"${devnum}:${distro_bootpart} " \"${prefix}${boot_syslinux_conf}; then " \"echo Found ${prefix}${boot_syslinux_conf}; " \ +"bootfile_bak=${bootfile}; " \"run boot_extlinux; " \ +"setenv bootfile ${bootfile_bak}; " \"echo SCRIPT FAILED: continuing...; " \"fi\0" \ \We've had this kind of problem before, and the answer is that variables should be local, not global in scope. In this case, I see that the way the pxe/sysboot code works is that we have to
env_set("..")in one place toenv_get("..")in another, so I don't see a way around this.
Quoted 4 lines
Quoted 1 line
Reviewed-by Tom Rini <[email protected]>IMO a better approach will be the bootflow implementation. I hope to get v2 out early next week.
I'm not sure if the bootflow way of going here would or would not have the same problem, or perhaps a slightly different problem. At heart here, "sysboot" calls env_set(...) and then calls in to the pxe code which does env_get(...). So now I wonder how this would be fixed in bootflow, since we aren't dealing with the environment directly.
Signature · 1 line
Tom
Yes changes inside include/config_distro_bootcmd.h not the best solution for this issue.
I think it is better to change sysboot cmd and i have prepared another solution already!
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
how about this ?
Quoted 93 lines · Tom Rini
Quoted 9 lines · Simon Glass
Hi Tom,
Quoted 6 lines · Tom Rini
Quoted 3 lines · Artem Lapkin
Problem
PXE cannot boot normally after Sysboot changed the bootfile env
(called
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
from
boot_extlinux) from the default "boot.scr.uimg" to "/boot/extlinux/extlinux.conf".In addition, an unbootable extlinux configuration will also make the
PXE
Quoted 1 line
Quoted 1 line
Quoted 1 line
boot unbootable, because it will use the incorrect path
"
/boot/extlinux/"Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
from the bootfile env.
Solution
Save and restore default bootfile env value when
boot_extlinuxisused.
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Example
================================================================
Hit SPACE in 2 seconds to stop autoboot
... is now current device
Found/boot/extlinux/extlinux.conf
Retrieving file:/boot/extlinux/extlinux.conf
413 bytes read in 2 ms (201.2 KiB/s)
Skipping Krescue for failure retrieving kernel
SCRIPT FAILED: continuing...
...
Speed: 1000, full duplex
BOOTP broadcast 1
DHCP client bound to address 192.168.11.151 (8 ms) Using ethernet@ff3f0000 device
TFTP from server 192.168.11.1; our IP address is 192.168.11.151 Filename '/boot/extlinux/pxelinux.cfg/default'.
Not retrying...
================================================================Quoted 6 lines
Quoted 6 lines
Review
Quoted 6 lines
Signed-off-by Artem Lapkin <[email protected]>--- include/config_distro_bootcmd.h | 2 ++ 1 file changed, 2 insertions(+)(quoted diff) +0
-0
b/include/config_distro_bootcmd.hQuoted 5 lines
Quoted 5 lines
include/config_distro_bootcmd.h line 445
Quoted 5 lines
index
3f724aa10f..db3d1b2362100644include/config_distro_bootcmd.h +0
-0@@ -445,7 +445,9 @@"${devnum}:${distro_bootpart} " \
Quoted 1 line
Quoted 1 line
include/config_distro_bootcmd.h line 446
Quoted 1 line
include/config_distro_bootcmd.h +0
-0"${prefix}${boot_syslinux_conf}; then" \
Quoted 1 line
Quoted 1 line
include/config_distro_bootcmd.h line 447
Quoted 1 line
include/config_distro_bootcmd.h +0
-0"echo Found ${prefix}${boot_syslinux_conf}; " \
Quoted 1 line
Quoted 1 line
include/config_distro_bootcmd.h line 448
Quoted 1 line
include/config_distro_bootcmd.h +1
-0+"bootfile_bak=${bootfile}; " \Quoted 1 line
Quoted 1 line
include/config_distro_bootcmd.h line 449
Quoted 1 line
include/config_distro_bootcmd.h +0
-0"run boot_extlinux; " \
Quoted 1 line
Quoted 1 line
include/config_distro_bootcmd.h line 450
Quoted 1 line
include/config_distro_bootcmd.h +1
-0+"setenv bootfile ${bootfile_bak}; " \
Quoted 1 line
Quoted 1 line
include/config_distro_bootcmd.h line 451
Quoted 1 line
include/config_distro_bootcmd.h +0
-0"echo SCRIPT FAILED: continuing...; " \
Quoted 1 line
Quoted 1 line
include/config_distro_bootcmd.h line 452
Quoted 1 line
include/config_distro_bootcmd.h +0
-0"fi\0" \Quoted 5 lines
Quoted 5 lines
include/config_distro_bootcmd.h line 453
Quoted 1 line
include/config_distro_bootcmd.h +0
-0\We've had this kind of problem before, and the answer is that variables should be local, not global in scope. In this case, I see that the way the pxe/sysboot code works is that we have to
env_set("..")in oneplace
Quoted 6 lines
Quoted 3 lines
to
env_get("..")in another, so I don't see a way around this.Reviewed-by Tom Rini <[email protected]>IMO a better approach will be the bootflow implementation. I hope to get v2 out early next week.
I'm not sure if the bootflow way of going here would or would not have the same problem, or perhaps a slightly different problem. At heart here, "sysboot" calls
env_set(...)and then calls in to the pxe code which doesenv_get(...). So now I wonder how this would be fixed in bootflow, since we aren't dealing with the environment directly.--
Tom
Hi Art,
Quoted 5 lines · Art Nikpal
Yes changes inside
include/config_distro_bootcmd.hnot the best solution for this issue. I think it is better to change sysboot cmd and i have prepared another solution already!
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
how about this ?
Seem reasonable to me, but could you check out my syslinux refactor series? It could use some review.
http://patchwork.ozlabs.org/project/uboot/list/?series=264265
- Simon
Quoted 81 lines · Tom Rini
Quoted 79 lines · Simon Glass
Quoted 64 lines
Hi Tom,
Quoted 61 lines · Tom Rini
Quoted 43 lines · Artem Lapkin
Problem
PXE cannot boot normally after Sysboot changed the bootfile env (called from
boot_extlinux) from the default "boot.scr.uimg" to "/boot/extlinux/extlinux.conf".In addition, an unbootable extlinux configuration will also make the PXE boot unbootable, because it will use the incorrect path "
/boot/extlinux/" from the bootfile env.Solution
Save and restore default bootfile env value when
boot_extlinuxis used.Example
================================================================
Hit SPACE in 2 seconds to stop autoboot
... is now current device
Found/boot/extlinux/extlinux.conf
Retrieving file:/boot/extlinux/extlinux.conf
413 bytes read in 2 ms (201.2 KiB/s)
Skipping Krescue for failure retrieving kernel
SCRIPT FAILED: continuing...
...
Speed: 1000, full duplex
BOOTP broadcast 1
DHCP client bound to address 192.168.11.151 (8 ms) Using ethernet@ff3f0000 device
TFTP from server 192.168.11.1; our IP address is 192.168.11.151 Filename '/boot/extlinux/pxelinux.cfg/default'.
Not retrying...
================================================================Signed-off-by Artem Lapkin <[email protected]>--- include/config_distro_bootcmd.h | 2 ++ 1 file changed, 2 insertions(+)include/config_distro_bootcmd.h +0
-0include/config_distro_bootcmd.h line 453
Quoted 9 lines
include/config_distro_bootcmd.h +2
-0@@ -445,7 +445,9 @@"${devnum}:${distro_bootpart} " \"${prefix}${boot_syslinux_conf}; then " \"echo Found ${prefix}${boot_syslinux_conf}; " \ +"bootfile_bak=${bootfile}; " \"run boot_extlinux; " \ +"setenv bootfile ${bootfile_bak}; " \"echo SCRIPT FAILED: continuing...; " \"fi\0" \ \We've had this kind of problem before, and the answer is that variables should be local, not global in scope. In this case, I see that the way the pxe/sysboot code works is that we have to
env_set("..")in one place toenv_get("..")in another, so I don't see a way around this.Quoted 4 lines
Quoted 1 line
Reviewed-by Tom Rini <[email protected]>IMO a better approach will be the bootflow implementation. I hope to get v2 out early next week.
I'm not sure if the bootflow way of going here would or would not have the same problem, or perhaps a slightly different problem. At heart here, "sysboot" calls
env_set(...)and then calls in to the pxe code which doesenv_get(...). So now I wonder how this would be fixed in bootflow, since we aren't dealing with the environment directly.--
Tom
Quoted 4 lines
could you check out my syslinux refactor
series? It could use some review.http://patchwork.ozlabs.org/project/uboot/list/?series=264265
Yes ! But I already can't apply this series for actual uboot code (need to change)
maybe u can make v3 patches for actual uboot state.
I checked it quickly. This series has many useful improvements!
Quoted 2 lines
Here's the patch where (I believe) this problem was addressed:
http://patchwork.ozlabs.org/project/uboot/patch/20210927092350.v2.11.I6a01e73ef114448e39cb6899c21f6c169e4da216@changeid/
look like yes and if your series will be applied my patch already no need.
Quoted 99 lines · Simon Glass
Hi Art,
Quoted 5 lines · Art Nikpal
Yes changes inside
include/config_distro_bootcmd.hnot the best solution for this issue. I think it is better to change sysboot cmd and i have prepared another solution already!
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
how about this ?Seem reasonable to me, but could you check out my syslinux refactor series? It could use some review.
http://patchwork.ozlabs.org/project/uboot/list/?series=264265
- Simon
Quoted 81 lines · Tom Rini
Quoted 79 lines · Simon Glass
Quoted 64 lines
Hi Tom,
Quoted 61 lines · Tom Rini
Quoted 43 lines · Artem Lapkin
Problem
PXE cannot boot normally after Sysboot changed the bootfile env (called from
boot_extlinux) from the default "boot.scr.uimg" to "/boot/extlinux/extlinux.conf".In addition, an unbootable extlinux configuration will also make the PXE boot unbootable, because it will use the incorrect path "
/boot/extlinux/" from the bootfile env.Solution
Save and restore default bootfile env value when
boot_extlinuxis used.Example
================================================================
Hit SPACE in 2 seconds to stop autoboot
... is now current device
Found/boot/extlinux/extlinux.conf
Retrieving file:/boot/extlinux/extlinux.conf
413 bytes read in 2 ms (201.2 KiB/s)
Skipping Krescue for failure retrieving kernel
SCRIPT FAILED: continuing...
...
Speed: 1000, full duplex
BOOTP broadcast 1
DHCP client bound to address 192.168.11.151 (8 ms) Using ethernet@ff3f0000 device
TFTP from server 192.168.11.1; our IP address is 192.168.11.151 Filename '/boot/extlinux/pxelinux.cfg/default'.
Not retrying...
================================================================Signed-off-by Artem Lapkin <[email protected]>--- include/config_distro_bootcmd.h | 2 ++ 1 file changed, 2 insertions(+)include/config_distro_bootcmd.h +0
-0include/config_distro_bootcmd.h line 453
Quoted 9 lines
include/config_distro_bootcmd.h +2
-0@@ -445,7 +445,9 @@"${devnum}:${distro_bootpart} " \"${prefix}${boot_syslinux_conf}; then " \"echo Found ${prefix}${boot_syslinux_conf}; " \ +"bootfile_bak=${bootfile}; " \"run boot_extlinux; " \ +"setenv bootfile ${bootfile_bak}; " \"echo SCRIPT FAILED: continuing...; " \"fi\0" \ \We've had this kind of problem before, and the answer is that variables should be local, not global in scope. In this case, I see that the way the pxe/sysboot code works is that we have to
env_set("..")in one place toenv_get("..")in another, so I don't see a way around this.Quoted 4 lines
Quoted 1 line
Reviewed-by Tom Rini <[email protected]>IMO a better approach will be the bootflow implementation. I hope to get v2 out early next week.
I'm not sure if the bootflow way of going here would or would not have the same problem, or perhaps a slightly different problem. At heart here, "sysboot" calls
env_set(...)and then calls in to the pxe code which doesenv_get(...). So now I wonder how this would be fixed in bootflow, since we aren't dealing with the environment directly.--
Tom
Hi Tom,
Quoted 68 lines · Tom Rini
Quoted 66 lines · Simon Glass
Hi Tom,
Quoted 62 lines · Tom Rini
Quoted 43 lines · Artem Lapkin
Problem
PXE cannot boot normally after Sysboot changed the bootfile env (called from
boot_extlinux) from the default "boot.scr.uimg" to "/boot/extlinux/extlinux.conf".In addition, an unbootable extlinux configuration will also make the PXE boot unbootable, because it will use the incorrect path "
/boot/extlinux/" from the bootfile env.Solution
Save and restore default bootfile env value when
boot_extlinuxis used.Example
================================================================
Hit SPACE in 2 seconds to stop autoboot
... is now current device
Found/boot/extlinux/extlinux.conf
Retrieving file:/boot/extlinux/extlinux.conf
413 bytes read in 2 ms (201.2 KiB/s)
Skipping Krescue for failure retrieving kernel
SCRIPT FAILED: continuing...
...
Speed: 1000, full duplex
BOOTP broadcast 1
DHCP client bound to address 192.168.11.151 (8 ms) Using ethernet@ff3f0000 device
TFTP from server 192.168.11.1; our IP address is 192.168.11.151 Filename '/boot/extlinux/pxelinux.cfg/default'.
Not retrying...
================================================================Signed-off-by Artem Lapkin <[email protected]>--- include/config_distro_bootcmd.h | 2 ++ 1 file changed, 2 insertions(+)include/config_distro_bootcmd.h +0
-0include/config_distro_bootcmd.h line 453
Quoted 9 lines
include/config_distro_bootcmd.h +2
-0@@ -445,7 +445,9 @@"${devnum}:${distro_bootpart} " \"${prefix}${boot_syslinux_conf}; then " \"echo Found ${prefix}${boot_syslinux_conf}; " \ +"bootfile_bak=${bootfile}; " \"run boot_extlinux; " \ +"setenv bootfile ${bootfile_bak}; " \"echo SCRIPT FAILED: continuing...; " \"fi\0" \ \We've had this kind of problem before, and the answer is that variables should be local, not global in scope. In this case, I see that the way the pxe/sysboot code works is that we have to
env_set("..")in one place toenv_get("..")in another, so I don't see a way around this.Reviewed-by Tom Rini <[email protected]>
Quoted 8 lines
Quoted 2 lines
IMO a better approach will be the bootflow implementation. I hope to get v2 out early next week.
I'm not sure if the bootflow way of going here would or would not have the same problem, or perhaps a slightly different problem. At heart here, "sysboot" calls
env_set(...)and then calls in to the pxe code which doesenv_get(...). So now I wonder how this would be fixed in bootflow, since we aren't dealing with the environment directly.
Here's the patch where (I believe) this problem was addressed:
Regards,
Simon