1.下载linux kernel源代码
到http://www.kernel.org/下载linux内核源代码,这里我们使用2.6.24.4的内核.
解压linux-2.6.24.4.tar.bz2
[matt@localhost GEC2410]$ tar -xvjf linux-2.6.24.4.tar.bz2
[matt@localhost GEC2410]$ cd linux-2.6.24.4
2.修改Makefile,设置交叉编译器
ARCH ?= arm
CROSS_COMPILE ?= /home/GEC2410/toolchain/arm-softfloat-linux-gnu/bin/arm-softfloat-linux-gnu-
3.设置Nand分区
修改arch/arm/plat-s3c24xx/common-smdk.c中108行的smdk_default_nand_part[]如下:
[matt@localhost linux-2.6.24.4]$ vim arch/arm/plat-s3c24xx/common-smdk.c
static struct mtd_partition smdk_default_nand_part[] = {
#if 0
[0] = {
.name = "Boot Agent",
.size = SZ_16K,
.offset = 0,
},
[1] = {
.name = "S3C2410 flash partition 1",
.offset = 0,
.size = SZ_2M,
},
[2] = {
.name = "S3C2410 flash partition 2",
.offset = SZ_4M,
.size = SZ_4M,
},
[3] = {
.name = "S3C2410 flash partition 3",
.offset = SZ_8M,
.size = SZ_2M,
},
[4] = {
.name = "S3C2410 flash partition 4",
.offset = SZ_1M * 10,
.size = SZ_4M,
},
[5] = {
.name = "S3C2410 flash partition 5",
.offset = SZ_1M * 14,
.size = SZ_1M * 10,
},
[6] = {
.name = "S3C2410 flash partition 6",
.offset = SZ_1M * 24,
.size = SZ_1M * 24,
},
[7] = {
.name = "S3C2410 flash partition 7",
.offset = SZ_1M * 48,
.size = SZ_16M,
}
#endif
[0] = {
.name = "U-Boot",
.size = SZ_1M,
.offset = 0,
},
[1] = {
.name = "Linux Kernel",
.offset = SZ_1M,
.size = SZ_1M*3,
},
[2] = {
.name = "Root",
.offset = SZ_4M,
.size = SZ_4M*10,
},
[3] = {
.name = "User",
.offset = SZ_4M*11,
.size = SZ_4M*5,
}
};
4 配置内核
4.1 支持启动时挂载devfs
为了我们的内核支持devfs以及在启动时并在/sbin/init运行之前能自动挂载/dev为devfs文件系统,修改fs/Kconfig文件
vi fs/Kconfig
找到menu "Pseudo filesystems"
添加如下语句:
config DEVFS_FS
bool "/dev file system support (OBSOLETE)"
default y
config DEVFS_MOUNT
bool "Au