diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2023-05-19 17:18:41 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2023-05-23 21:34:56 +0200 |
commit | badea0d6df2a2d3e5ac6c6d068f39ea80c2724d1 (patch) | |
tree | 0a66ff3a1dc75d0ea2d95d65ef5af31818473853 /src/boot | |
parent | mkfs-util: Silence noisy warning from mkfs.btrfs (diff) | |
download | systemd-badea0d6df2a2d3e5ac6c6d068f39ea80c2724d1.tar.xz systemd-badea0d6df2a2d3e5ac6c6d068f39ea80c2724d1.zip |
sd-boot,sd-stub: also print version after the address
The kernel, systemd, and many other things print their version during boot.
sd-boot and sd-stub are also important, so let's print the version if EFI_DEBUG.
(If !EFI_DEBUG, continue to be quiet.)
When updating the docs, I saw that that the text in HACKING.md was out of date.
Instead of trying to update the instructions there, make it shorter and refer
the reader to tools/debug-sd-boot.sh for details.
Diffstat (limited to 'src/boot')
-rw-r--r-- | src/boot/efi/util.c | 14 | ||||
-rw-r--r-- | src/boot/efi/util.h | 12 |
2 files changed, 14 insertions, 12 deletions
diff --git a/src/boot/efi/util.c b/src/boot/efi/util.c index b339021fe9..c5f1742466 100644 --- a/src/boot/efi/util.c +++ b/src/boot/efi/util.c @@ -4,6 +4,7 @@ #include "proto/simple-text-io.h" #include "ticks.h" #include "util.h" +#include "version.h" EFI_STATUS parse_boolean(const char *v, bool *b) { assert(b); @@ -543,10 +544,9 @@ uint64_t get_os_indications_supported(void) { return osind; } -#ifdef EFI_DEBUG -extern uint8_t __ImageBase; __attribute__((noinline)) void notify_debugger(const char *identity, volatile bool wait) { - printf("%s@%p\n", identity, &__ImageBase); +#ifdef EFI_DEBUG + printf("%s@%p %s\n", identity, &__ImageBase, GIT_VERSION); if (wait) printf("Waiting for debugger to attach...\n"); @@ -554,15 +554,15 @@ __attribute__((noinline)) void notify_debugger(const char *identity, volatile bo * has attached to us. Just "set variable wait = 0" or "return" to continue. */ while (wait) /* Prefer asm based stalling so that gdb has a source location to present. */ -#if defined(__i386__) || defined(__x86_64__) +# if defined(__i386__) || defined(__x86_64__) asm volatile("pause"); -#elif defined(__aarch64__) +# elif defined(__aarch64__) asm volatile("wfi"); -#else +# else BS->Stall(5000); +# endif #endif } -#endif #ifdef EFI_DEBUG void hexdump(const char16_t *prefix, const void *data, size_t size) { diff --git a/src/boot/efi/util.h b/src/boot/efi/util.h index bb917faf55..929f3bca8c 100644 --- a/src/boot/efi/util.h +++ b/src/boot/efi/util.h @@ -6,6 +6,9 @@ #include "proto/file-io.h" #include "string-util-fundamental.h" +/* This is provided by linker script. */ +extern uint8_t __ImageBase; + static inline void free(void *p) { if (!p) return; @@ -160,13 +163,12 @@ static inline void *PHYSICAL_ADDRESS_TO_POINTER(EFI_PHYSICAL_ADDRESS addr) { uint64_t get_os_indications_supported(void); -#ifdef EFI_DEBUG -/* Report the relocated position of text and data sections so that a debugger - * can attach to us. See debug-sd-boot.sh for how this can be done. */ +/* If EFI_DEBUG, print our name and version and also report the address of the image base so a debugger can + * be attached. See debug-sd-boot.sh for how this can be done. */ void notify_debugger(const char *identity, bool wait); + +#ifdef EFI_DEBUG void hexdump(const char16_t *prefix, const void *data, size_t size); -#else -# define notify_debugger(i, w) #endif /* On x86 the compiler assumes a different incoming stack alignment than what we get. |