Advertisement
andy782

Untitled

Jun 25th, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.64 KB | None | 0 0
  1. #!/bin/bash
  2. #https://apple.stackexchange.com/questions/107307/how-can-i-install-the-command-line-tools-completely-from-the-command-line
  3. #https://clover-wiki.zetam.org/Development
  4. touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
  5. cltools=$(softwareupdate -l | grep "\*.*Command Line" | head -n 1 | awk -F"*" '{print $2}' | sed -e 's/^ *//' | tr -d '\n')
  6. sudo -S <<< "password" softwareupdate -i "$cltools"
  7. cd ~
  8. mkdir src
  9. cd src
  10. svn co -r 20495 svn://svn.code.sf.net/p/edk2/code/trunk/edk2 edk2 --non-interactive --trust-server-cert --quiet
  11. cd edk2
  12. make -C BaseTools/Source/C 2> /dev/null | grep "Finished"
  13. svn co -r 3423 svn://svn.code.sf.net/p/cloverefiboot/code Clover --non-interactive --trust-server-cert --quiet
  14. cd Clover
  15. ./buildgettext.sh
  16. ./buildgcc-4.9.sh
  17. ./buildnasm.sh
  18. cd ..
  19. ./edksetup.sh
  20. cp -R Clover/Patches_for_EDK2/* ./
  21. cd Clover
  22. mbrdecl="
  23. EFI_HANDLE MyImageHandle;
  24. EFI_LOADED_IMAGE* MyLoadedImage;
  25. EFI_HANDLE MyDeviceHandle;
  26. EFI_DEVICE_PATH* MyDiskDevicePath;
  27. UINTN MyDevicePathSize;
  28. EFI_DEVICE_PATH* MyRemainingDevicePath = NULL;
  29. EFI_DEVICE_PATH* MyVolDevicePath;
  30. EFI_DEVICE_PATH* MyDevicePath;
  31. HARDDRIVE_DEVICE_PATH* MyHdPath = NULL;
  32. UINTN MyPartialLength = 0;
  33. EFI_HANDLE MyDiskHandle;
  34. EFI_BLOCK_IO* MyBlockIO;
  35. UINT8 MyMBR[512];
  36. "
  37. mbrpatch="
  38. MyImageHandle = gImageHandle;
  39. Status = gBS->HandleProtocol(MyImageHandle, &gEfiLoadedImageProtocolGuid, (VOID **) &MyLoadedImage);
  40. MyDeviceHandle = MyLoadedImage->DeviceHandle;
  41. MyDiskDevicePath = DevicePathFromHandle(MyDeviceHandle);
  42. MyDevicePathSize = GetDevicePathSize(MyDiskDevicePath);
  43. MyVolDevicePath = AllocateAlignedPages(EFI_SIZE_TO_PAGES(MyDevicePathSize), 64);
  44. CopyMem(MyVolDevicePath, MyDiskDevicePath, MyDevicePathSize);
  45. MyDevicePath = DuplicateDevicePath(MyVolDevicePath);
  46. MyRemainingDevicePath = MyDevicePath;
  47. while (MyDevicePath && !IsDevicePathEnd(MyDevicePath)) {
  48. if ((DevicePathType(MyDevicePath) == MEDIA_DEVICE_PATH) &&
  49. (DevicePathSubType(MyDevicePath) == MEDIA_HARDDRIVE_DP)) {
  50. MyHdPath = (HARDDRIVE_DEVICE_PATH*)MyDevicePath;
  51. }
  52. MyDevicePath = NextDevicePathNode(MyDevicePath);
  53. }
  54. if (MyHdPath) {
  55. MyPartialLength = (UINTN)((UINT8*)MyHdPath - (UINT8*)MyRemainingDevicePath);
  56. if (MyPartialLength > 0x1000) {
  57. MyPartialLength = sizeof(EFI_DEVICE_PATH);
  58. }
  59. MyDiskDevicePath = (EFI_DEVICE_PATH*)AllocatePool(MyPartialLength + sizeof(EFI_DEVICE_PATH));
  60. CopyMem(MyDiskDevicePath, MyVolDevicePath, MyPartialLength);
  61. CopyMem((UINT8*)MyDiskDevicePath + MyPartialLength, MyDevicePath, sizeof(EFI_DEVICE_PATH));
  62. MyRemainingDevicePath = MyDiskDevicePath;
  63. Status = gBS->LocateDevicePath(&gEfiDevicePathProtocolGuid, &MyRemainingDevicePath, &MyDiskHandle);
  64. if (!EFI_ERROR(Status)) {
  65. Status = gBS->HandleProtocol(MyDiskHandle, &gEfiBlockIoProtocolGuid, (VOID **) &MyBlockIO);
  66. if (!EFI_ERROR(Status)) {
  67. if (MyBlockIO->Media->BlockSize == 512) {
  68. Status = MyBlockIO->ReadBlocks(MyBlockIO, MyBlockIO->Media->MediaId, 0, 512, MyMBR);
  69. if (!EFI_ERROR(Status)) {
  70. MyMBR[0x1C2] = (UINT8)0x07;
  71. Status = MyBlockIO->WriteBlocks(MyBlockIO, MyBlockIO->Media->MediaId, 0, 512, MyMBR);
  72. }
  73. } else
  74. MyBlockIO = NULL;
  75. } else
  76. MyBlockIO = NULL;
  77. }
  78. FreePool(MyDiskDevicePath);
  79. }
  80. "
  81. perl -i -pe 'BEGIN { undef $/; } s/(RefitMain.+?{)/$1'"$mbrdecl"'/s' rEFIt_UEFI/refit/main.c
  82. perl -i -pe 'BEGIN { undef $/; } s/(EfiGetSystemConfigurationTable.+?;)/$1'"$mbrpatch"'/s' rEFIt_UEFI/refit/main.c
  83. cp rEFIt_UEFI/refit/main.c ~/Desktop/
  84. ./ebuild.sh -mc | grep -v "^\["
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement