Sunteți pe pagina 1din 8

PortingofAndroidOnBeagleboard.

1.Overview 2.Hardwarerequirement. 3.Softwarerequirement. 4.Beagleboard. 5.Setup. 6.BuildingKernelImage. 7.BuildingAndroidFilesystem. 8.BuildingLinuxfilesystemwithAndroidfilesystem. 9.SettingUpTheBootParametersandBootingtheLinuxkernel 10.Scriptfiletostartandroidservices. 11.FlashingtheNAND 12.Testing. 1.Overview Android is a software stack for mobile devices that includes an operating system, middleware and key applications. To learn more about android check the below link http://developer.android.com/guide/basics/whatisandroid.html. Android stack usesLinux2.6kernel.SincethisprojectisportingAndroidonBeagleboard,the linux2.6 kernel added a full support for Beagle board and its peripherals and androidspecificsubsystems. 2.Hardwarerequirement 1.BeagleBoardRevB6. 2.NullModemSerialCable. 3.Svideocable. 4.MiniBtoAUSBcable. 5.SD/MMCcard. 6.SD/MMCcardReader. 7.MonitorwithSvideosupport.(OrTVtunercardwithSvideosupport). 3.Softwarerequirement 1.Linuxkernel2.6.22.18TIomap3(2.6_kernel_revbv2.tar.gz Beagleboardbased). 2.AndroidPatchPatchingabovekerneltogetandroidspecificsupports. 3.LinuxFileSystemramdiskimage(ALSAFS). 4.Androidfilesystem.Extractedformemulatordiscussedbelow. 5.ArmToolchaincrosscompiler(arm2007q351armnonelinux gnueabii686pclinuxgnu.tar.bz2). 6.Scriptfiletostartandroidservices.

4.BeagleBoard

BeagleBoard,alowcostOMAP3530basedboard.POP(PackageonPackage)isa techniquewherethememory,NANDandSDRAM,aremountedontopoftheOMAP3530.The differentperipheralsupportthefollowing

oMicroprocessorunit(MPU)subsystembasedontheARMCortexA8processor. oPOPMemoryinterface o1GbMDDR(128Mbytes) o2GbNANDFlash(256Mbytes) o24BitRGBDisplayinterface(DSS) oSD/MMCinterface(Theconnectorcansupports7differenttypesofcard) oUSBOTGinterface oNTSC/PAL/SVideooutput oPowermanagement oSerialinterface oI2Cinterface oI2SAudiointerface(McBSP2) oExpansionMcBSP1 oJTAGdebugginginterface MoreaboutBeagleboardcangetfromhttp://beagleboard.org/and http://elinux.org/BeagleBoard.Documentsalsoavailableoverthislink.Source codeforbeagleboard,bootingprocedureandcompilingprocedurecanbefoundin http://code.google.com/p/beagleboard/ BootSequence: ResetButton: Whenpressedandreleased,causesafullpoweronresetofthe BeagleBoard.Itshouldbenotedthatcurrently,theresetwill notwork whentheLinuxkernelisrunning.Toresettheboardfrom thekernel operation,apowercycleisrequired. User/BootButton: AbuttonisprovidedontheBeagleBoardtoprovidetwofunctions: ForceachangeinthebootsequenceoftheOMAP3530. UsedasanapplicationbuttonthatcanbeusedbySWasneeded. WhenusedinconjunctionwiththeRESETbutton,itwillforceachange totheorderinwhichbootsourcesarecheckedasviablebootsources. IfthebuttonispressedwhiletheRESETbuttonisreleased,the sequencebecomes: oUSB oUART oMMC1 oNAND EventhoughtheNANDmayhaveaprograminit,ifacardisplacedin theMMCslot,itwilltrytobootfromitfirst.Ifitisnotthere,it willbootfromNAND.Thereisalsotheoptiontohaveaserial download applicationthatwillprogramtheNANDifconnectedtothe serialorUSB ports.InthisscenariotheinternalROMwillstopon eithertheserial orUSBportandstartthedownloadprocessfrom there.Itdoesrequire anapplicationtoberunonthehostPCin ordertoperformthis function. Iftheuserbuttonisnotpressedatreset,thesequenceinwhichthe internalROM looksforviablebootsourcesisasfollows: oNAND oUSB oUART3 oMMC1 Inthiscase,NANDoverrideseveryoptionandwillalwaysbootfrom NAND ifthereisdataintheNAND.IftheNANDisempty,thentheother sourcesareavailabletobeusedbasedonthebootorder. 5.Setup

