blob: 08a1e0c912dfc37651ec1642d755b8bfefc5890e [file] [log] [blame]
Jan Kundrát1b5a4282018-04-05 21:32:53 +02001CZECHLIGHT_RAUC_TMP_TARGET_DIR = $(FS_DIR)/rootfs.czechlight-rauc.tmp
2
Jan Kundrát1b5a4282018-04-05 21:32:53 +02003$(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átd146e492019-03-05 12:31:35 +01008 -e 's|CZECHLIGHT_RAUC_IMAGE_VERSION|$(call qstrip,$(shell git --git-dir=$(BR2_EXTERNAL_CZECHLIGHT_PATH)/.git describe))|' \
Jan Kundrát1b5a4282018-04-05 21:32:53 +02009 -e 's|CZECHLIGHT_RAUC_COMPATIBLE|$(call qstrip,$(CZECHLIGHT_RAUC_COMPATIBLE))|' \
Jan Kundrátae54f382018-04-09 10:29:55 +020010 $(BR2_EXTERNAL_CZECHLIGHT_PATH)/package/czechlight-rauc/rauc-manifest.raucm.in \
Jan Kundrát1b5a4282018-04-05 21:32:53 +020011 > $(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átae54f382018-04-09 10:29:55 +020016 cp $(BR2_EXTERNAL_CZECHLIGHT_PATH)/package/czechlight-rauc/rauc-hook.sh $(CZECHLIGHT_RAUC_TMP_TARGET_DIR)/hook.sh
Jan Kundrát1b5a4282018-04-05 21:32:53 +020017
Jan Kundrát4fbf2d22019-03-01 14:05:38 +010018 PATH=$(HOST_DIR)/bin:$(PATH) $(HOST_DIR)/bin/rauc \
Jan Kundrát1b5a4282018-04-05 21:32:53 +020019 --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
23rootfs-czechlight-rauc: $(BINARIES_DIR)/update.raucb
24
25rootfs-czechlight-rauc-show-depends:
26 @echo host-rauc rootfs-tar
27
28.PHONY: rootfs-czechlight-rauc rootfs-czechlight-rauc-show-depends
29
30ifeq ($(CZECHLIGHT_RAUC_ROOTFS),y)
31TARGETS_ROOTFS += rootfs-czechlight-rauc
32ifeq ($(call qstrip,$(CZECHLIGHT_RAUC_COMPATIBLE)),)
33$(error CZECHLIGHT_RAUC_COMPATIBLE cannot be empty)
34endif
35endif
Jan Kundrátf7edef32018-04-05 23:04:31 +020036
37CZECHLIGHT_RAUC_INSTALL_TARGET = YES
Jan Kundrátde3594f2018-05-24 16:28:06 +020038CZECHLIGHT_RAUC_DEPENDENCIES = rauc
Jan Kundrátf7edef32018-04-05 23:04:31 +020039
40ifeq ($(BR2_PACKAGE_CZECHLIGHT_RAUC),y)
41
42ifeq ($(call qstrip,$(CZECHLIGHT_RAUC_BOOTLOADER)),)
43$(error Unsupported bootloader for RAUC)
44endif
45
46ifeq ($(call qstrip,$(CZECHLIGHT_RAUC_SLOT_A_ROOTFS_DEV)),)
47$(error CZECHLIGHT_RAUC_SLOT_A_ROOTFS_DEV cannot be empty)
48endif
49ifeq ($(call qstrip,$(CZECHLIGHT_RAUC_SLOT_A_CFG_DEV)),)
50$(error CZECHLIGHT_RAUC_SLOT_A_CFG_DEV cannot be empty)
51endif
52ifeq ($(call qstrip,$(CZECHLIGHT_RAUC_SLOT_B_ROOTFS_DEV)),)
53$(error CZECHLIGHT_RAUC_SLOT_B_ROOTFS_DEV cannot be empty)
54endif
55ifeq ($(call qstrip,$(CZECHLIGHT_RAUC_SLOT_B_CFG_DEV)),)
56$(error CZECHLIGHT_RAUC_SLOT_B_CFG_DEV cannot be empty)
57endif
58
59endif # BR2_PACKAGE_CZECHLIGHT_RAUC
60
61define CZECHLIGHT_RAUC_INSTALL_TARGET_CMDS
Jan Kundrátdcb85882018-04-05 23:06:14 +020062 $(INSTALL) -D -m 0644 $(BR2_EXTERNAL_CZECHLIGHT_PATH)/crypto/rauc-cert.pem $(TARGET_DIR)/etc/rauc/keyring.pem
Jan Kundrátf7edef32018-04-05 23:04:31 +020063 $(INSTALL) -D -m 0644 $(BR2_EXTERNAL_CZECHLIGHT_PATH)/package/czechlight-rauc/system.conf.in $(TARGET_DIR)/etc/rauc/system.conf
Jan Kundráta8c2b3a2018-04-09 10:32:11 +020064 sed -i -E -e "s|CZECHLIGHT_RAUC_BOOTLOADER|$(call qstrip, $(CZECHLIGHT_RAUC_BOOTLOADER))|" \
Jan Kundrátf7edef32018-04-05 23:04:31 +020065 -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átde3594f2018-05-24 16:28:06 +020071 mkdir -p $(TARGET_DIR)/usr/lib/systemd/system/multi-user.target.wants/
Jan Kundrátcfca0b52018-04-09 11:45:52 +020072 $(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át7ac11342018-06-14 18:56:05 +020075 $(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át7ad22582018-08-22 19:06:45 +020078
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átf7edef32018-04-05 23:04:31 +020087endef
88
89$(eval $(generic-package))