[OpenWrt-Devel] ipq40xx: bootarg Manipulation Failing
Jeff Kletsky
lede at allycomm.com
Thu Mar 14 18:39:32 EDT 2019
I'm trying to bring up an IPQ4019-based Linksys EA8300 and have a
challenge with the OEM bootargs from U-Boot. While they could be
modified once in OpenWrt, I'm hoping to provide a serial-less way
for users to easily flash OpenWrt from the OEM web interface.
The OEM boot args are
init=/sbin/init rootfstype=ubifs ubi.mtd=NN,2048 root=ubi0:ubifs
rootwait rw
where NN is either 11 or 13, depending on the "selected" firmware
The OpenWrt boot args that work are
ubi.mtd=NN root=/dev/ubiblock0_0
Changing the OEM line to include `root=ubi0:rootfs` as a quick way to
check if a change of the UBI volume name would resolve the issue
failed to boot. `/dev/ubiblock0_0` was the only viable option shown.
TL;DR
=====
* I've tried 0067-generic-Mangle-bootloader-s-kernel-arguments.patch
It doesn't seem to be able to modify the FDT
* Can I better confirm if atags_to_fdt() is executing?
* If it is executing, what am I not doing properly to modify the FDT?
* If it is not executing:
* Is there an example of command-line modification in `init`?
* Is there a better way, short of changing U-Boot, to make the change?
---
I'm aware of 0067-generic-Mangle-bootloader-s-kernel-arguments.patch
used by the ipq80xx devices and copied that patch over. I configured
the kernel appropriately, based on the #ifdef statements in the patch
root at OpenWrt:~# zcat /proc/config.gz | fgrep ATAG
# CONFIG_ATAGS is not set
CONFIG_ARM_ATAG_DTB_COMPAT=y
# CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_FROM_BOOTLOADER is not set
# CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_EXTEND is not set
CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_MANGLE=y
as well as adding in the `append-rootblock` property to the DTS
chosen {
// stdout-path = "serial0:115200n8"; // set in
dk07.1.dtsi
bootargs = "ubi.mtd=11 root=/dev/ubiblock0_0";
bootargs-append = " clk_ignore_unused";
append-rootblock = "append_rootblock=";
call-count = "not";
};
(call-count was not present in initial tests, and is discussed later)
There was no evidence of the patched code running, either in the
booted /proc/device-tree, or from early `init` messages
(`Bootloader command line not present` appears, not
`Bootloader command line (ignored): ... `)
---
Confirming that the code was running is challenging, as it is so early
in the boot process, still in arch/arm/boot/compressed/head.S
To try to confirm that it was running, I moved the "extend the FDT"
code up and tried to write to a new, already defined property:
int atags_to_fdt(void *atag_list, void *fdt, int total_space)
{
struct tag *atag = atag_list;
/* In the case of 64 bits memory size, need to reserve 2 cells for
* address and size for each bank */
uint32_t mem_reg_property[2 * 2 * NR_BANKS];
int memcount = 0;
int ret, memsize;
/* let's give it all the room it could need */
ret = fdt_open_into(fdt, fdt, total_space);
if (ret < 0)
return ret;
/* indicate that this has been called and how many times */
/* for now, just say "yes" */
setprop_string(fdt, "/chosen", "call-count", "yes");
before any of the branching.
There is no change to the call-count property; it remains "not" as set
by the DTS.
---
I've looked through the logic in arch/arm/boot/compressed/head.S
and I only see one reason why atags_to_fdt() wouldn't be called
(assuming I've followed the nested #ifdef properly)
<https://github.com/torvalds/linux/blob/v4.19/arch/arm/boot/compressed/head.S#L294>
(I previously had the same results with 4.14)
* 294: Branch to dtb_check_done (386) if there is no DTB signature
The signature looks to be there, based on hexdump (0xd00dfeed):
0021fe50 00 00 00 00 41 52 4d 20 4f 70 65 6e 57 72 74 20 |....ARM
OpenWrt |
0021fe60 6c 69 6e 6b 73 79 73 5f 65 61 38 33 30 30 20 64
|linksys_ea8300 d|
0021fe70 65 76 69 63 65 20 74 72 65 65 20 62 6c 6f 62 00 |evice tree
blob.|
0021fe80 00 00 00 03 00 00 4a fe 00 00 00 1b d0 0d fe ed
|......J.........|
===========
---
Which leaves me with the puzzle:
* Can I better confirm if atags_to_fdt() is executing?
* If it is executing, what am I not doing properly to modify the FDT?
* If it is not executing:
* Is there an example of command-line modification in `init`?
* Is there a better way, short of changing U-Boot, to make the change?
Thanks,
Jeff
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list