From ddcb48cc3d176bae330a3d9fd0dfcc4038f1085b Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Sun, 18 Apr 2021 16:53:11 +0000 Subject: [PATCH] netbsd.sys: actually build the kernel Before, we were only building the headers, firmware, and bootloader. CONFIG could be overridden to use another pre-defined kernel, but there's no way to pass a custom kernel configuration yet. Tested booting the built kernel in a NetBSD VM. --- pkgs/os-specific/bsd/netbsd/default.nix | 29 ++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/pkgs/os-specific/bsd/netbsd/default.nix b/pkgs/os-specific/bsd/netbsd/default.nix index c94f00f4782..112a70917cf 100644 --- a/pkgs/os-specific/bsd/netbsd/default.nix +++ b/pkgs/os-specific/bsd/netbsd/default.nix @@ -433,12 +433,35 @@ let path = "sys"; version = "8.0"; sha256 = "123ilg8fqmp69bw6bs6nh98fpi1v2n9lamrzar61p27ji6sj7g0w"; + + CONFIG = "GENERIC"; + propagatedBuildInputs = [ include ]; - nativeBuildInputs = [ makeMinimal install tsort lorder statHook uudecode ]; + nativeBuildInputs = [ + makeMinimal install tsort lorder statHook uudecode config genassym + ]; + + postConfigure = '' + pushd arch/$MACHINE/conf + config $CONFIG + popd + ''; + + makeFlags = [ "FIRMWAREDIR=$(out)/libdata/firmware" ]; + hardeningDisable = [ "pic" ]; + MKKMOD = "no"; + NIX_CFLAGS_COMPILE = [ "-Wa,--no-warn" ]; + + postBuild = '' + make -C arch/$MACHINE/compile/$CONFIG $makeFlags + ''; + + postInstall = '' + cp arch/$MACHINE/compile/$CONFIG/netbsd $out + ''; + meta.platforms = lib.platforms.netbsd; extraPaths = [ common.src ]; - MKKMOD = "no"; - makeFlags = [ "FIRMWAREDIR=$(out)/libdata/firmware" ]; }; headers = symlinkJoin {