diff options
author | Matei Valeanu <Matei.Valeanu@enea.com> | 2019-06-12 17:59:53 +0200 |
---|---|---|
committer | Martin Borg <martin.borg@enea.com> | 2019-06-26 14:39:33 +0200 |
commit | 1004579ca431cdb239295dc6771af45b41b2791a (patch) | |
tree | 001010e9e36599fa7e9d2e6281aa1573be054fca /classes/override_image_types_ostree.inc | |
parent | c9704949a3cf50d40078340908dff34c48dba948 (diff) | |
download | meta-el-nfv-access-1004579ca431cdb239295dc6771af45b41b2791a.tar.gz |
ostree and otaimg enhancements
override_image_types_ostree.inc - do_image_ostree task:
-add dirs, cleandirs flags, to avoid mktemp, rm, cd, and to
also remove at clean
-add subimages, imgsuffix flags, to use automatic link creation
-create image in IMGDEPLOYDIR, instead of DEPLOY_DIR_IMAGE
to use the automatic deploy and clean mechanism (also helps
in cleaning old images)
override_image_types_ota.inc - do_image_otaimg task:
-add dirs, cleandirs flags, to avoid mktemp, rm, cd, and to
also remove at clean
-avoid untar-ing the ostree image, and use OSTREE_ROOTFS
-create image in IMGDEPLOYDIR, instead of DEPLOY_DIR_IMAGE
to use the automatic deploy and clean mechanism
Move OSTREE_REPO to "${WORKDIR}/ostree-repo", instead of
DEPLOY_DIR_IMAGE, this repo is needed for otaimg creation
sota_xeon-d.bbclass sota_atom-c3000.bbclass:
-set ROOTFS_sota to IMGDEPLOYDIR insted of DEPLOY_DIR_IMAGE,
as this is where the otaimg is now created; also use IMAGE_LINK_NAME
istead of IMAGE_NAME, to have the correct reference to the image,
even if the image was built in a previous run (IMAGE_NAME differs
in this case)
Change-Id: I44e87311d1819b80d34f924630d09e429d411d41
Signed-off-by: Matei Valeanu <Matei.Valeanu@enea.com>
Diffstat (limited to 'classes/override_image_types_ostree.inc')
-rw-r--r-- | classes/override_image_types_ostree.inc | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/classes/override_image_types_ostree.inc b/classes/override_image_types_ostree.inc index ac584e5..241afcd 100644 --- a/classes/override_image_types_ostree.inc +++ b/classes/override_image_types_ostree.inc | |||
@@ -1,3 +1,18 @@ | |||
1 | # overrides meta-updater/classes/image_types_ostree.bbclass | ||
2 | # - add do_image_ostree flags: | ||
3 | # - dirs, cleandirs: to avoid mktemp, rm, cd, and to also remove at clean | ||
4 | # - subimages, imgsuffix: to use automatic link creation | ||
5 | # - override of IMAGE_CMD_ostree | ||
6 | # - use the added flags | ||
7 | # - IMGDEPLOYDIR, instead of DEPLOY_DIR_IMAGE | ||
8 | |||
9 | OSTREE_ROOTFS="${WORKDIR}/ostree-root" | ||
10 | do_image_ostree[dirs] = "${OSTREE_ROOTFS}" | ||
11 | do_image_ostree[cleandirs] = "${OSTREE_ROOTFS}" | ||
12 | do_image_ostree[subimages] = "rootfs.ostree.tar.bz2" | ||
13 | do_image_ostree[imgsuffix] = "." | ||
14 | export OSTREE_ROOTFS | ||
15 | |||
1 | IMAGE_CMD_ostree () { | 16 | IMAGE_CMD_ostree () { |
2 | if [ -z "$OSTREE_REPO" ]; then | 17 | if [ -z "$OSTREE_REPO" ]; then |
3 | bbfatal "OSTREE_REPO should be set in your local.conf" | 18 | bbfatal "OSTREE_REPO should be set in your local.conf" |
@@ -7,13 +22,10 @@ IMAGE_CMD_ostree () { | |||
7 | bbfatal "OSTREE_BRANCHNAME should be set in your local.conf" | 22 | bbfatal "OSTREE_BRANCHNAME should be set in your local.conf" |
8 | fi | 23 | fi |
9 | 24 | ||
10 | OSTREE_ROOTFS=`mktemp -du ${WORKDIR}/ostree-root-XXXXX` | 25 | cp -a ${IMAGE_ROOTFS}/* ${OSTREE_ROOTFS} |
11 | cp -a ${IMAGE_ROOTFS} ${OSTREE_ROOTFS} | ||
12 | chmod a+rx ${OSTREE_ROOTFS} | 26 | chmod a+rx ${OSTREE_ROOTFS} |
13 | sync | 27 | sync |
14 | 28 | ||
15 | cd ${OSTREE_ROOTFS} | ||
16 | |||
17 | for d in var/*; do | 29 | for d in var/*; do |
18 | if [ "${d}" != "var/local" ]; then | 30 | if [ "${d}" != "var/local" ]; then |
19 | rm -rf ${d} | 31 | rm -rf ${d} |
@@ -125,16 +137,11 @@ IMAGE_CMD_ostree () { | |||
125 | # Copy image manifest | 137 | # Copy image manifest |
126 | cat ${IMAGE_MANIFEST} | cut -d " " -f1,3 > usr/package.manifest | 138 | cat ${IMAGE_MANIFEST} | cut -d " " -f1,3 > usr/package.manifest |
127 | 139 | ||
128 | cd ${WORKDIR} | ||
129 | |||
130 | # Create a tarball that can be then commited to OSTree repo | 140 | # Create a tarball that can be then commited to OSTree repo |
131 | OSTREE_TAR=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ostree.tar.bz2 | 141 | OSTREE_TAR=${IMGDEPLOYDIR}/${IMAGE_NAME}.rootfs.ostree.tar.bz2 |
132 | tar -C ${OSTREE_ROOTFS} --xattrs --xattrs-include='*' -cjf ${OSTREE_TAR} . | 142 | tar -C ${OSTREE_ROOTFS} --xattrs --xattrs-include='*' -cjf ${OSTREE_TAR} . |
133 | sync | 143 | sync |
134 | 144 | ||
135 | rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.rootfs.ostree.tar.bz2 | ||
136 | ln -s ${IMAGE_NAME}.rootfs.ostree.tar.bz2 ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.rootfs.ostree.tar.bz2 | ||
137 | |||
138 | if ! ostree --repo=${OSTREE_REPO} refs 2>&1 > /dev/null; then | 145 | if ! ostree --repo=${OSTREE_REPO} refs 2>&1 > /dev/null; then |
139 | ostree --repo=${OSTREE_REPO} init --mode=archive-z2 | 146 | ostree --repo=${OSTREE_REPO} init --mode=archive-z2 |
140 | fi | 147 | fi |
@@ -145,6 +152,4 @@ IMAGE_CMD_ostree () { | |||
145 | --skip-if-unchanged \ | 152 | --skip-if-unchanged \ |
146 | --branch=${OSTREE_BRANCHNAME} \ | 153 | --branch=${OSTREE_BRANCHNAME} \ |
147 | --subject="Commit-id: ${IMAGE_NAME}" | 154 | --subject="Commit-id: ${IMAGE_NAME}" |
148 | |||
149 | rm -rf ${OSTREE_ROOTFS} | ||
150 | } | 155 | } |