I am currently working my way through this process as well. I corrupted the factory SD card so I ended up getting a prebuilt image from techNexion before i learned more details about building my own image from NXP. I haven't actually built a flash from scratch yet but I believe I know recipe now. My SDK is built from Freescale-Linux-SDK-for-LS1021A-IOT-Rev2-v0.4-20150907-yocto.iso which I am told is the latest. It is derived from the v1.8 SDK release. (confusing right) . Format the card as fat32 and leave a 8K space in front of the first ext4 partition such that bootloader can be placed there. For an SD card boot the RCW (512Byte + preamble+header+PBI) followed by u-boot and checksum is placed at offset 0x8. I’m not sure but I think the environment variable space is in here as well.
using
sudo dd if=u-boot-ls1021aiot.bin of=/dev/sd[x] bs=512 seek=8 conv=notrunc oflag=dsync
the merged RCW uboot ... is placed on the flash.
The uImage--3.12-r0-ls1021aiot-20160720154524.bin and dtb files can be copied to the flash if you mount the flash partition.
That should be all there is to it.
In case it helps a copy of the email from techNexion states
---------------------------------
This device was built following NXP (formerly Freescale) instructions.
Also the Software is completely from NXP.
On our Server we have the following image from NXP:
ftp://ftp.technexion.net/demo_software/ls1021a-iot-gw/ls1021a-iot-gw-revB-OpenWRT-20151111.img.zip
You can use a Program like WinDisk Imager to flash it on a SD-Card.
For more information please contact NXP.
---------------------------------
Using this factory image. If I interrupt u-boot before it loads the kernel I see
=> fatls mmc 0:1
67015565 fsl-image-rds-ls1021aiot.ext2.gz.u-boot
550920 u-boot-sd-rcw-70.bin
4230656 uimage-ls1021aiot.bin
21183 uimage-ls1021a-iot.dtb
550920 u-boot-sd-rcw-20.bin
34517139 fsl-image-x11-ls1021aiot.ext2.gz.u-boot
The 2 rcw files are meaningless on a sd card boot. I don't know why they are there. Very confusing.
My environment variables at this point are
=> printenv
baudrate=115200
bootargs=root=/dev/ram0 rw console=ttyS0,115200
bootcmd=run mmcboot
bootdelay=3
consoledev=ttyS0
eth1addr=00:1F:7B:63:02:6E
eth2addr=00:1F:7B:63:02:6F
ethact=eTSEC2
ethaddr=00:1F:7B:63:02:6D
ethprime=eTSEC2
fdt_high=0xcfffffff
fdtaddr=82800000
initrd_high=0xcfffffff
loadaddr=82000000
mmcargs=setenv bootargs console=$consoledev,$baudrate root=/dev/ram rw rootwait $othbootargs
mmcboot=run mmcargs;mmc rescan; fatload mmc 0:1 $loadaddr uImage-ls1021aiot.bin;fatload mmc 0:1 $fdtaddr uImage-ls1021a-iot.dtb; fatload mmc 0:1 $ramdiskaddr fsl-image-rds-ls1021aiot.ext2.gz.u-boot; bootm $loadaddr $ramdiskaddr $fdtaddr
ramdiskaddr=83000000
scsidevs=0
stderr=serial
stdin=serial
stdout=serial
Environment size: 749/131068 bytes
This end up giving you a compressed root file system which you can't update from the running system. not optimal so..
I am now working on trying to put a uncompressed file system on the SD card. and changing the boot commands accordingly. I have received the command syntax from NXP below but I haven't tried it yet. It probably will need some tweaking.
I need to modify the SD flash partition so it will have a /boot folder which will contain uImage{bin,dtb} files along with the expanded root file system / The - in the bootm args indicates not to create a ramdisk I am told.
bootm 81000000 - 8f000000
+++++++++
SD boot with RFS on SD Card
setenv bootfile /boot/uImage-ls1021aiot.bin
setenv fdtfile /boot/uImage-ls1021a-iot.dtb
setenv mmcargs 'setenv bootargs root=/dev/mmcblk0p1 rw rootdelay=5 console=ttyS0,115200'
setenv mmcboot 'run sdargs; ext2load mmc 0:1 81000000 $bootfile; ext2load mmc 0:1 8f000000 $fdtfile; bootm 81000000 - 8f000000'
++++++++++
If you find any corrections or additional info please let me know.
Thanks
Bill