From: Trent Piepho <tpiepho@impinj.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] core/sdk: generate the SDK tarball ourselves
Date: Tue, 12 Jun 2018 17:47:38 +0000 [thread overview]
Message-ID: <1528825657.28705.168.camel@impinj.com> (raw)
In-Reply-To: <9ca7c9e9-061c-1dfb-f348-b92407b2f7e0@mind.be>
On Tue, 2018-06-12 at 15:30 +0200, Arnout Vandecappelle wrote:
>
> On 11-06-18 19:20, Trent Piepho wrote:
> > On Sun, 2018-06-10 at 23:21 +0200, Arnout Vandecappelle wrote:
> > >
> > > > .PHONY: sdk
> > > > -sdk: world
> > > > +sdk: world $(BR2_TAR_HOST_DEPENDENCY)
> > > > @$(call MESSAGE,"Rendering the SDK relocatable")
> > > > $(TOPDIR)/support/scripts/fix-rpath host
> > > > $(TOPDIR)/support/scripts/fix-rpath staging
> > > > $(INSTALL) -m 755 $(TOPDIR)/support/misc/relocate-sdk.sh $(HOST_DIR)/relocate-sdk.sh
> > > > mkdir -p $(HOST_DIR)/share/buildroot
> > > > echo $(HOST_DIR) > $(HOST_DIR)/share/buildroot/sdk-location
> > > > + $(Q)mkdir -p $(BINARIES_DIR)
> > > > + $(TAR) czf $(BINARIES_DIR)/buildroot-sdk.$(GNU_TARGET_NAME)-$(BR2_VERSION_FULL).tar.gz \
> > >
> > > Wouldn't it make more sense to make a .xz, or perhaps a .bz2? Although, that
> > > probably gives a significant hit to the build time. But since it's explicit in
> > > 'make sdk' I don't mind that much.
> > >
> >
> > I'm using the SDK with Docker. It can add tar.gz files into the
> > container, but now tar.xz. Having to recompress the archive would be a
> > significant increase in build time.
>
> Duh. Calling tar inside the container explicitly, rather than letting docker to
> the extract directly, isn't too much of a problem either, no?
I believe COPY + RUN ends up being more layers than just ADD. Though
current docker supports xz and bz2 so it would work to use a better
compression.
But, in the tests I've done on our vsphere system, using gz was still
fastest. I'm more interested in making the CI process faster than in
saving disk space.
>
> > > > + -C $(HOST_DIR) \
> > > > + --transform='s#^\.#buildroot-sdk.$(GNU_TARGET_NAME)-$(BR2_VERSION_FULL)#' \
> > >
> > > Perhaps move that "buildroot-sdk.$(GNU_TARGET_NAME)-$(BR2_VERSION_FULL)" into a
> > > variable?
> >
> > So having extracted an SDK, in an automated CI script, how does one use
> > it? I'll add it to the Docker container:
> >
> > ARG sdk_file
> > ENV SDK=/mnt/sdk
> > ADD --chown=user:user ${sdk_file} ${SDK}
>
> My docker-fu is not too great, but you can do something similar to expose the
> tarball directly, and then do
>
> RUN tar -xf ${sdk_file} --strip-components=1
>
> no?
It would be more like:
RUN dnf install -y tar
ARG sdk_file
ENV SDK=/mnt/sdk
COPY ${sdk_file} ${SDK}
RUN tar -xf ${SDK}/${sdk_file} -C ${SDK} --strip-components=1 --owner user:user
RUN rm ${SDK}/${sdk_file}
decompress option needs to be specified to tar, based on the compressor used.
This uses more layers.
> > Now it needs to be relocated. Something like:
> >
> > RUN cd ${SDK}/buildroot-sdk.arm-buildroot-linux-gnueabihf-2018.02-00035-ge588bdd3e8 && ./relocate-sdk.sh
>
> Here you could to
>
> RUN cd ${SDK}/buildroot-sdk.*/ && ./relocate-sdk.sh
Assumes only one directory will match the pattern. Would also require
the user of the SDK to do the same thing, assume the only directory in
${SDK} is the one they want and use a shell wildcard expansion to find
it. Which I admit could work, though I think it's a kludge. I needed
to do the same thing to find the sysroot location and compiler prefix
inside the SDK, and I think that's a kludge too, and wish buildroot put
a pointer in a known location in the sdk to where things in unknown
locations (sysroot) are. But I haven't gotten around to making a patch
to do that yet.
> That said, if you're building an SDK, it's probably because you're not changing
> it too often. As long as you're developing the Buildroot OS itself, there's
> generally no point generating the SDK. If you really are closely co-developing
> your application and the Buildroot OS, you're probably better of including the
> application as a package rather than building it externally.
The latter, both the SDK and the applications using the SDK change very
frequently. Which is why I'm so concerned about speed.
While the applications are buildroot packages as well, there are
downsides to doing development that way. So they exist as stand alone
packages that can be compiled outside of buildroot. No different than
any other package in buildroot in that regard.
But how to build a package stand alone in a CI process, in an
environment than can build it correctly, and also closely tracks the
image buildroot will make for the final product? Use the buildroot
SDK! So that's what I'm using it for.
next prev parent reply other threads:[~2018-06-12 17:47 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-09 21:06 [Buildroot] [PATCH] core/sdk: generate the SDK tarball ourselves Yann E. MORIN
2018-06-09 21:16 ` Yann E. MORIN
2018-06-10 6:03 ` Thomas Petazzoni
2018-06-10 7:47 ` Yann E. MORIN
2018-06-10 21:21 ` Arnout Vandecappelle
2018-06-11 17:20 ` Trent Piepho
2018-06-11 19:01 ` Thomas Petazzoni
2018-06-11 22:10 ` Trent Piepho
2018-06-12 9:57 ` Thomas Petazzoni
2018-06-12 17:11 ` Trent Piepho
2018-06-12 13:30 ` Arnout Vandecappelle
2018-06-12 17:47 ` Trent Piepho [this message]
2018-06-12 18:07 ` Stefan Becker
2018-06-12 19:01 ` Thomas Petazzoni
2018-06-12 19:25 ` Stefan Becker
2018-06-13 8:32 ` Andreas Naumann
2018-06-13 10:12 ` Arnout Vandecappelle
2018-06-13 15:46 ` Andreas Naumann
2018-06-13 9:47 ` Arnout Vandecappelle
2018-06-13 9:57 ` Thomas Petazzoni
2018-06-13 10:03 ` Stefan Becker
2018-06-13 11:58 ` Thomas Petazzoni
2018-06-15 18:27 ` Peter Korsgaard
2018-06-13 7:46 ` Arnout Vandecappelle
2018-06-13 7:59 ` Stefan Becker
2018-06-15 18:12 ` Peter Korsgaard
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=1528825657.28705.168.camel@impinj.com \
--to=tpiepho@impinj.com \
--cc=buildroot@busybox.net \
/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