Jump to content

Linux and Windows UEFI boot using Tianocore DUET firmware


Keshav Amburay
 Share

162 posts in this topic

Recommended Posts

Well, I am back at it. Thank you for your information. However I have still some questions.

 

On my system based on a GPT hard drive I have now several Linux running fine with GRUB2 intalled on a 1MiB partition with flag "bios_grub". I just want to add an entry for Windows 7 in GRUB2 to be able to launch Windows as well on this GPT disk.

 

Obviously I need to install DUET to do that. Initially I thought like making a DUET USB and map it on the GPT HD (ref. to the Chinese poster). Reading your answer I understand that I can do it directly on the HD (?)...

 

I never had a look to your BootDuet-master.zip before. So I went to compile it on my system. It gave me a list of bdxx.bin lst and map files. My system is amd64 then I guess I should use the file bd32_64.bin instead of bd32.bin as input file. I imagine I need as well to copy the bootmgfw.efi (and all of the files installed in the boot/efi partition by the windows installation in EFI mode).

 

Should I use a build with the hard-coded BIOS drive number (for the ESP) ?

 

However I am afraid it will compromise my working Linuxes installation. I don't want to directly boot into Windows. I would like it to work through GRUB2 after chainloading it in a specific entry for EFI DUET.

 

Could this work ? I guess I will not set the "boot" flag on the EFI System Partition so I will still be able to boot on the "bios_grub" flag 1 MiB partition ?

 

I mainly use Linux which I found more configurable, much quicker and more safe than Microsoft Windows. However, I still have some programs like Garmin GPS which only works in Windows. Some big commercial programs like the Adobe Creative Suite, ... etc.

 

Regards.

Link to comment
Share on other sites

My system is amd64 then I guess I should use the file bd32_64.bin instead of bd32.bin as input file. I imagine I need as well to copy the bootmgfw.efi (and all of the files installed in the boot/efi partition by the windows installation in EFI mode).

 

No, read the INSTALL file. The *_64.bin files are for 64-bit Logical Block Addressing, that's when the hard disk has more blocks than can be addressed with 32 bits (that's 2^32 blocks or 3TB) and still only when your ESP partition lies beyond the first 3TB.

 

You can, of course, boot using only the hard disk. You have GRUB 2 already correctly installed, you now only need to install BootDuet (and DUET, which is the EFILDR20 file) to your ESP and then chainload the ESP from GRUB.

 

Should I use a build with the hard-coded BIOS drive number (for the ESP) ?

 

No, that's mainly for using without a smart boot loader, and GRUB is smart and well behaved.

 

Could this work ? I guess I will not set the "boot" flag on the EFI System Partition so I will still be able to boot on the "bios_grub" flag 1 MiB partition ?

 

That's the preferrable setup. You don't need to copy and windows *.EFI files --- Windows already installed then into the EFI System Partition. You need only:

  • Copy the EFILDR20 file to the EFI System Partition (there should be only one in the disk)
  • Install BootDuet to the same ESP, using the dd command as explained in the INSTALL file (possibly also overwritting the hidden sectors field of the Boot Parameter Block of that partition as well, also as explained in the INSTALL file).
  • Add an entry to GRUB menu to chainload BootDuet which is on the ESP.

 

If you don't understand these steps well, then you should probably use the materials on rodsbooks.com, which relieve you from some of these details, but with which I cannot help you.

 

Greetings,

Link to comment
Share on other sites

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 B) 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.

Link to comment
Share on other sites

  • 6 months later...

Hi guys,

             Its been a long time since I interacted with many of you. I just want to say that I won't be updating the DUET git repos often since I now have a native UEFI 2.3.1 system (Lenovo Thinkpad Edge E430 3254-DAQ). You can find some UEFI related info about my laptop at https://wiki.archlinux.org/index.php/HCL/Firmwares/UEFI#Lenovo_Thinkpad_Edge_E430_3254-DAQ . I am not planning to take down the git repos but I suggest compiling your own DUET image if you want to test the latest code. I also suggest trying http://sourceforge.net/projects/cloverefiboot/ . I believe it might be discussed somewhere in the forum but can't find the thread. I haven't tried it myself but it seems to be updated regularly and has similar goals towards DUET usage.

  • Like 1
Link to comment
Share on other sites

  • 1 year later...

Even better (and eiser) use Clover it's based on tiancore and duet  and it supports OS X :claps: .

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 weeks later...

That didn't work as I wanted. The installer gives an error about installing to a GPT disk on a BIOS computer. Is there a way to make the DUET firmware read the DVD? The original person said that it worked for his Dell Studio 1555 and I'm using his version of the firmware in his second post.

Link to comment
Share on other sites

Are you using Clover, or DUET, or rEFInd, or rEFIt?


Clover is your best (And easiest in my mind) bet try clover it supports windows, os x, linux, and ny other os that can be (U)EFI loaded.

Link to comment
Share on other sites

  • 3 years later...

Maybe that's because TianoCore came from Intel.  :D

None of us here can get much inside the EFI emulation code, that would be a question for the TianoCore people.

 

You're better off trying one of those friendlier bootloaders, such as Clover.

And note that you only need UEFI to boot Windows, do you really want to do that?  :lol:

 

PS: I no longer use this solution, as I stopped using Windows at home.

Link to comment
Share on other sites

  • 2 months later...

Hi,

Know this is an old thread but its tough getting info on Duet so I thought I would ask here. I have made several Duet images and loading them inside VirtualBox. Noticed that the 2010 version of EDK2 Duetpkg does not load the efi shell unless you enable ‘efi’ setting in the Virtualbox settings. However the 2014 version loads the shell either way if EFI is turned off or on.  So was wondering if this is just some compatibility issue or just limitations with Edk2-2010?

 

Would prefer to use the 2010 version due to its small compile size.  The 2014 and above are about 50kb larger,

 

Thanks.

Link to comment
Share on other sites

 Share

×
×
  • Create New...