Lorenz Brun | f95909d | 2019-09-11 19:48:26 +0200 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | set -eo pipefail |
| 3 | |
Leopold Schabel | 67f9d09 | 2019-10-22 15:41:42 +0200 | [diff] [blame] | 4 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
| 5 | ROOT=$(realpath ${DIR}/../.vendor) |
| 6 | |
| 7 | echo "Vendor build root: $ROOT" |
| 8 | |
| 9 | if [ ! -d "$ROOT/linux" ] ; then |
Lorenz Brun | f95909d | 2019-09-11 19:48:26 +0200 | [diff] [blame] | 10 | echo "Please first call scripts/fetch_third_party.sh" |
Leopold Schabel | 67f9d09 | 2019-10-22 15:41:42 +0200 | [diff] [blame] | 11 | exit 1 |
Lorenz Brun | f95909d | 2019-09-11 19:48:26 +0200 | [diff] [blame] | 12 | fi |
| 13 | |
Leopold Schabel | 67f9d09 | 2019-10-22 15:41:42 +0200 | [diff] [blame] | 14 | if [ ! -d "$ROOT/edk2" ] ; then |
| 15 | git clone --single-branch --branch edk2-stable201908 --depth=1 --recurse-submodules https://github.com/tianocore/edk2 $ROOT/edk2 |
Lorenz Brun | f95909d | 2019-09-11 19:48:26 +0200 | [diff] [blame] | 16 | fi |
Lorenz Brun | f95909d | 2019-09-11 19:48:26 +0200 | [diff] [blame] | 17 | |
Leopold Schabel | 67f9d09 | 2019-10-22 15:41:42 +0200 | [diff] [blame] | 18 | ( |
| 19 | cd $ROOT/edk2 |
| 20 | . edksetup.sh |
| 21 | make -C BaseTools/Source/C |
| 22 | build -DTPM2_ENABLE -DSECURE_BOOT_ENABLE -t GCC5 -a X64 -b RELEASE -p $PWD/OvmfPkg/OvmfPkgX64.dsc |
Lorenz Brun | f95909d | 2019-09-11 19:48:26 +0200 | [diff] [blame] | 23 | |
Leopold Schabel | 67f9d09 | 2019-10-22 15:41:42 +0200 | [diff] [blame] | 24 | cp Build/OvmfX64/RELEASE_GCC5/FV/{OVMF_CODE.fd,OVMF_VARS.fd} $ROOT/../.artifacts |
| 25 | ) |
Lorenz Brun | f95909d | 2019-09-11 19:48:26 +0200 | [diff] [blame] | 26 | |
Leopold Schabel | 67f9d09 | 2019-10-22 15:41:42 +0200 | [diff] [blame] | 27 | musl_prefix=$ROOT/musl-prefix |
Lorenz Brun | f95909d | 2019-09-11 19:48:26 +0200 | [diff] [blame] | 28 | |
Leopold Schabel | 67f9d09 | 2019-10-22 15:41:42 +0200 | [diff] [blame] | 29 | ( |
| 30 | cd $ROOT/linux |
| 31 | make headers_install ARCH=x86_64 INSTALL_HDR_PATH=$musl_prefix |
| 32 | ) |
Lorenz Brun | f95909d | 2019-09-11 19:48:26 +0200 | [diff] [blame] | 33 | |
Leopold Schabel | 67f9d09 | 2019-10-22 15:41:42 +0200 | [diff] [blame] | 34 | mkdir -p $ROOT/musl |
| 35 | curl -L https://www.musl-libc.org/releases/musl-1.1.23.tar.gz | tar -xzf - -C $ROOT/musl --strip-components 1 |
Lorenz Brun | f95909d | 2019-09-11 19:48:26 +0200 | [diff] [blame] | 36 | |
Leopold Schabel | 67f9d09 | 2019-10-22 15:41:42 +0200 | [diff] [blame] | 37 | ( |
| 38 | cd $ROOT/musl |
| 39 | |
| 40 | ./configure --prefix=$musl_prefix --syslibdir=$musl_prefix/lib |
| 41 | make -j8 |
| 42 | make install |
| 43 | ) |
| 44 | |
| 45 | mkdir -p $ROOT/util-linux |
| 46 | curl -L https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git/snapshot/util-linux-2.34.tar.gz | tar -xzf - -C $ROOT/util-linux --strip-components 1 |
| 47 | |
| 48 | ( |
| 49 | cd $ROOT/util-linux |
| 50 | ./autogen.sh |
| 51 | ./configure \ |
| 52 | CC=$musl_prefix/bin/musl-gcc \ |
| 53 | --without-systemd \ |
| 54 | --without-udev \ |
| 55 | --without-btrfs \ |
| 56 | --disable-pylibmount \ |
| 57 | --without-tinfo \ |
| 58 | --prefix=$musl_prefix \ |
| 59 | --disable-makeinstall-chown \ |
| 60 | --disable-makeinstall-setuid \ |
| 61 | --with-bashcompletiondir=$musl_prefix/usr/share/bash-completion |
| 62 | make -j8 |
| 63 | make install |
| 64 | ) |
| 65 | |
| 66 | mkdir -p $ROOT/xfsprogs-dev |
| 67 | curl -L https://git.kernel.org/pub/scm/fs/xfs/xfsprogs-dev.git/snapshot/xfsprogs-dev-5.2.1.tar.gz | tar -xzf - -C $ROOT/xfsprogs-dev --strip-components 1 |
| 68 | |
| 69 | ( |
| 70 | cd $ROOT/xfsprogs-dev |
| 71 | patch -p1 < ../../patches/xfsprogs-dev/*.patch |
| 72 | make configure |
| 73 | ./configure CC=$musl_prefix/bin/musl-gcc "CFLAGS=-static -I$musl_prefix/include -L$musl_prefix/lib" "LDFLAGS=-L$musl_prefix/lib" |
| 74 | make -j8 mkfs |
| 75 | cp $ROOT/xfsprogs-dev/mkfs/mkfs.xfs $ROOT/../.artifacts |
| 76 | ) |