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

login
register
mail settings
Submitter Otavio Salvador
Date Feb. 24, 2014, 6:52 p.m.
Message ID <1393267973-4034-14-git-send-email-otavio@ossystems.com.br>
Download mbox | patch
Permalink /patch/67347/
State Changes Requested
Delegated to: Otavio Salvador
Headers show

Comments

Otavio Salvador - Feb. 24, 2014, 6:52 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>
---

 recipes-kernel/linux/linux-mfgtool.inc | 74 ++++++++++++++++++++++++++++++++++
 1 file changed, 74 insertions(+)
 create mode 100644 recipes-kernel/linux/linux-mfgtool.inc
Daiane Angolini - Feb. 25, 2014, 6:06 p.m.
On Mon, Feb 24, 2014 at 3:52 PM, Otavio Salvador
<otavio@ossystems.com.br> wrote:
> This makes a separated binary set for Manufacturing Tool use without
> clobbering the Linux Kernel used for normal use.

I don´t understand the script enough to comment.

We must elaborate a way to document a how-to for mfgtools. Maybe, we
should only add a comment on commit log (for example, for kernel
recipe and u-boot recipe) showing where the deliverable from this
recipe is placed, and what should I copy to mfg-tools dir tree in
order to get it working.

Not a mfg-tools related how-to, only a guide for the generated files.

Please, let me know what you think,


Daiane


>
> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
> ---
>
>  recipes-kernel/linux/linux-mfgtool.inc | 74 ++++++++++++++++++++++++++++++++++
>  1 file changed, 74 insertions(+)
>  create mode 100644 recipes-kernel/linux/linux-mfgtool.inc
>
> diff --git a/recipes-kernel/linux/linux-mfgtool.inc b/recipes-kernel/linux/linux-mfgtool.inc
> new file mode 100644
> index 0000000..dd09552
> --- /dev/null
> +++ b/recipes-kernel/linux/linux-mfgtool.inc
> @@ -0,0 +1,74 @@
> +# 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
> +}
> --
> 1.9.0
>
> _______________________________________________
> meta-freescale mailing list
> meta-freescale@yoctoproject.org
> https://lists.yoctoproject.org/listinfo/meta-freescale
Otavio Salvador - Feb. 26, 2014, 3:46 a.m.
On Tue, Feb 25, 2014 at 3:06 PM, Daiane Angolini <daiane.list@gmail.com> wrote:
> On Mon, Feb 24, 2014 at 3:52 PM, Otavio Salvador
> <otavio@ossystems.com.br> wrote:
>> This makes a separated binary set for Manufacturing Tool use without
>> clobbering the Linux Kernel used for normal use.
>
> I don´t understand the script enough to comment.
>
> We must elaborate a way to document a how-to for mfgtools. Maybe, we
> should only add a comment on commit log (for example, for kernel
> recipe and u-boot recipe) showing where the deliverable from this
> recipe is placed, and what should I copy to mfg-tools dir tree in
> order to get it working.
>
> Not a mfg-tools related how-to, only a guide for the generated files.
>
> Please, let me know what you think,

I extended the commitlog for v2 describing the image goal. The doc is
indeed need but we can look at it later as this patchset is to build
those artifacts.
Daiane Angolini - Feb. 26, 2014, 12:53 p.m.
> -----Original Message-----
> From: meta-freescale-bounces@yoctoproject.org [mailto:meta-freescale-
> bounces@yoctoproject.org] On Behalf Of Otavio Salvador
> Sent: Wednesday, February 26, 2014 12:46 AM
> To: Daiane Angolini
> Cc: meta-freescale Mailing List
> Subject: Re: [meta-freescale] [meta-fsl-arm PATCH 13/16] linux-mfgtool.inc:
> Build a Manufactoring Tool variant
> 
> On Tue, Feb 25, 2014 at 3:06 PM, Daiane Angolini <daiane.list@gmail.com>
> wrote:
> > On Mon, Feb 24, 2014 at 3:52 PM, Otavio Salvador
> > <otavio@ossystems.com.br> wrote:
> >> This makes a separated binary set for Manufacturing Tool use without
> >> clobbering the Linux Kernel used for normal use.
> >
> > I don´t understand the script enough to comment.
> >
> > We must elaborate a way to document a how-to for mfgtools. Maybe, we
> > should only add a comment on commit log (for example, for kernel
> > recipe and u-boot recipe) showing where the deliverable from this
> > recipe is placed, and what should I copy to mfg-tools dir tree in
> > order to get it working.
> >
> > Not a mfg-tools related how-to, only a guide for the generated files.
> >
> > Please, let me know what you think,
> 
> I extended the commitlog for v2 describing the image goal. The doc is
> indeed need but we can look at it later as this patchset is to build those
> artifacts.

I absolutely agree

Daiane

> 
> --
> Otavio Salvador                             O.S. Systems
> http://www.ossystems.com.br        http://code.ossystems.com.br
> Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
> _______________________________________________
> meta-freescale mailing list
> meta-freescale@yoctoproject.org
> https://lists.yoctoproject.org/listinfo/meta-freescale
>

Patch

diff --git a/recipes-kernel/linux/linux-mfgtool.inc b/recipes-kernel/linux/linux-mfgtool.inc
new file mode 100644
index 0000000..dd09552
--- /dev/null
+++ b/recipes-kernel/linux/linux-mfgtool.inc
@@ -0,0 +1,74 @@ 
+# 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
+}