U Boot or Universal Bootloader


Published on

U Boot or Universal Bootloader

Published in: Technology
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Slide NOTE: Help the field to keep the messages clean and clear to customers, and add speaker notes for their use. Include at least major bullet points to be used as discussion points with customers during a presentation.
  • U Boot or Universal Bootloader

    1. 1. Das U-Boot
    2. 2. Boot Terminology <ul><li>Loader </li></ul><ul><ul><li>Program that moves bits from non volatile memory to memory and then transfers CPU control to the newly “loaded” bits (executable) </li></ul></ul><ul><li>Bootloader / Bootstrap </li></ul><ul><ul><li>Program that loads the “first program” (the kernel) </li></ul></ul><ul><li>Boot PROM </li></ul><ul><ul><li>Persistent code that is “already loaded” on power-up </li></ul></ul><ul><li>Boot Manager </li></ul><ul><ul><li>Program that lets you choose the “first program” to load </li></ul></ul>
    3. 3. What’s a Loader? <ul><li>A program that moves bits from flash or disk to memory and then transfers control to the newly loaded bits (executable). </li></ul>cpu loader flash bits memory bits
    4. 4. Loading through Das U-boot SDRAM Memory Root File-System Kernel ROM Kernel Image Bootloader uboot Root File System Reset Bootloader uboot CPU BMODE 00 ByPass PROM 0x20000000 0x1000 Optional compressed
    5. 5. Das U-Boot <ul><li>The &quot;Universal Bootloader&quot; ( &quot;Das U-Boot&quot;) is a monitor/MicroOS program. </li></ul><ul><li>Started in October of 1999 by Dan Malek, supported by Wolfgang Denk (Denx Engineering) as of July 2000 </li></ul><ul><li>Free Software: full source code under GPL </li></ul><ul><ul><li>Hosted on SourceForge: http://sourceforge.net/projects/u-boot · </li></ul></ul><ul><li>Production quality: </li></ul><ul><ul><li>Used as default boot loader by several board vendors · </li></ul></ul><ul><li>Portable and easy to port and to debug </li></ul><ul><li>Many supported architectures: PPC, ARM, MIPS, x86, m68k, NIOS, Microblaze, and Blackfin </li></ul><ul><ul><li>More than 216 boards supported by public source tree </li></ul></ul>
    6. 6. Blackfin U-boot features
    7. 7. Where to get U-boot sources
    8. 8. User Interface (1) <ul><li>U-Boot uses a simple command line interface (CLI), usually over a serial console port. </li></ul><ul><li>Two different command interpreters are available: </li></ul><ul><ul><li>Simple CLI · </li></ul></ul><ul><ul><li>Bourne compatible shell (HUSH shell from Busybox) · </li></ul></ul><ul><li>Configuration parameters and commands / command sequences (scripts !) can be stored in &quot;environment variables&quot; which can be saved to non-volatile storage (flash, EEPROM, NVRAM, etc.) </li></ul>
    9. 9. User Interface (2) <ul><li>U-Boot supports many different ways to load and boot an image. </li></ul><ul><ul><li>Serial Port: &quot;loads&quot; (S-Record), &quot;loadb&quot; (Kermit binary protocol) </li></ul></ul><ul><ul><li>Ethernet: &quot;tftp&quot;, &quot;bootp&quot;, &quot;dhcp&quot;, &quot;nfs“ </li></ul></ul><ul><ul><li>Harddisk, CDROM: &quot;ide read&quot; </li></ul></ul><ul><ul><li>CompactFlash card etc.: &quot;ide read&quot; </li></ul></ul><ul><ul><li>USB Mass Storage Device: &quot;usb read&quot; </li></ul></ul><ul><ul><li>SCSI Disk and CDROM: &quot;scsi read&quot; </li></ul></ul><ul><ul><li>NAND flash with JFFS2 filesystem: &quot;nboot&quot; </li></ul></ul><ul><ul><li>Disk on Chip: &quot;doc read&quot; </li></ul></ul><ul><ul><li>PCI Bus: copy </li></ul></ul><ul><li>Commands </li></ul><ul><li>Environment Variables Commands </li></ul><ul><ul><li>Printenv </li></ul></ul><ul><ul><li>saveenv </li></ul></ul><ul><ul><li>Askenv </li></ul></ul><ul><ul><li>setenv </li></ul></ul><ul><ul><li>run </li></ul></ul><ul><ul><li>Bootd </li></ul></ul><ul><li>Memory Commands </li></ul><ul><li>Flash Memory Commands </li></ul><ul><li>Execution Control Commands </li></ul><ul><li>Network Commands </li></ul><ul><ul><li>Bootp </li></ul></ul><ul><ul><li>Cdp </li></ul></ul><ul><ul><li>dhcp </li></ul></ul><ul><ul><li>loadb </li></ul></ul><ul><ul><li>oads </li></ul></ul><ul><ul><li>Nfs </li></ul></ul><ul><ul><li>ping </li></ul></ul><ul><ul><li>rarpboot </li></ul></ul><ul><ul><li>tftpboot </li></ul></ul><ul><li>Information Commands </li></ul><ul><ul><li>bdinfo </li></ul></ul><ul><ul><li>coninfo </li></ul></ul><ul><ul><li>flinfo </li></ul></ul><ul><ul><li>iminfo </li></ul></ul><ul><ul><li>imls </li></ul></ul><ul><ul><li>help </li></ul></ul>
    10. 10. Boot Image <ul><li>Image: </li></ul><ul><ul><li>Header + Payload </li></ul></ul><ul><li>Header: </li></ul><ul><ul><li>Creation Timestamp </li></ul></ul><ul><ul><li>Data Load Address </li></ul></ul><ul><ul><li>Entry Point Address </li></ul></ul><ul><ul><li>Data CRC Checksum </li></ul></ul><ul><ul><li>Operating System </li></ul></ul><ul><ul><li>CPU architecture </li></ul></ul><ul><ul><li>Image Type </li></ul></ul><ul><ul><li>Compression Type </li></ul></ul><ul><ul><li>Image Name </li></ul></ul><ul><li>Actions: </li></ul><ul><ul><li>test CPU architecture and OS </li></ul></ul><ul><ul><li>test checksum (optional) </li></ul></ul><ul><ul><li>if compressed, uncompress </li></ul></ul><ul><ul><li>copy to load address </li></ul></ul><ul><ul><li>prepare boot arguments </li></ul></ul><ul><ul><li>start at entry point </li></ul></ul>
    11. 11. Image Types <ul><li>Standalone Programs </li></ul><ul><li>OS Kernel Images </li></ul><ul><li>RAMDisk Images </li></ul><ul><li>Multi-File Images </li></ul><ul><li>Firmware Images </li></ul><ul><li>Script files </li></ul>
    12. 12. Configuring U-Boot <ul><li>Configuration depends on the combination of board and CPU type; all such information is kept in a configuration file &quot;include/configs/<board_name>.h&quot;. </li></ul><ul><ul><li>Example: For a STAMP board, all configuration settings are in &quot;include/configs/stamp.h&quot;. </li></ul></ul><ul><li>For all supported boards there are ready-to-use default configurations available; just type &quot;make <board_name>_config&quot;. </li></ul><ul><ul><li>Example: For the STAMP board type: </li></ul></ul><ul><ul><ul><ul><li>cd u-boot </li></ul></ul></ul></ul><ul><ul><ul><ul><li>make stamp_config </li></ul></ul></ul></ul><ul><li>For configuration details, check the U-Boot README and the Wiki – docs.blackfin.uclinux.org </li></ul>
    13. 13. Building U-Boot (1/2) <ul><li>Building U-Boot has been tested in x86 cross environments (running RedHat 6.x and 7.x Linux, SuSE 9.0 and 9.1 Linux on x86). </li></ul><ul><li>It is assumed that you have the GNU cross compiling tools available in your path and named with a prefix of “bfin-elf&quot;. If this is not the case, you must change the definition of CROSS_COMPILE in Makefile. </li></ul>
    14. 14. Building U-Boot (2/2) <ul><li>U-Boot is intended to be simple to build. After installing the sources you must configure U-Boot for one specific board type. This is done by typing: </li></ul><ul><ul><ul><li>cd u-boot </li></ul></ul></ul><ul><ul><ul><li>make clean; make mrproper </li></ul></ul></ul><ul><ul><ul><li>make stamp_config </li></ul></ul></ul><ul><ul><ul><li>make all </li></ul></ul></ul><ul><li>You should get some working U-Boot images ready for download to / installation on your system: </li></ul><ul><ul><li>&quot;u-boot.bin&quot; is a raw binary image </li></ul></ul><ul><ul><li>&quot;u-boot&quot; is an image in ELF binary format </li></ul></ul><ul><ul><li>&quot;u-boot.srec&quot; is in Motorola S-Record format </li></ul></ul>
    15. 15. U-Boot Source Code <ul><li>Official U-boot Source Code is at: </li></ul><ul><ul><li>http://sourceforge.net/projects/u-boot </li></ul></ul><ul><li>Unofficial Blackfin Branch is at: </li></ul><ul><ul><li>http://blackfin.uclinux.org/projects/uboot533 </li></ul></ul><ul><li>U-Boot uses a 3 level version number containing a version, a sub-version, and a patchlevel &quot;U-Boot-2.34.5&quot; means: </li></ul><ul><ul><li>version &quot;2&quot;, </li></ul></ul><ul><ul><li>sub-version &quot;34&quot;, and </li></ul></ul><ul><ul><li>patchlevel &quot;4&quot;. </li></ul></ul><ul><li>The patchlevel is used to indicate certain stages of development between released versions, i. e. officially released versions of U-Boot will always have a patchlevel of &quot;0&quot;. </li></ul>
    16. 16. More U-Boot information <ul><li>The U-Boot project is hosted at Sourceforge: http://sourceforge.net/projects/u-boot </li></ul><ul><li>There is a pretty active u-boot-users mailing list. </li></ul><ul><li>The Mailing list archive can be viewed at sourceforge.net http://lists.sourceforge.net/lists/listinfo/u-boot-users/ </li></ul><ul><li>The DENX U-Boot and Linux Guide is a Wiki based documentation documenting U-Boot and its interaction with Linux. It can be viewed (and improved) at www.denx.de. The whole DULG web packed into a single HTML page or a PDF file is also available (PowerPC is the example) </li></ul><ul><li>The current README file can be viewed through viewcvs at sourceforge.net </li></ul>
    17. 17. Backup slides
    18. 18. Das U-Boot <ul><li>Introduction </li></ul><ul><li>Porting Guide </li></ul><ul><li>Directory Structure </li></ul><ul><li>Material in this presentation is taken from the project README file, and from http://www.denx.de/twiki/bin/view/UBootdoc/Presentation and http:// www.denx.de/twiki/bin/view/DULG/Manual </li></ul>
    19. 19. Supported Platforms 11 ARM92xT   3 ARM720T   5 StrongARM ARM 38 4xx   11 7xx/74xx   3 85xx   26 826x   15 824x   71 8xx   6 5xxx   2 5xx PPC Number of Boards Processor Architecture 3 BF533/BF535 Blackfin 1   Microblaze 3   NIOS32 1 5Kc MIPS64 3 Au1x00   2 4Kc MIPS32 2 Coldfire m68k 2 SC520 x86 8 XScale   1 AT91RM9200   1 S3C44B0 ARM (cont) Number of Boards Processor Architecture
    20. 20. Das U-boot Design Principles <ul><li>Easy to port to new architectures, new processors, and new boards </li></ul><ul><li>Easy to debug: serial console output as soon as possible · </li></ul><ul><li>Features and commands configurable · </li></ul><ul><li>As small as possible · </li></ul><ul><li>As reliable as possible </li></ul>
    21. 21. Image Support <ul><li>Although U-Boot can support any OS or standalone application, the main focus has always been on Linux during the design of U-Boot. </li></ul><ul><li>U-Boot includes many features that so far have been part of some special &quot;boot loader&quot; code within the Linux kernel. Also, any &quot;initrd&quot; images to be used are no longer part of one big Linux image; instead, kernel and &quot;initrd&quot; are separate images. </li></ul>
    22. 22. U-Boot Basic Command Set (1/4) <ul><li>Information Commands </li></ul><ul><ul><li>bdinfo - print Board Info structure ¨ </li></ul></ul><ul><ul><li>coninfo - print console devices and informations </li></ul></ul><ul><ul><li>flinfo - print FLASH memory information </li></ul></ul><ul><ul><li>iminfo - print header information for application image </li></ul></ul><ul><ul><li>imls - list all images found in flash </li></ul></ul><ul><ul><li>help - print online help </li></ul></ul><ul><li>Memory Commands </li></ul><ul><ul><li>base - print or set address offset </li></ul></ul><ul><ul><li>crc32 - checksum calculation </li></ul></ul><ul><ul><li>cmp - memory compare </li></ul></ul><ul><ul><li>cp - memory copy </li></ul></ul><ul><ul><li>md - memory display </li></ul></ul><ul><ul><li>mm - memory modify (auto-incrementing) </li></ul></ul><ul><ul><li>mtest - simple RAM test </li></ul></ul><ul><ul><li>mw - memory write (fill) </li></ul></ul><ul><ul><li>nm - memory modify (constant address) </li></ul></ul><ul><ul><li>loop - infinite loop on address range </li></ul></ul><ul><li>Flash Memory Commands </li></ul><ul><ul><li>cp - memory copy (program flash) </li></ul></ul><ul><ul><li>flinfo - print FLASH memory information </li></ul></ul><ul><ul><li>erase - erase FLASH memory </li></ul></ul><ul><ul><li>protect - enable or disable FLASH write protection </li></ul></ul><ul><li>Execution Control Commands </li></ul><ul><ul><li>autoscr - run script from memory </li></ul></ul><ul><ul><li>bootm - boot application image from memory </li></ul></ul><ul><ul><li>bootelf - Boot from an ELF image in memory </li></ul></ul><ul><ul><li>bootvx - Boot vxWorks from an ELF image </li></ul></ul><ul><ul><li>go - start application at address 'addr' </li></ul></ul>
    23. 23. U-Boot Basic Command Set (2/4) <ul><li>Network Commands </li></ul><ul><ul><li>bootp - boot image via network using BOOTP/TFTP protocol </li></ul></ul><ul><ul><li>cdp - Perform Cisco Discovery Protocol network configuration </li></ul></ul><ul><ul><li>dhcp - invoke DHCP client to obtain IP/boot params </li></ul></ul><ul><ul><li>loadb - load binary file over serial line (kermit mode) </li></ul></ul><ul><ul><li>loads - load S-Record file over serial line </li></ul></ul><ul><ul><li>nfs - boot image via network using NFS protocol </li></ul></ul><ul><ul><li>ping - send ICMP ECHO_REQUEST to network host </li></ul></ul><ul><ul><li>rarpboot- boot image via network using RARP/TFTP protocol </li></ul></ul><ul><ul><li>tftpboot- boot image via network using TFTP protocol </li></ul></ul><ul><li>Environment Variables Commands </li></ul><ul><ul><li>printenv- print environment variables </li></ul></ul><ul><ul><li>saveenv - save environment variables to persistent storage </li></ul></ul><ul><ul><li>askenv - get environment variables from stdin </li></ul></ul><ul><ul><li>setenv - set environment variables </li></ul></ul><ul><ul><li>run - run commands in an environment variable </li></ul></ul><ul><ul><li>bootd - boot default, i.e., run 'bootcmd' </li></ul></ul>
    24. 24. U-Boot Basic Command Set (3/4) <ul><li>Filesystem Support (FAT, cramfs, JFFS2, Reiser) </li></ul><ul><ul><li>chpart - change active partition </li></ul></ul><ul><ul><li>fsinfo - print information about filesystems </li></ul></ul><ul><ul><li>fsload - load binary file from a filesystem image </li></ul></ul><ul><ul><li>ls - list files in a directory (default /) </li></ul></ul><ul><ul><li>fatinfo - print information about filesystem </li></ul></ul><ul><ul><li>fatls - list files in a directory (default /) </li></ul></ul><ul><ul><li>fatload - load binary file from a dos filesystem </li></ul></ul><ul><ul><li>nand - NAND flash sub-system </li></ul></ul><ul><ul><li>reiserls- list files in a directory (default /) </li></ul></ul><ul><ul><li>reiserload- load binary file from a Reiser filesystem </li></ul></ul><ul><li>Special Commands </li></ul><ul><ul><li>i2c - I2C sub-system </li></ul></ul><ul><ul><li>doc - Disk-On-Chip sub-system </li></ul></ul><ul><ul><li>dtt - Digital Thermometer and Themostat </li></ul></ul><ul><ul><li>eeprom - EEPROM sub-system </li></ul></ul><ul><ul><li>fpga - FPGA sub-system </li></ul></ul><ul><ul><li>ide - IDE sub-system </li></ul></ul><ul><ul><li>kgdb - enter gdb remote debug mode </li></ul></ul><ul><ul><li>diskboot- boot from IDE device </li></ul></ul><ul><ul><li>icache - enable or disable instruction cache </li></ul></ul><ul><ul><li>dcache - enable or disable data cache </li></ul></ul><ul><ul><li>diag - perform board diagnostics ( POST code) </li></ul></ul><ul><ul><li>log - manipulate logbuffer </li></ul></ul><ul><ul><li>pci - list and access PCI Configuraton Space </li></ul></ul><ul><ul><li>regdump - register dump commands </li></ul></ul><ul><ul><li>usb - USB sub-system </li></ul></ul><ul><ul><li>sspi - SPI utility commands </li></ul></ul>
    25. 25. U-Boot Basic Command Set (4/4) <ul><li>Miscellaneous Commands </li></ul><ul><ul><li>bmp - manipulate BMP image data ¨ </li></ul></ul><ul><ul><li>date - get/set/reset date & time ¨ </li></ul></ul><ul><ul><li>echo - echo args to console ¨ </li></ul></ul><ul><ul><li>exit - exit script ¨ </li></ul></ul><ul><ul><li>kbd - read keyboard status ¨ </li></ul></ul><ul><ul><li>in - read data from an IO port ¨ </li></ul></ul><ul><ul><li>out - write datum to IO port ¨ </li></ul></ul><ul><ul><li>reset - Perform RESET of the CPU ¨ </li></ul></ul><ul><ul><li>sleep - delay execution for some time ¨ </li></ul></ul><ul><ul><li>test - minimal test like /bin/sh ¨ </li></ul></ul><ul><ul><li>version - print monitor version ¨ </li></ul></ul><ul><ul><li>wd - check and set watchdog ¨ </li></ul></ul><ul><ul><li>? - alias for 'help' ¨ </li></ul></ul>