Skip to content
This repository has been archived by the owner on Nov 6, 2024. It is now read-only.

Commit

Permalink
save
Browse files Browse the repository at this point in the history
  • Loading branch information
Scarjit committed Aug 5, 2024
1 parent d8e6a15 commit 7a380a9
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 24 deletions.
1 change: 1 addition & 0 deletions .idea/ipxe.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
21 changes: 21 additions & 0 deletions compile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

set -e

# Cleanup output directory (if exists)
rm -rf output

# Create output directory
mkdir -p output

# Update submodules
git submodule update --init --recursive

# Remove existing docker image
docker rmi unitedmanufacturinghub/ipxe:latest

# Build new docker image with cache busting
docker build -t unitedmanufacturinghub/ipxe:latest --build-arg CACHEBUST=$(date +%s) .

# Run the docker container and log the output
docker run --rm -v "$(pwd)/output:/output" -it unitedmanufacturinghub/ipxe:latest | tee output/ipxe.log
1 change: 1 addition & 0 deletions config/embed.ipxe
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ item installvdb Install to VDB
item installvdc Install to VDC
item listpci List all PCI devices
item customtoken Custom token
item shell Open shell
choose --default installsda --timeout 30000 target && goto ${target} || goto menu

:installsda
Expand Down
75 changes: 51 additions & 24 deletions make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,59 @@ set -e
# Remove old build files
rm -rf bin-*

echo "Building x86_64-efi"
make -j bin-x86_64-efi/ipxe.iso EMBED=embed.ipxe CERT=ca.pem,isrgrootx1.pem,lets-encrypt-r3.pem TRUST=ca.pem,isrgrootx1.pem,lets-encrypt-r3.pem
make -j bin-x86_64-efi/ipxe.usb EMBED=embed.ipxe CERT=ca.pem,isrgrootx1.pem,lets-encrypt-r3.pem TRUST=ca.pem,isrgrootx1.pem,lets-encrypt-r3.pem

echo "Building x86_64-bios"
make -j bin-x86_64-pcbios/ipxe.iso EMBED=embed.ipxe CERT=ca.pem,isrgrootx1.pem,lets-encrypt-r3.pem TRUST=ca.pem,isrgrootx1.pem,lets-encrypt-r3.pem
make -j bin-x86_64-pcbios/ipxe.usb EMBED=embed.ipxe CERT=ca.pem,isrgrootx1.pem,lets-encrypt-r3.pem TRUST=ca.pem,isrgrootx1.pem,lets-encrypt-r3.pem
make -j bin-x86_64-pcbios/ipxe.vhd EMBED=embed.ipxe CERT=ca.pem,isrgrootx1.pem,lets-encrypt-r3.pem TRUST=ca.pem,isrgrootx1.pem,lets-encrypt-r3.pem

# arm64-efi
echo "Building arm64-efi"
make -j CROSS=aarch64-linux-gnu- bin-arm64-efi/ipxe.iso EMBED=embed.ipxe CERT=ca.pem,isrgrootx1.pem,lets-encrypt-r3.pem TRUST=ca.pem,isrgrootx1.pem,lets-encrypt-r3.pem
make -j CROSS=aarch64-linux-gnu- bin-arm64-efi/ipxe.usb EMBED=embed.ipxe CERT=ca.pem,isrgrootx1.pem,lets-encrypt-r3.pem TRUST=ca.pem,isrgrootx1.pem,lets-encrypt-r3.pem
# Variables
EMBED="embed.ipxe"
CERT_TRUST=(
"ca.pem"
"isrgrootx1.pem"
"lets-encrypt-r3.pem"
)

# Convert array to comma-separated string
CERT_TRUST_STR=$(IFS=, ; echo "${CERT_TRUST[*]}")

# Build targets
declare -A targets=(
["x86_64-efi"]="bin-x86_64-efi/ipxe.iso bin-x86_64-efi/ipxe.usb"
["x86_64-bios"]="bin-x86_64-pcbios/ipxe.iso bin-x86_64-pcbios/ipxe.usb bin-x86_64-pcbios/ipxe.vhd"
["arm64-efi"]="bin-arm64-efi/ipxe.iso bin-arm64-efi/ipxe.usb"
)

# Make builds
for target in "${!targets[@]}"; do
echo "Building $target"
for output in ${targets[$target]}; do
if [[ $target == "arm64-efi" ]]; then
make -j CROSS=aarch64-linux-gnu- $output \
EMBED=$EMBED \
CERT=$CERT_TRUST_STR \
TRUST=$CERT_TRUST_STR
else
make -j $output \
EMBED=$EMBED \
CERT=$CERT_TRUST_STR \
TRUST=$CERT_TRUST_STR
fi
done
done

# Copy output files
output_dir="/output"
declare -A output_files=(
["bin-x86_64-efi/ipxe.iso"]="$output_dir/ipxe-x86_64-efi.iso"
["bin-x86_64-efi/ipxe.usb"]="$output_dir/ipxe-x86_64-efi.usb"
["bin-x86_64-pcbios/ipxe.iso"]="$output_dir/ipxe-x86_64-bios.iso"
["bin-x86_64-pcbios/ipxe.usb"]="$output_dir/ipxe-x86_64-bios.usb"
["bin-x86_64-pcbios/ipxe.vhd"]="$output_dir/ipxe-x86_64-bios.vhd"
["bin-arm64-efi/ipxe.iso"]="$output_dir/ipxe-arm64-efi.iso"
["bin-arm64-efi/ipxe.usb"]="$output_dir/ipxe-arm64-efi.usb"
)

echo "Copying output files"

cp bin-x86_64-efi/ipxe.iso /output/ipxe-x86_64-efi.iso
cp bin-x86_64-efi/ipxe.usb /output/ipxe-x86_64-efi.usb

cp bin-x86_64-pcbios/ipxe.iso /output/ipxe-x86_64-bios.iso
cp bin-x86_64-pcbios/ipxe.usb /output/ipxe-x86_64-bios.usb
cp bin-x86_64-pcbios/ipxe.vhd /output/ipxe-x86_64-bios.vhd

cp bin-arm64-efi/ipxe.iso /output/ipxe-arm64-efi.iso
cp bin-arm64-efi/ipxe.usb /output/ipxe-arm64-efi.usb
for src in "${!output_files[@]}"; do
cp $src ${output_files[$src]}
done

# Generate SHA256 sum for each file
cd /output || exit 1
cd $output_dir || exit 1
sha256sum ./* > sha256sum.txt

0 comments on commit 7a380a9

Please sign in to comment.