All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bootimg/image: Enhance bootimg to respect RM_OLD_IMAGE
@ 2016-01-17 11:16 Richard Purdie
  2016-01-30  1:34 ` Ricardo Neri
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Purdie @ 2016-01-17 11:16 UTC (permalink / raw)
  To: openembedded-core

Currently, iso and hddimg links don't respect RM_OLD_IMAGE. This
updates them to use the common symlinks code so that they behave
like the rest of the system.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>

diff --git a/meta/classes/bootimg.bbclass b/meta/classes/bootimg.bbclass
index ec9d0b7..ed9afb9 100644
--- a/meta/classes/bootimg.bbclass
+++ b/meta/classes/bootimg.bbclass
@@ -172,10 +172,6 @@ build_iso() {
 	fi
 
 	isohybrid $isohybrid_args ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.iso
-
-	cd ${DEPLOY_DIR_IMAGE}
-	rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.iso
-	ln -s ${IMAGE_NAME}.iso ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.iso
 }
 
 build_fat_img() {
@@ -280,10 +276,6 @@ build_hddimg() {
 		fi
 
 		chmod 644 ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg
-
-		cd ${DEPLOY_DIR_IMAGE}
-		rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hddimg
-		ln -s ${IMAGE_NAME}.hddimg ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hddimg
 	fi
 }
 
@@ -294,7 +286,10 @@ python do_bootimg() {
         bb.build.exec_func('build_efi_cfg', d)
     bb.build.exec_func('build_hddimg', d)
     bb.build.exec_func('build_iso', d)
+    bb.build.exec_func('create_symlinks', d)
 }
+do_bootimg[subimages] = "hddimg iso"
+do_bootimg[imgsuffix] = "."
 
 IMAGE_TYPEDEP_iso = "ext4"
 IMAGE_TYPEDEP_hddimg = "ext4"
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index fb923d9..782d555 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -397,7 +397,7 @@ python () {
         d.setVarFlag('do_image_%s' % t, 'fakeroot', '1')
         d.setVarFlag('do_image_%s' % t, 'prefuncs', debug + 'set_image_size')
         d.setVarFlag('do_image_%s' % t, 'postfuncs', 'create_symlinks')
-        d.setVarFlag('do_image_%s' % t, 'subimages', subimages)
+        d.setVarFlag('do_image_%s' % t, 'subimages', ' '.join(subimages))
         d.appendVarFlag('do_image_%s' % t, 'vardeps', ' '.join(vardeps))
         d.appendVarFlag('do_image_%s' % t, 'vardepsexclude', 'DATETIME')
 
@@ -460,15 +460,16 @@ python create_symlinks() {
     link_name = d.getVar('IMAGE_LINK_NAME', True)
     manifest_name = d.getVar('IMAGE_MANIFEST', True)
     taskname = d.getVar("BB_CURRENTTASK", True)
-    subimages = d.getVarFlag("do_" + taskname, 'subimages', False)
+    subimages = (d.getVarFlag("do_" + taskname, 'subimages', False) or "").split()
+    imgsuffix = d.getVarFlag("do_" + taskname, 'imgsuffix', True) or ".rootfs."
     os.chdir(deploy_dir)
 
     if not link_name:
         return
     for type in subimages:
-        if os.path.exists(img_name + ".rootfs." + type):
+        if os.path.exists(img_name + imgsuffix + type):
             dst = deploy_dir + "/" + link_name + "." + type
-            src = img_name + ".rootfs." + type
+            src = img_name + imgsuffix + type
             bb.note("Creating symlink: %s -> %s" % (dst, src))
             if os.path.islink(dst):
                 if d.getVar('RM_OLD_IMAGE', True) == "1" and \




^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] bootimg/image: Enhance bootimg to respect RM_OLD_IMAGE
  2016-01-17 11:16 [PATCH] bootimg/image: Enhance bootimg to respect RM_OLD_IMAGE Richard Purdie
@ 2016-01-30  1:34 ` Ricardo Neri
  2016-01-30 10:54   ` Richard Purdie
  0 siblings, 1 reply; 4+ messages in thread
From: Ricardo Neri @ 2016-01-30  1:34 UTC (permalink / raw)
  To: Richard Purdie; +Cc: openembedded-core

[Resending from an email subscribed to the oe list...]
On Sun, 2016-01-17 at 11:16 +0000, Richard Purdie wrote:
> @@ -294,7 +286,10 @@ python do_bootimg() {
>          bb.build.exec_func('build_efi_cfg', d)
>      bb.build.exec_func('build_hddimg', d)
>      bb.build.exec_func('build_iso', d)
> +    bb.build.exec_func('create_symlinks', d)
When I try to use bootimg.bbclass I get the following warning:

WARNING: Function create_symlinks doesn't exist

This is because create_symlinks is defined in image.bbclass but
bootimg.bbclass does not inherit from it. Should it be the case? Or the
definiton of create_symlinks should be moved to a separate file?

Thanks and BR,
Ricardo



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] bootimg/image: Enhance bootimg to respect RM_OLD_IMAGE
  2016-01-30  1:34 ` Ricardo Neri
