"Enabling reset hack" on boot



  • Hey there. Now that I'm quite familiar with my Omega2s+, I've re-embarked on customising our OS image directly from the stable OpenWRT 22.03 branch. We're doing this mainly from a security and control perspective as we can see production looming. I realise there's a 22.03 branch directly from Onion, but we end up having to disable features. I'd rather add features as necessary.

    My main question at this point is based on observing the logs at boot time. I notice the following:

    Sat Jun  3 09:42:30 2023 kern.warn kernel: [    0.386866] WARNING: CPU: 0 PID: 1 at drivers/mtd/spi-nor/core.c:2862 spi_nor_init+0x17c/0x184
    Sat Jun  3 09:42:30 2023 kern.warn kernel: [    0.395721] enabling reset hack; may not recover from unexpected reboots
    Sat Jun  3 09:42:30 2023 kern.warn kernel: [    0.402525] Modules linked in:
    Sat Jun  3 09:42:30 2023 kern.warn kernel: [    0.405631] CPU: 0 PID: 1 Comm: swapper Not tainted 5.15.114 #0
    Sat Jun  3 09:42:30 2023 kern.warn kernel: [    0.411655] Stack : 00000000 00000000 80c23974 80860000 806a0000 805fb6b8 80c39300 8069fe23
    Sat Jun  3 09:42:30 2023 kern.warn kernel: [    0.420187]         808633b4 00000001 809b7e90 80061ad8 805f4e8c 00000001 80c23930 2e702557
    Sat Jun  3 09:42:30 2023 kern.warn kernel: [    0.428718]         00000000 00000000 805fb6b8 80c237c8 ffffefff 00000000 00000000 ffffffea
    Sat Jun  3 09:42:30 2023 kern.warn kernel: [    0.437234]         00000000 80c237d4 00000049 806a6298 80860000 00000009 00000000 8036adbc
    Sat Jun  3 09:42:30 2023 kern.warn kernel: [    0.445756]         00000009 809b7e90 80640000 80e4f800 00000018 8032ddc8 00000000 80860000
    Sat Jun  3 09:42:30 2023 kern.warn kernel: [    0.454285]         ...
    Sat Jun  3 09:42:30 2023 kern.warn kernel: [    0.456773] Call Trace:
    Sat Jun  3 09:42:30 2023 kern.warn kernel: [    0.459261] [<8000702c>] show_stack+0x28/0xf0
    Sat Jun  3 09:42:30 2023 kern.warn kernel: [    0.463714] [<800261b4>] __warn+0x9c/0x124
    Sat Jun  3 09:42:30 2023 kern.warn kernel: [    0.467895] [<800262c8>] warn_slowpath_fmt+0x8c/0xac
    Sat Jun  3 09:42:30 2023 kern.warn kernel: [    0.472943] [<8036adbc>] spi_nor_init+0x17c/0x184
    Sat Jun  3 09:42:30 2023 kern.warn kernel: [    0.477728] [<8036b650>] spi_nor_scan+0x7a4/0xba0
    Sat Jun  3 09:42:30 2023 kern.warn kernel: [    0.482524] [<8036c390>] spi_nor_probe+0x94/0x310
    Sat Jun  3 09:42:30 2023 kern.warn kernel: [    0.487312] [<8033ed18>] really_probe.part.0+0xac/0x354
    Sat Jun  3 09:42:30 2023 kern.warn kernel: [    0.492649] [<8033f24c>] driver_probe_device+0x4c/0x154
    Sat Jun  3 09:42:30 2023 kern.warn kernel: [    0.497977] [<8033f8a4>] __device_attach_driver+0xd0/0x15c
    Sat Jun  3 09:42:30 2023 kern.warn kernel: [    0.503556] [<8033c990>] bus_for_each_drv+0x70/0xb0
    Sat Jun  3 09:42:30 2023 kern.warn kernel: [    0.508526] [<8033f5c8>] __device_attach+0xe0/0x180
    Sat Jun  3 09:42:30 2023 kern.warn kernel: [    0.513487] [<8033dc64>] bus_probe_device+0xa0/0xbc
    Sat Jun  3 09:42:30 2023 kern.warn kernel: [    0.518456] [<8033a408>] device_add+0x3e4/0x8e0
    Sat Jun  3 09:42:30 2023 kern.warn kernel: [    0.523062] [<80376b84>] __spi_add_device+0x80/0x160
    Sat Jun  3 09:42:30 2023 kern.warn kernel: [    0.528140] [<80376cc4>] spi_add_device+0x60/0x9c
    Sat Jun  3 09:42:30 2023 kern.warn kernel: [    0.532925] [<80377630>] spi_register_controller+0x7bc/0xaf4
    Sat Jun  3 09:42:30 2023 kern.warn kernel: [    0.538688] [<8037a0a8>] mt7621_spi_probe+0x168/0x220
    Sat Jun  3 09:42:30 2023 kern.warn kernel: [    0.543831] [<803414ac>] platform_probe+0x50/0xa4
    Sat Jun  3 09:42:30 2023 kern.warn kernel: [    0.548633] [<8033ed18>] really_probe.part.0+0xac/0x354
    Sat Jun  3 09:42:30 2023 kern.warn kernel: [    0.553946] [<8033f24c>] driver_probe_device+0x4c/0x154
    Sat Jun  3 09:42:30 2023 kern.warn kernel: [    0.559268] [<8033f9dc>] __driver_attach+0xac/0x1ac
    Sat Jun  3 09:42:30 2023 kern.warn kernel: [    0.564229] [<8033c8e4>] bus_for_each_dev+0x68/0xa4
    Sat Jun  3 09:42:30 2023 kern.warn kernel: [    0.569198] [<8033df38>] bus_add_driver+0x150/0x238
    Sat Jun  3 09:42:30 2023 kern.warn kernel: [    0.574158] [<803401dc>] driver_register+0x98/0x154
    Sat Jun  3 09:42:30 2023 kern.warn kernel: [    0.579129] [<80000638>] do_one_initcall+0x50/0x1b4
    Sat Jun  3 09:42:30 2023 kern.warn kernel: [    0.584086] [<8072e0d4>] kernel_init_freeable+0x1d0/0x26c
    Sat Jun  3 09:42:30 2023 kern.warn kernel: [    0.589591] [<80564058>] kernel_init+0x20/0x108
    Sat Jun  3 09:42:30 2023 kern.warn kernel: [    0.594217] [<80002478>] ret_from_kernel_thread+0x14/0x1c
    

    While it shows as a warning, I wonder if there's something for us to attend to here. Any ideas? I've not found much info re. the warning message elsewhere.

    Configuration info:

    • For Target System, selected MediaTek Ralink MIPS
    • For Subtarget, selected MT76x8 based boards
    • For Target Profile, Onion Omega2+

    Thanks.



  • @huntc The comments in the spi-nor driver seems to explain it.

    if (nor->addr_width == 4 &&
        nor->read_proto != SNOR_PROTO_8_8_8_DTR &&
        !(nor->flags & SNOR_F_4B_OPCODES)) {
    	/*
    	 * If the RESET# pin isn't hooked up properly, or the system
    	 * otherwise doesn't perform a reset command in the boot
    	 * sequence, it's impossible to 100% protect against unexpected
    	 * reboots (e.g., crashes). Warn the user (or hopefully, system
    	 * designer) that this is bad.
    	 */
    	WARN_ONCE(nor->flags & SNOR_F_BROKEN_RESET,
    		  "enabling reset hack; may not recover from unexpected reboots\n");
    	nor->params->set_4byte_addr_mode(nor, true);
    }

  • administrators

    @huntc Yep, the broken reset mentioned by @crispyoz is enabled in the Omega2P DTS file: https://github.com/openwrt/openwrt/blob/openwrt-22.03/target/linux/ramips/dts/mt7628an_onion_omega2p.dts#L9

    This is related to an issue with the flash chip, see our FAQ on that here: https://community.onion.io/topic/4338/faq-how-come-the-omega2-won-t-reboot-after-i-toggle-the-rst-pin


    As an aside, I don't see the same warning when using the latest Onion 22.03 beta firmware:

    root@Omega-f195:/# dmesg
    [    0.000000] Linux version 5.10.161 (builder@buildhost) (mipsel-openwrt-linux-musl-gcc (OpenWrt GCC 11.2.0 r20028-43d71ad93e) 11.2.0, GNU ld (GNU Binutils) 2.37) #0 Tue Jan 3 00:24:21 2023
    [    0.000000] Board has DDR2
    [    0.000000] Analog PMU set to hw control
    [    0.000000] Digital PMU set to hw control
    [    0.000000] SoC Type: MediaTek MT7688 ver:1 eco:2
    [    0.000000] printk: bootconsole [early0] enabled
    [    0.000000] CPU0 revision is: 00019655 (MIPS 24KEc)
    [    0.000000] MIPS: machine is Onion Omega2+
    [    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, PIPT, no 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] On node 0 totalpages: 32768
    [    0.000000]   Normal zone: 288 pages used for memmap
    [    0.000000]   Normal zone: 0 pages reserved
    [    0.000000]   Normal zone: 32768 pages, LIFO batch:7
    [    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
    [    0.000000] pcpu-alloc: [0] 0
    [    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 32480
    [    0.000000] Kernel command line: console=ttyS0,115200 rootfstype=squashfs,jffs2
    [    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes, linear)
    [    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes, linear)
    [    0.000000] Writing ErrCtl register=00025d1e
    [    0.000000] Readback ErrCtl register=00025d1e
    [    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
    [    0.000000] Memory: 121196K/131072K available (5751K kernel code, 622K rwdata, 700K rodata, 1236K init, 210K bss, 9876K reserved, 0K cma-reserved)
    [    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
    [    0.000000] NR_IRQS: 256
    [    0.000000] intc: using register map from devicetree
    [    0.000000] CPU Clock: 580MHz
    [    0.000000] timer_probe: no matching timers found
    [    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 6590553264 ns
    [    0.000011] sched_clock: 32 bits at 290MHz, resolution 3ns, wraps every 7405115902ns
    [    0.007659] Calibrating delay loop... 385.84 BogoMIPS (lpj=1929216)
    [    0.073587] pid_max: default: 32768 minimum: 301
    [    0.078256] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
    [    0.085275] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
    [    0.095423] dyndbg: Ignore empty _ddebug table in a CONFIG_DYNAMIC_DEBUG_CORE build
    [    0.107436] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
    [    0.116950] futex hash table entries: 256 (order: -1, 3072 bytes, linear)
    [    0.123592] pinctrl core: initialized pinctrl subsystem
    [    0.133880] NET: Registered protocol family 16
    [    0.139064] thermal_sys: Registered thermal governor 'step_wise'
    [    0.215647] clocksource: Switched to clocksource MIPS
    [    0.227929] NET: Registered protocol family 2
    [    0.232411] IP idents hash table entries: 2048 (order: 2, 16384 bytes, linear)
    [    0.240429] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear)
    [    0.248601] TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear)
    [    0.255984] TCP bind hash table entries: 1024 (order: 0, 4096 bytes, linear)
    [    0.262760] TCP: Hash tables configured (established 1024 bind 1024)
    [    0.269069] UDP hash table entries: 256 (order: 0, 4096 bytes, linear)
    [    0.275352] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes, linear)
    [    0.282472] NET: Registered protocol family 1
    [    0.286715] PCI: CLS 0 bytes, default 32
    [    0.299022] workingset: timestamp_bits=14 max_order=15 bucket_order=1
    [    0.311026] squashfs: version 4.0 (2009/01/31) Phillip Lougher
    [    0.316666] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
    [    0.328431] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
    [    0.338271] mt7621_gpio 10000600.gpio: registering 32 gpios
    [    0.343872] mt7621_gpio 10000600.gpio: registering 32 gpios
    [    0.349617] mt7621_gpio 10000600.gpio: registering 32 gpios
    [    0.355285] Serial: 8250/16550 driver, 16 ports, IRQ sharing enabled
    [    0.364531] printk: console [ttyS0] disabled
    [    0.368779] 10000c00.uartlite: ttyS0 at MMIO 0x10000c00 (irq = 28, base_baud = 2500000) is a 16550A
    [    0.377518] printk: console [ttyS0] enabled
    [    0.385923] printk: bootconsole [early0] disabled
    [    0.396325] 10000d00.uart1: ttyS1 at MMIO 0x10000d00 (irq = 29, base_baud = 2500000) is a 16550A
    [    0.406193] 10000e00.uart2: ttyS2 at MMIO 0x10000e00 (irq = 30, base_baud = 2500000) is a 16550A
    [    0.416851] spi-mt7621 10000b00.spi: sys_freq: 193333333
    [    0.446537] spi-nor spi0.0: mx25l25635e (32768 Kbytes)
    [    0.451827] 4 fixed-partitions partitions found on MTD device spi0.0
    [    0.458407] OF: Bad cell count for /palmbus@10000000/spi@b00/flash@0/partitions
    [    0.465861] OF: Bad cell count for /palmbus@10000000/spi@b00/flash@0/partitions
    [    0.473848] OF: Bad cell count for /palmbus@10000000/spi@b00/flash@0/partitions
    [    0.481348] OF: Bad cell count for /palmbus@10000000/spi@b00/flash@0/partitions
    [    0.489030] Creating 4 MTD partitions on "spi0.0":
    [    0.493908] 0x000000000000-0x000000030000 : "u-boot"
    [    0.502793] 0x000000030000-0x000000040000 : "u-boot-env"
    [    0.509597] 0x000000040000-0x000000050000 : "factory"
    [    0.518061] 0x000000050000-0x000002000000 : "firmware"
    [    0.524704] 2 uimage-fw partitions found on MTD device firmware
    [    0.530800] Creating 2 MTD partitions on "firmware":
    [    0.535874] 0x000000000000-0x00000021fcd0 : "kernel"
    [    0.540909] mtd: partition "kernel" doesn't end on an erase/write block -- force read-only
    [    0.552485] 0x00000021fcd0-0x000001fb0000 : "rootfs"
    [    0.557612] mtd: partition "rootfs" doesn't start on an erase/write block boundary -- force read-only
    [    0.568230] mtd: setting mtd5 (rootfs) as root device
    [    0.574451] 1 squashfs-split partitions found on MTD device rootfs
    [    0.580820] 0x000000690000-0x000001fb0000 : "rootfs_data"
    [    0.643824] rt3050-esw 10110000.esw: mediatek esw at 0xb0110000, irq 25 initialized
    [    0.652613] mtk_soc_eth 10100000.ethernet eth0: mediatek frame engine at 0xb0100000, irq 5
    [    0.663101] NET: Registered protocol family 10
    [    0.673871] Segment Routing with IPv6
    [    0.677837] NET: Registered protocol family 17
    [    0.682468] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this.
    [    0.695653] 8021q: 802.1Q VLAN Support v1.8
    [    0.708523] VFS: Mounted root (squashfs filesystem) readonly on device 31:5.
    [    0.722829] Freeing unused kernel memory: 1236K
    [    0.727472] This architecture does not have kernel memory protection.
    [    0.734014] Run /sbin/init as init process
    [    0.738173]   with arguments:
    [    0.738180]     /sbin/init
    [    0.738185]   with environment:
    [    0.738191]     HOME=/
    [    0.738197]     TERM=linux
    [    1.499889] init: Console is alive
    [    1.503963] init: - watchdog -
    [    3.193974] kmodloader: loading kernel modules from /etc/modules-boot.d/*
    [    3.334239] usbcore: registered new interface driver usbfs
    [    3.340004] usbcore: registered new interface driver hub
    [    3.345483] usbcore: registered new device driver usb
    [    3.390789] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
    [    3.408184] SCSI subsystem initialized
    [    3.419282] ehci-fsl: Freescale EHCI Host controller driver
    [    3.428383] ehci-platform: EHCI generic platform driver
    [    3.444222] phy phy-10120000.usbphy.0: remote usb device wakeup disabled
    [    3.451062] phy phy-10120000.usbphy.0: UTMI 16bit 30MHz
    [    3.456372] ehci-platform 101c0000.ehci: EHCI Host Controller
    [    3.462246] ehci-platform 101c0000.ehci: new USB bus registered, assigned bus number 1
    [    3.470436] ehci-platform 101c0000.ehci: irq 26, io mem 0x101c0000
    [    3.505674] ehci-platform 101c0000.ehci: USB 2.0 started, EHCI 1.00
    [    3.513259] hub 1-0:1.0: USB hub found
    [    3.518121] hub 1-0:1.0: 1 port detected
    [    3.528829] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
    [    3.539278] ohci-platform: OHCI generic platform driver
    [    3.545029] ohci-platform 101c1000.ohci: Generic Platform OHCI controller
    [    3.552037] ohci-platform 101c1000.ohci: new USB bus registered, assigned bus number 2
    [    3.560238] ohci-platform 101c1000.ohci: irq 26, io mem 0x101c1000
    [    3.640829] hub 2-0:1.0: USB hub found
    [    3.645598] hub 2-0:1.0: 1 port detected
    [    3.698238] sdhci: Secure Digital Host Controller Interface driver
    [    3.704557] sdhci: Copyright(c) Pierre Ossman
    [    3.711416] sdhci-pltfm: SDHCI platform and OF driver helper
    [    3.722407] usbcore: registered new interface driver usb-storage
    [    3.733863] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
    [    3.751885] init: - preinit -
    [    5.049362] random: jshn: uninitialized urandom read (4 bytes read)
    [    5.170000] random: jshn: uninitialized urandom read (4 bytes read)
    [    5.283378] random: jshn: uninitialized urandom read (4 bytes read)
    [   10.368561] mount_root: loading kmods from internal overlay
    [   10.419078] kmodloader: loading kernel modules from //etc/modules-boot.d/*
    [   10.433973] kmodloader: done loading kernel modules from //etc/modules-boot.d/*
    [   11.088639] jffs2: notice: (466) jffs2_build_xattr_subsystem: complete building xattr subsystem, 7 of xdatum (0 unchecked, 1 orphan) and 8 of xref (1 dead, 0 orphan) found.
    [   11.105192] block: attempting to load /tmp/jffs_cfg/upper/etc/config/fstab
    [   11.116796] block: extroot: not configured
    [   11.185817] jffs2: notice: (464) jffs2_build_xattr_subsystem: complete building xattr subsystem, 7 of xdatum (0 unchecked, 1 orphan) and 8 of xref (1 dead, 0 orphan) found.
    [   11.560231] block: attempting to load /tmp/jffs_cfg/upper/etc/config/fstab
    [   11.570994] block: extroot: not configured
    [   11.576957] mount_root: switching to jffs2 overlay
    [   11.585305] overlayfs: upper fs does not support tmpfile.
    [   11.597989] urandom-seed: Seeding with /etc/urandom.seed
    [   11.749501] procd: - early -
    [   11.752894] procd: - watchdog -
    [   12.614734] procd: - watchdog -
    [   12.622445] procd: - ubus -
    [   12.865953] random: ubusd: uninitialized urandom read (4 bytes read)
    [   12.875327] random: ubusd: uninitialized urandom read (4 bytes read)
    [   12.898845] random: ubusd: uninitialized urandom read (4 bytes read)
    [   12.921118] procd: - init -
    [   14.213226] random: jshn: uninitialized urandom read (4 bytes read)
    [   14.252799] random: ubusd: uninitialized urandom read (4 bytes read)
    [   14.268596] random: ubus: uninitialized urandom read (4 bytes read)
    [   15.182296] kmodloader: loading kernel modules from /etc/modules.d/*
    [   16.192864] i2c /dev entries driver
    [   16.210509] i2c-mt7621 10000900.i2c: clock 100 kHz
    [   16.264715] Loading modules backported from Linux version v5.15.81-0-ge4a7232c917c
    [   16.272485] Backport generated by backports.git v5.15.81-1-0-ge1867d55
    [   16.291415] urngd: v1.0.2 started.
    [   16.683239] mt76_wmac 10300000.wmac: ASIC revision: 76280001
    [   17.028533] random: crng init done
    [   17.032008] random: 24 urandom warning(s) missed due to ratelimiting
    [   17.732307] mt76_wmac 10300000.wmac: Firmware Version: 20151201
    [   17.738424] mt76_wmac 10300000.wmac: Build Time: 20151201183641
    [   17.775980] mt76_wmac 10300000.wmac: firmware init done
    [   17.959566] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
    [   18.190836] PPP generic driver version 2.4.2
    [   18.199861] NET: Registered protocol family 24
    [   18.219536] kmodloader: done loading kernel modules from /etc/modules.d/*
    [   48.763223] apcli0: authenticate with 0c:47:3d:a2:96:38
    [   48.781767] apcli0: send auth to 0c:47:3d:a2:96:38 (try 1/3)
    [   48.790198] apcli0: authenticated
    [   48.805742] apcli0: associate with 0c:47:3d:a2:96:38 (try 1/3)
    [   48.815599] apcli0: RX AssocResp from 0c:47:3d:a2:96:38 (capab=0xc11 status=0 aid=4)
    [   48.823760] apcli0: associated
    [   49.097150] IPv6: ADDRCONF(NETDEV_CHANGE): apcli0: link becomes ready
    [   49.412439] IPv6: ADDRCONF(NETDEV_CHANGE): ra0: link becomes ready
    


  • Thanks to both of you. I'm left not understanding whether there is something to be done... FYI I'm also using the Onion dev board with the Omega2S+.



  • @huntc @Lazar-Demin pointed to the relevant description of the underlying issue (mismatched address modes) the issue is in the NOR flash not the Omega2, Onion have just activated the workaround via the DTS. Basically the CPU is in 4 bit mode while the NOR may not have reset properly and therefore remains in 3 bit mode --->>> CONFUSION!

    I recall a lot of discussion of this issue on the SUSE dev list a few years ago, if you want to know more perhaps check the mail archive on suse.org.

    Bu the short answer is there is nothing you can fix here.


Log in to reply
 

Looks like your connection to Community was lost, please wait while we try to reconnect.