移植linux2.6.32.23到tq2440步骤及问题
1.Makefile
183 arch?=arm
184 CROSS_COMPILE ?=arm-none-linux-gnueabi- (这个根据自身的交叉编译名字)
2.修改bootloader传送给kernel的参数
本次使用的是tq 编译好的u-boot1.1.6,根据其中的call_linux(0,machine_type,kernel_params_base), machine_type自然就是处理器类型,在uboot中输入bd命令可得:
EmbedSky> bd
arch_number = 0x000000A8
env_t = 0x00000000
boot_params = 0x30000100
DRAM bank = 0x00000000
-> start = 0x30000000
-> size = 0x04000000
ethaddr = 0A:1B:2C:3D:4E:5F
ip_addr = 192.168.1.6
baudrate = 115200 bps
arch_number=0x000000A8,根据这个要修改linux中的mach_number.具体在/arch/arm/tools的mach-type.c中,当然你要先在/arch/arm/mach-s322440.c确定自己处理器名字:
MACHINE_START(S3C2440, "SMDK2440")
# machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number
s3c2440 ARCH_S3C2440 S3C2440 168
然后make smdk2410_defconfig
make menuconfig
根据自己需要配置
make zImage
down到板子上。终端显示:
No filesystem could mount root, tried: ext3 ext2 cramfs vfat msdos iso9660 romfs
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,2)
[] (unwind_backtrace+0x0/0xdc) from [] (panic+0x40/0x118)
[] (panic+0x40/0x118) from [] (mount_block_root+0x1d0/0x210)
[] (mount_block_root+0x1d0/0x210) from [] (prepare_namespace+0x164/0x1bc)
[] (prepare_namespace+0x164/0x1bc) from [] (kernel_init+0xd8/0x10c)
[] (kernel_init+0xd8/0x10c) from [] (kernel_thread_exit+0x0/0x8)
原来是不支持yaffs,google一下http://www.lingzhong.cn/tech/19819.htm,问题跟我一样,那我就直接拿过来用了。下面链接也有介绍!!:
http://www.cnblogs.com/hnrainll/archive/2011/06/10/2077917.html
http://blog.chinaunix.net/uid-11220430-id-168814.html
csb@csb-ThinkPad-E430c:~/code/yaffs2$
csb@csb-ThinkPad-E430c:~/code/yaffs2$ ./patch-ker.sh c m ~/code/linux-2.6.32.23Updating /home/csb/code/linux-2.6.32.23/fs/Kconfig
Updating /home/csb/code/linux-2.6.32.23/fs/Makefile
make menuconfig 后就显示了
<*> yaffs2 file system support │ │
-*- 512 byte / page devices
save and exit
make zImage
download 到板子,问题2来了:
NET: Registered protocol family 17
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
yaffs: dev is 32505858 name is "mtdblock2" rw
yaffs: passed flags ""
VFS: Mounted root (yaffs filesystem) on device 31:2.
Freeing init memory: 140K
Warning: unable to open an initial console.
Failed to execute /linuxrc. Attempting defaults...
Kernel panic - not syncing: No init found. Try passing init= option to kernel.
[] (unwind_backtrace+0x0/0xdc) from [] (panic+0x40/0x118)
[] (panic+0x40/0x118) from [] (init_post+0xcc/0xf4)
[] (init_post+0xcc/0xf4) from [] (kernel_init+0xdc/0x10c)
[] (kernel_init+0xdc/0x10c) from [] (kernel_thread_exit+0x0/0x8)
修改分区
在/arch/arm/plat-s3c24xx/common-smdk.c
static struct mtd_partition smdk_default_nand_part[] = {
[0] = {
.name = "bootloader",
.size = 0x00060000,
.offset = 0,
},
[1] = {
.name = "kernel",
.offset = 0x00080000,
.size = 0x00400000,
},
[2] = {
.name = "yaffs2system",
.offset = 0x00480000,
.size = 0x0FB80000,
}
};
修改前
mtd: partition "Boot Agent" doesn't end on an erase block -- force read-only
0x000000000000-0x000000200000 : "S3C2410 flash partition 1"
0x000000400000-0x000000800000 : "S3C2410 flash partition 2"
0x000000800000-0x000000a00000 : "S3C2410 flash partition 3"
0x000000a00000-0x000000e00000 : "S3C2410 flash partition 4"
0x000000e00000-0x000001800000 : "S3C2410 flash partition 5"
0x000001800000-0x000003000000 : "S3C2410 flash partition 6"
0x000003000000-0x000004000000 : "S3C2410 flash partition 7"
修改后:
Creating 3 MTD partitions on "NAND 256MiB 3,3V 8-bit":
0x000000000000-0x000000060000 : "bootloader"
0x000000080000-0x000000480000 : "kernel"
0x000000480000-0x000010000000 : "yaffs2system"
启动ok:
[root@EmbedSky /]# ls
bin linuxrc root usr
dev lost+found sbin var
etc mnt sys web
home opt tmp
lib proc tq2440_serial0
但是液晶屏显示没有设置好,在/arch/arm/mach-s3c2440/mach-smdk2440.c中:
根据tq已经修改好的linux-2.6.30的lcd参数,直接cp一下:
.width = 480,
.height = 272,
.pixclock = 40000,
.xres = 480,
.yres = 272,
.bpp = 16,
.left_margin = 19,
.right_margin = 10,
.hsync_len = 30,
.upper_margin = 4,
.lower_margin = 2,
.vsync_len = 8,
显示还是不正常,那么只好自己动手调一条参数了。根据以前的lcd驱动
#define VBPD_240320 (2)
#define VFPD_240320 (4)
#define VSPW_240320 (8)
#define HBPD_240320 (10)
#define HFPD_240320 (19)
#define HSPW_240320 (30)
发现跟上面一样的。
参考:
http://blog.csdn.net/yangdelong/article/details/5521104
估计是linux的lcd driver不适用,相关文件在/driver/ideo/fbmen.c
23时30分37秒,睡觉了。。。。。