您的位置:首页 > 移动开发 > Android开发

TQ2440平台上Android移植(1)

2011-08-09 18:05 302 查看
在网上找了好多资料,不过关于TQ2440上移植Android的只有一份,全都是其他转载的:转载内容如下

1、移植Android内核到TQ2440开发板上
1、从http://code.google.com/p/android/downloads/list上下载linux-2.6.25-android-1.0_r1.tar.gz
2、将内核解压到用户目录,如/root/kernel.git
3、进入kernel.git文件夹,如cd ~/kernel.git/
4、修改arch/arm/plat-s3c24xx/common-smdk.c文件中的nand flash分区设置,如gedit arch/arm/plat-s3c24xx/common-smdk.c
修改static struct mtd_partition smdk_default_nand_part[]结构体为:
static struct mtd_partition smdk_default_nand_part[] = {
        [0] = {
                .name        = "TQ2440_uboot",
                .size        = 0x00040000,
                .offset        = 0x00000000,
        },
        [1] = {
                .name        = "TQ2440_kernel",
                .offset        = 0x0004C000,
                .size        = 0x00200000,
        },
        [2] = {
                .name        = "TQ2440_yaffs2",
                .offset        = 0x0024C000,
                .size        = 0x03DB0000,
        }
};
5、在http://www.codesourcery.com/gnu_toolchains/arm/portal/release644网站上下载IA32 GNU/Linux TAR。
6、将文件解压到用户目录,如/usr/local/arm/arm-2008q3
7、进入arm-2008q3/bin文件夹,如cd ~/arm-2008q3/bin/
8、添加当前路径进入环境变量,如export PATH=$PWD:$PATH,或修改~/.bashrc文件并重新登录
9、进入内核文件夹,如cd ~/kernel.git/
10、修改Makefile文件,如gedit Makefile
更改ARCH和CROSS_COMPILE
#ARCH                ?= $(SUBARCH)
ARCH                ?= arm
#CROSS_COMPILE        ?= arm-eabi-
CROSS_COMPILE        ?= arm-none-gnueabi-
11、使用make s3c2410_defconfig,默认配置2410内核
12、运行make menuconfig
(1) 确保System Type ---> ARM system type ()中的内容为Samsung S3C2410, S3C2412, S3C2413, S3C2440, S3C2442, S3C2443
(2) 确保System Type ---> S3C2410 Machines ---> 
SMDK2410/A9M2410被勾选
(3) 取消选择与Goldfish相关的内容
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
(4) 选择S3C2410 LCD相关的内容
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
(5) 选中Android内核必须选项
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
(6) 尽量选中Android内核可选选项
Device Drivers ---> Android ---> 
RAM buffer console
Device Drivers ---> Android ---> 
Android timed gpio driver
Device Drivers ---> Android ---> 
Only allow certain groups to create sockets


上面的我就不赘述了,下面是我遇到的问题:

首先根据TQ2440的参考手册

移植LCD驱动,不然没法显示啊,用的内核是2.6.25的和android的差不多,所以就按照这个修改了,这个问题倒不是很多。

移植DM9000E网卡驱动,这个移植过程中发现drivers/net/dm9000.c好像被修改过了,还有就是参考手册上面的,有个不知道具体位置,不过我就按照自己的思路来。

编译过程中,很多问题,都一个个的修改了,没有什么大的问题,就是不知道逻辑上有没有问题。

因为我要的是NFS挂载的,所以移植了网卡驱动,其他的我就不知道要先移植哪一个了,索性直接下载试试。

移植到板子上了,启动。。。

Copy linux kernel from 0x00200000 to 0x30008000, size = 0x00300000 ... Copy Kernel to SDRAM done,NOW, Booting Linux......
Uncompressing Linux..................................................................................................... done, booting the kernel.

Error: unrecognized/unsupported machine ID (r1 = 0x000000a8).

Available machine support:

ID (hex)        NAME
000000c1        SMDK2410

Please check your kernel config and/or bootloader.


瞧出错了,仔细网上查了下,是u-boot机器码和内核的机器码不同的原因。

两种解决方法

1修改内核机器码:arch/arm/tools/mach-types

379行的 362为内核机器码 修改为168

2修改u-boot机器码:u-boot-1.1.6/include/asm-arm/mach-types.h

377行的 168改为 362,

这里我修改了内核的,我感觉方便。

今天就到这里,至于上面的网卡驱动和LCD驱动,还没有验证。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: