diff options
Diffstat (limited to 'meta/classes/kernel.bbclass')
-rw-r--r-- | meta/classes/kernel.bbclass | 782 |
1 files changed, 0 insertions, 782 deletions
diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass deleted file mode 100644 index 8693ab86be..0000000000 --- a/meta/classes/kernel.bbclass +++ /dev/null | |||
@@ -1,782 +0,0 @@ | |||
1 | inherit linux-kernel-base kernel-module-split | ||
2 | |||
3 | COMPATIBLE_HOST = ".*-linux" | ||
4 | |||
5 | KERNEL_PACKAGE_NAME ??= "kernel" | ||
6 | KERNEL_DEPLOYSUBDIR ??= "${@ "" if (d.getVar("KERNEL_PACKAGE_NAME") == "kernel") else d.getVar("KERNEL_PACKAGE_NAME") }" | ||
7 | |||
8 | PROVIDES += "${@ "virtual/kernel" if (d.getVar("KERNEL_PACKAGE_NAME") == "kernel") else "" }" | ||
9 | DEPENDS += "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}gcc kmod-native bc-native bison-native" | ||
10 | DEPENDS += "${@bb.utils.contains("INITRAMFS_FSTYPES", "cpio.lzo", "lzop-native", "", d)}" | ||
11 | DEPENDS += "${@bb.utils.contains("INITRAMFS_FSTYPES", "cpio.lz4", "lz4-native", "", d)}" | ||
12 | PACKAGE_WRITE_DEPS += "depmodwrapper-cross" | ||
13 | |||
14 | do_deploy[depends] += "depmodwrapper-cross:do_populate_sysroot gzip-native:do_populate_sysroot" | ||
15 | do_clean[depends] += "make-mod-scripts:do_clean" | ||
16 | |||
17 | CVE_PRODUCT ?= "linux_kernel" | ||
18 | |||
19 | S = "${STAGING_KERNEL_DIR}" | ||
20 | B = "${WORKDIR}/build" | ||
21 | KBUILD_OUTPUT = "${B}" | ||
22 | OE_TERMINAL_EXPORTS += "KBUILD_OUTPUT" | ||
23 | |||
24 | # we include gcc above, we dont need virtual/libc | ||
25 | INHIBIT_DEFAULT_DEPS = "1" | ||
26 | |||
27 | KERNEL_IMAGETYPE ?= "zImage" | ||
28 | INITRAMFS_IMAGE ?= "" | ||
29 | INITRAMFS_IMAGE_NAME ?= "${@['${INITRAMFS_IMAGE}-${MACHINE}', ''][d.getVar('INITRAMFS_IMAGE') == '']}" | ||
30 | INITRAMFS_TASK ?= "" | ||
31 | INITRAMFS_IMAGE_BUNDLE ?= "" | ||
32 | |||
33 | # KERNEL_VERSION is extracted from source code. It is evaluated as | ||
34 | # None for the first parsing, since the code has not been fetched. | ||
35 | # After the code is fetched, it will be evaluated as real version | ||
36 | # number and cause kernel to be rebuilt. To avoid this, make | ||
37 | # KERNEL_VERSION_NAME and KERNEL_VERSION_PKG_NAME depend on | ||
38 | # LINUX_VERSION which is a constant. | ||
39 | KERNEL_VERSION_NAME = "${@d.getVar('KERNEL_VERSION') or ""}" | ||
40 | KERNEL_VERSION_NAME[vardepvalue] = "${LINUX_VERSION}" | ||
41 | KERNEL_VERSION_PKG_NAME = "${@legitimize_package_name(d.getVar('KERNEL_VERSION'))}" | ||
42 | KERNEL_VERSION_PKG_NAME[vardepvalue] = "${LINUX_VERSION}" | ||
43 | |||
44 | python __anonymous () { | ||
45 | pn = d.getVar("PN") | ||
46 | kpn = d.getVar("KERNEL_PACKAGE_NAME") | ||
47 | |||
48 | # XXX Remove this after bug 11905 is resolved | ||
49 | # FILES_${KERNEL_PACKAGE_NAME}-dev doesn't expand correctly | ||
50 | if kpn == pn: | ||
51 | bb.warn("Some packages (E.g. *-dev) might be missing due to " | ||
52 | "bug 11905 (variable KERNEL_PACKAGE_NAME == PN)") | ||
53 | |||
54 | # The default kernel recipe builds in a shared location defined by | ||
55 | # bitbake/distro confs: STAGING_KERNEL_DIR and STAGING_KERNEL_BUILDDIR. | ||
56 | # Set these variables to directories under ${WORKDIR} in alternate | ||
57 | # kernel recipes (I.e. where KERNEL_PACKAGE_NAME != kernel) so that they | ||
58 | # may build in parallel with the default kernel without clobbering. | ||
59 | if kpn != "kernel": | ||
60 | workdir = d.getVar("WORKDIR") | ||
61 | sourceDir = os.path.join(workdir, 'kernel-source') | ||
62 | artifactsDir = os.path.join(workdir, 'kernel-build-artifacts') | ||
63 | d.setVar("STAGING_KERNEL_DIR", sourceDir) | ||
64 | d.setVar("STAGING_KERNEL_BUILDDIR", artifactsDir) | ||
65 | |||
66 | # Merge KERNEL_IMAGETYPE and KERNEL_ALT_IMAGETYPE into KERNEL_IMAGETYPES | ||
67 | type = d.getVar('KERNEL_IMAGETYPE') or "" | ||
68 | alttype = d.getVar('KERNEL_ALT_IMAGETYPE') or "" | ||
69 | types = d.getVar('KERNEL_IMAGETYPES') or "" | ||
70 | if type not in types.split(): | ||
71 | types = (type + ' ' + types).strip() | ||
72 | if alttype not in types.split(): | ||
73 | types = (alttype + ' ' + types).strip() | ||
74 | d.setVar('KERNEL_IMAGETYPES', types) | ||
75 | |||
76 | # KERNEL_IMAGETYPES may contain a mixture of image types supported directly | ||
77 | # by the kernel build system and types which are created by post-processing | ||
78 | # the output of the kernel build system (e.g. compressing vmlinux -> | ||
79 | # vmlinux.gz in kernel_do_compile()). | ||
80 | # KERNEL_IMAGETYPE_FOR_MAKE should contain only image types supported | ||
81 | # directly by the kernel build system. | ||
82 | if not d.getVar('KERNEL_IMAGETYPE_FOR_MAKE'): | ||
83 | typeformake = set() | ||
84 | for type in types.split(): | ||
85 | if type == 'vmlinux.gz': | ||
86 | type = 'vmlinux' | ||
87 | typeformake.add(type) | ||
88 | |||
89 | d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', ' '.join(sorted(typeformake))) | ||
90 | |||
91 | kname = d.getVar('KERNEL_PACKAGE_NAME') or "kernel" | ||
92 | imagedest = d.getVar('KERNEL_IMAGEDEST') | ||
93 | |||
94 | for type in types.split(): | ||
95 | typelower = type.lower() | ||
96 | d.appendVar('PACKAGES', ' %s-image-%s' % (kname, typelower)) | ||
97 | d.setVar('FILES_' + kname + '-image-' + typelower, '/' + imagedest + '/' + type + '-${KERNEL_VERSION_NAME}' + ' /' + imagedest + '/' + type) | ||
98 | d.appendVar('RDEPENDS_%s-image' % kname, ' %s-image-%s' % (kname, typelower)) | ||
99 | d.setVar('PKG_%s-image-%s' % (kname,typelower), '%s-image-%s-${KERNEL_VERSION_PKG_NAME}' % (kname, typelower)) | ||
100 | d.setVar('ALLOW_EMPTY_%s-image-%s' % (kname, typelower), '1') | ||
101 | d.setVar('pkg_postinst_%s-image-%s' % (kname,typelower), """set +e | ||
102 | if [ -n "$D" ]; then | ||
103 | ln -sf %s-${KERNEL_VERSION} $D/${KERNEL_IMAGEDEST}/%s > /dev/null 2>&1 | ||
104 | else | ||
105 | ln -sf %s-${KERNEL_VERSION} ${KERNEL_IMAGEDEST}/%s > /dev/null 2>&1 | ||
106 | if [ $? -ne 0 ]; then | ||
107 | echo "Filesystem on ${KERNEL_IMAGEDEST}/ doesn't support symlinks, falling back to copied image (%s)." | ||
108 | install -m 0644 ${KERNEL_IMAGEDEST}/%s-${KERNEL_VERSION} ${KERNEL_IMAGEDEST}/%s | ||
109 | fi | ||
110 | fi | ||
111 | set -e | ||
112 | """ % (type, type, type, type, type, type, type)) | ||
113 | d.setVar('pkg_postrm_%s-image-%s' % (kname,typelower), """set +e | ||
114 | if [ -f "${KERNEL_IMAGEDEST}/%s" -o -L "${KERNEL_IMAGEDEST}/%s" ]; then | ||
115 | rm -f ${KERNEL_IMAGEDEST}/%s > /dev/null 2>&1 | ||
116 | fi | ||
117 | set -e | ||
118 | """ % (type, type, type)) | ||
119 | |||
120 | |||
121 | image = d.getVar('INITRAMFS_IMAGE') | ||
122 | # If the INTIRAMFS_IMAGE is set but the INITRAMFS_IMAGE_BUNDLE is set to 0, | ||
123 | # the do_bundle_initramfs does nothing, but the INITRAMFS_IMAGE is built | ||
124 | # standalone for use by wic and other tools. | ||
125 | if image: | ||
126 | d.appendVarFlag('do_bundle_initramfs', 'depends', ' ${INITRAMFS_IMAGE}:do_image_complete') | ||
127 | |||
128 | # NOTE: setting INITRAMFS_TASK is for backward compatibility | ||
129 | # The preferred method is to set INITRAMFS_IMAGE, because | ||
130 | # this INITRAMFS_TASK has circular dependency problems | ||
131 | # if the initramfs requires kernel modules | ||
132 | image_task = d.getVar('INITRAMFS_TASK') | ||
133 | if image_task: | ||
134 | d.appendVarFlag('do_configure', 'depends', ' ${INITRAMFS_TASK}') | ||
135 | } | ||
136 | |||
137 | # Here we pull in all various kernel image types which we support. | ||
138 | # | ||
139 | # In case you're wondering why kernel.bbclass inherits the other image | ||
140 | # types instead of the other way around, the reason for that is to | ||
141 | # maintain compatibility with various currently existing meta-layers. | ||
142 | # By pulling in the various kernel image types here, we retain the | ||
143 | # original behavior of kernel.bbclass, so no meta-layers should get | ||
144 | # broken. | ||
145 | # | ||
146 | # KERNEL_CLASSES by default pulls in kernel-uimage.bbclass, since this | ||
147 | # used to be the default behavior when only uImage was supported. This | ||
148 | # variable can be appended by users who implement support for new kernel | ||
149 | # image types. | ||
150 | |||
151 | KERNEL_CLASSES ?= " kernel-uimage " | ||
152 | inherit ${KERNEL_CLASSES} | ||
153 | |||
154 | # Old style kernels may set ${S} = ${WORKDIR}/git for example | ||
155 | # We need to move these over to STAGING_KERNEL_DIR. We can't just | ||
156 | # create the symlink in advance as the git fetcher can't cope with | ||
157 | # the symlink. | ||
158 | do_unpack[cleandirs] += " ${S} ${STAGING_KERNEL_DIR} ${B} ${STAGING_KERNEL_BUILDDIR}" | ||
159 | do_clean[cleandirs] += " ${S} ${STAGING_KERNEL_DIR} ${B} ${STAGING_KERNEL_BUILDDIR}" | ||
160 | python do_symlink_kernsrc () { | ||
161 | s = d.getVar("S") | ||
162 | if s[-1] == '/': | ||
163 | # drop trailing slash, so that os.symlink(kernsrc, s) doesn't use s as directory name and fail | ||
164 | s=s[:-1] | ||
165 | kernsrc = d.getVar("STAGING_KERNEL_DIR") | ||
166 | if s != kernsrc: | ||
167 | bb.utils.mkdirhier(kernsrc) | ||
168 | bb.utils.remove(kernsrc, recurse=True) | ||
169 | if d.getVar("EXTERNALSRC"): | ||
170 | # With EXTERNALSRC S will not be wiped so we can symlink to it | ||
171 | os.symlink(s, kernsrc) | ||
172 | else: | ||
173 | import shutil | ||
174 | shutil.move(s, kernsrc) | ||
175 | os.symlink(kernsrc, s) | ||
176 | } | ||
177 | # do_patch is normally ordered before do_configure, but | ||
178 | # externalsrc.bbclass deletes do_patch, breaking the dependency of | ||
179 | # do_configure on do_symlink_kernsrc. | ||
180 | addtask symlink_kernsrc before do_patch do_configure after do_unpack | ||
181 | |||
182 | inherit kernel-arch deploy | ||
183 | |||
184 | PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-module-.*" | ||
185 | PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-image-.*" | ||
186 | PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-firmware-.*" | ||
187 | |||
188 | export OS = "${TARGET_OS}" | ||
189 | export CROSS_COMPILE = "${TARGET_PREFIX}" | ||
190 | export KBUILD_BUILD_VERSION = "1" | ||
191 | export KBUILD_BUILD_USER ?= "oe-user" | ||
192 | export KBUILD_BUILD_HOST ?= "oe-host" | ||
193 | |||
194 | KERNEL_RELEASE ?= "${KERNEL_VERSION}" | ||
195 | |||
196 | # The directory where built kernel lies in the kernel tree | ||
197 | KERNEL_OUTPUT_DIR ?= "arch/${ARCH}/boot" | ||
198 | KERNEL_IMAGEDEST ?= "boot" | ||
199 | |||
200 | # | ||
201 | # configuration | ||
202 | # | ||
203 | export CMDLINE_CONSOLE = "console=${@d.getVar("KERNEL_CONSOLE") or "ttyS0"}" | ||
204 | |||
205 | KERNEL_VERSION = "${@get_kernelversion_headers('${B}')}" | ||
206 | |||
207 | KERNEL_LOCALVERSION ?= "" | ||
208 | |||
209 | # kernels are generally machine specific | ||
210 | PACKAGE_ARCH = "${MACHINE_ARCH}" | ||
211 | |||
212 | # U-Boot support | ||
213 | UBOOT_ENTRYPOINT ?= "20008000" | ||
214 | UBOOT_LOADADDRESS ?= "${UBOOT_ENTRYPOINT}" | ||
215 | |||
216 | # Some Linux kernel configurations need additional parameters on the command line | ||
217 | KERNEL_EXTRA_ARGS ?= "" | ||
218 | |||
219 | EXTRA_OEMAKE = " HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" HOSTCPP="${BUILD_CPP}"" | ||
220 | EXTRA_OEMAKE += " HOSTCXX="${BUILD_CXX} ${BUILD_CXXFLAGS} ${BUILD_LDFLAGS}"" | ||
221 | |||
222 | KERNEL_ALT_IMAGETYPE ??= "" | ||
223 | |||
224 | copy_initramfs() { | ||
225 | echo "Copying initramfs into ./usr ..." | ||
226 | # In case the directory is not created yet from the first pass compile: | ||
227 | mkdir -p ${B}/usr | ||
228 | # Find and use the first initramfs image archive type we find | ||
229 | rm -f ${B}/usr/${INITRAMFS_IMAGE_NAME}.cpio | ||
230 | for img in cpio cpio.gz cpio.lz4 cpio.lzo cpio.lzma cpio.xz; do | ||
231 | if [ -e "${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE_NAME}.$img" ]; then | ||
232 | cp ${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE_NAME}.$img ${B}/usr/. | ||
233 | case $img in | ||
234 | *gz) | ||
235 | echo "gzip decompressing image" | ||
236 | gunzip -f ${B}/usr/${INITRAMFS_IMAGE_NAME}.$img | ||
237 | break | ||
238 | ;; | ||
239 | *lz4) | ||
240 | echo "lz4 decompressing image" | ||
241 | lz4 -df ${B}/usr/${INITRAMFS_IMAGE_NAME}.$img ${B}/usr/${INITRAMFS_IMAGE_NAME}.cpio | ||
242 | break | ||
243 | ;; | ||
244 | *lzo) | ||
245 | echo "lzo decompressing image" | ||
246 | lzop -df ${B}/usr/${INITRAMFS_IMAGE_NAME}.$img | ||
247 | break | ||
248 | ;; | ||
249 | *lzma) | ||
250 | echo "lzma decompressing image" | ||
251 | lzma -df ${B}/usr/${INITRAMFS_IMAGE_NAME}.$img | ||
252 | break | ||
253 | ;; | ||
254 | *xz) | ||
255 | echo "xz decompressing image" | ||
256 | xz -df ${B}/usr/${INITRAMFS_IMAGE_NAME}.$img | ||
257 | break | ||
258 | ;; | ||
259 | esac | ||
260 | break | ||
261 | fi | ||
262 | done | ||
263 | # Verify that the above loop found a initramfs, fail otherwise | ||
264 | [ -f ${B}/usr/${INITRAMFS_IMAGE_NAME}.cpio ] && echo "Finished copy of initramfs into ./usr" || die "Could not find any ${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE_NAME}.cpio{.gz|.lz4|.lzo|.lzma|.xz) for bundling; INITRAMFS_IMAGE_NAME might be wrong." | ||
265 | } | ||
266 | |||
267 | do_bundle_initramfs () { | ||
268 | if [ ! -z "${INITRAMFS_IMAGE}" -a x"${INITRAMFS_IMAGE_BUNDLE}" = x1 ]; then | ||
269 | echo "Creating a kernel image with a bundled initramfs..." | ||
270 | copy_initramfs | ||
271 | # Backing up kernel image relies on its type(regular file or symbolic link) | ||
272 | tmp_path="" | ||
273 | for imageType in ${KERNEL_IMAGETYPE_FOR_MAKE} ; do | ||
274 | if [ -h ${KERNEL_OUTPUT_DIR}/$imageType ] ; then | ||
275 | linkpath=`readlink -n ${KERNEL_OUTPUT_DIR}/$imageType` | ||
276 | realpath=`readlink -fn ${KERNEL_OUTPUT_DIR}/$imageType` | ||
277 | mv -f $realpath $realpath.bak | ||
278 | tmp_path=$tmp_path" "$imageType"#"$linkpath"#"$realpath | ||
279 | elif [ -f ${KERNEL_OUTPUT_DIR}/$imageType ]; then | ||
280 | mv -f ${KERNEL_OUTPUT_DIR}/$imageType ${KERNEL_OUTPUT_DIR}/$imageType.bak | ||
281 | tmp_path=$tmp_path" "$imageType"##" | ||
282 | fi | ||
283 | done | ||
284 | use_alternate_initrd=CONFIG_INITRAMFS_SOURCE=${B}/usr/${INITRAMFS_IMAGE_NAME}.cpio | ||
285 | kernel_do_compile | ||
286 | # Restoring kernel image | ||
287 | for tp in $tmp_path ; do | ||
288 | imageType=`echo $tp|cut -d "#" -f 1` | ||
289 | linkpath=`echo $tp|cut -d "#" -f 2` | ||
290 | realpath=`echo $tp|cut -d "#" -f 3` | ||
291 | if [ -n "$realpath" ]; then | ||
292 | mv -f $realpath $realpath.initramfs | ||
293 | mv -f $realpath.bak $realpath | ||
294 | ln -sf $linkpath.initramfs ${B}/${KERNEL_OUTPUT_DIR}/$imageType.initramfs | ||
295 | else | ||
296 | mv -f ${KERNEL_OUTPUT_DIR}/$imageType ${KERNEL_OUTPUT_DIR}/$imageType.initramfs | ||
297 | mv -f ${KERNEL_OUTPUT_DIR}/$imageType.bak ${KERNEL_OUTPUT_DIR}/$imageType | ||
298 | fi | ||
299 | done | ||
300 | fi | ||
301 | } | ||
302 | do_bundle_initramfs[dirs] = "${B}" | ||
303 | |||
304 | python do_devshell_prepend () { | ||
305 | os.environ["LDFLAGS"] = '' | ||
306 | } | ||
307 | |||
308 | addtask bundle_initramfs after do_install before do_deploy | ||
309 | |||
310 | get_cc_option () { | ||
311 | # Check if KERNEL_CC supports the option "file-prefix-map". | ||
312 | # This option allows us to build images with __FILE__ values that do not | ||
313 | # contain the host build path. | ||
314 | if ${KERNEL_CC} -Q --help=joined | grep -q "\-ffile-prefix-map=<old=new>"; then | ||
315 | echo "-ffile-prefix-map=${S}=/kernel-source/" | ||
316 | fi | ||
317 | } | ||
318 | |||
319 | kernel_do_compile() { | ||
320 | unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE | ||
321 | if [ "${BUILD_REPRODUCIBLE_BINARIES}" = "1" ]; then | ||
322 | # kernel sources do not use do_unpack, so SOURCE_DATE_EPOCH may not | ||
323 | # be set.... | ||
324 | if [ "${SOURCE_DATE_EPOCH}" = "" -o "${SOURCE_DATE_EPOCH}" = "0" ]; then | ||
325 | # The source directory is not necessarily a git repository, so we | ||
326 | # specify the git-dir to ensure that git does not query a | ||
327 | # repository in any parent directory. | ||
328 | SOURCE_DATE_EPOCH=`git --git-dir="${S}/.git" log -1 --pretty=%ct 2>/dev/null || echo "${REPRODUCIBLE_TIMESTAMP_ROOTFS}"` | ||
329 | fi | ||
330 | |||
331 | ts=`LC_ALL=C date -d @$SOURCE_DATE_EPOCH` | ||
332 | export KBUILD_BUILD_TIMESTAMP="$ts" | ||
333 | export KCONFIG_NOTIMESTAMP=1 | ||
334 | bbnote "KBUILD_BUILD_TIMESTAMP: $ts" | ||
335 | fi | ||
336 | # The $use_alternate_initrd is only set from | ||
337 | # do_bundle_initramfs() This variable is specifically for the | ||
338 | # case where we are making a second pass at the kernel | ||
339 | # compilation and we want to force the kernel build to use a | ||
340 | # different initramfs image. The way to do that in the kernel | ||
341 | # is to specify: | ||
342 | # make ...args... CONFIG_INITRAMFS_SOURCE=some_other_initramfs.cpio | ||
343 | if [ "$use_alternate_initrd" = "" ] && [ "${INITRAMFS_TASK}" != "" ] ; then | ||
344 | # The old style way of copying an prebuilt image and building it | ||
345 | # is turned on via INTIRAMFS_TASK != "" | ||
346 | copy_initramfs | ||
347 | use_alternate_initrd=CONFIG_INITRAMFS_SOURCE=${B}/usr/${INITRAMFS_IMAGE_NAME}.cpio | ||
348 | fi | ||
349 | cc_extra=$(get_cc_option) | ||
350 | for typeformake in ${KERNEL_IMAGETYPE_FOR_MAKE} ; do | ||
351 | oe_runmake ${typeformake} CC="${KERNEL_CC} $cc_extra " LD="${KERNEL_LD}" ${KERNEL_EXTRA_ARGS} $use_alternate_initrd | ||
352 | done | ||
353 | # vmlinux.gz is not built by kernel | ||
354 | if (echo "${KERNEL_IMAGETYPES}" | grep -wq "vmlinux\.gz"); then | ||
355 | mkdir -p "${KERNEL_OUTPUT_DIR}" | ||
356 | gzip -9cn < ${B}/vmlinux > "${KERNEL_OUTPUT_DIR}/vmlinux.gz" | ||
357 | fi | ||
358 | } | ||
359 | |||
360 | do_compile_kernelmodules() { | ||
361 | unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE | ||
362 | if [ "${BUILD_REPRODUCIBLE_BINARIES}" = "1" ]; then | ||
363 | # kernel sources do not use do_unpack, so SOURCE_DATE_EPOCH may not | ||
364 | # be set.... | ||
365 | if [ "${SOURCE_DATE_EPOCH}" = "" -o "${SOURCE_DATE_EPOCH}" = "0" ]; then | ||
366 | # The source directory is not necessarily a git repository, so we | ||
367 | # specify the git-dir to ensure that git does not query a | ||
368 | # repository in any parent directory. | ||
369 | SOURCE_DATE_EPOCH=`git --git-dir="${S}/.git" log -1 --pretty=%ct 2>/dev/null || echo "${REPRODUCIBLE_TIMESTAMP_ROOTFS}"` | ||
370 | fi | ||
371 | |||
372 | ts=`LC_ALL=C date -d @$SOURCE_DATE_EPOCH` | ||
373 | export KBUILD_BUILD_TIMESTAMP="$ts" | ||
374 | export KCONFIG_NOTIMESTAMP=1 | ||
375 | bbnote "KBUILD_BUILD_TIMESTAMP: $ts" | ||
376 | fi | ||
377 | if (grep -q -i -e '^CONFIG_MODULES=y$' ${B}/.config); then | ||
378 | cc_extra=$(get_cc_option) | ||
379 | oe_runmake -C ${B} ${PARALLEL_MAKE} modules CC="${KERNEL_CC} $cc_extra " LD="${KERNEL_LD}" ${KERNEL_EXTRA_ARGS} | ||
380 | |||
381 | # Module.symvers gets updated during the | ||
382 | # building of the kernel modules. We need to | ||
383 | # update this in the shared workdir since some | ||
384 | # external kernel modules has a dependency on | ||
385 | # other kernel modules and will look at this | ||
386 | # file to do symbol lookups | ||
387 | cp ${B}/Module.symvers ${STAGING_KERNEL_BUILDDIR}/ | ||
388 | # 5.10+ kernels have module.lds that we need to copy for external module builds | ||
389 | if [ -e "${B}/scripts/module.lds" ]; then | ||
390 | install -Dm 0644 ${B}/scripts/module.lds ${STAGING_KERNEL_BUILDDIR}/scripts/module.lds | ||
391 | fi | ||
392 | else | ||
393 | bbnote "no modules to compile" | ||
394 | fi | ||
395 | } | ||
396 | addtask compile_kernelmodules after do_compile before do_strip | ||
397 | |||
398 | kernel_do_install() { | ||
399 | # | ||
400 | # First install the modules | ||
401 | # | ||
402 | unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE | ||
403 | if (grep -q -i -e '^CONFIG_MODULES=y$' .config); then | ||
404 | oe_runmake DEPMOD=echo MODLIB=${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION} INSTALL_FW_PATH=${D}${nonarch_base_libdir}/firmware modules_install | ||
405 | rm "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build" | ||
406 | rm "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/source" | ||
407 | # If the kernel/ directory is empty remove it to prevent QA issues | ||
408 | rmdir --ignore-fail-on-non-empty "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/kernel" | ||
409 | else | ||
410 | bbnote "no modules to install" | ||
411 | fi | ||
412 | |||
413 | # | ||
414 | # Install various kernel output (zImage, map file, config, module support files) | ||
415 | # | ||
416 | install -d ${D}/${KERNEL_IMAGEDEST} | ||
417 | install -d ${D}/boot | ||
418 | |||
419 | # | ||
420 | # When including an initramfs bundle inside a FIT image, the fitImage is created after the install task | ||
421 | # by do_assemble_fitimage_initramfs. | ||
422 | # This happens after the generation of the initramfs bundle (done by do_bundle_initramfs). | ||
423 | # So, at the level of the install task we should not try to install the fitImage. fitImage is still not | ||
424 | # generated yet. | ||
425 | # After the generation of the fitImage, the deploy task copies the fitImage from the build directory to | ||
426 | # the deploy folder. | ||
427 | # | ||
428 | |||
429 | for imageType in ${KERNEL_IMAGETYPES} ; do | ||
430 | if [ $imageType != "fitImage" ] || [ "${INITRAMFS_IMAGE_BUNDLE}" != "1" ] ; then | ||
431 | install -m 0644 ${KERNEL_OUTPUT_DIR}/$imageType ${D}/${KERNEL_IMAGEDEST}/$imageType-${KERNEL_VERSION} | ||
432 | fi | ||
433 | done | ||
434 | |||
435 | install -m 0644 System.map ${D}/boot/System.map-${KERNEL_VERSION} | ||
436 | install -m 0644 .config ${D}/boot/config-${KERNEL_VERSION} | ||
437 | install -m 0644 vmlinux ${D}/boot/vmlinux-${KERNEL_VERSION} | ||
438 | [ -e Module.symvers ] && install -m 0644 Module.symvers ${D}/boot/Module.symvers-${KERNEL_VERSION} | ||
439 | install -d ${D}${sysconfdir}/modules-load.d | ||
440 | install -d ${D}${sysconfdir}/modprobe.d | ||
441 | } | ||
442 | |||
443 | # Must be ran no earlier than after do_kernel_checkout or else Makefile won't be in ${S}/Makefile | ||
444 | do_kernel_version_sanity_check() { | ||
445 | if [ "x${KERNEL_VERSION_SANITY_SKIP}" = "x1" ]; then | ||
446 | exit 0 | ||
447 | fi | ||
448 | |||
449 | # The Makefile determines the kernel version shown at runtime | ||
450 | # Don't use KERNEL_VERSION because the headers it grabs the version from aren't generated until do_compile | ||
451 | VERSION=$(grep "^VERSION =" ${S}/Makefile | sed s/.*=\ *//) | ||
452 | PATCHLEVEL=$(grep "^PATCHLEVEL =" ${S}/Makefile | sed s/.*=\ *//) | ||
453 | SUBLEVEL=$(grep "^SUBLEVEL =" ${S}/Makefile | sed s/.*=\ *//) | ||
454 | EXTRAVERSION=$(grep "^EXTRAVERSION =" ${S}/Makefile | sed s/.*=\ *//) | ||
455 | |||
456 | # Build a string for regex and a plain version string | ||
457 | reg="^${VERSION}\.${PATCHLEVEL}" | ||
458 | vers="${VERSION}.${PATCHLEVEL}" | ||
459 | if [ -n "${SUBLEVEL}" ]; then | ||
460 | # Ignoring a SUBLEVEL of zero is fine | ||
461 | if [ "${SUBLEVEL}" = "0" ]; then | ||
462 | reg="${reg}(\.${SUBLEVEL})?" | ||
463 | else | ||
464 | reg="${reg}\.${SUBLEVEL}" | ||
465 | vers="${vers}.${SUBLEVEL}" | ||
466 | fi | ||
467 | fi | ||
468 | vers="${vers}${EXTRAVERSION}" | ||
469 | reg="${reg}${EXTRAVERSION}" | ||
470 | |||
471 | if [ -z `echo ${PV} | grep -E "${reg}"` ]; then | ||
472 | bbfatal "Package Version (${PV}) does not match of kernel being built (${vers}). Please update the PV variable to match the kernel source or set KERNEL_VERSION_SANITY_SKIP=\"1\" in your recipe." | ||
473 | fi | ||
474 | exit 0 | ||
475 | } | ||
476 | |||
477 | addtask shared_workdir after do_compile before do_compile_kernelmodules | ||
478 | addtask shared_workdir_setscene | ||
479 | |||
480 | do_shared_workdir_setscene () { | ||
481 | exit 1 | ||
482 | } | ||
483 | |||
484 | emit_depmod_pkgdata() { | ||
485 | # Stash data for depmod | ||
486 | install -d ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/ | ||
487 | echo "${KERNEL_VERSION}" > ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/${KERNEL_PACKAGE_NAME}-abiversion | ||
488 | cp ${B}/System.map ${PKGDESTWORK}/${KERNEL_PACKAGE_NAME}-depmod/System.map-${KERNEL_VERSION} | ||
489 | } | ||
490 | |||
491 | PACKAGEFUNCS += "emit_depmod_pkgdata" | ||
492 | |||
493 | do_shared_workdir[cleandirs] += " ${STAGING_KERNEL_BUILDDIR}" | ||
494 | do_shared_workdir () { | ||
495 | cd ${B} | ||
496 | |||
497 | kerneldir=${STAGING_KERNEL_BUILDDIR} | ||
498 | install -d $kerneldir | ||
499 | |||
500 | # | ||
501 | # Store the kernel version in sysroots for module-base.bbclass | ||
502 | # | ||
503 | |||
504 | echo "${KERNEL_VERSION}" > $kerneldir/${KERNEL_PACKAGE_NAME}-abiversion | ||
505 | |||
506 | # Copy files required for module builds | ||
507 | cp System.map $kerneldir/System.map-${KERNEL_VERSION} | ||
508 | [ -e Module.symvers ] && cp Module.symvers $kerneldir/ | ||
509 | cp .config $kerneldir/ | ||
510 | mkdir -p $kerneldir/include/config | ||
511 | cp include/config/kernel.release $kerneldir/include/config/kernel.release | ||
512 | if [ -e certs/signing_key.x509 ]; then | ||
513 | # The signing_key.* files are stored in the certs/ dir in | ||
514 | # newer Linux kernels | ||
515 | mkdir -p $kerneldir/certs | ||
516 | cp certs/signing_key.* $kerneldir/certs/ | ||
517 | elif [ -e signing_key.priv ]; then | ||
518 | cp signing_key.* $kerneldir/ | ||
519 | fi | ||
520 | |||
521 | # We can also copy over all the generated files and avoid special cases | ||
522 | # like version.h, but we've opted to keep this small until file creep starts | ||
523 | # to happen | ||
524 | if [ -e include/linux/version.h ]; then | ||
525 | mkdir -p $kerneldir/include/linux | ||
526 | cp include/linux/version.h $kerneldir/include/linux/version.h | ||
527 | fi | ||
528 | |||
529 | # As of Linux kernel version 3.0.1, the clean target removes | ||
530 | # arch/powerpc/lib/crtsavres.o which is present in | ||
531 | # KBUILD_LDFLAGS_MODULE, making it required to build external modules. | ||
532 | if [ ${ARCH} = "powerpc" ]; then | ||
533 | if [ -e arch/powerpc/lib/crtsavres.o ]; then | ||
534 | mkdir -p $kerneldir/arch/powerpc/lib/ | ||
535 | cp arch/powerpc/lib/crtsavres.o $kerneldir/arch/powerpc/lib/crtsavres.o | ||
536 | fi | ||
537 | fi | ||
538 | |||
539 | if [ -d include/generated ]; then | ||
540 | mkdir -p $kerneldir/include/generated/ | ||
541 | cp -fR include/generated/* $kerneldir/include/generated/ | ||
542 | fi | ||
543 | |||
544 | if [ -d arch/${ARCH}/include/generated ]; then | ||
545 | mkdir -p $kerneldir/arch/${ARCH}/include/generated/ | ||
546 | cp -fR arch/${ARCH}/include/generated/* $kerneldir/arch/${ARCH}/include/generated/ | ||
547 | fi | ||
548 | |||
549 | if (grep -q -i -e '^CONFIG_UNWINDER_ORC=y$' $kerneldir/.config); then | ||
550 | # With CONFIG_UNWINDER_ORC (the default in 4.14), objtool is required for | ||
551 | # out-of-tree modules to be able to generate object files. | ||
552 | if [ -x tools/objtool/objtool ]; then | ||
553 | mkdir -p ${kerneldir}/tools/objtool | ||
554 | cp tools/objtool/objtool ${kerneldir}/tools/objtool/ | ||
555 | fi | ||
556 | fi | ||
557 | } | ||
558 | |||
559 | # We don't need to stage anything, not the modules/firmware since those would clash with linux-firmware | ||
560 | sysroot_stage_all () { | ||
561 | : | ||
562 | } | ||
563 | |||
564 | KERNEL_CONFIG_COMMAND ?= "oe_runmake_call -C ${S} CC="${KERNEL_CC}" LD="${KERNEL_LD}" O=${B} olddefconfig || oe_runmake -C ${S} O=${B} CC="${KERNEL_CC}" LD="${KERNEL_LD}" oldnoconfig" | ||
565 | |||
566 | python check_oldest_kernel() { | ||
567 | oldest_kernel = d.getVar('OLDEST_KERNEL') | ||
568 | kernel_version = d.getVar('KERNEL_VERSION') | ||
569 | tclibc = d.getVar('TCLIBC') | ||
570 | if tclibc == 'glibc': | ||
571 | kernel_version = kernel_version.split('-', 1)[0] | ||
572 | if oldest_kernel and kernel_version: | ||
573 | if bb.utils.vercmp_string(kernel_version, oldest_kernel) < 0: | ||
574 | bb.warn('%s: OLDEST_KERNEL is "%s" but the version of the kernel you are building is "%s" - therefore %s as built may not be compatible with this kernel. Either set OLDEST_KERNEL to an older version, or build a newer kernel.' % (d.getVar('PN'), oldest_kernel, kernel_version, tclibc)) | ||
575 | } | ||
576 | |||
577 | check_oldest_kernel[vardepsexclude] += "OLDEST_KERNEL KERNEL_VERSION" | ||
578 | do_configure[prefuncs] += "check_oldest_kernel" | ||
579 | |||
580 | kernel_do_configure() { | ||
581 | # fixes extra + in /lib/modules/2.6.37+ | ||
582 | # $ scripts/setlocalversion . => + | ||
583 | # $ make kernelversion => 2.6.37 | ||
584 | # $ make kernelrelease => 2.6.37+ | ||
585 | touch ${B}/.scmversion ${S}/.scmversion | ||
586 | |||
587 | if [ "${S}" != "${B}" ] && [ -f "${S}/.config" ] && [ ! -f "${B}/.config" ]; then | ||
588 | mv "${S}/.config" "${B}/.config" | ||
589 | fi | ||
590 | |||
591 | # Copy defconfig to .config if .config does not exist. This allows | ||
592 | # recipes to manage the .config themselves in do_configure_prepend(). | ||
593 | if [ -f "${WORKDIR}/defconfig" ] && [ ! -f "${B}/.config" ]; then | ||
594 | cp "${WORKDIR}/defconfig" "${B}/.config" | ||
595 | fi | ||
596 | |||
597 | ${KERNEL_CONFIG_COMMAND} | ||
598 | } | ||
599 | |||
600 | do_savedefconfig() { | ||
601 | bbplain "Saving defconfig to:\n${B}/defconfig" | ||
602 | oe_runmake -C ${B} savedefconfig | ||
603 | } | ||
604 | do_savedefconfig[nostamp] = "1" | ||
605 | addtask savedefconfig after do_configure | ||
606 | |||
607 | inherit cml1 | ||
608 | |||
609 | KCONFIG_CONFIG_COMMAND_append = " LD='${KERNEL_LD}' HOSTLDFLAGS='${BUILD_LDFLAGS}'" | ||
610 | |||
611 | EXPORT_FUNCTIONS do_compile do_install do_configure | ||
612 | |||
613 | # kernel-base becomes kernel-${KERNEL_VERSION} | ||
614 | # kernel-image becomes kernel-image-${KERNEL_VERSION} | ||
615 | PACKAGES = "${KERNEL_PACKAGE_NAME} ${KERNEL_PACKAGE_NAME}-base ${KERNEL_PACKAGE_NAME}-vmlinux ${KERNEL_PACKAGE_NAME}-image ${KERNEL_PACKAGE_NAME}-dev ${KERNEL_PACKAGE_NAME}-modules" | ||
616 | FILES_${PN} = "" | ||
617 | FILES_${KERNEL_PACKAGE_NAME}-base = "${nonarch_base_libdir}/modules/${KERNEL_VERSION}/modules.order ${nonarch_base_libdir}/modules/${KERNEL_VERSION}/modules.builtin ${nonarch_base_libdir}/modules/${KERNEL_VERSION}/modules.builtin.modinfo" | ||
618 | FILES_${KERNEL_PACKAGE_NAME}-image = "" | ||
619 | FILES_${KERNEL_PACKAGE_NAME}-dev = "/boot/System.map* /boot/Module.symvers* /boot/config* ${KERNEL_SRC_PATH} ${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build" | ||
620 | FILES_${KERNEL_PACKAGE_NAME}-vmlinux = "/boot/vmlinux-${KERNEL_VERSION_NAME}" | ||
621 | FILES_${KERNEL_PACKAGE_NAME}-modules = "" | ||
622 | RDEPENDS_${KERNEL_PACKAGE_NAME} = "${KERNEL_PACKAGE_NAME}-base" | ||
623 | # Allow machines to override this dependency if kernel image files are | ||
624 | # not wanted in images as standard | ||
625 | RDEPENDS_${KERNEL_PACKAGE_NAME}-base ?= "${KERNEL_PACKAGE_NAME}-image" | ||
626 | PKG_${KERNEL_PACKAGE_NAME}-image = "${KERNEL_PACKAGE_NAME}-image-${@legitimize_package_name(d.getVar('KERNEL_VERSION'))}" | ||
627 | RDEPENDS_${KERNEL_PACKAGE_NAME}-image += "${@oe.utils.conditional('KERNEL_IMAGETYPE', 'vmlinux', '${KERNEL_PACKAGE_NAME}-vmlinux', '', d)}" | ||
628 | PKG_${KERNEL_PACKAGE_NAME}-base = "${KERNEL_PACKAGE_NAME}-${@legitimize_package_name(d.getVar('KERNEL_VERSION'))}" | ||
629 | RPROVIDES_${KERNEL_PACKAGE_NAME}-base += "${KERNEL_PACKAGE_NAME}-${KERNEL_VERSION}" | ||
630 | ALLOW_EMPTY_${KERNEL_PACKAGE_NAME} = "1" | ||
631 | ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-base = "1" | ||
632 | ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-image = "1" | ||
633 | ALLOW_EMPTY_${KERNEL_PACKAGE_NAME}-modules = "1" | ||
634 | DESCRIPTION_${KERNEL_PACKAGE_NAME}-modules = "Kernel modules meta package" | ||
635 | |||
636 | pkg_postinst_${KERNEL_PACKAGE_NAME}-base () { | ||
637 | if [ ! -e "$D/lib/modules/${KERNEL_VERSION}" ]; then | ||
638 | mkdir -p $D/lib/modules/${KERNEL_VERSION} | ||
639 | fi | ||
640 | if [ -n "$D" ]; then | ||
641 | depmodwrapper -a -b $D ${KERNEL_VERSION} | ||
642 | else | ||
643 | depmod -a ${KERNEL_VERSION} | ||
644 | fi | ||
645 | } | ||
646 | |||
647 | PACKAGESPLITFUNCS_prepend = "split_kernel_packages " | ||
648 | |||
649 | python split_kernel_packages () { | ||
650 | do_split_packages(d, root='${nonarch_base_libdir}/firmware', file_regex=r'^(.*)\.(bin|fw|cis|csp|dsp)$', output_pattern='${KERNEL_PACKAGE_NAME}-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='') | ||
651 | } | ||
652 | |||
653 | # Many scripts want to look in arch/$arch/boot for the bootable | ||
654 | # image. This poses a problem for vmlinux and vmlinuz based | ||
655 | # booting. This task arranges to have vmlinux and vmlinuz appear | ||
656 | # in the normalized directory location. | ||
657 | do_kernel_link_images() { | ||
658 | if [ ! -d "${B}/arch/${ARCH}/boot" ]; then | ||
659 | mkdir ${B}/arch/${ARCH}/boot | ||
660 | fi | ||
661 | cd ${B}/arch/${ARCH}/boot | ||
662 | ln -sf ../../../vmlinux | ||
663 | if [ -f ../../../vmlinuz ]; then | ||
664 | ln -sf ../../../vmlinuz | ||
665 | fi | ||
666 | if [ -f ../../../vmlinuz.bin ]; then | ||
667 | ln -sf ../../../vmlinuz.bin | ||
668 | fi | ||
669 | if [ -f ../../../vmlinux.64 ]; then | ||
670 | ln -sf ../../../vmlinux.64 | ||
671 | fi | ||
672 | } | ||
673 | addtask kernel_link_images after do_compile before do_strip | ||
674 | |||
675 | do_strip() { | ||
676 | if [ -n "${KERNEL_IMAGE_STRIP_EXTRA_SECTIONS}" ]; then | ||
677 | if ! (echo "${KERNEL_IMAGETYPES}" | grep -wq "vmlinux"); then | ||
678 | bbwarn "image type(s) will not be stripped (not supported): ${KERNEL_IMAGETYPES}" | ||
679 | return | ||
680 | fi | ||
681 | |||
682 | cd ${B} | ||
683 | headers=`"$CROSS_COMPILE"readelf -S ${KERNEL_OUTPUT_DIR}/vmlinux | \ | ||
684 | grep "^ \{1,\}\[[0-9 ]\{1,\}\] [^ ]" | \ | ||
685 | sed "s/^ \{1,\}\[[0-9 ]\{1,\}\] //" | \ | ||
686 | gawk '{print $1}'` | ||
687 | |||
688 | for str in ${KERNEL_IMAGE_STRIP_EXTRA_SECTIONS}; do { | ||
689 | if ! (echo "$headers" | grep -q "^$str$"); then | ||
690 | bbwarn "Section not found: $str"; | ||
691 | fi | ||
692 | |||
693 | "$CROSS_COMPILE"strip -s -R $str ${KERNEL_OUTPUT_DIR}/vmlinux | ||
694 | }; done | ||
695 | |||
696 | bbnote "KERNEL_IMAGE_STRIP_EXTRA_SECTIONS is set, stripping sections:" \ | ||
697 | "${KERNEL_IMAGE_STRIP_EXTRA_SECTIONS}" | ||
698 | fi; | ||
699 | } | ||
700 | do_strip[dirs] = "${B}" | ||
701 | |||
702 | addtask strip before do_sizecheck after do_kernel_link_images | ||
703 | |||
704 | # Support checking the kernel size since some kernels need to reside in partitions | ||
705 | # with a fixed length or there is a limit in transferring the kernel to memory. | ||
706 | # If more than one image type is enabled, warn on any that don't fit but only fail | ||
707 | # if none fit. | ||
708 | do_sizecheck() { | ||
709 | if [ ! -z "${KERNEL_IMAGE_MAXSIZE}" ]; then | ||
710 | invalid=`echo ${KERNEL_IMAGE_MAXSIZE} | sed 's/[0-9]//g'` | ||
711 | if [ -n "$invalid" ]; then | ||
712 | die "Invalid KERNEL_IMAGE_MAXSIZE: ${KERNEL_IMAGE_MAXSIZE}, should be an integer (The unit is Kbytes)" | ||
713 | fi | ||
714 | at_least_one_fits= | ||
715 | for imageType in ${KERNEL_IMAGETYPES} ; do | ||
716 | size=`du -ks ${B}/${KERNEL_OUTPUT_DIR}/$imageType | awk '{print $1}'` | ||
717 | if [ $size -ge ${KERNEL_IMAGE_MAXSIZE} ]; then | ||
718 | bbwarn "This kernel $imageType (size=$size(K) > ${KERNEL_IMAGE_MAXSIZE}(K)) is too big for your device." | ||
719 | else | ||
720 | at_least_one_fits=y | ||
721 | fi | ||
722 | done | ||
723 | if [ -z "$at_least_one_fits" ]; then | ||
724 | die "All kernel images are too big for your device. Please reduce the size of the kernel by making more of it modular." | ||
725 | fi | ||
726 | fi | ||
727 | } | ||
728 | do_sizecheck[dirs] = "${B}" | ||
729 | |||
730 | addtask sizecheck before do_install after do_strip | ||
731 | |||
732 | inherit kernel-artifact-names | ||
733 | |||
734 | kernel_do_deploy() { | ||
735 | deployDir="${DEPLOYDIR}" | ||
736 | if [ -n "${KERNEL_DEPLOYSUBDIR}" ]; then | ||
737 | deployDir="${DEPLOYDIR}/${KERNEL_DEPLOYSUBDIR}" | ||
738 | mkdir "$deployDir" | ||
739 | fi | ||
740 | |||
741 | for imageType in ${KERNEL_IMAGETYPES} ; do | ||
742 | baseName=$imageType-${KERNEL_IMAGE_NAME} | ||
743 | install -m 0644 ${KERNEL_OUTPUT_DIR}/$imageType $deployDir/$baseName.bin | ||
744 | ln -sf $baseName.bin $deployDir/$imageType-${KERNEL_IMAGE_LINK_NAME}.bin | ||
745 | ln -sf $baseName.bin $deployDir/$imageType | ||
746 | done | ||
747 | |||
748 | if [ ${MODULE_TARBALL_DEPLOY} = "1" ] && (grep -q -i -e '^CONFIG_MODULES=y$' .config); then | ||
749 | mkdir -p ${D}${root_prefix}/lib | ||
750 | if [ -n "${SOURCE_DATE_EPOCH}" ]; then | ||
751 | TAR_ARGS="--sort=name --clamp-mtime --mtime=@${SOURCE_DATE_EPOCH}" | ||
752 | else | ||
753 | TAR_ARGS="" | ||
754 | fi | ||
755 | TAR_ARGS="$TAR_ARGS --owner=0 --group=0" | ||
756 | tar $TAR_ARGS -cv -C ${D}${root_prefix} lib | gzip -9n > $deployDir/modules-${MODULE_TARBALL_NAME}.tgz | ||
757 | |||
758 | ln -sf modules-${MODULE_TARBALL_NAME}.tgz $deployDir/modules-${MODULE_TARBALL_LINK_NAME}.tgz | ||
759 | fi | ||
760 | |||
761 | if [ ! -z "${INITRAMFS_IMAGE}" -a x"${INITRAMFS_IMAGE_BUNDLE}" = x1 ]; then | ||
762 | for imageType in ${KERNEL_IMAGETYPE_FOR_MAKE} ; do | ||
763 | if [ "$imageType" = "fitImage" ] ; then | ||
764 | continue | ||
765 | fi | ||
766 | initramfsBaseName=$imageType-${INITRAMFS_NAME} | ||
767 | install -m 0644 ${KERNEL_OUTPUT_DIR}/$imageType.initramfs $deployDir/$initramfsBaseName.bin | ||
768 | ln -sf $initramfsBaseName.bin $deployDir/$imageType-${INITRAMFS_LINK_NAME}.bin | ||
769 | done | ||
770 | fi | ||
771 | } | ||
772 | |||
773 | # We deploy to filenames that include PKGV and PKGR, read the saved data to | ||
774 | # ensure we get the right values for both | ||
775 | do_deploy[prefuncs] += "read_subpackage_metadata" | ||
776 | |||
777 | addtask deploy after do_populate_sysroot do_packagedata | ||
778 | |||
779 | EXPORT_FUNCTIONS do_deploy | ||
780 | |||
781 | # Add using Device Tree support | ||
782 | inherit kernel-devicetree | ||