Android/Android&Kernel2009/04/15 14:57
출처 : Korea Android]
Compile Kernel with Android Patches Browse git 
1- Clone beagle kernel with android patches :-
    $git clone git://source.mvista.com/git/linux-omap-2.6-historic.git
    $cd linux-omap-2.6
    $git remote add labs.embinux git://labs.embinux.org/linux-omap-2.6
    $git remote update
    For 2.6.25 Kernel-
    $git checkout -b beagle.android labs.embinux/android
    For 2.6.27 Kernel-
    $git checkout -b beagle.android-2.6.27 labs.embinux/android-2.6.27
    $make ARCH=arm omap3_beagle_android_defconfig
    $make ARCH=arm CROSS_COMPILE=PATH_TO_CODE_SOURCERY_TOOL_CHAIN uImage

Compile Android Build 
1- Get Android build from  http://source.android.com/download
 Follow the instruction in above link to get source 

2- Apply tls & gl wrapper patch given below to Android build
TLS patch 
$cd  ~/android_build/bionic
$patch -p1 < ~/Tls.patch
 Tls.patch
GL_WRAPPER patch
$cd ~/android_build/frameworks/base
$patch -p1 < ~/Gl_wrapper.patch
 Gl_wrapper.patch

ALSA Support 
1- $cd ~
2- Clone alsa-lib from 
 $git clone git://android.git.kernel.org/platform/external/alsa-lib.git
3- Clone ALSA based libaudio
 $git clone git://android.git.kernel.org/platform/hardware/alsa_sound.git
4- Apply following patches to build

Alsa_sound patch
$cd ~/alsa_sound
$patch -p1 < ~/Alsa_sound-v1.1.patch
 Alsa_sound.patch
5-Change directory to the root "android_build"
 $ cd ~/android_build
6- Add ALSA audio support to the board config file and comment out generic audio support.
$vim ~/android_build/build/target/board/generic/BoardConfig.mk
add BOARD_USES_ALSA_AUDIO := true 
#BOARD_USES_GENERIC_AUDIO := true
7- Copy ALSA support supporting code from steps 3 and 4 above
$cd ~/android_build
$cp -a ~/alsa-lib  external
$cp -a ~/alsa_sound hardware
8-Compile build
$cd ~/android_build
$make

Root file System of Android 
After compilation of build, root file system of android is generated at ~/android_build/out/target/product/generic
$cd  ~/android_build/out/target/product/generic
$mkdir ~/Android_rfs
$cp -a root/* ~/Android_rfs
$cp -a data/* ~/Android_rfs/data/
$cp -a system/* ~/ Android_rfs/system/
Apply patch to init.rc 
$cd ~/Android_rfs
$patch -p1 <  ~/Initrc.patch
 Initrc.patch
Apply qwerty.kl patch 
Apply this patch Android_rfs/system/usr/keylayout/qwerty.kl

$cd ~/Android_rfs/system/usr/keylayout
$path -p1 < Qwerty.patch
 Qwerty.patch
Key mapping is as follows 
Keyboard Key      Android Event
ESC               Back
Right Window      Menu 
Page up           Volume up
Page down         Volume down 
Left Window       Power 
Scroll lock       Explorer 
Right arrow       DPAD
Left arrow        DPAD left 
Up arrow          DPAD up 
Down arrow        DPAD down
Enter             Enter 
Home              Home
Tab               Tab

Along with above keys alphabetical characters & Digit keys(above qwerty keyboard) are mapped.

Ownership 
Do the following as either root or use sudo
$cd ~/Android_rfs
$chown -R root.root *
$chmod -R 777 data system
Boot Arguments of Beagle 
console=ttyS2,115200n8 root=/dev/nfs rw nfsroot=192.168.1.5:/data/target
ip=192.168.1.1::255.255.255.0 nolock,rsize=1024,wsize=1024 rootdelay=2
video=omapfb:mode:1280x720@50 init=/init
Boot the kernel on board with Android_rfs on nfs 
Once board is up you will find following new dir in Android_rfs
  /sqlite_stmt_journals
  /sdcard
  soft link of /etc to /system/etc
  /data/dalvik-cache 
  /data/anr 
  /data/app-private 
  /data/property
  /data/local 
  /data/misc 
If Android GUI dosen't appear on screen 
Execute logcat command to get all logs of all application running on Dalvik VM
Check here all .apk files are getting converted to .dex file inside /data/dalvik-cache
Play mp3 on Android 
$copy song.mp3 on your SD card partition1(/dev/mmcblk0p1), before inserting card into beagleboard.
$mount -t vfat /dev/mmcblk0p1 /sdcard
$setprop EXTERNAL_STORAGE_STATE mounted
$am broadcast -a android.intent.action.MEDIA_MOUNTED --ez read-only false -d  file:///sdcard
Start Network 
1-Connect eth0 interface to usb hub via ethernet to usb converter
2-Modify init.rc
#basic network init
setprop net.dns1 <primary-dns-server-ip> 


3-boot up board

4-Execute following commands from minicom
$netcfg eth0 up
$netcfg eth0 dhcp
Watch Android booting on Beagle 



 
Posted by mirwing