Skip to content

Commit

Permalink
Recovery will no longer require a custom vbmeta
Browse files Browse the repository at this point in the history
  • Loading branch information
DevZillion committed Jul 24, 2022
1 parent d26e94d commit 616b15f
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 13 deletions.
2 changes: 0 additions & 2 deletions BoardConfig.mk
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ BOARD_MKBOOTIMG_ARGS := \
--dtb_offset $(BOARD_DTB_OFFSET) \
--recovery_dtbo $(BOARD_PREBUILT_DTBOIMAGE)

BOARD_CUSTOM_BOOTIMG_MK := $(DEVICE_PATH)/bootimg.mk

# Recovery
BOARD_HAS_LARGE_FILESYSTEM := true
BOARD_HAS_NO_SELECT_BUTTON := true
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
- Releases tagged as "Pre-release" are considered experimental and may cause more unexpected stuff than the latest release, nobody is forced to support your in older releases.
```

Run ``chmod +x device/samsung/a31/mkbootimg`` to avoid building issues.
Build with twrp-11 to avoid the recovery.img being bigger than the partition.
### Special thanks to:
> [TeamWin](https://github.com/TeamWin) for the Recovery Project.
Expand Down
59 changes: 49 additions & 10 deletions bootimg.mk
Original file line number Diff line number Diff line change
@@ -1,18 +1,57 @@
MKBOOTIMG := device/samsung/a31/mkbootimg
# Copyright (C) 2020 The LineageOS Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

FLASH_IMAGE_TARGET ?= $(PRODUCT_OUT)/recovery.tar
LOCAL_PATH := $(call my-dir)

$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES) $(BOOTIMAGE_EXTRA_DEPS)
MKDTIMG := $(HOST_OUT_EXECUTABLES)/mkdtimg$(HOST_EXECUTABLE_SUFFIX)
KERNEL_OUT := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ
DTB_DIR := $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/dts/exynos
DTB_CFG := $(COMMON_PATH)/kernel/exynos9610.cfg

INSTALLED_DTBIMAGE_TARGET := $(PRODUCT_OUT)/dtb.img

define build-dtbimage-target
@echo "Building dtb.img"
$(MKDTIMG) cfg_create $@ $(DTB_CFG) -d $(DTB_DIR)
endef

$(INSTALLED_DTBIMAGE_TARGET): $(INSTALLED_KERNEL_TARGET) $(MKDTIMG)
$(build-dtbimage-target)

.PHONY: dtbimage
dtbimage: $(INSTALLED_DTBIMAGE_TARGET)

$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(AVBTOOL) $(INTERNAL_BOOTIMAGE_FILES) $(BOOTIMAGE_EXTRA_DEPS) $(INSTALLED_DTBIMAGE_TARGET) $(BOARD_AVB_BOOT_KEY_PATH)
$(call pretty,"Target boot image: $@")
$(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
$(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --dtb $(INSTALLED_DTBIMAGE_TARGET) --output $@
$(hide) echo -n "SEANDROIDENFORCE" >> $@
$(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE),raw)
$(hide) $(AVBTOOL) add_hash_footer \
--image $@ \
--partition_size $(BOARD_BOOTIMAGE_PARTITION_SIZE) \
--partition_name boot $(INTERNAL_AVB_BOOT_SIGNING_ARGS) \
$(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS)
@echo "Made boot image: $@"

$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTIMG) $(recovery_ramdisk) $(recovery_kernel) $(RECOVERYIMAGE_EXTRA_DEPS)
$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTIMG) $(AVBTOOL) $(recovery_ramdisk) $(recovery_kernel) $(RECOVERYIMAGE_EXTRA_DEPS) $(INSTALLED_DTBIMAGE_TARGET) $(BOARD_AVB_BOOT_KEY_PATH) $(BOARD_PREBUILT_DTBOIMAGE)
@echo "----- Making recovery image ------"
$(hide) $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
@echo "----- Lying about SEAndroid state to Samsung bootloader ------"
$(hide) $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --dtb $(INSTALLED_DTBIMAGE_TARGET) --output $@
$(hide) echo -n "SEANDROIDENFORCE" >> $@
@echo "Made recovery image: $@"
$(hide) tar -C $(PRODUCT_OUT) -c recovery.img > $(FLASH_IMAGE_TARGET)
@echo "Made flashable $(FLASH_IMAGE_TARGET): $@"
$(hide) $(call assert-max-image-size,$@,$(BOARD_RECOVERYIMAGE_PARTITION_SIZE),raw)
$(hide) $(AVBTOOL) add_hash_footer \
--image $@ \
--partition_size $(BOARD_RECOVERYIMAGE_PARTITION_SIZE) \
--partition_name recovery $(INTERNAL_AVB_RECOVERY_SIGNING_ARGS) \
$(BOARD_AVB_RECOVERY_ADD_HASH_FOOTER_ARGS)
@echo "Made recovery image: $@"
Binary file removed mkbootimg
Binary file not shown.

0 comments on commit 616b15f

Please sign in to comment.