after a lot of attempts, I've finally managed to automatize deployment of images on i.mx6 sabresd using network. I initially boot from SD card, where there is u-boot. The boot.scr makes u-boot download a kernel and a minimal rootfs (a .cpio.gz.uboot) and boot on RAM. From this minimal image, I download the real image and write it on the eMMC. I also donwload u-boot.imx and write it on the boot0 partition of the eMMC. When rebooting without the SD card (so I boot with the u-boot written on boot0), I boot using this in u-boot:
fatload mmc 2:1 0x12000000 zImage ; fatload mmc 2:1 0x18000000 imx6q-sabresd-ldo.dtb ; setenv bootargs console=ttymxc0,115200 root=/dev/mmcblk3p2 ; bootz 0x12000000 - 0x18000000
It works well, but to boot I have to manually enter the command above. As I use u-boot.imx, it seems that I can't use a boot.scr: boot0 is a special partition, I can't do much with it save write a file using dd, so I can't copy a boot.scr on it without erasing u-boot.imx. If I can't use a script, I'll have to compile u-boot to obtain a u-boot.imx with the correct boot procedure, right? But I don't know how to do that. I've searched, but I haven't find anything fitting my needs. Any help would be appreciated, thanks.