Professional Documents
Culture Documents
Abs2011 Yaghmour Porting PDF
Abs2011 Yaghmour Porting PDF
A out ...
Author o!"
#ntroduced $inu% &race &oolkit in 1''' (riginated Adeos and relay!s )kernel*relay.c+
1. ,omponents to port 2. ,ross-de.elopment toolchain /. 0orting the ootloader 4. 0orting the $inu% kernel 1. 2e.eloping de.ice dri.ers 3. 4etting the A(S0 5. #mplementing Android hard6are li s 7. ,ustomi8ing the user-space '. Building the A(S0 10. ,omponents to 6rite to !lash 11. 9se!ul :m edded $inu% tricks
1. ,omponents to port
CPU Architecture
GNU toolchain bootloader Kernel Bionic OSS package !al"ik Hardware lib ; ; ; ; ; ; ; ; ;
CPU Model
;
Target Board
; ;
2. ,ross-de.elopment toolchain
Auto-generating a toolchain"
,09 support"
Board support"
=eCuirements Kernel Architecture Androidisms Dhich kernel to start !rom An intro to kernel source layout 9sing a E&A4 de ugger
4.1. =eCuirements
Kernel is loaded in =A< and run y ootloader Board schematics 0hysical memory map ,hip timings =ecei.ing proper oot parameters !rom ootloader
4./. Androidisms
4oogle"
http"**android.git.kernel.org* http"**666.kernel.org Android kernel is a !ork Ho resolution in sight Cannot use .anilla kernel as-is ... 6akelocks $earn ho6 to use Igit re aseJ
Fanilla"
arch*
2.4M 29M 1.4M 5.3M 4.9M 1.4M 856K 4.6M 8.0K 1.4M 5.7M 1.1M 1.2M alpha arm avr32 blackfin cris frv h8300 ia64 Kconfig m32r m68k m68knommu microblaze 11M 1.7M 2.4M 13M 2.4M 636K 5.4M 4.7M 1.9M 1.9M 8.5M 1.4M mips mn10300 parisc powerpc s390 score sh sparc tile um x86 xtensa
arch*arm"
136K 208K 676K 1.1M 252K 96K 1.2M 808K 748K 308K 12K 60K 788K 76K ... boot common configs include lib mach-aaec2000 mach-at91 mach-bcmring mm nwfpe oprofile plat-iop plat-mxc plat-nomadik
dri.ers*
accessibility acpi amba ata atm auxdisplay base block bluetooth cdrom char clocksource connector cpufreq cpuidle crypto dca dio dma edac eisa firewire firmware gpio gpu hid hwmon i2c ide idle ieee802154 infiniband input isdn Kconfig leds lguest macintosh Makefile mca md media memstick message mfd misc mmc mtd net nubus of oprofile parisc parport pci pcmcia platform pnp power pps ps3 rapidio regulator rtc s390 sbus scsi serial sfi sh sn spi ssb staging tc telephony thermal tty uio usb uwb vhost video virtio vlynq w1 watchdog xen zorro
include*
acpi asm-generic config crypto drm Kbuild keys linux math-emu media mtd net pcmcia rdma rxrpc scsi sound trace video xen
&ry grep Ba.e a look at the $inu% ,ross-=e!erencing proKect" 9=$" http"**l%r.linu%.no* ,ode" http"**l%r.source!orge.net* Ad.anced kernel searching*understanding" ,Scope" http"**cscope.source!orge.net* KScope !ront-end" http"**kscope.source!orge.net* :&A4S )emacs+
Bootloader :arly kernel code 2e.ice dri.ers A atron $auter ach 4reenBills So!t6are ...
:.erything in 9ni% is a !ileL including de.ices 4et a copy o! $inu% 2e.ice 2ri.ersL /rd ed. B&DL emulator kernel doesnGt allo6 modules M") 9se standard $inu% model A0# &ry a.oiding 6akelocks in dri.ers 9se modules !or de.elopment Build dri.ers in 6hen you ship =emem er" kernel is 40$L dri.ers are ... NNN &ry using user-space Idri.ersJ !or proprietary parts Android actually promotes use o! user-space hard6are li s
Ho e%plicit re!erences to o Kects !rom other space Ho process can directly access or alter other processesG memory areas. Ho process can access anything inside the kernel 0rocesses that attempt die )seg!ault+
,rossing et6een user space and kernel space is through speci!ic e.ents
&iming #nterrupt handling and de!erral <emory management *sysL hotplugL etc. $ocking mechanisms Bard6are access ...
http"**android.git.kernel.org*
Q curl http"**android.git.kernel.org*repo M P* in*repo Q chmod aR% P* in*repo
4et IrepoJ"
See the uild system doc at source.android.com ,heck out de.ice* in A(S0 ,heck out ,yanogenmod ,heck out %da-de.elopers
<anu!acturer-pro.ided li audio.so )could use A$SA underneath ... at least as illustrated in their porting guide+ <anu!acturer-pro.ided li camera.so )could use F4$2 kernel dri.er underneath ... as illustrated in porting guide+ IDakelocksJ kernel patch <anu!acturer-pro.ided li sensors.so
Boot screen Status ar Het6ork 0reloaded apps Bro6ser ookmarks :mail pro.ider customi8ation &hemes Adding ne6 applications Adding ne6 ser.ices * ne6 hard6are type #nit
7.2. Status ar
$ocation"
!rame6orks* ase*packages*System9#*src*com*android*systemui*status ar
$ook !or"
7./. Het6ork
$ocations"
4lo al static"
!rame6orks* ase*core*res*res*%ml*apns.%ml
0=(29,&>,(0Y>O#$:S "W .endor*acme*etc*apns-con!-us.%ml"system*etc*apns-con!.%ml
2e.ice static"
2ynamic"
system*etc*apns-con!.%ml
Oormat"
Tapn carrierWU&-<o ile 9SU mccWU/10U mncWU230U apnWU 6ap..oicestream.comU userWUnoneU ser.erWUAU pass6ordWUnoneU pro%yWU 213.111.131.10U portWU7070U mmscWUhttp"**213.111.154.74*ser.lets*mmsU *M
See uild*target*products
0=(29,&>0A,KA4:S "W X ouncycastle X com.android.location.pro.ider X com.android.location.pro.ider.%ml X core X core-Kunit X create>test>dmtrace X dal.ik.m X de%deps X ...
See packages*apps*Bro6ser*res*.alues*strings.%ml
TY-- Bookmarks --M Tstring-array nameWU ookmarksUM TitemM4oogleT*itemM TitemMhttp"**666.google.com*T*itemM TitemMYahooYT*itemM TitemMhttp"**666.yahoo.com*T*itemM TitemM<SHT*itemM TitemMhttp"**666.msn.com*T*itemM TitemM<ySpaceT*itemM TitemMhttp"**666.myspace.com*T*itemM ...
See packages*apps*:mail*res*%ml*pro.iders.%ml
TY-- 4mail .ariants --M Tpro.ider idWUgmailU la elWU4mailU domainWUgmail.comUM Tincoming uriWUimapRsslR"**imap.gmail.comU usernameWUQemailU*M Toutgoing uriWUsmtpRsslR"**smtp.gmail.comU usernameWUQemailU*M T*pro.iderM Tpro.ider idWUgooglemailU la elWU4oogle <ailU domainWUgooglemail.comUM Tincoming uriWUimapRsslR"**imap.googlemail.comU usernameWUQemailU*M Toutgoing uriWUsmtpRsslR"**smtp.googlemail.comU usernameWUQemailU*M T*pro.iderM ... TY-- ,ommon 9S pro.iders --M Tpro.ider idWUaimU la elWUA#<U domainWUaim.comUM Tincoming uriWUimap"**imap.aim.comU la elWU#<A0U usernameWUQemailU*M Toutgoing uriWUsmtp"**smtp.aim.com"175U usernameWUQemailU*M T*pro.iderM Tpro.ider idWUaolU la elWUA($U domainWUaol.comUM Tincoming uriWUimap"**imap.aol.comU la elWU#<A0U usernameWUQemailU*M Toutgoing uriWUsmtp"**smtp.aol.com"175U usernameWUQemailU*M T*pro.iderM ...
7.5. &hemes
Add application in packages*apps ,an use :clipse to create initial .ersion ,opy :clipse proKect to packages*apps Add an appropriate Android.mk !ile to proKect Add proKect to 0=(29,&>0A,KA4:S
!rame6orks* ase*ser.ices*Ka.a*com*android*ser.er*
Ba.e the SystemSer.er.Ka.a initRreg. your ser.ice 2e!ine hard6are A0# !or apps :%pose through"
!rame6orks* ase*core*Ka.a*android*os*?ser.er@.aidl
,all on nati.e Idri.erJ code through EH# #mplement or connect to appropriate dri.er ,reate an app that calls on ser.ice <ay need to create ne6 S2K ...
7.10. #nit
See IAndroid #nit $anguageJ doc in porting guide See init.rc e%amples"
4lo al IpropertiesJ that can e set and read ,an e used to t6eak lo6-memory conditions
=eCuires 34- it 9 untu 10.04 0ackages reCuired" Q sudo apt-get install ia/2-li s ison !le% gper! X M gRR li ia/2 li c3-de.-i/73 li 8-de. li stdcRR X M li stdcRR3 li stdcRR3-/2 ia/2-li stdcRR3 X M ia/2-li stdcRR ia/2-li stdcRR1 ia/2-li s X M li ncurses-de. li /2ncurses-de. X M ia/2-li ncurses-de. ia/2-li ncurses li /2ncurses X M li /2ncurses1-de. 0atch uild*core*droiddoc.mk
https"**groups.google.com*group*androiduilding* ro6se>thread*thread*7//a711'a0e1c13c
... though you should check your screen at reaks ... Eust launch emulator 6hen itGs done"
Q emulator Z
See uild*en.setup.sh !or commands 9se IlunchJ !rom A(S0 root to set en. .ars
YouGll need that i! you come ack later and 6ant to relaunch emulator !rom A(S0 root.
11.1. crosstool-ng
,ross-de.elopment toolchain generator Successor to crosstool A.aila le at" http"**ymorin.is-a-geek.org*proKects*crosstool 2o6nloadsL patchesL uildsL installsL etc. ,omprises #$ steps <enucon!ig- ased Supports u,li cL gli c and egli c Supports A=<L Black!inL <#0SL 0o6er0,L SBL [ Oairly 6ell maintained
11.2. Busy o%
color-coded !ile lists ta completion UhomeUL UendU grepL sedL 6cL moreL less .i i!con!ig httpd sendmail t!tp top ...
2o6nload BusyBo% )1.17./+ <o.e to the directory !or the rest o! the setup"
$ cd busybox-1.18.3
IBuild (ptionsJ -M I2o you 6ant to uild BusyBo% 6ith a ,ross ,ompilerNJ ,ross-compiler pre!i%" arm-unknown-linux-gnueabiInstallation Options -> I2onGt use *usrJ
Build"
$ make
#nstall"
$ make install
,heat sheet" ,ommands to get the ne6 Busy o% onto the root!s"
$ $ $ $ $ adb adb adb adb adb shell mount -o remount,rw rootfs / shell mkdir /bin push busybox /bin/ shell /bin/busybox --install /bin shell
11./. u,li c
(riginates !rom u,linu% e!!ort Support oth ,09s that ha.e and those that lack an <<9 and*or an O09. Allo6s oth static and dynamic linking <ost applications that uild 6ith gli c 6ill uild and 6ork the same 6ith u,li c. A.aila le !rom" http"**ucli c.org*
karim.yaghmour@opersys.com
666.opersys.com