summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2014-10-02 10:55:23 +0100
committerSam Thursfield <sam.thursfield@codethink.co.uk>2014-10-02 10:55:23 +0100
commit6d4a0ec6caa5a1f1f1a73a7a8bd061889cf06299 (patch)
tree6a0928e1aadf2527e16d2ead1a571bfa7da19c71
parentd107a96317a05ec3238ff7bce94cd6cbf12398bf (diff)
parente9dbfdc623101442370d51525e8cdbe3867eab02 (diff)
downloaddefinitions-6d4a0ec6caa5a1f1f1a73a7a8bd061889cf06299.tar.gz
Merge branch 'baserock/sam/build-essential-comments'
Reviewed-By: Pedro Alvarez <pedro.alvarez@codethink.co.uk> Reviewed-By: Richard Maw <richard.maw@codethink.co.uk>
-rw-r--r--strata/armv7lhf-cross-toolchain/armv7lhf-cross-binutils.morph1
-rw-r--r--strata/armv7lhf-cross-toolchain/armv7lhf-cross-eglibc.morph14
-rw-r--r--strata/armv7lhf-cross-toolchain/armv7lhf-cross-gcc-nolibc.morph19
-rw-r--r--strata/armv7lhf-cross-toolchain/armv7lhf-cross-gcc.morph10
-rw-r--r--strata/build-essential/binutils.morph1
-rw-r--r--strata/build-essential/busybox.morph67
-rw-r--r--strata/build-essential/eglibc.morph5
-rw-r--r--strata/build-essential/gcc.morph16
-rw-r--r--strata/build-essential/stage1-binutils.morph7
-rw-r--r--strata/build-essential/stage1-gcc.morph18
-rw-r--r--strata/build-essential/stage2-binutils.morph5
-rw-r--r--strata/build-essential/stage2-busybox.morph43
-rw-r--r--strata/build-essential/stage2-eglibc.morph18
-rw-r--r--strata/build-essential/stage2-gcc-fixed-headers.morph9
-rw-r--r--strata/build-essential/stage2-gcc.morph28
-rw-r--r--strata/build-essential/stage2-reset-specs.morph12
16 files changed, 237 insertions, 36 deletions
diff --git a/strata/armv7lhf-cross-toolchain/armv7lhf-cross-binutils.morph b/strata/armv7lhf-cross-toolchain/armv7lhf-cross-binutils.morph
index d92150a5..8e842e41 100644
--- a/strata/armv7lhf-cross-toolchain/armv7lhf-cross-binutils.morph
+++ b/strata/armv7lhf-cross-toolchain/armv7lhf-cross-binutils.morph
@@ -1,6 +1,7 @@
name: armv7lhf-cross-binutils
kind: chunk
build-system: autotools
+
configure-commands:
- |
# The TARGET used is the final triplet we expect, rather than that
diff --git a/strata/armv7lhf-cross-toolchain/armv7lhf-cross-eglibc.morph b/strata/armv7lhf-cross-toolchain/armv7lhf-cross-eglibc.morph
index afbfa939..ee28c9dd 100644
--- a/strata/armv7lhf-cross-toolchain/armv7lhf-cross-eglibc.morph
+++ b/strata/armv7lhf-cross-toolchain/armv7lhf-cross-eglibc.morph
@@ -1,8 +1,20 @@
name: armv7lhf-cross-eglibc
kind: chunk
+
configure-commands:
- mkdir o
+
+# Necessary for ARM port
- cd libc && ln -s ../ports ports
+
+# Configure flag notes:
+# 1. Location of linux-api-headers, needed since eglibc doesn't
+# support being given a sysroot.
+# 2. Location of binutils, since we build binutils for the final
+# target triplet, but our gcc of our stage 1 target triplet.
+# 3. Normal flags. See eglibc.morph.
+# 4. Force configuration values of certain things that can't be detected
+# in a cross-compile.
- |
export MORPH_ARCH=armv7lhf
export TARGET=armv7lhf-baserock-linux-gnueabi
@@ -22,8 +34,10 @@ configure-commands:
--enable-add-ons=nptl,ports --without-cvs --without-selinux \
`# [4]` libc_cv_c_cleanup=yes libc_cv_ctors_header=yes \
libc_cv_forced_unwind=yes libc_cv_ssp=no
+
build-commands:
- cd o && make localtime=UTC
+
install-commands:
- |
# eglibc doesn't help with sysroots, so we need to spell out the
diff --git a/strata/armv7lhf-cross-toolchain/armv7lhf-cross-gcc-nolibc.morph b/strata/armv7lhf-cross-toolchain/armv7lhf-cross-gcc-nolibc.morph
index 9f993bc0..d164a60b 100644
--- a/strata/armv7lhf-cross-toolchain/armv7lhf-cross-gcc-nolibc.morph
+++ b/strata/armv7lhf-cross-toolchain/armv7lhf-cross-gcc-nolibc.morph
@@ -1,7 +1,20 @@
name: armv7lhf-cross-gcc-nolibc
kind: chunk
+
configure-commands:
- mkdir o
+
+# Configure flag notes:
+# 1. Standard flags. See gcc.morph.
+# 2. Our binutils is for the final $TARGET, rather than the intermediate
+# target our GCC is being built for, so we need to set
+# with-build-time-tools to get it to find our binutils at
+# build-time and with-as and with-ld so our temporary GCC uses
+# the appropriate tools when it compiles our libc, rather than
+# trying to use $TARGET_STAGE1-as when producing binaries.
+# 3. 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.
- |
export MORPH_ARCH=armv7lhf
export TARGET=armv7lhf-baserock-linux-gnueabi
@@ -25,10 +38,16 @@ configure-commands:
--disable-shared --disable-threads --disable-target-libiberty \
--disable-target-zlib --without-headers --with-newlib \
--with-system-zlib
+
build-commands:
- cd o && make
+
install-commands:
- cd o && make DESTDIR="$DESTDIR" install
+
+# The file libgcc_eh is required during eglibc's build, but is not created
+# because we built GCC with --disable-shared. This is a workaround for
+# eglibc's build system being slightly broken.
- |
export TARGET_STAGE1=armv7lhf-none-linux-gnueabi
libgcc_filename="$("$DESTDIR$PREFIX/bin/$TARGET_STAGE1-gcc" -print-libgcc-file-name)"
diff --git a/strata/armv7lhf-cross-toolchain/armv7lhf-cross-gcc.morph b/strata/armv7lhf-cross-toolchain/armv7lhf-cross-gcc.morph
index a5c6eac1..50c338e5 100644
--- a/strata/armv7lhf-cross-toolchain/armv7lhf-cross-gcc.morph
+++ b/strata/armv7lhf-cross-toolchain/armv7lhf-cross-gcc.morph
@@ -1,7 +1,15 @@
name: armv7lhf-cross-gcc
kind: chunk
+
configure-commands:
- mkdir o
+
+# Configure flag notes:
+# 1. Use the default sysroot path to install to and locate headers
+# 2. Recommended by Linux From Scratch; required for C++ ABI
+# compatibility with other Linux distributions.
+# 3. Standard flags. See gcc.morph.
+# 4. Avoid having more than one copy of ZLib in use on the system
- |
export MORPH_ARCH=armv7lhf
export TARGET=armv7lhf-baserock-linux-gnueabi
@@ -23,8 +31,10 @@ configure-commands:
--with-mpfr-include="$(pwd)/../mpfr/src" \
--with-mpfr-lib="$(pwd)/mpfr/src/.libs" \
`# [4]` --with-system-zlib
+
build-commands:
- cd o && make
+
install-commands:
- cd o && make DESTDIR="$DESTDIR" install
- |
diff --git a/strata/build-essential/binutils.morph b/strata/build-essential/binutils.morph
index 81d4d6f7..bab52672 100644
--- a/strata/build-essential/binutils.morph
+++ b/strata/build-essential/binutils.morph
@@ -1,6 +1,7 @@
name: binutils
kind: chunk
build-system: autotools
+
configure-commands:
- |
./configure --prefix="$PREFIX" --disable-nls --disable-werror \
diff --git a/strata/build-essential/busybox.morph b/strata/build-essential/busybox.morph
index df7bf008..b0bb46f5 100644
--- a/strata/build-essential/busybox.morph
+++ b/strata/build-essential/busybox.morph
@@ -1,31 +1,41 @@
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
-- '[ "$PREFIX" = /usr ] || sed -e ''s/.*INSTALL_NO_USR.*/CONFIG_INSTALL_NO_USR=y/''
- -i .config'
+
+- 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
-- sed -e 's/CONFIG_FEATURE_MOUNT_CIFS=y.*/# CONFIG_FEATURE_MOUNT_CIFS 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
+
+# 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_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_MINIX2=y.*/# CONFIG_FEATURE_MINIX2 is not set/' -i .config
- sed -e 's/CONFIG_FSCK_MINIX=y.*/# CONFIG_FSCK_MINIX is not set/' -i .config
@@ -38,11 +48,13 @@ configure-commands:
- 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
+
+# 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
+- 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
- |
@@ -51,12 +63,16 @@ build-commands:
f=$(echo "$fin" | sed 's/\.in$//')
sed -e 's|@rootprefix@||g' "$fin" >"$f";
done
+
install-commands:
- |
if [ "$PREFIX" = /usr ]; then PREFIX=; fi &&
make CONFIG_PREFIX="$DESTDIR$PREFIX" install &&
chmod 6755 "$DESTDIR$PREFIX"/bin/busybox
+
- mkdir -p "$DESTDIR/var/spool/cron/crontabs"
+
+# Install systemd units
- mkdir -p "$DESTDIR/lib/systemd/system/multi-user.target.wants"
- |
for f in systemd-units/*.service; do
@@ -66,11 +82,18 @@ install-commands:
for f in $(cd systemd-units; ls *.service | grep -v -F "@"); do
ln -s "../$f" "$DESTDIR/lib/systemd/system/multi-user.target.wants/";
done
+
+# Install custom udev rule to run ifup for every network device detected
- mkdir -p "$DESTDIR/lib/udev/rules.d"
-- for f in udev-rules/100-baserock.rules; do install -m 644 "$f" "$DESTDIR/lib/udev/rules.d";
+- for f in udev-rules/100-baserock.rules; do
+ install -m 644 "$f" "$DESTDIR/lib/udev/rules.d";
done
+
+# Set up DHCP
- mkdir -p "$DESTDIR$PREFIX"/share/udhcpc
- cp examples/udhcp/simple.script "$DESTDIR$PREFIX"/share/udhcpc/default.script
+
+# Set up NTP
- install scripts/run-ntpd-with-config "$DESTDIR$PREFIX"/sbin/.
- install -d "$DESTDIR/etc"
- |
@@ -80,6 +103,8 @@ install-commands:
server 2.pool.ntp.org
server 3.pool.ntp.org
EOF
+
+# Set up man environment variables
- |
cat << EOF > "$DESTDIR/etc/profile"
# Set default pager to less
diff --git a/strata/build-essential/eglibc.morph b/strata/build-essential/eglibc.morph
index 6f781a53..cc827ef9 100644
--- a/strata/build-essential/eglibc.morph
+++ b/strata/build-essential/eglibc.morph
@@ -38,7 +38,10 @@ products:
- .*
configure-commands:
- mkdir o
+
+# Necessary for ARM port
- cd libc && ln -s ../ports ports
+
- |
export CFLAGS="-O2 $CFLAGS"; cd o &&
../libc/configure \
@@ -49,8 +52,10 @@ configure-commands:
--enable-add-ons=nptl,ports \
--without-cvs \
--without-selinux
+
build-commands:
- cd o && make localtime=UTC
+
install-commands:
- cd o && make install_root="$DESTDIR" localtime=UTC install
- mkdir -p "$DESTDIR/etc"
diff --git a/strata/build-essential/gcc.morph b/strata/build-essential/gcc.morph
index c57edb61..50e2918c 100644
--- a/strata/build-essential/gcc.morph
+++ b/strata/build-essential/gcc.morph
@@ -1,7 +1,19 @@
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. Multilib does not make sense in Baserock.
+# 3. Optimisation libraries which for now we do without.
+# 4. Recommended by Linux From Scratch; required for C++ ABI
+# compatibility with other Linux distributions.
+# 5. MPFR is built in the GCC tree, we need to locate it.
+# 6. Avoid having more than one copy of ZLib in use on the system
- |
cd o && \
../configure \
@@ -17,12 +29,14 @@ configure-commands:
`# [5]` --with-mpfr-include="$(pwd)/../mpfr/src" \
--with-mpfr-lib="$(pwd)/mpfr/src/.libs" \
`# [6]` --with-system-zlib
+
build-commands:
- 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/stage1-binutils.morph b/strata/build-essential/stage1-binutils.morph
index d3e73a87..b6670d5c 100644
--- a/strata/build-essential/stage1-binutils.morph
+++ b/strata/build-essential/stage1-binutils.morph
@@ -1,7 +1,14 @@
name: stage1-binutils
kind: chunk
build-system: autotools
+
configure-commands:
+# We set the sysroot location dynamically at runtime by passing -B to GCC,
+# so we configure with 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.
+
- |
./configure --prefix="$PREFIX" --disable-nls --disable-werror \
--build=$(sh config.guess) \
diff --git a/strata/build-essential/stage1-gcc.morph b/strata/build-essential/stage1-gcc.morph
index 0e0c2d81..0cb03568 100644
--- a/strata/build-essential/stage1-gcc.morph
+++ b/strata/build-essential/stage1-gcc.morph
@@ -1,7 +1,19 @@
name: stage1-gcc
kind: chunk
+
configure-commands:
- mkdir o
+
+# Configure flag notes:
+# 1. Standard flags. See gcc.morph.
+# 2. Disable searching /usr/local/include for headers
+# 3. 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.
+# FIXME: this flag is not present until GCC 4.6.3!
+# 4. 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.
- |
cd o &&
../configure \
@@ -21,10 +33,16 @@ configure-commands:
--disable-shared --disable-threads --disable-target-libiberty \
--disable-target-zlib --without-headers --with-newlib \
--with-system-zlib
+
build-commands:
- cd o && make
+
install-commands:
- cd o && make DESTDIR="$DESTDIR" install
+
+# The file libgcc_eh is required during eglibc's build, but is not created
+# because we built GCC with --disable-shared. This is a workaround for
+# eglibc's build system being slightly broken.
- |
libgcc_filename=$($DESTDIR$PREFIX/bin/$TARGET_STAGE1-gcc -print-libgcc-file-name)
ln -sv libgcc.a $(echo $libgcc_filename | sed 's/libgcc/&_eh/')
diff --git a/strata/build-essential/stage2-binutils.morph b/strata/build-essential/stage2-binutils.morph
index a3701b2c..bc0b18ac 100644
--- a/strata/build-essential/stage2-binutils.morph
+++ b/strata/build-essential/stage2-binutils.morph
@@ -1,6 +1,7 @@
name: stage2-binutils
kind: chunk
build-system: autotools
+
configure-commands:
- |
export STAGE2_SYSROOT="$(dirname $(pwd))"
@@ -11,7 +12,11 @@ configure-commands:
--build=$(sh config.guess) \
--host=$TARGET_STAGE1 \
--target=$TARGET_STAGE1
+
build-commands:
+# Nested configure scripts require that we set CPPFLAGS here as well
+# (I don't think we should have to .. . at least in GCC, I think
+# TARGET_CPPFLAGS may be the answer)
- |
export STAGE2_SYSROOT="$(dirname $(pwd))"
export CPPFLAGS="--sysroot=$STAGE2_SYSROOT"
diff --git a/strata/build-essential/stage2-busybox.morph b/strata/build-essential/stage2-busybox.morph
index 7d17ea40..dc23d09b 100644
--- a/strata/build-essential/stage2-busybox.morph
+++ b/strata/build-essential/stage2-busybox.morph
@@ -1,31 +1,42 @@
name: stage2-busybox
kind: chunk
+
configure-commands:
+# 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
-- '[ "$PREFIX" = /usr ] || sed -e ''s/.*INSTALL_NO_USR.*/CONFIG_INSTALL_NO_USR=y/''
- -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.
- 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
-- sed -e 's/CONFIG_FEATURE_MOUNT_CIFS=y.*/# CONFIG_FEATURE_MOUNT_CIFS 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
+
+# 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_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_USE_INITTAB=y.*/# CONFIG_FEATURE_USE_INITTAB 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_FSCK_MINIX=y.*/# CONFIG_FSCK_MINIX is not set/' -i .config
- sed -e 's/CONFIG_HALT=y.*/# CONFIG_HALT is not set/' -i .config
@@ -41,13 +52,17 @@ configure-commands:
- 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
+
build-commands:
- |
export STAGE2_SYSROOT="$(dirname $(pwd))"
export CPPFLAGS="--sysroot=$STAGE2_SYSROOT"
export LDFLAGS="-Wl,--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.
- |
export STAGE2_SYSROOT="$(dirname $(pwd))"
export CPPFLAGS="--sysroot=$STAGE2_SYSROOT"
diff --git a/strata/build-essential/stage2-eglibc.morph b/strata/build-essential/stage2-eglibc.morph
index 05b0e231..3a7277ac 100644
--- a/strata/build-essential/stage2-eglibc.morph
+++ b/strata/build-essential/stage2-eglibc.morph
@@ -1,8 +1,18 @@
name: stage2-eglibc
kind: chunk
+
configure-commands:
- mkdir o
+
+# Necessary for ARM port
- cd libc && ln -s ../ports ports
+
+# Configure flag notes:
+# 1. Avoid installing to PREFIX/lib64 on x86_64.
+# 2. Location of linux-api-headers.
+# 3. Normal flags. See eglibc.morph.
+# 4. Force configuration values of certain things that can't be detected
+# in a cross-compile.
- |
export CFLAGS="-O2 $CFLAGS"; export CXX=false; \
cd o && ../libc/configure \
@@ -15,11 +25,19 @@ configure-commands:
--enable-add-ons=nptl,ports --without-cvs --without-selinux \
`# [4]` libc_cv_c_cleanup=yes libc_cv_ctors_header=yes \
libc_cv_forced_unwind=yes libc_cv_ssp=no
+
build-commands:
- cd o && make localtime=UTC
+
install-commands:
- cd o && make install_root="$DESTDIR" localtime=UTC install
- sh stage2-eglibc-fix-specs
+
+# Install a symlink for the program interpreter (ld.so) so that binaries
+# built in stage 3 before the stage 3 eglibc is built can use it.
+# FIXME: get a better way of finding the name of the loader. The lib64
+# path is hardcoded into eglibc in the file
+# sysdeps/unix/sysv/linux/configure.
- install -d $DESTDIR/lib
- |
cpu=$(echo $TARGET | cut -d '-' -f 1)
diff --git a/strata/build-essential/stage2-gcc-fixed-headers.morph b/strata/build-essential/stage2-gcc-fixed-headers.morph
index 2c4741ee..10794872 100644
--- a/strata/build-essential/stage2-gcc-fixed-headers.morph
+++ b/strata/build-essential/stage2-gcc-fixed-headers.morph
@@ -1,6 +1,14 @@
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.
- |
libgcc_dir=$(dirname $($TARGET_STAGE1-gcc -print-libgcc-file-name))
sysroot="$(dirname "$(pwd)")"
@@ -8,3 +16,4 @@ install-commands:
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/stage2-gcc.morph b/strata/build-essential/stage2-gcc.morph
index e342d648..bf6378c1 100644
--- a/strata/build-essential/stage2-gcc.morph
+++ b/strata/build-essential/stage2-gcc.morph
@@ -1,7 +1,25 @@
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 targets the bootstrap machine
+# (TARGET_STAGE1) so that the stage 1 GCC is used instead of the
+# compiler of the build machine.
+# 2. Disable searching /usr/local/include for headers
+# 3. This flag causes the correct --sysroot flag to be passed when calling
+# stage 1 GCC.
+# 4. C++ is built in stage 3.
+# 5. Standard flags. See gcc.morph.
- |
export STAGE2_SYSROOT="$(dirname $(pwd))"
export CC="$TARGET_STAGE1-gcc --sysroot=$STAGE2_SYSROOT"
@@ -22,12 +40,22 @@ configure-commands:
--without-cloog --without-ppl \
--with-mpfr-include="$(pwd)/../mpfr/src" \
--with-mpfr-lib="$(pwd)/mpfr/src/.libs"
+
build-commands:
- |
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
diff --git a/strata/build-essential/stage2-reset-specs.morph b/strata/build-essential/stage2-reset-specs.morph
index 6495909c..8892f67c 100644
--- a/strata/build-essential/stage2-reset-specs.morph
+++ b/strata/build-essential/stage2-reset-specs.morph
@@ -1,5 +1,17 @@
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:
- |
STAGE2_SYSROOT="$(dirname "$(pwd)")"