tolszak
Posts: 4
Joined: Tue Jan 14, 2020 10:28 pm

Raspberry pi 4 load kernel from non boot partition

Fri Feb 21, 2020 3:38 pm

Hello is it possible to load kernel from non boot partition?

e.g. partitions layout

- bootd
- rootfs1 with customkernel1
- rootfs2 with customkernel2

I did something like that with grub so that I could point out boot partition that it looks kernel in. This way I can only share RO roofs partition updates almost without touching boot partition. Ideally only config.txt would be updated at last step of an update.

satadru
Posts: 18
Joined: Thu Apr 18, 2013 5:18 pm

Re: Raspberry pi 4 load kernel from non boot partition

Fri Feb 21, 2020 7:38 pm

The simplest way would probably be to load u-boot, (assuming that u-boot has support for the partition type you have your kernel on), and then using a u-boot boot script to load your kernel from your other partition.

Of course you're going to have fun with getting a set of dtb files which work for your kernel and for u-boot...

User avatar
procount
Posts: 2059
Joined: Thu Jun 27, 2013 12:32 pm
Location: UK

Re: Raspberry pi 4 load kernel from non boot partition

Sat Feb 22, 2020 9:21 am

You can easily do it with noobs or pinn if you are prepared to have a partition layout as follows:

Code: Select all

Recovery
Bootkernel1
Rootfs1
Bootkernel2
Rootfs2
You can probably do it without noobs/pinn but with minimal firmware and an autoboot.txt file on the recovery partition to select which to load.

Pinn even has the ability on boot to silently update the OSes if a new version exists. You'd just have to work out a script how to make that alternate between the 2 instances, but I've not tried that part.
PINN - NOOBS with the extras... https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=142574

tolszak
Posts: 4
Joined: Tue Jan 14, 2020 10:28 pm

Re: Raspberry pi 4 load kernel from non boot partition

Mon Feb 24, 2020 1:18 pm

Sorry,

I had disabled notifications,

I use yocto so probably using NOOP or PINN is out of scope.

Seems like currently there is not rpi4 support on zeus branch. I however see that there is rpi4 def config added to u-boot and it seems already used by poky master.
https://github.com/u-boot/u-boot/commit ... f300782042

Thanks will try u-boot once it is available. I thought that perhaps I can create something like recovery config and then switch the boot partition using only rpi4 bootloader.

User avatar
procount
Posts: 2059
Joined: Thu Jun 27, 2013 12:32 pm
Location: UK

Re: Raspberry pi 4 load kernel from non boot partition

Mon Feb 24, 2020 1:48 pm

tolszak wrote:
Mon Feb 24, 2020 1:18 pm
I use yocto so probably using NOOP or PINN is out of scope.
What difference does the method you use to build your kernel (yocto) make?
NOOBS or PINN just tell the firmware which partition to load your OS from.
tolszak wrote:
Mon Feb 24, 2020 1:18 pm
I thought that perhaps I can create something like recovery config and then switch the boot partition using only rpi4 bootloader.
You can. It's called autoboot.txt. Just set boot_partition to the partition you want to boot.
PINN - NOOBS with the extras... https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=142574

tolszak
Posts: 4
Joined: Tue Jan 14, 2020 10:28 pm

Re: Raspberry pi 4 load kernel from non boot partition

Mon Feb 24, 2020 6:15 pm

procount wrote:What difference does the method you use to build your kernel (yocto) make?
NOOBS or PINN just tell the firmware which partition to load your OS from.
I just generate full image including boot rootfs, then I have wks file to point out partition layout. So you say installing PINN and just copy the binaries from boot partition is enough? Then I will be able to use PINN with my custom distro right?

Thanks for hints BTW

User avatar
procount
Posts: 2059
Joined: Thu Jun 27, 2013 12:32 pm
Location: UK

Re: Raspberry pi 4 load kernel from non boot partition

Mon Feb 24, 2020 9:17 pm

On second thoughts, PINN will just complicate things.

With the standard boot loader, you have the option of autoboot.txt specifying the boot_partition to use for loading the kernel from, or the rootfs option of cmdline.txt.
Or there's the UBoot option.

Normally the kernel is located on the FAT boot partition. The rootfs may be on the same partition or a separate partition. I'm not sure I understand enough of what you are trying to achieve.
PINN - NOOBS with the extras... https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=142574

Return to “Advanced users”