File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4242 name : MANUAL
4343 path : docs/MANUAL.pdf
4444
45+ build_guest_images :
46+ name : Build guest images (Nix)
47+ runs-on : [self-hosted, Linux, X64]
48+ steps :
49+ - name : Checkout repository
50+ uses : actions/checkout@v6
51+ - name : Setup Nix
52+ uses : cachix/install-nix-action@v27
53+ - name : Build guest images
54+ run : nix build .#images
55+
4556 build_macos_arm64 :
4657 name : Build examples (macOS ARM64)
4758 runs-on : macos-14
Original file line number Diff line number Diff line change @@ -13,3 +13,4 @@ rust/target/
1313compile_commands.json
1414* .orig
1515__pycache__ /
16+ result
Original file line number Diff line number Diff line change 3434 forAllSystems = with nixpkgs . lib ; genAttrs ( builtins . attrNames microkit-platforms ) ;
3535 in
3636 {
37+ packages = forAllSystems (
38+ system :
39+ let
40+ pkgs = import nixpkgs {
41+ inherit system ;
42+ } ;
43+
44+ linux-613 = pkgs . fetchFromGitHub {
45+ owner = "torvalds" ;
46+ repo = "linux" ;
47+ rev = "v6.13" ;
48+ hash = "sha256-FD22KmTFrIhED5X3rcjPTot1UOq1ir1zouEpRWZkRC0=" ;
49+ } ;
50+
51+ linux-518 = pkgs . fetchFromGitHub {
52+ owner = "torvalds" ;
53+ repo = "linux" ;
54+ rev = "v5.18" ;
55+ hash = "sha256-EB4nc9eHNAY2bHZVAnTckh/WpUkZN5EUj3rXZFR0E0M=" ;
56+ } ;
57+
58+ linux-aarch64-example-simple = ( pkgs . pkgsCross . aarch64-multiplatform . callPackage ./tools/linux/linux.nix { } ) {
59+ version = "5.18" ;
60+ src = linux-518 ;
61+ arch = "arm64" ;
62+ configFile = ./examples/simple/images/linux_config ;
63+ } ;
64+
65+ linux-aarch64-example-virtio = ( pkgs . pkgsCross . aarch64-multiplatform . callPackage ./tools/linux/linux.nix { } ) {
66+ version = "6.13" ;
67+ src = linux-613 ;
68+ arch = "arm64" ;
69+ configFile = ./examples/virtio/client_vm/linux_config ;
70+ } ;
71+
72+ allImages = pkgs . runCommand "all-images" { nativeBuildInputs = with pkgs ; [ gnutar gzip ] ; }
73+ ''
74+ mkdir -p $out
75+
76+ mkdir -p $out/linux-aarch64-example-simple/
77+ cp ${ linux-aarch64-example-simple } /* $out/linux-aarch64-example-simple/
78+
79+ mkdir -p $out/linux-aarch64-example-virtio/
80+ cp ${ linux-aarch64-example-virtio } /* $out/linux-aarch64-example-virtio/
81+
82+ cd $out
83+ for f in linux-*; do tar cf - $f | gzip -9 > `basename $f`.tar.gz; done
84+ ''
85+ ;
86+ in
87+ {
88+ images = allImages ;
89+ }
90+ ) ;
3791 devShells = forAllSystems (
3892 system :
3993 let
Original file line number Diff line number Diff line change 1+ {
2+ stdenv ,
3+ lib ,
4+ elfutils ,
5+ bc ,
6+ bison ,
7+ dtc ,
8+ fetchFromGitHub ,
9+ fetchpatch ,
10+ fetchurl ,
11+ flex ,
12+ perl ,
13+ gnutls ,
14+ installShellFiles ,
15+ libuuid ,
16+ meson-tools ,
17+ ncurses ,
18+ openssl ,
19+ python3 ,
20+ pkg-config ,
21+ which ,
22+ buildPackages ,
23+ callPackages ,
24+ } @pkgs :
25+
26+ lib . makeOverridable (
27+ {
28+ arch ,
29+ version ,
30+ src ,
31+ installDir ? "$out" ,
32+ configFile ,
33+ extraPatches ? [ ] ,
34+ extraMakeFlags ? [ ] ,
35+ stdenv ? pkgs . stdenv ,
36+ # TODO: actually implement
37+ extraFilesToInstall ? [ ] ,
38+ ...
39+ } @args :
40+ stdenv . mkDerivation (
41+ {
42+ inherit version src ;
43+
44+ pname = "linux-${ arch } -${ configFile } " ;
45+
46+ patches = extraPatches ;
47+
48+ # postPatch = ''
49+ # ${lib.concatMapStrings (script: ''
50+ # substituteInPlace ${script} \
51+ # --replace "#!/usr/bin/env python3" "#!${pythonScriptsToInstall.${script}}/bin/python3"
52+ # '') (builtins.attrNames pythonScriptsToInstall)}
53+ # patchShebangs tools
54+ # patchShebangs scripts
55+ # '';
56+
57+ nativeBuildInputs = [
58+ ncurses # tools/kwboot
59+ perl
60+ bc
61+ bison
62+ openssl
63+ pkg-config
64+ flex
65+ installShellFiles
66+ python3
67+ which
68+ elfutils
69+ ] ;
70+ depsBuildBuild = [ buildPackages . gccStdenv . cc ] ; # gccStdenv is needed for Darwin buildPlatform
71+
72+ hardeningDisable = [ "all" ] ;
73+
74+ enableParallelBuilding = true ;
75+
76+ makeFlags = [
77+ "ARCH=${ arch } "
78+ "DTC=${ lib . getExe buildPackages . dtc } "
79+ "CROSS_COMPILE=${ stdenv . cc . targetPrefix } "
80+ "HOSTCFLAGS=-fcommon"
81+ ]
82+ ++ extraMakeFlags ;
83+
84+ passAsFile = [ "extraConfig" ] ;
85+
86+ configurePhase = ''
87+ runHook preConfigure
88+
89+ cp ${ configFile } .config
90+ make $makeFlags -j$NIX_BUILD_CORES
91+
92+ runHook postConfigure
93+ '' ;
94+
95+ installPhase = ''
96+ runHook preInstall
97+
98+ mkdir -p ${ installDir }
99+ cp .config ${ installDir } /config
100+ cp vmlinux ${ installDir }
101+ ls -l arch/${ arch } /boot/Image && cp arch/${ arch } /boot/Image ${ installDir }
102+ ls -l arch/${ arch } /boot/Image.gz && cp arch/${ arch } /boot/Image.gz ${ installDir }
103+ ls -l arch/${ arch } /boot/bzImage && cp arch/${ arch } /boot/bzImage ${ installDir }
104+
105+ runHook postInstall
106+ '' ;
107+
108+ dontStrip = true ;
109+
110+ }
111+ )
112+ )
113+
You can’t perform that action at this time.
0 commit comments