Files
Abdurrahman Kaan DikeçandClaude Opus 5.5 0aa83038ce Retire kernel 7.2: releases ship 5.4, 6.18 and 7.3; devices on 7.2 move to 7.3
kernel.org ended the 7.2 series with 7.2.15. Releases no longer build or carry
mu300-kernel-7.2.tar.gz or the -k7.2 Magisk zips (release and mainline
workflows, make-release, make-magisk-zips), patches/7.2 is gone (7.3 has its
own 0028) and parity/mainline.list drops the 7.2 series.

Migration: mu300-update takes a 7.2 choice for 7.3 (never the 5.4 an unknown
choice means), says so in apply/boot/check/kernel, installs 7.3 through the
usual boot update (image before kept for rollback-boot, one-boot fallback
unchanged) and writes 7.3 down once an image of 7.3 is in place.
"mu300-update kernel 7.2" refuses and names 7.3. rollback-boot to a 7.2 image
still works and says the next update brings 7.3. Zips and directories of older
releases with 7.2 are still read. install.sh, install.ps1, the GUI, the web
installer and the Ubuntu panel take an answer or a choice of 7.2 as 7.3 with
a note; the kernel menu is 1) 5.4, 2) 6.18, 3) 7.3, and 4 still means 7.3.
mu300-api and the LuCI adapter no longer accept 7.2. Docs, wiki and site
(en/tr/zh) list three kernels and describe the retirement.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VVN2zDgf76kMDVSuWhHPUE
2026-11-02 02:25:17 +03:00

91 lines
6.1 KiB
Bash
Executable File

