[OE-core] [PATCH] rootfs_ipk, image: Add debug capture support

Richard Purdie richard.purdie at linuxfoundation.org
Tue Oct 2 11:12:26 UTC 2012


On Tue, 2012-10-02 at 10:20 +0100, Phil Blundell wrote:
> If ${IMAGE_BUILD_DEBUG} is set, construct a parallel tree containing
> the debug data for the packages that have been installed in the
> rootfs, then tar it up and deploy it alongside the rootfs images.
> 
> Signed-off-by: Phil Blundell <philb at gnu.org>
> ---
>  meta/classes/image.bbclass      |    9 +++++++++
>  meta/classes/rootfs_ipk.bbclass |   15 +++++++++++++++
>  meta/conf/bitbake.conf          |    1 +
>  3 files changed, 25 insertions(+)
> 
> diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
> index ab212b3..c82fba1 100644
> --- a/meta/classes/image.bbclass
> +++ b/meta/classes/image.bbclass
> @@ -445,3 +445,12 @@ do_package_write_deb[noexec] = "1"
>  do_package_write_rpm[noexec] = "1"
>  
>  addtask rootfs before do_build
> +
> +fakeroot do_capture_debug() {
> +	if [ "${IMAGE_BUILD_DEBUG}" = "1" -a -n "${IMAGE_ROOTFS_DBG}" -a -d "${IMAGE_ROOTFS_DBG}" ]; then
> +		tar czf ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.debug.tar.gz -C ${IMAGE_ROOTFS_DBG} .
> +		[ "${IMAGE_NAME}" == "${IMAGE_LINK_NAME}" ] || ln -sf ${IMAGE_NAME}.debug.tar.gz ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.debug.tar.gz
> +	fi
> +}
> +
> +addtask capture_debug before do_build after do_rootfs
> diff --git a/meta/classes/rootfs_ipk.bbclass b/meta/classes/rootfs_ipk.bbclass
> index 46e8d60..e4e74dd 100644
> --- a/meta/classes/rootfs_ipk.bbclass
> +++ b/meta/classes/rootfs_ipk.bbclass
> @@ -9,6 +9,8 @@ EXTRAOPKGCONFIG ?= ""
>  ROOTFS_PKGMANAGE = "opkg opkg-collateral ${EXTRAOPKGCONFIG}"
>  ROOTFS_PKGMANAGE_BOOTSTRAP  = "run-postinsts"
>  
> +IMAGE_BUILD_DEBUG ?= "0"
> +
>  do_rootfs[depends] += "opkg-native:do_populate_sysroot opkg-utils-native:do_populate_sysroot"
>  do_rootfs[recrdeptask] += "do_package_write_ipk"
>  
> @@ -17,6 +19,7 @@ do_rootfs[lockfiles] += "${WORKDIR}/ipk.lock"
>  IPKG_ARGS = "-f ${IPKGCONF_TARGET} -o ${IMAGE_ROOTFS} --force-overwrite"
>  # The _POST version also works when constructing the matching SDK
>  IPKG_ARGS_POST = "-f ${IPKGCONF_TARGET} -o $INSTALL_ROOTFS_IPK --force-overwrite"
> +IPKG_ARGS_DBG = "-f ${IPKGCONF_TARGET} -o ${IMAGE_ROOTFS_DBG} --force-overwrite"
>  
>  OPKG_PREPROCESS_COMMANDS = "package_update_index_ipk; package_generate_ipkg_conf"
>  
> @@ -88,6 +91,18 @@ fakeroot rootfs_ipk_do_rootfs () {
>  		fi
>  	fi
>  
> +	if [ "${IMAGE_BUILD_DEBUG}" = "1" -a -n "${IMAGE_ROOTFS_DBG}" ]; then
> +		all_pkgs=`opkg-cl ${IPKG_ARGS} list-installed | awk '{ print $1 }'`
> +		[ "${IMAGE_ROOTFS_DBG}" -ef "${IMAGE_ROOTFS}" ] || rm -rf ${IMAGE_ROOTFS_DBG}
> +		mkdir -p ${IMAGE_ROOTFS_DBG}${opkglibdir}
> +		opkg-cl ${IPKG_ARGS_DBG} update
> +		for p in $all_pkgs; do
> +	    		if [ "`opkg-cl ${IPKG_ARGS_DBG} info $p-dbg`" != "" ]; then
> +	    			opkg-cl ${IPKG_ARGS_DBG} --nodeps install $p-dbg
> +			fi
> +		done
> +	fi
> +
>  	install -d ${IMAGE_ROOTFS}/${sysconfdir}
>  	echo ${BUILDNAME} > ${IMAGE_ROOTFS}/${sysconfdir}/version
>  

Hasn't Paul added a general mechanism for doing this so we could add
this feature a level higher so that it could be used by all packaging
formats?

I'm a little concerned that the different backends are getting totally
different sets of features at this point. In some cases we have very
good reasons for it but that doesn't appear to be the case here.

Cheers,

Richard






More information about the Openembedded-core mailing list