Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FS#359 - kirkwood: kernel does not recognize rootfs in ubi #5409

Closed
openwrt-bot opened this issue Dec 27, 2016 · 0 comments
Closed

FS#359 - kirkwood: kernel does not recognize rootfs in ubi #5409

openwrt-bot opened this issue Dec 27, 2016 · 0 comments
Labels

Comments

@openwrt-bot
Copy link

@openwrt-bot openwrt-bot commented Dec 27, 2016

bobafetthotmail1:

I'm trying to add support for a ZyXEL NSA310 (kirkwood-based NAS), but the kernel does not find the rootfs in the ubi.

The image has kernel+rootfs+rootfs_data in ubi, built with
FILESYSTEMS := squashfs
IMAGES += factory.bin
IMAGE/factory.bin := append-ubi
KERNEL_IN_UBI := 1

If I boot the initramfs (ramdisk) system image while there is a ubi image flashed to nand, it gives this error while booting

[ 1.070706] UBI: auto-attach mtd2
[ 1.073868] ubi0: attaching mtd2
[ 1.083812] UBI: EOF marker found, PEBs from 28 will be erased
[ 1.089971] ubi0: scanning is finished
[ 1.093994] ubi0 error: ubi_read_volume_table: the layout volume was not found
[ 1.101458] ubi0 error: ubi_attach_mtd_dev: failed to attach mtd2, error -22
[ 1.108559] UBI error: cannot attach mtd2

but since ubi isn't necessary for the initramfs image, it works fine and I get to system console.

If I boot the firmware image from nand (and set uboot for booting from ubi, with NO bootargs passed to the kernel), the kernel boots until it finds the same error above, and then it posts this

[ 1.605331] VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6
[ 1.612865] Please append a correct "root=" boot option; here are the available partitions:
[ 1.621268] 1f00 1024 mtdblock0 (driver?)
[ 1.626346] 1f01 512 mtdblock1 (driver?)
[ 1.631439] 1f02 129024 mtdblock2 (driver?)
[ 1.636521] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

And auto-reboots.

I've tried with bootargs like ubi.mtd=2 but with any bootarg about root= or ubi it simply hangs and does not even start the kernel (shortly after uboot executes the kernel the device restarts).

the ubi partition seems to be OK according to uboot (see output of various uboot commands). Any help appreciated.

NSA310> ubi part ubi
ubi0: attaching mtd1
ubi0: scanning is finished
ubi0: attached mtd1 (name "mtd=2", size 126 MiB)
ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 129024 bytes
ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 512
ubi0: VID header offset: 512 (aligned 512), data offset: 2048
ubi0: good PEBs: 1008, bad PEBs: 0, corrupted PEBs: 0
ubi0: user volume: 3, internal volumes: 1, max. volumes count: 128
ubi0: max/mean erase counter: 1/0, WL threshold: 4096, image sequence number: 1235565284
ubi0: available PEBs: 0, total reserved PEBs: 1008, PEBs reserved for bad PEB handling: 20

NSA310> ubi info
UBI: MTD device name: "mtd=2"
UBI: MTD device size: 126 MiB
UBI: physical eraseblock size: 131072 bytes (128 KiB)
UBI: logical eraseblock size: 129024 bytes
UBI: number of good PEBs: 1008
UBI: number of bad PEBs: 0
UBI: smallest flash I/O unit: 2048
UBI: VID header offset: 512 (aligned 512)
UBI: data offset: 2048
UBI: max. allowed volumes: 128
UBI: wear-leveling threshold: 4096
UBI: number of internal volumes: 1
UBI: number of user volumes: 3
UBI: available PEBs: 0
UBI: total number of reserved PEBs: 1008
UBI: number of PEBs reserved for bad PEB handling: 20
UBI: max/mean erase counter: 1/0

NSA310> ubi info l
Volume information dump:
vol_id 0
reserved_pebs 16
alignment 1
data_pad 0
vol_type 3
name_len 6
usable_leb_size 129024
used_ebs 16
used_bytes 2064384
last_eb_bytes 129024
corrupted 0
upd_marker 0
name kernel
Volume information dump:
vol_id 1
reserved_pebs 10
alignment 1
data_pad 0
vol_type 3
name_len 6
usable_leb_size 129024
used_ebs 10
used_bytes 1290240
last_eb_bytes 129024
corrupted 0
upd_marker 0
name rootfs
Volume information dump:
vol_id 2
reserved_pebs 958
alignment 1
data_pad 0
vol_type 3
name_len 11
usable_leb_size 129024
used_ebs 958
used_bytes 123604992
last_eb_bytes 129024
corrupted 0
upd_marker 0
name rootfs_data
Volume information dump:
vol_id 2147479551
reserved_pebs 2
alignment 1
data_pad 0
vol_type 3
name_len 13
usable_leb_size 129024
used_ebs 2
used_bytes 258048
last_eb_bytes 2
corrupted 0
upd_marker 0
name layout volume

