One 、uboot brief introduction

    U-Boot, Full name Universal Boot Loader, It's following GPL Subordination of clauses FADSROM、8xxROM、PPCBOOT Gradually evolved Open source project .

     In terms of the operating system ,U-Boot Not only does it support embedded Linux System guidance , It also supports NetBSD, VxWorks, QNX, RTEMS, ARTOS, LynxOS, android Embedded operating system . The target operating system currently supported is OpenBSD, NetBSD, FreeBSD,4.4BSD, Linux, SVR4, Esix, Solaris, Irix, SCO, Dell, NCR, VxWorks, LynxOS, pSOS, QNX, RTEMS, ARTOS, android.

     stay CPU In terms of Architecture ,U-Boot In addition to supporting PowerPC Series of processors , Can also support MIPS、 x86、ARM、NIOS、XScale And so on many commonly used series processors .

U-Boot The goal of the project is to support as many as possible Embedded processor and Embedded operating system .

Two 、uboot Characteristics of

Uboot Characteristics of :

    1、 Open source ;

    2、 Support a variety of embedded operating system kernel , Such as Linux、NetBSD, VxWorks, QNX, RTEMS, ARTOS, LynxOS, android;

    3、 Support multiple processor families , Such as PowerPC、ARM、x86、MIPS;

    4、 High reliability and stability ;

    5、 Highly flexible function settings , fit U-Boot debugging 、 Different boot requirements of the operating system 、 Product release, etc ;

    6、 rich Device drivers Source code , Such as serial port 、 Ethernet 、SDRAM、FLASH、LCD、NVRAM、EEPROM、RTC、 Keyboard, etc ;

    7、 Rich development and debugging documents and powerful Network technology Support ;

3、 ... and 、 The main function

U-Boot The main functions supported :

    1、 System boot support NFS mount 、RAMDISK( Compressed or uncompressed ) Formal The root file system ; Support NFS mount 、 from FLASH Boot compressed or uncompressed systems in kernel ;

    2、 The basic auxiliary function is powerful Operating system interface function ; Flexible settings 、 Pass multiple key parameters to the operating system , It is suitable for system debugging requirements and product release in different development stages , Especially Linux The support is the strongest ; Support Target board There are many ways to store environmental parameters , Such as FLASH、NVRAM、EEPROM;

    3、 CRC32 Verification can be verified FLASH Middle core 、RAMDISK Image file Whether it is in good condition ;

    4、 Device drivers A serial port 、SDRAM、FLASH、 Ethernet 、LCD、NVRAM、EEPROM、 keyboard 、USB、PCMCIA、PCI、RTC And so on ;

    5、 Power on self test function SDRAM、FLASH Automatic size detection ;SDRAM Fault detection ;CPU model ;

    6、 Special function XIP kernel guide ;

Four 、 Working mode

    U-Boot There are two working modes: start loading mode and download mode .

1、 Start loading mode

     The boot loading mode is Bootloader Normal working mode of , When the embedded product is released ,Bootloader It has to work in this mode ,Bootloader take Embedded operating system from FLASH Load to SDRAM Run in , The whole process is automatic .

2、 Download mode

         The download mode is Bootloader By some means of communication kernel Image or The root file system Image, etc. from PC Download to Target board Of FLASH in . Users can take advantage of Bootloader Provide some command interface to complete the operation you want . Developers can use a variety of commands , Through serial port connection or network connection and other means of communication from the host (Host) Download the file ( Like kernel image 、 File system image ), Run them directly in memory or burn them in Flash Class solid state storage device .

         When transferring files between the board and the host , Can use serial port xmodem/ymodem/zmodem agreement , You can also use the Internet through tftp、nfs Protocol to transmit , as well as USB Download, etc .

     Generally speaking , Embedded developers use download mode to develop embedded system . Usually, cross network cable is used to connect PC Connect to the target development board , adopt TFTP The server downloads the kernel , use NFS The server mounts the file system .

5、 ... and 、uboot Common commands

1、 Get orders

command :help or ?

     function : View the current U-boot All commands supported in version .

2、 Environment variable command

bootdelay

Perform auto start (bootcmd The command ) Waiting seconds for

baudrate

Baud rate of serial console

netmask

The netmask of Ethernet

ethaddr

Ethernet MAC Address

bootfile

The default download file name

bootargs

Pass to Linux Kernel startup parameters

bootcmd

Execute commands on auto start

serverip

