Skip to contentSkip to conversation

imx-uuc: add new package

PATCH Superseded Gary Bisson 2 participants 4 messages Apr 13, 2016 – Apr 18, 2016 Arm i.MX and Layerscape

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 imx-uuc: add new package

This package provides the Universal Adapter user-space utility that is used to receive commands from the Manufacturing Tool using the Freescale UTP Protocol.

It requires a Freescale/NXP kernels whose configuration contains the CONFIG_FSL_UTP option.

The /fat file is provided as a bootargs to the g_mass_storage driver from U-Boot, see:
http://git.freescale.com/git/cgit.cgi/imx/uboot-imx.git/tree/include/
configs/mx6sabre_common.h?h=imx_v2015.04_3.14.52_1.1.0_ga#n116

Init scripts are provided so that the tool starts automatically at bootup.

Tested on Nitrogen6_MAX + MFGTools.

---
Hi all,

Changes v1 -> v2:
- add toolchain threads dependency
- add host-dosfstools selection
- add init scripts to start it as a daemon
- use manual install commands to control mkfs path and remove /linuxrc
- change Config.in comment

I have a few comments/questions on this new version:
- the install process still requires to use dd, hope using the system one is ok.
- I chose the init script number randomly (S80), hope it's ok.

Regards,
Gary

---
 package/freescale-imx/Config.in               |  1 +
 package/freescale-imx/imx-uuc/Config.in       | 19 +++++++++++++
 package/freescale-imx/imx-uuc/S80imx-uuc      | 28 +++++++++++++++++++
 package/freescale-imx/imx-uuc/imx-uuc.hash    |  1 +
 package/freescale-imx/imx-uuc/imx-uuc.mk      | 40 +++++++++++++++++++++++++++
 package/freescale-imx/imx-uuc/imx-uuc.service | 11 ++++++++
 6 files changed, 100 insertions(+)
 create mode 100644 package/freescale-imx/imx-uuc/Config.in
 create mode 100644 package/freescale-imx/imx-uuc/S80imx-uuc
 create mode 100644 package/freescale-imx/imx-uuc/imx-uuc.hash
 create mode 100644 package/freescale-imx/imx-uuc/imx-uuc.mk
 create mode 100644 package/freescale-imx/imx-uuc/imx-uuc.service
package/freescale-imx/Config.in +1 -0
index 4a086ae..8c03190 100644
@@ -51,6 +51,7 @@ config BR2_PACKAGE_FREESCALE_IMX_HAS_VPU
 
 source "package/freescale-imx/imx-kobs/Config.in"
 source "package/freescale-imx/imx-lib/Config.in"
+source "package/freescale-imx/imx-uuc/Config.in"
 source "package/freescale-imx/imx-vpu/Config.in"
 source "package/freescale-imx/firmware-imx/Config.in"
 if (BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX51 || BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX53)