@openwrt-bot
Copy link
Author

@openwrt-bot openwrt-bot commented Dec 27, 2016

bobafetthotmail1:

Btw, I'm using the same dtb I use to boot Debian on it.

@openwrt-bot
Copy link
Author

@openwrt-bot openwrt-bot commented Dec 30, 2016

diizzyy:

nbd kindly committed fixes recently which might be of interest, this makes my iomega iconnect device boot and flash properly.

@openwrt-bot
Copy link
Author

@openwrt-bot openwrt-bot commented Dec 31, 2016

bobafetthotmail1:

Sadly, that patch is unrelated (he changes the nand partition names of some kirkwood devices from "root" to "ubi"). My nand partitions already had the right names.

I just built an image with kernel outside of ubi (using same sources as I used for the bug report) and everything works fine.

These are the partitions I have on flash now (before there was only ubi after the uboot stuff).

[ 0.870019] 0x000000000000-0x000000100000 : "uboot"
[ 0.876440] 0x000000100000-0x000000180000 : "uboot_env"
[ 0.882786] 0x000000180000-0x000000680000 : "kernel"
[ 0.888807] 0x000000680000-0x000008000000 : "ubi"

this is the part about ubi not failing like before and actually doing its job.

[ 1.030586] UBI: auto-attach mtd3
[ 1.033752] ubi0: attaching mtd3
[ 1.040249] UBI: EOF marker found, PEBs from 12 will be erased
[ 1.046376] ubi0: scanning is finished
[ 1.081030] ubi0: volume 1 ("rootfs_data") re-sized from 9 to 938 LEBs
[ 1.088278] ubi0: attached mtd3 (name "ubi", size 121 MiB)
[ 1.093820] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 129024 bytes
[ 1.100741] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 512
[ 1.107473] ubi0: VID header offset: 512 (aligned 512), data offset: 2048
[ 1.114305] ubi0: good PEBs: 972, bad PEBs: 0, corrupted PEBs: 0
[ 1.120348] ubi0: user volume: 2, internal volumes: 1, max. volumes count: 128
[ 1.127600] ubi0: max/mean erase counter: 1/0, WL threshold: 4096, image sequence number: 120222938
[ 1.136699] ubi0: available PEBs: 0, total reserved PEBs: 972, PEBs reserved for bad PEB handling: 20
[ 1.146319] ubi0: background thread "ubi_bgt0d" started, PID 903
[ 1.210154] block ubiblock0_0: created from ubi0:0(rootfs)
[ 1.215682] ubiblock: device ubiblock0_0 (rootfs) set to be root filesystem

And I get to serial console afterwards.

So, there are either issues with the kernel patch that detects multiple partitions in ubi when there is also the kernel in it, or I did something wrong.
I did copycat the goflexnet that is working fine here, so I'm a bit puzzled about this.

@openwrt-bot
Copy link
Author

@openwrt-bot openwrt-bot commented Jan 1, 2017

bobafetthotmail1:

a full boot log, in case someone is interested