TFTP Server side IP Address

ipaddr

The local IP Address

stdin

Standard input devices , It's usually a serial port

stdout

standard output , It's usually a serial port , But LCD(VGA)

stderr

Standard error , It's usually a serial port , But LCD(VGA)

     Use printenv Command can print out the environment variables of the current development board .

        setenv envname value Set the value of the environment variable , without value, Delete env environment variable

    saveenv Save the modified environment variables to solid state memory .

    bootcmd Automatically start execution command ,uboot It will automatically count down after power on , Before the end of the countdown, if there is no external key to interrupt the automatic timing ,uboot Will be executed automatically bootcmd Variable Save command .

3、 Serial transmission command

    loadb   - load binary file over serial line (kermit mode)
    loadx   - load binary file over serial line (xmodem mode)
    loady   - load binary file over serial line (ymodem mode)

 

4、 Network command

    uboot You can transfer files to the development board through the network , Connect the development board and the computer directly with the cross network cable , You can also connect a router with an ordinary direct network cable .

    ping hostname

The reason why the Internet doesn't work :

        A、U-boot There is something wrong with the NIC driver
    B、U-boot There is a problem with the network protocol delay configuration
    C、 Network parameter configuration problem , such as IP etc. ,Host and Target There may be problems .

     If the network is connected , You can go through tftp、NFS Mount the development board

    nfs     - boot p_w_picpath via network using NFS protocol
    tftpboot- boot p_w_picpath via network using TFTP protocol
    bootp   - boot p_w_picpath via network using BOOTP/TFTP protocol

5、NandFlash Operation command

nand info

Display the available Nand Flash

nand device [dev]

Display or set the currently used Nand Flash

nand read  addr off  size

Nand Flash Read command , from Nand Of off Read at offset address size Bytes of data to SDRAM Of addr Address .

nand write   addr off  size

Nand Flash Burn order , take SDRAM Of addr At the address size Bytes of data are burned to Nand Of off offset .

nand write[.yaffs[1]] addr off size

burning yaffs  Image specific commands ,.yaffs1 for 512+16 NAND

nand erase [clean] [off size]

Nand Flash Erase the command , erase Nand Flash Of  off  Offset... At address size  Bytes of data

nand bad

Show Nand Flash My bad block

nand dump[.oob] off

Show Nand Flash Data in (16 Base number )

nand scrub

Erase the whole piece completely Nand Flash Data in , Include OOB. Can erase the software bad block mark .

nand markbad off

Mark  Nand Of  off  The block at the offset address is a bad block

6、 Memory 、 Register operation command

    nm      Modify the memory value ( Specify the address )    
     Format : nm [.b, .w, .l] address

 

    mm     Modify the memory value ( Add one to the address automatically )
     Format :  mm [.b, .w, .l] address 

    md       Display memory value
     Format :  md [.b, .w, .l] address [# of objects] 

    mw     Fill memory with specified data
     Format :  mw [.b, .w, .l] address value [count]

    cp      Copy of memory ( Including memory and Nor Flash Data copy between )
     Format :cp [.b, .w, .l] source target count

7、USB Operation command

usb reset

initialization USB controller

usb stop [f]

close USB controller

usb tree

Connected USB Device tree

usb info [dev]

Show USB equipment [dev] Information about

usb storage

Show connected USB The storage device

usb dev [dev]

Display and set the current USB The storage device

usb part [dev]

Show USB The storage device [dev] The partition information of

usb read addr blk# cnt

Read USB Storage device data

     Use USB Before operating the command, make sure that USB The device is connected ,usb reset, To initialize USB controller , Get device information .

8、SD/MMC Operation command

    mmc init [dev] - initialization MMC Subsystem
    mmc device [dev] - View and set the current device

     Use SD/MMC Before operating the command, make sure that SD/MMC The device is connected ,mmc init, To initialize MMC controller , Get device information .

6、 ... and 、uboot stay Flash Partition in

     In the embedded system, the commonly used Flash As a boot device ,Flash It's stored on the computer uboot、 environment variable 、 Kernel images and file systems .uboot Generally stored in Flash From , The location of its sector is generally determined by SoC Regulations , It's generally sector 0 Or sectors 1.uboot After storing environment variables , The storage location of kernel and file system can be allocated freely .

 

Uboot Official download address :

ftp://ftp.denx.de/pub/u-boot/

git://git.denx.de/u-boot.git

       http://git.denx.de/u-boot.git