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:
committed by
Pascal Vizeli
parent
f9f8b91b31
commit
a426046bcc
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,34 +0,0 @@
|
||||
From cf05dfaa34d8502041aa2354f3b8c97ca4d250c9 Mon Sep 17 00:00:00 2001
|
||||
From: Pascal Vizeli <pvizeli@syshack.ch>
|
||||
Date: Thu, 7 Jun 2018 17:36:00 +0000
|
||||
Subject: [PATCH 1/1] drivers: of: bugfix partition fixups
|
||||
|
||||
If we load a new device tree for linux kernel with a diferent layout,
|
||||
the fixup of partition going into endless loop. Exactly the of_find_property
|
||||
function will never come back on a invalid device_node.
|
||||
|
||||
My patch check, if the device will exists on device tree before we run the
|
||||
fixup.
|
||||
|
||||
Signed-off-by: Pascal Vizeli <pvizeli@syshack.ch>
|
||||
---
|
||||
drivers/of/partition.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/drivers/of/partition.c b/drivers/of/partition.c
|
||||
index aa6e601b7..17e420964 100644
|
||||
--- a/drivers/of/partition.c
|
||||
+++ b/drivers/of/partition.c
|
||||
@@ -140,6 +140,9 @@ static int of_partition_fixup(struct device_node *root, void *ctx)
|
||||
if (!cdev->device_node)
|
||||
return -EINVAL;
|
||||
|
||||
+ if (!of_find_node_by_path(cdev->device_node->full_name))
|
||||
+ return -EINVAL;
|
||||
+
|
||||
list_for_each_entry(partcdev, &cdev->partitions, partition_entry) {
|
||||
if (partcdev->flags & DEVFS_PARTITION_FROM_TABLE)
|
||||
continue;
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,161 +0,0 @@
|
||||
From 5facf78a36c30c47849c338bf685f69849173f87 Mon Sep 17 00:00:00 2001
|
||||
From: Pascal Vizeli <pvizeli@syshack.ch>
|
||||
Date: Fri, 8 Jun 2018 20:45:32 +0000
|
||||
Subject: [PATCH 1/1] command: add fix_bootargs
|
||||
|
||||
Signed-off-by: Pascal Vizeli <pvizeli@syshack.ch>
|
||||
---
|
||||
commands/Kconfig | 13 +++++
|
||||
commands/Makefile | 1 +
|
||||
commands/fix_bootargs.c | 105 ++++++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 119 insertions(+)
|
||||
create mode 100644 commands/fix_bootargs.c
|
||||
|
||||
diff --git a/commands/Kconfig b/commands/Kconfig
|
||||
index 951a86963..4cc55a358 100644
|
||||
--- a/commands/Kconfig
|
||||
+++ b/commands/Kconfig
|
||||
@@ -2137,6 +2137,19 @@ config CMD_SEED
|
||||
help
|
||||
Seed the pseudo random number generator (PRNG)
|
||||
|
||||
+config CMD_FIX_BOOTARGS
|
||||
+ tristate
|
||||
+ select GLOBALVAR
|
||||
+ select OFTREE
|
||||
+ prompt "fix_bootargs"
|
||||
+ help
|
||||
+ Read bootargs from device tree and set to 'linux.bootargs.chosen'
|
||||
+
|
||||
+ Usage: fix_bootargs [-f DTB]
|
||||
+
|
||||
+ Options:
|
||||
+ -f DTB Read it from a dtb file.
|
||||
+
|
||||
# end Miscellaneous commands
|
||||
endmenu
|
||||
|
||||
diff --git a/commands/Makefile b/commands/Makefile
|
||||
index eb4796389..fafa8b145 100644
|
||||
--- a/commands/Makefile
|
||||
+++ b/commands/Makefile
|
||||
@@ -122,4 +122,5 @@ obj-$(CONFIG_CMD_SPD_DECODE) += spd_decode.o
|
||||
obj-$(CONFIG_CMD_MMC_EXTCSD) += mmc_extcsd.o
|
||||
obj-$(CONFIG_CMD_NAND_BITFLIP) += nand-bitflip.o
|
||||
obj-$(CONFIG_CMD_SEED) += seed.o
|
||||
+obj-$(CONFIG_CMD_FIX_BOOTARGS) += fix_bootargs.o
|
||||
obj-$(CONFIG_CMD_IP_ROUTE_GET) += ip-route-get.o
|
||||
diff --git a/commands/fix_bootargs.c b/commands/fix_bootargs.c
|
||||
new file mode 100644
|
||||
index 000000000..f58a4ab1d
|
||||
--- /dev/null
|
||||
+++ b/commands/fix_bootargs.c
|
||||
@@ -0,0 +1,105 @@
|
||||
+/*
|
||||
+ * of_dump.c - dump devicetrees to the console
|
||||
+ *
|
||||
+ * Copyright (c) 2018 Pascal Vizeli <pvizeli@syshack.ch>, Hass.io
|
||||
+ *
|
||||
+ * See file CREDITS for list of people who contributed to this
|
||||
+ * project.
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License version 2
|
||||
+ * as published by the Free Software Foundation.
|
||||
+ *
|
||||
+ * This program is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ *
|
||||
+ */
|
||||
+
|
||||
+#include <common.h>
|
||||
+#include <libfile.h>
|
||||
+#include <of.h>
|
||||
+#include <command.h>
|
||||
+#include <malloc.h>
|
||||
+#include <linux/ctype.h>
|
||||
+#include <errno.h>
|
||||
+#include <globalvar.h>
|
||||
+#include <getopt.h>
|
||||
+#include <linux/err.h>
|
||||
+
|
||||
+static int do_fix_bootargs(int argc, char *argv[])
|
||||
+{
|
||||
+ int opt;
|
||||
+ int ret = 0;
|
||||
+ struct device_node *root = NULL, *node = NULL, *of_free = NULL;
|
||||
+ struct property *prop = NULL;
|
||||
+ char *dtbfile = NULL;
|
||||
+ size_t size;
|
||||
+
|
||||
+ while ((opt = getopt(argc, argv, "f")) > 0) {
|
||||
+ switch (opt) {
|
||||
+ case 'f':
|
||||
+ dtbfile = optarg;
|
||||
+ break;
|
||||
+ default:
|
||||
+ return COMMAND_ERROR_USAGE;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (dtbfile) {
|
||||
+ void *fdt;
|
||||
+
|
||||
+ fdt = read_file(dtbfile, &size);
|
||||
+ if (!fdt) {
|
||||
+ printf("unable to read %s: %s\n", dtbfile, strerror(errno));
|
||||
+ return -errno;
|
||||
+ }
|
||||
+
|
||||
+ root = of_unflatten_dtb(fdt);
|
||||
+
|
||||
+ free(fdt);
|
||||
+
|
||||
+ if (IS_ERR(root)) {
|
||||
+ ret = PTR_ERR(root);
|
||||
+ goto end;
|
||||
+ }
|
||||
+
|
||||
+ of_free = root;
|
||||
+ } else {
|
||||
+ root = of_get_root_node();
|
||||
+ }
|
||||
+
|
||||
+ node = of_find_node_by_path_or_alias(root, "/chosen");
|
||||
+ if (!node) {
|
||||
+ printf("Cannot find chosen\n");
|
||||
+ ret = -ENOENT;
|
||||
+ goto end;
|
||||
+ }
|
||||
+
|
||||
+ prop = of_find_property(node, "bootargs", NULL);
|
||||
+ if (!prop) {
|
||||
+ printf("Cannot find bootargs\n");
|
||||
+ ret = -ENOENT;
|
||||
+ goto end;
|
||||
+ }
|
||||
+
|
||||
+ ret = globalvar_add_simple("linux.bootargs.chosen", prop->value);
|
||||
+
|
||||
+end:
|
||||
+ if (of_free)
|
||||
+ of_delete_node(of_free);
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+BAREBOX_CMD_HELP_START(fix_bootargs)
|
||||
+BAREBOX_CMD_HELP_TEXT("Options:")
|
||||
+BAREBOX_CMD_HELP_OPT ("-f dtb", "work on dtb instead of internal devicetree\n")
|
||||
+BAREBOX_CMD_HELP_END
|
||||
+
|
||||
+BAREBOX_CMD_START(fix_bootargs)
|
||||
+ .cmd = do_fix_bootargs,
|
||||
+ BAREBOX_CMD_DESC("dump devicetree nodes")
|
||||
+ BAREBOX_CMD_OPTS("[-f DTB]")
|
||||
+ BAREBOX_CMD_HELP(cmd_fix_bootargs_help)
|
||||
+BAREBOX_CMD_END
|
||||
--
|
||||
2.17.1
|
||||
|
||||
Reference in New Issue
Block a user