public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH v2] cmd: fdt: skip board specific fixup using env variable
@ 2021-02-04 14:44 Wasim Khan
  2021-02-25 13:24 ` Tom Rini
  0 siblings, 1 reply; 2+ messages in thread
From: Wasim Khan @ 2021-02-04 14:44 UTC (permalink / raw)
  To: u-boot

From: Wasim Khan <wasim.khan@nxp.com>

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>
---
Changes in v2:
- Added check for skip_board_fixup in checkpatch.pl

 common/image-fdt.c    | 17 ++++++++++++-----
 scripts/checkpatch.pl |  6 ++++++
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/common/image-fdt.c b/common/image-fdt.c
index 327a8c4c39..0435176863 100644
--- a/common/image-fdt.c
+++ b/common/image-fdt.c
@@ -572,11 +572,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) {
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 4ed7e124c9..7b76894fb4 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2366,6 +2366,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",
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH v2] cmd: fdt: skip board specific fixup using env variable
  2021-02-04 14:44 [PATCH v2] cmd: fdt: skip board specific fixup using env variable Wasim Khan
@ 2021-02-25 13:24 ` Tom Rini
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Rini @ 2021-02-25 13:24 UTC (permalink / raw)
  To: u-boot

On Thu, Feb 04, 2021 at 03:44:04PM +0100, Wasim Khan wrote:

> From: Wasim Khan <wasim.khan@nxp.com>
> 
> 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>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210225/d237b35a/attachment.sig>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-02-25 13:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-04 14:44 [PATCH v2] cmd: fdt: skip board specific fixup using env variable Wasim Khan
2021-02-25 13:24 ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox