summaryrefslogtreecommitdiffstats
path: root/recipes-kernel/linux/staging-kernel.inc
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-kernel/linux/staging-kernel.inc')
-rw-r--r--recipes-kernel/linux/staging-kernel.inc133
1 files changed, 133 insertions, 0 deletions
diff --git a/recipes-kernel/linux/staging-kernel.inc b/recipes-kernel/linux/staging-kernel.inc
new file mode 100644
index 0000000..3ef802d
--- /dev/null
+++ b/recipes-kernel/linux/staging-kernel.inc
@@ -0,0 +1,133 @@
1# This .inc file allows building and deploying staging kernel + modules
2# with defconfig + fragment cfgs
3
4require kernel-configure.inc
5
6STAGING_NAME ?= "RELEASE"
7STAGING_KERNEL_FEATURES ?= ""
8KERNEL_FEATURES ?= ""
9MODULES_IMAGE_BASE_NAME = "modules-${PV}-${PR}-${MACHINE}"
10EXTRA_OEMAKE_prepend_task-stagingkernel = "${PARALLEL_MAKE} "
11
12do_stagingkernel () {
13 stagingkernel "${STAGING_KERNEL_FEATURES}" ${STAGING_NAME}
14}
15
16stagingkernel () {
17
18 configure_kernel "${KERNEL_DEFCONFIG}" "${1}"
19
20 # Copy defconfig to .config if .config does not exist. This allows
21 # recipes to manage the .config themselves in do_configure_prepend().
22 if [ -f "${WORKDIR}/defconfig" ] && [ ! -f "${B}/.config" ]; then
23 cp "${WORKDIR}/defconfig" "${B}/.config"
24 fi
25 yes '' | oe_runmake oldconfig
26
27 if [ ! -z "${INITRAMFS_IMAGE}" ]; then
28 for img in cpio.gz cpio.lzo cpio.lzma cpio.xz; do
29 if [ -e "${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.$img" ]; then
30 cp "${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.$img" initramfs.$img
31 fi
32 done
33 fi
34
35 #
36 # Build this alternative kernel
37 #
38
39 kernel_do_compile
40 do_compile_kernelmodules
41
42 #
43 # First install the modules to deploy dir
44 #
45 unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
46 if (grep -q -i -e '^CONFIG_MODULES=y$' .config); then
47 oe_runmake DEPMOD=echo INSTALL_MOD_PATH="${D}" modules_install
48 else
49 bbnote "no modules to install"
50 fi
51 if [ -d "${D}/lib" ]; then
52 tar -cvzf ${DEPLOY_DIR_IMAGE}/${MODULES_IMAGE_BASE_NAME}-${2}.tgz -C ${D} lib
53 fi
54 rm -fr ${D}/lib
55
56 #
57 # Dont build any dtb:s for the staging kernel
58 #
59
60 #
61 # Drop the resulting images in the deploy dir
62 #
63 cd ${S}
64 install -d ${DEPLOY_DIR_IMAGE}
65 install -m 0644 ${KERNEL_OUTPUT} ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGE_BASE_NAME}-${2}.bin
66 mv ${KERNEL_OUTPUT} ${KERNEL_OUTPUT}-${2}
67
68 #
69 # Install the final config alongside the images
70 #
71 cd ${S}
72 cp .config ${DEPLOY_DIR_IMAGE}/config-${PV}-${PR}-${MACHINE}-${2}.config
73 rm -f .config
74
75 #
76 # Create symlinks
77 #
78 cd ${DEPLOY_DIR_IMAGE}
79 rm -f ${KERNEL_IMAGE_SYMLINK_NAME}-${2}.bin
80 ln -sf ${KERNEL_IMAGE_BASE_NAME}-${2}.bin ${KERNEL_IMAGE_SYMLINK_NAME}-${2}.bin
81
82 rm -f config-${MACHINE}-${2}.config
83 ln -sf config-${PV}-${PR}-${MACHINE}-${2}.config config-${MACHINE}-${2}.config
84
85}
86
87do_stagingkernel[dirs] = "${DEPLOY_DIR_IMAGE} ${B}"
88
89do_stagingkernel[depends] += "u-boot-mkimage-native:do_populate_sysroot virtual/${TARGET_PREFIX}gcc:do_populate_sysroot virtual/${TARGET_PREFIX}gcc:do_populate_sysroot libgcc:do_populate_sysroot"
90
91addtask stagingkernel after do_patch before do_configure
92
93#
94# For reference, copy .config to deploy image
95#
96do_deploy_append () {
97
98 install -d ${DEPLOY_DIR_IMAGE}
99
100 #
101 # Drop the regular defconfig along side the others for consistency
102 #
103 cd ${S}
104 cp .config ${DEPLOY_DIR_IMAGE}/config-${PV}-${PR}-${MACHINE}.config
105
106 #
107 # add symlink
108 #
109 cd ${DEPLOY_DIR_IMAGE}
110 rm -f config-${MACHINE}.config
111 ln -s config-${PV}-${PR}-${MACHINE}.config config-${MACHINE}.config
112
113}
114
115#
116# Clean staging kernel related files in deploy dir
117#
118do_cleanstagingkernel () {
119
120 cd ${DEPLOY_DIR_IMAGE}
121 rm -f *-${STAGING_NAME}.*
122
123 rm -f config-${PV}-${PR}-${MACHINE}.config
124 rm -f config-${MACHINE}.config
125
126}
127
128LDFLAGS=""
129
130do_cleanstagingkernel[nostamp] = "1"
131
132addtask cleanstagingkernel after do_cleansstate
133