mfgtoolcli fails under linux

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

mfgtoolcli fails under linux

2,038 Views
matkattanek
Contributor III

I am having the same issue when using mfgtoolcli under Linux. (all works well when running it with Windows)

My hardware is  an NXP Imx6ull evk development board.

The package I am using is L4.9.11_1.0.0-ga_mfg-tools.

# ./linux-runvbs.sh mfgtool2-yocto-mx-evk-sdcard-sd1.vbs

mfgtool2-yocto-mx-evk-sdcard-sd1.vbs
Executing: ./mfgtoolcli -l SDCard -s board=sabresd -s mmc=0 -s 6uluboot=14x14evk -s 6uldtb=14x14-evk -s 6ulldtb=14x14-evk
Your Options:
board: sabresd
mmc: 0
6uluboot: 14x14evk
6uldtb: 14x14-evk
6ulldtb: 14x14-evk
Ready to flash.
init op Failed code# 24

Here the content of MfgToolLibLog.txt:

DLL version: 2.3.4
Mon Aug 13 10:54:42 2018
Start new logging
ModuleID[2] LevelID[1]: Error: Invalid device name: MX6SLL
ModuleID[2] LevelID[1]: Parse ucl script failed, error code: 24

Here the output of lsusb:

# lsusb

Bus 003 Device 029: ID 15a2:0080 Freescale Semiconductor, Inc.

Here is the tailing output of strace:

timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK) = 10
write(1, "Ready to flash.\n", 16Ready to flash.
) = 16
open("MfgToolLibLog.txt", O_RDWR|O_CREAT|O_APPEND, 0666) = 11
stat("MfgToolLibLog.txt", {st_mode=S_IFREG|0664, st_size=4700, ...}) = 0
fstat(11, {st_mode=S_IFREG|0664, st_size=4700, ...}) = 0
lseek(11, 4096, SEEK_SET) = 4096
read(11, "Parse ucl script failed, error c"..., 604) = 604
write(11, "DLL version: 2.3.4\n", 19) = 19
open("/etc/localtime", O_RDONLY|O_CLOEXEC) = 12
fstat(12, {st_mode=S_IFREG|0644, st_size=2845, ...}) = 0
fstat(12, {st_mode=S_IFREG|0644, st_size=2845, ...}) = 0
read(12, "TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\5\0\0\0\5\0\0\0\0"..., 4096) = 2845
lseek(12, -1811, SEEK_CUR) = 1034
read(12, "TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\5\0\0\0\5\0\0\0\0"..., 4096) = 1811
close(12) = 0
write(11, "Mon Aug 13 15:27:45 2018\n Star"..., 46) = 46
open("./Profiles/Linux/OS Firmware/ucl2.xml", O_RDONLY) = 12
stat("./Profiles/Linux/OS Firmware/ucl2.xml", {st_mode=S_IFREG|0644, st_size=84149, ...}) = 0
fstat(12, {st_mode=S_IFREG|0644, st_size=84149, ...}) = 0
read(12, "<!--\n* Copyright (C) 2012, Frees"..., 81920) = 81920
read(12, "ess=\"0x80800000\"\n\t\tloadSection=\""..., 4096) = 2229
brk(NULL) = 0x1e1e000
brk(0x1e3f000) = 0x1e3f000
brk(NULL) = 0x1e3f000
brk(0x1e60000) = 0x1e60000
brk(NULL) = 0x1e60000
brk(0x1e81000) = 0x1e81000
write(11, "ModuleID[2] LevelID[1]: Error: I"..., 59) = 59
write(11, "ModuleID[2] LevelID[1]: Parse uc"..., 64) = 64
close(11) = 0
write(1, "init op Failed code# 24 \n", 25init op Failed code# 24
) = 25
close(4) = 0
close(3) = 0
exit_group(-1) = ?
+++ exited with 255 +++

Here is the  ucl2.xml I modified, and I only included my target processor:

<UCL>
<CFG>
<!-- <STATE name="BootStrap" dev="MX6SL" vid="15A2" pid="0063"/> -->
<!-- <STATE name="BootStrap" dev="MX6SLL" vid="1FC9" pid="0128"/> -->
<!-- <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="BootStrap" dev="MX6UL" vid="15A2" pid="007D"/> -->
<!-- <STATE name="BootStrap" dev="MX7D" vid="15A2" pid="0076"/> -->
<STATE name="BootStrap" dev="MX6ULL" vid="15A2" pid="0080"/>
<!-- <STATE name="BootStrap" dev="MX7ULP" vid="1FC9" pid="0126"/> -->
<!-- <STATE name="Updater" dev="MSC" vid="066F" pid="37FF"/> -->
</CFG>

