liminix

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

default.nix (699B)


      1 {
      2   stdenv
      3 , fetchzip
      4 , gdb
      5  }:
      6 let kernel = fetchzip {
      7       name = "linux";
      8       url = "https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.15.71.tar.gz";
      9       hash = "sha256-pq6QNa0PJVeheaZkuvAPD0rLuEeKrViKk65dz+y4kqo=";
     10     };
     11 in
     12 stdenv.mkDerivation {
     13   name = "preinit";
     14   src = ./.;
     15 
     16 #  NIX_DEBUG=2;
     17   hardeningDisable = [ "all" ];
     18   CFLAGS = "-Os -static -DPREINIT_USE_LIBC  -fno-stack-protector -fpic -fPIC -I ./ -I ${kernel}/tools/include/nolibc";
     19 
     20   postBuild = ''
     21     $STRIP  --remove-section=.note --remove-section=.comment preinit
     22     ls -l preinit
     23   '';
     24 
     25   makeFlags = ["preinit"];
     26   stripAllList = ["bin"];
     27   installPhase = ''
     28     mkdir -p $out/bin
     29     cp preinit $out/bin
     30   '';
     31 }