首页 U-Boot Bootloader

U-Boot Bootloader

举报
开通vip

U-Boot Bootloader 1 Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//free­electrons.com The U­boot bootloader The U­boot bootloader Michael Opdenacker Thomas Petazzoni Free Electrons 2 Free Electrons. Kernel, drivers...

U-Boot Bootloader
1 Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//free­electrons.com The U­boot bootloader The U­boot bootloader Michael Opdenacker Thomas Petazzoni Free Electrons 2 Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//free­electrons.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/by­sa/3.0/legalcode © Copyright 2004­2009, Free Electrons feedback@free­electrons.com Document sources, updates and translations:  http://free­electrons.com/docs/u­boot 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//free­electrons.com Das U­boot http://www.denx.de/wiki/UBoot/WebHome Das U­Boot: Universal Bootloader from Denx Software The most used on arm. Supports: arm, ppc, mips, x86, m68k, nios... See our U­boot presentation for details: http://free­electrons.com/docs/u­boot Easy to port to new boards. See our BSP presentation for porting details: http://free­electrons.com/docs/bsp 4 Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//free­electrons.com Postprocessing kernel image for U­boot The U­boot bootloader needs extra information to be added to  the kernel and initrd image files.  mkimage postprocessing utility provided in U­boot sources Kernel image postprocessing: make uImage 5 Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//free­electrons.com Postprocessing initrd image for U­boot mkimage ­n initrd \  Name ­A arm \ Architecture ­O linux \ Operating System ­T ramdisk \ Type ­C gzip \ Compression ­d rd­ext2.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//free­electrons.com Compiling Das U­boot Get the U­boot sources from http://www.denx.de/wiki/UBoot In the U­boot source directory: Find the name of the config file for your board in include/configs  (for example: omap1710h3.h) Configure U­boot: make omap1710h3_config  (.h replaced by _config) If needed, change the cross­compiler prefix in Makefile: ifeq ($(ARCH),arm) CROSS_COMPILE = arm­linux­ endif Specify the path to your cross­compiler. For example: export PATH=/usr/local/uclibc­0.9.28­2/arm/bin:$PATH Compile: make 7 Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//free­electrons.com Compiling U­boot mkimage If you just need mkimage and U­boot is already installed on your board: mkimage is completely architecture and board independent. Configure U­boot 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//free­electrons.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 tftp­server 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//free­electrons.com Configuring tftp (2) On GNU/Linux systems based on Debian: Ubuntu, Knoppix Install the tftpd­hpa package if needed Set RUN_DAEMON="yes" in /etc/default/tftpd­hpa 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/tftpd­hpa restart 10 Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//free­electrons.com U­boot prompt Connect the target to the host through a serial console Power­up the board. On the serial console, you will see something like: U­Boot 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 u­boot #  11 Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//free­electrons.com Board information u­boot # 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//free­electrons.com Environment variables (1) u­boot # 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 u­boot # setenv serverip 10.0.0.2 u­boot # printenv serverip serverip=10.0.0.2 13 Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//free­electrons.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//free­electrons.com Network commands u­boot # tftp 8000 u­boot.bin From server 10.0.0.1; our IP address is  10.0.0.11 Filename 'u­boot.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//free­electrons.com Flash commands (1) u­boot # 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//free­electrons.com Flash commands (2) u­boot # protect off 1:0­4 Un­Protect Flash Sectors 0­4 in Bank # 1 u­boot # erase 1:0­4 Erase Flash Sectors 0­4 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//free­electrons.com Flash commands (3) Storing a file in flash Downloading from the network: u­boot # tftp 8000 u­boot.bin Copy to flash (0x01000000: first sector) u­boot # cp.b ${fileaddr} 1000000 ${filesize} Copy to Flash... ................ done Restore flash sector protection: u­boot # protect on 1:0­4 Protect Flash Sectors 0­5 in Bank # 1 18 Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//free­electrons.com boot commands Specify kernel boot parameters: u­boot # 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//free­electrons.com Useful links U­boot home page: http://www.denx.de/wiki/UBoot/WebHome Very nice overview about U­boot (which helped to create this section): http://linuxdevices.com/articles/AT5085702347.html The U­boot manual: http://www.denx.de/wiki/view/DULG/UBoot                20 Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//free­electrons.com Related documents http://free­electrons.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://free­electrons.com/articles Advantages of Free Software in embedded systems Embedded Linux optimizations Embedded Linux from Scratch... in 40 min! Linux USB drivers Real­time 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//free­electrons.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://free­electrons.com/training) By speaking about it to your friends, colleagues and local Free Software community. By adding links to our on­line 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 follow­up with  mainstream developers Help getting started Embedded Linux Training Unix and GNU/Linux basics Linux kernel and drivers development Real­time 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://free­electrons.com
本文档为【U-Boot Bootloader】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_617163
暂无简介~
格式:pdf
大小:438KB
软件:PDF阅读器
页数:22
分类:互联网
上传时间:2013-04-18
浏览量:56