How to setup MFGTOOL

MFGTOOL is used to upload uBoot into OpenRex through a micro USB cable. It's used in cases when the board is new (a board from production with no uBoot yet), in cases when you are developing uBoot or in case you accidentally re-flashed SPI memory.

The MFGTOOL is installed on your PC with Windows. If you do not have MFGTOOL installed, follow these steps:

1) Download MFGTOOL (e.g. IMX-L5.0.0-MFG-TOOL (REV L5.0.0_1.0.0)).

2) Create OpenRex Profile. Open "MFGTOOL 5.0\Profiles\Linux\OS Firmware\ucl2.xml" and add following lines after "/CFG":
	<LIST name="OpenRex-uBootOnly" desc="Only boot u-boot.imx">
		<CMD state="BootStrap" type="boot" body="BootStrap" file ="u-boot.imx" >Loading u-boot</CMD>
		<CMD state="BootStrap" type="load" file="firmware/fsl-image-mfgtool-initramfs-imx6qdlsolo.cpio.gz.u-boot" address="0x12C00000"
			loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE" ifdev="MX6Q MX6D">Loading Initramfs.</CMD>
		<CMD state="BootStrap" type="load" file="firmware/fsl-image-mfgtool-initramfs-imx6qdlsolo.cpio.gz.u-boot" address="0x83800000"
			loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE" ifdev="MX6SL MX6SX">Loading Initramfs.</CMD>			
		<CMD state="BootStrap" type="jump" > Jumping to u-boot. </CMD>
	</LIST>
It may look like this:
...
<UCL>
  <CFG>
    <STATE name="BootStrap" dev="MX6SL" vid="15A2" pid="0063"/>
    <STATE name="BootStrap" dev="MX6D" vid="15A2" pid="0061"/>
    <STATE name="BootStrap" dev="MX6Q" vid="15A2" pid="0054"/>
    <STATE name="BootStrap" dev="MX6SX" vid="15A2" pid="0071"/>
    <STATE name="Updater"   dev="MSC" vid="066F" pid="37FF"/>
  </CFG>

	<LIST name="OpenRex-uBootOnly" desc="Only boot u-boot.imx">
		<CMD state="BootStrap" type="boot" body="BootStrap" file ="u-boot.imx" >Loading u-boot</CMD>
		<CMD state="BootStrap" type="load" file="firmware/fsl-image-mfgtool-initramfs-imx6qdlsolo.cpio.gz.u-boot" address="0x12C00000"
			loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE" ifdev="MX6Q MX6D">Loading Initramfs.</CMD>
		<CMD state="BootStrap" type="load" file="firmware/fsl-image-mfgtool-initramfs-imx6qdlsolo.cpio.gz.u-boot" address="0x83800000"
			loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE" ifdev="MX6SL MX6SX">Loading Initramfs.</CMD>			
		<CMD state="BootStrap" type="jump" > Jumping to u-boot. </CMD>
	</LIST>

  <LIST name="SDCard" desc="Choose SD Card as media">
	<CMD state="BootStrap" type="boot" body="BootStrap" file ="firmware/u-boot-imx6q%board%_sd.imx" ifdev="MX6Q">Loading U-boot</CMD>
	<CMD state="BootStrap" type="boot" body="BootStrap" file ="firmware/u-boot-imx6dl%board%_sd.imx" ifdev="MX6D">Loading U-boot</CMD>
	<CMD state="BootStrap" type="boot" body="BootStrap" file ="firmware/u-boot-imx6slevk_sd.imx" ifdev="MX6SL">Loading U-boot</CMD>
	<CMD state="BootStrap" type="boot" body="BootStrap" file ="firmware/u-boot-imx6sx%sxuboot%_sd.imx" ifdev="MX6SX">Loading U-boot</CMD>
...		
3) Edit cfg.ini
[profiles]
chip = Linux

[platform]
board = OpenRex

[LIST]
name = OpenRex-uBootOnly
The MFGTOOL is setup. Now, you can copy your u-boot.imx into "MFGTOOL 5.0\Profiles\Linux\OS Firmware\" directory, start "MfgTool.exe", connect OpenRex throuh a micro USB cable and switch it on. Then press "Start" button.

Note:
- If you are using VMware player, use drag & drop to transfer files between virtual machine and your PC.
- If you are using VirtualBox, you may want to setup Shared folder (drag & drop may not always work correctly).

Setting up Shared Folder on Virtual Box:
1) Create a folder on your PC which you would like to use. Use a simple name, no special characters e.g. SharedFolder
2) In your virtualBox: Devices -> Shared Folders -> Shared Folders Settings
3) Click on the "+" button, in "Folder Path" find the folder
4) Check "Auto-mount", Check "Make Permanent"
5) Press OK, Press OK
6) Open Terminal and write:
sudo mkdir /media/sf_SharedFolder
sudo mount -t vboxsf SharedFolder /media/sf_SharedFolder/
sudo usermod -aG vboxsf fedevel #instead of fedevel use your username
Read more about VirtualBox and Shared Folders here >