Snakeoil Forums

Full Version: [split] Real Time Kernels discussion
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5
(22-Dec-2023, 08:13 AM)Snoopy8 Wrote: [ -> ]@uglymusic, this my Xmas present which may or may not cause indigestion ?  Think    Use these series of commands to create a RT kernel called kernel8. 
 
Code:
# based on https://forums.raspberrypi.com/viewtopic.php?t=344994
uname -r           # show existing kernel
sudo apt update
sudo apt install git bc bison flex libssl-dev make libncurses5-dev  
mkdir kernel
cd kernel/
git clone --depth=1 --branch rpi-6.1.y https://github.com/raspberrypi/linux
# check this website for correct version of RT kernel
# https://wiki.linuxfoundation.org/realtime/start
wget https://mirrors.edge.kernel.org/pub/linux/kernel/projects/rt/6.1/patch-6.1.67-rt20.patch.gz
cd linux/
zcat ../patch-6.1.67-rt20.patch.gz | patch -p1 --dry-run    #check the patch fits
zcat ../patch-6.1.67-rt20.patch.gz | patch -p1
make bcm2711_defconfig
make menuconfig                #General -> Preemption Model select Fully Preemptible Kernel (Real-Time)
nano .config                        #add personalised suffix to CONFIG_LOCALVERSION
scripts/config --disable SYSTEM_TRUSTED_KEYS
scripts/config --disable SYSTEM_REVOCATION_KEYS

