From bdf8a2e1e7967ddad93f3d25292029172a40ec06 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sat, 19 May 2007 15:36:32 +0000 Subject: [PATCH] Added Haiku revision number to the kernel (same mechanism as used for libroot). It's available in the kernel through the private get_haiku_revision() and added to the kernel syslog output. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21173 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- build/jam/HaikuImage | 2 +- headers/private/kernel/system_info.h | 2 ++ src/system/kernel/Jamfile | 11 +++++++++++ src/system/kernel/main.c | 1 + src/system/kernel/system_info.c | 13 +++++++++++++ 5 files changed, 28 insertions(+), 1 deletion(-) diff --git a/build/jam/HaikuImage b/build/jam/HaikuImage index 0f8c4fb2eb..6584f7595d 100644 --- a/build/jam/HaikuImage +++ b/build/jam/HaikuImage @@ -158,7 +158,7 @@ AddDriversToHaikuImage net : $(BEOS_ADD_ONS_DRIVERS_NET) ; #AddDriversToHaikuImage power : $(BEOS_ADD_ONS_DRIVERS_ACPI) ; # kernel -AddFilesToHaikuImage beos system : kernel_$(TARGET_ARCH) ; +AddFilesToHaikuImage beos system : kernel_$(TARGET_ARCH) ; # libs AddFilesToHaikuImage beos system lib : $(BEOS_SYSTEM_LIB) ; diff --git a/headers/private/kernel/system_info.h b/headers/private/kernel/system_info.h index b0b3fd464f..98bc4fb070 100644 --- a/headers/private/kernel/system_info.h +++ b/headers/private/kernel/system_info.h @@ -16,6 +16,8 @@ extern "C" { #endif extern status_t system_info_init(struct kernel_args *args); +extern uint32 get_haiku_revision(void); + extern status_t _user_get_system_info(system_info *userInfo, size_t size); #ifdef __cplusplus diff --git a/src/system/kernel/Jamfile b/src/system/kernel/Jamfile index db1be8eae9..57c9819225 100644 --- a/src/system/kernel/Jamfile +++ b/src/system/kernel/Jamfile @@ -118,6 +118,17 @@ Depends kernel.so : kernel ; # kernel.so will be rebuilt with the kernel +# Copy kernel and update the copy's revision section. We link everything +# against the original, but the copy will end up on the disk image (this way +# we avoid unnecessary dependencies). The copy will be located in a subdirectory. +if $(TARGET_PLATFORM) = haiku { + MakeLocate kernel_$(TARGET_ARCH) + : [ FDirName $(TARGET_DEBUG_$(DEBUG)_LOCATE_TARGET) revisioned ] ; + CopySetHaikuRevision kernel_$(TARGET_ARCH) + : kernel_$(TARGET_ARCH) ; +} + + SubInclude HAIKU_TOP src system kernel arch ; SubInclude HAIKU_TOP src system kernel cache ; SubInclude HAIKU_TOP src system kernel device_manager ; diff --git a/src/system/kernel/main.c b/src/system/kernel/main.c index 4156294164..60626e258a 100644 --- a/src/system/kernel/main.c +++ b/src/system/kernel/main.c @@ -94,6 +94,7 @@ _start(kernel_args *bootKernelArgs, int currentCPU) debug_init(&sKernelArgs); set_dprintf_enabled(true); dprintf("Welcome to kernel debugger output!\n"); + dprintf("Haiku revision: %lu\n", get_haiku_revision()); // init modules TRACE("init CPU\n"); diff --git a/src/system/kernel/system_info.c b/src/system/kernel/system_info.c index da87b48723..6cf58f3e65 100644 --- a/src/system/kernel/system_info.c +++ b/src/system/kernel/system_info.c @@ -32,6 +32,12 @@ const static int64 kKernelVersion = 0x1; const static char *kKernelName = "kernel_" HAIKU_ARCH; +// Haiku SVN revision. Will be set when copying the kernel to the image. +// Lives in a separate section so that it can easily be found. +static uint32 sHaikuRevision __attribute__((section("_haiku_revision"))); +static uint32 sHaikuRevision = 0; + + static int dump_info(int argc, char **argv) { @@ -107,6 +113,13 @@ system_info_init(struct kernel_args *args) } +uint32 +get_haiku_revision(void) +{ + return sHaikuRevision; +} + + // #pragma mark -