You are on page 1of 22

Page1

LinuxBSPmanual
1.Outline
2.DirectoryStructureIntroduction
2.1.Buildroot
2.2.Linux2.6.36
2.3.Uboot
2.4.Tools
3.Internalworkingmechanism
3.1.Automatethebuildprocess
4.Developmentenvironmentready
4.1.HardwareResources
4.2.SoftwareResources
5.Compiledcode
6.Firmwarepackage
6.1.Automaticpacking
6.2.ManualStrapping
6.3.CustommadenandPartition
(1)PlanningDiskPartitions
(2)Makingpartitionimage
(3)Firmwarepackageaddsfile
(4)Writingoftherelationshipbetweenthepartitionandmirror
6.4.CodedevelopmentPackagingConsiderations
6.5.PackagingConfigurationNotes
(1)MemoryReservationconditions
(2)Distributionofphysicalmemory
(3)VirtualMemoryDistribution
(4)Currentlytherearememoryrelatedstartupparameters
7.Writingfirmware
7.1.NandStartup
7.2.SdcardStartup
8.Customrootfilesystem
8.1.Modifybuiltinrootfs
8.2.ModifyNandFlashOfrootfs
9.IntegratedPackage
9.1.Sourcecodepackage
9.2.Binarypackages
9.3.Executablefiles
10.Appendix
Appendix1.AboutUBoot
Appendix2.Aboutsysconfig1.fexConfiguration
Appendix3.Secondarydevelopmentnotes
(1)CPUModifythefrequencyof
(2)SdcardToserial
(3)I2CSecondaryDevelopmentDescription(Herewiththei2cMountedonthebusgsensorExamplesequipment)
(4)spiExamplesofsecondarydevelopment
Appendix4.RelatedResources
Appendix5.Instructions

Page2
1.Overview

ThisdocumentdescribestheallwinnertechnologyforA10chipLicheeLinuxBSP(Licheeforthedevelopmentofthecode,laterreferredLicheeBSP)structure,interna
Andsimpleusage.ThepurposeofthisdocumentforhowtoguideuserstocustomizeandusetheBSP.

LicheeBSPcanbedownloadedfromtheftpclientChitechnology.
2.DirectoryStructureIntroduction
LicheeBSPmainlybyBuildroot(version2011.02),Linuxkernel2.6.36,Linuxkernel3.0,uboot,tools,fourmajorgroups
Tomake.WhichBuildrootresponsibleforARMtoolchain,generateUBoot,applicationpackages,LinuxrootfilesystemandfirmwarepackageLinux
KernelisacorepartofLicheeBSP.
2.1.Buildroot
Itsmainroleisto
(1)ManagementPackdependencybetween
(2)CrossgenerationARMtoolchain
(3)generatesUBoot
(4)Productionoftherootfilesystemcancontainstrace,directfb,oprofileandotherveryrichapplicationsandtestsoftware
(5)togeneratethefinalforprogrammingfirmwarepackage
Itsdirectorystructureisasfollows

[[Mailto:git@itlab][git@itlab]]test]$treeL1buildroot/
buildroot/
|Board
|Boot
|CHANGES
|Config.in
|Configs
|COPYING
|Dl
|Docs
|Fs
|Linux
|Makefile
|Package
|Readme.txt
|Scripts
|Target
|Tools
`Toolchain

Wherein,bootBootcodestoragedirectory,configdirectorytostorepredefinedprofiles,suchasoursun4i_defconfig,dlcatalog
Storehasbeendownloadedpackages,scriptsdirectorystoreoperatingcodebuildroot,targetdirectoryisstoredforgeneratingroot
Somerulesfilesystem,inthetoolsdirectoryisstoredinthepctoolsforpackagingandmassproduction.Forus,themostimportant
Apackagedirectory,whichkeptalmost3000softwarepackagesgeneraterules,wecanaddourownpackagesorinthemiddleontheinside
Member.Moreaboutbuildrootintroduction,cangototheofficialwebsitebuildroothttp://buildroot.uclibc.org/get.
2.2.Linux2.6.36
Directorystructureisasfollows:

Page3
|[Benn@LServerlichee]$treeL1
|Linux2.6.36/linux2.6.36/
|Arch
|Block
|Build
|COPYING
|CREDITS
|Crypto
|Documentation
|Drivers
|Firmware
|Fs
|Include
|Init
|Ipc
|Kbuild
|Kernel
|Lib
|MAINTAINERS
|Makefile
|Mm
|Modules
|Net
|Output
|README
|REPORTINGBUGS

|Rootfs
|Samples
|Scripts
|Security
|Sound
|Tools
|Usr
`Virt

