一、目前進展
1.Android已經可以通過NFS在FS2410開發板上運行
二、目前缺陷
1.觸控螢幕沒有校準
2.Android中時鐘停止,結束zygote進程,系統重啟,時鐘更新,但再次停止不動
3.串口無法與GPRS模組通訊
三、移植步驟
一、移植Android核心到FS2410開發板上
1、從http://code.google.com/p/android/downloads/list上下載linux-2.6.25-android-1.0_r1.tar.gz
2、將核心解壓到使用者目錄,如/home/wangan/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 = "Boot Agent",
.size = SZ_256K,
.offset = 0,
},
[1] = {
.name = "Linux Kernel",
.offset = SZ_256K,
.size = SZ_2M - SZ_256K,
},
[2] = {
.name = "File System",
.offset = SZ_2M,
.size = SZ_32M - SZ_2M,
},
[3] = {
.name = "Other",
.offset = SZ_32M,
.size = SZ_32M,
}
};
5、在http://www.codesourcery.com/gnu_toolchains/arm/portal/release644網站上下載IA32
GNU/Linux TAR。
6、將檔案解壓到使用者目錄,如/home/wangan/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-eabi-
11、從華清遠見Linux-2.6.8.1核心壓縮包中提取.config檔案(注意:config前面有個“.”)放入kernel.git檔案夾
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
(7) 其餘CONFIG選項,如系統支援請一併選擇
CONFIG_ANDROID_POWER =y
CONFIG_ANDROID_POWER_STAT =y
CONFIG_ANDROID_POWER_ALARM =y
(可以在Kconfig檔案中尋找ANDROID_POWER等欄位進行選擇,或者直接修改.config檔案)
13、退出並儲存.config
二、移植LCD驅動到Linux-2.6.25核心
1、 進入kernel.git檔案夾,如cd ~/kernel.git/
2、 修改arch/arm/mach-s3c2410/mach-smdk2410.c檔案,如gedit arch/arm/mach-s3c2410/mach-smdk2410.c
(1) 增加標頭檔#include <asm/arch/fb.h>
(2) 增加兩給結構體
static struct s3c2410fb_display smdk2410_lcd_cfg __initdata = {
.lcdcon5 = S3C2410_LCDCON5_FRM565 |
S3C2410_LCDCON5_INVVLINE |
S3C2410_LCDCON5_INVVFRAME |
S3C2410_LCDCON5_PWREN |
S3C2410_LCDCON5_HWSWP,
.type = S3C2410_LCDCON1_TFT,
.width = 320,
.height = 240,
.pixclock = 174757,
.xres = 320,
.yres = 240,
.bpp = 16,
.left_margin = 16,
.right_margin = 59,
.hsync_len = 9,
.upper_margin = 2,
.lower_margin = 6,
.vsync_len = 16,
};
static struct s3c2410fb_mach_info smdk2410_fb_info __initdata = {
.displays = &smdk2410_lcd_cfg,
.num_displays = 1,
.default_display = 0,
.gpccon = 0xaa955699,
.gpccon_mask = 0xffc003cc,
.gpcup = 0x0000ffff,
.gpcup_mask = 0xffffffff,
.gpdcon = 0xaa95aaa1,
.gpdcon_mask = 0xffc0fff0,
.gpdup = 0x0000faff,
.gpdup_mask = 0xffffffff,
.lpcsel = 0xf82,
};
(3) 在smdk2410_init()函數中增加s3c24xx_fb_set_platdata(&smdk2410_fb_info);
三、移植觸控螢幕驅動到Linux-2.6.25核心(參見《基於linux-2.26.5核心的FS2410開發板觸控螢幕驅動移植》)並製作zImage檔案,如make
這裡提一下,確保已經勾選Device Drivers ---> Input device support ---> <*> Event interface,本人曾經在這裡徘徊,感謝遊老師悉心教誨!
四、製作支援ARMv4的Android根檔案系統
1、從http://www.rayfile.com/files/d4660882-de04-11dd-af0d-0014221b798a/下載Android的ARMv4版本根檔案
2、在/dev下增加null和console兩個裝置節點
mknod -m 660 null c 1 3
mknod -m 660 console c 5 1
3、在U-boot中修改啟動參數init為/init,完整的命令列如:root=nfs nfsroot=169.254.7.118:/source/rootfs ip=169.254.7.119 console=ttySAC0,115200 init=/init
4、修改/init.rc檔案,去除除mount tmpfs tmpfs /sqlite_stmt_journals size=4m之外的所有mount命令
系統製作完成,現在應該可以看到漂亮的大表了。初次開機需要建立檔案,大約17分鐘。然後每次啟動只需要2分鐘。