2009年4月20日 星期一

Porting the atmel 9261EK uses linux-2.6.25 android kernel by eabi tool chain

首先 我先到Atmel for linux 網站去下載linux 2.6.25的kernel 和 patch
下載完後,至Android的網站下載android的kernel。

首先將9261的kernel做Patch
zcat 2.6.xx-at91.patch.gz | patch -p1
make ARCH=arm at91sam9261ek_defconfig
make ARCH=arm menuconfig

接著開啟另外一個終端機,進入android的kernel
先修改Makefile 指定ARCH=arm 和 CROSS Complier為 eabi的tool chain
然後 make menuconfig
接著照著 9261的kernel menuconfig去對照做config

Notice:
Frame buffer:

Device Drivers →
Graphics support →
<*> Support for frame buffer devices
[*] Enable Video Mode Handling Helpers
[*] Enable Tile Blitting Support
<*> AT91/AT32 LCD Controller support
[*] Frame Buffer in internal SRAM
Console display driver support →
<*> Frambuffer Console support
[*] Frambuffer Console Rotation
[*] Select compiled-in fonts
[*] VGA 8x8 font
[*] VGA 8x16 font
[*] Mac console 6x11 font (not supported by all dirvers)
[*] console 7x14 font (not supported by all drivers
[*] Pearl (old m68k) console 8x8 font
[*] Acorn console 8x8 font
[*] Mini 4x6 font
[*] Sparc console 8x16 font
[*] sparc console 12x12 font (not supported by all drivers)
[*] console 10x18 font (not supported by all drivers)
Logo configuration →
[*] Bootup logo
[*] Standard black and white Linux logo
[*] Standard 16-color Linux logo
[*] Standard 224-color Linux logo


接著丟到版子上面跑
可能出現下面error:
Error: unrecognized/unsupported machine ID (r1 = 0x*****)
解決的方法有兩種:

方法一
Linux Kernel 啟動時出現 bad machine ID,原因大致是u-boot傳遞給Kernel的machine ID 錯誤,所以我們可以用手動在Kernel Source Code 內添加 ID.

在9261中的 boot_params =PHYS_SRAM+0x100 而 PHYS_SRAM 又為0X20000000,
可以在U-BOOT的Source code 找到上面資訊
在 arch/arm/tools/mach-types可以找到 9261的machine ID為 848(十進制)

接著修改kernel的arch/arm/kernel/head.S,直接將ID 參數賦予給Kernel,
# vi arch/arm/kernel/head.S
----------------------------------------------
__INIT
.type stext, %function
ENTRY(stext)
/********* add here *********/
mov r0, #0
mov r1, #0x350 // machine ID 0x350 =848
ldr r2, =0x20000100 //
boot_params address
/********* end add *********/
msr cpsr_c, #PSR_F_BIT | PSR_I_BIT | SVC_MODE @ ensure svc mode
@ and irqs disabled


方法二
==================================================
修改u-boot,填寫ID


# vi common/cmd_boot.c
----------------------------------------------
31 #if defined(CONFIG_I386)
32 DECLARE_GLOBAL_DATA_PTR;
33 #endif
====>
31 //#if defined(CONFIG_I386)
32 DECLARE_GLOBAL_DATA_PTR;
33 //#endif
...
60 #if !defined(CONFIG_NIOS)
/************** add here ******************/
if(argc==2)
rc = ((ulong (*)(int, char *[]))addr) (0, gd->bd->bi_arch_number);
else

/*************** add end *****************/

61 rc = ((ulong (*)(int, char *[]))addr) (--argc, &argv[1]);
62 #else
63 /*
64 * Nios function pointers are address >> 1
65 */
66 rc = ((ulong (*)(int, char *[]))(addr>>1)) (--argc, &argv[1]);
67 #endif



沒有留言:

張貼留言