diff --git a/Documentation/user/booting-linux.rst b/Documentation/user/booting-linux.rst index 408f87d..437f4e8 100644 --- a/Documentation/user/booting-linux.rst +++ b/Documentation/user/booting-linux.rst @@ -49,8 +49,8 @@ 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 17934d8..679cae7 100644 --- a/Documentation/user/devicetree.rst +++ b/Documentation/user/devicetree.rst @@ -71,15 +71,7 @@ # 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 a43ee0c..4f2cabd 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 964b6cc..7393c4e 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 1e1b577..2e43a3a 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 b1ac2df..63713ac 100644 --- a/arch/arm/lib32/bootm.c +++ b/arch/arm/lib32/bootm.c @@ -26,6 +26,9 @@ #include #include +/* 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 @@ 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 @@ .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 8a47c0b..26a47bb 100644 --- a/commands/oftree.c +++ b/commands/oftree.c @@ -48,7 +48,6 @@ int probe = 0; char *load = NULL; char *save = NULL; - int free_of = 0; int ret; struct device_node *root; @@ -65,25 +64,12 @@ 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_OPT ("-l ", "Load to internal devicetree\n") BAREBOX_CMD_HELP_OPT ("-s ", "save internal devicetree to \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