SlideShare a Scribd company logo
1 of 7
Download to read offline
5/15/13 Compiling and using U-Boot for BeagleBone. | कायशाला (Kāryaśālā)
bharath.lohray.com/weblog/compiling-and-using-u-boot-for-beaglebone/ 1/7
0 2
Compiling and using U-Boot for
BeagleBone.
Posted on January 7, 2013
The [www ] ships with a micro SD card that contains an
[www ]. The images may be found and downloaded from the Ångström website .
This image works perfectly out of the box.
The problem I faced was how to get the BeagleBone load a kernel or a program
from a server and execute it and to get [www ] to load a program from the TFTP
server at boot without the user having to manually execute the boot commands each time
In the past, kernel and baremetal development on the BeagleBoard (rev C3) required me to
pull out the SD card each time I compiled something and reboot the BeagleBoard. Pulling out
and reinserting the card into the slot about 3 or 4 times an hour and burning an image on to it
was a development bottleneck and not to mention, I risked mechanically damaging
some delicate parts. The projected ended prematurely when the mechanical stress while
handling the board resulted failures that led the I C operations to go dead. A ~$150 hit on
my exchequers.
When I bought the [www ], Pandaboard, BeagleBone, Raspberry Pi, Atlys
and Zed Board, all of which had an ethernet ports on them, it made sense to load the kernel
or baremetal program over the LAN to mitigate the risk of physical damage and unthrottle the
development bottleneck of writing images to an SD card for each modify-compile iteration.
Image Distribution
To dish out the kernel images to the development boards, A and a TFTP server were
Like 0
BeagleBone Ångström Linux
distribution
baremetal
TFTP U-Boot
2
BeagleBoard-xM
DHCP
कायशाला (Kāryaśālā)
The outcomes of the Lord Loh's tinkerings
5/15/13 Compiling and using U-Boot for BeagleBone. | कायशाला (Kāryaśālā)
bharath.lohray.com/weblog/compiling-and-using-u-boot-for-beaglebone/ 2/7
setup. The DHCP server is configured to assign a fixed IP address, to the MAC address
corresponding to the BeagleBone. The configuration corresponding to the BeagleBone’s MAC
address also specifies the IP address of the TFTP server and the file name of the kernel
image file that it should download from that TFTP server. Specifying this for the specific MAC
lets various hosts (x86 PC / ARM / MIPS / PowerPC ) get their architecture specific images.
U-Boot
U-Boot or Das u-Boot is an openSource universal boot loader distributed under the GNU GPL
v2 for embedded ARM, PowerPC and MIPS systems. U-Boot needs to be configured for a
specific architecture and board before it can be built. U-Boot is a stage 2 boot loader (read
more ) which is loaded by the stage 1 boot loader. The Stage 1 boot loader is known as the
x-loader. The x-loader executable binary is in a file called MLO. Most ARM processors have
some basic ROM code that is enough to load and execute a file called MLOfrom the SD card
or NAND.
The x-loader may sometimes be found as independent projects for specific boards or
independent of U-Boot. For example TI’s x-loader which attempts to make x-loader
independent of U-Boot. An attempt to combine MLOand u-boot.imgfrom different releases
resulted in an unbootable system.
Compiling U-Boot
Pre-compiled binaries for various boards may be download from various sites such as the
Ångström distribution. However, if one chooses to compile their own U-Boot, the sources may
be obtained from here or from the git repository at git://git.denx.de/u-boot.git.
ST ART ING CLEAN:
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- distclean
CONFIGURING FOR AN ARCHIT ECT URE:
Configuring for the BeagleBone
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- am335x_evm_config
Configuring for the BeagleBoard-xM
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- omap3_beagle_config
5/15/13 Compiling and using U-Boot for BeagleBone. | कायशाला (Kāryaśālā)
bharath.lohray.com/weblog/compiling-and-using-u-boot-for-beaglebone/ 3/7
Configuring for the PandaBoard-ES
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- omap4_panda_config
BUILDING U-BOOT
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
This results in MLO, u-boot.binand u-boot.imgbeing generated. These files may be
copied into the FAT partition of the SD Card or flashed into the NAND.
U-Boot Boot Sequence
On power up or reset, the x-loader loads U-Boot and hands off control to it. The U-Boot waits
for a short while for the user to interrupt the boot and then proceeds to execute the
commands in the environment variable bootcmd.
The default boot sequence for the am3335x (BeagleBone) is -
mmc dev ${mmcdev};
if mmc rescan;
then
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;
This initializes the SD card, loads uENV.txt to memory, imports the contents from the
memory to environment space, loads uImageand boots it. Various words seen in the script
above are actually variables. ${variableName} is substituted by the value in the
5/15/13 Compiling and using U-Boot for BeagleBone. | कायशाला (Kāryaśālā)
bharath.lohray.com/weblog/compiling-and-using-u-boot-for-beaglebone/ 4/7
variable. Commands in variables may be executed as
run variableName
To change the boot sequence, the board configuration files have to modified and U-Boot has
to be recompiled. For the BeagleBone, this file is include/configs/am335x_evm.h. An
extract from the am335x_evm.hsource file is shown below -
#define CONFIG_BOOTCOMMAND 
"mmc dev ${mmcdev}; if mmc rescan; then " 
"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;" 
To change the boot sequence to load a file from the TFTP server and boot it with the ext4 file
system on the SD card as the root, I modified the source as below and recompiled U-Boot to
behave as desired.
#define CONFIG_BOOTCOMMAND 
"mmc dev ${mmcdev}; if mmc rescan; then " 
"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 dhcp ${loadaddr}; then " 
"run mmcargs;" 
"bootm ${loadaddr};"
"fi;" 
"fi;"
5/15/13 Compiling and using U-Boot for BeagleBone. | कायशाला (Kāryaśālā)
bharath.lohray.com/weblog/compiling-and-using-u-boot-for-beaglebone/ 5/7
5 THOUGHTS ON “COMPILING AND USING U-BOOT FOR BEAGLEBONE.”
2
I would like to conclude this entry by touching on an alternate boot loader called barebox .
barebox is a boot loader that was derived from U-Boot and is also distributed under GNU GPL
v2. Barebox scripts and commands are very Similar to U-Boot and a knowledge of U-Boot can
get one started on barebox very quickly. Barebox also provides some good features like a
boot menu.
Barebox uses kconfig can be configured by -
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig
Which lets the user tweak a lot of features before building the MLO & u-boot. While
BeagleBone is not supported by barebox yet, BeagleBoard & Pandaboard are. There are a
few patches floating around that claim to put in support for the AM335x processor, but none
of them worked out of the box on the current (2013-01-06) git copy.
This entry was posted in Embedded, Linux and tagged BeagleBone, Documentation,
Linux, u-boot by Lord Bharath Bhushan Lohray. Bookmark the permalink
[http://bharath.lohray.com/weblog/compiling-and-using-u-boot-for-beaglebone/] .
ShareShareShareShareMore
awesome
on March 24, 2013 at 18:59 said:
Thanks for this, this is exactly what I wanted to do.
In fact, I wasn’t even expecting to find such a match explaining right exactly what I
wanted to do — wanted to change the default u-boot command to tftp the kernel on
boot to avoid mechanical stress on the BeagleBone and speed up development.
Lord Bharath Bhushan Lohray
on March 24, 2013 at 19:05 said:
I am glad it helped. It took me quite a while to figure this out.
5/15/13 Compiling and using U-Boot for BeagleBone. | कायशाला (Kāryaśālā)
bharath.lohray.com/weblog/compiling-and-using-u-boot-for-beaglebone/ 6/7
Pham
on April 27, 2013 at 18:55 said:
Hi,
Thank your for this, but I have a problem with booting my Beaglebone V3.
I’m successful booting my Beaglebone with u-boot and MLO which I downloaded on
the Internet but I wanted to build myself u-boot from scratch.
In fact I compiled exactly as yours and it genarated MLO and u-boot.img and I copied
this files into SDCard. But I can’t not boot with new MLO and u-boot.img(I tried to boot
with old MLO and u-boot.img, il boot successfully). Il has error message like this
“Booting from mmc …
Wrong Ramdisk Image Format
Ramdisk image is corrupt or invalid”
Could you help me to find out why is this problem,
Thanks very much,
Lord Bharath Bhushan Lohray
on April 27, 2013 at 18:59 said:
Can you interrupt the U-Boot process by pressing any key? Do you have the
uENV.txt from your older U-Boot? What is in the variable bootcmd?
Pham
on April 28, 2013 at 06:34 said:
Hi,
Thanks yours answer quickly. I recompiled u-boot as like the site:
http://www.eewiki.net/display/linuxonarm/BeagleBone#BeagleBone-U-
BootConfigureandBuild: and this time it works:) . I’m very new in
embedded and I think your site is very useful with second part U-Boot
Boot Sequence.
Thanks again and have a nice weekend,
5/15/13 Compiling and using U-Boot for BeagleBone. | कायशाला (Kāryaśālā)
bharath.lohray.com/weblog/compiling-and-using-u-boot-for-beaglebone/ 7/7