1.MakesureBeaglepowerisinOFFstatebyremovingthe5V

supplyandtheUSBhostconnection. 2.ConnecttheIDCUARTcabletheBeagleBoardandusingaNull ModemserialcableconnectittoaUARTportonaLinux machine. 3.Haveterminalprogram,suchasMinicomrunningonthehost machine. 4.Configuretheterminalprogramfor(BAUDRATE115200,DATA8bit, PARITYnone,STOP1bit,FLOWCONTROLnone). 5.InserttheMMC/SDcard(thatispreparedasdescribedabove) intoMMC/SDslotonBeagleBoard. 6.ConnectaTV(NTSCM)toSvideoport.PowerONTV. 7.MakethreepartitionsovertheSDcard.OneshouldbeVFATfilesystem while othertwowithEXT2filesystem. a)mmcblk0p1firstpartitionfilesystemvfatkeepuImage b)mmcblk0p2secondpartitionfilesystemext2keeplinuxwith androidfilesystem c)mmcblk0p3thirdpartitionfilesystemext2keepandroid filesystem 6.BuildingKernelImage 1.ConfigureLinux2.6kernelmentionedabovewithfullbeagleboardand androidsupport. makeARCH=armCROSS_COMPILE=$(Pathoftoolchain)/bin/armeabimenuconfig BydefaultthekernelwillhavevideooutputLCD.ChangeittoTVrather thanLCD.FiletobechangecanbefoundinLinuxkernel/arch/arm/plot omapdisplay.c 2.Compilekernelbyfallowingcommand. makeARCH=armCROSS_COMPILE=$(Pathoftoolchain)/bin/armeabiuImage the 3.CopyuImagefromLinuxkernel/arch/arch/bootfoldertoSD/MMCcardwith followingcommandtovfatpartition, mount/dev/sdxx/mnt. cparch/arm/boot/uImage/mnt. umount/mnt

8.BuildingAndroidFilesystem Extractthedata.tarsystem.tarramdisk.imgwithfollowingcommands.Which formsAndroidfilesystem. a)DownloadandroidSDKandroidsdklinux_x861.0_r1.zipandsetupthepath in /root/.bash_profile b)stepsforextractingsystemanddatafromemulator... source:................ http://wiki.kldp.org/wiki.php/AndroidPortingOnRealTarget http://discuzandroid.blogspot.com/2008/01/extractgoogleandroidfile system.html c)stepbystepextractingsystemanddatafromemulator... nowgetinsidetoolsdirectory

