Patchwork [meta-fsl-arm,v2,06/16] linux-mfgtool.inc: Build a Manufactoring Tool variant

login
register
mail settings
Submitter Otavio Salvador
Date Feb. 26, 2014, 9:50 p.m.
Message ID <1393451420-3041-7-git-send-email-otavio@ossystems.com.br>
Download mbox | patch
Permalink /patch/67505/
State Accepted
Delegated to: Otavio Salvador
Headers show

Comments

Otavio Salvador - Feb. 26, 2014, 9:50 p.m.
This makes a separated binary set for Manufacturing Tool use without
clobbering the Linux Kernel used for normal use.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---

Changes in v2:
- Fix breakage from by Daiane; it was cased by a change in master in
  the way it stages the content. A new FIXME has been added.

 recipes-kernel/linux/linux-mfgtool.inc | 80 ++++++++++++++++++++++++++++++++++
 1 file changed, 80 insertions(+)
 create mode 100644 recipes-kernel/linux/linux-mfgtool.inc

Patch

diff --git a/recipes-kernel/linux/linux-mfgtool.inc b/recipes-kernel/linux/linux-mfgtool.inc
new file mode 100644
index 0000000..2b1ebf0
--- /dev/null
+++ b/recipes-kernel/linux/linux-mfgtool.inc
@@ -0,0 +1,80 @@ 
+# Produces a Manufacturing Tool compatible Linux Kernel
+#
+# This makes a separated binary set for Manufacturing Tool use
+# without clobbering the Linux Kernel used for normal use.
+#
+# This file must to be included after the original linux-imx.inc file
+# as it overrides the needed values.
+#
+# Copyright (C) 2014 O.S. Systems Software LTDA.
+
+# Adjust provides
+PROVIDES = "linux-mfgtool"
+
+# Avoid coliding files
+LOCALVERSION_append = "-mfgtool"
+KERNEL_SRC_PATH = "/usr/src/kernel-mfgtool"
+KERNEL_IMAGE_BASE_NAME = "${KERNEL_IMAGETYPE}-mfgtool-${PKGE}-${PKGV}-${PKGR}-${MACHINE}-${DATETIME}"
+KERNEL_IMAGE_SYMLINK_NAME = "${KERNEL_IMAGETYPE}-mfgtool-${MACHINE}"
+MODULE_IMAGE_BASE_NAME = "modules-mfgtool-${PKGE}-${PKGV}-${PKGR}-${MACHINE}-${DATETIME}"
+MODULE_TARBALL_SYMLINK_NAME = "modules-mfgtool-${MACHINE}.tgz"
+
+# Ensures we prefer our mfgtool specific files
+FILESEXTRAPATHS_prepend = "${THISDIR}/${ORIG_PN}-${PV}:${THISDIR}/${ORIG_PN}:"
+
+python mfgtool_recipe_handler () {
+    pn = e.data.getVar("PN", True)
+    if not (pn.endswith("-mfgtool") or pn.startswith("mfgtool-")):
+        return
+
+    e.data.setVar("MLPREFIX", "mfgtool-")
+    e.data.setVar("ORIG_PN", e.data.getVar("PN", True))
+    e.data.setVar("PN", "mfgtool-" + e.data.getVar("PN", True).replace("-mfgtool", "").replace("mfgtool-", ""))
+}
+
+python () {
+    pn = d.getVar("PN", True)
+    if not pn.startswith("mfgtool-"):
+        return
+
+    from oe.classextend import ClassExtender
+
+    class LinuxMfgToolExtender(ClassExtender):
+        def extend_name(self, name):
+            if name.startswith("rtld"):
+                return name
+            if name.endswith("-" + self.extname):
+                name = name.replace("-" + self.extname, "")
+            if name.startswith("virtual/"):
+                subs = name.split("/", 1)[1]
+                if not subs.startswith(self.extname):
+                    return "virtual/" + self.extname + "-" + subs
+                return name
+            if not name.startswith(self.extname):
+                return self.extname + "-" + name
+            return name
+
+    clsextend = LinuxMfgToolExtender("mfgtool", d)
+    clsextend.rename_packages()
+    clsextend.rename_package_variables((d.getVar("PACKAGEVARS", True) or "").split())
+
+    clsextend.map_packagevars()
+}
+
+addhandler mfgtool_recipe_handler
+mfgtool_recipe_handler[eventmask] = "bb.event.RecipePreFinalise"
+
+# FIXME: We need to remove the KERNEL_SRC_PATH contents as
+#        kernel.bbclass has no way to skip its installation.
+# FIXME: It is not possible to have external modules against
+#        this kernel variant.
+do_install_append() {
+	rm -r ${D}${KERNEL_SRC_PATH}
+	rmdir ${D}/usr/src ${D}/usr
+}
+
+# FIXME: We must to avoid the staging of KERNEL_SRC_PATH as
+#        it is being removed (see above FIXME items).
+sysroot_stage_all() {
+    :
+}