diff options
author | Anton Gerasimov <anton@advancedtelematic.com> | 2017-03-30 17:48:10 +0200 |
---|---|---|
committer | Anton Gerasimov <anton@advancedtelematic.com> | 2017-04-03 12:10:15 +0200 |
commit | 501e07acd803df6f9264c4206b4b9529006f287a (patch) | |
tree | 20e5bd1f9b3ffd4f230c9c9f5ac87fa85e626617 /classes | |
parent | 95b5db5a2714d429d31c42d079b192e8edb1a079 (diff) | |
download | meta-updater-501e07acd803df6f9264c4206b4b9529006f287a.tar.gz |
Merge from meta-agl-extra
Diffstat (limited to 'classes')
-rw-r--r-- | classes/image_types_ostree.bbclass | 9 | ||||
-rw-r--r-- | classes/image_types_ota.bbclass | 53 | ||||
-rw-r--r-- | classes/sdcard_image-dra7xx-evm-ota.bbclass | 3 | ||||
-rw-r--r-- | classes/sdcard_image-porter-ota.bbclass | 6 | ||||
-rw-r--r-- | classes/sdcard_image-rpi-ota.bbclass | 15 |
5 files changed, 51 insertions, 35 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 index f023649..179ed10 100644 --- a/classes/sdcard_image-dra7xx-evm-ota.bbclass +++ b/classes/sdcard_image-dra7xx-evm-ota.bbclass | |||
@@ -68,5 +68,8 @@ IMAGE_CMD_dra7xx-evm-sdimg-ota () { | |||
68 | xz -k "${SDIMG_OTA}" | 68 | xz -k "${SDIMG_OTA}" |
69 | ;; | 69 | ;; |
70 | esac | 70 | esac |
71 | |||
72 | rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.rootfs.dra7xx-evm-sdimg-ota | ||
73 | ln -s ${IMAGE_NAME}.rootfs.dra7xx-evm-sdimg-ota ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.rootfs.dra7xx-evm-sdimg-ota | ||
71 | } | 74 | } |
72 | 75 | ||
diff --git a/classes/sdcard_image-porter-ota.bbclass b/classes/sdcard_image-porter-ota.bbclass index 5909b44..a9619dc 100644 --- a/classes/sdcard_image-porter-ota.bbclass +++ b/classes/sdcard_image-porter-ota.bbclass | |||
@@ -59,9 +59,6 @@ IMAGE_CMD_porter-sdimg-ota () { | |||
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 | 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 | 60 | fi |
61 | 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 | 62 | # Optionally apply compression |
66 | case "${SDIMG_OTA_COMPRESSION}" in | 63 | case "${SDIMG_OTA_COMPRESSION}" in |
67 | "gzip") | 64 | "gzip") |
@@ -74,5 +71,8 @@ IMAGE_CMD_porter-sdimg-ota () { | |||
74 | xz -k "${SDIMG_OTA}" | 71 | xz -k "${SDIMG_OTA}" |
75 | ;; | 72 | ;; |
76 | esac | 73 | esac |
74 | |||
75 | rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.rootfs.porter-sdimg-ota | ||
76 | ln -s ${IMAGE_NAME}.rootfs.porter-sdimg-ota ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.rootfs.porter-sdimg-ota | ||
77 | } | 77 | } |
78 | 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 ; " |