Sama5d3 always enters failsafe mode

Version used: v22.03.3

Using a custom board based on sama5d35,

Each startup will enter failsafe mode, so I would like to ask what aspects I should start to solve this problem


[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 5.10.161 (zj@zj) (arm-openwrt-linux-muslgnueabi-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] CPU: ARMv7 Processor [410fc051] revision 1 (ARMv7), cr=10c53c7d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] OF: fdt: Machine model: sama5d3-chamberlain
[    0.000000] printk: bootconsole [earlycon0] enabled
[    0.000000] Memory policy: Data cache writeback
[    0.000000] cma: Failed to reserve 64 MiB
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000020000000-0x0000000027ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000020000000-0x0000000027ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000020000000-0x0000000027ffffff]
[    0.000000] CPU: All CPU(s) started in SVC mode.
[    0.000000] Built 1 zonelists, mobility grouping off.  Total pages: 32480
[    0.000000] Kernel command line: console=ttyS0,115200 earlyprintk root=/dev/mmcblk0p2 rw rootwait rootfstype=ext4
[    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] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 117768K/131072K available (8206K kernel code, 416K rwdata, 1624K rodata, 1024K init, 200K bss, 13304K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] clocksource: timer@f0010000: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 115833966437 ns
[    0.000021] sched_clock: 32 bits at 16MHz, resolution 60ns, wraps every 130150523873ns
[    0.008786] Switching to timer-based delay loop, resolution 60ns
[    0.015870] Calibrating delay loop (skipped), value calculated using timer frequency.. 33.00 BogoMIPS (lpj=165000)
[    0.027381] pid_max: default: 32768 minimum: 301
[    0.032885] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.041043] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.051396] CPU: Testing write buffer coherency: ok
[    0.058859] Setting up static identity map for 0x20100000 - 0x20100060
[    0.066576] dyndbg: Ignore empty _ddebug table in a CONFIG_DYNAMIC_DEBUG_CORE build
[    0.085792] VFP support v0.3: implementor 41 architecture 2 part 30 variant 5 rev 1
[    0.094850] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.105818] futex hash table entries: 256 (order: -1, 3072 bytes, linear)
[    0.113590] pinctrl core: initialized pinctrl subsystem
[    0.122312] NET: Registered protocol family 16
[    0.134393] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.144306] cpuidle: using governor ladder
[    0.148855] cpuidle: using governor menu
[    0.238719] AT91: PM: standby: standby, suspend: ulp0
[    0.245582] gpio-at91 fffff200.gpio: at address (ptrval)
[    0.252635] gpio-at91 fffff400.gpio: at address (ptrval)
[    0.259713] gpio-at91 fffff600.gpio: at address (ptrval)
[    0.266932] gpio-at91 fffff800.gpio: at address (ptrval)
[    0.274204] gpio-at91 fffffa00.gpio: at address (ptrval)
[    0.281987] pinctrl-at91 ahb:apb:pinctrl@fffff200: initialized AT91 pinctrl driver
[    0.291260] atmel_tcb: probe of f0010000.timer failed with error -16
[    0.298676] atmel_tcb f8014000.timer: IRQ index 1 not found
[    0.304947] atmel_tcb f8014000.timer: IRQ index 2 not found
[    0.471482] at_hdmac ffffe600.dma-controller: Atmel AHB DMA Controller ( cpy set slave ), 8 channels
[    0.483693] at_hdmac ffffe800.dma-controller: Atmel AHB DMA Controller ( cpy set slave ), 8 channels
[    0.496654] AT91: Detected SoC family: sama5d3
[    0.501660] AT91: Detected SoC: sama5d35, revision 2
[    0.508275] SCSI subsystem initialized
[    0.513170] usbcore: registered new interface driver usbfs
[    0.519374] usbcore: registered new interface driver hub
[    0.525464] usbcore: registered new device driver usb
[    0.532131] videodev: Linux video capture interface: v2.00
[    0.539064] Advanced Linux Sound Architecture Driver Initialized.
[    0.583365] clocksource: Switched to clocksource timer@f0010000
[    0.592385] NET: Registered protocol family 2
[    0.597736] IP idents hash table entries: 2048 (order: 2, 16384 bytes, linear)
[    0.606840] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear)
[    0.616303] TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.624867] TCP bind hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.632686] TCP: Hash tables configured (established 1024 bind 1024)
[    0.640005] UDP hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.647334] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.655576] NET: Registered protocol family 1
[    0.672651] Initialise system trusted keyrings
[    0.681508] workingset: timestamp_bits=14 max_order=15 bucket_order=1
[    0.903885] Key type asymmetric registered
[    0.908433] Asymmetric key parser 'x509' registered
[    0.944846] brd: module loaded
[    0.971600] loop: module loaded
[    0.976106] atmel_usart_serial: Failed to locate of_node [id: -2]
[    0.983545] atmel_usart_serial.0.auto: ttyS5 at MMIO 0xf0024000 (irq = 19, base_baud = 4125000) is a ATMEL_SERIAL
[    0.996803] atmel_usart_serial: Failed to locate of_node [id: -2]
[    1.004171] atmel_usart_serial.1.auto: ttyS3 at MMIO 0xf8020000 (irq = 22, base_baud = 4125000) is a ATMEL_SERIAL
[    1.017286] atmel_usart_serial: Failed to locate of_node [id: -2]
[    1.024770] printk: console [ttyS0] enabled
[    1.024770] printk: console [ttyS0] enabled
[    1.033669] printk: bootconsole [earlycon0] disabled
[    1.033669] printk: bootconsole [earlycon0] disabled
[    1.051232] macb f0028000.ethernet: invalid hw address, using random
[    1.105349] macb f0028000.ethernet eth0: Cadence GEM rev 0x00020119 at 0xf0028000 irq 39 (42:75:87:f3:2d:28)
[    1.116055] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    1.122565] ehci-atmel: EHCI Atmel driver
[    1.130845] atmel-ehci 700000.ehci: EHCI Host Controller
[    1.136277] atmel-ehci 700000.ehci: new USB bus registered, assigned bus number 1
[    1.144057] atmel-ehci 700000.ehci: irq 42, io mem 0x00700000
[    1.173439] atmel-ehci 700000.ehci: USB 2.0 started, EHCI 1.00
[    1.179682] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.10
[    1.188008] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    1.195244] usb usb1: Product: EHCI Host Controller
[    1.200091] usb usb1: Manufacturer: Linux 5.10.161 ehci_hcd
[    1.205712] usb usb1: SerialNumber: 700000.ehci
[    1.211598] hub 1-0:1.0: USB hub found
[    1.216795] hub 1-0:1.0: 3 ports detected
[    1.222461] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    1.228755] ohci-platform: OHCI generic platform driver
[    1.234356] ohci-atmel: OHCI Atmel driver
[    1.239661] at91_ohci 600000.ohci: USB Host Controller
[    1.244953] at91_ohci 600000.ohci: new USB bus registered, assigned bus number 2
[    1.252553] at91_ohci 600000.ohci: irq 42, io mem 0x00600000
[    1.327847] usb usb2: New USB device found, idVendor=1d6b, idProduct=0001, bcdDevice= 5.10
[    1.336177] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    1.343417] usb usb2: Product: USB Host Controller
[    1.348176] usb usb2: Manufacturer: Linux 5.10.161 ohci_hcd
[    1.353797] usb usb2: SerialNumber: at91
[    1.359066] hub 2-0:1.0: USB hub found
[    1.364348] hub 2-0:1.0: 3 ports detected
[    1.371311] usbcore: registered new interface driver cdc_acm
[    1.377052] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
[    1.385335] usbcore: registered new interface driver usb-storage
[    1.391576] usbcore: registered new interface driver usbserial_generic
[    1.398246] usbserial: USB Serial support registered for generic
[    1.404398] usbcore: registered new interface driver ftdi_sio
[    1.410200] usbserial: USB Serial support registered for FTDI USB Serial Device
[    1.417822] usbcore: registered new interface driver pl2303
[    1.423528] usbserial: USB Serial support registered for pl2303
[    1.431424] at91_rtc fffffeb0.rtc: registered as rtc0
[    1.436625] at91_rtc fffffeb0.rtc: setting system clock to 2007-01-01T00:02:12 UTC (1167609732)
[    1.445376] at91_rtc fffffeb0.rtc: AT91 Real Time Clock driver.
[    1.451601] i2c /dev entries driver
[    1.456377] at91-reset fffffe00.rstc: Starting after software reset
[    1.463812] at91_wdt fffffe40.watchdog: watchdog is disabled
[    1.491439] at91_wdt: probe of fffffe40.watchdog failed with error -22
[    1.499611] sdhci: Secure Digital Host Controller Interface driver
[    1.505833] sdhci: Copyright(c) Pierre Ossman
[    1.510427] sdhci-pltfm: SDHCI platform and OF driver helper
[    1.520511] ledtrig-cpu: registered to indicate activity on CPUs
[    1.527025] usbcore: registered new interface driver usbhid
[    1.532569] usbhid: USB HID core driver
[    1.538392] iio iio:device0: Resolution used: 12 bits
[    1.543531] iio iio:device0: ADC Touch screen is disabled.
[    1.556006] NET: Registered protocol family 10
[    1.564728] atmel_mci f0000000.mmc: version: 0x505
[    1.569724] atmel_mci f0000000.mmc: using dma0chan0 for DMA transfers
[    1.577517] atmel_mci f8000000.mmc: version: 0x505
[    1.582527] atmel_mci f8000000.mmc: using dma1chan0 for DMA transfers
[    1.626639] Segment Routing with IPv6
[    1.630451] NET: Registered protocol family 17
[    1.635116] 8021q: 802.1Q VLAN Support v1.8
[    1.640037] Loading compiled-in X.509 certificates
[    1.645420] atmel_mci f8000000.mmc: Atmel MCI controller at 0xf8000000 irq 20, 1 slots
[    1.654017] atmel_mci f0000000.mmc: Atmel MCI controller at 0xf0000000 irq 18, 1 slots
[    1.686753] input: gpio_keys as /devices/platform/gpio_keys/input/input0
[    1.694749] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[    1.714189] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[    1.720937] [dhd] _dhd_module_init: in Dongle Host Driver, version 101.10.361.29 (wlan=r892223-20221214-2)
[    1.720937] drivers/net/wireless/bcmdhd compiled on Jan  3 2023 at 00:24:21
[    1.720937] 
[    1.739144] [dhd] STATIC-MSG) dhd_static_buf_init : 101.10.361.29 (wlan=r892223-20221202-6)
[    1.747985] [dhd] STATIC-MSG) dhd_init_wlan_mem : prealloc ok for index 0: 5302272(5178K)
[    1.756439] [dhd] ======== Get GPIO from DTS(android,bcmdhd_wlan) ========
[    1.763555] [dhd] dhd_wlan_init_gpio: WL_HOST_WAKE=85, oob_irq=52, oob_irq_flags=0x4
[    1.771280] [dhd] dhd_wlan_init_gpio: WL_REG_ON=82
[    1.776140] [dhd] dhd_wifi_platform_load: Enter
[    1.780629] [dhd] Power-up adapter 'DHD generic adapter'
[    1.786139] [dhd] wifi_platform_set_power = 1, delay: 200 msec
[    1.791946] [dhd] ======== PULL WL_REG_ON(82) HIGH! ========
[    1.798251] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[    1.806985] platform regulatory.0: Falling back to sysfs fallback for: regulatory.db
[    1.834183] mmc0: new MMC card at address 0001
[    1.840975] mmcblk0: mmc0:0001 M62704 3.53 GiB 
[    1.846344] mmcblk0boot0: mmc0:0001 M62704 partition 1 2.00 MiB
[    1.853324] mmcblk0boot1: mmc0:0001 M62704 partition 2 2.00 MiB
[    1.862094]  mmcblk0: p1 p2
[    2.013431] [dhd] wifi_platform_bus_enumerate device present 1
[    2.019250] [dhd] ======== Card detection to detect SDIO card! ========
[    4.083415] [dhd] failed to power up DHD generic adapter, 0 retry left
[    4.105303] [dhd] wifi_platform_set_power = 0, delay: 0 msec
[    4.110985] [dhd] ======== PULL WL_REG_ON(82) LOW! ========
[    4.116591] [dhd] wifi_platform_bus_enumerate device present 0
[    4.122387] [dhd] ======== Card detection to remove SDIO card! ========
[    4.129062] [dhd] failed to power up DHD generic adapter, max retry reached**
[    4.136204] [dhd] unregister wifi platform drivers
[    4.140979] [dhd] wifi_platform_bus_enumerate device present 0
[    4.146856] [dhd] ======== Card detection to remove SDIO card! ========
[    4.153501] [dhd] dhd_wlan_deinit_gpio: gpio_free(WL_REG_ON 82)
[    4.159404] [dhd] dhd_wlan_deinit_gpio: gpio_free(WL_HOST_WAKE 85)
[    4.165641] [dhd] _dhd_module_init: Failed to load the driver, try cnt 0
[    4.172375] [dhd] _dhd_module_init: Failed to load driver max retry reached**
[    4.179533] [dhd] STATIC-MSG) dhd_static_buf_exit : Enter
[    4.185295] [dhd] _dhd_module_init: Exit err=-19
[    4.189880] ALSA device list:
[    4.192843]   No soundcards found.
[    4.211371] EXT4-fs (mmcblk0p2): warning: mounting unchecked fs, running e2fsck is recommended
[    4.223810] EXT4-fs (mmcblk0p2): mounted filesystem without journal. Opts: (null)
[    4.231382] VFS: Mounted root (ext4 filesystem) on device 179:2.
[    4.240380] Freeing unused kernel memory: 1024K
[    4.245152] Run /sbin/init as init process
[    4.325742] init: Console is alive
[    4.525540] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    4.551002] ehci-fsl: Freescale EHCI Host controller driver
[    4.560217] ehci-platform: EHCI generic platform driver
[    4.593098] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    4.611154] init: - preinit -
/lib/preinit/00_preinit.conf
/lib/preinit/02_default_set_state
/lib/preinit/02_sysinfo
/lib/preinit/10_indicate_failsafe
/lib/preinit/10_indicate_preinit
/lib/preinit/30_failsafe_wait
/lib/preinit/40_run_failsafe_hook
/lib/preinit/50_indicate_regular_preinit
/lib/preinit/70_initramfs_test
/lib/preinit/80_mount_root
/lib/preinit/81_urandom_seed
/lib/preinit/99_10_failsafe_dropbear
/lib/preinit/99_10_failsafe_login
/lib/preinit/99_10_failsafe_sshd
/lib/preinit/99_10_run_init
[    5.138736] random: jshn: uninitialized urandom read (4 bytes read)
Illegal instruction
Failed to parse message data
[    5.278613] random: jshn: uninitialized urandom read (4 bytes read)
Illegal instruction
Failed to parse message data
WARNING: Variable 'network' does not exist or is not an array/object
WARNING: Variable 'lan' does not exist or is not an array/object
Press the [f] key and hit [enter] to enter failsafe mode
Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
f
- failsafe -
Waiting for kernel randomness to be initialised...
[   10.703429] random: crng init done
Generating 1024 bit rsa key, this may take a while...

Error in initialization when found, unable to generate board.json. What is causing this?

After debugging I found that I couldn't load json characters because of jshn.

root@(none):/# jshn -R /etc/board.json 
Illegal instruction
root@(none):/# jshn -r '{"a":"w"}'
Illegal instruction

So, what do I do now

Reference: Gcc was broken on mvebu (armada 370) device after commit on 2019-03-25 - #22 by wackejohn

I have modified the target/Linux/at91 / sama5 / target. Mk. After the normal operation

CPU_SUBTYPE:=vfpv4-d16