Curated List of Reasons for Boards Stuck on “Starting kernel …”

3 minute read

Machine id mismatch

Board mini2440
U-Boot u-boot-2020.10 (3d01f8d5734399637e4d3f249a14b826414270af)
Kernel 5.9.11 (74aa8f46eddb81590be11280a0ea4b0375d30b59)
OpenOCD Open On-Chip Debugger 0.10.0+dev-ga8edbd0-dirty (2020-12-15-23:01)
JTAG OpenJTAG
Breakpoint N/A
Full log machine ID
Case No. #1

Key log:

Error: invalid dtb and unrecognized/unsupported machine ID
  r1=0x000007cf, r2=0x30000100
  r2[]=05 00 00 00 01 00 41 54 00 00 00 00 00 00 00 00
Available machine support:

ID (hex)	NAME
0000016a	MINI2440

Please check your kernel config and/or bootloader.

Steps to reproduce:

  1. Build and start U-Boot
  2. Replace MINI2440 with S3C2440 in arch/arm/mach-s3c24xx/mach-mini2440.c
    -MACHINE_START(MINI2440, "MINI2440")
    +MACHINE_START(S3C2440, "MINI2440")
    
  3. Boot kernel with this image
    MINI2440 # printenv tftpboot
    tftpboot=tftpboot 0x31000000 uImage; bootm
    MINI2440 # run tftpboot
    

Enable EARLY_PRINTK help a lot when do kernel debugging.

Serial Console not enabled

No kernel message output in serial console, but logs can be seen in __log_buf with md command in U-Boot after reset.

Board mini2440
U-Boot u-boot-2020.10 (3d01f8d5734399637e4d3f249a14b826414270af)
Kernel 5.9.11 (74aa8f46eddb81590be11280a0ea4b0375d30b59)
OpenOCD Open On-Chip Debugger 0.10.0+dev-ga8edbd0-dirty (2020-12-15-23:01)
JTAG OpenJTAG
Breakpoint N/A
Full log console disabled
Case No. #2

Key log:

Starting kernel ...

Steps to reproduce:

  1. Build and start U-Boot
  2. Remove below option from mini2440_defconfig:
    -CONFIG_SERIAL_SAMSUNG_CONSOLE=y
    
  3. Boot kernel with this image
    MINI2440 # printenv tftpboot
    tftpboot=tftpboot 0x31000000 uImage; bootm
    MINI2440 # run tftpboot
    
  4. Check kernel log
    $ rg __log_buf System.map
    15660:c06e1c28 b __log_buf
    

The log in log buffer indicate that the kernel boot process is complete, the reason for this issue is obvious.

MINI2440 # md 306e1c28
306e1c28: 00000000 00000000 00210038 c2000000    ........8.!.....
306e1c38: 746f6f42 20676e69 756e694c 6e6f2078    Booting Linux on
306e1c48: 79687020 61636973 5043206c 78302055     physical CPU 0x
306e1c58: 00000030 00000000 00000000 00000000    0...............
306e1c68: 00bc00d0 a2000000 756e694c 65762078    ........Linux ve
306e1c78: 6f697372 2e35206e 31312e39 3437672d    rsion 5.9.11-g74
306e1c88: 66386161 64653634 642d6264 79747269    aa8f46eddb-dirty
306e1c98: 64662820 40696162 61626466 65642d69     (fdbai@fdbai-de
306e1ca8: 6f746b73 28202970 2d6d7261 756e696c    sktop) (arm-linu
[...]
306e2e28: 206e7552 756e696c 20637278 69207361    Run linuxrc as i
306e2e38: 2074696e 636f7270 00737365 00000000    nit process.....
306e2e48: dd5e7a7e 00000000 00110028 e2000000    ~z^.....(.......
306e2e58: 69772020 61206874 6d756772 73746e65      with arguments

The bootargs not passed to kernel

This case is similar to case 2, but this issue is caused by bootargs.

Board mini2440
U-Boot u-boot-2020.10 (afcd25a7a60ddb69f0a8084a1dc0e6e22005b13b)
Kernel 5.9.11 (ab2c31bfc54b84fd24a9eaa7dc696ce30153d322)
OpenOCD Open On-Chip Debugger 0.10.0+dev-ga8edbd0-dirty (2020-12-15-23:01)
JTAG OpenJTAG
Breakpoint N/A
Full log Kernel command line is empty
Case No. #3

Steps to reproduce:

  1. Build and start U-Boot
  2. Unset bootargs
    MINI2440 # setenv bootargs ""
    MINI2440 # saveenv
    
  3. restart U-Boot
  4. Deselect CONFIG_MACH_S3C2410_DT and build uImage
  5. Boot kernel with this image
    MINI2440 # printenv tftpboot
    tftpboot=tftpboot $kernel_addr $bootfile; tftpboot $ramdisk_addr $ramdisk; bootm $kernel_addr $ramdisk_addr
    MINI2440 # run tftpboot
    

Define below macro in gdb to dump kernel log buffer contents:

define xxd
# dump binary memory dump.bin $arg0 $arg0+$arg1
dump binary memory dump.bin $arg0 ((void *)$arg0)+$arg1
shell xxd dump.bin
end
>>> xxd 0xc0b8f3d0 1536
00000000: 0000 0000 0000 0000 3800 2100 0000 00c2  ........8.!.....
00000010: 426f 6f74 696e 6720 4c69 6e75 7820 6f6e  Booting Linux on
00000020: 2070 6879 7369 6361 6c20 4350 5520 3078   physical CPU 0x
00000030: 3000 0000 0000 0000 0000 0000 0000 0000  0...............
00000040: d000 bc00 0000 00a2 4c69 6e75 7820 7665  ........Linux ve
00000050: 7273 696f 6e20 352e 392e 3131 2d67 6162  rsion 5.9.11-gab
00000060: 3263 3331 6266 6335 3462 2d64 6972 7479  2c31bfc54b-dirty
[...]
000004e0: 7069 6e67 206f 6e2e 2020 546f 7461 6c20  ping on.  Total
000004f0: 7061 6765 733a 2031 3632 3536 0000 0000  pages: 16256....
00000500: 0000 0000 0000 0000 2800 1500 0000 00a2  ........(.......
00000510: 4b65 726e 656c 2063 6f6d 6d61 6e64 206c  Kernel command l
00000520: 696e 653a 2000 0000 0000 0000 0000 0000  ine: ...........
00000530: 5800 4500 0000 00c2 4465 6e74 7279 2063  X.E.....Dentry c
00000540: 6163 6865 2068 6173 6820 7461 626c 6520  ache hash table
00000550: 656e 7472 6965 733a 2038 3139 3220 286f  entries: 8192 (o
00000560: 7264 6572 3a20 332c 2033 3237 3638 2062  rder: 3, 32768 b
00000570: 7974 6573 2c20 6c69 6e65 6172 2900 0000  ytes, linear)...
00000580: 0000 0000 0000 0000 5800 4400 0000 00c2  ........X.D.....

So, to fix this issue, a eraseenv will be suffice, the default bootargs will be used.

To same some debug time in future, I added a warning when ATAGS are used and the commandline is null, see this commit.