Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Phil Blundell <philb@gnu.org>
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [PATCH] rootfs_ipk, image: Add debug capture support
Date: Tue, 02 Oct 2012 12:12:26 +0100	[thread overview]
Message-ID: <1349176346.15753.139.camel@ted> (raw)
In-Reply-To: <1349169606.32611.73.camel@phil-desktop>

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@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





  reply	other threads:[~2012-10-02 11:25 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-02  9:20 [PATCH] rootfs_ipk, image: Add debug capture support Phil Blundell
2012-10-02 11:12 ` Richard Purdie [this message]
2012-10-02 11:15   ` Phil Blundell
2012-10-02 11:38     ` Richard Purdie
2012-10-02 13:42       ` Otavio Salvador
2012-10-02 13:51         ` Phil Blundell
2012-10-02 13:53           ` Otavio Salvador
2012-10-02 13:52             ` Martin Ertsås
2012-10-02 13:59               ` Otavio Salvador
2012-10-02 13:57                 ` Martin Ertsås
2012-10-02 14:02                   ` Otavio Salvador
2012-10-02 13:50       ` Phil Blundell
2013-04-25 11:12       ` Phil Blundell
2013-04-25 11:21         ` Martin Jansa
2013-04-25 13:47         ` Mark Hatle
2013-04-26 13:57           ` Phil Blundell
2013-04-26 14:16             ` Mark Hatle
2013-04-26 14:27               ` Phil Blundell
2013-04-26 14:39                 ` Mark Hatle
2013-04-26 14:41                   ` Phil Blundell
2013-04-26 14:50                     ` Otavio Salvador
2013-04-26 16:05                       ` Mark Hatle
2013-04-27 21:15         ` Chris Larson
2013-04-29 20:10           ` Debug Packaging (was: rootfs_ipk, image: Add debug capture support) Richard Purdie
2013-04-30 10:45             ` Phil Blundell
2013-04-30 15:24             ` Debug Packaging Mark Hatle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1349176346.15753.139.camel@ted \
    --to=richard.purdie@linuxfoundation.org \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=philb@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox