diff --git a/avb/Android.mk b/avb/Android.mk index 4a85fa0c..054bb557 100644 --- a/avb/Android.mk +++ b/avb/Android.mk @@ -52,7 +52,9 @@ LOCAL_EXPORT_C_INCLUDE_DIRS := $(KERNELFLINGER_LOCAL_PATH)/include LOCAL_CFLAGS := $(avb_common_cflags) -DAVB_COMPILATION -Wno-error -DAVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED ifneq ($(KERNELFLINGER_DISABLE_DEBUG_PRINT),true) - LOCAL_CFLAGS += -DAVB_ENABLE_DEBUG + ifeq ($(TARGET_BUILD_VARIANT),userdebug) + KERNELFLINGER_CFLAGS += -DAVB_ENABLE_DEBUG + endif endif ifeq ($(TARGET_USE_TPM),true) diff --git a/include/log.h b/include/log.h index 974e5b5b..9b845c38 100644 --- a/include/log.h +++ b/include/log.h @@ -133,11 +133,26 @@ void vlog(const CHAR16 *fmt, va_list args); Print(x "\n", ##__VA_ARGS__); \ log_flush_to_var(TRUE); \ } while(0) + +#define logs(x, ...) do { \ + log(x "\n", ##__VA_ARGS__); \ + if (ui_is_ready()) { \ + ui_print(x, ##__VA_ARGS__); \ + } else \ + Print(x "\n", ##__VA_ARGS__); \ + log_flush_to_var(TRUE); \ +} while(0) + #else #define error(x, ...) do { \ log(x "\n", ##__VA_ARGS__); \ log_flush_to_var(TRUE); \ } while(0) + +#define logs(x, ...) do { \ + log(x "\n", ##__VA_ARGS__); \ + log_flush_to_var(TRUE); \ +} while(0) #endif /* USE_UI */ #define efi_perror(ret, x, ...) do { \ diff --git a/libkernelflinger/android.c b/libkernelflinger/android.c index 13dbd07c..93c2afce 100644 --- a/libkernelflinger/android.c +++ b/libkernelflinger/android.c @@ -431,7 +431,7 @@ static inline EFI_STATUS handover_jump(EFI_HANDLE image, EFI_STATUS ret = EFI_LOAD_ERROR; UINTN map_key, i; - log(L"handover jump ...\n"); + logs(L"handover jump to kernel ...\n"); ret = setup_gdt(); if (EFI_ERROR(ret)) { @@ -780,7 +780,7 @@ static CHAR16 *get_boot_reason(void) /* in case of an OS initiated reboot => get reason from efi var */ bootreason = get_reboot_reason(); if (!bootreason) { - error(L"Error while trying to read the reboot reason"); + error(L"Not find reboot reason, set bootreason to unknown"); bootreason = L"unknown"; goto done; }