Well, I have tried to use the procedure you describe with no success. The install script you mentioned from Rod Smith is mainly suited to start from an empty drive. So I would have preferred to simply install an access for Windows in the current installation.
When selecting the Windows entry from the GRUB2 menu I get the following error message:
"error: invalid signature."
May be the problem is related on "How is the Hard Drive Partition Signature is calculated" in DUET. There is at least one question from a user on their edk2-devel email archive. I didn't found an answer for this. Nor why there is no problem with the Rod Smith script starting from a blank drive.
--------------------------------------------------------------------------------------------------------------------------------------------------
EDIT 1: For the following test I removed the EFI directory completely (containing Windows / ubuntu boot manager firmware) in the Boot DUET partition. Meaning the partition is either empty or with file Efildr20
On my latest test when I remove the Efildr20 file from the root of the Boot DUET partition I get the same error message meaning it does not load this file. Hence couldn't boot DUET.
Then copying again Efildr20 to the root of the partition, I get "error: file not found."
Removing it another time and I still get the same message "file not found".
It looks like it is unable to see the file Efildr20 ...
EDIT 2: It looks like the trouble come from the chainloading entry in GRUB2. I used an entry which worked well in pure EFI mode (on another computer).
Per se, if I remove my entry and replace it by the one used by the Chinese Poster:
menuentry "EFI DUET" {
set root=(hd0,3)
chainloader +1
}
I exit grub, but I get the error message:
"This is not a bootable disk. Please insert a bootable floppy and press any key to try again ..."
EDIT 3: replacing chainloader +1 by the path to the Windows boot manager firmware
chainloader (${root})/EFI/Microsoft/Boot/bootmgfw.efi
does not change anything. The system is expecting a bootable partition and it says it isn't. Why isn't it seen as bootable ? partition type is EF00 (boot flag is set).
Removing the file Efildr20 from the partition does not change anything. Meaning the system does not load Efildr20 but exit on error before. Hence should have nothing to do with the chainloading.
Well, I am not close to a quick solution.
--------------------------------------------------------------------------------------------------------------------------------------------------
Here are the detailed steps I followed. If you find anything I did wrong, please let me know.
Partition List on /dev/sda
-------------------------- -----
Command (? for help): p
Disk /dev/sda: 5860533168 sectors, 2.7 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): 6BA8BBC5-DB5D-47FA-A208-5ED2A213A87C
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 5860533134
Partitions will be aligned on 2048-sector boundaries
Total free space is 4678632301 sectors (2.2 TiB)
Number Start (sector) End (sector) Size Code Name
1 2048 1953791 953.0 MiB 0700 EFI System (for future
2 1953792 1955839 1024.0 KiB EF02 Boot BIOS GRUB
3 1955840 2932735 477.0 MiB 0700 EFI Boot DUET
4 2932736 3194879 128.0 MiB 0C01 Microsoft Reserved
5 3194880 393818111 186.3 GiB 0700 Windows 7
6 393820160 784445439 186.3 GiB AF00 Mac OS X
7 784445440 785422335 477.0 MiB 0700 boot
8 785422336 801046527 7.5 GiB 8200 linux-swap
9 801046528 947529727 69.8 GiB 0700 root
10 947529728 1181904895 111.8 GiB 0700 home
Preparing the boot partition
---------------------------- -------
$ sudo mkfs.msdos -F 32 -h 1955840 -v /dev/sda3
mkfs.msdos 3.0.12 (29 Oct 2011)
/dev/sda3 has 255 heads and 63 sectors per track,
logical sector size is 512,
using 0xf8 media descriptor, with 976896 sectors;
file system has 2 32-bit FATs and 8 sectors per cluster.
FAT size is 960 sectors, and provides 121868 clusters.
There are 32 reserved sectors.
Volume ID is 84239f3a, no volume label.
$
Show detailed information on ESP for DUET
----------------------------------------- --------------
Command (? for help): i
Partition number (1-10): 3
Partition GUID code: EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 (Microsoft basic data)
Partition unique GUID: 98475614-D7BE-494E-92DA-02B0A01EB693
First sector: 1955840 (at 955.0 MiB)
Last sector: 2932735 (at 1.4 GiB)
Partition size: 976896 sectors (477.0 MiB)
Attribute flags: 0000000000000000
Partition name: 'EFI Boot DUET'
Install BootDuet on the boot sector
----------------------------------- ---------
$ sudo -i
[sudo] password for jean:
# pwd
/root
# cd /home/jean/Downloads/BootDuet-master
# ls
bd12.bin bd16_64.bin bd16.bin bd32_64.bin bd32.bin BootDuet.S Makefile
bd12.lst bd16_64.lst bd16.lst bd32_64.lst bd32.lst COPYING README
bd12.map bd16_64.map bd16.map bd32_64.map bd32.map INSTALL
# dd if=bd32.bin of=/dev/sda20 bs=1 skip=90 seek=90 count=420
420+0 records in
420+0 records out
420 bytes (420

copied, 0.000607002 s, 692 kB/s
# logout
$
Get UUID for the Boot DUET Partition
------------------------------------ -----------
$ sudo blkid /dev/sda3
/dev/sda3: UUID="8423-9F3A" TYPE="vfat"
Chainloading Windows 7 in GRUB2
------------------------------- -------------
$ gksu gedit /etc/grub.d/40_custom
then append the following entry:
menuentry "Windows 7 x86_64 UEFI-GPT" {
insmod chain
insmod ntfs
search --fs-uuid --no-floppy --set=root 8423-9F3A
chainloader (${root})/EFI/Microsoft/Boot/bootmgfw.efi
}
Run update-grub
--------------- ------
$ sudo update-grub
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-3.2.0-35-generic
Found initrd image: /boot/initrd.img-3.2.0-35-generic
Found linux image: /boot/vmlinuz-3.2.0-23-generic
Found initrd image: /boot/initrd.img-3.2.0-23-generic
Found memtest86+ image: /memtest86+.bin
done
$
Mount the Boot DUET partition & Copy Microsoft Boot Manager Firmware [from Earlier install, as I have restored an image of the Windows 7 x64 partition]
-------------------------------------------------------------------------------------------------------------------------------------------------------
$ sudo mount /dev/sda3 /boot/efi
[sudo] password for jean:
$ sudo cp -R EFI /boot/efi
$
Copy DUET EFI Loader for FAT32
------------------------------ -------------
$ sudo cp Efildr20 /boot/efi
Unmount the Boot DUET partition
-------------------------------
$ sudo umount /dev/sda3
Change the partition type code of the Boot DUET partition
-------------------------------------------------------------------------
$ sudo gdisk
Command (? for help): t
Partition number (1-10): 3
Current type is 'Microsoft basic data'
Hex code or GUID (L to show codes, Enter = 8300): EF00
Changed type of partition to 'EFI System'
Command (? for help): p
Disk /dev/sda: 5860533168 sectors, 2.7 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): 6BA8BBC5-DB5D-47FA-A208-5ED2A213A87C
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 5860533134
Partitions will be aligned on 2048-sector boundaries
Total free space is 4678632301 sectors (2.2 TiB)
Number Start (sector) End (sector) Size Code Name
1 2048 1953791 953.0 MiB 0700
2 1953792 1955839 1024.0 KiB EF02
3 1955840 2932735 477.0 MiB EF00
4 2932736 3194879 128.0 MiB 0C01
5 3194880 393818111 186.3 GiB 0700
6 393820160 784445439 186.3 GiB AF00
7 784445440 785422335 477.0 MiB 0700
8 785422336 801046527 7.5 GiB 8200
9 801046528 947529727 69.8 GiB 0700
10 947529728 1181904895 111.8 GiB 0700
Command (? for help): w
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!
Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/sda.
Warning: The kernel is still using the old partition table.
The new table will be used at the next reboot.
The operation has completed successfully.
$
Reboot
---------
Regards.