| # |
| # Copyright 2016 The Android Open Source 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. |
| |
| ifeq ($(BOOTLOADER_USE_PREBUILT),false) |
| # Rules to create bootloader zip file, a precursor to the bootloader |
| # image that is stored in the target-files-package. There's also |
| # metadata file which indicates how large to make the VFAT filesystem |
| # image |
| |
| ifeq ($(TARGET_UEFI_ARCH),i386) |
| efi_default_name := bootia32.efi |
| LOADER_TYPE := linux-x86 |
| else |
| efi_default_name := bootx64.efi |
| LOADER_TYPE := linux-x86_64 |
| endif |
| |
| # (pulled from build/core/Makefile as this gets defined much later) |
| # Pick a reasonable string to use to identify files. |
| ifneq "" "$(filter eng.%,$(BUILD_NUMBER))" |
| # BUILD_NUMBER has a timestamp in it, which means that |
| # it will change every time. Pick a stable value. |
| FILE_NAME_TAG := eng.$(USER) |
| else |
| FILE_NAME_TAG := $(BUILD_NUMBER) |
| endif |
| |
| kernelflinger := $(PRODUCT_OUT)/efi/kernelflinger.efi |
| |
| BOARD_FIRST_STAGE_LOADER := $(kernelflinger) |
| |
| intermediates := $(call intermediates-dir-for,PACKAGING,bootloader_zip) |
| bootloader_zip := $(intermediates)/bootloader.zip |
| $(bootloader_zip): intermediates := $(intermediates) |
| $(bootloader_zip): efi_root := $(intermediates)/root |
| $(bootloader_zip): \ |
| $(TARGET_DEVICE_DIR)/AndroidBoard.mk \ |
| $(BOARD_FIRST_STAGE_LOADER) \ |
| | $(ACP) |
| |
| $(hide) rm -rf $(efi_root) |
| $(hide) rm -f $@ |
| $(hide) mkdir -p $(efi_root)/EFI/BOOT |
| $(hide) $(ACP) $(BOARD_FIRST_STAGE_LOADER) $(efi_root)/loader.efi |
| $(hide) $(ACP) $(BOARD_FIRST_STAGE_LOADER) $(efi_root)/EFI/BOOT/$(efi_default_name) |
| $(hide) echo "Brillo-OS=loader.efi" > $(efi_root)/manifest.txt |
| $(hide) echo "Fastboot=loader.efi;-f" >> $(efi_root)/manifest.txt |
| $(hide) (cd $(efi_root) && zip -qry ../$(notdir $@) .) |
| |
| bootloader_metadata := $(intermediates)/bootloader-size.txt |
| $(bootloader_metadata): |
| $(hide) mkdir -p $(dir $@) |
| $(hide) echo $(BOARD_BOOTLOADER_PARTITION_SIZE) > $@ |
| |
| INSTALLED_RADIOIMAGE_TARGET += $(bootloader_zip) $(bootloader_metadata) |
| |
| # Rule to create $(OUT)/bootloader image, binaries within are signed with |
| # testing keys |
| |
| BOOTLOADER_FROM_ZIP := vendor/bsp/intel/kernelflinger/build/bootloader_from_zip |
| |
| bootloader_bin := $(PRODUCT_OUT)/bootloader |
| $(bootloader_bin): \ |
| $(bootloader_zip) \ |
| $(IMG2SIMG) \ |
| $(BOOTLOADER_ADDITIONAL_DEPS) \ |
| $(BOOTLOADER_FROM_ZIP) |
| |
| $(hide) $(BOOTLOADER_FROM_ZIP) \ |
| --size $(BOARD_BOOTLOADER_PARTITION_SIZE) \ |
| $(BOOTLOADER_ADDITIONAL_ARGS) \ |
| --zipfile $(bootloader_zip) \ |
| $@ |
| |
| droidcore: $(bootloader_bin) |
| |
| .PHONY: bootloader |
| bootloader: $(bootloader_bin) |
| $(call dist-for-goals,droidcore,$(bootloader_bin):$(TARGET_PRODUCT)-bootloader-$(FILE_NAME_TAG)) |
| |
| fastboot_usb_bin := $(PRODUCT_OUT)/fastboot-usb.img |
| $(fastboot_usb_bin): \ |
| $(bootloader_zip) \ |
| $(BOOTLOADER_ADDITIONAL_DEPS) \ |
| $(BOOTLOADER_FROM_ZIP) |
| |
| $(hide) $(BOOTLOADER_FROM_ZIP) \ |
| $(BOOTLOADER_ADDITIONAL_ARGS) \ |
| --zipfile $(bootloader_zip) \ |
| --extra-size 10485760 \ |
| --bootable \ |
| $@ |
| |
| # Build when 'make' is run with no args |
| droidcore: $(fastboot_usb_bin) |
| |
| .PHONY: fastboot-usb |
| fastboot-usb: $(fastboot_usb_bin) |
| |
| $(call dist-for-goals,droidcore,$(fastboot_usb_bin):$(TARGET_PRODUCT)-fastboot-usb-$(FILE_NAME_TAG).img) |
| |
| endif |