summaryrefslogtreecommitdiffstats
path: root/meta-sota/classes
diff options
context:
space:
mode:
authorAnton Gerasimov <anton@advancedtelematic.com>2017-03-30 13:31:36 +0200
committerAnton Gerasimov <anton@advancedtelematic.com>2017-04-04 11:37:43 +0200
commit1c2571e37c6fa5e0ac3bb035173ae07a187648c5 (patch)
tree681d094eb924f1b5f7ecce6adbb08ce4e4eb2509 /meta-sota/classes
parent497d7db5bfc71367c6393a09a2f768b812fce83f (diff)
Update SOTA-related software
Support for grub2 has been added, rust's json parser temporarily replaced with python-canonicaljson because of compatibility issues. Change-Id: I6665ed3ad56afc90f0e82eb90993c8656be16d5f Signed-off-by: Anton Gerasimov <anton@advancedtelematic.com>
Diffstat (limited to 'meta-sota/classes')
-rw-r--r--meta-sota/classes/image_types_ostree.bbclass10
-rw-r--r--meta-sota/classes/image_types_ota.bbclass36
2 files changed, 34 insertions, 12 deletions
diff --git a/meta-sota/classes/image_types_ostree.bbclass b/meta-sota/classes/image_types_ostree.bbclass
index 04aeae8..1bbeb2d 100644
--- a/meta-sota/classes/image_types_ostree.bbclass
+++ b/meta-sota/classes/image_types_ostree.bbclass
@@ -58,6 +58,10 @@ IMAGE_CMD_ostree () {
echo "d /var/rootdirs 0755 root root -" >>${tmpfiles_conf}
echo "L /var/rootdirs/home - - - - /sysroot/home" >>${tmpfiles_conf}
+
+ # Preserve OSTREE_BRANCHNAME for future information
+ mkdir -p usr/share/sota/
+ echo -n "${OSTREE_BRANCHNAME}" > usr/share/sota/branchname
# Preserve data in /home to be later copied to /sysroot/home by
# sysroot generating procedure
mkdir -p usr/homedirs
@@ -100,6 +104,9 @@ IMAGE_CMD_ostree () {
cp ${DEPLOY_DIR_IMAGE}/${OSTREE_KERNEL} boot/vmlinuz-${checksum}
cp ${DEPLOY_DIR_IMAGE}/${OSTREE_INITRAMFS_IMAGE}-${MACHINE}${RAMDISK_EXT} boot/initramfs-${checksum}
+ # Copy image manifest
+ cat ${IMAGE_MANIFEST} | cut -d " " -f1,3 > usr/package.manifest
+
cd ${WORKDIR}
# Create a tarball that can be then commited to OSTree repo
@@ -130,6 +137,7 @@ IMAGE_CMD_ostreepush () {
if [ ${OSTREE_PUSH_CREDENTIALS} ]; then
garage-push --repo=${OSTREE_REPO} \
--ref=${OSTREE_BRANCHNAME} \
- --credentials=${OSTREE_PUSH_CREDENTIALS}
+ --credentials=${OSTREE_PUSH_CREDENTIALS} \
+ --cacert=${STAGING_ETCDIR_NATIVE}/ssl/certs/ca-certificates.crt
fi
}
diff --git a/meta-sota/classes/image_types_ota.bbclass b/meta-sota/classes/image_types_ota.bbclass
index 253d862..58bc7f0 100644
--- a/meta-sota/classes/image_types_ota.bbclass
+++ b/meta-sota/classes/image_types_ota.bbclass
@@ -9,11 +9,9 @@
inherit image
-IMAGE_DEPENDS_otaimg = "e2fsprogs-native:do_populate_sysroot"
-
-# For qemux86 u-boot is not included in any live image and is built separately
-IMAGE_DEPENDS_otaimg_append_qemux86 = " virtual/bootloader:do_deploy"
-IMAGE_DEPENDS_otaimg_append_qemux86-64 = " virtual/bootloader:do_deploy"
+IMAGE_DEPENDS_otaimg = "e2fsprogs-native:do_populate_sysroot \
+ ${@'grub:do_populate_sysroot' if d.getVar('OSTREE_BOOTLOADER', True) == 'grub' else ''} \
+ ${@'virtual/bootloader:do_deploy' if d.getVar('OSTREE_BOOTLOADER', True) == 'u-boot' else ''}"
calculate_size () {
BASE=$1
@@ -51,6 +49,7 @@ calculate_size () {
export OSTREE_OSNAME
export OSTREE_BRANCHNAME
export OSTREE_REPO
+export OSTREE_BOOTLOADER
IMAGE_CMD_otaimg () {
if ${@bb.utils.contains('IMAGE_FSTYPES', 'otaimg', 'true', 'false', d)}; then
@@ -75,15 +74,29 @@ IMAGE_CMD_otaimg () {
mkdir -p ${PHYS_SYSROOT}/boot/loader.0
ln -s loader.0 ${PHYS_SYSROOT}/boot/loader
- touch ${PHYS_SYSROOT}/boot/loader/uEnv.txt
+ if [ "${OSTREE_BOOTLOADER}" = "grub" ]; then
+ mkdir -p ${PHYS_SYSROOT}/boot/grub2
+ touch ${PHYS_SYSROOT}/boot/grub2/grub.cfg
+ elif [ "${OSTREE_BOOTLOADER}" = "u-boot" ]; then
+ touch ${PHYS_SYSROOT}/boot/loader/uEnv.txt
+ else
+ bberror "Invalid bootloader: ${OSTREE_BOOTLOADER}"
+ fi;
ostree --repo=${PHYS_SYSROOT}/ostree/repo pull-local --remote=${OSTREE_OSNAME} ${OSTREE_REPO} ${OSTREE_BRANCHNAME}
- ostree admin --sysroot=${PHYS_SYSROOT} deploy --os=${OSTREE_OSNAME} ${OSTREE_OSNAME}:${OSTREE_BRANCHNAME}
-
- # Copy deployment /home to sysroot
+ export OSTREE_BOOT_PARTITION="/boot"
+ kargs_list=""
+ for arg in ${OSTREE_KERNEL_ARGS}; do
+ kargs_list="${kargs_list} --karg-append=$arg"
+ done
+
+ ostree admin --sysroot=${PHYS_SYSROOT} deploy ${kargs_list} --os=${OSTREE_OSNAME} ${OSTREE_OSNAME}:${OSTREE_BRANCHNAME}
+
+ # Copy deployment /home and /var/sota to sysroot
HOME_TMP=`mktemp -d ${WORKDIR}/home-tmp-XXXXX`
- tar --xattrs --xattrs-include='*' -C ${HOME_TMP} -xf ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.rootfs.ostree.tar.bz2 ./usr/homedirs
+ tar --xattrs --xattrs-include='*' -C ${HOME_TMP} -xf ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.rootfs.ostree.tar.bz2 ./usr/homedirs ./var/sota || true
mv ${HOME_TMP}/usr/homedirs/home ${PHYS_SYSROOT}/
+ mv ${HOME_TMP}/var/sota ${PHYS_SYSROOT}/ostree/deploy/${OSTREE_OSNAME}/var/ || true
rm -rf ${HOME_TMP}
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}")
@@ -100,7 +113,8 @@ IMAGE_CMD_otaimg () {
rm -rf ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.otaimg
sync
dd if=/dev/zero of=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.otaimg seek=$OTA_ROOTFS_SIZE count=$COUNT bs=1024
- mkfs.ext4 ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.otaimg -d ${PHYS_SYSROOT}
+ mkfs.ext4 -O ^64bit ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.otaimg -d ${PHYS_SYSROOT}
+
rm -rf ${PHYS_SYSROOT}
rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.otaimg