Passing bootargs to the kernel from the Device Tree?

Hi, there.
I'm trying to convert a device from the AR71XX target to the ATH79 build target. The device is a ZBT WE826-Q based on the QCA9531 SoC and uses the AP147 build and images on the AR71XX system.

I've written the device tree as here: https://github.com/wambu-i/openwrt/blob/ath79-ztb-we826q/target/linux/ath79/dts/qca9531_zbtlink_zbt-we826q.dts

I've also added the following device in target/linux/ath79/image/generic.mk

define Device/zbtlink_zbt-we826q
	SOC := qca9531
	DEVICE_VENDOR := ZBT
	DEVICE_MODEL := WE826Q
	IMAGE_SIZE := 16000k
	DEVICE_PACKAGES := kmod-usb2 kmod-usb-storage
  SUPPORTED_DEVICES += zbt-we826q
endef
TARGET_DEVICES += zbtlink_zbt-we826q

However, when I build the image and flash it, I get the following kernel panic:

Trying to boot firmware from 0x9fe80000 ...
U-Boot firmware image header detected.
    Image Name:   MIPS OpenWrt Linux-4.9.223
    Data Size:    1416764 Bytes
    Load Address: 80060000
    Entry Point:  80060000
Uncompressing data (LZMA) ... done.
Flushing cache ... done.

Starting kernel at 0x80060000...

[    0.000000] Linux version 4.9.223 (ubuntu@ip-172-31-27-145) (gcc version 7.3.0 (OpenWrt GCC 7.3.0 r6907+1099-7e15e21766) ) #0 Tue Jun 9 22:31:21 2020
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019374 (MIPS 24Kc)
[    0.000000] SoC: Qualcomm Atheros QCA9533 ver 2 rev 0
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 08000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 32512
[    0.000000] Kernel command line:  board=AP147-010 console=ttyS0,115200 mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,14528k(rootfs),1472k(kernel),64k(art)ro,16000k@0x50000(firmware) rootfstype=squashfs noinitrd
[    0.000000] PID hash table entries: 512 (order: -1, 2048 bytes)
[    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Writing ErrCtl register=00000008
[    0.000000] Readback ErrCtl register=00000008
[    0.000000] Memory: 124816K/131072K available (3224K kernel code, 167K rwdata, 804K rodata, 276K init, 205K bss, 6256K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS:51
[    0.000000] Clocks: CPU:550.000MHz, DDR:400.000MHz, AHB:200.000MHz, Ref:25.000MHz
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 6950037990 ns
[    0.000011] sched_clock: 32 bits at 275MHz, resolution 3ns, wraps every 7809031678ns
[    0.008896] Calibrating delay loop... 366.18 BogoMIPS (lpj=1830912)
[    0.071924] pid_max: default: 32768 minimum: 301
[    0.077305] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.084814] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.096447] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.107683] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.115344] NET: Registered protocol family 16
[    0.122258] MIPS: machine is Atheros AP147-010 reference board
[    0.133461] ar724x-pci ar724x-pci.0: PCIe link is down
[    0.139304] registering PCI controller with io_map_base unset
[    0.643202] PCI host bridge to bus 0000:00
[    0.647950] pci_bus 0000:00: root bus resource [mem 0x10000000-0x11ffffff]
[    0.655746] pci_bus 0000:00: root bus resource [io  0x0000]
[    0.662076] pci_bus 0000:00: root bus resource [??? 0x00000000 flags 0x0]
[    0.669779] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
[    0.679660] clocksource: Switched to clocksource MIPS
[    0.686698] NET: Registered protocol family 2
[    0.692759] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.700751] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.707981] TCP: Hash tables configured (established 1024 bind 1024)
[    0.715333] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.722025] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.729469] NET: Registered protocol family 1
[    0.740331] Crashlog allocated RAM at address 0x3f00000
[    0.747923] workingset: timestamp_bits=30 max_order=15 bucket_order=0
[    0.763263] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.769931] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.792598] io scheduler noop registered
[    0.797059] io scheduler deadline registered (default)
[    0.803437] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
[    0.811187] console [ttyS0] disabled
[    0.835411] serial8250.0: ttyS0 at MMIO 0x18020000 (irq = 11, base_baud = 1562500) is a 16550A
[    0.845227] console [ttyS0] enabled
[    0.845227] console [ttyS0] enabled
[    0.852784] bootconsole [early0] disabled
[    0.852784] bootconsole [early0] disabled
[    0.865946] m25p80 spi0.0: found w25q128, expected m25p80
[    0.880854] m25p80 spi0.0: w25q128 (16384 Kbytes)
[    0.885765] 6 cmdlinepart partitions found on MTD device spi0.0
[    0.891900] Creating 6 MTD partitions on "spi0.0":
[    0.896860] 0x000000000000-0x000000040000 : "u-boot"
[    0.904528] 0x000000040000-0x000000050000 : "u-boot-env"
[    0.912701] 0x000000050000-0x000000e80000 : "rootfs"
[    0.919823] mtd: device 2 (rootfs) set to be root filesystem
[    0.925727] mtdsplit: no squashfs found in "rootfs"
[    0.931551] 0x000000e80000-0x000000ff0000 : "kernel"
[    0.939031] 0x000000ff0000-0x000001000000 : "art"
[    0.946534] 0x000000050000-0x000000ff0000 : "firmware"
[    0.955711] libphy: Fixed MDIO Bus: probed
[    0.986769] libphy: ag71xx_mdio: probed
[    1.622236] ag71xx-mdio.1: Found an AR934X built-in switch
[    1.675725] eth0: Atheros AG71xx at 0xba000000, irq 5, mode:GMII
[    2.312639] ag71xx ag71xx.0: connected to PHY at ag71xx-mdio.1:04 [uid=004dd042, driver=Generic PHY]
[    2.322985] eth1: Atheros AG71xx at 0xb9000000, irq 4, mode:MII
[    2.331389] NET: Registered protocol family 10
[    2.340932] NET: Registered protocol family 17
[    2.345717] 8021q: 802.1Q VLAN Support v1.8
[    2.354018] List of all partitions:
[    2.357659] 1f00             256 mtdblock0 [    2.361871]  (driver?)
[    2.364312] 1f01              64 mtdblock1 [    2.368444]  (driver?)
[    2.370898] 1f02           14528 mtdblock2 [    2.375029]  (driver?)
[    2.377473] 1f03            1472 mtdblock3 [    2.381616]  (driver?)
[    2.384060] 1f04              64 mtdblock4 [    2.388191]  (driver?)
[    2.390647] 1f05           16000 mtdblock5 [    2.394777]  (driver?)
[    2.397215] No filesystem could mount root, tried: [    2.402072]  squashfs
[    2.404418] 
[    2.405968] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,2)
[    2.415626] Rebooting in 1 seconds..

