]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
boot: pxe_utils: skip fdt setup in case legacy kernel is booted
authorSvyatoslav Ryhel <clamor95@gmail.com>
Thu, 25 Jan 2024 20:16:54 +0000 (22:16 +0200)
committerTom Rini <trini@konsulko.com>
Fri, 1 Mar 2024 23:34:08 +0000 (18:34 -0500)
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@yahoo.de>
Tested-by: Jethro Bull <jethrob@hotmail.com>
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
boot/pxe_utils.c
doc/develop/distro.rst

index 83bc1677856f5db49ca3bdc7531a46711fbd0b22..96205626750325320aafe2287fa38ab65e304e99 100644 (file)
@@ -634,7 +634,12 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label)
                char *fdtfilefree = NULL;
 
                if (label->fdt) {
-                       fdtfile = label->fdt;
+                       if (IS_ENABLED(CONFIG_SUPPORT_PASSING_ATAGS)) {
+                               if (strcmp("-", label->fdt))
+                                       fdtfile = label->fdt;
+                       } else {
+                               fdtfile = label->fdt;
+                       }
                } else if (label->fdtdir) {
                        char *f1, *f2, *f3, *f4, *slash;
 
@@ -731,14 +736,26 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label)
                zboot_argc = 5;
        }
 
-       if (!bootm_argv[3])
-               bootm_argv[3] = env_get("fdt_addr");
+       if (!bootm_argv[3]) {
+               if (IS_ENABLED(CONFIG_SUPPORT_PASSING_ATAGS)) {
+                       if (strcmp("-", label->fdt))
+                               bootm_argv[3] = env_get("fdt_addr");
+               } else {
+                       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)
-               bootm_argv[3] = env_get("fdtcontroladdr");
+       if (!bootm_argv[3] && genimg_get_format(buf) != IMAGE_FORMAT_FIT) {
+               if (IS_ENABLED(CONFIG_SUPPORT_PASSING_ATAGS)) {
+                       if (strcmp("-", label->fdt))
+                               bootm_argv[3] = env_get("fdtcontroladdr");
+               } else {
+                       bootm_argv[3] = env_get("fdtcontroladdr");
+               }
+       }
 
        if (bootm_argv[3]) {
                if (!bootm_argv[2])
index 8016acad098a2f005bf17210bbfb23c30b28207b..9e715b23ebb23b56035505ec763f3514e26e03c8 100644 (file)
@@ -81,6 +81,12 @@ 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 currently used
+  device tree.
+
+* If ``-`` is passed as fdt argument and ``CONFIG_SUPPORT_PASSING_ATAGS`` is
+  enabled, then no device tree will be used (legacy booting / pre-dtb kernel).
+
 See also doc/README.pxe under 'pxe file format'.
 
 One example extlinux.conf generated by the Fedora installer is::