Hi,
The default boot loader on the SPI-NOR flash for IMX6 Sabrelite seems to be u-boot. My intention is to replace this with the minimal loader and load U-boot from SDCard instead.
Linaro's wiki provides a set of binaries as part of iMX6DQ_SPI_to_SD_loader_binaries_rev1.0.zip, but the image doesn't seem to boot.
(I tried downloading iMX6DQ_SPI_to_uSDHC3.bin using both u-boot and MFGTool.)
Now, i am searching for the boot-loader's source so that i can build the image and try downloading.
Any links to the code/tested image, suggestions and/or alternative methods to solve the problem would be of great help.
Thanks & Regards
Just some question to better understand the boot on sabrelite.
(reopening this issue).
1) reading around it seems the the sabrelite can only boot from SPINOR because the fuses are blowed to do that? is it true?
2) the bounduary procedure use a SPIto SD code the tell to the ROM monitor of imx6Q to boot from SD even if the fuses say boot from SPINOR? true? (Boards/MX6QSabreLite - Linaro Wiki)
3) if item 1) is true, my question is if the uboot is loaded from spiNOR shouldn't be possible anyway to load kernel and rootFS from a differnet media (SD or Sata), if that version of ubbot hase such driver for imx6?
thanks Omar
Yes, Florent is right. The boundary device solution through the u-boot command line and the SPI_to_SD code do the same thing. If you are able to boot the SD card with the boundary device solution (really make sure that the U-Boot from the SD card is started, e.g. by checking the version or similar) then your SD card is fine. This would mean that the SPI_to_SD code in the SPI NOR flash isn't working properly (?).
There are probably tens of combinations, so at some point I suggest you to quickly go through the reference manual to understand better what to do, and why you have to do it.
When booting form a SD card, the bootloader must contain an image vector table that must be placed at a certain offset: 0x400 = 1kB.
So, when doing a dd to program the u-boot, if bs=1k then seek=1, if bs=512 then seek=2 !
Also, I consider that the generated u-boot is always padded, and I won't bother much to use another non-padded version.
You can clearly identify the padded one with an od or hexdump command in Linux to identify the IVT header = 0xD1002040 at offset 0x400. Data from 0x4 -> 0x400 are likely zeros, with a 32-bit branch instruction at 0x0.
user@ubuntu:~/linux_bsp/uboot-imx$ hexdump u-boot.bin | more
0000000 01c6 ea00 0000 0000 0000 0000 0000 0000
0000010 0000 0000 0000 0000 0000 0000 0000 0000
*
0000400 00d1 4020 0720 2780 0000 0000 042c 2780
The instruction at 0x0 is useless, it is a legacy from previous i.MX.
Therefore, the typical dd command is:
sudo dd if=u-boot.bin of=/dev/sdb bs=512 seek=2 skip=2; sync
The skip is to remove the first 1kB of zeros from u-boot, and the seek to preserve the MBR and related file system information usually contained in these first blocks of a SD card.
The small SPI_to_SD code does the same thing than the boundary device solution through a u-boot command line. if you disassemble the code, you'll see the same.
Apologise for the delay in response.Thank you for your suggestions.
>> Dirk Behme
>> Does your SD card-B contain an U-Boot known to boot from SD on SabreLite?
I have the following U-boot images:
(1)uboot-imx image generated by building sourcecode downloaded from git://git.denx.de/u-boot.git uboot-imx
(Applied patch as specified by i.MX Android R13 (ICS11.11-6x) User Guide)
(2)Uboot images from MFGtool
I have tried downloading all these images on to the SDCard, but haven't been able to boot.
And since i am unable to boot from SD Card, i dont know if it is a problem with:
1)The minimal loader on SPI Nor
2)Uboot image
I have followed the download procedure as specified in my previous post.
>>Florent Auger
>>Then, I suggest to ensure that the u-boot is not padded, otherwise add the skip option. Also, I would use the regular >>block size of a SD card bs=512 >>instead of 1K.
I have tried placing the u-boot image at both locations: 512 and 1K :
sudo dd if=u-boot-no-padding.bin of=/dev/sdb bs=1K seek=1; sync
sudo dd if=u-boot-no-padding.bin of=/dev/sdb bs=512 seek=1; sync
Both failed to boot.
>>Eric Nelson
>>The short picture is that you can boot do SDHC3 with this U-Boot command:
>>U-Boot> mw.l 0x020d8040 0x3040 && mw.l 0x020d8044 0x10000000 && reset
I followed the procedure in the link http://boundarydevices.com/running-linaro-ubuntu-on-i-mx6-sabre-lite-and-nitrogen6x/ and am able to see the Uboot image from SDcard bootup after a reset command
But i am unable to reproduce this if i replace linaro's uboot.bin with any other u-boot image that i have built or with the ones available from MFGtool.Also, i cant get the linaro's uboot to boot if i download just this into a fresh SDcard at 2K (same location as used by the linaro script).
My goal is to be able to make changes to u-boot and build images to run from both SD-card and NandFlash on Sabrelite.(Later on this has to be used to bootup android)
Now, if there is no other simple way of booting an Uboot image from SDCard, i plan to dig into the script/procedure from
http://boundarydevices.com/running-linaro-ubuntu-on-i-mx6-sabre-lite-and-nitrogen6x/ to figure out how this is working and try to reproduce the same with my own built image.
Please advise.
While working on a 'bootsd' command for main-line U-Boot, Troy found a nice way to do this which is much
easier than the SPI_to_SD loader, though not permanent.
Details are in this blog post, but the short picture is that you can boot do SDHC3 with this U-Boot command:
U-Boot> mw.l 0x020d8040 0x3040 && mw.l 0x020d8044 0x10000000 && reset
I would expect u-boot to determine the uSDHC controller used at boot, but I can't be sure of that.
If that's not the case, from the Freescale docs and Linaro web site, it looks like Freescale u-boot uses uSDHC4, and Linaro uses the uSDHC3. I would suggest to use the appropriate u-boot.
Then, I suggest to ensure that the u-boot is not padded, otherwise add the skip option. Also, I would use the regular block size of a SD card bs=512 instead of 1K.
Does your SD card-B contain an U-Boot known to boot from SD on SabreLite?
Thanks for your responses.
I completely agree, the instructions are very simple, but the board is not booting after following them :-)
I am now attaching the exact steps that i followed for the download:
1) Downloaded iMX6DQ_SPI_to_SD_loader_binaries_rev1.0.zip from https://wiki.linaro.org/Boards/MX6QSabreLite.
Procedure 1:(Download from U-boot):
-----------------------------------
2)Downloaded iMX6DQ_SPI_to_uSDHC3.bin to a full sized SD card (SD card-A):
$sudo dd if=iMX6DQ_SPI_to_uSDHC3.bin of=/dev/sdb
2+1 records in
2+1 records out
1136 bytes (1.1 kB) copied, 0.0210224 s, 54.0 kB/s
3)Downloaded u-boot-mx6q-sabrelite.bin to a full sized SD card (SD card-B):(Assuming that this is a non-padded image)
$ sudo dd if=u-boot-mx6q-sabrelite.bin of=/dev/sdb bs=1K seek=1; sync
169+1 records in
169+1 records out
173688 bytes (174 kB) copied, 0.0970572 s, 1.8 MB/s
4)Insert the SD card-A at slot SD3, start board and stop autoboot to reach commandline.
4)Below is the log collected from the console:
U-Boot 2009.08 (May 14 2012 - 09:03:18)
CPU: Freescale i.MX6 family TO0.0 at 792 MHz
Temperature: can't get valid data!
mx6q pll1: 792MHz
mx6q pll2: 528MHz
mx6q pll3: 480MHz
mx6q pll8: 50MHz
ipg clock : 66000000Hz
ipg per clock : 66000000Hz
uart clock : 80000000Hz
cspi clock : 60000000Hz
ahb clock : 132000000Hz
axi clock : 264000000Hz
emi_slow clock: 29333333Hz
ddr clock : 528000000Hz
usdhc1 clock : 198000000Hz
usdhc2 clock : 198000000Hz
usdhc3 clock : 198000000Hz
usdhc4 clock : 198000000Hz
nfc clock : 24000000Hz
Board: MX6Q-SABRELITE:[ POR]
Boot Device: I2C
I2C: ready
DRAM: 1 GB
MMC: FSL_USDHC: 0,FSL_USDHC: 1
JEDEC ID: 0xbf:0x25:0x41
Reading SPI NOR flash 0xc0000 [0x2000 bytes] -> ram 0x276009b8
SUCCESS
In: serial
Out: serial
Err: serial
Net: got MAC address from IIM: 00:19:b8:00:e5:a0
FEC0 [PRIME]
Hit any key to stop autoboot: 0
MX6Q SABRELITE U-Boot > mmc dev 0
mmc0 is current device
MX6Q SABRELITE U-Boot > mmc read 0x10800000 0 200
MMC read: dev # 0, block # 0, count 512 ... 512 blocks read: OK
MX6Q SABRELITE U-Boot > sf probe 1
JEDEC ID: 0xbf:0x25:0x41
2048 KiB SST25VF016B - 2MB at 0:1 is now current device
MX6Q SABRELITE U-Boot > sf erase 0 0x40000
Erasing SPI NOR flash 0x0 [0x40000 bytes]
................................................................SUCCESS
MX6Q SABRELITE U-Boot > sf write 0x10800000 0 0x40000
Writing SPI NOR flash 0x0 [0x40000 bytes] <- ram 0x10800000
...SUCCESS
5)Once the above procedure was done, i rebooted the board after replacing SD card-A with SD card-B, but the board does not boot.
Thanks & Regards
The Sabre lite board has 2 SD ports, and in the SPI_to_SD zip package you have the 2 loaders for uSDHC3 or uSDHC4. So, you should use the appropriate one, depending from which port the i.MX boots !
You must follow the instructions to program with the SPI_to_SD binary in the SPI NOR as if it was u-boot. There are documents in the BSP for that.
There's nothing tricky here.
We use the boot from SD mechanism as described in "Boot from SD" at https://wiki.linaro.org/Boards/MX6QSabreLite on a lot of SabreLite boards and it works quite well. In the end, iMX6DQ_SPI_to_uSDHC3.bin isn't really a boot loader. It writes two registers telling the i.MX6 BootRom to switch to SD boot and then issues a system reset using the watchdog. As far as I know, there is no source code for this. But you can easily disassemble the .elf/.bin. You will see that we talk only about ~10-20 ARM assembly instructions, then.