summaryrefslogtreecommitdiffstats
path: root/classes
diff options
context:
space:
mode:
authorLuka Pivk <luka.pivk@toradex.com>2019-01-10 11:41:55 +0100
committerLuka Pivk <luka.pivk@toradex.com>2019-01-11 09:11:31 +0100
commit6cc3ab1c90f84feed212ea5cc2b4e6b1af1b2b2e (patch)
tree87b8d82b4a7c8b466c3207853679dbc86988db4b /classes
parent967ac2b1db9ce96436d3afe9ea997bfc01f07ecd (diff)
downloadmeta-updater-6cc3ab1c90f84feed212ea5cc2b4e6b1af1b2b2e.tar.gz
classes/image_types_ostree.bbclass: fix checksum calculation
Adds initramfs and/or devicetree into checksum calculation. According to ostree documentation if devicetree and/or initramfs are included into ostree, checksum should also include them. Signed-off-by: Luka Pivk <luka.pivk@toradex.com>
Diffstat (limited to 'classes')
-rw-r--r--classes/image_types_ostree.bbclass25
1 files changed, 13 insertions, 12 deletions
diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass
index 5cb4d51..138e02e 100644
--- a/classes/image_types_ostree.bbclass
+++ b/classes/image_types_ostree.bbclass
@@ -104,26 +104,27 @@ IMAGE_CMD_ostree () {
104 ln -sf var/roothome root 104 ln -sf var/roothome root
105 fi 105 fi
106 106
107 checksum=`sha256sum ${DEPLOY_DIR_IMAGE}/${OSTREE_KERNEL} | cut -f 1 -d " "`
108
109 cp ${DEPLOY_DIR_IMAGE}/${OSTREE_KERNEL} boot/vmlinuz-${checksum}
110
111 if [ "${KERNEL_IMAGETYPE}" = "fitImage" ]; then 107 if [ "${KERNEL_IMAGETYPE}" = "fitImage" ]; then
112 # 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 -
113 # 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 " ")
114 touch boot/initramfs-${checksum} 112 touch boot/initramfs-${checksum}
115 else 113 else
116 cp ${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.${INITRAMFS_FSTYPES} boot/initramfs-${checksum} 114 if [ "${OSTREE_DEPLOY_DEVICETREE}" = "1" ] && [ -n "${KERNEL_DEVICETREE}" ]; then
117 if [ "${OSTREE_DEPLOY_DEVICETREE}" = "1" ]; then 115 checksum=$(cat ${DEPLOY_DIR_IMAGE}/${OSTREE_KERNEL} ${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.${INITRAMFS_FSTYPES} ${KERNEL_DEVICETREE} | sha256sum | cut -f 1 -d " ")
118 if test -n "${KERNEL_DEVICETREE}"; then 116 for DTS_FILE in ${KERNEL_DEVICETREE}; do
119 for DTS_FILE in ${KERNEL_DEVICETREE}; do 117 DTS_FILE_BASENAME=$(basename ${DTS_FILE})
120 DTS_FILE_BASENAME=$(basename ${DTS_FILE}) 118 cp ${DEPLOY_DIR_IMAGE}/${DTS_FILE_BASENAME} boot/devicetree-${DTS_FILE_BASENAME}-${checksum}
121 cp ${DEPLOY_DIR_IMAGE}/${DTS_FILE_BASENAME} boot/devicetree-${DTS_FILE_BASENAME}-${checksum} 119 done
122 done 120 else
123 fi 121 checksum=$(cat ${DEPLOY_DIR_IMAGE}/${OSTREE_KERNEL} ${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.${INITRAMFS_FSTYPES} | sha256sum | cut -f 1 -d " ")
124 fi 122 fi
123 cp ${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.${INITRAMFS_FSTYPES} boot/initramfs-${checksum}
125 fi 124 fi
126 125
126 cp ${DEPLOY_DIR_IMAGE}/${OSTREE_KERNEL} boot/vmlinuz-${checksum}
127
127 # Copy image manifest 128 # Copy image manifest
128 cat ${IMAGE_MANIFEST} | cut -d " " -f1,3 > usr/package.manifest 129 cat ${IMAGE_MANIFEST} | cut -d " " -f1,3 > usr/package.manifest
129} 130}