diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-10-21 21:05:30 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-12-21 12:37:53 +0000 |
commit | 86893e4ea5896199a6f02f8475f4f17aa1124c37 (patch) | |
tree | 8991c2825bdf69b41c8b30ff00db68663566209e /meta/classes/kernel.bbclass | |
parent | 1ff64a7e848dcdd540e1c60acec1d0ad80a642bb (diff) | |
download | poky-86893e4ea5896199a6f02f8475f4f17aa1124c37.tar.gz |
kernel: Rearrange for 1.8
In 1.8 we want to streamline the kernel build process. Basically we
currently have multiple copies of the kernel source floating around
and the copying/compression/decompression is painful.
Lets assume we have a kernel source per machine since in most cases
this is true (and we have a sysroot per machine anyway). Basically,
instead of extracting a source into WORKDIR, then copying to a sysroot,
we now set S to point straight at STAGING_DIR_KERNEL.
Anything using kernel source can then just point at it and use:
do_configure[depends] += "virtual/kernel:do_patch"
to depend on the kernel source being present. Note this is different
behaviour to DEPENDS += "virtual/kernel" which equates to
do_configure[depends] += "virtual/kernel:do_populate_sysroot".
Once we do this, we no longer need the copy operation in
do_populate_sysroot, in fact there is nothing to do there (yay).
The remaining part of the challenge is to kill off the horrible
do_install. This patch splits it off to a different class, the idea here
is to have a separate recipe which depends on the virtual/kernel:do_patch
and just installs and packages the source needed to build modules on
target into a specific package.
Right now this code is proof of concept. It builds kernels and kernel
modules. perf blows up in do_package with issues on finding the kernel
version which can probably be fixed by adding back the right bit of do_install,
and adding a dependency of do_package[depends] += "virtual/kernel:do_install"
to perf. The whole thing needs a good write up, the corner cases testing
and probably a good dose of cleanup to the remaining code.
(From OE-Core rev: 3b3f7e785e27990ba21bc7cd97289c826a9a95d1)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/kernel.bbclass')
-rw-r--r-- | meta/classes/kernel.bbclass | 91 |
1 files changed, 3 insertions, 88 deletions
diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass index 70ed95bbe0..bca34f4698 100644 --- a/meta/classes/kernel.bbclass +++ b/meta/classes/kernel.bbclass | |||
@@ -3,6 +3,8 @@ inherit linux-kernel-base kernel-module-split | |||
3 | PROVIDES += "virtual/kernel" | 3 | PROVIDES += "virtual/kernel" |
4 | DEPENDS += "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}gcc kmod-native depmodwrapper-cross bc-native" | 4 | DEPENDS += "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}gcc kmod-native depmodwrapper-cross bc-native" |
5 | 5 | ||
6 | S = "${STAGING_DIR_TARGET}/${KERNEL_SRC_PATH}" | ||
7 | |||
6 | # we include gcc above, we dont need virtual/libc | 8 | # we include gcc above, we dont need virtual/libc |
7 | INHIBIT_DEFAULT_DEPS = "1" | 9 | INHIBIT_DEFAULT_DEPS = "1" |
8 | 10 | ||
@@ -55,7 +57,7 @@ KERNEL_IMAGEDEST = "boot" | |||
55 | # | 57 | # |
56 | export CMDLINE_CONSOLE = "console=${@d.getVar("KERNEL_CONSOLE",1) or "ttyS0"}" | 58 | export CMDLINE_CONSOLE = "console=${@d.getVar("KERNEL_CONSOLE",1) or "ttyS0"}" |
57 | 59 | ||
58 | KERNEL_VERSION = "${@get_kernelversion('${B}')}" | 60 | KERNEL_VERSION = "${@get_kernelversion_headers('${B}')}" |
59 | 61 | ||
60 | KERNEL_LOCALVERSION ?= "" | 62 | KERNEL_LOCALVERSION ?= "" |
61 | 63 | ||
@@ -221,93 +223,6 @@ kernel_do_install() { | |||
221 | # | 223 | # |
222 | 224 | ||
223 | echo "${KERNEL_VERSION}" > $kerneldir/kernel-abiversion | 225 | 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 | } | 226 | } |
312 | do_install[prefuncs] += "package_get_auto_pr" | 227 | do_install[prefuncs] += "package_get_auto_pr" |
313 | 228 | ||