More Related Content

What's hot

Dockerizing WordPress
Dockerizing WordPressDockerizing WordPress
Dockerizing WordPressdotCloud
 
2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Heroku2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Herokuronnywang_tw
 
Performance Improvements in Browsers
Performance Improvements in BrowsersPerformance Improvements in Browsers
Performance Improvements in Browsersjeresig
 
Installing and running Postfix within a docker container from the command line
Installing and running Postfix within a docker container from the command lineInstalling and running Postfix within a docker container from the command line
Installing and running Postfix within a docker container from the command linedotCloud
 
Emacs presentation
Emacs presentationEmacs presentation
Emacs presentationLingfei Kong
 
0628阙宏宇
0628阙宏宇0628阙宏宇
0628阙宏宇zhu02
 
CiklumCPPSat: Alexey Podoba "Automatic assembly. Cmake"
CiklumCPPSat: Alexey Podoba "Automatic assembly. Cmake"CiklumCPPSat: Alexey Podoba "Automatic assembly. Cmake"
CiklumCPPSat: Alexey Podoba "Automatic assembly. Cmake"Ciklum Ukraine
 
Intro to pl/PHP Oscon2007
Intro to pl/PHP Oscon2007Intro to pl/PHP Oscon2007
Intro to pl/PHP Oscon2007Robert Treat
 
