diff options
28 files changed, 405 insertions, 379 deletions
diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass index 8b3cbcd..59d4510 100644 --- a/classes/image_types_ostree.bbclass +++ b/classes/image_types_ostree.bbclass | |||
| @@ -68,6 +68,10 @@ IMAGE_CMD_ostree () { | |||
| 68 | ln -s ../init.d/tmpfiles.sh usr/etc/rcS.d/S20tmpfiles.sh | 68 | ln -s ../init.d/tmpfiles.sh usr/etc/rcS.d/S20tmpfiles.sh |
| 69 | fi | 69 | fi |
| 70 | 70 | ||
| 71 | # Preserve OSTREE_BRANCHNAME for future information | ||
| 72 | mkdir -p usr/share/sota/ | ||
| 73 | echo -n "${OSTREE_BRANCHNAME}" > usr/share/sota/branchname | ||
| 74 | |||
| 71 | # Preserve data in /home to be later copied to /sysroot/home by | 75 | # Preserve data in /home to be later copied to /sysroot/home by |
| 72 | # sysroot generating procedure | 76 | # sysroot generating procedure |
| 73 | mkdir -p usr/homedirs | 77 | mkdir -p usr/homedirs |
| @@ -122,7 +126,7 @@ IMAGE_CMD_ostree () { | |||
| 122 | cp ${DEPLOY_DIR_IMAGE}/${OSTREE_INITRAMFS_IMAGE}-${MACHINE}${RAMDISK_EXT} boot/initramfs-${checksum} | 126 | cp ${DEPLOY_DIR_IMAGE}/${OSTREE_INITRAMFS_IMAGE}-${MACHINE}${RAMDISK_EXT} boot/initramfs-${checksum} |
| 123 | 127 | ||
| 124 | # Copy image manifest | 128 | # Copy image manifest |
| 125 | cat ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.manifest | cut -d " " -f1,3 > usr/package.manifest | 129 | cat ${IMAGE_MANIFEST} | cut -d " " -f1,3 > usr/package.manifest |
| 126 | 130 | ||
| 127 | cd ${WORKDIR} | 131 | cd ${WORKDIR} |
| 128 | 132 | ||
| @@ -154,6 +158,7 @@ IMAGE_CMD_ostreepush () { | |||
| 154 | if [ ${OSTREE_PUSH_CREDENTIALS} ]; then | 158 | if [ ${OSTREE_PUSH_CREDENTIALS} ]; then |
| 155 | garage-push --repo=${OSTREE_REPO} \ | 159 | garage-push --repo=${OSTREE_REPO} \ |
| 156 | --ref=${OSTREE_BRANCHNAME} \ | 160 | --ref=${OSTREE_BRANCHNAME} \ |
| 157 | --credentials=${OSTREE_PUSH_CREDENTIALS} | 161 | --credentials=${OSTREE_PUSH_CREDENTIALS} \ |
| 162 | --cacert=${STAGING_ETCDIR_NATIVE}/ssl/certs/ca-certificates.crt | ||
| 158 | fi | 163 | fi |
| 159 | } | 164 | } |
diff --git a/classes/image_types_ota.bbclass b/classes/image_types_ota.bbclass index bee1ea4..74533dd 100644 --- a/classes/image_types_ota.bbclass +++ b/classes/image_types_ota.bbclass | |||
| @@ -9,12 +9,9 @@ | |||
| 9 | 9 | ||
| 10 | inherit image | 10 | inherit image |
| 11 | 11 | ||
| 12 | IMAGE_DEPENDS_otaimg = "e2fsprogs-native:do_populate_sysroot" | 12 | IMAGE_DEPENDS_otaimg = "e2fsprogs-native:do_populate_sysroot \ |
| 13 | 13 | ${@'grub:do_populate_sysroot' if d.getVar('OSTREE_BOOTLOADER', True) == 'grub' else ''} \ | |
| 14 | # For qemux86 u-boot is not included in any live image and is built separately | 14 | ${@'virtual/bootloader:do_deploy' if d.getVar('OSTREE_BOOTLOADER', True) == 'u-boot' else ''}" |
| 15 | IMAGE_DEPENDS_otaimg_append_qemux86 = " virtual/bootloader:do_deploy" | ||
| 16 | IMAGE_DEPENDS_otaimg_append_qemux86-64 = " virtual/bootloader:do_deploy" | ||
| 17 | IMAGE_DEPENDS_otaimg_append_corei7-64-intel-common = " virtual/bootloader:do_deploy" | ||
| 18 | 15 | ||
| 19 | calculate_size () { | 16 | calculate_size () { |
| 20 | BASE=$1 | 17 | BASE=$1 |
| @@ -52,6 +49,7 @@ calculate_size () { | |||
| 52 | export OSTREE_OSNAME | 49 | export OSTREE_OSNAME |
| 53 | export OSTREE_BRANCHNAME | 50 | export OSTREE_BRANCHNAME |
| 54 | export OSTREE_REPO | 51 | export OSTREE_REPO |
| 52 | export OSTREE_BOOTLOADER | ||
| 55 | 53 | ||
| 56 | IMAGE_CMD_otaimg () { | 54 | IMAGE_CMD_otaimg () { |
| 57 | if ${@bb.utils.contains('IMAGE_FSTYPES', 'otaimg', 'true', 'false', d)}; then | 55 | if ${@bb.utils.contains('IMAGE_FSTYPES', 'otaimg', 'true', 'false', d)}; then |
| @@ -76,32 +74,31 @@ IMAGE_CMD_otaimg () { | |||
| 76 | mkdir -p ${PHYS_SYSROOT}/boot/loader.0 | 74 | mkdir -p ${PHYS_SYSROOT}/boot/loader.0 |
| 77 | ln -s loader.0 ${PHYS_SYSROOT}/boot/loader | 75 | ln -s loader.0 ${PHYS_SYSROOT}/boot/loader |
| 78 | 76 | ||
| 79 | touch ${PHYS_SYSROOT}/boot/loader/uEnv.txt | 77 | if [ "${OSTREE_BOOTLOADER}" = "grub" ]; then |
| 78 | mkdir -p ${PHYS_SYSROOT}/boot/grub2 | ||
| 79 | touch ${PHYS_SYSROOT}/boot/grub2/grub.cfg | ||
| 80 | elif [ "${OSTREE_BOOTLOADER}" = "u-boot" ]; then | ||
| 81 | touch ${PHYS_SYSROOT}/boot/loader/uEnv.txt | ||
| 82 | else | ||
| 83 | bberror "Invalid bootloader: ${OSTREE_BOOTLOADER}" | ||
| 84 | fi; | ||
| 80 | 85 | ||
| 81 | ostree --repo=${PHYS_SYSROOT}/ostree/repo pull-local --remote=${OSTREE_OSNAME} ${OSTREE_REPO} ${OSTREE_BRANCHNAME} | 86 | ostree --repo=${PHYS_SYSROOT}/ostree/repo pull-local --remote=${OSTREE_OSNAME} ${OSTREE_REPO} ${OSTREE_BRANCHNAME} |
| 82 | ostree admin --sysroot=${PHYS_SYSROOT} deploy --os=${OSTREE_OSNAME} ${OSTREE_OSNAME}:${OSTREE_BRANCHNAME} | 87 | export OSTREE_BOOT_PARTITION="/boot" |
| 83 | 88 | kargs_list="" | |
| 84 | # Copy deployment /home to sysroot | 89 | for arg in ${OSTREE_KERNEL_ARGS}; do |
| 90 | kargs_list="${kargs_list} --karg-append=$arg" | ||
| 91 | done | ||
| 92 | |||
| 93 | ostree admin --sysroot=${PHYS_SYSROOT} deploy ${kargs_list} --os=${OSTREE_OSNAME} ${OSTREE_OSNAME}:${OSTREE_BRANCHNAME} | ||
| 94 | |||
| 95 | # Copy deployment /home and /var/sota to sysroot | ||
| 85 | HOME_TMP=`mktemp -d ${WORKDIR}/home-tmp-XXXXX` | 96 | HOME_TMP=`mktemp -d ${WORKDIR}/home-tmp-XXXXX` |
| 86 | tar --xattrs --xattrs-include='*' -C ${HOME_TMP} -xf ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.rootfs.ostree.tar.bz2 ./usr/homedirs | 97 | tar --xattrs --xattrs-include='*' -C ${HOME_TMP} -xf ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.rootfs.ostree.tar.bz2 ./usr/homedirs ./var/sota || true |
| 87 | mv ${HOME_TMP}/usr/homedirs/home ${PHYS_SYSROOT}/ | 98 | > mv ${HOME_TMP}/var/sota ${PHYS_SYSROOT}/ostree/deploy/${OSTREE_OSNAME}/var/ || true |
| 99 | mv ${HOME_TMP}/usr/homedirs/home ${PHYS_SYSROOT}/ || true | ||
| 88 | rm -rf ${HOME_TMP} | 100 | rm -rf ${HOME_TMP} |
| 89 | 101 | ||
| 90 | # Deploy device credentials | ||
| 91 | if [ -n "$SOTA_CREDENTIALS" ]; then | ||
| 92 | if [ -f "$SOTA_CREDENTIALS" ]; then | ||
| 93 | EXT=`basename $SOTA_CREDENTIALS | cut -d'.' -f2` | ||
| 94 | if [ "$EXT" != "toml" ]; then | ||
| 95 | bbwarn "File\'s extension is not \'toml\', make sure you have the correct file" | ||
| 96 | fi | ||
| 97 | |||
| 98 | cat $SOTA_CREDENTIALS | sed 's/^package_manager = .*$/package_manager = "ostree"/' > ${PHYS_SYSROOT}/boot/sota.toml | ||
| 99 | chmod 644 ${PHYS_SYSROOT}/boot/sota.toml | ||
| 100 | else | ||
| 101 | bberror "File $SOTA_CREDENTIALS does not exist" | ||
| 102 | fi | ||
| 103 | fi | ||
| 104 | |||
| 105 | # Calculate image type | 102 | # Calculate image type |
| 106 | OTA_ROOTFS_SIZE=$(calculate_size `du -ks $PHYS_SYSROOT | cut -f 1` "${IMAGE_OVERHEAD_FACTOR}" "${IMAGE_ROOTFS_SIZE}" "${IMAGE_ROOTFS_MAXSIZE}" `expr ${IMAGE_ROOTFS_EXTRA_SPACE}` "${IMAGE_ROOTFS_ALIGNMENT}") | 103 | OTA_ROOTFS_SIZE=$(calculate_size `du -ks $PHYS_SYSROOT | cut -f 1` "${IMAGE_OVERHEAD_FACTOR}" "${IMAGE_ROOTFS_SIZE}" "${IMAGE_ROOTFS_MAXSIZE}" `expr ${IMAGE_ROOTFS_EXTRA_SPACE}` "${IMAGE_ROOTFS_ALIGNMENT}") |
| 107 | 104 | ||
| @@ -118,7 +115,7 @@ IMAGE_CMD_otaimg () { | |||
| 118 | rm -rf ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.otaimg | 115 | rm -rf ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.otaimg |
| 119 | sync | 116 | sync |
| 120 | dd if=/dev/zero of=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.otaimg seek=$OTA_ROOTFS_SIZE count=$COUNT bs=1024 | 117 | dd if=/dev/zero of=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.otaimg seek=$OTA_ROOTFS_SIZE count=$COUNT bs=1024 |
| 121 | mkfs.ext4 ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.otaimg -d ${PHYS_SYSROOT} | 118 | mkfs.ext4 -O ^64bit ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.otaimg -d ${PHYS_SYSROOT} |
| 122 | rm -rf ${PHYS_SYSROOT} | 119 | rm -rf ${PHYS_SYSROOT} |
| 123 | 120 | ||
| 124 | rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.otaimg | 121 | rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.otaimg |
diff --git a/classes/sdcard_image-dra7xx-evm-ota.bbclass b/classes/sdcard_image-dra7xx-evm-ota.bbclass deleted file mode 100644 index f023649..0000000 --- a/classes/sdcard_image-dra7xx-evm-ota.bbclass +++ /dev/null | |||
| @@ -1,72 +0,0 @@ | |||
| 1 | inherit image_types | ||
| 2 | |||
| 3 | # Boot partition volume id | ||
| 4 | BOOTDD_VOLUME_ID ?= "${MACHINE}" | ||
| 5 | |||
| 6 | # Boot partition size [in KiB] (will be rounded up to IMAGE_ROOTFS_ALIGNMENT) | ||
| 7 | BOOT_SPACE ?= "4096" | ||
| 8 | |||
| 9 | IMAGE_ROOTFS_ALIGNMENT = "4096" | ||
| 10 | SDIMG_OTA_ROOTFS_TYPE ?= "otaimg" | ||
| 11 | SDIMG_OTA_ROOTFS = "${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.${SDIMG_OTA_ROOTFS_TYPE}" | ||
| 12 | |||
| 13 | IMAGE_TYPEDEP_dra7xx-evm-sdimg-ota = "${SDIMG_OTA_ROOTFS_TYPE}" | ||
| 14 | IMAGE_DEPENDS_dra7xx-evm-sdimg-ota = " \ | ||
| 15 | parted-native \ | ||
| 16 | mtools-native \ | ||
| 17 | dosfstools-native \ | ||
| 18 | " | ||
| 19 | |||
| 20 | SDIMG_OTA = "${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.dra7xx-evm-sdimg-ota" | ||
| 21 | |||
| 22 | IMAGE_CMD_dra7xx-evm-sdimg-ota () { | ||
| 23 | OTAROOT_SIZE=`du -Lb ${SDIMG_OTA_ROOTFS} | cut -f1` | ||
| 24 | OTAROOT_SIZE=$(expr ${OTAROOT_SIZE} / 1024 + 1) | ||
| 25 | BOOT_SPACE_ALIGNED=$(expr ${BOOT_SPACE} + ${IMAGE_ROOTFS_ALIGNMENT} - 1) | ||
| 26 | BOOT_SPACE_ALIGNED=$(expr ${BOOT_SPACE_ALIGNED} - ${BOOT_SPACE_ALIGNED} % ${IMAGE_ROOTFS_ALIGNMENT}) | ||
| 27 | SDIMG_OTA_SIZE=$(expr ${IMAGE_ROOTFS_ALIGNMENT} + ${BOOT_SPACE_ALIGNED} + $OTAROOT_SIZE) | ||
| 28 | |||
| 29 | echo "Creating filesystem with Boot partition ${BOOT_SPACE_ALIGNED} KiB and RootFS $OTAROOT_SIZE KiB" | ||
| 30 | |||
| 31 | # Initialize sdcard image file | ||
| 32 | dd if=/dev/zero of=${SDIMG_OTA} bs=1024 count=0 seek=${SDIMG_OTA_SIZE} | ||
| 33 | |||
| 34 | # Create partition table | ||
| 35 | parted -s ${SDIMG_OTA} mklabel msdos | ||
| 36 | # Create boot partition and mark it as bootable | ||
| 37 | parted -s ${SDIMG_OTA} unit KiB mkpart primary fat32 ${IMAGE_ROOTFS_ALIGNMENT} $(expr ${BOOT_SPACE_ALIGNED} \+ ${IMAGE_ROOTFS_ALIGNMENT}) | ||
| 38 | parted -s ${SDIMG_OTA} set 1 boot on | ||
| 39 | # Create rootfs partition to the end of disk | ||
| 40 | parted -s ${SDIMG_OTA} -- unit KiB mkpart primary ext2 $(expr ${BOOT_SPACE_ALIGNED} \+ ${IMAGE_ROOTFS_ALIGNMENT}) -1s | ||
| 41 | parted ${SDIMG_OTA} print | ||
| 42 | |||
| 43 | # Create a vfat image with boot files | ||
| 44 | BOOT_BLOCKS=$(LC_ALL=C parted -s ${SDIMG_OTA} unit b print | awk '/ 1 / { print substr($4, 1, length($4 -1)) / 512 /2 }') | ||
| 45 | rm -f ${WORKDIR}/boot.img | ||
| 46 | mkfs.vfat -n "${BOOTDD_VOLUME_ID}" -S 512 -C ${WORKDIR}/boot.img $BOOT_BLOCKS | ||
| 47 | sync | ||
| 48 | |||
| 49 | sync | ||
| 50 | #dd if=${WORKDIR}/boot.img of=${SDIMG_OTA} conv=notrunc seek=1 bs=$(expr ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync | ||
| 51 | |||
| 52 | if echo "${SDIMG_OTA_ROOTFS_TYPE}" | egrep -q "*\.xz" | ||
| 53 | then | ||
| 54 | xzcat ${SDIMG_OTA_ROOTFS} | dd of=${SDIMG_OTA} conv=notrunc seek=1 bs=$(expr 1024 \* ${BOOT_SPACE_ALIGNED} + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync | ||
| 55 | else | ||
| 56 | dd if=${SDIMG_OTA_ROOTFS} of=${SDIMG_OTA} conv=notrunc seek=1 bs=$(expr 1024 \* ${BOOT_SPACE_ALIGNED} + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync | ||
| 57 | fi | ||
| 58 | |||
| 59 | # Optionally apply compression | ||
| 60 | case "${SDIMG_OTA_COMPRESSION}" in | ||
| 61 | "gzip") | ||
| 62 | gzip -k9 "${SDIMG_OTA}" | ||
| 63 | ;; | ||
| 64 | "bzip2") | ||
| 65 | bzip2 -k9 "${SDIMG_OTA}" | ||
| 66 | ;; | ||
| 67 | "xz") | ||
| 68 | xz -k "${SDIMG_OTA}" | ||
| 69 | ;; | ||
| 70 | esac | ||
| 71 | } | ||
| 72 | |||
diff --git a/classes/sdcard_image-minnowboard-ota.bbclass b/classes/sdcard_image-minnowboard-ota.bbclass deleted file mode 100644 index c49b3cd..0000000 --- a/classes/sdcard_image-minnowboard-ota.bbclass +++ /dev/null | |||
| @@ -1,78 +0,0 @@ | |||
| 1 | inherit image_types | ||
| 2 | |||
| 3 | # Boot partition volume id | ||
| 4 | BOOTDD_VOLUME_ID ?= "${MACHINE}" | ||
| 5 | |||
| 6 | # Boot partition size [in KiB] (will be rounded up to IMAGE_ROOTFS_ALIGNMENT) | ||
| 7 | BOOT_SPACE ?= "4096" | ||
| 8 | |||
| 9 | IMAGE_ROOTFS_ALIGNMENT = "4096" | ||
| 10 | SDIMG_OTA_ROOTFS_TYPE ?= "otaimg" | ||
| 11 | SDIMG_OTA_ROOTFS = "${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.${SDIMG_OTA_ROOTFS_TYPE}" | ||
| 12 | |||
| 13 | IMAGE_TYPEDEP_minnowboard-sdimg-ota = "${SDIMG_OTA_ROOTFS_TYPE}" | ||
| 14 | IMAGE_DEPENDS_minnowboard-sdimg-ota = " \ | ||
| 15 | parted-native \ | ||
| 16 | mtools-native \ | ||
| 17 | dosfstools-native \ | ||
| 18 | minnowboard-bootfiles \ | ||
| 19 | " | ||
| 20 | |||
| 21 | SDIMG_OTA = "${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.minnowboard-sdimg-ota" | ||
| 22 | |||
| 23 | IMAGE_CMD_minnowboard-sdimg-ota () { | ||
| 24 | OTAROOT_SIZE=`du -Lb ${SDIMG_OTA_ROOTFS} | cut -f1` | ||
| 25 | OTAROOT_SIZE=$(expr ${OTAROOT_SIZE} / 1024 + 1) | ||
| 26 | BOOT_SPACE_ALIGNED=$(expr ${BOOT_SPACE} + ${IMAGE_ROOTFS_ALIGNMENT} - 1) | ||
| 27 | BOOT_SPACE_ALIGNED=$(expr ${BOOT_SPACE_ALIGNED} - ${BOOT_SPACE_ALIGNED} % ${IMAGE_ROOTFS_ALIGNMENT}) | ||
| 28 | SDIMG_OTA_SIZE=$(expr ${IMAGE_ROOTFS_ALIGNMENT} + ${BOOT_SPACE_ALIGNED} + $OTAROOT_SIZE) | ||
| 29 | |||
| 30 | echo "Creating filesystem with Boot partition ${BOOT_SPACE_ALIGNED} KiB and RootFS $OTAROOT_SIZE KiB" | ||
| 31 | |||
| 32 | # Initialize sdcard image file | ||
| 33 | dd if=/dev/zero of=${SDIMG_OTA} bs=1024 count=0 seek=${SDIMG_OTA_SIZE} | ||
| 34 | |||
| 35 | # Create partition table | ||
| 36 | parted -s ${SDIMG_OTA} mklabel msdos | ||
| 37 | # Create boot partition and mark it as bootable | ||
| 38 | parted -s ${SDIMG_OTA} unit KiB mkpart primary fat32 ${IMAGE_ROOTFS_ALIGNMENT} $(expr ${BOOT_SPACE_ALIGNED} \+ ${IMAGE_ROOTFS_ALIGNMENT}) | ||
| 39 | parted -s ${SDIMG_OTA} set 1 boot on | ||
| 40 | # Create rootfs partition to the end of disk | ||
| 41 | parted -s ${SDIMG_OTA} -- unit KiB mkpart primary ext2 $(expr ${BOOT_SPACE_ALIGNED} \+ ${IMAGE_ROOTFS_ALIGNMENT}) -1s | ||
| 42 | parted ${SDIMG_OTA} print | ||
| 43 | |||
| 44 | # Create a vfat image with boot files | ||
| 45 | BOOT_BLOCKS=$(LC_ALL=C parted -s ${SDIMG_OTA} unit b print | awk '/ 1 / { print substr($4, 1, length($4 -1)) / 512 /2 }') | ||
| 46 | rm -f ${WORKDIR}/boot.img | ||
| 47 | mkfs.vfat -n "${BOOTDD_VOLUME_ID}" -S 512 -C ${WORKDIR}/boot.img $BOOT_BLOCKS | ||
| 48 | sync | ||
| 49 | |||
| 50 | mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/minnowboard-bootfiles/* ::/ | ||
| 51 | |||
| 52 | sync | ||
| 53 | dd if=${WORKDIR}/boot.img of=${SDIMG_OTA} conv=notrunc seek=1 bs=$(expr ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync | ||
| 54 | |||
| 55 | if echo "${SDIMG_OTA_ROOTFS_TYPE}" | egrep -q "*\.xz" | ||
| 56 | then | ||
| 57 | xzcat ${SDIMG_OTA_ROOTFS} | dd of=${SDIMG_OTA} conv=notrunc seek=1 bs=$(expr 1024 \* ${BOOT_SPACE_ALIGNED} + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync | ||
| 58 | else | ||
| 59 | dd if=${SDIMG_OTA_ROOTFS} of=${SDIMG_OTA} conv=notrunc seek=1 bs=$(expr 1024 \* ${BOOT_SPACE_ALIGNED} + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync | ||
| 60 | fi | ||
| 61 | |||
| 62 | # Optionally apply compression | ||
| 63 | case "${SDIMG_OTA_COMPRESSION}" in | ||
| 64 | "gzip") | ||
| 65 | gzip -k9 "${SDIMG_OTA}" | ||
| 66 | ;; | ||
| 67 | "bzip2") | ||
| 68 | bzip2 -k9 "${SDIMG_OTA}" | ||
| 69 | ;; | ||
| 70 | "xz") | ||
| 71 | xz -k "${SDIMG_OTA}" | ||
| 72 | ;; | ||
| 73 | esac | ||
| 74 | |||
| 75 | rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.minnowboard-sdimg-ota | ||
| 76 | ln -s ${IMAGE_NAME}.minnowboard-sdimg-ota ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.minnowboard-sdimg-ota | ||
| 77 | } | ||
| 78 | |||
diff --git a/classes/sdcard_image-porter-ota.bbclass b/classes/sdcard_image-porter-ota.bbclass deleted file mode 100644 index 5909b44..0000000 --- a/classes/sdcard_image-porter-ota.bbclass +++ /dev/null | |||
| @@ -1,78 +0,0 @@ | |||
| 1 | inherit image_types | ||
| 2 | |||
| 3 | # Boot partition volume id | ||
| 4 | BOOTDD_VOLUME_ID ?= "${MACHINE}" | ||
| 5 | |||
| 6 | # Boot partition size [in KiB] (will be rounded up to IMAGE_ROOTFS_ALIGNMENT) | ||
| 7 | BOOT_SPACE ?= "4096" | ||
| 8 | |||
| 9 | IMAGE_ROOTFS_ALIGNMENT = "4096" | ||
| 10 | SDIMG_OTA_ROOTFS_TYPE ?= "otaimg" | ||
| 11 | SDIMG_OTA_ROOTFS = "${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.${SDIMG_OTA_ROOTFS_TYPE}" | ||
| 12 | |||
| 13 | IMAGE_TYPEDEP_porter-sdimg-ota = "${SDIMG_OTA_ROOTFS_TYPE}" | ||
| 14 | IMAGE_DEPENDS_porter-sdimg-ota = " \ | ||
| 15 | parted-native \ | ||
| 16 | mtools-native \ | ||
| 17 | dosfstools-native \ | ||
| 18 | porter-bootfiles \ | ||
| 19 | " | ||
| 20 | |||
| 21 | SDIMG_OTA = "${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.porter-sdimg-ota" | ||
| 22 | |||
| 23 | IMAGE_CMD_porter-sdimg-ota () { | ||
| 24 | OTAROOT_SIZE=`du -Lb ${SDIMG_OTA_ROOTFS} | cut -f1` | ||
| 25 | OTAROOT_SIZE=$(expr ${OTAROOT_SIZE} / 1024 + 1) | ||
| 26 | BOOT_SPACE_ALIGNED=$(expr ${BOOT_SPACE} + ${IMAGE_ROOTFS_ALIGNMENT} - 1) | ||
| 27 | BOOT_SPACE_ALIGNED=$(expr ${BOOT_SPACE_ALIGNED} - ${BOOT_SPACE_ALIGNED} % ${IMAGE_ROOTFS_ALIGNMENT}) | ||
| 28 | SDIMG_OTA_SIZE=$(expr ${IMAGE_ROOTFS_ALIGNMENT} + ${BOOT_SPACE_ALIGNED} + $OTAROOT_SIZE) | ||
| 29 | |||
| 30 | echo "Creating filesystem with Boot partition ${BOOT_SPACE_ALIGNED} KiB and RootFS $OTAROOT_SIZE KiB" | ||
| 31 | |||
| 32 | # Initialize sdcard image file | ||
| 33 | dd if=/dev/zero of=${SDIMG_OTA} bs=1024 count=0 seek=${SDIMG_OTA_SIZE} | ||
| 34 | |||
| 35 | # Create partition table | ||
| 36 | parted -s ${SDIMG_OTA} mklabel msdos | ||
| 37 | # Create boot partition and mark it as bootable | ||
| 38 | parted -s ${SDIMG_OTA} unit KiB mkpart primary fat32 ${IMAGE_ROOTFS_ALIGNMENT} $(expr ${BOOT_SPACE_ALIGNED} \+ ${IMAGE_ROOTFS_ALIGNMENT}) | ||
| 39 | parted -s ${SDIMG_OTA} set 1 boot on | ||
| 40 | # Create rootfs partition to the end of disk | ||
| 41 | parted -s ${SDIMG_OTA} -- unit KiB mkpart primary ext2 $(expr ${BOOT_SPACE_ALIGNED} \+ ${IMAGE_ROOTFS_ALIGNMENT}) -1s | ||
| 42 | parted ${SDIMG_OTA} print | ||
| 43 | |||
| 44 | # Create a vfat image with boot files | ||
| 45 | BOOT_BLOCKS=$(LC_ALL=C parted -s ${SDIMG_OTA} unit b print | awk '/ 1 / { print substr($4, 1, length($4 -1)) / 512 /2 }') | ||
| 46 | rm -f ${WORKDIR}/boot.img | ||
| 47 | mkfs.vfat -n "${BOOTDD_VOLUME_ID}" -S 512 -C ${WORKDIR}/boot.img $BOOT_BLOCKS | ||
| 48 | sync | ||
| 49 | |||
| 50 | mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/porter-bootfiles/* ::/ | ||
| 51 | |||
| 52 | sync | ||
| 53 | dd if=${WORKDIR}/boot.img of=${SDIMG_OTA} conv=notrunc seek=1 bs=$(expr ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync | ||
| 54 | |||
| 55 | if echo "${SDIMG_OTA_ROOTFS_TYPE}" | egrep -q "*\.xz" | ||
| 56 | then | ||
| 57 | xzcat ${SDIMG_OTA_ROOTFS} | dd of=${SDIMG_OTA} conv=notrunc seek=1 bs=$(expr 1024 \* ${BOOT_SPACE_ALIGNED} + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync | ||
| 58 | else | ||
| 59 | dd if=${SDIMG_OTA_ROOTFS} of=${SDIMG_OTA} conv=notrunc seek=1 bs=$(expr 1024 \* ${BOOT_SPACE_ALIGNED} + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync | ||
| 60 | fi | ||
| 61 | |||
| 62 | rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.porter-sdimg-ota | ||
| 63 | ln -s ${IMAGE_NAME}.porter-sdimg-ota ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.porter-sdimg-ota | ||
| 64 | |||
| 65 | # Optionally apply compression | ||
| 66 | case "${SDIMG_OTA_COMPRESSION}" in | ||
| 67 | "gzip") | ||
| 68 | gzip -k9 "${SDIMG_OTA}" | ||
| 69 | ;; | ||
| 70 | "bzip2") | ||
| 71 | bzip2 -k9 "${SDIMG_OTA}" | ||
| 72 | ;; | ||
| 73 | "xz") | ||
| 74 | xz -k "${SDIMG_OTA}" | ||
| 75 | ;; | ||
| 76 | esac | ||
| 77 | } | ||
| 78 | |||
diff --git a/classes/sdcard_image-rpi-ota.bbclass b/classes/sdcard_image-rpi-ota.bbclass index cb0c597..f5c35a2 100644 --- a/classes/sdcard_image-rpi-ota.bbclass +++ b/classes/sdcard_image-rpi-ota.bbclass | |||
| @@ -72,6 +72,8 @@ SDIMG_OTA = "${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.rpi-sdimg-ota" | |||
| 72 | # Additional files and/or directories to be copied into the vfat partition from the IMAGE_ROOTFS. | 72 | # Additional files and/or directories to be copied into the vfat partition from the IMAGE_ROOTFS. |
| 73 | FATPAYLOAD ?= "" | 73 | FATPAYLOAD ?= "" |
| 74 | 74 | ||
| 75 | IMAGEDATESTAMP = "${@time.strftime('%Y.%m.%d',time.gmtime())}" | ||
| 76 | IMAGE_CMD_rpi-sdimg-ota[vardepsexclude] += "IMAGEDATESTAMP" | ||
| 75 | IMAGE_CMD_rpi-sdimg-ota[vardepsexclude] += "DATETIME" | 77 | IMAGE_CMD_rpi-sdimg-ota[vardepsexclude] += "DATETIME" |
| 76 | 78 | ||
| 77 | IMAGE_CMD_rpi-sdimg-ota () { | 79 | IMAGE_CMD_rpi-sdimg-ota () { |
| @@ -123,8 +125,10 @@ IMAGE_CMD_rpi-sdimg-ota () { | |||
| 123 | # Copy device tree overlays to dedicated folder | 125 | # Copy device tree overlays to dedicated folder |
| 124 | mmd -i ${WORKDIR}/boot.img overlays | 126 | mmd -i ${WORKDIR}/boot.img overlays |
| 125 | for DTB in ${DT_OVERLAYS}; do | 127 | for DTB in ${DT_OVERLAYS}; do |
| 126 | DTB_BASE_NAME=`basename ${DTB} .dtb` | 128 | DTB_EXT=${DTB##*.} |
| 127 | mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTB_BASE_NAME}.dtb ::overlays/${DTB_BASE_NAME}.dtbo | 129 | DTB_BASE_NAME=`basename ${DTB} ."${DTB_EXT}"` |
| 130 | |||
| 131 | mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTB_BASE_NAME}.${DTB_EXT} ::overlays/${DTB_BASE_NAME}.${DTB_EXT} | ||
| 128 | done | 132 | done |
| 129 | fi | 133 | fi |
| 130 | 134 | ||
| @@ -145,6 +149,10 @@ IMAGE_CMD_rpi-sdimg-ota () { | |||
| 145 | done | 149 | done |
| 146 | fi | 150 | fi |
| 147 | 151 | ||
| 152 | # Add stamp file | ||
| 153 | echo "${IMAGE_NAME}-${IMAGEDATESTAMP}" > ${WORKDIR}/image-version-info | ||
| 154 | mcopy -i ${WORKDIR}/boot.img -v ${WORKDIR}//image-version-info :: | ||
| 155 | |||
| 148 | # Burn Partitions | 156 | # Burn Partitions |
| 149 | sync | 157 | sync |
| 150 | dd if=${WORKDIR}/boot.img of=${SDIMG_OTA} conv=notrunc seek=1 bs=$(expr ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync | 158 | dd if=${WORKDIR}/boot.img of=${SDIMG_OTA} conv=notrunc seek=1 bs=$(expr ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync |
| @@ -171,6 +179,9 @@ IMAGE_CMD_rpi-sdimg-ota () { | |||
| 171 | xz -k "${SDIMG_OTA}" | 179 | xz -k "${SDIMG_OTA}" |
| 172 | ;; | 180 | ;; |
| 173 | esac | 181 | esac |
| 182 | |||
| 183 | rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.rootfs.rpi-sdimg-ota | ||
| 184 | ln -s ${IMAGE_NAME}.rootfs.rpi-sdimg-ota ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.rootfs.rpi-sdimg-ota | ||
| 174 | } | 185 | } |
| 175 | 186 | ||
| 176 | ROOTFS_POSTPROCESS_COMMAND += " rpi_generate_sysctl_config ; " | 187 | ROOTFS_POSTPROCESS_COMMAND += " rpi_generate_sysctl_config ; " |
diff --git a/conf/distro/sota.conf.inc b/conf/distro/sota.conf.inc index 23e5a43..55e9cac 100644 --- a/conf/distro/sota.conf.inc +++ b/conf/distro/sota.conf.inc | |||
| @@ -1,8 +1,20 @@ | |||
| 1 | IMAGE_INSTALL_append = " ostree rvi-sota-client" | 1 | DISTRO_FEATURES_append = " sota" |
| 2 | OVERRIDES .= ":sota" | ||
| 3 | |||
| 4 | IMAGE_INSTALL_append = " ostree os-release" | ||
| 2 | 5 | ||
| 3 | # live image for OSTree-enabled systems | 6 | # live image for OSTree-enabled systems |
| 4 | IMAGE_CLASSES_append = " image_types_ostree image_types_ota" | 7 | IMAGE_CLASSES += "image_types_ostree image_types_ota" |
| 5 | IMAGE_FSTYPES += "ostreepush otaimg" | 8 | IMAGE_FSTYPES += "ostreepush otaimg wic" |
| 9 | WKS_FILE = "sdimage-sota.wks" | ||
| 10 | do_image_wic[depends] += "${IMAGE_BASENAME}:do_image_otaimg" | ||
| 11 | |||
| 12 | # No working WKS for Raspberry Pi yet | ||
| 13 | IMAGE_FSTYPES_remove_raspberrypi3 = "wic" | ||
| 14 | IMAGE_FSTYPES_remove_raspberrypi2 = "wic" | ||
| 15 | |||
| 16 | # QEMU emulation uses plain otaimg, no wic needed | ||
| 17 | IMAGE_FSTYPES_remove_qemux86-64 = "wic" | ||
| 6 | 18 | ||
| 7 | # Please redefine OSTREE_REPO in order to have a persistent OSTree repo | 19 | # Please redefine OSTREE_REPO in order to have a persistent OSTree repo |
| 8 | OSTREE_REPO ?= "${DEPLOY_DIR_IMAGE}/ostree_repo" | 20 | OSTREE_REPO ?= "${DEPLOY_DIR_IMAGE}/ostree_repo" |
| @@ -10,36 +22,3 @@ OSTREE_BRANCHNAME ?= "ota-${MACHINE}" | |||
| 10 | OSTREE_OSNAME ?= "poky" | 22 | OSTREE_OSNAME ?= "poky" |
| 11 | OSTREE_INITRAMFS_IMAGE ?= "initramfs-ostree-image" | 23 | OSTREE_INITRAMFS_IMAGE ?= "initramfs-ostree-image" |
| 12 | 24 | ||
| 13 | # Platform-specific configurations | ||
| 14 | |||
| 15 | ## RaspberryPi | ||
| 16 | IMAGE_CLASSES_append_raspberrypi2 = " image_types_uboot sdcard_image-rpi-ota" | ||
| 17 | IMAGE_CLASSES_append_raspberrypi3 = " image_types_uboot sdcard_image-rpi-ota" | ||
| 18 | IMAGE_FSTYPES += "${@'rpi-sdimg-ota' if d.getVar('MACHINE', True).startswith('raspberrypi') else ''}" | ||
| 19 | IMAGE_FSTYPES_remove = "rpi-sdimg" | ||
| 20 | |||
| 21 | KERNEL_IMAGETYPE_raspberrypi2 = "uImage" | ||
| 22 | KERNEL_IMAGETYPE_raspberrypi3 = "uImage" | ||
| 23 | |||
| 24 | UBOOT_MACHINE_raspberrypi2 = "rpi_2_defconfig" | ||
| 25 | UBOOT_MACHINE_raspberrypi3 = "rpi_3_32b_defconfig" | ||
| 26 | PREFERRED_PROVIDER_virtual/bootloader_raspberrypi2 = "u-boot" | ||
| 27 | PREFERRED_PROVIDER_virtual/bootloader_raspberrypi3 = "u-boot" | ||
| 28 | |||
| 29 | # Some BSPs (e.g. meta-raspberrypi) use this variable to turn debug on/off | ||
| 30 | DISTRO_TYPE ?= "${@bb.utils.contains("IMAGE_FEATURES", "debug-tweaks", "debug", "release",d)}" | ||
| 31 | |||
| 32 | ## Minnowboard | ||
| 33 | PREFERRED_PROVIDER_virtual/bootloader_intel-corei7-64 = "u-boot-ota" | ||
| 34 | UBOOT_MACHINE_intel-corei7-64 = "minnowmax_defconfig" | ||
| 35 | IMAGE_CLASSES_append_intel-corei7-64 = " sdcard_image-minnowboard-ota" | ||
| 36 | IMAGE_FSTYPES += "${@'minnowboard-sdimg-ota' if d.getVar('MACHINE', True).startswith('intel-corei7-64') else ''}" | ||
| 37 | |||
| 38 | ## QEMU | ||
| 39 | PREFERRED_PROVIDER_virtual/bootloader_qemux86 = "u-boot-ota" | ||
| 40 | UBOOT_MACHINE_qemux86 = "qemu-x86_defconfig" | ||
| 41 | PREFERRED_PROVIDER_virtual/bootloader_qemux86-64= "u-boot-ota" | ||
| 42 | UBOOT_MACHINE_qemux86-64 = "qemu-x86_defconfig" | ||
| 43 | |||
| 44 | DISTROOVERRIDES_append = ":sota" | ||
| 45 | DISTRO_FEATURES_append = " sota" | ||
diff --git a/conf/include/bblayers/sota.inc b/conf/include/bblayers/sota.inc new file mode 100644 index 0000000..97edecb --- /dev/null +++ b/conf/include/bblayers/sota.inc | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | |||
| 2 | BBLAYERS += "${METADIR}/meta-updater" | ||
| 3 | BBLAYERS += "${METADIR}/meta-openembedded/meta-filesystems" | ||
| 4 | BBLAYERS += "${METADIR}/meta-openembedded/meta-oe" | ||
| 5 | BBLAYERS += "${METADIR}/meta-rust" | ||
diff --git a/conf/include/bblayers/sota_minnowboard.inc b/conf/include/bblayers/sota_minnowboard.inc new file mode 100644 index 0000000..1771e6c --- /dev/null +++ b/conf/include/bblayers/sota_minnowboard.inc | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | |||
| 2 | BBLAYERS += " ${METADIR}/meta-updater-minnowboard ${METADIR}/meta-intel " | ||
diff --git a/conf/include/bblayers/sota_porter.inc b/conf/include/bblayers/sota_porter.inc new file mode 100644 index 0000000..a0888d5 --- /dev/null +++ b/conf/include/bblayers/sota_porter.inc | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | |||
| 2 | BBLAYERS += " ${METADIR}/meta-updater-porter ${METADIR}/meta-renesas " | ||
diff --git a/conf/include/bblayers/sota_qemux86-64.inc b/conf/include/bblayers/sota_qemux86-64.inc new file mode 100644 index 0000000..22ace81 --- /dev/null +++ b/conf/include/bblayers/sota_qemux86-64.inc | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | |||
| 2 | BBLAYERS += " ${METADIR}/meta-updater-qemux86-64 " | ||
diff --git a/conf/include/bblayers/sota_raspberrypi.inc b/conf/include/bblayers/sota_raspberrypi.inc new file mode 100644 index 0000000..11ede20 --- /dev/null +++ b/conf/include/bblayers/sota_raspberrypi.inc | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | |||
| 2 | BBLAYERS += " ${METADIR}/meta-updater-raspberrypi ${METADIR}/meta-raspberrypi " | ||
diff --git a/conf/include/local/sota_minnowboard.inc b/conf/include/local/sota_minnowboard.inc new file mode 100644 index 0000000..b3702a2 --- /dev/null +++ b/conf/include/local/sota_minnowboard.inc | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | MACHINE = "intel-corei7-64" | ||
| 2 | |||
| 3 | PREFERRED_PROVIDER_virtual/bootloader = "u-boot-ota" | ||
| 4 | UBOOT_MACHINE = "minnowmax_defconfig" | ||
| 5 | IMAGE_CLASSES_append = " sdcard_image-minnowboard-ota" | ||
| 6 | IMAGE_FSTYPES += "minnowboard-sdimg-ota" | ||
diff --git a/conf/include/local/sota_porter.inc b/conf/include/local/sota_porter.inc new file mode 100644 index 0000000..e079e4d --- /dev/null +++ b/conf/include/local/sota_porter.inc | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | MACHINE = "porter" | ||
| 2 | |||
| 3 | # Commit united image to OSTree, not just uImage | ||
| 4 | OSTREE_KERNEL = "uImage+dtb" | ||
| 5 | |||
| 6 | IMAGE_CLASSES_append = " image_types_uboot " | ||
| 7 | IMAGE_BOOT_FILES = "porter-bootfiles/*" | ||
| 8 | |||
| 9 | OSTREE_BOOTLOADER ?= "u-boot" | ||
| 10 | UBOOT_MACHINE = "porter_vin_config" | ||
| 11 | |||
diff --git a/conf/include/local/sota_qemux86-64.inc b/conf/include/local/sota_qemux86-64.inc new file mode 100644 index 0000000..b72c29d --- /dev/null +++ b/conf/include/local/sota_qemux86-64.inc | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | MACHINE = "qemux86-64" | ||
| 2 | |||
| 3 | PREFERRED_VERSION_gcc-cross-${TARGET_ARCH} ?= "5.4%" | ||
| 4 | PREFERRED_VERSION_libgcc ?= "5.4%" | ||
| 5 | PREFERRED_VERSION_gcc-runtime ?= "5.4%" | ||
| 6 | |||
| 7 | # U-Boot support for SOTA | ||
| 8 | PREFERRED_PROVIDER_virtual/bootloader_sota = "u-boot-ota" | ||
| 9 | UBOOT_MACHINE = "qemu-x86_defconfig" | ||
| 10 | OSTREE_BOOTLOADER ?= "u-boot" | ||
| 11 | |||
| 12 | OSTREE_KERNEL_ARGS ?= "ramdisk_size=16384 rw rootfstype=ext4 rootwait rootdelay=2 ostree_root=/dev/hda" | ||
diff --git a/conf/include/local/sota_raspberrypi.inc b/conf/include/local/sota_raspberrypi.inc new file mode 100644 index 0000000..51919f0 --- /dev/null +++ b/conf/include/local/sota_raspberrypi.inc | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | MACHINE ?= "raspberrypi3" | ||
| 2 | |||
| 3 | # normal image class is sdcard_image-rpi-gdp, for sota it is image_types_uboot & sdcard_image-rpi-ota | ||
| 4 | IMAGE_CLASSES += "image_types_uboot sdcard_image-rpi-ota" | ||
| 5 | |||
| 6 | # normal image is rpi-sdimg, for sota it is rpi-sdimg-ota | ||
| 7 | IMAGE_FSTYPES += "rpi-sdimg-ota" | ||
| 8 | ### both rpi-sdimg and rpi-sdimg-ota broken | ||
| 9 | IMAGE_FSTYPES += "ext4.xz ext4.bmap tar.xz" | ||
| 10 | |||
| 11 | KERNEL_IMAGETYPE_sota = "uImage" | ||
| 12 | PREFERRED_PROVIDER_virtual/bootloader = "u-boot" | ||
| 13 | UBOOT_MACHINE_raspberrypi2 = "rpi_2_defconfig" | ||
| 14 | UBOOT_MACHINE_raspberrypi3 = "rpi_3_32b_defconfig" | ||
| 15 | |||
| 16 | OSTREE_BOOTLOADER ?= "u-boot" | ||
diff --git a/recipes-sota/ostree/ostree_git.bb b/recipes-sota/ostree/ostree_git.bb index 5775dfa..102b70f 100644 --- a/recipes-sota/ostree/ostree_git.bb +++ b/recipes-sota/ostree/ostree_git.bb | |||
| @@ -8,7 +8,9 @@ INHERIT_remove_class-native = "systemd" | |||
| 8 | 8 | ||
| 9 | SRC_URI = "gitsm://github.com/ostreedev/ostree.git;branch=master" | 9 | SRC_URI = "gitsm://github.com/ostreedev/ostree.git;branch=master" |
| 10 | 10 | ||
| 11 | SRCREV="6517a8a27a1386e7cb5482e7cb2919fe92721ccf" | 11 | SRCREV="3b09620c2738bce4ed45e099cf2e4c5df7671d39" |
| 12 | |||
| 13 | PV = "2017.3-31-g3b09620c" | ||
| 12 | 14 | ||
| 13 | S = "${WORKDIR}/git" | 15 | S = "${WORKDIR}/git" |
| 14 | 16 | ||
| @@ -16,16 +18,20 @@ BBCLASSEXTEND = "native" | |||
| 16 | 18 | ||
| 17 | DEPENDS += "attr libarchive glib-2.0 pkgconfig gpgme libgsystem fuse libsoup-2.4 e2fsprogs gtk-doc-native" | 19 | DEPENDS += "attr libarchive glib-2.0 pkgconfig gpgme libgsystem fuse libsoup-2.4 e2fsprogs gtk-doc-native" |
| 18 | DEPENDS_append = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', ' systemd', '', d)}" | 20 | DEPENDS_append = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', ' systemd', '', d)}" |
| 19 | |||
| 20 | DEPENDS_remove_class-native = "systemd-native" | 21 | DEPENDS_remove_class-native = "systemd-native" |
| 21 | 22 | ||
| 22 | RDEPENDS_${PN} = "python util-linux-libuuid util-linux-libblkid util-linux-libmount libcap xz os-release ca-certificates" | 23 | RDEPENDS_${PN} = "python util-linux-libuuid util-linux-libblkid util-linux-libmount libcap xz bash" |
| 23 | RDEPENDS_${PN}_remove_class-native = "python-native os-release-native" | 24 | RDEPENDS_${PN}_remove_class-native = "python-native" |
| 24 | 25 | ||
| 25 | EXTRA_OECONF = "CFLAGS='-g' --with-libarchive --disable-gtk-doc --disable-gtk-doc-html --disable-gtk-doc-pdf --disable-man" | 26 | EXTRA_OECONF = "--with-libarchive --disable-gtk-doc --disable-gtk-doc-html --disable-gtk-doc-pdf --disable-man --with-smack --with-builtin-grub2-mkconfig" |
| 26 | EXTRA_OEMAKE = "CFLAGS='-g'" | ||
| 27 | EXTRA_OECONF_append_class-native = " --enable-wrpseudo-compat" | 27 | EXTRA_OECONF_append_class-native = " --enable-wrpseudo-compat" |
| 28 | 28 | ||
| 29 | # Path to ${prefix}/lib/ostree/ostree-grub-generator is hardcoded on the | ||
| 30 | # do_configure stage so we do depend on it | ||
| 31 | SYSROOT_DIR = "${STAGING_DIR_TARGET}" | ||
| 32 | SYSROOT_DIR_class-native = "${STAGING_DIR_NATIVE}" | ||
| 33 | do_configure[vardeps] += "SYSROOT_DIR" | ||
| 34 | |||
| 29 | SYSTEMD_REQUIRED = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}" | 35 | SYSTEMD_REQUIRED = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}" |
| 30 | SYSTEMD_REQUIRED_class-native = "" | 36 | SYSTEMD_REQUIRED_class-native = "" |
| 31 | 37 | ||
| @@ -55,7 +61,7 @@ do_compile_prepend() { | |||
| 55 | export SYSTEMD_REQUIRED | 61 | export SYSTEMD_REQUIRED |
| 56 | 62 | ||
| 57 | do_install_append() { | 63 | do_install_append() { |
| 58 | if [ -n $SYSTEMD_REQUIRED ]; then | 64 | if [ -n ${SYSTEMD_REQUIRED} ]; then |
| 59 | install -p -D ${S}/src/boot/ostree-prepare-root.service ${D}${systemd_unitdir}/system/ostree-prepare-root.service | 65 | install -p -D ${S}/src/boot/ostree-prepare-root.service ${D}${systemd_unitdir}/system/ostree-prepare-root.service |
| 60 | install -p -D ${S}/src/boot/ostree-remount.service ${D}${systemd_unitdir}/system/ostree-remount.service | 66 | install -p -D ${S}/src/boot/ostree-remount.service ${D}${systemd_unitdir}/system/ostree-remount.service |
| 61 | fi | 67 | fi |
diff --git a/recipes-sota/rvi-sota-client/rvi-sota-client_git.bb b/recipes-sota/rvi-sota-client/rvi-sota-client_git.bb index c469ac7..9a3dbf9 100644 --- a/recipes-sota/rvi-sota-client/rvi-sota-client_git.bb +++ b/recipes-sota/rvi-sota-client/rvi-sota-client_git.bb | |||
| @@ -8,107 +8,154 @@ inherit cargo systemd | |||
| 8 | 8 | ||
| 9 | S = "${WORKDIR}/git" | 9 | S = "${WORKDIR}/git" |
| 10 | 10 | ||
| 11 | SRCREV = "022cf8501f9eb84bf334a2490e6e0c67842882ab" | 11 | # When changing this, don't forget to: |
| 12 | # 1) Update PV | ||
| 13 | # 2) Check that Cargo.lock hasn't changed with git diff old..new Cargo.lock | ||
| 14 | SRCREV = "878aa386e61bc253e4fae624ae62507710cd23f3" | ||
| 12 | 15 | ||
| 13 | # Generate with: | 16 | # Generate with: |
| 14 | # git describe --tags | cut -b2- | 17 | # git describe --tags | cut -b2- |
| 15 | PV = "0.2.30-2-g022cf85" | 18 | # or from the rvi_sota_client repo: |
| 19 | # make package-version | ||
| 20 | PV = "0.2.32-131-g878aa38" | ||
| 16 | 21 | ||
| 17 | BBCLASSEXTEND = "native" | 22 | BBCLASSEXTEND = "native" |
| 18 | 23 | ||
| 19 | FILES_${PN} = " \ | 24 | FILES_${PN} = " \ |
| 25 | /lib64 \ | ||
| 26 | ${bindir}/canonical_json.py \ | ||
| 20 | ${bindir}/sota_client \ | 27 | ${bindir}/sota_client \ |
| 21 | ${bindir}/sota_sysinfo.sh \ | 28 | ${bindir}/sota_sysinfo.sh \ |
| 22 | ${bindir}/system_info.sh \ | 29 | ${bindir}/system_info.sh \ |
| 23 | ${bindir}/sota_ostree.sh \ | 30 | ${bindir}/sota_ostree.sh \ |
| 31 | ${bindir}/sota_prov.sh \ | ||
| 24 | ${sysconfdir}/sota_client.version \ | 32 | ${sysconfdir}/sota_client.version \ |
| 25 | ${sysconfdir}/sota_certificates \ | 33 | ${sysconfdir}/sota_certificates \ |
| 34 | /var/sota/sota_provisioning_credentials.p12 \ | ||
| 35 | /var/sota/sota_provisioning_url.env \ | ||
| 36 | ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_unitdir}/system/sota_client_autoprovision.service', '', d)} \ | ||
| 26 | ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_unitdir}/system/sota_client.service', '', d)} \ | 37 | ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_unitdir}/system/sota_client.service', '', d)} \ |
| 27 | " | 38 | " |
| 28 | 39 | ||
| 40 | # list of dependencies can be generated from Cargo.lock by running | ||
| 41 | # cat Cargo.lock | sed -e '1,/metadata/ d' Cargo.lock | awk '{print "crate://crates.io/"$2 "/" $3" \\"}' | ||
| 29 | SRC_URI = " \ | 42 | SRC_URI = " \ |
| 30 | crate://crates.io/aho-corasick/0.5.3 \ | 43 | crate://crates.io/aho-corasick/0.5.3 \ |
| 31 | crate://crates.io/bit-set/0.2.0 \ | 44 | crate://crates.io/aho-corasick/0.6.3 \ |
| 45 | crate://crates.io/base64/0.4.1 \ | ||
| 46 | crate://crates.io/bit-set/0.4.0 \ | ||
| 32 | crate://crates.io/bit-vec/0.4.3 \ | 47 | crate://crates.io/bit-vec/0.4.3 \ |
| 33 | crate://crates.io/bitflags/0.4.0 \ | ||
| 34 | crate://crates.io/bitflags/0.7.0 \ | 48 | crate://crates.io/bitflags/0.7.0 \ |
| 35 | crate://crates.io/bytes/0.3.0 \ | 49 | crate://crates.io/byteorder/1.0.0 \ |
| 50 | crate://crates.io/bytes/0.4.1 \ | ||
| 36 | crate://crates.io/cfg-if/0.1.0 \ | 51 | crate://crates.io/cfg-if/0.1.0 \ |
| 37 | crate://crates.io/chan-signal/0.1.7 \ | 52 | crate://crates.io/chan/0.1.19 \ |
| 38 | crate://crates.io/chan/0.1.18 \ | 53 | crate://crates.io/chan-signal/0.2.0 \ |
| 39 | crate://crates.io/cookie/0.2.5 \ | 54 | crate://crates.io/chrono/0.3.0 \ |
| 40 | crate://crates.io/crossbeam/0.2.10 \ | 55 | crate://crates.io/crossbeam/0.2.10 \ |
| 41 | crate://crates.io/dbus/0.4.1 \ | 56 | crate://crates.io/dbus/0.5.2 \ |
| 42 | crate://crates.io/env_logger/0.3.5 \ | 57 | crate://crates.io/deque/0.3.1 \ |
| 43 | crate://crates.io/gcc/0.3.40 \ | 58 | crate://crates.io/dtoa/0.4.1 \ |
| 59 | crate://crates.io/env_logger/0.4.2 \ | ||
| 60 | crate://crates.io/error-chain/0.7.2 \ | ||
| 61 | crate://crates.io/foreign-types/0.2.0 \ | ||
| 62 | crate://crates.io/gcc/0.3.45 \ | ||
| 44 | crate://crates.io/gdi32-sys/0.2.0 \ | 63 | crate://crates.io/gdi32-sys/0.2.0 \ |
| 45 | crate://crates.io/getopts/0.2.14 \ | 64 | crate://crates.io/getopts/0.2.14 \ |
| 46 | crate://crates.io/hpack/0.2.0 \ | ||
| 47 | crate://crates.io/httparse/1.2.1 \ | 65 | crate://crates.io/httparse/1.2.1 \ |
| 48 | crate://crates.io/hyper/0.9.14 \ | 66 | crate://crates.io/hyper/0.10.5 \ |
| 49 | crate://crates.io/idna/0.1.0 \ | 67 | crate://crates.io/idna/0.1.0 \ |
| 68 | crate://crates.io/iovec/0.1.0 \ | ||
| 69 | crate://crates.io/itoa/0.3.1 \ | ||
| 50 | crate://crates.io/kernel32-sys/0.2.2 \ | 70 | crate://crates.io/kernel32-sys/0.2.2 \ |
| 51 | crate://crates.io/language-tags/0.2.2 \ | 71 | crate://crates.io/language-tags/0.2.2 \ |
| 52 | crate://crates.io/lazy_static/0.1.16 \ | 72 | crate://crates.io/lazy_static/0.2.5 \ |
| 53 | crate://crates.io/lazy_static/0.2.2 \ | 73 | crate://crates.io/libc/0.2.21 \ |
| 54 | crate://crates.io/lazycell/0.4.0 \ | 74 | crate://crates.io/log/0.3.7 \ |
| 55 | crate://crates.io/libc/0.2.18 \ | ||
| 56 | crate://crates.io/log/0.3.6 \ | ||
| 57 | crate://crates.io/matches/0.1.4 \ | 75 | crate://crates.io/matches/0.1.4 \ |
| 58 | crate://crates.io/memchr/0.1.11 \ | 76 | crate://crates.io/memchr/0.1.11 \ |
| 59 | crate://crates.io/mime/0.2.2 \ | 77 | crate://crates.io/memchr/1.0.1 \ |
| 60 | crate://crates.io/mio/0.6.1 \ | 78 | crate://crates.io/metadeps/1.1.1 \ |
| 61 | crate://crates.io/miow/0.1.4 \ | 79 | crate://crates.io/mime/0.2.3 \ |
| 62 | crate://crates.io/net2/0.2.26 \ | ||
| 63 | crate://crates.io/nix/0.7.0 \ | ||
| 64 | crate://crates.io/nom/1.2.4 \ | 80 | crate://crates.io/nom/1.2.4 \ |
| 65 | crate://crates.io/num_cpus/1.2.0 \ | 81 | crate://crates.io/num/0.1.37 \ |
| 66 | crate://crates.io/openssl-sys/0.9.3 \ | 82 | crate://crates.io/num-integer/0.1.33 \ |
| 67 | crate://crates.io/openssl/0.9.3 \ | 83 | crate://crates.io/num-iter/0.1.33 \ |
| 68 | crate://crates.io/pkg-config/0.3.8 \ | 84 | crate://crates.io/num-traits/0.1.37 \ |
| 85 | crate://crates.io/num_cpus/1.3.0 \ | ||
| 86 | crate://crates.io/openssl/0.9.10 \ | ||
| 87 | crate://crates.io/openssl-sys/0.9.10 \ | ||
| 88 | crate://crates.io/pem/0.2.0 \ | ||
| 89 | crate://crates.io/pkg-config/0.3.9 \ | ||
| 90 | crate://crates.io/quote/0.3.15 \ | ||
| 69 | crate://crates.io/rand/0.3.15 \ | 91 | crate://crates.io/rand/0.3.15 \ |
| 70 | crate://crates.io/regex-syntax/0.3.9 \ | 92 | crate://crates.io/rayon/0.6.0 \ |
| 93 | crate://crates.io/redox_syscall/0.1.17 \ | ||
| 71 | crate://crates.io/regex/0.1.80 \ | 94 | crate://crates.io/regex/0.1.80 \ |
| 95 | crate://crates.io/regex/0.2.1 \ | ||
| 96 | crate://crates.io/regex-syntax/0.3.9 \ | ||
| 97 | crate://crates.io/regex-syntax/0.4.0 \ | ||
| 98 | crate://crates.io/ring/0.7.1 \ | ||
| 72 | crate://crates.io/rust-crypto/0.2.36 \ | 99 | crate://crates.io/rust-crypto/0.2.36 \ |
| 73 | crate://crates.io/rustc-serialize/0.3.22 \ | 100 | crate://crates.io/rustc-serialize/0.3.23 \ |
| 74 | crate://crates.io/rustc_version/0.1.7 \ | 101 | crate://crates.io/rustc_version/0.1.7 \ |
| 75 | crate://crates.io/semver/0.1.20 \ | 102 | crate://crates.io/semver/0.1.20 \ |
| 103 | crate://crates.io/serde/0.9.11 \ | ||
| 104 | crate://crates.io/serde_codegen_internals/0.14.1 \ | ||
| 105 | crate://crates.io/serde_derive/0.9.11 \ | ||
| 106 | crate://crates.io/serde_json/0.9.9 \ | ||
| 76 | crate://crates.io/sha1/0.2.0 \ | 107 | crate://crates.io/sha1/0.2.0 \ |
| 77 | crate://crates.io/slab/0.3.0 \ | 108 | crate://crates.io/syn/0.11.9 \ |
| 78 | crate://crates.io/solicit/0.4.4 \ | 109 | crate://crates.io/synom/0.11.3 \ |
| 79 | crate://crates.io/thread-id/2.0.0 \ | 110 | crate://crates.io/thread-id/2.0.0 \ |
| 111 | crate://crates.io/thread-id/3.0.0 \ | ||
| 80 | crate://crates.io/thread_local/0.2.7 \ | 112 | crate://crates.io/thread_local/0.2.7 \ |
| 81 | crate://crates.io/time/0.1.35 \ | 113 | crate://crates.io/thread_local/0.3.3 \ |
| 114 | crate://crates.io/time/0.1.36 \ | ||
| 82 | crate://crates.io/toml/0.2.1 \ | 115 | crate://crates.io/toml/0.2.1 \ |
| 83 | crate://crates.io/traitobject/0.0.1 \ | 116 | crate://crates.io/toml/0.3.1 \ |
| 117 | crate://crates.io/traitobject/0.1.0 \ | ||
| 118 | crate://crates.io/tungstenite/0.1.1 \ | ||
| 84 | crate://crates.io/typeable/0.1.2 \ | 119 | crate://crates.io/typeable/0.1.2 \ |
| 85 | crate://crates.io/unicase/1.4.0 \ | 120 | crate://crates.io/unicase/1.4.0 \ |
| 86 | crate://crates.io/unicode-bidi/0.2.3 \ | 121 | crate://crates.io/unicode-bidi/0.2.5 \ |
| 87 | crate://crates.io/unicode-normalization/0.1.2 \ | 122 | crate://crates.io/unicode-normalization/0.1.4 \ |
| 123 | crate://crates.io/unicode-xid/0.0.4 \ | ||
| 88 | crate://crates.io/unix_socket/0.5.0 \ | 124 | crate://crates.io/unix_socket/0.5.0 \ |
| 89 | crate://crates.io/url/1.2.3 \ | 125 | crate://crates.io/unreachable/0.1.1 \ |
| 126 | crate://crates.io/untrusted/0.3.2 \ | ||
| 127 | crate://crates.io/url/1.4.0 \ | ||
| 90 | crate://crates.io/user32-sys/0.2.0 \ | 128 | crate://crates.io/user32-sys/0.2.0 \ |
| 129 | crate://crates.io/utf-8/0.7.0 \ | ||
| 91 | crate://crates.io/utf8-ranges/0.1.3 \ | 130 | crate://crates.io/utf8-ranges/0.1.3 \ |
| 131 | crate://crates.io/utf8-ranges/1.0.0 \ | ||
| 132 | crate://crates.io/uuid/0.4.0 \ | ||
| 92 | crate://crates.io/void/1.0.2 \ | 133 | crate://crates.io/void/1.0.2 \ |
| 93 | crate://crates.io/winapi-build/0.1.1 \ | ||
| 94 | crate://crates.io/winapi/0.2.8 \ | 134 | crate://crates.io/winapi/0.2.8 \ |
| 95 | crate://crates.io/ws/0.5.3 \ | 135 | crate://crates.io/winapi-build/0.1.1 \ |
| 96 | crate://crates.io/ws2_32-sys/0.2.1 \ | ||
| 97 | git://github.com/advancedtelematic/rvi_sota_client \ | 136 | git://github.com/advancedtelematic/rvi_sota_client \ |
| 98 | " | 137 | " |
| 138 | |||
| 99 | SRC_URI[index.md5sum] = "79f10f436dbf26737cc80445746f16b4" | 139 | SRC_URI[index.md5sum] = "79f10f436dbf26737cc80445746f16b4" |
| 100 | SRC_URI[index.sha256sum] = "86114b93f1f51aaf0aec3af0751d214b351f4ff9839ba031315c1b19dcbb1913" | 140 | SRC_URI[index.sha256sum] = "86114b93f1f51aaf0aec3af0751d214b351f4ff9839ba031315c1b19dcbb1913" |
| 101 | 141 | ||
| 102 | SYSTEMD_SERVICE_${PN} = "sota_client.service" | 142 | SYSTEMD_SERVICE_${PN} = "sota_client.service sota_client_autoprovision.service" |
| 103 | 143 | ||
| 104 | DEPENDS += " openssl dbus" | 144 | DEPENDS += " openssl openssl-native dbus " |
| 105 | RDEPENDS_${PN} = " libcrypto \ | 145 | RDEPENDS_${PN} = " libcrypto \ |
| 106 | libssl \ | 146 | libssl \ |
| 107 | bash \ | 147 | bash \ |
| 108 | lshw \ | 148 | lshw \ |
| 109 | jq \ | 149 | jq \ |
| 150 | curl \ | ||
| 151 | python \ | ||
| 152 | python-canonicaljson \ | ||
| 153 | python-json \ | ||
| 110 | " | 154 | " |
| 111 | 155 | ||
| 156 | export SOTA_AUTOPROVISION_CREDENTIALS | ||
| 157 | export SOTA_AUTOPROVISION_URL | ||
| 158 | |||
| 112 | do_compile_prepend() { | 159 | do_compile_prepend() { |
| 113 | export SOTA_VERSION=$(make sota-version) | 160 | export SOTA_VERSION=$(make sota-version) |
| 114 | } | 161 | } |
| @@ -116,20 +163,38 @@ do_compile_prepend() { | |||
| 116 | do_install() { | 163 | do_install() { |
| 117 | install -d ${D}${bindir} | 164 | install -d ${D}${bindir} |
| 118 | install -m 0755 target/${TARGET_SYS}/release/sota_client ${D}${bindir} | 165 | install -m 0755 target/${TARGET_SYS}/release/sota_client ${D}${bindir} |
| 119 | install -m 0755 run/sota_sysinfo.sh ${D}${bindir} | 166 | install -m 0755 ${S}/run/sota_sysinfo.sh ${D}${bindir} |
| 120 | ln -fs ${bindir}/sota_sysinfo.sh ${D}${bindir}/system_info.sh # For compatibilty with old sota.toml files | 167 | ln -fs ${bindir}/sota_sysinfo.sh ${D}${bindir}/system_info.sh # For compatibilty with old sota.toml files |
| 121 | install -m 0755 run/sota_ostree.sh ${D}${bindir} | 168 | install -m 0755 ${S}/run/sota_ostree.sh ${D}${bindir} |
| 169 | install -m 0755 ${S}/run/sota_prov.sh ${D}${bindir} | ||
| 170 | install -m 0755 ${S}/run/canonical_json.py ${D}${bindir} | ||
| 122 | 171 | ||
| 123 | if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then | 172 | if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then |
| 124 | install -d ${D}${systemd_unitdir}/system | 173 | install -d ${D}/${systemd_unitdir}/system |
| 125 | if ${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'true', 'false', d)}; then | 174 | if [ -n "$SOTA_AUTOPROVISION_CREDENTIALS" ]; then |
| 126 | install -c ${S}/run/sota_client_ostree.service ${D}${systemd_unitdir}/system/sota_client.service | 175 | install -c ${S}/run/sota_client_uptane_auto.service ${D}${systemd_unitdir}/system/sota_client.service |
| 127 | else | 176 | else |
| 128 | install -c ${S}/run/sota_client.service ${D}${systemd_unitdir}/system/sota_client.service | 177 | install -c ${S}/run/sota_client_ostree.service ${D}${systemd_unitdir}/system/sota_client.service |
| 129 | fi | 178 | fi |
| 179 | install -c ${S}/run/sota_client_autoprovision.service ${D}${systemd_unitdir}/system/sota_client_autoprovision.service | ||
| 130 | fi | 180 | fi |
| 131 | 181 | ||
| 132 | install -d ${D}${sysconfdir} | 182 | install -d ${D}${sysconfdir} |
| 133 | echo `git log -1 --pretty=format:%H` > ${D}${sysconfdir}/sota_client.version | 183 | echo `git log -1 --pretty=format:%H` > ${D}${sysconfdir}/sota_client.version |
| 134 | install -c ${S}/run/sota_certificates ${D}${sysconfdir} | 184 | install -c ${S}/run/sota_certificates ${D}${sysconfdir} |
| 185 | ln -fs /lib ${D}/lib64 | ||
| 186 | |||
| 187 | if [ -n "$SOTA_AUTOPROVISION_CREDENTIALS" ]; then | ||
| 188 | EXPDATE=`openssl pkcs12 -in $SOTA_AUTOPROVISION_CREDENTIALS -password "pass:" -nodes 2>/dev/null | openssl x509 -noout -enddate | cut -f2 -d "="` | ||
| 189 | |||
| 190 | if [ `date +%s` -ge `date -d "${EXPDATE}" +%s` ]; then | ||
| 191 | bberror "Certificate ${SOTA_AUTOPROVISION_CREDENTIALS} has expired on ${EXPDATE}" | ||
| 192 | fi | ||
| 193 | |||
| 194 | install -d ${D}/var | ||
| 195 | install -d ${D}/var/sota | ||
| 196 | install -m 0655 $SOTA_AUTOPROVISION_CREDENTIALS ${D}/var/sota/sota_provisioning_credentials.p12 | ||
| 197 | echo "SOTA_GATEWAY_URI=$SOTA_AUTOPROVISION_URL" > ${D}/var/sota/sota_provisioning_url.env | ||
| 198 | fi | ||
| 199 | |||
| 135 | } | 200 | } |
diff --git a/recipes-sota/sota-tools/sota-tools_git.bb b/recipes-sota/sota-tools/sota-tools_git.bb index e472ff8..326ff20 100644 --- a/recipes-sota/sota-tools/sota-tools_git.bb +++ b/recipes-sota/sota-tools/sota-tools_git.bb | |||
| @@ -6,7 +6,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=65d26fcc2f35ea6a181ac777e42db1ea" | |||
| 6 | S = "${WORKDIR}/git" | 6 | S = "${WORKDIR}/git" |
| 7 | 7 | ||
| 8 | SRC_URI = "gitsm://github.com/advancedtelematic/sota-tools.git;branch=master" | 8 | SRC_URI = "gitsm://github.com/advancedtelematic/sota-tools.git;branch=master" |
| 9 | SRCREV = "c6ecec3e86c423dd6caaa362a5ff0a1a6f4072a8" | 9 | SRCREV = "4d7f22f50ab43be5bee61ad3e96cd9db4ef3a372" |
| 10 | 10 | ||
| 11 | inherit cmake | 11 | inherit cmake |
| 12 | 12 | ||
diff --git a/recipes-support/libgit2/libgit2-release.inc b/recipes-support/libgit2/libgit2-release.inc deleted file mode 100644 index 62a13cf..0000000 --- a/recipes-support/libgit2/libgit2-release.inc +++ /dev/null | |||
| @@ -1,2 +0,0 @@ | |||
| 1 | require libgit2.inc | ||
| 2 | SRC_URI = "https://github.com/libgit2/libgit2/archive/v${PV}.tar.gz" | ||
diff --git a/recipes-support/libgit2/libgit2.inc b/recipes-support/libgit2/libgit2.inc deleted file mode 100644 index a0da834..0000000 --- a/recipes-support/libgit2/libgit2.inc +++ /dev/null | |||
| @@ -1,19 +0,0 @@ | |||
| 1 | SUMMARY = "the Git linkable library" | ||
| 2 | HOMEPAGE = "http://libgit2.github.com/" | ||
| 3 | LICENSE = "GPL-2.0-with-GCC-exception" | ||
| 4 | |||
| 5 | DEPENDS = "openssl zlib" | ||
| 6 | |||
| 7 | inherit cmake | ||
| 8 | |||
| 9 | # CLAR = tests, needs python-native | ||
| 10 | EXTRA_OECMAKE = "\ | ||
| 11 | -DTHREADSAFE=ON \ | ||
| 12 | -DBUILD_CLAR=OFF \ | ||
| 13 | -DSHA1_TYPE="builtin" \ | ||
| 14 | -DCMAKE_BUILD_TYPE=RelWithDebInfo \ | ||
| 15 | -DBUILD_SHARED_LIBS=ON \ | ||
| 16 | -DBUILD_EXAMPLES=OFF \ | ||
| 17 | " | ||
| 18 | |||
| 19 | BBCLASSEXTEND = "native" | ||
diff --git a/recipes-support/libgit2/libgit2_0.24.1.bb b/recipes-support/libgit2/libgit2_0.24.1.bb deleted file mode 100644 index 2d0c6ff..0000000 --- a/recipes-support/libgit2/libgit2_0.24.1.bb +++ /dev/null | |||
| @@ -1,4 +0,0 @@ | |||
| 1 | LIC_FILES_CHKSUM = "file://COPYING;md5=34197a479f637beb9e09e56893f48bc2" | ||
| 2 | SRC_URI[md5sum] = "3674ca2d40388b1175e25b6f5a3a82ad" | ||
| 3 | SRC_URI[sha256sum] = "60198cbb34066b9b5c1613d15c0479f6cd25f4aef42f7ec515cd1cc13a77fede" | ||
| 4 | require libgit2-release.inc | ||
diff --git a/recipes-support/lshw/lshw_02.16.bb b/recipes-support/lshw/lshw_02.16.bb index 53b0d65..99901ff 100644 --- a/recipes-support/lshw/lshw_02.16.bb +++ b/recipes-support/lshw/lshw_02.16.bb | |||
| @@ -14,12 +14,11 @@ DEPENDS = "pciutils \ | |||
| 14 | usbutils" | 14 | usbutils" |
| 15 | COMPATIBLE_HOST = "(i.86|x86_64|arm|aarch64).*-linux" | 15 | COMPATIBLE_HOST = "(i.86|x86_64|arm|aarch64).*-linux" |
| 16 | 16 | ||
| 17 | PR="r1" | ||
| 18 | |||
| 19 | SRC_URI="http://ezix.org/software/files/lshw-B.${PV}.tar.gz \ | 17 | SRC_URI="http://ezix.org/software/files/lshw-B.${PV}.tar.gz \ |
| 20 | file://cross-compile.patch \ | 18 | file://cross-compile.patch \ |
| 21 | file://ldflags.patch \ | 19 | file://ldflags.patch \ |
| 22 | " | 20 | " |
| 21 | |||
| 23 | SRC_URI[md5sum] = "67479167add605e8f001097c30e96d0d" | 22 | SRC_URI[md5sum] = "67479167add605e8f001097c30e96d0d" |
| 24 | SRC_URI[sha256sum] = "809882429555b93259785cc261dbff04c16c93d064db5f445a51945bc47157cb" | 23 | SRC_URI[sha256sum] = "809882429555b93259785cc261dbff04c16c93d064db5f445a51945bc47157cb" |
| 25 | 24 | ||
diff --git a/recipes-support/python-canonicaljson/python-canonicaljson.bb b/recipes-support/python-canonicaljson/python-canonicaljson.bb new file mode 100644 index 0000000..d8a0728 --- /dev/null +++ b/recipes-support/python-canonicaljson/python-canonicaljson.bb | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | DESCRIPTION = "python-canonicaljson recipe" | ||
| 2 | |||
| 3 | LICENSE = "Apache-2.0" | ||
| 4 | LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=2ee41112a44fe7014dce33e26468ba93" | ||
| 5 | |||
| 6 | SRCREV = "92e2c06871cc275c2a8b8e3e899141a212aae0e8" | ||
| 7 | SRC_URI = "git://github.com/matrix-org/python-canonicaljson.git" | ||
| 8 | S = "${WORKDIR}/git" | ||
| 9 | |||
| 10 | # Generate with: | ||
| 11 | # git describe --tags | cut -b2- | ||
| 12 | PV = "1.0.0" | ||
| 13 | inherit setuptools | ||
| 14 | |||
| 15 | RDEPENDS_${PN} = "\ | ||
| 16 | python-simplejson \ | ||
| 17 | python-frozendict \ | ||
| 18 | " | ||
diff --git a/recipes-support/python-frozendict/python-frozendict.bb b/recipes-support/python-frozendict/python-frozendict.bb new file mode 100644 index 0000000..79fe5c8 --- /dev/null +++ b/recipes-support/python-frozendict/python-frozendict.bb | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | DESCRIPTION = "python-frozendict recipe" | ||
| 2 | |||
| 3 | LICENSE = "BSD" | ||
| 4 | LIC_FILES_CHKSUM = "file://${S}/LICENSE.txt;md5=f4da037a49c09b456fdbbc7a5bd36132" | ||
| 5 | |||
| 6 | SRCREV = "c5d16bafcca7b72ff3e8f40d3a9081e4c9233f1b" | ||
| 7 | SRC_URI = "git://github.com/slezica/python-frozendict.git" | ||
| 8 | S = "${WORKDIR}/git" | ||
| 9 | |||
| 10 | PV = "1.2" | ||
| 11 | inherit setuptools | ||
| 12 | |||
diff --git a/scripts/envsetup.sh b/scripts/envsetup.sh new file mode 100755 index 0000000..316a782 --- /dev/null +++ b/scripts/envsetup.sh | |||
| @@ -0,0 +1,53 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | SCRIPT="envsetup.sh" | ||
| 4 | |||
| 5 | MACHINE=$1 | ||
| 6 | |||
| 7 | if [ "$#" -lt 1 ]; then | ||
| 8 | echo "Usage: ${SCRIPT} <machine> [builddir]" | ||
| 9 | return -1 | ||
| 10 | elif [ "$#" -eq 2 ]; then | ||
| 11 | BUILDDIR=$2 | ||
| 12 | else | ||
| 13 | BUILDDIR=build | ||
| 14 | fi | ||
| 15 | BULDDIR=$2 | ||
| 16 | |||
| 17 | # detect if this script is sourced: see http://stackoverflow.com/a/38128348/6255594 | ||
| 18 | SOURCED=0 | ||
| 19 | if [ -n "$ZSH_EVAL_CONTEXT" ]; then | ||
| 20 | [[ $ZSH_EVAL_CONTEXT =~ :file$ ]] && { SOURCED=1; SOURCEDIR=$(cd $(dirname -- $0) && pwd -P); } | ||
| 21 | elif [ -n "$KSH_VERSION" ]; then | ||
| 22 | [[ "$(cd $(dirname -- $0) && pwd -P)/$(basename -- $0)" != "$(cd $(dirname -- ${.sh.file}) && pwd -P)/$(basename -- ${.sh.file})" ]] && { SOURCED=1; SOURCEDIR=$(cd $(dirname -- ${.sh.file}) && pwd -P); } | ||
| 23 | elif [ -n "$BASH_VERSION" ]; then | ||
| 24 | [[ $0 != "$BASH_SOURCE" ]] && { SOURCED=1; SOURCEDIR=$(cd $(dirname -- $BASH_SOURCE) && pwd -P); } | ||
| 25 | fi | ||
| 26 | |||
| 27 | if [ $SOURCED -ne 1 ]; then | ||
| 28 | unset SOURCED | ||
| 29 | unset SOURCEDIR | ||
| 30 | echo "Error: this script needs to be sourced in a supported shell" >&2 | ||
| 31 | echo "Please check that the current shell is bash, zsh or ksh and run this script as '. $0 <args>'" >&2 | ||
| 32 | exit -1 | ||
| 33 | fi | ||
| 34 | |||
| 35 | SCRIPTDIR=$(cd $(dirname $BASH_SOURCE) && pwd -P) | ||
| 36 | METADIR=$(cd $(dirname $BASH_SOURCE)/../.. && pwd -P) | ||
| 37 | |||
| 38 | if ! [[ -e ${SCRIPTDIR}/../conf/include/local/sota_${MACHINE}.inc && -e ${SCRIPTDIR}/../conf/include/bblayers/sota_${MACHINE}.inc ]]; then | ||
| 39 | echo "Error: invalid machine: ${MACHINE}" >&2 | ||
| 40 | return -1 | ||
| 41 | fi | ||
| 42 | |||
| 43 | if [ -e ${BUILDDIR}/conf/local.conf ]; then | ||
| 44 | source $METADIR/poky/oe-init-build-env ${BUILDDIR} | ||
| 45 | else | ||
| 46 | source $METADIR/poky/oe-init-build-env ${BUILDDIR} | ||
| 47 | echo "METADIR := \"\${@os.path.abspath('${METADIR}')}\"" >> conf/bblayers.conf | ||
| 48 | cat ${METADIR}/meta-updater/conf/include/bblayers/sota.inc >> conf/bblayers.conf | ||
| 49 | cat ${METADIR}/meta-updater/conf/include/bblayers/sota_${MACHINE}.inc >> conf/bblayers.conf | ||
| 50 | echo "include conf/include/local/sota_${MACHINE}.inc" >> conf/local.conf | ||
| 51 | echo "include conf/distro/sota.conf.inc" >> conf/local.conf | ||
| 52 | fi | ||
| 53 | |||
diff --git a/scripts/lib/wic/canned-wks/sdimage-sota.wks b/scripts/lib/wic/canned-wks/sdimage-sota.wks new file mode 100644 index 0000000..c31c3a5 --- /dev/null +++ b/scripts/lib/wic/canned-wks/sdimage-sota.wks | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | # short-description: Create OTA-enabled SD card image | ||
| 2 | # long-description: Creates a partitioned SD card image with OSTree | ||
| 3 | # physical sysroot as a payload. Boot files are located in the | ||
| 4 | # first vfat partition. | ||
| 5 | |||
| 6 | part /boot --source bootimg-partition --ondisk mmcblk --fstype=vfat --label boot --active --align 4096 --size 20 | ||
| 7 | part / --source otaimage --ondisk mmcblk --fstype=ext4 --label root --align 4096 | ||
diff --git a/scripts/lib/wic/plugins/otaimage.py b/scripts/lib/wic/plugins/otaimage.py new file mode 100644 index 0000000..016c996 --- /dev/null +++ b/scripts/lib/wic/plugins/otaimage.py | |||
| @@ -0,0 +1,69 @@ | |||
| 1 | # ex:ts=4:sw=4:sts=4:et | ||
| 2 | # -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- | ||
| 3 | # | ||
| 4 | # This program is free software; you can redistribute it and/or modify | ||
| 5 | # it under the terms of the GNU General Public License version 2 as | ||
| 6 | # published by the Free Software Foundation. | ||
| 7 | # | ||
| 8 | # This program is distributed in the hope that it will be useful, | ||
| 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | # GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along | ||
| 14 | # with this program; if not, write to the Free Software Foundation, Inc., | ||
| 15 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 16 | # | ||
| 17 | |||
| 18 | import os | ||
| 19 | |||
| 20 | from wic import msger | ||
| 21 | from wic.pluginbase import SourcePlugin | ||
| 22 | from wic.utils.oe.misc import get_bitbake_var | ||
| 23 | |||
| 24 | class OTAImagePlugin(SourcePlugin): | ||
| 25 | """ | ||
| 26 | Add an already existing filesystem image to the partition layout. | ||
| 27 | """ | ||
| 28 | |||
| 29 | name = 'otaimage' | ||
| 30 | |||
| 31 | @classmethod | ||
| 32 | def do_install_disk(cls, disk, disk_name, cr, workdir, oe_builddir, | ||
| 33 | bootimg_dir, kernel_dir, native_sysroot): | ||
| 34 | """ | ||
| 35 | Called after all partitions have been prepared and assembled into a | ||
| 36 | disk image. Do nothing. | ||
| 37 | """ | ||
| 38 | pass | ||
| 39 | |||
| 40 | @classmethod | ||
| 41 | def do_configure_partition(cls, part, source_params, cr, cr_workdir, | ||
| 42 | oe_builddir, bootimg_dir, kernel_dir, | ||
| 43 | native_sysroot): | ||
| 44 | """ | ||
| 45 | Called before do_prepare_partition(). Possibly prepare | ||
| 46 | configuration files of some sort. | ||
| 47 | """ | ||
| 48 | pass | ||
| 49 | |||
| 50 | @classmethod | ||
| 51 | def do_prepare_partition(cls, part, source_params, cr, cr_workdir, | ||
| 52 | oe_builddir, bootimg_dir, kernel_dir, | ||
| 53 | rootfs_dir, native_sysroot): | ||
| 54 | """ | ||
| 55 | Called to do the actual content population for a partition i.e. it | ||
| 56 | 'prepares' the partition to be incorporated into the image. | ||
| 57 | """ | ||
| 58 | if not bootimg_dir: | ||
| 59 | bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE") | ||
| 60 | if not bootimg_dir: | ||
| 61 | msger.error("Couldn't find DEPLOY_DIR_IMAGE, exiting\n") | ||
| 62 | |||
| 63 | msger.debug('Bootimg dir: %s' % bootimg_dir) | ||
| 64 | |||
| 65 | src = bootimg_dir + "/" + get_bitbake_var("IMAGE_LINK_NAME") + ".otaimg" | ||
| 66 | |||
| 67 | msger.debug('Preparing partition using image %s' % (src)) | ||
| 68 | part.prepare_rootfs_from_fs_image(cr_workdir, src, "") | ||
| 69 | |||