package/freescale-imx/imx-uuc/Config.in new file +19 -0
new file mode 100644
index 0000000..75e4c87
@@ -0,0 +1,19 @@
+config BR2_PACKAGE_IMX_UUC
+	bool "imx-uuc"
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_arm # Only relevant for i.MX
+	select BR2_PACKAGE_HOST_DOSFSTOOLS
+	help
+	  This package provides the Universal Adapter user-space utility
+	  that is used to receive commands from the Manufacturing Tool
+	  using the Freescale UTP Protocol.
+
+	  It requires a Freescale/NXP kernel whose configuration contains
+	  the CONFIG_FSL_UTP option.
+
+	  This package is provided by Freescale/NXP as-is and doesn't have
+	  an upstream.
+
+comment "imx-uuc needs a toolchain w/ threads"
+	depends on BR2_ARM
+	depends on !BR2_TOOLCHAIN_HAS_THREADS
package/freescale-imx/imx-uuc/S80imx-uuc new file +28 -0
new file mode 100644
index 0000000..8d6d8c1
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+NAME=uuc
+DAEMON=/usr/bin/$NAME
+
+case "$1" in
+  start)
+    printf "Starting $NAME: "
+    start-stop-daemon -S -q -b -p /var/run/${NAME}.pid -x $DAEMON
+    echo "OK"
+    ;;
+  stop)
+    printf "Stopping $NAME: "
+    start-stop-daemon -K -q -p /var/run/${NAME}.pid
+    echo "OK"
+    ;;
+  restart|reload)
+    $0 stop
+    sleep 1
+    $0 start
+    ;;
+  *)
+    echo "Usage: $0 {start|stop|restart}"
+    exit 1
+esac
+
+exit $?
+
package/freescale-imx/imx-uuc/imx-uuc.hash new file +1 -0
new file mode 100644
index 0000000..aab9ea8
@@ -0,0 +1 @@
+sha256 95d7f7b075f58fedc07602fbc0e5bf5212d28deea3d09cdbcbd80992dcd18482  imx-uuc-0.5.1.tar.gz
package/freescale-imx/imx-uuc/imx-uuc.mk new file +40 -0
new file mode 100644
index 0000000..58e749e
@@ -0,0 +1,40 @@
+################################################################################
+#
+# imx-uuc
+#
+################################################################################
+
+IMX_UUC_VERSION = 0.5.1
+IMX_UUC_SITE = $(FREESCALE_IMX_SITE)
+IMX_UUC_LICENSE = GPLv2+
+IMX_UUC_LICENSE_FILES = COPYING
+
+# mkfs.vfat is needed to create a FAT partition used by g_mass_storage
+# so Windows do not offer to format the device when connected to the PC.
+IMX_UUC_DEPENDENCIES = host-dosfstools
+
+define IMX_UUC_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) CC=$(TARGET_CC)
+endef
+
+define IMX_UUC_INSTALL_TARGET_CMDS
+	$(INSTALL) -D -m 755 $(@D)/uuc $(TARGET_DIR)/usr/bin/uuc
+	$(INSTALL) -D -m 755 $(@D)/sdimage $(TARGET_DIR)/usr/bin/sdimage
+	dd if=/dev/zero of=$(TARGET_DIR)/fat bs=1M count=1
+	$(HOST_DIR)/usr/sbin/mkfs.vfat $(TARGET_DIR)/fat
+endef
+
+define IMX_UUC_INSTALL_INIT_SYSV
+	$(INSTALL) -D -m 0755 package/freescale-imx/imx-uuc/S80imx-uuc \
+		$(TARGET_DIR)/etc/init.d/S80imx-uuc
+endef
+
+define IMX_UUC_INSTALL_INIT_SYSTEMD
+	$(INSTALL) -D -m 0644 package/freescale-imx/imx-uuc/imx-uuc.service \
+		$(TARGET_DIR)/usr/lib/systemd/system/imx-uuc.service
+	mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/
+	ln -fs ../../../../usr/lib/systemd/system/imx-uuc.service \
+		$(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/imx-uuc.service
+endef
+
+$(eval $(generic-package))
package/freescale-imx/imx-uuc/imx-uuc.service new file +11 -0
new file mode 100644
index 0000000..fae7fc6
@@ -0,0 +1,11 @@
+[Unit]
+Description=i.MX Universal UTP Communication Service
+After=systemd-modules-load.service
+
+[Service]
+Type=simple
+ExecStart=/usr/bin/uuc
+
+[Install]
+WantedBy=multi-user.target
+
Signature · 1 line
2.7.0
#1 lore raw

PATCH v2 1/1 imx-uuc: add new package

Hello,

The commit title should have been:

imx-uuc: new package

(yes that's nitpicking)

Quoted 11 lines · Gary Bisson
package/freescale-imx/imx-uuc/Config.in new file +5 -0
new file mode 100644
index 0000000..75e4c87
@@ -0,0 +1,19 @@
+config BR2_PACKAGE_IMX_UUC
+	bool "imx-uuc"
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_arm # Only relevant for i.MX
+	select BR2_PACKAGE_HOST_DOSFSTOOLS

package/freescale-imx/imx-uuc/Config.in line 15

Quoted 10 lines
package/freescale-imx/imx-uuc/Config.in new file +10 -0
+	help
+	  This package provides the Universal Adapter user-space utility
+	  that is used to receive commands from the Manufacturing Tool
+	  using the Freescale UTP Protocol.
+
+	  It requires a Freescale/NXP kernel whose configuration contains
+	  the CONFIG_FSL_UTP option.
+
+	  This package is provided by Freescale/NXP as-is and doesn't have
+	  an upstream.

Some of those lines were slightly too long, so I rewrapped.

package/freescale-imx/imx-uuc/Config.in line 18

Quoted 3 lines
package/freescale-imx/imx-uuc/Config.in new file +3 -0
+
+comment "imx-uuc needs a toolchain w/ threads"
+	depends on BR2_ARM

BR2_arm, not BR2_ARM.

Quoted 7 lines
package/freescale-imx/imx-uuc/Config.in new file +1 -0
+	depends on !BR2_TOOLCHAIN_HAS_THREADS
package/freescale-imx/imx-uuc/S80imx-uuc new file +0 -0
new file mode 100644
index 0000000..8d6d8c1

package/freescale-imx/imx-uuc/S80imx-uuc line 10

Quoted 10 lines
package/freescale-imx/imx-uuc/S80imx-uuc new file +10 -0
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+NAME=uuc
+DAEMON=/usr/bin/$NAME
+
+case "$1" in
+  start)
+    printf "Starting $NAME: "
+    start-stop-daemon -S -q -b -p /var/run/${NAME}.pid -x $DAEMON
+    echo "OK"

I've added missing error checking here.

package/freescale-imx/imx-uuc/S80imx-uuc line 15

Quoted 5 lines
package/freescale-imx/imx-uuc/S80imx-uuc new file +5 -0
+    ;;
+  stop)
+    printf "Stopping $NAME: "
+    start-stop-daemon -K -q -p /var/run/${NAME}.pid
+    echo "OK"

