summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2018-07-09 08:21:15 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2018-07-09 08:21:15 +0200
commit64c720391a0c127dba33d1ae8aeba30b6a3c692d (patch)
tree1784bd58f6c7eb673cf10a1962214a39e2a87057
parent1073955aa5fb777381de710ad314cdbf68fef189 (diff)
parent3fc9db5d2aa58e057e28f86a195077afd9e2bcf4 (diff)
downloadbarebox-64c720391a0c127dba33d1ae8aeba30b6a3c692d.tar.gz
barebox-64c720391a0c127dba33d1ae8aeba30b6a3c692d.tar.xz
Merge branch 'for-next/kill-oftree-f'
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--Documentation/user/booting-linux.rst4
-rw-r--r--Documentation/user/devicetree.rst16
-rw-r--r--arch/arm/boards/kindle-mx50/defaultenv-kindle-mx50/boot/mmc_kernel4
-rw-r--r--arch/arm/boards/radxa-rock/env/boot/mshc12
-rw-r--r--arch/arm/boards/radxa-rock/env/boot/mshc1-old2
-rw-r--r--arch/arm/lib32/bootm.c15
-rw-r--r--commands/oftree.c17
7 files changed, 25 insertions, 35 deletions
diff --git a/Documentation/user/booting-linux.rst b/Documentation/user/booting-linux.rst
index 408f87d8e8..437f4e80ca 100644
--- a/Documentation/user/booting-linux.rst
+++ b/Documentation/user/booting-linux.rst
@@ -49,8 +49,8 @@ variable:
bootm
**NOTE:** it may happen that barebox is probed from the devicetree, but you have
-want to start a Kernel without passing a devicetree. In this case call ``oftree -f``
-to free the internal devicetree before calling ``bootm``
+want to start a Kernel without passing a devicetree. In this case set the
+``global.bootm.boot_atag`` variable to ``true``.
Passing Kernel Arguments
^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/Documentation/user/devicetree.rst b/Documentation/user/devicetree.rst
index 17934d86e3..679cae7f00 100644
--- a/Documentation/user/devicetree.rst
+++ b/Documentation/user/devicetree.rst
@@ -71,15 +71,7 @@ work on the internal devicetree. It is possible to add/remove nodes using the
# add a property to it
of_property -s /chosen/mynode/ myproperty myvalue
-It is important to know that these commands always work on the internal
-devicetree. If you modify the internal devicetree to influence the behaviour of
-a kernel booted later, make sure that you start the kernel with the internal
-devicetree (i.e. don't pass a devicetree to the :ref:`command_bootm` command). If you
-wish to use another devicetree than the internal devicetree for starting the kernel,
-you can exchange the internal devicetree during runtime using the
-:ref:`command_oftree` command:
-
-.. code-block:: sh
-
- oftree -f
- oftree -l /new/dtb
+It is important to know that these commands normally work on the internal
+devicetree. If you want to modify the devicetree the kernel is started with
+see the -f options to of_property and of_node. This option will register the
+operation for later execution on the Kernel devicetree.
diff --git a/arch/arm/boards/kindle-mx50/defaultenv-kindle-mx50/boot/mmc_kernel b/arch/arm/boards/kindle-mx50/defaultenv-kindle-mx50/boot/mmc_kernel
index a43ee0cc92..4f2cabd54e 100644
--- a/arch/arm/boards/kindle-mx50/defaultenv-kindle-mx50/boot/mmc_kernel
+++ b/arch/arm/boards/kindle-mx50/defaultenv-kindle-mx50/boot/mmc_kernel
@@ -2,8 +2,8 @@
# Boot the Amazon factory-shipped kernel uimage stored on
# the eMMC at CONFIG_MMC_BOOTFLASH_ADDR 0x41000
-# Purge the OF tree to enable passing of ATAGs
-oftree -f
+# Force ATAG boot
+global.bootm.boot_atag=true
# The same machine type introduced with freescale ENGR00124359
armlinux_architecture=2955
diff --git a/arch/arm/boards/radxa-rock/env/boot/mshc1 b/arch/arm/boards/radxa-rock/env/boot/mshc1
index 964b6cc3eb..7393c4e63b 100644
--- a/arch/arm/boards/radxa-rock/env/boot/mshc1
+++ b/arch/arm/boards/radxa-rock/env/boot/mshc1
@@ -2,7 +2,7 @@
mount /dev/mshc1.0
-oftree -f
+global.bootm.boot_atag=true
oftree -l /mnt/mshc1.0/rk3188-radxarock.dtb
global.bootm.image=/mnt/mshc1.0/zImage
diff --git a/arch/arm/boards/radxa-rock/env/boot/mshc1-old b/arch/arm/boards/radxa-rock/env/boot/mshc1-old
index 1e1b57751d..2e43a3aafe 100644
--- a/arch/arm/boards/radxa-rock/env/boot/mshc1-old
+++ b/arch/arm/boards/radxa-rock/env/boot/mshc1-old
@@ -2,7 +2,7 @@
mount /dev/mshc1.0
-oftree -f
+global.bootm.boot_atag=true
global.bootm.image=/mnt/mshc1.0/zImage-old
global.linux.bootargs.dyn.root="root=/dev/mmcblk0p2 rootwait"
diff --git a/arch/arm/lib32/bootm.c b/arch/arm/lib32/bootm.c
index b1ac2df731..63713acf59 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
*
@@ -165,7 +168,12 @@ static int __do_bootm_linux(struct image_data *data, unsigned long free_mem,
free_mem = PAGE_ALIGN(initrd_end + 1);
}
- if (!fdt) {
+ if (fdt && bootm_boot_atag) {
+ printf("Error: Boot with ATAGs forced, but kernel has an appended device tree\n");
+ return -EINVAL;
+ }
+
+ if (!fdt && !bootm_boot_atag) {
fdt = bootm_get_devicetree(data);
if (IS_ERR(fdt))
return PTR_ERR(fdt);
@@ -612,8 +620,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);
diff --git a/commands/oftree.c b/commands/oftree.c
index 8a47c0be58..26a47bb581 100644
--- a/commands/oftree.c
+++ b/commands/oftree.c
@@ -48,7 +48,6 @@ static int do_oftree(int argc, char *argv[])
int probe = 0;
char *load = NULL;
char *save = NULL;
- int free_of = 0;
int ret;
struct device_node *root;
@@ -65,25 +64,12 @@ static int do_oftree(int argc, char *argv[])
return COMMAND_ERROR_USAGE;
}
break;
- case 'f':
- free_of = 1;
- break;
case 's':
save = optarg;
break;
}
}
- if (free_of) {
- struct device_node *root = of_get_root_node();
-
- if (root)
- of_delete_node(root);
-
- if (!load)
- return 0;
- }
-
if (!probe && !load && !save)
return COMMAND_ERROR_USAGE;
@@ -140,13 +126,12 @@ BAREBOX_CMD_HELP_TEXT("Options:")
BAREBOX_CMD_HELP_OPT ("-l <DTB>", "Load <DTB> to internal devicetree\n")
BAREBOX_CMD_HELP_OPT ("-s <DTB>", "save internal devicetree to <DTB>\n")
BAREBOX_CMD_HELP_OPT ("-p", "probe devices from stored device tree")
-BAREBOX_CMD_HELP_OPT ("-f", "free stored device tree")
BAREBOX_CMD_HELP_END
BAREBOX_CMD_START(oftree)
.cmd = do_oftree,
BAREBOX_CMD_DESC("handle device trees")
- BAREBOX_CMD_OPTS("[-lspf]")
+ BAREBOX_CMD_OPTS("[-lsp]")
BAREBOX_CMD_GROUP(CMD_GRP_MISC)
BAREBOX_CMD_HELP(cmd_oftree_help)
BAREBOX_CMD_END