@@ -241,3 +241,15 @@ source "arch/arm/platforms/Kconfig"
source "common/Kconfig"
source "drivers/Kconfig"
+
+if DEBUG || EXPERT
+
+config EARLY_PRINTK
+ string "Enable early hard-coded console for printk"
+ help
+ Setup a serial device early during boot for logging message. Used
+ for very early bring-up.
+
+ See docs/misc/arm/early-printk.txt
+
+endif
@@ -16,7 +16,7 @@ obj-y += device.o
obj-y += domain.o
obj-y += domain_build.init.o
obj-y += domctl.o
-obj-$(EARLY_PRINTK) += early_printk.o
+obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
obj-y += gic.o
obj-y += gic-v2.o
obj-$(CONFIG_GICV3) += gic-v3.o
@@ -22,12 +22,15 @@ ifneq ($(call cc-option,$(CC),-fvisibility=hidden,n),n)
CFLAGS += -DGCC_HAS_VISIBILITY_ATTRIBUTE
endif
-EARLY_PRINTK := n
-
-ifeq ($(CONFIG_DEBUG),y)
+ifneq ($(CONFIG_EARLY_PRINTK),)
# See docs/misc/arm/early-printk.txt for syntax
+ifneq ($(CONFIG_DEBUG),y)
+# Early printk is dependant on a debug build.
+$(error CONFIG_EARLY_PRINTK enabled for non-debug build)
+endif
+
EARLY_PRINTK_brcm := 8250,0xF040AB00,2
EARLY_PRINTK_dra7 := 8250,0x4806A000,2
EARLY_PRINTK_fastmodel := pl011,0x1c090000,115200
@@ -54,6 +57,10 @@ else
EARLY_PRINTK_CFG := $(subst $(comma), ,$(CONFIG_EARLY_PRINTK))
endif
+ifeq ($(EARLY_PRINTK_CFG),)
+$(error Unknown CONFIG_EARLY_PRINTK setting)
+endif
+
# Extract configuration from string
EARLY_PRINTK_INC := $(word 1,$(EARLY_PRINTK_CFG))
EARLY_UART_BASE_ADDRESS := $(word 2,$(EARLY_PRINTK_CFG))
@@ -76,22 +83,11 @@ CFLAGS-y += -DEARLY_PRINTK_VERSION_NONE
endif
endif
-ifneq ($(EARLY_PRINTK_INC),)
-EARLY_PRINTK := y
-endif
-
-CFLAGS-$(EARLY_PRINTK) += -DCONFIG_EARLY_PRINTK
+CFLAGS-y += -DCONFIG_EARLY_PRINTK
CFLAGS-$(EARLY_PRINTK_INIT_UART) += -DEARLY_PRINTK_INIT_UART
-CFLAGS-$(EARLY_PRINTK) += -DEARLY_PRINTK_INC=\"debug-$(EARLY_PRINTK_INC).inc\"
-CFLAGS-$(EARLY_PRINTK) += -DEARLY_PRINTK_BAUD=$(EARLY_PRINTK_BAUD)
-CFLAGS-$(EARLY_PRINTK) += -DEARLY_UART_BASE_ADDRESS=$(EARLY_UART_BASE_ADDRESS)
-CFLAGS-$(EARLY_PRINTK) += -DEARLY_UART_REG_SHIFT=$(EARLY_UART_REG_SHIFT)
-
-else # !CONFIG_DEBUG
-
-ifneq ($(CONFIG_EARLY_PRINTK),)
-# Early printk is dependant on a debug build.
-$(error CONFIG_EARLY_PRINTK enabled for non-debug build)
-endif
+CFLAGS-y += -DEARLY_PRINTK_INC=\"debug-$(EARLY_PRINTK_INC).inc\"
+CFLAGS-y += -DEARLY_PRINTK_BAUD=$(EARLY_PRINTK_BAUD)
+CFLAGS-y += -DEARLY_UART_BASE_ADDRESS=$(EARLY_UART_BASE_ADDRESS)
+CFLAGS-y += -DEARLY_UART_REG_SHIFT=$(EARLY_UART_REG_SHIFT)
endif
@@ -1,6 +1,6 @@
subdir-y += lib
-obj-$(EARLY_PRINTK) += debug.o
+obj-$(CONFIG_EARLY_PRINTK) += debug.o
obj-y += domctl.o
obj-y += domain.o
obj-y += entry.o
@@ -2,7 +2,7 @@ subdir-y += lib
obj-y += cache.o
obj-$(CONFIG_HARDEN_BRANCH_PREDICTOR) += bpi.o
-obj-$(EARLY_PRINTK) += debug.o
+obj-$(CONFIG_EARLY_PRINTK) += debug.o
obj-y += domctl.o
obj-y += domain.o
obj-y += entry.o
Support for a very early console has existed for ARM for quite some time. Previously EARLY_PRINTK had to be passed in as a Make variable, instead of as a configuration option. Create the option to allow selecting via .config. Signed-off-by: Elliott Mitchell <ehem+xen@drgnwing.com> --- This is mostly RFC due to insufficient testing. I am hopeful this successfully changes things to have the Kconfig CONFIG_EARLY_PRINTK option replace the environment/Make variable EARLY_PRINTK. --- xen/arch/arm/Kconfig | 12 ++++++++++++ xen/arch/arm/Makefile | 2 +- xen/arch/arm/Rules.mk | 34 +++++++++++++++------------------- xen/arch/arm/arm32/Makefile | 2 +- xen/arch/arm/arm64/Makefile | 2 +- 5 files changed, 30 insertions(+), 22 deletions(-)