deleted file mode 100644
@@ -1,14 +0,0 @@
-# This software is a part of ISAR.
-# Copyright (C) 2020 Siemens AG
-#
-# SPDX-License-Identifier: MIT
-
-IMAGER_INSTALL_cpio += "cpio"
-CPIO_IMAGE_FORMAT ?= "newc"
-
-IMAGE_CMD_cpio() {
- ${SUDO_CHROOT} \
- sh -c "cd ${PP_ROOTFS}; /usr/bin/find . | \
- /usr/bin/cpio -H ${CPIO_IMAGE_FORMAT} -o > \
- ${IMAGE_FILE_CHROOT}"
-}
deleted file mode 100644
@@ -1,15 +0,0 @@
-# This software is a part of ISAR.
-# Copyright (C) 2015-2017 ilbers GmbH
-
-IMAGER_INSTALL_ext4 += "e2fsprogs"
-
-MKE2FS_ARGS ?= "-t ext4"
-
-# Generate ext4 filesystem image
-IMAGE_CMD_ext4() {
- truncate -s ${ROOTFS_SIZE}K '${IMAGE_FILE_HOST}'
-
- ${SUDO_CHROOT} /sbin/mke2fs ${MKE2FS_ARGS} \
- -F -d '${PP_ROOTFS}' '${IMAGE_FILE_CHROOT}'
-}
-#IMAGE_CMD_ext4[vardepsexclude] = "ROOTFS_SIZE ROOTFS_EXTRA"
deleted file mode 100644
@@ -1,22 +0,0 @@
-# This software is a part of ISAR.
-# Copyright (C) Siemens AG, 2019
-#
-# SPDX-License-Identifier: MIT
-
-MKIMAGE_ARGS ??= ""
-
-FIT_IMAGE_SOURCE ??= "fitimage.its"
-
-IMAGER_INSTALL_fit += "u-boot-tools device-tree-compiler"
-
-# Generate fit image
-IMAGE_CMD_fit() {
- if [ ! -e "${WORKDIR}/${FIT_IMAGE_SOURCE}" ]; then
- die "FIT_IMAGE_SOURCE does not contain fitimage source file"
- fi
-
- # Create fit image using buildchroot tools
- ${SUDO_CHROOT} /usr/bin/mkimage ${MKIMAGE_ARGS} \
- -f '${PP_WORK}/${FIT_IMAGE_SOURCE}' '${IMAGE_FILE_CHROOT}'
-}
-IMAGE_CMD_fit[depends] = "${PN}:do_transform_template"
@@ -11,7 +11,6 @@ SSTATE_MANIFESTS = "${TMPDIR}/sstate-control/${MACHINE}-${DISTRO}-${DISTRO_ARCH}
IMAGE_INSTALL ?= ""
IMAGE_FSTYPES ?= "${@ d.getVar("IMAGE_TYPE", True) if d.getVar("IMAGE_TYPE", True) else "ext4"}"
-IMAGE_CONVERSIONS = "gz xz"
IMAGE_ROOTFS ?= "${WORKDIR}/rootfs"
KERNEL_IMAGE_PKG ??= "${@ ("linux-image-" + d.getVar("KERNEL_NAME", True)) if d.getVar("KERNEL_NAME", True) else ""}"
@@ -85,6 +84,26 @@ inherit image-postproc-extension
inherit image-locales-extension
inherit image-account-extension
+# Extra space for rootfs in MB
+ROOTFS_EXTRA ?= "64"
+
+def get_rootfs_size(d):
+ import subprocess
+ rootfs_extra = int(d.getVar("ROOTFS_EXTRA", True))
+
+ output = subprocess.check_output(
+ ["sudo", "du", "-xs", "--block-size=1k", d.getVar("IMAGE_ROOTFS", True)]
+ )
+ base_size = int(output.split()[0])
+
+ return base_size + rootfs_extra * 1024
+
+python set_image_size () {
+ rootfs_size = get_rootfs_size(d)
+ d.setVar('ROOTFS_SIZE', str(rootfs_size))
+ d.setVarFlag('ROOTFS_SIZE', 'export', '1')
+}
+
def get_base_type(t, d):
bt = t
for c in d.getVar('IMAGE_CONVERSIONS').split():
@@ -110,18 +129,10 @@ python() {
# image types
IMAGE_CLASSES ??= ""
-IMGCLASSES = "container-img cpiogz-img ext4-img fit-img targz-img ubi-img ubifs-img vm-img wic-img"
+IMGCLASSES = "imagetypes imagetypes_wic imagetypes_vm imagetypes_container"
IMGCLASSES += "${IMAGE_CLASSES}"
inherit ${IMGCLASSES}
-# image conversions
-CONVERSION_CMD_gz = "${SUDO_CHROOT} sh -c 'gzip -f -9 -n -c --rsyncable ${IMAGE_FILE_CHROOT} > ${IMAGE_FILE_CHROOT}.gz'"
-CONVERSION_DEPS_gz = "gzip"
-
-XZ_OPTIONS ?= ""
-CONVERSION_CMD_xz = "${SUDO_CHROOT} sh -c 'cat ${IMAGE_FILE_CHROOT} | xz ${XZ_OPTIONS} > ${IMAGE_FILE_CHROOT}.xz'"
-CONVERSION_DEPS_xz = "xz-utils"
-
# hook up IMAGE_CMD_*
python() {
image_types = (d.getVar('IMAGE_FSTYPES') or '').split()
@@ -262,19 +273,6 @@ python() {
d.appendVar('IMAGER_BUILD_DEPS', ' ' + ' '.join(sorted(imager_build_deps)))
}
-# Extra space for rootfs in MB
-ROOTFS_EXTRA ?= "64"
-
-def get_rootfs_size(d):
- import subprocess
- rootfs_extra = int(d.getVar("ROOTFS_EXTRA", True))
-
- output = subprocess.check_output(
- ["sudo", "du", "-xs", "--block-size=1k", d.getVar("IMAGE_ROOTFS", True)]
- )
- base_size = int(output.split()[0])
-
- return base_size + rootfs_extra * 1024
# here we call a command that should describe your whole build system,
# this could be "git describe" or something similar.
@@ -293,12 +291,6 @@ get_build_id() {
fi
}
-python set_image_size () {
- rootfs_size = get_rootfs_size(d)
- d.setVar('ROOTFS_SIZE', str(rootfs_size))
- d.setVarFlag('ROOTFS_SIZE', 'export', '1')
-}
-
ROOTFS_CONFIGURE_COMMAND += "image_configure_fstab"
image_configure_fstab[weight] = "2"
image_configure_fstab() {
new file mode 100644
@@ -0,0 +1,91 @@
+# This software is a part of ISAR.
+# Copyright (C) 2021 Siemens AG
+#
+# SPDX-License-Identifier: MIT
+
+#image type: tar
+IMAGER_INSTALL_tar = "tar"
+TAR_OPTIIONS ?= ""
+
+IMAGE_CMD_tar() {
+ ${SUDO_CHROOT} tar ${TAR_OPTIONS} -cvzf \
+ ${IMAGE_FILE_CHROOT} --one-file-system -C ${PP_ROOTFS} .
+}
+
+# image type: ext4
+IMAGER_INSTALL_ext4 += "e2fsprogs"
+MKE2FS_ARGS ?= "-t ext4"
+
+IMAGE_CMD_ext4() {
+ truncate -s ${ROOTFS_SIZE}K '${IMAGE_FILE_HOST}'
+
+ ${SUDO_CHROOT} /sbin/mke2fs ${MKE2FS_ARGS} \
+ -F -d '${PP_ROOTFS}' '${IMAGE_FILE_CHROOT}'
+}
+
+# image type: cpio
+IMAGER_INSTALL_cpio += "cpio"
+CPIO_IMAGE_FORMAT ?= "newc"
+
+IMAGE_CMD_cpio() {
+ ${SUDO_CHROOT} \
+ sh -c "cd ${PP_ROOTFS}; /usr/bin/find . | \
+ /usr/bin/cpio -H ${CPIO_IMAGE_FORMAT} -o > \
+ ${IMAGE_FILE_CHROOT}"
+}
+
+# image type: fit
+MKIMAGE_ARGS ??= ""
+FIT_IMAGE_SOURCE ??= "fitimage.its"
+IMAGER_INSTALL_fit += "u-boot-tools device-tree-compiler"
+
+IMAGE_CMD_fit() {
+ if [ ! -e "${WORKDIR}/${FIT_IMAGE_SOURCE}" ]; then
+ die "FIT_IMAGE_SOURCE does not contain fitimage source file"
+ fi
+
+ ${SUDO_CHROOT} /usr/bin/mkimage ${MKIMAGE_ARGS} \
+ -f '${PP_WORK}/${FIT_IMAGE_SOURCE}' '${IMAGE_FILE_CHROOT}'
+}
+IMAGE_CMD_fit[depends] = "${PN}:do_transform_template"
+
+# image type: ubifs
+IMAGER_INSTALL_ubifs += "mtd-utils"
+IMAGE_CMD_REQUIRED_ARGS_ubifs = "MKUBIFS_ARGS"
+
+# glibc bug 23960 https://sourceware.org/bugzilla/show_bug.cgi?id=23960
+# should not use QEMU on armhf target with mkfs.ubifs < v2.1.3
+python() {
+ if 'ubifs' in (d.getVar('IMAGE_BASETYPES') or '').split():
+ d.setVar('ISAR_CROSS_COMPILE_armhf', '1')
+}
+
+IMAGE_CMD_ubifs() {
+ ${SUDO_CHROOT} /usr/sbin/mkfs.ubifs ${MKUBIFS_ARGS} \
+ -r '${PP_ROOTFS}' '${IMAGE_FILE_CHROOT}'
+}
+
+# image type: ubi
+IMAGER_INSTALL_ubi += "mtd-utils"
+IMAGE_CMD_REQUIRED_ARGS_ubi = "UBINIZE_ARGS"
+UBINIZE_CFG ??= "ubinize.cfg"
+
+IMAGE_CMD_ubi() {
+ if [ ! -e "${WORKDIR}/${UBINIZE_CFG}" ]; then
+ die "UBINIZE_CFG does not contain ubinize config file."
+ fi
+
+ ${SUDO_CHROOT} /usr/sbin/ubinize ${UBINIZE_ARGS} \
+ -o '${IMAGE_FILE_CHROOT}' '${PP_WORK}/${UBINIZE_CFG}'
+}
+IMAGE_CMD_ubi[depends] = "${PN}:do_transform_template"
+
+# image conversions
+IMAGE_CONVERSIONS = "gz xz"
+
+CONVERSION_CMD_gz = "${SUDO_CHROOT} sh -c 'gzip -f -9 -n -c --rsyncable ${IMAGE_FILE_CHROOT} > ${IMAGE_FILE_CHROOT}.gz'"
+CONVERSION_DEPS_gz = "gzip"
+
+XZ_OPTIONS ?= ""
+CONVERSION_CMD_xz = "${SUDO_CHROOT} sh -c 'cat ${IMAGE_FILE_CHROOT} | xz ${XZ_OPTIONS} > ${IMAGE_FILE_CHROOT}.xz'"
+CONVERSION_DEPS_xz = "xz-utils"
similarity index 100%
rename from meta/classes/container-img.bbclass
rename to meta/classes/imagetypes_container.bbclass
similarity index 100%
rename from meta/classes/vm-img.bbclass
rename to meta/classes/imagetypes_vm.bbclass
similarity index 100%
rename from meta/classes/wic-img.bbclass
rename to meta/classes/imagetypes_wic.bbclass
deleted file mode 100644
@@ -1,8 +0,0 @@
-# This software is a part of ISAR.
-# Copyright (c) Siemens AG, 2018
-#
-# SPDX-License-Identifier: MIT
-
-IMAGE_CMD_tar() {
- sudo tar -cvzf ${DEPLOY_DIR_IMAGE}/${IMAGE_FULLNAME}.tar.gz --one-file-system -C ${IMAGE_ROOTFS} .
-}
deleted file mode 100644
@@ -1,20 +0,0 @@
-# This software is a part of ISAR.
-# Copyright (C) Siemens AG, 2019
-#
-# SPDX-License-Identifier: MIT
-
-UBINIZE_CFG ??= "ubinize.cfg"
-
-IMAGER_INSTALL_ubi += "mtd-utils"
-
-# Generate ubi filesystem image
-IMAGE_CMD_ubi() {
- if [ ! -e "${WORKDIR}/${UBINIZE_CFG}" ]; then
- die "UBINIZE_CFG does not contain ubinize config file."
- fi
-
- ${SUDO_CHROOT} /usr/sbin/ubinize ${UBINIZE_ARGS} \
- -o '${IMAGE_FILE_CHROOT}' '${PP_WORK}/${UBINIZE_CFG}'
-}
-IMAGE_CMD_ubi[depends] = "${PN}:do_transform_template"
-IMAGE_CMD_REQUIRED_ARGS_ubi = "UBINIZE_ARGS"
deleted file mode 100644
@@ -1,21 +0,0 @@
-# This software is a part of ISAR.
-# Copyright (C) Siemens AG, 2019
-#
-# SPDX-License-Identifier: MIT
-
-IMAGER_INSTALL_ubifs += "mtd-utils"
-
-# glibc bug 23960 https://sourceware.org/bugzilla/show_bug.cgi?id=23960
-# should not use QEMU on armhf target with mkfs.ubifs < v2.1.3
-python() {
- if 'ubifs' in (d.getVar('IMAGE_BASETYPES') or '').split():
- d.setVar('ISAR_CROSS_COMPILE_armhf', '1')
-}
-
-# Generate ubifs filesystem image
-IMAGE_CMD_ubifs() {
- # Create ubifs image using buildchroot tools
- ${SUDO_CHROOT} /usr/sbin/mkfs.ubifs ${MKUBIFS_ARGS} \
- -r '${PP_ROOTFS}' '${IMAGE_FILE_CHROOT}'
-}
-IMAGE_CMD_REQUIRED_ARGS_ubifs = "MKUBIFS_ARGS"
Instead of per-type classes *-img.bbclass, we move to - imagetypes.bbclass for the "simple" types and the conversions - dedicated files for the more complex types: - imagetypes_wic.bbclass - imagetypes_vm.bbclass - imagetypes_contaier.bbclass Signed-off-by: Adriaan Schmidt <adriaan.schmidt@siemens.com> --- meta/classes/cpiogz-img.bbclass | 14 --- meta/classes/ext4-img.bbclass | 15 --- meta/classes/fit-img.bbclass | 22 ----- meta/classes/image.bbclass | 50 +++++----- meta/classes/imagetypes.bbclass | 91 +++++++++++++++++++ ...g.bbclass => imagetypes_container.bbclass} | 0 .../{vm-img.bbclass => imagetypes_vm.bbclass} | 0 ...wic-img.bbclass => imagetypes_wic.bbclass} | 0 meta/classes/targz-img.bbclass | 8 -- meta/classes/ubi-img.bbclass | 20 ---- meta/classes/ubifs-img.bbclass | 21 ----- 11 files changed, 112 insertions(+), 129 deletions(-) delete mode 100644 meta/classes/cpiogz-img.bbclass delete mode 100644 meta/classes/ext4-img.bbclass delete mode 100644 meta/classes/fit-img.bbclass create mode 100644 meta/classes/imagetypes.bbclass rename meta/classes/{container-img.bbclass => imagetypes_container.bbclass} (100%) rename meta/classes/{vm-img.bbclass => imagetypes_vm.bbclass} (100%) rename meta/classes/{wic-img.bbclass => imagetypes_wic.bbclass} (100%) delete mode 100644 meta/classes/targz-img.bbclass delete mode 100644 meta/classes/ubi-img.bbclass delete mode 100644 meta/classes/ubifs-img.bbclass