Download as pdf
Download as pdf
You are on page 1of 17
sysrz019 {9.5 U-Boot: Chapter 9, Setting Up the Bootloader: Embedded Linux Systems: Linux systoms « eTutorals.7g ox Online Gantt From Zoho Looking for a MS Project alternative? Zoho Projects is both intuitive and compre! Home (i) Lieux systems (Linuxssystensi)/ Embedded Linux Systems (Linux! systemsiembeddedtinuxtsystoms) 9.5 U-Boot {As [said eater, U-Bootis arch documented bootloader, The README fie inchided wis the package, for example, covers he use of U-Baot extensively. Among othe things, discusses the package's source cede layout, the avalable build options, UBoct's command set, andthe typical {environment variables used in U-Boot. Inthe following, Iwi cover tho essential aspocts of U-Boat and prove practical examples ofits use. An in-depth dscussion of U-Boot would, however, require a book ots own. Fortis oason, | encourage you to print a copy ofthe README provided wih U Boot and have a look atte oxher documentation writen by the project maintanee 9.5.1 Compiling and Installing Start by downloading and extracting the latest vors.n ef U-Boat n your S{PRIROOTootir sérectory. As ofthis wring, the latest U-Boot version fs 0.2.0. Once extracted, move tothe package's rectory $ ed HPRIROOT}/bootde/u-boot-0.2.0 Physical RAM and Flash Location he board used inthe folowing explanations has 16 MB of RAM and & MB oflsh, The RAMs mapped from address 00000000 to .adraes XO0FFFFFF, and the fash is mapped from acdress 0x40000000 to adrets Ox{07FFFFF. The documentation provided wit U-Beoy| cusses is use ofthe prysical memory of targets hp otutoials.orgLinuxtsystomslombeddedinux*systoms/Chapior+8.+Selting+Uptthe+Bootloader/8.5+U-Boot wr sysrz019 {9.5 U-Boot: Chapter 9, Setting Up the Bootloader : Embedded Linux Systems: Linx systems « eTutorals.org Before you can build U-Boot, you need to configure ior your target. The package includes a numberof preset configurations for quite afew boards. So. a configuration may vory well exit fr your target alady. Look athe README filet eo i your board is supported, For each supported board, U-Boot® Makefile chides @ BARD_NANE_conf ig target, whichis used to configure U-Boot's bull for the designated board. The configuration target for te ‘TOMBOL board | use for my control module, for example, is TQ*BEAL_config. Ones you have determined the proper Makefile target to use, configure U- Boots build process: 5 make TONBGEL_config Now, build U-Bocr: make CROSS_COMPILEspowerpe-Linuxe In aditon to generating bootloader magee, the build process wil compile 2 few tools tobe used on the host fer condoning binary images before owntoacing them of othe target to arunring U-Boot. Table 9.2 lists the fles generated during U-Boots compilation Table 0-2, Fes generated during U-Boat: compilation Filename Description System map JThe symbolmap ‘boot (U-Boat in ELF binary format ootbin (U-Boat raw Binary mage thal can be wit fo the boo! slorage device ‘books (F-Boot image n Motorlas S-Rocord format ‘You can now download the U-Boat image onto your target's boot storage device using the appropriate procedure, M you already have U-Bact, or ona its ‘ancestars (PPCBo0: or ARMBcat) installed on your target, you can use the installed copy to update U-Boot to a new version, as we shall se in Section 95.10. you have another bootloader installa, flow the procodures descr'bed in hat booleadars dacumenlaton for updating boolleaders. Final f you have no bootloader whalsoover installed on your large, you need to use a hardware programming device, such a lash programmer ot 8 BDM debugger, to copy U-Boat to your target Whichever method you use to copy the actual bootloader mage to your target, make a copy ofthe relevant bootloader images to your $/PRUROOTImages ‘rectory. For my contol module for example, | copy the images a9 ‘allows: 5 ep Systen.aap ${PRDROOT}/Inages/usboot.systen-napet.2. se youintond to debug U-Boot isl, copy the ELF binary als: se boot ${PRIROOT)/images/u-boot-0,2.€ Fal, instal the host ool generated by the U-Boot bul 5 ep tools/netnage ${°REFTX)/0in 9.8.2 Booting with U-Boot ‘Once U-Boots properly installed on your target, you can boot t wile boing connected ‘othe trgol through a Soria ine and using a trmnal mutator to Interface with the target. As sai in Chapter 4, not all teminal emulators interact clearly wit ll bootloader. Inthe case of U-Boot, avoid using minicom for fle transfor, since probloms may occur dung such tansfrs. Here is & sample boot output for my contol module: Ustoct 0.2.8 (Jan 27 2803 ~ 28:20:23) eu: yOcaoenzPonb) at 8 Mla: 4 Kb T-Cache 4 KB D-Cache FEC pre Board: ToN@6eLO8@A3-T80, 203 Push: 8 mo oust serial Hit any key to stop autoboot: 5 ‘np Hetutorals. org inuxtsystomslombeddedslinux+systoms!Chapier+8,+SelingUptthesBoctloader9 5+U-Bool air sysrz019 {9.5 U-Boot: Chapter 9, Setting Up the Bootloader : Embedded Linux Systems: Linx systems « eTutorals.org ‘As you can see, U-Bo0t prints version information and ten provides some deta regarding the hardware itis running on. As goon ast boots, a five second limor stats ticking at the last output in, I you do not press a key during those ve seconds, U-Boct boosts default configuration, By pressing a key, you get prompt (One ofthe frst things you probably want to ty i obtaining help from U-Boat 2 hep askew ~ get environment variables fron stdin utosen = run serdpe fron nerory base = print or sev address offset bingo. print board Info structure bootn boot application sage fron menory boots = boot inage via network using SeotP/TFTP protocol bootd = boot default, A.e., run "boatems erp = menory compare Coninfo - print corsole devices ard inforrations ep senory copy crea? = checksun ealeulation date get/set/reset date & tine ‘thep— Snvoke OX? client to absain 1P/o008 parans ‘diskooot boot from IDE device ‘echo echo args to console frase erase FLAS! nanory SLinfo. ~ print FLASH wanory anformstion go. = start application at accress ‘azde help = print online nelp Ade IDE sub-system fninfo = print header inforeation for application Snage loade~ doed bérary fle over sertal Line (kermit noce) loads ~ aoad S-Record File over serial Line oop - Snfinite loop on address range ns enoryaisplay rm = nenory nodify (auto-increnentina) rest staple saw cost m= memory write (411) fe enory modify (constant adress) Dprintenv- print enviroment versables protect = enable or disable FLASH write protection Farpooot- boot image via network using RAB2/TFTP protocol reset - Perforw RESET of the CPU run = run comands in an environnent vardable {aveeny ~ save environtent variables to persistent storage sevew = set environment varsables Slees) > delay execution #0 sone tine ‘fepeoat boot inage via netvork using TF1? protocol ana en variabies ipacer and servers version ~ print monitor version PUT pisse for *nelp [As you can sue, U-800t has alot of commands. Fortunately, U-Bo0l also provides per-command he: = help ep © (.b, ay <2] source target count When U-Boot appends the [.b, .w, .1] expression toa command this means that youneed!to append one ofthe indicated sbings tthe command to invoke the desir version ofthe command. In he caso of cp or example, there are thre versions, cp, ep.w, and ep for copying bytes, words, and longs, rospectvaly. U-Boots viet nits argument parsing. expects most values to be provided in hexadecimal fo. In the case ofthe cp comand, for example, this means that he source address, the target adcress, and the byte count must be provided in hexadecimal values. You dat need to prepend or append those values ith any sort of special characters, suchas "Ox" or", your source adress is Cx40000000, fr example, simply ‘ype s0ead00, U-Boat accopts any unique subso of charactors thal starts @ command nam. If you want to use the erase command, for examplo, you can typo just th fst ttroe ltrs, ra, since erate i the only command to star with those tree fst eltets. On the ater hand, ou can" ype lo ané expect U-Beot to understand Iino there are thee commands that stat with those letters: load, loads, and lop. 95.3 Using U-Boot’s Environment Variables ‘np Hetutorals. org inuxtsystomslombeddedslinux+systoms!Chapier+8,+SelingUptthesBoctloader9 5+U-Bool ane sysrz019 {9.5 U-Boot: Chapter 9, Setting Up the Bootloader: Embedded Linux Systems: Linux systoms « eTutorals.7g ‘Once U-Boot is up and running, you can comvigure it by seling the appropriate envionment variables. The use of U-Bool environment variables is very iil tothe use of environment variables in Unix shells, sue as bash, To view the cuctant values of the error variables on your target. use the pinteny command. Hoe isa subset of the environment variables found an my control module padde=192.268.172.18 stdoutesers Enviroment size: 791/16380 bytes Each environment variable has a diferent meaning. Some environment variable, such as bootdelay, sertalt, of Spaddr, have predetermined uses that ‘are recognized by U-Boot itsel, See the README Mile for a comoletedscussion of U-Hoots envionment variables and the meanings, ‘As with Unix shells, you can add environment variables in U-Boot Todo so, you must use the sstenw command. Hers isan example session where | add a few envenment variables fo my contol module (he third command must be anered asa singe line, even though it appear broken onthe page) 2 setenv rootpath /hone/aria/etriereot s > setenv kernel_adar 49190008 = setenv nfsend setenv boctargs reot=/dov/afs ow nfsroote\$(serversp):\S(reotpath) p-\$ pader) :\S(serversp):\S(gatevayi):\8(netmask) \$(hostnare)::ofF panic=t\; boote \$(kernel_addr) setenv bootend Fun nfscnd In this cas, | set U-Boot oboct from the Kernel found at Ox40100000 and to mounts root lesystem using NFS. Notice that | used the \ character to tll U ‘Boo! that tho character folowing \ shoul no be interpreted as a special charactor. This is how the rfsced bok Ike, fr example, aor U-Boot has read it nfs2endeseteny bootargs roate/dev/nts ra nfsraotes{serverip):$(roetpath) sp-$(spader):8(serverip) :$(gatevayip) (netmask) :$(hostnane)::0f¢ pan‘e=tbootn (kernel acer) ‘The selon command ads the environment variables to the Curent session only Hence if you reset the system, ary environment variable you set only with soteny willbe lost, For the environment variables lo survive reboots, hey must be saved to lash, Ths is done using the saveeny command: Unprotected 1 sectors done Weiting to Flash... done Be careful when using saveony, since it wil save al the environment variables currently tind, even those you may have been using temporary. Bofre sing saveen, use pinion to take a look a the currently defined environment variables to make sure you are saving only the necessary variables, M you want to daete@ variable, smply use setenv onthe variable wthout providing any values. Here's an example printeny RAWDISK_adde Note thatthe « character not teated as a speclal character by setenv. In fac, Is seen as another character in the sting making up the environment variable, as we saw earler in :his section. Te following command, fr example, Is flawed (notice the extra = clsplayed by prntenv in comparison tothe same printonv snow inthe previous capture) hp otutoials.orgLinuxtsystomslombeddedinux*systoms/Chapior+8.+Selting+Uptthe+Bootloader/8.5+U-Boot ane ssr2019 {95 U-Boot: Chapter 9, Setting Up the Bootloader: Embedded Linux Systems: Linux systems: eTutorls.7g 9.5.4 Creating Boot Scripts U-Boat environment variables can be used to create boot scripts. Such bool srpts ar actually environment variables containing a st of U-Boat command ssequoncas. By using a combination ofthe run command and te ;(somicolon) operator, you can make U-Boot run boot scrips. The onviormant variables set inthe previous section for instance, sre actualy pat ofa boot sort, msc, The Koy tothe way the serio | provided inthe previous section works f the bootcnd environment variable, This variable recogrized by U-Boot a the script to run automstcally when the system is bootes, | set this variable as run nfscnd, In athe words, U-Boot should run the nfs script to hoot the system, In tum, his environment variables gt of commands of is own. Fs, it sols the boatargs environment variable, which U-Boot passes tothe em as ts boot parameters, and tren uses the boatm command!to boot the kernel locate at $(kerne!_add). The semicolon separates commands. The so ofthe $(VA@_NAME) operat ols U-Boot fo rplace the entre sting wits the valu o the VAR_AANE eavironment variable. Hence, when nFscne runs, $0 the ret ofthe environment variables included in nfscnd are replaced by their respective values, ne_addr) 1s replaced by 49109800, which s the value | set earler. I the same way, $(rootpath) i replaced by /hone/karin/etr-roots, and Though it would have been possible o set bootcnd fo contain the ete boot script instead of using run nFscnd, would have been much harder then to spaciyallemative boot scrips at he boot command in, By using the run command nthe boated script, multiple boat scrips can coexist within U-Boat’ ‘environment varables. You can then change the system's default boot using => setenv bootead run OTHER g007 SCRIPT ‘Oryou can run boot seins creel Fam the commang line without changing the value ofthe booted environmect variable ‘Scripts area very uso feature of L-Boot and you should use them whenever you need to aulomate a certain task in U-Boat, 9.8.5 Preparing Binary images ‘Since the raw flash isnot sructured tke a flsystom and does not contain any sort of Te headers, binary images downloaded tothe target must cary headers for U-Boot to recognize thelr content ang understand how to oad them. The mkimage uty we installed earler was packaged wth U-Boat fr this purpose, It ad te information U-Boot nes to binary images while attaching a checksum for vericaion purposes, Wine the ue of mage hear no tetra requirement fo boctndey, uch hears are very convenient ng develpment andthe ald Hence, ther us by UB To S00 the typical use of mkimage, type the command without any parameters: $ mkinage Dis => Mist image heacer information 4 data_ftle(sdata_ -A ppe -0 linux -T kernel -¢ grip - e0eeea00 -c 00000008 \ > od valtrun-2.4.28.g2 vmlinux-2.4.18. tng nage Wane: 2.4.18 Contre] Nodule Image Type: PowerPC Linux Kernel Image (eztp compressed) hp otutoials.orgLinuxtsystomslombeddedinux*systoms/Chapior+8.+Selting+Uptthe+Bootloader/8.5+U-Boot snr sysrz019 {9.5 U-Boot: Chapter 9, Setting Up the Bootloader: Embedded Linux Systems: Linux systoms « eTutorals.7g ‘The command takes qule afew fags, but ther meaning is easly understood by looking athe usage message provided by mkimage. Note thal the name of ‘he image, provided inthe -n option, cannot be more than 32 charactors. Ary excess charactrs willbe ignored by mkimage. The res ofthe command line tell mkimage that this is a gzipped PPC Linux kernel image that shouldbe loaded at address 0x00000000 and started fom that same address. The image being provided in inputs vminux-2 4.18 gz and the U-Boot formatted image will be output to vmlinux 4.18mg. RAM disk images can be processed ina simlar fashion: $ wktnage -r “RAN ask” > -A ppe -0 linux -T randisk -¢ grip \ age Wane: RY cisk rage Type: Power? Linux RAMDisk Image (@zip compressed) In this caso, to number of paramotersisshorto, since we dort neo to specily start and load acrosses. Note thatthe mage ype has changod to rondiss, We canals erat colon separator 1 nu2ti-type image that combines both the kere! image and a RAM cisk. In that ase, the fs included are listed sequential using a S$ weinage “Ape -0 Linux -T multi -c gzip -2 e2e0000e -e oooeeeee \ > <4 valinux-2.4.18.gzzinitra.bin \ > wmlinge-2.4.48-inited. tne Tage Type: PowerPC Linux Multi-File Inage (gzip compressed) load Address: oxe50@200e fEnzry Point: exeseaedee Tage 0: 530790 aytes = S16 Kb = 9H ‘Once you have prepared an image with mkimags, tis ready tobe used by U-Boot and can be downloaded tothe target As well se below, U-Boot can receive brary mages in a numer of ferent ways. One way sto use images formated in Motorola's S-Record format you intond to use this formal, you need to further process tne images generated by mkimago by convoring thom tothe S-Record format. Here s an example conversion of the ault3-Ypo Image gonerated above 5 powerpeslinux-objcopy =I binary +0 sree \ > wainge-2.6.6-initrd. ng valinue-2.4.28 9.5.6 Booting Using BOOTPIDHCP, TFTP, and NFS IW you have propery configured a server to provide the fargot wih DHCP, TFTP, and NFS service, a Vexplained earlier, you can boot your target remately ‘Back rom U-Boots prompt on my contol module, here is how 1 boot mi target remotely, or example => bootp Diep client bound to address 192.368.172.30 ‘Tere fron server 192,168.172.50; our IP address is 192.168,172.10 Fienane "one/karin/valinun-2-4.18. ing load address: oxz00000 Loading: Aveneanassmumuevvvesengagannnevovuvesesnyaaennnen Bytes transferred = 530854 (51026 hex) The boolp command issues a request thats answored by the DHCP saver, Using the DHCP server's answer, U-Boot conics the TFTP server and obtains the wmninux-24.18.ng mage fle, whieh I places at address 0x00100000 in RAM, You can very the image's header Informaton using he innfo comman hp otutoials.orgLinuxtsystomslombeddedinux*systoms/Chapior+8.+Selting+Uptthe+Bootloader/8.5+U-Boot ene ssr2019 {95 U-Boot: Chapter 9, Setting Up the Bootloader: Embedded Linux Systems: Linux systems: eTutorls.7g nage Type: PowerPC Linux Karel Tnage (g2Sp compressed) Verifying Checksum... 06 ‘As you can see, the Information prted out by imo on the targets very smart that printed ou onthe host by mkinfo, The O« sting reprte for the checksum means thatthe image has been downloaded propery and that we can boot it nage Type: PowerPC Linux Kernel Tnage (€2ip compressed) Verdfying Checksum... 0€ Linux version 2.4.18 (kardngTsotihuscan) (gcc version 2.95.3 29810315... zone(@): 4096 pages rone(3): © pages. rone(2): © pages. ‘éoRebooting in 188 seconds. In this case, the kemel panies because i's unable o fina any roc flesystem. To solve this problem, we must use the environmen: variables 1 create @ boot script for passing appropriate boot options to tne kemel. The folowing commands create a new boot scrip, boots, and modi the special boot ce sofipl a8 wo din Section 8.5.3, n order forthe system to boot using BOOTPIDHCP, TFTP, and NFS: => setenv bootpnfs boota\; setenv kemel_sdér 06100000\; run nfscrd = printenv bootend In this caso, tho bootpnts script automaticaly executes the boot instruction we used earl in ths section to oblain a kernel rom the TFTP sever. thon ses the nfscad scrip we created in Section 85.3 to boot this Kernel, The value of kere|_addr is changed so thatthe rfscnd sep: would use the Kernel loaded using TFTP, not he ane located at 40100000. you us the boot command now, U-Bo0! wll boot ently from the network. twill download the kere rough TFTP and mounts oot lasystom on NFS. 1 you woul the to save the envronment variables we just set se the saveen command before rebooting the systom, otherwise, you wil have sel the ‘same variables again atthe next reboot 9.5.7 Downloading Binary Images to Flash ‘Booting from tne network is ne for early development and testing. For production use, the target must have its kemel stored in fash. As we wll see shel, there afew ways to copy a kerel rom the host the target and store tt lash Before you can copy any kemelimage, however, you must frst choose @ flash region to store it and erase the fash region forthe incoming kernel, Inthe case of my control module, |store the defau kermel between 040100000 land 0x40 FFFFF. Hence, from U-Boot's prom, lease this region Erase Flash fron exaei to oxaenttes hp otutoials.orgLinuxtsystomslombeddedinux*systoms/Chapior+8.+Selting+Uptthe+Bootloader/8.5+U-Boot mr sysrz019 {9.5 U-Boot: Chapter 9, Setting Up the Bootloader : Embedded Linux Systems: Linx systems « eTutorals.org ‘The simplest way to instal a kernel inthe target's lash i to frst download it into RAM and then copy tt the Nash, You can use the ktpboot command to dowrloa a korol rom tye ost to RAM. => tftpboct 90180800 /hone/karin/valinix-2- 4.18. ‘ap broadeast 2 {TTP from server 192,168.172.505 our IP address Se 392.268.172.10 Fienane "oe karia/vilinun-2-4.28. ing" load address: oxae0000 Loading: seneanasnmnuueesueceennnonnnndeuuvetesssanennnon done fytes transferred = 530854 (61536 hex) \Whon ttpboots un, lads the FLIesize environment variable fo the exsting environment variables and sos ito the size ofthe fle downloade: <> printeny Fiertze ‘Hilesizesti9es You can use this ervronment variable in subsequent commands to avoid yping inthe fle size by hand Don't frgel to erase this environment viable belore saving the environment vatables, off, to, willbe saved. In aditon to taboo, you can use the loach commana to download images tothe tra => todo o6100000 | Ready for binary (hermit) download ‘Atthis point, U-Boat suspends and you must use the terminal emulator onthe host to send the image fle othe target In his case, U-Boot expects to download the data according tothe hermit binary protocol, and you must therefore use Kermit to download binary rage to U-Boot, Once the transl is one, U-Boot wll output ‘te Total Size = ox0u9si996 = 520854 aytes fw start acér = exgona9080 Hove, 100, U-Boot will gat the FS les ize envionment variabe tothe size ofthe fe downloaded. As we did eat, you may want to use the iminfo command to vorfy tat the image has been properly downloadea. ‘Once the images in RAM, you can copy ito ash = ep. o0r00000 aor00000 $(F4estz0) Copy to Flash... done = Sek ces00000 4 cneceing Image ¢ ce109900 Inage Wane: 2.4.18 Control Module created: 2093-92-85 19:29:08 UTC Inage ype: Power? Linux Kernel Insge (gzip compressed) Data size: 530709 aytes = 518.3 8 entry Poinc: e0800000 Verstyng Checksu =... 0€ ‘Atornatively, instead of downleading the image to RAM frst using ptboot or loadb nd then wing ito Mash, you can download the image dctly to Mash Using loads. In this case, the host eends the imoge te the target in S-Recerd forme. In comparison tote two previous methods, however, downloading an S- Record fies extremly slow, In most cases its referable to use ilpbooto load instead '®1The loadb command and, by default the ttpboot command can't be used to download direcly to flash. Though Us Boot can be configured at compile time to allow direct flash download using tftpboot, direct flash download using loadb is not supported, ‘To downloas $-Recor les, you will nee fo use the eu terminal emulator to transfer them tothe target, because the other terminal emulators don't interact propery with U-Boot when downloading his sort of le. When connected through cu, use the folowing commands ‘np Hetutorals. org inuxtsystomslombeddedslinux+systoms!Chapier+8,+SelingUptthesBoctloader9 5+U-Bool ane ssr2019 {95 U-Boot: Chapter 9, Setting Up the Bootloader: Embedded Linux Systems: Linux systems: eTutorls.7g vm inux-2-4.38,srec comected] fr start Addr > exeae09080 ‘The => sing shown heres actually part ofthe input you have to type. is actually the cu command vsed to inate fle download, Asbetore, you can vary the Image ono i's in memory: si checking Image at ces00000 nage ype: Power? Linux Kernel Inage (gzip compressed) Data size: 530799 aytes = 518.3 13 Entry Point: e28ee009 [Every ime you want o load anew image ta lash, you have o start back atthe erase command shown in ta beginning ofthis section. 9.5.8 Booting Using a RAM Disk ‘The fet slep in booting tom a RAM disk is to download the RAM disk rom the host and install onthe target's lash, Many ofthe commands are the same 8 those show ane explained in previous sections Here i how | do this fr my conta medul: hp otutoials.orgLinuxtsystomslombeddedinux*systoms/Chapior+8.+Selting+Uptthe+Bootloader/8.5+U-Boot snr ssr2019 9.5 U-Boot: Chapter 8, Setting Up the Bootloader => tftpboot 90100000 /hone/karia/Anitré. boot Flenane "he karin/ initrd. boot bytes transferred = 470552 (72618 hex) => det 0200000 created: 2003-02-05 19:20:35 UTC Tnage Type: PowerPC Linux RDisk Inage (gzip compressed) Data size: a7edss aytes = 459.5 18 Veestying Checksum =... 0€ © printeny filesize done => ep. 86200000 40709000 $(¢sIes820) Copy to Flash... done Image Wane: MY disk mage Type: PowerPC Linux RIMDISk Inage (Bz:p compressed) verifying Checksun «Of Embetided Linux Systems Since Lhd aeady installed kernel, Ican boo: the kernal available in flash with the RAM dlsk ust installed Linux systems «Tutorials. hp otutoials.orgLinuxtsystomslombeddedinux*systoms/Chapior+8.+Selting+Uptthe+Bootloader/8.5+U-Boot son7 ssr2019 {95 U-Boot: Chapter 9, Setting Up the Bootloader: Embedded Linux Systems: Linux systems: eTutorls.7g nage Type: PowerPC Linux Kernel Tnage (gzip compressed) Verdfying Checksun =. 06 created: 2003-02-05 19:20:35 UTC nage Type: PowerPC Linux RADisk Inage (g2ip compressed) Data size: a7eass aytes = 459.5 18 Veesying Checksum =... 06 Loading Roncisk to @@¢2c868, end eofsecdd ... 0k Linux version 2.4.28 (karingTeatshusean) (gee version 2.95.3 20918 one(0): 4096 pages one(1): @ pages one(2): 0 pages. Decrenenter Frequency: soeoeee RANDISK desvor Enfelalized: 16 RAM claks of 4096K size 1026 blocksize VES! Haunted root (ext? filesystem) Here, 00, we can use envionment variables ta automate the booting process, Aso, nstad of using separate images forthe kernel andthe RAM disk, we could use a single image conianing both, such a the one we created in Section 8.5.5. As Isai ear, U-Boot is vary floxble bootloader with many possible configurations. Though we cannot hope to cover als possiblites here, fal ree to exparmant with U-Boat to oblan the setup that suits you best. 9.5.9 Booting from CompactFlash Devices Before booting @ kernel tom a CF card using U-Boot, you need to properly pariton and populate the CF card. Use past or fei to partion the CF device, depending on your host. Since U-Baot does not recognize any disk flasysom, you wil ned fo create afew smal parlions told raw binary images and Cone large pation o hele your root lesystem, as | explained in Chaptor 7 Fr my control module, for example, lused @ 32 MB CF card on which | erated tes partons using feek: wo 2 MB partion fo hold one stable Kernel and ‘one exoerimentalkemel, and one 30 MB partion to hold my root lesystem. To copy the kernels to thelr respective partons, | used te command: 6d fovminux-2.4.18-ing of /dev/ scat reenpting of=/dev/sda2 ormattes fdovésda9 using mke2Is, mounted it on mnt, and coped the root flesystem tot using the lochniques described in the previous chapter ‘Aer |ingrted the CF eardin the PEMCIA por using @ CF-o-PCMCIA adapter, here was the output of U-Boat at startup: hp otutoials.orgLinuxtsystomslombeddedinux*systoms/Chapior+8.+Selting+Uptthe+Bootloader/8.5+U-Boot sir ssr2019 98.5 U-Boot: Chapter 8, Setting Up the Bootloader: Embedded Linux Systems U-toct 0.2.8 (Jan 27 2083 - 20:20:21) Board: TQHR60\DB0K2-TH9.263 [ss2ieon] [unique] [singte) [steep] [standby] (4ale] [ow power Typer Rerovable Hard isk Capacity: 30.6 Mi ~ 0.0 cb (62720 x 542) His any key to stop autoboot: 5 Linux systems «Tutorials. U-Boat ides the storage cevice a startup. U-Ba0t provides a wide range of ide commands for manipulating IDE storage devices. You can see hess ‘commands by typing the help command ae ae ae reset 106 controller device [¢ev] - stow or set currert device part [dev] ~ print partitson table oF ene or ail IDE devices ead aden blk ent Werte oder biRH eat ~ reas/anste to/from nenory acéress “addr \We can further use U-Boat’ commana tne to get more information regarding the device: Ths command reads the partion table ofthe CF davice and prints out, ln this casa, the pation printed out by U-Boot is the description provided ear, Loacing a kemel mage rom one ofthe partons onthe CF device is done using tne éskeoct command, This command takes wo arguments the adres ‘here the kemelis tobe loaded and a partion dente. The later isa concatenation ofthe device number and the partion number on that device ‘separatod by @ colon, Tis is how loa the kernel image fourd on parton 1 of device Oto address 0x00¢00000: Loading fron I9E gevice 8, partition 1: Rane: nos Image None: 2.4.18 Contcol Module ‘nage Type: PowerPC Linux Karel Tnage (gzip compressed) => se 60400000 ‘checking Image at c0age00e Created: 2603-92-05 19:29:08 UTC nage Type: PowerPC Linux Keene Tnage (gzip compressed) Data size: 530790 sytes = 518.3 1 hp otutoials.orgLinuxtsystomslombeddedinux*systoms/Chapior+8.+Selting+Uptthe+Bootloader/8.5+U-Boot vonr sysrz019 {9.5 U-Boot: Chapter 9, Setting Up the Bootloader: Embedded Linux Systems: Linux systoms « eTutorals.7g ‘Once the kernels loaded, you can wee the bookm command to boot thal kernel, This can ao be automated by elting the sutostart environment variable to yes. In that ease, diaxoact wil automaticaly boot the kernel loads © setenv autostart yes = disk 0490000 8:2 Image Type: PowerPC Linux Kernel Inage (€2i9 compressed) Data size: 530799 aytes = 518.3 13 Entry Point: e2eee009 4 Booting image at 20420000... created: 2603-92-05 19:19:08 UTC nage Type: PowerPC Linux Kernel Inage (gzip compressed) Data size: 530790 sytes = 518,31 Uncorpressing Kervel Image «+» Of Linux version 2.4.18 (earingTeo ‘As wo did in Section 95.3 an Section 9.56, you can serp the bootup frm te CF device by seting the appropiate U-ool environment variables, Alo, you wish, you can write fo the disk directly from U-Boot using the ide wre command, Have ook atthe help ouput and the documentation for more information regarding the use of U-Boo!'s IDE capabites. 9.5.10 Updating U-Boot -Bootis ke any otter open source project continues to evolve overtime as contrutons are made and bug fxes are inograted tothe codebase, Consequently, you may feel the need to update your targets fmuare version. Fortunately, because L-Boot run from RAM, fan be used to undate tl Essontally, we have to download a now version to the target, erase the ol frmware version, and copy the new version overt £235 THE 125 CANTON F ‘There aro obvious danger o this operation, because 2 mistake or a power flue willrondor the target urbootable, Hance, utrost caution must be used when carrying out the fllowing stops. Make sure you have a copy ofthe orignal bootloader you ave about replace so that you can at eas al back to a known working version. Aso, soiously Consider avoiding tho replacomont of your ‘umwaref you have no hardware means to reprogram the arge's Tash fhe upgrade falls, Kyou do not have access to @ BOM debugger o lash programmer, for example, there Isa great 76x that you willbe left with a broken system fone ofthe following stops fails. Dealing with bugay sofware is one thing; ending up wih unusable hardware is ancther. ‘once you have taken the necessary precautions Gowrie the U-Boat image into RAM using TFTP: ‘tp 00200000 /home/sarin/u-boot.bin-0.2. Filename "/hone/karin/s-boot.bin-8. 2.0 aytes transferred = 166532 (2Aa84 hex) you de not have @ TFTP server setup, you can also use the terminal emulator to send the image: 4H Ready for binary (Rernit) dounosé Unike other images we have downloaded to he target, you cannet use the imi command to check the image, since the U-Boct image downloaded was not packaged on the host using the mkimage cammand, You can, however, use or2 before and ater copying tha image to flash overly proper copying hp otutoials.orgLinuxtsystomslombeddedinux*systoms/Chapior+8.+Selting+Uptthe+Bootloader/8.5+U-Boot san7 sysrz019 {9.5 U-Boot: Chapter 9, Setting Up the Bootloader: Embedded Linux Systems: Linux systoms « eTutorals.7g "Now, unprotect the lah region where U-Boot is located so you can erase i in his ease, U-Boot occupies the lah region from 040000000 to ox4003F FFF) => protect oFF 40900000 6963FFFF Erase the previous bootloader image: Copy the new bootloader to its final destination => €9.2 00200000 40000000 $(FLesiz6) Copy to Flash... done Erase the Filesize environment varable set during he downloas ‘Save the envionment variabas: Unprotected 1 see done Writing to Flash... dene [Athi stage, the now bootloader image has boon Insaled and is ready to be used. Untl you issue he reso command, however, you can sill use the olé U- Boot curently running to fh any probloms that may have occured during the update. Once you are satisfied that every step ofthe update has gone though cleanly, you can go ahead and resi the system: toot 0.2.8 (Jan 27 2083 - 20:20:23) Board ToMso0LDbeK3-T89.203, It you can see the U-Bost boot message again, U-Boat has been successfully updated, Olverw'se, there has been a problem withthe replacement ofthe firmware and you need to reprog’am the fash device using the appropr ate hardware too. ‘Sometimes, kecnel images that uted to boot with the older bootloader version wl fall to boot with newer versions. When upgrading from a PPCBoot version prloro 1.0.5 to Version 1.05 Fle, for example, kemels prot to 246-o166 may fl to bool. In hat case, the reason beni th problem i inthe way U. ‘Boot pases the clock speed tothe Kemel. Pir to kernel 245-9765, kemels expected to receive the speed in MHz, while ater kernels expect to receive the ‘speed in Hr. To his end, PPCBo9t 1.0.5 passes the clock speed to keels in Hz. Kemels that expec 10 receve itn MHz, however, flo bot. In practice, the boot pocess wil starts i would normaly, but the system wil reeze ght ater U-Boat fishes uncompressing the images for startup. You wll theretre, see something te hp otutoials.orgLinuxtsystomslombeddedinux*systoms/Chapior+8.+Selting+Uptthe+Bootloader/8.5+U-Boot vanr sysrz019 {9.5 U-Boot: Chapter 9, Setting Up the Bootloader : Embedded Linux Systems: Linx systems « eTutorals.org [Notting willbe ouput after that, and there willbe no responées fo any input rom the terminal. To soe the prob, you need I el the newer version of U- ‘Boot to keep passing th clock speed in MH fo the older Kom, Tiss done by soting tho clocks_in_ahz environment variable to 4 “> setenv clocks inne 2 “Though this sort of problem does not cur for every upgrade, changes nthe kemel sometinesrequtesigiicant changes tothe tools that interface it it. {Given that such proslems are dificult to igure out you are not involved in the actual evelopment af each project | strongly encourage you to keep in ‘ouch rth the est of the U-Boct users ay subscribing tothe U-Boot users maling lst rom the projects we site an to reac annauncemerts of new versions carol, ‘np Hetutorals. org inuxtsystomslombeddedslinux+systoms!Chapier+8,+SelingUptthesBoctloader9 5+U-Bool ssi sysrz019 {9.5 U-Boot: Chapter 9, Setting Up the Bootloader : Embedded Linux Systems: Linx systems « eTutorals.org Comments tutorials @ Login ~ Recommend § — iwest —F Share Sortby Best ~ @ sein tne discussion. toomwa on sion uP wi oraus @ Name [André Balen“ 4 mont 690 ‘An excallont introduction to wboot, thank you very much! 2A v + Reply » Share» guest 3 yous a0 Really very helpful and clearly explained! =) AY + Reply» Share» Guest 4 yeas 90 \Very nice instruction, clearly organized, Thanks! AY + Reply» Share Arun years 3g0 Compact and clear explanation . Thanks I AY + Reply» Share auect 5 yeas a0 vory very..useful AY + Reply» Share Guest +6 year 290 Great examples. Really helpful. Thanks for posting! AY + Reply + Share 0 +7 years en0 Thanks! So helpfull, AY + Realy» Shere hajapasha +7 years ano Good Notes Ard It Is Very Help AY + Realy» Shere» 2 sutserde © aaa vsque to yourstends oequsnte & Dinque' Pvacy lJlutrials.org/Linuxtsysterns/omboddedstinux+systoms!Chapler+8.+Selting+Uptthe-Bootloader!95+U-Bool! ser sysrz019 {9.5 U-Boot: Chapter 9, Setting Up the Bootloader: Embedded Linux Systems: Linux systoms « eTutorals.7g [8uitsing Embedded Linux Systems (/Linux systers/embedded +inuxt syst [dedication (/Linux+systems/embedded+linux+systems/Dedication/) [Preface (/Linuxs-systems/embeded linux +systerns/Preface/) [Chapter 1. Introduction (/Linwc+systems/embedded +linuxtsystems/Chapter+1-+ntreduction/) EXchapter 2. Basic Concepts (/Linux -systems/embedded linux systems/Chapter12.+ Basics Conceots/) [Chapter 3, Hardware Support (/Linux-systems/embedded- Hnux+systems/Chapter+3.+Hlardware+ Supper) [B)Chapter 4. Developmert Teals(/Linuxssystems/ embedded +liux-+systems/Chapter+4.+Develepmen:+Tocls/) [ExChapter 5. Kernel Consicerations (/Linux-systems/embedded-linux+systems/Chapter+5.+Kernel+Consideratons/) [B)Chapter 6, Root Flesystem Content (/Linux-+systems/emoedded+linux+ systems/Chapter+6,+Root+Fllesysten+ Content/) [Chapter 7, storage Device Manipulation (/Linux- systems/embedded Hinux systems/Chapter+7.+Storage+DeviceFManipul [Chapter 8, Root Flesystem Setup (/Unuxtsystems/embedded-+linye+systems/Chapter=8 -+Root-+Fllesystem+Setup/) Exchapter 9. Setting Up the Bootloacer (/Linux+systems/embedded linux +systems/Chapter+9.4Setting +Uptthe Bootloader/) 119.1 Bootloaders Galore (/Linuxtsystems/embedded-inux#systems/Chapler+s.+Setting=Up-ne+Bootloader/9.14Boolloaders+Galore/) [19.2 Server Setup for Network Boot (Vlinuxesysters/embedded=Inux+systems/Chapter+9,+Setting+Up+the+Bootloader/9.2+Server+ Setup forsNetwork+ Boot) 9.3 Using LILO with Disk and Compactlash Devices (VUnux-systerns/erbedded: tnux-systems/Chapter 19,+Setting Up the Bootleader/9.3 Using LILO witht Disk and CompactFlash+ Devices/) [19-4 Using GRUB with DiskOrchip Devices (VLinux tsysters/embedded: linux systems/Chapter +9. Setting Up the Bootloader/9.4 Using + GRUB with #DiskOnChip+Devices/) 19-5 U-Boot [chapter 10. Setting Up Networking Services (/Lnux1 systems/erbedded #lnux systems/Chapter+ 10. + Setting 1Up+ Networking Services/} Echapter 11, Debugging Tools (/Linuxtsysters/embedded+linux-systems/Chapter+11.+Debuging+Tools/) Appendix A. loresheet (/Linux+systems/embeddedtlinux+systems/Appendix+A.+Worksheet/) Appendix 8, Resources (/Liuxtsystoms/embedded-linuxs systems/AnpendixB,+Resources/) [Appendix C. Important Licenses anc Notices (/Linux+-systems/embeddec+linux+systems/Appendix+C,+Impartant+Licensestand-+Notices/) [iCotophon (/Linux -systems/embeddec'#linux+systems/Colenhon/) 5 Buleing + Embeded + Lnux’ Systems/) Remember the name: eTutorals.org ‘Advertse on eTutrials.or (alto:adming@etutorils.0°9) Copyright eTutoals.or 2008-2018, Al ight reserves, hp otutoials.orgLinuxtsystomslombeddedinux*systoms/Chapior+8.+Selting+Uptthe+Bootloader/8.5+U-Boot air

You might also like