RT Preempt实时补丁调试记录
在fork官方linux打补丁后,内核编译出错,主要是在和时钟有关,
arch/arm/mach-imx/下面这三个文件
clk-pllv3.c
clk-gate2.c
clk-pfd.c
三个文件要加上头文件<wait.h>就能解决,编译成功后推送到peyoot/linux.git这个自己的git,至此已经可以单独编译出实时内核。
接下来编译带内核和设备树的整个固件。
在linux对应版本的bb文件中,用SRC_URI指向自己的git和自己的版本号 编译出错
run.do_configure.17041: cannot open /home/robin/dey20-workspace/cc6sbc/tmp/work/ccimx6sbc-dey-linux-gnueabi/linux-dey/3.14-r0/defconfig: No such file 解决办法: 在DEY2.0需要在meta-digi/meta-digi-arm/recipes-kernel/linux/linux-dey_3.14.bb文件中添加SRC_URI,除了指定branch外,在结尾加上"... file://defconfig" ,即 SRC_URI = "git://github.com/peyoot/linux.git;branch=v3.14/dey-2.0/rtpreempt file://defconfig" 在DEY2.4这个就不需要了。\\ 继续在bitbake core-image-base时,会出现:\\ In file included from /home/robin/dey20-workspace/cc6sbc/tmp/work-shared/ccimx6sbc/kernel-source/include/linux/spinlock.h:291:0, from /home/robin/dey20-workspace/cc6sbc/tmp/work-shared/ccimx6sbc/kernel-source/include/linux/seqlock.h:35, from /home/robin/dey20-workspace/cc6sbc/tmp/work-shared/ccimx6sbc/kernel-source/include/linux/time.h:5, from /home/robin/dey20-workspace/cc6sbc/tmp/work-shared/ccimx6sbc/kernel-source/include/linux/stat.h:18, from /home/robin/dey20-workspace/cc6sbc/tmp/work-shared/ccimx6sbc/kernel-source/include/linux/module.h:10, from /home/robin/dey20-workspace/cc6sbc/tmp/work/ccimx6sbc-dey-linux-gnueabi/kernel-module-imx-gpu-viv/5.0.11.p7.4+fslc+gitAUTOINC+2b3290d1c1-r0/git/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/gc_hal_kernel_linux.h:61, from /home/robin/dey20-workspace/cc6sbc/tmp/work/ccimx6sbc-dey-linux-gnueabi/kernel-module-imx-gpu-viv/5.0.11.p7.4+fslc+gitAUTOINC+2b3290d1c1-r0/git/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/gc_hal_kernel_os.c:56: /home/robin/dey20-workspace/cc6sbc/tmp/work/ccimx6sbc-dey-linux-gnueabi/kernel-module-imx-gpu-viv/5.0.11.p7.4+fslc+gitAUTOINC+2b3290d1c1-r0/git/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/gc_hal_kernel_os.c:7422:21: <wrap hi>error: passing argument 1 of 'rt_spin_unlock' from incompatible pointer type [-Werror=incompatible-pointer-types]</wrap> spin_unlock_irq(&signal->obj.wait.lock); \\ 看到这个错误是和显卡驱动有关,应该是驱动源文件和实时内核一些宏定义有冲突,如果要从代码级解决,需要到相关出错的源码处去修复,考虑到实时系统一般不用图形界面,我先把这个驱动关了试试。到DEY源码内的meta-digi-arm/conf/machine/include/imx-digi-base.inc,把SOC_HAS_VIVANTE_KERNEL_DRIVER_SUPPORT_mx6q和SOC_HAS_VIVANTE_KERNEL_DRIVER_SUPPORT_mx6dl都设置为0,保存后再编译。 继续出错,把那个文件内的 MACHINE_SOCARCH_FILTER开头的两行注释掉,同时禁掉MACHINE_GSTREAMER_1_0开头的四行。也没有用。 这个错误查得是和上游freescale的驱动有关,所以不用禁驱动的方法,而是尝试是用已经支持RT Preempt的vivante驱动,在/source/meta-fsl-arm/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv_5.0.11.p7.4+fslc.bb 而在其内可以看到当前所用的版本,在对应的上游git源码版本中有更新的5.0.11.p8.6 ,应该尝试用这个来解决这个编译错误 其实我只想改这个gpu-viv内核驱动模块版本,但fsl官方我看到有rt版本的linux内核,也许可以尝试一下真接用 在meta-digi/meta-digi-arm/conf/machine/includes/digi-defaults.inc 中,改为PREFERRED_PROVIDER_virtual/kernel ??= "linux-fslc-imx-rt " 上面这个方法不行,回到原来的,哪里错改哪,从之前的log可以看出,我们用的是kernel-module-imx-gpu-viv/5.0.11.p7.4 想办法直接用已经打了rt的源码,并且在bb文件中把相关的patch取消 mv gpu-viv gpu-viv-linuxdey git clone -b upstream/5.0.11.p8.6 https://github.com/Freescale/kernel-module-imx-gpu-viv/ 此外,在dey目录中,用这个/meta-fsl-arm/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv_5.0.11.p8.4+fslc.bb (官网下载) 并在meta-digi/meta-digi-arm中把相关的bbappend和patch移除(假定更新的版本已经默认解决之前的patch问题) 不行,回退到5a0534c版本 git reset --hard 5a0534c git push -f -u origin v3.14/dey-2.0/rtpreempt 下个计划是手工修改gpu-viv驱动的相关地方: bitbake -c cleansstate linux-dey bitbake -c cleanall core-image-base bitbake core-image-base