]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
cmd: fdt: skip board specific fixup using env variable
authorWasim Khan <wasim.khan@nxp.com>
Thu, 4 Feb 2021 14:44:04 +0000 (15:44 +0100)
committerTom Rini <trini@konsulko.com>
Wed, 24 Feb 2021 21:51:48 +0000 (16:51 -0500)
Sometimes it is useful to boot OS with already fixed-up
device tree. Check for env variable 'skip_board_fixup'
before calling ft_board_setup().
Current behaviour is unchanged, additionally user can
set skip_board_fixup to 1 to skip the fixup.

Signed-off-by: Wasim Khan <wasim.khan@nxp.com>
common/image-fdt.c
scripts/checkpatch.pl

index 61ce6e5779fe3e702b5073a824f2330b881a20e7..a287b6639255b6956f9f900009032dbea35e2dde 100644 (file)
@@ -576,11 +576,18 @@ int image_setup_libfdt(bootm_headers_t *images, void *blob,
        fdt_fixup_pstore(blob);
 #endif
        if (IMAGE_OF_BOARD_SETUP) {
-               fdt_ret = ft_board_setup(blob, gd->bd);
-               if (fdt_ret) {
-                       printf("ERROR: board-specific fdt fixup failed: %s\n",
-                              fdt_strerror(fdt_ret));
-                       goto err;
+               const char *skip_board_fixup;
+
+               skip_board_fixup = env_get("skip_board_fixup");
+               if (skip_board_fixup && ((int)simple_strtol(skip_board_fixup, NULL, 10) == 1)) {
+                       printf("skip board fdt fixup\n");
+               } else {
+                       fdt_ret = ft_board_setup(blob, gd->bd);
+                       if (fdt_ret) {
+                               printf("ERROR: board-specific fdt fixup failed: %s\n",
+                                      fdt_strerror(fdt_ret));
+                               goto err;
+                       }
                }
        }
        if (IMAGE_OF_SYSTEM_SETUP) {
index 01ab570a168beb5dac696ff688cbd0ccce4cab7d..755f4802a463942da04890a3fa8a575faaac1720 100755 (executable)
@@ -2383,6 +2383,12 @@ sub u_boot_line {
                     "fdt or initrd relocation disabled at boot time\n" . $herecurr);
        }
 
+       # make sure 'skip_board_fixup' is not
+       if ($rawline =~ /.*skip_board_fixup.*/) {
+               ERROR("SKIP_BOARD_FIXUP",
+                    "Avoid setting skip_board_fixup env variable\n" . $herecurr);
+       }
+
        # Do not use CONFIG_ prefix in CONFIG_IS_ENABLED() calls
        if ($line =~ /^\+.*CONFIG_IS_ENABLED\(CONFIG_\w*\).*/) {
                ERROR("CONFIG_IS_ENABLED_CONFIG",