Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

80.5. firmware-realtek-20260916

Realtek device firmware from linux-firmware — rtw88 and rtw89 Wi-Fi, Bluetooth, and r8169 Ethernet

Version 20260916, release 1
Shelf boot — Everything before userspace: the kernel, microcode, firmware for the host, bootloader and EFI tooling
Phase 41_system (System), 223 of 1047 in build order
Licence LicenseRef-linux-firmware
Homepage https://gitlab.com/kernel-firmware/linux-firmware
Build time 0.9 SBU
Installed size 10.1 MiB in 299 files
Recipe ports/core/boot/firmware-realtek/kpkgbuild

About

Realtek’s share of linux-firmware: the rtw88, rtw89 and rtlwifi Wi-Fi firmware, the rtl_bt Bluetooth firmware and the rtl_nic firmware r8169 loads for most Realtek Ethernet. 165 files and links, 9,580,394 bytes. The installation medium carries it.

Why it is in KDOS

The comment above the 10 ports from firmware-intel to linux-firmware in script/phases/41_system/packages.d/boot.txt:

Firmware. Without it a real machine has no Wi-Fi, no Bluetooth and — this is the one that surprises people — no GPU: from Vega/GFX9 on, amdgpu must load PSP/SMU/GFX/SDMA blobs before it can bring the display up, and Xe and Gen12+ i915 refuse to load without GuC. You fall through to simpledrm on the EFI framebuffer: a picture, no EGL, no compositor.

Upstream's whole tree, installed by its own copy-firmware.sh and split by vendor: each firmware-* port builds the same tarball and keeps its share, firmware-map records which port ships each file for kdos firmware sync, and the linux-firmware meta is all of them.

Sources

Dependencies

Depends on: zstd.

Required by (1): linux-firmware.

Installation

From the repository root, inside the build container, this is the line kdosbuild runs for the port:

script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install firmware-realtek'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/boot/firmware-realtek.

1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.

cd /ports/core/boot/firmware-realtek
echo 'f80dcb757a623deda62200c08e0e1a88c76fb6b54964f31b35fa74da1c90ccc5  linux-firmware-20260916.tar.xz' | sha256sum -c -

2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.

SRC_ROOT=/var/cache/kpkg/work/firmware-realtek
SRC=$SRC_ROOT/firmware-realtek-20260916
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf linux-firmware-20260916.tar.xz -C "$SRC" --strip-components=1

Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.

3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the recipe’s helpers group and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

