1
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//freeelectrons.com
The Uboot bootloader
The Uboot
bootloader
Michael Opdenacker
Thomas Petazzoni
Free Electrons
2
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//freeelectrons.com
Rights to copy
Attribution – ShareAlike 3.0
You are free
to copy, distribute, display, and perform the work
to make derivative works
to make commercial use of the work
Under the following conditions
Attribution. You must give the original author credit.
Share Alike. If you alter, transform, or build upon this work, you
may distribute the resulting work only under a license identical to
this one.
For any reuse or distribution, you must make clear to others the license
terms of this work.
Any of these conditions can be waived if you get permission from the
copyright holder.
Your fair use and other rights are in no way affected by the above.
License text: http://creativecommons.org/licenses/bysa/3.0/legalcode
© Copyright 20042009, Free Electrons
feedback@freeelectrons.com
Document sources, updates and translations:
http://freeelectrons.com/docs/uboot
Corrections, suggestions, contributions and
translations are welcome!
Latest update: Feb 3, 2009
3
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//freeelectrons.com
Das Uboot
http://www.denx.de/wiki/UBoot/WebHome
Das UBoot: Universal Bootloader from Denx Software
The most used on arm.
Supports: arm, ppc, mips, x86, m68k, nios...
See our Uboot presentation for details:
http://freeelectrons.com/docs/uboot
Easy to port to new boards.
See our BSP presentation for porting details:
http://freeelectrons.com/docs/bsp
4
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//freeelectrons.com
Postprocessing kernel image for Uboot
The Uboot bootloader needs extra information to be added to
the kernel and initrd image files.
mkimage postprocessing utility provided in Uboot sources
Kernel image postprocessing:
make uImage
5
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//freeelectrons.com
Postprocessing initrd image for Uboot
mkimage
n initrd \ Name
A arm \ Architecture
O linux \ Operating System
T ramdisk \ Type
C gzip \ Compression
d rdext2.gz \ Input file
uInitrd Output file
Note: this applies to initramfs images in the same way.
Bootloaders don't see the difference between initrds and
initramfs.
6
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//freeelectrons.com
Compiling Das Uboot
Get the Uboot sources from http://www.denx.de/wiki/UBoot
In the Uboot source directory:
Find the name of the config file for your board in include/configs
(for example: omap1710h3.h)
Configure Uboot:
make omap1710h3_config (.h replaced by _config)
If needed, change the crosscompiler prefix in Makefile:
ifeq ($(ARCH),arm)
CROSS_COMPILE = armlinux
endif
Specify the path to your crosscompiler. For example:
export PATH=/usr/local/uclibc0.9.282/arm/bin:$PATH
Compile:
make
7
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//freeelectrons.com
Compiling Uboot mkimage
If you just need mkimage
and Uboot is already installed on your board:
mkimage is completely architecture and board independent.
Configure Uboot sources for any board on any architecture
(see previous slide).
Compile:
make (or make k if you have minor failures)
Install mkimage:
cp tools/mkimage /usr/local/bin/
8
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//freeelectrons.com
Configuring tftp (1)
Often in development: downloading a kernel image from the
network. Instructions for xinetd based systems (Fedora Core, Red
Hat...)
Install the tftpserver package if needed
Remove disable = yes in /etc/xinetd.d/tftp
Copy your image files to the /tftpboot/ directory (or to the
location specified in /etc/xinetd.d/tftp)
You may have to disable SELinux in /etc/selinux/config
Restart xinetd:
/etc/init.d/xinetd restart
9
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//freeelectrons.com
Configuring tftp (2)
On GNU/Linux systems based on Debian: Ubuntu, Knoppix
Install the tftpdhpa package if needed
Set RUN_DAEMON="yes"
in /etc/default/tftpdhpa
Copy your images to /var/lib/tftpboot
/etc/hosts.allow:
Replace ALL : ALL@ALL : DENY by ALL : ALL@ALL : ALLOW
/etc/hosts.deny:
Comment out ALL: PARANOID
Restart the server:
/etc/init.d/tftpdhpa restart
10
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//freeelectrons.com
Uboot prompt
Connect the target to the host through a serial console
Powerup the board.
On the serial console, you will see something like:
UBoot 1.1.2 (Aug 3 2004 17:31:20)
RAM Configuration:
Bank #0: 00000000 8 MB
Flash: 2 MB
In: serial
Out: serial
Err: serial
uboot #
11
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//freeelectrons.com
Board information
uboot # bdinfo
DRAM bank = 0x00000000
> start = 0x00000000
> size = 0x00800000
ethaddr = 00:40:95:36:35:33
ip_addr = 10.0.0.11
baudrate = 19200 bps
12
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//freeelectrons.com
Environment variables (1)
uboot # printenv
baudrate=19200
ethaddr=00:40:95:36:35:33 Network settings
netmask=255.255.255.0 for TFTP
ipaddr=10.0.0.11 and NFS
serverip=10.0.0.1
stdin=serial
stdout=serial
stderr=serial
uboot # setenv serverip 10.0.0.2
uboot # printenv serverip
serverip=10.0.0.2
13
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//freeelectrons.com
Environment variables (2)
Environment variable changes can be stored
to flash using the saveenv command.
You can even create small shell scripts
stored in environment variables:
setenv myscript 'tftp 0x21400000 uImage ;
bootm 0x21400000'
You can then execute the script:
run myscript
More elaborate scripting is available with script files,
to be processed with mkimage.
14
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//freeelectrons.com
Network commands
uboot # tftp 8000 uboot.bin
From server 10.0.0.1; our IP address is
10.0.0.11
Filename 'uboot.bin'.
Load address: 0x8000
Loading: ###################
done
Bytes transferred = 95032 (17338 hex)
The address and size of the downloaded file are stored in the
fileaddr and filesize environment variables.
15
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//freeelectrons.com
Flash commands (1)
uboot # flinfo
Bank # 1: AMD Am29LV160DB 16KB,2x8KB,32KB,31x64KB
Size: 2048 KB in 35 Sectors
Sector Start Addresses:
S00 @ 0x01000000 ! S01 @ 0x01004000 !
S02 @ 0x01006000 ! S03 @ 0x01008000 !
S04 @ 0x01010000 ! S05 @ 0x01020000 !
S06 @ 0x01030000 S07 @ 0x01040000
...
S32 @ 0x011D0000 S33 @ 0x011E0000
S34 @ 0x011F0000
Protected sectors
16
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//freeelectrons.com
Flash commands (2)
uboot # protect off 1:04
UnProtect Flash Sectors 04 in Bank # 1
uboot # erase 1:04
Erase Flash Sectors 04 in Bank # 1
Erasing Sector 0 @ 0x01000000 ... done
Erasing Sector 1 @ 0x01004000 ... done
Erasing Sector 2 @ 0x01006000 ... done
Erasing Sector 3 @ 0x01008000 ... done
Erasing Sector 4 @ 0x01010000 ... done
17
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//freeelectrons.com
Flash commands (3)
Storing a file in flash
Downloading from the network:
uboot # tftp 8000 uboot.bin
Copy to flash (0x01000000: first sector)
uboot # cp.b ${fileaddr} 1000000 ${filesize}
Copy to Flash... ................ done
Restore flash sector protection:
uboot # protect on 1:04
Protect Flash Sectors 05 in Bank # 1
18
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//freeelectrons.com
boot commands
Specify kernel boot parameters:
uboot # setenv bootargs mem=64M \
console=ttyS0,115200 init=/sbin/init \
root=/dev/mtdblock0
Execute the kernel from a given physical address (RAM or
flash):
bootm 0x01030000
Continues on
the same line
19
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//freeelectrons.com
Useful links
Uboot home page:
http://www.denx.de/wiki/UBoot/WebHome
Very nice overview about Uboot
(which helped to create this section):
http://linuxdevices.com/articles/AT5085702347.html
The Uboot manual:
http://www.denx.de/wiki/view/DULG/UBoot
20
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//freeelectrons.com
Related documents
http://freeelectrons.com/training
Introduction to Unix and GNU/Linux
Embedded Linux kernel and driver development
Free Software tools for embedded Linux systems
Audio in embedded Linux systems
Multimedia in embedded Linux systems
http://freeelectrons.com/articles
Advantages of Free Software in embedded systems
Embedded Linux optimizations
Embedded Linux from Scratch... in 40 min!
Linux USB drivers
Realtime in embedded Linux systems
Introduction to uClinux
Linux on TI OMAP processors
Free Software development tools
Java in embedded Linux systems
Introduction to GNU/Linux and Free Software
Linux and ecology
What's new in Linux 2.6?
How to port Linux on a new PDA
All the technical presentations and training materials created and used by Free
Electrons, available under a free documentation license (more than 1500 pages!).
21
Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//freeelectrons.com
How to help
If you support this work, you can help ...
By sending corrections, suggestions, contributions and
translations
By asking your organization to order training sessions
performed by the author of these documents (see
http://freeelectrons.com/training)
By speaking about it to your friends, colleagues
and local Free Software community.
By adding links to our online materials on your website,
to increase their visibility in search engine results.
Custom Development
System integration
Embedded Linux demos and prototypes
System optimization
Linux kernel drivers
Application and interface development
Free Electrons services
Technical Support
Development tool and application support
Issue investigation and solution followup with
mainstream developers
Help getting started
Embedded Linux Training
Unix and GNU/Linux basics
Linux kernel and drivers development
Realtime Linux
uClinux
Development and profiling tools
Lightweight tools for embedded systems
Root filesystem creation
Audio and multimedia
System optimization
Consulting
Help in decision making
System architecture
Identification of suitable technologies
Managing licensing requirements
System design and performance review
http://freeelectrons.com
本文档为【U-Boot Bootloader】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑,
图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。