1)mksdcardcard100Mcard.img//createanemptycardimage. 2)emulatorsdcardcard.img//startingemulator. Note:Downloadbusyboxbinaryforandroid. 3)adbd1pushbusybox/system/bin/busybox//pushbusyboxintoemulator 4)adbshell 5)chmod+x/busybox 6)busyboxtarc/data.tar/data 7)busyboxtarc/system.tar/system 8)mountoloopcard.imgmnt/ 9)adbpull/data.tar.//extractingdata 8)adbpull/system.tar.//extractingsystem d)Gettheramdisk.imgfromSDK_PATH/tools/lib/images/ramdisk.img stepsforextractingramdisk.img.......... 1)cpramdisk.imgramdisk.gz 2)gunzipramdisk.gz 3)cdtarget_fs 4)cpioiv<../ramdisk e)NowAndroidfilesystemisready.Whichmeansitshouldhave directories:systemanddataetcsysdevsbin files:initinit.rc 7.BuildingLinuxfilesystemwithAndroidfilesystem LinuxFilesystemusedisrdext28M.bin(WithStreamvideosupport) SourceLink:http://code.google.com/p/beagleboard/downloads/list a)gunzipd<rdext28M.bin>ramdisk b)mkdirlinuxfs c)mountoloopramdisklinuxfs/ d)cdlinuxfs/ e)mkdirandroidkeepandroidfilesystemextractedasperabove,inthis androiddirectory. f)copylinuxfilesystemwithAndroidsupporttommcblkp2ofsdcard. mount/dev/sdx2/mnt cpavlinuxfs/*/mnt/ umount/mnt 9)SettingUpTheBootParametersandBootingtheLinuxkernel InordertoboottheLinuxKernel,kernelparametersneedtobeplacedinFlash. Thissectiondescribesthecommandstobootthekernelup. StepsforloadingKernelandFilesystemimagesfromSDcard a)mmcinit;//initializemmccard. b)fatloadmmc0:10x80300000uImage//kernelimage c)fatloadmmc0:10x81600000initrd.bin//filesystemramdisk_image StepsforloadingKernelandFileSystemimagesserially a)Bootthebeagleboardandtypethefollowingcommandatshell command:loadyram_addressImage.

Prerequisites:MMCcardshouldhave3partitions.

b)NowopenMinicomwith115200baudRate. c)pressctrlA+Z,youwillgetmenuinthatselect'S'tosendImage andnowselect'ymodem'protocolthenpressenter. d)Nowusespacebartoselecttheintendedfiletosendandpressenter. Whichopensadialogboxshowingfilesendingprocesssectorsbysectors.

a)Firstpartition(EXT2)tohaveonlyandroidfilesystem. b)SecondPartition(EXT2)tohaveLinuxandandroidfilesystemina separatedirectory. c)Thisisofvfattypepartitiontohaveinitrd.binimageanduImagefiles. StepsforAndroidBootinginBeagleboard: a)DirectlybootfromAndroidKernelintotheandroidfilesystem.i.eletthe androidkerneldirectlystart/initfromandroidfilesystem. 1.Setupthebootargs. setenvbootargsconsole=ttyS2,115200n8,n8noinitrdroot=/dev/mmcblk0p1 rwrootfstype=ext2init=/initnohz=off 2.RunthesecommandsinFlash,type: saveenv//tosave printenv//todisplay 3.Typethefollowingcommandnext://ifMMCcardPresent mmcinit;//initializemmccard. fatloadmmc0:10x80300000uImage;copyimagetocertainlocation. 4.bootm0x80300000;//bootingthekernel b)Manuallybootingtoandroidfilesystemfromnormallinuxfilesystem. Note:Disableautostartin/etc/init.rcfordbusdaemon,app_processand runtime. 1.Setupthebootargs. setenvbootargsconsole=ttyS2,115200n8noinitrdroot=/dev/mmcblk0p2 rootfstype=ext2rwrootdelay=1init=/linuxrcnohz=off 2.RunthesecommandsinFlash,type: saveenv//tosave printenv//todisplay 3.Typethefollowingcommandnext://ifMMCcardPresent mmcinit;//initializemmccard. fatloadmmc0:10x80300000uImage;copyimagetocertainlocation. 4.bootm0x80300000;//bootingthekernel StepsforNormalBootupofBeagleboardwithLinuxkernelandramdiskimage: 1.Setupthebootargs. setenvbootargsconsole=ttyS2,115200n8rorootfstype=ext2rootdelay=1 ramdisk_size=32768init=/linuxrcroot=/dev/consoleinitrd=0x81600000,60M nohz=off 2.RunthesecommandsinFlash,type: saveenv//tosave printenv//todisplay 3.Typethefollowingcommandnext://ifMMCcardPresent mmcinit;//initializemmccard. fatloadmmc0:10x80300000uImage; fatloadmmc0:10x81600000initrd.bin 4.bootm0x80300000;//bootingthekernel