I think that the panic is caused by the wrong bootargs in the following line:
Kernel command line: board=AP147-010 console=ttyS0,115200 mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,14528k(rootfs),1472k(kernel),64k(art)ro,16000k@0x50000(firmware) rootfstype=squashfs noinitrd, but I have no idea how those are being selected over the bootargs in the device tree?

This device comes with a stock Chaos Calmer image that has been upgraded to the newer AR71XX images, so I'm using the sysupgrade image for flashing.

I've also tried overriding the bootargs in the kernel config, but it seems like those options currently do nothing according to this question.

CONFIG_CMDLINE="rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE_OVERRIDE=y

Is there any other specific file I need to specify the bootargs on? Or is something else causing the panic?

In the device tree you can set bootargs with:

chosen {
    bootargs = "console=ttyS0,115200";
};

As is see in your dts, you are setting already something there. So there is something other wrong!


All the following outputs let me think that you are booting a ar71xx build!

A old kernel that was used on 18.06 for ar71xx. (18.06 hasn't a ath79 target)
And ath79's first supported kernel version was 4.14!

Only the ar71xx clock drivers printed DDR and AHB frequencies. You won't see that on ath79.

This is also only printed on ar71xx builds!

Thanks for your response, @juppin

It looks like you're right about the build, but I'm using the images built using the ATH79 built. Here's my bin/targets/ath79/generic/config.buildinfo

CONFIG_TARGET_ath79=y
CONFIG_TARGET_ath79_generic=y
CONFIG_TARGET_ath79_generic_DEVICE_zbtlink_zbt-we826q=y
CONFIG_PACKAGE_kmod-usb-serial=y
CONFIG_PACKAGE_kmod-usb-serial-option=y
CONFIG_PACKAGE_kmod-usb-serial-wwan=y

I'm using sysupgrade -F -v ... to flash.
Is there a specific way to ensure the upgrade?

@juppin, so I decided to use the in build Breed environment for upgrading.
I've managed to load the image, but I get the following error after loading the image:

breed> Upgrade completed.
Rebooting in 2 seconds ...
Resetting ...
Boot and Recovery Environment for Embedded Devices
Copyright (C) 2018 HackPascal <hackpascal@gmail.com>
Build date 2018-06-12 [git-b25d73d]
Version 1.1 (r1220)

DRAM: 128MB
Platform: Qualcomm Atheros QCA953X rev 2
Board: Letv LBA-047-CH
Clocks: CPU: 550MHz, DDR: 400MHz, AHB: 200MHz, Ref: 25MHz
Flash: Winbond W25Q128 (16MB) on ath79-spi
ag71xx-eth: MAC address is invalid, using default settings.
ag71xx-eth: Using MAC address 00:13:74:00:00:01
Waiting for auto-negotiation complete ... OK
eth0: Atheros AR8228/AR8229 rev 1

Network started on eth0, inet addr 192.168.1.1, netmask 255.255.255.0

Press any key to interrupt autoboot ... 0   

Unable to locate firmware.

Starting breed built-in shell

Would you happen to know why that happens?
Thanks!

sysupgrade is probably fine....

I think your problem is in the DTS

partition@50000 {
				compatible = "tplink,firmware";
				label = "firmware";
				reg = <0x050000 0xfa0000>;

compatible should probably be
compatible = "denx,uimage";

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.