
Guide to Applying Real-Time Patches and Solving Problems on the T507 Platform Based on Linux 4.9
Applying Real-Time Patches
Each version of the kernel has a corresponding real-time patch.
The kernel version of T507 is 4.9.170, and here is the corresponding real-time patch version.
Download address: https://mirrors.edge.kernel.org/pub/linux/kernel/projects/rt/4.9/older/
After obtaining the patch compressed package, extract it in the virtual machine:
tar -xzvf linux-4.4.206.tar.gz gunzip patch-4.4.206-rt190.patch.gz
Apply the patch under the kernel path.
Enter the kernel configuration menu.
Select the full preemption mode.
After the application is completed, compilation usually fails because the source code has been modified later, and there will be some parts that conflict with the official patch files. .rej files will be automatically generated at these locations.
Please manually add the modifications in these files to the source code. When adding, do not directly copy and paste.
For example, if the content in the patch file contains a variable a, but the context in the source code uses sunxi_a. Please unify these modifications with the existing source code and pay attention to these differences.
Solving Compilation Errors
1. The kernel source code of T507 is quite special. The zram part refers to the kernel of 5.10, so this part should be modified with reference to the real-time patch of 5.10;
2. During the compilation process, an error occurred regarding the driver of the 6256 wifi and Bluetooth chip. The error information at that time was not saved. The general meaning is that the actual parameters passed to one of the functions do not match the parameter types defined in the function;
The modifications are as follows:
diff --git a/linux-4.9/drivers/net/wireless/bcmdhd/dhd_pno.c b/linux-4.9/drivers/net/wireless/bcmdhd/dhd_pno.c old mode 100644 new mode 100755 index 8d2957fd8..52d491f21 --- a/linux-4.9/drivers/net/wireless/bcmdhd/dhd_pno.c +++ b/linux-4.9/drivers/net/wireless/bcmdhd/dhd_pno.c @@ -35,7 +35,7 @@ #ifdef PNO_SUPPORT #include#include - +#include #include #include @@ -3169,7 +3169,7 @@ exit: } mutex_unlock(&_pno_state->pno_mutex); exit_no_unlock: - if (waitqueue_active(&_pno_state->get_batch_done.wait)) + if (swait_active(&_pno_state->get_batch_done.wait)) complete(&_pno_state->get_batch_done); return err; } @@ -3948,7 +3948,7 @@ dhd_pno_event_handler(dhd_pub_t *dhd, wl_event_msg_t *event, void *event_data) { struct dhd_pno_batch_params *params_batch; params_batch = &_pno_state->pno_params_arr[INDEX_OF_BATCH_PARAMS].params_batch; - if (!waitqueue_active(&_pno_state->get_batch_done.wait)) { + if (!swait_active(&_pno_state->get_batch_done.wait)) { DHD_PNO(("%s : WLC_E_PFN_BEST_BATCHING\n", __FUNCTION__)); params_batch->get_batch.buf = NULL; params_batch->get_batch.bufsize = 0;
The reason is that after applying the real-time patch, the interface used has been changed from waitqueue_active to swait_active, so an error regarding function parameter passing occurred.
3. The compilation script added to the kernel also needs to be modified.
The path in the above figure is the output path of the kernel driver module, which will be automatically created when compiling the kernel. If no modification is made, the compilation output will follow the path 4.9.170-rt129, but the path created by the compilation script is 4.9.170, so the compilation cannot pass.
4. After packaging into an image and running it on the board, the kernel keeps crashing, and the printed information is consistent with the content in the document provided by Allwinner.
(1)
(2)
5. When running the packaged image, the screen does not display.
The GPU driver module fails to load normally because the path of the startup script in init.d is incorrect.
The modifications are as follows:
By analogy, when loading other modules, please pay attention to the path changes.
Real-time performance after applying the patch.