Trying to boot mainline on Wink Hub v1

Rogan Dawes rogan at dawes.za.net
Sun Jun 25 00:54:41 PDT 2023


On Sat, 24 Jun 2023 at 16:36, Fabio Estevam <festevam at gmail.com> wrote:
>
> Adding linux-mtd and some folks who may have some suggestions.
>
> On Sat, Jun 24, 2023 at 11:23 AM Rogan Dawes <rogan at dawes.za.net> wrote:
> >
> > Hi folks,
> >
> > I am trying to boot a mainline (or thereabouts) kernel on the Wink Hub v1, which is an i.MX28-based "home automation hub" dating from around 2014.
> >
> > The vendor kernel is 2.6.35, it has 64MB RAM and 128MB NAND Flash, and I'm hoping to get something like OpenWrt running on it. So far, with Fabio's help, I was able to get it to boot to the point where it cannot find its rootfs (a UBIFS on the NAND) and panics. I did have to revert to 6.1.35 on Fabio's suggestion, as mainline (git clone torvalds/linux as of a day or so ago) was crashing shortly after initialising the USB core.
> >
> > I append the current boot log, in the hopes that someone will be able to assist me in figuring out what is preventing the kernel from recognising the filesystems on the NAND flash. The flash IS recognised, but there are no mtd-related messages subsequent to that.
> >
> > u-boot has some mtdpart-related environment variables, although the mtdparts one doesn't seem to be invoked, rather "mtdparts default" is used:
> >
> > boot_getflag=mtdparts default && ubi part database && ubifsmount ubi0:database && mw 42000000 0 8 && ubifsload 42000000 DO_UPDATE 1 && run boot_logic
> > bootcmd=mtdparts default; run boot_getflag || echo Falling back to updater...; run boot_updater
> > mtdparts=mtdparts=gpmi-nand:3m(u-boot),4m(updater-kernel),28m(updater-rootfs),8m(database),8m(app-kernel),-(app-rootfs)
> > appboot_args=setenv bootargs 'noinitrd console=ttyAM0,115200 rootfstype=ubifs ubi.mtd=5 root=ubi0:rootfs rw gpmi';
> >
> > I used mxs_defconfig when configuring 6.1.35, but had to add the appended DTB and ATAGS due to the ancient u-boot not supporting DTB. I also tried adding the various MTD options below, but they appear to have had no effect.:
> >
> > > CONFIG_ARM_APPENDED_DTB=y
> > > CONFIG_ARM_ATAG_DTB_COMPAT=y
> > > CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_FROM_BOOTLOADER=y
> > > CONFIG_AS_VFP_VMRS_FPINST=y
> > >
> > > CONFIG_MTD_CFI=y
> > > CONFIG_MTD_JEDECPROBE=y
> > > CONFIG_MTD_GEN_PROBE=y
> > > CONFIG_MTD_CFI_INTELEXT=y
> > > CONFIG_MTD_CFI_AMDSTD=y
> > > CONFIG_MTD_CFI_STAA=y
> > > CONFIG_MTD_CFI_UTIL=y
> > > CONFIG_MTD_UBI_BLOCK=y
> >
> > If it is of any use, the vendor kernel is available here: https://github.com/winkapp/wink-hub-kernel-public
> >
> > Any suggestions would be welcome. Many thanks
> >
> > Rogan
> >
> > U-Boot 2014.01-14400-gda781c6-dirty (Apr 30 2014 - 22:35:38)
> >
> > CPU:   Freescale i.MX28 rev1.2 at 454 MHz
> > BOOT:  NAND, 3V3
> > DRAM:  64 MiB
> > NAND:  128 MiB
> > In:    serial
> > Out:   serial
> > Err:   serial
> > Net:   FEC0 [PRIME]
> > Hit any key to stop autoboot:  0
> > UBI: attaching mtd1 to ubi0
> > UBI: physical eraseblock size:   131072 bytes (128 KiB)
> > UBI: logical eraseblock size:    126976 bytes
> > UBI: smallest flash I/O unit:    2048
> > UBI: VID header offset:          2048 (aligned 2048)
> > UBI: data offset:                4096
> > UBI: attached mtd1 to ubi0
> > UBI: MTD device name:            "mtd=3"
> > UBI: MTD device size:            8 MiB
> > UBI: number of good PEBs:        64
> > UBI: number of bad PEBs:         0
> > UBI: max. allowed volumes:       128
> > UBI: wear-leveling threshold:    4096
> > UBI: number of internal volumes: 1
> > UBI: number of user volumes:     1
> > UBI: available PEBs:             0
> > UBI: total number of reserved PEBs: 64
> > UBI: number of PEBs reserved for bad PEB handling: 2
> > UBI: max/mean erase counter: 78/64
> > UBIFS: mounted UBI device 0, volume 0, name "database"
> > UBIFS: mounted read-only
> > UBIFS: file system size:   6221824 bytes (6076 KiB, 5 MiB, 49 LEBs)
> > UBIFS: journal size:       1015809 bytes (992 KiB, 0 MiB, 6 LEBs)
> > UBIFS: media format:       w4/r0 (latest is w4/r0)
> > UBIFS: default compressor: LZO
> > UBIFS: reserved for root:  307487 bytes (300 KiB)
> > Loading file 'DO_UPDATE' to addr 0x42000000 with size 1 (0x00000001)...
> > Done
> > Total of 1 word(s) were the same
> >
> > NAND read: device 0 offset 0x2b00000, size 0x600000
> >  6291456 bytes read: OK
> > ## Booting kernel from Legacy Image at 42000000 ...
> >    Image Name:
> >    Created:      2023-06-24  13:06:31 UTC
> >    Image Type:   ARM Linux Kernel Image (uncompressed)
> >    Data Size:    5962866 Bytes = 5.7 MiB
> >    Load Address: 40008000
> >    Entry Point:  40008000
> >    Verifying Checksum ... OK
> >    Loading Kernel Image ... OK
> >
> > Starting kernel ...
> >
> > [    0.000000] Booting Linux on physical CPU 0x0
> > [    0.000000] Linux version 6.1.35-dirty (rogan at vermin) (arm-linux-gnueabi-gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2) #5 Sat Jun 24 15:06:07 SAST 2023
> > [    0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=0005317f
> > [    0.000000] CPU: VIVT data cache, VIVT instruction cache
> > [    0.000000] OF: fdt: Machine model: i.MX28 Wink Hub v1
> > [    0.000000] Memory policy: Data cache writeback
> > [    0.000000] Zone ranges:
> > [    0.000000]   Normal   [mem 0x0000000040000000-0x0000000043ffffff]
> > [    0.000000] Movable zone start for each node
> > [    0.000000] Early memory node ranges
> > [    0.000000]   node   0: [mem 0x0000000040000000-0x0000000043ffffff]
> > [    0.000000] Initmem setup node 0 [mem 0x0000000040000000-0x0000000043ffffff]
> > [    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 16256
> > [    0.000000] Kernel command line: noinitrd console=ttyAMA0,115200 rootfstype=ubifs ubi.mtd=5 root=ubi0:rootfs rw gpmi
> > [    0.000000] Unknown kernel command line parameters "gpmi", will be passed to user space.
> > [    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes, linear)
> > [    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes, linear)
> > [    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
> > [    0.000000] Memory: 45644K/65536K available (8460K kernel code, 1199K rwdata, 2588K rodata, 244K init, 6471K bss, 19892K reserved, 0K cma-reserved)
> > [    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
> > [    0.000000] trace event string verifier disabled
> > [    0.000000] Running RCU self tests
> > [    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
> > [    0.000000] clocksource: mxs_timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
> > [    0.000006] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
> > [    0.003405] Console: colour dummy device 80x30
> > [    0.003693] Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., Ingo Molnar
> > [    0.003739] ... MAX_LOCKDEP_SUBCLASSES:  8
> > [    0.003779] ... MAX_LOCK_DEPTH:          48
> > [    0.003811] ... MAX_LOCKDEP_KEYS:        8192
> > [    0.003839] ... CLASSHASH_SIZE:          4096
> > [    0.003866] ... MAX_LOCKDEP_ENTRIES:     32768
> > [    0.003893] ... MAX_LOCKDEP_CHAINS:      65536
> > [    0.003920] ... CHAINHASH_SIZE:          32768
> > [    0.003947]  memory used by lock dependency info: 4061 kB
> > [    0.003977]  memory used for stack traces: 2112 kB
> > [    0.004002]  per task-struct memory footprint: 1536 bytes
> > [    0.004298] Calibrating delay loop... 226.09 BogoMIPS (lpj=1130496)
> > [    0.081618] pid_max: default: 32768 minimum: 301
> > [    0.084059] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
> > [    0.084195] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
> > [    0.097589] CPU: Testing write buffer coherency: ok
> > [    0.111607] Setting up static identity map for 0x40008400 - 0x40008458
> > [    0.123246] devtmpfs: initialized
> > [    0.190262] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
> > [    0.190533] futex hash table entries: 256 (order: 1, 12288 bytes, linear)
> > [    0.192143] pinctrl core: initialized pinctrl subsystem
> > [    0.215464] NET: Registered PF_NETLINK/PF_ROUTE protocol family
> > [    0.220040] DMA: preallocated 256 KiB pool for atomic coherent allocations
> > [    0.425508] Serial: AMBA PL011 UART driver
> > [    0.431690] 80074000.serial: ttyAMA0 at MMIO 0x80074000 (irq = 182, base_baud = 0) is a PL011 rev2
> > [    0.754392] printk: console [ttyAMA0] enabled
> > [    3.161398] SCSI subsystem initialized
> > [    3.170058] usbcore: registered new interface driver usbfs
> > [    3.176937] usbcore: registered new interface driver hub
> > [    3.182882] usbcore: registered new device driver usb
> > [    3.190465] pps_core: LinuxPPS API ver. 1 registered
> > [    3.195573] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti at linux.it>
> > [    3.205257] PTP clock support registered
> > [    3.213085] Advanced Linux Sound Architecture Driver Initialized.
> > [    3.234306] clocksource: Switched to clocksource mxs_timer
> > [    3.395135] NET: Registered PF_INET protocol family
> > [    3.402895] IP idents hash table entries: 2048 (order: 2, 16384 bytes, linear)
> > [    3.416774] tcp_listen_portaddr_hash hash table entries: 128 (order: 0, 5120 bytes, linear)
> > [    3.425632] Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear)
> > [    3.433821] TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear)
> > [    3.442028] TCP bind hash table entries: 1024 (order: 4, 81920 bytes, linear)
> > [    3.450483] TCP: Hash tables configured (established 1024 bind 1024)
> > [    3.458377] UDP hash table entries: 256 (order: 2, 24576 bytes, linear)
> > [    3.465777] UDP-Lite hash table entries: 256 (order: 2, 24576 bytes, linear)
> > [    3.474778] NET: Registered PF_UNIX/PF_LOCAL protocol family
> > [    3.488201] RPC: Registered named UNIX socket transport module.
> > [    3.494815] RPC: Registered udp transport module.
> > [    3.499655] RPC: Registered tcp transport module.
> > [    3.504660] RPC: Registered tcp NFSv4.1 backchannel transport module.
> > [    4.657683] workingset: timestamp_bits=30 max_order=14 bucket_order=0
> > [    4.775685] NFS: Registering the id_resolver key type
> > [    4.782073] Key type id_resolver registered
> > [    4.786941] Key type id_legacy registered
> > [    4.791827] jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
> > [    4.806023] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 248)
> > [    4.813930] io scheduler mq-deadline registered
> > [    4.818839] io scheduler kyber registered
> > [    4.869244] mxs-dma 80004000.dma-apbh: initialized
> > [    4.891685] mxs-dma 80024000.dma-apbx: initialized
> > [    4.923617] nand: device found, Manufacturer ID: 0x01, Chip ID: 0xf1
> > [    4.930339] nand: AMD/Spansion S34ML01G1
> > [    4.934570] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
> > [    4.942857] Scanning device for bad blocks
> > [    5.826118] gpmi-nand 8000c000.nand-controller: driver registered.
> > [    5.859955] usbcore: registered new interface driver asix
> > [    5.866184] usbcore: registered new interface driver ax88179_178a
> > [    5.872851] usbcore: registered new interface driver cdc_ether
> > [    5.879653] usbcore: registered new interface driver smsc95xx
> > [    5.886224] usbcore: registered new interface driver net1080
> > [    5.892535] usbcore: registered new interface driver cdc_subset
> > [    5.899239] usbcore: registered new interface driver zaurus
> > [    5.905912] usbcore: registered new interface driver cdc_ncm
> > [    5.912217] usbcore: registered new interface driver r8153_ecm
> > [    5.919034] usbcore: registered new interface driver usb-storage
> > [    5.937188] stmp3xxx-rtc 80056000.rtc: registered as rtc0
> > [    5.943091] stmp3xxx-rtc 80056000.rtc: setting system clock to 1970-01-01T02:13:23 UTC (8003)
> > [    5.953933] i2c_dev: i2c /dev entries driver
> > [    5.969696] stmp3xxx_rtc_wdt stmp3xxx_rtc_wdt: initialized watchdog with heartbeat 19s
> > [    5.997893] usbcore: registered new interface driver usbhid
> > [    6.003611] usbhid: USB HID core driver
> > [    6.027058] NET: Registered PF_PACKET protocol family
> > [    6.033019] Key type dns_resolver registered
> > [    6.041529] registered taskstats version 1
> > [    6.248291] UBI error: cannot open mtd 5, error -19
> > [    6.260823] ALSA device list:
> > [    6.264585]   No soundcards found.
> > [    6.274234] uart-pl011 80074000.serial: no DMA platform data
> > [    6.282805] VFS: Cannot open root device "ubi0:rootfs" or unknown-block(0,0): error -19
> > [    6.291188] Please append a correct "root=" boot option; here are the available partitions:
> > [    6.299882] 1f00          131072 mtdblock0
> > [    6.299987]  (driver?)
> > [    6.307019] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
> > [    6.315384] CPU: 0 PID: 1 Comm: swapper Not tainted 6.1.35-dirty #5
> > [    6.321751] Hardware name: Freescale MXS (Device Tree)
> > [    6.326969]  unwind_backtrace from show_stack+0x10/0x14
> > [    6.332371]  show_stack from dump_stack_lvl+0x38/0x4c
> > [    6.337570]  dump_stack_lvl from panic+0x114/0x338
> > [    6.342503]  panic from mount_block_root+0x17c/0x238
> > [    6.347633]  mount_block_root from prepare_namespace+0x88/0x184
> > [    6.353705]  prepare_namespace from kernel_init+0x10/0x108
> > [    6.359337]  kernel_init from ret_from_fork+0x14/0x3c
> > [    6.364506] Exception stack(0xc4819fb0 to 0xc4819ff8)
> > [    6.369649] 9fa0:                                     00000000 00000000 00000000 00000000
> > [    6.377920] 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
> > [    6.386187] 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
> > [    6.392909] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) ]---

