Support dual bootloader (#27)

* Support dual bootloader

Signed-off-by: Pascal Vizeli <pvizeli@syshack.ch>

* Make ova running

Signed-off-by: Pascal Vizeli <pvizeli@syshack.ch>

* fix uboot

Signed-off-by: Pascal Vizeli <pvizeli@syshack.ch>

* Update supervisor

Signed-off-by: Pascal Vizeli <pvizeli@syshack.ch>

* Support all rpi

Signed-off-by: Pascal Vizeli <pvizeli@syshack.ch>
This commit is contained in:
Pascal Vizeli
2018-06-11 01:06:49 +02:00
committed by Pascal Vizeli
parent f9f8b91b31
commit a426046bcc
94 changed files with 648 additions and 13004 deletions

View File

@@ -1,30 +0,0 @@
From 6344ec5c84a49c2df4c2f26b52d317a34e3bc0c7 Mon Sep 17 00:00:00 2001
From: Pascal Vizeli <pvizeli@syshack.ch>
Date: Mon, 4 Jun 2018 07:55:46 +0000
Subject: [PATCH 1/2] ARM: dts: bcm2836-rpi-2: re-enable booting from SD card
Signed-off-by: Pascal Vizeli <pvizeli@syshack.ch>
---
arch/arm/dts/bcm2836-rpi-2.dts | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/arch/arm/dts/bcm2836-rpi-2.dts b/arch/arm/dts/bcm2836-rpi-2.dts
index 42b6abb18..2fa1c8bb4 100644
--- a/arch/arm/dts/bcm2836-rpi-2.dts
+++ b/arch/arm/dts/bcm2836-rpi-2.dts
@@ -9,3 +9,12 @@
reg = <0x0 0x0>;
};
};
+
+&sdhci {
+ status = "okay";
+};
+
+&sdhost {
+ status = "disabled";
+};
+
--
2.17.0

View File

@@ -1,167 +0,0 @@
From 3fe92c12e01e35cc97fbd92d8ae098ac583cfa1f Mon Sep 17 00:00:00 2001
From: Pascal Vizeli <pvizeli@syshack.ch>
Date: Mon, 4 Jun 2018 09:25:40 +0000
Subject: [PATCH 3/3] Add HassOS bootchoiser state
Signed-off-by: Pascal Vizeli <pvizeli@syshack.ch>
---
arch/arm/dts/bcm2835-rpi.dts | 69 ++++++++++++++++++++++++++++++++++
arch/arm/dts/bcm2836-rpi-2.dts | 68 +++++++++++++++++++++++++++++++++
2 files changed, 137 insertions(+)
diff --git a/arch/arm/dts/bcm2835-rpi.dts b/arch/arm/dts/bcm2835-rpi.dts
index 22d60e961..3357d06b7 100644
--- a/arch/arm/dts/bcm2835-rpi.dts
+++ b/arch/arm/dts/bcm2835-rpi.dts
@@ -13,3 +13,72 @@
&sdhost {
status = "disabled";
};
+
+/ {
+
+ aliases {
+ state = &state;
+ };
+
+ state: state {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ magic = <0xef98423f>;
+ compatible = "barebox,state";
+ backend = <&backend_state>;
+ backend-type = "raw";
+ backend-stridesize = <4048>;
+
+ bootstate {
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ system0 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ remaining_attempts@0 {
+ reg = <0x0 0x4>;
+ type = "uint32";
+ default = <3>;
+ };
+ priority@4 {
+ reg = <0x4 0x4>;
+ type = "uint32";
+ default = <20>;
+ };
+ };
+ system1 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ remaining_attempts@8 {
+ reg = <0x8 0x4>;
+ type = "uint32";
+ default = <0>;
+ };
+ priority@c {
+ reg = <0xc 0x4>;
+ type = "uint32";
+ default = <10>;
+ };
+ };
+ last_chosen@10 {
+ reg = <0x10 0x4>;
+ type = "uint32";
+ };
+ };
+ };
+};
+
+&sdhci {
+ partitions {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "fixed-partitions";
+
+ backend_state: partition@22100000 {
+ label = "state";
+ reg = <0x22100000 0x800000>;
+ };
+ };
+};
+
diff --git a/arch/arm/dts/bcm2836-rpi-2.dts b/arch/arm/dts/bcm2836-rpi-2.dts
index bdee1296e..e41def570 100644
--- a/arch/arm/dts/bcm2836-rpi-2.dts
+++ b/arch/arm/dts/bcm2836-rpi-2.dts
@@ -14,3 +14,71 @@
status = "disabled";
};
+/ {
+
+ aliases {
+ state = &state;
+ };
+
+ state: state {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ magic = <0xef98423f>;
+ compatible = "barebox,state";
+ backend = <&backend_state>;
+ backend-type = "raw";
+ backend-stridesize = <4048>;
+
+ bootstate {
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ system0 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ remaining_attempts@0 {
+ reg = <0x0 0x4>;
+ type = "uint32";
+ default = <3>;
+ };
+ priority@4 {
+ reg = <0x4 0x4>;
+ type = "uint32";
+ default = <20>;
+ };
+ };
+ system1 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ remaining_attempts@8 {
+ reg = <0x8 0x4>;
+ type = "uint32";
+ default = <0>;
+ };
+ priority@c {
+ reg = <0xc 0x4>;
+ type = "uint32";
+ default = <10>;
+ };
+ };
+ last_chosen@10 {
+ reg = <0x10 0x4>;
+ type = "uint32";
+ };
+ };
+ };
+};
+
+&sdhci {
+ partitions {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "fixed-partitions";
+
+ backend_state: partition@22100000 {
+ label = "state";
+ reg = <0x22100000 0x800000>;
+ };
+ };
+};
+
--
2.17.0

View File

@@ -1,42 +0,0 @@
From 19ab0b433893cc7d16e8f4a6052f0f784131c43a Mon Sep 17 00:00:00 2001
From: Pascal Vizeli <pvizeli@syshack.ch>
Date: Sat, 2 Jun 2018 22:08:31 +0000
Subject: [PATCH 1/1] common: state: allow to overlay state backend
This allow to use overlay for state backends. I.e. on raspberry you need
use barebox with SDHCI (slow) and after linux boot it will use SDHOST driver.
But the problem now is, that the state is on SDHCI and dt-utils need it on
SDHOST. Actual it is not possible to overwrite this.
Signed-off-by: Pascal Vizeli <pvizeli@syshack.ch>
---
common/state/state.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/common/state/state.c b/common/state/state.c
index 25d950211..e6259043f 100644
--- a/common/state/state.c
+++ b/common/state/state.c
@@ -494,8 +494,17 @@ static int of_state_fixup(struct device_node *root, void *ctx)
}
/* backend phandle */
- backend_node = of_find_node_by_reproducible_name(root,
- state->backend_reproducible_name);
+ if (node) {
+ ret = of_property_read_u32(node, "backend", &phandle);
+ if (ret)
+ goto out;
+
+ backend_node = of_find_node_by_phandle_from(phandle, root);
+ } else {
+ backend_node = of_find_node_by_reproducible_name(root,
+ state->backend_reproducible_name);
+ }
+
if (!backend_node) {
ret = -ENODEV;
goto out;
--
2.17.0