riscv64: Generate a bootable EFI MMC image

* mmc might be not ideal. But raw is just a single partition and
  anyboot is heavily x86. MMC will technically work for now to get
  bootable images.
* floppyboot isn't used on EFI platforms, since we call two different
  actions, just drop floppyboot altogether on EFI SD Images.

Change-Id: Idabb5483304007dd601bf8a1158036ffd24f73aa
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3165
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
This commit is contained in:
Alexander von Gluck IV 2020-08-21 18:07:33 -05:00 committed by Alex von Gluck IV
parent e178540314
commit b3cd2bdfa7
8 changed files with 134 additions and 22 deletions

View File

@ -38,6 +38,7 @@ rule BuildSDImage image : files
} }
} }
# Usage: image : loader floppyboot everything_else
actions BuildUBootSDImage1 actions BuildUBootSDImage1
{ {
$(RM) $(1) $(RM) $(1)
@ -81,7 +82,7 @@ actions BuildUBootSDImage1
cat $(2[0]) >> $(1) cat $(2[0]) >> $(1)
} }
# Usage: image : loader everything_else
actions BuildEfiSDImage1 actions BuildEfiSDImage1
{ {
$(RM) $(1) $(RM) $(1)
@ -110,9 +111,7 @@ actions BuildEfiSDImage1
MTOOLSRC=$(1).mtools mmd i:/EFI MTOOLSRC=$(1).mtools mmd i:/EFI
MTOOLSRC=$(1).mtools mmd i:/EFI/BOOT MTOOLSRC=$(1).mtools mmd i:/EFI/BOOT
MTOOLSRC=$(1).mtools mcopy $(2[2-2]) i:/EFI/BOOT/$(EFINAME) MTOOLSRC=$(1).mtools mcopy $(2[2-2]) i:/EFI/BOOT/$(EFINAME)
# Not really needed on EFI since we use EFI runtime services. MTOOLSRC=$(1).mtools mcopy $(2[3-]) i:
#MTOOLSRC=$(1).mtools mcopy $(2[3-3]) i:/haiku_floppyboot.ub
MTOOLSRC=$(1).mtools mcopy $(2[4-]) i:
MTOOLSRC=$(1).mtools mcopy uEnv.txt i: MTOOLSRC=$(1).mtools mcopy uEnv.txt i:
# populate fdts # populate fdts
MTOOLSRC=$(1).mtools mmd i:/fdt MTOOLSRC=$(1).mtools mmd i:/fdt
@ -133,8 +132,15 @@ for platform in [ MultiBootSubDirSetup ] {
on $(platform) { on $(platform) {
# SD/mmc image targets # SD/mmc image targets
if $(TARGET_BOOT_PLATFORM) = efi { if $(TARGET_BOOT_PLATFORM) = efi {
BuildSDImage $(HAIKU_MMC_NAME) : if $(TARGET_ARCH) = arm || $(TARGET_ARCH) = arm64 {
$(HAIKU_IMAGE) haiku_loader.$(TARGET_BOOT_PLATFORM) haiku-floppyboot.tgz.$(TARGET_BOOT_PLATFORM) boot.scr ; # These EFI platforms need u-boot to get them going
BuildSDImage $(HAIKU_MMC_NAME) : $(HAIKU_IMAGE)
haiku_loader.$(TARGET_BOOT_PLATFORM)
boot.scr ;
} else {
BuildSDImage $(HAIKU_MMC_NAME) : $(HAIKU_IMAGE)
haiku_loader.$(TARGET_BOOT_PLATFORM) ;
}
} else { } else {
BuildSDImage $(HAIKU_MMC_NAME) : BuildSDImage $(HAIKU_MMC_NAME) :
$(HAIKU_IMAGE) haiku_loader.$(TARGET_BOOT_PLATFORM) haiku-floppyboot.tgz.$(TARGET_BOOT_PLATFORM) boot.scr ; $(HAIKU_IMAGE) haiku_loader.$(TARGET_BOOT_PLATFORM) haiku-floppyboot.tgz.$(TARGET_BOOT_PLATFORM) boot.scr ;

View File

@ -1,7 +1,7 @@
SubDir HAIKU_TOP src add-ons kernel bus_managers pci arch $(TARGET_ARCH) ; SubDir HAIKU_TOP src add-ons kernel bus_managers pci arch $(TARGET_ARCH) ;
SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) ] ; SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) ] ;
UsePrivateHeaders kernel [ FDirName kernel arch $(TARGET_ARCH) ] UsePrivateHeaders kernel [ FDirName kernel arch $(TARGET_ARCH) ]
[ FDirName kernel boot platform $(HAIKU_BOOT_PLATFORM) ] ; [ FDirName kernel boot platform $(HAIKU_BOOT_PLATFORM) ] ;
KernelStaticLibrary pci_arch_bus_manager : KernelStaticLibrary pci_arch_bus_manager :

View File

@ -1,11 +1,11 @@
/* /*
* Copyright 2009, Haiku Inc. * Copyright 2009, Haiku Inc. All rights reserved.
* All rights reserved. Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef PCI_BUS_MANAGER_ARM_IO_H #ifndef PCI_BUS_MANAGER_ARM_IO_H
#define PCI_BUS_MANAGER_ARM_IO_H #define PCI_BUS_MANAGER_ARM_IO_H
#include <SupportDefs.h> #include <SupportDefs.h>
#endif // PCI_BUS_MANAGER_ARM_IO_H #endif // PCI_BUS_MANAGER_ARM_IO_H

View File

@ -0,0 +1,10 @@
SubDir HAIKU_TOP src add-ons kernel bus_managers pci arch $(TARGET_ARCH) ;
SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) ] ;
UsePrivateHeaders kernel [ FDirName kernel arch $(TARGET_ARCH) ]
[ FDirName kernel boot platform $(HAIKU_BOOT_PLATFORM) ] ;
KernelStaticLibrary pci_arch_bus_manager :
pci_controller.cpp
pci_io.c
;

View File

@ -0,0 +1,27 @@
/*
* Copyright 2009-2020, Haiku Inc., All rights reserved.
* Distributed under the terms of the MIT License.
*/
#include "pci_controller.h"
//#include <arch_platform.h>
#include "pci_private.h"
status_t
pci_controller_init(void)
{
/* no support yet */
#warning RISCV64: WRITEME
return B_OK;
}
phys_addr_t
pci_ram_address(phys_addr_t physical_address_in_system_memory)
{
return physical_address_in_system_memory;
}

View File

@ -0,0 +1,61 @@
/*
* Copyright 2009-2020, Haiku Inc., All rights reserved.
* Distributed under the terms of the MIT License.
*/
#include "pci_io.h"
#include "pci_private.h"
#warning RISCV64: WRITEME
status_t
pci_io_init()
{
return B_OK;
}
uint8
pci_read_io_8(int mapped_io_addr)
{
/* NOT IMPLEMENTED */
return 0;
}
void
pci_write_io_8(int mapped_io_addr, uint8 value)
{
/* NOT IMPLEMENTED */
}
uint16
pci_read_io_16(int mapped_io_addr)
{
/* NOT IMPLEMENTED */
return 0;
}
void
pci_write_io_16(int mapped_io_addr, uint16 value)
{
/* NOT IMPLEMENTED */
}
uint32
pci_read_io_32(int mapped_io_addr)
{
/* NOT IMPLEMENTED */
return 0;
}
void
pci_write_io_32(int mapped_io_addr, uint32 value)
{
/* NOT IMPLEMENTED */
}

View File

@ -0,0 +1,11 @@
/*
* Copyright 2009-2020, Haiku Inc., All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef PCI_BUS_MANAGER_RISCV64_IO_H
#define PCI_BUS_MANAGER_RISCV64_IO_H
#include <SupportDefs.h>
#endif // PCI_BUS_MANAGER_RISCV64_IO_H

View File

@ -337,10 +337,7 @@ for platform in [ MultiBootSubDirSetup ] {
case efi : case efi :
BuildEFILoader haiku_loader.$(TARGET_BOOT_PLATFORM) : boot_loader_$(TARGET_BOOT_PLATFORM) ; BuildEFILoader haiku_loader.$(TARGET_BOOT_PLATFORM) : boot_loader_$(TARGET_BOOT_PLATFORM) ;
if $(TARGET_ARCH) = arm || $(TARGET_ARCH) = arm64 { if $(TARGET_ARCH) = arm || $(TARGET_ARCH) = arm64 {
# These platforms sometimes need u-boot to get them going # These EFI platforms need u-boot to get them going
BuildUImage haiku-floppyboot.tgz.$(TARGET_BOOT_PLATFORM) : haiku-floppyboot.tgz :
-A $(TARGET_ARCH) -O linux -T ramdisk -C none
-n 'Haiku $(TARGET_KERNEL_ARCH) floppyboot' ;
BuildUImageScript boot.scr BuildUImageScript boot.scr
: [ FDirName $(HAIKU_TOP) data boot u-boot boot-$(TARGET_ARCH).scr.txt ] ; : [ FDirName $(HAIKU_TOP) data boot u-boot boot-$(TARGET_ARCH).scr.txt ] ;
} }