-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
166 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Copyright 2024 Edgeless Systems GmbH | ||
# SPDX-License-Identifier: AGPL-3.0-only | ||
|
||
{ | ||
writeShellApplication, | ||
qemu, | ||
OVMF, | ||
}: | ||
|
||
writeShellApplication { | ||
name = "boot-image"; | ||
runtimeInputs = [ qemu ]; | ||
text = '' | ||
if [ $# -ne 3 ]; then | ||
echo "Usage: $0 <kernel> <kernel-params-file> <image>" >&2 | ||
exit 1 | ||
fi | ||
kernel=$1 | ||
# kernelParams=$(cat "$2") | ||
image=$3 | ||
tmpFile=$(mktemp) | ||
cp "$image" "$tmpFile" | ||
qemu-system-x86_64 \ | ||
-enable-kvm \ | ||
-m 3G \ | ||
-nographic \ | ||
-drive if=pflash,format=raw,readonly=on,file=${OVMF.firmware} \ | ||
-drive if=pflash,format=raw,readonly=on,file=${OVMF.variables} \ | ||
-kernel "$kernel" \ | ||
-append "init=/nix/store/x45q9gkzj8wzw952lv2jrsyx8vqdfx1b-nixos-system-nixos-24.11pre-git/init root=/dev/sda1 rootfstype=erofs rootflags=ro console=ttyS0" \ | ||
-device virtio-scsi-pci,id=scsi0,num_queues=4 \ | ||
-device scsi-hd,drive=drive0,bus=scsi0.0,channel=0,scsi-id=0,lun=0 \ | ||
-drive "file=$tmpFile,if=none,id=drive0" | ||
''; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Copyright 2024 Edgeless Systems GmbH | ||
# SPDX-License-Identifier: AGPL-3.0-only | ||
|
||
{ | ||
lib, | ||
fetchurl, | ||
buildLinux, | ||
... | ||
}: | ||
|
||
buildLinux { | ||
version = "6.11"; | ||
modDirVersion = "6.11.7"; | ||
|
||
src = fetchurl { | ||
url = "https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.11.7.tar.xz"; | ||
sha256 = "sha256-C/XsZEgX15KJIPdjWBMR9b8lipJ1nPLzCYXadDrz67I="; | ||
}; | ||
|
||
structuredExtraConfig = with lib.kernel; { | ||
AMD_MEM_ENCRYPT = lib.mkForce (option yes); | ||
DRM_AMDGPU = lib.mkForce (option no); | ||
DRM_AMDGPU_CIK = lib.mkForce (option no); | ||
DRM_AMDGPU_SI = lib.mkForce (option no); | ||
DRM_AMDGPU_USERPTR = lib.mkForce (option no); | ||
DRM_AMD_DC_FP = lib.mkForce (option no); | ||
DRM_AMD_DC_SI = lib.mkForce (option no); | ||
HSA_AMD = lib.mkForce (option no); | ||
DRM_AMD_ACP = lib.mkForce (option no); | ||
DRM_AMD_DC_DCN = lib.mkForce (option no); | ||
DRM_AMD_DC_HDCP = lib.mkForce (option no); | ||
DRM_AMD_SECURE_DISPLAY = lib.mkForce (option no); | ||
DRM_AMD_ISP = lib.mkForce (option no); | ||
HYPERV_AZURE_BLOB = lib.mkForce (option no); | ||
INTEL_TDX_GUEST = lib.mkForce (option yes); | ||
DEFAULT_SECURITY_APPARMOR = lib.mkForce (option no); | ||
DEFAULT_SECURITY_SELINUX = lib.mkForce (option no); | ||
|
||
# Required to be compiled with the kernel to allow booting in | ||
# direct Linux boot scenarios. | ||
VIRTIO = lib.mkForce (option yes); | ||
VIRTIO_PCI = lib.mkForce (option yes); | ||
VIRTIO_BLK = lib.mkForce (option yes); | ||
VIRTIO_SCSI = lib.mkForce (option yes); | ||
VIRTIO_MMIO = lib.mkForce (option yes); | ||
ATA = lib.mkForce (option yes); | ||
EROFS_FS = lib.mkForce (option yes); | ||
}; | ||
|
||
extraMeta.branch = "6.11"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Copyright 2024 Edgeless Systems GmbH | ||
# SPDX-License-Identifier: AGPL-3.0-only | ||
|
||
{ | ||
config, | ||
pkgs, | ||
lib, | ||
... | ||
}: | ||
|
||
let | ||
cfg = config.contrast.qemu; | ||
in | ||
|
||
{ | ||
options.contrast.qemu = { | ||
enable = lib.mkEnableOption "Enable QEMU (bare-metal) specific settings"; | ||
}; | ||
|
||
config = lib.mkIf cfg.enable { | ||
boot.kernelPackages = pkgs.recurseIntoAttrs (pkgs.linuxPackagesFor pkgs.kata-kernel-uvm); | ||
|
||
boot.initrd.systemd.tpm2.enable = lib.mkForce false; | ||
boot.initrd.systemd.enable = lib.mkForce false; | ||
boot.initrd.availableKernelModules = lib.mkForce [ ]; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters