一、移植前说明
交叉编译器版本为arm-linux-gcc 3.4.5,目标板为GEC2410,NAND FLASH 64M,SDRAM为64M。在网站 可以下到最新的linux版本,解压之。
二、移植步骤
1、修改内核根目录下的Makefile文件
$pwd
/home/yuaf/linux-2.6.26
$vi Makefile
找到
export KBUILD_BUILDHOST := $(SUBARCH)
ARCH ?= $(SUBARCH)
CROSS_COMPILE ?=
将它修改为
ARCH ?= arm
CROSS_COMPILE ?= arm-linux-
注:我的编译器路径解压在 /usr/local/arm/ 目录下,修改环境变量/etc/environment,把自己的bin文件路径添加在此文件里,就行啦!就可以在任何一个地方直接使用arm-linux-gcc来进行编译啦!如:
$pwd
/etc
$more environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/arm/gcc-3.4.5-glibc-2.3.6/bin"
LANGUAGE="zh_CN:zh:en_US:en"
LANG="zh_CN.UTF-8"
2.修改arch/arm/plat-s3c24xx/common-smdk.c文件,修改NAND FLASH的分区信息
$vi common-smdk.c
在smdk_default_nand_part[]中进行如下修改:
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, } #else [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, }, #endif };
|
3、配置内核
在配置内核前,可以拷贝s3c2410默认的配置文件到内核源代码根目录下,以简化配置过程。
$cp arch/arm/configs/s3c2410_defconfig .config
$make menuconfig
再在此基础上配置一些选项,其具体的每项代表什么意思,可以参照如下网址,有比较详细的介绍。
General setup --->
[*] Configure standard kernel features(for small systems)
System Type ---->
S3C2410 Machines --->
[*] SMKD2410/A9M2410
其余在此目录的全部按“N”。
而S3C2400 Machines、S3C2412 Machines、S3C2440 Machines、S3C2442 Machines、S3C2443 Machines全部选择 “N”。
Boot options --->
将 (root=/dev/hda1 ro init=/bin/bash console=ttySAC0) Default kernel command string
改成 (console=ttySAC0 root=/dev/nfs init=/linuxrc nfsroot=192.168.0.50:/home/yuaf/root_nfs ip=192.168.0.100:192.168.0.50:192.168.0.1:255.255.255.0:) Default kernel command string
也就是网络启动nfs文件系统的命令。init=/linuxrc,很重要!!!
Networking --->
Networking options --->
<*> Packet socket
[*] Packet socket:mapped IO
File systems --->
[*] Network File Systems --->
<*> NFS file system support
[*] Provide NFSv3 client support
[*] provide client support for the NFSv3 ACL protocol extension
[*] provide NfSv4 client support
<*> NFS server support
[*] NFS server support for the NFSv3 ACL protocol extension
[*] Root file system on NFS
[*] support for rpcbind version 3 & 4
保存退出。
4.编译内核
$make
就可以在 arch/arm/boot 目录下生成 zImage文件啦。
下一步就是通过TFTP下载内核到SDRAM,运行之。
阅读(1213) | 评论(0) | 转发(0) |