mirror of
https://github.com/dikeckaan/mu300-linux.git
synced 2026-12-05 08:02:40 +00:00
kernel: the driver trees are remade from the pristine copy when their patches change
build-all.sh copied wlan_combo and the Bluetooth driver once and patched the copies in place, so a second run in the same volume failed: wlan_combo-pcie-post-init-retry neither applied nor reverse-applied, because a later patch had moved its lines, and build-wlan.sh stopped. The Bluetooth loop hid the same case with "|| true". Both copies now carry .mu300-patches with the hash of their patch files, like the kernel tree, and are copied afresh and patched in order whenever the hash differs. build-wlan.sh patches only a tree without the marker (the by-hand route in BUILD.md). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DqKKtBQZCfxYnHuBCuDqqn
This commit is contained in:
1 parent
5a892370a6
commit
b0e959572d
2 files changed
+19
-10
No files matched your search
+12
-4
@@ -55,10 +55,18 @@ fi
|
||||
echo -gb50db5b6224c > .scmversion
|
||||
M=kernel_modules/kernel5.4
|
||||
fetch /src/realme "$MODULES_REPO" "$MODULES_REV" $M/wcn/wlan/wlan_combo $M/wcn/bluetooth/driver $M/gpu/natt/mali
|
||||
[ -d /src/ext-wlan_combo ] || cp -r /src/realme/$M/wcn/wlan/wlan_combo /src/ext-wlan_combo
|
||||
[ -d /src/ext-sprdbt ] || cp -r /src/realme/$M/wcn/bluetooth/driver /src/ext-sprdbt
|
||||
# like build-wlan.sh does for Wi-Fi: the MU300 fixes of the Bluetooth driver, skipped when already applied
|
||||
(cd /src/ext-sprdbt && for p in /work/patches/sprdbt-*.patch; do patch -p1 --forward -s < "$p" || true; done)
|
||||
# The driver trees are the pristine copy plus exactly their patches, like the kernel above: a copy patched in place
|
||||
# cannot take a changed patch set (a second run found wlan_combo-pcie-post-init-retry neither applied nor reverted,
|
||||
# because a later patch had moved its lines), so the copy is remade whenever the patch files change.
|
||||
patched_copy() { # patched_copy DEST SOURCE PATCH-GLOB
|
||||
local sum; sum=$(cat /work/patches/$3 | sha256sum | cut -d" " -f1)
|
||||
[ "$(cat "$1/.mu300-patches" 2>/dev/null)" = "$sum" ] && return 0
|
||||
rm -rf "$1" && cp -r "$2" "$1"
|
||||
(cd "$1" && for p in /work/patches/$3; do patch -p1 -s -f < "$p"; done)
|
||||
echo "$sum" > "$1/.mu300-patches"
|
||||
}
|
||||
patched_copy /src/ext-wlan_combo /src/realme/$M/wcn/wlan/wlan_combo 'wlan_combo-*.patch'
|
||||
patched_copy /src/ext-sprdbt /src/realme/$M/wcn/bluetooth/driver 'sprdbt-*.patch'
|
||||
[ -d /src/ext-mali ] || cp -r /src/realme/$M/gpu/natt/mali /src/ext-mali
|
||||
|
||||
echo "==> kernel"
|
||||
|
||||
@@ -3,12 +3,13 @@
|
||||
# Source: realme C51/C53 AndroidT kernel_modules/kernel5.4/wcn/wlan/wlan_combo (GPL), patched for the MU300.
|
||||
set -e
|
||||
WSRC=${WSRC:-/src/ext-wlan_combo}
|
||||
# a patch either applies or is applied already; anything else stops the build (as upstream/build.sh)
|
||||
cd "$WSRC" && for p in /work/patches/wlan_combo-*.patch; do
|
||||
if patch -p1 -N -s --dry-run < "$p" >/dev/null 2>&1; then patch -p1 -N -s < "$p"
|
||||
elif patch -p1 -R -s -f --dry-run < "$p" >/dev/null 2>&1; then :
|
||||
else echo "patch does not apply: $p" >&2; exit 1; fi
|
||||
done
|
||||
# build-all.sh hands over a tree that already carries the patches (.mu300-patches); a tree prepared by hand (BUILD.md)
|
||||
# gets them here, in order, and a patch that does not apply stops the build (as upstream/build.sh)
|
||||
cd "$WSRC"
|
||||
if [ ! -f .mu300-patches ]; then
|
||||
for p in /work/patches/wlan_combo-*.patch; do patch -p1 -s -f < "$p"; done
|
||||
cat /work/patches/wlan_combo-*.patch | sha256sum | cut -d" " -f1 > .mu300-patches
|
||||
fi
|
||||
cd /src/zte-u30air
|
||||
make O=/src/out-linux ARCH=arm64 LLVM=1 LLVM_IAS=1 CC=clang LD=ld.lld -j"$(nproc)" M="$WSRC" modules
|
||||
llvm-strip --strip-debug -o /src/out-linux/sprd_wlan_combo.ko "$WSRC/sprd_wlan_combo.ko"
|
||||
Reference in new issue
Block a user