From f7f685f8c90573b9a110aae5f33c8c4dabf0b9b1 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Fri, 16 Jan 2026 16:52:40 +0000 Subject: [PATCH] [build] Canonicalise console type configuration Move all console configuration from config/defaults/.h to the top-level config/console.h, using indented conditional blocks to clarify which console types are supported and enabled on each platform. Signed-off-by: Michael Brown --- src/config/console.h | 90 +++++++++++++++++++++++------------- src/config/defaults/efi.h | 1 - src/config/defaults/linux.h | 1 - src/config/defaults/pcbios.h | 1 - src/config/defaults/sbi.h | 2 - 5 files changed, 57 insertions(+), 38 deletions(-) diff --git a/src/config/console.h b/src/config/console.h index 028021fa2..40a325896 100644 --- a/src/config/console.h +++ b/src/config/console.h @@ -15,53 +15,77 @@ FILE_SECBOOT ( PERMITTED ); #include -/* - * Default console types +/***************************************************************************** * - * These are all enabled by default for the appropriate platforms. - * You may disable them if needed. + * Console types * */ -//#undef CONSOLE_PCBIOS /* Default BIOS console */ -//#undef CONSOLE_EFI /* Default EFI console */ -//#undef CONSOLE_LINUX /* Default Linux console */ +/* Console types supported on all platforms */ +//#define CONSOLE_FRAMEBUFFER /* Graphical framebuffer console */ +//#define CONSOLE_SYSLOG /* Syslog console */ +//#define CONSOLE_SYSLOGS /* Encrypted syslog console */ -/* - * Additional console types +/* Console types supported only on systems with serial ports */ +#if ! defined ( SERIAL_NULL ) + //#define CONSOLE_SERIAL /* Serial port console */ +#endif + +/* Console types supported only on BIOS platforms */ +#if defined ( PLATFORM_pcbios ) + //#define CONSOLE_INT13 /* INT13 disk log console */ + #define CONSOLE_PCBIOS /* Default BIOS console */ +#endif + +/* Console types supported only on EFI platforms */ +#if defined ( PLATFORM_efi ) + #define CONSOLE_EFI /* Default EFI console */ +#endif + +/* Console types supported only on RISC-V SBI platforms */ +#if defined ( PLATFORM_sbi ) + #define CONSOLE_SBI /* RISC-V SBI debug console */ +#endif + +/* Console types supported only on Linux platforms */ +#if defined ( PLATFORM_linux ) + #define CONSOLE_LINUX /* Default Linux console */ +#endif + +/* Console types supported only on x86 CPUs */ +#if defined ( __i386__ ) || defined ( __x86_64__ ) + //#define CONSOLE_DEBUGCON /* Bochs/QEMU/KVM debug port console */ + //#define CONSOLE_DIRECT_VGA /* Direct access to VGA card */ + //#define CONSOLE_PC_KBD /* Direct access to PC keyboard */ + //#define CONSOLE_VMWARE /* VMware logfile console */ +#endif + +/* Enable serial console on platforms that are typically headless */ +#if defined ( CONSOLE_SBI ) + #define CONSOLE_SERIAL +#endif + +/***************************************************************************** * - * These are not enabled by default, but may be useful in your - * environment. + * Keyboard maps + * + * See hci/keymap/keymap_*.c for available keyboard maps. * */ -//#define CONSOLE_SERIAL /* Serial port console */ -//#define CONSOLE_FRAMEBUFFER /* Graphical framebuffer console */ -//#define CONSOLE_SYSLOG /* Syslog console */ -//#define CONSOLE_SYSLOGS /* Encrypted syslog console */ -//#define CONSOLE_VMWARE /* VMware logfile console */ -//#define CONSOLE_DEBUGCON /* Bochs/QEMU/KVM debug port console */ -//#define CONSOLE_INT13 /* INT13 disk log console */ -//#define CONSOLE_SBI /* RISC-V SBI debug console */ +#define KEYBOARD_MAP us /* Default US keyboard map */ +//#define KEYBOARD_MAP dynamic /* Runtime selectable keyboard map */ -/* - * Very obscure console types +/***************************************************************************** * - * You almost certainly do not need to enable these. + * Log levels + * + * Control which syslog() messages are generated. Note that this is + * not related in any way to CONSOLE_SYSLOG. * */ -//#define CONSOLE_DIRECT_VGA /* Direct access to VGA card */ -//#define CONSOLE_PC_KBD /* Direct access to PC keyboard */ - -/* Keyboard map (available maps in hci/keymap/) */ -#define KEYBOARD_MAP us - -/* Control which syslog() messages are generated. - * - * Note that this is not related in any way to CONSOLE_SYSLOG. - */ -#define LOG_LEVEL LOG_NONE +#define LOG_LEVEL LOG_NONE #include #include NAMED_CONFIG(console.h) diff --git a/src/config/defaults/efi.h b/src/config/defaults/efi.h index e16c51c27..baacae4f9 100644 --- a/src/config/defaults/efi.h +++ b/src/config/defaults/efi.h @@ -14,7 +14,6 @@ FILE_SECBOOT ( PERMITTED ); #define IOMAP_VIRT #define PCIAPI_EFI #define DMAAPI_OP -#define CONSOLE_EFI #define TIMER_EFI #define UMALLOC_EFI #define MEMMAP_NULL diff --git a/src/config/defaults/linux.h b/src/config/defaults/linux.h index b63279381..9d8b217d3 100644 --- a/src/config/defaults/linux.h +++ b/src/config/defaults/linux.h @@ -9,7 +9,6 @@ FILE_LICENCE ( GPL2_OR_LATER ); -#define CONSOLE_LINUX #define TIMER_LINUX #define UACCESS_LINUX #define UMALLOC_LINUX diff --git a/src/config/defaults/pcbios.h b/src/config/defaults/pcbios.h index 6fb2ab0e9..c4d3f7527 100644 --- a/src/config/defaults/pcbios.h +++ b/src/config/defaults/pcbios.h @@ -14,7 +14,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); #define PCIAPI_PCBIOS #define DMAAPI_FLAT #define TIMER_PCBIOS -#define CONSOLE_PCBIOS #define NAP_PCBIOS #define UMALLOC_UHEAP #define MEMMAP_INT15 diff --git a/src/config/defaults/sbi.h b/src/config/defaults/sbi.h index fa995ddba..f9361c926 100644 --- a/src/config/defaults/sbi.h +++ b/src/config/defaults/sbi.h @@ -23,8 +23,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); #endif #define FDT_SBI -#define CONSOLE_SBI -#define CONSOLE_SERIAL #define REBOOT_SBI #define UMALLOC_UHEAP #define MEMMAP_FDT