(Not about OpenWrt) A self-built kernel won't boot. DTB error

This question is not about OpenWrt, but I don't know where else to ask.

Linksys WRT-1900ACS v2

I'm trying to boot a kernel that I built myself form the latest master from https://github.com/torvalds/linux , using OpenWrt's toolchain and kernel config file (/proc/config.gz) from a running OpenWrt image on the exact same router.

The router transfers the image via TFTP (from arch/arm/boot/zImage), transfers DTB file (from arch/arm/boot/dts/armada-385-linksys-cobra.dtb), starts kernel, but it immediately stops with this error:

Starting kernel ...


Error: invalid dtb and unrecognized/unsupported machine ID
  r1=0x00000210, r2=0x00ff8000
  r2[]=00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Available machine support:

ID (hex)        NAME
ffffffff        Generic DT based system
ffffffff        Marvell Armada 39x (Device Tree)
ffffffff        Marvell Armada 380/385 (Device Tree)
ffffffff        Marvell Armada 375 (Device Tree)
ffffffff        Marvell Armada 370/XP (Device Tree)

Please check your kernel config and/or bootloader.

What am I doing wrong?
Why all machines have the same (ffffffff) ID?

Thanks.

While mvebu has considerable mainline support (apart from its abysmal wireless side), just a kernel isn't enough to boot up - and on these embedded devices, you have to do (a lot-) more to beat kernel- and userland into shape to be accepted by the OEM bootloader. 'Just' compiling a vanilla mainline kernel won't do, you need the whole that makes up 'OpenWrt' - and once you do that, you'll notice that even then upgrading the kernel isn't exactly a beginner's job.

1 Like

Can you share more of the uboot session? From power on up to starting the kernel would help.

Would need to know the commands you used to load and boot the kernel plus details of a printenv from uboot.

Also, invalid dtb usually means what it says - the dtb is corrupt. Use the one from the openwrt kernel.

And I expect slh is right, even if you get a custom kernel to boot it may not work with the openwrt install you have on the device

BootROM - 1.73

Booting from NAND flash


General initialization - Version: 1.0.0

Detected Device ID 6820

High speed PHY - Version: 2.0


Init RD NAS topology Serdes Lane 3 is USB3

Serdes Lane 4 is SGMII

board SerDes lanes topology details:

 | Lane #  | Speed |  Type       |

 --------------------------------

 |   0    |  06   |  SATA0	|

 |   1    |  05   |  PCIe0	|

 |   2    |  06   |  SATA1	|

 |   3    |  05   |  USB3 HOST1	|

 |   4    |  05   |  PCIe1	|

 |   5    |  00   |  SGMII2	|

 --------------------------------

:** Link is Gen1, check the EP capability 

PCIe, Idx 0: Link upgraded to Gen2 based on client cpabilities 

:** Link is Gen1, check the EP capability 

PCIe, Idx 1: remains Gen1

High speed PHY - Ended Successfully

DDR3 Training Sequence - Ver TIP-1.26.0

mvSysEnvGetTopologyUpdateInfo: TWSI Read failed

DDR3 Training Sequence - Switching XBAR Window to FastPath Window 

DDR3 Training Sequence - Ended Successfully

Not detected suspend to RAM indication

BootROM: Image checksum verification PASSED


 __   __                      _ _