Now the error message changes and complains about the MX6ULL being invalid:

# tail MfgToolLibLog.txt

Mon Aug 13 15:19:51 2018
Start new logging
ModuleID[2] LevelID[1]: Error: Invalid device name: MX6ULL
ModuleID[2] LevelID[1]: Parse ucl script failed, error code: 24

Is anybody successfully using mfgtoolcli with Linux?

I see some complains about it on this forum but no solution.

mfgtoolcli is clearly upset about something. Would be great to get it running.

Mat

0 Kudos
3 Replies

1,293 Views
colin_critch
Contributor I
Flashing the MYD-Y6ULX to it's default state using the NXP USB boot 
loader built into the MX6ULL ROM with mfgtoolcli on Fedora 31 Linux
===================================================================

Set-up
======

Stuff to install on Fedora 31
----------------
sudo dnf install libusb
sudo dnf install libusb-devel
sudo dnf install strace


Stuff to download
-----------------
This example uses MYD-Y6ULX-20190329-m44.iso  which is large and contains MYD-Y6ULX-mfgtools-20180810.zip


if you need libusb you can compile form source and install. https://github.com/libusb/libusb.git



mkdir flash
cd flash
cp /your path to download zip .
tar -xvf MYD-Y6ULX-mfgtools-20180810.zip
cd MYD-Y6ULX-mfgtools-20180810

We are now in /flash/MYD-Y6ULX-mfgtools-20180810 



The mfgtoolcli is not good, so we have to edit the file ucl2.xml The problem is it can't deal with us 
changing the location or filename in linux! The other problem is that my device MX6ULL is
too long/invalid for the mfgtoolcli so we have to manipulate the default ucl2.xml file.
So if your device is not a MX6ULL just remove it from the device list in the ucl2.xml.
If you don't you will get an error 24. If you are using a MX6ULL just effectively
rename MX6ULL to MX6UL and remove the original MX6UL from the device list. 


These sed lines will do the job is you have a MX6ULL which for a MYC-Y6ULX you will have. 
Only run once after unzipping

sed 's/"MX6UL"/"ZX6UL"/g' ./Profiles/Linux/OS\ Firmware/ucl2.xml  > ./Profiles/Linux/OS\ Firmware/ucl3.xml
sed '/STATE name="BootStrap" dev="ZX6UL" vid="15A2" pid="007D"/d' ./Profiles/Linux/OS\ Firmware/ucl3.xml > ./Profiles/Linux/OS\ Firmware/ucl4.xml
sed 's/"MX6ULL"/"MX6UL"/g' ./Profiles/Linux/OS\ Firmware/ucl4.xml  > ./Profiles/Linux/OS\ Firmware/ucl5.xml
mv ./Profiles/Linux/OS\ Firmware/ucl2.xml ./Profiles/Linux/OS\ Firmware/ucl2.xml.bak
cp ./Profiles/Linux/OS\ Firmware/ucl5.xml ./Profiles/Linux/OS\ Firmware/ucl2.xml


If are not running a MYC-Y6ULX/MX6ULL you can just run this line which deletes a line from the device list.
sed '/STATE name="BootStrap" dev="MX6ULL" vid="15A2" pid="0080"/d' ./Profiles/Linux/OS\ Firmware/ucl2.xml > ./Profiles/Linux/OS\ Firmware/ucl5.xml
mv ./Profiles/Linux/OS\ Firmware/ucl2.xml ./Profiles/Linux/OS\ Firmware/ucl2.xml.bak
cp ./Profiles/Linux/OS\ Firmware/ucl5.xml ./Profiles/Linux/OS\ Firmware/ucl2.xml


Reset the PCB to the default firmware but using the nxp boot loader built in to the Read Only Memory in the imx6ull

01) you can create the example line below by executing linux-cvbs.sh this will make the .vbs files into sh scripts you can get a simular line below in one of these scripts
02) switch off power to board
03) remove sd card from dev board if it has one
04) remove micro usb cable from development board
05) put the hardware into USB recovery mode. For the MYC-Y6ULX  on switch (SW1) change third switch to OFF and four switch to ON   (this is boot to micro USB)
06) run this line below as root as you need permission to access the Freescale USB device
07) for the myir default firmware for the MYC-Y6ULX execute the line below:-

example:


