Skip to contentSkip to conversation

configs/rock5b_defconfig: Switch to mainline kernel

Buildroot kilian.zinnecker--- via buildroot 1 participant 4 messages Feb 6, 2024 – Feb 10, 2024

lore
Share & tools
lore
#0 lore raw

Hello,

The board support for the Rock5b uses a custom kernel. However, there already exists some mainline support for its SoC, the Rockchip RK3588 [1]. Some of it seems to already be present in kernel 6.6, which is the current latest version in buildroot. I would like to change the kernel used for the Rock5b from custom to mainline. Unfortunately I face a challenge.

In order to get kernel log output on the serial interface, I changed the consosole from ttyS2,1500000n8 to serial2,1500000n8 in the kernel bootargs (as seen in Sebastian Reichel's Kernel Recipes 2023 talk). After that, it shows the kernel messages, but it never reaches a shell:

[    0.321600] mmc_host mmc1: Bus speed (slot 0) = 400000Hz (slot req 
400000Hz, actual 400000HZ div = 0)
[    0.370827] hub 4-0:1.0: USB hub found
[    0.371218] hub 4-0:1.0: 1 port detected
[    0.372291] Waiting for root device /dev/mmcblk0p2...
[    0.382457] mmc_host mmc1: Bus speed (slot 0) = 198000000Hz (slot req 
200000000Hz, actual 198000000HZ div = 0)
[    0.497629] usb 1-1: new high-speed USB device number 2 using ehci-platform
[    0.655570] hub 1-1:1.0: USB hub found
[    0.656181] hub 1-1:1.0: 4 ports detected
[    0.794063] dwmmc_rockchip fe2c0000.mmc: Successfully tuned phase to 118
[    0.794672] mmc1: new ultra high speed SDR104 SDHC card at address 5048
[    0.796162] mmcblk1: mmc1:5048 SD32G 29.7 GiB
[    0.802500] GPT:Primary header thinks Alt. header is not at the end of the 
disk.
[    0.803155] GPT:563351 != 62357503
[    0.803459] GPT:Alternate GPT header not at the end of the disk.
[    0.803985] GPT:563351 != 62357503
[    0.804287] GPT: Use GNU Parted to correct GPT errors.
[    0.804761]  mmcblk1: p1 p2
[   31.717905] vdd_gpu_s0: disabling
[  115.285576] random: crng init done

Of course it could be, that it is just not configured anymore to put a shell on the serial interface, but I already tried to address that with:

BR2_TARGET_GENERIC_GETTY=y
BR2_TARGET_GENERIC_GETTY_PORT="serial2"

However, that did not seem to help. Could it be, that there is something wrong with the SD card formatting? It at least complains about it, but I am too unfamiliar with that, so I don't know whether it is a problem. I also tried to change the rootfs partition in the bootargs mmcblk0p2 to mmcblk1p2, but then the boot got stuck at some other place.

As kernel defconfig I use the default arm64 defconfig (BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y). Could that also be an issue, i.e., that I should provide a tailored one, e.g., by starting from the one used by the custom kernel?

I appreciate any help or suggestions, thanks and best regards, Kilian

[1] https://gitlab.collabora.com/hardware-enablement/rockchip-3588/notes-for-rockchip-3588/-/blob/main/mainline-status.md

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#1 lore raw

Hi Kilian,

Quoted 25 lines · kilian.zinnecker--- via buildroot

Hello,

The board support for the Rock5b uses a custom kernel. However, there already exists some mainline support for its SoC, the Rockchip RK3588 [1]. Some of it seems to already be present in kernel 6.6, which is the current latest version in buildroot. I would like to change the kernel used for the Rock5b from custom to mainline. Unfortunately I face a challenge.

In order to get kernel log output on the serial interface, I changed the consosole from ttyS2,1500000n8 to serial2,1500000n8 in the kernel bootargs (as seen in Sebastian Reichel's Kernel Recipes 2023 talk). After that, it shows the kernel messages, but it never reaches a shell:

[    0.321600] mmc_host mmc1: Bus speed (slot 0) = 400000Hz (slot req
400000Hz, actual 400000HZ div = 0)
[    0.370827] hub 4-0:1.0: USB hub found
[    0.371218] hub 4-0:1.0: 1 port detected
[    0.372291] Waiting for root device /dev/mmcblk0p2...
[    0.382457] mmc_host mmc1: Bus speed (slot 0) = 198000000Hz (slot req
200000000Hz, actual 198000000HZ div = 0)
[    0.497629] usb 1-1: new high-speed USB device number 2 using ehci-platform
[    0.655570] hub 1-1:1.0: USB hub found
[    0.656181] hub 1-1:1.0: 4 ports detected
[    0.794063] dwmmc_rockchip fe2c0000.mmc: Successfully tuned phase to 118
[    0.794672] mmc1: new ultra high speed SDR104 SDHC card at address 5048
Quoted 8 lines
[    0.796162] mmcblk1: mmc1:5048 SD32G 29.7 GiB
[    0.802500] GPT:Primary header thinks Alt. header is not at the end of the
disk.
[    0.803155] GPT:563351 != 62357503
[    0.803459] GPT:Alternate GPT header not at the end of the disk.
[    0.803985] GPT:563351 != 62357503
[    0.804287] GPT: Use GNU Parted to correct GPT errors.
[    0.804761]  mmcblk1: p1 p2

Clearly, the rootfs is on mmcblk1p2, not mmcblk0p2. So if you have mmcblk0p2
on your command line, and rootwait, it will just wait indefinitely for the rootfs to appear.

Quoted 2 lines
[   31.717905] vdd_gpu_s0: disabling
[  115.285576] random: crng init done

That's pretty late for the RNG to be initialized, you'll need the RNG seeder
from userspace - but this is enabled by default in Buildroot I think.

Quoted 9 lines

Of course it could be, that it is just not configured anymore to put a shell on the serial interface, but I already tried to address that with:

BR2_TARGET_GENERIC_GETTY=y
BR2_TARGET_GENERIC_GETTY_PORT="serial2"

However, that did not seem to help. Could it be, that there is something wrong with the SD card formatting? It at least complains about it, but I am too unfamiliar with that, so I don't know whether it is a problem.

That's normal. It's because the generated image is not the exact size of your
SD card, so the backup GPT partition table is somewhere in the middle instead of at the end. You can run parted on your laptop after writing the SD card and before booting it to fix the issue. But it shouldn't make any difference at all for booting.

Quoted 3 lines

I also tried to
change the rootfs partition in the bootargs mmcblk0p2 to mmcblk1p2, but then the boot got stuck at some other place.

That other place is the interesting one, with mmcblk0p2 I would indeed expect
it to stop where you've shown it above.

Quoted 5 lines

As kernel defconfig I use the default arm64 defconfig (BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y). Could that also be an issue, i.e., that I should provide a tailored one, e.g., by starting from the one used by the custom kernel?

It's indeed possible that the arm64 defconfig misses some things that are
needed by the RK3588, hard to say from here. But if it already gets to MMC enumeration, it looks like it's mostly working.

Regards,
Arnout

Quoted 10 lines

I appreciate any help or suggestions, thanks and best regards, Kilian

[1] https://gitlab.collabora.com/hardware-enablement/rockchip-3588/notes-for-rockchip-3588/-/blob/main/mainline-status.md

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#2 lore raw
Quoted 9 lines · Arnout Vandecappelle

 Hi Kilian,

Quoted 5 lines · kilian.zinnecker--- via buildroot

Of course it could be, that it is just not configured anymore to put a shell on the serial interface, but I already tried to address that with:

BR2_TARGET_GENERIC_GETTY=y
BR2_TARGET_GENERIC_GETTY_PORT="serial2"

 Oh, and it's safer to keep this at the default "console" - if you get kernel output on console, the getty on the same location should work fine. With "serial2" you have to be sure that that is really correct and that you're not confusing with the name in device tree or in U-Boot, both of which may be different. Actually, "serial2" is almost certainly wrong, serial ports almost always start with tty.

 Regards,
 Arnout

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw
In reply to Arnout Vandecappelle via buildroot

Hello Arnout, all,

I was told that from kernel 6.7 on the ethernet of the Rock5B is supported, so I switched to that version (precisely 6.7.4 currently).

Quoted 3 lines

Clearly, the rootfs is on mmcblk1p2, not mmcblk0p2. So if you have
mmcblk0p2 on your command line, and rootwait, it will just wait indefinitely for the rootfs to appear.

Yes, correct, when I switch to mmcblk1p2 it works now! But I also switched to kernel 6.7.4 for now and switched the console in the bootargs to ttyS2 again.

Quoted 6 lines
Quoted 2 lines
[   31.717905] vdd_gpu_s0: disabling
[  115.285576] random: crng init done

That's pretty late for the RNG to be initialized, you'll need the RNG
seeder from userspace - but this is enabled by default in Buildroot I think.

How could I check that?

Quoted 10 lines
Quoted 9 lines

Of course it could be, that it is just not configured anymore to put a shell on the serial interface, but I already tried to address that with:

BR2_TARGET_GENERIC_GETTY=y
BR2_TARGET_GENERIC_GETTY_PORT="serial2"

However, that did not seem to help. Could it be, that there is something wrong with the SD card formatting? It at least complains about it, but I am too unfamiliar with that, so I don't know whether it is a problem.

Quoted 5 lines

That's normal. It's because the generated image is not the exact size of
your SD card, so the backup GPT partition table is somewhere in the middle instead of at the end. You can run parted on your laptop after writing the SD card and before booting it to fix the issue. But it shouldn't make any difference at all for booting.

Thanks, I am not familiar with this and thought, it might cause some troubles.

Currently the Rock5B does boot now with the 6.7.4 upstream kernel, but ethernet does not work yet. I try to figure out how to get it working, then I will submit a patch.

Thanks for your help and best regards,
Kilian

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot