Skip to contentSkip to conversation

image.bbclass: remove tmp/rootfs after image creation unless you set a variable

PATCH In review Chris Larson 9 participants 15 messages Jun 17, 2009 – Jun 18, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 image.bbclass: remove tmp/rootfs after image creation unless you set a variable

Set IMAGE_KEEPROOTFS to something other than the empty string to keep tmp/rootfs around after image creation, otherwise it will be removed, as it's not a fully functional filesystem, and causes much confusion among users as a result.

---
 classes/image.bbclass |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
classes/image.bbclass +1 -0
index f0cc3b3..974e734 100644
@@ -133,6 +133,7 @@ fakeroot do_rootfs () {
 	${IMAGE_POSTPROCESS_COMMAND}
 	
 	${MACHINE_POSTPROCESS_COMMAND}
+	${@['rm -rf ${IMAGE_ROOTFS}', ''][bool(d.getVar("IMAGE_KEEPROOTFS", 1))]}
 }
 
 do_deploy_to[nostamp] = "1"
Signature · 1 line
1.6.0
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Chris Larson

Set IMAGE_KEEPROOTFS to something other than the empty string to keep tmp/rootfs around after image creation, otherwise it will be removed, as it's not a fully functional filesystem, and causes much confusion among users as a result.

Signature · 1 line
Tom Rini
Acked-by on v1 1/1
#2 lore raw
In reply to Chris Larson

Dnia środa, 17 czerwca 2009 o 19:10:40 Chris Larson napisał(a):

Quoted 6 lines

Set IMAGE_KEEPROOTFS to something other than the empty string to keep tmp/rootfs around after image creation, otherwise it will be removed, as it's not a fully functional filesystem, and causes much confusion among users as a result.

I am also tired of explaining to users why tmp/rootfs should not be used as nfsroot.

Regards,

Signature · 3 lines
JID:      [email protected]
Website:  http://marcin.juszkiewicz.com.pl/
LinkedIn: http://www.linkedin.com/in/marcinjuszkiewicz
#3 lore raw
In reply to Chris Larson
Quoted 2 lines · Chris Larson

Set IMAGE_KEEPROOTFS to something other than the empty string to keep tmp/rootfs around after image creation, otherwise it will be removed

We had something like this proposed a while ago by I think Lynn Lin. This is already a bit more evolved since it is conditional on a variable. The proposal then was rejected on the grounds of breaking concurrent builds and I think this will likely be the case here, too.

comments?

#4 lore raw
Quoted 5 lines · Rolf Leggewie
Quoted 2 lines · Chris Larson

Set IMAGE_KEEPROOTFS to something other than the empty string to keep tmp/rootfs around after image creation, otherwise it will be removed

We had something like this proposed a while ago by I think Lynn Lin.

I revisited that thread and it was actually about something else.

http://thread.gmane.org/gmane.comp.handhelds.openembedded/24434

My earlier comment does not apply.

#5 lore raw
Quoted 7 lines · Rolf Leggewie
Quoted 6 lines · Rolf Leggewie
Quoted 3 lines · Chris Larson

Set IMAGE_KEEPROOTFS to something other than the empty string to keep tmp/rootfs around after image creation, otherwise it will be removed

Quoted 8 lines
Quoted 1 line

We had something like this proposed a while ago by I think Lynn Lin.

I revisited that thread and it was actually about something else.

http://thread.gmane.org/gmane.comp.handhelds.openembedded/24434

My earlier comment does not apply.

Pushed once it got acked a couple times :) Feel free to revert if there's a good reason to do s
o.

Signature · 7 lines
Chris Larson
clarson at kergoth dot com
clarson at mvista dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Software Engineer
MontaVista Software, Inc.
#6 lore raw
In reply to Rolf Leggewie
Quoted 10 lines · On Среда 17 июня 2009 21:40:58 Rolf Leggewie wrote:
Quoted 2 lines · Chris Larson

