summaryrefslogtreecommitdiffstats
path: root/meta/classes/kernel.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/kernel.bbclass')
-rw-r--r--meta/classes/kernel.bbclass502
1 files changed, 502 insertions, 0 deletions
diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
new file mode 100644
index 0000000..19b159b
--- /dev/null
+++ b/meta/classes/kernel.bbclass
@@ -0,0 +1,502 @@
1inherit linux-kernel-base kernel-module-split
2
3PROVIDES += "virtual/kernel"
4DEPENDS += "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}gcc kmod-native depmodwrapper-cross"
5
6# we include gcc above, we dont need virtual/libc
7INHIBIT_DEFAULT_DEPS = "1"
8
9KERNEL_IMAGETYPE ?= "zImage"
10INITRAMFS_IMAGE ?= ""
11INITRAMFS_TASK ?= ""
12INITRAMFS_IMAGE_BUNDLE ?= ""
13
14python __anonymous () {
15 kerneltype = d.getVar('KERNEL_IMAGETYPE', True) or ''
16 if kerneltype == 'uImage':
17 depends = d.getVar("DEPENDS", True)
18 depends = "%s u-boot-mkimage-native" % depends
19 d.setVar("DEPENDS", depends)
20
21 image = d.getVar('INITRAMFS_IMAGE', True)
22 if image:
23 d.appendVarFlag('do_bundle_initramfs', 'depends', ' ${INITRAMFS_IMAGE}:do_rootfs')
24
25 # NOTE: setting INITRAMFS_TASK is for backward compatibility
26 # The preferred method is to set INITRAMFS_IMAGE, because
27 # this INITRAMFS_TASK has circular dependency problems
28 # if the initramfs requires kernel modules
29 image_task = d.getVar('INITRAMFS_TASK', True)
30 if image_task:
31 d.appendVarFlag('do_configure', 'depends', ' ${INITRAMFS_TASK}')
32}
33
34inherit kernel-arch deploy
35
36PACKAGES_DYNAMIC += "^kernel-module-.*"
37PACKAGES_DYNAMIC += "^kernel-image-.*"
38PACKAGES_DYNAMIC += "^kernel-firmware-.*"
39
40export OS = "${TARGET_OS}"
41export CROSS_COMPILE = "${TARGET_PREFIX}"
42
43KERNEL_PRIORITY ?= "${@int(d.getVar('PV',1).split('-')[0].split('+')[0].split('.')[0]) * 10000 + \
44 int(d.getVar('PV',1).split('-')[0].split('+')[0].split('.')[1]) * 100 + \
45 int(d.getVar('PV',1).split('-')[0].split('+')[0].split('.')[-1])}"
46
47KERNEL_RELEASE ?= "${KERNEL_VERSION}"
48
49# Where built kernel lies in the kernel tree
50KERNEL_OUTPUT ?= "arch/${ARCH}/boot/${KERNEL_IMAGETYPE}"
51KERNEL_IMAGEDEST = "boot"
52
53#
54# configuration
55#
56export CMDLINE_CONSOLE = "console=${@d.getVar("KERNEL_CONSOLE",1) or "ttyS0"}"
57
58KERNEL_VERSION = "${@get_kernelversion('${B}')}"
59
60KERNEL_LOCALVERSION ?= ""
61
62# kernels are generally machine specific
63PACKAGE_ARCH = "${MACHINE_ARCH}"
64
65# U-Boot support
66UBOOT_ENTRYPOINT ?= "20008000"
67UBOOT_LOADADDRESS ?= "${UBOOT_ENTRYPOINT}"
68
69# Some Linux kernel configurations need additional parameters on the command line
70KERNEL_EXTRA_ARGS ?= ""
71
72# For the kernel, we don't want the '-e MAKEFLAGS=' in EXTRA_OEMAKE.
73# We don't want to override kernel Makefile variables from the environment
74EXTRA_OEMAKE = ""
75
76KERNEL_ALT_IMAGETYPE ??= ""
77
78# Define where the kernel headers are installed on the target as well as where
79# they are staged.
80KERNEL_SRC_PATH = "/usr/src/kernel"
81
82KERNEL_IMAGETYPE_FOR_MAKE = "${@(lambda s: s[:-3] if s[-3:] == ".gz" else s)(d.getVar('KERNEL_IMAGETYPE', True))}"
83
84copy_initramfs() {
85 echo "Copying initramfs into ./usr ..."
86 # In case the directory is not created yet from the first pass compile:
87 mkdir -p ${B}/usr
88 # Find and use the first initramfs image archive type we find
89 rm -f ${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.cpio
90 for img in cpio.gz cpio.lz4 cpio.lzo cpio.lzma cpio.xz; do
91 if [ -e "${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.$img" ]; then
92 cp ${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.$img ${B}/usr/.
93 case $img in
94 *gz)
95 echo "gzip decompressing image"
96 gunzip -f ${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.$img
97 break
98 ;;
99 *lz4)
100 echo "lz4 decompressing image"
101 lz4 -df ${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.$img
102 break
103 ;;
104 *lzo)
105 echo "lzo decompressing image"
106 lzop -df ${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.$img
107 break
108 ;;
109 *lzma)
110 echo "lzma decompressing image"
111 lzma -df ${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.$img
112 break
113 ;;
114 *xz)
115 echo "xz decompressing image"
116 xz -df ${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.$img
117 break
118 ;;
119 esac
120 fi
121 done
122 echo "Finished copy of initramfs into ./usr"
123}
124
125INITRAMFS_BASE_NAME = "${KERNEL_IMAGETYPE}-initramfs-${PV}-${PR}-${MACHINE}-${DATETIME}"
126INITRAMFS_BASE_NAME[vardepsexclude] = "DATETIME"
127do_bundle_initramfs () {
128 if [ ! -z "${INITRAMFS_IMAGE}" -a x"${INITRAMFS_IMAGE_BUNDLE}" = x1 ]; then
129 echo "Creating a kernel image with a bundled initramfs..."
130 copy_initramfs
131 if [ -e ${KERNEL_OUTPUT} ] ; then
132 mv -f ${KERNEL_OUTPUT} ${KERNEL_OUTPUT}.bak
133 fi
134 use_alternate_initrd=CONFIG_INITRAMFS_SOURCE=${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.cpio
135 kernel_do_compile
136 mv -f ${KERNEL_OUTPUT} ${KERNEL_OUTPUT}.initramfs
137 mv -f ${KERNEL_OUTPUT}.bak ${KERNEL_OUTPUT}
138 # Update install area
139 echo "There is kernel image bundled with initramfs: ${B}/${KERNEL_OUTPUT}.initramfs"
140 install -m 0644 ${B}/${KERNEL_OUTPUT}.initramfs ${D}/boot/${KERNEL_IMAGETYPE}-initramfs-${MACHINE}.bin
141 echo "${B}/${KERNEL_OUTPUT}.initramfs"
142 fi
143}
144
145python do_devshell_prepend () {
146 os.environ["LDFLAGS"] = ''
147}
148
149addtask bundle_initramfs after do_install before do_deploy
150
151kernel_do_compile() {
152 unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
153 # The $use_alternate_initrd is only set from
154 # do_bundle_initramfs() This variable is specifically for the
155 # case where we are making a second pass at the kernel
156 # compilation and we want to force the kernel build to use a
157 # different initramfs image. The way to do that in the kernel
158 # is to specify:
159 # make ...args... CONFIG_INITRAMFS_SOURCE=some_other_initramfs.cpio
160 if [ "$use_alternate_initrd" = "" ] && [ "${INITRAMFS_TASK}" != "" ] ; then
161 # The old style way of copying an prebuilt image and building it
162 # is turned on via INTIRAMFS_TASK != ""
163 copy_initramfs
164 use_alternate_initrd=CONFIG_INITRAMFS_SOURCE=${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.cpio
165 fi
166 oe_runmake ${KERNEL_IMAGETYPE_FOR_MAKE} ${KERNEL_ALT_IMAGETYPE} CC="${KERNEL_CC}" LD="${KERNEL_LD}" ${KERNEL_EXTRA_ARGS} $use_alternate_initrd
167 if test "${KERNEL_IMAGETYPE_FOR_MAKE}.gz" = "${KERNEL_IMAGETYPE}"; then
168 gzip -9c < "${KERNEL_IMAGETYPE_FOR_MAKE}" > "${KERNEL_OUTPUT}"
169 fi
170}
171
172do_compile_kernelmodules() {
173 unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
174 if (grep -q -i -e '^CONFIG_MODULES=y$' .config); then
175 oe_runmake ${PARALLEL_MAKE} modules CC="${KERNEL_CC}" LD="${KERNEL_LD}" ${KERNEL_EXTRA_ARGS}
176 else
177 bbnote "no modules to compile"
178 fi
179}
180addtask compile_kernelmodules after do_compile before do_strip
181
182kernel_do_install() {
183 #
184 # First install the modules
185 #
186 unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
187 if (grep -q -i -e '^CONFIG_MODULES=y$' .config); then
188 oe_runmake DEPMOD=echo INSTALL_MOD_PATH="${D}" modules_install
189 rm "${D}/lib/modules/${KERNEL_VERSION}/build"
190 rm "${D}/lib/modules/${KERNEL_VERSION}/source"
191 # If the kernel/ directory is empty remove it to prevent QA issues
192 rmdir --ignore-fail-on-non-empty "${D}/lib/modules/${KERNEL_VERSION}/kernel"
193 else
194 bbnote "no modules to install"
195 fi
196
197 #
198 # Install various kernel output (zImage, map file, config, module support files)
199 #
200 install -d ${D}/${KERNEL_IMAGEDEST}
201 install -d ${D}/boot
202 install -m 0644 ${KERNEL_OUTPUT} ${D}/${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE}-${KERNEL_VERSION}
203 install -m 0644 System.map ${D}/boot/System.map-${KERNEL_VERSION}
204 install -m 0644 .config ${D}/boot/config-${KERNEL_VERSION}
205 install -m 0644 vmlinux ${D}/boot/vmlinux-${KERNEL_VERSION}
206 [ -e Module.symvers ] && install -m 0644 Module.symvers ${D}/boot/Module.symvers-${KERNEL_VERSION}
207 install -d ${D}${sysconfdir}/modules-load.d
208 install -d ${D}${sysconfdir}/modprobe.d
209
210 #
211 # Support for external module building - create a minimal copy of the
212 # kernel source tree.
213 #
214 kerneldir=${D}${KERNEL_SRC_PATH}
215 install -d $kerneldir
216
217 #
218 # Store the kernel version in sysroots for module-base.bbclass
219 #
220
221 echo "${KERNEL_VERSION}" > $kerneldir/kernel-abiversion
222
223 #
224 # Store kernel image name to allow use during image generation
225 #
226
227 echo "${KERNEL_IMAGE_BASE_NAME}" >$kerneldir/kernel-image-name
228
229 #
230 # Copy the entire source tree. In case an external build directory is
231 # used, copy the build directory over first, then copy over the source
232 # dir. This ensures the original Makefiles are used and not the
233 # redirecting Makefiles in the build directory.
234 #
235 find . -depth -not -name "*.cmd" -not -name "*.o" -not -path "./Documentation*" -not -path "./.*" -print0 | cpio --null -pdlu $kerneldir
236 cp .config $kerneldir
237 if [ "${S}" != "${B}" ]; then
238 pwd="$PWD"
239 cd "${S}"
240 find . -depth -not -path "./Documentation*" -not -path "./.*" -print0 | cpio --null -pdlu $kerneldir
241 cd "$pwd"
242 fi
243
244 # Test to ensure that the output file and image type are not actually
245 # the same file. If hardlinking is used, they will be the same, and there's
246 # no need to install.
247 ! [ ${KERNEL_OUTPUT} -ef $kerneldir/${KERNEL_IMAGETYPE} ] && install -m 0644 ${KERNEL_OUTPUT} $kerneldir/${KERNEL_IMAGETYPE}
248 install -m 0644 System.map $kerneldir/System.map-${KERNEL_VERSION}
249
250 # Dummy Makefile so the clean below works
251 mkdir $kerneldir/Documentation
252 touch $kerneldir/Documentation/Makefile
253
254 #
255 # Clean and remove files not needed for building modules.
256 # Some distributions go through a lot more trouble to strip out
257 # unecessary headers, for now, we just prune the obvious bits.
258 #
259 # We don't want to leave host-arch binaries in /sysroots, so
260 # we clean the scripts dir while leaving the generated config
261 # and include files.
262 #
263 oe_runmake -C $kerneldir CC="${KERNEL_CC}" LD="${KERNEL_LD}" clean _mrproper_scripts
264
265 # hide directories that shouldn't have their .c, s and S files deleted
266 for d in tools scripts lib; do
267 mv $kerneldir/$d $kerneldir/.$d
268 done
269
270 # delete .c, .s and .S files, unless we hid a directory as .<dir>. This technique is
271 # much faster than find -prune and -exec
272 find $kerneldir -not -path '*/\.*' -type f -name "*.[csS]" -delete
273
274 # put the hidden dirs back
275 for d in tools scripts lib; do
276 mv $kerneldir/.$d $kerneldir/$d
277 done
278
279 # As of Linux kernel version 3.0.1, the clean target removes
280 # arch/powerpc/lib/crtsavres.o which is present in
281 # KBUILD_LDFLAGS_MODULE, making it required to build external modules.
282 if [ ${ARCH} = "powerpc" ]; then
283 cp -l arch/powerpc/lib/crtsavres.o $kerneldir/arch/powerpc/lib/crtsavres.o
284 fi
285
286 # Necessary for building modules like compat-wireless.
287 if [ -f include/generated/bounds.h ]; then
288 cp -l include/generated/bounds.h $kerneldir/include/generated/bounds.h
289 fi
290 if [ -d arch/${ARCH}/include/generated ]; then
291 mkdir -p $kerneldir/arch/${ARCH}/include/generated/
292 cp -flR arch/${ARCH}/include/generated/* $kerneldir/arch/${ARCH}/include/generated/
293 fi
294
295 # Remove the following binaries which cause strip or arch QA errors
296 # during do_package for cross-compiled platforms
297 bin_files="arch/powerpc/boot/addnote arch/powerpc/boot/hack-coff \
298 arch/powerpc/boot/mktree scripts/kconfig/zconf.tab.o \
299 scripts/kconfig/conf.o scripts/kconfig/kxgettext.o"
300 for entry in $bin_files; do
301 rm -f $kerneldir/$entry
302 done
303
304 # kernels <2.6.30 don't have $kerneldir/tools directory so we check if it exists before calling sed
305 if [ -f $kerneldir/tools/perf/Makefile ]; then
306 # Fix SLANG_INC for slang.h
307 sed -i 's#-I/usr/include/slang#-I=/usr/include/slang#g' $kerneldir/tools/perf/Makefile
308 fi
309}
310do_install[prefuncs] += "package_get_auto_pr"
311
312python sysroot_stage_all () {
313 oe.path.copyhardlinktree(d.expand("${D}${KERNEL_SRC_PATH}"), d.expand("${SYSROOT_DESTDIR}${KERNEL_SRC_PATH}"))
314}
315
316KERNEL_CONFIG_COMMAND ?= "oe_runmake_call oldnoconfig || yes '' | oe_runmake oldconfig"
317
318kernel_do_configure() {
319 # fixes extra + in /lib/modules/2.6.37+
320 # $ scripts/setlocalversion . => +
321 # $ make kernelversion => 2.6.37
322 # $ make kernelrelease => 2.6.37+
323 touch ${B}/.scmversion ${S}/.scmversion
324
325 # Copy defconfig to .config if .config does not exist. This allows
326 # recipes to manage the .config themselves in do_configure_prepend().
327 if [ -f "${WORKDIR}/defconfig" ] && [ ! -f "${B}/.config" ]; then
328 cp "${WORKDIR}/defconfig" "${B}/.config"
329 fi
330 eval ${KERNEL_CONFIG_COMMAND}
331}
332
333do_savedefconfig() {
334 oe_runmake savedefconfig
335}
336do_savedefconfig[nostamp] = "1"
337addtask savedefconfig after do_configure
338
339inherit cml1
340
341EXPORT_FUNCTIONS do_compile do_install do_configure
342
343# kernel-base becomes kernel-${KERNEL_VERSION}
344# kernel-image becomes kernel-image-${KERNEL_VERISON}
345PACKAGES = "kernel kernel-base kernel-vmlinux kernel-image kernel-dev kernel-modules"
346FILES_${PN} = ""
347FILES_kernel-base = "/lib/modules/${KERNEL_VERSION}/modules.order /lib/modules/${KERNEL_VERSION}/modules.builtin"
348FILES_kernel-image = "/boot/${KERNEL_IMAGETYPE}*"
349FILES_kernel-dev = "/boot/System.map* /boot/Module.symvers* /boot/config* ${KERNEL_SRC_PATH}"
350FILES_kernel-vmlinux = "/boot/vmlinux*"
351FILES_kernel-modules = ""
352RDEPENDS_kernel = "kernel-base"
353# Allow machines to override this dependency if kernel image files are
354# not wanted in images as standard
355RDEPENDS_kernel-base ?= "kernel-image"
356PKG_kernel-image = "kernel-image-${@legitimize_package_name('${KERNEL_VERSION}')}"
357PKG_kernel-base = "kernel-${@legitimize_package_name('${KERNEL_VERSION}')}"
358RPROVIDES_kernel-base += "kernel-${KERNEL_VERSION}"
359ALLOW_EMPTY_kernel = "1"
360ALLOW_EMPTY_kernel-base = "1"
361ALLOW_EMPTY_kernel-image = "1"
362ALLOW_EMPTY_kernel-modules = "1"
363DESCRIPTION_kernel-modules = "Kernel modules meta package"
364
365pkg_postinst_kernel-base () {
366 if [ ! -e "$D/lib/modules/${KERNEL_VERSION}" ]; then
367 mkdir -p $D/lib/modules/${KERNEL_VERSION}
368 fi
369 if [ -n "$D" ]; then
370 depmodwrapper -a -b $D ${KERNEL_VERSION}
371 else
372 depmod -a ${KERNEL_VERSION}
373 fi
374}
375
376pkg_postinst_kernel-image () {
377 update-alternatives --install /${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE} ${KERNEL_IMAGETYPE} ${KERNEL_IMAGETYPE}-${KERNEL_VERSION} ${KERNEL_PRIORITY} || true
378}
379
380pkg_postrm_kernel-image () {
381 update-alternatives --remove ${KERNEL_IMAGETYPE} ${KERNEL_IMAGETYPE}-${KERNEL_VERSION} || true
382}
383
384PACKAGESPLITFUNCS_prepend = "split_kernel_packages "
385
386python split_kernel_packages () {
387 do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.bin$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='')
388 do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.fw$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='')
389 do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.cis$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='')
390}
391
392do_strip() {
393 if [ -n "${KERNEL_IMAGE_STRIP_EXTRA_SECTIONS}" ]; then
394 if [[ "${KERNEL_IMAGETYPE}" != "vmlinux" ]]; then
395 bbwarn "image type will not be stripped (not supported): ${KERNEL_IMAGETYPE}"
396 return
397 fi
398
399 cd ${B}
400 headers=`"$CROSS_COMPILE"readelf -S ${KERNEL_OUTPUT} | \
401 grep "^ \{1,\}\[[0-9 ]\{1,\}\] [^ ]" | \
402 sed "s/^ \{1,\}\[[0-9 ]\{1,\}\] //" | \
403 gawk '{print $1}'`
404
405 for str in ${KERNEL_IMAGE_STRIP_EXTRA_SECTIONS}; do {
406 if [[ "$headers" != *"$str"* ]]; then
407 bbwarn "Section not found: $str";
408 fi
409
410 "$CROSS_COMPILE"strip -s -R $str ${KERNEL_OUTPUT}
411 }; done
412
413 bbnote "KERNEL_IMAGE_STRIP_EXTRA_SECTIONS is set, stripping sections:" \
414 "${KERNEL_IMAGE_STRIP_EXTRA_SECTIONS}"
415 fi;
416}
417do_strip[dirs] = "${B}"
418
419addtask do_strip before do_sizecheck after do_kernel_link_vmlinux
420
421# Support checking the kernel size since some kernels need to reside in partitions
422# with a fixed length or there is a limit in transferring the kernel to memory
423do_sizecheck() {
424 if [ ! -z "${KERNEL_IMAGE_MAXSIZE}" ]; then
425 cd ${B}
426 size=`ls -lL ${KERNEL_OUTPUT} | awk '{ print $5}'`
427 if [ $size -ge ${KERNEL_IMAGE_MAXSIZE} ]; then
428 die "This kernel (size=$size > ${KERNEL_IMAGE_MAXSIZE}) is too big for your device. Please reduce the size of the kernel by making more of it modular."
429 fi
430 fi
431}
432do_sizecheck[dirs] = "${B}"
433
434addtask sizecheck before do_install after do_strip
435
436KERNEL_IMAGE_BASE_NAME ?= "${KERNEL_IMAGETYPE}-${PKGE}-${PKGV}-${PKGR}-${MACHINE}-${DATETIME}"
437# Don't include the DATETIME variable in the sstate package signatures
438KERNEL_IMAGE_BASE_NAME[vardepsexclude] = "DATETIME"
439KERNEL_IMAGE_SYMLINK_NAME ?= "${KERNEL_IMAGETYPE}-${MACHINE}"
440MODULE_IMAGE_BASE_NAME ?= "modules-${PKGE}-${PKGV}-${PKGR}-${MACHINE}-${DATETIME}"
441MODULE_IMAGE_BASE_NAME[vardepsexclude] = "DATETIME"
442MODULE_TARBALL_BASE_NAME ?= "${MODULE_IMAGE_BASE_NAME}.tgz"
443# Don't include the DATETIME variable in the sstate package signatures
444MODULE_TARBALL_SYMLINK_NAME ?= "modules-${MACHINE}.tgz"
445MODULE_TARBALL_DEPLOY ?= "1"
446
447do_uboot_mkimage() {
448 if test "x${KERNEL_IMAGETYPE}" = "xuImage" ; then
449 if test "x${KEEPUIMAGE}" != "xyes" ; then
450 ENTRYPOINT=${UBOOT_ENTRYPOINT}
451 if test -n "${UBOOT_ENTRYSYMBOL}"; then
452 ENTRYPOINT=`${HOST_PREFIX}nm ${S}/vmlinux | \
453 awk '$3=="${UBOOT_ENTRYSYMBOL}" {print $1}'`
454 fi
455 if test -e arch/${ARCH}/boot/compressed/vmlinux ; then
456 ${OBJCOPY} -O binary -R .note -R .comment -S arch/${ARCH}/boot/compressed/vmlinux linux.bin
457 uboot-mkimage -A ${UBOOT_ARCH} -O linux -T kernel -C none -a ${UBOOT_LOADADDRESS} -e $ENTRYPOINT -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin arch/${ARCH}/boot/uImage
458 rm -f linux.bin
459 else
460 ${OBJCOPY} -O binary -R .note -R .comment -S vmlinux linux.bin
461 rm -f linux.bin.gz
462 gzip -9 linux.bin
463 uboot-mkimage -A ${UBOOT_ARCH} -O linux -T kernel -C gzip -a ${UBOOT_LOADADDRESS} -e $ENTRYPOINT -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin.gz arch/${ARCH}/boot/uImage
464 rm -f linux.bin.gz
465 fi
466 fi
467 fi
468}
469
470addtask uboot_mkimage before do_install after do_compile
471
472kernel_do_deploy() {
473 install -m 0644 ${KERNEL_OUTPUT} ${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}.bin
474 if [ ${MODULE_TARBALL_DEPLOY} = "1" ] && (grep -q -i -e '^CONFIG_MODULES=y$' .config); then
475 mkdir -p ${D}/lib
476 tar -cvzf ${DEPLOYDIR}/${MODULE_TARBALL_BASE_NAME} -C ${D} lib
477 ln -sf ${MODULE_TARBALL_BASE_NAME} ${DEPLOYDIR}/${MODULE_TARBALL_SYMLINK_NAME}
478 fi
479
480 ln -sf ${KERNEL_IMAGE_BASE_NAME}.bin ${DEPLOYDIR}/${KERNEL_IMAGE_SYMLINK_NAME}.bin
481 ln -sf ${KERNEL_IMAGE_BASE_NAME}.bin ${DEPLOYDIR}/${KERNEL_IMAGETYPE}
482
483 cp ${COREBASE}/meta/files/deploydir_readme.txt ${DEPLOYDIR}/README_-_DO_NOT_DELETE_FILES_IN_THIS_DIRECTORY.txt
484
485 cd ${B}
486 # Update deploy directory
487 if [ -e "${KERNEL_OUTPUT}.initramfs" ]; then
488 echo "Copying deploy kernel-initramfs image and setting up links..."
489 initramfs_base_name=${INITRAMFS_BASE_NAME}
490 initramfs_symlink_name=${KERNEL_IMAGETYPE}-initramfs-${MACHINE}
491 install -m 0644 ${KERNEL_OUTPUT}.initramfs ${DEPLOYDIR}/${initramfs_base_name}.bin
492 cd ${DEPLOYDIR}
493 ln -sf ${initramfs_base_name}.bin ${initramfs_symlink_name}.bin
494 fi
495}
496do_deploy[dirs] = "${DEPLOYDIR} ${B}"
497do_deploy[prefuncs] += "package_get_auto_pr"
498
499addtask deploy before do_build after do_install
500
501EXPORT_FUNCTIONS do_deploy
502