sudo ./mfgtoolcli  -l "NAND Flash"  -s board=bert -s lite=l -s 6uluboot=14x14 -s nand=nand -s 6uldtb=14x14 -s ddrsize=256 -s nanddtb=gpmi-weim -s part_uboot=0 
     -s part_kernel=2 -s part_dtb=3 -s part_rootfs=4 -s rootfs=core-image-base-myd-y6ull14x14.rootfs.tar.bz2


This should then be shown:-
    Your Options:
    board: bert
    lite: l
    6uluboot: 14x14
    nand: nand
    6uldtb: 14x14
    ddrsize: 256
    nanddtb: gpmi-weim
    part_uboot: 0
    part_kernel: 2
    part_dtb: 3
    part_rootfs: 4
    rootfs: core-image-base-myd-y6ull14x14.rootfs.tar.bz2
    Ready to flash.

07) power on board
09) plug in micro usb cable

the programming will commence and then finish with
     1       100% [=====================================================================================================>]       

10) press control C to exit program
11) power off board
12) remove micro usb 
13) put the PCB into nand flash boot mode. For the MYC-Y6ULX change dip switch 3 to ON and dip switch 4 to off
14) connect ttl serial to header to JP1, connect at 115200 baud
15) power on board and see the boot lines, you will be able to login with "root"

with the default myir MYC-Y6ULX firmware you will get this boot line

    Booting Linux on physical CPU 0x0
    Linux version 4.1.15-1.2.0+gd87b5be (blackrose@brix4770-debian) (gcc version 5.3.0 (GCC) ) #1 SMP PREEMPT Tue Aug 7 14:36:07 CST 2018



Trouble Shooting
================
Look at MfgToolLibLog.txt
Also run with strace like this:-
sudo strace -s9999 -o ./trace.txt ./mfgtoolcli  -l "NAND Flash"  -s board=bert -s lite=l -s 6uluboot=14x14 -s nand=nand -s 6uldtb=14x14 -s ddrsize=256 -s nanddtb=gpmi-weim 
   -s part_uboot=0 -s part_kernel=2 -s part_dtb=3 -s part_rootfs=4 -s rootfs=core-image-base-myd-y6ull14x14.rootfs.tar.bz2
then look at trace.txt

Possible alternatives
=====================
https://community.nxp.com/thread/441563
https://github.com/NXPmicro/mfgtools/wiki
https://imxdev.gitlab.io/tutorial/Using_the_imx_usb_loader_tool/

Other reading
=============
https://github.com/MYiR-Dev/MYD-Y6ULX-LinuxDevelopmentGuide/tree/master/en
https://www.youtube.com/watch?v=j1T37OxUhe4
0 Kudos

1,293 Views
andreykononov
Contributor III

this is some kinda bug in mfgtools on linux. i'm using sabresd board imxq and trying to flash it. this problem becouse of dev name is longer 6 chars. first start (./mfgtool2-yocto-mx-sabresd-sdcard-sd4.vbs.sh) give me error

Error: Invalid device name: MX6SLL

delete "<STATE name="BootStrap" dev="MX6SLL" vid="1FC9" pid="0128"/>" from ucl2.xml and get error

Error: Invalid device name: MX6ULL

delete <STATE name="BootStrap" dev="MX6ULL" vid="15A2" pid="0080"/>  from ucl2.xml and get error

Error: Invalid device name: MX7ULP

delete <STATE name="BootStrap" dev="MX7ULP" vid="1FC9" pid="0126"/> from ucl2.xml and get error

Boot command-- file ./Profiles/Linux/OS Firmware/firmware/u-boot-imx6q%plus%sabresd_sd.imx failed to open.errcode is 2

this error is for my board file and it is understandeble and can be fixed

0 Kudos

1,293 Views
matkattanek
Contributor III

Just downloaded the latest L4.9.88_2.0.0_mfg-tool packages. Too bad it still shows the same problem:

./linux-runvbs.sh mfgtool2-yocto-mx-evk-sdcard-sd1.vbs
mfgtool2-yocto-mx-evk-sdcard-sd1.vbs
Executing: ./mfgtoolcli -l SDCard -s board=sabresd -s mmc=0 -s 6uluboot=14x14evk -s 6uldtb=14x14-evk -s 6ulldtb=14x14-evk
Your Options:
board: sabresd
mmc: 0
6uluboot: 14x14evk
6uldtb: 14x14-evk
6ulldtb: 14x14-evk
Ready to flash.
init op Failed code# 24

0 Kudos