七,为SAM9260编译ARM-LINUX内核
0赞
1,传送文件包到LINUX系统并解压
利用SecureCRT 5.1.3登陆,传送文件到系统
root@yuanxh-desktop:/home/yuanxh# cd at91_works/
root@yuanxh-desktop:/home/yuanxh/at91_works# rz
在SecureCRT弹出的窗口中选择2.6.23-at91.patch.gz和linux-2.6.23.tar.bz2包;
2,解压内核及打上补丁包
root@yuanxh-desktop:/home/yuanxh/at91_works# tar xjvf linux-2.6.23.tar.bz2
root@yuanxh-desktop:/home/yuanxh/at91_works# gzip -d 2.6.23-at91.patch.gz
root@yuanxh-desktop:/home/yuanxh/at91_works# cd linux-2.6.23
root@yuanxh-desktop:/home/yuanxh/at91_works/linux-2.6.23# patch -p1 < ../2.6.23-at91.patch
3,为内核指定编译器
root@yuanxh-desktop:/home/yuanxh/at91_works/linux-2.6.23# vi Makefile
把 EXTRAVERSION = -9gsam9260ek 写上自己版本标识,指定体系结构和编译器
ARCH ?= arm
CROSS_COMPILE ?= /usr/local/arm/eldk-4.1/usr/bin/arm-linux-
添加可加载模块安装路径
INSTALL_MOD_PATH = $(TOPDIR)/modules-$(KERNELRELEASE)
4,编译内核及发布目标码
A,查看内核支持的开发板
root@yuanxh-desktop:/home/yuanxh/at91_works/linux-2.6.23# make ARCH=arm CROSS_COMPILE=arm-linux- help
B,配置为AT91RM9260EK板默认设置
root@yuanxh-desktop:/home/yuanxh/at91_works/linux-2.6.23# make ARCH=arm CROSS_COMPILE=arm-linux- at91sam9260ek_defconfig
C,编译生成全部目标码
root@yuanxh-desktop:/home/yuanxh/at91_works/linux-2.6.23# make ARCH=arm CROSS_COMPILE=arm-linux-
D,也可分步依次生成zImage,可加载modules和安装可加载模拟到默认目录
root@yuanxh-desktop:/home/yuanxh/at91_works/linux-2.6.23# make ARCH=arm CROSS_COMPILE=arm-linux- zImage
root@yuanxh-desktop:/home/yuanxh/at91_works/linux-2.6.23# make ARCH=arm CROSS_COMPILE=arm-linux- modules
root@yuanxh-desktop:/home/yuanxh/at91_works/linux-2.6.23# make ARCH=arm CROSS_COMPILE=arm-linux- modules_install
E,发送内核目标码和可加载模块
root@yuanxh-desktop:/home/yuanxh/at91_works/linux-2.6.23# cp arch/arm/boot/zImage .
root@yuanxh-desktop:/home/yuanxh/at91_works/linux-2.6.23# mv zImage zImage-2.6.23-9gsam9260ek.bin
root@yuanxh-desktop:/home/yuanxh/at91_works/linux-2.6.23# sz zImage-2.6.23-9gsam9260ek.bin
root@yuanxh-desktop:/home/yuanxh/at91_works/linux-2.6.23# tar czvf modules-2.6.23-9gsam9260ek.tar.gz modules-2.6.23-9gsam9260ek/
root@yuanxh-desktop:/home/yuanxh/at91_works/linux-2.6.23# sz modules-2.6.23-9gsam9260ek.tar.gz
F,个性化配置内核
root@yuanxh-desktop:/home/yuanxh/at91_works/linux-2.6.23# make ARCH=arm CROSS_COMPILE=arm-linux- menuconfig
.config中内核启动命令行参数CONFIG_CMDLINE改为:
mem=64M console=ttyS0,115200 initrd=0x21100000,8388608 root=/dev/ram0 rw init=/linuxrc
G,编译生成U-BOOT可识别目标码uImage
root@yuanxh-desktop:/home/yuanxh/at91_works/linux-2.6.23# make ARCH=arm CROSS_COMPILE=arm-linux- uImage
root@yuanxh-desktop:/home/yuanxh/at91_works/linux-2.6.23# cp arch/arm/boot/uImage .
root@yuanxh-desktop:/home/yuanxh/at91_works/linux-2.6.23# mv uImage uImage-2.6.23-9gsam9260ek.bin
root@yuanxh-desktop:/home/yuanxh/at91_works/linux-2.6.23# sz uImage-2.6.23-9gsam9260ek.bin
5,清除内核目标码恢复未配置状态
root@yuanxh-desktop:/home/yuanxh/at91_works/linux-2.6.23# make ARCH=arm CROSS_COMPILE=arm-linux- clean
root@yuanxh-desktop:/home/yuanxh/at91_works/linux-2.6.23# make ARCH=arm CROSS_COMPILE=arm-linux- distclean
root@yuanxh-desktop:/home/yuanxh/at91_works/linux-2.6.23# make ARCH=arm CROSS_COMPILE=arm-linux- mrproper