Cacoo enterprise installation_manual
Cacoo enterprise installation_manualCacoo enterprise installation_manual
Cacoo enterprise installation_manualjoseig23
 
OpenSolaris On EeePc at Osc Spring
OpenSolaris On EeePc at Osc SpringOpenSolaris On EeePc at Osc Spring
OpenSolaris On EeePc at Osc SpringMasafumi Ohta
 
Build Moses on Ubuntu (64-bit) in VirtualBox: recorded by Aaron
Build Moses on Ubuntu (64-bit) in VirtualBox: recorded by AaronBuild Moses on Ubuntu (64-bit) in VirtualBox: recorded by Aaron
Build Moses on Ubuntu (64-bit) in VirtualBox: recorded by AaronLifeng (Aaron) Han
 
Dependency Management with Composer
Dependency Management with ComposerDependency Management with Composer
Dependency Management with ComposerJordi Boggiano
 
Check the version with fixes. Link in description
Check the version with fixes. Link in descriptionCheck the version with fixes. Link in description
Check the version with fixes. Link in descriptionPrzemyslaw Koltermann
 

What's hot (18)

Dockerizing WordPress
Dockerizing WordPressDockerizing WordPress
Dockerizing WordPress
 
2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Heroku2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Heroku
 
Performance Improvements in Browsers
Performance Improvements in BrowsersPerformance Improvements in Browsers
Performance Improvements in Browsers
 
Installing and running Postfix within a docker container from the command line
Installing and running Postfix within a docker container from the command lineInstalling and running Postfix within a docker container from the command line
Installing and running Postfix within a docker container from the command line
 
CouchDB Google
CouchDB GoogleCouchDB Google
CouchDB Google
 
Os Treat
Os TreatOs Treat
Os Treat
 
Apache
ApacheApache
Apache
 
Emacs presentation
Emacs presentationEmacs presentation
Emacs presentation
 
BPMS1
BPMS1BPMS1
BPMS1
 
Docker perl build
Docker perl buildDocker perl build
Docker perl build
 
0628阙宏宇
0628阙宏宇0628阙宏宇
0628阙宏宇
 
CiklumCPPSat: Alexey Podoba "Automatic assembly. Cmake"
CiklumCPPSat: Alexey Podoba "Automatic assembly. Cmake"CiklumCPPSat: Alexey Podoba "Automatic assembly. Cmake"
CiklumCPPSat: Alexey Podoba "Automatic assembly. Cmake"
 
