转自:http://hi.baidu.com/%D6%BE%C4%A6%C7%E9%CA%A5/blog/item/b36da3045a0dfc07738b651c.html
折腾了大半个月,终于看到ANDROID系统的桌面了。。修改系统所需要的资料全部都来自网上,我只是在这里做一个总结,由于之前没有接触过ARM,LINUX还算是了解,一上来就做这个系统移植还是相当痛苦的,废话就不多说了,进入正题。
内核的修改:
1.修改kernel下的Makefile:
ARCH ?=arm
CROSSS_COMPILE ?=arm-linux-
2.修改arch/arm/plat-s3c24xx/common-smdk.c
static struct mtd_partition smdk_default_nand_part[] = {
[0] = {
.name = "supervivi",
.size = 0x0006000,
.offset = 0,
},
[1] = {
.name = "Kernel"
.offset = 0x00060000,
.size = 0x00200000,
},
[2] = {
.name = "root"
.offse = 0x00260000,
.size = 1024 * 1024 * 1024,//64U * 1024 * 1024 - 0x00260000,
}
[3] = {
.name = "nand",
.offset = 0x00000000,
.size = 1024 * 1024 * 1024,//64U * 1024 * 1024 - 0x00260000,
}
3.修改drive/mtd/nand/s3c2410.c
在s3c2410_nand_init_chip里修改NAND_ECC_SOFT为NAND_ECC_NONE
4.修改arch/arm/mach-s3c2440/mach-smdk2440.c
statce void __init smdk2440_map_io(void)
{
s3c24xx_init_io(smdk2440_iodesc, ARRAY_SIZE(smdk2440_iodesc));
s3c24xx_init_clocks(12000000);
s3c24xx_init_uarts(smdk2440_uartcfgs, ARRAY_SIZE(smdk2440_uartcfgs));
}
5.拷贝s3c2410的默认配置目录到内核根目录下,简化配置过程
kernel# cp arch/arm/configs/s3c2410_defconfig .config
6.make menuconfig
(1).General setup --->
[*] Configure standard kernel features (for small systems) --->
(2).System Type ---->
[*] S3C2410 DMA support
[*] Support ARM920T processor
S3C2410 Machines --->
[*] SMDK2410/A9M2410
S3C2440 Machines --->
[*] SMDK2440
[*] SMDK2440 with S3C2440 CPU module
(3).File systems ---> Miscellaneous filesystems --->
<*> YAFFS2 file system support
-*- 512 byte / page devices
[ ] Use older-style on-NAND data format with pageStatus byte
[ ] Lets Yaffs do its own ECC
-*- 2048 byte (or larger) / page devices
[*] Autoselect yaffs2 format
[*] Disable lazy loading
[ ] Turn off wide tnodes
[ ] Force chunk erase check
[*] Cache short names in RAM
(4)
Device Drivers ---> Character devices ---> < > Goldfish TTY Driver
Device Drivers ---> Power supply class support ---> < > Goldfish battery driver (NEW)
Device Drivers ---> Real Time Clock ---> < > GOLDFISH (NEW)
Device Drivers ---> Graphics support ---> Support for frame buffer devices ---> < > Goldfish Framebuffer
(5)
Device Drivers ---> Graphics support ---> Support for frame buffer devices ---><*> S3C2410 LCD framebuffer support
Device Drivers ---> Graphics support ---> [*] Bootup logo ---> [*] Standard black and white Linux logo
Device Drivers ---> Graphics support ---> [*] Bootup logo ---> [*] Standard 16-color Linux logo
Device Drivers ---> Graphics support ---> [*] Bootup logo ---> [*] Standard 224-color Linux logo
(6)
Kernel Features ---> [*] Use the ARM EABI to compile the kernel
General setup ---> [*] Use full shmem filesystem
General setup ---> [*] Enable Android's Shared Memory Subsystem
System Type ---> [*] Support Thumb user binaries
Device Drivers ---> Android ---> [*] Android log driver
Device Drivers ---> Android ---> <*> Binder IPC Driver
(7)
Device Drivers ---> Android ---> [*] RAM buffer console
Device Drivers ---> Android ---> [*] Android timed gpio driver
Device Drivers ---> Android ---> [*] Only allow certain groups to create sockets
按照之前我的那篇博文的移植步骤移植ANDRIOD到板子上问题还是挺多的。。我在网络上找的步骤和我那个基本上一模一样,没什么区别,可是别人的问题就没有这么多,我的咋就这么多呢。。。可能是内核版本或者是板子有点区别吧
1.Error: unrecognized/unsupported machine ID (r1 = 0x000007cf)
当我把内核下载到板子上,启动内核的时候就出现了这个错误,无语了。。才开始入手ARM,现在连个头绪都没有。。还好有网络的帮忙,结果发现原来是我们S3C2440的MACHINE ID代号不对,具体是多少呢?
在arch/arm/tools/mach-types中找到s3c2440 ARCH_S3C2440 S3C2440 362,默认的MACHINE ID号就是362,可是运行内核的时候错误提示的MACHINE ID是0x000007cf,0x000007cf是十六进制数,转化成10进制数为1999,所以将之前默认的ID 362改成1999,问题就解决了。
2.LCD画面分成2半。。。。
内核编辑好了,我下了一个完好的文件系统,接下来的就是把内核还有文件系统下载到板子上,心情那叫一个激动啊。。把内核和文件系统下载到板子上后,启动系统。。终于看到画面了。。不过屏幕被分割成了像上图所显示的那样,2半。。我晕!!!在网上查资料貌似没有找到和我遇到相同问题的人,感觉走投无路了。。没办法,还是得找。。最后问题还是解决了。。
问题就出在arch/arm/mach-s3c2440/mach-smdk2440.c这个文件夹里,看到.pixclock .xres .yres这些参数没有?嘿嘿 这些就是关于屏幕位置的参数,不过这些参数是固定搭配的,不是说偏移一点,只要把其中的一个量改小或者改大就可以了,我用的是3.5寸的LCD
.pixclock = 10000
.xres = 240
.yres = 320
.bpp = 16
.leftmargin = 20
.rightmargin = 37
.hsync_len = 6
.upper-margin = 2
.lower = 6
.rsync = 2
.lpcsel = 0xf82
问题就解决了。。