How to allow Uboot to choose boot kernel? (Upstream uboot for RockPi4)

Hi,

Since RockPi4 is already using upstream Uboot, I’m wondering what is needed to switch kernels through U-boot.

Currently, the timeout doesn’t really allow user to choose which kernel to boot.

This brings a lot of pain to test kernels. (Have to switch custom compiled kernel to test 64K page size)

As when the default kernel fails, either goes into Uboot input all the kernel/dtbs/initrd and kernel options (pretty long), or remove the sdcard, mount it and modify the extlinux/*.

The later method needs me to access the sdcard, but since I’m also using NVME on that board, the ribbon cable mostly blocks the sdcard slot.
So it will take me over 5mins just to modify the default kernel back to manjaro kernel.

Any good idea on that? IIRC some Uboot build allows kernel selection afaik, and with such feature,
it should allow us to do more testing related to kernel/initrd/dtbs.

Thank.

We don’t prohibit the kernel selection from Uboot. We use the default timeout that’s present in uboot, which is 3 seconds I believe.

What you need to do though, is create an entry in your extlinux.conf file for the new kernel you want to test.

As far as I know, there is no way to detect installed kernels and generate an extlinux.conf from that at boot time with u-boot.

Other bootloaders, like petit-boot, have this capability, by checking for boot-scripts.

The problem is, I created the entry, and change DEFAULT to my new entry, then U-boot indeed defaults to the new initrd/kernel/fdt.

So far so good, but when the kernel doesn’t work (mostly I screw up something), e.g. I forgot to include the rockchip pcie controller or the xfs module, then we fall to initramfs shell.

What I want is, in uboot, allow me to choose between the entries already in the extlinux.conf.

Is it possible? I tried bootmenu command, but that doesn’t work and seems to need extra script other than extlinux.conf payload.

Should be possible to just add another section with LANEL, KERNEL, FDT and APPEND lines.

Then you should be able to stop the autoboot when booting and select which you want.

It’s not something I have tried though.

Exactly what I tried. Only the DEFAULT works to switch different labels.
And if I screw up the path of either kernel/fdt/initrd, then U-boot would automatically switch to the manjaro one.

But that’s all.

Firstly, the timeout doesn’t work at all. Uboot always only follow its 3 sec delay. Since it hasn’t yet read the extlinux payload.

Furthermore, if I interrupt the count down of U-boot, it just go back to uboot shell. Not boot entry choosing.

I’m wondering if I missed something or there are some extra options needed in uboot to do that.

Currently the workaround is, fallback to initramfs shell, mount the /boot partition, use vi the change the extlinux payload back to manjaro kernel, and force reboot.

The workflow can be updated to a script, and be passed into the initramfs through mkinitpcio, but that’s still a workaround, far less elegant than uboot boot choose.

Why not try to look into grub ?

I hope since we have display out in uboot for rk3399 board it is time to look into grub also.

I have tried few times but it have some error with efi not supported when doing sudo update-grub
Maybe you can give it a try

You mean chain boot from uboot to grub?

I guess it’s possible but it may be overkilled just to choose different bot entries.

Although grub would work great for boards with EFI, but unfortunately not RK3399…

Somehow netBSD is a efi boot, there is a bootaa64.efi, so 3399 can efi boot
(and no other “boot” files)