移植2.6.15.4内核(转)
2007-07-12 16:32
在
http://www.kernel.org下载 2.6.15.4 的内核,
在[url]ftp://ftp.handhelds.org/projects/toolchain/arm-linux-gcc-3.4.1.tar.bz2[/url]下载交叉编译工具 修改Makefile 注释掉以下内容: #ARCH ?= $(SUBARCH) #CROSS_COMPILE ?= 增加如下内容: ARCH : = arm CROSS_COMPILE =/usr/local/arm/3.4.1/bin/arm-linux- 修改arch/arm/mach-s3c2410/devs.c文件 增加头文件定义 /***********add here***********/ #include <linux/mtd/partitions.h> #include <asm/arch/nand.h> #include <linux/mtd/nand.h> /**************end add********/ 增加nand flash分区信息 /*****************************add here***************************/ static int chip0_map[] = { 0 }; struct mtd_partition s3c_nand_part[] = { [0] = { .name = "vivi", .offset = 0x00000000, .size = 0x00020000, }, [1] = { .name = "param", .offset = 0x00020000, .size = 0x00010000, }, [2] = { .name = "kernel", .offset = 0x00030000, .size = 0x001d0000, }, [3] = { .name = "root", .offset = 0x00200000, .size = 0x03dfc000, } }; static struct s3c2410_nand_set s3c_nand_sets[] = { [0] = { .name = "chip0", .nr_chips = 1, .nr_map = chip0_map, .nr_partitions = ARRAY_SIZE(s3c_nand_part), .partitions = s3c_nand_part } }; static struct s3c2410_platform_nand s3c_nand_info = { .tacls = 0, .twrph0 = 30, .twrph1 = 0, .nr_sets = ARRAY_SIZE(s3c_nand_sets), .sets = s3c_nand_sets, }; /********************************end add****************************/ struct platform_device s3c_device_nand = { .name = "s3c2410-nand", .id = -1, .num_resources = ARRAY_SIZE(s3c_nand_resource), .resource = s3c_nand_resource, /***********add here****************/ .dev = { .platform_data = &s3c_nand_info } /**************end here************/ }; 可以交叉编译内核了 make mrproper //清楚所有config信息 make clean //清楚中间代码 make smdk2410_defconfig //使用默认2410配置 make menuconfig //配置 make 内核配置选择: 用NFS做根文件系统并配置网络: 主机上配置好NFS和DHCP服务 编译内核选择 Networking ---> [*] Networking support Networking options ---> [*] IP: kernel level autoconfiguration [*] IP: DHCP support [*] IP: BOOTP support 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 (EXPERIMENTAL) [*] Allow direct I/O on NFS files (EXPERIMENTAL) [ ] NFS server support [*] Root file system on NFS 网卡驱动: 在下面的网址下载sunshiyou做好的dm9000x.c驱动 http://www.hhcn.com/cgi-bin/topic.cgi?forum=3&topic=101&start=12&show=0 拷贝到drivers/net/arm目录下改名为dm9000.c 我这个开发板用的是EINT0,而2.6内核不能使用这个,所以把EINT0和EINT1焊到一起,驱动里面用的是EINT1。 修改drivers/net/arm/目录下的Kconfig文件,在最后添加如下内容: Config ARM_DM9000 tristate "DM9000 for ARM support" depends on NET_ETHERNET && ARM && ARCH_SMDK2410 help Support for CS8900A chipset based Ethernet cards. If you have a network (Ethernet) card of this type, say Y and read the Ethernet-HOWTO, available from as well as.To compile this driver as a module, choose M here and read.The module will be called cs8900.o. 修改drivers/net/arm/目录下的Makefile文件,在最后添加如下内容: obj-$(CONFIG_ARM_DM9000) += dm9000.o 编译内核选择: Device Drivers ---> Network device support ---> Ethernet (10 or 100Mbit) ---> [*] DM9000E suport for ARM linux_cmd_line 配置为 noinitrd root=/dev/nfs nfsroot=192.168.1.130:/mnt/arm nfsaddrs=192.168.1.160 init=/linuxrc console=ttySAC0 在/mnt/arm目录放一个可用的文件系统(我是用cramfs文件解开的) 目前为止网卡已经驱动,并可以挂载上NFSROOT了但内核启动到释放内存就不动了,也没有出错信息。 内核启动到释放内存就不动了: VFS: Mounted root (cramfs filesystem) readonly. Freeing init memory: 92K 对内核代码init/main.c进行跟踪: if (execute_command) { printk("***********0/n" ); run_init_process(execute_command); printk("***********2/n" ); printk(KERN_WARNING "Failed to execute %s. Attempting " "defaults.../n", execute_command); printk("***********3/n" ); } printk("***********4/n" ); run_init_process("/sbin/init"); run_init_process("/etc/init"); run_init_process("/bin/init"); run_init_process("/bin/sh"); printk("***********5 /n"); panic("No init found. Try passing init= option to kernel."); 屏幕打印: VFS: Mounted root (cramfs filesystem) readonly. Freeing init memory: 92K ***********0 linux_cmd_line 去掉init=/linuxrc项,屏幕打印: VFS: Mounted root (cramfs filesystem) readonly. Freeing init memory: 92K ***********4 说明run_init_process函数 有问题 在网上一个maillist里看到解决方法: Hi, Kulkarni, Ganapatrao P. IN BLR SISL wrote: [...] > I am trying to boot the kernel, its comes up and hangs at the end > (hangs after "Freeing init memory: 64K"), I am not getting the shell > on the minicom. > > Anybody faced such problem?? > Any solution/workaround ... Please If you have activated "FastFPE math emulation" im kernel config then try to use the "NWFPE math emulation" (section "General setup" in menuconfig). I had the same problem a few weeks ago and solved it on this way (FastFPE seems to be not implemented). [...] Regards, Wolfgang Schriebl 更改选项重新编译内核烧进板子重启: mount: Mounting none on /root failed: Invalid argument mount: Mounting none on /tmp failed: Invalid argument mount: Mounting none on /var failed: Invalid argument mkdir: Cannot create directory `/var/lib': Read-only file system mkdir: Cannot create directory `/var/run': Read-only file system mkdir: Cannot create directory `/var/log': Read-only file system Please press Enter to activate this console. BusyBox v1.00 (2006.01.11-14:20+0000) Built-in shell (ash) Enter 'help' for a list of built-in commands. -sh: can't access tty; job control turned off id: unknown uid 0 [@(none) /]# |