Intro to pl/PHP Oscon2007
Intro to pl/PHP Oscon2007Intro to pl/PHP Oscon2007
Intro to pl/PHP Oscon2007
 
Cacoo enterprise installation_manual
Cacoo enterprise installation_manualCacoo enterprise installation_manual
Cacoo enterprise installation_manual
 
OpenSolaris On EeePc at Osc Spring
OpenSolaris On EeePc at Osc SpringOpenSolaris On EeePc at Osc Spring
OpenSolaris On EeePc at Osc Spring
 
Build Moses on Ubuntu (64-bit) in VirtualBox: recorded by Aaron
Build Moses on Ubuntu (64-bit) in VirtualBox: recorded by AaronBuild Moses on Ubuntu (64-bit) in VirtualBox: recorded by Aaron
Build Moses on Ubuntu (64-bit) in VirtualBox: recorded by Aaron
 
Dependency Management with Composer
Dependency Management with ComposerDependency Management with Composer
Dependency Management with Composer
 
Check the version with fixes. Link in description
Check the version with fixes. Link in descriptionCheck the version with fixes. Link in description
Check the version with fixes. Link in description
 

Similar to Compile U-Boot for BeagleBone Boot over Ethernet

Getting Started with Buildroot - Lab
Getting Started with Buildroot - LabGetting Started with Buildroot - Lab
Getting Started with Buildroot - LabTrevor Woerner
 
101 2.2 install boot manager
101 2.2 install boot manager101 2.2 install boot manager
101 2.2 install boot managerAcácio Oliveira
 
101 2.2 install boot manager
101 2.2 install boot manager101 2.2 install boot manager
101 2.2 install boot managerAcácio Oliveira
 
ChromePad - Chromium OS ThinkPad X220
ChromePad - Chromium OS ThinkPad X220ChromePad - Chromium OS ThinkPad X220
ChromePad - Chromium OS ThinkPad X220AndrewWright224
 
ChromePad - Chromium OS for ThinkPad
ChromePad - Chromium OS for ThinkPadChromePad - Chromium OS for ThinkPad
ChromePad - Chromium OS for ThinkPadAndrewWright224
 
U Boot or Universal Bootloader
U Boot or Universal BootloaderU Boot or Universal Bootloader
U Boot or Universal BootloaderSatpal Parmar
 
Coscup x ruby conf tw 2021 google cloud buildpacks 剖析與實踐
Coscup x ruby conf tw 2021  google cloud buildpacks 剖析與實踐Coscup x ruby conf tw 2021  google cloud buildpacks 剖析與實踐
Coscup x ruby conf tw 2021 google cloud buildpacks 剖析與實踐KAI CHU CHUNG
 
Jagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratchJagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratchlinuxlab_conf
 
BeagleBone Black: Platform Bring-Up with Upstream Components
BeagleBone Black: Platform Bring-Up with Upstream ComponentsBeagleBone Black: Platform Bring-Up with Upstream Components
BeagleBone Black: Platform Bring-Up with Upstream ComponentsGlobalLogic Ukraine
 
A million ways to provision embedded linux devices
A million ways to provision embedded linux devicesA million ways to provision embedded linux devices
A million ways to provision embedded linux devicesMender.io
 
Device Tree Overlay implementation on AOSP 9.0
Device Tree Overlay implementation on AOSP 9.0Device Tree Overlay implementation on AOSP 9.0
Device Tree Overlay implementation on AOSP 9.0Cheng Wig
 
Gdg cloud taipei ddt meetup #53 buildpack
Gdg cloud taipei ddt meetup #53 buildpackGdg cloud taipei ddt meetup #53 buildpack
Gdg cloud taipei ddt meetup #53 buildpackKAI CHU CHUNG
 
How to configure an environment to cross-compile applications for beagleboard-xM
How to configure an environment to cross-compile applications for beagleboard-xMHow to configure an environment to cross-compile applications for beagleboard-xM
How to configure an environment to cross-compile applications for beagleboard-xMDalton Valadares
 
Embedded Fest 2019. Игорь Опанюк. Das U-boot v2019: a look under the hood
Embedded Fest 2019. Игорь Опанюк. Das U-boot v2019: a look under the hoodEmbedded Fest 2019. Игорь Опанюк. Das U-boot v2019: a look under the hood
Embedded Fest 2019. Игорь Опанюк. Das U-boot v2019: a look under the hoodEmbeddedFest
 