#!/bin/sh
# Package the mainline build (build.sh + build-modules.sh) as a kernel bundle, laid out like the release's
# mu300-kernel.tar.gz so that mu300-update can install it:
# upstream/make-bundle.sh OUT.tar.gz [KERNEL_BUNDLE_5.4]
# ./Image LK-loadable kernel (wrap-image.py: LK copies it to 0x80080000)
# ./ramdisk-generic.lz4 boot/init, busybox, logdw, e2fsck and the modules of upstream/module-order.txt
# ./modules/*.ko every module - the kernel's own (=m) and the vendor ones - flat, for /lib/modules/<release>
# on the root filesystem (Ubuntu: extra/, indexed by depmod; OpenWrt: flat, for kmodloader)
# ./kernel.release the kernel's release string (uname -r)
# ./devices the devices it runs on (f50 u30air, and v50 when the kernel has its LED driver)
# ./features what it can do that older bundles could not (sdcard, linux-slot, gpt-root)
# ./modules.builtin* what the kernel has built in, for depmod/modprobe
# busybox and logdw are the static helpers of the 5.4 bundle (default: the newest one under release/).
set -eu
TOP=$(cd "$(dirname "$0")/.." && pwd)
U=$TOP/upstream
# the build to package: upstream/out (6.18), or MU300_UPSTREAM_OUT=upstream/out-7.3 for another kernel
UO=${MU300_UPSTREAM_OUT:-$U/out}
OUT=${1:?usage: upstream/make-bundle.sh OUT.tar.gz [mu300-kernel.tar.gz]}
REF=${2:-$(ls -t "$TOP"/release/*/mu300-kernel.tar.gz 2>/dev/null | head -1)}
[ -f "$UO/Image" ] || { echo "no $UO/Image (run build.sh)" >&2; exit 1; }
[ -f "$REF" ] || { echo "no 5.4 kernel bundle for busybox/logdw (give one as the second argument)" >&2; exit 1; }
# the build's module tree and the staging directory must keep xt_HL.ko and xt_hl.ko apart (FINDINGS 212); a tree built
# on a file system that ignores case has lost one of each pair already (audit-bundle.py also finds that)
. "$U/case-sensitive.sh"
case_sensitive "$UO/modules" || exit 1
python3 "$U/audit-bundle.py" "$UO" "$U/mu300-mainline.config"
# nothing of the 5.4 kernel missing unsaid (parity-5.4.txt; audit-bundle.py wrote kernel.config)
python3 "$U/check-parity.py" --mainline "$UO"
# the modules the devices' guard keeps from on-demand loading, against this build (FINDINGS 163)
python3 "$U/check-autoload-blocked.py" "$UO" "$TOP/rootfs/overlay/opt/mu300/lib/autoload-blocked" \
"$TOP/rootfs/overlay/opt/mu300/bin/mu300-modprobe-guard"
krel=$(strings "$UO/Image" | sed -n 's/^Linux version \([^ ]*\) .*/\1/p' | head -1)
[ -n "$krel" ] || { echo "cannot read the kernel release from upstream/out/Image" >&2; exit 1; }
# a module left over from another kernel release would only fail on the device, at insmod
for m in "$UO"/modules/*.ko; do
v=$(strings "$m" | sed -n 's/^vermagic=\([^ ]*\) .*/\1/p' | head -1)
[ "$v" = "$krel" ] || { echo "$m is built for '$v', the kernel is '$krel'" >&2; exit 1; }
done
# --- stale begin
# ... and a vendor module built before its source last changed has the right vermagic and the old code (kanoqwq
# 265f4de3, f6b0668d: a Wi-Fi fix that was in the tree and not in the bundle). build-modules.sh logs each module directory's build
# to modules/NAME.log, so a file of upstream/modules/NAME newer than that log was changed after the build: refused
# until build-modules.sh has run again. (A release builds from a fresh checkout, where the logs come last.)
for d in "$U"/modules/*/; do
d=${d%/}; n=${d##*/}
[ -f "$UO/modules/$n.log" ] || { echo "$n was not built for this kernel: no $UO/modules/$n.log (build-modules.sh)" >&2; exit 1; }
f=$(find "$d" -type f -newer "$UO/modules/$n.log" | head -n 1)
[ -z "$f" ] || { echo "${f#"$TOP"/} changed after $n was built for $krel: run build-modules.sh $n again" >&2; exit 1; }
done
# --- stale end
for m in $(cat "$U/module-order.txt"); do
[ -f "$UO/modules/$m" ] || { echo "module-order.txt names $m, which was not built" >&2; exit 1; }
done
W=$(mktemp -d "${TMPDIR:-/tmp}/mu300-bundle.XXXXXX")
trap 'rm -rf "$W"' EXIT
case_sensitive "$W" || exit 1
tar -xzf "$REF" -C "$W" ./busybox ./logdw
# init's e2fsck (FINDINGS 182), from 5.4 bundles since it came; an older one: the ramdisk boots without it (the
# release audit refuses such a bundle)
tar -xzf "$REF" -C "$W" ./e2fsck 2>/dev/null || echo "warning: $REF has no e2fsck; this ramdisk will not check its root filesystem" >&2
mkdir "$W/b" "$W/b/modules"
python3 "$U/wrap-image.py" "$UO/Image" "$W/b/Image"
python3 "$TOP/boot/build-boot-image.py" --generic-ramdisk --modules "$UO/modules" \
--module-order "$U/module-order.txt" --busybox "$W/busybox" --logdw "$W/logdw" \
$([ -f "$W/e2fsck" ] && echo --e2fsck "$W/e2fsck") \
--ueventd-perms "$TOP/android-vendor/ueventd-perms.sh" --out "$W/b/ramdisk-generic.lz4" >/dev/null
cp "$UO"/modules/*.ko "$W/b/modules/"
for f in modules.builtin modules.builtin.modinfo; do [ ! -f "$UO/$f" ] || cp "$UO/$f" "$W/b/"; done
cp "$UO/kernel.config" "$UO/modules.in-tree" "$W/b/"
( cd "$W/b/modules" && printf '%s\n' *.ko ) > "$W/b/modules.list"
echo "$krel" > "$W/b/kernel.release"
# the devices this kernel runs on; mu300-update and the installers check it (FINDINGS 33c: mainline kernels from
# before this file do not bring up the U30 Air's USB). The ZTE V50 (experimental, FINDINGS 95) only with a kernel
# that has its LED driver and its eMMC host kept awake (patch 0017): both came with it, the driver's option tells.
if grep -qx 'CONFIG_LEDS_AW9523B=y' "$UO/kernel.config"; then
echo "f50 u30air v50" > "$W/b/devices"
else
echo "f50 u30air" > "$W/b/devices"
fi
# what this kernel can do that an older bundle could not; mu300-update reads it before it replaces a kernel
# (sdcard: the card slot's host is probed, so a system on the SD card can boot with it; linux-slot: its init runs
# from slot a as well, when Android is on b; gpt-root: its init also boots a system in a GPT partition named mu300root,
# another installer's layout, FINDINGS 178)
printf 'sdcard\nlinux-slot\ngpt-root\n' > "$W/b/features"
tar -C "$W/b" -czf "$OUT" .
echo "$OUT: kernel $krel, $(ls "$W/b/modules" | wc -l | tr -d ' ') modules ($(du -sk "$W/b/modules" | cut -f1) KiB), ramdisk segment $(wc -c < "$W/b/ramdisk-generic.lz4" | tr -d ' ') bytes"