裁剪内核
由于之前划分的MTD里的kernel分区只有2M空间,此时我们的内核有2.35MB,所以需要对内核裁剪到小于2MB大小(当然也可以直接修改MTD分区)。查看linux-3.4.2/.config文件,执行make menuconfig命令去掉想要裁剪的内容:
System Type->
SAMSUNG S3C24XX SoCs Support->
[ ] SAMSUNG S3C2410
[ ] SAMSUNG S3C2412
[ ] SAMSUNG S3C2416/S3C2450
[ ] SAMSUNG S3 C2442
[ ] SAMSUNG S3C2443
[ ] Simtec Electronics ANUBIS
[ ] Avantech AT2440EVB development board
[ ] NexVision NEXCODER 2440 Light Board
[ ] Simtec IM2440D20 (OSIRIS) module
[ ] HP iPAQ rx3715
File systems --->
< > Second extended fs support
< > Ext3 journalling file system support
CD-ROM/DVD Filesystems --->
< > ISO 9660 CDROM file system support
DOS/FAT/NT Filesystems --->
< > MSDOS fs support
< > VFAT (Windows-95) fs support
[*] Miscellaneous filesystems --->
< > Compressed ROM file system support (cramfs)
[ ] Include support for ZLIB compressed file systems
< > ROM file system support
Device Drivers --->
SCSI device support --->
< > SCSI device support
Input device support --->
[ ] Provide legacy /dev/psaux device
[ ] Mice --->
[ ] Keyboards --->
[ ] Joysticks/Gamepads --->
[*] Touchscreens --->
<*> Samsung S3C2410/generic touchscreen input driver
< > USB Touchscreen Driver
<*> Sound card support --->
<*> Advanced Linux Sound Architecture --->
[ ] USB sound devices --->
Multifunction device drivers --->
< > Support for Silicon Motion SM501
< > Support for NXP PCF50633
[*] USB support --->
[ ] USB device filesystem (DEPRECATED)
[ ] The shared table of common (or usual) storage devices
< > USB Serial Converter support --->
重新编译内核如下:
可以看到内核已经裁剪到小于2MB大小了,可以直接将uImage直接烧写到NAND Flash里的kernel分区去,在uboot命令行输入如下命令:
tftp 30000000 uImage (下载内核到30000000地址)
nand erase.part kernel (擦除kernel分区)
nand write 30000000 kernel (将内核写入kernel分区)
制作补丁
在linux-3.4.2根目录执行如下命令:
cp .config config_ok (保存内核配置文件)
make distclean
cd ..
mv linux-3.4.2 linux-3.4.2_jz2440
tar xjf linux-3.4.2.tar.bz2
diff -urN linux-3.4.2 linux-3.4.2_jz2440 > linux-3.4.2_jz2440.patch
这样就制作好了linux-3.4.2内核的补丁文件linux-3.4.2_jz2440.patch,使用补丁方法如下:
1. 获取linux-3.4.2源码并解压
2. 将linux-3.4.2_jz2440.patch与linux-3.4.2放在同一个目录
3. 进入linux-3.4.2根目录执行“patch -p1 < ../linux-3.4.2_jz2440.patch”
4. 将config_ok另存为配置文件.config,执行“cp config_ok .config”
5. 执行“make uImage”编译生成uImage