summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrea Adami <andrea.adami@gmail.com>2011-07-12 00:33:11 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-07-12 15:08:20 +0100
commitf8bf4e2b16f5b36187a966f5bc9121033f038e90 (patch)
tree1c4bac96512b7e1774ce5871abb1e96620b5b01a
parent9534a96a63ecd08b55e56cf0368d2580ed2ed8b2 (diff)
downloadpoky-f8bf4e2b16f5b36187a966f5bc9121033f038e90.tar.gz
kernel.bbclass: handle embedding of initramfs images
* "All 2.6 Linux kernels contain a gzipped "cpio" format archive, which is * extracted into rootfs when the kernel boots up." * (http://www.kernel.org/doc/Documentation/filesystems/ramfs-rootfs-initramfs.txt) * * In some cases it can be useful to take advantage of this ability and embed your * customized rootfs ("the move to early userspace is necessary because finding * and mounting the real root device is complex"). * * Therefore, some code was added and since 2009 OpenEmbedded metadata * provides a convenient way to include your initramfs by setting * INITRAMFS_IMAGE = "your_initramfs_image.bb" * and specifying the chosen output format in the initramfs image recipe, e.g. * IMAGE_FSTYPES = "cpio.gz cpio.lzma" * * * Patch was imported from the OpenEmbedded git server * (git://git.openembedded.org/openembedded) * * Add satndalone task "builtin_initramfs". * commit 72761e468bb3e905459f2b81ce1bc4d80419481f * (From OE-Core rev: 19bda7f2c2dac6363468a49295c38f2095c67c98) Signed-off-by:Paul Sokolovsky <pmiscml@gmail.com> * * 'Remove usage of non-standard variables (DEPLOY_TO) and random renaming * of output.' * commit 456ba7ffd159821e86ad7ad4b66ec7d5790bd054 * Richard Purdie <rpurdie@rpsys.net> * * 'Fis typo in do_builtin_initramfs.' * commit 37f2fe4b801df832e93553a08eff24fec736c7d4 * Signed-off-by:Paul Sokolovsky <pmiscml@gmail.com> * * 'comment initramfs stuff till rootfs locking works properly (initramfs * should be optional as well)' * commit 2818d8b7be1a0d9a59ad3528091d47517d59328b * Signed-off-by: Koen Kooi <koen@openembedded.org> * * 'get initramfs stuff working * commit 1642b3e8fc81c666713951fdd4e7ff9a50d1c5a8 * Signed-off-by: Thomas Kunze <thommycheck@gmx.de> * * 'Fix INITRAMFS logic to stop breaking builds for people not using it' * commit dcf3049eb9eedf0838af59969b3f70a43298d3d7 * Signed-off-by: Richard Purdie <rpurdie@rpsys.net> * * '-change initramfs-logic' * commit 3e3f297457138e96e2b652658675796853eb0293 * Signed-off-by: Thomas Kunze <thommycheck@gmx.de> * * 'move initramfs stuff to configure so we can do postprocessing * on it with do_configure_append' * commit fc03e2be0b4470748a8b7707cea7293303adc424 * Signed-off-by: Koen Kooi <koen@openembedded.org> * * 'copy gz, lzo, lzma initramfs cpio images.' * commit 572abc3fdd1076ca35d8c15d269cc9d862101805 * Signed-off-by: Andrea Adami <andrea.adami@gmail.com> * * 'move the kernel size check to linux-kexecboot.inc.' * commit 45f82a941c77e9d747814fa1e337ba803475d327 * Signed-off-by: Andrea Adami <andrea.adami@gmail.com> * * Finally, two refinements as discussed on openembedded-core * mailing list: * - replace "if image != '' and image is not None:" with "if image" * - add cpio.xz support Signed-off-by: Andrea Adami <andrea.adami@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/kernel.bbclass16
1 files changed, 16 insertions, 0 deletions
diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index 943252ab99..1a71df64ba 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -7,6 +7,8 @@ DEPENDS += "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}depmod virtual/$
7INHIBIT_DEFAULT_DEPS = "1" 7INHIBIT_DEFAULT_DEPS = "1"
8 8
9KERNEL_IMAGETYPE ?= "zImage" 9KERNEL_IMAGETYPE ?= "zImage"
10INITRAMFS_IMAGE ?= ""
11INITRAMFS_TASK ?= ""
10 12
11python __anonymous () { 13python __anonymous () {
12 kerneltype = bb.data.getVar('KERNEL_IMAGETYPE', d, 1) or '' 14 kerneltype = bb.data.getVar('KERNEL_IMAGETYPE', d, 1) or ''
@@ -14,6 +16,10 @@ python __anonymous () {
14 depends = bb.data.getVar("DEPENDS", d, 1) 16 depends = bb.data.getVar("DEPENDS", d, 1)
15 depends = "%s u-boot-mkimage-native" % depends 17 depends = "%s u-boot-mkimage-native" % depends
16 bb.data.setVar("DEPENDS", depends, d) 18 bb.data.setVar("DEPENDS", depends, d)
19
20 image = bb.data.getVar('INITRAMFS_IMAGE', d, True)
21 if image:
22 bb.data.setVar('INITRAMFS_TASK', '${INITRAMFS_IMAGE}:do_rootfs', d)
17} 23}
18 24
19inherit kernel-arch deploy 25inherit kernel-arch deploy
@@ -179,8 +185,18 @@ kernel_do_configure() {
179 cp "${WORKDIR}/defconfig" "${S}/.config" 185 cp "${WORKDIR}/defconfig" "${S}/.config"
180 fi 186 fi
181 yes '' | oe_runmake oldconfig 187 yes '' | oe_runmake oldconfig
188
189 if [ ! -z "${INITRAMFS_IMAGE}" ]; then
190 for img in cpio.gz cpio.lzo cpio.lzma cpio.xz; do
191 if [ -e "${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.$img"
192 cp "${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.$i
193 fi
194 done
195 fi
182} 196}
183 197
198kernel_do_configure[depends] += "${INITRAMFS_TASK}"
199
184do_menuconfig() { 200do_menuconfig() {
185 export DISPLAY='${DISPLAY}' 201 export DISPLAY='${DISPLAY}'
186 export DBUS_SESSION_BUS_ADDRESS='${DBUS_SESSION_BUS_ADDRESS}' 202 export DBUS_SESSION_BUS_ADDRESS='${DBUS_SESSION_BUS_ADDRESS}'