diff options
Diffstat (limited to 'recipes-kernel/linux/linux-mfgtool.inc')
-rw-r--r-- | recipes-kernel/linux/linux-mfgtool.inc | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-mfgtool.inc b/recipes-kernel/linux/linux-mfgtool.inc new file mode 100644 index 0000000..5c042ee --- /dev/null +++ b/recipes-kernel/linux/linux-mfgtool.inc | |||
@@ -0,0 +1,80 @@ | |||
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 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 | |||
22 | # Ensures we prefer our mfgtool specific files | ||
23 | FILESEXTRAPATHS_prepend = "${THISDIR}/${ORIG_PN}-${PV}:${THISDIR}/${ORIG_PN}:" | ||
24 | |||
25 | python mfgtool_recipe_handler () { | ||
26 | pn = e.data.getVar("PN", True) | ||
27 | if not (pn.endswith("-mfgtool") or pn.startswith("mfgtool-")): | ||
28 | return | ||
29 | |||
30 | e.data.setVar("MLPREFIX", "mfgtool-") | ||
31 | e.data.setVar("ORIG_PN", e.data.getVar("PN", True)) | ||
32 | e.data.setVar("PN", "mfgtool-" + e.data.getVar("PN", True).replace("-mfgtool", "").replace("mfgtool-", "")) | ||
33 | } | ||
34 | |||
35 | python () { | ||
36 | pn = d.getVar("PN", True) | ||
37 | if not pn.startswith("mfgtool-"): | ||
38 | return | ||
39 | |||
40 | from oe.classextend import ClassExtender | ||
41 | |||
42 | class LinuxMfgToolExtender(ClassExtender): | ||
43 | def extend_name(self, name): | ||
44 | if name.startswith("rtld"): | ||
45 | return name | ||
46 | if name.endswith("-" + self.extname): | ||
47 | name = name.replace("-" + self.extname, "") | ||
48 | if name.startswith("virtual/"): | ||
49 | subs = name.split("/", 1)[1] | ||
50 | if not subs.startswith(self.extname): | ||
51 | return "virtual/" + self.extname + "-" + subs | ||
52 | return name | ||
53 | if not name.startswith(self.extname): | ||
54 | return self.extname + "-" + name | ||
55 | return name | ||
56 | |||
57 | clsextend = LinuxMfgToolExtender("mfgtool", d) | ||
58 | clsextend.rename_packages() | ||
59 | clsextend.rename_package_variables((d.getVar("PACKAGEVARS", True) or "").split()) | ||
60 | |||
61 | clsextend.map_packagevars() | ||
62 | } | ||
63 | |||
64 | addhandler mfgtool_recipe_handler | ||
65 | mfgtool_recipe_handler[eventmask] = "bb.event.RecipePreFinalise" | ||
66 | |||
67 | # FIXME: We need to remove the KERNEL_SRC_PATH contents as | ||
68 | # kernel.bbclass has no way to skip its installation. | ||
69 | # FIXME: It is not possible to have external modules against | ||
70 | # this kernel variant. | ||
71 | do_install_append() { | ||
72 | rm -r ${D}${KERNEL_SRC_PATH} | ||
73 | rmdir ${D}/usr/src ${D}/usr | ||
74 | } | ||
75 | |||
76 | # FIXME: We must to avoid the staging of KERNEL_SRC_PATH as | ||
77 | # it is being removed (see above FIXME items). | ||
78 | sysroot_stage_all() { | ||
79 | : | ||
80 | } | ||