Jump to content

PREEMPT_RT patch for rockchip rk-5.10-rkr8?


Recommended Posts

Posted (edited)

Hello. I'm looking for a PREEMPT_RT patch for your linux-rockchip kernel.

I've tried to apply an rt101 patch for 5.10.209 (branch rk-5.10-rkr8), but it has so many differences (especially, scheduler-related)...  I've spend a lot of time resolving the conflicts manually but my kernel keeps crashing on start.

 

Please, help me...

Edited by SysProg
branch
Posted

The kernel you are trying to modify is a heavily modified vendor bsp kernel that is some sort of weird mixture of Android and Linux. My suggestion is don't waste your time...

 

You may have better chances with 6.1.y vendor bsp since it is some sort of proper Linux.

Posted (edited)

@Werner thank you for your reply. I haven't seen a 6.1.y kernel from rockchip, only v5.10 and below. May I ask you for a link? Or do you mean v6.1.y of mainline linux kernel?

 

Edited by SysProg
typo
Posted (edited)

@SysProg I'm also looking for a way to got a PREEMPT_RT kernel for Armbian. I followed the instructions from **indianajones**  https://forum.armbian.com/topic/11491-real-time-operating-system/ to include a rt patch and running the `compile.sh` script.

The patching and kernel compilation works, but the `compile.sh` script fails because of wrong references of filenames.

 

Steps to reproduce:

- Build environment: Docker

- Board: lime2

- Kernel Release: jammy (22.04)

- Kernel version: 6.6.75

- RT-Patch: patch-6.6.74-rt48.patch.xz https://www.kernel.org/pub/linux/kernel/projects/rt/6.6/older/patch-6.6.74-rt48.patch.xz

 

Packaging linux-image [ sunxi linux-sunxi-current ] 
[🐳|🔨] [ 14M] /armbian/.tmp/work-faa9b4e0-5171-48e1-a64e-1437de80d285/kernel_dest_install_dir-GxS0c/image/boot 
[🐳|🔨] ├── [211K] config-6.6.75-rt48-current-sunxi
[🐳|🔨] ├── [3.6M] System.map-6.6.75-rt48-current-sunxi 
[🐳|🔨] └── [ 10M] vmlinuz-6.6.75-rt48-current-sunxi 
[🐳|🔨]
[🐳|🔨] 14M used in 0 directories, 3 files 
[🐳|🌱] Kernel-built image filetype [ vmlinuz-6.6.75-current-sunxi: cannot open `/armbian/.tmp/work-faa9b4e0-5171-48e1-a64e-1437de80d285/kernel_dest_install_dir-GxS0c/image/boot/vmlinuz-6.6.75-current-sunxi' (No such file or directory) ] 
[🐳|🔨] ls: cannot access '/armbian/.tmp/work-faa9b4e0-5171-48e1-a64e-1437de80d285/kernel_dest_install_dir-GxS0c/image/boot/vmlinuz-6.6.75-current-sunxi': No such file or directory

 

The related function is `kernel_package_callback_linux_image()` inside `kernel-debs.sh`.

 

I'm still try to find out how to solve this failure. The hook `call_extension_method "pre_package_kernel_image"` is maybe to key, or some extra build commands like *KERNEL_CONFIGURE*.
I tried this quick and dirty extension, but no success so far:

function pre_package_kernel_image__600_set_kernel_name() {
    # Determine the correct kernel image file name
    kernel_image_file=$(ls "${kernel_pre_package_path}/vmlinuz-6.6.75-*" 2>/dev/null)
    if [ -z "$kernel_image_file" ]; then
        echo "Error: Kernel image file not found!" >&2
        run_host_command_logged ls -la "${kernel_pre_package_path}"
        exit 1
    fi

    # Set the correct kernel image name
    kernel_image_pre_package_path="$kernel_image_file"
    echo "Using kernel image file: $kernel_image_pre_package_path"
}

 

Any help will be welcome.

Edited by Seihan
Posted (edited)

Hi @Werner! I configured the 6.1 kernel (manually added an RT-patch too), but I have problems booting it, it only detects mmcblk0boot* partitions from my card and no rootfs/user partitions.

My uboot is a slightly modified old rockchip-uboot of 2017. Does kernel 6.1 require a newer uboot? If so, which one should I take?

 

Nevermind, my bad! I've missed a CONFIG_EFI_PARTITION...

 

@Seihan, sorry, I cannot use 6.6 for some reasons, only 6.1 and below, so I can't be any of help

Edited by SysProg
Posted

@SysProg can you please provide instructions how you patched the kernel?

As mentoined, I used the armbian build script. The RT patch is the last of 8 patches in my case. I'm trying to solve the issue with an extension hook.  I use a second extension to modify the partitions on the image, this may solve your problem. The hooks format_partitions, and prepare_image_size are used for this as described here 

 

Posted

I successfully built an armbian image with PREEMPT_RT kernel, by changing line 52 in armbian/lib/functions/compilation/kernel-debs.sh into:

declare kernel_version_family="${kernel_version}-rt48-${BRANCH}-${LINUXFAMILY}"

This isn't a valid solution, but it worked for me, for this moment.

 

root@lime2 ~ # uname -a
Linux lime2 6.6.75-rt48-current-sunxi #19 SMP Sat Feb  1 17:37:57 UTC 2025 armv7l armv7l armv7l GNU/Linux

 

Limitations:

- works only for rt48

- kernel 6.6.75

- patch-6.6.74-rt48.patch.xz

 

It is not possible to pin the build process to specific kernel version tags. The option exists, but it has no effect. Any hints on how to pin the builder to a specific kernel would be helpful to reproduce this build in the future.

Posted
10.03.2025 в 09:40, SysProg сказал:

I'm looking for a PREEMPT_RT patch for your linux-rockchip kernel.

I've tried to apply an rt101 patch for 5.10.209 (branch rk-5.10-rkr8), but it has so many differences (especially, scheduler-related)...  I've spend a lot of time resolving the conflicts manually but my kernel keeps crashing on start.

Maybe you can describe the problem/goal that you want to solve using RT Core.

 

First you need to figure out what is required.
There are several real-time Cores. And each solves its own problems.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines