diff options
Diffstat (limited to 'recipes-kernel/linux/linux-mfgtool.inc')
-rw-r--r-- | recipes-kernel/linux/linux-mfgtool.inc | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-mfgtool.inc b/recipes-kernel/linux/linux-mfgtool.inc new file mode 100644 index 00000000..948d698c --- /dev/null +++ b/recipes-kernel/linux/linux-mfgtool.inc | |||
@@ -0,0 +1,82 @@ | |||
1 | # Produces a Manufacturing Tool compatible Linux Kernel | ||
2 | # | ||
3 | # This makes a separated binary set for Manufacturing Tool use | ||
4 | # without clobbering the Linux Kernel used for normal use. | ||
5 | # | ||
6 | # This file must be included after the original linux-imx.inc file | ||
7 | # as it overrides the needed values. | ||
8 | # | ||
9 | # Copyright (C) 2014, 2015 O.S. Systems Software LTDA. | ||
10 | |||
11 | # Adjust provides | ||
12 | PROVIDES = "linux-mfgtool" | ||
13 | |||
14 | # Avoid coliding files | ||
15 | LOCALVERSION_append = "-mfgtool" | ||
16 | KERNEL_SRC_PATH = "/usr/src/kernel-mfgtool" | ||
17 | KERNEL_IMAGE_BASE_NAME = "${KERNEL_IMAGETYPE}-mfgtool-${PKGE}-${PKGV}-${PKGR}-${MACHINE}-${DATETIME}" | ||
18 | KERNEL_IMAGE_SYMLINK_NAME = "${KERNEL_IMAGETYPE}-mfgtool-${MACHINE}" | ||
19 | MODULE_IMAGE_BASE_NAME = "modules-mfgtool-${PKGE}-${PKGV}-${PKGR}-${MACHINE}-${DATETIME}" | ||
20 | MODULE_TARBALL_SYMLINK_NAME = "modules-mfgtool-${MACHINE}.tgz" | ||
21 | STAGING_KERNEL_DIR = "${TMPDIR}/work-shared/${MACHINE}/kernel-mfgtool-source" | ||
22 | STAGING_KERNEL_BUILDDIR = "${TMPDIR}/work-shared/${MACHINE}/kernel-mfgtool-build-artifacts" | ||
23 | |||
24 | # Ensures we prefer our mfgtool specific files | ||
25 | FILESEXTRAPATHS_prepend := "${THISDIR}/${ORIG_PN}-${PV}:${THISDIR}/${ORIG_PN}:" | ||
26 | |||
27 | python mfgtool_recipe_handler () { | ||
28 | pn = e.data.getVar("PN", True) | ||
29 | if not (pn.endswith("-mfgtool") or pn.startswith("mfgtool-")): | ||
30 | return | ||
31 | |||
32 | e.data.setVar("MLPREFIX", "mfgtool-") | ||
33 | e.data.setVar("ORIG_PN", e.data.getVar("PN", True)) | ||
34 | e.data.setVar("PN", "mfgtool-" + e.data.getVar("PN", True).replace("-mfgtool", "").replace("mfgtool-", "")) | ||
35 | } | ||
36 | |||
37 | python () { | ||
38 | pn = d.getVar("PN", True) | ||
39 | if not pn.startswith("mfgtool-"): | ||
40 | return | ||
41 | |||
42 | from oe.classextend import ClassExtender | ||
43 | |||
44 | class LinuxMfgToolExtender(ClassExtender): | ||
45 | def extend_name(self, name): | ||
46 | if name.startswith("rtld"): | ||
47 | return name | ||
48 | if name.endswith("-" + self.extname): | ||
49 | name = name.replace("-" + self.extname, "") | ||
50 | if name.startswith("virtual/"): | ||
51 | subs = name.split("/", 1)[1] | ||
52 | if not subs.startswith(self.extname): | ||
53 | return "virtual/" + self.extname + "-" + subs | ||
54 | return name | ||
55 | if not name.startswith(self.extname): | ||
56 | return self.extname + "-" + name | ||
57 | return name | ||
58 | |||
59 | clsextend = LinuxMfgToolExtender("mfgtool", d) | ||
60 | clsextend.rename_packages() | ||
61 | clsextend.rename_package_variables((d.getVar("PACKAGEVARS", True) or "").split()) | ||
62 | |||
63 | clsextend.map_packagevars() | ||
64 | clsextend.map_regexp_variable("PACKAGES_DYNAMIC") | ||
65 | } | ||
66 | |||
67 | addhandler mfgtool_recipe_handler | ||
68 | mfgtool_recipe_handler[eventmask] = "bb.event.RecipePreFinalise" | ||
69 | |||
70 | # FIXME: Avoid depmod data emiting as kernel-abiversion path is | ||
71 | # hardcoded. | ||
72 | emit_depmod_pkgdata() { | ||
73 | : | ||
74 | } | ||
75 | |||
76 | # FIXME: We need to remove the STAGING_KERNEL_BUILDDIR contents as | ||
77 | # kernel.bbclass has no way to skip its installation. | ||
78 | # FIXME: It is not possible to have external modules against | ||
79 | # this kernel variant. | ||
80 | do_install_append() { | ||
81 | rm -r ${STAGING_KERNEL_BUILDDIR} | ||
82 | } | ||