Jump to content

knutster

Members
  • Content Count

    1
  • Joined

  • Last visited

About knutster

  • Rank
    InsanelyMac Protégé

Profile Information

  • Gender
    Male
  • Location
    Stockholm, Sweden
  1. I recently decided to blow away everything on my Macbook Pro 15" (late 2007) and install Lion and Ubuntu 11.04 in a dual boot fashion. I won't go into the details of installing Ubuntu on this particular machine here, but in the end I had the setup I wanted with rEFIt's gptsync updating my MBR properly and me able to dual boot either via rEFIt or holding the option key during boot and selecting the "Windows" partition. I then had the bright idea to enable Filevault full disk encryption. Unfortunately this: a ) resets the MBR to its virgin state making option-booting only find Lion. b ) hides rEFIt inside the encrypted partition making it non-viable. No worries, methinks, we'll just pop this puppy on the hidden /dev/disk0s1 EFI partition. After some incantations and blessing which can be Googled this was working fine. Alas, gptsync is not happy! gptsync: GPT partition of type 'Unknown' found, will not touch this disk. A quick diskutil list reveals that the once proud Lion HFS+ partition has now been converted to a partition of type Apple_CoreStorage and gptsync has no clue. After downloading the source to refit 0.14 I found the gpt partition types in lib.c in the gptsync directory. The new partition type for CoreStorage is not there and can be found with the following: vishnu:tools knut$ sudo gpt -r show -l /dev/rdisk0 start size index contents 0 1 MBR 1 1 Pri GPT header 2 32 Pri GPT table 34 6 40 409600 1 GPT part - "EFI System Partition" 409640 156250000 2 GPT part - "Lion" 156659640 1269536 3 GPT part - "Recovery HD" 157929176 1954 4 GPT part - "GRUB BIOS BOOT" 157931130 585938 5 GPT part - "LINUX BOOT" 158517068 154064691 6 GPT part - "LINUX LVM" 312581759 16 312581775 32 Sec GPT table 312581807 1 Sec GPT header vishnu:tools knut$ sudo gpt -r show /dev/rdisk0 start size index contents 0 1 MBR 1 1 Pri GPT header 2 32 Pri GPT table 34 6 40 409600 1 GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B 409640 156250000 2 GPT part - 53746F72-6167-11AA-AA11-00306543ECAC 156659640 1269536 3 GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC 157929176 1954 4 GPT part - 21686148-6449-6E6F-744E-656564454649 157931130 585938 5 GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 158517068 154064691 6 GPT part - E6D6D379-F507-44C2-A23C-238F2A3DF928 312581759 16 312581775 32 Sec GPT table 312581807 1 Sec GPT header 53746F72-6167-11AA-AA11-00306543ECAC is the id we're looking for, note that the first three blocks need to be reversed when you put it in lib.c. It thus becomes: 726F74536761AA11AA1100306543ECAC After rolling around on the floor with various versions of Xcode and gnu-efi to get this sucker compiled I finally gave up and went for plan B. I got out Hex Fiend (Mac hex editor) and replaced the tag for the Apple Raid (Offline) partition with the above in gptsync.efi on my blessed /efi partition. So I replaced this: 444941524F5FAA11AA1100306543ECAC with 726F74536761AA11AA1100306543ECAC (two matches). After a reboot gptsync detects the Apple_CoreStorage partition as Apple Raid (Offline) and generates an MBR that works fine for option-booting or rEFIt booting my Linux partition. rEFIt can be removed at this point but I'll keep it hanging around on the EFI partition in case I need it later. I'm too lazy to file a bug on rEFIt to get Apple_CoreStorage fixed, maybe someone else feels like doing it. Attached is a version of gptsync.efi that can be used to generate a working MBR for a Filevault 2 enabled system on Lion. Don't blame me if things start burning or melting. gptsync.zip
×