freebsd.iwlwifi-firmware: init (#497341)

This commit is contained in:
Artemis Tosini
2026-03-09 03:52:03 +00:00
committed by GitHub
4 changed files with 90 additions and 1 deletions
+1 -1
View File
@@ -65,7 +65,7 @@ stdenvNoCC.mkDerivation rec {
description = "Binary firmware collection packaged by kernel.org";
homepage = "https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git";
license = lib.licenses.unfreeRedistributableFirmware;
platforms = lib.platforms.linux;
platforms = lib.platforms.unix;
maintainers = with lib.maintainers; [ fpletz ];
priority = 6; # give precedence to kernel firmware
sourceProvenance = with lib.sourceTypes; [ binaryFirmware ];
@@ -0,0 +1,55 @@
{
lib,
mkDerivation,
sys,
buildFreebsd,
linux-firmware,
}:
mkDerivation rec {
# out-of-tree, but we still want to use freebsd.mkDerivation, which wants an in-tree path
path = "...";
pname = "iwlwifi-firmware";
version = linux-firmware.version;
# Upstream FreeBSD doesn't wrap wifi firmware, only gpu firmware.
# We have to write our own build scripts for this.
src = ./src;
outputs = [
"out"
"debug"
];
extraNativeBuildInputs = [ buildFreebsd.xargs-j ];
env = sys.passthru.env;
SYSDIR = "${sys.src}/sys";
KERN_DEBUGDIR = "${builtins.placeholder "debug"}/lib/debug";
KERN_DEBUGDIR_KODIR = "${KERN_DEBUGDIR}/kernel";
KERN_DEBUGDIR_KMODDIR = "${KERN_DEBUGDIR}/kernel";
KMODDIR = "${placeholder "out"}/kernel";
LINUX_FIRMWARE = "${linux-firmware}/lib/firmware";
# generates relocations the linker can't handle
hardeningDisable = [
"pic"
];
makeFlags = [
"DEBUG_FLAGS=-g"
"XARGS_J=xargs-j"
"NO_XREF=1"
];
preConfigure = ''
bash gen-makefiles
'';
meta = {
description = "Intel Wifi Firmware for FreeBSD";
platforms = lib.platforms.freebsd;
license = linux-firmware.meta.license;
};
}
@@ -0,0 +1,8 @@
KMOD= ${NAME}
FIRMWS= ${NAME}:${NAME}
CLEANFILES+= ${NAME} ${NAME}.fwo ${NAME}.ko.debug ${NAME}.ko.full
${NAME}: ${LINUX_FIRMWARE}/intel/iwlwifi/${NAME}
cp $? ${.TARGET}
@@ -0,0 +1,26 @@
set -e
scriptdir=$(cd $(dirname $0) && pwd)
fwdir=$LINUX_FIRMWARE/intel/iwlwifi
for dir in $scriptdir/*; do
if [ ! -d "$dir" ]; then
continue
fi
rm -rf "$dir"
done
for file in $fwdir/*.*; do
base=$(basename $file)
echo "SUBDIR += $base" >> Makefile
mkdir -p "$scriptdir/$base"
cat > "$scriptdir/$base/Makefile" <<EOF
NAME= $base
.include <bsd.kmod.mk>
EOF
done
echo ".include <bsd.subdir.mk>" >> Makefile