How to compile realtime kernel on aarch64 pi4

Discussion about U-Boot and the kernel.

How to compile realtime kernel on aarch64 pi4

Postby tombrear » Sun Oct 04, 2020 3:31 pm

As a newbie in Archlinuxarm, I have no idea how to do this.
Could anyone help to give me a direction? Thanks so much.
tombrear
 
Posts: 17
Joined: Sun Oct 04, 2020 3:29 pm

Re: How to compile realtime kernel on aarch64 pi4

Postby mrtux » Mon Oct 05, 2020 7:09 am

The steps are similar to building a kernel on x86_64, make sure you have the dependencies for building packages installed. First you will need to grab your configuration file. Arch Linux allows you to do this from /proc/config.gz, as an example on your Pi run $this->bbcode_second_pass_code('', ' zcat /proc/config.gz > piconfig ') You will need to move and rename this later. You will need the realtime patch, https://rt.wiki.kernel.org/index.php/CONFIG_PREEMPT_RT_Patch Afterwards, download the kernel source from https://www.kernel.org/ extract it to a build location and prepare it, move your config file to the build directory as .config, apply the RT patch. Then configure the kernel by running make menuconfig, make sure your preemption is set to RT, save, and afterwards build the kernel. You will have to do a little research on building the kernel for arm64, Basically you will need to run $this->bbcode_second_pass_code('', ' make Image Image.gz modules ') and you will also need to build the device tree blobs, which you can do with $this->bbcode_second_pass_code('', ' make DTC_FLAGS="-@" dtbs ') After everything is build, you will need to copy the files to your /boot location. If you plan on doing this often, I would recommend making a PKGBUILD so it is simplifies updating the kernel, and you will be able to install the kernels you build as packages and avoid manually copying the files each time. You could use an existing PKGBUILD from the AUR and modify it to suit your needs. You will need to build a new ramdisk after copying your files. As long as your image file name is not changed, you should be able to use mkinitcpio -P. You can also cross compile the kernel on an x86_64 to speed the process up dramatically, but it is more involved to figure out initially. If you don't have any experience building kernels, you will need to spend some time doing some research before you'll be able to pull this off. Lastly, once your kernel files are copied and it boots properly, be sure to know if you do not uninstall the linux-aarch64 package, when it updates it will replace your files. What are you trying to run on your Pi? Are you sure that you absolutely need a RT kernel?
mrtux
 
Posts: 32
Joined: Wed Aug 12, 2020 4:06 am

Re: How to compile realtime kernel on aarch64 pi4

Postby tombrear » Mon Oct 05, 2020 8:21 am

Mrtux:

Thanks fro reply. I am trying to build music playback custom OS which requires low latency and low jitter for better sound quality.
This is first time to compile the kernel by my own. So I am still confused about how to make it done with more details. :cry: :roll:
tombrear
 
Posts: 17
Joined: Sun Oct 04, 2020 3:29 pm

Re: How to compile realtime kernel on aarch64 pi4

Postby graysky » Mon Oct 05, 2020 11:20 am

Highly recommend you do not manually build but that you use https://github.com/archlinuxarm/PKGBUILDs/tree/master/core/linux-raspberrypi4 as a template and modify the files therein to suit you needs.
graysky
Developer
 
Posts: 1727
Joined: Sun Jun 26, 2011 6:56 am
Location: /run/user/1000

Re: How to compile realtime kernel on aarch64 pi4

Postby tombrear » Mon Oct 05, 2020 12:25 pm

graysky
Thanks for this tips, but it seems not compatible with aarch64 env. And I am really not familiar with PKBuilds on Archlinux.
I would try to research more. :cry: :roll:
tombrear
 
Posts: 17
Joined: Sun Oct 04, 2020 3:29 pm

Re: How to compile realtime kernel on aarch64 pi4

Postby graysky » Mon Oct 05, 2020 2:55 pm

If building a realtime kernel is just a different set of config options, you can use the PKGBUILD as-is and just use your own config.
graysky
Developer
 
Posts: 1727
Joined: Sun Jun 26, 2011 6:56 am
Location: /run/user/1000

Re: How to compile realtime kernel on aarch64 pi4

Postby tombrear » Tue Oct 06, 2020 10:12 am

I am try to do that. But en error happened.
==> Generating module dependencies
==> Creating gzip-compressed initcpio image: /boot/initramfs-linux.img
==> Image generation successful
==> Building image from preset: /etc/mkinitcpio.d/linux-aarch64.preset: 'fallback'
-> -k 4.19.148-2-rt64-ARCH -c /etc/mkinitcpio.conf -g /boot/initramfs-linux-fallback.img -S autodetect
==> ERROR: Unable to write to /boot/initramfs-linux-fallback.img

What's heppened?
tombrear
 
Posts: 17
Joined: Sun Oct 04, 2020 3:29 pm

Re: How to compile realtime kernel on aarch64 pi4

Postby graysky » Tue Oct 06, 2020 11:26 am

Is your /boot full?
graysky
Developer
 
Posts: 1727
Joined: Sun Jun 26, 2011 6:56 am
Location: /run/user/1000

Re: How to compile realtime kernel on aarch64 pi4

Postby tombrear » Tue Oct 06, 2020 1:25 pm

I have no idea, boot is 200M as install instruction.
Is that too small for doing compile kernel? the total SD card is 64G.
tombrear
 
Posts: 17
Joined: Sun Oct 04, 2020 3:29 pm

Re: How to compile realtime kernel on aarch64 pi4

Postby tombrear » Tue Oct 06, 2020 2:42 pm

use df -h
/dev/mmcvbl0p1 253M 55M 198M 22% /boot
/dev/sdb2 59G. 7.5G. 48G. 14%. /home/pi/root
tombrear
 
Posts: 17
Joined: Sun Oct 04, 2020 3:29 pm

Next

Return to U-Boot/Kernel

Who is online

Users browsing this forum: No registered users and 8 guests