How to use the command line version of MfgTools2 in my own application?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to use the command line version of MfgTools2 in my own application?

1,704 Views
pakhira
Contributor I

Hi,

I'm developing a GUI application in Qt for an easy way to program i.MX based boards. I'm trying to use the MfgTools2 in CLI mode (using the -noui) but am running into problems. I'm running it using a QProcess to open a command prompt which invokes the MfgTools2:

[code]

cmd /C <path to MfgTool2> -noui

[/code]

The MfgTool2 runs, but the output is not sent to Qt, neither in the STDOUT stream nor the STDERR stream. Even if I directly run it in command prompt and redirect the STDOUT and STDERR outputs to files, the application output is still on the screen instead of the files, as shown in the screenshot I have attached. So somehow the tool is using a non standard way to output text?

mfgtoolScreenshot.JPG

Is there any way to make the tool work in my program? Any ideas would be appreciated. Thanks!

Anindya

Labels (4)
0 Kudos
Reply
2 Replies

921 Views
igorpadykov
NXP Employee
NXP Employee

Hi Anindya

one can debug it or customize for own application using sources:

GitHub - codeauroraforum/mfgtools: Freescale/NXP I.MX Chip image deploy tools. 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

921 Views
pakhira
Contributor I

Hi igorpadykov,

I was originally trying to use the MfgTool2 which uses the ucl2.xml files for configuration, since I have used the GUI application before as well and I am familiar with it. Now I'm trying to make the mfgtools that you linked to and running into some problems. I have been able to write the uboot, kernel, device tree and ramfs for bootstrapping, but cannot figure out how to write the custom kernel and rootfs. I've been using this script:

uuu_version 1.0.1
SDP: boot -f u-boot-tx6q-1036_mfg.bin -nojump
SDP: write -f mfg.env -addr 0x10500000
SDP: write -f uImage_tx6-mfg -addr 0x10800000
SDP: write -f imx6q-tx6q-1036_mfg.dtb -addr 0x11180000
SDP: write -f initramfs.cpio.gz.uboot -addr 0x11200000
SDP: write -f imx6q-tx6q-1036.dtb -addr 0x11100000
SDP: jump -f u-boot-tx6q-1036.bin -ivt

I cannot figure out how to proceed after this. In the ucl2.xml, after bootstrapping, the following commands are executed:

<CMD state="BootStrap" type="jump" > Boot... </CMD>

<CMD state="Updater" type="push" body="$ cd /dev;for d in `ls | sed '/mmcblk/!d;/p/d;/boot/d'`;do [ -e ${d}rpmb ] && continue;ln -s $d emmc;break;done"> Select SD device...</CMD>
<CMD state="Updater" type="push" body="$ cd /dev;for d in `ls | sed '/mmcblk/!d;/p/d;/boot/d'`;do [ -e ${d}rpmb ] || continue;ln -sf $d emmc;break;done"> Select eMMC device if possible...</CMD>
<CMD state="Updater" type="push" body="$ [ -b /dev/emmc ] && (echo label-id:0x0cc66cc0; echo size=30720,type=c; echo type=83) | sfdisk /dev/emmc"> Partitioning...</CMD>
<CMD state="Updater" type="push" body="$ [ -b /dev/$(readlink /dev/emmc)p1 ] && mkfs.vfat /dev/$(readlink /dev/emmc)p1">Format Linux partition</CMD>
<CMD state="Updater" type="push" body="$ [ -b /dev/$(readlink /dev/emmc)p2 ] && mkfs.ext3 /dev/$(readlink /dev/emmc)p2">Format rootfs partition</CMD>

<CMD state="Updater" type="push" body="$ mkdir -p /mnt/mmcblk0p1"/>
<CMD state="Updater" type="push" body="$ mount -t vfat /dev/$(readlink /dev/emmc)p1 /mnt/mmcblk0p1"/>
<CMD state="Updater" type="push" body="pipe cat - > /mnt/mmcblk0p1/uImage" file="%_KRNL%">Write kernel image</CMD>
<CMD state="Updater" type="push" body="frf">flush the memory.</CMD>
<CMD state="Updater" type="push" body="$ umount /mnt/mmcblk0p1"/>
<CMD state="Updater" type="push" body="$ rmdir /mnt/mmcblk0p1"/>

<CMD state="Updater" type="push" body="$ mkdir -p /mnt/mmcblk0p2"/>
<CMD state="Updater" type="push" body="$ mount -t ext3 /dev/$(readlink /dev/emmc)p2 /mnt/mmcblk0p2"/>
<CMD state="Updater" type="push" body="pipe tar -x%_ROOTFS_TAROPT%v -C /mnt/mmcblk0p2" file="%_ROOTFS%">Sending and writing rootfs</CMD>
<CMD state="Updater" type="push" body="frf">flush the memory.</CMD>
<CMD state="Updater" type="push" body="pipe tar -C /mnt/mmcblk0p2 -x%_MODULES_TAROPT%vf - lib ./lib usr ./usr" file="%_MODULES%">Write modules</CMD>
<CMD state="Updater" type="push" body="frf">flush the memory.</CMD>
<CMD state="Updater" type="push" body="$ umount /mnt/mmcblk0p2"/>
<CMD state="Updater" type="push" body="$ rmdir /mnt/mmcblk0p2"/>

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

Unfortunately the wiki suggests using fastboot commands (FB and FBK) but they don't seem to generate any response. Also, "FB: setenv fastboot_buffer 0x10800000" responds with "unknown command." It would be great if you could tell me how to proceed with this.

0 Kudos
Reply