博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
arm-linux-gcc4.4.3编译s3c2410平台linux内核
阅读量:7116 次
发布时间:2019-06-28

本文共 3800 字,大约阅读时间需要 12 分钟。

写在前面:2.6.14版本的内核用arm-linux-gcc4.4.3没有编译成功,下载2.6.37版本的内核用arm-linux-gcc4.4.3编译通过。

 

一、首先下载linux内核:

linux-2.6.14.tar.bz2 下载地址:

二、解压linux-2.6.14.tar.bz2:

tar -jxvf linux-2.6.14.tar.bz2

三、配置Makefile文件:

1、打开源码根目录下的Makefile文件:

gedit Makefile

修改Makefile文件:

ARCH            ?= arm

CROSS_COMPILE   ?= arm-linux-

2、查看目录结构:

ls -l linux-2.6.14/arch/arm/

drwxrwxr-x 4 mlx mlx  4096 Oct 28  2005 boot

drwxrwxr-x 2 mlx mlx  4096 Oct 28  2005 common
drwxrwxr-x 2 mlx mlx  4096 Oct 28  2005 configs
-rw-rw-r-- 1 mlx mlx 21221 Oct 28  2005 Kconfig
-rw-rw-r-- 1 mlx mlx  3845 Oct 28  2005 Kconfig.debug
drwxrwxr-x 2 mlx mlx  4096 Oct 28  2005 kernel
drwxrwxr-x 2 mlx mlx  4096 Oct 28  2005 lib
... ...
drwxrwxr-x 2 mlx mlx  4096 Oct 28  2005 mach-s3c2410
... ...

可以看到该内核支持s3c2410芯片。

3、查看芯片的默认配置文件:

ls -l linux-2.6.14/arch/arm/configs/

-rw-rw-r-- 1 mlx mlx 18719 Oct 28  2005 rpc_defconfig

-rw-rw-r-- 1 mlx mlx 20543 Oct 28  2005 s3c2410_defconfig
-rw-rw-r-- 1 mlx mlx 16901 Oct 28  2005 shannon_defconfig
-rw-rw-r-- 1 mlx mlx 21104 Oct 28  2005 shark_defconfig
-rw-rw-r-- 1 mlx mlx 18173 Oct 28  2005 simpad_defconfig
-rw-rw-r-- 1 mlx mlx 13382 Oct 28  2005 smdk2410_defconfig
-rw-rw-r-- 1 mlx mlx 28956 Oct 28  2005 spitz_defconfig
-rw-rw-r-- 1 mlx mlx 17936 Oct 28  2005 versatile_defconfig

四、编译内核:

1、拷贝配置文件:

cd linux-2.6.14

cp -f arch/arm/configs/s3c2410_defconfig .config

2、make menuconfig

make menuconfig出错

(1)、Makefile:450: *** mixed implicit and normal rules: deprecated syntax

(2)、make: *** No rule to make target 'menuconfig'.  Stop.

针对(1),是由于我的系统的make工具太新,make的旧版规则已经无法兼容新版。按照以下方式,问题得到解决:

 

在makefile中修改:

config %config: scripts_basic outputmakefile FORCE

改为:

%config: scripts_basic outputmakefile FORCE

 

修改/ %/: prepare scripts FORCE(错)

为:%/: prepare scripts FORCE(对)

如果正确不做修改

修改后继续make menuconfig,又出现错误:

You must install ncurses-devel in order

>> to use 'make menuconfig'

安装:

sudo apt-get install libncurses5-dev

安装完毕后再次执行make menuconfig即可运行

选择 Load an Alternate Configation File 回车

               选择.config

选择 save an Alternate Configation File 回车

        此处显示的是我们刚选择的defconfig文件路径,删除掉,改为linux 2.6.26 解压路径下的.config(XXXXXX/.config)

 

3、出现错误:arch/arm: Is a directory. Stop.

原因:ARCH            ?= arm这句话的arm后出现了空格

make zImage 开始编译,编译成功会生成zImage文件

 出错

arch/arm/mm/alignment.c: In function 'proc_alignment_write':

arch/arm/mm/alignment.c:119: error: read-only variable '__r2' used as 'asm' output
arch/arm/mm/alignment.c:119: error: read-only variable '__r2' used as 'asm' output
arch/arm/mm/alignment.c:119: error: read-only variable '__r2' used as 'asm' output
arch/arm/mm/alignment.c:119: error: read-only variable '__r2' used as 'asm' output
scripts/Makefile.build:193: recipe for target 'arch/arm/mm/alignment.o' failed
make[1]: *** [arch/arm/mm/alignment.o] Error 1
Makefile:784: recipe for target 'arch/arm/mm' failed
make: *** [arch/arm/mm] Error 2

网上说是因为arm-linux-gcc版本过高导致的,用3.4.1版本。

 

五、下载2.6.37内核,按照上面的方式重新make:

报错

Can't use 'defined(@array)' (Maybe you should just omit the defined()?) at kernel/timeconst.pl line 373.

/home/mlx/ArmLinux/linux-2.6.37/kernel/Makefile:139: recipe for target 'kernel/timeconst.h' failed
make[1]: *** [kernel/timeconst.h] Error 255
Makefile:914: recipe for target 'kernel' failed
make: *** [kernel] Error 2

解决:将kernel/timeconst.pl中第373行的defined()去掉只留下@val就可以了

继续make,报错:

drivers/leds/leds-h1940.c: In function 'h1940_greenled_set':

drivers/leds/leds-h1940.c:33: error: implicit declaration of function 'h1940_latch_control'
scripts/Makefile.build:250: recipe for target 'drivers/leds/leds-h1940.o' failed
make[2]: *** [drivers/leds/leds-h1940.o] Error 1
scripts/Makefile.build:380: recipe for target 'drivers/leds' failed
make[1]: *** [drivers/leds] Error 2
Makefile:914: recipe for target 'drivers' failed
make: *** [drivers] Error 2

直接把h1940_latch_control()函数注销掉,具体修解决方法还不知道。

继续make,完成后生成了vmlinux。

转载于:https://www.cnblogs.com/softhal/p/5699840.html

你可能感兴趣的文章
深入理解asp.net里的HttpModule机制
查看>>
java基础学习_常用类03_StringBuffer类、数组高级和Arrays类、Integer类和Character类_day13总结...
查看>>
Asp.net MVC Session过期异常的处理
查看>>
python ThreadPoolExecutor线程池使用
查看>>
IPTABLES 规则(Rules)
查看>>
关于URL编码
查看>>
深度学习的可解释性研究(一):让模型「说人话」
查看>>
QT5提示can not find -lGL的解决方法
查看>>
Silverlight/Windows8/WPF/WP7/HTML5周学习导读(9月17日-9月23日)
查看>>
Tap-Ahead:让移动搜索更加便捷的解决之道
查看>>
Windows Server2016 Hyper-v Cluster部署
查看>>
juniper路由器配置
查看>>
jQuery一点一滴系列教程(第三点)
查看>>
ARP解决方法/工具 真假ARP防范区别方法 ARP终极解决方案
查看>>
系统数据权限的实现方案
查看>>
华为vlan划分,单臂路由以及静态路由
查看>>
UCD 2010百度工作坊
查看>>
ssh2免密码登录
查看>>
4_move_find_into_model
查看>>
MySQL · 捉虫动态 · UK 包含 NULL 值备库延迟分析
查看>>