Patch Application
The first step of getting the PREEMPT_RT working with RISC-V architecture was to apply the official patch file to the mainline Linux kernel source tree. Usually, with correctly selected versions, this would be a very simple step of just using the patch command to apply a single patch file. However, in this case, there was a very specific version of the Linux kernel required to correctly support the StarFive JH-7110 DevKit. Now the StarFive JH-7110 DevKit Linux version is 5.15.0.
Download 5.15.0-rt patch from: This Link.
patch -p1 < (patch)
After applying the 5.15.0 RT patch, apply the patches in Appendix A. These patches contain the LAZY_PREEMPT configuration for the RISC-V architecture and enable the PREEMPT_RT configuration for JH-7110 DevKit. Additionally, a modification has been made to the kernel/sched/cpupri.c file regarding task prioritization by patch: 0004-cpupri-a-work-around-for-non-rt-test-panic. This modification addresses an issue in the official RT patch where non-RT tasks would trigger a 'kernel panic' during a stress test. However, please note that this is a workaround.