Skip to contentSkip to conversation

Incremental image generation(rpm based rootfs)

PATCH In review Robert Yang 2 participants 5 messages Dec 29, 2011 – Dec 30, 2011

lore
Share & tools
lore
#0 lore raw

cover Incremental image generation(rpm based rootfs)

Testing:
1) Enable INC_IMAGE_GEN = "1" in conf/local.conf
2) $ bitbake core-image-sato

* Test when remove some pkgs
a) Save the modify time of file which is in tmp/work/qemux86_64-poky-linux/core-image-sato-1.0-r0/rootfs/dev/.
b) Edit meta/recipes-sato/images/core-image-sato.bb, remove ${SATO_IMAGE_FEATURES} from IMAGE_FEATURES.
c) bitbake core-image-sato

Result: The project built well, check the modify time of the file which is in tmp/work/qemux86_64-poky-linux/core-image-sato-1.0-r0/rootfs/dev/, They should be the same to step a)'s, which means that these files were note newly created.

* Testh when add some pkgs
a) Save the modify time of file which is in tmp/work/qemux86_64-poky-linux/core-image-sato-1.0-r0/rootfs/dev/.
b) Edit meta/recipes-sato/images/core-image-sato.bb, add the ${SATO_IMAGE_FEATURES} back to IMAGE_FEATURES.
c) bitbake core-image-sato

Result: The project built well, check the modify time of the file which is in tmp/work/qemux86_64-poky-linux/core-image-sato-1.0-r0/rootfs/dev/, They should be the same to step a)'s, which means that these files were note newly created.

* Test when edit a pkg
a) bitbake bzip2 -cclean
b) rm -f rm -f sstate-cache/sstate-bzip2-*
c) Edit meta/recipes-extended/bzip2/bzip2_1.0.6.bb
d) bitbake core-image-sato
Result: The project built well, and check:
tmp/work/qemux86-poky-linux/core-image-sato-1.0-r0/temp/log.do_rootfs
Only the bzip2 has been re-installed

// Robert

The following changes since commit f5aa3bbda623c8fae3a761d72fddc95631ad0706:

coreutils: ensure --color works so DEPEND on libcap (2011-12-24 10:05:47 +0000)

are available in the git repository at:
git://git.pokylinux.org/poky-contrib robert/inc_image_gen
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=robert/inc_image_gen

Robert Yang (2):
Incremental image generation(rpm based rootfs)
Incremental image generation(Add config sample)

 meta-yocto/conf/local.conf.sample |    7 ++++
 meta/classes/image.bbclass        |   11 +++++-
 meta/classes/package_rpm.bbclass  |   72 +++++++++++++++++++++++++++++++-----
 3 files changed, 78 insertions(+), 12 deletions(-)
Signature · 1 line
1.7.4.1
#1 lore raw

PATCH 1/2 Incremental image generation(rpm based rootfs)

Incremental image generation, the rootfs would be totally removed and re-created in the second generation by default, but with INC_IMAGE_GEN = "1", the rootfs would be kept, and will do update(remove/add some pkgs) on it.
NOTE: This is not suggested when you want to create a productive rootfs

For example:
1) Add the follow config option to a conf file:

     INC_IMAGE_GEN = "1"

2) bitbake core-image-sato
modify a package
bitbake core-image-sato

The rootfs would not be totally removed and re-created in the second generation, it would be simply updated based on the "package".

Implatation:
1) Figure out the pkg which need to be removed or re-installed, then use 'rpm -e to remove the old one. Use the rpm's BUILDTIME to determine which pkg has been rebuilt.

2) Figure out the pkg which is newly added, and use 'rpm -U' to install it.

This only for the rpm based rootfs, I don't know whether we also need this for ipk or deb based rootfs.