|  \/  | __ _ _ ____   _____| | |
| |\/| |/ _` | '__\ \ / / _ \ | |
| |  | | (_| | |   \ V /  __/ | |
|_|  |_|\__,_|_|    \_/ \___|_|_|
         _   _     ____              _
        | | | |   | __ )  ___   ___ | |_ 
        | | | |___|  _ \ / _ \ / _ \| __| 
        | |_| |___| |_) | (_) | (_) | |_ 
         \___/    |____/ \___/ \___/ \__| 
 ** LOADER **


U-Boot 2013.01 (Mar 27 2015 - 16:50:46) Marvell version: 2014_T3.0p6

Boot version : v1.0.13

Board: RD-NAS-88F6820-DDR3
SoC:   MV88F6820 Rev A0
       running 2 CPUs
CPU:   ARM Cortex A9 MPCore (Rev 1) LE
       CPU 0
       CPU    @ 1600 [MHz]
       L2     @ 800 [MHz]
       TClock @ 200 [MHz]
       DDR    @ 800 [MHz]
       DDR 32 Bit Width, FastPath Memory Access, DLB Enabled, ECC Disabled
DRAM:  512 MiB

Map:   Code:			0x1fea9000:0x1ff7632c
       BSS:			0x1ffef6b4
       Stack:			0x1f9a8f20
       Heap:			0x1f9a9000:0x1fea9000
raise: Signal # 8 caught
U-ENV offset == 0x200000
raise: Signal # 8 caught
U-ENV offset == 0x200000
       U-Boot Environment:	0x00200000:0x00220000 (NAND)

NAND:  128 MiB
MMC:   mv_sdh: 0
DEVINFO offset == 0x900000
U-ENV offset == 0x200000
U-ENV offset == 0x200000
S-ENV offset == 0x240000


#### auto_recovery ####
[u_env] get auto_recovery == yes
[u_env] get auto_recovery == yes
[u_env] get boot_part == 1
[u_env] get boot_part_ready == 3
auto_recovery enabled:1, boot_part:1, boot_part_ready:3 

S-ENV offset == 0x240000
[boot_count_read] block:0x240000, size:128KB, records:64 
[boot_count_read_record] boot_count:2, next_record:60

[boot_count_write] erase:0, auto_recovery->block_offset:0x240000 offset=0x25E000

Updating boot_count ... 
[boot_count_write] offset:0x25E000 , length:2048
done

PCI-e 0 (IF 0 - bus 0) Root Complex Interface, Detected Link X1, GEN 2.0
PCI-e 1 (IF 1 - bus 1) Root Complex Interface, Detected Link X1, GEN 1.1
USB2.0 0: Host Mode
USB3.0 1: Host Mode
USB3.0 0: Host Mode
Board configuration detected:
mvEthE6171SwitchBasicInit init 
Net:   
|  port  | Interface | PHY address  |
|--------|-----------|--------------|
| egiga0 |   RGMII   |     0x01     |
| egiga1 |   SGMII   |     0x00     |
egiga0 [PRIME], egiga1
auto_recovery_check changes bootcmd: run nandboot 
Hit any key to stop autoboot: 3 
Marvell>> printenv
CASset=max
MALLOC_len=5
MPmode=SMP
altFwSize=0x2800000
altKernAddr=0x3200000
altKernSize=0x0600000
altnandboot=setenv bootargs console=ttyS0,115200 root=/dev/mtdblock7 ro rootdelay=1 rootfstype=jffs2 earlyprintk $mtdparts;nand read $defaultLoadAddr $altKernAddr $altKernSize; bootm $defaultLoadAddr
auto_recovery=yes
autoload=no
baudrate=115200
boot_order=hd_scr usb_scr mmc_scr hd_img usb_img mmc_img pxe net_img net_scr
boot_part=1
boot_part_ready=3
bootargs_dflt=$console $nandEcc $mtdparts $bootargs_root nfsroot=$serverip:$rootpath ip=$ipaddr:$serverip$bootargs_end $mvNetConfig video=dovefb:lcd0:$lcd0_params clcd.lcd0_enable=$lcd0_enable clcd.lcd_panel=$lcd_panel
bootargs_end=:10.4.50.254:255.255.255.0:Armada38x:eth0:none
bootargs_root=root=/dev/nfs rw
bootcmd="run altnandboot"
bootcmd_auto=stage_boot $boot_order
bootcmd_fdt=tftpboot 0x2000000 $image_name;tftpboot $fdtaddr $fdtfile;setenv bootargs $console $nandEcc $mtdparts $bootargs_root nfsroot=$serverip:$rootpath ip=$ipaddr:$serverip$bootargs_end $mvNetConfig video=dovefb:lcd0:$lcd0_params clcd.lcd0_enable=$lcd0_enable clcd.lcd_panel=$lcd_panel; bootz 0x2000000 - $fdtaddr;
bootcmd_fdt_boot=tftpboot 0x2000000 $image_name; setenv bootargs $console $nandEcc $mtdparts $bootargs_root nfsroot=$serverip:$rootpath ip=$ipaddr:$serverip$bootargs_end $mvNetConfig video=dovefb:lcd0:$lcd0_params clcd.lcd0_enable=$lcd0_enable clcd.lcd_panel=$lcd_panel; bootz 0x2000000 - $fdtaddr;
bootcmd_fdt_edit=tftpboot $fdtaddr $fdtfile; fdt addr $fdtaddr; setenv bootcmd $bootcmd_fdt_boot
bootcmd_lgcy=tftpboot 0x2000000 $image_name; setenv bootargs $bootargs_dflt; bootm 0x2000000; 
bootcmd_tftp=tftpboot $loadaddr $image_name ; tftpboot $fdtaddr $fdtfile ; setenv bootargs $console $nandEcc $mtdparts root=/dev/sda rootdelay=100 ; bootz $loadaddr - $fdtaddr
bootdelay=3
bootpart=1
cacheShare=no
console=console=ttyS0,115200
defaultLoadAddr=0x2000000
device_partition=0:1
disaMvPnp=no
eeeEnable=no
enaClockGating=no
enaCpuStream=no
enaFPU=yes
enaMonExt=no
enaWrAllo=no
eth1addr=00:50:43:82:24:21
eth1mtu=1500
eth2addr=00:50:43:82:fa:21
eth2mtu=1500
eth3addr=00:50:43:24:fa:82
eth3mtu=1500
ethact=egiga0
ethaddr=00:50:43:fa:24:21
ethmtu=1500
ethprime=egiga0
fdt_addr=2040000
fdt_skip_update=no
fdtaddr=0x1000000
fdtfile=armada-38x-modular.dtb
firmwareName=cobra.img
flash_alt_image=tftpboot $defaultLoadAddr $firmwareName && nand erase $altKernAddr $altFwSize && nand write $defaultLoadAddr $altKernAddr $filesize
flash_pri_image=tftpboot $defaultLoadAddr $firmwareName && nand erase $priKernAddr $priFwSize && nand write $defaultLoadAddr $priKernAddr $filesize
ide_path=/
image_name=uImage
initrd_name=uInitrd
ipaddr=192.168.1.1
kernel_addr_r=2080000
lcd0_enable=0
lcd0_params=640x480-16@60
lcd_panel=0
loadaddr=0x02000000
loads_echo=0
mtdids=nand0=armada-nand
mtdparts=mtdparts=armada-nand:2048K(uboot)ro,256K(u_env),256K(s_env),1m@9m(devinfo),40m@10m(kernel),34m@16m(rootfs),40m@50m(alt_kernel),34m@56m(alt_rootfs),80m@10m(ubifs),-@90m(syscfg)
mvNetConfig=mv_net_config=4,(00:50:43:11:11:11,0:1:2:3),mtu=1500
mv_pon_addr=00:50:43:21:fa:82
nandEcc=nfcConfig=4bitecc
nandboot=setenv bootargs console=ttyS0,115200 root=/dev/mtdblock5 ro rootdelay=1 rootfstype=jffs2 earlyprintk $mtdparts;nand read $defaultLoadAddr $priKernAddr $priKernSize; bootm $defaultLoadAddr
netbsd_en=no
netmask=255.255.255.0
netretry=no
pcieTune=no
pexMode=RC
priFwSize=0x2800000
priKernAddr=0x0a00000
priKernSize=0x0600000
pxe_files_load=:default.arm-armadaxp-db:default.arm-armadaxp:default.arm
pxefile_addr_r=3100000
ramdisk_addr_r=2880000
rootpath=/srv/nfs/
sata_delay_reset=0
sata_dma_mode=yes
script_addr_r=3000000
script_name=boot.scr
serverip=192.168.1.254
standalone=fsload 0x2000000 $image_name;setenv bootargs $console $nandEcc $mtdparts root=/dev/mtdblock0 rw ip=$ipaddr:$serverip$bootargs_end; bootm 0x2000000;
stderr=serial
stdin=serial
stdout=serial
update_both_images=tftpboot $defaultLoadAddr $firmwareName && nand erase $priKernAddr $priFwSize && nand erase $altKernAddr $altFwSize && nand write $defaultLoadAddr $priKernAddr $filesize && nand write $defaultLoadAddr $altKernAddr $filesize
usb0Mode=host
usbActive=0
usbType=2
vxworks_en=no
yuk_ethaddr=00:00:00:EE:51:81

Environment size: 4407/131068 bytes
Marvell>> run bootcmd_tftp
Using egiga0 device
TFTP from server 192.168.1.254; our IP address is 192.168.1.1
Filename 'uImage'.
Load address: 0x2000000
Loading: #################################################################
	 #################################################################
	 #############################################################
	 139.6 KiB/s
done
Bytes transferred = 2798112 (2ab220 hex)
Using egiga0 device
TFTP from server 192.168.1.254; our IP address is 192.168.1.1
Filename 'armada-38x-modular.dtb'.
Load address: 0x1000000
Loading: ##
	 137.7 KiB/s
done
Bytes transferred = 20015 (4e2f hex)
## Flattened Device Tree blob at 01000000
   Booting using the fdt blob at 0x01000000
   Loading Device Tree to 00ff8000, end 00fffe2e ... OK

   Starting Device Tree update ('fdt_skip_update' = no)
Unable to update property /soc/internal-regs/ethernet@70000:local-mac-address, err=FDT_ERR_NOSPACE
Unable to update property /soc/internal-regs/ethernet@30000:local-mac-address, err=FDT_ERR_NOSPACE
Unable to update property /soc/internal-regs/ethernet@34000:local-mac-address, err=FDT_ERR_NOSPACE
Updating device tree failed

Starting kernel ...


Error: invalid dtb and unrecognized/unsupported machine ID
  r1=0x00000210, r2=0x00ff8000
  r2[]=00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Available machine support:

ID (hex)	NAME
ffffffff	Generic DT based system
ffffffff	Marvell Armada 39x (Device Tree)
ffffffff	Marvell Armada 380/385 (Device Tree)
ffffffff	Marvell Armada 375 (Device Tree)
ffffffff	Marvell Armada 370/XP (Device Tree)

Please check your kernel config and/or bootloader.

bootcmd_tftp variable is added by me. The rest is the default.

It's the default from kernel sources. Why would it be corrupt?
Where do I find OpenWrt's dtb? Or how do I extract it from the sysupgrade file?

These errors are stopping the device tree from being loaded. You can disable fdt checking by adding fdt_skip_update = yes to your boot command.
If that still doesn't work, get the dts from the openwrt kernel source and compile it to a dtb. Leave skip update on though.

You can also append the dtb to the kernel image and avoid loading it at all;

cat zImage dts/armada-385-linksys-cobra.dtb > zImage.fdt
mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n Linux-4.12.4-mvebu-tld-1 -d zImage.fdt uImage

Then tftpboot the kernel image only.

Lots more details on booting custom kernels on MVEBU at the Doozan forum, eg;

1 Like

Also, in the Openwrt wiki the WRT1900ACSv2 is a Shelby - not a Cobra. The dts to compile would be this one;

It's not that. It only adds MAC addresses.

It's not that either. Those two are identical except for LED names.

Here's the boot log without MAC address update and with armada-385-linksys-cobra.dtb:

Marvell>> setenv fdt_skip_update yes
Marvell>> run bootcmd_tftp
Using egiga0 device
TFTP from server 192.168.1.254; our IP address is 192.168.1.1
Filename 'uImage'.
Load address: 0x2000000
Loading: #################################################################
         #################################################################
         #############################################################
         139.6 KiB/s
done
Bytes transferred = 2798112 (2ab220 hex)
Using egiga0 device
TFTP from server 192.168.1.254; our IP address is 192.168.1.1
Filename 'armada-38x-modular.dtb'.
Load address: 0x1000000
Loading: ##
         138.7 KiB/s
done
Bytes transferred = 20043 (4e4b hex)
## Flattened Device Tree blob at 01000000
   Booting using the fdt blob at 0x01000000
   Loading Device Tree to 00ff8000, end 00fffe4a ... OK

   Skipping Device Tree update ('fdt_skip_update' = yes)

Starting kernel ...


Error: invalid dtb and unrecognized/unsupported machine ID
  r1=0x00000210, r2=0x00ff8000
  r2[]=00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Available machine support:

ID (hex)        NAME
ffffffff        Generic DT based system
ffffffff        Marvell Armada 39x (Device Tree)
ffffffff        Marvell Armada 380/385 (Device Tree)
ffffffff        Marvell Armada 375 (Device Tree)
ffffffff        Marvell Armada 370/XP (Device Tree)

Please check your kernel config and/or bootloader.

With mkimage it refuses to boot at all. Error is:
Bad Linux ARM zImage magic!


I still think the problem is with those machine IDs. They are all ffffffff. That's not correct, is it?

IT WORKS!!!
The solution was to enable CONFIG_ARM_APPENDED_DTB in kernel menuconfig, append .dtb to kernel image (just cat it, without mkimage) and boot without transferring a separate dtb file.

Marvell>> setenv bootcmd_tftp tftpboot \$loadaddr \$image_name \; setenv bootargs \$console \$nandEcc \$mtdparts root=/dev/sda rootdelay=100 \; bootz \$loadaddr
Marvell>> run bootcmd_tftp
Using egiga0 device
TFTP from server 192.168.1.254; our IP address is 192.168.1.1
Filename 'uImage'.
Load address: 0x2000000
Loading: #################################################################
         #################################################################
         #############################################################
         139.6 KiB/s
done
Bytes transferred = 2791411 (2a97f3 hex)

Starting kernel ...

[    0.000000][    T0] Booting Linux on physical CPU 0x0
[    0.000000][    T0] Linux version 6.1.0-rc8M95D-14-00004-g781c189e91e4 (marius95@GRAPHIM) (arm-openwrt-linux-muslgnueabi-gcc (OpenWrt GCC 12.2.0 r21391+9-a8f3c97ce8) 12.2.0, GNU ld (GNU Binutils) 2.39) #4 SMP Wed Dec  7 12:18:37 EET 2022
[    0.000000][    T0] CPU: ARMv7 Processor [414fc091] revision 1 (ARMv7), cr=10c5387d
[    0.000000][    T0] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000][    T0] OF: fdt: Machine model: Linksys WRT1900ACS

I still wish I knew why it didn't work with the separate dtb file.

Is this McDebian you're running? Out of curiosity, what's your interest in running 6.1 on your WRT1900ACS?

Support for a separate fdt file needs to be built into uboot by the vendor, if they don’t use it they don’t have to make it work.
Vendors are lazy.
Appended fdt is annoying to maintain, but works reliably on Marvell socs

It's not a full OS, just a kernel and busybox. I'm investigating a bug in ahci-mvebu.

uboot does support separate dtb.
It did work last week, but then I had to reset everything and then it didn't work anymore. I didn't make a backup and I have no ideea what changed.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.