* [PATCH 1/3] meta/image classes: refactor task stamps
2019-03-21 14:07 [PATCH 0/3] Clean image pipeline claudius.heine.ext
@ 2019-03-21 14:07 ` claudius.heine.ext
2019-03-21 14:07 ` [PATCH 2/3] meta/classes/*-img: remove 'inherit image' statements claudius.heine.ext
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: claudius.heine.ext @ 2019-03-21 14:07 UTC (permalink / raw)
To: isar-users; +Cc: Claudius Heine
From: Claudius Heine <ch@denx.de>
This patch adds 'DISTRO' and 'MACHINE' to 'PF' and removes the 'WORKDIR'
declaration in the 'image.bbclass'. This way each 'PN', 'DISTRO',
'MACHINE' tripel will have their own 'WORKDIR' and 'STAMP' directory.
'stamp-extra-info' settings for 'DISTRO' and 'MACHINE' is no longer
necessary for each task.
Signed-off-by: Claudius Heine <ch@denx.de>
---
meta/classes/ext4-img.bbclass | 2 --
meta/classes/fit-img.bbclass | 2 --
meta/classes/image.bbclass | 16 +++-------------
meta/classes/targz-img.bbclass | 2 --
meta/classes/ubi-img.bbclass | 2 --
meta/classes/ubifs-img.bbclass | 2 --
meta/classes/wic-img.bbclass | 4 ----
7 files changed, 3 insertions(+), 27 deletions(-)
diff --git a/meta/classes/ext4-img.bbclass b/meta/classes/ext4-img.bbclass
index 29e5f77..5eac507 100644
--- a/meta/classes/ext4-img.bbclass
+++ b/meta/classes/ext4-img.bbclass
@@ -3,8 +3,6 @@
EXT4_IMAGE_FILE = "${DEPLOY_DIR_IMAGE}/${IMAGE_FULLNAME}.ext4.img"
-do_ext4_image[stamp-extra-info] = "${DISTRO}-${MACHINE}"
-
# Generate ext4 filesystem image
do_ext4_image() {
rm -f ${EXT4_IMAGE_FILE}
diff --git a/meta/classes/fit-img.bbclass b/meta/classes/fit-img.bbclass
index edca09f..be0cbfe 100644
--- a/meta/classes/fit-img.bbclass
+++ b/meta/classes/fit-img.bbclass
@@ -13,8 +13,6 @@ FIT_IMAGE_FILE ?= "${IMAGE_FULLNAME}.fit.img"
IMAGER_INSTALL += "u-boot-tools device-tree-compiler"
-do_fit_image[stamp-extra-info] = "${DISTRO}-${MACHINE}"
-
# Generate fit image
do_fit_image() {
if [ ! -e "${WORKDIR}/${FIT_IMAGE_SOURCE}" ]; then
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 3ba755f..7cbe555 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -1,6 +1,8 @@
# This software is a part of ISAR.
# Copyright (C) 2015-2017 ilbers GmbH
+PF = "${PN}-${DISTRO}-${MACHINE}"
+
IMAGE_INSTALL ?= ""
IMAGE_TYPE ?= "ext4-img"
IMAGE_ROOTFS = "${WORKDIR}/rootfs"
@@ -8,7 +10,7 @@ IMAGE_ROOTFS = "${WORKDIR}/rootfs"
IMAGE_INSTALL += "${@ ("linux-image-" + d.getVar("KERNEL_NAME", True)) if d.getVar("KERNEL_NAME", True) else ""}"
# Name of the image including distro&machine names
-IMAGE_FULLNAME = "${PN}-${DISTRO}-${MACHINE}"
+IMAGE_FULLNAME = "${PF}"
# These variables are used by wic and start_vm
KERNEL_IMAGE ?= "${@get_image_name(d, 'vmlinuz')[1]}"
@@ -38,8 +40,6 @@ DEPENDS += "${IMAGE_INSTALL} ${IMAGE_TRANSIENT_PACKAGES}"
IMAGE_TRANSIENT_PACKAGES += "isar-cfg-localepurge isar-cfg-rootpw"
-WORKDIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/${MACHINE}/${PN}"
-
ISAR_RELEASE_CMD_DEFAULT = "git -C ${LAYERDIR_core} describe --tags --dirty --match 'v[0-9].[0-9]*'"
ISAR_RELEASE_CMD ?= "${ISAR_RELEASE_CMD_DEFAULT}"
@@ -173,10 +173,6 @@ isar_image_cleanup() {
'
}
-do_fetch[stamp-extra-info] = "${DISTRO}-${MACHINE}"
-do_unpack[stamp-extra-info] = "${DISTRO}-${MACHINE}"
-
-do_rootfs[stamp-extra-info] = "${DISTRO}-${MACHINE}"
do_rootfs[depends] = "isar-apt:do_cache_config isar-bootstrap-target:do_bootstrap"
do_rootfs[deptask] = "do_deploy_deb"
@@ -197,8 +193,6 @@ do_mark_rootfs() {
"${IMAGE_ROOTFS}"
}
-do_mark_rootfs[stamp-extra-info] = "${DISTRO}-${MACHINE}"
-
addtask mark_rootfs before do_copy_boot_files do_transform_template after do_rootfs
do_copy_boot_files() {
@@ -227,7 +221,6 @@ do_copy_boot_files() {
addtask copy_boot_files before do_build after do_rootfs
do_copy_boot_files[dirs] = "${DEPLOY_DIR_IMAGE}"
-do_copy_boot_files[stamp-extra-info] = "${DISTRO}-${MACHINE}"
SDKCHROOT_DIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/sdkchroot-${HOST_DISTRO}-${HOST_ARCH}"
@@ -256,7 +249,6 @@ do_populate_sdk() {
ln -Tfsr ${SDKCHROOT_DIR}/rootfs ${DEPLOY_DIR_IMAGE}/sdk-${DISTRO}-${DISTRO_ARCH}
}
-do_populate_sdk[stamp-extra-info] = "${DISTRO}-${MACHINE}"
do_populate_sdk[depends] = "sdkchroot:do_build"
addtask populate_sdk after do_rootfs
@@ -265,7 +257,6 @@ inherit base-apt-helper
do_cache_base_repo[depends] = "base-apt:do_cache_config"
do_cache_base_repo[lockfiles] = "${REPO_BASE_DIR}/isar.lock"
-do_cache_base_repo[stamp-extra-info] = "${DISTRO}-${MACHINE}"
do_cache_base_repo() {
if [ -d ${WORKDIR}/apt_cache ]; then
@@ -319,6 +310,5 @@ do_install_imager_deps() {
do_install_imager_deps[depends] = "buildchroot-target:do_build"
do_install_imager_deps[deptask] = "do_deploy_deb"
do_install_imager_deps[lockfiles] += "${REPO_ISAR_DIR}/isar.lock"
-do_install_imager_deps[stamp-extra-info] = "${DISTRO}-${MACHINE}"
addtask install_imager_deps before do_build
diff --git a/meta/classes/targz-img.bbclass b/meta/classes/targz-img.bbclass
index ef3748e..0a0ece7 100644
--- a/meta/classes/targz-img.bbclass
+++ b/meta/classes/targz-img.bbclass
@@ -5,8 +5,6 @@
TARGZ_IMAGE_FILE = "${DEPLOY_DIR_IMAGE}/${IMAGE_FULLNAME}.tar.gz"
-do_targz_image[stamp-extra-info] = "${DISTRO}-${MACHINE}"
-
do_targz_image() {
rm -f ${TARGZ_IMAGE_FILE}
sudo tar -cvzf ${TARGZ_IMAGE_FILE} -C ${IMAGE_ROOTFS} .
diff --git a/meta/classes/ubi-img.bbclass b/meta/classes/ubi-img.bbclass
index f61a940..f34ac84 100644
--- a/meta/classes/ubi-img.bbclass
+++ b/meta/classes/ubi-img.bbclass
@@ -16,8 +16,6 @@ UBI_IMAGE_FILE ?= "${IMAGE_FULLNAME}.ubi.img"
IMAGER_INSTALL += "mtd-utils"
-do_ubi_image[stamp-extra-info] = "${DISTRO}-${MACHINE}"
-
# Generate ubi filesystem image
do_ubi_image() {
if [ ! -e "${WORKDIR}/${UBINIZE_CFG}" ]; then
diff --git a/meta/classes/ubifs-img.bbclass b/meta/classes/ubifs-img.bbclass
index ed37357..dcf9eb9 100644
--- a/meta/classes/ubifs-img.bbclass
+++ b/meta/classes/ubifs-img.bbclass
@@ -14,8 +14,6 @@ UBIFS_IMAGE_FILE ?= "${IMAGE_FULLNAME}.ubifs.img"
IMAGER_INSTALL += "mtd-utils"
-do_ubifs_image[stamp-extra-info] = "${DISTRO}-${MACHINE}"
-
# Generate ubifs filesystem image
do_ubifs_image() {
rm -f '${DEPLOY_DIR_IMAGE}/${UBIFS_IMAGE_FILE}'
diff --git a/meta/classes/wic-img.bbclass b/meta/classes/wic-img.bbclass
index 5a451a0..3ca8607 100644
--- a/meta/classes/wic-img.bbclass
+++ b/meta/classes/wic-img.bbclass
@@ -101,8 +101,6 @@ FAKEROOTCMD ?= "${ISARROOT}/scripts/wic_fakeroot"
RECIPE_SYSROOT_NATIVE ?= "/"
BUILDCHROOT_DIR = "${BUILDCHROOT_TARGET_DIR}"
-do_wic_image[stamp-extra-info] = "${DISTRO}-${MACHINE}"
-
WIC_CREATE_EXTRA_ARGS ?= ""
WICVARS += "\
@@ -141,8 +139,6 @@ do_rootfs_wicenv[prefuncs] = 'set_image_size'
WIC_IMAGE_FILE ="${DEPLOY_DIR_IMAGE}/${IMAGE_FULLNAME}.wic.img"
-do_build[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
-
do_wic_image() {
buildchroot_do_mounts
sudo -s <<'EOSUDO'
--
2.20.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/3] meta/classes/*-img: remove 'inherit image' statements
2019-03-21 14:07 [PATCH 0/3] Clean image pipeline claudius.heine.ext
2019-03-21 14:07 ` [PATCH 1/3] meta/image classes: refactor task stamps claudius.heine.ext
@ 2019-03-21 14:07 ` claudius.heine.ext
2019-03-21 14:07 ` [PATCH 3/3] meta/classes/image*: refactor image pipeline and image.bbclass claudius.heine.ext
2019-03-25 8:21 ` [PATCH 0/3] Clean image pipeline Claudius Heine
3 siblings, 0 replies; 5+ messages in thread
From: claudius.heine.ext @ 2019-03-21 14:07 UTC (permalink / raw)
To: isar-users; +Cc: Claudius Heine
From: Claudius Heine <ch@denx.de>
Those statements are not necessary since those files are
included by the 'image.bbclass'
Signed-off-by: Claudius Heine <ch@denx.de>
---
meta/classes/fit-img.bbclass | 3 ---
meta/classes/ubi-img.bbclass | 3 ---
meta/classes/ubifs-img.bbclass | 2 --
3 files changed, 8 deletions(-)
diff --git a/meta/classes/fit-img.bbclass b/meta/classes/fit-img.bbclass
index be0cbfe..e8026c4 100644
--- a/meta/classes/fit-img.bbclass
+++ b/meta/classes/fit-img.bbclass
@@ -6,9 +6,6 @@
MKIMAGE_ARGS ??= ""
FIT_IMAGE_SOURCE ??= "fitimage.its"
-
-inherit image
-
FIT_IMAGE_FILE ?= "${IMAGE_FULLNAME}.fit.img"
IMAGER_INSTALL += "u-boot-tools device-tree-compiler"
diff --git a/meta/classes/ubi-img.bbclass b/meta/classes/ubi-img.bbclass
index f34ac84..a34c465 100644
--- a/meta/classes/ubi-img.bbclass
+++ b/meta/classes/ubi-img.bbclass
@@ -9,9 +9,6 @@ python() {
}
UBINIZE_CFG ??= "ubinize.cfg"
-
-inherit image
-
UBI_IMAGE_FILE ?= "${IMAGE_FULLNAME}.ubi.img"
IMAGER_INSTALL += "mtd-utils"
diff --git a/meta/classes/ubifs-img.bbclass b/meta/classes/ubifs-img.bbclass
index dcf9eb9..bf019a8 100644
--- a/meta/classes/ubifs-img.bbclass
+++ b/meta/classes/ubifs-img.bbclass
@@ -8,8 +8,6 @@ python() {
bb.fatal("MKUBIFS_ARGS must be set")
}
-inherit image
-
UBIFS_IMAGE_FILE ?= "${IMAGE_FULLNAME}.ubifs.img"
IMAGER_INSTALL += "mtd-utils"
--
2.20.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 3/3] meta/classes/image*: refactor image pipeline and image.bbclass
2019-03-21 14:07 [PATCH 0/3] Clean image pipeline claudius.heine.ext
2019-03-21 14:07 ` [PATCH 1/3] meta/image classes: refactor task stamps claudius.heine.ext
2019-03-21 14:07 ` [PATCH 2/3] meta/classes/*-img: remove 'inherit image' statements claudius.heine.ext
@ 2019-03-21 14:07 ` claudius.heine.ext
2019-03-25 8:21 ` [PATCH 0/3] Clean image pipeline Claudius Heine
3 siblings, 0 replies; 5+ messages in thread
From: claudius.heine.ext @ 2019-03-21 14:07 UTC (permalink / raw)
To: isar-users; +Cc: Claudius Heine
From: Claudius Heine <ch@denx.de>
The new pipeline is roughly as follows:
0. `do_unpack`
1. `do_rootfs`
2. `do_rootfs_postprocess`
3. `do_image_tools`
4. `do_image`
5. `do_deploy`
x. `do_build`
This commit also splits the image.bbclass functionality up into
additional bbclass files to improve independant development.
Signed-off-by: Claudius Heine <ch@denx.de>
---
meta/classes/ext4-img.bbclass | 2 +-
meta/classes/fit-img.bbclass | 2 +-
meta/classes/image-cache-extension.bbclass | 26 +++++
meta/classes/image-sdk-extension.bbclass | 36 +++++++
meta/classes/image-tools-extension.bbclass | 43 ++++++++
meta/classes/image.bbclass | 113 +++++----------------
meta/classes/targz-img.bbclass | 2 +-
meta/classes/ubi-img.bbclass | 2 +-
meta/classes/ubifs-img.bbclass | 2 +-
meta/classes/wic-img.bbclass | 4 +-
10 files changed, 136 insertions(+), 96 deletions(-)
create mode 100644 meta/classes/image-cache-extension.bbclass
create mode 100644 meta/classes/image-sdk-extension.bbclass
create mode 100644 meta/classes/image-tools-extension.bbclass
diff --git a/meta/classes/ext4-img.bbclass b/meta/classes/ext4-img.bbclass
index 5eac507..e2e91a8 100644
--- a/meta/classes/ext4-img.bbclass
+++ b/meta/classes/ext4-img.bbclass
@@ -24,5 +24,5 @@ do_ext4_image() {
_do_ext4_image_cleanup
}
-addtask ext4_image before do_build after do_copy_boot_files
+addtask ext4_image before do_image after do_image_tools
do_ext4_image[prefuncs] = 'set_image_size'
diff --git a/meta/classes/fit-img.bbclass b/meta/classes/fit-img.bbclass
index e8026c4..221ac3f 100644
--- a/meta/classes/fit-img.bbclass
+++ b/meta/classes/fit-img.bbclass
@@ -24,4 +24,4 @@ do_fit_image() {
sudo chroot ${BUILDCHROOT_DIR} /usr/bin/mkimage ${MKIMAGE_ARGS} \
-f '${PP_WORK}/${FIT_IMAGE_SOURCE}' '${PP_DEPLOY}/${FIT_IMAGE_FILE}'
}
-addtask fit_image before do_build after do_copy_boot_files do_install_imager_deps do_unpack do_transform_template
+addtask fit_image before do_image after do_image_tools do_transform_template
diff --git a/meta/classes/image-cache-extension.bbclass b/meta/classes/image-cache-extension.bbclass
new file mode 100644
index 0000000..af17e0b
--- /dev/null
+++ b/meta/classes/image-cache-extension.bbclass
@@ -0,0 +1,26 @@
+# This software is a part of ISAR.
+# Copyright (C) Siemens AG, 2019
+#
+# SPDX-License-Identifier: MIT
+#
+# This class extends the image.bbclass to supply the creation of cache repositories
+
+inherit base-apt-helper
+
+do_cache_base_repo[depends] = "base-apt:do_cache_config"
+do_cache_base_repo[lockfiles] = "${REPO_BASE_DIR}/isar.lock"
+do_cache_base_repo[stamp-extra-info] = "${DISTRO}-${MACHINE}"
+do_cache_base_repo() {
+ if [ -d ${WORKDIR}/apt_cache ]; then
+ populate_base_apt ${WORKDIR}/apt_cache
+ fi
+
+ if [ -d ${BUILDCHROOT_HOST_DIR}/var/cache/apt ]; then
+ populate_base_apt ${BUILDCHROOT_HOST_DIR}/var/cache/apt
+ fi
+
+ if [ -d ${BUILDCHROOT_TARGET_DIR}/var/cache/apt ]; then
+ populate_base_apt ${BUILDCHROOT_TARGET_DIR}/var/cache/apt
+ fi
+}
+addtask cache_base_repo after do_rootfs do_install_imager_deps
diff --git a/meta/classes/image-sdk-extension.bbclass b/meta/classes/image-sdk-extension.bbclass
new file mode 100644
index 0000000..1838080
--- /dev/null
+++ b/meta/classes/image-sdk-extension.bbclass
@@ -0,0 +1,36 @@
+# This software is a part of ISAR.
+# Copyright (C) Siemens AG, 2019
+#
+# SPDX-License-Identifier: MIT
+#
+# This class extends the image.bbclass to supply the creation of a sdk
+
+SDKCHROOT_DIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/sdkchroot-${HOST_DISTRO}-${HOST_ARCH}"
+
+do_populate_sdk[stamp-extra-info] = "${DISTRO}-${MACHINE}"
+do_populate_sdk[depends] = "sdkchroot:do_build"
+do_populate_sdk() {
+ # Copy isar-apt with deployed Isar packages
+ sudo cp -Trpfx ${REPO_ISAR_DIR}/${DISTRO} ${SDKCHROOT_DIR}/rootfs/isar-apt
+
+ # Purge apt cache to make image slimmer
+ sudo rm -rf ${SDKCHROOT_DIR}/rootfs/var/cache/apt/*
+
+ sudo umount -R ${SDKCHROOT_DIR}/rootfs/dev || true
+ sudo umount ${SDKCHROOT_DIR}/rootfs/proc || true
+ sudo umount -R ${SDKCHROOT_DIR}/rootfs/sys || true
+
+ # Remove setup scripts
+ sudo rm -f ${SDKCHROOT_DIR}/rootfs/chroot-setup.sh ${SDKCHROOT_DIR}/rootfs/configscript.sh
+
+ # Copy mount_chroot.sh for convenience
+ sudo cp ${ISARROOT}/scripts/mount_chroot.sh ${SDKCHROOT_DIR}/rootfs
+
+ # Create SDK archive
+ sudo tar -C ${SDKCHROOT_DIR} --transform="s|^rootfs|sdk-${DISTRO}-${DISTRO_ARCH}|" \
+ -c rootfs | xz -T0 > ${DEPLOY_DIR_IMAGE}/sdk-${DISTRO}-${DISTRO_ARCH}.tar.xz
+
+ # Install deployment link for local use
+ ln -Tfsr ${SDKCHROOT_DIR}/rootfs ${DEPLOY_DIR_IMAGE}/sdk-${DISTRO}-${DISTRO_ARCH}
+}
+addtask populate_sdk after do_rootfs
diff --git a/meta/classes/image-tools-extension.bbclass b/meta/classes/image-tools-extension.bbclass
new file mode 100644
index 0000000..0a6d5ee
--- /dev/null
+++ b/meta/classes/image-tools-extension.bbclass
@@ -0,0 +1,43 @@
+# This software is a part of ISAR.
+# Copyright (C) Siemens AG, 2019
+#
+# SPDX-License-Identifier: MIT
+#
+# This file extends the image.bbclass to supply tools for futher imager functions
+
+# Imager are expected to run natively, thus will use the target buildchroot.
+ISAR_CROSS_COMPILE = "0"
+
+inherit buildchroot
+
+IMAGER_INSTALL ??= ""
+IMAGER_BUILD_DEPS ??= ""
+DEPENDS += "${IMAGER_BUILD_DEPS}"
+
+python () {
+ if d.getVar('IMAGE_TYPE', True) == 'wic-img':
+ d.appendVar('IMAGER_INSTALL',
+ ' ' + d.getVar('WIC_IMAGER_INSTALL', True))
+}
+
+do_install_imager_deps[depends] = "buildchroot-target:do_build"
+do_install_imager_deps[deptask] = "do_deploy_deb"
+do_install_imager_deps[lockfiles] += "${REPO_ISAR_DIR}/isar.lock"
+do_install_imager_deps() {
+ if [ -z "${@d.getVar("IMAGER_INSTALL", True).strip()}" ]; then
+ exit
+ fi
+
+ buildchroot_do_mounts
+
+ E="${@bb.utils.export_proxies(d)}"
+ sudo -E chroot ${BUILDCHROOT_DIR} sh -c ' \
+ apt-get update \
+ -o Dir::Etc::sourcelist="sources.list.d/isar-apt.list" \
+ -o Dir::Etc::sourceparts="-" \
+ -o APT::Get::List-Cleanup="0"
+ apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y \
+ --allow-unauthenticated install \
+ ${IMAGER_INSTALL}'
+}
+addtask install_imager_deps before do_image_tools
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 7cbe555..3ffdbca 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -53,8 +53,10 @@ image_do_mounts() {
buildchroot_do_mounts
}
-inherit ${IMAGE_TYPE}
inherit isar-bootstrap-helper
+inherit image-sdk-extension
+inherit image-cache-extension
+inherit image-tools-extension
# Extra space for rootfs in MB
ROOTFS_EXTRA ?= "64"
@@ -174,7 +176,6 @@ isar_image_cleanup() {
}
do_rootfs[depends] = "isar-apt:do_cache_config isar-bootstrap-target:do_bootstrap"
-
do_rootfs[deptask] = "do_deploy_deb"
do_rootfs[root_cleandirs] = "${IMAGE_ROOTFS} \
${IMAGE_ROOTFS}/isar-apt"
@@ -192,9 +193,9 @@ do_mark_rootfs() {
--build-id "${BUILD_ID}" --variant "${DESCRIPTION}" \
"${IMAGE_ROOTFS}"
}
+addtask mark_rootfs before do_rootfs_postprocess after do_rootfs
-addtask mark_rootfs before do_copy_boot_files do_transform_template after do_rootfs
-
+do_copy_boot_files[dirs] = "${DEPLOY_DIR_IMAGE}"
do_copy_boot_files() {
KERNEL_IMAGE=${@get_image_name(d, 'vmlinuz')[1]}
if [ -n "${KERNEL_IMAGE}" ]; then
@@ -218,97 +219,31 @@ do_copy_boot_files() {
cp -f "$dtb" "${DEPLOY_DIR_IMAGE}/${DTB_FILE}"
fi
}
+addtask copy_boot_files before do_rootfs_postprocess after do_rootfs
-addtask copy_boot_files before do_build after do_rootfs
-do_copy_boot_files[dirs] = "${DEPLOY_DIR_IMAGE}"
-
-SDKCHROOT_DIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/sdkchroot-${HOST_DISTRO}-${HOST_ARCH}"
-
-do_populate_sdk() {
- # Copy isar-apt with deployed Isar packages
- sudo cp -Trpfx ${REPO_ISAR_DIR}/${DISTRO} ${SDKCHROOT_DIR}/rootfs/isar-apt
-
- # Purge apt cache to make image slimmer
- sudo rm -rf ${SDKCHROOT_DIR}/rootfs/var/cache/apt/*
-
- sudo umount -R ${SDKCHROOT_DIR}/rootfs/dev || true
- sudo umount ${SDKCHROOT_DIR}/rootfs/proc || true
- sudo umount -R ${SDKCHROOT_DIR}/rootfs/sys || true
-
- # Remove setup scripts
- sudo rm -f ${SDKCHROOT_DIR}/rootfs/chroot-setup.sh ${SDKCHROOT_DIR}/rootfs/configscript.sh
-
- # Copy mount_chroot.sh for convenience
- sudo cp ${ISARROOT}/scripts/mount_chroot.sh ${SDKCHROOT_DIR}/rootfs
-
- # Create SDK archive
- sudo tar -C ${SDKCHROOT_DIR} --transform="s|^rootfs|sdk-${DISTRO}-${DISTRO_ARCH}|" \
- -c rootfs | xz -T0 > ${DEPLOY_DIR_IMAGE}/sdk-${DISTRO}-${DISTRO_ARCH}.tar.xz
-
- # Install deployment link for local use
- ln -Tfsr ${SDKCHROOT_DIR}/rootfs ${DEPLOY_DIR_IMAGE}/sdk-${DISTRO}-${DISTRO_ARCH}
+python do_rootfs_postprocess() {
+ """Virtual task"""
+ pass
}
+addtask rootfs_postprocess before do_build after do_rootfs
-do_populate_sdk[depends] = "sdkchroot:do_build"
-
-addtask populate_sdk after do_rootfs
-
-inherit base-apt-helper
-
-do_cache_base_repo[depends] = "base-apt:do_cache_config"
-do_cache_base_repo[lockfiles] = "${REPO_BASE_DIR}/isar.lock"
-
-do_cache_base_repo() {
- if [ -d ${WORKDIR}/apt_cache ]; then
- populate_base_apt ${WORKDIR}/apt_cache
- fi
-
- if [ -d ${BUILDCHROOT_HOST_DIR}/var/cache/apt ]; then
- populate_base_apt ${BUILDCHROOT_HOST_DIR}/var/cache/apt
- fi
-
- if [ -d ${BUILDCHROOT_TARGET_DIR}/var/cache/apt ]; then
- populate_base_apt ${BUILDCHROOT_TARGET_DIR}/var/cache/apt
- fi
+python do_image_tools() {
+ """Virtual task"""
+ pass
}
+addtask image_tools before do_build after do_rootfs_postprocess
-addtask cache_base_repo after do_rootfs do_install_imager_deps
-
-# Imager are expected to run natively, thus will use the target buildchroot.
-ISAR_CROSS_COMPILE = "0"
-
-inherit buildchroot
-
-IMAGER_INSTALL ??= ""
-IMAGER_BUILD_DEPS ??= ""
-DEPENDS += "${IMAGER_BUILD_DEPS}"
-
-python () {
- if d.getVar('IMAGE_TYPE', True) == 'wic-img':
- d.appendVar('IMAGER_INSTALL',
- ' ' + d.getVar('WIC_IMAGER_INSTALL', True))
+python do_image() {
+ """Virtual task"""
+ pass
}
+addtask image before do_build after do_image_tools
-do_install_imager_deps() {
- if [ -z "${@d.getVar("IMAGER_INSTALL", True).strip()}" ]; then
- exit
- fi
-
- buildchroot_do_mounts
-
- E="${@bb.utils.export_proxies(d)}"
- sudo -E chroot ${BUILDCHROOT_DIR} sh -c ' \
- apt-get update \
- -o Dir::Etc::sourcelist="sources.list.d/isar-apt.list" \
- -o Dir::Etc::sourceparts="-" \
- -o APT::Get::List-Cleanup="0"
- apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y \
- --allow-unauthenticated install \
- ${IMAGER_INSTALL}'
+python do_deploy() {
+ """Virtual task"""
+ pass
}
+addtask deploy before do_build after do_image
-do_install_imager_deps[depends] = "buildchroot-target:do_build"
-do_install_imager_deps[deptask] = "do_deploy_deb"
-do_install_imager_deps[lockfiles] += "${REPO_ISAR_DIR}/isar.lock"
-
-addtask install_imager_deps before do_build
+# Last so that the image type can overwrite tasks if needed
+inherit ${IMAGE_TYPE}
diff --git a/meta/classes/targz-img.bbclass b/meta/classes/targz-img.bbclass
index 0a0ece7..f408527 100644
--- a/meta/classes/targz-img.bbclass
+++ b/meta/classes/targz-img.bbclass
@@ -10,4 +10,4 @@ do_targz_image() {
sudo tar -cvzf ${TARGZ_IMAGE_FILE} -C ${IMAGE_ROOTFS} .
}
-addtask targz_image before do_build after do_mark_rootfs
+addtask targz_image before do_image after do_imager_tools
diff --git a/meta/classes/ubi-img.bbclass b/meta/classes/ubi-img.bbclass
index a34c465..2cf3344 100644
--- a/meta/classes/ubi-img.bbclass
+++ b/meta/classes/ubi-img.bbclass
@@ -27,4 +27,4 @@ do_ubi_image() {
sudo chroot ${BUILDCHROOT_DIR} /usr/sbin/ubinize ${UBINIZE_ARGS} \
-o '${PP_DEPLOY}/${UBI_IMAGE_FILE}' '${PP_WORK}/${UBINIZE_CFG}'
}
-addtask ubi_image before do_build after do_copy_boot_files do_install_imager_deps do_unpack do_transform_template
+addtask ubi_image before do_image after do_image_tools do_transform_template
diff --git a/meta/classes/ubifs-img.bbclass b/meta/classes/ubifs-img.bbclass
index bf019a8..4297d21 100644
--- a/meta/classes/ubifs-img.bbclass
+++ b/meta/classes/ubifs-img.bbclass
@@ -23,4 +23,4 @@ do_ubifs_image() {
-r '${PP_ROOTFS}' '${PP_DEPLOY}/${UBIFS_IMAGE_FILE}'
}
-addtask ubifs_image before do_build after do_copy_boot_files do_install_imager_deps
+addtask ubifs_image before do_image after do_image_tools
diff --git a/meta/classes/wic-img.bbclass b/meta/classes/wic-img.bbclass
index 3ca8607..74368a6 100644
--- a/meta/classes/wic-img.bbclass
+++ b/meta/classes/wic-img.bbclass
@@ -133,7 +133,7 @@ python do_rootfs_wicenv () {
}
-addtask do_rootfs_wicenv after do_copy_boot_files before do_wic_image
+addtask do_rootfs_wicenv after do_rootfs_postprocess before do_wic_image
do_rootfs_wicenv[vardeps] += "${WICVARS}"
do_rootfs_wicenv[prefuncs] = 'set_image_size'
@@ -167,4 +167,4 @@ EOSUDO
do_wic_image[file-checksums] += "${WKS_FILE_CHECKSUM}"
do_wic_image[depends] = "buildchroot-target:do_build"
-addtask wic_image before do_build after do_install_imager_deps
+addtask wic_image before do_image after do_image_tools
--
2.20.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 0/3] Clean image pipeline
2019-03-21 14:07 [PATCH 0/3] Clean image pipeline claudius.heine.ext
` (2 preceding siblings ...)
2019-03-21 14:07 ` [PATCH 3/3] meta/classes/image*: refactor image pipeline and image.bbclass claudius.heine.ext
@ 2019-03-25 8:21 ` Claudius Heine
3 siblings, 0 replies; 5+ messages in thread
From: Claudius Heine @ 2019-03-25 8:21 UTC (permalink / raw)
To: isar-users; +Cc: Claudius Heine
On 21/03/2019 15.07, [ext] claudius.heine.ext@siemens.com wrote:
> From: Claudius Heine <ch@denx.de>
>
> Hi,
>
> this patchset implements the first version of a cleaner image creation
> pipeline. No functional change expected yet.
>
> It depends on the isar-image to image merge patchset
Some build error occur with this patchset. Will send v2 soon.
Claudius
>
> Cheers,
> Claudius
>
>
> Claudius Heine (3):
> meta/image classes: refactor task stamps
> meta/classes/*-img: remove 'inherit image' statements
> meta/classes/image*: refactor image pipeline and image.bbclass
>
> meta/classes/ext4-img.bbclass | 4 +-
> meta/classes/fit-img.bbclass | 7 +-
> meta/classes/image-cache-extension.bbclass | 26 +++++
> meta/classes/image-sdk-extension.bbclass | 36 ++++++
> meta/classes/image-tools-extension.bbclass | 43 +++++++
> meta/classes/image.bbclass | 129 +++++----------------
> meta/classes/targz-img.bbclass | 4 +-
> meta/classes/ubi-img.bbclass | 7 +-
> meta/classes/ubifs-img.bbclass | 6 +-
> meta/classes/wic-img.bbclass | 8 +-
> 10 files changed, 139 insertions(+), 131 deletions(-)
> create mode 100644 meta/classes/image-cache-extension.bbclass
> create mode 100644 meta/classes/image-sdk-extension.bbclass
> create mode 100644 meta/classes/image-tools-extension.bbclass
>
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-54 Fax: (+49)-8142-66989-80 Email: ch@denx.de
^ permalink raw reply [flat|nested] 5+ messages in thread