V3 Incremental rpm image generation
cover V3 Incremental rpm image generation
Changes of V3:
* Change the name from INC_RPM_IMAGE_GEN to INC_RPM_IMAGE_GEN as Richard suggested, and it will only work for rpm based rootfs, the deb and ipk will be done in M3.
* Update rootfs_rpm.bbclass since other developer has modified it since V2.
Changes of V2:
* Move the config sample from meta-yocto/conf/local.conf.sample to meta-yocto/conf/local.conf.sample.extended as Saul suggested.
Testing:
1) Add INC_RPM_IMAGE_GEN = "1" to 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
The following changes since commit 468998cddbe1a803096c9b357e1b5daa3b7e8c2e:
command.py: add parseConfigurationFiles API (2012-01-06 16:01:44 +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 rpm image generation Incremental rpm image generation(Add config sample)
meta-yocto/conf/local.conf.sample.extended | 7 +++ meta/classes/image.bbclass | 11 ++++- meta/classes/package_rpm.bbclass | 73 ++++++++++++++++++++++++---- meta/classes/rootfs_rpm.bbclass | 6 ++- 4 files changed, 84 insertions(+), 13 deletions(-)
Signature · 1 line
1.7.4.1
PATCH 1/2 V3 Incremental rpm image generation
Incremental rpm image generation, the rootfs would be totally removed and re-created in the second generation by default, but with INC_RPM_IMAGE_GEN = "1", the rpm based 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_RPM_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, the deb and ipk based rootfs would be done later.
[YOCTO #1651]
--- meta/classes/image.bbclass | 11 +++++- meta/classes/package_rpm.bbclass | 73 ++++++++++++++++++++++++++++++++----- meta/classes/rootfs_rpm.bbclass | 6 +++- 3 files changed, 77 insertions(+), 13 deletions(-)
meta/classes/image.bbclass +9 -2
@@ -134,15 +134,22 @@ do_rootfs[umask] = 022 fakeroot do_rootfs () { #set -x - rm -rf ${IMAGE_ROOTFS} + # When use the rpm incremental image generation, don't remove the rootfs + if [ "${INC_RPM_IMAGE_GEN}" != "1" -o "${IMAGE_PKGTYPE}" != "rpm" ]; 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 +63 -10
85 lines not on this page · raw message
meta/classes/rootfs_rpm.bbclass +5 -1
@@ -201,11 +201,15 @@ rootfs_check_package_exists() { } rootfs_install_packages() { + # The pkg to be installed here is not controlled by the + # package_install_internal_rpm, so it may have already been + # installed(e.g, installed in the first time when generate the + # rootfs), use '--replacepkgs' to always install them for pkg in $@; do ${RPM} --root ${IMAGE_ROOTFS} -D "_dbpath ${rpmlibdir}" \ -D "__dbi_txn create nofsync private" \ --noscripts --notriggers --noparentdirs --nolinktos \ - -Uhv $pkg || true + --replacepkgs -Uhv $pkg || true done }
Signature · 1 line
1.7.4.1
PATCH 2/2 V3 Incremental rpm image generation(Add config sample)
In reply to Robert YangAdd the config sample for incremental image generation to meta-yocto/conf/local.conf.sample.extended
[YOCTO #1651]
--- meta-yocto/conf/local.conf.sample.extended | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
meta-yocto/conf/local.conf.sample.extended +7 -0
@@ -123,3 +123,10 @@ # The following is a list of classes to import to use in the generation of images # currently an example class is image_types_uboot # IMAGE_CLASSES = " image_types_uboot" + +# Incremental rpm image generation, the rootfs would be totally removed +# and re-created in the second generation by default, but with +# INC_RPM_IMAGE_GEN = "1", the rpm based 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_RPM_IMAGE_GEN = "1"
Signature · 1 line
1.7.4.1
Quoted 65 lines · Robert Yang
Changes of V3:
* Change the name fromINC_RPM_IMAGE_GENtoINC_RPM_IMAGE_GENas Richard suggested, and it will only work for rpm based rootfs, the deb and ipk will be done in M3.* Update rootfs_rpm.bbclass since other developer has modified it since V2.
Changes of V2:
* Move the config sample from meta-yocto/conf/local.conf.sample to meta-yocto/conf/local.conf.sample.extended as Saul suggested.Testing:
1) AddINC_RPM_IMAGE_GEN= "1" toconf/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} fromIMAGE_FEATURES.
c) bitbake core-image-satoResult: 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 toIMAGE_FEATURES.
c) bitbake core-image-satoResult: 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-installedThe following changes since commit
468998cddbe1a803096c9b357e1b5daa3b7e8c2e:command.py: add parseConfigurationFiles API (2012-01-06 16:01:44 +0000)are available in the git repository at:
git://git.pokylinux.org/poky-contribrobert/inc_image_gen
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=robert/inc_image_genRobert Yang (2):
Incremental rpm image generation Incremental rpm image generation(Add config sample)
Quoted 6 lines
meta-yocto/conf/local.conf.sample.extended | 7 +++ meta/classes/image.bbclass | 11 ++++- meta/classes/package_rpm.bbclass | 73 ++++++++++++++++++++++++---- meta/classes/rootfs_rpm.bbclass | 6 ++- 4 files changed, 84 insertions(+), 13 deletions(-)
Merged into OE-Core
'
Thanks
Sau!