PINE64
bootloader menu to pick a kernel - what is the current situation in in early 2022? - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: Pinebook Pro (https://forum.pine64.org/forumdisplay.php?fid=111)
+--- Forum: Linux on Pinebook Pro (https://forum.pine64.org/forumdisplay.php?fid=114)
+--- Thread: bootloader menu to pick a kernel - what is the current situation in in early 2022? (/showthread.php?tid=15918)



bootloader menu to pick a kernel - what is the current situation in in early 2022? - maxtothemax - 01-30-2022

Hi all. I'm trying to compile and boot a custom kernel on my PineBook Pro. Trying to add some printk instrumentation to troubleshoot a type C hotplug issue I'm having, but I'm getting stuck even getting the kernel to boot at all. I don't want to outright replace my stock kernel, I just want to be able to pick the kernel I want at boot time. Ideally I would want to stick to the principle of a 100% free software (or close to it) process, and using a second computer with a serial cable is not attractive to me.

I am reluctant to try any option that makes my custom kernel the default, unless I also have a working boot menu that lets me pick the stock kernel.

I am using the manjaro OS that came preinstalled, fully updated. I am using the default partition map and bootloader.

I have tried editing my /boot/extlinux/extlinux.conf to look like this:
Code:
Timeout 10
DEFAULT Manjaro ARM

MENU TITLE pick a kernel

LABEL Manjaro ARM
KERNEL /Image
FDT /dtbs/rockchip/rk3399-pinebook-pro.dtb
APPEND initrd=/initramfs-linux.img console=tty1 console=ttyS2,1500000 root=LABEL=ROOT_MNJRO rw rootwait video=eDP-1:1920x1080@60 video=HDMI-A-1:1920x1080@60 bootsplash.bootfile=bootsplash-themes/manjaro/bootsplash

LABEL CUSTOM INSTRUMENTATION
KERNEL /vmlinux-5.17.0-rc1-CUSTOM_INSTRUMENTATION+
FDT /dtbs/rockchip/rk3399-pinebook-pro.dtb
APPEND initrd=/initramfs-custom-instrumentation.img console=tty1 console=ttyS2,1500000 root=LABEL=ROOT_MNJRO rw rootwait video=eDP-1:1920x1080@60 video=HDMI-A-1:1920x1080@60 bootsplash.bootfile=bootsplash-themes/manjaro/bootsplash
This doesn't seem to do anything, just boots right into the stock kernel. I also tried spamming control-C or the arrow keys at boot time, this made no difference, no menu shows up. As I mentioned earlier I am reluctant to change the DEFAULT setting since it might make the system unbootable.

I have also tried using the kexec method. I wrote this script:
Code:
#! /bin/sh
sudo kexec -l /boot/vmlinux-5.17.0-rc1-CUSTOM_INSTRUMENTATION+ --initrd=/boot/initramfs-custom-instrumentation.img --reuse-cmdline

# I tried both of these versions:
#sudo systemctl kexec
sudo kexec -e
It's hard to tell what the hardware is doing on a fanless system, but it appears to just power off the computer when I run the script. Then, when I power it on, I just get a blank screen. I can then hard reset and power it on again, and it boots back into the stock kernel.

I found some prior forum threads on this subject, but it looks like the situation is evolving rapidly and the info there might not be up to date.


RE: bootloader menu to pick a kernel - what is the current situation in in early 2022? - jpalus - 02-02-2022

I'm doing kernel selection for more than a year so it's definitely possible. The biggest obstacle before was lack of display support in uboot but patches existed and since uboot 2021.07 it is mainlined. Things worth checking
  1. Try adding "menu label" entry under "label" (if I remember correctly it didn't work without it)
  2. Check your uboot version (some ancient versions of uboot didn't support extlinux.conf though I would be surprised if it was used for Pinebook Pro)
  3. Make sure partition with extlinux.conf is used: needs to be marked as active and device holding partition needs to be ordered accordingly in boot_targets var in uboot



RE: bootloader menu to pick a kernel - what is the current situation in in early 2022? - wpeckham - 02-02-2022

Another option: clone your system to a fast SD card.  Boot from it and make sure it works properly.  When the SD boot works well,  move the custom kernel into place on the SD card and boot from it to test your kernel. 

Advantage
1.  leaves your EMMC boot untouched!   
2. Backout is remove the SD card and reboot: dead simple.
3. Retry is fix your custom kernel, copy into place on the SD card, and try again.

Way less stress, dead simple, portable, and repeatable.


RE: bootloader menu to pick a kernel - what is the current situation in in early 2022? - maxtothemax - 02-02-2022

Those are some good breadcrumbs, thanks! I'll report results this weekend.


RE: bootloader menu to pick a kernel - what is the current situation in in early 2022? - maxtothemax - 02-05-2022

Partial success!

I did add the MENU LABEL lines to extlinux.conf, but I am not sure whether that was actually needed.

What made the difference in the end was switching from "uboot-pinebookpro-bsp" to "uboot-pinebookpro" ("pacman -S uboot-pinebookpro" and then follow the directions that get printed on the command line.)

This gets me a bootloader menu to pick a kernel like I wanted, and it can boot the stock kernel successfully. Unlike some of older reports I found on the forums, in my experience, switching to mainline u-boot did not make booting unreliable and suspend works fine.

When I pick my custom kernel, I get the same blank screen behavior that I saw with the kexec method, but I guess that just means there's something wrong with my kernel and I can troubleshoot that separately. I have the bootloader behavior I wanted, so I'll mark this thread as solved.