Skip to content

Conversation

@wking
Copy link
Contributor

@wking wking commented Sep 21, 2017

This PR also includes a number of other rootfs-builder improvements; details in the commit messages.

We can build tarballs for other platforms if we get access to a box that can run the target busybox binary, because part of the extraction process is asking the extracted busybox what commands it supports.

Builds on #478; review that first.

Before this commit, attempting to list the commands using a busybox
binary built for another platform would result in:

  sh: rootfs/bin/busybox: cannot execute binary file: Exec format error

but not cause Make to abort.  Now Make reports an error on such
failures (and also on link failures).

Signed-off-by: W. Trevor King <wking@tremily.us>
There won't be any for a successful run, because the busybox rule
clears out the directory.  But there may be some symlinks already if
you're running after the echo rule failed for whatever reason.  This
change makes those echo re-runs more robust.

Signed-off-by: W. Trevor King <wking@tremily.us>
The new Make handling is using:

* Default values [1] for ARCHES ?= amd64
* Substitution references [2] for $(ARCHES:%=rootfs-%.tar.gz).
* % [3] and $* [4] for pattern rules like rootfs-%.tar.gz.
* .PRECIOUS [5] to avoid errors like:

    rm downloads/stage3-amd64-current.tar.bz2 rootfs/amd64/bin/busyboxmake: unlink: rootfs/amd64/bin/busybox: Permission denied
    rootfs/amd64/bin/echomake: unlink: rootfs/amd64/bin/echo: Permission denied

  when Make completes.

Where Gentoo's architecture names don't match, the per-platform
tarballs should be renamed to use the Go names [6] when copying into
the root project directory.

[1]: https://www.gnu.org/software/make/manual/html_node/Setting.html#Setting
[2]: https://www.gnu.org/software/make/manual/html_node/Substitution-Refs.html
[3]: https://www.gnu.org/software/make/manual/html_node/Pattern-Rules.html
[4]: https://www.gnu.org/software/make/manual/html_node/Automatic-Variables.html
[5]: https://www.gnu.org/software/make/manual/html_node/Special-Targets.html#index-precious-targets
[6]: https://golang.org/doc/install/source#introduction

Signed-off-by: W. Trevor King <wking@tremily.us>
And use the appropriate one for the current architecture.

Renaming the old 'runtime' -> 'runtimeCommand' avoids clobbering the
runtime package name.  Renaming our local variable to match what
container.go is using seemed like a better choice than inventing a
custom name for the local package import.

Signed-off-by: W. Trevor King <wking@tremily.us>
@wking
Copy link
Contributor Author

wking commented Sep 21, 2017

Rebased onto master with cec5f49afcac88 now that #472 and #478 have landed.

This was extracted with from stage3-i486-20170919.tar.bz2.  The stage3
had a SHA512 hash of [1] and a valid signature by [2].

Generated with:

  $ cd contrib/rootfs-builder
  $ make ARCHES=i486
  $ cp -f rootfs-i486.tar.gz ../../rootfs-386.tar.gz

[1]: 9e007ef33f5aef6f70b7e263ed66e7679479261758ac34f61e5a2558de7559eb9a7fdbb31264bbeba09bfcc06df57263592d986393051bac5cd432c1228b65f0
[2]: Gentoo Linux Release Engineering (Automated Weekly Release Key) <releng@gentoo.org>
     Primary key fingerprint: 13EB BDBE DE7A 1277 5DFD  B1BA BB57 2E0E 2D18 2910

Signed-off-by: W. Trevor King <wking@tremily.us>
@wking wking changed the title root-*.tar.gz: Add per-arch tarballs (currently for amd64 and 386) rootfs-*.tar.gz: Add per-arch tarballs (currently for amd64 and 386) Sep 21, 2017
@Mashimiao
Copy link

Mashimiao commented Sep 22, 2017

LGTM

Approved with PullApprove

1 similar comment
@mrunalp
Copy link
Contributor

mrunalp commented Sep 28, 2017

LGTM

Approved with PullApprove

