[PATCH v1 1/1] boot: pxe_utils: skip fdt setup in case legacy kernel is booted
Svyatoslav Ryhel
clamor95 at gmail.com
Wed Jan 24 21:27:31 CET 2024
Currently, if boot with extlinux.conf and do not set the fdt
U-Boot will provide its own device tree. This behavior is
beneficial if the U-Boot device tree is in sync with Linux,
but it totally halts the booting of pre-dtb kernels (3.4 for
example) since it uses ATAGs. To fix this, pass `-` in the
fdt extlinux field as a signal that no tree should be used.
Suggested-by: Jonas Schwöbel <jonasschwoebel at yahoo.de>
Tested-by: Jethro Bull <jethrob at hotmail.com>
Signed-off-by: Svyatoslav Ryhel <clamor95 at gmail.com>
---
boot/pxe_utils.c | 8 +++++---
doc/develop/distro.rst | 3 +++
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/boot/pxe_utils.c b/boot/pxe_utils.c
index 83bc167785..6a2c881965 100644
--- a/boot/pxe_utils.c
+++ b/boot/pxe_utils.c
@@ -634,7 +634,8 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label)
char *fdtfilefree = NULL;
if (label->fdt) {
- fdtfile = label->fdt;
+ if (strcmp("-", label->fdt))
+ fdtfile = label->fdt;
} else if (label->fdtdir) {
char *f1, *f2, *f3, *f4, *slash;
@@ -731,13 +732,14 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label)
zboot_argc = 5;
}
- if (!bootm_argv[3])
+ if (!bootm_argv[3] && strcmp("-", label->fdt))
bootm_argv[3] = env_get("fdt_addr");
kernel_addr_r = genimg_get_kernel_addr(kernel_addr);
buf = map_sysmem(kernel_addr_r, 0);
- if (!bootm_argv[3] && genimg_get_format(buf) != IMAGE_FORMAT_FIT)
+ if (!bootm_argv[3] && genimg_get_format(buf) != IMAGE_FORMAT_FIT &&
+ strcmp("-", label->fdt))
bootm_argv[3] = env_get("fdtcontroladdr");
if (bootm_argv[3]) {
diff --git a/doc/develop/distro.rst b/doc/develop/distro.rst
index 8016acad09..c81da8a0fd 100644
--- a/doc/develop/distro.rst
+++ b/doc/develop/distro.rst
@@ -81,6 +81,9 @@ as specified at `Boot Loader Specification`_:
* Does not document the fdtdir option, which automatically selects the DTB to
pass to the kernel.
+* If no fdt/fdtdir is provided, the U-Boot will pass its own device tree, and
+ if fdt is passed with ``-``, then device tree will not be used (legacy booting).
+
See also doc/README.pxe under 'pxe file format'.
One example extlinux.conf generated by the Fedora installer is::
--
2.40.1
More information about the U-Boot
mailing list