diff options
Diffstat (limited to 'classes')
-rw-r--r-- | classes/image_types_ostree.bbclass | 23 | ||||
-rw-r--r-- | classes/image_types_ota.bbclass | 8 | ||||
-rw-r--r-- | classes/sota.bbclass | 2 | ||||
-rw-r--r-- | classes/sota_raspberrypi.bbclass | 15 | ||||
-rw-r--r-- | classes/sota_sanity.bbclass | 10 |
5 files changed, 42 insertions, 16 deletions
diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass index 4095de0..29da78e 100644 --- a/classes/image_types_ostree.bbclass +++ b/classes/image_types_ostree.bbclass | |||
@@ -6,10 +6,11 @@ OSTREE_ROOTFS ??= "${WORKDIR}/ostree-rootfs" | |||
6 | OSTREE_COMMIT_SUBJECT ??= "Commit-id: ${IMAGE_NAME}" | 6 | OSTREE_COMMIT_SUBJECT ??= "Commit-id: ${IMAGE_NAME}" |
7 | OSTREE_COMMIT_BODY ??= "" | 7 | OSTREE_COMMIT_BODY ??= "" |
8 | OSTREE_UPDATE_SUMMARY ??= "0" | 8 | OSTREE_UPDATE_SUMMARY ??= "0" |
9 | OSTREE_DEPLOY_DEVICETREE ??= "0" | ||
9 | 10 | ||
10 | BUILD_OSTREE_TARBALL ??= "1" | 11 | BUILD_OSTREE_TARBALL ??= "1" |
11 | 12 | ||
12 | SYSTEMD_USED = "${@oe.utils.ifelse(d.getVar('VIRTUAL-RUNTIME_init_manager', True) == 'systemd', 'true', '')}" | 13 | SYSTEMD_USED = "${@oe.utils.ifelse(d.getVar('VIRTUAL-RUNTIME_init_manager') == 'systemd', 'true', '')}" |
13 | 14 | ||
14 | IMAGE_CMD_TAR = "tar --xattrs --xattrs-include=*" | 15 | IMAGE_CMD_TAR = "tar --xattrs --xattrs-include=*" |
15 | CONVERSION_CMD_tar = "touch ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}; ${IMAGE_CMD_TAR} --numeric-owner -cf ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.tar -C ${OTA_IMAGE_ROOTFS} . || [ $? -eq 1 ]" | 16 | CONVERSION_CMD_tar = "touch ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}; ${IMAGE_CMD_TAR} --numeric-owner -cf ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.tar -C ${OTA_IMAGE_ROOTFS} . || [ $? -eq 1 ]" |
@@ -103,18 +104,27 @@ IMAGE_CMD_ostree () { | |||
103 | ln -sf var/roothome root | 104 | ln -sf var/roothome root |
104 | fi | 105 | fi |
105 | 106 | ||
106 | checksum=`sha256sum ${DEPLOY_DIR_IMAGE}/${OSTREE_KERNEL} | cut -f 1 -d " "` | ||
107 | |||
108 | cp ${DEPLOY_DIR_IMAGE}/${OSTREE_KERNEL} boot/vmlinuz-${checksum} | ||
109 | |||
110 | if [ "${KERNEL_IMAGETYPE}" = "fitImage" ]; then | 107 | if [ "${KERNEL_IMAGETYPE}" = "fitImage" ]; then |
111 | # this is a hack for ostree not to override init= in kernel cmdline - | 108 | # this is a hack for ostree not to override init= in kernel cmdline - |
112 | # make it think that the initramfs is present (while it is in FIT image) | 109 | # make it think that the initramfs is present (while it is in FIT image) |
110 | # since initramfs is fake file, it does not need to be included in checksum | ||
111 | checksum=$(sha256sum ${DEPLOY_DIR_IMAGE}/${OSTREE_KERNEL} | cut -f 1 -d " ") | ||
113 | touch boot/initramfs-${checksum} | 112 | touch boot/initramfs-${checksum} |
114 | else | 113 | else |
114 | if [ "${OSTREE_DEPLOY_DEVICETREE}" = "1" ] && [ -n "${KERNEL_DEVICETREE}" ]; then | ||
115 | checksum=$(cat ${DEPLOY_DIR_IMAGE}/${OSTREE_KERNEL} ${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.${INITRAMFS_FSTYPES} ${KERNEL_DEVICETREE} | sha256sum | cut -f 1 -d " ") | ||
116 | for DTS_FILE in ${KERNEL_DEVICETREE}; do | ||
117 | DTS_FILE_BASENAME=$(basename ${DTS_FILE}) | ||
118 | cp ${DEPLOY_DIR_IMAGE}/${DTS_FILE_BASENAME} boot/devicetree-${DTS_FILE_BASENAME}-${checksum} | ||
119 | done | ||
120 | else | ||
121 | checksum=$(cat ${DEPLOY_DIR_IMAGE}/${OSTREE_KERNEL} ${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.${INITRAMFS_FSTYPES} | sha256sum | cut -f 1 -d " ") | ||
122 | fi | ||
115 | cp ${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.${INITRAMFS_FSTYPES} boot/initramfs-${checksum} | 123 | cp ${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.${INITRAMFS_FSTYPES} boot/initramfs-${checksum} |
116 | fi | 124 | fi |
117 | 125 | ||
126 | cp ${DEPLOY_DIR_IMAGE}/${OSTREE_KERNEL} boot/vmlinuz-${checksum} | ||
127 | |||
118 | # Copy image manifest | 128 | # Copy image manifest |
119 | cat ${IMAGE_MANIFEST} | cut -d " " -f1,3 > usr/package.manifest | 129 | cat ${IMAGE_MANIFEST} | cut -d " " -f1,3 > usr/package.manifest |
120 | } | 130 | } |
@@ -160,6 +170,9 @@ IMAGE_CMD_ostreepush () { | |||
160 | 170 | ||
161 | IMAGE_TYPEDEP_garagesign = "ostreepush" | 171 | IMAGE_TYPEDEP_garagesign = "ostreepush" |
162 | do_image_garagesign[depends] += "unzip-native:do_populate_sysroot" | 172 | do_image_garagesign[depends] += "unzip-native:do_populate_sysroot" |
173 | # This lock solves OTA-1866, which is that removing GARAGE_SIGN_REPO while using | ||
174 | # garage-sign simultaneously for two images often causes problems. | ||
175 | do_image_garagesign[lockfiles] += "${DEPLOY_DIR_IMAGE}/garagesign.lock" | ||
163 | IMAGE_CMD_garagesign () { | 176 | IMAGE_CMD_garagesign () { |
164 | if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then | 177 | if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then |
165 | # if credentials are issued by a server that doesn't support offline signing, exit silently | 178 | # if credentials are issued by a server that doesn't support offline signing, exit silently |
diff --git a/classes/image_types_ota.bbclass b/classes/image_types_ota.bbclass index 9883a68..a31cbd1 100644 --- a/classes/image_types_ota.bbclass +++ b/classes/image_types_ota.bbclass | |||
@@ -42,8 +42,8 @@ OTA_IMAGE_ROOTFS_task-image-ota = "${OTA_SYSROOT}" | |||
42 | IMAGE_TYPEDEP_ota = "ostreecommit" | 42 | IMAGE_TYPEDEP_ota = "ostreecommit" |
43 | do_image_ota[dirs] = "${OTA_SYSROOT}" | 43 | do_image_ota[dirs] = "${OTA_SYSROOT}" |
44 | do_image_ota[cleandirs] = "${OTA_SYSROOT}" | 44 | do_image_ota[cleandirs] = "${OTA_SYSROOT}" |
45 | do_image_ota[depends] = "${@'grub:do_populate_sysroot' if d.getVar('OSTREE_BOOTLOADER', True) == 'grub' else ''} \ | 45 | do_image_ota[depends] = "${@'grub:do_populate_sysroot' if d.getVar('OSTREE_BOOTLOADER') == 'grub' else ''} \ |
46 | ${@'virtual/bootloader:do_deploy' if d.getVar('OSTREE_BOOTLOADER', True) == 'u-boot' else ''}" | 46 | ${@'virtual/bootloader:do_deploy' if d.getVar('OSTREE_BOOTLOADER') == 'u-boot' else ''}" |
47 | IMAGE_CMD_ota () { | 47 | IMAGE_CMD_ota () { |
48 | ostree admin --sysroot=${OTA_SYSROOT} init-fs ${OTA_SYSROOT} | 48 | ostree admin --sysroot=${OTA_SYSROOT} init-fs ${OTA_SYSROOT} |
49 | ostree admin --sysroot=${OTA_SYSROOT} os-init ${OSTREE_OSNAME} | 49 | ostree admin --sysroot=${OTA_SYSROOT} os-init ${OSTREE_OSNAME} |
@@ -93,7 +93,7 @@ IMAGE_CMD_ota () { | |||
93 | IMAGE_TYPEDEP_ota-ext4 = "ota" | 93 | IMAGE_TYPEDEP_ota-ext4 = "ota" |
94 | do_image_ota_ext4[depends] = "e2fsprogs-native:do_populate_sysroot" | 94 | do_image_ota_ext4[depends] = "e2fsprogs-native:do_populate_sysroot" |
95 | IMAGE_CMD_ota-ext4 () { | 95 | IMAGE_CMD_ota-ext4 () { |
96 | # Calculate image type | 96 | # Calculate image size |
97 | OTA_ROOTFS_SIZE=$(calculate_size `du -ks ${OTA_SYSROOT} | cut -f 1` "${IMAGE_OVERHEAD_FACTOR}" "${IMAGE_ROOTFS_SIZE}" "${IMAGE_ROOTFS_MAXSIZE}" `expr ${IMAGE_ROOTFS_EXTRA_SPACE}` "${IMAGE_ROOTFS_ALIGNMENT}") | 97 | OTA_ROOTFS_SIZE=$(calculate_size `du -ks ${OTA_SYSROOT} | cut -f 1` "${IMAGE_OVERHEAD_FACTOR}" "${IMAGE_ROOTFS_SIZE}" "${IMAGE_ROOTFS_MAXSIZE}" `expr ${IMAGE_ROOTFS_EXTRA_SPACE}` "${IMAGE_ROOTFS_ALIGNMENT}") |
98 | 98 | ||
99 | if [ ${OTA_ROOTFS_SIZE} -lt 0 ]; then | 99 | if [ ${OTA_ROOTFS_SIZE} -lt 0 ]; then |
@@ -110,4 +110,4 @@ IMAGE_CMD_ota-ext4 () { | |||
110 | mkfs.ext4 -O ^64bit ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.ota-ext4 -L otaroot -d ${OTA_SYSROOT} | 110 | mkfs.ext4 -O ^64bit ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.ota-ext4 -L otaroot -d ${OTA_SYSROOT} |
111 | } | 111 | } |
112 | 112 | ||
113 | do_image_wic[depends] += "${@bb.utils.contains('DISTRO_FEATURES', 'sota', '%s:do_image_ota_ext4' % d.getVar('IMAGE_BASENAME', True), '', d)}" | 113 | do_image_wic[depends] += "${@bb.utils.contains('DISTRO_FEATURES', 'sota', '%s:do_image_ota_ext4' % d.getVar('IMAGE_BASENAME'), '', d)}" |
diff --git a/classes/sota.bbclass b/classes/sota.bbclass index 93f59eb..92b4c43 100644 --- a/classes/sota.bbclass +++ b/classes/sota.bbclass | |||
@@ -21,7 +21,7 @@ WKS_FILE_sota ?= "sdimage-sota.wks" | |||
21 | 21 | ||
22 | EXTRA_IMAGEDEPENDS_append_sota = " parted-native mtools-native dosfstools-native" | 22 | EXTRA_IMAGEDEPENDS_append_sota = " parted-native mtools-native dosfstools-native" |
23 | 23 | ||
24 | INITRAMFS_FSTYPES ??= "${@oe.utils.ifelse(d.getVar('OSTREE_BOOTLOADER', True) == 'u-boot', 'cpio.gz.u-boot', 'cpio.gz')}" | 24 | INITRAMFS_FSTYPES ?= "${@oe.utils.ifelse(d.getVar('OSTREE_BOOTLOADER') == 'u-boot', 'cpio.gz.u-boot', 'cpio.gz')}" |
25 | 25 | ||
26 | # Please redefine OSTREE_REPO in order to have a persistent OSTree repo | 26 | # Please redefine OSTREE_REPO in order to have a persistent OSTree repo |
27 | export OSTREE_REPO ?= "${DEPLOY_DIR_IMAGE}/ostree_repo" | 27 | export OSTREE_REPO ?= "${DEPLOY_DIR_IMAGE}/ostree_repo" |
diff --git a/classes/sota_raspberrypi.bbclass b/classes/sota_raspberrypi.bbclass index 600f9e9..e1c0054 100644 --- a/classes/sota_raspberrypi.bbclass +++ b/classes/sota_raspberrypi.bbclass | |||
@@ -5,6 +5,13 @@ KERNEL_IMAGETYPE_sota = "fitImage" | |||
5 | INITRAMFS_FSTYPES = "cpio.gz" | 5 | INITRAMFS_FSTYPES = "cpio.gz" |
6 | OSTREE_KERNEL = "${KERNEL_IMAGETYPE}-${INITRAMFS_IMAGE}-${MACHINE}-${KERNEL_FIT_LINK_NAME}" | 6 | OSTREE_KERNEL = "${KERNEL_IMAGETYPE}-${INITRAMFS_IMAGE}-${MACHINE}-${KERNEL_FIT_LINK_NAME}" |
7 | 7 | ||
8 | # DTB needs to be relocated to apply overlays | ||
9 | UBOOT_DTB_LOADADDRESS = "0x05000000" | ||
10 | UBOOT_DTBO_LOADADDRESS = "0x06000000" | ||
11 | |||
12 | # Deploy config fragment list to OSTree root fs | ||
13 | IMAGE_INSTALL_append = " fit-conf" | ||
14 | |||
8 | PREFERRED_PROVIDER_virtual/bootloader_sota ?= "u-boot" | 15 | PREFERRED_PROVIDER_virtual/bootloader_sota ?= "u-boot" |
9 | UBOOT_ENTRYPOINT_sota ?= "0x00008000" | 16 | UBOOT_ENTRYPOINT_sota ?= "0x00008000" |
10 | 17 | ||
@@ -18,7 +25,13 @@ IMAGE_BOOT_FILES_sota = "bcm2835-bootfiles/* u-boot.bin;${SDIMG_KERNELIMAGE}" | |||
18 | KERNEL_DEVICETREE_raspberrypi2_sota ?= " bcm2709-rpi-2-b.dtb " | 25 | KERNEL_DEVICETREE_raspberrypi2_sota ?= " bcm2709-rpi-2-b.dtb " |
19 | KERNEL_DEVICETREE_raspberrypi3_sota ?= " bcm2710-rpi-3-b.dtb overlays/vc4-kms-v3d.dtbo overlays/rpi-ft5406.dtbo" | 26 | KERNEL_DEVICETREE_raspberrypi3_sota ?= " bcm2710-rpi-3-b.dtb overlays/vc4-kms-v3d.dtbo overlays/rpi-ft5406.dtbo" |
20 | 27 | ||
28 | SOTA_MAIN_DTB_raspberrypi2 ?= "bcm2709-rpi-2-b.dtb" | ||
29 | SOTA_MAIN_DTB_raspberrypi3 ?= "bcm2710-rpi-3-b.dtb" | ||
30 | |||
31 | SOTA_DT_OVERLAYS_raspberrypi3 ?= "vc4-kms-v3d.dtbo rpi-ft5406.dtbo" | ||
32 | |||
21 | # Kernel args normally provided by RPi's internal bootloader. Non-updateable | 33 | # Kernel args normally provided by RPi's internal bootloader. Non-updateable |
22 | OSTREE_KERNEL_ARGS_sota ?= " 8250.nr_uarts=1 bcm2708_fb.fbwidth=720 bcm2708_fb.fbheight=480 bcm2708_fb.fbswap=1 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000 dwc_otg.lpm_enable=0 console=ttyS0,115200 usbhid.mousepoll=0 " | 34 | OSTREE_KERNEL_ARGS_sota ?= " 8250.nr_uarts=1 bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=614 bcm2708_fb.fbswap=1 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000 dwc_otg.lpm_enable=0 console=ttyS0,115200 usbhid.mousepoll=0 " |
23 | 35 | ||
24 | SOTA_CLIENT_FEATURES_append = " ubootenv" | 36 | SOTA_CLIENT_FEATURES_append = " ubootenv" |
37 | |||
diff --git a/classes/sota_sanity.bbclass b/classes/sota_sanity.bbclass index e47de19..8e80acb 100644 --- a/classes/sota_sanity.bbclass +++ b/classes/sota_sanity.bbclass | |||
@@ -1,17 +1,17 @@ | |||
1 | # Sanity check the sota setup for common misconfigurations | 1 | # Sanity check the sota setup for common misconfigurations |
2 | 2 | ||
3 | def sota_check_overrides(status, d): | 3 | def sota_check_overrides(status, d): |
4 | for var in (d.getVar('SOTA_OVERRIDES_BLACKLIST', True) or "").split(): | 4 | for var in (d.getVar('SOTA_OVERRIDES_BLACKLIST') or "").split(): |
5 | if var in d.getVar('OVERRIDES', True).split(':'): | 5 | if var in d.getVar('OVERRIDES').split(':'): |
6 | status.addresult("%s should not be a overrides, because it is a image fstype in updater layer, please check your OVERRIDES setting.\n" % var) | 6 | status.addresult("%s should not be a overrides, because it is a image fstype in updater layer, please check your OVERRIDES setting.\n" % var) |
7 | 7 | ||
8 | def sota_check_required_variables(status, d): | 8 | def sota_check_required_variables(status, d): |
9 | for var in (d.getVar('SOTA_REQUIRED_VARIABLES', True) or "").split(): | 9 | for var in (d.getVar('SOTA_REQUIRED_VARIABLES') or "").split(): |
10 | if not d.getVar(var, True): | 10 | if not d.getVar(var): |
11 | status.addresult("%s should be set in your local.conf.\n" % var) | 11 | status.addresult("%s should be set in your local.conf.\n" % var) |
12 | 12 | ||
13 | def sota_raise_sanity_error(msg, d): | 13 | def sota_raise_sanity_error(msg, d): |
14 | if d.getVar("SANITY_USE_EVENTS", True) == "1": | 14 | if d.getVar("SANITY_USE_EVENTS") == "1": |
15 | bb.event.fire(bb.event.SanityCheckFailed(msg), d) | 15 | bb.event.fire(bb.event.SanityCheckFailed(msg), d) |
16 | return | 16 | return |
17 | 17 | ||