I *think* my problem is that U-Boot is not aware of the device tree,
as I have been passing it as an appended item to the kernel, thinking
that U-Boot was not Device-Tree compliant. Consequently, it is unable
to patch it with the contents of the mtdparts environment variable,
and hence the kernel never knows to go looking for the mtd partitions.
Checking the supported commands shows that it does understand Device
Tree (fdt command is present), so rather than creating a concatenated
kernel and DT, I should instead create a FIT.

My question now is how do I determine load addresses? I created the
appended .its file, which gets loaded at 0x42000000 (as $loadaddr). I
realise now that I am then overwriting the FIT when the kernel gets
unpacked from the image. And I'm not sure where to put the dtb either.
Is there a rule of thumb? As a reminder, the device has 64MB RAM,
which confuses me further - 0x42000000 seems to be well outside of
that 64MB range. Clearly the RAM must be present at some "base
address", but I'm not sure where to find that.

Thanks

Rogan

/dts-v1/;

/ {
        description = "arm kernel, ramdisk and FDT blob";
        #address-cells = <1>;

        images {
                kernel {
                        description = "ARM MXS Kernel";
                        data = /incbin/("Image.gz");
                        type = "kernel";
                        arch = "arm";
                        os = "linux";
                        compression = "gzip";
                        load = <0x42000000>;
                        entry = <0x42000000>;
                        hash {
                                algo = "sha1";
                        };
                };

                imx28-wink-hub-v1 {
                        description = "lx2162aqds-dtb";
                        data = /incbin/("imx28-wink-hub-v1.dtb");
                        type = "flat_dt";
                        arch = "arm";
                        os = "linux";
                        compression = "none";
                        load = <0x90000000>;
                        hash {
                                algo = "sha1";
                        };
                };
/*
                initrd {
                        description = "initrd for arm";
                        data = /incbin/("image-core-wink-hub-v1.ext2.gz");
                        type = "ramdisk";
                        arch = "arm";
                        os = "linux";
                        compression = "none";
                        load = <0x00000000>;
                        entry = <0x00000000>;
                        hash {
                                algo = "sha1";
                        };
                };
*/
        };

        configurations {
                default = "wink-hub-v1";
                wink-hub-v1 {
                        description = "config for Wink Hub v1";
                        kernel = "kernel";
                        // ramdisk = "initrd";
                        fdt = "imx28-wink-hub-v1";
                };
        };
};



More information about the linux-mtd mailing list