10.CreateaScriptfiletostartandroidservices(android_start.sh)usingvieditor #!/bin/sh lns/android/system/system lns/android/data/data #copyallandroidetcfile cp/android/etc/*/etcR exportPATH=/sbin:/system/sbin:/system/bin:$PATH exportLD_LIBRARY_PATH=/system/lib exportANDROID_ROOT=/system exportANDROID_ASSETS=/system/app exportANDROID_DATA=/data exportEXTERNAL_STORAGE=/sdcard exportDRM_CONTENT=/data/drm/content /bin/chmodRa+rw/data/tmp /bin/chmodRa+rw/dev/binder chroot/android/init /system/bin/app_processXzygote/system/binzygote& /system/bin/dbusdaemonsystem& runtime&

11.FlashingtheNand Prerequisites:

1)MMCcardtobeformatedwithsinglepartitionasvfat. 2)Needdevicetohostconvertercable. 3)NeedUARTserialcable. 4)Needtodownloadsourcefiles. Note: SourceLink:http://code.google.com/p/beagleboard/wiki/BeagleSourceCode StepstoperformFlashingfromubootusingSD/MMCcard. 1)Makesurethatallbelowmentionedfilesareready. xload.bin.ift MLO uboot.bin kernelimage(uImage) ramdisk.bin(filesystem) 2)copythefilesintoMMCcardaswithnamegivenbelowinaorder. xload.bin.iftforNandasxload.bin.ift MLOasMLO uboottoflashontoNandasflashuboot.bin uboot.binforMMCbootasuboot.bin ramdiskImageasrdext2.bin Kernel(uImage)asuImage

3)TheninserttheMMCcardintoslotandpowerupwhilepressingUser button. CommandstowriteintoNandMemory mmcinit; Xload fatloadmmc00x80200000xload.bin.ift; (fatloadmmcpartition:partitionnumberram_adressimage) nandunlock; nandecchw; nanderase080000; (nanderaseoffsetsize) nandwrite0x80200000080000; (nandwriteaddressoffsetsize) nandlock Flashuboot fatloadmmc00x80200000flashuboot.bin; nandunlock; nandeccsw;nanderase800000x1e0000; nandwrite0x80200000800000x1e0000; nandlock; Kernel fatloadmmc00x80300000uImage;nandunlock nandecchw nanderase0x2800000x500000 nandwrite0x803000000x2800000x1e0000 (nandwriteaddressoffsetkernel_size) nandlock File_System nandunlock nandecchw nanderase0x7800000xf88000 nandwrite0x816000000x7800000x400000 (nandwriteaddressoffsetFile_System_size) nandlock 4)Nowreboottheboardandpressresetbutton.

StepstoperformFlashingfromSerialcable. 1)Downloadbeagle_recover.tar.bz2 SourceLink:http://groups.google.com/group/beagleboard/files 2)Extractthecontents.Andsetuptheconnectionusingserialcableand Beagleboardandpoweritup. 3)Getinsidethebeagle_recoverdirectoryandrun $./recover_beagle.shttyS0 4)Whichflashescontentsxload.bin.iftanduboot.binintoNANDmemeory. TableofMemoryPartitioning: Ram_addressNandFlashoffsetSize Start End XLoader 0x80200000 0x0000000x80000 0x0080000 Uboot 0x 80200000 0x0800000x260000 0x01e0000 BootEnvNand0x80200000 0x2600000x00280000 0x0020000 Kerneloffset0x803000000x2800000x007800000x0500000

FileSystemOffset0x816000000x7800000x100000000x0f88000

12.Testing TARGET: 1.Bootwithkernelonbeagleboard. HOST: 1.Runthescriptfile. ./android_start.sh

S-ar putea să vă placă și