Jan Kundrát | 1b5a428 | 2018-04-05 21:32:53 +0200 | [diff] [blame] | 1 | CZECHLIGHT_RAUC_TMP_TARGET_DIR = $(FS_DIR)/rootfs.czechlight-rauc.tmp |
| 2 | |
| 3 | CZECHLIGHT_RAUC_IMAGE_VERSION = dev |
| 4 | |
| 5 | $(BINARIES_DIR)/update.raucb: host-rauc rootfs-tar |
| 6 | @$(call MESSAGE,"Generating RAUC update bundle") |
| 7 | $(RM) -rf $(CZECHLIGHT_RAUC_TMP_TARGET_DIR) |
| 8 | mkdir -p $(CZECHLIGHT_RAUC_TMP_TARGET_DIR) |
| 9 | sed \ |
| 10 | -e 's|CZECHLIGHT_RAUC_IMAGE_VERSION|$(call qstrip,$(CZECHLIGHT_RAUC_IMAGE_VERSION))|' \ |
| 11 | -e 's|CZECHLIGHT_RAUC_COMPATIBLE|$(call qstrip,$(CZECHLIGHT_RAUC_COMPATIBLE))|' \ |
| 12 | $(BR2_EXTERNAL_CZECHLIGHT_PATH)/board/czechlight/common/rauc-manifest.raucm.in \ |
| 13 | > $(CZECHLIGHT_RAUC_TMP_TARGET_DIR)/manifest.raucm |
| 14 | |
| 15 | $(RM) -f $(BINARIES_DIR)/update.raucb |
| 16 | ln $(BINARIES_DIR)/rootfs.tar.xz $(CZECHLIGHT_RAUC_TMP_TARGET_DIR) |
| 17 | tar -cJf $(CZECHLIGHT_RAUC_TMP_TARGET_DIR)/cfg.tar.xz -T /dev/null |
| 18 | cp $(BR2_EXTERNAL_CZECHLIGHT_PATH)/board/czechlight/common/rauc-hook.sh $(CZECHLIGHT_RAUC_TMP_TARGET_DIR)/hook.sh |
| 19 | |
| 20 | $(HOST_DIR)/usr/bin/rauc \ |
| 21 | --cert $(BR2_EXTERNAL_CZECHLIGHT_PATH)/crypto/rauc-cert.pem \ |
| 22 | --key $(BR2_EXTERNAL_CZECHLIGHT_PATH)/crypto/rauc-key.pem \ |
| 23 | bundle $(CZECHLIGHT_RAUC_TMP_TARGET_DIR) $(BINARIES_DIR)/update.raucb |
| 24 | |
| 25 | rootfs-czechlight-rauc: $(BINARIES_DIR)/update.raucb |
| 26 | |
| 27 | rootfs-czechlight-rauc-show-depends: |
| 28 | @echo host-rauc rootfs-tar |
| 29 | |
| 30 | .PHONY: rootfs-czechlight-rauc rootfs-czechlight-rauc-show-depends |
| 31 | |
| 32 | ifeq ($(CZECHLIGHT_RAUC_ROOTFS),y) |
| 33 | TARGETS_ROOTFS += rootfs-czechlight-rauc |
| 34 | ifeq ($(call qstrip,$(CZECHLIGHT_RAUC_COMPATIBLE)),) |
| 35 | $(error CZECHLIGHT_RAUC_COMPATIBLE cannot be empty) |
| 36 | endif |
| 37 | endif |
Jan Kundrát | f7edef3 | 2018-04-05 23:04:31 +0200 | [diff] [blame^] | 38 | |
| 39 | CZECHLIGHT_RAUC_INSTALL_TARGET = YES |
| 40 | |
| 41 | ifeq ($(BR2_PACKAGE_CZECHLIGHT_RAUC),y) |
| 42 | |
| 43 | ifeq ($(call qstrip,$(CZECHLIGHT_RAUC_BOOTLOADER)),) |
| 44 | $(error Unsupported bootloader for RAUC) |
| 45 | endif |
| 46 | |
| 47 | ifeq ($(call qstrip,$(CZECHLIGHT_RAUC_SLOT_A_ROOTFS_DEV)),) |
| 48 | $(error CZECHLIGHT_RAUC_SLOT_A_ROOTFS_DEV cannot be empty) |
| 49 | endif |
| 50 | ifeq ($(call qstrip,$(CZECHLIGHT_RAUC_SLOT_A_CFG_DEV)),) |
| 51 | $(error CZECHLIGHT_RAUC_SLOT_A_CFG_DEV cannot be empty) |
| 52 | endif |
| 53 | ifeq ($(call qstrip,$(CZECHLIGHT_RAUC_SLOT_B_ROOTFS_DEV)),) |
| 54 | $(error CZECHLIGHT_RAUC_SLOT_B_ROOTFS_DEV cannot be empty) |
| 55 | endif |
| 56 | ifeq ($(call qstrip,$(CZECHLIGHT_RAUC_SLOT_B_CFG_DEV)),) |
| 57 | $(error CZECHLIGHT_RAUC_SLOT_B_CFG_DEV cannot be empty) |
| 58 | endif |
| 59 | |
| 60 | endif # BR2_PACKAGE_CZECHLIGHT_RAUC |
| 61 | |
| 62 | define CZECHLIGHT_RAUC_INSTALL_TARGET_CMDS |
| 63 | $(INSTALL) -D -m 0644 $(BR2_EXTERNAL_CZECHLIGHT_PATH)/package/czechlight-rauc/system.conf.in $(TARGET_DIR)/etc/rauc/system.conf |
| 64 | sed -i -E -e "s|CZECHLIGHT_RAUC_BOOTLOADER|$(CZECHLIGHT_RAUC_BOOTLOADER)|" \ |
| 65 | -e 's|CZECHLIGHT_RAUC_COMPATIBLE|$(call qstrip,$(CZECHLIGHT_RAUC_COMPATIBLE))|' \ |
| 66 | -e "s|CZECHLIGHT_RAUC_SLOT_A_ROOTFS_DEV|$(call qstrip,$(CZECHLIGHT_RAUC_SLOT_A_ROOTFS_DEV))|" \ |
| 67 | -e "s|CZECHLIGHT_RAUC_SLOT_A_CFG_DEV|$(call qstrip,$(CZECHLIGHT_RAUC_SLOT_A_CFG_DEV))|" \ |
| 68 | -e "s|CZECHLIGHT_RAUC_SLOT_B_ROOTFS_DEV|$(call qstrip,$(CZECHLIGHT_RAUC_SLOT_B_ROOTFS_DEV))|" \ |
| 69 | -e "s|CZECHLIGHT_RAUC_SLOT_B_CFG_DEV|$(call qstrip,$(CZECHLIGHT_RAUC_SLOT_B_CFG_DEV))|" \ |
| 70 | $(TARGET_DIR)/etc/rauc/system.conf |
| 71 | endef |
| 72 | |
| 73 | $(eval $(generic-package)) |