Patchwork [2/2] kernel.bbclass: Stop bundle_initramfs thwarting sstate cache and fix race

login
register
mail settings
Submitter Mike Crowe
Date Nov. 22, 2013, 2:04 p.m.
Message ID <1385129059-941-3-git-send-email-mac@mcrowe.com>
Download mbox | patch
Permalink /patch/62233/
State New
Headers show

Comments

Mike Crowe - Nov. 22, 2013, 2:04 p.m.
The new do_bundle_initramfs task defeats using the sstate cache. The kernel
is resurrected from the sstate cache but ends up being built again since
do_bundle_initramfs depends on do_compile. The do_bundle_initramfs task is
also marked nostamp which means it will always run.

The plan is to run do_bundle_initramfs before do_deploy and then move the
code to update the deploy directory to do_deploy but make it write to
${DEPLOYDIR} rather then ${DEPLOY_DIR_IMAGE}.

do_bundle_initramfs can also race against do_install since both call into
the kernel build system. This is fixed by making do_bundle_initramfs run
after do_install (and this therefore also fixes the problem that
3baa63b4d588c3262254528b406ede265dd117bf was addressing.)

Signed-off-by: Mike Crowe <mcrowe@brightsign.biz>
---
 meta/classes/kernel.bbclass |   24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

Patch

diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index ba13e67..4974507 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -134,25 +134,14 @@  do_bundle_initramfs () {
 		echo "There is kernel image bundled with initramfs: ${B}/${KERNEL_OUTPUT}.initramfs"
 		install -m 0644 ${B}/${KERNEL_OUTPUT}.initramfs ${D}/boot/${KERNEL_IMAGETYPE}-initramfs-${MACHINE}.bin
 		echo "${B}/${KERNEL_OUTPUT}.initramfs"
-		cd ${B}
-		# Update deploy directory
-		if [ -e "${KERNEL_OUTPUT}.initramfs" ]; then
-			echo "Copying deploy kernel-initramfs image and setting up links..."
-			initramfs_base_name=${INITRAMFS_BASE_NAME}
-			initramfs_symlink_name=${KERNEL_IMAGETYPE}-initramfs-${MACHINE}
-			install -m 0644 ${KERNEL_OUTPUT}.initramfs ${DEPLOY_DIR_IMAGE}/${initramfs_base_name}.bin
-			cd ${DEPLOY_DIR_IMAGE}
-			ln -sf ${initramfs_base_name}.bin ${initramfs_symlink_name}.bin
-		fi
 	fi
 }
-do_bundle_initramfs[nostamp] = "1"
 
 python do_devshell_prepend () {
     os.environ["LDFLAGS"] = ''
 }
 
-addtask bundle_initramfs after do_compile before do_build
+addtask bundle_initramfs after do_install before do_deploy
 
 kernel_do_compile() {
 	unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
@@ -479,6 +468,17 @@  kernel_do_deploy() {
 	ln -sf ${KERNEL_IMAGE_BASE_NAME}.bin ${DEPLOYDIR}/${KERNEL_IMAGETYPE}
 
 	cp ${COREBASE}/meta/files/deploydir_readme.txt ${DEPLOYDIR}/README_-_DO_NOT_DELETE_FILES_IN_THIS_DIRECTORY.txt
+
+	cd ${B}
+	# Update deploy directory
+	if [ -e "${KERNEL_OUTPUT}.initramfs" ]; then
+		echo "Copying deploy kernel-initramfs image and setting up links..."
+		initramfs_base_name=${INITRAMFS_BASE_NAME}
+		initramfs_symlink_name=${KERNEL_IMAGETYPE}-initramfs-${MACHINE}
+		install -m 0644 ${KERNEL_OUTPUT}.initramfs ${DEPLOYDIR}/${initramfs_base_name}.bin
+		cd ${DEPLOYDIR}
+		ln -sf ${initramfs_base_name}.bin ${initramfs_symlink_name}.bin
+	fi
 }
 do_deploy[dirs] = "${DEPLOYDIR} ${B}"
 do_deploy[prefuncs] += "package_get_auto_pr"