AM335X 内核移植及问题解决

步骤

由于给我的内核版本是3.2.0,太低,我的ubuntu是18.04的,后续处理了很多版本不兼容问题

1、 解压源码

  tar -xvf linux-3.2-evb335x.tar.bz2

2、 指定源码顶目录下的编译工具链以及代码编译之后运行的架构平台

  197 ARCH        ?= arm
  198 CROSS_COMPILE   ?= arm-none-linux-gnueabi-

3、 清除内核源码的旧文件目标配置

make mrproper

4、 根据公板参考板生成自己的配置,.config文件表明了有那些代码将被编译到内核镜像中

   cp evb335x_demo_config .config      

一般生成自己的配置,是要执行make XXX_defconfig,就会在顶层目录生成.config文件,结果资料直接给了你一份,当然所厂商的配置文件都在这个路径下arch/arm/configs
在这里插入图片描述

5、 还可以选择通过图形化界面选配对应的驱动代码是否编译到镜像(y),是否编译成单独的模块(m),不编译到内核镜像中(n)

  make menuconfig

6、 编译内核镜像

 make uImage -j4

生成的镜像位置

在这里插入图片描述
uImage就是我们的内核镜像,可以直接烧录到板子中

问题总结

报错1:arm-linux-gnueabihf-gcc: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory

/home/linux/kernel/linux-3.2-evb335x/./Kbuild:35: recipe for target ‘kernel/bounds.s’ failed
make[1]: *** [kernel/bounds.s] Error 127
Makefile:987: recipe for target ‘prepare0’ failed
make: *** [prepare0] Error 2
解决方法:
sudo apt-get install lib32stdc++6

报错2:

Can’t use ‘defined(@array)’ (Maybe you should just omit the defined()?) at kernel/timeconst.pl line 373.主要是版本不兼容,高版本的linux编译低版本的内核源码。
解决方法:
修改文件vi kernel/timeconst.pl +373
373 #if (!defined(@val)) { //修改为
374 if (!(@val)) {

报错3:

include/linux/compiler-gcc.h:94:1: fatal error: linux/compiler-gcc7.h: No such file or directory
#include gcc_header(GNUC)
^~~~
compilation terminated.
/home/linux/kernel/linux-3.2-evb335x/./Kbuild:35: recipe for target ‘kernel/bounds.s’ failed
make[1]: *** [kernel/bounds.s] Error 1
Makefile:987: recipe for target ‘prepare0’ failed
make: *** [prepare0] Error 2
解决方法:编译器版本不兼容,发现对应的路径下没有compiler-gcc7.h,但是有compiler-gcc4.h和compiler-gcc.h,就将这两个文件拷贝一份,同时重命名为compiler-gcc7.h即可。
cp include/linux/compiler-gcc4.h include/linux/compiler-gcc7.h

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值