Skip to content

Commit

Permalink
BootLib: DeviceInfo: set bootloader version during compile time
Browse files Browse the repository at this point in the history
Change-Id: I3f669841e4c91ac44f6d19db73005d981269fdac
Signed-off-by: Alexander Martinz <[email protected]>
  • Loading branch information
amartinz committed Sep 10, 2021
1 parent 7487038 commit 24e3744
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
6 changes: 6 additions & 0 deletions AndroidBoot.mk
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ ifneq ($(TARGET_BOOTLOADER_BOARD_MODEL),)
else
BOARD_BOOTLOADER_PRODUCT_MODEL := unknown
endif
ifneq ($(TARGET_BOOTLOADER_VERSION),)
BOARD_BOOTLOADER_VERSION := $(TARGET_BOOTLOADER_VERSION)
else
BOARD_BOOTLOADER_VERSION := unknown
endif

ifneq ($(TARGET_BOARD_TYPE),auto)
TARGET_BOARD_TYPE_AUTO := TARGET_BOARD_TYPE_AUTO=0
Expand Down Expand Up @@ -174,4 +179,5 @@ $(TARGET_ABL): $(LOCAL_ABL_SRC_FILE) | $(ABL_OUT) $(INSTALLED_KEYSTOREIMAGE_TARG
TARGET_ARCHITECTURE=$(TARGET_ARCHITECTURE) \
BOARD_BOOTLOADER_PRODUCT_NAME=$(BOARD_BOOTLOADER_PRODUCT_NAME) \
BOARD_BOOTLOADER_PRODUCT_MODEL=$(BOARD_BOOTLOADER_PRODUCT_MODEL) \
BOARD_BOOTLOADER_VERSION=$(BOARD_BOOTLOADER_VERSION) \
USERDATAIMAGE_FILE_SYSTEM_TYPE=$(USERDATAIMAGE_FILE_SYSTEM_TYPE)
12 changes: 4 additions & 8 deletions QcomModulePkg/Library/BootLib/DeviceInfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,14 +240,7 @@ UpdateDevInfo (CHAR16 *Pname, CHAR8 *ImgVersion)
{
EFI_STATUS Status = EFI_SUCCESS;

if (!StrCmp ((CONST CHAR16 *)Pname, (CONST CHAR16 *)L"bootloader")) {
AsciiStrnCpyS (DevInfo.bootloader_version, MAX_VERSION_LEN, PRODUCT_NAME,
AsciiStrLen (PRODUCT_NAME));
AsciiStrnCatS (DevInfo.bootloader_version, MAX_VERSION_LEN, "-",
AsciiStrLen ("-"));
AsciiStrnCatS (DevInfo.bootloader_version, MAX_VERSION_LEN, ImgVersion,
AsciiStrLen (ImgVersion));
} else {
if (StrCmp ((CONST CHAR16 *)Pname, (CONST CHAR16 *)L"bootloader")) {
AsciiStrnCpyS (DevInfo.radio_version, MAX_VERSION_LEN, PRODUCT_NAME,
AsciiStrLen (PRODUCT_NAME));
AsciiStrnCatS (DevInfo.radio_version, MAX_VERSION_LEN, "-",
Expand Down Expand Up @@ -279,6 +272,9 @@ EFI_STATUS DeviceInfoInit (VOID)
FirstReadDevInfo = FALSE;
}

AsciiStrnCpyS (DevInfo.bootloader_version, MAX_VERSION_LEN, PRODUCT_BOOTLOADER_VERSION,
AsciiStrLen (PRODUCT_BOOTLOADER_VERSION));

EnableChargingScreen (TRUE);

if (CompareMem (DevInfo.magic, DEVICE_MAGIC, DEVICE_MAGIC_SIZE)) {
Expand Down
1 change: 1 addition & 0 deletions QcomModulePkg/QcomModulePkg.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
GCC:*_*_*_CC_FLAGS = -DZ_SOLO
GCC:*_*_*_CC_FLAGS = -DPRODUCT_NAME=\"$(BOARD_BOOTLOADER_PRODUCT_NAME)\"
GCC:*_*_*_CC_FLAGS = -DPRODUCT_MODEL=\"$(BOARD_BOOTLOADER_PRODUCT_MODEL)\"
GCC:*_*_*_CC_FLAGS = -DPRODUCT_BOOTLOADER_VERSION=\"$(BOARD_BOOTLOADER_VERSION)\"

!if $(VERIFIED_BOOT)
GCC:*_*_*_CC_FLAGS = -DVERIFIED_BOOT
Expand Down

0 comments on commit 24e3744

Please sign in to comment.