Building PREEMPT_RT kernel inside docker

Hello, i want to share and also ask a question about my approach for rebuilding l4t kernel with PREEMPT_RT patch.

Here is the Dockerfile which builds kernel and modules for Xavier (jetpack 4.2.1 supported). Just run following commands on your laptop

docker build -t xavier-rt-kernel:32.2.1 -f Dockerfile.l4t_32_2_1 .
docker run --rm -v $(pwd):/host xavier-rt-kernel:32.2.1 \
  cp /Linux_for_Tegra/kernel/kernel_supplements.tbz2 \
     /Linux_for_Tegra/bootloader/payloads_t19x/bl_update_payload \
     /Linux_for_Tegra/bootloader/payloads_t19x/bl_update_payload_default \
       /host

After that “bl_update_payload” can be flashed with OTA update and “kernel_supplements.tbz2” should be unpacked to /lib/modules. I use OTA update to not depend on USB and preerve contents of the system. This allows me to switch between RT and non-RT kernels in a minute. Described whole workflow here.

This approach works well for me, but i have a question. Do i also need to rebuild DTB (from generated DTS) after rt-patch.sh changes? I’m using DTBs from default kernel now.

If approach makes sense, i can also add latest 4.2.2 support.

No change in DT required between RT and non-RT kernel.