[YOCTO #1651]

---
 meta/classes/image.bbclass       |   11 +++++-
 meta/classes/package_rpm.bbclass |   72 ++++++++++++++++++++++++++++++++-----
 2 files changed, 71 insertions(+), 12 deletions(-)
meta/classes/image.bbclass +9 -2
index 865d430..71b60f3 100644
@@ -134,15 +134,22 @@ do_rootfs[umask] = 022
 
 fakeroot do_rootfs () {
 	#set -x
-	rm -rf ${IMAGE_ROOTFS}
+    # When use the incremental image generation, don't remove the rootfs
+    if [ "${INC_IMAGE_GEN}" != "1" ]; then
+        rm -rf ${IMAGE_ROOTFS}
+    fi
 	rm -rf ${MULTILIB_TEMP_ROOTFS}
 	mkdir -p ${IMAGE_ROOTFS}
 	mkdir -p ${DEPLOY_DIR_IMAGE}
 
 	cp ${COREBASE}/meta/files/deploydir_readme.txt ${DEPLOY_DIR_IMAGE}/README_-_DO_NOT_DELETE_FILES_IN_THIS_DIRECTORY.txt
 
-	if [ "${USE_DEVFS}" != "1" ]; then
+    # If "${IMAGE_ROOTFS}/dev" exists, then the device had been made by
+    # the previous build
+	if [ "${USE_DEVFS}" != "1" -a ! -r "${IMAGE_ROOTFS}/dev" ]; then
 		for devtable in ${@get_devtable_list(d)}; do
+            # Always return ture since there maybe already one when use the
+            # incremental image generation
 			makedevs -r ${IMAGE_ROOTFS} -D $devtable
 		done
 	fi
meta/classes/package_rpm.bbclass +62 -10

84 lines not on this page · raw message

Signature · 1 line
1.7.4.1
#2 lore raw

PATCH 2/2 Incremental image generation(Add config sample)

In reply to Robert Yang

Add the config sample for incremental image generation to meta-yocto/conf/local.conf.sample

[YOCTO #1651]

---
 meta-yocto/conf/local.conf.sample |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
meta-yocto/conf/local.conf.sample +7 -0
index ca8636c..e33ffd9 100644
@@ -222,3 +222,10 @@ PATCHRESOLVE = "noop"
 # track the version of this file when it was generated. This can safely be ignored if
 # this doesn't mean anything to you.
 CONF_VERSION = "1"
+
+# Incremental image generation(only for rpm based rootfs currently), the rootfs
+# would be totally removed and re-created in the second generation by default,
+# but with INC_IMAGE_GEN = "1", the rootfs would be kept, and will do
+# update(remove/add some pkgs) on it.
+# NOTE: This is not suggested when you want to create a productive rootfs
+#INC_IMAGE_GEN = "1"
Signature · 1 line
1.7.4.1
#3 lore raw

Re: [PATCH 2/2] Incremental image generation(Add config sample)

Quoted 15 lines · Robert Yang

Add the config sample for incremental image generation to meta-yocto/conf/local.conf.sample

[YOCTO #1651]

---
  meta-yocto/conf/local.conf.sample |    7 +++++++
  1 files changed, 7 insertions(+), 0 deletions(-)
meta-yocto/conf/local.conf.sample +0 -0
index ca8636c..e33ffd9 100644

meta-yocto/conf/local.conf.sample PATCHRESOLVE = "noop" · line 231

Quoted 10 lines
meta-yocto/conf/local.conf.sample +7 -0
@@ -222,3 +222,10 @@ PATCHRESOLVE = "noop"
  # track the version of this file when it was generated. This can safely be ignored if
  # this doesn't mean anything to you.
  CONF_VERSION = "1"
+
+# Incremental image generation(only for rpm based rootfs currently), the rootfs
+# would be totally removed and re-created in the second generation by default,
+# but with INC_IMAGE_GEN = "1", the rootfs would be kept, and will do
+# update(remove/add some pkgs) on it.
+# NOTE: This is not suggested when you want to create a productive rootfs
+#INC_IMAGE_GEN = "1"

This should probably belong in the local.conf.sample.extended file.

Sau!

#4 lore raw

Re: [PATCH 2/2] Incremental image generation(Add config sample)

Quoted 22 lines · Saul Wold
Quoted 21 lines · Robert Yang

Add the config sample for incremental image generation to meta-yocto/conf/local.conf.sample

[YOCTO #1651]

---
meta-yocto/conf/local.conf.sample | 7 +++++++

1 files changed, 7 insertions(+), 0 deletions(-)
meta-yocto/conf/local.conf.sample +0 -0
index ca8636c..e33ffd9 100644
@@ -222,3 +222,10 @@ PATCHRESOLVE = "noop"
 # track the version of this file when it was generated. This can safely be

ignored if

# this doesn't mean anything to you.
CONF_VERSION = "1"
+
Quoted 9 lines

meta-yocto/conf/local.conf.sample PATCHRESOLVE = "noop" · line 231

Quoted 6 lines
meta-yocto/conf/local.conf.sample +6 -0
+# Incremental image generation(only for rpm based rootfs currently), the rootfs
+# would be totally removed and re-created in the second generation by default,
+# but with INC_IMAGE_GEN = "1", the rootfs would be kept, and will do
+# update(remove/add some pkgs) on it.
+# NOTE: This is not suggested when you want to create a productive rootfs
+#INC_IMAGE_GEN = "1"

This should probably belong in the local.conf.sample.extended file.

Thanks, Saul, I will wait for other's comment and send a V2 by the end of tomorrow.

// Robert

Quoted 2 lines

Sau!