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 | |
Jan Kundrát | 1b5a428 | 2018-04-05 21:32:53 +0200 | [diff] [blame] | 3 | $(BINARIES_DIR)/update.raucb: host-rauc rootfs-tar |
| 4 | @$(call MESSAGE,"Generating RAUC update bundle") |
| 5 | $(RM) -rf $(CZECHLIGHT_RAUC_TMP_TARGET_DIR) |
| 6 | mkdir -p $(CZECHLIGHT_RAUC_TMP_TARGET_DIR) |
| 7 | sed \ |
Jan Kundrát | 9cea9b6 | 2021-01-22 20:28:50 +0100 | [diff] [blame] | 8 | -e 's|CZECHLIGHT_RAUC_IMAGE_VERSION|$(call qstrip,$(shell git --git-dir=$(BR2_EXTERNAL_CZECHLIGHT_PATH)/.git --work-tree=$(BR2_EXTERNAL_CZECHLIGHT_PATH) describe --dirty))|' \ |
Jan Kundrát | 1b5a428 | 2018-04-05 21:32:53 +0200 | [diff] [blame] | 9 | -e 's|CZECHLIGHT_RAUC_COMPATIBLE|$(call qstrip,$(CZECHLIGHT_RAUC_COMPATIBLE))|' \ |
Jan Kundrát | ae54f38 | 2018-04-09 10:29:55 +0200 | [diff] [blame] | 10 | $(BR2_EXTERNAL_CZECHLIGHT_PATH)/package/czechlight-rauc/rauc-manifest.raucm.in \ |
Jan Kundrát | 1b5a428 | 2018-04-05 21:32:53 +0200 | [diff] [blame] | 11 | > $(CZECHLIGHT_RAUC_TMP_TARGET_DIR)/manifest.raucm |
| 12 | |
| 13 | $(RM) -f $(BINARIES_DIR)/update.raucb |
| 14 | ln $(BINARIES_DIR)/rootfs.tar.xz $(CZECHLIGHT_RAUC_TMP_TARGET_DIR) |
| 15 | tar -cJf $(CZECHLIGHT_RAUC_TMP_TARGET_DIR)/cfg.tar.xz -T /dev/null |
Jan Kundrát | ae54f38 | 2018-04-09 10:29:55 +0200 | [diff] [blame] | 16 | cp $(BR2_EXTERNAL_CZECHLIGHT_PATH)/package/czechlight-rauc/rauc-hook.sh $(CZECHLIGHT_RAUC_TMP_TARGET_DIR)/hook.sh |
Jan Kundrát | 1b5a428 | 2018-04-05 21:32:53 +0200 | [diff] [blame] | 17 | |
Jan Kundrát | 4fbf2d2 | 2019-03-01 14:05:38 +0100 | [diff] [blame] | 18 | PATH=$(HOST_DIR)/bin:$(PATH) $(HOST_DIR)/bin/rauc \ |
Jan Kundrát | 1b5a428 | 2018-04-05 21:32:53 +0200 | [diff] [blame] | 19 | --cert $(BR2_EXTERNAL_CZECHLIGHT_PATH)/crypto/rauc-cert.pem \ |
| 20 | --key $(BR2_EXTERNAL_CZECHLIGHT_PATH)/crypto/rauc-key.pem \ |
| 21 | bundle $(CZECHLIGHT_RAUC_TMP_TARGET_DIR) $(BINARIES_DIR)/update.raucb |
| 22 | |
| 23 | rootfs-czechlight-rauc: $(BINARIES_DIR)/update.raucb |
| 24 | |
| 25 | rootfs-czechlight-rauc-show-depends: |
| 26 | @echo host-rauc rootfs-tar |
| 27 | |
| 28 | .PHONY: rootfs-czechlight-rauc rootfs-czechlight-rauc-show-depends |
| 29 | |
| 30 | ifeq ($(CZECHLIGHT_RAUC_ROOTFS),y) |
| 31 | TARGETS_ROOTFS += rootfs-czechlight-rauc |
| 32 | ifeq ($(call qstrip,$(CZECHLIGHT_RAUC_COMPATIBLE)),) |
| 33 | $(error CZECHLIGHT_RAUC_COMPATIBLE cannot be empty) |
| 34 | endif |
| 35 | endif |
Jan Kundrát | f7edef3 | 2018-04-05 23:04:31 +0200 | [diff] [blame] | 36 | |
| 37 | CZECHLIGHT_RAUC_INSTALL_TARGET = YES |
Jan Kundrát | de3594f | 2018-05-24 16:28:06 +0200 | [diff] [blame] | 38 | CZECHLIGHT_RAUC_DEPENDENCIES = rauc |
Jan Kundrát | f7edef3 | 2018-04-05 23:04:31 +0200 | [diff] [blame] | 39 | |
| 40 | ifeq ($(BR2_PACKAGE_CZECHLIGHT_RAUC),y) |
| 41 | |
| 42 | ifeq ($(call qstrip,$(CZECHLIGHT_RAUC_BOOTLOADER)),) |
| 43 | $(error Unsupported bootloader for RAUC) |
| 44 | endif |
| 45 | |
| 46 | ifeq ($(call qstrip,$(CZECHLIGHT_RAUC_SLOT_A_ROOTFS_DEV)),) |
| 47 | $(error CZECHLIGHT_RAUC_SLOT_A_ROOTFS_DEV cannot be empty) |
| 48 | endif |
| 49 | ifeq ($(call qstrip,$(CZECHLIGHT_RAUC_SLOT_A_CFG_DEV)),) |
| 50 | $(error CZECHLIGHT_RAUC_SLOT_A_CFG_DEV cannot be empty) |
| 51 | endif |
| 52 | ifeq ($(call qstrip,$(CZECHLIGHT_RAUC_SLOT_B_ROOTFS_DEV)),) |
| 53 | $(error CZECHLIGHT_RAUC_SLOT_B_ROOTFS_DEV cannot be empty) |
| 54 | endif |
| 55 | ifeq ($(call qstrip,$(CZECHLIGHT_RAUC_SLOT_B_CFG_DEV)),) |
| 56 | $(error CZECHLIGHT_RAUC_SLOT_B_CFG_DEV cannot be empty) |
| 57 | endif |
| 58 | |
| 59 | endif # BR2_PACKAGE_CZECHLIGHT_RAUC |
| 60 | |
| 61 | define CZECHLIGHT_RAUC_INSTALL_TARGET_CMDS |
Jan Kundrát | dcb8588 | 2018-04-05 23:06:14 +0200 | [diff] [blame] | 62 | $(INSTALL) -D -m 0644 $(BR2_EXTERNAL_CZECHLIGHT_PATH)/crypto/rauc-cert.pem $(TARGET_DIR)/etc/rauc/keyring.pem |
Jan Kundrát | f7edef3 | 2018-04-05 23:04:31 +0200 | [diff] [blame] | 63 | $(INSTALL) -D -m 0644 $(BR2_EXTERNAL_CZECHLIGHT_PATH)/package/czechlight-rauc/system.conf.in $(TARGET_DIR)/etc/rauc/system.conf |
Jan Kundrát | a8c2b3a | 2018-04-09 10:32:11 +0200 | [diff] [blame] | 64 | sed -i -E -e "s|CZECHLIGHT_RAUC_BOOTLOADER|$(call qstrip, $(CZECHLIGHT_RAUC_BOOTLOADER))|" \ |
Jan Kundrát | f7edef3 | 2018-04-05 23:04:31 +0200 | [diff] [blame] | 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 |
Jan Kundrát | de3594f | 2018-05-24 16:28:06 +0200 | [diff] [blame] | 71 | mkdir -p $(TARGET_DIR)/usr/lib/systemd/system/multi-user.target.wants/ |
Jan Kundrát | cfca0b5 | 2018-04-09 11:45:52 +0200 | [diff] [blame] | 72 | $(INSTALL) -D -m 0644 $(BR2_EXTERNAL_CZECHLIGHT_PATH)/package/czechlight-rauc/rauc-mark-good.service \ |
| 73 | $(TARGET_DIR)/usr/lib/systemd/system/ |
| 74 | ln -sf ../rauc-mark-good.service $(TARGET_DIR)/usr/lib/systemd/system/multi-user.target.wants/ |
Jan Kundrát | 7ac1134 | 2018-06-14 18:56:05 +0200 | [diff] [blame] | 75 | $(INSTALL) -D -m 0644 $(BR2_EXTERNAL_CZECHLIGHT_PATH)/package/czechlight-rauc/enable-hw-watchdog.service \ |
| 76 | $(TARGET_DIR)/usr/lib/systemd/system/ |
| 77 | ln -sf ../enable-hw-watchdog.service $(TARGET_DIR)/usr/lib/systemd/system/multi-user.target.wants/ |
Jan Kundrát | 7ad2258 | 2018-08-22 19:06:45 +0200 | [diff] [blame] | 78 | |
| 79 | # Just for USB flashing |
| 80 | mkdir -p $(TARGET_DIR)/usr/lib/systemd/system-generators/ |
| 81 | $(INSTALL) -D -m 0755 \ |
| 82 | $(BR2_EXTERNAL_CZECHLIGHT_PATH)/package/czechlight-rauc/czechlight-usb-flash-mount-generator \ |
| 83 | $(TARGET_DIR)/usr/lib/systemd/system-generators/ |
| 84 | $(INSTALL) -D -m 0644 \ |
| 85 | $(BR2_EXTERNAL_CZECHLIGHT_PATH)/package/czechlight-rauc/usb-flash.service \ |
| 86 | $(TARGET_DIR)/usr/lib/systemd/system/ |
Jan Kundrát | f7edef3 | 2018-04-05 23:04:31 +0200 | [diff] [blame] | 87 | endef |
| 88 | |
| 89 | $(eval $(generic-package)) |