fw_vendor() {
	case "$1" in
	i915/* | xe/* | intel/* | iwlwifi-* | qat_* | isci/*) vendor=intel ;;
	amdgpu/* | radeon/* | amd/* | amd-ucode/* | amdnpu/* | amdtee/* | r128/*) vendor=amd ;;
	nvidia/*) vendor=nvidia ;;
	rtl_bt/* | rtl_nic/* | rtlwifi/* | rtw88/* | rtw89/* | realtek/*) vendor=realtek ;;
	mediatek/* | rt[0-9]*) vendor=mediatek ;;
	brcm/* | cypress/* | bnx2/* | bnx2x/* | tigon/*) vendor=broadcom ;;
	ath[0-9]*/* | ath3k-* | ar3k/* | ar5523.* | ar7010* | ar9170-* | ar9271.* | carl9170-* | htc_* | qca/* | qcom/* | wil6210.*) vendor=qualcomm ;;
	*) vendor=misc ;;
	esac
}

fw="$SRC_ROOT/firmware"
rm -rf "$fw"
./copy-firmware.sh --zstd "$fw"

find "$fw/qcom" -mindepth 1 -maxdepth 1 \
	! -name aic100 ! -name aic200 ! -name qdu100 ! -name 'sdx*' ! -name 'prog_firehose_*' \
	-exec rm -rf {} +
find "$fw/mellanox" -name 'mlxsw_spectrum*.mfa2*' \
	! -name 'mlxsw_spectrum-13.2010.1006.mfa2*' \
	! -name 'mlxsw_spectrum2-29.2010.1006.mfa2*' \
	! -name 'mlxsw_spectrum3-30.2010.1006.mfa2*' \
	-exec rm -f {} +
rm -f "$fw"/mrvl/prestera/mvsw_prestera_fw-v2.0.img* "$fw"/mrvl/prestera/mvsw_prestera_fw-v3.0.img*
while IFS= read -r l; do
	case "$(readlink "$l")" in
	qcom/*) [ -e "$l" ] || rm -f "$l" ;;
	esac
done < <(find "$fw" -maxdepth 1 -type l)

dangling=0
while IFS= read -r l; do
	[ -e "$l" ] || { echo "dangling firmware symlink: $l" >&2; dangling=$((dangling + 1)); }
done < <(find "$fw" -type l)
if [ "$dangling" -ne 0 ]; then
	echo "ERROR: $dangling dangling firmware symlink(s)" >&2
	exit 1
fi

map="$SRC_ROOT/firmware-map"
own="$SRC_ROOT/firmware-own"
: > "$map"
: > "$own"
while IFS= read -r -d '' f; do
	rel=${f#"$fw"/}
	target=$rel
	[ -L "$f" ] && target=$(realpath --relative-to="$fw" "$f")
	fw_vendor "$target"
	printf 'firmware-%s %s\n' "$vendor" "${rel%.zst}" >> "$map"
	[ "firmware-$vendor" = "$name" ] && printf '%s\0' "$rel" >> "$own"
done < <(find "$fw" \( -type f -o -type l \) -print0)

if [ "$name" = firmware-map ]; then
	install -d "$PKG/usr/share/kdos"
	LC_ALL=C sort -k 2 -o "$PKG/usr/share/kdos/firmware-map" "$map"
	chmod 644 "$PKG/usr/share/kdos/firmware-map"
else
	[ -s "$own" ] || { echo "ERROR: no firmware file is $name's" >&2; exit 1; }
	install -d "$PKG/lib/firmware"
	tar -C "$fw" --null -T "$own" -cf - | tar -C "$PKG/lib/firmware" -xf -
	while IFS= read -r l; do
		[ -e "$l" ] || { echo "ERROR: $name links $l to another port's file" >&2; exit 1; }
	done < <(find "$PKG/lib/firmware" -type l)
fi

install -d "$PKG/usr/share/licenses/$name"
install -m644 WHENCE "$PKG/usr/share/licenses/$name/"
find . -maxdepth 1 -type f -name 'LICEN[CS]E*' -exec install -m644 -t "$PKG/usr/share/licenses/$name/" {} +
cp -r LICENSES "$PKG/usr/share/licenses/$name/"
missing=0
for lic in $(grep -oE 'See LICEN[CS]E[._][A-Za-z0-9._+-]*' WHENCE | sed 's/^See //; s/\.$//' | sort -u); do
	[ -e "$PKG/usr/share/licenses/$name/LICENSES/$lic" ] || { echo "WHENCE names a missing licence: $lic" >&2; missing=1; }
done
[ "$missing" -eq 0 ]

The switches, and why each is set:

The common switches of each build system are explained in the Flag glossary.

4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/firmware-realtek, prunes what the image does not ship, lints the tree and rolls it reproducibly:

tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
    --mtime=@$SOURCE_DATE_EPOCH \
    --use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
    -cf firmware-realtek-20260916-1.tar.xz -C "$PKG" .

5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/firmware-realtek, and runs the triggers its paths call for.

Contents

Installed directories: /lib/firmware/realtek, /lib/firmware/rtl_bt, /lib/firmware/rtl_nic, /lib/firmware/rtlwifi, /lib/firmware/rtw88, /lib/firmware/rtw89, /usr/share/licenses/firmware-realtek.