Jump to content

Linux and Windows UEFI boot using Tianocore DUET firmware


  • Please log in to reply
153 replies to this topic

#81
Keshav Amburay

Keshav Amburay

    InsanelyMac Protégé

  • Members
  • PipPip
  • 56 posts
  • Gender:Male
  • Location:Indiana, USA
  • Interests:Arch Linux

What I would like would be to completely tame the compilation process, which is too complicated for people that are not firmware developers, maybe taking advantage of those GNU EFI tools which are used to compile ELILO.

This is my guess, because I never had the EFILDR and EFILDR16 images with me. Only the EFILDR20 that Keshav compiled (call it the law of the least effort, or the principle of minimum energy...).
I'm convinced that if you take the first 512 or maybe 4096 bytes of those three files, the rest of the files are byte for byte equal.


http://dl.dropbox.co...LE_BUILD.tar.xz
http://dl.dropbox.co...LE_BUILD.tar.xz

Compiled files compressed with tar and (xz -9) as on 13-JUN-2011 , the (DUET_EMUVARIABLE_BUILD.tar.xz)/FV/Efildr20 is same as Efildr20 in EFI_DUET and ditto for FSVARIABLE build.

@migle: All the Efildr files plus the relevant scripts copied into the dir for you to see.

My build process :-

1) Set up symlinks outside (OUTER_DIR) the edk2 and other tianocore git checkout dirs - https://github.com/s.../my_symlinks.sh

2) Then apply https://github.com/s...Makefiles.patch into EDK2 root dir - not all the changes are needed for DuetPkg, some of them are for OvmfPkg (QEMU and VirtualBox UEFI firmware), but those changes are untested.

For now I maintain the patch in the form of a separate git branch keshav_pr in the edk2 git repo so my duet compile script simply checks out that branch before compile, instead of applying the patch like normally needed.

3) Run (OUTER_DIR)/duet_x64_edk2_linux_compile_setup.sh ( https://github.com/s...ompile_setup.sh ) which sources https://github.com/s..._duet_common.sh which in turn sources https://github.com/s...ocore_common.sh .

See the scripts on how the compile process occurs. Important info - I compile in Archlinux x86_64 system with gcc-multilib 4.6 (mostly latest snapshot - Archlinux is bleeding-edge like), and Archlinux uses default python to python3, so i temporarily re symlink python2 into python for the compile process to continue. Also with -Werror compile fails in gcc 4.6, that is removed in CORRECT_WERROR() in tianocore_common.sh .

4) duet_x64_edk2_linux_compile_setup.sh calls http://tianocore.git...ld64.sh;hb=HEAD which automates most of the compile process. No need for mingw or mingw-w64. Although it can also be compiled in Windows with VS2008 or VS2010, I am more comfortable in linux due to the ability to automate the task using bash scripts.

