[OpenWrt-Devel] Same Kernel Crash / Dont crash , given an attempt to read rootfs ?

sven falempin sven.falempin at gmail.com
Thu Sep 5 13:25:34 EDT 2019


Hello,

I was learning about openWRT and trying to get an ipq4019 to work with
recent openwrt

I forked : d3e832d6fda8a39e7ec262994f75dac67353dcae and create a DTS
file from the templates, tried my build using dhcp/bootm initramfs
Kernel,

The layout of the flash separate the FIT kernel and the ROOTFS,
I extracted ( probably not the best way , below for details ) the hsqs
/ squashfs part of the factory image,

When the device boot the non ramfs KERNEL it crashes like that :

[    1.032721] 0x000000580000-0x000001b80000 : "rootfs"
[    1.037444] mtd: device 9 (rootfs) set to be root filesystem
[    1.042160] 1 squashfs-split partitions found on MTD device rootfs
[    1.047606] 0x000000c00000-0x000001b80000 : "rootfs_data"
[    1.054867] ipq4019-pinctrl 1000000.pinctrl: invalid function mdio0
in map table
[    1.059189] libphy: ipq40xx_mdio: probed
[    1.070582] Unable to handle kernel NULL pointer dereference at
virtual address 000000a4
[    1.070621] pgd = (ptrval)
[    1.078484] [000000a4] *pgd=00000000
[    1.080973] Internal error: Oops: 5 [#1] SMP ARM
[    1.084699] Modules linked in:
[    1.089302] CPU: 2 PID: 1 Comm: swapper/0 Not tainted 4.19.64 #0
[    1.092167] Hardware name: Generic DT based system
[    1.098338] PC is at ar40xx_probe+0x308/0x724
[    1.102932] LR is at ar40xx_probe+0x2fc/0x724
[    1.107354] pc : [<c0607b8c>]    lr : [<c0607b80>]    psr: 60000013
[    1.111698] sp : df449e08  ip : dfb585a4  fp : 00000000
[    1.117774] r10: df5a4200  r9 : c0b20574  r8 : c0b5f4e4
[    1.122983] r7 : df5a4210  r6 : dfb779f0  r5 : 00000000  r4 : df7e0040
[    1.128192] r3 : 00000002  r2 : 00000000  r1 : 00000000  r0 : df7e0040
[    1.134793] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
[    1.141304] Control: 10c5387d  T: 00000051
[    1.148504] Process swapper/0 (pid: 1, stack limit = 0x(ptrval))
[    1.154235] Stack: (0xdf449e08 to 0xdf44a000)
[    1.160313] 9e00:                   00000000 dfb6f3f8 df5769c0
00000004 00098000 000987ff
[    1.164575] 9e20: dfb77d28 00000200 00000000 00000000 00000000
00000000 0c000000 0c07ffff
[    1.172732] 9e40: dfb77a48 00000200 00000000 00000000 00000000
00000000 c0b20574 df5a4210
[    1.180893] 9e60: c0b20574 c0b5e858 00000000 00000000 c0b20574
00000000 00000000 c05a6368
[    1.189053] 9e80: c0b5e854 df5a4210 c0b5e858 c05a4ba8 df5a4210
c0b20574 df5a4244 00000000
[    1.197213] 9ea0: 00000000 00000062 c0a35c04 c05a4fd0 df5a4210
c0b20574 c05a4f40 c05a3144
[    1.205371] 9ec0: df407d58 df552db4 c0b20574 df575600 c0b1cde8
c05a4144 c089aa18 ffffe000
[    1.213533] 9ee0: c0b20574 c0b20574 c0b04c48 ffffe000 c0a1778c
c05a56d4 c0b29dc0 c0b04c48
[    1.221690] 9f00: ffffe000 c03026a4 00000003 00000000 00000000
c0353100 00000000 df449f24
[    1.229853] 9f20: cccccccd 00000000 c08dbee8 c08a0be8 00000006
00000006 c08658c4 00000000
[    1.238009] 9f40: c086c214 c0865938 c0a2b83c cccccccd 00000000
00041340 00000007 c0b29dc0
[    1.246171] 9f60: c0b29dc0 c0a2b834 c0a2b83c c0a35c04 00000000
c0a00eec 00000006 00000006
[    1.254328] 9f80: 00000000 c0a0058c 00000000 c079621c 00000000
00000000 00000000 00000000
[    1.262490] 9fa0: 00000000 c0796224 00000000 c03010e8 00000000
00000000 00000000 00000000
[    1.270647] 9fc0: 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000
[    1.278809] 9fe0: 00000000 00000000 00000000 00000000 00000013
00000000 00000000 00000000
[    1.286984] [<c0607b8c>] (ar40xx_probe) from [<c05a6368>]
(platform_drv_probe+0x34/0x70)
[    1.295135] [<c05a6368>] (platform_drv_probe) from [<c05a4ba8>]
(really_probe+0x14c/0x2b4)
[    1.303292] [<c05a4ba8>] (really_probe) from [<c05a4fd0>]
(__driver_attach+0x90/0xc4)
[    1.311363] [<c05a4fd0>] (__driver_attach) from [<c05a3144>]
(bus_for_each_dev+0x48/0x98)
[    1.319264] [<c05a3144>] (bus_for_each_dev) from [<c05a4144>]
(bus_add_driver+0xe8/0x200)
[    1.327420] [<c05a4144>] (bus_add_driver) from [<c05a56d4>]
(driver_register+0xbc/0xf8)
[    1.335583] [<c05a56d4>] (driver_register) from [<c03026a4>]
(do_one_initcall+0x7c/0x184)
[    1.343398] [<c03026a4>] (do_one_initcall) from [<c0a00eec>]
(kernel_init_freeable+0x1c4/0x260)
[    1.351731] [<c0a00eec>] (kernel_init_freeable) from [<c0796224>]
(kernel_init+0x8/0x114)
[    1.360237] [<c0796224>] (kernel_init) from [<c03010e8>]
(ret_from_fork+0x14/0x2c)

I do not understand how a (maybe) invalid rootfs could crash the
kernel like that
especially when the ramfs kernel works fine :


[    1.163653] 0x000000580000-0x000001b80000 : "rootfs"
[    1.168320] mtd: device 9 (rootfs) set to be root filesystem
[    1.173108] 1 squashfs-split partitions found on MTD device rootfs
[    1.178525] 0x000000c00000-0x000001b80000 : "rootfs_data"
[    1.185837] ipq4019-pinctrl 1000000.pinctrl: invalid function mdio0
in map table
[    1.190099] libphy: ipq40xx_mdio: probed
[    1.268444] ESS reset ok!
[    1.301448] ESS reset ok!
[    1.719346] libphy: Fixed MDIO Bus: probed
[    1.824620] i2c /dev entries driver
[    1.824907] i2c_qup 78b7000.i2c: using default clock-frequency 100000
[    1.834006] NET: Registered protocol family 10
[    1.836073] Segment Routing with IPv6
[    1.837977] NET: Registered protocol family 17
[    1.841834] 8021q: 802.1Q VLAN Support v1.8
[    1.846005] Registering SWP/SWPB emulation handler
[    1.85675[    1.878475] Freeing unused kernel memory: 14336K
[    1.927344] Run /init as init process
[    1.959651] init: Console is alive
[    1.959930] init: - watchdog -
[    1.973086] kmodloader: loading kernel modules from /etc/modules-boot.d/

I setup my test like this :
I just look for the magic of squash and DD out of the  file the data
to flash the rootfs partition
dd if=/home/toor/release/HD53/bin/targets/ipq40xx/generic/openwrt-ipq40xx-ipq-hd53-squashfs-nand-factory.ubi
skip=459264 bs=8 > ./hd53.hsqs

I did not find another way to do that, nor I understand how
ar40xx_probe is related to rootfs

Basically I boot /dev/mtd8 and i put hd53.hsqs in /dev/mtd9, the
~/release/HD53/bin/targets/ipq40xx/generic/openwrt-ipq40xx-ipq-hd53-fit-uImage.itb
in /dev/mtd8
and the u-boot tftp boot these file
~/release/HD53/bin/targets/ipq40xx/generic/openwrt-ipq40xx-ipq-hd53-initramfs-fit-uImage.itb

TFTP BOOT is fine , booting the  openwrt-ipq40xx-ipq-hd53-fit-uImage.itb crashes

It's mostly confusing to me.
My main question is : did I screw up the rootfs so bad it does, or is
there another problem ?

Thank you for reading.

_______________________________________________
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