Presentation on theme: "Das U-Boot 3/25/2017 Slide NOTE:"— Presentation transcript:
1 Das U-Boot 3/25/2017 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.
2 Boot Terminology Loader Bootloader / Bootstrap Boot PROM Boot Manager 3/25/2017Boot TerminologyLoaderProgram that moves bits from non volatile memory to memory and then transfers CPU control to the newly “loaded” bits (executable)Bootloader / BootstrapProgram that loads the “first program” (the kernel)Boot PROMPersistent code that is “already loaded” on power-upBoot ManagerProgram that lets you choose the “first program” to loadLoading is an important and often over-looked OS concept. Loading is increasingly accomplished “on-demand” via dynamic linking-loaders. The Linux kernel module mechanism is essentially an advanced application of dynamic linking/loading.People often mistakenly think that “bootstrap” refers to boot laces.The “bootstrap” metaphor refers to the nonsensical image of someone lifting themselves up off the ground by their own bootstrap. The impossibility of this image adds to the mystery of the boot process.There are lots of related types of “firmware”: ROM, PROM, EPROM, EEPROM, NVRAM, Flash RAM and who knows what else. PROM in “Boot PROM” or “PROM Monitor” is used informally. In the SPARC architecture, these are actually contained in EEPROMs.The phrase “first program” is in quotes for a reason. Often the first program loaded is itself a boot manager, like LILO.LILO introduces the concept of “chain loaders”. Why not have one loader load another loader which might load another loader…
3 What’s a Loader? memory loader bits flash cpu bits 3/25/2017What’s a Loader?A program that moves bits from flash or disk to memory and then transfers control to the newly loaded bits (executable).loadermemorybitsflashbitscpuA great reference is “Linkers & Loaders” by John Levine Morgan Kaufmann 2000.Loaders are also sometimes responsible for allocating memory, setting protection bits, updating memory maps, etc.
4 Loading through Das U-boot SDRAMMemory0x1000ResetCPUKernelRootFile-SystemROMBMODE 00ByPass PROM0xBootloaderubootBootloaderubootKernel ImageOptionalcompressedRoot File System
5 3/25/2017Das U-BootThe "Universal Bootloader" ("Das U-Boot") is a monitor/MicroOS program.Started in October of 1999 by Dan Malek, supported by Wolfgang Denk (Denx Engineering) as of July 2000Free Software: full source code under GPLHosted on SourceForge: ·Production quality:Used as default boot loader by several board vendors ·Portable and easy to port and to debugMany supported architectures: PPC, ARM, MIPS, x86, m68k, NIOS, Microblaze, and BlackfinMore than 216 boards supported by public source treeUboot – very powerful and supports:Network bootFlash based bootMultiple protocolsSplash screen (display image in CRT)
8 User Interface (1)U-Boot uses a simple command line interface (CLI), usually over a serial console port.Two different command interpreters are available:Simple CLI ·Bourne compatible shell (HUSH shell from Busybox) ·Configuration parameters and commands / command sequences (scripts !) can be stored in "environment variables" which can be saved to non-volatile storage (flash, EEPROM, NVRAM, etc.)
9 3/25/2017User Interface (2)U-Boot supports many different ways to load and boot an image.Serial Port: "loads" (S-Record), "loadb" (Kermit binary protocol)Ethernet: "tftp", "bootp", "dhcp", "nfs“Harddisk, CDROM: "ide read"CompactFlash card etc.: "ide read"USB Mass Storage Device: "usb read"SCSI Disk and CDROM: "scsi read"NAND flash with JFFS2 filesystem: "nboot"Disk on Chip: "doc read"PCI Bus: copyCommandsMemory CommandsFlash Memory CommandsExecution Control CommandsUser interface for Uboot – command line for serial port either net.Flexible and powerful – can configure your system and only compile what you need.Network CommandsBootpCdpdhcploadboadsNfspingrarpboottftpbootEnvironment Variables CommandsPrintenvsaveenvAskenvsetenvrunBootdInformation Commandsbdinfoconinfoflinfoiminfoimlshelp
10 Boot Image Image: Header: Actions: Header + Payload Creation TimestampData Load AddressEntry Point AddressData CRC ChecksumOperating SystemCPU architectureImage TypeCompression TypeImage NameActions:test CPU architecture and OStest checksum (optional)if compressed, uncompresscopy to load addressprepare boot argumentsstart at entry point
11 Image Types Standalone Programs OS Kernel Images RAMDisk Images 3/25/2017Image TypesStandalone ProgramsOS Kernel ImagesRAMDisk ImagesMulti-File ImagesFirmware ImagesScript filesStandalone ProgramsDirectly runnable in the environment provided by U-Boot; it is expected that you can continue to work in U-Boot after return from the Standalone Program.OS Kernel ImagesUsually images of some Embedded OS which will take over control completely. Usually these programs will install their own set of exception handlers, device drivers, set up the MMU, etc.RAMDisk ImagesData blocks, and their parameters (address, size) are passed to an OS kernel that is being started.Multi-File ImagesContain several images, typically an OS (Linux) kernel image and one or more data images like RAMDisks. This construct is useful for instance when you want to boot over the network using BOOTP etc., where the boot server provides just a single image file, but you want to get for instance an OS kernel and a RAMDisk image.Firmware ImagesBinary images containing firmware (like U-Boot or FPGA images) which usually will be programmed to flash memory.Script filesCommand sequences that will be executed by U-Boot's command interpreter; this feature is especially useful when you configure U-Boot to use a real shell (hush) as command interpreter.
12 Configuring U-BootConfiguration depends on the combination of board and CPU type; all such information is kept in a configuration file "include/configs/<board_name>.h".Example: For a STAMP board, all configuration settings are in "include/configs/stamp.h".For all supported boards there are ready-to-use default configurations available; just type "make <board_name>_config".Example: For the STAMP board type:cd u-bootmake stamp_configFor configuration details, check the U-Boot README and the Wiki – docs.blackfin.uclinux.org
13 Building U-Boot (1/2)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).It is assumed that you have the GNU cross compiling tools available in your path and named with a prefix of “bfin-elf". If this is not the case, you must change the definition of CROSS_COMPILE in Makefile.
14 Building U-Boot (2/2)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:cd u-bootmake clean; make mrpropermake stamp_configmake allYou should get some working U-Boot images ready for download to / installation on your system:"u-boot.bin" is a raw binary image"u-boot" is an image in ELF binary format"u-boot.srec" is in Motorola S-Record format
15 U-Boot Source Code Official U-boot Source Code is at: 3/25/2017U-Boot Source CodeOfficial U-boot Source Code is at:Unofficial Blackfin Branch is at:U-Boot uses a 3 level version number containing a version, a sub-version, and a patchlevel "U-Boot " means:version "2",sub-version "34", andpatchlevel "4".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 "0".Location of Uboot source code…
16 More U-Boot information The U-Boot project is hosted at Sourceforge:There is a pretty active u-boot-users mailing list.The Mailing list archive can be viewed at sourceforge.netThe 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 The whole DULG web packed into a single HTML page or a PDF file is also available (PowerPC is the example)The current README file can be viewed through viewcvs at sourceforge.net
18 Das U-Boot Introduction Porting Guide Directory Structure Material in this presentation is taken from the project README file, and from and
19 Supported Platforms Architecture Processor Number of Boards PPC 5xx 2 5xxx68xx71824x15826x2685xx37xx/74xx114xx38ARMStrongARM5ARM720TARM92xTArchitectureProcessorNumber of BoardsARM (cont)S3C44B01AT91RM9200XScale8x86SC5202m68kColdfireMIPS324KcAu1x003MIPS645KcNIOS32MicroblazeBlackfinBF533/BF535
20 Das U-boot Design Principles Easy to port to new architectures, new processors, and new boardsEasy to debug: serial console output as soon as possible ·Features and commands configurable ·As small as possible ·As reliable as possible
21 Image SupportAlthough U-Boot can support any OS or standalone application, the main focus has always been on Linux during the design of U-Boot.U-Boot includes many features that so far have been part of some special "boot loader" code within the Linux kernel. Also, any "initrd" images to be used are no longer part of one big Linux image; instead, kernel and "initrd" are separate images.
22 U-Boot Basic Command Set (1/4) Information Commandsbdinfo - print Board Info structure ¨coninfo - print console devices and informationsflinfo - print FLASH memory informationiminfo - print header information for application imageimls - list all images found in flashhelp - print online helpMemory Commandsbase - print or set address offsetcrc32 - checksum calculationcmp - memory comparecp - memory copymd - memory displaymm - memory modify (auto-incrementing)mtest - simple RAM testmw - memory write (fill)nm - memory modify (constant address)loop - infinite loop on address rangeFlash Memory Commandscp - memory copy (program flash)flinfo - print FLASH memory informationerase - erase FLASH memoryprotect - enable or disable FLASH write protectionExecution Control Commandsautoscr - run script from memorybootm - boot application image from memorybootelf - Boot from an ELF image in memorybootvx - Boot vxWorks from an ELF imagego - start application at address 'addr'
23 U-Boot Basic Command Set (2/4) Network Commandsbootp - boot image via network using BOOTP/TFTP protocolcdp - Perform Cisco Discovery Protocol network configurationdhcp - invoke DHCP client to obtain IP/boot paramsloadb - load binary file over serial line (kermit mode)loads - load S-Record file over serial linenfs - boot image via network using NFS protocolping - send ICMP ECHO_REQUEST to network hostrarpboot- boot image via network using RARP/TFTP protocoltftpboot- boot image via network using TFTP protocolEnvironment Variables Commandsprintenv- print environment variablessaveenv - save environment variables to persistent storageaskenv - get environment variables from stdinsetenv - set environment variablesrun - run commands in an environment variablebootd - boot default, i.e., run 'bootcmd'
24 U-Boot Basic Command Set (3/4) Filesystem Support (FAT, cramfs, JFFS2, Reiser)chpart - change active partitionfsinfo - print information about filesystemsfsload - load binary file from a filesystem imagels - list files in a directory (default /)fatinfo - print information about filesystemfatls - list files in a directory (default /)fatload - load binary file from a dos filesystemnand - NAND flash sub-systemreiserls- list files in a directory (default /)reiserload- load binary file from a Reiser filesystemSpecial Commandsi2c - I2C sub-systemdoc - Disk-On-Chip sub-systemdtt - Digital Thermometer and Themostateeprom - EEPROM sub-systemfpga - FPGA sub-systemide - IDE sub-systemkgdb - enter gdb remote debug modediskboot- boot from IDE deviceicache - enable or disable instruction cachedcache - enable or disable data cachediag - perform board diagnostics (POST code)log - manipulate logbufferpci - list and access PCI Configuraton Spaceregdump - register dump commandsusb - USB sub-systemsspi - SPI utility commands
25 U-Boot Basic Command Set (4/4) Miscellaneous Commandsbmp - manipulate BMP image data ¨date - get/set/reset date & time ¨echo - echo args to console ¨exit - exit script ¨kbd - read keyboard status ¨in - read data from an IO port ¨out - write datum to IO port ¨reset - Perform RESET of the CPU ¨sleep - delay execution for some time ¨test - minimal test like /bin/sh ¨version - print monitor version ¨wd - check and set watchdog ¨? - alias for 'help' ¨