And here. I've also re-indented the init script to match the indentation used in S50dropbear (which I believe is more or less our reference).

package/freescale-imx/imx-uuc/imx-uuc.hash line 1

Quoted 7 lines
package/freescale-imx/imx-uuc/imx-uuc.hash new file +1 -0
new file mode 100644
index 0000000..aab9ea8
@@ -0,0 +1 @@
+sha256 95d7f7b075f58fedc07602fbc0e5bf5212d28deea3d09cdbcbd80992dcd18482  imx-uuc-0.5.1.tar.gz

Missing source for the hash, so I've assumed it had been locally calculated, and added the usual comment.

Applied with those changes, thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#2 lore raw

PATCH v2 1/1 imx-uuc: add new package

Thomas, All,

Quoted 8 lines · Thomas Petazzoni

Hello,

The commit title should have been:

imx-uuc: new package

(yes that's nitpicking)

No that's good to know, next time I'll make sure to name it like this.

Quoted 16 lines · Gary Bisson
Quoted 15 lines
package/freescale-imx/imx-uuc/Config.in new file +9 -0
new file mode 100644
index 0000000..75e4c87
@@ -0,0 +1,19 @@
+config BR2_PACKAGE_IMX_UUC
+     bool "imx-uuc"
+     depends on BR2_TOOLCHAIN_HAS_THREADS
+     depends on BR2_arm # Only relevant for i.MX
+     select BR2_PACKAGE_HOST_DOSFSTOOLS
+     help
+       This package provides the Universal Adapter user-space utility
+       that is used to receive commands from the Manufacturing Tool
+       using the Freescale UTP Protocol.
Quoted 8 lines

package/freescale-imx/imx-uuc/Config.in line 15

Quoted 6 lines
package/freescale-imx/imx-uuc/Config.in new file +6 -0
+
+       It requires a Freescale/NXP kernel whose configuration contains
+       the CONFIG_FSL_UTP option.
+
+       This package is provided by Freescale/NXP as-is and doesn't have
+       an upstream.

Some of those lines were slightly too long, so I rewrapped.

What number of characters would you like to see? I always go by the 80-character line rule.

Quoted 32 lines

package/freescale-imx/imx-uuc/Config.in line 18

Quoted 3 lines
package/freescale-imx/imx-uuc/Config.in new file +3 -0
+
+comment "imx-uuc needs a toolchain w/ threads"
+     depends on BR2_ARM

BR2_arm, not BR2_ARM.

Quoted 7 lines
package/freescale-imx/imx-uuc/Config.in new file +1 -0
+     depends on !BR2_TOOLCHAIN_HAS_THREADS
package/freescale-imx/imx-uuc/S80imx-uuc new file +0 -0
new file mode 100644
index 0000000..8d6d8c1

package/freescale-imx/imx-uuc/S80imx-uuc line 10

Quoted 10 lines
package/freescale-imx/imx-uuc/S80imx-uuc new file +10 -0
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+NAME=uuc
+DAEMON=/usr/bin/$NAME
+
+case "$1" in
+  start)
+    printf "Starting $NAME: "
+    start-stop-daemon -S -q -b -p /var/run/${NAME}.pid -x $DAEMON
+    echo "OK"

