All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Korsgaard <peter@korsgaard.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH next v8 1/6] core: implement per-package SDK and target
Date: Fri, 29 Nov 2019 15:20:33 +0100	[thread overview]
Message-ID: <87muceahn2.fsf@dell.be.48ers.dk> (raw)
In-Reply-To: <20191105164646.23820-2-thomas.petazzoni@bootlin.com> (Thomas Petazzoni's message of "Tue, 5 Nov 2019 17:46:40 +0100")

>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@bootlin.com> writes:

 > This commit implements the core of the move to per-package SDK and
 > target directories. The main idea is that instead of having a global
 > output/host and output/target in which all packages install files, we
 > switch to per-package host and target directories, that only contain
 > their explicit dependencies.

 > There are two main benefits:

 >  - Packages will now see only the dependencies they explicitly list in
 >    their <pkg>_DEPENDENCIES variable, and the recursive dependencies
 >    thereof.

 >  - We can support top-level parallel build properly, because a package
 >    only "sees" its own host directory and target directory, isolated
 >    from the build of other packages that can happen in parallel.

 > It works as follows:

 >  - A new output/per-package/ directory is created, which will contain
 >    one sub-directory per package, and inside it, a "host" directory
 >    and a "target" directory:

 >    output/per-package/busybox/target
 >    output/per-package/busybox/host
 >    output/per-package/host-fakeroot/target
 >    output/per-package/host-fakeroot/host

 >    This output/per-package/ directory is PER_PACKAGE_DIR.

 >  - The global TARGET_DIR and HOST_DIR variable now automatically point
 >    to the per-package directory when PKG is defined. So whenever a
 >    package references $(HOST_DIR) or $(TARGET_DIR) in its build
 >    process, it effectively references the per-package host/target
 >    directories. Note that STAGING_DIR is a sub-dir of HOST_DIR, so it
 >    is handled as well.

 >  - Of course, packages have dependencies, so those dependencies must
 >    be installed in the per-package host and target directories. To do
 >    so, we simply rsync (using hard links to save space and time) the
 >    host and target directories of the direct dependencies of the
 >    package to the current package host and target directories.

 >    We only need to take care of direct dependencies (and not
 >    recursively all dependencies), because we accumulate into those
 >    per-package host and target directories the files installed by the
 >    dependencies. Note that this only works because we make the
 >    assumption that one package does *not* overwrite files installed by
 >    another package.

 >    This is done for "extract dependencies" at the beginning of the
 >    extract step, and for "normal dependencies" at the beginning of the
 >    configure step.

 > This is basically enough to make per-package SDK and target work. The
 > only gotcha is that at the end of the build, output/target and
 > output/host are empty, which means that:

 >  - The filesystem image creation code cannot work.

 >  - We don't have a SDK to build code outside of Buildroot.

 > In order to fix this, this commit extends the target-finalize step so
 > that it starts by populating output/target and output/host by
 > rsync-ing into them the target and host directories of all packages
 > listed in the $(PACKAGES) variable. It is necessary to do this
 > sequentially in the target-finalize step and not in each
 > package. Doing it in package installation means that it can be done in
 > parallel. In that case, there is a chance that two rsyncs are creating
 > the same hardlink or directory at the same time, which makes one of
 > them fail.

 > This change to per-package directories has an impact on the RPATH
 > built into the host binaries, as those RPATH now point to various
 > per-package host directories, and no longer to the global host
 > directory. We do not try to rewrite such RPATHs during the build as
 > having such RPATHs is perfectly fine, but we still need to handle two
 > fallouts from this change:

 >  - The check-host-rpath script, which verifies at the end of each
 >    package installation that it has the appropriate RPATH, is modified
 >    to understand that a RPATH to $(PER_PACKAGE_DIR)/<pkg>/host/lib is
 >    a correct RPAT.

 >  - The fix-rpath script, which mungles the RPATH mainly for the SDK
 >    preparation, is modified to rewrite the RPATH to not point to
 >    per-package directories. Indeed the patchelf --make-rpath-relative
 >    call only works if the RPATH points to the ROOTDIR passed as
 >    argument, and this ROOTDIR is the global host directory. Rewriting
 >    the RPATH to not point to per-package host directories prior to
 >    this is an easy solution to this issue.

 > Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>

I think it is finally time to get this merged - Committed to next,
thanks!

-- 
Bye, Peter Korsgaard

  reply	other threads:[~2019-11-29 14:20 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-05 16:46 [Buildroot] [PATCH next v8 0/6] Top-level parallel build support Thomas Petazzoni
2019-11-05 16:46 ` [Buildroot] [PATCH next v8 1/6] core: implement per-package SDK and target Thomas Petazzoni
2019-11-29 14:20   ` Peter Korsgaard [this message]
2023-11-10 14:12   ` [Buildroot] [BUG?] per-package not fully working with dependencies and rebuild John Ernberg
2019-11-05 16:46 ` [Buildroot] [PATCH next v8 2/6] Makefile: allow top-level parallel build with BR2_PER_PACKAGE_DIRECTORIES=y Thomas Petazzoni
2019-11-29 14:20   ` Peter Korsgaard
2019-11-05 16:46 ` [Buildroot] [PATCH next v8 3/6] package/pkg-generic: make libtool .la files compatible with per-package directories Thomas Petazzoni
2019-11-20 20:22   ` Matthew Weber
2019-11-29 14:24   ` Peter Korsgaard
2019-11-05 16:46 ` [Buildroot] [PATCH next v8 4/6] package/pkg-kconfig: handle KCONFIG_DEPENDENCIES " Thomas Petazzoni
2019-11-29 14:39   ` Peter Korsgaard
2019-11-05 16:46 ` [Buildroot] [PATCH next v8 5/6] docs/manual: add details about top-level parallel build support Thomas Petazzoni
2019-11-29 14:43   ` Peter Korsgaard
2019-11-05 16:46 ` [Buildroot] [PATCH next v8 6/6] docs/manual: document the effect of per-package directory on variables Thomas Petazzoni
2019-11-29 14:43   ` Peter Korsgaard
2019-11-06 19:37 ` [Buildroot] [PATCH next v8 0/6] Top-level parallel build support Bernd Kuhls

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=87muceahn2.fsf@dell.be.48ers.dk \
    --to=peter@korsgaard.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.