[OE-core] [PATCH] kernel.bbclass, image.bbclass: Implement kernel INITRAMFS dependency and bundling

Richard Purdie richard.purdie at linuxfoundation.org
Wed Nov 20 17:14:27 UTC 2013


On Wed, 2013-11-20 at 17:04 +0000, Mike Crowe wrote:
> This patch 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. (Note that Richard Purdie's bitbake fix in
> http://git.openembedded.org/bitbake/commit/?h=master-next&id=f21910157d873c030b149c4cdc5b57c5062ab5a6
> is required for it to even work that well.)
> 
> When testing I also found that do_bundle_initramfs could race against
> do_install so I think that do_bundle_initramfs needs to be run after
> do_install.
> 
> Here's my RFC patch to ensure that the sstate cache continues to be used
> effectively. 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}.
>
> In my limited testing this seems to make the sstate cache work effectively
> when INITRAMFS_IMAGE_BUNDLE="1" but I think it needs someone who actually
> uses this feature to test the patch and point out what I've got wrong
> before it can be merged.

This looks like the right thing to be doing, tasks should not be poking
into DEPLOY_DIR_IMAGE themselves as that bypasses sstate.

We need to kill the do_bundle_initramfs[nostamp] = "1" too.

Cheers,

Richard


> 
> diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
> index 6959aa1..0ba0044 100644
> --- a/meta/classes/kernel.bbclass
> +++ b/meta/classes/kernel.bbclass
> @@ -134,16 +134,6 @@ 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"
> @@ -152,7 +142,7 @@ 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 +469,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"
> 
> 
> Mike.
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core at lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core





More information about the Openembedded-core mailing list