Here is a quick summary at booting a Linux system on the i.MX 6 Sabre SD platform, through USB.
This assumes you have a "working" Linux development environment at hand (e.g. Debian), and that your are able to build a working Linux system with buildroot already, as explained in this post. You will also need libusb-1.0 development files (headers and libraries), as well as root/sudo permissions to access USB peripherals.
Also, we will use the fine imx_usb_loader tool that the nice folks at Boundary Devices have developed for their i.MX 5/6 boards, as it works fine for Sabre sd as well.
We will use git to fetch buildroot sources:
$ git clone git://git.busybox.net/buildroot
This should create a buildroot directory with all the latest sources (after a while).
Note that for more stability you might want to checkout a release instead of the latest version; to do so, list the available release tags with e.g. git tag -l '201*', and git checkout <the-desired-tag>.
The beauty of buildroot is that it will take care of everything for you, including preparing a cross compiler. You can configure buildroot for Sabre SD by doing:
$ cd buildroot
$ make freescale_imx6sabresd_defconfig
By default this would generate binaries suitable for booting with an SD card, so we need to tweak a few settings to obtain a ramdisk, which u-boot will like. Summon the configuration menu with the following command:
$ make menuconfig
Descend into the "Filesystem images" submenu, and select the following buildroot options:
Exit, saving your configuration. You might want to verify that you have indeed the the correct options in your .config:
$ grep '^BR2_TARGET_ROOTFS_CPIO' .config
This should return the following:
BR2_TARGET_ROOTFS_CPIO=y
BR2_TARGET_ROOTFS_CPIO_GZIP=y
BR2_TARGET_ROOTFS_CPIO_UIMAGE=y
You may then proceed with the build:
$ make
This should download and build everything, so it will take a while.
Note that, as bryanthomas pointed out, there are no files for the sabre sd in the boards folder. This is because no patches or custom kernel configurations are needed outside of what is defined in the defconfig. So the only place the sabre sd board lives in buildroot is in the configs directory. At the time of writing we still need a small final hack to have Linux boot on /init instead of its default /linuxrc for proper boot on ramdisk, though. Hopefully this should be addressed in a future buildroot version, and a patch is on his way, but for now we change the boot script in our target filesystem with:
$ cd output/target
$ ln -svf init linuxrc
$ cd ../..
$ make
All build results will fall under the output/images folder. We are most interested in the following pieces:
output/images/
+- imx6q-sabresq.dtb
+- rootfs.cpio.uboot
+- u-boot.imx
`- uImage
We will use git to fetch imx_usb_loader sources:
$ git clone git://github.com/boundarydevices/imx_usb_loader.git
This should create an imx_usb_loader directory with all the latest sources.
Assuming your Linux development environment has the necessary libusb-1.0 headers and libraries, you can simply build by doing:
$ cd imx_usb_loader
$ make
This should compile an imx_usb tool in the current folder.
First, copy all the necessary buildroot generated items to the imx_usb_loader directory. You will need:
Now we need to explain to imx_usb what we want to download to the i.MX romcode through USB. Add the following lines in the end of the mx6_usb_work.conf:
...
u-boot.imx:dcd,plug
uImage:load 0x12000000
rootfs.cpio.uboot:load 0x12C00000
imx6q-sabresd.dtb:load 0x18000000
u-boot.imx:clear_dcd,jump header
The first line with dcd, plug uses u-boot header to configure the DDR3 memory, allowing us to download contents to the Sabre SD memory. This is exactly what the three subsequent lines with load directives do. The last line re-uses u-boot one more time to find out the address where to jump (jump header directive), but not touching the DDR configuration any more thanks to the clear_dcd directive (thanks jeanmariepons-b46892 for the tips) . Look at the comments in mx6_usb_work.conf for (a bit) more details on the various directives available.
Also, note that all the absolute addresses mentioned above are what u-boot needed at the time of writing. Hopefully this should be fairly stable.
We are all set for booting now. Connect to the USB to UART port with a serial terminal set to 115200 baud, no parity, 8bit data. Connect also your PC to the USB OTG port of the Sabre SD, and make sure you have no SD card inserted and power up the platform. The Sabre SD should not boot into an operating system, but rather wait for a payload to download through USB. You might want to verify that it is indeed waiting with the following command:
$ lsusb
In the resulting output, there should be a line like the following:
Bus 001 Device 098: ID 15a2:0054 Freescale Semiconductor, Inc. i.MX 6Dual/6Quad SystemOnChip in RecoveryMode
On your PC, start the download of our "payload" to your Sabre SD with:
$ sudo ./imx_usb
(Note that you need proper permissions to do that.)
After download of all the pieces, u-boot should start in its "mfgtools mode", as reflected by the following messages on UART:
...
Boot from USB for mfgtools
Use default environment for mfgtools
Run bootcmd_mfg: run mfgtool_args;bootm ${loadaddr} ${initrd_addr} ${fdt_addr};
...
The Linux kernel should then start, and your buildroot system should reach a prompt:
...
Welcome to Buildroot
buildroot login:
From there you may login as root.
Enjoy!
I erased boot loader from eMMC memory and then want to recover my system over USB u-boot mode. But I am not able to detect my device over USB OTG port when I run "lsusb" or "dmesg" commands. What can be possible issues? Please help me with this.
Hello,
i want to make this usb download on a imx6ul. What adresses do i have to change here:
...
u-boot.imx:dcd,plug
uImage:load 0x12000000
rootfs.cpio.uboot:load 0x12C00000
imx6q-sabresd.dtb:load 0x18000000
u-boot.imx:clear_dcd,jump header