General method for writing uboot, bootloader, and kernel in an Embedded System

Source: Internet
Author: User


General methods for writing uboot/bootloader/kernel in an embedded system this article introduces the general methods for writing uboot/bootloader/kernel in an embedded system, and if uboot or kernel errors occur, how to re-run uboot/kernel when the boot fails at www.2cto.com. there are generally two methods for writing uboot/kernel. One is to directly convert the uboot/kernel image files (binary files) in linux (shell) run the flash command to write the data to a specific flash partition. On the uboot interface, configure serverip, ipaddr, the following is an example of downloading uboot/kernel to flash using the tftp command: // 1. in linux shell, the uboot/kernel mtd write command is a custom flash command. // Burn write uboot,/dev/mtd0 is bootloader specific partition mtd write u-boot.bin/dev/mtd0 // burn write kernel, mtd1 is kernel specific partition mtd write vmlinux. elf/dev/mtd1 // restart reboot // 2. Run uboot/kernel on the uboot interface, take kernel as an example. // In the bootloader interface, // setenv ipaddr 10.10.167.10 // server IP address setenv serverip 10.10.167.249 // download the Linux kernel vmlinux52tftpboot 0 vmlinux52 // burn it to flash. // 0x20000000 is the storage location of vmlinux52. // 0x1dd00000 is the starting position of the system kernel (different locations for each device ), // + 0x600000 is the file length. upgrade 0x20000000 0x1dd00000 + 0x600000 // restart linux bootoctliux ******************* * ********************* if the startup fails due to uboot or Kernel errors, when a problem occurs, you need to determine whether the problem is in the uboot or linux phase. This can be determined by observing the debug information during the startup process. If the problem occurs in uboot, It is troublesome, this requires a flash chip with the correct uboot/bootloader to boot the system to the uboot interface, and then re-burn the uboot to the flash of the system, then burn the kernel (if necessary ). 1. A specific PCLL (flash chip) is required for re-writing uboot. A correct bootloader is fixed on this PCLL. Through this bootloader, you can successfully enter the bootloader interface, run uboot/bootloader again under this condition. The PLCC step is to change the Startup Mode of the system from external flash (that is, PLCC) to external boot by using a jumper/dial switch when the system is powered, after that, the system is powered on and starts from PLCC. After the boot is successful, go to the uboot interface, that is, the command line shows Dream 5220 ## (similar to the command line prompt). At this time, the startup mode of the edition card is changed to starting from nor flash. Then re-burn the uboot to the nor flash. Use kermit. Kermit is a serial port service tool. Similar to minicom, Kermit has more functions than minicom. // Kermit/usb0.cfg is the configuration file of kermit. You can specify the configuration file in the path kermit-y kermit/usb0.cfg-y kermit/usb0.cfg, such as/dev/ttyUSB0. The file content is as follows: /* set line/dev/ttyUSB0 set speed 115200 set carrier-watch off set hardshake noneset flow-control nonerobustset file type bin set file name Character set rec pack 1000 set send pack 1000 set window 5 */save the file in the main directory, name it: kermit/usb0.cfg (customizable). Enter the kermit interface. Press c to enter the serial interface (that is, the device interface) and switch back to the kermit interface. Shortcut: Ctrl + \, then press c. Run: Dream 5220 # detect: Checking for NOR flash... Flash detect 33554432 Mb, which indicates that flash is in good state. // Enable the serial port to enter the accept status. Dream 5220 # loadb enter the kermit interface: ctrl + \ press c to execute: send uboot. bin is to send the uboot. bin file in the current directory to the serial port. Then, enter the serial port interface. Run: Dream 5220 # upgrade 0x20000000 0x1dc00000 + 0xe0000 0x20000000 is the default address to which the file is sent after kermit sends the file. Write the file to the first address of nor flash: 0x1dc00000 + 0xe0000 is the write length. Run: reset. Restart the system. /* At this point, the new uboot is fully written. If the reset is still unsuccessful, the problem must be found in the linux Startup or new uboot, this can be seen through the debug information during the startup process. If there is a problem with the kernel, the linux does not enter the shell interface. to re-enter the Uboot environment, after the reset, press ctrl + c all the time, so that after uboot is started, it will not enter the kernel startup phase, but will stay in the uboot command line. In this uboot environment, run the new kernel, the configuration of ipaddr and serverip is the same as that in the initial example. // Setenv ipaddr 10.10.167.10 // server IP address setenv serverip 10.10.167.249 // download the Linux kernel vmlinux52 // the corresponding file exists in the tftpboot directory of the server, set up to tftp service environment tftpboot 0 vmlinux52 // burn to flash. // 0x20000000 is the storage location of vmlinux52. // 0x1dd00000 is the starting position of the system kernel (different locations for each device), // + 0x600000 is the file length upgrade 0x20000000 0x1dd00000 + 0x600000 before the reset, generally, you need to set the environment variable. For example, setenv linux_args mtdparts = octeon_nor0: 1 m (BOOT), 7 m (LINUX), 21 m (CONFIG), 3 m (MD) setenv bootcmd 'bootoctlinux 0x1dd00000 coremask = 0x3 mem = 000000' // save saveenv bootoctliux II. If the uboot itself is faulty, modify the uboot code. After compilation, use PLCC to repeat the above burning process.

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.