I’m trying to install multiple kernels and switch between them by changing config.txt on my CM4 DevTerm. However, I can’t get it to boot if I change the kernel to anything besides the default. Here’s what I’ve tried:
- Add the line
kernel=kernel8.img
to config.txt. This works fine. - Copy kernel8.img to kernel_copy.img. Change config.txt to
kernel=kernel_copy.img
. This fails to boot. - Try scenario 2 again, but this time also copy initramfs8 to initramfs_copy.img, just in case it autodetects the name like that. No change.
- I’ve also tried compiling my own kernel and installing it to kernel_mine.img, as suggested in the Raspberry Pi kernel docs. It fails in the same way as 2, of course.
I have UART logging enabled for the bootloader and kernel. Here’s what the logs look like for scenario 1:
RPi: BOOTLOADER release VERSION:4fd8f1f3 DATE: 2023/05/11 TIME: 07:26:03
BOOTMODE: 0x06 partition 0 build-ts BUILD_TIMESTAMP=1683786363 serial 6cc3ffaa boardrev c03140 stc 478856
PM_RSTS: 0x00001000
part 00000000 reset_info 00000000
uSD voltage 3.3V
Initialising SDRAM 'Samsung' 16Gb x2 total-size: 32 Gbit 3200
DDR 3200 1 0 32 152
Boot mode: SD (01) order f2564
SD HOST: 200000000 CTL0: 0x00800000 BUS: 400000 Hz actual: 390625 HZ div: 512 (256) status: 0x1fff0000 delay: 276
SD HOST: 200000000 CTL0: 0x00800f00 BUS: 400000 Hz actual: 390625 HZ div: 512 (256) status: 0x1fff0000 delay: 276
OCR c0ff8000 [23]
CID: 006f0303434241445310aa0000830173
CSD: 400e00325b590000ea6d7f800a404000
SD: bus-width: 4 spec: 2 SCR: 0x02b58003 0x00000000
SD HOST: 200000000 CTL0: 0x00800f04 BUS: 50000000 Hz actual: 50000000 HZ div: 4 (2) status: 0x1fff0000 delay: 2
MBR: 0x00002000, 1048576 type: 0x0c
MBR: 0x00102000,60397568 type: 0x83
MBR: 0x00000000, 0 type: 0x00
MBR: 0x00000000, 0 type: 0x00
Trying partition: 0
type: 32 lba: 8192 oem: 'mkfs.fat' volume: ' bootfs '
rsc 32 fat-sectors 2040 c-count 261116 c-size 4
root dir cluster 2 sectors 0 entries 0
FAT32 clusters 261116
Trying partition: 0
type: 32 lba: 8192 oem: 'mkfs.fat' volume: ' bootfs '
rsc 32 fat-sectors 2040 c-count 261116 c-size 4
root dir cluster 2 sectors 0 entries 0
FAT32 clusters 261116
Read config.txt bytes 337 hnd 0x292e
gpio_cmd: '10=ip,np' pins: 10-10 drive: -1 fsel: 0 term: 0
Read start4.elf bytes 2254208 hnd 0x4ca5
Read fixup4.dat bytes 5403 hnd 0x129
0x00c03140 0x00000000 0x00001fff
MEM GPU: 76 ARM: 948 TOTAL: 1024
Firmware: 03dc77429335caee083e22ddc8eec09c07f12a7a Aug 10 2023 15:33:38
Starting start4.elf @ 0xfec00200 partition 0
+
[ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd083]
[ 0.000000] Linux version 5.10.17-v8+ (cpi@cpi-X79) (aarch64-linux-gnu-gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0, 3
[ 0.000000] Machine model: Raspberry Pi Compute Module 4 Rev 1.0
[ 0.000000] efi: UEFI not found.
[ 0.000000] Reserved memory: created CMA memory pool at 0x0000000016c00000, size 384 MiB
[ 0.000000] OF: reserved mem: initialized node linux,cma, compatible id shared-dma-pool
[ 0.000000] Zone ranges:
[ 0.000000] DMA [mem 0x0000000000000000-0x000000003fffffff]
[ 0.000000] DMA32 [mem 0x0000000040000000-0x00000000fbffffff]
[ 0.000000] Normal empty
[...and this continues on and shows the whole boot sequence up to the login screen...]
And here is scenario 2. It seems like the bootloader passes off to the kernel, which never prints its first log.
RPi: BOOTLOADER release VERSION:4fd8f1f3 DATE: 2023/05/11 TIME: 07:26:03
BOOTMODE: 0x06 partition 0 build-ts BUILD_TIMESTAMP=1683786363 serial 6cc3ffaa boardrev c03140 stc 478856
PM_RSTS: 0x00001000
part 00000000 reset_info 00000000
uSD voltage 3.3V
Initialising SDRAM 'Samsung' 16Gb x2 total-size: 32 Gbit 3200
DDR 3200 1 0 32 152
Boot mode: SD (01) order f2564
SD HOST: 200000000 CTL0: 0x00800000 BUS: 400000 Hz actual: 390625 HZ div: 512 (256) status: 0x1fff0000 delay: 276
SD HOST: 200000000 CTL0: 0x00800f00 BUS: 400000 Hz actual: 390625 HZ div: 512 (256) status: 0x1fff0000 delay: 276
OCR c0ff8000 [18]
CID: 006f0303434241445310aa0000830173
CSD: 400e00325b590000ea6d7f800a404000
SD: bus-width: 4 spec: 2 SCR: 0x02b58003 0x00000000
SD HOST: 200000000 CTL0: 0x00800f04 BUS: 50000000 Hz actual: 50000000 HZ div: 4 (2) status: 0x1fff0000 delay: 2
MBR: 0x00002000, 1048576 type: 0x0c
MBR: 0x00102000,60397568 type: 0x83
MBR: 0x00000000, 0 type: 0x00
MBR: 0x00000000, 0 type: 0x00
Trying partition: 0
type: 32 lba: 8192 oem: 'mkfs.fat' volume: ' bootfs '
rsc 32 fat-sectors 2040 c-count 261116 c-size 4
root dir cluster 2 sectors 0 entries 0
FAT32 clusters 261116
Trying partition: 0
type: 32 lba: 8192 oem: 'mkfs.fat' volume: ' bootfs '
rsc 32 fat-sectors 2040 c-count 261116 c-size 4
root dir cluster 2 sectors 0 entries 0
FAT32 clusters 261116
Read config.txt bytes 317 hnd 0x9
gpio_cmd: '10=ip,np' pins: 10-10 drive: -1 fsel: 0 term: 0
Read start4.elf bytes 2254208 hnd 0x4ca5
Read fixup4.dat bytes 5403 hnd 0x129
0x00c03140 0x00000000 0x00001fff
MEM GPU: 76 ARM: 948 TOTAL: 1024
Firmware: 03dc77429335caee083e22ddc8eec09c07f12a7a Aug 10 2023 15:33:38
Starting start4.elf @ 0xfec00200 partition 0
+
Diff of the two logs (up to the point where the kernel boots):
@@ -9,7 +9,7 @@
Boot mode: SD (01) order f2564
SD HOST: 200000000 CTL0: 0x00800000 BUS: 400000 Hz actual: 390625 HZ div: 512 (256) status: 0x1fff0000 delay: 276
SD HOST: 200000000 CTL0: 0x00800f00 BUS: 400000 Hz actual: 390625 HZ div: 512 (256) status: 0x1fff0000 delay: 276
-OCR c0ff8000 [23]
+OCR c0ff8000 [18]
CID: 006f0303434241445310aa0000830173
CSD: 400e00325b590000ea6d7f800a404000
SD: bus-width: 4 spec: 2 SCR: 0x02b58003 0x00000000
@@ -28,7 +28,7 @@
rsc 32 fat-sectors 2040 c-count 261116 c-size 4
root dir cluster 2 sectors 0 entries 0
FAT32 clusters 261116
-Read config.txt bytes 337 hnd 0x292e
+Read config.txt bytes 317 hnd 0x9
gpio_cmd: '10=ip,np' pins: 10-10 drive: -1 fsel: 0 term: 0
Read start4.elf bytes 2254208 hnd 0x4ca5
Read fixup4.dat bytes 5403 hnd 0x129
Any ideas on what could be going wrong? Maybe something needs to be configured with the initramfs images as well?