public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Andrew Fish <afish@apple.com>
To: Rafael Machado <rafaelrodrigues.machado@gmail.com>
Cc: "edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Subject: Re: What Bios data is sent to the Bootloader/OS ?
Date: Fri, 11 Aug 2017 15:21:40 -0700	[thread overview]
Message-ID: <42CE0497-A269-4D40-9E65-31A3CE27F197@apple.com> (raw)
In-Reply-To: <CACgnt79ffcmSW6LikySPjf-EgwndBOFAapjBiwq_fC3su0MKqQ@mail.gmail.com>


> On Aug 11, 2017, at 6:00 AM, Rafael Machado <rafaelrodrigues.machado@gmail.com> wrote:
> 
> Hi everyone
> 
> I have a question that probably some guys here can help.
> The scenario I have, is that I need to create a OS image that must be able
> to boot at a UEFI system (with no csm module), and at a legacy bios system.
> My fist thought is that this is not possible.
> 


Rafael,

We designed EFI to co-exist with legacy BIOS  so you could make media that boots both ways. I think it is useful to step back and think about how booting works. 
1) EFI loads a relocatable PE/COFF image that is a file (pointed to by an NVRAM variable, or in a known path for removable media) on a FAT32 file system (Usually the EFI System Partition). 
2) For a legacy hard disk boot the the BIOS loads the 1st 0x200 (512) bytes of the disk (MBR) into 0x7C00 and jumps to it in real mode. The MBR code usually plays a similar trick and loads 1st 0x200 bytes of the boot partition into memory and jump to it, this is usually the start of the file system on the disk partition. 

The 0x200 byte limit in MBR in combination with the 4 partition limit ended up with a lot of creative "grabbing of space" which worked great util different code broke each other. This grabbing "unused space" and the size limits is why we ended up adding GPT to the EFI spec as a next generation partitioning scheme. 

I think your problem is more about can you put a BIOS boot loader and a EFI Boot loader on the same disk and have them boot the same kernel. Seems like most of what the OS loader needs to do is a solved problem, it is just making everything coexist you have to figure out.

Thanks,

Andrew Fish



> The first thing I see that is different is the what the memory map is
> presented to the Bootloader/OS. At legacy bios the int15/0xE820 is used,
> and at a UEFI bios the GetMemoryMap() from the boot service is used. Is my
> understanding correct?
> 
> Besides that. Is there any other change that could not make it possible to
> create a single BootloaderLoader/OS image able to boot on a UEFI BIOS(with
> no CSM) and on a Legacy Bios ?
> 
> I would like to create a list or arguments to talk with my client that
> requested this, in case this is really not possible.
> 
> The OS in this case is Linux, and the bootloader is Grub or Syslinux.
> 
> Thanks and Regards
> Rafael R. Machado
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel



  reply	other threads:[~2017-08-11 22:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-11 13:00 What Bios data is sent to the Bootloader/OS ? Rafael Machado
2017-08-11 22:21 ` Andrew Fish [this message]
2017-08-12  3:22   ` Rod Smith
2017-08-13 13:07     ` Rafael Machado
2017-08-13 18:08       ` Andrew Fish
2017-08-14 17:43         ` Rafael Machado
2017-08-14 20:49 ` Igor Skochinsky
2017-08-16  9:56   ` Rafael Machado

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=42CE0497-A269-4D40-9E65-31A3CE27F197@apple.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox