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.bbclass505
1 files changed, 505 insertions, 0 deletions
diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
new file mode 100644
index 0000000000..2a6ec34c36
--- /dev/null
+++ b/meta/classes/kernel.bbclass
@@ -0,0 +1,505 @@
1inherit linux-kernel-base kernel-module-split
2
3PROVIDES += "virtual/kernel"
4DEPENDS += "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}gcc kmod-native depmodwrapper-cross bc-native"
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)
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 mkdir -p ${D}/lib/modules/${KERNEL_VERSION}
217 ln -sf ${KERNEL_SRC_PATH} "${D}/lib/modules/${KERNEL_VERSION}/build"
218
219 #
220 # Store the kernel version in sysroots for module-base.bbclass
221 #
222
223 echo "${KERNEL_VERSION}" > $kerneldir/kernel-abiversion
224
225 #
226 # Store kernel image name to allow use during image generation
227 #
228
229 echo "${KERNEL_IMAGE_BASE_NAME}" >$kerneldir/kernel-image-name
230
231 #
232 # Copy the entire source tree. In case an external build directory is
233 # used, copy the build directory over first, then copy over the source
234 # dir. This ensures the original Makefiles are used and not the
235 # redirecting Makefiles in the build directory.
236 #
237 find . -depth -not -name "*.cmd" -not -name "*.o" -not -name "*.so.dbg" -not -name "*.so" -not -path "./Documentation*" -not -path "./source*" -not -path "./.*" -print0 | cpio --null -pdlu $kerneldir
238 cp .config $kerneldir
239 if [ "${S}" != "${B}" ]; then
240 pwd="$PWD"
241 cd "${S}"
242 find . -depth -not -path "./Documentation*" -not -path "./.*" -print0 | cpio --null -pdlu $kerneldir
243 cd "$pwd"
244 fi
245
246 # Test to ensure that the output file and image type are not actually
247 # the same file. If hardlinking is used, they will be the same, and there's
248 # no need to install.
249 ! [ ${KERNEL_OUTPUT} -ef $kerneldir/${KERNEL_IMAGETYPE} ] && install -m 0644 ${KERNEL_OUTPUT} $kerneldir/${KERNEL_IMAGETYPE}
250 install -m 0644 System.map $kerneldir/System.map-${KERNEL_VERSION}
251
252 # Dummy Makefile so the clean below works
253 mkdir $kerneldir/Documentation
254 touch $kerneldir/Documentation/Makefile
255
256 #
257 # Clean and remove files not needed for building modules.
258 # Some distributions go through a lot more trouble to strip out
259 # unecessary headers, for now, we just prune the obvious bits.
260 #
261 # We don't want to leave host-arch binaries in /sysroots, so
262 # we clean the scripts dir while leaving the generated config
263 # and include files.
264 #
265 oe_runmake -C $kerneldir CC="${KERNEL_CC}" LD="${KERNEL_LD}" clean _mrproper_scripts
266
267 # hide directories that shouldn't have their .c, s and S files deleted
268 for d in tools scripts lib; do
269 mv $kerneldir/$d $kerneldir/.$d
270 done
271
272 # delete .c, .s and .S files, unless we hid a directory as .<dir>. This technique is
273 # much faster than find -prune and -exec
274 find $kerneldir -not -path '*/\.*' -type f -name "*.[csS]" -delete
275
276 # put the hidden dirs back
277 for d in tools scripts lib; do
278 mv $kerneldir/.$d $kerneldir/$d
279 done
280
281 # As of Linux kernel version 3.0.1, the clean target removes
282 # arch/powerpc/lib/crtsavres.o which is present in
283 # KBUILD_LDFLAGS_MODULE, making it required to build external modules.
284 if [ ${ARCH} = "powerpc" ]; then
285 cp -l arch/powerpc/lib/crtsavres.o $kerneldir/arch/powerpc/lib/crtsavres.o
286 fi
287
288 # Necessary for building modules like compat-wireless.
289 if [ -f include/generated/bounds.h ]; then
290 cp -l include/generated/bounds.h $kerneldir/include/generated/bounds.h
291 fi
292 if [ -d arch/${ARCH}/include/generated ]; then
293 mkdir -p $kerneldir/arch/${ARCH}/include/generated/
294 cp -flR arch/${ARCH}/include/generated/* $kerneldir/arch/${ARCH}/include/generated/
295 fi
296
297 # Remove the following binaries which cause strip or arch QA errors
298 # during do_package for cross-compiled platforms
299 bin_files="arch/powerpc/boot/addnote arch/powerpc/boot/hack-coff \
300 arch/powerpc/boot/mktree scripts/kconfig/zconf.tab.o \
301 scripts/kconfig/conf.o scripts/kconfig/kxgettext.o"
302 for entry in $bin_files; do
303 rm -f $kerneldir/$entry
304 done
305
306 # kernels <2.6.30 don't have $kerneldir/tools directory so we check if it exists before calling sed
307 if [ -f $kerneldir/tools/perf/Makefile ]; then
308 # Fix SLANG_INC for slang.h
309 sed -i 's#-I/usr/include/slang#-I=/usr/include/slang#g' $kerneldir/tools/perf/Makefile
310 fi
311}
312do_install[prefuncs] += "package_get_auto_pr"
313
314python sysroot_stage_all () {
315 oe.path.copyhardlinktree(d.expand("${D}${KERNEL_SRC_PATH}"), d.expand("${SYSROOT_DESTDIR}${KERNEL_SRC_PATH}"))
316}
317
318KERNEL_CONFIG_COMMAND ?= "oe_runmake_call oldnoconfig || yes '' | oe_runmake oldconfig"
319
320kernel_do_configure() {
321 # fixes extra + in /lib/modules/2.6.37+
322 # $ scripts/setlocalversion . => +
323 # $ make kernelversion => 2.6.37
324 # $ make kernelrelease => 2.6.37+
325 touch ${B}/.scmversion ${S}/.scmversion
326
327 # Copy defconfig to .config if .config does not exist. This allows
328 # recipes to manage the .config themselves in do_configure_prepend().
329 if [ -f "${WORKDIR}/defconfig" ] && [ ! -f "${B}/.config" ]; then
330 cp "${WORKDIR}/defconfig" "${B}/.config"
331 fi
332 eval ${KERNEL_CONFIG_COMMAND}
333}
334
335do_savedefconfig() {
336 oe_runmake savedefconfig
337}
338do_savedefconfig[nostamp] = "1"
339addtask savedefconfig after do_configure
340
341inherit cml1
342
343EXPORT_FUNCTIONS do_compile do_install do_configure
344
345# kernel-base becomes kernel-${KERNEL_VERSION}
346# kernel-image becomes kernel-image-${KERNEL_VERISON}
347PACKAGES = "kernel kernel-base kernel-vmlinux kernel-image kernel-dev kernel-modules"
348FILES_${PN} = ""
349FILES_kernel-base = "/lib/modules/${KERNEL_VERSION}/modules.order /lib/modules/${KERNEL_VERSION}/modules.builtin"
350FILES_kernel-image = "/boot/${KERNEL_IMAGETYPE}*"
351FILES_kernel-dev = "/boot/System.map* /boot/Module.symvers* /boot/config* ${KERNEL_SRC_PATH} /lib/modules/${KERNEL_VERSION}/build"
352FILES_kernel-vmlinux = "/boot/vmlinux*"
353FILES_kernel-modules = ""
354RDEPENDS_kernel = "kernel-base"
355# Allow machines to override this dependency if kernel image files are
356# not wanted in images as standard
357RDEPENDS_kernel-base ?= "kernel-image"
358PKG_kernel-image = "kernel-image-${@legitimize_package_name('${KERNEL_VERSION}')}"
359PKG_kernel-base = "kernel-${@legitimize_package_name('${KERNEL_VERSION}')}"
360RPROVIDES_kernel-base += "kernel-${KERNEL_VERSION}"
361ALLOW_EMPTY_kernel = "1"
362ALLOW_EMPTY_kernel-base = "1"
363ALLOW_EMPTY_kernel-image = "1"
364ALLOW_EMPTY_kernel-modules = "1"
365DESCRIPTION_kernel-modules = "Kernel modules meta package"
366
367pkg_postinst_kernel-base () {
368 if [ ! -e "$D/lib/modules/${KERNEL_VERSION}" ]; then
369 mkdir -p $D/lib/modules/${KERNEL_VERSION}
370 fi
371 if [ -n "$D" ]; then
372 depmodwrapper -a -b $D ${KERNEL_VERSION}
373 else
374 depmod -a ${KERNEL_VERSION}
375 fi
376}
377
378pkg_postinst_kernel-image () {
379 update-alternatives --install /${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE} ${KERNEL_IMAGETYPE} /${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE}-${KERNEL_VERSION} ${KERNEL_PRIORITY} || true
380}
381
382pkg_postrm_kernel-image () {
383 update-alternatives --remove ${KERNEL_IMAGETYPE} ${KERNEL_IMAGETYPE}-${KERNEL_VERSION} || true
384}
385
386PACKAGESPLITFUNCS_prepend = "split_kernel_packages "
387
388python split_kernel_packages () {
389 do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.(bin|fw|cis|dsp)$', 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 invalid=`echo ${KERNEL_IMAGE_MAXSIZE} | sed 's/[0-9]//g'`
426 if [ -n "$invalid" ]; then
427 die "Invalid KERNEL_IMAGE_MAXSIZE: ${KERNEL_IMAGE_MAXSIZE}, should be an integerx (The unit is Kbytes)"
428 fi
429 size=`du -ks ${B}/${KERNEL_OUTPUT} | awk '{ print $1}'`
430 if [ $size -ge ${KERNEL_IMAGE_MAXSIZE} ]; then
431 die "This kernel (size=$size(K) > ${KERNEL_IMAGE_MAXSIZE}(K)) is too big for your device. Please reduce the size of the kernel by making more of it modular."
432 fi
433 fi
434}
435do_sizecheck[dirs] = "${B}"
436
437addtask sizecheck before do_install after do_strip
438
439KERNEL_IMAGE_BASE_NAME ?= "${KERNEL_IMAGETYPE}-${PKGE}-${PKGV}-${PKGR}-${MACHINE}-${DATETIME}"
440# Don't include the DATETIME variable in the sstate package signatures
441KERNEL_IMAGE_BASE_NAME[vardepsexclude] = "DATETIME"
442KERNEL_IMAGE_SYMLINK_NAME ?= "${KERNEL_IMAGETYPE}-${MACHINE}"
443MODULE_IMAGE_BASE_NAME ?= "modules-${PKGE}-${PKGV}-${PKGR}-${MACHINE}-${DATETIME}"
444MODULE_IMAGE_BASE_NAME[vardepsexclude] = "DATETIME"
445MODULE_TARBALL_BASE_NAME ?= "${MODULE_IMAGE_BASE_NAME}.tgz"
446# Don't include the DATETIME variable in the sstate package signatures
447MODULE_TARBALL_SYMLINK_NAME ?= "modules-${MACHINE}.tgz"
448MODULE_TARBALL_DEPLOY ?= "1"
449
450do_uboot_mkimage() {
451 if test "x${KERNEL_IMAGETYPE}" = "xuImage" ; then
452 if test "x${KEEPUIMAGE}" != "xyes" ; then
453 ENTRYPOINT=${UBOOT_ENTRYPOINT}
454 if test -n "${UBOOT_ENTRYSYMBOL}"; then
455 ENTRYPOINT=`${HOST_PREFIX}nm ${S}/vmlinux | \
456 awk '$3=="${UBOOT_ENTRYSYMBOL}" {print $1}'`
457 fi
458 if test -e arch/${ARCH}/boot/compressed/vmlinux ; then
459 ${OBJCOPY} -O binary -R .note -R .comment -S arch/${ARCH}/boot/compressed/vmlinux linux.bin
460 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
461 rm -f linux.bin
462 else
463 ${OBJCOPY} -O binary -R .note -R .comment -S vmlinux linux.bin
464 rm -f linux.bin.gz
465 gzip -9 linux.bin
466 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
467 rm -f linux.bin.gz
468 fi
469 fi
470 fi
471}
472
473addtask uboot_mkimage before do_install after do_compile
474
475kernel_do_deploy() {
476 install -m 0644 ${KERNEL_OUTPUT} ${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}.bin
477 if [ ${MODULE_TARBALL_DEPLOY} = "1" ] && (grep -q -i -e '^CONFIG_MODULES=y$' .config); then
478 mkdir -p ${D}/lib
479 tar -cvzf ${DEPLOYDIR}/${MODULE_TARBALL_BASE_NAME} -C ${D} lib
480 ln -sf ${MODULE_TARBALL_BASE_NAME} ${DEPLOYDIR}/${MODULE_TARBALL_SYMLINK_NAME}
481 fi
482
483 ln -sf ${KERNEL_IMAGE_BASE_NAME}.bin ${DEPLOYDIR}/${KERNEL_IMAGE_SYMLINK_NAME}.bin
484 ln -sf ${KERNEL_IMAGE_BASE_NAME}.bin ${DEPLOYDIR}/${KERNEL_IMAGETYPE}
485
486 cp ${COREBASE}/meta/files/deploydir_readme.txt ${DEPLOYDIR}/README_-_DO_NOT_DELETE_FILES_IN_THIS_DIRECTORY.txt
487
488 cd ${B}
489 # Update deploy directory
490 if [ -e "${KERNEL_OUTPUT}.initramfs" ]; then
491 echo "Copying deploy kernel-initramfs image and setting up links..."
492 initramfs_base_name=${INITRAMFS_BASE_NAME}
493 initramfs_symlink_name=${KERNEL_IMAGETYPE}-initramfs-${MACHINE}
494 install -m 0644 ${KERNEL_OUTPUT}.initramfs ${DEPLOYDIR}/${initramfs_base_name}.bin
495 cd ${DEPLOYDIR}
496 ln -sf ${initramfs_base_name}.bin ${initramfs_symlink_name}.bin
497 fi
498}
499do_deploy[dirs] = "${DEPLOYDIR} ${B}"
500do_deploy[prefuncs] += "package_get_auto_pr"
501
502addtask deploy before do_build after do_install
503
504EXPORT_FUNCTIONS do_deploy
505