[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.4.39 (alby@openSUSE-xeon) (gcc version 5.4.0 (LEDE GCC 5.4.0 r2684-94030e8) ) #0 Mon Dec 26 10:17:33 2016
[ 0.000000] CPU: Feroceon 88FR131 [56251311] revision 1 (ARMv5TE), cr=0005397f
[ 0.000000] CPU: VIVT data cache, VIVT instruction cache
[ 0.000000] Machine model: ZyXEL NSA310b
[ 0.000000] Memory policy: Data cache writeback
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 65024
[ 0.000000] Kernel command line: console=ttyS0,115200
[ 0.000000] PID hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.000000] Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
[ 0.000000] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
[ 0.000000] Memory: 253776K/262144K available (3978K kernel code, 138K rwdata, 1484K rodata, 176K init, 196K bss, 8368K reserved, 0K cma-reserved)
[ 0.000000] Virtual kernel memory layout:
[ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
[ 0.000000] fixmap : 0xffc00000 - 0xfff00000 (3072 kB)
[ 0.000000] vmalloc : 0xd0800000 - 0xff800000 ( 752 MB)
[ 0.000000] lowmem : 0xc0000000 - 0xd0000000 ( 256 MB)
[ 0.000000] modules : 0xbf000000 - 0xc0000000 ( 16 MB)
[ 0.000000] .text : 0xc0008000 - 0xc055ddb4 (5464 kB)
[ 0.000000] .init : 0xc055e000 - 0xc058a000 ( 176 kB)
[ 0.000000] .data : 0xc058a000 - 0xc05ac848 ( 139 kB)
[ 0.000000] .bss : 0xc05ac848 - 0xc05ddbec ( 197 kB)
[ 0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] NR_IRQS:16 nr_irqs:16 16
[ 0.000000] clocksource: orion_clocksource: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 9556302233 ns
[ 0.000009] sched_clock: 32 bits at 200MHz, resolution 5ns, wraps every 10737418237ns
[ 0.000090] Calibrating delay loop... 1196.85 BogoMIPS (lpj=5984256)
[ 0.090083] pid_max: default: 32768 minimum: 301
[ 0.090193] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.090213] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.090744] CPU: Testing write buffer coherency: ok
[ 0.091111] Setting up static identity map for 0x81e0 - 0x821c
[ 0.091425] mvebu-soc-id: MVEBU SoC ID=0x6281, Rev=0x3
[ 0.096685] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.096833] pinctrl core: initialized pinctrl subsystem
[ 0.097907] NET: Registered protocol family 16
[ 0.098250] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.099140] cpuidle: using governor ladder
[ 0.099491] Feroceon L2: Enabling L2
[ 0.099536] Feroceon L2: Cache support initialised.
[ 0.117776] SCSI subsystem initialized
[ 0.118532] usbcore: registered new interface driver usbfs
[ 0.118608] usbcore: registered new interface driver hub
[ 0.118667] usbcore: registered new device driver usb
[ 0.119589] clocksource: Switched to clocksource orion_clocksource
[ 0.120680] NET: Registered protocol family 2
[ 0.121212] TCP established hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.121247] TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.121277] TCP: Hash tables configured (established 2048 bind 2048)
[ 0.121328] UDP hash table entries: 256 (order: 0, 4096 bytes)
[ 0.121354] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[ 0.121501] NET: Registered protocol family 1
[ 0.123313] futex hash table entries: 256 (order: -1, 3072 bytes)
[ 0.123384] Crashlog allocated RAM at address 0x3f00000
[ 0.136383] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[ 0.136407] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[ 0.139104] io scheduler noop registered
[ 0.139121] io scheduler deadline registered (default)
[ 0.140356] kirkwood-pinctrl f1010000.pin-controller: registered pinctrl driver
[ 0.140943] irq: Cannot allocate irq_descs @ IRQ33, assuming pre-allocated
[ 0.141291] irq: Cannot allocate irq_descs @ IRQ65, assuming pre-allocated
[ 0.141854] mvebu-pcie mbus:pcie-controller: PCI host bridge to bus 0000:00
[ 0.141873] pci_bus 0000:00: root bus resource [io 0x1000-0xfffff]
[ 0.141884] pci_bus 0000:00: root bus resource [mem 0xe0000000-0xefffffff]
[ 0.141898] pci_bus 0000:00: root bus resource [bus 00-ff]
[ 0.142182] PCI: bus0: Fast back to back transfers disabled
[ 0.142196] pci 0000:00:01.0: bridge configuration invalid ([bus 00-00]), reconfiguring
[ 0.142713] PCI: bus1: Fast back to back transfers disabled
[ 0.142809] pci 0000:00:01.0: BAR 8: assigned [mem 0xe0000000-0xe00fffff]
[ 0.142824] pci 0000:00:01.0: BAR 7: assigned [io 0x10000-0x10fff]
[ 0.142842] pci 0000:01:00.0: BAR 6: assigned [mem 0xe0000000-0xe000ffff pref]
[ 0.142857] pci 0000:01:00.0: BAR 4: assigned [mem 0xe0010000-0xe0013fff 64bit pref]
[ 0.142879] pci 0000:01:00.0: BAR 2: assigned [mem 0xe0014000-0xe0014fff 64bit pref]
[ 0.142898] pci 0000:01:00.0: BAR 0: assigned [io 0x10000-0x100ff]
[ 0.142912] pci 0000:00:01.0: PCI bridge to [bus 01]
[ 0.142924] pci 0000:00:01.0: bridge window [io 0x10000-0x10fff]
[ 0.142937] pci 0000:00:01.0: bridge window [mem 0xe0000000-0xe00fffff]
[ 0.173043] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
[ 0.174068] console [ttyS0] disabled
[ 0.174141] f1012000.serial: ttyS0 at MMIO 0xf1012000 (irq = 26, base_baud = 12500000) is a 16550A
[ 0.709412] console [ttyS0] enabled
[ 0.714092] sata_mv f1080000.sata: slots 32 ports 2
[ 0.722227] scsi host0: sata_mv
[ 0.726140] scsi host1: sata_mv
[ 0.729509] ata1: SATA max UDMA/133 irq 32
[ 0.733661] ata2: SATA max UDMA/133 irq 32
[ 0.738384] nand: device found, Manufacturer ID: 0xec, Chip ID: 0xf1
[ 0.744795] nand: Samsung NAND 128MiB 3,3V 8-bit
[ 0.749436] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[ 0.757062] Scanning device for bad blocks
[ 0.859033] 3 ofpart partitions found on MTD device orion_nand
[ 0.864903] Creating 3 MTD partitions on "orion_nand":
[ 0.870077] 0x000000000000-0x000000100000 : "uboot"
[ 0.876488] 0x000000100000-0x000000180000 : "uboot_env"
[ 0.882830] 0x000000180000-0x000007f80000 : "ubi"
[ 0.889398] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 0.896000] ehci-pci: EHCI PCI platform driver
[ 0.900552] ehci-orion: EHCI orion driver
[ 0.904745] orion-ehci f1050000.ehci: EHCI Host Controller
[ 0.910309] orion-ehci f1050000.ehci: new USB bus registered, assigned bus number 1
[ 0.918134] orion-ehci f1050000.ehci: irq 30, io mem 0xf1050000
[ 0.939607] orion-ehci f1050000.ehci: USB 2.0 started, EHCI 1.00
[ 0.946322] hub 1-0:1.0: USB hub found
[ 0.950295] hub 1-0:1.0: 1 port detected
[ 0.954682] usbcore: registered new interface driver usb-storage
[ 0.961165] rtc-mv f1010300.rtc: rtc core: registered f1010300.rtc as rtc0
[ 0.968123] i2c /dev entries driver
[ 0.972912] orion_wdt: Initial timeout 21 sec
[ 0.982666] marvell-cesa f1030000.crypto: CESA device successfully registered
[ 0.990926] NET: Registered protocol family 10
[ 0.996778] NET: Registered protocol family 17
[ 1.001332] bridge: automatic filtering via arp/ip/ip6tables has been deprecated. Update your scripts to load br_netfilter if you need this.
[ 1.014021] 8021q: 802.1Q VLAN Support v1.8
[ 1.020556] UBI: auto-attach mtd2
[ 1.023721] ubi0: attaching mtd2
[ 1.033646] UBI: EOF marker found, PEBs from 28 will be erased
[ 1.039808] ubi0: scanning is finished
[ 1.043833] ubi0 error: ubi_read_volume_table: the layout volume was not found
[ 1.051305] ubi0 error: ubi_attach_mtd_dev: failed to attach mtd2, error -22
[ 1.058410] UBI error: cannot attach mtd2
[ 1.062520] rtc-mv f1010300.rtc: setting system clock to 2016-12-31 17:20:41 UTC (1483204841)
[ 1.249613] ata1: SATA link down (SStatus 0 SControl F300)
[ 1.289603] usb 1-1: new high-speed USB device number 2 using orion-ehci
[ 1.441676] hub 1-1:1.0: USB hub found
[ 1.445773] hub 1-1:1.0: 4 ports detected
[ 1.599608] ata2: SATA link down (SStatus 0 SControl F300)
[ 1.605318] VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6
[ 1.612856] Please append a correct "root=" boot option; here are the available partitions:
[ 1.621260] 1f00 1024 mtdblock0 (driver?)
[ 1.626339] 1f01 512 mtdblock1 (driver?)
[ 1.631432] 1f02 129024 mtdblock2 (driver?)
[ 1.636513] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[ 1.645537] Rebooting in 1 seconds..

@openwrt-bot
Copy link
Author

@openwrt-bot openwrt-bot commented Jan 1, 2017

bobafetthotmail1:

And a mailing list thread with another guy (J Mo) that encounters the same issue when adding a new device
http://u-boot.denx.narkive.com/VjazWBZq/older-u-boot-mangles-ubi-from-ubinize-1-5-2

[ 3.781181] ubi0: attaching mtd11
[ 3.835224] UBI: EOF marker found, PEBs from 40 will be erased
[ 3.835384] ubi0: scanning is finished
[ 3.840040] ubi0 error: ubi_read_volume_table: the layout volume was
not found
[ 3.844072] ubi0 error: ubi_attach_mtd_dev: failed to attach mtd11,
error -22
[ 3.850897] UBI error: cannot attach mtd11

but then hoses his uboot and the thread stops

@openwrt-bot
Copy link
Author

@openwrt-bot openwrt-bot commented Jan 11, 2017

nbd:

Fixed in r2904-3be4c6ca93

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant