Write the uboot and linux operating systems-general Linux technology-Linux programming and kernel information to Flash. The following is a detailed description. I. In-chip startup
1. Use the Xmodem protocol to send the loader. bin and uboot. binfile, uboot. the bin is sent to the system's SDRAM. After sending the bin, uboot starts to run. If the bin is powered off or exited, everything starts from the beginning, because the data stored in the SDRAM will disappear after power failure or exit.
2. Erase Flash
Before burning or writing Flash, you need to erase it:
Uboot> protect off all remove Flash sector write Protection
Uboot> erase all erased all Flash sectors
(Note:
If you only want to erase the Flash in a certain area, such as the area between 0x0000000 and 0x10060000, you can run the following command:
1) protect off 10000000 1006 ffff
2) erase 10000000 1006 ffff
If you want to add write protection to an area, such as the area between 0x0000000 and 0x10060000, you can run the following command:
1) protect on 10000000 1006 ffff
You can use the flinfo command to view which areas are protected and those areas are not protected.
)
3. Burn boot. bin to Flash
At the Uboot prompt, type the following command:
Uboot> loadb 21000000 (boot will be displayed after the download. bin size, and then run the command cp. B converts the last 4 digits to f When writing the code. If the file size is 5e33a, it is changed to 5 ffff when writing the code.) the file is sent to the system's SDRAM.
Then, use the Kermit protocol on the Super Terminal to send the file boot. bin. After sending the file, type the following command:
Uboot> cp. B 21000000 10000000 5 ffff writes data sent to SDRAM to Flash
Uboot> protect on 10000000 10005 ffff write protection for the content written into Flash
(Note:
You can also use the tftp or bootp protocol, but you must first set the network variable, that is, the IP address of the Local Machine and the target machine, and the Mac address of the target machine.
Network environment variables:
Uboot> setenv bootargs root =/dev/ram rw initrd = 0x21100000,6000000 ramdisk_size = 15360
Console = ttyS0, 115200, mem = 32 M start system environment variable
Uboot> setenv ethaddr 12: 34: 56: 78: 99: aa mac address
Uboot> setenv ipaddr [target board ip address] Target Board ip Address
Uboot> setenv serverip [Host ip address] Host ip Address
Tftp protocol:
1) tftp 21000000 lb/boot. bin
2) cp. B 21000000 10000000 5 ffff
3) protect on 10000000 10005fff
Bootp protocol:
1) bootp 21000000 lb/boot. bin
2) cp. B 21000000 10000000 5 ffff
3) protect on 10000000 10005fff
)
4. Run Uboot.gz to Flash.
At the Uboot prompt, type the command: Install uboot.gz
Uboot> loadb 20000000 sends a file to the system's SDRAM
Then, use kermitprotocol to send the uboot.gz file in the Super Bowl. After sending the file, type the following command:
Uboot> cp. B 20000000 10010000 ffff writes data sent to SDRAM to Flash
Uboot> protect on 10000000 1001 ffff write protection for the content written into Flash
(Note: tftp or bootp protocol can also be used here)
Ii. Off-chip startup
1) how to run your program in uboot
1. Run the program manually (only download the program to the SDRAM and run it for test purposes only. The program disappears after power failure or Exit)
1) loadb 20000000 download the user program (*. bin) <注:必须是.bin文件,可用arm-linux-objcopy命令生成>
2) The go 20000000 program will run
2. Automatic Running (write the program to Flash, and the program runs automatically after uboot is started)
1) set Environment Variables
Uboot> setenv usr_prg cp. B 10300000 20000000 ffff (program size)
Uboot> setenv run_prg go 20000000
Uboot> setenv bootcmd run usr_prg \; run run_prg
Uboot> saveenv
2) write the program to burn it into Flash
Protect off all
Erase 10300000 103 fffff
Loadb 20000000 download *. bin
Cp. B 20000000 10300000 ffff (user program size)
3) after reset, the program runs automatically.
Ii. run linux
1. Download the SDRAM from linux to the system for running (only for testing purposes, and it will disappear after power failure or Exit)
1) Run Uboot and set Environment Variables
Uboot> setenv bootargs root =/dev/ram rw initrd = 0x21100000,6000000 ramdisk_size = 15360
Console = ttyS0, 115200, mem = 32 M start system environment variable
Uboot> setenv ethaddr 12: 34: 56: 78: 99: aa mac address
Uboot> setenv ipaddr [target board ip address] Target Board ip Address
Uboot> setenv serverip [Host ip address] Host ip Address
2) download the Linux kernel and File System
Open the tftpserver application, set the root directory path, and copy the kernel and file system to the configured root directory.
Uboot> tftp 21100000 ramdisk.gz download file system
Uboot> tftp 21000000 uImage download linux Kernel
Uboot> bootm 21000000 start linux
Then the linux operating system starts to run.
2. Run the Flash program from Linux to the system.
1) set the environment variables for running Linux
Uboot> setenv bootargs root =/dev/ram rw initrd = 0x21100000,6000000 ramdisk_size = 15360 console = ttyS0, 115200, mem = 32 M start system environment variable
Uboot> setenv image cp. B 10020000 21000000 b0000 copy the kernel to sdram
Uboot> setenv ramdisk cp. B 100d0000 21100000 copy file system to sdram
Uboot> setenv boot bootm variable boot
Uboot> setenv bootcmd run ramdisk \; run image \; run boot sets the default variable bootcmd
Uboot> setenv ethaddr 12: 34: 56: 78: 99: aa mac address
Uboot> setenv ipaddr target board ip address, which is determined by yourself
Uboot> setenv serverip Host ip address, which is the ip address of your PC
Uboot> saveenv save environment variables
2) Burn the Linux kernel to Flash
Uboot> tftp 21100000 ramdisk.gz
Uboot> cp. B 21100000 100d0000 226000
Uboot> tftp 21000000 uImage
Uboot> cp. B 21000000 10020000 b0000
The reset linux operating system starts to run.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.