Repository: 0xbb/apple_set_os.efi Branch: master Commit: 5712c5bf5352 Files: 6 Total size: 4.9 KB Directory structure: gitextract_en31dnqg/ ├── .gitignore ├── Dockerfile ├── LICENSE ├── Makefile ├── README.md └── apple_set_os.c ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ *.so apple_set_os.o apple_set_os.efi ================================================ FILE: Dockerfile ================================================ FROM debian:stretch WORKDIR /build RUN apt-get update && apt-get install -y \ build-essential \ gnu-efi CMD make clean && make ================================================ FILE: LICENSE ================================================ The MIT License (MIT) Copyright (c) 2015 Bruno Bierbaumer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: Makefile ================================================ ARCH = x86_64 TARGET = apple_set_os.efi FORMAT = efi-app-$(ARCH) INC = /usr/include/efi CFLAGS = -I$(INC) -I$(INC)/$(ARCH) \ -DGNU_EFI_USE_MS_ABI -fPIC -fshort-wchar -ffreestanding \ -fno-stack-protector -maccumulate-outgoing-args \ -Wall -D$(ARCH) -Werror -m64 -mno-red-zone LDFLAGS = -T /usr/lib/elf_$(ARCH)_efi.lds -Bsymbolic -shared -nostdlib -znocombreloc \ /usr/lib/crt0-efi-$(ARCH).o %.efi: %.so objcopy -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel \ -j .rela -j .reloc -S --target=$(FORMAT) $^ $@ %.so: %.o $(LD) $(LDFLAGS) -o $@ $^ $(shell $(CC) $(CFLAGS) -print-libgcc-file-name) \ /usr/lib/libgnuefi.a all: $(TARGET) clean: rm -f $(TARGET) *.so apple_set_os.o ================================================ FILE: README.md ================================================ # apple_set_os.efi Tiny EFI program for unlocking the Intel IGD on the Macbook Pro 11,3 for Linux and Windows. It has been made to be easily chainloaded by unmodified EFI bootloader like Grub, rEFInd etc. The Macbook Pro 11,3 model's EFI is switching off the Intel GPU if you boot anything but Mac OS X. So a little trick by faking the OS identifiction is required to make all hardware accessible. All credits belong to [Andreas Heider](https://github.com/ah-) who originally discovered this hack: https://lists.gnu.org/archive/html/grub-devel/2013-12/msg00442.html ## Usage: Copy the apple_set_os.efi binary (download it from [releases](https://github.com/0xbb/apple_set_os.efi/releases)) to EFI System Partition (ESP) : ``` mkdir /boot/efi/EFI/custom cp apple_set_os.efi /boot/efi/EFI/custom ``` [rEFInd](http://www.rodsbooks.com/refind/) should automatically show a new icon for apple_set_os.efi. Grub can be configured to start apple_set_os.efi automatically by adding the following lines to ``/etc/grub.d/40_custom``: ``` search --no-floppy --set=root --label EFI chainloader (${root})/EFI/custom/apple_set_os.efi boot ``` ## Build: Tested on Debian Jessie 8.0: ``` apt-get install gnu-efi git clone https://github.com/0xbb/apple_set_os.efi cd apple_set_os.efi make ``` ## Build via docker ```bash docker build -t apple_set_os . && docker run --rm -it -v $(pwd):/build apple_set_os ``` ================================================ FILE: apple_set_os.c ================================================ // Copyright (c) 2015 Bruno Bierbaumer #include #include #include #include #include #include #include #define APPLE_SET_OS_VENDOR "Apple Inc." #define APPLE_SET_OS_VERSION "Mac OS X 10.9" static EFI_GUID APPLE_SET_OS_GUID = { 0xc5c5da95, 0x7d5c, 0x45e6, { 0xb2, 0xf1, 0x3f, 0xd5, 0x2b, 0xb1, 0x00, 0x77 }}; typedef struct efi_apple_set_os_interface { UINT64 version; EFI_STATUS (EFIAPI *set_os_version) (IN CHAR8 *version); EFI_STATUS (EFIAPI *set_os_vendor) (IN CHAR8 *vendor); } efi_apple_set_os_interface; EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *systemTable) { SIMPLE_TEXT_OUTPUT_INTERFACE *conOut = systemTable->ConOut; conOut->OutputString(conOut, L"apple_set_os started\r\n"); efi_apple_set_os_interface *set_os = NULL; EFI_STATUS status = systemTable->BootServices->LocateProtocol(&APPLE_SET_OS_GUID, NULL, (VOID**) &set_os); if(EFI_ERROR(status) || set_os == NULL) { conOut->OutputString(conOut, L"Could not locate the apple set os protocol.\r\n"); return status; } if(set_os->version != 0){ status = set_os->set_os_version((CHAR8 *) APPLE_SET_OS_VERSION); if(EFI_ERROR(status)){ conOut->OutputString(conOut, L"Could not set version.\r\n"); return status; } conOut->OutputString(conOut, L"Set os version to " APPLE_SET_OS_VERSION ".\r\n"); } status = set_os->set_os_vendor((CHAR8 *) APPLE_SET_OS_VENDOR); if(EFI_ERROR(status)){ conOut->OutputString(conOut, L"Could not set vendor.\r\n"); return status; } conOut->OutputString(conOut, L"Set os vendor to " APPLE_SET_OS_VENDOR ".\r\n"); return EFI_SUCCESS; }