liminix-fork/pkgs/preinit/default.nix
Daniel Barlow a7e7146887 preinit: disable nolibc
- it stopped working with 22.11->23.05
- linking statically against musl is about 17k, so
  this is costing us 11k or so
2023-06-18 23:04:26 +01:00

31 lines
699 B
Nix

{
stdenv
, fetchzip
, gdb
}:
let kernel = fetchzip {
name = "linux";
url = "https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.15.71.tar.gz";
hash = "sha256-pq6QNa0PJVeheaZkuvAPD0rLuEeKrViKk65dz+y4kqo=";
};
in
stdenv.mkDerivation {
name = "preinit";
src = ./.;
# NIX_DEBUG=2;
hardeningDisable = [ "all" ];
CFLAGS = "-Os -static -DPREINIT_USE_LIBC -fno-stack-protector -fpic -fPIC -I ./ -I ${kernel}/tools/include/nolibc";
postBuild = ''
$STRIP --remove-section=.note --remove-section=.comment preinit
ls -l preinit
'';
makeFlags = ["preinit"];
stripAllList = ["bin"];
installPhase = ''
mkdir -p $out/bin
cp preinit $out/bin
'';
}