5) DuetPkg/build64.sh simply builds only the FirmwareVolume (DUET_EMUVARIABLE_BUILD.tar.xz)/FV/DUETEFIMAINFV.Fv file (don't know what that means exactly).

DuetPkg/PostBuild.sh ( http://tianocore.git...uild.sh;hb=HEAD ) then creates the actual Efildr files using the pre-compiled ASM Bootsector files from DuetPkg/BootSector/bin ( http://tianocore.git...bc0c4fe;hb=HEAD )

6) DuetPkg/PostBuild.sh also creates the memdisk file i include in the other two repos in github by calling DuetPkg/CreateBootDisk.sh in the very end ( http://tianocore.git...Disk.sh;hb=HEAD ). I also added a https://github.com/s..._memdisk_old.sh file to my scripts to do this separately if the precompiled files are already available which may optionally be called in post_duet_x64_compile.sh (which I will describe later).

I tried to do the same memdisk but with BootDuet instead of edk2's bootsectors in https://github.com/s..._memdisk_new.sh but have not succeeded sop far due to device naming assumptions in srs5694's duet-install which do not work for a superfloppy loop device.

7) If the above compile succeeds and the Efildr files are generated successfully the i manually run https://github.com/s..._x64_compile.sh which copies the files ot the relevant local location of the github repos, commits the changes with the DATE as the commit messages. I push the changes to github manually though.

The main reason sometimes Efildr files are not generated are due to some filesize restriction hardcoded in http://tianocore.git...nPage.c;hb=HEAD (mainly #define EFI_PAGE_BASE_OFFSET_IN_LDR 0x70000 ). This file is called in DuetPkg/PostBuild.sh for X64 firmware alone.

I had to disable some modules in http://tianocore.git...X64.dsc;hb=HEAD (file that includes modules to be compiled) and http://tianocore.git...Pkg.fdf;hb=HEAD (file that defines modules that should go into FV image) . See the UDK_EDK2_DuetPkg_Changes_to_Makefiles.patch patch for the changes I made to those files. If someone know what GenPage exactly does and can circumvent the filesize restriction I can include more modules like floppy (right nor the Efildr file will not recognize a floppy disk drive (hardware) once loaded, this restriction does not apply to loading Efildr from a floppy disk using BootDuet).

For all these scripts checkout https://github.com/s...y_Shell_Scripts . Hope this helps.

Also gnu-efi http://sourceforge.n...ojects/gnu-efi/ headers which ELILO uses, are a very minimal subset of efi-toolkit http://sourceforge.n...tle=EFI_Toolkit project which was active when EDK1 was used. Now EDK2 is one big integrated UEFI development environment which is much more updated and follow the latest Spec version. http://tianocore.git...=StdLib;hb=HEAD is the EDK2 equivalent of efi-toolkit.

#82
migle

migle

    InsanelyMac Protégé

  • Members
  • Pip
  • 27 posts
  • Location:Alcochete, Portugal

@migle: All the Efildr files plus the relevant scripts copied into the dir for you to see.


Ok, I just checked those files to see if EFILDR, EFILDR16 and EFILDR20 are equal except for the first 512 bytes. They are. That means that when using BootDuet we can safely just rename the file, as we have been doing, because it skips those first 512 bytes, and that means there's no point in keeping separate copies of those.

For all these scripts checkout https://github.com/s...y_Shell_Scripts . Hope this helps.


More than compiling Duet, I would like to understand it. I know that EFI files are PE executable files, that's good, we know all about those, they're COFF based, generated by some linker, obviously they're static executables that don't export symbols, GNU ldd will generate them given appropriate parameters.

Then there's FV files, Firmware Volume. Ok, they're something you would write on a flash memory or something. They're generated by that GenFV program given an INF file (which is a kind of makefile). But what are they? Collections of EFI files? FV files are described in the UEFI specification, but I didn't look into that yet.

Then there's FW files? What are those? Are they actually used here? It would be nice to strip this thing of things we don't need.

There's the EFILDR image, generated by EfiLdrImage. Reading the comments, it's a header (which we already know contains the loading code and the code that switches to protected mode and then to 64 bit mode), plus a collection of PE32 executables (EFI files? FV files?)...

You see, on the bootsect directory there's a readme file with a nice diagram telling how the multiple source files are combined. I would like to understand this at that level.

Then there's that whole bunch of GenThis, GenThat files. Some of them are of no use to us, who use Linux. On Windows, those simple tools like dd aren't available, so simply combining images of parts of images together require that a special purpose tool is written. We don't need those, and anyone who wants to use DUET for the same purpose as we do doesn't need them either (only a masochist would use DUET for booting Windows if it's not for having Linux or FreeBSD on the same machine).


Also gnu-efi http://sourceforge.n...ojects/gnu-efi/ headers which ELILO uses, are a very minimal subset of efi-toolkit http://sourceforge.n...tle=EFI_Toolkit project which was active when EDK1 was used. Now EDK2 is one big integrated UEFI development environment which is much more updated and follow the latest Spec version. http://tianocore.git...=StdLib;hb=HEAD is the EDK2 equivalent of efi-toolkit.


I just looked at that link you posted. Good, it's a runtime library, I understand that and it's essential for building a free-standing executable. I see the INF file for the dreaded python build tool. If I didn't have the python build tool, I would be able to do a Makefile for compiling that into a static library.

I'll take it for granted that that library is better than the gnu-efi. It even has floating-point support functions.

This is the kind of thing that is needed to understand this. To separate this into components are understand each of them in isolation. You already went far in that, but I didn't yet have the time for it.

We need to have a minimal understanding of how these files (FV, EfiLdr) are composed to be able to (as you are already able, I think) pick modules from other projects (VirtualBox). And we'll need to understand how this thing lays in memory and how come the OS doesn't overwrite it if we ever want to replace one module (such as FSVariable).

Of course, "need" is relative. This thing already does more or less what we want. It's still not the perfect pre-boot environment, but is already good enough to boot a single operating system (Windows) and we really don't need to boot any other.

#83
srs5694

srs5694

    InsanelyMac Legend

  • Members
  • PipPipPipPipPipPipPip
  • 541 posts
  • Gender:Male
  • Location:Woonsocket, RI

But please do not remove the -b and -u options in the script.


No, of course not. FWIW, I've uploaded a slightly more dynamic version of this change to:

http://www.rodsbooks...stall-0.1.2.tgz

This version checks for the presence of the copy_duet_files.sh file in the same directory as duet-install. If that file is present, the script sets the uefiDuetPath variable to the script's directory. If not, it sets it to ~/bootduet/skodabenz-EFI_DUET -- perhaps not better than the duet-install script's directory, but maybe it is. (It is for me.) The -u option overrides either of these, of course, and -b sends the script looking for BootDuet files elsewhere, too.

I think you're right by not changing partitions, boot flags, etc. That would only make new limitations arise. Partitioning is the job of gdisk and similar tools. The model would be GRUB. About compiling, I don't know...


I named my script "duet-install" after "grub-install." It actually does change boot flags, and sometimes partition type codes (it changes type codes when the -F option is used to create a FAT filesystem). As to compiling, since Keshav includes BootDuet binaries in his package set, and since binaries of SYSLINUX come with it, those who aren't familiar with software compilation can install everything. I've tested it from PartedMagic and it works there.

I think the best approach is formating the filesystem using default parameters and then installing the correct version of BootDuet for it.


One problem I ran into is that the Windows 7 installer flakes out if the ESP uses FAT16. (Probably FAT12, too, but I didn't test it.) Thus, if you want to use the ESP as the target for UEFI DUET and install Windows, it's best to use FAT32. This probably wouldn't be an issue if you were to use a separate ESP from the UEFI DUET installation partition, though. That's one of the reasons I changed my script to favor FAT32 whenever possible.

Partitioning and formatting automatically only makes sense for the original use of DUET which was on a dedicated pen drive, you can never make those kinds of assumptions about someones personal harddisk.


It can also make sense if you're setting everything up from scratch, although I admit that creating a filesystem separately isn't a big deal. I chose to make the default in my script to not create a filesystem, since I didn't want it accidentally trashing something important; but with the -F option, it will do so.

only a masochist would use DUET for booting Windows if it's not for having Linux or FreeBSD on the same machine


Actually, there's one potentially important reason for using UEFI DUET in a Windows-only environment: Getting access to >2 TiB hard disks. Of course, it's possible to use such a disk as a data (non-boot) disk without UEFI, but to use all of such a disk you need GPT, and to boot Windows from a GPT disk you need UEFI.

I've spoken with engineers at a couple of disk manufacturers, and they're concerned about this issue. (Or they were a few months ago; maybe they've got some other solutions coming by now.) I figure it's only a matter of time before a Windows-only user finds this thread because he's desperate to get his new 3 TB disk working properly in his small-form-factor computer that has room for just one hard disk.

Incidentally, does anybody know how to turn the recovery DVDs created from a recovery partition on a Windows 7 computer into a more standard install DVD? I ask because my laptop with Windows 7 Home has these recovery DVDs, but they include no EFI boot option, and I'm trying to get something that I can use to re-install Windows in EFI mode.

Edit: I just did a Web search and I found, surprisingly, that you can download legal Windows installation DVD images from here. You've got to have a valid license key to use them, of course, and license keys are tied to specific product versions, so this isn't a loophole for a free upgrade!

#84
Keshav Amburay

Keshav Amburay

    InsanelyMac Protégé

  • Members
  • PipPip
  • 56 posts
  • Gender:Male
  • Location:Indiana, USA
  • Interests:Arch Linux

One problem I ran into is that the Windows 7 installer flakes out if the ESP uses FAT16. (Probably FAT12, too, but I didn't test it.) Thus, if you want to use the ESP as the target for UEFI DUET and install Windows, it's best to use FAT32. This probably wouldn't be an issue if you were to use a separate ESP from the UEFI DUET installation partition, though. That's one of the reasons I changed my script to favor FAT32 whenever possible.


I don't know whether it is actually true, haven't found any documentation regarding this. But I never tried FAT16 or FAT12 (which will be never be actually used since EFISYS should be atleast 100 MiB) for EFISYS partition. I used mkfs.vfat -F32 option for my EFISYS and my DUET partition.

Incidentally, does anybody know how to turn the recovery DVDs created from a recovery partition on a Windows 7 computer into a more standard install DVD? I ask because my laptop with Windows 7 Home has these recovery DVDs, but they include no EFI boot option, and I'm trying to get something that I can use to re-install Windows in EFI mode.

Edit: I just did a Web search and I found, surprisingly, that you can download legal Windows installation DVD images from here. You've got to have a valid license key to use them, of course, and license keys are tied to specific product versions, so this isn't a loophole for a free upgrade!


You can also try http://www.insanelym...p...t&p=1261601 .

BTW see the link in post #71 on how to create Archlinux BIOS+UEFI and Windows x64 BIOS+UEFI USB drive. It will also be useful for other UEFI supporting distros like Ubuntu, Fedora (if using grub2-efi) or Clonezilla.

#85
scrapdogg

scrapdogg

    InsanelyMac Protégé

  • Members
  • Pip
  • 2 posts
i'd like to thank keshav for posting this guide on changing win7 to gpt without formatting, if a windows monkey like myself with no linux knowledge and even less than no mac knowledge can get this working then anyone can :P

for whatever reason neither sysresccd nor partedmagic would boot to a working gui no matter what i tried on my system (win7 64bit, gigabyte ga-x58a udr3 rev2,hitachi 3tb hdd{the reason i need to boot from gpt so i canactually use the whole drive}, core i7 950, and 2 radeon 6870's in crossfire). what did actually boot up to the gui's were riplinux grub iso and the gparted iso.

bet you're wondering why i needed both :)

i couldn't figure out for the life of me how to add gdisk (gptfdisk) to the riplinux iso, so i had to use it from the command prompt in gparted and then boot riplinux after the mbr to gpt conversion for the other tools since riplinux has a great gui. after mustering up enough courage to try this out i finally got it working after alot of google searches for "linux command for "?" (lol i told you i suck at linux) although i'm more than comfortable at a dos prompt "go figure".

one more thing, (setterm -powersave off -blank 0) before you start the gui is a must with riplinux as any partition work in gparted that is going to take a while will come to a screeching halt if the screensaver kicks in (found that out the hard way at 2:00 this morning when a partition move should have been completed only to find it at 20% done... and since i couldn't run that command with the gui already started i applied good old duct tape theory to the equaiton and used a pen to hold down one of the keys on the keyboard and went back to sleep :)

after i got everything working the 200mb efi partition was in the middle of the disk between 2 ntfs partitions. imagine my horror when i couldn't extend the os partition to the rest of the unallocated space on the drive. so when you make that partition you might think about creating it at the end of the disk if you want 1 big data partition (generally frowned upon i know, but i always shrink it in windows before i back it up). or you can use gparted to move partitions around afterwards like i'm doing now. :P

one more more thing while i'm thinking about it on my particular motherboard the efi boot option will only actually boot up windows 7 on the intel sata ports!!! not the marvell ports and definitely not the jmicron ports. (you have been warned!) and this goes without saying but, USE WINDOWS IMAGE BACKUP TO BACKUP YOUR OS BEFORE YOU TRY ANY OF THIS!!!. i think i restored my mbr backup 3 times before i got everything right.

thanks to everyone else who added to this thread as well, hope my mistakes can help someone out who know even less about linux than i do :) and i fully expected the forum quizzes to be all osx stuff but to my surprise they were just general tech stuff. first quiz 8/12 second one 19/20. not bad for an old dos/windows guy. i'm actually a+ certified if you can believe that!! lol, more like a+ certifiable :)

#86
srs5694

srs5694

    InsanelyMac Legend

  • Members
  • PipPipPipPipPipPipPip
  • 541 posts
  • Gender:Male
  • Location:Woonsocket, RI

I don't know whether it is actually true, haven't found any documentation regarding this. But I never tried FAT16 or FAT12 (which will be never be actually used since EFISYS should be atleast 100 MiB) for EFISYS partition. I used mkfs.vfat -F32 option for my EFISYS and my DUET partition.


My comment about Windows flaking out with non-FAT32 ESPs is based on my own observations. I was actually getting quite frustrated because I was initially letting mkdosfs set the FAT size, and it uses FAT16 on 100-200 MiB partitions. Windows will then begin to install but complain that the partitions aren't in the recommended order. It then fails after copying a bunch of files and, on reboot, I'd find that there were two ESPs -- the one I created and the one that Windows created because it didn't like the one I created. Switching to FAT32 solves those problems. Using a separate non-ESP partition for UEFI DUET and letting Windows create the disk's ESP would also presumably work, but I've not tested that.

Incidentally, I've discovered another "gotcha:" Both GParted and GNU Parted (and probably other GParted-based tools) clear all the GPT attribute flags from all partitions whenever they create or delete (and maybe modify) any partition. This of course wreaks havoc with SYSLINUX, which relies on the "Legacy BIOS Bootable" flag being set. That's not so much of a problem if you're using GRUB in the MBR, but with SYSLINUX it's a pain.

i'd like to thank keshav for posting this guide on changing win7 to gpt without formatting, if a windows monkey like myself with no linux knowledge and even less than no mac knowledge can get this working then anyone can :P


ROTFL! Just two posts after I predicted it, a Windows-only person comes along! ;) (Although it sounds like you've got a motherboard with built-in UEFI, so you're not using DUET.)

bet you're wondering why i needed both ;)

i couldn't figure out for the life of me how to add gdisk (gptfdisk) to the riplinux iso, so i had to use it from the command prompt in gparted and then boot riplinux after the mbr to gpt conversion for the other tools since riplinux has a great gui.


FWIW, USB flash drives are great tools for situations like this. You can drop whatever you need on them and use them from the flash drive, or perhaps copy them over.

after i got everything working the 200mb efi partition was in the middle of the disk between 2 ntfs partitions. imagine my horror when i couldn't extend the os partition to the rest of the unallocated space on the drive. so when you make that partition you might think about creating it at the end of the disk if you want 1 big data partition (generally frowned upon i know, but i always shrink it in windows before i back it up). or you can use gparted to move partitions around afterwards like i'm doing now. :blink:


On a fresh installation, the usual practice is to put the ESP at the very start of the disk. If you're converting an existing setup, though, the end likely makes more sense than the middle because it won't get in the way if it's at the end. An alternative would be to shrink your Windows partition from its start to clear up space at the start of the disk, but that type of repartitioning operation is always a bit risky. (It's generally safer to modify the end point of a partition rather than the start point.)

one more more thing while i'm thinking about it on my particular motherboard the efi boot option will only actually boot up windows 7 on the intel sata ports!!! not the marvell ports and definitely not the jmicron ports. (you have been warned!)


You could check the motherboard and/or chipset manufacturers' Web sites to see if they've got UEFI drivers for their products. Even if they do, though, that might not be all that much help, since the UEFI needs to be able to read the disk in order to load the driver, and if that's your only disk, it won't help much to have a driver on a disk that the firmware can't read. One way around it might be to put the firmware in a USB flash drive or something similar. This might be worth doing if the Marvell or JMicron ports were faster or otherwise preferable to the Intel ports. If not, though, moving the cable to an Intel port is certainly simpler.

#87
Keshav Amburay

Keshav Amburay

    InsanelyMac Protégé

  • Members
  • PipPip
  • 56 posts
  • Gender:Male
  • Location:Indiana, USA
  • Interests:Arch Linux

My comment about Windows flaking out with non-FAT32 ESPs is based on my own observations. I was actually getting quite frustrated because I was initially letting mkdosfs set the FAT size, and it uses FAT16 on 100-200 MiB partitions. Windows will then begin to install but complain that the partitions aren't in the recommended order. It then fails after copying a bunch of files and, on reboot, I'd find that there were two ESPs -- the one I created and the one that Windows created because it didn't like the one I created. Switching to FAT32 solves those problems. Using a separate non-ESP partition for UEFI DUET and letting Windows create the disk's ESP would also presumably work, but I've not tested that.


Might be related to UEFI Spec specifically mentioning FAT32 for ESP (atleast in one place in the document).

Incidentally, I've discovered another "gotcha:" Both GParted and GNU Parted (and probably other GParted-based tools) clear all the GPT attribute flags from all partitions whenever they create or delete (and maybe modify) any partition. This of course wreaks havoc with SYSLINUX, which relies on the "Legacy BIOS Bootable" flag being set. That's not so much of a problem if you're using GRUB in the MBR, but with SYSLINUX it's a pain.


GParted (and KDE Partition Manager) depends on libparted (part of GNU Parted) so thats the one likely creating the problem. I actually had this error with Syslinux when I repartitioned my linux system using GParted for separate /var about two months back but I didn't suspect libparted was the cause of the problem. I simply replaced syslinux with grub2 bios but didn't check the /boot partition GPT attributes.

BTW RIP (Recovery Is Possible, not Rest In Peace lol) linux http://www.tux.org/p.../looplinux/rip/ includes gdisk command in the iso but I am not sure of fixparts though. I use it instead of parted-magic since parted magic does not provide a 64-bit kernel (for chroot operations). For a person new to the linux world I would recommend System Rescue CD for an ALL-IN-ONE rescue system but its download size is slightly bigger than RIP Linux or parted-magic. AFAIK RIP uses Fluxbox, SysResCD uses XFCE and Parted Magic uses LXDE as the Desktop Environment. Of these Parted Magic does not provide a 64-bit kernel.

Also a Microsoft Reserved Partition (msftres GNU Parted flag) is not needed to boot Windows in UEFI mode. That partition is used to compensate for lack of post MBR 31 KiB gap (due to cylinder alignment in MBR setup) in GPT table. This region is used by Windows to store partition metadata of dynamic disks within the GPT system. Dynamic disks are similar to linux LVM. Having the msftres partition allows you to convert your disk to dynamic disk anytime. If you want to prevent Windows from converting the disk to Dynamic, I suggest you delete the msftres partition.

http://en.wikipedia....erved_Partition
http://en.wikipedia....dynamic_volumes
http://msdn.microsof...201104111922443
http://msdn.microsof.....28VS.85).aspx

#88
scrapdogg

scrapdogg

    InsanelyMac Protégé

  • Members
  • Pip
  • 2 posts

I've spoken with engineers at a couple of disk manufacturers, and they're concerned about this issue. (Or they were a few months ago; maybe they've got some other solutions coming by now.) I figure it's only a matter of time before a Windows-only user finds this thread because he's desperate to get his new 3 TB disk working properly in his small-form-factor computer that has room for just one hard disk.

Incidentally, does anybody know how to turn the recovery DVDs created from a recovery partition on a Windows 7 computer into a more standard install DVD? I ask because my laptop with Windows 7 Home has these recovery DVDs, but they include no EFI boot option, and I'm trying to get something that I can use to re-install Windows in EFI mode.

Edit: I just did a Web search and I found, surprisingly, that you can download legal Windows installation DVD images from here. You've got to have a valid license key to use them, of course, and license keys are tied to specific product versions, so this isn't a loophole for a free upgrade!


if you do end up downloading one of those legal windows isos, you can force it to uefi mode with the information in this thread, specifically keshav's post 2nd down from the top (keshav to the rescue again!!). i actually had to do it myself so i know that it works :D

http://www.insanelym...howtopic=184349

and lol you called it alright, although i actually have 3 hdd's in my computer WOOOOHOO go me!!

if i had known then what i know now i woulda bought a 2tb hdd :gun: just kidding i love breaking stuff and putting it back together!!! that's how i got the nickname "doc" as a kid i would fix stuff even if it wasn't broken!

and keshav you are absolutely right riplinux does in fact have gdisk and it also has fixparts as well. didn't even think to check since i had already burned gparted to a cdrw (there's one i can erase and get back) lol. i actually tried system rescue cd but like i said earlier my dumb :hysterical: couldn't get the gui part to show up on my system. an id10t error i'm sure.

thanks again guys

#89
migle

migle

    InsanelyMac Protégé

  • Members
  • Pip
  • 27 posts
  • Location:Alcochete, Portugal

Actually, there's one potentially important reason for using UEFI DUET in a Windows-only environment: Getting access to >2 TiB hard disks. Of course, it's possible to use such a disk as a data (non-boot) disk without UEFI, but to use all of such a disk you need GPT, and to boot Windows from a GPT disk you need UEFI.

I've spoken with engineers at a couple of disk manufacturers, and they're concerned about this issue. (Or they were a few months ago; maybe they've got some other solutions coming by now.) I figure it's only a matter of time before a Windows-only user finds this thread because he's desperate to get his new 3 TB disk working properly in his small-form-factor computer that has room for just one hard disk.


You're right, it's true, I forgot that. And they're selling older BIOSes even today! For many years to come people will want to have their >3TB or >30TB :-) disks and it's important that motherboards, processors, etc, don't simply become garbage because of such a minor issue (not minor... a little thing with a big impact).

#90
Keshav Amburay

Keshav Amburay

    InsanelyMac Protégé

  • Members
  • PipPip
  • 56 posts
  • Gender:Male
  • Location:Indiana, USA
  • Interests:Arch Linux

My comment about Windows flaking out with non-FAT32 ESPs is based on my own observations. I was actually getting quite frustrated because I was initially letting mkdosfs set the FAT size, and it uses FAT16 on 100-200 MiB partitions. Windows will then begin to install but complain that the partitions aren't in the recommended order. It then fails after copying a bunch of files and, on reboot, I'd find that there were two ESPs -- the one I created and the one that Windows created because it didn't like the one I created. Switching to FAT32 solves those problems. Using a separate non-ESP partition for UEFI DUET and letting Windows create the disk's ESP would also presumably work, but I've not tested that.


The below quote is not of any forum post. It is copied form the UEFI Specification 2.3.1 (supported by UDK/EDK2 DUET) Chapter 12.3 File System Format.

EFI encompasses the use of FAT32 for a system partition, and FAT12 or FAT16 for removable media. The FAT32 system partition is identified by an OSType value other than that used to identify previous versions of FAT. This unique partition type distinguishes an EFI defined file system from a normal FAT file system. The file system supported by EFI includes support for long file names.

FAT defines that all files in a directory must have a unique name, and unique is defined as a case insensitive match.

UEFI does not impose a restriction on the number or location of System Partitions that can exist on a system. System Partitions are discovered when required by UEFI firmware by examining the partition GUID and verifying that the contents of the partition conform to the FAT file system as defined in Section 12.3.1.1. Further, UEFI implementations may allow the use of conforming FAT partitions which do not use the ESP GUID. Partition creators may prevent UEFI firmware from examining and using a specific partition by setting bit 1 of the Partition Attributes (see 5.3.3) which will exclude the partition as a potential ESP.


Also see - Microsoft EFI FAT32 File System Specification - http://msdn.microsof...e/gg463080.aspx .

#91
migle

migle

    InsanelyMac Protégé

  • Members
  • Pip
  • 27 posts
  • Location:Alcochete, Portugal

The below quote is not of any forum post. It is copied form the UEFI Specification 2.3.1 (supported by UDK/EDK2 DUET) Chapter 12.3 File System Format.


Hmm. Well, Vista installed fine with a FAT16 ESP.

Sometimes, people overspecify things with no good reason. In the end, the firmware will have to support all three types even if just for removable media. That is to say, specifying that, will not relieve the firmware from dealing with the complexity of the three types of FAT. Also, an implementation which followed that paragraph strictly would have to have additional complexity for deciding which media is removable and limiting the types of FAT that would be recognized.

But, that quote is reason enough for "pushing" FAT32 to people by default.

Also see - Microsoft EFI FAT32 File System Specification - http://msdn.microsof...e/gg463080.aspx .


Hmm..... Following that link, what caught my attention was the license for the specifcation... It brings to mind that FAT32 now is a patented proprietary file system that has a specification which is available only to those who accept an agreement. Really. The only reason for that document being there is for people accepting the licence.

Who needs that spec? Everyone knows how FAT32 works: it's just like FAT16 (unpatentable common knowledge) except for one or two minor differences. Just read it on Wikipedia. LFN where a more complex change. There's open source software for FAT32 for at least 15 years. I'm really sorry that digital camera manufacturers didn't get together and challenge Microsoft's claims legally.

And who approved the UEFI spec fell into forcing the use of a proprietary file system...

That's also a good reason for having FAT16 and 12 as an option.

Thanks for looking it up in the UEFI spec.

#92
srs5694

srs5694

    InsanelyMac Legend

  • Members
  • PipPipPipPipPipPipPip
  • 541 posts
  • Gender:Male
  • Location:Woonsocket, RI
The FAT bitness thing gets worse: There a bug in Ubuntu 11.04 that causes it to trash existing ESPs, at least if they're FAT32 (I don't know if it also trashes FAT16 ESPs), replacing them with FAT16 ESPs. This imposes a hurdle for the coexistence of Windows and Ubuntu on a UEFI system: If you start with a Windows installation, Ubuntu trashes the ESP and makes Windows unbootable; and if you start with Ubuntu, Windows can't complete its installation and creates a duplicate ESP (if there's room on the disk). Either way, the only solution I'm aware of is to back up the ESP and restore it at one point or another.

#93
srs5694

srs5694

    InsanelyMac Legend

  • Members
  • PipPipPipPipPipPipPip
  • 541 posts
  • Gender:Male
  • Location:Woonsocket, RI
FWIW, I've put up some documentation on installing and using UEFI DUET on my Web page:

http://www.rodsbooks.com/bios2uefi/

It's geared toward intermediate-to-advaned Windows users, although the Linux-specific sections raise the bar a bit, the assumption being that Linux users need less hand-holding when it comes to mounting volumes, etc.

#94
Keshav Amburay

Keshav Amburay

    InsanelyMac Protégé

  • Members
  • PipPip
  • 56 posts
  • Gender:Male
  • Location:Indiana, USA
  • Interests:Arch Linux
I have created a mirror of the git repos at gitorious - https://gitorious.or...efi_duet_builds . Since I use github for my personal stuff (and it has a 300 MB or MiB limit), I thought gitirious is more suited for stuff like duet.

FWIW, I've put up some documentation on installing and using UEFI DUET on my Web page:

http://www.rodsbooks.com/bios2uefi/

It's geared toward intermediate-to-advaned Windows users, although the Linux-specific sections raise the bar a bit, the assumption being that Linux users need less hand-holding when it comes to mounting volumes, etc.


Few comments :-

UEFI DUET currently lacks support for common optical disc filesystems (ISO-9660 and UDF). This doesn't prevent you from installing an OS, perhaps even from such a disc; but you must have a way to start the installer from a hard disk partition or USB flash drive.


UEFI can boot CD/DVDs just fine provided they come with a EFI floppy image and a eltorito 0xEF entry pointing to that floppy image in the iso. which will be mounted by the UEFI firmware as a virtual EFISYS filesystem.

UEFI DUET doesn't work on all computers. Most importantly, it's really only useful on 64-bit x86-64 computers, especially in binary form. Even on such systems, it doesn't start up properly on all computers.


I am not so well-versed with English language but this sound like DUET does not start in ALL x86_64 computers. I think it should be 'in some of the systems'.

Please add link to gitorious page for the duet binaries https://gitorious.or...efi_duet_builds . I may even use it as default if i plan to change my github account to 'for personal stuff only' .

Extract the 1/Windows/Boot/EFI/bootmgfw.efi file from the SOURCES/install.wim file on the Windows installation disc. This file is in 7zip format, so you'll need a suitable unarchiver. I used 7z under Linux.


It is actually a Microsoft specific format called http://en.wikipedia...._Imaging_Format . 7-zip aka p7zip is the only non-Microsoft decompressor tool that can (as of now) extract WIM files.

This isn't a DUET issue specifically, but because Linux and Windows use the same partition type GUID to identify their filesystem partitions, Windows will see Linux filesystem partitions as unformatted Windows partitions; they'll show up in the Computer window and, if you click them, Windows will prompt you to format them. This is a disaster waiting to happen. I recommend you change the type code of Linux filesystem partitions using gdisk. Using a type code of 8301 ("Linux reserved") should keep Windows from messing with your Linux partitions.


I don't recommend Linux Reserved GUID either. We don't know (yet) for what purpose the linux kernel uses the partition type. Its better to stick with some random GUID untill a linux specific Data partition GUID is defined by upstream.

This link can go into the Additional Resources section http://homepage.ntlw...ot-process.html . Also like ##### XPC seems to be another DUET based hackintosh bootloader.




And http://homepage.ntlw...ot-process.html too.

#95
srs5694

srs5694

    InsanelyMac Legend

  • Members
  • PipPipPipPipPipPipPip
  • 541 posts
  • Gender:Male
  • Location:Woonsocket, RI

I have created a mirror of the git repos at gitorious - https://gitorious.or...ocore_uefi_duet . Since I use github for my personal stuff (and it has a 300 MB or MiB limit), I thought gitirious is more suited for stuff like duet.


One problem with that site is that there's no obvious way to download the whole package as a tarball or a ZIP file. Using git may be OK for people who are already familiar with it, but it's a very specialized tool, and lots of people aren't familiar with it. If there's something I've overlooked, could you please point it out to me?

UEFI can boot CD/DVDs just fine provided they come with a EFI floppy image and a eltorito 0xEF entry pointing to that floppy image in the iso. which will be mounted by the UEFI firmware as a virtual EFISYS filesystem.


Interesting, but apparently of only theoretical interest -- I ran some tests, and I was unable to get Fedora 15, OpenSUSE 11.4, Ubuntu 11.04, or Windows 7 to boot using the optical disc option in the UEFI DUET Boot Manager. If it works for you, there must be some trick to it, or maybe it only works on some systems. If so, I'd appreciate hearing precisely how you got it to work. Thanks.

UEFI DUET doesn't work on all computers.

I am not so well-versed with English language but this sound like DUET does not start in ALL x86_64 computers. I think it should be 'in some of the systems'.


To a native speaker, at least of American English, the construction I used clearly means that it works on some but not all computers. Nonetheless, I've changed the wording since clearly not everybody reading the page will be a native English speaker.

It is actually a Microsoft specific format called http://en.wikipedia...._Imaging_Format . 7-zip aka p7zip is the only non-Microsoft decompressor tool that can (as of now) extract WIM files.


Thanks for the correction; I've modified the page appropriately.

I don't recommend Linux Reserved GUID either. We don't know (yet) for what purpose the linux kernel uses the partition type. Its better to stick with some random GUID untill a linux specific Data partition GUID is defined by upstream.


AFAIK, the kernel doesn't use partition type codes at all; they're only used by partitioning tools and other user-space programs. Still, I do appreciate your point, but any way you do it it's a bad choice. I'll try contacting the libparted people to see if I can coordinate creation of a new code for Linux data partitions....

This link can go into the Additional Resources section http://homepage.ntlw...ot-process.html . Also like ##### XPC seems to be another DUET based hackintosh bootloader.


Thanks for the links. FWIW, I considered adding XPC, but I couldn't find anything remotely resembling an authoritative URL for it; like too many things in the Hackintosh world, XPC just seems to be floating around out there on various download sites. If you know of an authoritative reference for XPC, I'll add it, but I don't want to add a link to some random download site that might go away or become a link to something obsolete in a week.

BTW, I've done some more testing, and I've had success with UEFI DUET on only two of four computers for version 2.1 and only one of four computers for 2.3. The numbers are small, but one pattern is that the only computer to work with both versions uses an Intel CPU; my other three test computers all have AMD CPUs. That makes me wonder if you might have set an Intel-specific optimization when you compiled the code. If so, unsetting that option would make sense. Of course, it's also possible that the AMD/Intel correlation I'm seeing here is just a coincidence, or there could be something intrinsic to the code itself, rather than compile options, that makes it work poorly or not at all on AMD systems.

#96
Keshav Amburay

Keshav Amburay

    InsanelyMac Protégé

  • Members
  • PipPip
  • 56 posts
  • Gender:Male
  • Location:Indiana, USA
  • Interests:Arch Linux
@srs5694: In the bios2uefi page you mention thet grub2 seems to be most difficult-to-setup UEFI bootloader. Can you elaborate on it? Can you try https://github.com/s...2/grub2_uefi.sh ?

For others: rEFIt is written specifically for Intel Macs, not for any UEFI system, as a (kinda) multiboot boot-loader, so you may have problems with it in DUET or in Sandy Bridge UEFI systems.

#97
Keshav Amburay

Keshav Amburay

    InsanelyMac Protégé

  • Members
  • PipPip
  • 56 posts
  • Gender:Male
  • Location:Indiana, USA
  • Interests:Arch Linux
@srs5694: Please change the UEFI DUET link in bios2uefi page to https://gitorious.or...-tarball/master . This link works. I plan to remove github repos soon.

For updated links see http://www.insanelym...p...t&p=1300176 .

#98
Dr. Hurt

Dr. Hurt

    InsanelyMac Legend

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 1,456 posts
  • Gender:Male
  • Location:Cairo, Egypt and NYC, USA
  • Interests:Wandering around on the internet!! Politics, Sci/Tech, Medicine.
How about installing Windows 7 x64 on a real UEFI system. Does windows default to using the BIOS compatibility layer, or does it detect the UEFI and boot, format HDD accordingly. I'm getting a Dell inspiron N5110 soon which comes with APTIO UEFI. Really curious as to how this'll go.

#99
Laqk

Laqk

    InsanelyMac Protégé

  • Members
  • Pip
  • 18 posts

How about installing Windows 7 x64 on a real UEFI system. Does windows default to using the BIOS compatibility layer, or does it detect the UEFI and boot, format HDD accordingly. I'm getting a Dell inspiron N5110 soon which comes with APTIO UEFI. Really curious as to how this'll go.

In order to install Windows 7 x64 in true UEFI mode, the install DVD needs to have the proper el-torito record. This is the case with genuine Microsoft DVDs, or DVDs created by burning a genuine Microsoft ISO image. DVDs created with customized Windows 7 installs from applications like rt7lite will not work because they don't create the proper el-torito header.

There is a way to manually create an ISO image containing the proper el-torito records using the oscdimg.exe tool from either OPK or WAIK. In fact, that's the tool Microsoft use the create their own DVD images. That's what I used to create my own custom install Windows 7 x64 DVD and it worked very well, allowing me to install Windows 7 x64 in UEFI mode on a GPT-partitionned HDD.

#100
Keshav Amburay

Keshav Amburay

    InsanelyMac Protégé

  • Members
  • PipPip
  • 56 posts
  • Gender:Male
  • Location:Indiana, USA
  • Interests:Arch Linux

There is a way to manually create an ISO image containing the proper el-torito records using the oscdimg.exe tool from either OPK or WAIK. In fact, that's the tool Microsoft use the create their own DVD images. That's what I used to create my own custom install Windows 7 x64 DVD and it worked very well, allowing me to install Windows 7 x64 in UEFI mode on a GPT-partitionned HDD.


http://www.insanelym...p...t&p=1261601





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users

© 2014 InsanelyMac  |   News  |   Forum  |   Downloads  |   OSx86 Wiki  |   Mac Netbook  |   PHP hosting by CatN  |   Designed by Ed Gain  |   Logo by irfan  |   Privacy Policy