mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 1/3] ARM: bootm: Add option boot using ATAGs
Date: Mon, 11 Jun 2018 22:42:43 +0200	[thread overview]
Message-ID: <20180611204245.8351-2-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20180611204245.8351-1-s.hauer@pengutronix.de>

So far we can only force legacy boot using ATAGs by executing
'oftree -f'. Said command is going away as often this command
is not safe to call. Add an alternative way using the
global.bootm.boot_atag environment variable.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/lib32/bootm.c | 26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/arch/arm/lib32/bootm.c b/arch/arm/lib32/bootm.c
index c8bf72f0e0..17eb78c6b2 100644
--- a/arch/arm/lib32/bootm.c
+++ b/arch/arm/lib32/bootm.c
@@ -26,6 +26,9 @@
 #include <asm/armlinux.h>
 #include <asm/system.h>
 
+/* If true, ignore device tree and boot with ATAGs */
+static int bootm_boot_atag;
+
 /*
  * sdram_start_and_size() - determine place for putting the kernel/oftree/initrd
  *
@@ -135,8 +138,14 @@ static int __do_bootm_linux(struct image_data *data, unsigned long free_mem, int
 	unsigned long kernel;
 	unsigned long initrd_start = 0, initrd_size = 0, initrd_end = 0;
 	enum arm_security_state state = bootm_arm_security_state();
+	void *oftree;
 	int ret;
 
+	if (bootm_boot_atag)
+		oftree = NULL;
+	else
+		oftree = data->oftree;
+
 	kernel = data->os_res->start + data->os_entry;
 
 	initrd_start = data->initrd_address;
@@ -163,16 +172,18 @@ static int __do_bootm_linux(struct image_data *data, unsigned long free_mem, int
 		free_mem = PAGE_ALIGN(initrd_end + 1);
 	}
 
-	ret = bootm_load_devicetree(data, free_mem);
-	if (ret)
-		return ret;
+	if (oftree) {
+		ret = bootm_load_devicetree(data, free_mem);
+		if (ret)
+			return ret;
+	}
 
 	if (bootm_verbose(data)) {
 		printf("\nStarting kernel at 0x%08lx", kernel);
 		if (initrd_size)
 			printf(", initrd at 0x%08lx", initrd_start);
 		if (data->oftree)
-			printf(", oftree at 0x%p", data->oftree);
+			printf(", oftree at 0x%p", oftree);
 		printf("...\n");
 	}
 
@@ -188,7 +199,7 @@ static int __do_bootm_linux(struct image_data *data, unsigned long free_mem, int
 	if (data->dryrun)
 		return 0;
 
-	start_linux((void *)kernel, swap, initrd_start, initrd_size, data->oftree,
+	start_linux((void *)kernel, swap, initrd_start, initrd_size, oftree,
 		    state);
 
 	restart_machine();
@@ -600,8 +611,13 @@ static struct binfmt_hook binfmt_barebox_hook = {
 	.exec = "bootm",
 };
 
+BAREBOX_MAGICVAR_NAMED(global_bootm_boot_atag, global.bootm.boot_atag,
+		       "If true, ignore device tree and boot using ATAGs");
+
 static int armlinux_register_image_handler(void)
 {
+	globalvar_add_simple_bool("bootm.boot_atag", &bootm_boot_atag);
+
 	register_image_handler(&barebox_handler);
 	register_image_handler(&uimage_handler);
 	register_image_handler(&rawimage_handler);
-- 
2.17.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2018-06-11 20:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-11 20:42 [PATCH v2 0/3] kill oftree -f Sascha Hauer
2018-06-11 20:42 ` Sascha Hauer [this message]
2018-06-11 20:42 ` [PATCH 2/3] commands: oftree: " Sascha Hauer
2018-06-11 20:42 ` [PATCH 3/3] Documentation: explain new way to boot using ATAGs Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180611204245.8351-2-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox