Use integrated Intel GPU on hypnos
This commit is contained in:
parent
c7e0f66295
commit
eb9406fe1f
102
hosts/hypnos/0001-Add-apple_set_os-EFI-boot-service.patch
Normal file
102
hosts/hypnos/0001-Add-apple_set_os-EFI-boot-service.patch
Normal file
@ -0,0 +1,102 @@
|
||||
From d310ddee0fb8e7a5a8b89668c6cb8f9dc863ce94 Mon Sep 17 00:00:00 2001
|
||||
From: Jordan Holt <jordan@vimium.com>
|
||||
Date: Sun, 28 Apr 2024 15:59:52 +0100
|
||||
Subject: [PATCH] Add apple_set_os EFI boot service
|
||||
|
||||
---
|
||||
drivers/firmware/efi/libstub/x86-stub.c | 59 +++++++++++++++++++++++++
|
||||
include/linux/efi.h | 1 +
|
||||
2 files changed, 60 insertions(+)
|
||||
|
||||
diff --git a/drivers/firmware/efi/libstub/x86-stub.c b/drivers/firmware/efi/libstub/x86-stub.c
|
||||
index d5a8182cf..be722c43a 100644
|
||||
--- a/drivers/firmware/efi/libstub/x86-stub.c
|
||||
+++ b/drivers/firmware/efi/libstub/x86-stub.c
|
||||
@@ -449,6 +449,63 @@ static void setup_graphics(struct boot_params *boot_params)
|
||||
}
|
||||
}
|
||||
|
||||
+typedef struct {
|
||||
+ u64 version;
|
||||
+ void (*set_os_version) (const char *os_version);
|
||||
+ void (*set_os_vendor) (const char *os_vendor);
|
||||
+} apple_set_os_interface_t;
|
||||
+
|
||||
+static efi_status_t apple_set_os()
|
||||
+{
|
||||
+ apple_set_os_interface_t *set_os;
|
||||
+ efi_guid_t set_os_guid = APPLE_SET_OS_PROTOCOL_GUID;
|
||||
+ efi_status_t status;
|
||||
+ void **handles;
|
||||
+ unsigned long i, nr_handles, size = 0;
|
||||
+
|
||||
+ status = efi_bs_call(locate_handle, EFI_LOCATE_BY_PROTOCOL,
|
||||
+ &set_os_guid, NULL, &size, handles);
|
||||
+
|
||||
+ if (status == EFI_BUFFER_TOO_SMALL) {
|
||||
+ status = efi_bs_call(allocate_pool, EFI_LOADER_DATA,
|
||||
+ size, &handles);
|
||||
+
|
||||
+ if (status != EFI_SUCCESS)
|
||||
+ return status;
|
||||
+
|
||||
+ status = efi_bs_call(locate_handle, EFI_LOCATE_BY_PROTOCOL,
|
||||
+ &set_os_guid, NULL, &size, handles);
|
||||
+ }
|
||||
+
|
||||
+ if (status != EFI_SUCCESS)
|
||||
+ goto free_handle;
|
||||
+
|
||||
+ nr_handles = size / sizeof(void *);
|
||||
+ for (i = 0; i < nr_handles; i++) {
|
||||
+ void *h = handles[i];
|
||||
+
|
||||
+ status = efi_bs_call(handle_protocol, h,
|
||||
+ &set_os_guid, &set_os);
|
||||
+
|
||||
+ if (status != EFI_SUCCESS || !set_os)
|
||||
+ continue;
|
||||
+
|
||||
+ if (set_os->version > 0) {
|
||||
+ efi_bs_call((unsigned long)set_os->set_os_version,
|
||||
+ "Mac OS X 10.9");
|
||||
+ }
|
||||
+
|
||||
+ if (set_os->version >= 2) {
|
||||
+ efi_bs_call((unsigned long)set_os->set_os_vendor,
|
||||
+ "Apple Inc.");
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+free_handle:
|
||||
+ efi_bs_call(free_pool, uga_handle);
|
||||
+
|
||||
+ return status;
|
||||
+}
|
||||
|
||||
static void __noreturn efi_exit(efi_handle_t handle, efi_status_t status)
|
||||
{
|
||||
@@ -951,6 +1008,8 @@ void __noreturn efi_stub_entry(efi_handle_t handle,
|
||||
|
||||
setup_unaccepted_memory();
|
||||
|
||||
+ apple_set_os();
|
||||
+
|
||||
status = exit_boot(boot_params, handle);
|
||||
if (status != EFI_SUCCESS) {
|
||||
efi_err("exit_boot() failed!\n");
|
||||
diff --git a/include/linux/efi.h b/include/linux/efi.h
|
||||
index d59b0947f..81158014f 100644
|
||||
--- a/include/linux/efi.h
|
||||
+++ b/include/linux/efi.h
|
||||
@@ -385,6 +385,7 @@ void efi_native_runtime_setup(void);
|
||||
#define EFI_MEMORY_ATTRIBUTES_TABLE_GUID EFI_GUID(0xdcfa911d, 0x26eb, 0x469f, 0xa2, 0x20, 0x38, 0xb7, 0xdc, 0x46, 0x12, 0x20)
|
||||
#define EFI_CONSOLE_OUT_DEVICE_GUID EFI_GUID(0xd3b36f2c, 0xd551, 0x11d4, 0x9a, 0x46, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d)
|
||||
#define APPLE_PROPERTIES_PROTOCOL_GUID EFI_GUID(0x91bd12fe, 0xf6c3, 0x44fb, 0xa5, 0xb7, 0x51, 0x22, 0xab, 0x30, 0x3a, 0xe0)
|
||||
+#define APPLE_SET_OS_PROTOCOL_GUID EFI_GUID(0xc5c5da95, 0x7d5c, 0x45e6, 0xb2, 0xf1, 0x3f, 0xd5, 0x2b, 0xb1, 0x00, 0x77)
|
||||
#define EFI_TCG2_PROTOCOL_GUID EFI_GUID(0x607f766c, 0x7455, 0x42be, 0x93, 0x0b, 0xe4, 0xd7, 0x6d, 0xb2, 0x72, 0x0f)
|
||||
#define EFI_TCG2_FINAL_EVENTS_TABLE_GUID EFI_GUID(0x1e2ed096, 0x30e2, 0x4254, 0xbd, 0x89, 0x86, 0x3b, 0xbe, 0xf8, 0x23, 0x25)
|
||||
#define EFI_LOAD_FILE_PROTOCOL_GUID EFI_GUID(0x56ec3091, 0x954c, 0x11d2, 0x8e, 0x3f, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
|
||||
--
|
||||
2.42.0
|
||||
|
@ -7,8 +7,13 @@
|
||||
|
||||
boot = {
|
||||
initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
|
||||
initrd.kernelModules = [ ];
|
||||
kernelModules = [ "applesmc" "kvm-intel" "wl" ];
|
||||
kernelPatches = [
|
||||
{
|
||||
name = "spoof-mac-os-x";
|
||||
patch = ./0001-Add-apple_set_os-EFI-boot-service.patch;
|
||||
}
|
||||
];
|
||||
extraModulePackages = [ config.boot.kernelPackages.broadcom_sta ];
|
||||
};
|
||||
|
||||
@ -18,10 +23,19 @@
|
||||
|
||||
hardware = {
|
||||
cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
nvidia = {
|
||||
modesetting.enable = true;
|
||||
powerManagement.enable = true;
|
||||
opengl = {
|
||||
enable = true;
|
||||
extraPackages = with pkgs; [
|
||||
intel-vaapi-driver
|
||||
intel-media-driver
|
||||
libvdpau-va-gl
|
||||
];
|
||||
driSupport = true;
|
||||
};
|
||||
};
|
||||
|
||||
environment.variables = {
|
||||
VDPAU_DRIVER = "va_gl";
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user