(一)编译内核
1、修改Makefile
book@ubuntu:~$ cd linux-3.5/
diff -urN linux-3.5/Makefile linux-3.5_s3c2440/Makefile
--- linux-3.5/Makefile 2012-07-22 04:58:29.000000000 +0800
+++ linux-3.5_s3c2440/Makefile 2018-06-18 15:26:04.857250091 +0800
@@ -192,8 +192,8 @@
# Default value for CROSS_COMPILE is not to prefix executables
# Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile
export KBUILD_BUILDHOST := $(SUBARCH)
-ARCH ?= $(SUBARCH)
-CROSS_COMPILE ?= $(CONFIG_CROSS_COMPILE:"%"=%)
+ARCH ?= arm
+CROSS_COMPILE ?= arm-linux-
# Architecture as present in compile.h
UTS_MACHINE := $(ARCH)
2、查看默认配置文件
book@ubuntu:~/linux-3.5$ ls -l arch/arm/configs | grep "s3c*"
-rw-rw-r-- 1 david david 1829 7月 22 2012 cns3420vb_defconfig
-rw-rw-r-- 1 david david 11286 7月 22 2012 s3c2410_defconfig
-rw-rw-r-- 1 david david 2134 7月 22 2012 s3c6400_defconfig
book@ubuntu:~/linux-3.5$ cp arch/arm/configs/s3c2410_defconfig arch/arm/configs/s3c2440_defconfig
3、尝试编译内核
book@ubuntu:~/linux-3.5$ make s3c2440_defconfig
book@ubuntu:~/linux-3.5$ make uImage
...
Can't use 'defined(@array)' (Maybe you should just omit the defined()?) at kernel/timeconst.pl line 373.
/work/s3c2440/source/linux-3.5_s3c2440/kernel/Makefile:133: recipe for target 'kernel/timeconst.h' failed
make[1]: *** [kernel/timeconst.h] Error 255
Makefile:775: recipe for target 'kernel' failed
make: *** [kernel] Error 2
4、修改kernel/timeconst.pl
diff -urN linux-3.5/kernel/timeconst.pl linux-3.5_s3c2440/kernel/timeconst.pl
--- linux-3.5/kernel/timeconst.pl 2012-07-22 04:58:29.000000000 +0800
+++ linux-3.5_s3c2440/kernel/timeconst.pl 2018-06-18 15:43:05.479306091 +0800
@@ -370,7 +370,7 @@
}
@val = @{$canned_values{$hz}};
- if (!defined(@val)) {
+ if (!@val) {
@val = compute_values($hz);
}
output($hz, @val);
5、再次编译内核
book@ubuntu:~/linux-3.5$ make uImage
...
"mkimage" command not found - U-Boot images will not be built
/work/s3c2440/source/linux-3.5_s3c2440/arch/arm/boot/Makefile:89: recipe for target 'arch/arm/boot/uImage' failed
make[1]: *** [arch/arm/boot/uImage] Error 1
/work/s3c2440/source/linux-3.5_s3c2440/arch/arm/Makefile:277: recipe for target 'uImage' failed
make: *** [uImage] Error 2
book@ubuntu:~/linux-3.5$ sudo apt-get install u-boot-tools
book@ubuntu:~/linux-3.5$ sudo apt-get install uboot-mkimage
book@ubuntu:~/linux-3.5$ make uImage
6、尝试用新内核启动
book@ubuntu:~/linux-3.5$ sudo gedit /etc/exports
增加一行/work/s3c2440/nfs/ *(rw,sync,no_subtree_check,no_root_squash)
book@ubuntu:~/linux-3.5$ sudo service nfs-kernel-server restart
Nand中MTD分区表
启动内核失败,下一节我们开始修改mtd分区