[haiku-commits] Re: haiku: hrev50684 - in src/system/boot: platform/efi loader src platform/efi/arch/x86_64 .

  • From: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
  • To: "haiku-commits@xxxxxxxxxxxxx" <haiku-commits@xxxxxxxxxxxxx>
  • Date: Mon, 14 Nov 2016 23:20:35 +1300

On 14 November 2016 at 23:01,  <jessica.l.hamilton@xxxxxxxxx> wrote:

hrev50684 adds 22 changesets to branch 'master'
old head: b273e9733d25babe5e6702dc1e24f3dff1ffd6dc
new head: f4ff9cb02c1d292908407314ed023af25e0995da
overview: 
http://cgit.haiku-os.org/haiku/log/?qt=range&q=f4ff9cb02c1d+%5Eb273e9733d25

----------------------------------------------------------------------------

20e11028aa31: Don't use partition pointer as id, as it only works on 32bit 
platforms.

  Use a counter to generate the partition id, and store the id to partition
  lookup in a hashmap instead.

                         [ Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx> ]

211483cb512b: EFI: Initial test EFI application

  * Only set HAIKU_BOOT_PLATFORM to bios_ia32 if not defined
  * Add gnuefi build feature
  * Introduce BOOT_LDFLAGS, and move options for passing to linker
    into ArchitectureSetup
  * x86_64 compile fixes for warnings in boot loader
  * loader/elf.cpp: don't include ELF32 support when targeting EFI
  * relocation_func.cpp: copy of the relocation code from gnuefi
    to make _relocate extern "C", and avoid including <efilib.h>
  * boot_loader_efi.ld: copy of gnuefi's elf_x86_64_efi.lds,
    modified to include support for C++ constructors, etc. Keep in
    sync with the gnuefi package

  Signed-off-by: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>

                         [ Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx> ]

bd0604764ee1: Setup -fno-pic or -fpic in Architecture Rules.

  EFI boot needs -fpic but all boot code was built with -fno-pic.
  This is now set accordingly in HAIKU_BOOT_CCFLAGS and
  HAIKU_BOOT_C++FLAGS.

  Also setup compile flags for EFI platform.

                         [ Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx> ]

735f1daee956: EFI: Implement console code.

                         [ Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx> ]

495efc382b3c: loader: Drop the HashMap for partition lookup by id

  The HashMap constructor was called before the heap is initialized,
  ending up calling malloc from the OpenHashMap constructor.

  Oddly it was still working on x86 but broke other platforms.

  Instead we add a Lookup() static method to Partition,
  which by default walks gPartitions for the id,
  and recursively calls itself on the children lists.

  This means we must add a partition even temporarily to gPartitions
  before Scan()ing it though.

  Signed-off-by: François Revol <revol@xxxxxxx>

                                          [ François Revol <revol@xxxxxxx> ]

e2e1558a02e4: EFI: stub functions so we can call loader's main() function.

                         [ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

c0002a79e779: EFI: Implement heap

                         [ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

c0bdc8bef589: bootloader: build objects in $(TARGET_BOOT_PLATFORM)

  This separates the objects required for the various boot
  loaders, allowing the build system to be able to build
  for different targets alongside each other. Currently
  only done for bios_ia32 vs efi, as both loaders will be
  needed for the x86_64 images.

                         [ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

96f4d68b2b1c: EFI: check for boot keys

  * Only supports spacebar for the boot menu, and escape for
    enabling debug output. Shift keys will not work.

                         [ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

dbf1363b4146: EFI: naive platform_allocate_region() implementation

                         [ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

325b1e378771: EFI: add support for graphics mode output

  * We can now switch between graphics and text modes, and display
    the splash screen

                         [ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

2da1cb75a40b: EFI: device support for anyboot CDs.

  I have tried to get normal ISOs working, but the bootloader doesn't
  seem to detect any bootable partitions.

                         [ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

b3215a62758d: EFI: preliminary support for starting the kernel.

  Enough to let the kernel to print hello, but not much beyond that.

  Signed-off-by: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>

                           [ Henry Harrington <henry.harrington@xxxxxxxxx> ]

34a6dd672874: EFI: Initialize/load the GDT.

  Signed-off-by: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>

                           [ Henry Harrington <henry.harrington@xxxxxxxxx> ]

21e3ac6cf52f: vm: Try harder to allocate early physical pages.

  Signed-off-by: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>

                           [ Henry Harrington <henry.harrington@xxxxxxxxx> ]

82dcc31606c9: bootloader: Translate kernel args before adding them to 
kernel_args_range.

  Chunks may be physically contiguous, but virtually disjoint. Adding
  physical addresses may cause ranges to be merged incorrectly.

  Signed-off-by: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>

                           [ Henry Harrington <henry.harrington@xxxxxxxxx> ]

6e6efaecdc51: EFI: add ACPI support

  Also add support in the kernel to get the ACPI RSDP from the
  bootloader, and pass onto the ACPI driver using get_boot_item.

                         [ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

a1d0102ee4a8: EFI: add support for HPET

                         [ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

a7142a503761: EFI: add cpu.cpp from bios_ia32

                         [ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

ec239abcf592: EFI: implement mmu_map_physical_memory & mmu_free.

  Also move cpu, acpi, hpet init into platform_start_kernel, as we
  need an initialised heap for alllocating memory for recording
  the mapped regions.

                         [ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

a99a0c003d14: EFI: add support for SMP.

  Signed-off-by: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>

                               [ Nick Smallbone <nick.smallbone@xxxxxxxxx> ]

f4ff9cb02c1d: Merge branch 'uefi-support'

                         [ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

----------------------------------------------------------------------------

Uh, that was a fraction premature; renamed branches, wrong upstream...
_< so I didn't get to update the merge commit message.

Anyway, you can build and test this as follows:

1. Grab a copy of x64 OVMF firmware from
https://sourceforge.net/projects/edk2/files/OVMF/
2. Build the x86_64 cross-tools as normal
3. Build loader & anyboot image, and test!
    generated> HAIKU_BOOT_PLATFORM=efi jam -q haiku_loader.efi
    generated> jam -q @nightly-anyboot image
    generated> qemu-system-x86_64 -m 256 -hda
fat:objects/haiku/x86_64/release/system/boot/efi -cdrom
haiku-nightly-anyboot.image -bios OVMF.fd -net none -no-reboot -serial
stdio

In the EFI shell: fs0:\haiku_loader.efi

Whilst it can boot the kernel, it has severe page faults in usermode
apps, from launch_daemon to everything else that spawns.

There's still a whole bunch of other support code to do (e.g. support
booting from more than just anyboot images, the serial I/O support),
but this should be enough to enable testing and debugging.

Other related posts: