mkbootimg.mk 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. # Copyright (C) 2017 The LineageOS Project
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. LOCAL_PATH := $(call my-dir)
  15. ifeq ($(strip $(BOARD_KERNEL_SEPARATED_DT)),true)
  16. ifneq ($(strip $(BOARD_KERNEL_PREBUILT_DT)),true)
  17. ifeq ($(strip $(BUILD_TINY_ANDROID)),true)
  18. include device/qcom/common/dtbtool/Android.mk
  19. endif
  20. ifeq ($(strip $(TARGET_CUSTOM_DTBTOOL)),)
  21. DTBTOOL_NAME := dtbToolLineage
  22. else
  23. DTBTOOL_NAME := $(TARGET_CUSTOM_DTBTOOL)
  24. endif
  25. DTBTOOL := $(HOST_OUT_EXECUTABLES)/$(DTBTOOL_NAME)$(HOST_EXECUTABLE_SUFFIX)
  26. INSTALLED_DTIMAGE_TARGET := $(PRODUCT_OUT)/dt.img
  27. ifeq ($(strip $(TARGET_CUSTOM_DTBTOOL)),)
  28. # dtbToolCM will search subdirectories
  29. possible_dtb_dirs = $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/
  30. else
  31. # Most specific paths must come first in possible_dtb_dirs
  32. possible_dtb_dirs = $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/dts/exynos/ $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/dts/ $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/
  33. endif
  34. define build-dtimage-target
  35. $(call pretty,"Target dt image: $@")
  36. $(hide) for dir in $(possible_dtb_dirs); do \
  37. if [ -d "$$dir" ]; then \
  38. dtb_dir="$$dir"; \
  39. break; \
  40. fi; \
  41. done; \
  42. $(DTBTOOL) $(BOARD_DTBTOOL_ARGS) -o $@ -s $(BOARD_KERNEL_PAGESIZE) -p $(KERNEL_OUT)/scripts/dtc/ "$$dtb_dir";
  43. $(hide) chmod a+r $@
  44. endef
  45. $(INSTALLED_DTIMAGE_TARGET): $(DTBTOOL) $(INSTALLED_KERNEL_TARGET)
  46. $(build-dtimage-target)
  47. @echo "Made DT image: $@"
  48. .PHONY: dtimage
  49. dtimage: $(INSTALLED_DTIMAGE_TARGET)
  50. endif
  51. endif
  52. $(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES) $(BOOTIMAGE_EXTRA_DEPS)
  53. $(call pretty,"Target boot image: $@")
  54. $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
  55. $(hide) echo -n "SEANDROIDENFORCE" >> $@
  56. $(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE),raw)
  57. @echo "Made boot image: $@"
  58. FLASH_IMAGE_TARGET ?= $(PRODUCT_OUT)/recovery.tar
  59. $(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTIMG) $(recovery_ramdisk) $(recovery_kernel) $(RECOVERYIMAGE_EXTRA_DEPS)
  60. @echo "----- Making recovery image ------"
  61. $(hide) $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@ --id > $(RECOVERYIMAGE_ID_FILE)
  62. $(hide) echo -n "SEANDROIDENFORCE" >> $@
  63. $(hide) $(call assert-max-image-size,$@,$(BOARD_RECOVERYIMAGE_PARTITION_SIZE),raw)
  64. @echo "Made recovery image: $@"
  65. $(hide) tar -C $(PRODUCT_OUT) -H ustar -c recovery.img > $(FLASH_IMAGE_TARGET)
  66. @echo "Made Odin flashable recovery tar: ${FLASH_IMAGE_TARGET}"