[OpenWrt-Devel] ARM: Overriding Specific bootargs

Jeff Kletsky lede at allycomm.com
Fri Feb 22 12:24:31 EST 2019

I could use some guidance to either a solution or an approach to
wresting the OEM bootloader args into an "OpenWrt-compatible" form.

(ARM; ipq40xx, in particular)


     What's the "best" way to override `root=ubi0:ubifs` from the
     bootloader to `root=/dev/ubiblock0_0` or otherwise make the
     OpenWrt kernel boot without changing the U-Boot environment?


     How can I configure an OpenWrt build to have the kernel be able to
     boot with `root=ubi0:ubifs` (and not break everything that might
     expect the UBI volume be named `rootfs`)?

While I could control the U-Boot environment from an installed OpenWrt
Instance, that doesn't seem like it could provide a "serial-less"
OEM-to-OpenWrt transition.

That the device (Linksys EA8300) is a dual-firmware device and could
be booting from either partition, at least as far as I can tell, makes
a hard-coded kernel command line an unsuitable approach.

What I'm looking for is how to get from the information provided by
the bootloader about which partition is "active" into the kernel's
command line so that it can mount the proper root.

 From the OEM U-Boot:

     init=/sbin/init rootfstype=ubifs ubi.mtd=NN,2048 root=ubi0:ubifs
     rootwait rw

where NN is 11 or 13, depending on selected firmware version.

What my current build is looking for:

     ubi.mtd=NN root=/dev/ubiblock0_0

Apparently, for ARM architectures, "the bootloader is always
right" [1][2][3], adding additional challenges.

Using chosen/bootargs was confirmed to be "ignored" if the bootloader
provided bootargs.

Using chosen/bootargs-append didn't help as the result still tries to
boot from ubi0:ubifs

     init=/sbin/init rootfstype=ubifs ubi.mtd=11,2048 root=ubi0:ubifs
     rootwait rw root=/dev/ubiblock0_0 clk_ignore_unused

Testing from the boot loader with

     ubi.mtd=NN root=ubi0:rootfs

didn't boot, as apparently the kernel isn't finding the UBI volume by
name, at least as I have it configured.

I've looked at a few of the ARM Kconfig options as a "quick hack", but
none seemed to be able to get the "right" bootargs to the kernel:


This kind of "heavy handed" approach has problems with impacting other
devices on the same target, or maintenance problems as there doesn't
seem to be a way to "patch" the kernel .config for a single device.

I found, looked at, and tried


which provides


but it extracts a number from the `root=` argument from the bootloader
command line and doesn't *remove* the `root=` argument.

(The three variants of this patch are all similar in function.)


I can see a couple ways forward with this that allow end users to
install/revert OpenWrt without cracking the case and installing a
serial connection:

* Modify the UBI bundle to change the name of the volume from "rootfs"
   to "ubifs" (and all kernel and downstream changes needed)

* Consider the task of adding arg /removal/ to something like
   "Mangle-bootloader-s-kernel-arguments.patch" (which would allow
   "replacement" from chosen/bootargs-append)

Suggestions of the path to explore first, or other approaches, are welcome



DTS using `append-rootblock` in `master`
from `fgrep -r append-rootblock target`:

armada-385-linksys-venom.dts   append-rootblock = "root=/dev/mtdblock"
qcom-ipq8065-nbg6817.dts       append-rootblock = "root=/dev/mmcblk0p";
qcom-ipq8064-ea8500.dts        append-rootblock = "ubi.mtd="

is not directly applicable, as its U-Boot environment has the "right" root=

     init=/sbin/init rootfstype=squashfs
     ubi.mtd=11,2048 ubi.block=0,0 root=/dev/ubiblock0_0 rootwait ro




[3] arch/arm/boot/compressed/atags_to_fdt.c

openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list