0d311d61b4
The exec bit was missing on prebuild.sh as committed in PR #15 (it landed mode 0644). Running './prebuild.sh' fails with 'Permission denied'; bash ./prebuild.sh works as a workaround but the shebang is intended to do its job. Caught while running the first linux-ampere-fourier build on boltzmann today. README.md examples show './prebuild.sh' so users will hit the same error. Single-bit fix via git update-index --chmod=+x. No content change.
66 lines
2.6 KiB
Bash
Executable File
66 lines
2.6 KiB
Bash
Executable File
#!/bin/bash
|
|
# prebuild — stage the kernel source tarball this PKGBUILD expects.
|
|
#
|
|
# linux-ampere-fourier's source is a snapshot of marfrit/linux-rk3588-marfrit
|
|
# @ f8f3ad9 (260MB), too big to commit to marfrit-packages and currently
|
|
# unpushable to Gitea (boltzmann's working clone is shallow; gitea push
|
|
# refuses shallow updates). Hosting the tarball outside Gitea would need
|
|
# infrastructure setup that's not in scope for the first iteration.
|
|
#
|
|
# So: produce the tarball locally from the kernel working tree just
|
|
# before makepkg runs. Idempotent — if an existing tarball matches the
|
|
# expected sha256 we skip the archive step.
|
|
#
|
|
# Run from this directory: cd arch/linux-ampere-fourier && ./prebuild.sh
|
|
# Override the kernel-tree location: LINUX_RK3588_MARFRIT_TREE=/path ./prebuild.sh
|
|
#
|
|
# Default tree location matches the boltzmann/ampere convention from
|
|
# kernel-agent issue #6: $HOME/src/linux-rockchip.
|
|
set -euo pipefail
|
|
|
|
TREE="${LINUX_RK3588_MARFRIT_TREE:-${HOME}/src/linux-rockchip}"
|
|
COMMIT=f8f3ad934433bd7e1207d9b0b37e817a692b7ee9
|
|
SHA256_EXPECTED=b4eca11e883fe6f7f306d8751c3efa3afed9cc3465c74a3320de1b7204f5f330
|
|
|
|
HERE="$(cd "$(dirname "$0")" && pwd)"
|
|
OUTPUT="${HERE}/linux-rk3588-marfrit-${COMMIT:0:7}.tar.gz"
|
|
|
|
if [ -f "$OUTPUT" ]; then
|
|
have=$(sha256sum "$OUTPUT" | cut -d' ' -f1)
|
|
if [ "$have" = "$SHA256_EXPECTED" ]; then
|
|
echo "prebuild: $OUTPUT already exists with correct sha256"
|
|
exit 0
|
|
else
|
|
echo "prebuild: existing $OUTPUT sha mismatch (have=$have, want=$SHA256_EXPECTED) — regenerating" >&2
|
|
rm -f "$OUTPUT"
|
|
fi
|
|
fi
|
|
|
|
if [ ! -d "$TREE/.git" ]; then
|
|
echo "prebuild: kernel tree not at $TREE" >&2
|
|
echo " set LINUX_RK3588_MARFRIT_TREE=/path/to/linux-rockchip and retry" >&2
|
|
exit 2
|
|
fi
|
|
|
|
cd "$TREE"
|
|
|
|
if ! git cat-file -e "$COMMIT" 2>/dev/null; then
|
|
echo "prebuild: commit $COMMIT not found in $TREE" >&2
|
|
echo " fetch the linux-rk3588-marfrit branch first:" >&2
|
|
echo " git fetch <remote> linux-rk3588-marfrit" >&2
|
|
exit 3
|
|
fi
|
|
|
|
echo "prebuild: generating archive from $TREE @ $COMMIT..."
|
|
git archive --format=tar.gz --prefix=linux-rk3588-marfrit/ "$COMMIT" -o "$OUTPUT"
|
|
|
|
# git archive emits a deterministic tar stream but gzip compression may
|
|
# vary by version. The sha256 check is informational; warn-don't-fail.
|
|
have=$(sha256sum "$OUTPUT" | cut -d' ' -f1)
|
|
if [ "$have" != "$SHA256_EXPECTED" ]; then
|
|
echo "prebuild: WARNING $OUTPUT sha=$have (canonical=$SHA256_EXPECTED)" >&2
|
|
echo " probably a gzip-version difference; tar payload should be identical" >&2
|
|
fi
|
|
|
|
echo "prebuild: wrote $OUTPUT ($(du -h "$OUTPUT" | cut -f1), sha=$have)"
|