Linux-2.6.32.24内核移植

2014-11-24 07:34:50 · 作者: · 浏览: 2

1. 准备工作
准备Linux内核源码,交叉编译工具链,一个可用的ramdisk文件系统等


2. 复制参考板的config文件到内核源码树的根目录
root@linuxidc:/source/kernel/linux-2.6.32.24# cp arch/arm/configs/s3c2410_defconfig .config



3. 修改Makefile,将目标平台改为您目标板的平台,使用交叉编译器
root@linuxidc:/source/kernel/linux-2.6.32.24# vim Makefile


进入后,找到


191 ARCH = $(SUBARCH)


192 CROSS_COMPILE = $(CONFIG_CROSS_COMPILE:"%"=%)


将其修改为


191 ARCH := arm


192 CROSS_COMPILE := arm-linux-


4. ramdisk文件系统1. 修改ramdisk文件系统的起始地址和大小
进入


root@linuxidc:/source/kernel/linux-2.6.32.24# vim arch/arm/mm/init.c


找到


34 static unsigned long phys_initrd_start __initdata = 0;


35 static unsigned long phys_initrd_size __initdata = 0;


改为


34 static unsigned long phys_initrd_start __initdata = 0x30800000;


35 static unsigned long phys_initrd_size __initdata = 0x1c00000;



2. 配置内核支持ramdisk作为启动文件系统
Device Drivers --->


SCSI device support --->


<*> SCSI device support


<*> SCSI disk support


Block devices --->


<*> RAM disk support


(1) Default number of RAM disks


(8192) Default RAM disk size (kbytes)


General setup --->


[*] Initial RAM filesystem and RAM disk (initramfs/initrd) support


5. make
root@linuxidc:/source/kernel/linux-2.6.32.24# make


6. 修改错误wrong_size_cmpxchg
提示错误:


kernel/built-in.o(.text+0x1bee8): In function `alloc_pid':


include/asm-generic/cmpxchg-local.h:42: undefined reference to `wrong_size_cmpxchg'


make: *** [.tmp_vmlinux1] Error 1


修正方法:


删除函数wrong_size_cmpxchg()的声明


删除整个函数__cmpxchg_local_generic()