From: Ahmad Fatoum <ahmad@a3f.at>
To: barebox@lists.infradead.org
Cc: Tomaz Solc <tomaz.solc@tablix.org>
Subject: [PATCH 10/11] ARM: rpi: add new rpi boot target
Date: Sat, 28 Nov 2020 22:39:33 +0100 [thread overview]
Message-ID: <20201128213934.681065-10-ahmad@a3f.at> (raw)
In-Reply-To: <20201128213934.681065-1-ahmad@a3f.at>
For drop-in placement of barebox into the boot chain, it's useful to
have a target to boot the kernel like the VideoCore would have booted
the kernel if barebox hadn't been started instead.
This commit is based on the information here:
https://www.tablix.org/~avian/blog/archives/2019/03/booting_raspbian_from_barebox/
Cc: Tomaz Solc <tomaz.solc@tablix.org>
Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
arch/arm/boards/raspberry-pi/Makefile | 1 +
.../boards/raspberry-pi/defaultenv-rpi/boot/rpi | 5 +++++
arch/arm/boards/raspberry-pi/rpi-common.c | 15 +++++++++++++++
3 files changed, 21 insertions(+)
create mode 100755 arch/arm/boards/raspberry-pi/defaultenv-rpi/boot/rpi
diff --git a/arch/arm/boards/raspberry-pi/Makefile b/arch/arm/boards/raspberry-pi/Makefile
index a3e93eb73a32..ddcf015f0848 100644
--- a/arch/arm/boards/raspberry-pi/Makefile
+++ b/arch/arm/boards/raspberry-pi/Makefile
@@ -1,2 +1,3 @@
obj-$(CONFIG_MACH_RPI_COMMON) += rpi-common.o
lwl-y += lowlevel.o
+bbenv-y += defaultenv-rpi
diff --git a/arch/arm/boards/raspberry-pi/defaultenv-rpi/boot/rpi b/arch/arm/boards/raspberry-pi/defaultenv-rpi/boot/rpi
new file mode 100755
index 000000000000..bf81aeb87bb0
--- /dev/null
+++ b/arch/arm/boards/raspberry-pi/defaultenv-rpi/boot/rpi
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+global linux.bootargs.dyn.vc="${global.vc.bootargs}"
+global.bootm.image="/boot/${global.vc.kernel}"
+global.bootm.oftree=/vc.dtb
diff --git a/arch/arm/boards/raspberry-pi/rpi-common.c b/arch/arm/boards/raspberry-pi/rpi-common.c
index 30bfa995b3fa..e326732b3aa4 100644
--- a/arch/arm/boards/raspberry-pi/rpi-common.c
+++ b/arch/arm/boards/raspberry-pi/rpi-common.c
@@ -20,6 +20,7 @@
#include <generated/mach-types.h>
#include <linux/sizes.h>
#include <globalvar.h>
+#include <asm/system_info.h>
#include <mach/core.h>
#include <mach/mbox.h>
@@ -414,6 +415,8 @@ static int rpi_env_init(void)
return 0;
}
+ defaultenv_append_directory(defaultenv_rpi);
+
default_environment_path_set("/boot/barebox.env");
return 0;
@@ -450,6 +453,18 @@ static int rpi_vc_fdt_bootargs(void *fdt)
globalvar_add_simple("vc.bootargs", cmdline);
+ switch(cpu_architecture()) {
+ case CPU_ARCH_ARMv6:
+ globalvar_add_simple("vc.kernel", "kernel.img");
+ break;
+ case CPU_ARCH_ARMv7:
+ globalvar_add_simple("vc.kernel", "kernel7.img");
+ break;
+ case CPU_ARCH_ARMv8:
+ globalvar_add_simple("vc.kernel", "kernel7l.img");
+ break;
+ }
+
out:
if (root)
of_delete_node(root);
--
2.28.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2020-11-28 21:39 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-28 21:39 [PATCH 01/11] Revert "ARM: dts: bcm2835-rpi: re-enable booting from SD card" Ahmad Fatoum
2020-11-28 21:39 ` [PATCH 02/11] ARM: dts: rpi: drop unnecessary /chosen/stdout-path overrides Ahmad Fatoum
2020-11-28 21:39 ` [PATCH 03/11] ARM: rpi: make functions in rpi-common.c static Ahmad Fatoum
2020-11-28 21:39 ` [PATCH 04/11] ARM: rpi: move rpi_model_init() to postcore Ahmad Fatoum
2020-11-28 21:39 ` [PATCH 05/11] ARM: rpi: support raspberry pi 1 and zero mini-uart Ahmad Fatoum
2020-11-28 21:39 ` [PATCH 06/11] ARM: rpi: add new init function for Raspberry Pi Zero Ahmad Fatoum
2020-11-28 21:39 ` [PATCH 07/11] ARM: rpi: Add Raspberry Pi Zero W mini-uart support Ahmad Fatoum
2020-11-28 21:39 ` [PATCH 08/11] ARM: rpi: drop no longer needed environment Ahmad Fatoum
2020-11-28 21:39 ` [PATCH 09/11] ARM: rpi: fix model description string Ahmad Fatoum
2020-11-28 21:39 ` Ahmad Fatoum [this message]
2020-11-28 21:39 ` [PATCH 11/11] doc: bcm283x: document use of mini-uart on Raspberry Pi Zero W / CM3 Ahmad Fatoum
2020-11-29 19:50 ` Roland Hieber
2020-11-29 20:20 ` Ahmad Fatoum
2020-12-07 7:10 ` Sascha Hauer
2020-12-07 10:00 ` Ahmad Fatoum
2020-12-07 10:29 ` Sascha Hauer
2020-12-07 10:00 ` [PATCH] fixup! " Ahmad Fatoum
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=20201128213934.681065-10-ahmad@a3f.at \
--to=ahmad@a3f.at \
--cc=barebox@lists.infradead.org \
--cc=tomaz.solc@tablix.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