经过一个星期的不停修改错误,看代码,每天都忙到2点才睡,今天终于解决了所有问题,成功移植linux2.6.38内核到TQ2440。
移植步骤:
1.修改根目录的Makefile中的ARCH=arm,CROSS-COMPILE=arm-linux-
2.在arch/arm/mach-s3c2440/mach-smdk2440.c中,将163行的s3c24xx_init_clocks(16934400)改为s3c24xx_init_clocks(12000000)。
3.修改arch/arm/tools/mach-types中379行的362改为168,因为uboot中定义的机器码是168.
4.修改arch/arm/boot/中的Makefile文件,在58行添加@cp -f arch/arm/boot/zImage zImage.bin,实现把生成的zImage文件复制到内核源码根目录下。
5.在根目录的Makefile的1164行添加rm -f zImage.bin,使得在执行make distclean在清除产生的文件的同时,把内核根目录下的zImage也清除。
6.修改arch/arm/plat-s3c24xx/common-smdk.c中111行的static struct mtd_partition smdk_default_nand_part[]的nandflash分区为:
[0] = { .name = "Andy_uboot", .offset = 0x00000000, .size = 0x00040000, }, [1] = { .name = "Andy_kernel", .offset = 0x00200000, .size = 0x00200000, }, [2] = { .name = "Andy_yaffs2", .offset = 0x00400000, .size = 0x0FB80000, } 7.修改drivers/mtd/nand/s3c2410.c中的839行为chip->ecc.mode=NAND_ECC_NONE;
8.修改arch/arm/mach-s3c2440/mach-smdk2440.c中100行为.ulcon = 0x03。
9.在drivers/serial/samsung.c的51行添加
#include <mach/regs-gpio.h> #include <linux/gpio.h> 在433行添加: if (port->line == 2) { s3c2410_gpio_cfgpin(S3C2410_GPH(6), S3C2410_GPH6_TXD2); s3c2410_gpio_pullup(S3C2410_GPH(6), 1); s3c2410_gpio_cfgpin(S3C2410_GPH(7), S3C2410_GPH7_RXD2); s3c2410_gpio_pullup(S3C2410_GPH(7), 1); } 10.用git工具下载最新的yaffs2源代码。
具体为在终端输入git clone git://www.aleph1.co.uk/yaffs2下载最新的yaffs2,下
载完成给内核打补丁,进入yaffs目录,执行
./patch-kernel.sh c m opt/Andy/linux-2.6.38(以自己的内核目录为准),其中的c代表复制,m代表复合类型。 11.用make menuconfig配置linux内核。
12.执行make zImage,将生成的zImage.bin下载到TQ2440。
13.制作文件系统。
解压busybox-1.18.4.tar.bz2,修改busybox-1.18.4中的Makefile,在164行和190行分别修改为CROSS-COMPILE=arm-linux-和ARCH=arm。执行make,然后在执行make install。将生成_install复制到根目录,添加文件系统文件,用天嵌提供的mkyaffs2image生成root.bin的可执行文件,下载到开发板。
14.启动开发板,打印信息如下:
Start Linux ...
Copy linux kernel from 0x00200000 to 0x30008000, size = 0x00200000 ... Copy Kernel to SDRAM done,NOW, Booting Linux...... Uncompressing Linux... done, booting the kernel. Linux version 2.6.38-Andy () (gcc version 4.3.3 (Sourcery G++ Lite 2009q1-176) ) #15 Fri Apr 8 20:21:42 CST 2011 CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177 CPU: VIVT data cache, VIVT instruction cache Machine: Andy's TQ2440 development board!ATAG_INITRD is deprecated; please update your bootloader. Memory policy: ECC disabled, Data cache writeback CPU S3C2440A (id 0x32440001) S3C24XX Clocks, Copyright 2004 Simtec Electronics S3C244X: core 400.000 MHz, memory 100.000 MHz, peripheral 50.000 MHz CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256 Kernel command line: noinitrd root=/dev/mtdblock2 init=/linuxrc console=ttySAC0 PID hash table entries: 256 (order: -2, 1024 bytes) Dentry cache hash table entries: 8192 (order: 3, 32768 bytes) Inode-cache hash table entries: 4096 (order: 2, 16384 bytes) Memory: 64MB = 64MB total Memory: 60896k/60896k available, 4640k reserved, 0K highmem Virtual kernel memory layout: vector : 0xffff0000 - 0xffff1000 ( 4 kB) fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB) DMA : 0xffc00000 - 0xffe00000 ( 2 MB) vmalloc : 0xc4800000 - 0xf6000000 ( 792 MB) lowmem : 0xc0000000 - 0xc4000000 ( 64 MB) modules : 0xbf000000 - 0xc0000000 ( 16 MB) .init : 0xc0008000 - 0xc0025000 ( 116 kB)