boot: embed Haiku revision in loader binary
Change-Id: I9f71fba6c2c4fdaa63e118825c5fd00d51b556fb Reviewed-on: https://review.haiku-os.org/c/haiku/+/5693 Reviewed-by: waddlesplash <waddlesplash@gmail.com> Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
This commit is contained in:
parent
eb198a09e9
commit
2ca24be640
@ -131,11 +131,13 @@ actions BuildEFILoader
|
||||
# no bfd support, fake efi Pe header
|
||||
$(TARGET_OBJCOPY_$(TARGET_KERNEL_ARCH)) -j .text -j .sdata -j .data \
|
||||
-j .dynamic -j .dynsym -j .rel* -j .rela* -j .reloc -j .dynstr \
|
||||
-j _haiku_revision \
|
||||
--output-target=$(OUTPUT_TARGET) $(2) $(1)
|
||||
else
|
||||
# bfd supports pe + efi for arch
|
||||
$(TARGET_OBJCOPY_$(TARGET_KERNEL_ARCH)) -j .text -j .sdata -j .data \
|
||||
-j .dynamic -j .dynsym -j .rel* -j .rela* -j .reloc -j .dynstr \
|
||||
-j _haiku_revision \
|
||||
--output-target=$(OUTPUT_TARGET) \
|
||||
--subsystem=efi-app $(2) $(1)
|
||||
fi
|
||||
@ -385,11 +387,14 @@ for platform in [ MultiBootSubDirSetup ] {
|
||||
: $(ldflags)
|
||||
;
|
||||
|
||||
MakeLocate <revisioned>boot_loader_$(TARGET_BOOT_PLATFORM) : [ FDirName $(TARGET_DEBUG_$(DEBUG)_LOCATE_TARGET) revisioned ] ;
|
||||
CopySetHaikuRevision <revisioned>boot_loader_$(TARGET_BOOT_PLATFORM) : boot_loader_$(TARGET_BOOT_PLATFORM) ;
|
||||
|
||||
switch $(TARGET_BOOT_PLATFORM) {
|
||||
case efi :
|
||||
if $(HAIKU_BOOT_$(platform:G=:U)_PRIVATE_KEYFILE) {
|
||||
BuildEFILoader haiku_loader.$(TARGET_BOOT_PLATFORM).unsigned
|
||||
: boot_loader_$(TARGET_BOOT_PLATFORM) ;
|
||||
: <revisioned>boot_loader_$(TARGET_BOOT_PLATFORM) ;
|
||||
SignEFILoader haiku_loader.$(TARGET_BOOT_PLATFORM)
|
||||
: haiku_loader.$(TARGET_BOOT_PLATFORM).unsigned
|
||||
: [ FDirName $(HAIKU_TOP) data boot efi keys DB.crt ]
|
||||
@ -398,7 +403,7 @@ for platform in [ MultiBootSubDirSetup ] {
|
||||
: [ FDirName $(HAIKU_TOP) data boot efi keys DB.crt ] ;
|
||||
} else {
|
||||
BuildEFILoader haiku_loader.$(TARGET_BOOT_PLATFORM)
|
||||
: boot_loader_$(TARGET_BOOT_PLATFORM) ;
|
||||
: <revisioned>boot_loader_$(TARGET_BOOT_PLATFORM) ;
|
||||
}
|
||||
|
||||
if $(TARGET_ARCH) = arm || $(TARGET_ARCH) = riscv64 {
|
||||
@ -408,17 +413,17 @@ for platform in [ MultiBootSubDirSetup ] {
|
||||
}
|
||||
|
||||
case bios_ia32 :
|
||||
BuildBiosLoader haiku_loader.$(TARGET_BOOT_PLATFORM) : boot_loader_$(TARGET_BOOT_PLATFORM) ;
|
||||
BuildBiosLoader haiku_loader.$(TARGET_BOOT_PLATFORM) : <revisioned>boot_loader_$(TARGET_BOOT_PLATFORM) ;
|
||||
|
||||
case pxe_ia32 :
|
||||
BuildBiosLoader haiku_loader.$(TARGET_BOOT_PLATFORM) : boot_loader_$(TARGET_BOOT_PLATFORM) ;
|
||||
BuildBiosLoader haiku_loader.$(TARGET_BOOT_PLATFORM) : <revisioned>boot_loader_$(TARGET_BOOT_PLATFORM) ;
|
||||
|
||||
case openfirmware :
|
||||
BuildOpenFirmwareLoader haiku_loader.$(TARGET_BOOT_PLATFORM) : boot_loader_$(TARGET_BOOT_PLATFORM) ;
|
||||
BuildOpenFirmwareLoader haiku_loader.$(TARGET_BOOT_PLATFORM) : <revisioned>boot_loader_$(TARGET_BOOT_PLATFORM) ;
|
||||
|
||||
case u-boot :
|
||||
local loader_entry = `printf \"obase=16;ibase=16;10 + %x\\n\" $(HAIKU_BOOT_LOADER_BASE)|bc` ;
|
||||
BuildUImage haiku_loader.$(TARGET_BOOT_PLATFORM) : boot_loader_$(TARGET_BOOT_PLATFORM)
|
||||
BuildUImage haiku_loader.$(TARGET_BOOT_PLATFORM) : <revisioned>boot_loader_$(TARGET_BOOT_PLATFORM)
|
||||
:
|
||||
-A $(TARGET_ARCH) -O linux -T kernel -C none
|
||||
-a $(HAIKU_BOOT_LOADER_BASE) -e $(loader_entry)
|
||||
@ -430,24 +435,24 @@ for platform in [ MultiBootSubDirSetup ] {
|
||||
: [ FDirName $(HAIKU_TOP) data boot u-boot boot-$(TARGET_ARCH).scr.txt ] ;
|
||||
|
||||
case amiga_m68k :
|
||||
BuildBiosLoader haiku_loader.$(TARGET_BOOT_PLATFORM) : boot_loader_$(TARGET_BOOT_PLATFORM) ;
|
||||
BuildBiosLoader haiku_loader.$(TARGET_BOOT_PLATFORM) : <revisioned>boot_loader_$(TARGET_BOOT_PLATFORM) ;
|
||||
ChecksumAmigaLoader haiku_loader.$(TARGET_BOOT_PLATFORM) ;
|
||||
|
||||
case atari_m68k :
|
||||
BuildBiosLoader haiku_loader.$(TARGET_BOOT_PLATFORM) : boot_loader_$(TARGET_BOOT_PLATFORM) ;
|
||||
BuildBiosLoader haiku_loader.$(TARGET_BOOT_PLATFORM) : <revisioned>boot_loader_$(TARGET_BOOT_PLATFORM) ;
|
||||
ChecksumAtariLoader haiku_loader.$(TARGET_BOOT_PLATFORM) ;
|
||||
|
||||
AtariBootPrgLd haiku.prg :
|
||||
boot_loader_$(TARGET_BOOT_PLATFORM)
|
||||
<revisioned>boot_loader_$(TARGET_BOOT_PLATFORM)
|
||||
: $(HAIKU_TOP)/src/system/ldscripts/$(TARGET_ARCH)/boot_prg_$(TARGET_BOOT_PLATFORM).ld
|
||||
: -Bstatic
|
||||
;
|
||||
|
||||
case riscv :
|
||||
BuildBiosLoader haiku_loader.$(TARGET_BOOT_PLATFORM) : boot_loader_$(TARGET_BOOT_PLATFORM) ;
|
||||
BuildBiosLoader haiku_loader.$(TARGET_BOOT_PLATFORM) : <revisioned>boot_loader_$(TARGET_BOOT_PLATFORM) ;
|
||||
|
||||
case next_m68k :
|
||||
BuildAoutLoader haiku_loader.$(TARGET_BOOT_PLATFORM) : boot_loader_$(TARGET_BOOT_PLATFORM) ;
|
||||
BuildAoutLoader haiku_loader.$(TARGET_BOOT_PLATFORM) : <revisioned>boot_loader_$(TARGET_BOOT_PLATFORM) ;
|
||||
|
||||
case * :
|
||||
Exit "Currently unsupported haiku_loader:" $(TARGET_BOOT_PLATFORM) ;
|
||||
|
@ -117,6 +117,7 @@ for platform in [ MultiBootSubDirSetup ] {
|
||||
partitions.cpp
|
||||
RootFileSystem.cpp
|
||||
stdio.cpp
|
||||
system_revision.c
|
||||
vfs.cpp
|
||||
vm.cpp
|
||||
|
||||
@ -164,7 +165,7 @@ for platform in [ MultiBootSubDirSetup ] {
|
||||
SEARCH on [ FGristFiles safemode_settings.cpp ]
|
||||
= [ FDirName $(HAIKU_TOP) src system kernel debug ] ;
|
||||
|
||||
SEARCH on [ FGristFiles driver_settings.cpp ]
|
||||
SEARCH on [ FGristFiles driver_settings.cpp system_revision.c ]
|
||||
= [ FDirName $(HAIKU_TOP) src system libroot os ] ;
|
||||
|
||||
SEARCH on [ FGristFiles amiga_rdb.cpp ]
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include <boot/PathBlocklist.h>
|
||||
#include <boot/stdio.h>
|
||||
#include <boot/net/NetStack.h>
|
||||
#include <system_revision.h>
|
||||
|
||||
#include "file_systems/packagefs/packagefs.h"
|
||||
|
||||
@ -58,6 +59,7 @@ main(stage2_args *args)
|
||||
panic("Could not initialize VFS!\n");
|
||||
|
||||
dprintf("Welcome to the Haiku boot loader!\n");
|
||||
dprintf("Haiku revision: %s\n", get_haiku_revision());
|
||||
|
||||
bool mountedAllVolumes = false;
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include <boot/platform/generic/text_menu.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <system_revision.h>
|
||||
|
||||
|
||||
// position
|
||||
@ -70,6 +71,19 @@ print_centered(int32 line, const char *text, bool resetPosition = true)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
print_right(int32 line, const char *text, bool resetPosition = true)
|
||||
{
|
||||
console_set_cursor(console_width() - (strlen(text) + 1), line);
|
||||
printf("%s", text);
|
||||
|
||||
if (resetPosition) {
|
||||
console_set_cursor(0, 0);
|
||||
// this avoids unwanted line feeds
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
print_item_at(int32 line, MenuItem *item, bool clearHelp = true)
|
||||
{
|
||||
@ -213,7 +227,10 @@ draw_menu(Menu *menu)
|
||||
print_centered(2, "Haiku Boot Loader");
|
||||
|
||||
console_set_color(kCopyrightColor, kBackgroundColor);
|
||||
print_centered(4, "Copyright 2004-2020 Haiku, Inc.");
|
||||
print_right(console_height() - 1, get_haiku_revision());
|
||||
|
||||
console_set_color(kCopyrightColor, kBackgroundColor);
|
||||
print_centered(4, "Copyright 2004-2022 Haiku, Inc.");
|
||||
|
||||
if (menu->Title()) {
|
||||
console_set_cursor(kOffsetX, kFirstLine - 2);
|
||||
|
@ -14,7 +14,7 @@ static char sHaikuRevision[SYSTEM_REVISION_LENGTH]
|
||||
|
||||
|
||||
const char*
|
||||
#ifdef _KERNEL_MODE
|
||||
#if defined(_KERNEL_MODE) || defined(_BOOT_MODE)
|
||||
get_haiku_revision(void)
|
||||
#else
|
||||
__get_haiku_revision(void)
|
||||
|
Loading…
x
Reference in New Issue
Block a user