forked from pojntfx/ipxe-binaries
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Hydrunfile
executable file
·66 lines (52 loc) · 2.04 KB
/
Hydrunfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
set -e
# C
if [ "$1" = "c" ]; then
# Install native dependencies
apt update
apt install -y git make build-essential liblzma-dev gcc-arm-linux-gnueabi gcc-aarch64-linux-gnu ccache
# Configure Git
git config --global --add safe.directory '*'
# Get latest iPXE release
rm -rf ipxe
git clone https://github.com/ipxe/ipxe.git
cd ipxe/src
# We use the latest `master` branch since the release is broken (see https://github.com/ipxe/ipxe/issues/1293),
# also run `git checkout $(git tag --sort=-v:refname | head -n1)` once there is a release with the fix
# Enable HTTPS
sed -i -e 's/#undef\tDOWNLOAD_PROTO_HTTPS/#define\tDOWNLOAD_PROTO_HTTPS/g' config/general.h
# Add the embedded script
cp ../../config/init.ipxe .
# Configure make
EMBEDDED_MAKE() {
make EMBED="init.ipxe" -j"$(nproc)" "$@"
}
# Configure ccache
ccache -F 0
ccache -M 0
# Get ccache stats
ccache -s
# Build
EMBEDDED_MAKE CROSS_COMPILE="ccache " bin-i386-pcbios/ipxe.kpxe
EMBEDDED_MAKE CROSS_COMPILE="ccache " bin-i386-efi/ipxe.efi
EMBEDDED_MAKE CROSS_COMPILE="ccache " bin-x86_64-efi/ipxe.efi
EMBEDDED_MAKE CROSS_COMPILE="ccache " bin-x86_64-pcbios/undionly.kpxe
EMBEDDED_MAKE CROSS_COMPILE="ccache arm-linux-gnueabi-" ARCH=arm32 bin-arm32-efi/snp.efi
EMBEDDED_MAKE CROSS_COMPILE="ccache aarch64-linux-gnu-" ARCH=arm64 bin-arm64-efi/snp.efi
# Stage into temporary directory
mkdir -p /tmp/out
cp bin-i386-pcbios/ipxe.kpxe /tmp/out/ipxe-i386.kpxe
cp bin-i386-efi/ipxe.efi /tmp/out/ipxe-i386.efi
cp bin-x86_64-efi/ipxe.efi /tmp/out/ipxe-x86_64.efi
cp bin-arm32-efi/snp.efi /tmp/out/ipxe-arm32.efi
cp bin-arm64-efi/snp.efi /tmp/out/ipxe-arm64.efi
cp bin-x86_64-pcbios/undionly.kpxe /tmp/out/undionly.kpxe
cp ../../config/config.go /tmp/out
cp ../../config/config.ipxe /tmp/out
# Create tar archive in out directory
mkdir -p ../../out
tar -zcvf ../../out/ipxe.tar.gz -C /tmp/out .
# Get ccache stats
ccache -s
exit 0
fi