Debian (Lemaker) grub.cfg change to help kernel building

There’s a pretty handy feature in grub that’s currently not incorporated in grub.cfg:

$ grub-reboot 1 # or any label, like 'experimental'
$ reboot

Now the board will reboot once to the boot entry title or number after grub-reboot. For this to work there needs to be a bit of logic added to the grub config file. I’ve uploaded mine here:

I hope this helps anyone else building kernels. I’d love to send this in as a feature request, but I have no idea where.

Can you explain a little more how to use this.
I’ve been trying to fix the drm driver for debain and been building and testing a few kernels a day. If this is for booting a test kernel but still leaving the original kernel intact thats great.

Do you have a kernel tree for debain in a git where the display for desktop is working?
I have been building the 96 Boards Kernel but the display is broken.

Thank you very much for this.

So far I’ve been cataloguing the different kernel options, from 4.9 to mainline (which boots after applying MMC patches from 4.19).

The Debian image I got has a kernel image, Image in /boot, along with a dts file.

The above modification allows you to keep an extra copy of each (corresponding to the second boot entry). The board default boots into the OEM kernel, unless you tell it otherwise with grub-reboot. If the experimental kernel doesn’t work just hit reset to boot with the OEM kernel again.

That’s a nice feature for testing kernel builds.
I will be using it for sure.

When running the LeUbuntu 16.04 with the stock kernel the display works fine.
But i need a custom kernel as i am tying to get a NVME SSD working in the M.2 Key M slot.

So far no luck finding the kernel source used to build the kernel in the LeMaker images.
It’s going to be a lot of trial and error i guess.

Ok i edited my /boot/grub/grub.cfg file and added your changes.
But nothing is happening, its the same as before the edit.
I don’t see anything in /ect/ for grub either.

How do i add your grub changes? or Where ??

Assuming you overwrote your grub config file with mine:

First you run grub-reboot 1 (0 indexed menu entries).
If you want to check, go to /boot/grub, there should be a file grubenv now. If you cat it it should have your selection.
Now when you run reboot you should see, on the serial console, see the 2nd option selected. Your experimental kernel should boot now (provided you copied the image & dts and installed the modules).

I think my problem is i need to mount.
sudo mount -o loop boot-hikey970.uefi.img /mnt/boot-hikey970
Then copy your Grub.cfg in that image.

I edited the grub.cfg that is in the root dir of the booted hikey.
/boot/grub/grub.cfg
That did not have any effect. Even deleting the file did not affect anything.

So i need to edit the grub.cfg that is in the boot image ?
boot-hikey970.uefi.img

I have the grub.cfg edited in the boot UEFI image.
The normal boot works fine.

When i run grub-reboot 1

root@hikey970:~# grub-reboot 1
bash: grub-reboot: command not found

I’m running ubuntu 16.04, I’m guessing it must not have the grub package installed?