初始化奇妙小屏幕控制器项目
This commit is contained in:
@@ -0,0 +1,105 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
SOURCE=
|
||||
CONFIG=
|
||||
OUTPUT=
|
||||
JOBS=${JOBS:-2}
|
||||
RELEASE=6.1.31-matrix-axp313a1
|
||||
LOCALVERSION_SUFFIX=-matrix-axp313a1
|
||||
VENDOR_COMMIT=30ff3fd5cf45417622b447a12e7a947402ffe34d
|
||||
|
||||
while [ "$#" -gt 0 ]; do
|
||||
case "$1" in
|
||||
--source) SOURCE=$2; shift 2 ;;
|
||||
--config) CONFIG=$2; shift 2 ;;
|
||||
--output) OUTPUT=$2; shift 2 ;;
|
||||
*) echo "unknown argument: $1" >&2; exit 2 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -z "$SOURCE" ] || [ -z "$CONFIG" ] || [ -z "$OUTPUT" ]; then
|
||||
echo "usage: build_axp313a_kernel.sh --source DIR --config FILE --output EMPTY_DIR" >&2
|
||||
exit 2
|
||||
fi
|
||||
SOURCE=$(CDPATH= cd -- "$SOURCE" && pwd)
|
||||
CONFIG=$(readlink -f -- "$CONFIG")
|
||||
OUTPUT=$(readlink -f -- "$OUTPUT")
|
||||
SCRIPT_ROOT=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
|
||||
PATCH_ROOT=$SCRIPT_ROOT/kernel/patches
|
||||
BUILD=$OUTPUT/build
|
||||
STAGE=$OUTPUT/stage
|
||||
|
||||
case "$SOURCE" in /|/boot|/opt|/usr|/var|/home) echo "source path is too broad" >&2; exit 1 ;; esac
|
||||
case "$OUTPUT" in /|/boot|/opt|/usr|/var|/home) echo "output path is too broad" >&2; exit 1 ;; esac
|
||||
if [ ! -f "$SOURCE/Makefile" ] || [ ! -f "$CONFIG" ]; then
|
||||
echo "kernel source or config is missing" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [ -n "$(find "$OUTPUT" -mindepth 1 -maxdepth 1 -print -quit)" ]; then
|
||||
echo "output directory must be empty" >&2
|
||||
exit 1
|
||||
fi
|
||||
case "$JOBS" in *[!0-9]*|'') echo "JOBS must be a positive integer" >&2; exit 1 ;; esac
|
||||
if [ "$JOBS" -lt 1 ] || [ "$JOBS" -gt 4 ]; then
|
||||
echo "JOBS must be within 1..4" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
(cd "$PATCH_ROOT" && sha256sum -c SHA256SUMS)
|
||||
for upstream_patch in \
|
||||
75c8cb2f4cb218aaf4ea68cab08d6dbc96eeae15.patch \
|
||||
60fd7eb89670d2636ac3156881acbd103c6eba6a.patch \
|
||||
4628b804555773daa982d9578d89fe04fcdde374.patch
|
||||
do
|
||||
test -f "$PATCH_ROOT/$upstream_patch"
|
||||
done
|
||||
grep -q 'AXP313A_ID' "$SOURCE/include/linux/mfd/axp20x.h"
|
||||
grep -q 'axp313a_regulators' "$SOURCE/drivers/regulator/axp20x-regulator.c"
|
||||
for patch_file in \
|
||||
0003-walnutpi-6.1-axp313a-strict-backport.patch \
|
||||
0004-walnutpi-axp313a-dts.patch \
|
||||
0005-walnutpi-axp313a-preserve-dldo1.patch \
|
||||
0006-walnutpi-uwe5622-out-of-tree-build.patch \
|
||||
0007-walnutpi-enabled-realtek-out-of-tree-build.patch \
|
||||
0008-walnutpi-rtl8192eu-out-of-tree-build.patch \
|
||||
0009-walnutpi-rtl8812au-out-of-tree-build.patch \
|
||||
0010-walnutpi-rtl8812au-phydm-out-of-tree-build.patch \
|
||||
0011-walnutpi-rtl88x2cs-topdir-out-of-tree-build.patch \
|
||||
0012-walnutpi-emmc-axp313a-dts.patch \
|
||||
0013-walnutpi-axp313a-fixed-dcdc-frequency.patch
|
||||
do
|
||||
patch -d "$SOURCE" -p1 --forward --batch --fuzz=0 < "$PATCH_ROOT/$patch_file"
|
||||
done
|
||||
|
||||
mkdir -p -- "$BUILD" "$STAGE/boot" "$STAGE/lib"
|
||||
cp -- "$CONFIG" "$BUILD/.config"
|
||||
make -C "$SOURCE" O="$BUILD" olddefconfig
|
||||
"$SOURCE/scripts/config" --file "$BUILD/.config" \
|
||||
--set-str LOCALVERSION '' \
|
||||
--disable LOCALVERSION_AUTO \
|
||||
--set-str SYSTEM_TRUSTED_KEYS '' \
|
||||
--set-str SYSTEM_REVOCATION_KEYS ''
|
||||
make -C "$SOURCE" O="$BUILD" olddefconfig
|
||||
actual_release=$(make -s -C "$SOURCE" O="$BUILD" \
|
||||
LOCALVERSION="$LOCALVERSION_SUFFIX" kernelrelease)
|
||||
if [ "$actual_release" != "$RELEASE" ]; then
|
||||
echo "unexpected kernel release: $actual_release" >&2
|
||||
exit 1
|
||||
fi
|
||||
make -C "$SOURCE" O="$BUILD" LOCALVERSION="$LOCALVERSION_SUFFIX" \
|
||||
-j"$JOBS" Image dtbs modules
|
||||
make -C "$SOURCE" O="$BUILD" LOCALVERSION="$LOCALVERSION_SUFFIX" \
|
||||
modules_install INSTALL_MOD_PATH="$STAGE"
|
||||
|
||||
install -m 0644 "$BUILD/arch/arm64/boot/Image" "$STAGE/boot/Image-matrix-axp313a1"
|
||||
install -m 0644 "$BUILD/arch/arm64/boot/dts/allwinner/sun50i-h616-walnutpi-1b.dtb" \
|
||||
"$STAGE/boot/sun50i-h616-walnutpi-1b-matrix-axp313a1.dtb"
|
||||
install -m 0644 "$BUILD/arch/arm64/boot/dts/allwinner/sun50i-h616-walnutpi-1b-emmc.dtb" \
|
||||
"$STAGE/boot/sun50i-h616-walnutpi-1b-emmc-matrix-axp313a1.dtb"
|
||||
install -m 0644 "$BUILD/System.map" "$STAGE/boot/System.map-$RELEASE"
|
||||
install -m 0644 "$BUILD/.config" "$STAGE/boot/config-$RELEASE"
|
||||
printf '%s\n' "$VENDOR_COMMIT" > "$STAGE/SOURCE_COMMIT"
|
||||
printf '%s\n' "$RELEASE" > "$STAGE/KERNEL_RELEASE"
|
||||
(cd "$STAGE" && find boot lib SOURCE_COMMIT KERNEL_RELEASE -type f -print0 | sort -z | xargs -0 sha256sum > SHA256SUMS)
|
||||
echo "candidate kernel built at $STAGE"
|
||||
Reference in New Issue
Block a user