BootStrap
From ArmadeusWiki
(Redirected from Bootstrtap)
Instructions to use the Armadeus U-Boot recovery utility.
If you think you bricked your board by flashing a bad bootloader, don't worry: there is a solution to recover it, without a JTAG probe. Indeed i.MX processors have an internal "bootstrap" mode that allow them to communicate through RS-232 or USB just after a reset.
Introduction
- The uboot_recover tool is a Python piece of code that allows you to automatically install a new U-Boot from scratch or to recover it in case of failure. uboot_recover requires the python and pyserial packages to be installed on your PC:
$ sudo apt-get install python-serial python-usb
This utility communicates with the i.MX(L/27/28/51/6/6UL) processor while in bootstrap mode (See i.MX(L/27/28/51/6/6UL) Reference Manual for more informations).
- To enter the bootstrap mode, you have to put the bootstrap jumper and reset your Armadeus board:
- Instructions to know how to do it and in which order is given by the recover tool, depending on your platform.
Usage
- Quit all Kermit/Minicom/GTKTerm/Hyperterminal sessions connected to the board through Serial Port.
- Go inside the software/uboot_recover/ directory and launch (sudo usage is required on APF28, APF51, APF6 and OPOS6UL):
$ cd software/uboot_recover/ $ sudo python xxxx_recover.py (xxxx depends on the version of your board (ie: apf9328, apf27, apf28, apf51, apf6 or opos6ul))
- The tool will ask you to specify the serial port on which the board is connected. Under Linux please use /dev/ttySx or /dev/ttyUSBx and under Window$ use COMx.
- Others information have to be given, depending on your platform:
APF9328 | APF27 | APF51 | APF28 | APF6 | 'OPOS6UL |
---|---|---|---|---|---|
The size of the SDRAM has to be indicated. Default value is 16Mo. The tool will then try to synchronize with the i.MX (on APF9328 only). When you see that message, reset your board: Re-synchronizing... Please reset your board in bootstrap mode ! Please reset your board in bootstrap mode ! Please reset your board in bootstrap mode ! Please reset your board in bootstrap mode ! loading file ramprogrammer.bin. Please wait... |
APF27 Bootstrap Tool /!\ Do not forget to put the bootstrap jumper and to reset your board /!\ (be sure to have a file named apf27-u-boot-nand.bin in current dir too) /!\ U-Boot recover eat lot of CPU, be sure that no process trust your CPU Enter serial port number or name to use (/dev/ttySx under Linux and COMx under Windows): |
--- APF6 Bootstrap Tool --- Procedure to follow: 1] Be sure to: * have built the APF6 BSP (make apf6_defconfig; make), * have "sb" tool installed (On Ubuntu: sudo apt-get install lrzsz), * have launched this script as root (sudo). 2] Power off your board, close all serial terminal sessions, remove all USB cables 3] Take jumper off BOOT0 pin and put it on BOOT1 pin. 4] Power on your board 5] Connect a USB cable from your PC to the APF6Dev OTG miniUSB connector 6] Connect a USB cable from your PC to the APF6Dev console miniUSB connector --- Enter serial port number or device name to use for console (/dev/ttyUSB0 under Linux (default) or COMx under Window$): |
--- OPOS6UL Bootstrap Tool --- Procedure to follow: 1] Be sure to: * have built the OPOS6UL BSP (make opos6ul_defconfig; make), * have "sb" tool installed on your PC (on Ubuntu: sudo apt-get install lrzsz), * have launched this script as root (sudo). 2] Power off your board, close all serial terminal sessions, remove all USB cables 3] Take jumper off BOOT1 pins and put it on BOOT0 pins. 4] Power on your board 5] Connect a USB cable from your PC to the OPOS6ULDev OTG miniUSB connector 6] Connect a USB cable from your PC to the OPOS6ULDev console/debug miniUSB connector --- Then, enter serial port number or device name to use for console (/dev/ttyUSB0 under Linux (default) or COMx under Window$): |
- After having entered the tools parameters and pressed ENTER, the following messages are displayed:
APF9328 | APF27 | APF51 | APF28 | APF6 | OPOS6UL |
---|---|---|---|---|---|
loading file ramprogrammer.bin. Please wait... 284 octets Loading file u-boot.bin. Please wait... 150304 octets loading file flashprogrammer.bin. Please wait... 668 octets Flashing please wait... . uBoot successfully recovered ! |
successful operation completion SDRAM INIT1 APF SDRAM INIT2 APF Transfering: 379952 bytes transfered Successful download completion U-Boot 2012.04.01 (Dec 21 2016 - 17:20:47) apf27 patch 3.8 I2C: ready DRAM: 128 MiB NAND: 256 MiB *** Warning - bad CRC, using default environment In: serial Out: serial Err: serial nand_unlock: start: 000a0000, length: 267780096! Net: FEC Hit any key to stop autoboot: 0 BIOS>Would you like to erase the environment variables? y/n: y env default -f && saveenv && echo Flash environment variables erased! ## Resetting to default environment Saving Environment to NAND... Erasing Nand... Erasing at 0xe0000 -- 100% complete. Writing to Nand... done Flash environment variables erased! BIOS> setenv fileaddr A0000000; setenv filesize 0005cc1c;run flash_uboot device 0 whole chip nand_unlock: start: 00000000, length: 268435456! NAND flash successfully unlocked NAND erase.part: device 0 offset 0x0, size 0xa0000 OK NAND write: device 0 offset 0x0, size 0x5cc1c 379932 bytes written: OK NAND flash successfully locked device 0 offset 0xa0000, size 0xff60000 nand_unlock: start: 000a0000, length: 267780096! NAND flash successfully unlocked Flashing of uboot succeed BIOS>U-Boot successfully recovered ! |
sb (lrzsz) 0.12.21rc config file <../../buildroot/output/host/usr/share/imx_usb_loader/imx_usb.conf> vid=0x066f pid=0x3780 file_name=mx23_usb_work.conf vid=0x15a2 pid=0x004f file_name=mx28_usb_work.conf vid=0x15a2 pid=0x0052 file_name=mx50_usb_work.conf vid=0x15a2 pid=0x0054 file_name=mx6_usb_work.conf vid=0x15a2 pid=0x0061 file_name=mx6_usb_work.conf vid=0x15a2 pid=0x0063 file_name=mx6_usb_work.conf vid=0x15a2 pid=0x0041 file_name=mx51_usb_work.conf vid=0x15a2 pid=0x004e file_name=mx53_usb_work.conf vid=0x15a2 pid=0x006a file_name=vybrid_usb_work.conf vid=0x066f pid=0x37ff file_name=linux_gadget.conf config file <../../buildroot/output/host/usr/share/imx_usb_loader/mx6_usb_work.conf> parse ../../buildroot/output/host/usr/share/imx_usb_loader/mx6_usb_work.conf 15a2:0054(apf6qdl) bConfigurationValue =1 Interface 0 claimed HAB security state: development mode (0x56787856) == work item filename apf6-u-boot.spl load_size 0 bytes load_addr 0x00000000 dcd 1 clear_dcd 0 plug 1 jump_mode 2 jump_addr 0x00000000 == end work item main dcd length 60 sub dcd length 5c loading binary file(apf6-u-boot.spl) to 00907400, skip=0, fsize=9c00 type=aa <<<39936, 39936 bytes>>> succeeded (status 0x88888888) jumping to 0x00907400 Sending: apf6-u-boot.img Bytes Sent: 372864 BPS:9112 Sending: Ymodem sectors/kbytes sent: 0/ 0k Transfer complete Opening serial port /dev/ttyUSB0... ts, 2 retries Loaded 372844 bytes U-Boot 2014.07 (Dec 11 2014 - 16:45:44) CPU: Freescale i.MX6D rev1.2 at 792 MHz Reset cause: POR Board: APF6 DRAM: 1 GiB MMC: FSL_SDHC: 0, FSL_SDHC: 1 WARNING: Make sure the PCIe #PERST line is connected! In: serial Out: serial Err: serial Net: FEC [PRIME] Saving Environment to MMC... Writing to MMC(0)... done Hit any key to stop autoboot: 0 BIOS> env default -f -a ## Resetting to default environment BIOS> loady ## Ready for binary (ymodem) download to 0x12000000 at 115200 bps... C Sending: apf6-u-boot.spl Bytes Sent: 39936 BPS:2382 Sending: Ymodem sectors/kbytes sent: 0/ 0k Transfer complete m - CRC mode, 2(SOH)/39(STX)/0(CAN) packets, 3 retries ## Total Size = 0x00009c00 = 39936 Bytes BIOS> run flash_uboot_spl switch to partitions #1, OK mmc0(part 1) is current device MMC write: dev # 0, block # 2, count 79 ... 79 blocks written: OK Flashing of U-boot SPL succeed BIOS> loady ## Ready for binary (ymodem) download to 0x12000000 at 115200 bps... C Sending: apf6-u-boot.img Bytes Sent: 372864 BPS:8061 Sending: Ymodem sectors/kbytes sent: 0/ 0k Transfer complete m - CRC mode, 3(SOH)/364(STX)/0(CAN) packets, 3 retries ## Total Size = 0x0005b06c = 372844 Bytes BIOS> run flash_uboot_img switch to partitions #1, OK mmc0(part 1) is current device MMC write: dev # 0, block # 138, count 729 ... 729 blocks written: OK Flashing of U-boot image succeed BIOS> --- Would you like to erase the environment variables ? y/N: y run flash_reset_env ## Resetting to default environment Saving Environment to MMC... Writing to redundant MMC(0)... done Flash environment variables erased! BIOS> --- U-Boot successfully recovered ! --- Now you can remove miniUSB OTG cable and put the jumper back on BOOT0 pin. Your board is running... |
--- U-Boot successfully recovered ! --- Now you can remove the miniUSB OTG cable and put the jumper back on BOOT0 pin. Your board will boot... As the restored U-Boot version may differ from the one your were using, if you want to maximize the chances to keep your rootfs data safe, we strongly advise you to reflash the same U-Boot version your were using before the recovery. Otherwise (you don't care about your data), please upgrade to the latest available stable Armadeus U-Boot release. |
- At the end, you can specify whether the environment variables (IP, your special scripts...) have to be erased or not. If your board does not start anymore after a first uboot_recover, please respond 'y'.
Note: If all went fine, don't forget to remove the bootstrap jumper if you want to restart the board in its normal boot state |