summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Dale <richard.dale@codethink.co.uk>2015-02-26 14:42:06 +0000
committerRichard Dale <richard.dale@codethink.co.uk>2015-04-01 10:18:11 +0100
commit4dc82d03908d89dbb1b57837d968e0dfbe1a57cb (patch)
tree2774930e7ecf3a5fe87b3cfa21089dfd1f8d26fc
parent4b86588589b909bb6ea4bdfe275b8a34ae7ae74d (diff)
downloaddefinitions-4dc82d03908d89dbb1b57837d968e0dfbe1a57cb.tar.gz
Add a build-essential-musl stratum for the musl libc library
-rw-r--r--strata/build-essential-musl.morph380
-rw-r--r--strata/build-essential-musl/binutils.morph8
-rw-r--r--strata/build-essential-musl/busybox.morph124
-rw-r--r--strata/build-essential-musl/ccache.morph12
-rw-r--r--strata/build-essential-musl/fhs-dirs.morph50
-rw-r--r--strata/build-essential-musl/gawk.morph5
-rw-r--r--strata/build-essential-musl/gcc.morph51
-rw-r--r--strata/build-essential-musl/linux-api-headers.morph20
-rw-r--r--strata/build-essential-musl/m4-tarball.morph5
-rw-r--r--strata/build-essential-musl/make.morph5
-rw-r--r--strata/build-essential-musl/musl.morph9
-rw-r--r--strata/build-essential-musl/stage1-binutils.morph23
-rw-r--r--strata/build-essential-musl/stage1-gcc.morph78
-rw-r--r--strata/build-essential-musl/stage2-binutils.morph22
-rw-r--r--strata/build-essential-musl/stage2-busybox.morph109
-rw-r--r--strata/build-essential-musl/stage2-fake-bash.morph4
-rw-r--r--strata/build-essential-musl/stage2-fhs-dirs.morph52
-rw-r--r--strata/build-essential-musl/stage2-gawk.morph9
-rw-r--r--strata/build-essential-musl/stage2-gcc-fixed-headers.morph20
-rw-r--r--strata/build-essential-musl/stage2-gcc.morph82
-rw-r--r--strata/build-essential-musl/stage2-libstdc++.morph36
-rw-r--r--strata/build-essential-musl/stage2-linux-api-headers.morph20
-rw-r--r--strata/build-essential-musl/stage2-make.morph9
-rw-r--r--strata/build-essential-musl/stage2-musl.morph47
-rw-r--r--strata/build-essential-musl/stage2-reset-specs.morph22
-rw-r--r--strata/build-essential-musl/zlib.morph9
26 files changed, 1211 insertions, 0 deletions
diff --git a/strata/build-essential-musl.morph b/strata/build-essential-musl.morph
new file mode 100644
index 00000000..b0752dbe
--- /dev/null
+++ b/strata/build-essential-musl.morph
@@ -0,0 +1,380 @@
+name: build-essential-musl
+kind: stratum
+description: |
+ Toolchain stratum
+
+ Stage 1: build a minimal cross compiler with the host's tools.
+
+ Starting with a cross compiler ensures that (a) nothing from the host
+ can leak into the build-essential artifacts, and (b) cross-compiling
+ build-essential is fully tested and supported, since we always use the
+ cross code paths.
+
+ Stage 2: cross-build the whole of build-essential, using the host's tools
+ but the cross-compiler toolchain.
+
+ Stage 2 GCC outputs code for the same 'bootstrap' machine as stage 1 GCC,
+ but because stage 2 GCC is also built to *run* on the bootstrap machine
+ it can only execute inside the stage 3 chroot (due to being built against
+ a libc with a non-standard prefix).
+
+ Stage 3: build the whole of build-essential again, this time using a
+ staging area containing only the output of stage 2. The result of this
+ build is fully reproducible.
+
+ We do a switch-a-roo between stage 2 and 3: stages 2 chunks are all built
+ to run on a host *-bootstrap-* while stage 3 chunks are native-built for
+ a *-baserock-* machine. This works, because the cross build was all for
+ show (and cleanliness) and the binaries actually still run on the host.
+
+ After build-essential is built we do another trick. See
+ stage2-fhs-dirs.morph for details. Basically, /bin is a symlink to
+ /tools/bin during stage 2 but in stage 3 it becomes a real directory
+ again.
+chunks:
+- name: stage1-binutils-musl
+ morph: strata/build-essential-musl/stage1-binutils.morph
+ repo: upstream:binutils-redhat
+ ref: b1d3b01332ae49a60ff5d6bf53d3a5b1805769c8
+ unpetrify-ref: baserock/build-essential
+ build-depends: []
+ build-mode: bootstrap
+ prefix: /tools
+
+- name: stage1-gcc-musl
+ morph: strata/build-essential-musl/stage1-gcc.morph
+ repo: upstream:gcc-tarball
+ ref: 64b6dc020e879808a0c8f2271585e2f5ae45372a
+ unpetrify-ref: baserock/build-essential-musl
+ build-depends:
+ - stage1-binutils-musl
+ build-mode: bootstrap
+ prefix: /tools
+
+- name: stage2-linux-api-headers-musl
+ morph: strata/build-essential-musl/stage2-linux-api-headers.morph
+ repo: upstream:linux
+ ref: 6d90449f594534084a7847c0b9f0216b0f9056b1
+ unpetrify-ref: baserock/v3.12-musl
+ build-depends:
+ - stage1-binutils-musl
+ - stage1-gcc-musl
+ build-mode: bootstrap
+ prefix: /tools
+
+- name: stage2-musl
+ morph: strata/build-essential-musl/stage2-musl.morph
+ repo: upstream:musl
+ ref: 12cc52b5f2ca421786dc7ac227a0d41a8c8ed0c2
+ unpetrify-ref: baserock/1.1.6
+ build-depends:
+ - stage1-binutils-musl
+ - stage1-gcc-musl
+ - stage2-linux-api-headers-musl
+ build-mode: bootstrap
+ prefix: /tools
+
+- name: stage2-libstdc++-musl
+ morph: strata/build-essential-musl/stage2-libstdc++.morph
+ repo: upstream:gcc-tarball
+ ref: 64b6dc020e879808a0c8f2271585e2f5ae45372a
+ unpetrify-ref: baserock/build-essential-musl
+ build-depends:
+ - stage1-binutils-musl
+ - stage1-gcc-musl
+ - stage2-musl
+ build-mode: bootstrap
+ prefix: /tools
+
+- name: stage2-binutils-musl
+ morph: strata/build-essential-musl/stage2-binutils.morph
+ repo: upstream:binutils-redhat
+ ref: b1d3b01332ae49a60ff5d6bf53d3a5b1805769c8
+ unpetrify-ref: baserock/build-essential
+ build-depends:
+ - stage1-binutils-musl
+ - stage1-gcc-musl
+ - stage2-musl
+ build-mode: bootstrap
+ prefix: /tools
+
+- name: stage2-gcc-fixed-headers-musl
+ morph: strata/build-essential-musl/stage2-gcc-fixed-headers.morph
+ repo: upstream:gcc-tarball
+ ref: 64b6dc020e879808a0c8f2271585e2f5ae45372a
+ unpetrify-ref: baserock/build-essential-musl
+ build-depends:
+ - stage1-binutils-musl
+ - stage1-gcc-musl
+ - stage2-musl
+ build-mode: bootstrap
+ prefix: /tools
+
+- name: stage2-gcc-musl
+ morph: strata/build-essential-musl/stage2-gcc.morph
+ repo: upstream:gcc-tarball
+ ref: 64b6dc020e879808a0c8f2271585e2f5ae45372a
+ unpetrify-ref: baserock/build-essential-musl
+ build-depends:
+ - stage1-binutils-musl
+ - stage1-gcc-musl
+ - stage2-musl
+ - stage2-gcc-fixed-headers-musl
+ - stage2-libstdc++-musl
+ build-mode: bootstrap
+ prefix: /tools
+
+- name: stage2-busybox-musl
+ morph: strata/build-essential-musl/stage2-busybox.morph
+ repo: upstream:busybox
+ ref: 8a801e0f024f1385d8e989b80b90443546bceae7
+ unpetrify-ref: baserock/build-essential
+ build-depends:
+ - stage1-binutils-musl
+ - stage1-gcc-musl
+ - stage2-musl
+ build-mode: bootstrap
+ prefix: /tools
+
+- name: stage2-fake-bash-musl
+ morph: strata/build-essential-musl/stage2-fake-bash.morph
+ repo: upstream:bash
+ ref: 3590145af6f1c9fa321dff231f69ae696e7e740b
+ unpetrify-ref: baserock/bash-4.3-patch-27
+ build-depends: []
+ build-mode: bootstrap
+ prefix: /tools
+
+- name: stage2-fhs-dirs-musl
+ morph: strata/build-essential-musl/stage2-fhs-dirs.morph
+ repo: baserock:baserock/fhs-dirs
+ ref: 41bbb474cd4647ee715bc94c21c161d12a20deb4
+ unpetrify-ref: master
+ build-depends: []
+ build-mode: bootstrap
+ prefix: /tools
+
+- name: stage2-gawk-musl
+ morph: strata/build-essential-musl/stage2-gawk.morph
+ repo: upstream:gawk
+ ref: 1da41261fba4cd03a32362d44c8634f599ae64db
+ unpetrify-ref: master
+ build-depends:
+ - stage1-binutils-musl
+ - stage1-gcc-musl
+ - stage2-musl
+ build-mode: bootstrap
+ prefix: /tools
+
+- name: stage2-make-musl
+ morph: strata/build-essential-musl/stage2-make.morph
+ repo: file:///src/workspace/make
+ ref: 0559ff870e348083a3b8329f70d56646bd7e4261
+ unpetrify-ref: baserock/build-essential
+ build-depends:
+ - stage1-binutils-musl
+ - stage1-gcc-musl
+ - stage2-musl
+ build-mode: bootstrap
+ prefix: /tools
+
+- name: stage2-reset-specs-musl
+ morph: strata/build-essential-musl/stage2-reset-specs.morph
+ repo: upstream:musl
+ ref: 12cc52b5f2ca421786dc7ac227a0d41a8c8ed0c2
+ unpetrify-ref: baserock/1.1.6
+ build-depends:
+ - stage1-binutils-musl
+ - stage1-gcc-musl
+ - stage2-linux-api-headers-musl
+ - stage2-musl
+ build-mode: bootstrap
+ prefix: /tools
+
+- name: fhs-dirs-musl
+ morph: strata/build-essential-musl/fhs-dirs.morph
+ repo: baserock:baserock/fhs-dirs
+ ref: 41bbb474cd4647ee715bc94c21c161d12a20deb4
+ unpetrify-ref: master
+ build-depends:
+ - stage2-binutils-musl
+ - stage2-busybox-musl
+ - stage2-musl
+ - stage2-fhs-dirs-musl
+ - stage2-gawk-musl
+ - stage2-gcc-musl
+ - stage2-linux-api-headers-musl
+ - stage2-make-musl
+ - stage2-reset-specs-musl
+
+- name: linux-api-headers-musl
+ morph: strata/build-essential-musl/linux-api-headers.morph
+ repo: upstream:linux
+ ref: 6d90449f594534084a7847c0b9f0216b0f9056b1
+ unpetrify-ref: baserock/v3.12-musl
+ build-depends:
+ - stage2-binutils-musl
+ - stage2-busybox-musl
+ - stage2-musl
+ - stage2-fhs-dirs-musl
+ - stage2-gawk-musl
+ - stage2-gcc-musl
+ - stage2-linux-api-headers-musl
+ - stage2-make-musl
+ - stage2-reset-specs-musl
+
+- name: musl
+ morph: strata/build-essential-musl/musl.morph
+ repo: upstream:musl
+ ref: 12cc52b5f2ca421786dc7ac227a0d41a8c8ed0c2
+ unpetrify-ref: baserock/1.1.6
+ build-depends:
+ - stage2-binutils-musl
+ - stage2-busybox-musl
+ - stage2-fake-bash-musl
+ - stage2-musl
+ - stage2-fhs-dirs-musl
+ - stage2-gawk-musl
+ - stage2-gcc-musl
+ - stage2-linux-api-headers-musl
+ - stage2-make-musl
+ - stage2-reset-specs-musl
+ - linux-api-headers-musl
+
+- name: zlib-musl
+ morph: strata/build-essential-musl/zlib.morph
+ repo: upstream:zlib
+ ref: db333af7e9b90a23fd7f9cd8dc128123b34bf698
+ unpetrify-ref: baserock/build-essential
+ build-depends:
+ - stage2-binutils-musl
+ - stage2-busybox-musl
+ - stage2-musl
+ - stage2-fhs-dirs-musl
+ - stage2-gawk-musl
+ - stage2-gcc-musl
+ - stage2-linux-api-headers-musl
+ - stage2-make-musl
+ - stage2-reset-specs-musl
+ - musl
+
+- name: binutils-musl
+ morph: strata/build-essential-musl/binutils.morph
+ repo: upstream:binutils-redhat
+ ref: b1d3b01332ae49a60ff5d6bf53d3a5b1805769c8
+ unpetrify-ref: baserock/build-essential
+ build-depends:
+ - stage2-binutils-musl
+ - stage2-busybox-musl
+ - stage2-musl
+ - stage2-fhs-dirs-musl
+ - stage2-gawk-musl
+ - stage2-gcc-musl
+ - stage2-linux-api-headers-musl
+ - stage2-make-musl
+ - stage2-reset-specs-musl
+ - musl
+ - zlib-musl
+
+- name: busybox-musl
+ morph: strata/build-essential-musl/busybox.morph
+ repo: upstream:busybox
+ ref: 772a98fec669cf881d7c1ea17631bc8560bccf5c
+ unpetrify-ref: baserock/build-essential
+ build-depends:
+ - stage2-binutils-musl
+ - stage2-busybox-musl
+ - stage2-musl
+ - stage2-fhs-dirs-musl
+ - stage2-gawk-musl
+ - stage2-gcc-musl
+ - stage2-linux-api-headers-musl
+ - stage2-make-musl
+ - stage2-reset-specs-musl
+ - musl
+
+- name: gawk-musl
+ morph: strata/build-essential-musl/gawk.morph
+ repo: upstream:gawk
+ ref: 1da41261fba4cd03a32362d44c8634f599ae64db
+ unpetrify-ref: master
+ build-depends:
+ - stage2-binutils-musl
+ - stage2-busybox-musl
+ - stage2-musl
+ - stage2-fhs-dirs-musl
+ - stage2-gawk-musl
+ - stage2-gcc-musl
+ - stage2-linux-api-headers-musl
+ - stage2-make-musl
+ - stage2-reset-specs-musl
+ - musl
+
+- name: m4-tarball-musl
+ morph: strata/build-essential-musl/m4-tarball.morph
+ repo: upstream:m4-tarball
+ ref: 23c11479b3ad787adc7a651ee0c4347839e47723
+ unpetrify-ref: m4-1.4.17
+ build-depends:
+ - stage2-binutils-musl
+ - stage2-busybox-musl
+ - stage2-musl
+ - stage2-fhs-dirs-musl
+ - stage2-gcc-musl
+ - stage2-make-musl
+ - stage2-reset-specs-musl
+ - musl
+
+- name: gcc-musl
+ morph: strata/build-essential-musl/gcc.morph
+ repo: upstream:gcc-tarball
+ ref: 64b6dc020e879808a0c8f2271585e2f5ae45372a
+ unpetrify-ref: baserock/build-essential-musl
+ build-depends:
+ - stage2-binutils-musl
+ - stage2-busybox-musl
+ - stage2-musl
+ - stage2-fhs-dirs-musl
+ - stage2-gawk-musl
+ - stage2-gcc-musl
+ - stage2-linux-api-headers-musl
+ - stage2-make-musl
+ - stage2-reset-specs-musl
+ - musl
+ - zlib-musl
+ - m4-tarball-musl
+
+- name: make-musl
+ morph: strata/build-essential-musl/make.morph
+ repo: file:///src/workspace/make
+ ref: 0559ff870e348083a3b8329f70d56646bd7e4261
+ unpetrify-ref: baserock/build-essential
+ build-depends:
+ - stage2-binutils-musl
+ - stage2-busybox-musl
+ - stage2-musl
+ - stage2-fhs-dirs-musl
+ - stage2-gawk-musl
+ - stage2-gcc-musl
+ - stage2-linux-api-headers-musl
+ - stage2-make-musl
+ - stage2-reset-specs-musl
+ - musl
+
+- name: ccache-musl
+ morph: strata/build-essential-musl/ccache.morph
+ repo: upstream:ccache
+ ref: 567631456f0899cdf0c382f898d38aadc8901d32
+ unpetrify-ref: baserock/build-essential
+ build-depends:
+ - stage2-binutils-musl
+ - stage2-busybox-musl
+ - stage2-musl
+ - stage2-fhs-dirs-musl
+ - stage2-gawk-musl
+ - stage2-gcc-musl
+ - stage2-linux-api-headers-musl
+ - stage2-make-musl
+ - stage2-reset-specs-musl
+ - musl
+ - zlib-musl
diff --git a/strata/build-essential-musl/binutils.morph b/strata/build-essential-musl/binutils.morph
new file mode 100644
index 00000000..bab52672
--- /dev/null
+++ b/strata/build-essential-musl/binutils.morph
@@ -0,0 +1,8 @@
+name: binutils
+kind: chunk
+build-system: autotools
+
+configure-commands:
+- |
+ ./configure --prefix="$PREFIX" --disable-nls --disable-werror \
+ --with-system-zlib
diff --git a/strata/build-essential-musl/busybox.morph b/strata/build-essential-musl/busybox.morph
new file mode 100644
index 00000000..61177c11
--- /dev/null
+++ b/strata/build-essential-musl/busybox.morph
@@ -0,0 +1,124 @@
+name: busybox
+kind: chunk
+
+configure-commands:
+# Busybox's default config has everything enabled.
+- make defconfig
+
+- sed -e 's|.*UDHCPC_DEFAULT_SCRIPT.*|CONFIG_UDHCPC_DEFAULT_SCRIPT="'"$PREFIX"/share/udhcpc/default.script'"|' -i .config
+- sed -e 's|.*IFUPDOWN_IFSTATE_PATH.*|CONFIG_IFUPDOWN_IFSTATE_PATH="/run/ifstate"|' -i .config
+
+# Avoid dividing applets between $PREFIX/[s]bin and $PREFIX/usr/[s]bin.
+- '[ "$PREFIX" = /usr ] || sed -e ''s/.*INSTALL_NO_USR.*/CONFIG_INSTALL_NO_USR=y/'' -i .config'
+
+# We have GAWK, but in GENIVI baseline we want to get rid of it
+# - sed -e 's/CONFIG_AWK=y.*/# CONFIG_AWK is not set/' -i .config
+
+# Depends on stuff that was removed since eglibc 2.14.
+- sed -e 's/CONFIG_INETD=y.*/# CONFIG_INETD is not set/' -i .config
+
+# Busybox Patch is incompatible enough with GNU Patch that it can't be
+# used for GNULib projects built from Git.
+- sed -e 's/CONFIG_PATCH=y.*/# CONFIG_PATCH is not set/' -i .config
+
+# None of this is needed because we have kmod; and it actually breaks the
+# Linux build because depmod isn't compatible enough with util-linux's.
+- sed -e 's/CONFIG_DEPMOD=y.*/# CONFIG_DEPMOD is not set/' -i .config
+- sed -e 's/CONFIG_INSMOD=y.*/# CONFIG_INSMOD is not set/' -i .config
+- sed -e 's/CONFIG_MODPROBE=y.*/# CONFIG_MODPROBE is not set/' -i .config
+- sed -e 's/CONFIG_MODPROBE_SMALL=y.*/# CONFIG_MODPROBE_SMALL is not set/' -i .config
+- sed -e 's/CONFIG_LSMOD=y.*/# CONFIG_LSMOD is not set/' -i .config
+- sed -e 's/CONFIG_RMMOD=y.*/# CONFIG_RMMOD is not set/' -i .config
+
+# General features that we don't need.
+- sed -e 's/CONFIG_FEATURE_MOUNT_CIFS=y.*/# CONFIG_FEATURE_MOUNT_CIFS is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_EXTRA_COMPAT=y.*/# CONFIG_FEATURE_EXTRA_COMPAT is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_EXTRA_QUIET=y.*/# CONFIG_FEATURE_EXTRA_QUIET is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_INIT_COREDUMPS=y.*/# CONFIG_FEATURE_INIT_COREDUMPS is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_INIT_SCTTY=y.*/# CONFIG_FEATURE_INIT_SCTTY is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_INIT_SYSLOG=y.*/# CONFIG_FEATURE_INIT_SYSLOG is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_INITRD=y.*/# CONFIG_FEATURE_INITRD is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_IP_ROUTE=y.*/# CONFIG_FEATURE_IP_ROUTE is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_USE_INITTAB=y.*/# CONFIG_FEATURE_USE_INITTAB is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_MINIX2=y.*/# CONFIG_FEATURE_MINIX2 is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_IFCONFIG_SLIP=y.*/# CONFIG_FEATURE_IFCONFIG_SLIP is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_INETD_RPC=y.*/# CONFIG_FEATURE_INETD_RPC is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_SELINUX=y.*/# CONFIG_FEATURE_SELINUX is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_SYSTEMD=y.*/# CONFIG_FEATURE_SYSTEMD is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_HAVE_RPC=y.*/# CONFIG_FEATURE_HAVE_RPC is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_VI_REGEX_SEARCH=y.*/# CONFIG_FEATURE_VI_REGEX_SEARCH is not set/' -i .config
+- sed -e 's/CONFIG_IFPLUGD=y.*/# CONFIG_IFPLUGD is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_IP_LINK=y.*/# CONFIG_FEATURE_IP_LINK is not set/' -i .config
+- sed -e 's/CONFIG_FSCK_MINIX=y.*/# CONFIG_FSCK_MINIX is not set/' -i .config
+- sed -e 's/CONFIG_HALT=y.*/# CONFIG_HALT is not set/' -i .config
+- sed -e 's/CONFIG_IFCONFIG=y.*/# CONFIG_IFCONFIG is not set/' -i .config
+- sed -e 's/CONFIG_IPLINK=y.*/# CONFIG_IPLINK is not set/' -i .config
+- sed -e 's/CONFIG_IPROUTE=y.*/# CONFIG_IPROUTE is not set/' -i .config
+- sed -e 's/CONFIG_INIT=y.*/# CONFIG_INIT is not set/' -i .config
+- sed -e 's/CONFIG_INIT_TERMINAL_TYPE=y.*/CONFIG_INIT_TERMINAL_TYPE=""/' -i .config
+- sed -e 's/CONFIG_LOSETUP=y.*/# CONFIG_LOSETUP is not set/' -i .config
+- sed -e 's/CONFIG_LSUSB=y.*/# CONFIG_LSUSB is not set/' -i .config
+- sed -e 's/CONFIG_LSPCI=y.*/# CONFIG_LSPCI is not set/' -i .config
+- sed -e 's/CONFIG_LZMA=y.*/# CONFIG_LZMA is not set/' -i .config
+- sed -e 's/CONFIG_MKFS_EXT2=y.*/# CONFIG_MKFS_EXT2 is not set/' -i .config
+- sed -e 's/CONFIG_MOUNT_NFS=y.*/# CONFIG_MOUNT_NFS is not set/' -i .config
+- sed -e 's/CONFIG_MKFS_MINIX=y.*/# CONFIG_MKFS_MINIX is not set/' -i .config
+- sed -e 's/CONFIG_PAM=y.*/# CONFIG_PAM is not set/' -i .config
+- sed -e 's/CONFIG_RUNLEVEL=y.*/# CONFIG_RUNLEVEL is not set/' -i .config
+- sed -e 's/CONFIG_SELINUXENABLED=y.*/# CONFIG_SELINUXENABLED is not set/' -i .config
+- sed -e 's/CONFIG_STRINGS=y.*/# CONFIG_STRINGS is not set/' -i .config
+- sed -e 's/CONFIG_UNLZMA=y.*/# CONFIG_UNLZMA is not set/' -i .config
+- sed -e 's/CONFIG_UNXZ=y.*/# CONFIG_UNXZ is not set/' -i .config
+- sed -e 's/CONFIG_XZ=y.*/# CONFIG_XZ is not set/' -i .config
+- sed -e 's/CONFIG_WERROR=y.*/# CONFIG_WERROR is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_IFUPDOWN_IP_BUILTIN=y.*/# CONFIG_FEATURE_IFUPDOWN_IP_BUILTIN is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_IFUPDOWN_IPV4=y.*/# CONFIG_FEATURE_IFUPDOWN_IPV4 is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_IFUPDOWN_IPV6=y.*/# CONFIG_FEATURE_IFUPDOWN_IPV6 is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_IFUPDOWN_MAPPING=y.*/# CONFIG_FEATURE_IFUPDOWN_MAPPING is not set/' -i .config
+- sed -e 's/CONFIG_IP=y.*/# CONFIG_IP is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_IP_ADDRESS=y.*/# CONFIG_FEATURE_IP_ADDRESS is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_IP_LINK=y.*/# CONFIG_FEATURE_IP_LINK is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_IP_ROUTE=y.*/# CONFIG_FEATURE_IP_ROUTE is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_IP_TUNNEL=y.*/# CONFIG_FEATURE_IP_TUNNEL is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_IP_RULE=y.*/# CONFIG_FEATURE_IP_RULE is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_IP_SHORT_FORMS=y.*/# CONFIG_FEATURE_IP_SHORT_FORMS is not set/' -i .config
+- sed -e 's/CONFIG_IPADDR=y.*/# CONFIG_IPADDR is not set/' -i .config
+- sed -e 's/CONFIG_IPLINK=y.*/# CONFIG_IPLINK is not set/' -i .config
+- sed -e 's/CONFIG_IPROUTE=y.*/# CONFIG_IPROUTE is not set/' -i .config
+- sed -e 's/CONFIG_IPTUNNEL=y.*/# CONFIG_IPTUNNEL is not set/' -i .config
+- sed -e 's/CONFIG_IPRULE=y.*/# CONFIG_IPRULE is not set/' -i .config
+
+# Now turn on some little bits we do need
+- sed -e 's/# CONFIG_BBCONFIG is not set/CONFIG_BBCONFIG=y/' -i .config
+- sed -e 's/# CONFIG_FEATURE_COMPRESS_BBCONFIG is not set/CONFIG_FEATURE_COMPRESS_BBCONFIG=y/' -i .config
+- sed -e 's/# CONFIG_FEATURE_MOUNT_HELPERS is not set/CONFIG_FEATURE_MOUNT_HELPERS=y/' -i .config
+
+
+build-commands:
+- make
+
+install-commands:
+- |
+ if [ "$PREFIX" = /usr ]; then PREFIX=; fi &&
+ make CONFIG_PREFIX="$DESTDIR$PREFIX" install &&
+ chmod 6755 "$DESTDIR$PREFIX"/bin/busybox
+
+# Set up man environment variables
+- mkdir -p "$DESTDIR"/etc
+- |
+ cat << EOF > "$DESTDIR/etc/profile"
+ # Set default pager to less
+ export MANPAGER='less -R'
+ EOF
+- |
+ cat << EOF > "$DESTDIR/etc/man.conf"
+ # This file is used by man to provide a manpath for those without one by
+ # examining their PATH environment variable.
+ #
+ # Lines beginning with `#' are comments and are ignored. Any combination of
+ # tabs or spaces may be used as `whitespace' separators.
+
+ MANDATORY_MANPATH /usr/man
+ MANDATORY_MANPATH /usr/share/man
+ MANDATORY_MANPATH /usr/local/share/man
+ EOF
diff --git a/strata/build-essential-musl/ccache.morph b/strata/build-essential-musl/ccache.morph
new file mode 100644
index 00000000..383eee8a
--- /dev/null
+++ b/strata/build-essential-musl/ccache.morph
@@ -0,0 +1,12 @@
+name: ccache
+kind: chunk
+build-system: autotools
+configure-commands:
+- ./configure --prefix="$PREFIX"
+install-commands:
+- make DESTDIR="$DESTDIR" install
+- mkdir -p "$DESTDIR/$PREFIX/lib/ccache"
+- for cc in gcc cc g++ c++; do ln -sf "$PREFIX/bin/ccache" "$DESTDIR/$PREFIX/lib/ccache/$cc";
+ done
+- for cc in gcc cc g++ c++; do ln -sf "$PREFIX/bin/ccache" "$DESTDIR/$PREFIX/lib/ccache/$TARGET-$cc";
+ done
diff --git a/strata/build-essential-musl/fhs-dirs.morph b/strata/build-essential-musl/fhs-dirs.morph
new file mode 100644
index 00000000..64474872
--- /dev/null
+++ b/strata/build-essential-musl/fhs-dirs.morph
@@ -0,0 +1,50 @@
+name: fhs-dirs
+kind: chunk
+description: create the FHS 2.3 directory hierarchy and the usual files
+install-commands:
+- sh ./create-fhs-dirs "$DESTDIR"
+- install -m 644 passwd "$DESTDIR/etc/passwd"
+- install -m 600 shadow "$DESTDIR/etc/shadow"
+- install -m 644 interfaces "$DESTDIR/etc/network/interfaces"
+- install -m 644 group "$DESTDIR/etc/group"
+- install -m 644 ld.so.conf "$DESTDIR/etc/ld.so.conf"
+- install -m 644 issue "$DESTDIR/etc/issue"
+- install -m 644 services "$DESTDIR/etc/services"
+- install -m 644 protocols "$DESTDIR/etc/protocols"
+- echo baserock > "$DESTDIR"/etc/hostname
+devices:
+- type: c
+ filename: /dev/console
+ gid: 0
+ major: 5
+ minor: 1
+ permissions: '0600'
+ uid: 0
+- type: c
+ filename: /dev/full
+ gid: 0
+ major: 1
+ minor: 7
+ permissions: '0666'
+ uid: 0
+- type: c
+ filename: /dev/null
+ gid: 0
+ major: 1
+ minor: 3
+ permissions: '0666'
+ uid: 0
+- type: c
+ filename: /dev/urandom
+ gid: 0
+ major: 1
+ minor: 9
+ permissions: '0666'
+ uid: 0
+- type: c
+ filename: /dev/zero
+ gid: 0
+ major: 1
+ minor: 5
+ permissions: '0666'
+ uid: 0
diff --git a/strata/build-essential-musl/gawk.morph b/strata/build-essential-musl/gawk.morph
new file mode 100644
index 00000000..1ad871c6
--- /dev/null
+++ b/strata/build-essential-musl/gawk.morph
@@ -0,0 +1,5 @@
+name: gawk
+kind: chunk
+build-system: autotools
+configure-commands:
+- ./configure --prefix="$PREFIX" --disable-nls
diff --git a/strata/build-essential-musl/gcc.morph b/strata/build-essential-musl/gcc.morph
new file mode 100644
index 00000000..1597124d
--- /dev/null
+++ b/strata/build-essential-musl/gcc.morph
@@ -0,0 +1,51 @@
+name: gcc
+kind: chunk
+
+configure-commands:
+- mkdir o
+
+# Configure flag notes:
+# 1. An attempt to stop anything going in $PREFIX/lib64 (which doesn't
+# fully work; we will need to hobble the multilib configuration in
+# config/i386/t-linux64 if we really want to kill /lib64).
+# 2. Avoid having more than one copy of ZLib in use on the system
+# 3. Multilib does not make sense in Baserock.
+- |
+ case "$MORPH_ARCH" in
+ armv7lhf) ARCH_FLAGS="--with-arch=armv7-a \
+ --with-cpu=cortex-a9 \
+ --with-tune=cortex-a9 \
+ --with-fpu=vfpv3-d16 \
+ --with-float=hard" ;;
+ armv7*) ARCH_FLAGS="--with-arch=armv7-a" ;;
+ esac
+
+ TARGET_STAGE1=`echo $TARGET_STAGE1 | sed -e 's/bootstrap-linux-gnu/linux-musl/'`
+ cd o && ../configure \
+ $ARCH_FLAGS \
+ --build=$TARGET_STAGE1 \
+ --prefix="$PREFIX" \
+ `# [1]` --libdir=$PREFIX/lib \
+ --disable-bootstrap \
+ `# [2]` --with-system-zlib \
+ `# [3]` --disable-multilib \
+ --enable-languages=c,c++,fortran \
+ --disable-libgomp \
+ --disable-libsanitizer
+
+
+build-commands:
+- |
+ case "$MORPH_ARCH" in
+ armv7*) sed -i "s/--host=none/--host=armv7a/" o/Makefile
+ sed -i "s/--target=none/--target=armv7a/" o/Makefile ;;
+ esac
+ cd o && make
+
+install-commands:
+- cd o && make DESTDIR="$DESTDIR" install
+- ln -s gcc "$DESTDIR/$PREFIX/bin/cc"
+- >
+ for fortran_alias in f77 f90 f95; do
+ ln -s gfortran "$DESTDIR/$PREFIX/bin/$fortran_alias"
+ done
diff --git a/strata/build-essential-musl/linux-api-headers.morph b/strata/build-essential-musl/linux-api-headers.morph
new file mode 100644
index 00000000..f634e8f7
--- /dev/null
+++ b/strata/build-essential-musl/linux-api-headers.morph
@@ -0,0 +1,20 @@
+name: linux-api-headers
+kind: chunk
+install-commands:
+- |
+ case "$MORPH_ARCH" in
+ armv7b|armv7l|armv7lhf)
+ ARCH="arm" ;;
+ x86_32)
+ ARCH="i386" ;;
+ x86_64)
+ ARCH="x86_64" ;;
+ ppc64)
+ ARCH="powerpc" ;;
+ *)
+ echo "Error: unsupported Morph architecture: $MORPH_ARCH" >&2
+ exit 1
+ esac
+ ARCH=$ARCH make INSTALL_HDR_PATH=dest HOSTCFLAGS=-I/tools/include headers_install
+- install -d "$DESTDIR${PREFIX-/usr}/include"
+- cp -r dest/include/* "$DESTDIR/${PREFIX-/usr}/include"
diff --git a/strata/build-essential-musl/m4-tarball.morph b/strata/build-essential-musl/m4-tarball.morph
new file mode 100644
index 00000000..e460a9dc
--- /dev/null
+++ b/strata/build-essential-musl/m4-tarball.morph
@@ -0,0 +1,5 @@
+name: m4-tarball
+kind: chunk
+build-system: autotools
+configure-commands:
+- ./configure --prefix="$PREFIX"
diff --git a/strata/build-essential-musl/make.morph b/strata/build-essential-musl/make.morph
new file mode 100644
index 00000000..1259b342
--- /dev/null
+++ b/strata/build-essential-musl/make.morph
@@ -0,0 +1,5 @@
+name: make
+kind: chunk
+build-system: autotools
+configure-commands:
+- ./configure --prefix="$PREFIX" --disable-nls
diff --git a/strata/build-essential-musl/musl.morph b/strata/build-essential-musl/musl.morph
new file mode 100644
index 00000000..de53b466
--- /dev/null
+++ b/strata/build-essential-musl/musl.morph
@@ -0,0 +1,9 @@
+name: musl
+kind: chunk
+configure-commands:
+- ./configure --prefix="$PREFIX"
+build-commands:
+- make
+install-commands:
+- make install
+- install -d "$DESTDIR/etc" ; echo "/usr/lib64:/usr/lib" >> "$DESTDIR/etc/ld-musl-x86_64.path"
diff --git a/strata/build-essential-musl/stage1-binutils.morph b/strata/build-essential-musl/stage1-binutils.morph
new file mode 100644
index 00000000..2d2cb497
--- /dev/null
+++ b/strata/build-essential-musl/stage1-binutils.morph
@@ -0,0 +1,23 @@
+name: stage1-binutils
+kind: chunk
+build-system: autotools
+
+configure-commands:
+# We set the sysroot location dynamically at runtime by passing
+# `--sysroot` to GCC, so we need to build a linker with sysroot support.
+# We set it to a non-existent directory as a safety net to avoid looking
+# at the host dirs in case we forget to set the sysroot. Setting the
+# lib path is vital to avoid the tools we build linking to the libraries
+# on the host system; the '=' makes the path we give relative to the
+# sysroot, which we can then set at runtime by passing -Wl,--sysroot to
+# GCC. Although nothing should be installed on /lib64, we configure the
+# linker to look at that directory as well to make things more robust
+# (currently GCC installs libraries to this directory at least on
+# x86_64).
+
+- |
+ ./configure --prefix="$PREFIX" --disable-nls --disable-werror \
+ --build=$(sh config.guess) \
+ --host=$(sh config.guess) \
+ --target=x86_64-linux-musl \
+ --with-sysroot=/nonexistentdir --with-lib-path="=$PREFIX/lib:=$PREFIX/lib64"
diff --git a/strata/build-essential-musl/stage1-gcc.morph b/strata/build-essential-musl/stage1-gcc.morph
new file mode 100644
index 00000000..b231a05d
--- /dev/null
+++ b/strata/build-essential-musl/stage1-gcc.morph
@@ -0,0 +1,78 @@
+name: stage1-gcc
+kind: chunk
+
+configure-commands:
+# Workaround from LFS due GCC not detecting stack protection correctly
+- sed -i '/k prot/agcc_cv_libc_provides_ssp=yes' gcc/configure
+
+- mkdir o
+
+# Configure flag notes:
+# 1. See gcc.morph.
+# 2. Although we will be setting a sysroot at runtime, giving a
+# temporary one at configuration time seems necessary so that
+# `--with-native-system-header-dir` produces effect and
+# /tools/include is in the include path for the newly built GCC. We
+# set it by default to a non-existent directory to avoid GCC looking
+# at the host dirs, in case we forget to give it at runtime.
+# 3. Disable searching /usr/local/include for headers
+# 4. The pass 1 compiler needs to find the libraries we build in pass
+# 2. Include path must be set explicility, because it defaults to
+# $SYSROOT/usr/include rather than $SYSROOT/include.
+# 5. Disable stuff that doesn't work when building a cross compiler
+# without an existing libc, and generally try to keep this build as
+# simple as possible.
+- |
+ case "$MORPH_ARCH" in
+ armv7lhf) ARCH_FLAGS="--with-arch=armv7-a \
+ --with-cpu=cortex-a9 \
+ --with-tune=cortex-a9 \
+ --with-fpu=vfpv3-d16 \
+ --with-float=hard" ;;
+ armv7*) ARCH_FLAGS="--with-arch=armv7-a" ;;
+ esac
+
+ cd o && ../configure \
+ $ARCH_FLAGS \
+ --build=$(sh ../config.guess) \
+ --host=$(sh ../config.guess) \
+ --target=x86_64-linux-musl \
+ --prefix="$PREFIX" \
+ `# [1]` --libdir="$PREFIX/lib" \
+ `# [2]` --with-sysroot=/nonexistentdir \
+ --with-newlib \
+ `# [3]` --with-local-prefix="$PREFIX" \
+ `# [4]` --with-native-system-header-dir="$PREFIX/include" \
+ --without-headers \
+ --disable-nls \
+ --disable-shared \
+ --disable-multilib \
+ `# [5]` --disable-decimal-float \
+ `# [5]` --disable-threads \
+ `# [5]` --disable-libatomic \
+ `# [5]` --disable-libgomp \
+ `# [5]` --disable-libitm \
+ `# [5]` --disable-libquadmath \
+ `# [5]` --disable-libsanitizer \
+ `# [5]` --disable-libssp \
+ `# [5]` --disable-libvtv \
+ `# [5]` --disable-libcilkrts \
+ `# [5]` --disable-libstdc++-v3 \
+ --enable-languages=c,c++
+
+build-commands:
+- |
+ # GCC is not passing the correct host/target flags to GMP's configure
+ # script, which causes it to not use the machine-dependent code for
+ # the platform and use the generic one instead. However, the generic
+ # code results on an undefined reference to `__gmpn_invert_limb' in
+ # ARMv7. Fix the invocation of GMP's configure script so that GMP can
+ # use the machine-dependent code.
+ case "$MORPH_ARCH" in
+ armv7*) sed -i "s/--host=none/--host=armv7a/" o/Makefile
+ sed -i "s/--target=none/--target=armv7a/" o/Makefile ;;
+ esac
+ cd o && make
+
+install-commands:
+- cd o && make DESTDIR="$DESTDIR" install
diff --git a/strata/build-essential-musl/stage2-binutils.morph b/strata/build-essential-musl/stage2-binutils.morph
new file mode 100644
index 00000000..20a19860
--- /dev/null
+++ b/strata/build-essential-musl/stage2-binutils.morph
@@ -0,0 +1,22 @@
+name: stage2-binutils
+kind: chunk
+build-system: autotools
+
+configure-commands:
+- |
+ export STAGE2_SYSROOT="$(dirname $(pwd))"
+ export CXX=false
+ TARGET_STAGE1=`echo $TARGET_STAGE1 | sed -e 's/bootstrap-linux-gnu/linux-musl/'`
+ # binutils has its own embedded libtool, which is old and strips out
+ # `--sysroot`. Work around by modifying the compiler command to
+ # include the sysroot flag
+ export CC="$TARGET_STAGE1-gcc --sysroot=$STAGE2_SYSROOT"
+ ./configure --prefix="$PREFIX" --disable-nls --disable-werror \
+ --build=$(sh config.guess) \
+ --host=$TARGET_STAGE1 \
+ --target=$TARGET_STAGE1
+
+build-commands:
+- |
+ export STAGE2_SYSROOT="$(dirname $(pwd))"
+ make
diff --git a/strata/build-essential-musl/stage2-busybox.morph b/strata/build-essential-musl/stage2-busybox.morph
new file mode 100644
index 00000000..c629f803
--- /dev/null
+++ b/strata/build-essential-musl/stage2-busybox.morph
@@ -0,0 +1,109 @@
+name: stage2-busybox
+kind: chunk
+
+configure-commands:
+- TARGET_STAGE1=`echo $TARGET_STAGE1 | sed -e 's/bootstrap-linux-gnu/linux-musl/'`
+# Explicitly setting HOSTCC is required because we have a 'gcc' earlier in
+# the PATH supplied by the stage2-gcc chunk, which can't execute outside of
+# the stage 3 staging area.
+- make HOSTCC="/usr/bin/gcc" CROSS_COMPILE=$TARGET_STAGE1- defconfig
+
+# Avoid dividing applets between $PREFIX/[s]bin and $PREFIX/usr/[s]bin.
+- '[ "$PREFIX" = /usr ] || sed -e ''s/.*INSTALL_NO_USR.*/CONFIG_INSTALL_NO_USR=y/'' -i .config'
+
+# We have GAWK.
+- sed -e 's/CONFIG_AWK=y.*/# CONFIG_AWK is not set/' -i .config
+
+# Depends on stuff that was removed since eglibc 2.14.
+- sed -e 's/CONFIG_INETD=y.*/# CONFIG_INETD is not set/' -i .config
+
+# Busybox Patch is incompatible enough with GNU Patch that it can't be
+# used for GNULib projects built from Git.
+- sed -e 's/CONFIG_PATCH=y.*/# CONFIG_PATCH is not set/' -i .config
+
+# None of this is needed because we have kmod; and it actually breaks the
+# Linux build because depmod isn't compatible enough with util-linux's.
+- sed -e 's/CONFIG_DEPMOD=y.*/# CONFIG_DEPMOD is not set/' -i .config
+- sed -e 's/CONFIG_INSMOD=y.*/# CONFIG_INSMOD is not set/' -i .config
+- sed -e 's/CONFIG_MODPROBE=y.*/# CONFIG_MODPROBE is not set/' -i .config
+- sed -e 's/CONFIG_MODPROBE_SMALL=y.*/# CONFIG_MODPROBE_SMALL is not set/' -i .config
+- sed -e 's/CONFIG_LSMOD=y.*/# CONFIG_LSMOD is not set/' -i .config
+- sed -e 's/CONFIG_RMMOD=y.*/# CONFIG_RMMOD is not set/' -i .config
+
+# General features that we don't need.
+- sed -e 's/CONFIG_FEATURE_MOUNT_CIFS=y.*/# CONFIG_FEATURE_MOUNT_CIFS is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_EXTRA_COMPAT=y.*/# CONFIG_FEATURE_EXTRA_COMPAT is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_EXTRA_QUIET=y.*/# CONFIG_FEATURE_EXTRA_QUIET is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_INIT_COREDUMPS=y.*/# CONFIG_FEATURE_INIT_COREDUMPS is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_INIT_SCTTY=y.*/# CONFIG_FEATURE_INIT_SCTTY is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_INIT_SYSLOG=y.*/# CONFIG_FEATURE_INIT_SYSLOG is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_INITRD=y.*/# CONFIG_FEATURE_INITRD is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_IP_ROUTE=y.*/# CONFIG_FEATURE_IP_ROUTE is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_USE_INITTAB=y.*/# CONFIG_FEATURE_USE_INITTAB is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_MINIX2=y.*/# CONFIG_FEATURE_MINIX2 is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_IFCONFIG_SLIP=y.*/# CONFIG_FEATURE_IFCONFIG_SLIP is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_INETD_RPC=y.*/# CONFIG_FEATURE_INETD_RPC is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_SELINUX=y.*/# CONFIG_FEATURE_SELINUX is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_SYSTEMD=y.*/# CONFIG_FEATURE_SYSTEMD is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_HAVE_RPC=y.*/# CONFIG_FEATURE_HAVE_RPC is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_VI_REGEX_SEARCH=y.*/# CONFIG_FEATURE_VI_REGEX_SEARCH is not set/' -i .config
+- sed -e 's/CONFIG_IFPLUGD=y.*/# CONFIG_IFPLUGD is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_IP_LINK=y.*/# CONFIG_FEATURE_IP_LINK is not set/' -i .config
+- sed -e 's/CONFIG_FSCK_MINIX=y.*/# CONFIG_FSCK_MINIX is not set/' -i .config
+- sed -e 's/CONFIG_HALT=y.*/# CONFIG_HALT is not set/' -i .config
+- sed -e 's/CONFIG_IFCONFIG=y.*/# CONFIG_IFCONFIG is not set/' -i .config
+- sed -e 's/CONFIG_IPLINK=y.*/# CONFIG_IPLINK is not set/' -i .config
+- sed -e 's/CONFIG_IPROUTE=y.*/# CONFIG_IPROUTE is not set/' -i .config
+- sed -e 's/CONFIG_INIT=y.*/# CONFIG_INIT is not set/' -i .config
+- sed -e 's/CONFIG_INIT_TERMINAL_TYPE=y.*/CONFIG_INIT_TERMINAL_TYPE=""/' -i .config
+- sed -e 's/CONFIG_LOSETUP=y.*/# CONFIG_LOSETUP is not set/' -i .config
+- sed -e 's/CONFIG_LSUSB=y.*/# CONFIG_LSUSB is not set/' -i .config
+- sed -e 's/CONFIG_LZMA=y.*/# CONFIG_LZMA is not set/' -i .config
+- sed -e 's/CONFIG_MKFS_EXT2=y.*/# CONFIG_MKFS_EXT2 is not set/' -i .config
+- sed -e 's/CONFIG_MOUNT_NFS=y.*/# CONFIG_MOUNT_NFS is not set/' -i .config
+- sed -e 's/CONFIG_MKFS_MINIX=y.*/# CONFIG_MKFS_MINIX is not set/' -i .config
+- sed -e 's/CONFIG_PAM=y.*/# CONFIG_PAM is not set/' -i .config
+- sed -e 's/CONFIG_RUNLEVEL=y.*/# CONFIG_RUNLEVEL is not set/' -i .config
+- sed -e 's/CONFIG_SELINUXENABLED=y.*/# CONFIG_SELINUXENABLED is not set/' -i .config
+- sed -e 's/CONFIG_STRINGS=y.*/# CONFIG_STRINGS is not set/' -i .config
+- sed -e 's/CONFIG_UNLZMA=y.*/# CONFIG_UNLZMA is not set/' -i .config
+- sed -e 's/CONFIG_UNXZ=y.*/# CONFIG_UNXZ is not set/' -i .config
+- sed -e 's/CONFIG_XZ=y.*/# CONFIG_XZ is not set/' -i .config
+- sed -e 's/CONFIG_WERROR=y.*/# CONFIG_WERROR is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_IFUPDOWN_IP_BUILTIN=y.*/# CONFIG_FEATURE_IFUPDOWN_IP_BUILTIN is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_IFUPDOWN_IPV4=y.*/# CONFIG_FEATURE_IFUPDOWN_IPV4 is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_IFUPDOWN_IPV6=y.*/# CONFIG_FEATURE_IFUPDOWN_IPV6 is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_IFUPDOWN_MAPPING=y.*/# CONFIG_FEATURE_IFUPDOWN_MAPPING is not set/' -i .config
+- sed -e 's/CONFIG_IP=y.*/# CONFIG_IP is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_IP_ADDRESS=y.*/# CONFIG_FEATURE_IP_ADDRESS is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_IP_LINK=y.*/# CONFIG_FEATURE_IP_LINK is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_IP_ROUTE=y.*/# CONFIG_FEATURE_IP_ROUTE is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_IP_TUNNEL=y.*/# CONFIG_FEATURE_IP_TUNNEL is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_IP_RULE=y.*/# CONFIG_FEATURE_IP_RULE is not set/' -i .config
+- sed -e 's/CONFIG_FEATURE_IP_SHORT_FORMS=y.*/# CONFIG_FEATURE_IP_SHORT_FORMS is not set/' -i .config
+- sed -e 's/CONFIG_IPADDR=y.*/# CONFIG_IPADDR is not set/' -i .config
+- sed -e 's/CONFIG_IPLINK=y.*/# CONFIG_IPLINK is not set/' -i .config
+- sed -e 's/CONFIG_IPROUTE=y.*/# CONFIG_IPROUTE is not set/' -i .config
+- sed -e 's/CONFIG_IPTUNNEL=y.*/# CONFIG_IPTUNNEL is not set/' -i .config
+- sed -e 's/CONFIG_IPRULE=y.*/# CONFIG_IPRULE is not set/' -i .config
+
+
+build-commands:
+- |
+ TARGET_STAGE1=`echo $TARGET_STAGE1 | sed -e 's/bootstrap-linux-gnu/linux-musl/'`
+ export STAGE2_SYSROOT="$(dirname $(pwd))"
+ export CPPFLAGS="--sysroot=$STAGE2_SYSROOT"
+ export LDFLAGS="--sysroot=$STAGE2_SYSROOT"
+ make HOSTCC="/usr/bin/gcc" CROSS_COMPILE=$TARGET_STAGE1-
+
+install-commands:
+# We expect to be built with a non-standard prefix in stage 2 (i.e. not
+# /usr). The install will break if prefix is set to /usr.
+- |
+ TARGET_STAGE1=`echo $TARGET_STAGE1 | sed -e 's/bootstrap-linux-gnu/linux-musl/'`
+ export STAGE2_SYSROOT="$(dirname $(pwd))"
+ export CPPFLAGS="--sysroot=$STAGE2_SYSROOT"
+ export LDFLAGS="--sysroot=$STAGE2_SYSROOT"
+ make CONFIG_PREFIX="$DESTDIR$PREFIX" \
+ HOSTCC="/usr/bin/gcc" CROSS_COMPILE=$TARGET_STAGE1- install &&
+ chmod 6755 "$DESTDIR$PREFIX"/bin/busybox
diff --git a/strata/build-essential-musl/stage2-fake-bash.morph b/strata/build-essential-musl/stage2-fake-bash.morph
new file mode 100644
index 00000000..021fd366
--- /dev/null
+++ b/strata/build-essential-musl/stage2-fake-bash.morph
@@ -0,0 +1,4 @@
+name: stage2-fake-bash
+kind: chunk
+install-commands:
+- printf '#!/bin/sh\nexec /bin/sh "$@"\n' | install -D /proc/self/fd/0 -m 755 "$DESTDIR$PREFIX/bin/bash"
diff --git a/strata/build-essential-musl/stage2-fhs-dirs.morph b/strata/build-essential-musl/stage2-fhs-dirs.morph
new file mode 100644
index 00000000..14a6e253
--- /dev/null
+++ b/strata/build-essential-musl/stage2-fhs-dirs.morph
@@ -0,0 +1,52 @@
+name: stage2-fhs-dirs
+kind: chunk
+description: create the FHS 2.3 directory hierarchy and the usual files
+install-commands:
+- sh ./create-fhs-dirs "$DESTDIR"
+- rmdir "$DESTDIR/bin"
+- ln -s "$PREFIX/bin" "$DESTDIR/bin"
+- install -m 644 passwd "$DESTDIR/etc/passwd"
+- install -m 600 shadow "$DESTDIR/etc/shadow"
+- install -m 644 interfaces "$DESTDIR/etc/network/interfaces"
+- install -m 644 group "$DESTDIR/etc/group"
+- install -m 644 ld.so.conf "$DESTDIR/etc/ld.so.conf"
+- install -m 644 issue "$DESTDIR/etc/issue"
+- install -m 644 services "$DESTDIR/etc/services"
+- install -m 644 protocols "$DESTDIR/etc/protocols"
+- echo baserock > "$DESTDIR"/etc/hostname
+devices:
+- type: c
+ filename: /dev/console
+ gid: 0
+ major: 5
+ minor: 1
+ permissions: '0600'
+ uid: 0
+- type: c
+ filename: /dev/full
+ gid: 0
+ major: 1
+ minor: 7
+ permissions: '0666'
+ uid: 0
+- type: c
+ filename: /dev/null
+ gid: 0
+ major: 1
+ minor: 3
+ permissions: '0666'
+ uid: 0
+- type: c
+ filename: /dev/urandom
+ gid: 0
+ major: 1
+ minor: 9
+ permissions: '0666'
+ uid: 0
+- type: c
+ filename: /dev/zero
+ gid: 0
+ major: 1
+ minor: 5
+ permissions: '0666'
+ uid: 0
diff --git a/strata/build-essential-musl/stage2-gawk.morph b/strata/build-essential-musl/stage2-gawk.morph
new file mode 100644
index 00000000..21bcf16a
--- /dev/null
+++ b/strata/build-essential-musl/stage2-gawk.morph
@@ -0,0 +1,9 @@
+name: stage2-gawk
+kind: chunk
+build-system: autotools
+configure-commands:
+- STAGE2_SYSROOT="$(dirname $(pwd))" CPPFLAGS="--sysroot=$STAGE2_SYSROOT" CXX=false
+ LDFLAGS="--sysroot=$STAGE2_SYSROOT" ./configure --prefix="$PREFIX" --disable-nls
+ --build=$(sh config.guess) --host=x86_64-linux-musl
+build-commands:
+- STAGE2_SYSROOT="$(dirname $(pwd))" make
diff --git a/strata/build-essential-musl/stage2-gcc-fixed-headers.morph b/strata/build-essential-musl/stage2-gcc-fixed-headers.morph
new file mode 100644
index 00000000..9d3e293c
--- /dev/null
+++ b/strata/build-essential-musl/stage2-gcc-fixed-headers.morph
@@ -0,0 +1,20 @@
+name: stage2-gcc-fixed-headers
+kind: chunk
+install-commands:
+# Stage 1 GCC's fixincludes process created a limits.h before there was
+# a real limits.h available for the target. This step (taken from Linux
+# Linux From Scratch) creates a better one so that stage 2 GCC can compile.
+#
+# THIS IS A FRAGILE HACK! We need to replace the headers. The only way to
+# overwrite files in a staging area is to install a new chunk.
+# This is undesired behaviour in the long term, as we want to never
+# have overlaps, so this functionality may go away.
+- |
+ TARGET_STAGE1=`echo $TARGET_STAGE1 | sed -e 's/bootstrap-linux-gnu/linux-musl/'`
+ libgcc_dir=$(dirname $($TARGET_STAGE1-gcc -print-libgcc-file-name))
+ sysroot="$(dirname "$(pwd)")"
+ target_libgcc_dir="${libgcc_dir#$sysroot}"
+ mkdir -p "$DESTDIR/$target_libgcc_dir/include-fixed"
+ cat "gcc/limitx.h" "gcc/glimits.h" "gcc/limity.h" \
+ >"$DESTDIR/$target_libgcc_dir/include-fixed/limits.h"
+
diff --git a/strata/build-essential-musl/stage2-gcc.morph b/strata/build-essential-musl/stage2-gcc.morph
new file mode 100644
index 00000000..53e5b8c5
--- /dev/null
+++ b/strata/build-essential-musl/stage2-gcc.morph
@@ -0,0 +1,82 @@
+name: stage2-gcc
+kind: chunk
+
+configure-commands:
+- mkdir o
+
+# In other projects we specify the sysroot location using CPPFLAGS.
+# Here, that breaks because GCC compiles stuff for the *build* machine,
+# too ... and this requires using the host's compiler, which cannot use
+# the same set of CPPFLAGS as the target. If we specify the sysroot
+# using CC instead then we don't interfere, because we are only
+# specifying the *host* C compiler.
+#
+# Configure flag notes:
+# 1. It's vital that this compiler runs in the bootstrap machine, and
+# targets the same machine (TARGET_STAGE1) so that the stage 1 GCC
+# is used instead of the compiler of the build machine.
+# 2. See gcc.morph.
+# 3. Disable searching /usr/local/include for headers
+# 4. This flag causes the correct --sysroot flag to be passed when
+# calling stage 1 GCC.
+- |
+ case "$MORPH_ARCH" in
+ armv7lhf) ARCH_FLAGS="--with-arch=armv7-a \
+ --with-cpu=cortex-a9 \
+ --with-tune=cortex-a9 \
+ --with-fpu=vfpv3-d16 \
+ --with-float=hard" ;;
+ armv7*) ARCH_FLAGS="--with-arch=armv7-a" ;;
+ esac
+ TARGET_STAGE1=`echo $TARGET_STAGE1 | sed -e 's/bootstrap-linux-gnu/linux-musl/'`
+ export STAGE2_SYSROOT="$(dirname $(pwd))"
+ export CC="$TARGET_STAGE1-gcc --sysroot=$STAGE2_SYSROOT"
+ export CXX="$TARGET_STAGE1-g++ --sysroot=$STAGE2_SYSROOT"
+ export AR="$TARGET_STAGE1-ar"
+ export RANLIB="$TARGET_STAGE1-ranlib"
+ cd o && ../configure \
+ $ARCH_FLAGS \
+ --build=$(sh ../config.guess) \
+ `# [1]` --host=$TARGET_STAGE1 \
+ `# [1]` --target=$TARGET_STAGE1 \
+ --prefix="$PREFIX" \
+ `# [2]` --libdir=$PREFIX/lib \
+ `# [3]` --with-local-prefix=$PREFIX \
+ `# [4]` --with-build-sysroot="$STAGE2_SYSROOT" \
+ --disable-bootstrap \
+ --disable-nls \
+ --disable-multilib \
+ --disable-libgomp \
+ --disable-libstdcxx-pch \
+ --disable-libsanitizer \
+ --enable-languages=c,c++
+
+build-commands:
+- |
+ case "$MORPH_ARCH" in
+ armv7*) sed -i "s/--host=none/--host=armv7a/" o/Makefile
+ sed -i "s/--target=none/--target=armv7a/" o/Makefile ;;
+ esac
+ export STAGE2_SYSROOT="$(dirname $(pwd))"
+ cd o && make
+
+install-commands:
+- cd o && make DESTDIR="$DESTDIR" install
+
+# Stage 3 builds need to link against this file in the location that
+# it will be in the final system, so we make a temporary link now.
+#
+# On x86_64 GCC resolutely installs its libraries into lib64. To fix this
+# would require hobbling the MULTILIB_OSDIRNAMES field in
+# gcc/config/i386/t-linux64 and this might break things, so for now we
+# tolerate the inconsistency.
+- |
+ if [ "$(echo $TARGET | cut -c -6)" = "x86_64" ]; then
+ libdir=lib64
+ else
+ libdir=lib
+ fi
+
+ install -d "$DESTDIR/lib"
+ ln -s "$PREFIX/$libdir/libgcc_s.so" "$DESTDIR/lib/"
+ ln -s "$PREFIX/$libdir/libgcc_s.so.1" "$DESTDIR/lib/"
diff --git a/strata/build-essential-musl/stage2-libstdc++.morph b/strata/build-essential-musl/stage2-libstdc++.morph
new file mode 100644
index 00000000..dcd0d98f
--- /dev/null
+++ b/strata/build-essential-musl/stage2-libstdc++.morph
@@ -0,0 +1,36 @@
+name: stage2-libstdc++
+kind: chunk
+configure-commands:
+- mkdir o
+
+# Configure flag notes:
+# 1. The thread C++ library cannot be built, as the thread C library
+# was not build in stage1-gcc.
+# 2. Prevents the installation of precompiled include files, which are
+# not needed at this stage.
+# 3. From LFS: the header location of C++ needs to be explicitly given
+# as we are running the configure script from the top-level
+# directory.
+- |
+ export STAGE2_SYSROOT="$(dirname $(pwd))"
+ # -fPIC must be given, otherwise it will not be possible to create
+ # shared libraries linked to libstdc++
+ export CPPFLAGS="--sysroot=$STAGE2_SYSROOT -fPIC"
+ export LDFLAGS="--sysroot=$STAGE2_SYSROOT"
+ cd o && ../libstdc++-v3/configure \
+ --build=$(sh ../config.guess) \
+ --host=x86_64-linux-musl \
+ --target=x86_64-linux-musl \
+ --prefix="$PREFIX" \
+ --disable-nls \
+ --disable-shared \
+ --disable-multilib \
+ `# [1]` --disable-libstdcxx-threads \
+ `# [2]` --disable-libstdcxx-pch \
+ `# [3]` --with-gxx-include-dir=/tools/x86_64-linux-musl/include/c++/4.9.2
+
+build-commands:
+- cd o && make
+
+install-commands:
+- cd o && make DESTDIR="$DESTDIR" install
diff --git a/strata/build-essential-musl/stage2-linux-api-headers.morph b/strata/build-essential-musl/stage2-linux-api-headers.morph
new file mode 100644
index 00000000..50e1aaa5
--- /dev/null
+++ b/strata/build-essential-musl/stage2-linux-api-headers.morph
@@ -0,0 +1,20 @@
+name: stage2-linux-api-headers
+kind: chunk
+install-commands:
+- |
+ case "$MORPH_ARCH" in
+ armv7b|armv7l|armv7lhf)
+ ARCH="arm" ;;
+ x86_32)
+ ARCH="i386" ;;
+ x86_64)
+ ARCH="x86_64" ;;
+ ppc64)
+ ARCH="powerpc" ;;
+ *)
+ echo "Error: unsupported Morph architecture: $MORPH_ARCH" >&2
+ exit 1
+ esac
+ ARCH=$ARCH make INSTALL_HDR_PATH=dest headers_install
+- install -d "$DESTDIR${PREFIX-/usr}/include"
+- cp -r dest/include/* "$DESTDIR/${PREFIX-/usr}/include"
diff --git a/strata/build-essential-musl/stage2-make.morph b/strata/build-essential-musl/stage2-make.morph
new file mode 100644
index 00000000..c33b9f1f
--- /dev/null
+++ b/strata/build-essential-musl/stage2-make.morph
@@ -0,0 +1,9 @@
+name: stage2-make
+kind: chunk
+build-system: autotools
+configure-commands:
+- STAGE2_SYSROOT="$(dirname $(pwd))" CPPFLAGS="--sysroot=$STAGE2_SYSROOT" CXX=false
+ LDFLAGS="--sysroot=$STAGE2_SYSROOT" ./configure --prefix="$PREFIX" --disable-nls
+ --build=$(sh config/config.guess) --host=x86_64-linux-musl
+build-commands:
+- STAGE2_SYSROOT="$(dirname $(pwd))" make
diff --git a/strata/build-essential-musl/stage2-musl.morph b/strata/build-essential-musl/stage2-musl.morph
new file mode 100644
index 00000000..cd84f3b0
--- /dev/null
+++ b/strata/build-essential-musl/stage2-musl.morph
@@ -0,0 +1,47 @@
+name: stage2-musl
+kind: chunk
+configure-commands:
+# Configure flag notes:
+# 1. Avoid installing to PREFIX/lib64 on x86_64.
+# 2. Location of linux-api-headers.
+# 3. Normal flags. See glibc.morph.
+# 4. Force configuration values of certain things that can't be detected
+# in a cross-compile.
+- |
+ export CFLAGS="-O2 $CFLAGS"; export CXX=false; \
+ ./configure \
+ CROSS_COMPILE=x86_64-linux-musl- \
+ $ARCH_FLAGS \
+ --prefix="$PREFIX" \
+ --host=x86_64-linux-musl \
+ --disable-gcc-wrapper \
+ `# [1]` --libdir="$PREFIX/lib" \
+ `# [2]` --with-headers="$(pwd)/../../$PREFIX/include" \
+ `# [3]` --disable-profile --enable-kernel=2.6.25 \
+ `# [4]` libc_cv_c_cleanup=yes libc_cv_ctors_header=yes \
+ libc_cv_forced_unwind=yes libc_cv_ssp=no
+
+build-commands:
+- make localtime=UTC
+
+install-commands:
+- make install_root="$DESTDIR" localtime=UTC install
+- sh stage2-musl-fix-specs
+
+# Install a symlink for the program interpreter (ld.so) so that binaries
+# built in stage 3 before the stage 3 musl is built can use it.
+# sysdeps/unix/sysv/linux/configure.
+- install -d $DESTDIR/lib
+- |
+ cpu=$(echo $TARGET | cut -d '-' -f 1)
+ case "$cpu" in
+ x86_64)
+ cd "$DESTDIR$PREFIX"/lib ; ln -s libc.so ld-musl-x86_64.so.1 ;;
+ ppc64)
+ install -d "$DESTDIR/lib64"
+ ln -s "$PREFIX/lib/ld64.so.1" \
+ "$DESTDIR/lib64/ld64.so.1" ;;
+ *)
+ loader=$(basename $(ls "$DESTDIR$PREFIX"/lib/ld-musl*))
+ ln -s "$PREFIX/lib/$loader" "$DESTDIR/lib/$loader"
+ esac
diff --git a/strata/build-essential-musl/stage2-reset-specs.morph b/strata/build-essential-musl/stage2-reset-specs.morph
new file mode 100644
index 00000000..82b4f0b7
--- /dev/null
+++ b/strata/build-essential-musl/stage2-reset-specs.morph
@@ -0,0 +1,22 @@
+name: stage2-reset-specs
+kind: chunk
+
+# Nasty hack to get around being unable to reliably add configuration to gcc,
+# hence the gcc specs are modified, combined with Baserock's rootfs protection
+# preventing specs being modified before builds.
+# The limitation is overcome by installing files as part of a chunk, which
+# overwrites previous files.
+# New specs were added for the bootstrap builds, but after stage2 we start
+# having chrooted builds, so the old specs need to be replaced.
+# Unfortunately we can't just replace the specs with the ones gcc produces,
+# since gcc behaves differently without specs to with specs it produces!
+# So we use a **NASTY HACK** to replace the specs symlink with one that
+# points to a file that doesn't exist.
+install-commands:
+- |
+ TARGET_STAGE1=`echo $TARGET_STAGE1 | sed -e 's/bootstrap-linux-gnu/linux-musl/'`
+ STAGE2_SYSROOT="$(dirname "$(pwd)")"
+ specs_dir="$(dirname $($TARGET_STAGE1-gcc -print-libgcc-file-name))"
+ target_specs_dir="$DESTDIR/${specs_dir#$STAGE2_SYSROOT}"
+ mkdir -p "$target_specs_dir"
+ ln -s "temporary specs removed by baserock bootstrap" "$target_specs_dir/specs"
diff --git a/strata/build-essential-musl/zlib.morph b/strata/build-essential-musl/zlib.morph
new file mode 100644
index 00000000..a69eebf3
--- /dev/null
+++ b/strata/build-essential-musl/zlib.morph
@@ -0,0 +1,9 @@
+name: zlib
+kind: chunk
+max-jobs: 1
+configure-commands:
+- ./configure --prefix="$PREFIX"
+build-commands:
+- make
+install-commands:
+- make DESTDIR="$DESTDIR" install