Sie sind auf Seite 1von 25

I-7410: Advanced Linux, Part Embedded Linux LA In"tructi#n" at t$e TI %et!

ab &'##m %(111)

Franz Meyer TI ie! Pa*e 1

1 +enera!itie"
F#r t$e Lab" in t$i" c#ur"e y#u ,i!! u"e a de"-t#. P/ a" deve!#.ment "y"tem and a /A'ME 0it a" tar*et "y"tem( 1n t$e P/ u"e a recent Linux di"tributi#n !i-e 2ebian "3ueeze #r 4buntu 15(4(

1(1 T$e 2eve!#.ment 6y"tem


A 2e"-t#. P/ ,it$ a rem#vab!e $ard di"- a" deve!#.ment "y"tem( ##tab!e $ard di"- ,it$ y#ur Linux deve!#.ment "y"tem(

1(5 T$e Tar*et 6y"tem

T$e /A'ME 0it $a" &am#n* #t$er") t$e 7#!!#,in* 7eature" A T#radex embedded b#ard ,it$ 8"ca!e .r#ce""#r Mem#ry mana*ement unit I1 Exten"i#n b#ard ,it$ LE2", di. ",itc$e", +PI1 ",itc$e", di*itia! I1" An L/2 2i".!ay T,# "eria! inter7ace" 4A'T0 and 4A'T1 1ne Et$ernet inter7ace &'9-4:, ET;)

1(< /#nnecti#n bet,een 2eve!#.ment and Tar*et 6y"tem


6eria! /ab!e t# !in- t$e tar*et "y"tem ,it$ a t$e deve!#.ment "y"tem u"in* "eria! c#mmunicati#n .#rt" /r#""-#ver Et$ernet cab!e bet,een t$e tar*et "y"tem and t$e deve!#.ment "y"tem

5 Ex.erimenta! 6etu.
T$e 7#!!#,in* 7i*ure "$#," t$e ex.erimenta! "etu.( /1M5 cr#""-#ver '65<5 cab!e /1M1 1=5(1>?(5(1 et$1 cr#""-#ver Et$ernet cab!e et$0 LA%@Internet Development System Target System 1=5(1>?(5(100 ET; 4A'T0 4A'T1

Fi*ure 1: 2eve!#.ment 6y"tem and Tar*et 6y"tem T# ma-e t$e "et-u. #.erati#na!, .r#ceed a" 7#!!#," 1( /#nnect t$e 7ir"t "eria! .#rt /1M1 &at t$e b#tt#m #7 t$e bac- .!ane) #n t$e 26 t# t$e 7ir"t "eria! .#rt &4A'T0) #n t$e T6 5( /#nnect t$e #n b#ard Et$ernet ada.ter #n t$e 26 &c$ec- i7 it i" a""i*ned t# eth1) t# t$e #n!y Et$ernet ada.ter eth0 #n t$e T6( <( In"ert t$e rem#vab!e di"- in t$e deve!#.ment "y"tem and b##t t$e Linux "y"tem LA In"tructi#n" F6-501< Pa*e 1

I-7410: Advanced Linux, Part Embedded Linux LA In"tructi#n" at t$e TI %et!ab &'##m %(111)

Franz Meyer TI ie! Pa*e 5

< Pre.are A#ur 2eve!#.ment 6y"tem &2ebian)


B$en t$e di".!ay mana*er i" ready, !#* in a" u"er: student, ,it$ .a"",#rd: student. Per$a." y#ur acc#unt name may di77er( B$en y#ur de"-t#. i" ready #.en "#me "$e!! ,ind#,"(

<(1 /$ec- Pac-a*e"


A#u "$#u!d a!ready $ave in"ta!!ed t$e nece""ary .ac-a*e" build-essential, texinfo, bison, gettext, ncurses5-dev, flex, subversion, uboot-mkimage, and g++( T$#"e .ac-a*e" ,i!! be u"ed t# .er7#rm "ucce""7u!!y make menuconfig(

<(5 2irect#ry 6tructure


It i" rec#mmended t# u"e a "e.arate .artiti#n #7 at !ea"t 15 +b 7#r t$e /A'ME "#7t,are( /reate "uc$ a .artiti#n, ma-e an ext7" &< #r 4) #n it, and m#unt it t# t$e m#unt .#int /opt/carme( Per$a." "ym-!in- /opt/carme ,it$ t$e t#. !eve! direct#ry @carme(T$e /A'ME "#7t,are ,i!! re"ide in t$e 7#!!#,in* "ub-direct#rie" in /opt/carme: /carme -> /opt/carme /opt/carme +-- kernel sources for our embedded kernels +-- linux-2.6.35.9-CARME +-- linux-3.0.4-CARME +-- more kernel sources +-- rootfs -> rootfs-simple-arm-2012.02 +-- rootfs-simple-arm-2012.02 +-- bin +-- dev +-- more Linux top level directories +-- more root file systems /opt/tftpboot +-- carme-uImage -> carme-uImage-2.6.35.9-CARME +-- carme-uImage-2.6.35.9-CARME +-- carme-uImage-3.0.4-CARME In t$e direct#ry /opt/carme y#u $ave -erne! "#urce tree" and r##t 7i!e" "y"tem" 7#r t$e /A'ME tar*et "y"tem( Furt$erm#re, t$e direct#ry /opt/tftpboot $#!d" -erne! ima*e" t$at are retrieved by t$e /A'ME tar*et "y"tem by t$e TFTP(

<(< /reate t$e /r#""-2eve!#.ment T##! /$ain


'eca!! t$at y#u cr#""-deve!#. "#7t,are #n t$e 26( T$e "#7t,are eventua!!y run" #n t$e T6( 0ee. in mind t$at t$e tar*et .!at7#rm i" ba"ed #n an 8"ca!e &A'M c#m.atib!e) .r#ce""#r and n#t an Inte! .r#ce""#r( Fir"t y#u need t# create and in"ta!! a cr#""deve!#.ment t##! c$ain( T$e "ite $tt.:@@bui!dr##t(uc!ibc(#r*@ "ay" t$e 7#!!#,in*: ui!dr##t i" a "et #7 Ma-e7i!e" and .atc$e" t$at ma-e" it ea"y t# *enerate a c#m.!ete embedded Linux "y"tem( ui!dr##t can *enerate any #r a!! #7 a cr#""-c#m.i!ati#n

LA In"tructi#n"

F6-501<

Pa*e 5

I-7410: Advanced Linux, Part Embedded Linux LA In"tructi#n" at t$e TI %et!ab &'##m %(111)

Franz Meyer TI ie! Pa*e <

t##!c$ain, a r##t 7i!e"y"tem, a -erne! ima*e and a b##t!#ader ima*e( ui!dr##t i" u"e7u! main!y 7#r .e#.!e ,#r-in* ,it$ "ma!! #r embedded "y"tem", u"in* vari#u" /P4 arc$itecture" &x?>, A'M, MIP6, P#,erP/, etc() : it aut#mate" t$e bui!din* .r#ce"" #7 y#ur embedded "y"tem and ea"e" t$e cr#""-c#m.i!ati#n .r#ce""( In t$i" !ab ,e u"e t$e 7ir"t .art #7 bui!dr##t: +enerate a cr#""-c#m.i!ati#n t##! c$ain 7#r t$e A'M .!at7#rm( 6ec#nd, ,e bui!d a "im.!e r##t 7i!e "y"tem( T$e -erne! ima*e, #n t$e #t$er $and, need" t# be .atc$ed 7#r #ur .!at7#rm and ,i!! be .r#vided( Fina!!y, t$e b##t !#ader i" a!ready in"ta!!ed #n y#ur b#ard( F#r t$e cr#""-deve!#.ment "#7t,are t$e 7#!!#,in* direct#ry "tructure i" u"ed: /opt/crosstools +-- arm -> arm-2012.02 (link to the current toolchain) +-- arm-2012.09 +-- arm-linux -> arm-unknown-linux-uclibcgnueabi +-- arm-unknown-linux-uclibcgnueabi +-- bin +-- lib +-- many other sub directories +-- arm-2010.09 (an older tool chain) +-- the same sub structure as above

<(<(1 /reatin* an A'M t##!c$ain


It i" "u**e"ted t$at y#u .er7#rm t$i" ta"- somewhere in your home directory, 7#r exam.!e in ~/crosstools( T$e ab#ve direct#ry /opt/crosstools i" t$e in"ta!!ati#n !#cati#n #7 t$e cr#""-deve!#.ment "#7t,are( %#tice t$at y#u bui!d t$e cr#"" deve!#.ment "#7t,are a" y#u but in"ta!! it a" r##t( /reate a direct#ry crosstools "#me,$ere in y#u $#me direct#ry( T$en cd t# t$i" direct#ry( 2#,n!#ad t$e bui!dr##t "#7t,are: http://buildroot.uclibc.org/downloads/buildroot-2012.02.tar.bz2 4ntar it( A#u *et a "ubdirect#ry buildroot-2012.02( T$en cd t# t$i" direct#ry(

<(<(5 /#n7i*urati#n #7 ui!dr##t


T$e bui!dr##t bui!d .r#ce"" can be c#n7i*ured "imi!ar t# a Linux -erne!( T$ere i" a t#. !eve! ma-e 7i!e c#ntainin* a tar*et ca!!ed menuc#n7i*( A#u c#u!d bui!d t$e t##!-c$ain, t$e bu"y-b#x, a !inux -erne!, it" r##t 7i!e "y"tem in a "in*!e run( It" i" "u**e"ted t# d# t$at in "evera! "in*!e "te."( e*in ,it$ t$e c#n"tructi#n #7 a cr#""-deve!#.ment t##!-c$ain( +enera!!y, t# bui!d and u"e t$e bui!dr##t "tu77, y#u d# t$e 7#!!#,in*: 1) run Cma-e menuc#n7i*C 5) "e!ect t$e .ac-a*e" y#u ,i"$ t# c#m.i!e <) run Cma-eC 4) ,ait ,$i!e it c#m.i!e" :) 2e.endin* #n ,$at y#u ,ant c#.y t$e re"u!t" at t$e .r#.er !#cati#n( In a 7ir"t "te. y#u #n!y "e!ect *enera! menu" a" de"cribed be!#,(

LA In"tructi#n"

F6-501<

Pa*e <

I-7410: Advanced Linux, Part Embedded Linux LA In"tructi#n" at t$e TI %et!ab &'##m %(111)
$ make menuconfig Buildroot 2012.02 Configuration

Franz Meyer TI ie! Pa*e 4

Target Architecture (arm) ---> select arm if nothing selected Target Architecture Variant (generic_arm) ---> must be gen arm Target ABI (EABI) ---> select EABI if nothing is there Build options ---> adopt defaults Toolchain ---> Toolchain menu Kernel Headers (Linux 2.6.35.x kernel headers)-->(select 2.6.35) ... [*] Thread library debugging ... Binutils Version (binutils 2.21) ---> select this ... GCC compiler Version (gcc 4.5.x) ---> select this ... [*] Build/install a shared libgcc? ... [*] Build a gdb server for the target [*] Build a gdb for the host ... [*] Enable MMU support [*] Use software floating point by default [*] Enable large file support Select exit and return to Buildroot configuration Continue in menu: Buildroot 2012.02 Configuration System configuration ---> Set hostname to carme Set baudrate to 38400 --- The following menus are used to build a root file system. You will do that later. Thus, unselect all. Package Selection for the target ---> unselect all Target filesystem options ---> unselect all Bootloaders ---> unselect all Kernel ---> unselect all --Load an Alternate Configuration File Save an Alternate Configuration File Select exit

--D *ivin* a .config 7i!e

T# ma-e t$e t##! c$ain ty.e: $ make

LA In"tructi#n"

F6-501<

Pa*e 4

I-7410: Advanced Linux, Part Embedded Linux LA In"tructi#n" at t$e TI %et!ab &'##m %(111)

Franz Meyer TI ie! Pa*e :

A#u ,i!! "ee bui!dr##t d#,n!#adin* "#7t,are .ac-a*e" 7r#m t$e Internet and c#m.i!in* t$#"e .ac$a*e"( T$i" ,i!! ta-e "evera! minute"( +ive y#u a brea-( T$e re"u!t #7 t$e ma-e run ,i!! be in direct#ry: output/host/usr/( It may !##- !i-e t$i":
student@~/crosstools/buildroot-2012.02/output/host/usr$ ls -l total 32 lrwxrwxrwx arm-linux -> arm-unknown-linux-uclibcgnueabi drwxr-xr-x 5 student student arm-unknown-linux-uclibcgnueabi drwxr-xr-x 2 student student bin <-- contains utilities drwxr-xr-x 3 student student include drwxr-xr-x 2 student student info drwxr-xr-x 4 student student lib <-- contains libraries drwxr-xr-x 3 student student libexec drwxr-xr-x 4 student student man drwxr-xr-x 11 student student share

B$ere i" t$e A'M cr#"" c#m.i!er &arm-!inux-*cc) E $ cd output $ find . -name arm-linux-gcc ./host/usr/bin/arm-linux-gcc ;ere it i"( Inv#-e it #n t$e c#mmand !ine:
$ ./host/usr/bin/arm-linux-gcc --ver Using built-in specs. COLLECT_GCC=./bin/arm-linux-gcc COLLECT_LTO_WRAPPER=/home/student/labs/buildroot2012.02/output/host/usr/libexec/gcc/arm-unknown-linuxuclibcgnueabi/4.5.3/lto-wrapper Target: arm-unknown-linux-uclibcgnueabi Configured with: /home/student/labs/buildroot-2012.02/output/toolchain/gcc4.5.3/configure --prefix=/home/student/labs/buildroot-2012.02/output/host/usr --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=arm-unknownlinux-uclibcgnueabi --enable-languages=c --withsysroot=/home/student/labs/buildroot-2012.02/output/host/usr/arm-unknownlinux-uclibcgnueabi/sysroot --with-build-timetools=/home/student/labs/buildroot-2012.02/output/host/usr/arm-unknown-linuxuclibcgnueabi/bin --disable-__cxa_atexit --enable-target-optspace --disablelibquadmath --disable-libgomp --with-gnu-ld --disable-libssp --disablemultilib --enable-tls --enable-shared --withgmp=/home/student/labs/buildroot-2012.02/output/host/usr --withmpfr=/home/student/labs/buildroot-2012.02/output/host/usr --withmpc=/home/student/labs/buildroot-2012.02/output/host/usr --disable-nls --enable-threads --disable-decimal-float --with-float=soft --with-abi=aapcslinux --with-pkgversion='Buildroot 2012.02' --withbugurl=http://bugs.buildroot.net/ Thread model: posix gcc version 4.5.3 (Buildroot 2012.02)

I7 y#u *et "#met$in* !i-e t$i" t$atC" 7ine( %#, c#m.i!e a "ma!! .r#*ram( Brite a "ma!! $e!!# .r#*ram &in direct#ry @tm.)

LA In"tructi#n"

F6-501<

Pa*e :

I-7410: Advanced Linux, Part Embedded Linux LA In"tructi#n" at t$e TI %et!ab &'##m %(111) $cat >> /tmp/hello.c #include <stdio.h> int main(void) { printf("hello\n"); return 0; } Ctrl/D

Franz Meyer TI ie! Pa*e >

$ ./host/usr/bin/arm-linux-gcc -o /tmp/hello /tmp/hello.c $ file /tmp/hello hello: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), not stripped A#u *#t an executab!e 7i!e 7#r t$e A'M .r#ce""#r(

<(<(< In"ta!!in* #7 t$e t##! c$ain &a" r##t)


T$e !#cati#n i": /opt/crosstools/arm-2012.02( 2# t$e 7#!!#,in* &a" r##t):
# cd /opt/crosstools/arm-2012.02 # cp -a /home/student/crosstools/buildroot-2012.02/output/host/usr/ arm-linux . # cp -a /home/student/crosstools/buildroot-2012.02/output/host/usr/ arm-unknown-linux-uclibcgnueabi/ . # cp -a /home/student/crosstools/buildroot-2012.02/output/host/usr/bin/ . # cp -a /home/student/crosstools/buildroot-2012.02/output/host/usr/lib/ . # cp -a /home/student/crosstools/buildroot-2012.02/output/host/usr/libexec/ . # cp -a /home/student/crosstools/buildroot-2012.02/output/host/usr/share/ . # ls -l total 20 lrwxrwxrwx 1 arm-linux -> arm-unknown-linux-uclibcgnueabi drwxr-xr-x 5 arm-unknown-linux-uclibcgnueabi drwxr-xr-x 2 student student 4096 Mar 13 19:52 bin drwxr-xr-x 4 student student 4096 Mar 13 19:52 lib drwxr-xr-x 3 student student 4096 Mar 13 19:43 libexec dr,xr-xr-x > "tudent "tudent 40=> Mar 1< 1=:<= "$are

<(<(4 M#di7y t$e PAT; variab!e


Add t$e direct#ry /opt/crosstools/arm/bin t# t$e .at$ #n t$e 26( A#u may ,ant t# add t$e 7#!!#,in* !ine in y#ur .bashrc 7i!e, .er$a." in y#ur .profile 7i!e: PATH=/opt/crosstools/arm/bin:$PATH 'eca!! t$at a "ymb#!ic !in- arm i" u"ed in /opt/crosstools t# .#int t# t$e .r#.er t##! c$ain(

<(<(: Inv#-e t$e arm-!inux-*cc any,$ere


a"ed #n t$e PAT; variab!e t$e arm-linux-gcc "$#u!d be 7#und in every termina!( T$e c#mmand

LA In"tructi#n"

F6-501<

Pa*e >

I-7410: Advanced Linux, Part Embedded Linux LA In"tructi#n" at t$e TI %et!ab &'##m %(111) $ arm-linux-gcc -o hello /tmp/hello.c c#mmand "$#u!d *ive t$e "ame re"u!t a" ab#ve(

Franz Meyer TI ie! Pa*e 7

<(<(> Fa!!bacI7 y#ur cr#""t##! c$ain d#e" n#t ,#r- y#u 7ind mine at t$e 7#!!#,in* !#cati#n: $tt.:@@.ari"(net!ab(b7$(c$@Fmy71@i7410-15@cr#""t##!"-arm-5015(05(tar(bz5 2#,n!#ad t$e 7i!e crosstools-arm.2012.02.tar.bz2 t# t$e /tmp direct#ry( T$en c$an*e t# t$e direct#ry /opt/crosstools and untar t$e tar 7i!e( T$i" ,i!! create and .#.u!ate t$e /opt/crosstools/arm-2012.02 direct#ry( /reate t$e "#7t !in- arm in direct#ry /opt/crosstools( Ada.t t$e PAT; variab!e a" ab#ve and te"t t$e t##!c$ain in t$e "ame ,ay $ arm-linux-gcc -v A#u "$#u!d *et #ut.ut !i-e t$i": Usinsg built-in specs. Target: arm-none-linux-gnueabi, etc, etc Configured with: a lot of directories Thread model: posix gcc version 4.5.3

<(4 In"ta!! t$e /A'ME -erne! and it" ima*e


In t$e embedded Linux ,#r!d y#u n#rma!!y d# n#t u"e t$e m#"t recent -erne!"( A#u .re7er "tab!e -erne!"( F#r t$e /A'ME b#ard it i" -erne! 5(>(5:(=( It i" -n#,n t# 7#r "tabi!ity( T$e -erne! date" t# 1ct@%#v 5010( B$en y#u cr#""-c#m.i!e a -erne! y#u "$#u!d u"e a t##!-c$ain #7 t$e "ame .eri#d #7 time, 7#r exam.!e ver"i#n 5010(0=( 2#,n!#ad t$e t##!-c$ain and t$e -erne! "#urce 7r#m t$e LA "erver int# t$e /tmp direct#ry #7 y#ur 26( T$e !#cati#n #7 t$e /A'ME "#7t,are i": $tt.:@@.ari"(net!ab(b7$(c$@Fmy71@i7410-15@cr#""t##!"-arm-5010(0=(tar(bz5 $tt.:@@.ari"(net!ab(b7$(c$@Fmy71@i7410-15@!inux-5(>(<:(=-/A'ME(tar(bz5 Fir"t, untar t$e t##!-c$ain int# t$e direct#ry /opt/crosstools *ivin* t$e 7#!!#,in* direct#ry "tructure: /opt/crosstools +-- arm-2010.09 +-- more tool-chains 6ec#nd, untar it int# t$e direct#ry /opt/carme/kernel *ivin* t$e 7#!!#,in* direct#ry "tructure: /opt/carme +-- kernel +-- linux-2.6.35.9-CARME

LA In"tructi#n"

F6-501<

Pa*e 7

I-7410: Advanced Linux, Part Embedded Linux LA In"tructi#n" at t$e TI %et!ab &'##m %(111)

Franz Meyer TI ie! Pa*e ?

Add t$e direct#ry tftpboot in /opt/( T$i" i" t$e !#cati#n #7 t$e -erne! ima*e" d#,n!#aded by t$e TFTP c!ient #7 t$e b##t !#ader( T$e name #7 t$e current ima*e t$at i" re3ue"ted by t$e b##t !#ader mu"t be uImage-carme( T$e -erne! tarba!! ab#ve, $#,ever, $a" been c!eaned( T$ere i" n# -erne! ima*e in it but it c#ntain" a .config 7i!e t# rebui!d t$e -erne! ima*e( T$e -erne! bui!d i" c#ntr#!!ed by a Ma-e7i!e in t$e linux-2.6.35.9-CARME direct#ry t$e t#. !eve! ma-e 7i!e, and by Ma-e7i!e" in m#"t "ub"e3uent direct#rie"( Ma-e "ure t$at t$e 7#!!#,in* ma-e variab!e" are "et c#rrect!y in t$e t#. !eve! ma-e 7i!e: A'/; Garm /'166H/1MPILEG eit$er @ab"-.at$-t#-cr#""c#m.i!er #r arm-!inuxI%6TALLHM12HPAT;G@#.t@carme@r##t7" T$e /'166H/1MPILE variab!e ".eci7ie" t$e !#cati#n #7 t$e cr#""-c#m.i!er &arm-!!inux*cc)( A#u $ave t#, #.ti#n": &1) y#u may ".eci7y eit$er t$e ab"#!ute .at$ t# t$e cr#""c#m.i!er, #r &5) y#u may re!y #n t$e PAT; variab!e( T$e 7ir"t #.ti#n i" rec#mmended be cau"e y#u ,i!! u"e t$e -erne! bui!d .r#cedure t# bui!d y#ur #,n -erne! m#du!e" I#ut #7 t$e -erne! "#urce treeJ( T$e -erne! deve!#.er" rec#mmend t# u"e t$e "ame t##!-c$ain 7#r t$e -erne! a" ,e!! a" 7#r -erne! m#du!e"( I7 y#u u"e t$e "ec#nd met$#d it i" .#""ib!e t$at t$e PAT; variab!e ".eci7ie" a di77erent t##!-c$ain( T# .er7#rm t$e -erne! bui!d y#u may ,ant t# u"e t$e 7#!!#,in* c#mmand "e3uence: $make menuconfig and t$en $make uImage(

T$e "ec#nd c#mmand .r#duce" a -erne! ima*e at t$e 7#!!#,in* !#cati#n: /opt/carme/kernel/linux-2.6.35.9-CARME/arch/arm/boot/uImage /#.y &a" r##t) t$e uImage 7i!e t# /opt/tftpboot/uImage-carme-2.6.35.9-CARME-2010.09( %ext, create a "ymb#!ic !in- uImage-carme 7#r t$i" ima*e 7i!e in @#.t@t7t.b##t( Fallback A#u may *et a -erne! ima*e #n t$e !ab "erver at $tt.:@@.ari"(net!ab(b7$(c$@Fmy71@i7410-15@uIma*e-5(>(<:(=-/A'ME 2#,n!#ad t$i" -erne! ima*e t# t$e direct#ry /opt/tftpboot, .er$a." u"e t$e ,*et uti!ity( Lin- t$e 7i!e ,it$ uImage-carme( %#, y#u $ave .#.u!ated t$e direct#rie" /opt/carme/kernel, /opt/tftpboot, and /opt/crosstools/arm-2012.09( B$at remain" i" t$e r##t 7i!e "y"tem(

<(: /reatin* a "im.!e Linux '##t Fi!e 6y"tem 7#r t$e Tar*et Mac$ine &/A'ME)
In "ecti#n <(< y#u #n!y bui!d t$e t##! c$ain, a!t$#u*$ y#u c#u!d $ave d#ne m#re( 'eca!! t$at t$e bui!dr##t "#7t,are #77er" y#u t$e #.ti#n t# create a r##t 7i!e "y"tem inc!udin* a LA In"tructi#n" F6-501< Pa*e ?

I-7410: Advanced Linux, Part Embedded Linux LA In"tructi#n" at t$e TI %et!ab &'##m %(111)

Franz Meyer TI ie! Pa*e =

bu"yb#x( T$e bu"yb#x i" a c#!!ecti#n #7 uti!itie"( %#tice t$at in a P/ 4nix eac$ c#mmand im.!emented a" a "e.arate .r#*ram( %#, it i" time t# bui!d t$e bu"yb#x and t$e r##t 7i!e "y"tem( +# bac- t# t$e ~/somewhere/crosstools/buildroot-2012.02 direct#ry( e7#re y#u c#ntinue ,it$ t$e c#n7i*urati#n ta"-, "ave t$e current .config 7i!e( T$en ty.e $ make menuconfig A#u ,i!! be bac- in t$e ui!dr##t 5015(05 /#n7i*urati#n "creen( /$ec- t$e 7#!!#,in* "ettin*" and .er$a." add m#re( A#u may iterate t$i" .r#ce""( 6e!ect Package Selection for the target ---> *ivin*

[*] BusyBox BusyBox Version (BusyBox 1.19.x) ---> 1.19 is OK (package/busybox/busybox-1.19.x.config) BusyBox configuration file to use? default location is: package/busybox/busybox-1.18.x.config [*] Show packages that are also provided by busybox customize the package selection by the following selections Audio and video libraries and applications ---> nothing Compressors and decompressors ---> take all Debugging, profiling and benchmark ---> nothing Development tools ---> nothing Games ---> nothing Graphic libraries and applications (graphic/text) ---> select the directfb stuff, free fonts etc Hardware handling ---> select hdparm, hwdata, makedevs Interpreter languages and scripting ---> nothing Libraries ---> select Compression and decompression ---> take defaults Crypto ---> select openssl Database ---> nothing Filesystem ---> select libsysfs Graphics ---> select freetype,jpeg,libpng,libungif (defaults) Hardware handling ---> defaults Java scripts ---> nothing Networking ---> Networking -*- libpcap should be selcted (tcpdump) Other ---> nothing Text and terminal handling ---> nothing JSON/XML ---> nothing Miscellaneous ---> default Networking applications ---> select

LA In"tructi#n"

F6-501<

Pa*e =

I-7410: Advanced Linux, Part Embedded Linux LA In"tructi#n" at t$e TI %et!ab &'##m %(111)

Franz Meyer TI ie! Pa*e 10

select dropbear, ethtool, netstat-nat, openssh, tcpdump, tinyhttpd Package managers ---> nothing Real-Time ---> nothing Shell and utilities ---> select select bash, dash, file, screen, sudo, which System tools ---> select select all from kmod on Text editors and viewers ---> select ed, less, nano, vim Host utilities ---> nothing Filesystem images ---> select select tar Bootloaders ---> nothing Kernel ---> nothing exit and save the configuration in .config

bui!d a!! by ty.in* $ make ta-e" a ,$i!e &ca( 50 min)

T$e re"u!t i" a tem.!ate 7#r r##t 7i!e "y"tem in direct#ry ./output/target
student@:~/crosstools/buildroot-2012.02$ total 56 drwxr-xr-x 2 student student 4096 Mar 16 drwxr-xr-x 3 student student 4096 Feb 28 drwxr-xr-x 6 student student 4096 Mar 16 drwxr-xr-x 2 student student 4096 Mar 16 drwxr-xr-x 2 student student 4096 Mar 16 lrwxrwxrwx 1 student student 11 Mar 16 drwxr-xr-x 2 student student 4096 Mar 16 drwxr-xr-x 2 student student 4096 Mar 16 drwxr-xr-x 2 student student 4096 Mar 16 drwxr-xr-x 2 student student 4096 Mar 16 drwxr-xr-x 2 student student 4096 Mar 16 drwxr-xr-x 2 student student 4096 Mar 16 drwxr-xr-x 3 student student 4096 Mar 16 drwxr-xr-x 6 student student 4096 Mar 16 drwxr-xr-x 4 student student 4096 Mar 16 ls -l ./output/target/ 10:30 21:54 09:55 09:33 10:30 09:45 09:33 09:33 09:33 09:33 10:30 09:33 09:45 09:55 09:55 bin dev etc home lib linuxrc -> bin/busybox mnt opt proc root sbin sys tmp usr var

It !##-" !i-e a Linux r##t 7i!e indeed( A#u a!"# 7ind a tar 7i!e 7#r t$at r##t 7i!e "y"tem in output/images/rootfs.tar( 4ntar it &a" r##t) in direct#ry /opt/carme/rootfs2012.09( T$en "ymb#!ic !in- t$i" direct#ry ,it$ rootfs( T$i" tec$ni3ue a!!#," y#u t# ex.eriment ,it$ di77erent ver"i#n" #7 t$e r##t 7i!e "y"tem( T$e current ver"i#n can be 7#und by t$e "ymb#!ic !in- rootfs( 1ur /A'ME "#7t,are 7#r t$e tar*et "y"tem i" n#, ready( T$e 3ue"ti#n i": 2#e" it b##t #n t$e tar*et "y"temE e7#re y#u can c$ec- t$at, y#u need t# .re.are t$e net,#r- and "#me "ervice" !i-e TFTP, 2;/P, F%6 #n t$e 26(

LA In"tructi#n"

F6-501<

Pa*e 10

I-7410: Advanced Linux, Part Embedded Linux LA In"tructi#n" at t$e TI %et!ab &'##m %(111)

Franz Meyer TI ie! Pa*e 11

<(:(1 Fa!!bacA#u may *et a "am.!e r##t 7i!e "y"tem #n t$e !ab "erver at $tt.:@@.ari"(net!ab(b7$(c$@Fmy71@i7410-15@r##t7"-5015(05-v1(tar(bz5 In"ta!! t$e r##t 7i!e in t$i" tar ba!! in t$e direct#ry @#.t@carme *ivin* "ub-direct#ry rootfs-2012.02-v1( T$en !in- t$i" direct#ry "ymb#!ica!!y ,it$ rootfs(

<(> %et,#r- ada.ter a""i*nment &#n t$e 26)


/$ec- i7 t$e net,#r- a""i*nment .r#cedure durin* b##t a""i*n" eth0 t# t$e Et$ernet card and eth1 t# t$e #n b#ard ada.ter( I7 t$e c#n7i*urati#n di77er" t$en c$ec- t$e udev ru!e" 7i!e in /etc/udev/rules.d/70-persistent-net.rules &2ebian) #r a "imi!ar 7i!e( 'eca!! t$e 7#!!#,in* "ettin*" #n t$e 26 ada.ter eth0 i" c#n7i*ured by t$e Lab 2;/P "erver ada.ter eth1 i" c#n7i*ured manua!!y( 1n 2ebian "y"tem" d# t$at in t$e /etc/network/interface 7i!e( %#tice t$at y#u "$#u!d c#n7i*ure t$e IP addre"" t# 192.168.2.1( A "am.!e 7i!e i" *iven be!#,( T$e 26 act" a" 2;/P "erver #n t$e de*enerated "ub net,#r- 7#rmed by t$e cr#""ed cab!e( T$e IP addre"" #7 t$e T6 i" a""i*ned t# 192.168.2.100 by t$e 2;/P "erver #n t$e 26( T$e 2;/P "erver need" t# c#n7i*ured "uc$ t$at it "u..!ie" t$e nece""ary .arameter" t# t$e tar*et "y"tem( 6ee be!#,( 6am.!e %et,#r-in* Inter7ace" /#n7i*urati#n Fi!e: /etc/network/interfaces A#u #n!y u"e t$e "ec#nd ada.ter et$1 t# c#nnect t$e tar*et "y"tem( T$u", t$e menti#ned "ervice" !i-e d$c., t7t., and n7" need n#t run a!! t$e time( It i" "u**e"ted t# u"e an Ii7ace carmeJ "tanza( A#u 7ire u. t$e inter7ace et$1 manua!!y by ty.in* $ sudo ifup eth1=carme 1n "#me "y"tem" t$ere i" a c#n7!ict ,it$ t$e net,#r- mana*er( It i" "u**e"ted t# turn t$e net,#r- mana*er #77(
# sample file /etc/network/interfaces # done by installer # auto lo iface lo inet loopback auto eth0 iface eth0 inet dhcp # # by myf1: alternative usage of eth1 for carme # fire up eth1 for carme (as root) by typing # # ifup eth1=carme # iface carme inet static address 192.168.2.1 netmask 255.255.255.0

LA In"tructi#n"

F6-501<

Pa*e 11

I-7410: Advanced Linux, Part Embedded Linux LA In"tructi#n" at t$e TI %et!ab &'##m %(111)
# start services up /etc/init.d/nfs-kernel-server start up /etc/init.d/isc-dhcp-server start # stop services in reverse order down /etc/init.d/isc-dhcp-server stop

Franz Meyer TI ie! Pa*e 15

d#,n

@etc@init(d@n7"--erne!-"erver "t#.

<(7 /#n7i*ure t$e minic#m termina!


/$ec- i7 t$e minic#m i" t$ere &ty.e: $ which minicom)( I7 n#t , in"ta!! t$e minic#m .ac-a*e in t$e u"ua! ,ay( T$e c#n7i*urati#n 7#r t$e /A'ME b#ard i" "t#red in t$e 7i!e /etc/minicom/minirc.carme( /reate t$e 7i!e ,it$ t$e 7#!!#,in* c#ntent":
# Machine-generated pu port pu baudrate pu minit pu mreset pu mdialpre pu mdialsuf pu mdialpre2 pu mdialsuf2 pu mdialpre3 pu mdialsuf3 pu mconnect pu mnocon1 pu mnocon2 pu mnocon3 pu mnocon4 pu mhangup pu mdialcan pu mdialtime pu mrdelay pu mretries pu mdropdtr pu mautobaud pu showspeed pu downdir pu hasdcd pu rtscts file - use "minicom -s" to change parameters. /dev/ttyS0 38400

No l /opt/carme No No

'un t$i" minic#m termina! "#7t,are by ty.in* &a" r##t) $minicom carme

<(? /#n7i*urin* %F6


Fir"t ma-e "ure t$at %F6 i" in"ta!!ed( A#u need at !ea"t t$e t,# .ac-a*e" n7"-c#mm#n and n7"--erne!-"erver( T# c#n7i*ure %F6 y#u *# t$r#u*$ t$e 7#!!#,in* "te." 1( /#n7i*urati#n 7i!e /etc/exports

LA In"tructi#n"

F6-501<

Pa*e 15

I-7410: Advanced Linux, Part Embedded Linux LA In"tructi#n" at t$e TI %et!ab &'##m %(111)

Franz Meyer TI ie! Pa*e 1<

# /etc/exports: the access control list for filesystems # # which may be exported to NFS clients. See exports(5). # # Example for NFSv4: # /srv/nfs4 gss/krb5i(rw,sync,fsid=0,crossmnt) # /srv/nfs4/homes gss/krb5i(rw,sync) # /opt/carme/rootfs 192.168.2.0/24(rw,no_root_squash, no_subtree_check,sync,fsid=0) 5( 'em#ve t$e %F6 re!ated "ym!in-" 7r#m t$e /etc/rc.?d/ direct#rie"( T$e %F6 "erver need #n!y be "tarted ,$en y#u ,#r- ,it$ t$e tar*et "y"tem( T# ac$ieve t$at y#u may ,ant t# u"e t$e u.@d#,n c#mmand" in t$e /etc/network/interface 7i!e( <( 6ettin* de7au!t" &im.#rtant) T$e /etc/default/portmap 7i!e "$#u!d c#ntain t$e 7#!!#,in* !ine: OPTIONS=-i eth1 T$e 7#!!#,in* "cri.t" may be u"ed t# re"tart b#t$ t$e n7"--erne!-"erver &a!"# "tart" n7"c#mm#n): /etc/init.d/nfs-kernel-server start 'eca!! t$at /opt/carme/rootfs i" a "ymb#!ic !in- t# t$e .r#.er r##t 7i!e "y"tem( I7 y#u ,ant c$an*e t$i" !in- y#u "$#u!d "t#. t$e n7"--erne!-"erver 7ir"t, c$an*e t$e !in-, and re"tart t$e n7"--erne!-"erver( M#untin* t$e ex.#rted /opt/carme/rootfs direct#ry #7 t$e deve!#.ment "y"tem &26) #n t$e r##t direct#ry @ #7 t$e tar*et "y"tem &T6) a!!#," y#u t# deve!#. y#ur "#7t,are any,$ere in y#ur $#me direct#ry tree #n y#ur 26 a" n#n-r##t u"er( At t$e end #7 y#ur deve!#.ment .r#ce"" y#u c#.y t$e executab!e 7i!e&") int# t$e direct#ry &a" r##t) /opt/carme/rootfs/usr/local/bin #n t$e 26( T$en ",itc$ t# t$e minic#m ,ind#,( I7 t$e n7"-m#unt i" c#rrect!y e"tab!i"$ed y#u "im.!y run t$e executab!e 7r#m t$e /usr/local/bin direct#ry #n t$e T6( I7 y#u u"e t$e make uti!ity #n t$e 26, it i" "u**e"ted t# de7ine an install tar*et in t$e Makefile t$at c#ntain" c#mmand" t# c#.y t$e executab!e 7i!e&") int# t$e /opt/carme/rootfs/usr/local/bin direct#ry( In t$i" ca"e, run in t$e 26 c#mmand ,ind#,: make install a" r##t, #r sudo make install a" y#u( ;int: ecau"e t$e %F6 "erver i" #n!y u"e7u! ,$en t$e /A'ME -it i" c#nnected it i" better ,$en y#u "tart t$e %F6 "erver #n!y i7 y#u c#n7i*ure t$e inter7ace eth1( T# c$ec- ,$at direct#rie" t$e %F6 "erver i" ex.#rtin* u"e t$e c#mmand $ sudo showmount --exports localhost

LA In"tructi#n"

F6-501<

Pa*e 1<

I-7410: Advanced Linux, Part Embedded Linux LA In"tructi#n" at t$e TI %et!ab &'##m %(111)

Franz Meyer TI ie! Pa*e 14

<(= /#n7i*urin* 2;/P


Many Linux "y"tem" c#me ,it$ a .re-c#n7i*ured 2;/P "erver( It can be u"ed t# .r#vide c#n7i*urati#n in7#rmati#n 7#r t$e /A'ME -it( Am#n* #t$er t$in*" it a""i*n" an IP addre"" #ut #7 a ".eci7ied ran*e #7 IP addre""e"( ;#,ever, it i" better t# add a rec#rd t# c#n7i*ure t$e tar*et "y"tem "tatica!!y ba"ed #n it" MA/ addre""( A" 7#r 2;/P it c#ncern" t$e 7i!e" in t$e direct#ry /var/lib/dhcp( It i" "u**e"ted t# bac-u. a!! #ri*ina! 7i!e" in t$i" direct#ry( T$e 2;/P c#n7i*urati#n 7i!e in /etc/dhcpd.conf need" a "ubnet "tatement 7#r eac$ "ubnet t$e 2;/P "erver "u..#rt"( In #ur ca"e it i" t$e "ubnet 192.168.2.0/24( T# a!,ay" a""i*n t$e /A'ME -it t$e "ame IP addre"" &192.168.2.100) *iven t$e MA/ addre"" #7 t$e /A'ME -it ma-e "ure t$at t$e 7#!!#,in* b!#c- i" t$ere &in"ide t$e "ubnet b!#c-)( A /etc/dhcpd.conf 7i!e may !##!i-e t$i": subnet 192.168.2.0 netmask 255.255.255.0 { range 192.168.2.10 192.168.2.250; option routers 192.168.2.1; option subnet-mask 255.255.255.0; option broadcast-address 192.168.2.255; option domain-name "carme.development.local"; option domain-name-servers 192.168.2.1,192.168.2.2; option ip-forwarding off; option time-offset 39600; option root-path "/opt/carme/rootfs"; default-lease-time 600; max-lease-time 7200; # Fixed IP addresses can also be specified for hosts. # For the embedded board fill in the hardware address host CARME { hardware ethernet fixed-address option host-name next-server filename } } T# re"tart t$e 2;/P "erver by ty.e &a" r##t): /etc/init.d/isc-dhcp-server restart( #r better inc!ude t$e c#mmand int# t$e net,#r- c#n7i*urati#n "cri.t &/etc/network/interfaces) by u"in* t$e u. c#mmand( 6imi!ar!y, "t#. t$e "erver by u"in* t$e d#,n c#mmand in t$e interfaces 7i!e( B$en y#u &re)"tart y#ur /A'ME 0it c$ec- i7 t$e IP addre"" 192.168.2.100 i" a""i*ned( yo:ur:et:hn:ad:dr; 192.168.2.100; CARME; 192.168.2.1; uImage-carme;

<(10 /#n7i*urin* TFTP


/urrent!y t$e /A'ME &T6) $a" n# -erne! ima*e #n n#n-v#!ati!e 'AM "uc$ a" 7!a"$ #r /2 'AM( It #n!y c#ntain" a b##t !#ader &ub##t) in t$e 7ir"t 7!a"$ .artiti#n( T$e u-b##t

LA In"tructi#n"

F6-501<

Pa*e 14

I-7410: Advanced Linux, Part Embedded Linux LA In"tructi#n" at t$e TI %et!ab &'##m %(111)

Franz Meyer TI ie! Pa*e 1:

!#ader i" ca.ab!e t# *et an IP addre"" and t# run t$e b##t .r#t#c#!( In it" current c#n7i*urati#n it d#,n!#ad" t$e Linux -erne! ima*e 7r#m t$e 26( T$u" t$e 26 "y"tem "$#u!d run t$e t7t. "erver( %#rma!!y t$e t7t. "erver i" "tarted by t$e inetd( T$u" c$ec- t,# t$in*": 1( I" t$e .ac-a*e t7t.d in"ta!!edE I7 n#t in"ta!! it( 5( I" t$e 7#!!#,in* !ine .re"ent in t$e /etc/inetd.conf 7i!e: # run this only on machines acting as "boot servers." tftp dgram udp wait nobody /usr/sbin/tcpd /usr/sbin/in.tftpd /opt/tftpboot \

T$e TFTP "erver &t7t.d) u"e" t$e direct#ry /opt/tftpboot a" de7au!t direct#ry( Ma-e "ure t$at t$e current -erne! ima*e uImage-carme i" t$ere(

4 6tartin* t$e Tar*et 6y"tem


6,itc$ t# t$e minic#m ,ind#, #n t$e 26, t$en .re"" t$e re"et butt#n #n t$e T6, #r interru.t t$e .#,er "u..!y 7#r t$e T6 7#r a 7e, "ec#nd"( A7ter a ,$i!e y#u "$#u!d "ee "#me me""a*e i""ued by t$e u-b##t !#ader, 7#!!#,ed by a c#unt d#,n 7r#m : d#,n t# zer#( T$en t$e u-b##t !#ader #n t$e T6 c#ntact" t$e 2;/P "erver #n t$e 26 t# *et ba"ic net,#r-in* in7#rmati#n !i-e a tem.#rary IP addre"", t$e name #7 t$e b##t ima*e, etc( T$en t$e u-b##t !#ader #n t$e T6 c#ntact" t$e TFTP "erver #n t$e 26 and re3ue"t" t$e -erne! ima*e( 2urin* t$e TFT &trivia! 7i!e tran"7er) y#u "ee a "e3uence #7 K in t$e minic#m ,ind#,( T$e u-b##t-!#ader $a" n#, d#ne it" L#b and "et" t$e net,#rinter7ace d#,n becau"e t$e -erne! may ,ant t# rec#n7i*ure it di77erent!y( T$e next "te. i" t# unc#m.re"" t$e -erne! ima*e and t# "tart it( B$en t$e -erne! "tart" t$e net,#r- #n t$e T6 it a*ain c#ntact" t$e 2/;P "erver #n t$e 26( Fina!!y t$e T6 m#unt" it" r##t 7i!e "y"tem t# t$e %F6 "ubtree ex.#rted by t$e 26 a" indicated in it" /etc/exports 7i!e( It i" current!y t$e direct#ry /opt/carme/rootfs( I7 y#ur T6 b##t" c#rrect!y y#u "$#u!d "ee "#met$in* !i-e t$i":
U-Boot 1.3.4-CARME-00016-g4d2cfc3-dirty (Feb DRAM: 64 MB Flash: 32 MB In: serial Out: serial Err: serial CPU speed: 312000kHz . done Un-Protected 1 sectors Hit any key to stop autoboot: No MMC card found 6 2009 - 10:39:13)

** Unable to use mmc 0:1 for fatload ** Wrong Image Format for bootm command ERROR: can't get kernel image! dm9000 i/o: 0x8000000, id: 0x90000a46 DM9000: running in 32 bit mode MAC: 00:14:2d:00:1a:de operating at 100M full duplex mode BOOTP broadcast 1 *** Unhandled DHCP Option in OFFER/ACK: 19

LA In"tructi#n"

F6-501<

Pa*e 1:

I-7410: Advanced Linux, Part Embedded Linux LA In"tructi#n" at t$e TI %et!ab &'##m %(111)

Franz Meyer TI ie! Pa*e 1>

*** Unhandled DHCP Option in OFFER/ACK: 2 *** Unhandled DHCP Option in OFFER/ACK: 28 *** Unhandled DHCP Option in OFFER/ACK: 44 *** Unhandled DHCP Option in OFFER/ACK: 45 *** Unhandled DHCP Option in OFFER/ACK: 46 *** Unhandled DHCP Option in OFFER/ACK: 19 *** Unhandled DHCP Option in OFFER/ACK: 2 *** Unhandled DHCP Option in OFFER/ACK: 28 *** Unhandled DHCP Option in OFFER/ACK: 44 *** Unhandled DHCP Option in OFFER/ACK: 45 *** Unhandled DHCP Option in OFFER/ACK: 46 DHCP client bound to address 192.168.2.100 TFTP from server 192.168.2.1; our IP address is 192.168.2.100 Filename 'uImage-carme'. Load address: 0xa1000000 Loading: ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ######################################################### done Bytes transferred = 2620388 (27fbe4 hex) ## Booting kernel from Legacy Image at a1000000 ... Image Name: Linux-3.0.4-CARME Created: 2012-02-16 16:28:40 UTC Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 2620324 Bytes = 2.5 MB Load Address: a0008000 Entry Point: a0008000 Verifying Checksum ... OK Loading Kernel Image ... OK OK Starting kernel ... Uncompressing Linux... done, booting the kernel. [ 0.000000] Linux version 3.0.4-CARME (student@adv-linux) (gcc version 4.5.1 (Sourcery G++ Lite 2010.09-50) ) #5 PREEMPT Thu F2 [ 0.000000] CPU: XScale-PXA270 [69054117] revision 7 (ARMv5TE), cr=0000397f [ 0.000000] CPU: VIVT data cache, VIVT instruction cache [ 0.000000] Machine: CARME Colibri PXA270 [ 0.000000] Ignoring unrecognised tag 0x54410008 [ 0.000000] Memory policy: ECC disabled, Data cache writeback [ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256 [ 0.000000] Kernel command line: root=/dev/nfs ip=:::::eth0: console=ttyS0,38400n8 display=qvga [ 0.000000] PID hash table entries: 256 (order: -2, 1024 bytes) [ 0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes) [ 0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes) [ 0.000000] Memory: 64MB = 64MB total [ 0.000000] Memory: 59988k/59988k available, 5548k reserved, 0K highmem [ 0.000000] Virtual kernel memory layout: [ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)

LA In"tructi#n"

F6-501<

Pa*e 1>

I-7410: Advanced Linux, Part Embedded Linux LA In"tructi#n" at t$e TI %et!ab &'##m %(111)
[ 0.000000] [ 0.000000] [ 0.000000] [ 0.000000] [ 0.000000] [ 0.000000] [ 0.000000] [ 0.000000] [ 0.000000] [ 0.000000] [ 0.000000] [ 0.000000] 1321528ms [ 0.000000] [ 0.000627] [ 0.080331] [ 0.080785] [ 0.081019] [ 0.082107] [ 0.091742] [ 0.193404] [ 0.201157] [ 0.202669] [ 0.203845] [ 0.215412] [ 0.216027] [ 0.304044] [ 0.304512] [ 0.305587] bytes) [ 0.305756] [ 0.305862] [ 0.305895] [ 0.305933] [ 0.305998] [ 0.307319] [ 0.308573] [ 0.308647] [ 0.308672] [ 0.308699] [ 0.309287] [ 0.309474] [ 0.322483] [ 0.324378] [ 0.325255] [ 0.327415] [ 0.330442] [ 0.330495] [ 0.330748] [ 1.497421] [ 2.547231] [ 2.576554] [ 2.616591] [ 2.677928] [ 2.708427] [ 2.719151] [ 2.779336] [ 2.795079]

Franz Meyer TI ie! Pa*e 17

fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB) DMA : 0xffc00000 - 0xffe00000 ( 2 MB) vmalloc : 0xc4800000 - 0xe8000000 ( 568 MB) lowmem : 0xc0000000 - 0xc4000000 ( 64 MB) modules : 0xbf000000 - 0xc0000000 ( 16 MB) .init : 0xc0008000 - 0xc0029000 ( 132 kB) .text : 0xc0029000 - 0xc0493eb0 (4524 kB) .data : 0xc0494000 - 0xc04b6be0 ( 139 kB) .bss : 0xc04b6c04 - 0xc04d483c ( 120 kB) Preemptible hierarchical RCU implementation. NR_IRQS:288 nr_irqs:288 288 sched_clock: 32 bits at 3250kHz, resolution 307ns, wraps every Console: colour dummy device 80x30 Calibrating delay loop... 310.88 BogoMIPS (lpj=1554432) pid_max: default: 32768 minimum: 301 Security Framework initialized Mount-cache hash table entries: 512 CPU: Testing write buffer coherency: ok NET: Registered protocol family 16 bio: create slab <bio-0> at 0 usbcore: registered new interface driver usbfs usbcore: registered new interface driver hub usbcore: registered new device driver usb cfg80211: Calling CRDA to update world regulatory domain Switching to clocksource oscr0 NET: Registered protocol family 2 IP route cache hash table entries: 1024 (order: 0, 4096 bytes) TCP established hash table entries: 2048 (order: 2, 16384 TCP bind hash table entries: 2048 (order: 1, 8192 bytes) TCP: Hash tables configured (established 2048 bind 2048) TCP reno registered UDP hash table entries: 256 (order: 0, 4096 bytes) UDP-Lite hash table entries: 256 (order: 0, 4096 bytes) NET: Registered protocol family 1 RPC: Registered named UNIX socket transport module. RPC: Registered udp transport module. RPC: Registered tcp transport module. RPC: Registered tcp NFSv4.1 backchannel transport module. NetWinder Floating Point Emulator V0.97 (double precision) PMU: registered new PMU device of type 0 Installing knfsd (copyright (C) 1996 okir@monad.swb.de). JFFS2 version 2.2. (NAND) 2001-2006 Red Hat, Inc. JFFS2: default compression mode: priority msgmni has been set to 117 io scheduler noop registered io scheduler deadline registered io scheduler cfq registered (default) pxa2xx-uart.0: ttyS0 at MMIO 0x40100000 (irq = 22) is a FFUART console [ttyS0] enabled pxa2xx-uart.1: ttyS1 at MMIO 0x40200000 (irq = 21) is a BTUART pxa2xx-uart.2: ttyS2 at MMIO 0x40700000 (irq = 20) is a STUART brd: module loaded loop: module loaded nbd: registered device at major 43 Uniform Multi-Platform E-IDE driver ide-gd driver 1.18

LA In"tructi#n"

F6-501<

Pa*e 17

I-7410: Advanced Linux, Part Embedded Linux LA In"tructi#n" at t$e TI %et!ab &'##m %(111)

Franz Meyer TI ie! Pa*e 1?

[ 2.811073] physmap platform flash device: 02000000 at 00000000 [ 2.829973] physmap-flash.0: Found 2 x16 devices at 0x0 in 32-bit bank. Manufacturer ID 0x000089 Chip ID 0x000018 [ 2.860899] Intel/Sharp Extended Query Table at 0x0031 [ 2.876282] Intel/Sharp Extended Query Table at 0x0031 [ 2.891663] Using buffer write method [ 2.902562] cfi_cmdset_0001: Erase suspend on write enabled [ 2.921527] Using physmap partition information [ 2.935192] Creating 3 MTD partitions on "physmap-flash.0": [ 2.951958] 0x000000000000-0x000000040000 : "Bootloader" [ 2.974930] 0x000000040000-0x000000440000 : "Kernel" [ 2.997371] 0x000000440000-0x000002000000 : "Rootfs" [ 3.020975] Using configured DiskOnChip probe address 0x4000000 [ 3.039353] dm9000 Ethernet Driver, V1.31 [ 3.168145] eth0: dm9000e at c485a000,c485c004 IRQ 210 MAC: 00:14:2d:00:1a:de (chip) [ 3.195944] mousedev: PS/2 mouse device common for all mice [ 3.212880] i2c /dev entries driver [ 3.226649] TCP cubic registered [ 3.236646] NET: Registered protocol family 17 [ 3.250092] NET: Registered protocol family 15 [ 3.263497] lib80211: common routines for IEEE802.11 drivers [ 3.280527] Registering the dns_resolver key type [ 3.294720] XScale iWMMXt coprocessor detected. [ 3.356251] dm9000 dm9000: eth0: link down [ 5.446231] dm9000 dm9000: eth0: link up, 100Mbps, full-duplex, lpa 0xC5E1 [ 5.466819] Sending DHCP requests ., OK [ 5.516175] IP-Config: Got DHCP answer from 192.168.2.1, my address is 192.168.2.100 [ 5.539954] IP-Config: Complete: [ 5.549689] device=eth0, addr=192.168.2.100, mask=255.255.255.0, gw=192.168.2.1, [ 5.572290] host=CARME, domain=carme.develoment.local, nisdomain=(none), [ 5.593804] bootserver=192.168.2.1, rootserver=192.168.2.1, rootpath=/opt/carme/rootfs [ 5.680125] VFS: Mounted root (nfs filesystem) on device 0:13. [ 5.698096] Freeing init memory: 132K INIT: version 2.88 booting mount: mounting / on failed: No such file or directorymount: mounting tmpfs on /dev/shm failed: No such file or directory Starting logging: OK Starting rsyslog daemon: OK Initializing random number generator... done. Starting network... ip: RTNETLINK answers: File exists Starting dropbear sshd: generating rsa key... generating dsa key... OK Generating RSA Key... Generating public/private rsa1 key pair. Your identification has been saved in /etc/ssh_host_key. Your public key has been saved in /etc/ssh_host_key.pub. The key fingerprint is: 6c:b4:79:9c:62:e5:7d:4f:ce:ca:d4:8e:f4:ed:f6:17 The key's randomart image is: +--[RSA1 2048]----+ | | | | | . . |

LA In"tructi#n"

F6-501<

Pa*e 1?

I-7410: Advanced Linux, Part Embedded Linux LA In"tructi#n" at t$e TI %et!ab &'##m %(111)

Franz Meyer TI ie! Pa*e 1=

| o * o | | S = . . .| | o o . E | | o *| | + =+| | +oO| +-----------------+ Generating RSA Key... Generating public/private rsa key pair. Your identification has been saved in /etc/ssh_host_rsa_key. Your public key has been saved in /etc/ssh_host_rsa_key.pub. The key fingerprint is: 81:4f:f9:d2:c2:e1:e9:d9:1d:16:be:7e:6c:72:4b:4b The key's randomart image is: +--[ RSA 2048]----+ | | | . . | | . = . | | = * . . | | S o + | | . = o o | | o . o.E | | ..o=. | | .=o. | +-----------------+ Generating DSA Key... THIS CAN TAKE A MINUTE OR TWO DEPENDING ON YOUR PROCESSOR! Generating public/private dsa key pair. Your identification has been saved in /etc/ssh_host_dsa_key. Your public key has been saved in /etc/ssh_host_dsa_key.pub. The key fingerprint is: 60:91:68:9c:f8:c6:33:60:01:fd:26:9e:fd:f8:34:03 The key's randomart image is: +--[ DSA 1024]----+ |.o.+ o.. | | = = .. | | . * o | | . O. . | | . *Eo S | | o .. | | o+ | | ...o | | .. | +-----------------+ Generating ECDSA Key... THIS CAN TAKE A MINUTE OR TWO DEPENDING ON YOUR PROCESSOR! Generating public/private ecdsa key pair. Your identification has been saved in /etc/ssh_host_ecdsa_key. Your public key has been saved in /etc/ssh_host_ecdsa_key.pub. The key fingerprint is: 3a:d9:4a:11:3f:8c:56:2b:ca:9d:6c:19:42:1c:7b:f5 The key's randomart image is: +--[ECDSA 256]---+ | . . | | . o . . | | + o . E |

LA In"tructi#n"

F6-501<

Pa*e 1=

I-7410: Advanced Linux, Part Embedded Linux LA In"tructi#n" at t$e TI %et!ab &'##m %(111)
| . . * . | | . * S | | . * X . | | o @ . | | o o | | . | +-----------------+ Starting sshd: OK Starting tinyhttpd: done INIT: Entering runlevel: 1 Welcome to Buildroot carme login: root

Franz Meyer TI ie! Pa*e 50

[root@carme ~]# ifconfig -a eth0 Link encap:Ethernet HWaddr 00:14:2D:00:1A:DE inet addr:192.168.2.100 Bcast:192.168.2.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:4255 errors:0 dropped:0 overruns:0 frame:0 TX packets:2172 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:4683004 (4.4 MiB) TX bytes:340404 (332.4 KiB) Interrupt:210 Base address:0xa000 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

[root@carme ~]# ping 192.168.2.1 PING 192.168.2.1 (192.168.2.1): 56 data bytes 64 bytes from 192.168.2.1: seq=0 ttl=64 time=0.529 ms 64 bytes from 192.168.2.1: seq=1 ttl=64 time=0.508 ms --- 192.168.2.1 ping statistics --2 packets transmitted, 2 packets received, 0% packet loss round-trip min/avg/max = 0.508/0.518/0.529 ms [root@carme ~]# ping 8.8.8.8 PING 8.8.8.8 (8.8.8.8): 56 data bytes --- 8.8.8.8 ping statistics --2 packets transmitted, 0 packets received, 100% [root@carme ~]# route -n Kernel IP routing table Destination Gateway Genmask 0.0.0.0 192.168.2.1 0.0.0.0 192.168.2.0 0.0.0.0 255.255.255.0 [root@carme ~]# packet loss Flags Metric Ref UG 0 0 U 0 0 Use Iface 0 eth0 0 eth0

L#* in t$e T6 7r#m t$e minic#m termina! a" u"er r##t( %# .a"",#rd i" re3uired( T$e "u.eru"er i" t$e #n!y u"er #n t$e T6( A#u are in bu"ine"" ,$en t$e c#mmand Ils -l /I #n t$e T6 &in t$e minic#m ,ind#,) and t$e "ame c#mmand in t$e direct#ry /opt/carme/rootfs "$#, t$e "ame 7i!e"(

LA In"tructi#n"

F6-501<

Pa*e 50

I-7410: Advanced Linux, Part Embedded Linux LA In"tructi#n" at t$e TI %et!ab &'##m %(111) B$at can *# ,r#n*E

Franz Meyer TI ie! Pa*e 51

T$e T6C" b##t me""a*e" are n#t $eard by t$e 26( -D c$ec- t$e net,#r- "ettin*" 2#,n!#adin* #7 t$e -erne! may time #ut( -D "eri#u"( Per$a." t$e net,#r- mana*er "$ut" unex.ected!y d#,n t$e inter7ace eth1( I7 t$e -erne! can be d#,n!#aded, t$e -erne! b##t", but a -erne! .anic i" .r#duced ,$i!e m#untin* t$e r##t 7i!e "y"tem: -D c$ec- i7 t$e tar*et mac$ine i" c#n7i*ured c#rrect!y( Ma-e "ure t$at t$e tar*et "y"tem -n#," ,$ere %F6 "erver i"( T$e #.ti#n nextserver "$#u!d be 192.168.2.1( T$e T6C" r##t 7i!e "y"tem cann#t be m#unted -D c$ec- t$e net,#r-in* c#n7i*urati#n and retry( I7 it 7ai!" m#re t$an t$ree time", t$ere i" a "eri#u" .r#b!em( 6#me device" are mi""in*: !##- at t$e !#* t# 7ind #ut ,$ic$ device"( Find #ut t$e ty.e, min#r and maL#r number #7 t$e device( Brite a "cri.t t# create t$e mi""in* n#de"( Let t$e init .r#ce"" run t$e "cri.t(

4(1 6$uttin* d#,n t$e Tar*et 6y"tem


In t$e minic#m ,ind#, y#u 7ir"t terminate t$e tar*et "e""i#n &ty.e exit #n t$e c#mmand !ine)( T$en ty.e /tr!@A M and "e!ect 8 &exit)(

4(5 /#n7i*urin* t$e ##t L#ader &u-b##t)


T$e b##t !#ader "tart" ,it$ a t$ree "ec#nd" c#unt d#,n( B$en y#u $it a -ey durin* t$i" c#untd#,n t$e b##t !#aderC" /LI i""ue" a .r#m.t( T$i" a!!#," y#u t# enter c#mmand"( Ty.e help t# *et an #vervie, #ver avai!ab!e c#mmand"( T$e m#"t intere"tin* c#mmand" dea! ,it$ t$e u-b##t envir#nment( printenv setenv name value saveenv di".!ay" t$e current envir#nment variab!e"( "et" variab!e name t# va!ue( "ave" t$e envir#nment variab!e" t# n#n-v#!ati!e mem#ry

T$e re"u!t #7 t$e .rintenv c#mmand "$#u!d !##- !i-e t$i":


U-Boot 1.3.4-CARME-00016-g4d2cfc3-dirty (Feb DRAM: 64 MB Flash: 32 MB In: serial Out: serial Err: serial Hit any key to stop autoboot: -- Key hit here u-boot$ printenv bootcmd=run bootLinux || run autoBootMMC || bootm 80000 || dhcp && bootm bootdelay=3 6 2009 - 10:39:13)

LA In"tructi#n"

F6-501<

Pa*e 51

I-7410: Advanced Linux, Part Embedded Linux LA In"tructi#n" at t$e TI %et!ab &'##m %(111)

Franz Meyer TI ie! Pa*e 55

baudrate=38400 ipaddr=192.168.2.100 serverip=192.168.2.1 netmask=255.255.255.0 bootfile="uImage26" oldbootCMD=bootm 80000 || dhcp && bootm autoBootMMC=mmcinit;fatload mmc 0 0xA0000000 /carme/autorun.bin && go 0xA0000000 bootLinux=mmcinit;fatload mmc 0 0xA1000000 uImage26 && bootm ethaddr=00:14:2D:00:1B:04 bootargs=root=/dev/nfs ip=:::::eth0: console=ttyS0,38400N8 display=xvga ^ stdout=serial console bit rate stdin=serial check in inittab, line stderr=serial ttyS0::respawn.. -L ttyS0 38400 Environment size: 505/261884 bytes

A#u "ee $ere, am#n* #t$er t$in*", t$at t$e Et$ernet addre"" i" 00:14:2D:00:1B:04(

: Te"tin* t$e Tar*et 6y"tem


In t$e exerci"e" #n t$e embedded "y"tem ,e ,i!! cr#""-deve!#. "#7t,are #n t$e deve!#.ment "y"tem and acce"" it #n t$e tar*et "y"tem via t$e net,#r- 7i!e "y"tem %F6( T# te"t i7 t$e deve!#.ment .r#ce"" ,#r-" c#rrect!y it i" "u**e"ted t# ,rite &1) a "im.!e / .r#*ram in t$e $e!!# ,#r!d "ty!e, and &5) a "im.!e $e!!# m#du!e(

:(1 A ;e!!# Pr#*ram


A $e!!# ,#r!d .r#*ram in / may !##- !i-e t$i" &"#urce 7i!e $e!!#(c): #include <stdio.h> int main(void) { prinf(hello\n); return 0; } $arm-linux-gcc -o hello hello.c T$e 7i!e uti!ity "$#u!d "$#, t$at t$e executab!e i" bui!d 7#r t$e A'M .!at7#rm
$file hello hello: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.14, not stripped

I2#,n#adJ t$e .r#*ram t# t$e tar*et "y"tem &a" r##t): $sudo cp ./hello /opt/carme/rootfs/usr/local/bin 'un t$e .r#*ram #n t$e tar*et "y"tem: LA In"tructi#n" F6-501< Pa*e 55

I-7410: Advanced Linux, Part Embedded Linux LA In"tructi#n" at t$e TI %et!ab &'##m %(111) $cd /usr/local/bin $./hello hello

Franz Meyer TI ie! Pa*e 5<

Exercise- : Brite a ma-e 7i!e t# bui!d t$e $e!!# ,#r!d .r#*ram( Fir"t, ma-e a "im.!e ma-e 7i!e, t$en ,rite a *eneric ma-e 7i!e( Exercise-!: Lin- t$e $e!!# .r#*ram "tatica!!y a" ,e!! a" dynamica!!y( B$at i" t$e di77erenceE

> In"ta!!in* and c#n7i*urin* a 66; "erver #n t$e tar*et "y"tem


B$y: may be u"e7u! 7#r rem#te c#n7i*urati#n( A#u "e!ected t$e #.en""$ in "ecti#n <(4 I/reatin* 6im.!e '##t7"J /#n7i*urati#n 7i!e" @etc@""$dHc#n7i* A!!#, r##t !#*in 6.eci7y t$e !#cati#n 7#r t$e -ey" 0ey *enerati#n ,i!! ta-e a !#n* time #n t$e tar*et( +enerate -ey" #n t$e deve!#.ment "y"tem and c#.y it t# t$e .r#.er !#cati#n &"ee ""$dHc#n7i*) Ada.t &"im.!i7y) t$e "tart u. "cri.t in @etc@init(d@6:0""$d L#* in 7r#m a termina! ,ind#, #n t$e 26( Trace t$e 66; tra77ic u"in* tc.dum. #n t$e tar*et "y"tem

7 T$e !in- Pr#*ram


/#n"ider t$e 7#!!#,in* / .r#*ram:
/*************************************************************** * \file blink.c ***************************************************************/ #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/time.h> #include <sys/mman.h> #include <time.h> #include <fcntl.h> #define #define #define #define #define #define MEM_DEV MAP_LENGTH IO_BASE LED_OFFSET MAX_LOOPS LED_PATTERN "/dev/mem" ( 16 ) /*16 bytes */ ( 0xc000000 ) /*IO base in physical memory*/ ( 0x3000 ) /*led register ofs in IO space*/ ( 5 ) ( 0x55 ) /*one for all odd bits*/

/***************************************************************

LA In"tructi#n"

F6-501<

Pa*e 5<

I-7410: Advanced Linux, Part Embedded Linux LA In"tructi#n" at t$e TI %et!ab &'##m %(111)

Franz Meyer TI ie! Pa*e 54

* GLOBAL VARIABLES **************************************************************/ static off_t led_reg_ofs=IO_BASE+LED_OFFSET; /*must be page aligned*/ static char *ledAddr = NULL; /*LED IO addr in VM*/ /**************************************************************** * main ***************************************************************/ int main(int argc, char* argv[]) { int fd, i; printf("Blink\n"); /* * Try to open the memory device special file */ if ((fd = open(MEM_DEV, O_RDWR|O_SYNC)) == -1) { perror("at open "); return -1; } /* mmap mem dev to memory region */ ledAddr = mmap(NULL, /* start address */ MAP_LENGTH, /* the IO space */ PROT_READ|PROT_WRITE, /* read and write */ MAP_SHARED, /* share this mapping with all processes */ fd, /* /dev/mem */ led_reg_ofs); /* IO memory region addr */ for (i = 0; i < MAX_LOOPS; i++) { *(volatile unsigned char *) ledAddr = LED_PATTERN; sleep(1); *(volatile unsigned char *) ledAddr = ~LED_PATTERN; sleep(1); } /* cleanup and exit */ *(volatile unsigned char *) ledAddr = 0x0; munmap(ledAddr, MAP_LENGTH); close(fd); return 0; }

ui!d t$e executab!e .r#*ram 7i!e in t$e "ame ,ay a" y#u bui!t t$e $e!!# .r#*ram( B$at $a..en" #n t$e b#ardE 2i"cu"" $#, t$i" .r#*ram d#e" it" ,#r-( E".ecia!!y, 7ind #ut ,$at exact!y t$e "y"tem ca!! mmap() d#e"( B$at i" t$e di77erence in "ize bet,een a "tatica!!y !in-ed and dynamica!!y !in-ed .r#*ramE Ta-e t$i" blink.c a" an exam.!e( Ma-e a *eneric ma-e 7i!e 7#r t$i" blink.c .r#*ram( Extend t$e .r#*ram "# t$at it re.#rt" .eri#dica!!y t$e "tate #7 ",itc$ array L0((L7 in " "in*!e byte i7 t$e ",itc$ re*i"ter #77"et i" e3ua! t# 0x3200(

LA In"tructi#n"

F6-501<

Pa*e 54

I-7410: Advanced Linux, Part Embedded Linux LA In"tructi#n" at t$e TI %et!ab &'##m %(111)

Franz Meyer TI ie! Pa*e 5:

? 6im.!e P16I8 T$read"


Brite a .r#*ram t$at create" a *iven number #7 P16I8 t$read", eac$ #7 ,$ic$ runnin* an in"tance #7 a "$ared t$read 7uncti#n( T$e t$read 7uncti#n *et" a "!ee. time in "ec#nd" a" .arameter and de!ay" executi#n 7#r t$e ".eci7ied time( T$e .rimary t$read create" a *iven number #7 runner t$read" and ,ait" unti! a!! runner t$read" $ave terminated( Ma-e a c#.y #7 t$e *eneric ma-e 7i!e #7 t$e .revi#u" exerci"e and ada.t it t# t$i" .r#*ram( %#tice t$at y#u need t# ".eci7y t$e P16I8 t$read !ibrary !ib.t$read 7#r !in-in* &u"e t$e ",itc$: -l pthread)(

LA In"tructi#n"

F6-501<

Pa*e 5:

Das könnte Ihnen auch gefallen