From 67a74448ff1c97e0b65b8677e86af4aca32206e9 Mon Sep 17 00:00:00 2001 From: Jesse Chan Date: Thu, 2 Feb 2017 00:22:09 +0800 Subject: [PATCH] add a common mkbootimg.mk to quiet "KERNEL IS NOT SEANDROID ENFORCING" warning * dtimage part is taken from vendor/cm Change-Id: I243af7a0158ea64fe4c524e98f084b073944f5bb --- mkbootimg.mk | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 mkbootimg.mk diff --git a/mkbootimg.mk b/mkbootimg.mk new file mode 100644 index 00000000..ce320a00 --- /dev/null +++ b/mkbootimg.mk @@ -0,0 +1,75 @@ +# Copyright (C) 2017 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. + +LOCAL_PATH := $(call my-dir) + +ifeq ($(strip $(BOARD_KERNEL_SEPARATED_DT)),true) +ifneq ($(strip $(BOARD_KERNEL_PREBUILT_DT)),true) +ifeq ($(strip $(BUILD_TINY_ANDROID)),true) +include device/qcom/common/dtbtool/Android.mk +endif + +ifeq ($(strip $(TARGET_CUSTOM_DTBTOOL)),) +DTBTOOL_NAME := dtbToolCM +else +DTBTOOL_NAME := $(TARGET_CUSTOM_DTBTOOL) +endif + +DTBTOOL := $(HOST_OUT_EXECUTABLES)/$(DTBTOOL_NAME)$(HOST_EXECUTABLE_SUFFIX) + +INSTALLED_DTIMAGE_TARGET := $(PRODUCT_OUT)/dt.img + +ifeq ($(strip $(TARGET_CUSTOM_DTBTOOL)),) +# dtbToolCM will search subdirectories +possible_dtb_dirs = $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/ +else +# Most specific paths must come first in possible_dtb_dirs +possible_dtb_dirs = $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/dts/ $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/ +endif + +define build-dtimage-target + $(call pretty,"Target dt image: $@") + $(hide) for dir in $(possible_dtb_dirs); do \ + if [ -d "$$dir" ]; then \ + dtb_dir="$$dir"; \ + break; \ + fi; \ + done; \ + $(DTBTOOL) $(BOARD_DTBTOOL_ARGS) -o $@ -s $(BOARD_KERNEL_PAGESIZE) -p $(KERNEL_OUT)/scripts/dtc/ "$$dtb_dir"; + $(hide) chmod a+r $@ +endef + +$(INSTALLED_DTIMAGE_TARGET): $(DTBTOOL) $(INSTALLED_KERNEL_TARGET) + $(build-dtimage-target) + @echo "Made DT image: $@" + +.PHONY: dtimage +dtimage: $(INSTALLED_DTIMAGE_TARGET) + +endif +endif + +$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES) $(BOOTIMAGE_EXTRA_DEPS) + $(call pretty,"Target boot image: $@") + $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@ + $(hide) echo -n "SEANDROIDENFORCE" >> $@ + $(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE),raw) + @echo "Made boot image: $@" + +$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTIMG) $(recovery_ramdisk) $(recovery_kernel) $(RECOVERYIMAGE_EXTRA_DEPS) + @echo "----- Making recovery image ------" + $(hide) $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@ --id > $(RECOVERYIMAGE_ID_FILE) + $(hide) echo -n "SEANDROIDENFORCE" >> $@ + $(hide) $(call assert-max-image-size,$@,$(BOARD_RECOVERYIMAGE_PARTITION_SIZE),raw) + @echo "Made recovery image: $@"