Set IMAGE_KEEPROOTFS to something other than the empty string to keep tmp/rootfs around after image creation, otherwise it will be removed

We had something like this proposed a while ago by I think Lynn Lin. This is already a bit more evolved since it is conditional on a variable. The proposal then was rejected on the grounds of breaking concurrent builds and I think this will likely be the case here, too.

comments?

I think that was on 'tmp.gz' deletion and this one actually removes IMAGE_ROOTFS, not tmp/rootfs, so it should be fine.

#7 lore raw
In reply to Chris Larson
Quoted 15 lines · Chris Larson

Set IMAGE_KEEPROOTFS to something other than the empty string to keep tmp/rootfs around after image creation, otherwise it will be removed, as it's not a fully functional filesystem, and causes much confusion among users as a result.

---
 classes/image.bbclass |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
classes/image.bbclass +0 -0
index f0cc3b3..974e734 100644

classes/image.bbclass fakeroot do_rootfs () { · line 139

Quoted 7 lines
classes/image.bbclass +1 -0
@@ -133,6 +133,7 @@ fakeroot do_rootfs () {
 	${IMAGE_POSTPROCESS_COMMAND}
 
 	${MACHINE_POSTPROCESS_COMMAND}
+	${@['rm -rf ${IMAGE_ROOTFS}', ''][bool(d.getVar("IMAGE_KEEPROOTFS", 1))]}
 }
 
 do_deploy_to[nostamp] = "1"

Something I've been thinking about for a while is moving rootfs into ${WORKDIR}/. That way you can have concurrent image generation for a start and rm_work could be taught to clean it up...

Cheers,

Richard

#8 lore raw
Quoted 22 lines · Richard Purdie
Quoted 21 lines · Chris Larson

Set IMAGE_KEEPROOTFS to something other than the empty string to keep tmp/rootfs around after image creation, otherwise it will be removed, as it's not a fully functional filesystem, and causes much confusion among users as a result.

---
 classes/image.bbclass |    1 +

 1 files changed, 1 insertions(+), 0 deletions(-)
classes/image.bbclass +1 -0
index f0cc3b3..974e734 100644
@@ -133,6 +133,7 @@ fakeroot do_rootfs () {
       ${IMAGE_POSTPROCESS_COMMAND}
 
       ${MACHINE_POSTPROCESS_COMMAND}
+     ${@['rm -rf ${IMAGE_ROOTFS}', ''][bool(d.getVar("IMAGE_KEEPROOTFS", 1))]}
  }
 
Quoted 5 lines
Quoted 1 line

 do_deploy_to[nostamp] = "1"

Something I've been thinking about for a while is moving rootfs into ${WORKDIR}/. That way you can have concurrent image generation for a start and rm_work could be taught to clean it up...

That's a better way of doing it, indeed. In fact, someone suggested it on irc, and I promptly went and forgot about it :)

Signature · 7 lines
Chris Larson
clarson at kergoth dot com
clarson at mvista dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Software Engineer
MontaVista Software, Inc.
#9 lore raw
In reply to Richard Purdie
Quoted 22 lines · Richard Purdie
Quoted 21 lines · Chris Larson

Set IMAGE_KEEPROOTFS to something other than the empty string to keep tmp/rootfs around after image creation, otherwise it will be removed, as it's not a fully functional filesystem, and causes much confusion among users as a result.

---
 classes/image.bbclass |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
classes/image.bbclass +1 -0
index f0cc3b3..974e734 100644
@@ -133,6 +133,7 @@ fakeroot do_rootfs () {
 	${IMAGE_POSTPROCESS_COMMAND}
 
 	${MACHINE_POSTPROCESS_COMMAND}
+	${@['rm -rf ${IMAGE_ROOTFS}', ''][bool(d.getVar("IMAGE_KEEPROOTFS", 1))]}
 }
 
Quoted 5 lines

classes/image.bbclass fakeroot do_rootfs () { · line 139

Quoted 1 line
classes/image.bbclass +0 -0
 do_deploy_to[nostamp] = "1"

Something I've been thinking about for a while is moving rootfs into ${WORKDIR}/. That way you can have concurrent image generation for a start and rm_work could be taught to clean it up...

Isn't the other part of that the need to serialize making the package index files?

Signature · 1 line
Tom Rini
#10 lore raw
Quoted 7 lines · Tom Rini
Quoted 3 lines · Richard Purdie

Something I've been thinking about for a while is moving rootfs into ${WORKDIR}/. That way you can have concurrent image generation for a start and rm_work could be taught to clean it up...

Isn't the other part of that the need to serialize making the package index files?

I thought we'd done that? If not we should, its not difficult as we have locking functions in bitbake.

Signature · 1 line
RP
#11 lore raw
In reply to Chris Larson

Hello,

Quoted 2 lines · Chris Larson

Set IMAGE_KEEPROOTFS to something other than the empty string to keep

+1 for the idea, but "something other than the empty string" is a very bad user interface.

If users see:

IMAGE_KEEPROOTFS = "1"

in most cases they'll do:

IMAGE_KEEPROOTFS = "0"

instead of

#IMAGE_KEEPROOTFS = "1"

Do we have more of these?? It never occured to me before.

Regards

Signature · 1 line
Leon
#12 lore raw
Quoted 15 lines · Leon Woestenberg

Hello,

Quoted 2 lines · Chris Larson

Set IMAGE_KEEPROOTFS to something other than the empty string to keep

+1 for the idea, but "something other than the empty string" is a very bad user interface.

If users see:

IMAGE_KEEPROOTFS = "1"

in most cases they'll do:

Quoted 8 lines

IMAGE_KEEPROOTFS = "0"

instead of

#IMAGE_KEEPROOTFS = "1"

Do we have more of these?? It never occured to me before.

We have this sort of thing all over the place. It needs an audit. Some vars expect set/empty, some expect 0/1, some expect yes/no, some just have a *convention* of yes/no.. afaik, anyway.

Signature · 5 lines
Chris Larson
Software Engineer
MontaVista Software, Inc.
Email: clarson AT mvista DOT com
Email: clarson AT kergoth DOT com
#13 lore raw
In reply to Leon Woestenberg
Quoted 7 lines · Leon Woestenberg

Hello,
If users see:

IMAGE_KEEPROOTFS = "1"

in most cases they'll do:

Quoted 8 lines

IMAGE_KEEPROOTFS = "0"

instead of

#IMAGE_KEEPROOTFS = "1"

Do we have more of these?? It never occured to me before.

Yeah, I made exactly this mistake with OE_STRICT_CHECKSUMS last week. Luckily, Mickey was on hand to put me straight, otherwise it would have been a frustrating experience.

p.

#14 lore raw
In reply to Leon Woestenberg
Quoted 15 lines · Leon Woestenberg

Hello,

Quoted 2 lines · Chris Larson

Set IMAGE_KEEPROOTFS to something other than the empty string to keep

+1 for the idea, but "something other than the empty string" is a very bad user interface.

If users see:

IMAGE_KEEPROOTFS = "1"

in most cases they'll do:

Quoted 8 lines

IMAGE_KEEPROOTFS = "0"

instead of

#IMAGE_KEEPROOTFS = "1"

Do we have more of these?? It never occured to me before.

Over the past day or so I've been thinking about putting together a proof of concept variable type checking .inc. Something like:

IMAGE_KEEPROOTFS ?= "0"
IMAGE_KEEPROOTFS[type] = "bool"

Then it would freak if it's not set to something valid for that type. It wouldn't be hard to throw such a thing together.

Signature · 7 lines
Chris Larson
clarson at kergoth dot com
clarson at mvista dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Software Engineer
MontaVista Software, Inc.