Finalize verified 2720 Flip release source and untrack image outputs
This commit is contained in:
1 parent
2a3078e42c
commit
1c011b360a
121 files changed
+8467
-686
No files matched your search
Executable
+154
@@ -0,0 +1,154 @@
|
||||
#!/bin/sh
|
||||
# Build the nokia-beatles lk2nd boot images from upstream source.
|
||||
#
|
||||
# ./scripts/build-lk2nd-beatles.sh build normal + diagnostic + display
|
||||
# ./scripts/build-lk2nd-beatles.sh --check validate the shipped images only
|
||||
# ./scripts/build-lk2nd-beatles.sh --only normal build just one variant
|
||||
# ./scripts/build-lk2nd-beatles.sh --force-panel-init append lk2nd.force-panel-init to
|
||||
# the normal image cmdline
|
||||
# WITH_DISPLAY=1 ./scripts/build-lk2nd-beatles.sh enable the SPI display during boot
|
||||
#
|
||||
# Overrides: BANANARCHY_LK2ND_SRC (existing upstream checkout),
|
||||
# BANANARCHY_LK2ND_BUILD_DIR (scratch), JOBS (make -j).
|
||||
set -eu
|
||||
|
||||
BASE_DIR=$(cd "$(dirname "$0")/.." && pwd)
|
||||
UPSTREAM=https://github.com/msm8916-mainline/lk2nd.git
|
||||
COMMIT=cf45aefd22d744b2bf9b39455afae697ce430063
|
||||
PATCH="$BASE_DIR/bootloader/lk2nd/nokia-beatles.patch"
|
||||
NORMAL_IMAGE="$BASE_DIR/images/boot-lk2nd-nokia-beatles.img"
|
||||
DIAG_IMAGE="$BASE_DIR/images/boot-lk2nd-nokia-beatles-diagnostic.img"
|
||||
DISPLAY_IMAGE="$BASE_DIR/images/boot-lk2nd-nokia-beatles-display.img"
|
||||
DOCKER_IMAGE=bananarchy-lk2nd-build:local
|
||||
BUILD_DIR=${BANANARCHY_LK2ND_BUILD_DIR:-"$BASE_DIR/.lk2nd-build"}
|
||||
|
||||
CHECK_ONLY=0
|
||||
ONLY=all
|
||||
FORCE_PANEL_INIT=0
|
||||
WITH_DISPLAY=${WITH_DISPLAY:-0}
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
--check) CHECK_ONLY=1 ;;
|
||||
--only) shift; ONLY=${1:-all} ;;
|
||||
--force-panel-init) FORCE_PANEL_INIT=1 ;;
|
||||
--with-display) WITH_DISPLAY=1 ;;
|
||||
*) echo "[!] unknown option: $1" >&2; exit 1 ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
CMD_BASE="lk2nd lk2nd.compatible=nokia,beatles"
|
||||
# Default: lk2nd.no-display keeps a RAM-only framebuffer and never touches
|
||||
# QUP SPI before USB is up. The panel can then be enabled at runtime with
|
||||
# "fastboot oem display-init", which is safe because all QUP and clock polls
|
||||
# are bounded. The -display.img variant uses lk2nd.display=on for boot-time
|
||||
# panel initialization.
|
||||
if [ "$WITH_DISPLAY" != 1 ]; then
|
||||
CMD_BASE="$CMD_BASE lk2nd.no-display"
|
||||
fi
|
||||
if [ "$FORCE_PANEL_INIT" = 1 ]; then
|
||||
CMD_BASE="$CMD_BASE lk2nd.force-panel-init"
|
||||
fi
|
||||
CMD_DIAG="lk2nd lk2nd.compatible=nokia,beatles lk2nd.no-display"
|
||||
CMD_DISPLAY="lk2nd lk2nd.compatible=nokia,beatles lk2nd.display=on"
|
||||
|
||||
check_images() {
|
||||
python3 "$BASE_DIR/scripts/check-lk2nd-beatles.py" \
|
||||
--image "$NORMAL_IMAGE" --patch "$PATCH" --expect-fastboot 0
|
||||
python3 "$BASE_DIR/scripts/check-lk2nd-beatles.py" \
|
||||
--image "$DIAG_IMAGE" --patch "$PATCH" --expect-fastboot 1
|
||||
python3 "$BASE_DIR/scripts/check-lk2nd-beatles.py" \
|
||||
--image "$DISPLAY_IMAGE" --patch "$PATCH" --expect-fastboot 0 \
|
||||
--expect-display 1 --allow-missing-cookie
|
||||
}
|
||||
|
||||
if [ "$CHECK_ONLY" = 1 ]; then
|
||||
check_images
|
||||
exit 0
|
||||
fi
|
||||
|
||||
for tool in git docker python3; do
|
||||
if ! command -v "$tool" >/dev/null 2>&1; then
|
||||
echo "[!] $tool is required" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
if [ ! -f "$PATCH" ]; then
|
||||
echo "[!] missing $PATCH" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -n "${BANANARCHY_LK2ND_SRC:-}" ]; then
|
||||
SRC=$BANANARCHY_LK2ND_SRC
|
||||
else
|
||||
SRC="$BUILD_DIR/src"
|
||||
mkdir -p "$BUILD_DIR"
|
||||
if [ ! -d "$SRC/.git" ]; then
|
||||
git init -q "$SRC"
|
||||
git -C "$SRC" remote add origin "$UPSTREAM"
|
||||
fi
|
||||
head=$(git -C "$SRC" rev-parse HEAD 2>/dev/null || true)
|
||||
if [ "$head" != "$COMMIT" ]; then
|
||||
echo "[*] fetching upstream lk2nd at $COMMIT"
|
||||
git -C "$SRC" fetch --depth 1 origin "$COMMIT"
|
||||
git -C "$SRC" checkout -q FETCH_HEAD
|
||||
fi
|
||||
git -C "$SRC" reset --hard -q HEAD
|
||||
git -C "$SRC" clean -fdq
|
||||
fi
|
||||
|
||||
head=$(git -C "$SRC" rev-parse HEAD 2>/dev/null || true)
|
||||
if [ "$head" != "$COMMIT" ]; then
|
||||
echo "[!] $SRC is at ${head:-unknown}, expected $COMMIT" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if git -C "$SRC" apply --check --reverse "$PATCH" 2>/dev/null; then
|
||||
echo "[*] nokia-beatles patch already applied"
|
||||
else
|
||||
echo "[*] applying nokia-beatles patch"
|
||||
git -C "$SRC" apply --check "$PATCH"
|
||||
git -C "$SRC" apply "$PATCH"
|
||||
fi
|
||||
|
||||
if ! docker image inspect "$DOCKER_IMAGE" >/dev/null 2>&1; then
|
||||
echo "[*] building the arm-none-eabi toolchain image"
|
||||
docker build -t "$DOCKER_IMAGE" "$BASE_DIR/bootloader/lk2nd"
|
||||
fi
|
||||
|
||||
build_variant() {
|
||||
label=$1
|
||||
version=$2
|
||||
extra=$3
|
||||
cmdline=$4
|
||||
out=$5
|
||||
echo "[*] building lk2nd-msm8909 ($label)"
|
||||
# shellcheck disable=SC2086
|
||||
docker run --rm --user "$(id -u):$(id -g)" \
|
||||
-v "$SRC:/src" -w /src "$DOCKER_IMAGE" \
|
||||
make TOOLCHAIN_PREFIX=arm-none-eabi- \
|
||||
LK2ND_VERSION="$version" \
|
||||
MKBOOTIMG_CMDLINE="$cmdline" \
|
||||
$extra -j"${JOBS:-4}" lk2nd-msm8909
|
||||
mkdir -p "$(dirname "$out")"
|
||||
cp "$SRC/build-lk2nd-msm8909/lk2nd.img" "$out"
|
||||
echo "[*] wrote $out"
|
||||
sha256sum "$out"
|
||||
}
|
||||
|
||||
if [ "$ONLY" = all ] || [ "$ONLY" = normal ]; then
|
||||
build_variant normal bananarchy-beatles-a1109-r3 "" "$CMD_BASE" "$NORMAL_IMAGE"
|
||||
fi
|
||||
if [ "$ONLY" = all ] || [ "$ONLY" = diagnostic ]; then
|
||||
# Forced fastboot + no SPI display: decisive probe when lk2nd hangs before
|
||||
# USB. Run "fastboot oem display-init" / "oem display-test" from here to
|
||||
# bring up the GC9305 panel without reflashing; "oem screenshot" verifies
|
||||
# the framebuffer and "oem scan-dtb" stages the exact kernel DTB.
|
||||
build_variant diagnostic bananarchy-beatles-a1109-diag-r3 \
|
||||
"DEBUG=2 LK2ND_FORCE_FASTBOOT=1" "$CMD_DIAG" "$DIAG_IMAGE"
|
||||
fi
|
||||
if [ "$ONLY" = all ] || [ "$ONLY" = display ]; then
|
||||
build_variant display bananarchy-beatles-a1109-display-r3 "" "$CMD_DISPLAY" "$DISPLAY_IMAGE"
|
||||
fi
|
||||
|
||||
check_images
|
||||
Reference in new issue
Block a user