准备工作:
Uboot
交叉编译工具 ,这个没什么说的,下载地址http://www.codesourcery.com/public/gnu_toolchain/arm-none-linux-gnueabi/arm-2008q3-72-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
kernel ,你得下载Android版本的(下载地址:http://android.googlecode.com/files/linux-2.6.25-android-1.0_r1.tar.gz ), 这与以前Linux的kernel还是有差异的,具体差异在哪,没研究过,不过从驱动方面看,差异不是很大。
根文件系统 ,自己也是初学乍道,自己还没尝试制作,只能暂用网上流传的 armv4,下载地址:http://attachments.hiapk.com/download//soft/armv4.tar.gz
开始工作:
1.Uboot制作,
用你原先Linux下的Uboot,只需要修改下启动参数主要是init=/init,我的详细配置信息:#define CONFIG_BOOTARGS "console=ttySAC0 root=/dev/nfs init=/init nfsroot=192.168.1.110:/tftpboot/root_nfs,rsize=1500,wsize=1500 ip=192.168.1.111:192.168.1.110:192.168.1.1:255.255.255.0:www.sansung.com:eth0:off"
2.kernel移植,
a.首先建个个文件夹mkdir /home/android,把上面下载的文件复制到这里,分别解压缩(tar xvf xxx),你会在当前目录看到以下三个文件夹:arm-2008q3, kernel.git, armv4.
b.进入kernel.git目录,Vim Makefile,修改
#ARCH ?= $(SUBARCH)
#CROSS_COMPILE ?= arm-eabi-
ARCH ?= arm
CROSS_COMPILE ?= arm-none-linux-gnueabi- 然后,设置编译环境,Vim build.env
#sh/bin
export PATH=$PATH:/home/android/arm-2008q3/bin
退出保存,运行:source build.env。只要关闭了此次Shell窗户,在编译kernel时都要运行的。 c.把你自己以前Linux下的.config文件copy过来,复制到kernel.git目录。
d.剩下主要是Android的配置的,具体的我也不清楚,照猫画虎,根据网上盛传的,
make menuconfig,进入配置界面,主要查看以下选项
选中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
尽量选中Android内核可选选项
Device Drivers ---> Android ---> [*] RAM buffer console
Device Drivers ---> Android ---> [*] Android timed gpio driver
Device Drivers ---> Android ---> [*] Only allow certain groups to create sockets e.为了能看到Android的UI,你必须移植LCD驱动,具体做法与Linux下相同,就此不做说明。
以上步骤完成,你便可以直接make uImage,中间可能会出现一些问题,每个人的情况可能不一样,在此无法列举,我的下文会列出我遇到的错误和解决方法。
3.根文件系统制作,
这里谈不上制作,因为直接下别人的,嘿嘿~~~,废话不说了,直接进入正题,cd armv4,你将看到三个文件夹,分别是data,root,system,其它三个是.img文件,可以忽略不要,分别把data,system文件夹 copy进root文件夹中,覆盖root里原先的data,system文件夹,这样便搞定了,但是,要记住把这个root文件下的内容全部复制到你 nfs挂载的目录下。
以上工作完成,在做点小动作:
a.在/dev下增加null和console两个设备节点
mknod null c 1 3
mknod console c 5 1 b.修改/init.rc文件,去除除mount tmpfs tmpfs /sqlite_stmt_journals size=4m之外的所有mount命令
c.最好改变下这个目录所有文件的权限,chmod -R 777 nfs_root
以上工作完成后,你便可以和当时在Linux下一样的方法,在2410平台下跑你的Android,不过要等待很久哦,第一次启动很慢,要建立很多 文件。
遇到的问题总结:
err1:
CC [M] drivers/net/b44.o
drivers/net/b44.c: In function 'b44_sync_dma_desc_for_device':
drivers/net/b44.c:151: error: implicit declaration of function'dma_sync_single_range_for_device'
drivers/net/b44.c: In function 'b44_sync_dma_desc_for_cpu':
drivers/net/b44.c:161: error: implicit declaration of function'dma_sync_single_range_for_cpu'
make[2]: *** [drivers/net/b44.o] 错误 1
make[1]: *** [drivers/net] 错误 2
make: *** [drivers] 错误 2解决方法:
发现这个貌似和蓝牙相关,但是暂时不用蓝牙,所以就先屏蔽了嘿嘿
#config B44
# tristate "Broadcom 440x/47xx ethernet support"
# depends on SSB_POSSIBLE
# select SSB
# select MII
# help
# If you have a network (Ethernet) controller of this type,say Y
# or M and read the Ethernet-HOWTO, available from
# <http://www.tldp.org/docs.html#howto >.
#
# To compile this driver as a module, choose M here. Themodule
# will be called b44. ====================================================================
err2:drivers/video/console/vgacon.c: In function 'vgacon_startup':
drivers/video/console/vgacon.c:494: error: 'PCIMEM_BASE' undeclared(first use in this function)
drivers/video/console/vgacon.c:494: error: (Each undeclaredidentifier is reported only once
drivers/video/console/vgacon.c:494: error: for each function itappears in.)
drivers/video/console/vgacon.c: In function 'vgacon_do_font_op':
drivers/video/console/vgacon.c:1052: error: 'PCIMEM_BASE' undeclared(first use in this function)
make[3]: *** [drivers/video/console/vgacon.o] 错误 1
make[2]: *** [drivers/video/console] 错误 2
make[1]: *** [drivers/video] 错误 2
make: *** [drivers] 错误 2解决方法:
device drivers->
Graphics support->
Console display driver support->
[ ]VGA text console====================================================================
err3MODPOST 694 modules
ERROR: "groups_search" [net/ipv6/ipv6.ko] undefined!
ERROR: "groups_search" [net/bluetooth/bluetooth.ko] undefined!
ERROR: "__bad_udelay" [drivers/isdn/hisax/hisax.ko] undefined!
ERROR: "ioport_map" [drivers/char/tpm/tpm_atmel.ko] undefined!
make[1]: *** [__modpost] 错误 1
make: *** [modules] 错误 2解决方法:
去掉一下配置
networking ->
networking options ->
<>the IPv6 protocol<>bluetooth subsystem support
device drivers ->
<>ISDN support
character devices ->
<>TMP Hardware support ->
===================================================================
err4fs2410> go 32000000
## Starting application at 0x32000000 ...
UncompressingLinux...............................................................
................................... done, booting the kernel.
死在这里了???但是开机LOGO还是现实了,就是没打印信息....无语啊~~~解决方法:
device drivers ->
character devices ->
serial driver ->
<*>samsung S3C2410/40/42/12 serial portsupport
<*>support for console on S3C2410 serrialport
====================================================================
err5init: Unable to open persistent property directory /data/property
errno: 2
解决方法:
在data目录下自己手动建立一个property文件夹====================================================================
err6
启动后,画面被缩小了1/4,分别在LCD的上部左右各显示一张,其下部为黑屏
解决方法:
原先LCD像素为24bit,改为16bit就搞定了