-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This makes better use of our limited amount (10GB) of Github Actions cache storage
- Loading branch information
Showing
4 changed files
with
260 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# Arguments | ||
# 1. Platform (i.e. generic, mpfs, etc) | ||
# 2. Bitness (i.e. 32, 64) | ||
# 3. Buildroot download directory (lower) | ||
# 4. Buildroot download directory (upper) | ||
# 5. Buildroot ccache directory (lower) | ||
# 6. Buildroot ccache directory (upper) | ||
|
||
if [[ "$#" -lt 6 ]]; then | ||
echo "usage: build-keystone.sh [platform] [bits]" | ||
exit 1 | ||
fi | ||
|
||
# Extract arguments | ||
export KEYSTONE_PLATFORM="$1"; shift | ||
export KEYSTONE_BITS="$1"; shift | ||
export DL_LOWER="$1"; shift | ||
export DL_UPPER="$1"; shift | ||
export CCACHE_LOWER="$1"; shift | ||
export CCACHE_UPPER="$1"; shift | ||
|
||
export DL_WORK="$PWD/buildroot/dl-work" | ||
export CCACHE_WORK="$PWD/buildroot-ccache-work" | ||
BUILDSCRIPT=$(mktemp) | ||
|
||
# Generate buildscript. Note that variable substitution happens *here* instead | ||
# of at runtime, which is what we want. | ||
cat <<EOF > "$BUILDSCRIPT" | ||
mkdir -p "$PWD/buildroot/dl" | ||
mkdir -p "$DL_WORK" | ||
mount -t overlay overlay \ | ||
-o lowerdir="$DL_LOWER",upperdir="$DL_UPPER",workdir="$DL_WORK" \ | ||
"$PWD/buildroot/dl" | ||
mkdir -p "$PWD/buildroot-ccache" | ||
mkdir -p "$CCACHE_WORK" | ||
mount -t overlay overlay \ | ||
-o lowerdir="$CCACHE_LOWER",upperdir="$CCACHE_UPPER",workdir="$CCACHE_WORK" \ | ||
"$PWD/buildroot-ccache" | ||
BUILDROOT_CCACHE="$PWD/buildroot-ccache" make -j$(nproc) | ||
EOF | ||
|
||
function finish { | ||
# Clean up, called on script exit | ||
rm -rf "$DL_WORK" "$CCACHE_WORK" "$BUILDSCRIPT" | ||
} | ||
trap finish EXIT | ||
|
||
# Run the build with overlaid directories | ||
unshare -cm --keep-caps bash "$BUILDSCRIPT" |