Difference between revisions of "EBC Exercise 25 Configuring U-boot"

From eLinux.org
Jump to: navigation, search
m (Compiling U-boot: Added mounting mmcblk0p1)
m (Compiling U-boot)
 
(7 intermediate revisions by 3 users not shown)
Line 3: Line 3:
 
{{YoderHead}}
 
{{YoderHead}}
  
This follows the approach taken in [[EBC Exercise 13 Configuring the Kernel]].  We'll use '''bitbake''' to get the source files for U-boot and then we'll edit them.
+
In [[EBC_Exercise_08_Installing_Development_Tools#DAS_U-boot]]  you learned how to download, compile and run U-boot, here we'll configure it.
 
+
== bitbake ==
+
 
+
When you did [[EBC Exercise 22 Cross-Compiling and Finding the Right Kernel]] u-boot was downloaded and compiled. If you used the default configure, the source code was removed once it was done.  Check and see:
+
 
+
host$ '''cd ~/BeagleBoard/oe/build/tmp-angstrom_v2012_05-eglibc/work/beagleboard-angstrom-linux-gnueabi/'''
+
host$ '''ls'''
+
 
+
You should see a directory starting with <code>u-boot-</code>.  The rest of the name tells what version you have.  Change to that directory and see what's there:
+
 
+
host$ '''cd u-boot-*'''
+
host$ '''ls'''
+
 
+
If you see a '''git''' directory, you are in luck. If you see just a '''temp''' directory you need to go back to [[EBC Exercise 22 Cross-Compiling and Finding the Right Kernel]] and get it installed.
+
 
+
Once you have the '''git''' directory, ''cd'' to it and look around.
+
  
 
== Compiling U-boot ==
 
== Compiling U-boot ==
Line 25: Line 9:
 
You can now compile U-boot.  
 
You can now compile U-boot.  
  
  host$ '''source ~/.oe/crossCompileEnv.sh'''
+
  host$ '''source ~/crossCompileEnv.sh'''
 
  host$ '''make'''
 
  host$ '''make'''
 
  host$ '''scp u-boot.bin root@beagle:.'''
 
  host$ '''scp u-boot.bin root@beagle:.'''
Line 56: Line 40:
 
== <span style="color:green">Assignment</span> ==
 
== <span style="color:green">Assignment</span> ==
  
# Modify u-boot to include your initials in the prompt. (Hint:  Look for the omap3_beagle.h file.)
+
 
# Learn what is done when the '''boot''' command in entered in u-boot.
+
# Modify u-boot to include your initials in the prompt. (Hint:  Look for the '''omap3_beagle.h''' file for the xM or '''am335x_evm.h''' for the bone.)
 +
# Learn what is done when the '''boot''' command is entered in u-boot.
 
# Find where the code for boot is defined in the u-boot source.
 
# Find where the code for boot is defined in the u-boot source.
  
Line 68: Line 53:
 
  u-boot# '''print bootcmd'''
 
  u-boot# '''print bootcmd'''
 
  bootcmd=if mmc rescan ${mmcdev}; then if userbutton; then setenv bootenv user.txt;fi;echo SD/MMC found on device ${mmcdev};if run loadbootenv; then echo Loaded environment from ${bootenv};run importbootenv;fi;if test -n $uenvcmd; then echo Running uenvcmd ...;run uenvcmd;fi;if run loaduimage; then run mmcboot;fi;fi;run nandboot;
 
  bootcmd=if mmc rescan ${mmcdev}; then if userbutton; then setenv bootenv user.txt;fi;echo SD/MMC found on device ${mmcdev};if run loadbootenv; then echo Loaded environment from ${bootenv};run importbootenv;fi;if test -n $uenvcmd; then echo Running uenvcmd ...;run uenvcmd;fi;if run loaduimage; then run mmcboot;fi;fi;run nandboot;
 
Pretty print the output (by hand) and draw a flow chart of the logic.  Print each variable that is reference by the code.
 
  
 
{{YoderFoot}}
 
{{YoderFoot}}

Latest revision as of 17:19, 3 June 2013

thumb‎ Embedded Linux Class by Mark A. Yoder


In EBC_Exercise_08_Installing_Development_Tools#DAS_U-boot you learned how to download, compile and run U-boot, here we'll configure it.

Compiling U-boot

You can now compile U-boot.

host$ source ~/crossCompileEnv.sh
host$ make
host$ scp u-boot.bin root@beagle:.

On the beagle, first be sure the FAT partition is mounted

beagle$ cd /media/
beagle$ mkdir mmcblk0p1
beagle$ mount /dev/mmcblk0p1 mmcblk0p1/
beagle$ cd mmcblk0p1/
beagle$ ls -ls
total 354
  2 drwxr-xr-x 4 root root   2048 May 16 15:29 Docs
  2 drwxr-xr-x 5 root root   2048 May 16 15:29 Drivers
  6 -rwxr-xr-x 1 root root   5829 Aug 14 10:10 LICENSE.txt
 84 -rwxr-xr-x 1 root root  85058 Aug 14 08:19 MLO
 14 -rwxr-xr-x 1 root root  13976 Aug 14 10:10 README.htm
  2 -rwxr-xr-x 1 root root     27 Aug 14 10:23 Uenv.txt
  2 -rwxr-xr-x 1 root root    178 Aug 14 10:10 autorun.inf
  2 -rwxr-xr-x 1 root root    171 Aug 14 10:10 info.txt
238 -rwxr-xr-x 1 root root 241948 Aug 14 08:19 u-boot.img
  2 -rwxr-xr-x 1 root root     33 Aug 14 10:23 uEnv.txt.orig

Make a backup of the original u-boot.

beagle$ cp u-boot.bin u-boot.bin.orig
beagle$ cp ~/u-boot.bin .
beagle$ shutdown -r now

You should now be running the new u-boot.

Assignment

  1. Modify u-boot to include your initials in the prompt. (Hint: Look for the omap3_beagle.h file for the xM or am335x_evm.h for the bone.)
  2. Learn what is done when the boot command is entered in u-boot.
  3. Find where the code for boot is defined in the u-boot source.

Hint:

u-boot# help boot
boot - boot default, i.e., run 'bootcmd'

Usage:
boot 
u-boot# print bootcmd
bootcmd=if mmc rescan ${mmcdev}; then if userbutton; then setenv bootenv user.txt;fi;echo SD/MMC found on device ${mmcdev};if run loadbootenv; then echo Loaded environment from ${bootenv};run importbootenv;fi;if test -n $uenvcmd; then echo Running uenvcmd ...;run uenvcmd;fi;if run loaduimage; then run mmcboot;fi;fi;run nandboot;




thumb‎ Embedded Linux Class by Mark A. Yoder