Similar to Compile U-Boot for BeagleBone Boot over Ethernet (20)

Getting Started with Buildroot - Lab
Getting Started with Buildroot - LabGetting Started with Buildroot - Lab
Getting Started with Buildroot - Lab
 
101 2.2 install boot manager
101 2.2 install boot manager101 2.2 install boot manager
101 2.2 install boot manager
 
2.2 install boot manager
2.2 install boot manager2.2 install boot manager
2.2 install boot manager
 
101 2.2 install boot manager
101 2.2 install boot manager101 2.2 install boot manager
101 2.2 install boot manager
 
BeagleBone Black Bootloaders
BeagleBone Black BootloadersBeagleBone Black Bootloaders
BeagleBone Black Bootloaders
 
BeagleBoard-xM Booting Process
BeagleBoard-xM Booting ProcessBeagleBoard-xM Booting Process
BeagleBoard-xM Booting Process
 
ChromePad - Chromium OS ThinkPad X220
ChromePad - Chromium OS ThinkPad X220ChromePad - Chromium OS ThinkPad X220
ChromePad - Chromium OS ThinkPad X220
 
ChromePad - Chromium OS for ThinkPad
ChromePad - Chromium OS for ThinkPadChromePad - Chromium OS for ThinkPad
ChromePad - Chromium OS for ThinkPad
 
kubernetes practice
kubernetes practicekubernetes practice
kubernetes practice
 
BeagleBone Black Bootloaders
BeagleBone Black BootloadersBeagleBone Black Bootloaders
BeagleBone Black Bootloaders
 
U Boot or Universal Bootloader
U Boot or Universal BootloaderU Boot or Universal Bootloader
U Boot or Universal Bootloader
 
Coscup x ruby conf tw 2021 google cloud buildpacks 剖析與實踐
Coscup x ruby conf tw 2021  google cloud buildpacks 剖析與實踐Coscup x ruby conf tw 2021  google cloud buildpacks 剖析與實踐
Coscup x ruby conf tw 2021 google cloud buildpacks 剖析與實踐
 
Jagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratchJagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratch
 
BeagleBone Black: Platform Bring-Up with Upstream Components
BeagleBone Black: Platform Bring-Up with Upstream ComponentsBeagleBone Black: Platform Bring-Up with Upstream Components
BeagleBone Black: Platform Bring-Up with Upstream Components
 
A million ways to provision embedded linux devices
A million ways to provision embedded linux devicesA million ways to provision embedded linux devices
A million ways to provision embedded linux devices
 
Device Tree Overlay implementation on AOSP 9.0
Device Tree Overlay implementation on AOSP 9.0Device Tree Overlay implementation on AOSP 9.0
Device Tree Overlay implementation on AOSP 9.0
 
Docker as an every day work tool
Docker as an every day work toolDocker as an every day work tool
Docker as an every day work tool
 
Gdg cloud taipei ddt meetup #53 buildpack
Gdg cloud taipei ddt meetup #53 buildpackGdg cloud taipei ddt meetup #53 buildpack
Gdg cloud taipei ddt meetup #53 buildpack
 
How to configure an environment to cross-compile applications for beagleboard-xM
How to configure an environment to cross-compile applications for beagleboard-xMHow to configure an environment to cross-compile applications for beagleboard-xM
How to configure an environment to cross-compile applications for beagleboard-xM
 
Embedded Fest 2019. Игорь Опанюк. Das U-boot v2019: a look under the hood
Embedded Fest 2019. Игорь Опанюк. Das U-boot v2019: a look under the hoodEmbedded Fest 2019. Игорь Опанюк. Das U-boot v2019: a look under the hood
Embedded Fest 2019. Игорь Опанюк. Das U-boot v2019: a look under the hood
 

