Unverified Commit 44ed9295 authored by Artemis Tosini's avatar Artemis Tosini Committed by GitHub
Browse files

freebsd.iwlwifi-firmware: init (#497341)

parents 6768ae6c a51a52d8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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 ];
+55 −0
Original line number Diff line number Diff line
{
  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;
  };
}
+8 −0
Original line number Diff line number Diff line
KMOD=	${NAME}

FIRMWS=	${NAME}:${NAME}

CLEANFILES+=	${NAME} ${NAME}.fwo ${NAME}.ko.debug ${NAME}.ko.full

${NAME}: ${LINUX_FIRMWARE}/intel/iwlwifi/${NAME}
	cp $? ${.TARGET}
+26 −0
Original line number Diff line number Diff line
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