summaryrefslogtreecommitdiffstats
path: root/meta/classes/image.bbclass
diff options
context:
space:
mode:
authorMartin Jansa <Martin.Jansa@gmail.com>2018-07-10 19:36:10 +0000
committerMartin Jansa <Martin.Jansa@gmail.com>2022-06-03 15:29:22 +0200
commit0b9c23c0fdb158a8c2294dba97d0421d59888694 (patch)
tree918f099998abb0ea86e926e7cf2e6018c9cb1fc5 /meta/classes/image.bbclass
parentcdeae4218092cc3ea748cd07260b3198924f788d (diff)
downloadopenembedded-core-contrib-0b9c23c0fdb158a8c2294dba97d0421d59888694.tar.gz
image*.bbclass, kernel*.bbclass: create versioned hard links instead of version-less symlinks
* We used to create the actual artifact files with some version in the filename and then created symlink without any version which was updated to point to the latest one created. In some scenarios it's useful to create all artifacts - typically rootfs and kernel images with the same version - like release build even when the kernel itself wasn't modified since the previous release. If we include the release version in the regular _NAME variables then we'll need to re-run do_deploy and do_image which will cause kernel to be rebuilt and image to be re-created even when the only change since last build was the version number. With this change we can re-use kernel and image from sstate when nothing was changed and run only very fast do_deploy_links task which just adds another hard link to existing artifact from sstate. * This is already used by various LGE builds as do_webos_deploy_fixup() https://github.com/webosose/meta-webosose/blob/master/meta-webos/classes/webos_deploy.bbclass but injecting this task in all the right places id difficult and sometimes requires whole bbclass to be duplicated. Having simpler way of versioning artifacts directly in oe-core might be useful for others. * move IMAGE_VERSION_SUFFIX from _NAME variables to _LINK_NAME that way e.g. kernel.do_deploy can be reused from sstate to provide "version-less" artifacts and then very fast do_deploy_links task just adds links with consistent suffixes (by default the version from the recipe but could be easily set to e.g. some release name when building some products). * create hard links instead of symlinks, so that whatever version the filename says is really there * some IMAGE_FSTYPES might need the "version-less" IMAGE_NAME file to be removed first or they might either append or update the content of the image instead of creating new image file from scratch - I have seen this only with one proprietary format we generate with our own tool, so hopefully this isn't very common * this is basically the mechanism are using in webOS with WEBOS_IMAGE_NAME_SUFFIX which is for official builds set from jenkins job and then all artifacts (images as well as corresponding kernel files) have the same version string) * without this, you can still easily set the variables to contain the version from jenkins job (excluded from sstate signature like DATETIME currently is to prevent rebuilding it everytime even when the content didn't change) but then when kernel is reused from sstate you can have version 1.0 used on kernel artifacts and 2.0 on image artifacts. * if you don't exclude the version string with vardepsexclude, then you get the right version in the filenames but for cost of re-executing do_deploy every single time, which with rm_work will cause all kernel tasks to be re-executed (together with everything which depends on it like external modules etc). * the implementation "from outside" is a bit tricky as shown in webOS OSE, because first you need to reverse the meaning of IMAGE_NAME and IMAGE_LINK_NAME like here, but also replace all symlinks with hardlinks and then adjust all recipes/bbclasses to depend on our do_deploy_fixup task instead of the original do_deploy see the variable modifications: https://github.com/webosose/meta-webosose/blob/a35e81622aae1066591e44a132d01297ff478248/meta-webos/conf/distro/include/webos.inc#L65 and then various bbclasses to hook do_webos_deploy_fixup task creating the hardlinks for possible artifacts: https://github.com/webosose/meta-webosose/blob/a35e81622aae1066591e44a132d01297ff478248/meta-webos/classes/webos_deploy.bbclass https://github.com/webosose/meta-webosose/blob/a35e81622aae1066591e44a132d01297ff478248/meta-webos/classes/kernel.bbclass https://github.com/webosose/meta-webosose/blob/a35e81622aae1066591e44a132d01297ff478248/meta-webos/classes/image.bbclass so hopefully with all these changes in oe-core other project can achieve the same just by setting one variable IMAGE_VERSION_SUFFIX * drop ${PKGE}-${PKGV}-${PR} from kernel artifacts names (this is the latest build) and add it only in hardlinks created in do_deploy_links so that we can use PKGR there again (because these links are generally used only by human operators and they don't have their own TASKHASH or the IMAGE_VERSION_SUFFIX might be set to some release name which they do understand * this allows to drop package_get_auto_pr from kernel do_deploy as well, leaving only 2 EXTENDPRAUTO bumps for each kernel build (do_package and do_deploy_links, unfortunatelly these will still have different value, so if you're looking for the exact kernel image in deploy directory based on kernel image package version seen on the device the EXTENDPRAUTO part of PR will be different). [YOCTO #12937] Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Diffstat (limited to 'meta/classes/image.bbclass')
-rw-r--r--meta/classes/image.bbclass10
1 files changed, 5 insertions, 5 deletions
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index c2f3232027..bf271ef501 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -589,14 +589,14 @@ python create_symlinks() {
return
for type in subimages:
dst = os.path.join(deploy_dir, link_name + "." + type)
- src = img_name + imgsuffix + type
- if os.path.exists(os.path.join(deploy_dir, src)):
- bb.note("Creating symlink: %s -> %s" % (dst, src))
+ src = os.path.join(deploy_dir, img_name + imgsuffix + type)
+ if os.path.exists(src):
+ bb.note("Creating hardlink: %s -> %s" % (dst, src))
if os.path.islink(dst):
os.remove(dst)
- os.symlink(src, dst)
+ os.link(src, dst)
else:
- bb.note("Skipping symlink, source does not exist: %s -> %s" % (dst, src))
+ bb.note("Skipping hardlink, source does not exist: %s -> %s" % (dst, src))
}
MULTILIBRE_ALLOW_REP =. "${base_bindir}|${base_sbindir}|${bindir}|${sbindir}|${libexecdir}|${sysconfdir}|${nonarch_base_libdir}/udev|/lib/modules/[^/]*/modules.*|"