@ 2016-01-30 10:54   ` Richard Purdie
  2016-01-31 20:58     ` Ricardo Neri
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Purdie @ 2016-01-30 10:54 UTC (permalink / raw)
  To: Ricardo Neri; +Cc: openembedded-core

On Fri, 2016-01-29 at 17:34 -0800, Ricardo Neri wrote:
> [Resending from an email subscribed to the oe list...]
> On Sun, 2016-01-17 at 11:16 +0000, Richard Purdie wrote:
> > @@ -294,7 +286,10 @@ python do_bootimg() {
> >          bb.build.exec_func('build_efi_cfg', d)
> >      bb.build.exec_func('build_hddimg', d)
> >      bb.build.exec_func('build_iso', d)
> > +    bb.build.exec_func('create_symlinks', d)
> When I try to use bootimg.bbclass I get the following warning:
> 
> WARNING: Function create_symlinks doesn't exist
> 
> This is because create_symlinks is defined in image.bbclass but
> bootimg.bbclass does not inherit from it. Should it be the case? Or
> the
> definiton of create_symlinks should be moved to a separate file?

I guess the key question is whether anyone is using bootimg.bbclass
without using image.bbclass, or whether that is even
possible/practical?

Was this an existing setup that broke?

Cheers,

Richard


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] bootimg/image: Enhance bootimg to respect RM_OLD_IMAGE
  2016-01-30 10:54   ` Richard Purdie
@ 2016-01-31 20:58     ` Ricardo Neri
  0 siblings, 0 replies; 4+ messages in thread
From: Ricardo Neri @ 2016-01-31 20:58 UTC (permalink / raw)
  To: Richard Purdie; +Cc: luv, openembedded-core

On Sat, 2016-01-30 at 10:54 +0000, Richard Purdie wrote:
> On Fri, 2016-01-29 at 17:34 -0800, Ricardo Neri wrote:
> > [Resending from an email subscribed to the oe list...]
> > On Sun, 2016-01-17 at 11:16 +0000, Richard Purdie wrote:
> > > @@ -294,7 +286,10 @@ python do_bootimg() {
> > >          bb.build.exec_func('build_efi_cfg', d)
> > >      bb.build.exec_func('build_hddimg', d)
> > >      bb.build.exec_func('build_iso', d)
> > > +    bb.build.exec_func('create_symlinks', d)
> > When I try to use bootimg.bbclass I get the following warning:
> > 
> > WARNING: Function create_symlinks doesn't exist
> > 
> > This is because create_symlinks is defined in image.bbclass but
> > bootimg.bbclass does not inherit from it. Should it be the case? Or
> > the
> > definiton of create_symlinks should be moved to a separate file?
> 
> I guess the key question is whether anyone is using bootimg.bbclass
> without using image.bbclass, or whether that is even
> possible/practical?

Hmm. Probably only image-live.bbclass. But if I understand correctly,
that class gets inherited by image.bbclass if live is specified in the
IMAGE_FSTYPES. 
> 
> Was this an existing setup that broke?

For the Linux UEFI Validation project we have a custom luv-live-image
recipe[1] that inherits from bootimg.bbclass but not from image.bbclass.
We have not had the need thus far. Our ramdisk does inherit
image.bbclass via core-image.bbclass[2].

Perhaps our live image recipe can be reworked to inherit from
image-live? Our main customization is that we have two partitions in the
bootable media.

Thanks and BR,
Ricardo

[1].https://github.com/01org/luv-yocto/blob/master/meta-luv/recipes-core/images/luv-live-image.bb
[2].https://github.com/01org/luv-yocto/blob/master/meta-luv/recipes-core/images/core-image-efi-initramfs.bb
> 
> Cheers,
> 
> Richard




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-01-31 20:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-17 11:16 [PATCH] bootimg/image: Enhance bootimg to respect RM_OLD_IMAGE Richard Purdie
2016-01-30  1:34 ` Ricardo Neri
2016-01-30 10:54   ` Richard Purdie
2016-01-31 20:58     ` Ricardo Neri

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.