From patchwork Wed Oct 26 16:08:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gary Bisson X-Patchwork-Id: 687174 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3t3w1934wGz9sXx for ; Thu, 27 Oct 2016 03:08:29 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=boundarydevices-com.20150623.gappssmtp.com header.i=@boundarydevices-com.20150623.gappssmtp.com header.b=sFXrni+6; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 855C5956DB; Wed, 26 Oct 2016 16:08:26 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Ni15cHrbOmbQ; Wed, 26 Oct 2016 16:08:25 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 39D56956E8; Wed, 26 Oct 2016 16:08:25 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 4EED41C4416 for ; Wed, 26 Oct 2016 16:08:22 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 400138BCAB for ; Wed, 26 Oct 2016 16:08:22 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fl-IOO1HnWXw for ; Wed, 26 Oct 2016 16:08:21 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm0-f43.google.com (mail-wm0-f43.google.com [74.125.82.43]) by whitealder.osuosl.org (Postfix) with ESMTPS id 2691D8AE2F for ; Wed, 26 Oct 2016 16:08:21 +0000 (UTC) Received: by mail-wm0-f43.google.com with SMTP id 140so25781896wmv.0 for ; Wed, 26 Oct 2016 09:08:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=boundarydevices-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=I5fJxc6o7sJ9niWNsct3UAR9DMBts8Gx2FuIPzIuQvA=; b=sFXrni+6VhztUzkXK7CB4cq39tlnmpL8uAkgmL0a+vem0LxzBDknOW3Cj4ERICF2Ni P0FlNBLnJA7E5CJeLQ8hWCKW71QgS4FG5aRW1HYzCUbyOw08jZPBGEFDHvxfLWf/P+sK kkL1FySK5HiKzmPFGqaTaOaDh/VSxUCN/uoh4q6a6LVfFfu1fVkGF7r8D9r1q/sLEtEB 1uY+dKqEdtp3m9Q6rYWWtoBCTESIpZtuVHj2k4vWhM+K7y1fpOiJzw+fa64pzz1F20Fo jWIMHHJe51XBEoSpekfA3+QLOIbeAFClw6eHqbx5RRhpdu/G/kxMdJ4pFpWZufL/o7tL 833A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=I5fJxc6o7sJ9niWNsct3UAR9DMBts8Gx2FuIPzIuQvA=; b=FugUF1zDiVQw8OfuL6eAwx5YNkDlMaAQooiwbhv7G1Dk73o1yAsNkIA0EWdAb5iomu CZRl9EQXtzUhLij9tDKTdj3dk3Hya9bxErpHWdsKCqhVRZipDJC8DonBIDOs7Gxk2JPM gbtF9YBqygW6qPNUAV/dZkBkCD2sq88l64Rs6aJ3hy7OOzKQRfGcuyBoR8xpZw3/hf+T ilYvz/lJjNlD8Bp1IcVoXYCAwGw/DTgiOU9+YBGq7jtqBl1QFCuuu70dhN7VMQYav6+l DBRS/4i+v5YbeCpg8k8V+tk1yhbtfDl17dAdfNraCz+OqzTpccpUkU8tmlor3RxNPYco TUbA== X-Gm-Message-State: ABUngvcr6mndfDvj+uUyCzF9ps757/PbW5seq8NYi4VKvd6U271NLQHyRIFPh2dfUFbh5A== X-Received: by 10.28.25.134 with SMTP id 128mr8667378wmz.99.1477498099093; Wed, 26 Oct 2016 09:08:19 -0700 (PDT) Received: from t450s.lan (89-92-98-28.hfc.dyn.abo.bbox.fr. [89.92.98.28]) by smtp.googlemail.com with ESMTPSA id pe5sm3404683wjb.15.2016.10.26.09.08.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Oct 2016 09:08:18 -0700 (PDT) From: Gary Bisson To: buildroot@busybox.net Date: Wed, 26 Oct 2016 18:08:02 +0200 Message-Id: <20161026160803.30262-2-gary.bisson@boundarydevices.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20161026160803.30262-1-gary.bisson@boundarydevices.com> References: <20161026160803.30262-1-gary.bisson@boundarydevices.com> Cc: thomas.petazzoni@free-electrons.com Subject: [Buildroot] [PATCH v2 1/2] mfgtools: new package X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" This package contains the Freescale manufacturing tool. It is designed to program firmware to i.MX boards during production. The communication is done over USB using the Freescale UTP protocol. The project is maintained on NXPMicro Github repository: https://github.com/NXPmicro/mfgtools Signed-off-by: Gary Bisson --- Changelog v1 -> v2: - Use host-cmake-package and build the CLI as a post build hook - Fix licenses: now BSD-3c and CPOL - Fix MFGTOOLS_CFLAGS and rename it HOST_MFGTOOLS_CFLAGS - Use HOST_LDFLAGS instead of specifyin the rpath manually - Fix install commands to have the full destination path - Add readme.txt file --- package/Config.in.host | 1 + package/mfgtools/Config.in.host | 10 ++++++++ package/mfgtools/mfgtools.hash | 2 ++ package/mfgtools/mfgtools.mk | 34 +++++++++++++++++++++++++ package/mfgtools/readme.txt | 56 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 103 insertions(+) create mode 100644 package/mfgtools/Config.in.host create mode 100644 package/mfgtools/mfgtools.hash create mode 100644 package/mfgtools/mfgtools.mk create mode 100644 package/mfgtools/readme.txt diff --git a/package/Config.in.host b/package/Config.in.host index 1140c70..e33cbb5 100644 --- a/package/Config.in.host +++ b/package/Config.in.host @@ -22,6 +22,7 @@ menu "Host utilities" source "package/jq/Config.in.host" source "package/jsmin/Config.in.host" source "package/lpc3250loader/Config.in.host" + source "package/mfgtools/Config.in.host" source "package/mke2img/Config.in.host" source "package/mkpasswd/Config.in.host" source "package/mtd/Config.in.host" diff --git a/package/mfgtools/Config.in.host b/package/mfgtools/Config.in.host new file mode 100644 index 0000000..8bba9e2 --- /dev/null +++ b/package/mfgtools/Config.in.host @@ -0,0 +1,10 @@ +config BR2_PACKAGE_HOST_MFGTOOLS + bool "host mfgtools" + depends on BR2_arm + help + This package contains the Freescale manufacturing tool. + It is designed to program firmware to i.MX boards during + production. The communication is done over USB using the + Freescale UTP protocol. + + https://github.com/NXPmicro/mfgtools diff --git a/package/mfgtools/mfgtools.hash b/package/mfgtools/mfgtools.hash new file mode 100644 index 0000000..e73a7fa --- /dev/null +++ b/package/mfgtools/mfgtools.hash @@ -0,0 +1,2 @@ +# locally computed +sha256 6ce93a33c269282df305cf7e517d2d14fde78203537d8ea75b064966afe48464 mfgtools-b219fc219a35c365010897ed093c40750f8cdac6.tar.gz diff --git a/package/mfgtools/mfgtools.mk b/package/mfgtools/mfgtools.mk new file mode 100644 index 0000000..fcc28ab --- /dev/null +++ b/package/mfgtools/mfgtools.mk @@ -0,0 +1,34 @@ +################################################################################ +# +# mfgtools +# +################################################################################ + +MFGTOOLS_VERSION = b219fc219a35c365010897ed093c40750f8cdac6 +MFGTOOLS_SITE = $(call github,NXPmicro,mfgtools,$(MFGTOOLS_VERSION)) +MFGTOOLS_SUBDIR = MfgToolLib +MFGTOOLS_LICENSE = BSD-3c or CPOL +MFGTOOLS_LICENSE_FILES = LICENSE +HOST_MFGTOOLS_DEPENDENCIES = host-cmake host-libusb + +HOST_MFGTOOLS_CFLAGS = \ + $(HOST_CFLAGS) $(HOST_LDFLAGS) -std=c++11 -lpthread \ + -L$(@D)/MfgToolLib -lMfgToolLib -I$(@D)/MfgToolLib \ + -lusb-1.0 -I$(HOST_DIR)/usr/include/libusb-1.0 \ + -fpermissive -Wno-write-strings + +define HOST_MFGTOOLS_CLI_BUILD + $(HOST_CONFIGURE_OPTS) $(MAKE) CC=$(HOSTCXX) \ + CFLAGS="$(HOST_MFGTOOLS_CFLAGS)" -C $(@D)/TestPrgm +endef + +HOST_MFGTOOLS_POST_BUILD_HOOKS += HOST_MFGTOOLS_CLI_BUILD + +define HOST_MFGTOOLS_INSTALL_CMDS + $(INSTALL) -D -m 755 $(@D)/MfgToolLib/libMfgToolLib.so \ + $(HOST_DIR)/usr/lib/libMfgToolLib.so + $(INSTALL) -D -m 755 $(@D)/TestPrgm/mfgtoolcli \ + $(HOST_DIR)/usr/bin/mfgtoolcli +endef + +$(eval $(host-cmake-package)) diff --git a/package/mfgtools/readme.txt b/package/mfgtools/readme.txt new file mode 100644 index 0000000..3f25f6e --- /dev/null +++ b/package/mfgtools/readme.txt @@ -0,0 +1,56 @@ +MfgTools How To: + +Here is an example on how to use the MfgTools with Buildroot: +1- Build your mfgtool image: + - Make sure to enable the following Buildroot options: +BR2_PACKAGE_FREESCALE_IMX=y +BR2_PACKAGE_IMX_UUC=y +BR2_TARGET_ROOTFS_CPIO=y +BR2_TARGET_ROOTFS_CPIO_GZIP=y +BR2_TARGET_ROOTFS_CPIO_UIMAGE=y + - Also modify your kernel configuration to have: +CONFIG_USB_GADGET=y +CONFIG_USB_MASS_STORAGE=y +CONFIG_FSL_UTP=y +CONFIG_MMC_BLOCK_MINORS=16 + +2- Go into the output and create the necessary folders: +$ cd output +$ mkdir -p "Profiles/Linux/OS Firmware/firmware" + +3- Create your XML update script named ucl2.xml: + - You can find a sample XML here: +$ wget https://storage.googleapis.com/boundarydevices.com/ucl2.xml \ + -O Profiles/Linux/OS\ Firmware/ucl2.xml + +4- Copy the mfgtools U-Boot, Kernel and initramfs images created: +$ cp images/u-boot.imx images/zImage images/imx6q-sabrelite.dtb \ + images/rootfs.cpio.uboot Profiles/Linux/OS\ Firmware/firmware/ + +5- Copy the prebuilt binaries to be flashed: + - Depends on your ucl2.xml file, the sample doesn't flash anything. + +6- Execute the MfgTools client: +$ ./host/usr/bin/mfgtoolcli -l mmc -s uboot_defconfig=imx \ + -s dtbname=imx6q-sabrelite.dtb -s initramfs=rootfs.cpio.uboot \ + -s mmc=1 -p 1 + +For more information about the tools options, please read the +"Manufacturing Tool V2 Quick Start Guide.docx" documentation contained in +every mfgtools package from NXP website[1]. + +Note: All the above commands require your Linux host user to have permissions +to access the USB devices. Please make sure to have udev rules that allow the +user to communicate with the BootROM IDs (Freescale USB recovery) as well as +the one used for the UTP Linux image (0x066F:0x37FF). +Using 'sudo' in front of the mfgtoolcli command would also grant you the +necessary permission but it is *not* recommended. + +Also, if your U-Boot environment doesn't include mfgtools bootargs, make sure +to set the following: +setenv bootargs "console=${console},${baudrate} g_mass_storage.stall=0 \ + g_mass_storage.removable=1 g_mass_storage.idVendor=0x066F \ + g_mass_storage.idProduct=0x37FF g_mass_storage.iSerialNumber=\"\" \ + g_mass_storage.file=/fat" + +[1] http://www.nxp.com/products/software-and-tools/software-development-tools/i.mx-software-and-tools/i.mx-6-series-software-and-development-tool-resources:IMX6_SW