# ideally run next command on terminal because it takes time; SSH session may reset
make -j4 Image.gz modules dtbs  # -j4 uses 4 CPUs, prompted for certificate, enter, cpuset should be turned off
sudo make -j4 modules_install
sudo cp arch/arm64/boot/dts/broadcom/*.dtb /boot/firmware/
sudo cp arch/arm64/boot/dts/overlays/*.dtb* /boot/firmware/overlays/
sudo cp arch/arm64/boot/dts/overlays/README /boot/firmware/overlays/
sudo cp /boot/firmware/kernel8.img /boot/firmware/kernel8old.img
sudo cp arch/arm64/boot/Image.gz /boot/firmware/kernel8.img

sudo reboot
uname -r                # confirm new kernel

It will take just over 2 hours to do the compile (make -j4...).

@hkphantomgtr, you have been testing various kernels for the Pi.  Not sure whether you want to try building a RT kernel???

Thank you, @Snoopy8. That's fantastic! I'm away for Christmas, so it will probably be New Year indigestion Smile

In the meantime, I'll be doing my prep.

First question: is this for Ubuntu or Raspberry Pi OS?
(22-Dec-2023, 11:19 PM)uglymusic Wrote: [ -> ]First question: is this for Ubuntu or Raspberry Pi OS?

Raspberry Bookworm OS Lite. Will build a 6.1 RT kernel using Raspberry source. Note that the kernel will run with no problems, but it will blank out the kernel field in SnakeOil / Hardware. This is an interim solution until AK can tell me how to deploy an RT kernel using Grub in Bookworm.

Also, unable to compile using Ubuntu sources.

Have tested this process a few times. Will work as it is, with current 6.1.67-RT20 RT patch. If that changes, please adjust patch number. Have fun, and hopefully will give little indigestion...
@Snoopy8 If you can, please upload your kernel to the Snakeoil Wiki. Raspberry Pi being Raspberry Pi meaning the kernel you built will be compatible with all Raspberry Pi 4, and so on.

As with @hkphantomgtr, my intention is to come up with a web application for people to customise their kernel, and if the kernel as they exactly specified exists, go straight to download, or build and send an email to a download link.

If only I won some lottery, such is life I guess. 
  [Image: angel1.gif]
(23-Dec-2023, 07:18 AM)agent_kith Wrote: [ -> ]@Snoopy8 If you can, please upload your kernel to the Snakeoil Wiki. Raspberry Pi being Raspberry Pi meaning the kernel you built will be compatible with all Raspberry Pi 4, and so on.
Which kernel? The image file that works, or the deb package that I couldn't get running. Or both?

Also. please create a new 1.3 branch on Wiki (I don't know how!) and I will take it from there.
(23-Dec-2023, 04:32 AM)Snoopy8 Wrote: [ -> ]
(22-Dec-2023, 11:19 PM)uglymusic Wrote: [ -> ]First question: is this for Ubuntu or Raspberry Pi OS?

Raspberry Bookworm OS Lite. Will build a 6.1 RT kernel using Raspberry source. Note that the kernel will run with no problems, but it will blank out the kernel field in SnakeOil / Hardware. This is an interim solution until AK can tell me how to deploy an RT kernel using Grub in Bookworm.

Also, unable to compile using Ubuntu sources.

Have tested this process a few times. Will work as it is, with current 6.1.67-RT20 RT patch. If that changes, please adjust patch number. Have fun, and hopefully will give little indigestion...

Brill! Looking forward to trying it Smile
(23-Dec-2023, 07:37 AM)Snoopy8 Wrote: [ -> ]Also. please create a new 1.3 branch on Wiki (I don't know how!) and I will take it from there.
Just overwrite the existing sections Tongue. Moving forward to 1.3.x not going to support 1.2.x much. Old entries are all kept in history so we can always revisit the old pages as needed. (This is why I prefer a wiki manual over a more traditional user doc page).

Just woke up around 8am Perth time.. Man I must be so tired past few weeks to sleep in this late! Prepping for 1.3.0 official release soonish.
(23-Dec-2023, 07:18 AM)agent_kith Wrote: [ -> ]@Snoopy8 If you can, please upload your kernel to the Snakeoil Wiki. Raspberry Pi being Raspberry Pi meaning the kernel you built will be compatible with all Raspberry Pi 4, and so on.
The kernel image that I built works only for the machine that it was built on.  Cannot copy the files to another instance; it wrecks the audio inputs at the minimum.

So, will postpone this idea of sharing kernels until the issue of using a dpkg to deploy kernels on Bookworm is solved.
(23-Dec-2023, 07:18 AM)agent_kith Wrote: [ -> ]@Snoopy8 If you can, please upload your kernel to the Snakeoil Wiki. Raspberry Pi being Raspberry Pi meaning the kernel you built will be compatible with all Raspberry Pi 4, and so on.

I have made 2 RT kernels for Bookworm, one in kernel8.img format, and also a deb package.

The kernel8 method is documented in post #30
https://www.snakeoil-os.net/forums/Threa...98#pid6998
This works on the computer (sd card) that generated the image, but when I swapped sd cards, copied all files, cannot enable new kernel.

With the deb package, can see it in SO but cannot enable it.
[Image: Boot-kernel-2023-12-27-230252.png]

For your development work, you can use the 2712 kernel which comes with Bookworm. I will upload my RT kernel to the wiki for your testing when you are ready.
(27-Dec-2023, 08:34 PM)Snoopy8 Wrote: [ -> ]For your development work, you can use the 2712 kernel which comes with Bookworm. I will upload my RT kernel to the wiki for your testing when you are ready.
Can do that now as I need more kernels to test. For some reason 2712 don't boot up in the Pi4 that I have, but the v8 one works fine.

Almost certain the existing Linux (PC) kernel detection code don't work properly for aarch64. because while those files are there, the actual kernel image is gzipped and to find the version I'll need to extract the image and then find the version that match.. Still trying to find a good way to do this, so the more kernels I have at hand, the better. Tongue
(28-Dec-2023, 01:55 PM)agent_kith Wrote: [ -> ]Can do that now as I need more kernels to test. For some reason 2712 don't boot up in the Pi4 that I have, but the v8 one works fine.
Can't upload tar file to Wiki. Have sent you link to access Google Docs.
 
(28-Dec-2023, 01:55 PM)agent_kith Wrote: [ -> ]Almost certain the existing Linux (PC) kernel detection code don't work properly for aarch64. because while those files are there, the actual kernel image is gzipped and to find the version I'll need to extract the image and then find the version that match.. Still trying to find a good way to do this, so the more kernels I have at hand, the better. Tongue
I suspect that you may be able to use /boot/firmware/config.txt to reference the new kernel but I was not able to find the right fields.
https://www.raspberrypi.com/documentatio...g_txt.html
Pages: 1 2 3 4 5