2013-12-12 16:07:04 +00:00
inherit linux-kernel-base kernel-module-split
2005-08-31 10:45:47 +00:00
PROVIDES += "virtual/kernel"
2016-08-01 12:32:53 +00:00
DEPENDS += "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}gcc kmod-native depmodwrapper-cross bc-native lzop-native"
2008-04-08 15:31:57 +00:00
2014-12-19 17:46:27 +00:00
S = "${STAGING_KERNEL_DIR}"
B = "${WORKDIR}/build"
KBUILD_OUTPUT = "${B}"
OE_TERMINAL_EXPORTS += "KBUILD_OUTPUT"
2014-12-18 11:41:58 +00:00
2008-04-08 15:31:57 +00:00
# we include gcc above, we dont need virtual/libc
INHIBIT_DEFAULT_DEPS = "1"
2005-08-31 10:45:47 +00:00
2008-03-25 15:48:26 +00:00
KERNEL_IMAGETYPE ?= "zImage"
2011-07-11 22:33:11 +00:00
INITRAMFS_IMAGE ?= ""
INITRAMFS_TASK ?= ""
2013-08-22 23:04:27 +00:00
INITRAMFS_IMAGE_BUNDLE ?= ""
2008-03-25 15:48:26 +00:00
2016-05-25 08:47:16 +00:00
# KERNEL_VERSION is extracted from source code. It is evaluated as
# None for the first parsing, since the code has not been fetched.
# After the code is fetched, it will be evaluated as real version
# number and cause kernel to be rebuilt. To avoid this, make
# KERNEL_VERSION_NAME and KERNEL_VERSION_PKG_NAME depend on
# LINUX_VERSION which is a constant.
KERNEL_VERSION_NAME = "${@d.getVar('KERNEL_VERSION', True) or ""}"
KERNEL_VERSION_NAME[vardepvalue] = "${LINUX_VERSION}"
KERNEL_VERSION_PKG_NAME = "${@legitimize_package_name(d.getVar('KERNEL_VERSION', True))}"
KERNEL_VERSION_PKG_NAME[vardepvalue] = "${LINUX_VERSION}"
2008-03-25 15:48:26 +00:00
python __anonymous () {
2015-05-14 12:31:06 +00:00
import re
2016-05-25 08:47:16 +00:00
# Merge KERNEL_IMAGETYPE and KERNEL_ALT_IMAGETYPE into KERNEL_IMAGETYPES
type = d.getVar('KERNEL_IMAGETYPE', True) or ""
alttype = d.getVar('KERNEL_ALT_IMAGETYPE', True) or ""
types = d.getVar('KERNEL_IMAGETYPES', True) or ""
if type not in types.split():
types = (type + ' ' + types).strip()
if alttype not in types.split():
types = (alttype + ' ' + types).strip()
d.setVar('KERNEL_IMAGETYPES', types)
typeformake = re.sub(r'\.gz', '', types)
d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', typeformake)
for type in typeformake.split():
typelower = type.lower()
d.appendVar('PACKAGES', ' ' + 'kernel-image-' + typelower)
d.setVar('FILES_kernel-image-' + typelower, '/boot/' + type + '*')
d.appendVar('RDEPENDS_kernel-image', ' ' + 'kernel-image-' + typelower)
d.setVar('PKG_kernel-image-' + typelower, 'kernel-image-' + typelower + '-${KERNEL_VERSION_PKG_NAME}')
2011-07-11 22:33:11 +00:00
2016-05-25 08:47:16 +00:00
d.setVar('ALLOW_EMPTY_kernel-image-' + typelower, '1')
imagedest = d.getVar('KERNEL_IMAGEDEST', True)
priority = d.getVar('KERNEL_PRIORITY', True)
postinst = '#!/bin/sh\n' + 'update-alternatives --install /' + imagedest + '/' + type + ' ' + type + ' ' + '/' + imagedest + '/' + type + '-${KERNEL_VERSION_NAME} ' + priority + ' || true' + '\n'
d.setVar('pkg_postinst_kernel-image-' + typelower, postinst)
postrm = '#!/bin/sh\n' + 'update-alternatives --remove' + ' ' + type + ' ' + type + '-${KERNEL_VERSION_NAME} || true' + '\n'
d.setVar('pkg_postrm_kernel-image-' + typelower, postrm)
2015-05-14 12:31:06 +00:00
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata:
sed \
-e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \
-e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-i `grep -ril bb.data *`
(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-09 15:00:01 +00:00
image = d.getVar('INITRAMFS_IMAGE', True)
2011-07-11 22:33:11 +00:00
if image:
2016-01-06 22:57:49 +00:00
d.appendVarFlag('do_bundle_initramfs', 'depends', ' ${INITRAMFS_IMAGE}:do_image_complete')
2013-08-22 23:04:27 +00:00
# NOTE: setting INITRAMFS_TASK is for backward compatibility
# The preferred method is to set INITRAMFS_IMAGE, because
# this INITRAMFS_TASK has circular dependency problems
# if the initramfs requires kernel modules
image_task = d.getVar('INITRAMFS_TASK', True)
if image_task:
d.appendVarFlag('do_configure', 'depends', ' ${INITRAMFS_TASK}')
2008-03-25 15:48:26 +00:00
}
2015-05-14 12:31:09 +00:00
# Here we pull in all various kernel image types which we support.
#
# In case you're wondering why kernel.bbclass inherits the other image
# types instead of the other way around, the reason for that is to
# maintain compatibility with various currently existing meta-layers.
# By pulling in the various kernel image types here, we retain the
# original behavior of kernel.bbclass, so no meta-layers should get
# broken.
#
# KERNEL_CLASSES by default pulls in kernel-uimage.bbclass, since this
# used to be the default behavior when only uImage was supported. This
# variable can be appended by users who implement support for new kernel
# image types.
KERNEL_CLASSES ?= " kernel-uimage "
inherit ${KERNEL_CLASSES}
2014-12-19 17:46:27 +00:00
# Old style kernels may set ${S} = ${WORKDIR}/git for example
# We need to move these over to STAGING_KERNEL_DIR. We can't just
# create the symlink in advance as the git fetcher can't cope with
# the symlink.
2015-01-15 11:54:19 +00:00
do_unpack[cleandirs] += " ${S} ${STAGING_KERNEL_DIR} ${B} ${STAGING_KERNEL_BUILDDIR}"
do_clean[cleandirs] += " ${S} ${STAGING_KERNEL_DIR} ${B} ${STAGING_KERNEL_BUILDDIR}"
2014-12-19 17:46:27 +00:00
base_do_unpack_append () {
s = d.getVar("S", True)
kernel.bbclass: fix do_unpack function when S ends with slash
* slash at the end causes os.symlink(kernsrc, s) to use s as
directory name and fails with:
ERROR: Error executing a python function in /OE/build/owpb/webos-ports/meta-smartphone/meta-samsung/recipes-kernel/linux/linux-samsung-tuna_git.bb:
The stack trace of python calls that resulted in this exception/failure was:
File: 'base_do_unpack', lineno: 26, function: <module>
0022: subprocess.call(d.expand("mv /OE/build/owpb/webos-ports/tmp-glibc/work/maguro-webos-linux-gnueabi/linux-samsung-tuna/3_3.0.72+gitrAUTOINC+f8ed73f94a-r12/git/ /OE/build/owpb/webos-ports/tmp-glibc/sysroots/maguro/usr/src/kernel"), shell=True)
0023: os.symlink(kernsrc, s)
0024:
0025:
*** 0026:base_do_unpack(d)
0027:
File: 'base_do_unpack', lineno: 23, function: base_do_unpack
0019: bb.utils.mkdirhier(kernsrc)
0020: bb.utils.remove(kernsrc, recurse=True)
0021: import subprocess
0022: subprocess.call(d.expand("mv /OE/build/owpb/webos-ports/tmp-glibc/work/maguro-webos-linux-gnueabi/linux-samsung-tuna/3_3.0.72+gitrAUTOINC+f8ed73f94a-r12/git/ /OE/build/owpb/webos-ports/tmp-glibc/sysroots/maguro/usr/src/kernel"), shell=True)
*** 0023: os.symlink(kernsrc, s)
0024:
0025:
0026:base_do_unpack(d)
0027:
Exception: OSError: [Errno 2] No such file or directory
ERROR: Function failed: base_do_unpack
ERROR: Logfile of failure stored in: /OE/build/owpb/webos-ports/tmp-glibc/work/maguro-webos-linux-gnueabi/linux-samsung-tuna/3_3.0.72+gitrAUTOINC+f8ed73f94a-r12/temp/log.do_unpack.17042
ERROR: Task 0 (/OE/build/owpb/webos-ports/meta-smartphone/meta-samsung/recipes-kernel/linux/linux-samsung-tuna_git.bb, do_unpack) failed with exit code '1'
(From OE-Core rev: dba30c2395792b553b69ce0b44cc75ff2dbdb317)
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-01-07 14:06:49 +00:00
if s[-1] == '/':
# drop trailing slash, so that os.symlink(kernsrc, s) doesn't use s as directory name and fail
s=s[:-1]
2014-12-19 17:46:27 +00:00
kernsrc = d.getVar("STAGING_KERNEL_DIR", True)
if s != kernsrc:
bb.utils.mkdirhier(kernsrc)
bb.utils.remove(kernsrc, recurse=True)
2015-09-08 10:58:14 +00:00
if d.getVar("EXTERNALSRC", True):
# With EXTERNALSRC S will not be wiped so we can symlink to it
os.symlink(s, kernsrc)
else:
import shutil
shutil.move(s, kernsrc)
os.symlink(kernsrc, s)
2014-12-19 17:46:27 +00:00
}
2010-08-05 13:25:20 +00:00
inherit kernel-arch deploy
2005-08-31 10:45:47 +00:00
2012-10-12 10:46:38 +00:00
PACKAGES_DYNAMIC += "^kernel-module-.*"
PACKAGES_DYNAMIC += "^kernel-image-.*"
PACKAGES_DYNAMIC += "^kernel-firmware-.*"
2006-02-10 11:38:23 +00:00
2005-08-31 10:45:47 +00:00
export OS = "${TARGET_OS}"
export CROSS_COMPILE = "${TARGET_PREFIX}"
2012-03-23 12:56:28 +00:00
KERNEL_PRIORITY ?= "${@int(d.getVar('PV',1).split('-')[0].split('+')[0].split('.')[0]) * 10000 + \
int(d.getVar('PV',1).split('-')[0].split('+')[0].split('.')[1]) * 100 + \
int(d.getVar('PV',1).split('-')[0].split('+')[0].split('.')[-1])}"
2005-08-31 10:45:47 +00:00
2007-01-08 21:05:18 +00:00
KERNEL_RELEASE ?= "${KERNEL_VERSION}"
2005-12-12 14:41:23 +00:00
2016-05-25 08:47:16 +00:00
# The directory where built kernel lies in the kernel tree
KERNEL_OUTPUT_DIR ?= "arch/${ARCH}/boot"
2005-08-31 10:45:47 +00:00
KERNEL_IMAGEDEST = "boot"
#
# configuration
#
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata:
sed \
-e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \
-e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-i `grep -ril bb.data *`
(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-09 15:00:01 +00:00
export CMDLINE_CONSOLE = "console=${@d.getVar("KERNEL_CONSOLE",1) or "ttyS0"}"
2005-08-31 10:45:47 +00:00
2014-10-21 21:05:30 +00:00
KERNEL_VERSION = "${@get_kernelversion_headers('${B}')}"
2005-08-31 10:45:47 +00:00
KERNEL_LOCALVERSION ?= ""
# kernels are generally machine specific
PACKAGE_ARCH = "${MACHINE_ARCH}"
2008-02-06 15:27:26 +00:00
# U-Boot support
UBOOT_ENTRYPOINT ?= "20008000"
2008-06-05 10:49:22 +00:00
UBOOT_LOADADDRESS ?= "${UBOOT_ENTRYPOINT}"
2008-02-06 15:27:26 +00:00
2013-08-05 17:08:25 +00:00
# Some Linux kernel configurations need additional parameters on the command line
2012-05-03 13:48:48 +00:00
KERNEL_EXTRA_ARGS ?= ""
2010-06-24 19:00:48 +00:00
KERNEL_ALT_IMAGETYPE ??= ""
2013-08-22 23:04:27 +00:00
copy_initramfs() {
echo "Copying initramfs into ./usr ..."
2013-09-27 21:32:00 +00:00
# In case the directory is not created yet from the first pass compile:
mkdir -p ${B}/usr
2013-08-22 23:04:27 +00:00
# Find and use the first initramfs image archive type we find
rm -f ${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.cpio
2014-01-14 11:00:48 +00:00
for img in cpio.gz cpio.lz4 cpio.lzo cpio.lzma cpio.xz; do
2013-08-22 23:04:27 +00:00
if [ -e "${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.$img" ]; then
cp ${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.$img ${B}/usr/.
case $img in
*gz)
echo "gzip decompressing image"
gunzip -f ${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.$img
break
;;
2014-01-14 11:00:48 +00:00
*lz4)
echo "lz4 decompressing image"
lz4 -df ${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.$img
break
;;
2013-08-22 23:04:27 +00:00
*lzo)
echo "lzo decompressing image"
lzop -df ${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.$img
break
;;
*lzma)
echo "lzma decompressing image"
2013-11-15 13:31:01 +00:00
lzma -df ${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.$img
2013-08-22 23:04:27 +00:00
break
;;
*xz)
echo "xz decompressing image"
xz -df ${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.$img
break
;;
esac
fi
done
echo "Finished copy of initramfs into ./usr"
}
2016-05-25 08:47:16 +00:00
INITRAMFS_BASE_NAME = "initramfs-${PV}-${PR}-${MACHINE}-${DATETIME}"
2013-08-22 23:04:27 +00:00
INITRAMFS_BASE_NAME[vardepsexclude] = "DATETIME"
do_bundle_initramfs () {
if [ ! -z "${INITRAMFS_IMAGE}" -a x"${INITRAMFS_IMAGE_BUNDLE}" = x1 ]; then
echo "Creating a kernel image with a bundled initramfs..."
copy_initramfs
2016-05-25 08:47:16 +00:00
# Backing up kernel image relies on its type(regular file or symbolic link)
tmp_path=""
for type in ${KERNEL_IMAGETYPES} ; do
if [ -h ${KERNEL_OUTPUT_DIR}/$type ] ; then
linkpath=`readlink -n ${KERNEL_OUTPUT_DIR}/$type`
realpath=`readlink -fn ${KERNEL_OUTPUT_DIR}/$type`
mv -f $realpath $realpath.bak
tmp_path=$tmp_path" "$type"#"$linkpath"#"$realpath
elif [ -f ${KERNEL_OUTPUT_DIR}/$type ]; then
mv -f ${KERNEL_OUTPUT_DIR}/$type ${KERNEL_OUTPUT_DIR}/$type.bak
tmp_path=$tmp_path" "$type"##"
fi
done
2013-08-22 23:04:27 +00:00
use_alternate_initrd=CONFIG_INITRAMFS_SOURCE=${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.cpio
kernel_do_compile
2016-05-25 08:47:16 +00:00
# Restoring kernel image
for tp in $tmp_path ; do
type=`echo $tp|cut -d "#" -f 1`
linkpath=`echo $tp|cut -d "#" -f 2`
realpath=`echo $tp|cut -d "#" -f 3`
if [ -n "$realpath" ]; then
mv -f $realpath $realpath.initramfs
mv -f $realpath.bak $realpath
2016-06-24 13:40:08 +00:00
ln -sf $linkpath.initramfs ${B}/${KERNEL_OUTPUT_DIR}/$type.initramfs
2016-05-25 08:47:16 +00:00
else
mv -f ${KERNEL_OUTPUT_DIR}/$type ${KERNEL_OUTPUT_DIR}/$type.initramfs
mv -f ${KERNEL_OUTPUT_DIR}/$type.bak ${KERNEL_OUTPUT_DIR}/$type
fi
done
2013-08-22 23:04:27 +00:00
# Update install area
2016-05-25 08:47:16 +00:00
for type in ${KERNEL_IMAGETYPES} ; do
echo "There is kernel image bundled with initramfs: ${B}/${KERNEL_OUTPUT_DIR}/$type.initramfs"
install -m 0644 ${B}/${KERNEL_OUTPUT_DIR}/$type.initramfs ${D}/boot/$type-initramfs-${MACHINE}.bin
echo "${B}/${KERNEL_OUTPUT_DIR}/$type.initramfs"
done
2013-08-22 23:04:27 +00:00
fi
}
2016-07-21 11:09:23 +00:00
do_bundle_initramfs[dirs] = "${B}"
2013-09-20 05:45:46 +00:00
python do_devshell_prepend () {
os.environ["LDFLAGS"] = ''
}
2013-11-22 14:23:02 +00:00
addtask bundle_initramfs after do_install before do_deploy
2013-08-22 23:04:27 +00:00
2005-08-31 10:45:47 +00:00
kernel_do_compile() {
2006-11-20 08:56:52 +00:00
unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
2013-08-22 23:04:27 +00:00
# The $use_alternate_initrd is only set from
# do_bundle_initramfs() This variable is specifically for the
# case where we are making a second pass at the kernel
# compilation and we want to force the kernel build to use a
# different initramfs image. The way to do that in the kernel
# is to specify:
# make ...args... CONFIG_INITRAMFS_SOURCE=some_other_initramfs.cpio
2013-09-27 21:32:00 +00:00
if [ "$use_alternate_initrd" = "" ] && [ "${INITRAMFS_TASK}" != "" ] ; then
# The old style way of copying an prebuilt image and building it
# is turned on via INTIRAMFS_TASK != ""
copy_initramfs
use_alternate_initrd=CONFIG_INITRAMFS_SOURCE=${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.cpio
fi
2016-05-25 08:47:16 +00:00
for typeformake in ${KERNEL_IMAGETYPE_FOR_MAKE} ; do
oe_runmake ${typeformake} CC="${KERNEL_CC}" LD="${KERNEL_LD}" ${KERNEL_EXTRA_ARGS} $use_alternate_initrd
for type in ${KERNEL_IMAGETYPES} ; do
if test "${typeformake}.gz" = "${type}"; then
gzip -9c < "${typeformake}" > "${KERNEL_OUTPUT_DIR}/${type}"
break;
fi
done
done
2011-03-15 10:25:01 +00:00
}
do_compile_kernelmodules() {
unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
2015-07-08 14:16:51 +00:00
if (grep -q -i -e '^CONFIG_MODULES=y$' ${B}/.config); then
oe_runmake -C ${B} ${PARALLEL_MAKE} modules CC="${KERNEL_CC}" LD="${KERNEL_LD}" ${KERNEL_EXTRA_ARGS}
2015-11-12 16:13:15 +00:00
# Module.symvers gets updated during the
# building of the kernel modules. We need to
# update this in the shared workdir since some
# external kernel modules has a dependency on
# other kernel modules and will look at this
# file to do symbol lookups
2016-06-13 23:14:06 +00:00
cp ${B}/Module.symvers ${STAGING_KERNEL_BUILDDIR}/
2005-08-31 10:45:47 +00:00
else
2011-04-29 04:49:31 +00:00
bbnote "no modules to compile"
2005-08-31 10:45:47 +00:00
fi
}
2013-04-10 12:36:47 +00:00
addtask compile_kernelmodules after do_compile before do_strip
2005-08-31 10:45:47 +00:00
2009-11-19 13:22:48 +00:00
kernel_do_install() {
2010-05-24 10:14:56 +00:00
#
# First install the modules
#
2009-11-19 13:22:48 +00:00
unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
if (grep -q -i -e '^CONFIG_MODULES=y$' .config); then
oe_runmake DEPMOD=echo INSTALL_MOD_PATH="${D}" modules_install
2012-08-05 19:48:44 +00:00
rm "${D}/lib/modules/${KERNEL_VERSION}/build"
rm "${D}/lib/modules/${KERNEL_VERSION}/source"
2014-01-14 01:21:00 +00:00
# If the kernel/ directory is empty remove it to prevent QA issues
rmdir --ignore-fail-on-non-empty "${D}/lib/modules/${KERNEL_VERSION}/kernel"
2009-11-19 13:22:48 +00:00
else
2011-04-29 04:49:31 +00:00
bbnote "no modules to install"
2009-11-19 13:22:48 +00:00
fi
2010-05-24 10:14:56 +00:00
#
# Install various kernel output (zImage, map file, config, module support files)
2012-03-29 14:08:55 +00:00
#
2009-11-19 13:22:48 +00:00
install -d ${D}/${KERNEL_IMAGEDEST}
install -d ${D}/boot
2016-05-25 08:47:16 +00:00
for type in ${KERNEL_IMAGETYPES} ; do
install -m 0644 ${KERNEL_OUTPUT_DIR}/${type} ${D}/${KERNEL_IMAGEDEST}/${type}-${KERNEL_VERSION}
done
2009-11-19 13:22:48 +00:00
install -m 0644 System.map ${D}/boot/System.map-${KERNEL_VERSION}
install -m 0644 .config ${D}/boot/config-${KERNEL_VERSION}
install -m 0644 vmlinux ${D}/boot/vmlinux-${KERNEL_VERSION}
2009-12-14 15:55:03 +00:00
[ -e Module.symvers ] && install -m 0644 Module.symvers ${D}/boot/Module.symvers-${KERNEL_VERSION}
2012-08-05 19:48:44 +00:00
install -d ${D}${sysconfdir}/modules-load.d
install -d ${D}${sysconfdir}/modprobe.d
kernel: move source and build output to work-shared
commit 3b3f7e785e279 [kernel: Rearrange for 1.8] began the process of
moving the kernel source and build artefacts out of sstate control and
into a shared location.
This changed triggered some workflow issues, as well as bugs related
to the kernel source containing build output, and hence being dirty and
breaking kernel rebuilds.
To solve these issues, and to make it clear that the kernel is not under
sstate control, we move the source and build outputs to:
work-shared/MACHINE/kernel-source
work-shared/MACHINE/kernel-build-artifacts
Where kernel-build-artifacts is the kernel build output and
kernel-source is kept "pristine". The build-artifacts contain everything
that is required to build external modules against the kernel source,
and includes the defconfig, the kernel-abiversion, System.map files and
output from "make scripts".
External module builds should either pass O= on the command line, or
set KBUILD_OUTPUT to point to the build-artifacts. module-base.bbclass
takes care of setting KBUILD_OUTPUT, so most existing external module
recipes are transparently adapted to the new source/build layout.
recipes that depend on the kernel source must have a depedency on the
do_shared_workdir task:
do_configure[depends] += "virtual/kernel:do_shared_workdir"
With this dependency added, the STAGING_KERNEL_DIR will be populated and
available to the rest of the build.
(From OE-Core rev: 6a1ff0e7eacef595738f2fed086986fd622ec32a)
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-01-15 11:54:15 +00:00
}
do_install[prefuncs] += "package_get_auto_pr"
2009-11-19 13:22:48 +00:00
2015-05-06 20:28:39 +00:00
addtask shared_workdir after do_compile before do_compile_kernelmodules
2015-05-14 09:31:51 +00:00
addtask shared_workdir_setscene
do_shared_workdir_setscene () {
exit 1
}
kernel: move source and build output to work-shared
commit 3b3f7e785e279 [kernel: Rearrange for 1.8] began the process of
moving the kernel source and build artefacts out of sstate control and
into a shared location.
This changed triggered some workflow issues, as well as bugs related
to the kernel source containing build output, and hence being dirty and
breaking kernel rebuilds.
To solve these issues, and to make it clear that the kernel is not under
sstate control, we move the source and build outputs to:
work-shared/MACHINE/kernel-source
work-shared/MACHINE/kernel-build-artifacts
Where kernel-build-artifacts is the kernel build output and
kernel-source is kept "pristine". The build-artifacts contain everything
that is required to build external modules against the kernel source,
and includes the defconfig, the kernel-abiversion, System.map files and
output from "make scripts".
External module builds should either pass O= on the command line, or
set KBUILD_OUTPUT to point to the build-artifacts. module-base.bbclass
takes care of setting KBUILD_OUTPUT, so most existing external module
recipes are transparently adapted to the new source/build layout.
recipes that depend on the kernel source must have a depedency on the
do_shared_workdir task:
do_configure[depends] += "virtual/kernel:do_shared_workdir"
With this dependency added, the STAGING_KERNEL_DIR will be populated and
available to the rest of the build.
(From OE-Core rev: 6a1ff0e7eacef595738f2fed086986fd622ec32a)
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-01-15 11:54:15 +00:00
2015-01-29 14:35:08 +00:00
emit_depmod_pkgdata() {
# Stash data for depmod
install -d ${PKGDESTWORK}/kernel-depmod/
echo "${KERNEL_VERSION}" > ${PKGDESTWORK}/kernel-depmod/kernel-abiversion
2015-07-08 14:16:51 +00:00
cp ${B}/System.map ${PKGDESTWORK}/kernel-depmod/System.map-${KERNEL_VERSION}
2015-01-29 14:35:08 +00:00
}
PACKAGEFUNCS += "emit_depmod_pkgdata"
kernel: move source and build output to work-shared
commit 3b3f7e785e279 [kernel: Rearrange for 1.8] began the process of
moving the kernel source and build artefacts out of sstate control and
into a shared location.
This changed triggered some workflow issues, as well as bugs related
to the kernel source containing build output, and hence being dirty and
breaking kernel rebuilds.
To solve these issues, and to make it clear that the kernel is not under
sstate control, we move the source and build outputs to:
work-shared/MACHINE/kernel-source
work-shared/MACHINE/kernel-build-artifacts
Where kernel-build-artifacts is the kernel build output and
kernel-source is kept "pristine". The build-artifacts contain everything
that is required to build external modules against the kernel source,
and includes the defconfig, the kernel-abiversion, System.map files and
output from "make scripts".
External module builds should either pass O= on the command line, or
set KBUILD_OUTPUT to point to the build-artifacts. module-base.bbclass
takes care of setting KBUILD_OUTPUT, so most existing external module
recipes are transparently adapted to the new source/build layout.
recipes that depend on the kernel source must have a depedency on the
do_shared_workdir task:
do_configure[depends] += "virtual/kernel:do_shared_workdir"
With this dependency added, the STAGING_KERNEL_DIR will be populated and
available to the rest of the build.
(From OE-Core rev: 6a1ff0e7eacef595738f2fed086986fd622ec32a)
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-01-15 11:54:15 +00:00
do_shared_workdir () {
cd ${B}
kerneldir=${STAGING_KERNEL_BUILDDIR}
2011-03-09 01:09:10 +00:00
install -d $kerneldir
2010-05-18 13:46:33 +00:00
2011-06-22 15:41:34 +00:00
#
# Store the kernel version in sysroots for module-base.bbclass
#
echo "${KERNEL_VERSION}" > $kerneldir/kernel-abiversion
kernel: move source and build output to work-shared
commit 3b3f7e785e279 [kernel: Rearrange for 1.8] began the process of
moving the kernel source and build artefacts out of sstate control and
into a shared location.
This changed triggered some workflow issues, as well as bugs related
to the kernel source containing build output, and hence being dirty and
breaking kernel rebuilds.
To solve these issues, and to make it clear that the kernel is not under
sstate control, we move the source and build outputs to:
work-shared/MACHINE/kernel-source
work-shared/MACHINE/kernel-build-artifacts
Where kernel-build-artifacts is the kernel build output and
kernel-source is kept "pristine". The build-artifacts contain everything
that is required to build external modules against the kernel source,
and includes the defconfig, the kernel-abiversion, System.map files and
output from "make scripts".
External module builds should either pass O= on the command line, or
set KBUILD_OUTPUT to point to the build-artifacts. module-base.bbclass
takes care of setting KBUILD_OUTPUT, so most existing external module
recipes are transparently adapted to the new source/build layout.
recipes that depend on the kernel source must have a depedency on the
do_shared_workdir task:
do_configure[depends] += "virtual/kernel:do_shared_workdir"
With this dependency added, the STAGING_KERNEL_DIR will be populated and
available to the rest of the build.
(From OE-Core rev: 6a1ff0e7eacef595738f2fed086986fd622ec32a)
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-01-15 11:54:15 +00:00
2014-11-14 19:51:27 +00:00
# Copy files required for module builds
cp System.map $kerneldir/System.map-${KERNEL_VERSION}
cp Module.symvers $kerneldir/
cp .config $kerneldir/
mkdir -p $kerneldir/include/config
cp include/config/kernel.release $kerneldir/include/config/kernel.release
kernel: move source and build output to work-shared
commit 3b3f7e785e279 [kernel: Rearrange for 1.8] began the process of
moving the kernel source and build artefacts out of sstate control and
into a shared location.
This changed triggered some workflow issues, as well as bugs related
to the kernel source containing build output, and hence being dirty and
breaking kernel rebuilds.
To solve these issues, and to make it clear that the kernel is not under
sstate control, we move the source and build outputs to:
work-shared/MACHINE/kernel-source
work-shared/MACHINE/kernel-build-artifacts
Where kernel-build-artifacts is the kernel build output and
kernel-source is kept "pristine". The build-artifacts contain everything
that is required to build external modules against the kernel source,
and includes the defconfig, the kernel-abiversion, System.map files and
output from "make scripts".
External module builds should either pass O= on the command line, or
set KBUILD_OUTPUT to point to the build-artifacts. module-base.bbclass
takes care of setting KBUILD_OUTPUT, so most existing external module
recipes are transparently adapted to the new source/build layout.
recipes that depend on the kernel source must have a depedency on the
do_shared_workdir task:
do_configure[depends] += "virtual/kernel:do_shared_workdir"
With this dependency added, the STAGING_KERNEL_DIR will be populated and
available to the rest of the build.
(From OE-Core rev: 6a1ff0e7eacef595738f2fed086986fd622ec32a)
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-01-15 11:54:15 +00:00
# We can also copy over all the generated files and avoid special cases
# like version.h, but we've opted to keep this small until file creep starts
# to happen
2015-01-15 11:54:14 +00:00
if [ -e include/linux/version.h ]; then
mkdir -p $kerneldir/include/linux
cp include/linux/version.h $kerneldir/include/linux/version.h
fi
2014-11-14 19:51:27 +00:00
# As of Linux kernel version 3.0.1, the clean target removes
# arch/powerpc/lib/crtsavres.o which is present in
# KBUILD_LDFLAGS_MODULE, making it required to build external modules.
if [ ${ARCH} = "powerpc" ]; then
mkdir -p $kerneldir/arch/powerpc/lib/
cp arch/powerpc/lib/crtsavres.o $kerneldir/arch/powerpc/lib/crtsavres.o
fi
2015-08-08 01:15:21 +00:00
if [ -d include/generated ]; then
mkdir -p $kerneldir/include/generated/
cp -fR include/generated/* $kerneldir/include/generated/
fi
2014-11-14 19:51:27 +00:00
2016-02-02 09:01:56 +00:00
if [ -d arch/${ARCH}/include/generated ]; then
mkdir -p $kerneldir/arch/${ARCH}/include/generated/
cp -fR arch/${ARCH}/include/generated/* $kerneldir/arch/${ARCH}/include/generated/
2014-11-14 19:51:27 +00:00
fi
2005-08-31 10:45:47 +00:00
}
2015-01-29 14:35:08 +00:00
# We don't need to stage anything, not the modules/firmware since those would clash with linux-firmware
kernel: move source and build output to work-shared
commit 3b3f7e785e279 [kernel: Rearrange for 1.8] began the process of
moving the kernel source and build artefacts out of sstate control and
into a shared location.
This changed triggered some workflow issues, as well as bugs related
to the kernel source containing build output, and hence being dirty and
breaking kernel rebuilds.
To solve these issues, and to make it clear that the kernel is not under
sstate control, we move the source and build outputs to:
work-shared/MACHINE/kernel-source
work-shared/MACHINE/kernel-build-artifacts
Where kernel-build-artifacts is the kernel build output and
kernel-source is kept "pristine". The build-artifacts contain everything
that is required to build external modules against the kernel source,
and includes the defconfig, the kernel-abiversion, System.map files and
output from "make scripts".
External module builds should either pass O= on the command line, or
set KBUILD_OUTPUT to point to the build-artifacts. module-base.bbclass
takes care of setting KBUILD_OUTPUT, so most existing external module
recipes are transparently adapted to the new source/build layout.
recipes that depend on the kernel source must have a depedency on the
do_shared_workdir task:
do_configure[depends] += "virtual/kernel:do_shared_workdir"
With this dependency added, the STAGING_KERNEL_DIR will be populated and
available to the rest of the build.
(From OE-Core rev: 6a1ff0e7eacef595738f2fed086986fd622ec32a)
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-01-15 11:54:15 +00:00
sysroot_stage_all () {
2015-01-29 14:35:08 +00:00
:
2005-08-31 10:45:47 +00:00
}
2014-12-19 17:46:27 +00:00
KERNEL_CONFIG_COMMAND ?= "oe_runmake_call -C ${S} O=${B} oldnoconfig || yes '' | oe_runmake -C ${S} O=${B} oldconfig"
2014-02-07 16:30:32 +00:00
2016-05-09 04:43:31 +00:00
python check_oldest_kernel() {
oldest_kernel = d.getVar('OLDEST_KERNEL', True)
kernel_version = d.getVar('KERNEL_VERSION', True)
tclibc = d.getVar('TCLIBC', True)
if tclibc == 'glibc':
kernel_version = kernel_version.split('-', 1)[0]
if oldest_kernel and kernel_version:
if bb.utils.vercmp_string(kernel_version, oldest_kernel) < 0:
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', True), oldest_kernel, kernel_version, tclibc))
}
check_oldest_kernel[vardepsexclude] += "OLDEST_KERNEL KERNEL_VERSION"
do_configure[prefuncs] += "check_oldest_kernel"
2005-08-31 10:45:47 +00:00
kernel_do_configure() {
2012-03-23 12:56:29 +00:00
# fixes extra + in /lib/modules/2.6.37+
# $ scripts/setlocalversion . => +
# $ make kernelversion => 2.6.37
# $ make kernelrelease => 2.6.37+
2012-03-26 17:29:48 +00:00
touch ${B}/.scmversion ${S}/.scmversion
2012-03-23 12:56:29 +00:00
2014-12-19 17:46:27 +00:00
if [ "${S}" != "${B}" ] && [ -f "${S}/.config" ] && [ ! -f "${B}/.config" ]; then
mv "${S}/.config" "${B}/.config"
fi
2011-02-08 22:31:23 +00:00
# Copy defconfig to .config if .config does not exist. This allows
# recipes to manage the .config themselves in do_configure_prepend().
2011-07-20 20:22:31 +00:00
if [ -f "${WORKDIR}/defconfig" ] && [ ! -f "${B}/.config" ]; then
cp "${WORKDIR}/defconfig" "${B}/.config"
2011-02-08 22:31:23 +00:00
fi
2015-12-09 23:45:03 +00:00
${KERNEL_CONFIG_COMMAND}
2005-08-31 10:45:47 +00:00
}
2011-08-02 12:30:18 +00:00
do_savedefconfig() {
2015-07-08 14:16:51 +00:00
oe_runmake -C ${B} savedefconfig
2011-08-02 12:30:18 +00:00
}
do_savedefconfig[nostamp] = "1"
addtask savedefconfig after do_configure
2005-08-31 10:45:47 +00:00
inherit cml1
2009-11-19 13:22:48 +00:00
EXPORT_FUNCTIONS do_compile do_install do_configure
2005-08-31 10:45:47 +00:00
2007-08-29 19:29:56 +00:00
# kernel-base becomes kernel-${KERNEL_VERSION}
2016-05-09 04:43:30 +00:00
# kernel-image becomes kernel-image-${KERNEL_VERSION}
2012-10-16 22:34:28 +00:00
PACKAGES = "kernel kernel-base kernel-vmlinux kernel-image kernel-dev kernel-modules"
2013-05-07 13:30:03 +00:00
FILES_${PN} = ""
2013-02-28 18:09:05 +00:00
FILES_kernel-base = "/lib/modules/${KERNEL_VERSION}/modules.order /lib/modules/${KERNEL_VERSION}/modules.builtin"
2016-05-25 08:47:16 +00:00
FILES_kernel-image = ""
2014-09-30 21:40:05 +00:00
FILES_kernel-dev = "/boot/System.map* /boot/Module.symvers* /boot/config* ${KERNEL_SRC_PATH} /lib/modules/${KERNEL_VERSION}/build"
2007-09-11 12:47:17 +00:00
FILES_kernel-vmlinux = "/boot/vmlinux*"
2012-10-16 22:34:28 +00:00
FILES_kernel-modules = ""
2007-08-29 19:29:56 +00:00
RDEPENDS_kernel = "kernel-base"
2016-05-25 08:47:16 +00:00
# Allow machines to override this dependency if kernel image files are
2007-08-29 19:29:56 +00:00
# not wanted in images as standard
RDEPENDS_kernel-base ?= "kernel-image"
2011-05-20 16:29:47 +00:00
PKG_kernel-image = "kernel-image-${@legitimize_package_name('${KERNEL_VERSION}')}"
2015-08-25 10:36:07 +00:00
RDEPENDS_kernel-image += "${@base_conditional('KERNEL_IMAGETYPE', 'vmlinux', 'kernel-vmlinux', '', d)}"
2011-05-20 16:29:47 +00:00
PKG_kernel-base = "kernel-${@legitimize_package_name('${KERNEL_VERSION}')}"
2012-07-06 15:52:41 +00:00
RPROVIDES_kernel-base += "kernel-${KERNEL_VERSION}"
2005-08-31 10:45:47 +00:00
ALLOW_EMPTY_kernel = "1"
2007-08-29 19:29:56 +00:00
ALLOW_EMPTY_kernel-base = "1"
2005-08-31 10:45:47 +00:00
ALLOW_EMPTY_kernel-image = "1"
2012-10-16 22:34:28 +00:00
ALLOW_EMPTY_kernel-modules = "1"
DESCRIPTION_kernel-modules = "Kernel modules meta package"
2005-08-31 10:45:47 +00:00
2014-03-21 18:02:38 +00:00
pkg_postinst_kernel-base () {
2013-08-09 17:58:42 +00:00
if [ ! -e "$D/lib/modules/${KERNEL_VERSION}" ]; then
mkdir -p $D/lib/modules/${KERNEL_VERSION}
fi
if [ -n "$D" ]; then
depmodwrapper -a -b $D ${KERNEL_VERSION}
else
depmod -a ${KERNEL_VERSION}
fi
}
2013-02-03 17:31:30 +00:00
PACKAGESPLITFUNCS_prepend = "split_kernel_packages "
python split_kernel_packages () {
2016-03-23 22:09:32 +00:00
do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.(bin|fw|cis|csp|dsp)$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='')
2005-08-31 10:45:47 +00:00
}
2007-12-06 09:43:11 +00:00
2015-12-23 00:12:53 +00:00
# Many scripts want to look in arch/$arch/boot for the bootable
2016-05-25 08:47:17 +00:00
# image. This poses a problem for vmlinux and vmlinuz based
# booting. This task arranges to have vmlinux and vmlinuz appear
# in the normalized directory location.
do_kernel_link_images() {
2015-12-23 00:12:53 +00:00
if [ ! -d "${B}/arch/${ARCH}/boot" ]; then
mkdir ${B}/arch/${ARCH}/boot
fi
cd ${B}/arch/${ARCH}/boot
ln -sf ../../../vmlinux
2016-05-25 08:47:17 +00:00
if [ -f ../../../vmlinuz ]; then
ln -sf ../../../vmlinuz
fi
2015-12-23 00:12:53 +00:00
}
2013-04-10 12:36:47 +00:00
do_strip() {
if [ -n "${KERNEL_IMAGE_STRIP_EXTRA_SECTIONS}" ]; then
2016-05-25 08:47:16 +00:00
if ! (echo "${KERNEL_IMAGETYPES}" | grep -wq "vmlinux"); then
bbwarn "image type(s) will not be stripped (not supported): ${KERNEL_IMAGETYPES}"
2013-04-10 12:36:47 +00:00
return
fi
cd ${B}
2016-05-25 08:47:16 +00:00
headers=`"$CROSS_COMPILE"readelf -S ${KERNEL_OUTPUT_DIR}/vmlinux | \
2013-04-10 12:36:47 +00:00
grep "^ \{1,\}\[[0-9 ]\{1,\}\] [^ ]" | \
sed "s/^ \{1,\}\[[0-9 ]\{1,\}\] //" | \
gawk '{print $1}'`
for str in ${KERNEL_IMAGE_STRIP_EXTRA_SECTIONS}; do {
2015-09-30 02:29:33 +00:00
if ! (echo "$headers" | grep -q "^$str$"); then
2013-04-10 12:36:47 +00:00
bbwarn "Section not found: $str";
fi
2016-05-25 08:47:16 +00:00
"$CROSS_COMPILE"strip -s -R $str ${KERNEL_OUTPUT_DIR}/vmlinux
2013-04-10 12:36:47 +00:00
}; done
bbnote "KERNEL_IMAGE_STRIP_EXTRA_SECTIONS is set, stripping sections:" \
"${KERNEL_IMAGE_STRIP_EXTRA_SECTIONS}"
fi;
}
do_strip[dirs] = "${B}"
2016-05-25 08:47:17 +00:00
addtask do_strip before do_sizecheck after do_kernel_link_images
2013-04-10 12:36:47 +00:00
2007-12-06 09:43:11 +00:00
# Support checking the kernel size since some kernels need to reside in partitions
# with a fixed length or there is a limit in transferring the kernel to memory
do_sizecheck() {
2008-06-05 10:49:22 +00:00
if [ ! -z "${KERNEL_IMAGE_MAXSIZE}" ]; then
2014-07-07 09:33:59 +00:00
invalid=`echo ${KERNEL_IMAGE_MAXSIZE} | sed 's/[0-9]//g'`
if [ -n "$invalid" ]; then
die "Invalid KERNEL_IMAGE_MAXSIZE: ${KERNEL_IMAGE_MAXSIZE}, should be an integerx (The unit is Kbytes)"
fi
2016-05-25 08:47:16 +00:00
for type in ${KERNEL_IMAGETYPES} ; do
size=`du -ks ${B}/${KERNEL_OUTPUT_DIR}/$type | awk '{print $1}'`
if [ $size -ge ${KERNEL_IMAGE_MAXSIZE} ]; then
warn "This kernel $type (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."
fi
done
2012-03-29 14:08:55 +00:00
fi
2007-12-06 09:43:11 +00:00
}
2013-04-08 20:15:51 +00:00
do_sizecheck[dirs] = "${B}"
2007-12-06 09:43:11 +00:00
2013-04-10 12:36:47 +00:00
addtask sizecheck before do_install after do_strip
2008-02-06 15:27:26 +00:00
2016-05-25 08:47:16 +00:00
KERNEL_IMAGE_BASE_NAME ?= "${PKGE}-${PKGV}-${PKGR}-${MACHINE}-${DATETIME}"
2010-12-16 08:56:15 +00:00
# Don't include the DATETIME variable in the sstate package signatures
KERNEL_IMAGE_BASE_NAME[vardepsexclude] = "DATETIME"
2016-05-25 08:47:16 +00:00
KERNEL_IMAGE_SYMLINK_NAME ?= "${MACHINE}"
2013-04-15 11:07:01 +00:00
MODULE_IMAGE_BASE_NAME ?= "modules-${PKGE}-${PKGV}-${PKGR}-${MACHINE}-${DATETIME}"
2013-01-17 15:24:58 +00:00
MODULE_IMAGE_BASE_NAME[vardepsexclude] = "DATETIME"
2013-01-09 17:01:23 +00:00
MODULE_TARBALL_BASE_NAME ?= "${MODULE_IMAGE_BASE_NAME}.tgz"
2012-11-20 16:19:56 +00:00
# Don't include the DATETIME variable in the sstate package signatures
MODULE_TARBALL_SYMLINK_NAME ?= "modules-${MACHINE}.tgz"
2012-09-23 21:45:10 +00:00
MODULE_TARBALL_DEPLOY ?= "1"
2008-02-06 15:27:26 +00:00
2010-12-16 08:56:15 +00:00
kernel_do_deploy() {
2016-05-25 08:47:16 +00:00
for type in ${KERNEL_IMAGETYPES} ; do
base_name=${type}-${KERNEL_IMAGE_BASE_NAME}
install -m 0644 ${KERNEL_OUTPUT_DIR}/${type} ${DEPLOYDIR}/${base_name}.bin
done
2012-09-23 21:45:10 +00:00
if [ ${MODULE_TARBALL_DEPLOY} = "1" ] && (grep -q -i -e '^CONFIG_MODULES=y$' .config); then
2013-04-12 08:12:55 +00:00
mkdir -p ${D}/lib
2012-11-20 16:19:56 +00:00
tar -cvzf ${DEPLOYDIR}/${MODULE_TARBALL_BASE_NAME} -C ${D} lib
2013-06-05 09:20:50 +00:00
ln -sf ${MODULE_TARBALL_BASE_NAME} ${DEPLOYDIR}/${MODULE_TARBALL_SYMLINK_NAME}
2008-10-29 01:48:22 +00:00
fi
2008-06-05 10:49:22 +00:00
2016-05-25 08:47:16 +00:00
for type in ${KERNEL_IMAGETYPES} ; do
base_name=${type}-${KERNEL_IMAGE_BASE_NAME}
symlink_name=${type}-${KERNEL_IMAGE_SYMLINK_NAME}
ln -sf ${base_name}.bin ${DEPLOYDIR}/${symlink_name}.bin
ln -sf ${base_name}.bin ${DEPLOYDIR}/${type}
done
2011-08-16 17:13:04 +00:00
2011-08-23 15:22:14 +00:00
cp ${COREBASE}/meta/files/deploydir_readme.txt ${DEPLOYDIR}/README_-_DO_NOT_DELETE_FILES_IN_THIS_DIRECTORY.txt
2013-11-22 14:23:02 +00:00
cd ${B}
# Update deploy directory
2016-05-25 08:47:16 +00:00
for type in ${KERNEL_IMAGETYPES} ; do
if [ -e "${KERNEL_OUTPUT_DIR}/${type}.initramfs" ]; then
echo "Copying deploy ${type} kernel-initramfs image and setting up links..."
initramfs_base_name=${type}-${INITRAMFS_BASE_NAME}
initramfs_symlink_name=${type}-initramfs-${MACHINE}
install -m 0644 ${KERNEL_OUTPUT_DIR}/${type}.initramfs ${DEPLOYDIR}/${initramfs_base_name}.bin
2016-06-24 10:42:32 +00:00
ln -sf ${initramfs_base_name}.bin ${DEPLOYDIR}/${initramfs_symlink_name}.bin
2016-05-25 08:47:16 +00:00
fi
done
2008-02-06 15:27:26 +00:00
}
2016-01-25 15:07:34 +00:00
do_deploy[cleandirs] = "${DEPLOYDIR}"
2010-08-05 13:25:20 +00:00
do_deploy[dirs] = "${DEPLOYDIR} ${B}"
2013-04-15 11:07:01 +00:00
do_deploy[prefuncs] += "package_get_auto_pr"
2008-02-06 15:27:26 +00:00
kernel: move source and build output to work-shared
commit 3b3f7e785e279 [kernel: Rearrange for 1.8] began the process of
moving the kernel source and build artefacts out of sstate control and
into a shared location.
This changed triggered some workflow issues, as well as bugs related
to the kernel source containing build output, and hence being dirty and
breaking kernel rebuilds.
To solve these issues, and to make it clear that the kernel is not under
sstate control, we move the source and build outputs to:
work-shared/MACHINE/kernel-source
work-shared/MACHINE/kernel-build-artifacts
Where kernel-build-artifacts is the kernel build output and
kernel-source is kept "pristine". The build-artifacts contain everything
that is required to build external modules against the kernel source,
and includes the defconfig, the kernel-abiversion, System.map files and
output from "make scripts".
External module builds should either pass O= on the command line, or
set KBUILD_OUTPUT to point to the build-artifacts. module-base.bbclass
takes care of setting KBUILD_OUTPUT, so most existing external module
recipes are transparently adapted to the new source/build layout.
recipes that depend on the kernel source must have a depedency on the
do_shared_workdir task:
do_configure[depends] += "virtual/kernel:do_shared_workdir"
With this dependency added, the STAGING_KERNEL_DIR will be populated and
available to the rest of the build.
(From OE-Core rev: 6a1ff0e7eacef595738f2fed086986fd622ec32a)
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-01-15 11:54:15 +00:00
addtask deploy after do_populate_sysroot
2010-09-08 14:48:31 +00:00
2010-12-16 08:56:15 +00:00
EXPORT_FUNCTIONS do_deploy