Ok. There seems to be hell lot of confusion in this thread. I have dual-booted Windows 7 x64 Pro and Archlinux x86_64 (grub2) for about a year now in UEFI-GPT configuration. Assuming most of you know BIOS systems boot, I will describe how UEFI systems boot.
UEFI firmware has the ability to read MBR and GUID Partition tables as well as FAT 12/16/32 filesystems (Apple EFI additionally has HFS+ support and APM partition table support). UEFI firmware does not use any bootsector or embedded code in any part of disk (MBR or partition start etc.).
Every UEFI system requires >=100 MiB FAT32 EF00 (gdisk code) EFI SYSTEM PARTITION (I recommend atleast 200 MiB). This is not /boot partition which is different from EFISYS. This partition is compulsory for any UEFI system and it should be FAT32.
Windows ISO Installer determines which firmware has been used for booting the ISO. If BIOS is used, MBR is supported. If UEFI then GPT is supported. Not vice-versa. Kind of idiotic (I know).
GParted (actually GNU Parted) very well supports GPT for about 2 years now. I recommend GNU Parted (libparted) >=2.3 .
Format the whole /dev/sda as GPT using gdisk. Create the EFI SYSTEM PARTITION, 1 Windows Partition NTFS any size you want, any number of Linux Data Partitions (use some random partition type GUID for all) of any size each. 1 Linux swap of size twice the size of installed RAM in the system.
The reason i told you to use random guid for linux partitions is that linux by default does not have its own basic data partition type defined (even haiku has it) so people started using the part-guid which Microsoft defined for Basic Data FAT/NTFS partitions as the part-guid for linux partitions as well. Linux kernel does not care about partition type guid for its data partitions. I use some crazy random key-strokes guid for my Archlinux /boot and '/' root fs.
The structure of ESP is that it mainly contains a /EFI dir inside which there are many subdirs which can be used by each vendor (
http://www.uefi.org/specs/esp_registry). Windows installs the efi bootloader to (ESP)/EFI/Microsoft/Boot/ which is identical to (WINDOWS_SYSTEM_PART)/boot/microsoft/ incase of BIOS systems.
The dir mainly consists of bootmgfw.efi, bootmgr.efi, memtest.efi and 'bcd'. The files we need to bother about are bootmgfw.efi and bcd. 'bcd' is the menu file for bootmgr similar to grub.cfg for grub2. 'bootmgfw.efi' is analogous to grub.efi .
All linux distro installers (Ubuntu included) assume EFISYS partition to be mounted at /boot/efi. This should be done manually by the user before launching the installer.
For manual setup of grub2-efi in ESP follow
https://wiki.archlinux.org/index.php...r_UEFI_systems (I wrote most of this). Do not follow
http://grub.enbug.org/TestingOnMacbook as it is mostly Mac specific.
When grub-install is run for UEFI systems, it sets up the (ESP)/EFI/<vendor name or grub> dir structure (ESP==/boot/efi in most linux systems), meaning if grub-install detects that ubuntu is running it will install grub2 at (ESP)/EFI/ubuntu/* , otherwise fallback to (ESP)/EFI/grub/*. I will assume (ESP)/EFI/grub for the below commands.
The grub2 modules and efi application is installed at (ESP)/EFI/grub/*.mod and (ESP)/EFI/grub/grub.efi . This application is portable and grub2 for the most part detect the prefix dir at runtime (see archwiki grub2 article for details).
Even if the ESP grub2 dir structure is setup, the firmware will not boot it since it has not been directed to launch the (ESP)/EFI/grub/grub.efi file as the default efi app. This thing is done by efibootmgr which is called internally by grub-install itself if it detetc efibootmgr in the system (`which efibootmgr`). You can also set it up separately using instructions at
https://wiki.archlinux.org/index.php...e_Boot_Manager.
Note: grub-install for uefi system does not take any device path at the end of command ie no 'grub-install /dev/sda'.
My /dev/sda is GPT
Code:
GPT fdisk (gdisk) version 0.7.1
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
Found valid GPT with protective MBR; using GPT.
Disk /dev/sda: 625142448 sectors, 298.1 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 625142414
Partitions will be aligned on 8-sector boundaries
Total free space is 33792359 sectors (16.1 GiB)
Number Start (sector) End (sector) Size Code Name
1 2048 821247 400.0 MiB EF00 EFI_SYSTEM_PART
2 821248 823295 1024.0 KiB EF02 BIOS_BOOT_GRUB2
3 823296 1642495 400.0 MiB FFFF ARCHLINUX_x86_64_BOOT
4 1642496 16322559 7.0 GiB 8200 ARCHLINUX_x86_64_SWAP
5 17832150 112197959 45.0 GiB 0700 MS_WINDOWS_7_x86_64_PRO
6 112197960 206563769 45.0 GiB 0700 DATA_3
7 206563770 258179514 24.6 GiB FFFF ARCHLINUX_x86_64_ROOT
8 290455200 457370549 79.6 GiB 0700 DATA_1
9 457370550 625137344 80.0 GiB 0700 DATA_2
The partition names are self explanatory. Notice the FFFF code for Archlinux Root and Boot partition (random part-type guid).
First create the partitios as described above. Install Windows 7 in UEFI_GPT mode. Then install Ubuntu, grub-efi-amd64 (I guess thats the ubuntu package name for grub2 x86_64-efi).
Run grub-install and make grub.efi default using efibootmgr. The add the following to (ESP)/EFI/grub/grub.cfg (/EFI or /efi is immaterial since fat32 is case-insensitive - not UTF-8 encoding)
Code:
menuentry "Windows 7 UEFI" {
search --file --no-floppy --set=root /efi/Microsoft/Boot/bootmgfw.efi
chainloader (${root})/efi/Microsoft/Boot/bootmgfw.efi
}
Windows UEFI booting is described clearly at
http://www.insanelymac.com/forum/lof...ex.php/t186440 .
If you get black screen with a cursor problem while launching grub2, you need to compile grub2-efi with this patch
https://github.com/skodabenz/Misc_Li...lignment.patch .
Bookmarks