Files
mu300-linux/upstream/make-bundle.sh
T
Abdurrahman Kaan DikeçandClaude Opus 5.5 0ec79df54d U30 Air runs the mainline kernels: VBUS from extcon-gpio, GPIO LEDs; unique USB serial numbers; bundles name their devices
- ssphy (6.18, 7.2): the U30 Air's device tree gives the PHY the PMIC's Type-C block as extcon, which has no driver
  under mainline, and the PHY deferred for ever (no USB at all). When extcon names that block, the PHY now takes
  VBUS from the extcon-usb-gpio node both boards have. CONFIG_LEDS_GPIO for its LEDs.
- init: the USB serial number is MU300LINUX-<serial number> (macOS gave a second device with the same one no network
  interface), and the serial number is read from the device tree's bootargs as well, since a mainline kernel
  forces its own command line.
- kernel bundles carry ./devices ("f50 u30air"); mu300-update and both installers keep a bundle without it off a
  U30 Air (its 5.4 ramdisk lacks the U30 Air modules, its mainline kernel the fix above). This replaces the
  "5.4 only" rule: the U30 Air gets every kernel and Ubuntu 26.04 from the next release on.
- FINDINGS 33c, README: what runs on the U30 Air under mainline (all but the battery reading).

Tested on the U30 Air with one-shot trials and --trial-guard, an F50 on the same Mac: 6.18 and 7.2 with USB network,
mobile data, VPN, hotspot (a Wi-Fi client for 3 minutes, no drops, 0% loss), Bluetooth and LEDs.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AeuDBrAce8rrgSJDbFJQGN
2026-09-28 08:59:56 +03:00

49 lines
2.9 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 and the modules of upstream/module-order.txt
# ./modules/*.ko every module, for /lib/modules/<release> on the root filesystem
# ./kernel.release the kernel's release string (uname -r)
# ./devices the devices it runs on (f50 u30air)
# ./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.2 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; }
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
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)
trap 'rm -rf "$W"' EXIT
tar -xzf "$REF" -C "$W" ./busybox ./logdw
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" \
--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
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)
echo "f50 u30air" > "$W/b/devices"
tar -C "$W/b" -czf "$OUT" .
echo "$OUT: kernel $krel, $(ls "$W/b/modules" | wc -l | tr -d ' ') modules, ramdisk segment $(wc -c < "$W/b/ramdisk-generic.lz4" | tr -d ' ') bytes"