ThedirectorystructurewithmorethanstandardLinuxkernelisthesame,exceptonemoremodulesdirectory.
modulesdirectoryisusedtostoredidnottellustoexpand
Localkernelmenuconfigintegratedexternalmodules.Wehaveputexample,maliandwifithesethreeexternalmodules,exampleisshown
Exampleuse,maliour3DGPUdriver.
[Benn@LServerlichee]$treeL1linux2.6.36/modules/
linux2.6.36/modules/
|Example
|Mali
`Wifi

2.3.Uboot
Thisdirectoryisnoneedtoredevelopment,butthecompilerisrequired
2.4.Tools
Thisdirectoryispackedcatalog,someofthepackagingrelatedfilesettingsandfirmwarelinux_bsppackagegeneratedinasubdirectoryofthedirectory

3.Theinternalworkingmechanism

3.1.Automatedcompilationflow
Inanexamplesun4i

Page4

Figure3.1buildautomationflowchart
Note:Youneedtospecifyparametersatexecutionbuild.shscript,specificreference./build.shhOutput

4.Preparethedevelopmentenvironment

4.1HardwareResources
(1)A10EVBdevelopmentboard
(2)2PC,aninstallation(linux)docompileserver,anotherPCtoinstallWindowsforprogrammingfirmware(ifenoughhardwareconfiguration,
APCequippedwithavirtualmachinecancompletetheabovework)

(3)serialcable,12VpowersupplyandthesmallportUSBcable

Figure4.1serial/usbwire
4.2.SoftwareResources
(1)compileserver1,installUbuntu10.04(64bit).
Compilerenvironmentrequiresatleastgcc,ncurse,bison,autoconf,wget,patch,texinfo,zlib,dosunixpackagesifneededtocompileandroid
Wish

Page5
all:
sudoaptgetinstallsunjava6jdk
ubuntu32:
sudo 32aptgetinstallgitcoregnupgflexbisongperflibsdldevlibesd0devlibwxgtk2
dev
buildessentialzipcurl
libncurses5devzlib1gdevvalgrind
ubuntu64:
sudoaptgetinstallgitcoregnupgflexbisongperfbuildessentialzipcurlzlib1gdev
gccmultilibg++multilib
libc6devi386lib32ncurses5devia32libsx11protoco
dev
libx11devlib32readline5devlib32zdev

(2)OnePCforprogrammingfirmware,installwindows,itisrecommendedtoinstallputty,andnetworkmappingtocompiletheaboveLinuxserver

5.compilethecode
(1)compiledcode
Firstbuildroot/scripts/top_build.shcopiedtothedirectoryinlicheelicheedirectory
$Cpbuildroot/scripts/topbuild.shbuild.sh

Forexample,tocompileastreamlinedversionoftheLinuxBSPfirmware,enter
$Cdworkdir/lichee
$./Build.shpsun4ilite

TocompileacompleteversionoftheLinuxBSPfirmware,enter
$./Build.shpsun4i

Note:LiteandFullversiondifferenceisthatLitecontainsfewerpackages,shortercompiletimes.
Compilethecode,thesystemwillgeneratetheusermaybeusefultocopyabinaryfiletothelichee/outdirectory,whilealsocopythegeneratedfirmwarepackage
Tothenextbuildroot/tools/packfollowingpackagingtoolsworkingdirectoryandstartLinuxpackagingtooltogeneratethefinalfirmwarepackagethan
Asbuildroot/tools/pack/out/linuxevb1.2A.img.Usersgetthefirmwarepackage,thedirectuseLiveSuitNandFlashprogrammingtoolthatis
Can.

6.Packingfirmware
Packagingreferstoourtranslationofthebootloader,kernelandrootfilesystemwritesanimagefiletogether,thisimagefileisalsocalledfirmware.
Thisimagecanthenbewrittenonthenandflashorsdcard,toinitiateoursystem.
6.1.Automaticpacking

Page6
Bspinourbuildsystem,hasbeenaddedtopackagingtoolautomationpackageunderlinux.Thecodeiscompiled,
NeedtobuildastreamlinedversionoftheLinuxBSPfirmware,enter
$Cdworkdir/lichee
$./Build.shpsun4ilite

TocompileacompleteversionoftheLinuxBSPfirmware,enter
$Cdworkdir/lichee
$./Build.shpsun4i

Alreadyitincludestheprocessofpacking.Theresultingimagefileisworkdir/lichee/buildroot/tools/pack/out/linuxevb1.1.img(linux
evb1.2A.imglinuxevb1.2B.imgdifferenttargetboard)
Note:build.shscriptexecutableparameters

NAME
buildThetoplevelbuildscriptforLicheeLinuxBSP
SYNOPSIS
build[h]|[pplatform][kkern_version][mmodule]|pack
OPTIONS
h
p[platform]

Displayhelpmessage
platform,egsun4i,sun4ilite,sun4idebug,sun4i_crane
sun4i:fulllinuxbsp
sun4ilite:linuxbspwithlesspackages
sun4idebug:linuxbspfordebug
sun4i_crane:androidkernel

k[kern_ver]

2.6.36(default),or3.0

m[module]

Usethisoptionwhenyoudontwanttobuildall.[OPTIONAL]
egkernel,buildroot,uboot,all(default)...
Tostartpackprogram

pack

Examples:
./build.shpsun4ilite
./build.shpsun4i_crane
./build.shpsun4ilite
./build.shpack

b[board]targetedversionofsignal
evb1.1correspondingboardmodelA10EVBV11(defualtoption)
evb1.2AcorrespondingboardmodelA10EVBV12resistivescreen
evb1.2BcorrespondingboardmodelA10EVBV12capacitive7inchscreen
Ifthescreendoesnot,firmwareprogramsintotheboard,thescreenwillbewhite.
p[platform]compiledversionofthetarget(thenondefaultconfiguration)
sun4i:fullversionoflinuxbspcompile

Page7
sun4ilite:Liteinuxbspcompile

[OPTIONAL]

sun4idebug:linuxbspdebugversion
sun4i_crane:androidcompiledkernel
k[kern_ver]kernelversion
2.6.36(default)
3.0
m[module]compiledobject
kernel
buildroot
all(default)correspondskernel+buildroot

packoptionsarepackagedoptions,afterperforming./build.shpack,therewillbechips,platform,targetversionthreechoices,aslongastheactualsituationtomakepos
Indeedchoosetogeneratecorrespondingfirmwarepackage,generatedfirmwarepackageplacedinthetools/packdirectories.
NOTE:packexecutablescriptparameters
NAME
packThepacktoolsforlinuxfirmware
SYNOPSIS
pack[h][Bboard_type][pproduct_type]
OPTIONS
h
B[Board_type]
p[producttype]

Displayhelpmessage
Boardtype,egevb1.1,evb1.2A,evb1.2B,...
Producttype,eglinux,crane,...

6.2.ManualStrapping
Windowcanmanuallypackagedunderway.Packagedscripts
Under/tools/pack,pack.bat,andlatertherewillbethesameasthethirdchoiceunderlinux,generatedfirmwarealsoonthetools/packdirectory
6.3Customnandpartition
(1)PlanningDiskPartitions
Zoningreferstothestoragedevice(usuallyanandflashorsdcard),thedivisionofspaceaccordingtothelogic.
Traditionally,thepartitionsarenumberedfrom0,
Itrepresentsthefirstdistrict,arepresentativeofthesecondpartition,andsoon.TherulesaresimilartotheharddiskpartitiononthePC,showninFigure6.1.

Figure6.1Partitionschematic

Figure6.1indicates,onastoragedevice,atotalofatotalofeightAHdistrict,wherethestartingpositiontostartfromtheheadofthepartitionAstoragedeviceisthefir
PartitionHtakesupthetail,isthelastpartition.

Page8
Planningzones,itmeansthenumberspecifiedinthefirmwarebundlepartitionstoragedevicesbyuserdefinedpartitionproperties.
Whenprogrammingfirmwarepackage,storagedevices
Therewillbesaddledbyauserdefinedpartitions.Withthisplantheusercanmodifythepartitiondiagram6.1,likethefollowingsituations:

Partitiondiagramofamodified6.2
Planningcanbeseenthroughthepartition,thepartitionreducedcapacityB,Cpartitionsizeisincreased,whilereducingtheHpartition.
Toplanforthepartitiononthestoragedevice,theneed
Followthestepsbelowtodo
1)Openbuildroot/tools/pack/sys_config.xxx.fexfileeFexdirectory(xxxcorrespondstolinuxorcrane)
2)Locatethe[part_num],theoriginaldocumentreadsasfollows:

[Part_num]
Num
=1

Itsaidthenumberofpartitioniscurrentlyprogrammedto1.Ifyouneedtoaddanewpartition,weneedtochangethevalueofnum.Ifyouadda,
Thenumvalueto2iftheincreaseintwo,numvaluebecomes3andsoon.
Whenaddingtwopartition,itshouldbethefollowingcontents:
[Part_num]
Num
=3

3)Propertyconfigurationpartitionofapartitionofproperty,shouldhavethefollowingfive:
Partitionname,classnameofthepartition,thesizeofthepartition,theuserattributepartition,partitionreadwriteproperty.
Thefollowingisdescribedinafilepartition
Attributes:
[Partition0]
class_name
name
size_hi
size_lo
user_type
rotype

=DISK
=BOOTFS
=0
=131072
=0
=0

parttition0indicatestheserialnumberarea,theneedtoensurethenumbersinascendingorderstartingfromzero.
class_name:Fileclassproperties
Currently,theclassattributeallpartitionsshouldbefixedcharactertype"DISK"
name:Partitionname
Partitionnamesareuserdefinedattributes.Whentheusertodefineapartition,youcanputintotheirownhopeofastringhere,butthelengthisnot
Itcanbemorethan16bytes.
size_hi\size_low:partitionsize

Sizeofthepartitionisa64bitinteger,theminimumis0,themaximumyoucanachieve(2^631)kilobytes,thatthevalueofeachunitonbehalfof1Kbytes.
To
Convenienceofdescription,thelistofattributestorepresentthesizeofthepartitionbytwointegervalues,size_hirepresentsthepartitionsizehigh32,size_lowsaidpo

Page9
Lowareathesizeof32.Size_hilistis0,size_lowis131072,representsthepartitionsizeis131072Kbytes,namely128Mbytes.
user_type:UserProperties
Thisisprovidedbytheoperatingsystemtotheproperty.
Currently,eachoperatingsystempartitionread,willbejudgedbasedonuserattributesthecurrentpartitionisnot
Istheirown.Thepurposeofthisdesignistoavoidwhenmultiplesystemscoexist,AtoBOSoperatingsystempartitionsarenot
ReadandwriteoperationsshouldbeledBoperatingsystemcannotworkproperly.
Provisionofuserattributesareasfollows:
0:AllsystemsUniversal
1:melisspecial
2:linux/androidspecial
3:wincespecial
Other:Reserved

ro_type:readwriteproperty
Purposeofthedesignisthatyoucanreadandwriteattributestoapartitiondesignedasareadonlyorreadwrite.
Currently,thispropertyisinthesystemdoesnotstart,
Butwhenyoucanreadthepartitionpropertyrighttoreadthisvalue.
Now,thepropertyisleft0.
Whenunderstandalltheattributespartitions,youcanlistthedesiredpartition.Forexample,nowwanttoaddapartition,thenameis"MYPART",size
Is512Mbytes,propertiesarecommon,itcanbewrittenasfollowsinthetable
[Partition0]
class_name
name
size_hi
size_lo
user_type
rotype

=DISK
=MYPART
=0
=524288
=0
=0

Throughtheabovesteps,youcanaddapartitionifyouneedtoaddmultiplepartitions,repeatingtheaboveoperationscanbe.Whenaddingpartitions,
Notethatthevaluetoincrementalchangeafterparttition.
(2)makingpartitionimage
PartitionimagereferstopackagingthetimethatthefileinadirectorydevelopedintoaspecificfileviaPCtool.Thisfileaccordingtothefilesystem
Formatarrangement,thedocumentincludestheoriginaldirectoryofallfilesanddirectorystructureexactlyasarranged.
Whentheimagefiletobeprogrammedintothestoragedevice
Ononepartition,youcanseeexactlythesamecontentanddirectorystructureofthepartitionandtheoriginaldirectory.
ThepurposeistomakepartitionimagetoaspecificdirectoryonthePCcopyingontosmallmachinestoragedevices.
Developmenttime,aslongasthemodificationsonaPC
Anycontentsofthepartition,isequivalenttomodifythecontentofthispartitionthestoragedevice.
Thisbecomesquiteeasytomodifythepartitiondoesnotneedtodealwithasmallmachine
Correspondingcontent.
Theprocedureforcreatingpartitionimageasfollows:
1)theselecteddirectory
Thisdirectoryisusedtomakepartitionimage,hiddenfilesinthedirectorywillnotbeaddedtoapartitionimage.
2)producedscript
Thescriptisusedtospecifythepartitionsizeproduction.
Forexample,thedirectorypathformakingpartitionimageandhopethesizeofapartitionis128M,or
Is1024kcreateapartitionnameofthemirror,youneedtospecifyinthescript.

Page10
Thecompletecontentsofapartitionofthescriptasfollows(thescriptisbuildroot\tools\pack\wboot\bootfs.ini)
[System]
ver=100
date=2009703
ID=937ae0d050e343c29b84bfef0cd21a41
[Fsinfo]
disccnt=1
disc0=c
[C]
Filesystemdrive
disc=c
Filesystemimagename
fsname=.\bootfs.fex
Filesystemtype
format=fat16
Filesystemsize(k)
size=131072
FileSystemProperties
attr=0
Rootlocationandcounterdefine
rootcnt=1
root0=.\bootfs

Whenmakingpartitionimage,youneedtocareaboutisthefollowingthreeitems:
Filesystemimagename.
Filesystemimagename
fsname=.\bootfs.fex
Itrepresentsthenameofthegeneratedpartitionimage,andthepathgenerated.
Userscanmodifythefullpathhereandtheywanttopartitionimagegeneratedtext
Membername.
Filesystemsize(k)
Filesystemsize(k)
size=131072
IsthefilesystemsizeoftheunitisK,theexamplerepresentsthesizeofthepartitionimageis131072kbytes,namely128Mbytes.Whenmakingacomplete
Afterpartition,thesizeofthispartitionshouldbethe128M.
Partitionpath
Rootlocationandcounterdefine
rootcnt=1
root0=.\bootfs

Hereindicatesthepathpartition,asintheexampleofroot0=.\Bootfs,indicatingthecurrentdirectoryunderbootfsneedtobemakingapartitionimage.
Incase
Usersneedtoproduceaspecifieddirectorypartitionimage,thepath(absolutepathorequivalent)directorycanfillinhere.
3)generatepartitions
Afterpartitioningthescriptiscomplete,youcancallPCtoolgeneratesapartitionimage.Typically,youuseabatchfiletoaccomplishthistask.One
Commonscripttogenerateabatchfileasfollows
::==================================================
::Buildbootfs

Page11
::==================================================
..\Pctools\fsbuild200\fsbuild.exe
.\Bootfs.ini
^..\Efex\split_c43a2a92a8ed4f92abdbca0d5d29666d.bin>bootfs.txt
Filecontentisverysimple,simplycallupaPCtool,andthenputinfrontofthescriptfileasanargumenttothetool.Ififthere
Print,printthecontentsoftheguideputbootfs.txtfile.
Infact,ifyousettogeneratea128Mpartitionimage,buttheactualsizeofthecorrespondingdirectoryonly32M,accordingtotheaboverules,thefinalgenerated
Fileimageandnot128M,but32M.Whyisthis?
WhenPCToolsruns,allthefilesinthespecifieddirectorywillbeassembledintoafilesystemimage,ifthedirectorysizeis32M,theresultingpartitionimageon
Is32M.Ifthepartitionsizeisspecifiedinthescriptwhenthe128M,PCtoolruns,itwillfillalargenumberof0inthepartitionbehindthemirror32Muntil
Itssizereaches128M.
However,ifthetimeisrunning,theparameterspecifiestheneedtopad0,PCToolswillnotbefilledwithzeros,maintainingtheoriginal
The32Msize.
BatchparameterentryPCTools
.\Bootfs.ini^..\efex\split_c43a2a92a8ed4f92abdbca0d5d29666d.bin
Whereinthebinfile,itmeansthatthedocumentproducedbythemirror,donotneedtoaddasfilledwithzeros.Ifyouneedtofill0,theparameterscanbe
Write:
.\Bootfs.ini
Thus,itwillgenerateasizethatisspecifiedpartitionimagesize,ifitisthepreviousexample,theresultisa128Mpartitionimage,validfor
Capacityis32M,othervalues
arezero.

(3)Thefirmwarepackageaddsfile
Firmwarepackageaddsthedocumentreferstoafiletothefirmwarepackage.UsersWiththisoperation,youcanaddfilestothespecifiedfirmwarepackage
In,forsubsequentoperation.

Asmentionedabove,thefirmwarepackageisessentiallyadocumentbyacompositionsimilartoacompressedpackage,tocompressmultiplefilesintoafirmwarepack
Here,
Throughadescriptivescriptfile,youneedtoaddtothefirmwarepackageofdocumentsenumerated.
Then,thepackagingprocessreadsthescriptfiletogenerate
Thefinalfirmwarepackage.
First,thetextmode,openthe\tools\pack\wboot\image_linux.cfg(androidisimage_crane.cfg)file,youcanseethebig
Causethefollowingcontents:
Pathdefinition
[DIR_DEF]
INPUT_DIR="..\"
[FILELIST]
{Filename=INPUT_DIR.."eFex\\sys_config.fex",maintype=ITEM_COMMON,subtype=
"SYS_CONFIG000000",},
{Filename=INPUT_DIR.."eFex\\split_c43a2a92a8ed4f92abdbca0d5d29666d.bin",\
maintype=ITEM_COMMON,subtype="SPLIT_0000000000",},
{Filename=INPUT_DIR.."wboot\\bootfs.fex",maintype=ITEM_ROOTFSFAT16,subtype=
"BOOTFS_000000000",},
{Filename=INPUT_DIR.."eGon\\Boot0.bin",maintype=ITEM_BOOT,
subtype=
"BOOT0_0000000000",},
{Filename=INPUT_DIR.."eGon\\Boot1.bin",maintype=ITEM_BOOT,
subtype=
"BOOT1_0000000000",},
{Filename=INPUT_DIR.."eFex\\usb\\tools.fex",maintype=ITEM_PHOENIX_TOOLS,subtype=
"Xxxxxxxxxxxxxxxx",},
......

Above,thescriptfileispackagedparts.Addafileformat,asfollows:
filename=path&name,maintype=ITEM_ROOTFSFAT16,subtype=user_define

Page12
Whenusersneedtoaddthefile,followthesameformat,thedocumentsyouneedtowritethescriptfile.
filename:packedfiles
Itreferstothefullpathofthefile.Youcanusearelativepath,suchasascriptfile,usetherelativepath.
maintype:packagingformat
Typeindicatesthefileformat,usersdonotneedtomodifyit,tokeepthe"ITEM_ROOTFSFAT16",theactualtimeofwritingwithoutthedoublequotes.
subtype:customname
Isauserdefinedname,theuseofdigitaland26Englishcharacters(casesensitive),therequirementistobe16characterslong.
Thispropertymaybeprogrammedin
Whenused.

Afterwritingtherulesaslongastheuserinaccordancewiththeabove,andtocompletetheformulaintothescriptfile[FILELIST],untilthepackwhenitwillautomatic
Addedtothefirmwarepackage.
Whenpacking,providesafixedencryptionfunctionisaddedtothefirmwarepackagefilesareautomaticallyencrypted.
Ifyoudonotwanttoencryptfiles,youneedtofile
Extensionpieceinto"fex".Forexample,userswanttoaddafiletothefirmware1.binpackage,withoutencryption,youneedtotake1.binmodification
Into1.fex.
(4)therelationshipbetweenthepartitionandmirrorprogramming

Createapartitioninfrontofthemirroreventuallybeprogrammedintothepartition.
Thesocalledprogrammingpartitions,referstoafileprogrammedintoapartition.Ifa
Programmingpartitionimagefiletoapartition,aftertheprogrammingiscompleted,thepartitionsmallmachinealreadycontainsafilesystemwiththecorrespondingfil
Aftermakingapartitionimage,youneedtoputittotheappropriatepartitionprogrammed.Accordingtopreviousreports,theuserhastoaddapartition,
Canmakeadirectoryintoapartitionimage,youcanalsoaddcreatepartitionimagefileintothefirmwarepackage,andnow,onhowtodivide
Areaprogrammedintotheimagefileonthepartition.
Andaddingapartition,asintheworkspace\sys_config.fexfileeFexdirectory,therearethefollowingelements:
[Down_num]
down_num

=1

[Download0]
part_name
pkt_name
encrypt

=BOOTFS
=BOOTFS_000000000
=0

down_num=1,representsthenumberofpartitioniscurrentlyrequiredonlyoneprogrammer.
Ifyouwanttoprogrammultiplepartitions,youshouldbeinthisplace,filled
Toprogramthenumberofactualpartition.
[Download]:Title
Itisprogrammedtopartitionthemaintitle.Eachpartitionneedstobeprogrammedfrom0maintitle,inascendingorder.
Therefore,thefirstprogrammingpartitionmaintitle
Shouldbe[download0],thesecondmaintitleis[download1],thenthmaintitleis[download(n1)](bracketsdoesnotexist).
part_name:Partitionname
Consistentpartitionnamepartitionnameandaddpartitionsdescribed.
Inotherwords,itrepresentstheprogrammedactionsrequireapartitionwherethedatawrite
Them.
Thenamemustbefoundinthesamescript,partitiontable,otherwise,wouldresultintheprogrammingprocesstofindtherightprogrammingposition,resultingin
Failed.
pkt_name:FileName
Thisreferstothenameoftheprogrammingoperation,thefiletobeprogrammed.
Youcancheckthefirmwarepackageaddsafile,weintroducetheattacheddocumentssubtype.
Thefilenameisaddedtothesubtypefirmwarefilesinthepackage,whichmustbe16characters.

Page13
encrypt:EncryptionProperties
Ifthisvalueis0,indicatingthecurrentprogrammingisnotencryptedotherwiseitindicatesencryption.
Undernormalcircumstances,itisrecommendedtousenoencryption,whichallowencryptavalueof0,
Thiswillgreatlyincreasethespeedofprogramming.
Withtheabove,hereisaprogrammingparadigmrepresentsthepartition(assumingthepartitionandfilesalreadyexist).
[Down_num]
down_num

=2

[Download0]
part_name
pkt_name
encrypt

=BOOTFS
=BOOTFS_000000000
=0

[Download1]
part_name
pkt_name
encrypt

=ROOTFS
=ROOTFS_000000000
=0

Thisexampleindicatesthatthefirmwarepackage,tobeprogrammedtwopartitions.
NameofthefirstpartitionisBOOTFS,canbefoundinthelistofpartitionsplanto
WritingtothispartitionpartitionimageisBOOTFS_000000000,thecorrespondingfilescanbefoundintheworkspace\wboot\image.cfgfile
That,whenprogrammingneednotbeencrypted.
Similarly,thenameofthesecondpartitionisROOTFS,canbefoundinthelistofthepartitionplan,tobeprogrammedintothepartitionpartitionimage
IsROOTFS_000000000,thecorrespondingfilescanbefoundintheworkspace\wboot\image.cfgfile,nordoesitrequireprogrammingtime
Secret.
Note1:imge.cfgandsys_configxxx.fex(xxxislinuxorcrane)in.Thesubtypeinimge.cfgislimited.
Suchas
subtype="SYS_CONFIG000000",mustbe16characters.
Note2:Formoredetailedinformation,referto"LinuxBSPGPIOManagementandConfiguration"
6.4CodeDevelopmentPackagingConsiderations
(1)addanewpackage
Inmenuconfigintegratedaddanewpackage,themoduleordriver,eitheratbuildrootorlinux2.6.36,tobesurethatyoucompile
.configFilepackagewhenthecorrespondingentryisopen,otherwiseitwillnotbethenewadditionstocompilecompiletime.
Ifafterthemoduleisthedefaultsetting
Issettoopen,thenreplacethecontentsofthecorrespondingdeconfigfileconfigspleaseusedirectory.configcontent.
(2)modifiedthepackage
Afteranumberofpackageshavebeenopenedinthedefault.configbemodifiedifitisinbuildroot,youneedtooutput/buildrecompileunder
Correspondtothenameofthedirectorytodelete(youcanalsomakecleanoncerecompile,butitwillspendmoretimethantheformer,theadvantageisDoing
Inordertoensuremaximumresultsarecorrect,ifthereisacertainunderstandingofbuildrootuser,youcanoperateaccordingtotheirownsituation,their
Realbuildroottheentireworkprocess,eachstagewillmakeatag,ifatagcorrespondingstagedeleted,buildrootwillthinktheyhavenot
Thestagewillbedoneagaindoverywelliftheuserofthismechanismcanonlydeletethespecifiedlabelcanbe),ifitisunderlinux2.6.36
Changesithastogetridoftheoriginalcorrespondingtothegeneratedfiles(executionmakemrpropercanachievethesamepurpose,todosoundersimilarbuildroot
Executemakeclean).Ifthetimetofully,Irecommendlargescalechangesinthecode,dothefollowing
cdlinux2.6.36
makemrproper
cd../buildroot
makeclean
rm.config

Page14
6.5.PackagingConfigurationNote
(1)MemoryReservationconditions

Note1:gpsandg2dofmemorymustbereservedinsysconfig1.fexsignadocumenttoopentheitemused(ieXXX_used=1)will
Effect.Andthesetwostartingaddressvalue(GPS:0x59000000g2d:0x59000000)arebothsetasideamaximum16M,(linux
2.6.36/arch/arm/machsun4i/include/mach/platformdefined.)Theactualsizesizesettingsneedtobemodified
In/buildroot/tools/pack/eFex/sys_config1_xxx.fex(xxxgoalEditionmodels)

Figure6.3MemoryReservedFigure
(2)thedistributionofphysicalmemory

Page15

(3)thedistributionofvirtualmemory
3GBuserspace
Kernelspace1GB
IOspace&SRAMstartaddress0xF0000000endaddress0XF1EBFFFF
DRAMstartaddress0xC0000000endaddress0XE0000000

(4)currentlyactivememoryrelatedparametershave

Sizecanbechanged,theminimumcanbesetto0,thesizeneedstobemodifiedinaccordancewith(theoreticallyaslongastheprojectdoesnotconflictwithotherfree
Set).

7.programmingfirmware

Page16
7.1.Nandstart
ItisassumedthattheprogrammingisA10EVBboard,thefollowingstepsareprogrammedfirmwarepackage(startingfromNandFlash)
(1)Connectthedevelopmentboardinthefollowingfigure
Serial,USB,andpower

Figure7.1Wiringphysicalmapofasmallmachinedownload
(2)readyfirmwarepackage
Inthefinalchapter6.1,wegettheLinuxBSPgeneratedfirmwarepackage.
(Thedefaultfirmwarepackagesizecannotexceed300M,ifyouneedtoincrease,may
Tomodifybuildroot/tools/pack/eFex/sys_config.fexfile[partition1]ofsize_hiandsize_lo2parameters,specificparametersmodificationmethod
Seethecommentsinadocument)
(3)RunLiveSuitTools
Inbuildroot/tools/belowthistool,youcancopythetoolfrombelowontoWindowsXP.Afterconnectingline,
PressENTER/UPGRADEkey+RESETbutton(specificallyholddownENTER/UPGRADEkeyandthenpresstheRESETbutton,releaseRESETbutton,after
ReleasetheENTER/UPGRADEbutton).Thengoesintoupgrademode.
IfnoENTER/UPGRADEandRESETbutton(Somekeyfailureorsomecustomersspecialboard),canbeusedtoforceburnapproach:

1:Ifthesmallmachineinthesystemitself,itonlyneedtorepower,holddowntheserialterminal2,afterenteringtheprogrammingmodefirmwarereleasebuttoncanb
2:Ifthesmallmachineitselfhasnosystem,orthesystemhasbeenunabletouse,whenyouneedtorepower,conductormakenandflashdatai/oportShort
Roadtoforciblyentertheprogrammingstate.
IfthefirsttimeyouuseLiveSuit,youwillbepromptedtoinstallUSBdrivers,thedriveralsoplacedbuildroot/tools/livesuit/UsbDriverbelow.
Accordingto
PromptstoinstalltheUSBdrive,asshownbelow

Page17

Figure7.2livesuitUSBdrivetoload(1)

Figure7.3livesuitUSBdriveloaded(2)

Page18

Figure7.4livesuitUSBdriveloaded(3)
Note1:livesuitdriversinusbdriversubdirectoryoftheinstallationdirectoryofthesoftwareunderthe

Figure7.5livesuitUSBdriveloaded(4)

Page19

Figure7.6livesuitUSBdriveloaded(5)
Afterinstallingthedriverintotheprogrammingprocess.

Figure7.7firmwareprogrammingformattingtips
Thechoiceonthemap,select"Yes"afterthesmallplanecomparabletothenandflashfullformat,andthenburnthefirmware,thensmallmachineonlybasicsystem,
Andapplicationfirmwarepackageitselfcontains,select"No",equivalenttoonlyupdatethesystem,someoftheoriginalapplicationwillberetained.

Figure7.8firmwareprogrammingprogressbar
Note1:Iamworkingdirectorycallednew,thenewequivalentoftheforegoinglicheeburnfinished,presstheRESET(ifitisevb12,whichburnsolidfinish
Afterthememberwillautomaticallyrestart,youdonotpressRESETtorestart)

Page20

Figure7.9programmingiscompletedtheloginscreen
Withrootuserlogin,passwordisempty.
7.2.Sdcardstart
Doesnotsupport

8.customrootfilesystem
LinuxBSPusedtwocurrentrootfilesystem.
ThefirststagerootfilesystemandLinuxkernelcompilationtogether,thesecondstagerootfilesystemingeneralprogramming
ToNandFlashpartition.
8.1.Modifyingbuiltinrootfs
Performthefollowingactions:
$Cdlichee/linux2.6.36/rootfs
$./Build.shesun4i_rootfs.cpio.gz

Atthispoint,you'llfindunderrootfs/directorywillbeadirectorycalledskel,youcanaddandmodifythefilesinside.Aftereditingexecution
$./Build.shcsun4i_rootfs.cpio.gz
AfterupdatingtherootfsremembertorecompileLinuxKernel
(Wheresun4i_rootfs.cpio.gzarchivepackagedefaultsizecannotexceed13M,thislimitcanbuildroot\tools\pack\wbootinrepair
Change,buttheupperlimitliftspaceislimited)
8.2.ModifyingtherootfsNandFlash
(1)acopyofanexistingprofile
$Cdlichee/buildroot
$Cpconfigs/sun4i_defconfig.config

Page21
(2)intotheinterfaceconfigurationbuildroot
$MakeARCH=armmenuconfig
Aftertheabovecommandtodisplaythefollowingscreen

Figure7.1linuxkernelmakemenuconfiginterface
Aftersavingtheconfiguration,andthenrerunthenextlicheedirectorybuild.shscript.

Compilationprocess,ifthereisapackagemissing,buildrootautomaticallydownloadedfromtheInternet,butthistimethemachinecannotconnecttothenetworkifthe
Downloadtheappropriateversionofthepackage,copythepackagetothebuildroot/dldirectory

9.IntegratedPackage

9.1sourcecodepackage
Forusermodeapplications,dynamicandstaticlibrariesshouldbeintegratedintobuildroot,thebuildroot/packagesunderadirectorycorrespondingtoapackage.
Instructionsonhowtointegratethepackageinbuildroot,referhttp://buildroot.uclibc.org/docs.html.Ifthereareproblems,pleasecontactthe
Documentauthorforhelp.
Takeasimpleexample:
Toaddasourcepackageinbuildroot,wemustfirstcreateanewdirectoryunderbuildroot/packagedirectory,thedirectorynameisthenameofthepackage,Head
Directory,andthenaddafileandaxxxx.mkconfig.infile(xxxxisthenameofthepackage)inthedirectory.Specificwordingofthesetwodocuments,
OtherpackagesSeebuildroot/packagedirectory,ortheofficialwebsite(softwaresourcecodepackagesintoofficialpackagesonlineandtheirpreparation
Sourcepackage,config.inthisclass2fileformatpackageisthesame,butthereisalargedifferencebetweenwriting.mkfile,ifitisthelatter,seefsck
msdospackage.mk,theformerseearguspackage.mk).Afterfinishtheaboveoperations,butalsointhebuildroot/packagedirectory
Theconfig.infile,add
source"package/panlong/Config.in"
Note1:Assumethatthepackagenametobeaddedtopanlongwords.Asforthelocationofthecodeaddedbythespecificcircumstances,toaddlocation
affectenforcement
Makemenuconfiglineisthelocationofthecorrespondingoptionpackages.
Examples:
menu"PackageSelectionforthetarget"
source"package/busybox/Config.in"
source"package/customize/Config.in"

Page22
#source"package/lcdtest/Config.in"
#source"package/tptest/Config.in"
#source"package/kernelheader/Config.in"
#source"package/swtools/Config.in"
#source"package/ext4utils/Config.in"
#source"package/tiobench/Config.in"
#source"package/fsck_msdos/Config.in"
#source"package/mali3d/Config.in"
#source"package/cedar/Config.in"
__source"package/panlong/Config.in"__
#Audioandvideoapplications
source"package/multimedia/Config.in"

Here,"#"atthebeginningofthelineexecutionwhenmakemenuconfigisinvisible.Here,wewillsource"package/panlong/Config.in"add
Tothenextmenu"PackageSelectionforthetarget",themenu,soweexecutemakemenuconfig

Figure7.2Buildrootmakemenuconfiginterface
FIGmakechoices,pressenter

Figure7.3packageselectionforthetargetsubmenuinterface

Page23
Youcanseewe'veaddedapackage.
Note1:Thesearejustademo,addasactualaddedtothesubmenutomanageinthepackage.
Forthekerneldrivershouldtrytoconsiderintolinux2.6.36/driversbelow,ifnotdirectlyintegratedwiththekernelmenuconfig,youshouldput
Inthelinux2.6.36/modulesbelow.
Youcanmenuconfigintegratedpackage,addingmethod,seekconfigrelevantinformation.
Menuconfigcannotintegratedwiththepackage,withmalimodulestobeaddedatanexample:

First,createasubdirectoryinthemodulesmalipackagedirectory,thenastheeditorofatotalpackageofmakefile,
Theremaybeusedfourparameters:
LICHEE_KDIR
:itisbuildrootandlinux2.6.36directorywherethelayer

LICHEE_MOD_DIR=${LICHEE_KDIR}/output/lib/modules/${KERNEL_VERSION}
KERNEL_VERSION=2.6.36android
CROSS_COMPILE=armnonelinuxgnueabi
ARCH=arm
Theseparametersaredefinedinlinux2.6.36/scripts/build_XX.shdefinedin(xxrepresentstheparameteryouchoosepaftercompiletime,suchassun4ietc.)
Aftercompletingmakefileeditors,inordertomaketheoverallcompilationsystemallowedtobetranslatedinto,theneedinthelinux2.6.36/scripts/build_XX.shfile
Thebuild_modules()functiontoaddmalipackagecompilationrules,andaddclearrulesclean_modules()function.(Specificallywrite
Methodcanbemodeledmali)
Ifyouaddtheitemisturnedonbydefault,soyouneedtoreplacethecorrespondingdefconfig.configfilewithedited.Assun4i,wecan
Inthe.configunderheavybuildrootnamedsun4i_defconfig,thensaveittoafolderunderbuildroot\configsfile
9.2binarypackages
Above,butignoredduringcompilation.Youcanreferencebuildroot/packages/mali3dorlinux2.6.36/modules/gps
9.3executablefile
Ifyouneedtoaddissomeoftheexecutablefile,orthelikeissimilarlscdcommand,youcanadddirectlytobuildroot\output\target(providedthat
Hasbeenfullycompiledonce),theinstructiondirectlytobinbin,sbinorunderusr,sbin,andotherexecutablefilescanbeaddedtospecifyinhope
Anyfolder.

10.Appendix
Appendix1.AboutUBoot
OurLicheeBSPhasbeentransplanteduboot,rununderbuildrootdirectory,makemenuconfig,thenBootloaders>choose
TheubootforSUN4I.Youcancompiletheuboot.Ifyouchoosetheuboot,ubootwillbepackagedtoolspackedintomirrorwhenpacking
In.Whenubootarepackagedinthemirror,itwillstartubootbytheboot1,uboot5secondsinthecaseofserialnoinputthenstartthekernel.
(1)ubootcanbepackagedintonandorsdcardstartup.
(2)Ifyoudonotwanttouseuboot,onlytocanceltheubootforthebuidrootofmenuconfiginSUN4I.Itwillnotbepackedintothemirror.

(3)ubootkernelbootparameterisnotcurrentlysupported.So,ifyouwanttosetthekernelbootparameters,enforcesthedefaultbootparametersinthekernelconfigura

Page24
Appendix2.Aboutsysconfig1.fexConfiguration

Thisfileisonthetargetboardfeaturesanumberofrelatedconfigurationfiles,someofthemodulesfeatureenabled,turnedoff,aswellassomesetparameterscanbemo
Thisfileimplements,currentlysysconfig1.fexconfigurationinstructionsandinstructionsongpiounderbuildroot/docsdirectory.
Appendix3.TheseconddevelopmentPrecautions
(1)CPUfrequencymodification
Inlichee\linux2.6.36\arch\arm\machsun4i\cpufreq\cpufreq.hfilehas2linesofcode:
#defineSUN4I_CPUFREQ_MAX
(1008000000)/*configthemaximumfrequencyofsun4icore*/
#defineSUN4I_CPUFREQ_MIN(600000000) /*Configtheminimumfrequencyofsun4icore*/
Herewedefinethemaximumandminimumfrequency,ifthemaximumandminimumvalues
tothesame,CPUwillnotbeautomatictuning.

(2)sdcardtoserial
Sometimes,inordertodebugneeds,youmayneedtouseanSDcardtoserialmodedebugging(serialnumberplateisnotdrawn),thistimeneedtorepair
Sysconfig1.fexchangeinthreeplaces
[Uart_para]in

Modifyago
uart_debug_tx
uart_debug_rx

=Port:PB22<2>
=Port:PB23<2>

Therevised
uart_debug_tx
uart_debug_rx

=Port:PF2<4>
=Port:PF4<4>

[Uart_para0]in
Modifyago
uart_debug_tx
uart_debug_rx

=Port:PB22<2>
=Port:PB23<2>

Therevised
uart_debug_tx
uart_debug_rx

=Port:PF2<4>
=Port:PF4<4>

Thesetwomodificationsactuallychangethemeaningisthesame
Sincethistime,sdcard0nolongerasastoragemedium,so
[Mmc0_para]in
Modifyago
sdc_used

=1

Therevised
sdc_used

=0

Ifyouwanttomodifythefirmwarepackageconfigurationrelatedinformation,refertosysconfig.fexandsysconfig1.fex2presentationfilesandrelateddocumentation
(2fexfileinbuildroot\tools\pack\eFexdirectory,relateddocumentationin\buildroot\toolspack\under\docsdirectory)

Page25
(3)I2CsecondarydevelopmentDescription(usedhereini2cbusmountgsensorequipment,forexample)
Whenconfiguredaccordingtotheconfigurationexampleoftheassignmentofthemodule,thekernelatbootprints:
gsensor:registeredbma250@addr0x18
Itindicatesthattheconfigurationinformationisnotwrong.
Iftheprint
gsensor_i2c_awxx_init:script_parser_fetchgsensor_twi_addrerr,err=errormessage4andthelike,indicatesthattheconfigurationproblem.
Errorerrornumberasfollows:
1Bufferisempty,therearenoscript.binfilemaybootfs
2NameisNULL
3ValueisNULL
4Notfindtheconfigurationitems
5Bufferinsufficient
Drivingpart
XXXX_NAMEnameofthedriverandconfigurationfilemustgsenser_nameitemcorresponds(includingcase),orcannotproperlyloadthedriver
staticconststructi2c_device_idxxxx_id[]={
{XXXX_NAME,0},
{}
}
staticstructi2c_driverxxxx_driver={
.probe
=Xxxx_probe,
.remove
=Xxxx_remove,
.id_table
=Xxxx_id,
.driver
={
.owner
=THIS_MODULE,
.name=XXXX_NAME,
},
}

Fortheabovebma250configuration,thereshouldbe
#defineXXXX_NAME "Bma250"
Ifgsensorcanprobetoprovethereisnoproblemofhardwareandsoftwareinterfaces,therestisgsensorcommissioningthedriveitself.
(4)spisecondarydevelopmentexample

Spihavetwokindsofkernelandusermode,whentheseconddevelopment,majorchangesmaybeopenedwheretheusermode(thedefaultisnotopenusermode),this
Toperformunderlinux2.6.36directory:
makeARCH=armmenuconfig
SelectDeviceDrivers

Page26

Figure1linux2.6.36makeARCH=armmenuconfiginterface
NextselectSPIsupport

Interfacelinux2.6.36Devicemenu2
USERmodespidevicedriversupportthataselectY(compiledintothekernel)/M(compiledasamodule)

Page27

Figure3linux2.6.36Device>InterfaceSPIsupportmenu
Aftercompletionoftheabovechanges,thecompilersourcecode,willbecompiledtogetherspikernelmodeandusermode.
Configurationchangesneedbuildroot\tools\pack\eFex\sysconfig1.fexdocumentfor[spin_para][spi_devices][spi_board0]thesekeys
Configuration.
Forkernelmode:
There[spi0_para]to[spi3_para]4subkeycorresponds,justfollowtheinstructionsontheassignmentto
Forusermode:
Thenumberoffirstspi_dev_numCI[spi_devices]keyfilluserlandunderspideviceinterfaces
Then[spi_board0]keystofollowtheinstructionsoftheassignment,ifspi_dev_num>1youneedtomanuallyadd
[Spi_board1]to[spi_boardn].
Currently,itdoesnotsupportfullduplexmodeandCSlevelconversion(bothbeingonlyselect0).
Appendix4.RelatedResources
makefilehelpdocumentation
http://www.gnu.org/software/make/manual/make.html
buildroothelpdocumentation
http://buildroot.uclibc.org/downloads/buildroot.html
Appendix5.Instructions
Currently,onlyA10EVBV11,A10EVBV12A,A10EVBV12B3thedevelopmentboard(butalsosupportavarietyofcustomerboards,false
Ifthecustomergpiosettinghasbeenmodified,youneedtomodifythecorrespondinggpioprovidedinsysconfig1.fexfile)

You might also like