@mrunalp mrunalp merged commit 02b49ac into opencontainers:master Sep 28, 2017
@wking wking deleted the per-arch-tarballs branch September 28, 2017 23:43
wking added a commit to wking/ocitools-v2 that referenced this pull request Mar 9, 2018
I'm not sure when the change happened (sometime since ff5e578,
contrib/rootfs-builder: Support multiple architectures, 2017-09-20,
opencontainers#479), but Gentoo is now using timestamps and xz compression for their
amd64 stage3:

  $ curl http://distfiles.gentoo.org/releases/amd64/autobuilds/latest-stage3.txt
  # Latest as of Fri, 09 Mar 2018 15:00:02 +0000
  # ts=1520607602
  20180308T214502Z/stage3-amd64-20180308T214502Z.tar.xz 188851072
  20180308T214502Z/hardened/stage3-amd64-hardened-20180308T214502Z.tar.xz 174759140
  20180308T214502Z/hardened/stage3-amd64-hardened+nomultilib-20180308T214502Z.tar.xz 167639136
  20180301T214503Z/hardened/stage3-amd64-hardened-selinux-20180301T214503Z.tar.xz 187319664
  20180308T214502Z/stage3-amd64-nomultilib-20180308T214502Z.tar.xz 181866296
  20180303/systemd/stage3-amd64-systemd-20180303.tar.bz2 281873162
  20180225/uclibc/stage3-amd64-uclibc-hardened-20180225.tar.bz2 57147392
  20180225/uclibc/stage3-amd64-uclibc-vanilla-20180225.tar.bz2 144490332
  20180308T214502Z/stage3-x32-20180308T214502Z.tar.xz 205285160
  20180308T214502Z/hardened/stage4-amd64-hardened+minimal-20180308T214502Z.tar.bz2 261776436
  20180308T214502Z/hardened/stage4-amd64-hardened+minimal-nomultilib-20180308T214502Z.tar.bz2 251821245
  20180308T214502Z/stage4-amd64-minimal-20180308T214502Z.tar.bz2 280918565
  20180308T214502Z/stage4-amd64-minimal-nomultilib-20180308T214502Z.tar.bz2 268835860
  20180303/systemd/stage4-amd64-systemd-20180303.tar.bz2 622067712

This commit adapts to that change, allowing us to continue to pull the
vanilla stage3-amd64-20180308T214502Z.tar.xz.

Signed-off-by: W. Trevor King <wking@tremily.us>
wking added a commit to wking/ocitools-v2 that referenced this pull request Mar 9, 2018
I'm not sure when the change happened (sometime since ff5e578,
contrib/rootfs-builder: Support multiple architectures, 2017-09-20,
opencontainers#479), but Gentoo is now using timestamps for some amd64 stages:

  $ curl http://distfiles.gentoo.org/releases/amd64/autobuilds/latest-stage3.txt
  # Latest as of Fri, 09 Mar 2018 15:00:02 +0000
  # ts=1520607602
  20180308T214502Z/stage3-amd64-20180308T214502Z.tar.xz 188851072
  20180308T214502Z/hardened/stage3-amd64-hardened-20180308T214502Z.tar.xz 174759140
  20180308T214502Z/hardened/stage3-amd64-hardened+nomultilib-20180308T214502Z.tar.xz 167639136
  20180301T214503Z/hardened/stage3-amd64-hardened-selinux-20180301T214503Z.tar.xz 187319664
  20180308T214502Z/stage3-amd64-nomultilib-20180308T214502Z.tar.xz 181866296
  20180303/systemd/stage3-amd64-systemd-20180303.tar.bz2 281873162
  20180225/uclibc/stage3-amd64-uclibc-hardened-20180225.tar.bz2 57147392
  20180225/uclibc/stage3-amd64-uclibc-vanilla-20180225.tar.bz2 144490332
  ...

Signed-off-by: W. Trevor King <wking@tremily.us>
wking added a commit to wking/ocitools-v2 that referenced this pull request Mar 9, 2018
I'm not sure when the change happened (sometime since ff5e578,
contrib/rootfs-builder: Support multiple architectures, 2017-09-20,
opencontainers#479), but Gentoo is now using xz compression for some amd64 stages:

  $ curl http://distfiles.gentoo.org/releases/amd64/autobuilds/latest-stage3.txt
  # Latest as of Fri, 09 Mar 2018 15:00:02 +0000
  # ts=1520607602
  20180308T214502Z/stage3-amd64-20180308T214502Z.tar.xz 188851072
  20180308T214502Z/hardened/stage3-amd64-hardened-20180308T214502Z.tar.xz 174759140
  20180308T214502Z/hardened/stage3-amd64-hardened+nomultilib-20180308T214502Z.tar.xz 167639136
  20180301T214503Z/hardened/stage3-amd64-hardened-selinux-20180301T214503Z.tar.xz 187319664
  20180308T214502Z/stage3-amd64-nomultilib-20180308T214502Z.tar.xz 181866296
  20180303/systemd/stage3-amd64-systemd-20180303.tar.bz2 281873162
  20180225/uclibc/stage3-amd64-uclibc-hardened-20180225.tar.bz2 57147392
  20180225/uclibc/stage3-amd64-uclibc-vanilla-20180225.tar.bz2 144490332
  20180308T214502Z/stage3-x32-20180308T214502Z.tar.xz 205285160
  20180308T214502Z/hardened/stage4-amd64-hardened+minimal-20180308T214502Z.tar.bz2 261776436
  20180308T214502Z/hardened/stage4-amd64-hardened+minimal-nomultilib-20180308T214502Z.tar.bz2 251821245
  20180308T214502Z/stage4-amd64-minimal-20180308T214502Z.tar.bz2 280918565
  20180308T214502Z/stage4-amd64-minimal-nomultilib-20180308T214502Z.tar.bz2 268835860
  20180303/systemd/stage4-amd64-systemd-20180303.tar.bz2 622067712

This commit adapts to that change, allowing us to continue to pull the
vanilla stage3-amd64-20180308T214502Z.tar.xz.

Signed-off-by: W. Trevor King <wking@tremily.us>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants