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.inc156
1 files changed, 156 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..a8c2ba4
--- /dev/null
+++ b/recipes-kernel/linux/staging-kernel.inc
@@ -0,0 +1,156 @@
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
12kernel_do_configure_prepend() {
13
14 configure_kernel "${KERNEL_DEFCONFIG}" "${STAGING_KERNEL_FEATURES}"
15
16}
17
18do_stagingkernel () {
19 stagingkernel "${KERNEL_FEATURES}" ${STAGING_NAME}
20 if [ -n "${STAGING_KERNEL_FEATURES_RT}" ]; then
21 cd ${B}
22 stagingkernel "${STAGING_KERNEL_FEATURES_RT}" "rt"
23 fi
24
25}
26
27stagingkernel () {
28
29 configure_kernel "${KERNEL_DEFCONFIG}" "${1}"
30
31 # Copy defconfig to .config if .config does not exist. This allows
32 # recipes to manage the .config themselves in do_configure_prepend().
33 if [ -f "${WORKDIR}/defconfig" ] && [ ! -f "${B}/.config" ]; then
34 cp "${WORKDIR}/defconfig" "${B}/.config"
35 fi
36 yes '' | oe_runmake oldconfig
37
38 if [ ! -z "${INITRAMFS_IMAGE}" ]; then
39 for img in cpio.gz cpio.lzo cpio.lzma cpio.xz; do
40 if [ -e "${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.$img" ]; then
41 cp "${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.$img" initramfs.$img
42 fi
43 done
44 fi
45
46 #
47 # Build this alternative kernel
48 #
49
50 kernel_do_compile
51 do_compile_kernelmodules
52
53 #
54 # First install the modules to deploy dir
55 #
56 unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
57 if (grep -q -i -e '^CONFIG_MODULES=y$' .config); then
58 oe_runmake DEPMOD=echo INSTALL_MOD_PATH="${D}" modules_install
59 else
60 bbnote "no modules to install"
61 fi
62 if [ -d "${D}/lib" ]; then
63 tar -cvzf ${DEPLOY_DIR_IMAGE}/${MODULES_IMAGE_BASE_NAME}-${2}.tgz -C ${D} lib
64 fi
65 rm -fr ${D}/lib
66
67 #
68 # Dont build any dtb:s for the staging kernel
69 #
70
71 #
72 # Drop the resulting images in the deploy dir
73 #
74 cd ${S}
75 install -d ${DEPLOY_DIR_IMAGE}
76 install -m 0644 ${KERNEL_OUTPUT} ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGE_BASE_NAME}-${2}.bin
77 mv ${KERNEL_OUTPUT} ${KERNEL_OUTPUT}-${2}
78
79 #
80 # Install the final config alongside the images
81 #
82 cd ${S}
83 cp .config ${DEPLOY_DIR_IMAGE}/config-${PV}-${PR}-${MACHINE}-${2}.config
84 rm -f .config
85
86 #
87 # Create symlinks
88 #
89 cd ${DEPLOY_DIR_IMAGE}
90 rm -f ${KERNEL_IMAGE_SYMLINK_NAME}-${2}.bin
91 ln -sf ${KERNEL_IMAGE_BASE_NAME}-${2}.bin ${KERNEL_IMAGE_SYMLINK_NAME}-${2}.bin
92
93 rm -f config-${MACHINE}-${2}.config
94 ln -sf config-${PV}-${PR}-${MACHINE}-${2}.config config-${MACHINE}-${2}.config
95
96}
97
98do_stagingkernel[dirs] = "${DEPLOY_DIR_IMAGE} ${B}"
99
100do_stagingkernel[depends] += "u-boot-mkimage-native:do_populate_sysroot virtual/${TARGET_PREFIX}gcc:do_populate_sysroot virtual/${TARGET_PREFIX}gcc:do_populate_sysroot"
101
102addtask stagingkernel after do_patch before do_configure
103
104#
105# For reference, copy .config to deploy image
106#
107do_deploy_append () {
108
109 install -d ${DEPLOY_DIR_IMAGE}
110
111 #
112 # Drop the regular defconfig along side the others for consistency
113 #
114 cd ${S}
115 cp .config ${DEPLOY_DIR_IMAGE}/config-${PV}-${PR}-${MACHINE}.config
116
117 #
118 # add symlink
119 #
120 cd ${DEPLOY_DIR_IMAGE}
121 rm -f config-${MACHINE}.config
122 ln -s config-${PV}-${PR}-${MACHINE}.config config-${MACHINE}.config
123
124 if [ -n "${STAGING_KERNEL_FEATURES_RT}" ]; then
125 cd ${S}
126 install -m 0644 ${KERNEL_OUTPUT}-rt ${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}-rt.bin
127
128 #
129 # Create symlinks
130 #
131 cd ${DEPLOYDIR}
132 rm -f ${KERNEL_IMAGE_SYMLINK_NAME}-rt.bin
133 ln -sf ${KERNEL_IMAGE_BASE_NAME}-rt.bin ${KERNEL_IMAGE_SYMLINK_NAME}-rt.bin
134 fi
135
136}
137
138#
139# Clean staging kernel related files in deploy dir
140#
141do_cleanstagingkernel () {
142
143 cd ${DEPLOY_DIR_IMAGE}
144 rm -f *-${STAGING_NAME}.*
145
146 rm -f config-${PV}-${PR}-${MACHINE}.config
147 rm -f config-${MACHINE}.config
148
149}
150
151LDFLAGS=""
152
153do_cleanstagingkernel[nostamp] = "1"
154
155addtask cleanstagingkernel after do_cleansstate
156