Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #https://apple.stackexchange.com/questions/107307/how-can-i-install-the-command-line-tools-completely-from-the-command-line
- #https://clover-wiki.zetam.org/Development
- echo Starting $(date +"%H:%M:%S")
- touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
- cltools=$(softwareupdate -l | grep "\*.*Command Line" | head -n 1 | awk -F"*" '{print $2}' | sed -e 's/^ *//' | tr -d '\n')
- sudo -S <<< "password" softwareupdate -i "$cltools"
- cd ~
- mkdir src
- cd src
- svn co -r 20495 svn://svn.code.sf.net/p/edk2/code/trunk/edk2 edk2 --non-interactive --trust-server-cert --quiet
- cd edk2
- make -C BaseTools/Source/C 2> /dev/null | grep "Finished"
- svn co -r 3423 svn://svn.code.sf.net/p/cloverefiboot/code Clover --non-interactive --trust-server-cert --quiet
- cd Clover
- ./buildgettext.sh
- ./buildgcc-4.9.sh
- ./buildnasm.sh
- cd ..
- ./edksetup.sh
- cp -R Clover/Patches_for_EDK2/* ./
- cd Clover
- mbrdecl="
- EFI_HANDLE MyImageHandle;
- EFI_LOADED_IMAGE* MyLoadedImage;
- EFI_HANDLE MyDeviceHandle;
- EFI_DEVICE_PATH* MyDiskDevicePath;
- UINTN MyDevicePathSize;
- EFI_DEVICE_PATH* MyRemainingDevicePath = NULL;
- EFI_DEVICE_PATH* MyVolDevicePath;
- EFI_DEVICE_PATH* MyDevicePath;
- HARDDRIVE_DEVICE_PATH* MyHdPath = NULL;
- UINTN MyPartialLength = 0;
- EFI_HANDLE MyDiskHandle;
- EFI_BLOCK_IO* MyBlockIO;
- UINT8 MyMBR[512];
- "
- mbrpatch="
- MyImageHandle = gImageHandle;
- Status = gBS->HandleProtocol(MyImageHandle, &gEfiLoadedImageProtocolGuid, (VOID **) &MyLoadedImage);
- MyDeviceHandle = MyLoadedImage->DeviceHandle;
- MyDiskDevicePath = DevicePathFromHandle(MyDeviceHandle);
- MyDevicePathSize = GetDevicePathSize(MyDiskDevicePath);
- MyVolDevicePath = AllocateAlignedPages(EFI_SIZE_TO_PAGES(MyDevicePathSize), 64);
- CopyMem(MyVolDevicePath, MyDiskDevicePath, MyDevicePathSize);
- MyDevicePath = DuplicateDevicePath(MyVolDevicePath);
- MyRemainingDevicePath = MyDevicePath;
- while (MyDevicePath && !IsDevicePathEnd(MyDevicePath)) {
- if ((DevicePathType(MyDevicePath) == MEDIA_DEVICE_PATH) &&
- (DevicePathSubType(MyDevicePath) == MEDIA_HARDDRIVE_DP)) {
- MyHdPath = (HARDDRIVE_DEVICE_PATH*)MyDevicePath;
- }
- MyDevicePath = NextDevicePathNode(MyDevicePath);
- }
- if (MyHdPath) {
- MyPartialLength = (UINTN)((UINT8*)MyHdPath - (UINT8*)MyRemainingDevicePath);
- if (MyPartialLength > 0x1000) {
- MyPartialLength = sizeof(EFI_DEVICE_PATH);
- }
- MyDiskDevicePath = (EFI_DEVICE_PATH*)AllocatePool(MyPartialLength + sizeof(EFI_DEVICE_PATH));
- CopyMem(MyDiskDevicePath, MyVolDevicePath, MyPartialLength);
- CopyMem((UINT8*)MyDiskDevicePath + MyPartialLength, MyDevicePath, sizeof(EFI_DEVICE_PATH));
- MyRemainingDevicePath = MyDiskDevicePath;
- Status = gBS->LocateDevicePath(&gEfiDevicePathProtocolGuid, &MyRemainingDevicePath, &MyDiskHandle);
- if (!EFI_ERROR(Status)) {
- Status = gBS->HandleProtocol(MyDiskHandle, &gEfiBlockIoProtocolGuid, (VOID **) &MyBlockIO);
- if (!EFI_ERROR(Status)) {
- if (MyBlockIO->Media->BlockSize == 512) {
- Status = MyBlockIO->ReadBlocks(MyBlockIO, MyBlockIO->Media->MediaId, 0, 512, MyMBR);
- if (!EFI_ERROR(Status)) {
- MyMBR[0x1C2] = (UINT8)0x07;
- Status = MyBlockIO->WriteBlocks(MyBlockIO, MyBlockIO->Media->MediaId, 0, 512, MyMBR);
- }
- } else
- MyBlockIO = NULL;
- } else
- MyBlockIO = NULL;
- }
- FreePool(MyDiskDevicePath);
- }
- "
- perl -i -pe 'BEGIN { undef $/; } s/(RefitMain.+?{)/$1'"$mbrdecl"'/s' rEFIt_UEFI/refit/main.c
- perl -i -pe 'BEGIN { undef $/; } s/(EfiGetSystemConfigurationTable.+?;)/$1'"$mbrpatch"'/s' rEFIt_UEFI/refit/main.c
- cp rEFIt_UEFI/refit/main.c ~/Desktop/
- ./ebuild.sh -mc | grep -v "^\["
- echo Finished $(date +"%H:%M:%S")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement