Content
- Get and compile the latest uBoot
- Run uBoot on an empty module
- Flash uBoot for the very first time into a fresh module
- Programming eFuses on very fresh module
- Updating uBoot
- Important files
- Help! uBoot doesnt boot up.
- Booting uBoot from an SD card
- Booting Windows from an SD card
- Booting printenv examples
- Compile latest kernel
Get and compile the latest uBoot
Run the following commands (please, be aware you are downloading uBoot for your module – you may want to use a different branch e.g. instead of “uboot_initial_changes” use u-boot-2gb or u-boot-512mb):
# cd /home/fedevel/ltib/rpm/BUILD/ # git clone -b uboot_initial_changes https://github.com/FEDEVEL/imx6rex-u-boot-2009.08.git # cd imx6rex-u-boot-2009.08/ # ./build_u-boot.sh # sudo cp u-boot.bin /tftp/
Run uBoot on an empty module (a fresh module just coming from production)
Register on the Freescale website, login, download Mfgtools-Rel-4.1.0_130816_MX6Q_UPDATER and unpack it.
We need to do some changes in the config files. Follow these steps:
1. Open “Mfgtools-Rel-4.1.0_130816_MX6Q_UPDATER\Profiles\MX6Q Linux Update\OS Firmware\ucl2.xml“
2. Find “LIST name=”Sabre-SD-K3.5.7″ desc=”Choose SD as media for kernel 3.5.7″ and just above this line place:
<LIST name="Sabre-SD-uBootOnly" desc="Only boot u-Boot.bin"> <CMD state="BootStrap" type="boot" body="BootStrap" file ="u-boot.bin" >Loading U-boot</CMD> <CMD state="BootStrap" type="load" file="initramfs.cpio.gz.uboot" address="0x10C00000" loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE" >Loading Initramfs.</CMD> <CMD state="BootStrap" type="jump" > Jumping to OS image. </CMD> </LIST>
3. Open the file Mfgtools-Rel-4.1.0_130816_MX6Q_UPDATER\cfg.ini and replace “name = Sabre-SD” with:
name = Sabre-SD-uBootOnly
4. The next step is to prepare TFTP client software for file transfer between Linux host computer and your Windows computer. Download & Install TFTPD32 on your local Windows machine.
After the installation, go to “Mfgtools-Rel-4.1.0_130816_MX6Q_UPDATER\Profiles\MX6Q Linux Update\OS Firmware\” and create an empty u-boot.bin file
5. Set TFTPD32 as you can see on the screenshot – use your Linux host IP, set your Mfgtools directory and press “GET” button. Then you need check if the u-boot from Linux host was uploaded to your Windows “Mfgtools-Rel-4.1.0_130816_MX6Q_UPDATER\Profiles\MX6Q Linux Update\OS Firmware\” directory (e.g. compare size of these two files):
6. Connect iMX6 Rex micro USB (J21) with your Windows computer. If your module is completely new, JP2 must not be fitted. If you have already programmed efuses, JP2 must be fitted. The USB series resistors must be in positions: R62 Fitted / R65 Fitted / R63 Not Fitted / R67 Not Fitted.
7. Connect iMX6 Rex serial port with null modem cable to your windows machine and run Hyperterminal (or download and use Tera Term). Set it to Baud rate: 115200 / Data: 8 / Parity: none / Stop bit: 1 / Flow control: none.
8. Start MfgTool2.exe from “Mfgtools-Rel-4.1.0_130816_MX6Q_UPDATER“
9. Switch on power of the iMX6 Rex board
10. The MfgTool2.exe must change:
from: “No device connected”
to: “HID-compliant device”
11. Press “Start” button
12. Watch the serial console, u-boot should now start.
Flash uBoot for the very first time into a fresh module (only once)
Your u-boot is now running from the previous steps. Connect network cable. Run these commands (update MAC, IP and server IP according to your setup):
> setenv netdev eth0 > setenv ethprime FEC0 > setenv ethact FEC0 > setenv ethaddr 00:01:02:03:04:05 > setenv fec_addr 00:01:02:03:04:05 > setenv ipaddr 192.168.0.150 > setenv serverip 192.168.0.86 > setenv gatewayip 192.168.0.1 > saveenv
Now flash the u-Boot into SPI. Check if the file u-boot.bin is placed on the TFTPD32 server. Just copy and paste this line into your console:
> mw.b 0x10800000 0xFF 0x80000;tftp 0x10800000 u-boot.bin;sf probe 3:2;sf erase 0x0 0x80000;sf write 0x10800000 0x0 0x80000
Programming eFuses on very fresh module (only once)
To be able to run the uBoot automaticaly from SPI, you need to program eFuses. Run these commands from uBoot. It’s very important you do it exactly this way – otherwise your module may never boot up.
//!!BEAWARE: Once you blow a bit to 1, it can NOT be changed back to 0!! //BE SURE YOU ARE DOING IT RIGHT - THIS IS THE CORRECT SETTING FOR iMX6 REX SPI BOOT //THE iMX6 REX SPI IS CONNECTED TO ECSPI3 and CS2 //for IMX6 REX, YOU MUST DO IT EXACTLY THIS WAY: > imxotp blow --force 5 0x2A000030 > imxotp blow --force 6 0x10
Program eFuses to set the MAC address. Be sure that you set the correct address – it cannot be changed back.
//!!BEAWARE: Once you blow a bit to 1, it can NOT be changed back to 0!! //USE YOUR MAC ADDRESS!!!!, this is just en example // example MAC Address: 00:0d:15:00:bc:4a > imxotp blow --force 23 0x000d > imxotp blow --force 22 0x1500bc4a
Now you can unplug the micro usb cable and reset the board.
Updating uBoot
Anytime you need to update uBoot, just run this command:
> mw.b 0x10800000 0xFF 0x80000;tftp 0x10800000 u-boot.bin;sf probe 3:2;sf erase 0x0 0x80000;sf write 0x10800000 0x0 0x80000
Important files
If you design your own baseboard, you may need to have a look at these files & directories:
imx6rex-u-boot-2009.08/board/freescale/mx6q_rex/ imx6rex-u-boot-2009.08/include/configs/mx6q_rex.h
Help! uBoot doesnt boot up.
If you accidentally flash a wrong u-boot, you can boot up through the USB cable and reflash it with a working one. Just follow the “Run uBoot on an empty module” steps.
Booting uBoot from an SD card
iMX6 Rex always boots up from the on-module SPI (this is defined by eFuses). Sometimes, you may want to boot uBoot from SD card. Follow these steps to do so:
To prepare a SD card, download cfimager, download uboot (depending on your module configuration use 1GB, 2GB or 512MB uboot version). Do not forget to rename uboot and the name of the card reader drive letter (located at the end of the command e.g. G). Use this command in Windows command prompt:
cfimager.exe -raw -offset 0x400 -skip 0x400 -f u-boot.bin -d G
Insert the SD card into the slot on the board edge (J29) – SD3 Interface. Now you have two options.
Option 1 – run this command from uBoot
> mw.l 0x020d8040 0x3040; mw.l 0x020d8044 0x10000000; reset
Option 2 – reflash SPI with iMX6DQ_SPI_to_uSDHC3.bin
Download iMX6DQ_SPI_to_uSDHC3.bin (originally from here) to your host machine and place it to the /tftp directory.
# cd # wget http://www.imx6rex.com/download/design-files/imx6_rex__development_baseboard/v1i1/firmware/sources_\&_other_files/iMX6DQ_SPI_to_SD_loader_binaries_rev1.0.zip # unzip iMX6DQ_SPI_to_SD_loader_binaries_rev1.0.zip # sudo cp -prv iMX6DQ_SPI_to_SD_loader_rev1.0/iMX6DQ_SPI_to_uSDHC3.bin /tftp
Go to you board and reflash the SPI:
> mw.b 0x10800000 0xFF 0x80000;tftp 0x10800000 iMX6DQ_SPI_to_uSDHC3.bin;sf probe 3:2;sf erase 0x0 0x80000;sf write 0x10800000 0x0 0x80000
In case you would like to use the standard SPI uboot again, you need to reflash the SPI back:
> mw.b 0x10800000 0xFF 0x80000;tftp 0x10800000 u-boot.bin;sf probe 3:2;sf erase 0x0 0x80000;sf write 0x10800000 0x0 0x80000
Booting Windows from an SD card
To prepare an SD card, download cfimager. You will also need your eboot.nb0 and NK.nb0 files. Insert the SD card into your computer and check the sd card letter (in our case, the SD card is visible as G drive, dont forget to replace the G in the commands below with the letter as your SD card was recognized). Then run these commands.
First save eboot.nb0 to SD card:
cfimager.exe -f eboot.nb0 -d G -imx53 -a
then save NK.nb0
cfimager.exe -f NK.nb0 -d G -imx53
Remove the SD card from your computer and plug it into the edge SD slot of your iMX6 Rex board. Cancel the u-boot autoboot and insert these commands:
> mw.l 0x020d8040 0x3040; mw.l 0x020d8044 0x10000000; reset
After this, press “space bar” to interrupt the eboot and press following keys:
Select SD3: M, T, 1, R,
Select booting device: 5, 5,
Disable KITL: K,
Start the Image: L,
Here are all the letters in one line: M, T, 1, R, 5, 5, K, L. After this, Windows Embedded Compact will boot up.
Booting printenv examples
Use HDMI as a default video output
> setenv bootargs_mmc 'setenv bootargs ${bootargs} ip=dhcp root=/dev/mmcblk0p1 rootwait video=mxcfb0:dev=hdmi,1920x1080M@60,if=RGB666 vmalloc=400M fbmem=28M fbcon=28M' > setenv bootcmd_mmc 'run bootargs_mmc ; mmc dev 1; ext2load mmc 1 0x10800000 uImage-gpu 3916636; bootm 0x10800000'
Compile latest kernel
To compile latest kernel run this commands >