I've added missing error checking here.

package/freescale-imx/imx-uuc/S80imx-uuc line 15

Quoted 5 lines
package/freescale-imx/imx-uuc/S80imx-uuc new file +5 -0
+    ;;
+  stop)
+    printf "Stopping $NAME: "
+    start-stop-daemon -K -q -p /var/run/${NAME}.pid
+    echo "OK"
Quoted 3 lines

And here. I've also re-indented the init script to match the indentation used in S50dropbear (which I believe is more or less our reference).

Good to know too, I actually randomly copied one init script already present (S53neard).

Quoted 10 lines

package/freescale-imx/imx-uuc/imx-uuc.hash line 1

Quoted 7 lines
package/freescale-imx/imx-uuc/imx-uuc.hash new file +1 -0
new file mode 100644
index 0000000..aab9ea8
@@ -0,0 +1 @@
+sha256 95d7f7b075f58fedc07602fbc0e5bf5212d28deea3d09cdbcbd80992dcd18482  imx-uuc-0.5.1.tar.gz

Missing source for the hash, so I've assumed it had been locally calculated, and added the usual comment.

Yes it was locally, thanks.

Quoted 1 line

Applied with those changes, thanks!

No problem, I just want to add one thing that I discovered last week, there's a Linux equivalent of the MFGTools developed by Ixonos:
https://github.com/ixonos/utp_com

It allows to do the same thing, send flashing scripts, executing commands, flashing partitions etc... I might add it to the host packages some day but it unfortunately depends on libsgutils2-dev for the scsi headers in order to build. Not sure what the best approach is.

Thanks,
Gary

#3 lore raw

PATCH v2 1/1 imx-uuc: add new package

Hello,

Quoted 5 lines · Gary Bisson
Quoted 3 lines

imx-uuc: new package

(yes that's nitpicking)

No that's good to know, next time I'll make sure to name it like this.

No problem, it's easy to fix :)

Quoted 4 lines
Quoted 1 line

Some of those lines were slightly too long, so I rewrapped.

What number of characters would you like to see? I always go by the 80-character line rule.

72 characters is our rule, including the tab+2 spaces indentation.

Quoted 6 lines
Quoted 3 lines

And here. I've also re-indented the init script to match the indentation used in S50dropbear (which I believe is more or less our reference).

Good to know too, I actually randomly copied one init script already present (S53neard).

Our init scripts are far from being very consistent, so no problem with this. We should probably write down a few rules, and do a bit of cleanup work so that they look more similar.

Quoted 11 lines
Quoted 1 line

Applied with those changes, thanks!

No problem, I just want to add one thing that I discovered last week, there's a Linux equivalent of the MFGTools developed by Ixonos:
https://github.com/ixonos/utp_com

It allows to do the same thing, send flashing scripts, executing commands, flashing partitions etc... I might add it to the host packages some day but it unfortunately depends on libsgutils2-dev for the scsi headers in order to build. Not sure what the best approach is.

Just create a host package for libsgutils, and make host-utp-com depend on it.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com