Closes #376820 The issue with providing `moduleMakeFlags` via `passthru` of the kernel package is that when this package gets overriden[1], the `moduleMakeFlags` list still references the kernel without the overrides. This broke e.g. kernel modules of linux-rpi4 which can be reproduced with nix-build --argstr system aarch64-linux -A linuxKernel.packages.linux_rpi4.zfs_2_3 This used to break with Error: modDirVersion 6.6.51 specified in the Nix expression is wrong, it should be: 6.6.51-v8 since KBUILD_OUTPUT referenced the kernel without the changes from `overrideDerivation` that also changes the `modDirVersion`. The new approach is to add the build flags right into `linuxKernel.packages.linux_X_Y`: that way we don't need any hacks to update `moduleMakeFlags` when the derivation with the passthru gets overridden. By using the fixpoint of the package-set, the `kernelModuleMakeFlags` list is correctly updated. E.g. given with import ./. {}; linuxKernel.packages.linux_6_6.extend (self: super: { kernel = super.kernel.overrideAttrs (_: { name = "linux-snens"; }); }) the `makeFlags` is correctly updated: $ nix-instantiate snenskek.nix -A zfs_2_3.makeFlags --eval --strict [ "ARCH=x86_64" "CROSS_COMPILE=" "KBUILD_OUTPUT=/nix/store/gsp68549k1aqbwxwczpgw67w5jjn4shw-linux-snens-dev/lib/modules/6.6.74/build" ] [1] E.g. `linux-rpi4`.
57 lines
1.6 KiB
Nix
57 lines
1.6 KiB
Nix
{
|
|
stdenv,
|
|
lib,
|
|
fetchgit,
|
|
kernel,
|
|
kernelModuleMakeFlags,
|
|
kmod,
|
|
}:
|
|
let
|
|
version = "22.03.5";
|
|
in
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
pname = "trelay";
|
|
version = "${version}-${kernel.version}";
|
|
|
|
src = fetchgit {
|
|
url = "https://git.openwrt.org/openwrt/openwrt.git";
|
|
rev = "v${version}";
|
|
hash = "sha256-5f9LvaZUxtfTpTR268QMkEmHUpn/nct+MVa44SBGT5c=";
|
|
sparseCheckout = [ "package/kernel/trelay/src" ];
|
|
};
|
|
|
|
sourceRoot = "${finalAttrs.src.name}/package/kernel/trelay/src";
|
|
hardeningDisable = [
|
|
"pic"
|
|
"format"
|
|
];
|
|
nativeBuildInputs = [ kmod ] ++ kernel.moduleBuildDependencies;
|
|
|
|
postPatch = ''
|
|
cp '${./Makefile}' Makefile
|
|
'';
|
|
|
|
makeFlags = kernelModuleMakeFlags ++ [
|
|
"KERNELRELEASE=${kernel.modDirVersion}"
|
|
"KERNEL_DIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
|
|
"INSTALL_MOD_PATH=$(out)"
|
|
];
|
|
|
|
meta = with lib; {
|
|
description = "For relaying IP packets between two devices to build a IP bridge between them";
|
|
longDescription = ''
|
|
A kernel module that relays ethernet packets between two devices (similar to a bridge),
|
|
but without any MAC address checks.
|
|
|
|
This makes it possible to bridge client mode or ad-hoc mode wifi devices to ethernet VLANs,
|
|
assuming the remote end uses the same source MAC address as the device that packets are
|
|
supposed to exit from.
|
|
'';
|
|
homepage = "https://github.com/openwrt/openwrt/tree/main/package/kernel/trelay";
|
|
license = licenses.gpl2Plus;
|
|
maintainers = [ maintainers.aprl ];
|
|
platforms = platforms.linux;
|
|
broken = lib.versionOlder kernel.version "5.10";
|
|
};
|
|
})
|