Compile U-Boot for BeagleBone Boot over Ethernet

  • 1. 5/15/13 Compiling and using U-Boot for BeagleBone. | कायशाला (Kāryaśālā) bharath.lohray.com/weblog/compiling-and-using-u-boot-for-beaglebone/ 1/7 0 2 Compiling and using U-Boot for BeagleBone. Posted on January 7, 2013 The [www ] ships with a micro SD card that contains an [www ]. The images may be found and downloaded from the Ångström website . This image works perfectly out of the box. The problem I faced was how to get the BeagleBone load a kernel or a program from a server and execute it and to get [www ] to load a program from the TFTP server at boot without the user having to manually execute the boot commands each time In the past, kernel and baremetal development on the BeagleBoard (rev C3) required me to pull out the SD card each time I compiled something and reboot the BeagleBoard. Pulling out and reinserting the card into the slot about 3 or 4 times an hour and burning an image on to it was a development bottleneck and not to mention, I risked mechanically damaging some delicate parts. The projected ended prematurely when the mechanical stress while handling the board resulted failures that led the I C operations to go dead. A ~$150 hit on my exchequers. When I bought the [www ], Pandaboard, BeagleBone, Raspberry Pi, Atlys and Zed Board, all of which had an ethernet ports on them, it made sense to load the kernel or baremetal program over the LAN to mitigate the risk of physical damage and unthrottle the development bottleneck of writing images to an SD card for each modify-compile iteration. Image Distribution To dish out the kernel images to the development boards, A and a TFTP server were Like 0 BeagleBone Ångström Linux distribution baremetal TFTP U-Boot 2 BeagleBoard-xM DHCP कायशाला (Kāryaśālā) The outcomes of the Lord Loh's tinkerings
  • 2. 5/15/13 Compiling and using U-Boot for BeagleBone. | कायशाला (Kāryaśālā) bharath.lohray.com/weblog/compiling-and-using-u-boot-for-beaglebone/ 2/7 setup. The DHCP server is configured to assign a fixed IP address, to the MAC address corresponding to the BeagleBone. The configuration corresponding to the BeagleBone’s MAC address also specifies the IP address of the TFTP server and the file name of the kernel image file that it should download from that TFTP server. Specifying this for the specific MAC lets various hosts (x86 PC / ARM / MIPS / PowerPC ) get their architecture specific images. U-Boot U-Boot or Das u-Boot is an openSource universal boot loader distributed under the GNU GPL v2 for embedded ARM, PowerPC and MIPS systems. U-Boot needs to be configured for a specific architecture and board before it can be built. U-Boot is a stage 2 boot loader (read more ) which is loaded by the stage 1 boot loader. The Stage 1 boot loader is known as the x-loader. The x-loader executable binary is in a file called MLO. Most ARM processors have some basic ROM code that is enough to load and execute a file called MLOfrom the SD card or NAND. The x-loader may sometimes be found as independent projects for specific boards or independent of U-Boot. For example TI’s x-loader which attempts to make x-loader independent of U-Boot. An attempt to combine MLOand u-boot.imgfrom different releases resulted in an unbootable system. Compiling U-Boot Pre-compiled binaries for various boards may be download from various sites such as the Ångström distribution. However, if one chooses to compile their own U-Boot, the sources may be obtained from here or from the git repository at git://git.denx.de/u-boot.git. ST ART ING CLEAN: $ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- distclean CONFIGURING FOR AN ARCHIT ECT URE: Configuring for the BeagleBone $ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- am335x_evm_config Configuring for the BeagleBoard-xM $ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- omap3_beagle_config
  • 3. 5/15/13 Compiling and using U-Boot for BeagleBone. | कायशाला (Kāryaśālā) bharath.lohray.com/weblog/compiling-and-using-u-boot-for-beaglebone/ 3/7 Configuring for the PandaBoard-ES $ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- omap4_panda_config BUILDING U-BOOT $ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- This results in MLO, u-boot.binand u-boot.imgbeing generated. These files may be copied into the FAT partition of the SD Card or flashed into the NAND. U-Boot Boot Sequence On power up or reset, the x-loader loads U-Boot and hands off control to it. The U-Boot waits for a short while for the user to interrupt the boot and then proceeds to execute the commands in the environment variable bootcmd. The default boot sequence for the am3335x (BeagleBone) is - mmc dev ${mmcdev}; if mmc rescan; then 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; This initializes the SD card, loads uENV.txt to memory, imports the contents from the memory to environment space, loads uImageand boots it. Various words seen in the script above are actually variables. ${variableName} is substituted by the value in the
  • 4. 5/15/13 Compiling and using U-Boot for BeagleBone. | कायशाला (Kāryaśālā) bharath.lohray.com/weblog/compiling-and-using-u-boot-for-beaglebone/ 4/7 variable. Commands in variables may be executed as run variableName To change the boot sequence, the board configuration files have to modified and U-Boot has to be recompiled. For the BeagleBone, this file is include/configs/am335x_evm.h. An extract from the am335x_evm.hsource file is shown below - #define CONFIG_BOOTCOMMAND "mmc dev ${mmcdev}; if mmc rescan; then " "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;" To change the boot sequence to load a file from the TFTP server and boot it with the ext4 file system on the SD card as the root, I modified the source as below and recompiled U-Boot to behave as desired. #define CONFIG_BOOTCOMMAND "mmc dev ${mmcdev}; if mmc rescan; then " "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 dhcp ${loadaddr}; then " "run mmcargs;" "bootm ${loadaddr};" "fi;" "fi;"
  • 5. 5/15/13 Compiling and using U-Boot for BeagleBone. | कायशाला (Kāryaśālā) bharath.lohray.com/weblog/compiling-and-using-u-boot-for-beaglebone/ 5/7 5 THOUGHTS ON “COMPILING AND USING U-BOOT FOR BEAGLEBONE.” 2 I would like to conclude this entry by touching on an alternate boot loader called barebox . barebox is a boot loader that was derived from U-Boot and is also distributed under GNU GPL v2. Barebox scripts and commands are very Similar to U-Boot and a knowledge of U-Boot can get one started on barebox very quickly. Barebox also provides some good features like a boot menu. Barebox uses kconfig can be configured by - make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig Which lets the user tweak a lot of features before building the MLO & u-boot. While BeagleBone is not supported by barebox yet, BeagleBoard & Pandaboard are. There are a few patches floating around that claim to put in support for the AM335x processor, but none of them worked out of the box on the current (2013-01-06) git copy. This entry was posted in Embedded, Linux and tagged BeagleBone, Documentation, Linux, u-boot by Lord Bharath Bhushan Lohray. Bookmark the permalink [http://bharath.lohray.com/weblog/compiling-and-using-u-boot-for-beaglebone/] . ShareShareShareShareMore awesome on March 24, 2013 at 18:59 said: Thanks for this, this is exactly what I wanted to do. In fact, I wasn’t even expecting to find such a match explaining right exactly what I wanted to do — wanted to change the default u-boot command to tftp the kernel on boot to avoid mechanical stress on the BeagleBone and speed up development. Lord Bharath Bhushan Lohray on March 24, 2013 at 19:05 said: I am glad it helped. It took me quite a while to figure this out.
  • 6. 5/15/13 Compiling and using U-Boot for BeagleBone. | कायशाला (Kāryaśālā) bharath.lohray.com/weblog/compiling-and-using-u-boot-for-beaglebone/ 6/7 Pham on April 27, 2013 at 18:55 said: Hi, Thank your for this, but I have a problem with booting my Beaglebone V3. I’m successful booting my Beaglebone with u-boot and MLO which I downloaded on the Internet but I wanted to build myself u-boot from scratch. In fact I compiled exactly as yours and it genarated MLO and u-boot.img and I copied this files into SDCard. But I can’t not boot with new MLO and u-boot.img(I tried to boot with old MLO and u-boot.img, il boot successfully). Il has error message like this “Booting from mmc … Wrong Ramdisk Image Format Ramdisk image is corrupt or invalid” Could you help me to find out why is this problem, Thanks very much, Lord Bharath Bhushan Lohray on April 27, 2013 at 18:59 said: Can you interrupt the U-Boot process by pressing any key? Do you have the uENV.txt from your older U-Boot? What is in the variable bootcmd? Pham on April 28, 2013 at 06:34 said: Hi, Thanks yours answer quickly. I recompiled u-boot as like the site: http://www.eewiki.net/display/linuxonarm/BeagleBone#BeagleBone-U- BootConfigureandBuild: and this time it works:) . I’m very new in embedded and I think your site is very useful with second part U-Boot Boot Sequence. Thanks again and have a nice weekend,
  • 7. 5/15/13 Compiling and using U-Boot for BeagleBone. | कायशाला (Kāryaśālā) bharath.lohray.com/weblog/compiling-and-using-u-boot-for-beaglebone/ 7/7