This series of blog posts contains the following parts:

1. The bootloader U-Boot

2. The Kernel and Device Tree

3. Debian Root File System

4. Flashing with MFGTool in Windows (This part)

5. Creating an SDCard image in Linux


Part 4: MFGTool


In this part I won´t be talking that much about MFGTool itself.

For that I already have a blog post outside of this series, that you can find here:

Mainline Kernel and U-Boot with MFGTool


The script used in that blog is different to the one we will be using here by the way.

So read carefully.


I assume that you followed the previous parts of this series.

And with that you now should have four files.


- u-boot.imx

- boot.scr

- linux-kernel.tgz

- oneiric.tgz


Depending on where you now have these files stored, you have to copy them now to your Windows system you will be using to flash everything with MFGTool.

Easiest way to that would be using WinSCP by the way.


What you now also need is MFGTool of course.


You can get one here: RIoTboard BSP Images and Tools Download - Android and Linux

Or at the end of this blog, there will also be a download to the image I created.



Now that we have our files, let´s get started.

Step 1:

Extract MFGTool if not already done.

Step 2:

Inside the folder where you extracted MFGTool, go into the folder "Profiles\MX6DL Linux Update\OS Firmware\files".

Delete all files and folders in there.

Copy your 4 new files (u-boot.imx, linux-kernel.tgz, oneiric.tgz and boot.scr) into the folder.


Step 3:

In the folder "Profiles\MX6DL Linux Update\OS Firmware" open the file ucl2.xml with you favourite editor. (I´m using Notepad++)

(If the file´s named ucl2.txt rename it to ucl2.xml. That´s almost a running gag here...)

Go to the End of the file and insert this right after the last </LIST> entry. Then save and close the file.

<LIST name="i.MX6SOLO-DEBIAN-RIOT-eMMC" desc="Choose eMMC as media">
  <CMD state="BootStrap" type="boot" body="BootStrap" file ="u-boot-mx6solo-RIoTboard.bin" >Loading U-boot</CMD>
  <CMD state="BootStrap" type="load" file="uImage" address="0x10800000"
    loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE" >Loading Kernel.</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>

  <CMD state="Updater" type="push" body="$ dd if=/dev/zero of=/dev/mmcblk0 bs=1M count=20">Wipe</CMD>

  <CMD state="Updater" type="push" body="send" file="">Sending partition shell</CMD>
  <CMD state="Updater" type="push" body="$ tar xf $FILE "> Partitioning...</CMD>
  <CMD state="Updater" type="push" body="$ sh /dev/mmcblk0"> Partitioning...</CMD>

  <CMD state="Updater" type="push" body="send" file="files/u-boot.imx">Sending u-boot</CMD>
  <CMD state="Updater" type="push" body="$ dd if=$FILE of=/dev/mmcblk0 bs=512 seek=2">write u-boot.imx</CMD>
  <CMD state="Updater" type="push" body="$ dd if=/dev/zero of=/dev/mmcblk0 bs=512 seek=1536 count=16">clean up u-boot parameter</CMD>
  <CMD state="Updater" type="push" body="frf">flush the memory</CMD>

  <CMD state="Updater" type="push" body="$ mkfs.ext4 -j /dev/mmcblk0p1">Formatting rootfs partition</CMD>
  <CMD state="Updater" type="push" body="$ mkdir -p /mnt/mmcblk0p1"/>
  <CMD state="Updater" type="push" body="$ mount -t ext4 /dev/mmcblk0p1 /mnt/mmcblk0p1"/>

  <CMD state="Updater" type="push" body="pipe tar --numeric-owner -zxv -C /mnt/mmcblk0p1" file="files/oneiric.tgz">Sending and writing rootfs</CMD>
  <CMD state="Updater" type="push" body="frf">Finishing rootfs write</CMD>

  <CMD state="Updater" type="push" body="pipe tar --numeric-owner -zxv -C /mnt/mmcblk0p1" file="files/linux-kernel.tgz">Sending and writing Kernel and Modules</CMD>
  <CMD state="Updater" type="push" body="frf">Finishing writing Kernel and Modules</CMD>

  <CMD state="Updater" type="push" body="send" file="files/boot.scr">Sending bootscript</CMD>
  <CMD state="Updater" type="push" body="$ cp $FILE /mnt/mmcblk0p1/boot.scr">Copy bootscript into root</CMD>
  <CMD state="Updater" type="push" body="frf">flush the memory</CMD>

  <CMD state="Updater" type="push" body="$ umount /mnt/mmcblk0p1">Unmounting rootfs partition</CMD>

  <CMD state="Updater" type="push" body="$ echo Update Complete!">Done</CMD>

Step 4:

In the root folder of MFGTool open the file "cfg.ini".


Replace the line with "name = ..." with this.


Then save the file and close it.


Step 5:

Start MFGTool.

If it doesn´t give you any errors now it should have read the script correctly and has found all needed files.

Otherwise look into the file "MfgTool.log" what gives the error.

Most of the time just a file is missing.


Step 6:

Time to flash.

Put your RIoTBoard into serial download mode.

(Dip Switches 1 and 5 to Off rest On)


Connect it over the USB port right at the ethernet port with your PC and Power on the board.


MFGTool should now show an HID Device.


Hit "Start" and wait till it´s done.

Then hit "Stop" and close MFGTool.


Remove the USB cable and Power it Off.


Step 7:

Put the dip Switches back to 2 and 5 Off rest On.

Power the board on.


And that´s it.


If the kernel loads the second LED should go into hearbeat mode and starts blinking.

Also you can see everything on the serial console and can even login from there.


In the next part we will be creating an SDCard image you can flash onto an SDCard and then boot from it with the RIoTBoard.