mirror of
https://github.com/ps5-linux/ps5-linux-image.git
synced 2026-07-15 21:42:27 +00:00
kernel-builder: build + bundle NXP IW620 mwifiex driver
linux-ps5 currently ships no wifi driver — the PS5 onboard wifi is NXP IW620 (not the upstream mwifiex), which lives at ps5-linux/ps5-linux- mwifiex as an out-of-tree patch against nxp-imx/mwifiex. Users have to clone that repo + run install.sh on the target, which needs gcc + kernel headers and is a manual step every kernel bump. Build it in the kernel-builder container right after the kernel: clone both repos, apply ps5-iw620.patch, make against the kernel src tree, install mlan.ko+moal.ko into /out/staging/lib/modules/$KVER/extra/ ps5-iw620/ with the NXP modprobe options + autoload conf. depmod -b refreshes the index. All package formats (.deb/.rpm/.pkg.tar.zst) then include the driver automatically. MWIFIEX_REPO / MWIFIEX_REF overridable via env in case downstream wants to test a fork or specific commit.
This commit is contained in:
@@ -34,4 +34,46 @@ make headers_install INSTALL_HDR_PATH="$HDR/usr"
|
||||
export srctree=/src SRCARCH=x86
|
||||
CC="${CROSS_COMPILE}gcc" HOSTCC=gcc MAKE=make /src/scripts/package/install-extmod-build "$HDR/lib/modules/$KVER/build"
|
||||
|
||||
# ---- NXP IW620 mwifiex driver (the PS5's onboard wifi) ----
|
||||
# Build the out-of-tree moal+mlan modules against the kernel we just built
|
||||
# and stage them into /out/staging so they get bundled in linux-ps5.{deb,rpm,
|
||||
# pkg.tar.zst}. Without this, users get no wifi until they manually run
|
||||
# ps5-linux-mwifiex/install.sh on the target (which needs gcc + headers).
|
||||
echo "=== Building NXP IW620 mwifiex driver ==="
|
||||
MWIFIEX_REPO="${MWIFIEX_REPO:-https://github.com/ps5-linux/ps5-linux-mwifiex.git}"
|
||||
MWIFIEX_REF="${MWIFIEX_REF:-main}"
|
||||
MWIFIEX_NXP_REPO=https://github.com/nxp-imx/mwifiex.git
|
||||
MWIFIEX_NXP_REF=lf-6.18.2_1.0.0
|
||||
|
||||
PS5_MW=/tmp/ps5-linux-mwifiex
|
||||
NXP_MW=/tmp/nxp-mwifiex
|
||||
rm -rf "$PS5_MW" "$NXP_MW"
|
||||
git clone "$MWIFIEX_REPO" "$PS5_MW"
|
||||
git -C "$PS5_MW" checkout "$MWIFIEX_REF" 2>/dev/null || true
|
||||
git clone --depth 1 --branch "$MWIFIEX_NXP_REF" "$MWIFIEX_NXP_REPO" "$NXP_MW"
|
||||
git -C "$NXP_MW" apply "$PS5_MW/ps5-iw620.patch"
|
||||
|
||||
# Build against the kernel source we just built (out-of-tree build needs
|
||||
# the in-tree build dir, not just headers; same as install-extmod-build).
|
||||
make -C "$NXP_MW" CONFIG_OBJTOOL= KERNELDIR=/src ARCH=x86 -j"$(nproc)"
|
||||
[ -f "$NXP_MW/mlan.ko" ] && [ -f "$NXP_MW/moal.ko" ] \
|
||||
|| { echo "ERROR: mwifiex build did not produce mlan.ko/moal.ko"; exit 1; }
|
||||
|
||||
EXTRA_DIR="/out/staging/lib/modules/$KVER/extra/ps5-iw620"
|
||||
mkdir -p "$EXTRA_DIR"
|
||||
install -m 0644 "$NXP_MW/mlan.ko" "$EXTRA_DIR/mlan.ko"
|
||||
install -m 0644 "$NXP_MW/moal.ko" "$EXTRA_DIR/moal.ko"
|
||||
|
||||
# Modprobe + modules-load.d so the driver auto-loads at boot.
|
||||
mkdir -p /out/staging/etc/modprobe.d /out/staging/etc/modules-load.d
|
||||
echo moal > /out/staging/etc/modules-load.d/moal
|
||||
cat > /out/staging/etc/modprobe.d/moal.conf <<'MPCONF'
|
||||
# PS5 IW620 mwifiex (NXP moal/mlan, built out-of-tree by kernel-builder).
|
||||
softdep moal pre: cfg80211 mlan
|
||||
options moal fw_name=nxp/pcieuartiw620_combo_v1.bin pcie_int_mode=1 drv_mode=1 cfg80211_wext=4 sta_name=mlan ext_scan=1 auto_fw_reload=0 wifi_reset_config=0 sched_scan=0 ps_mode=2 auto_ds=2 amsdu_disable=1
|
||||
MPCONF
|
||||
|
||||
# Rebuild module index so modprobe moal works without depmod -a post-install.
|
||||
depmod -b /out/staging "$KVER"
|
||||
|
||||
echo "=== Build artifacts staged in /out/staging ==="
|
||||
|
||||
Reference in New Issue
Block a user