2016-08-17 15:08:22 +00:00
|
|
|
#
|
|
|
|
# Partition table
|
|
|
|
#
|
|
|
|
# The partition table is not a real component that gets linked into
|
|
|
|
# the project. Instead, it is a standalone project to generate
|
|
|
|
# the partition table binary as part of the build process. This
|
|
|
|
# binary is then added to the list of files for esptool.py to flash.
|
|
|
|
#
|
|
|
|
.PHONY: partition_table partition_table-flash partition_table-clean
|
|
|
|
|
|
|
|
# NB: gen_esp32part.py lives in the sdk/bin/ dir not component dir
|
2016-09-01 08:27:51 +00:00
|
|
|
GEN_ESP32PART := $(PYTHON) $(COMPONENT_PATH)/gen_esp32part.py -q
|
2016-08-17 15:08:22 +00:00
|
|
|
|
2016-11-11 06:00:34 +00:00
|
|
|
# Has a matching value in bootloader_support esp_flash_partitions.h
|
2016-11-07 03:35:23 +00:00
|
|
|
PARTITION_TABLE_OFFSET := 0x8000
|
|
|
|
|
2016-08-17 15:08:22 +00:00
|
|
|
# Path to partition CSV file is relative to project path for custom
|
|
|
|
# partition CSV files, but relative to component dir otherwise.$
|
|
|
|
PARTITION_TABLE_ROOT := $(call dequote,$(if $(CONFIG_PARTITION_TABLE_CUSTOM),$(PROJECT_PATH),$(COMPONENT_PATH)))
|
|
|
|
PARTITION_TABLE_CSV_PATH := $(call dequote,$(abspath $(PARTITION_TABLE_ROOT)/$(subst $(quote),,$(CONFIG_PARTITION_TABLE_FILENAME))))
|
|
|
|
|
|
|
|
PARTITION_TABLE_BIN := $(BUILD_DIR_BASE)/$(notdir $(PARTITION_TABLE_CSV_PATH:.csv=.bin))
|
|
|
|
|
2016-12-19 02:06:21 +00:00
|
|
|
ifdef CONFIG_SECURE_BOOT_BUILD_SIGNED_BINARIES
|
2016-11-07 04:45:57 +00:00
|
|
|
PARTITION_TABLE_BIN_UNSIGNED := $(PARTITION_TABLE_BIN:.bin=-unsigned.bin)
|
|
|
|
# add an extra signing step for secure partition table
|
2016-11-25 03:13:05 +00:00
|
|
|
$(PARTITION_TABLE_BIN): $(PARTITION_TABLE_BIN_UNSIGNED) $(SDKCONFIG_MAKEFILE) $(SECURE_BOOT_SIGNING_KEY)
|
|
|
|
$(ESPSECUREPY) sign_data --keyfile $(SECURE_BOOT_SIGNING_KEY) -o $@ $<
|
2016-11-07 04:45:57 +00:00
|
|
|
else
|
|
|
|
# secure bootloader disabled, both files are the same
|
|
|
|
PARTITION_TABLE_BIN_UNSIGNED := $(PARTITION_TABLE_BIN)
|
2016-11-03 06:33:30 +00:00
|
|
|
endif
|
2016-08-17 15:08:22 +00:00
|
|
|
|
2016-11-07 04:45:57 +00:00
|
|
|
$(PARTITION_TABLE_BIN_UNSIGNED): $(PARTITION_TABLE_CSV_PATH) $(SDKCONFIG_MAKEFILE)
|
2016-08-17 15:08:22 +00:00
|
|
|
@echo "Building partitions from $(PARTITION_TABLE_CSV_PATH)..."
|
2016-11-11 01:29:38 +00:00
|
|
|
$(GEN_ESP32PART) $< $@
|
2016-08-17 15:08:22 +00:00
|
|
|
|
2016-08-18 09:11:27 +00:00
|
|
|
all_binaries: $(PARTITION_TABLE_BIN)
|
|
|
|
|
2016-11-07 03:35:23 +00:00
|
|
|
PARTITION_TABLE_FLASH_CMD = $(ESPTOOLPY_SERIAL) write_flash $(PARTITION_TABLE_OFFSET) $(PARTITION_TABLE_BIN)
|
|
|
|
ESPTOOL_ALL_FLASH_ARGS += $(PARTITION_TABLE_OFFSET) $(PARTITION_TABLE_BIN)
|
2016-08-17 15:08:22 +00:00
|
|
|
|
|
|
|
partition_table: $(PARTITION_TABLE_BIN)
|
|
|
|
@echo "Partition table binary generated. Contents:"
|
|
|
|
@echo $(SEPARATOR)
|
2016-11-11 01:29:38 +00:00
|
|
|
$(GEN_ESP32PART) $<
|
2016-08-17 15:08:22 +00:00
|
|
|
@echo $(SEPARATOR)
|
|
|
|
@echo "Partition flashing command:"
|
|
|
|
@echo "$(PARTITION_TABLE_FLASH_CMD)"
|
|
|
|
|
|
|
|
partition_table-flash: $(PARTITION_TABLE_BIN)
|
|
|
|
@echo "Flashing partition table..."
|
2016-11-11 01:29:38 +00:00
|
|
|
$(PARTITION_TABLE_FLASH_CMD)
|
2016-08-17 15:08:22 +00:00
|
|
|
|
|
|
|
partition_table-clean:
|
2016-11-11 01:29:38 +00:00
|
|
|
rm -f $(PARTITION_TABLE_BIN)
|
2016-08-18 09:11:27 +00:00
|
|
|
|
|
|
|
clean: partition_table-clean
|