Patchwork [3/5] populate_sdk:support incremental deb image generation

login
register
mail settings
Submitter Hongxu Jia
Date Feb. 4, 2013, 9:34 a.m.
Message ID <b3040834daa4640f588a0df302ad931966d9ac89.1359968242.git.hongxu.jia@windriver.com>
Download mbox | patch
Permalink /patch/43969/
State New
Headers show

Comments

Hongxu Jia - Feb. 4, 2013, 9:34 a.m.
When use the incremental image generation, and the type of previous image
has no change, don't remove the rootfs

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 meta/classes/populate_sdk_base.bbclass |   13 ++++++++++---
 meta/classes/populate_sdk_deb.bbclass  |    2 +-
 2 files changed, 11 insertions(+), 4 deletions(-)

Patch

diff --git a/meta/classes/populate_sdk_base.bbclass b/meta/classes/populate_sdk_base.bbclass
index c587af8..783682f 100644
--- a/meta/classes/populate_sdk_base.bbclass
+++ b/meta/classes/populate_sdk_base.bbclass
@@ -65,8 +65,15 @@  fakeroot python do_populate_sdk() {
 }
 
 fakeroot populate_sdk_image() {
-	rm -rf ${SDK_OUTPUT}
-	mkdir -p ${SDK_OUTPUT}
+
+	# When use the incremental image generation, and the type of previous image
+	# has no change, don't remove the rootfs
+	if [ "${INC_DEB_IMAGE_GEN}" = "1" -a -d ${T}/dpkg ]; then
+		echo "NOTE: Start incremental generation"
+	else
+		rm -rf ${SDK_OUTPUT}
+		mkdir -p ${SDK_OUTPUT}
+	fi
 
 	# populate_sdk_<image> is required to construct two images:
 	#  SDK_ARCH-nativesdk - contains the cross compiler and associated tooling
@@ -90,7 +97,7 @@  fakeroot populate_sdk_image() {
 	rm -f ${SDK_OUTPUT}/${SDKPATHNATIVE}${libdir_nativesdk}/*.la
 
 	# Link the ld.so.cache file into the hosts filesystem
-	ln -s /etc/ld.so.cache ${SDK_OUTPUT}/${SDKPATHNATIVE}/etc/ld.so.cache
+	ln -snf /etc/ld.so.cache ${SDK_OUTPUT}/${SDKPATHNATIVE}/etc/ld.so.cache
 }
 
 fakeroot create_sdk_files() {
diff --git a/meta/classes/populate_sdk_deb.bbclass b/meta/classes/populate_sdk_deb.bbclass
index e1705e7b..687f63d 100644
--- a/meta/classes/populate_sdk_deb.bbclass
+++ b/meta/classes/populate_sdk_deb.bbclass
@@ -60,7 +60,7 @@  populate_sdk_deb () {
 
 	#move remainings
 	install -d ${SDK_OUTPUT}/${SDKPATHNATIVE}/var/lib/dpkg
-	mv ${SDK_OUTPUT}/var/lib/dpkg/* ${SDK_OUTPUT}/${SDKPATHNATIVE}/var/lib/dpkg
+	cp -rf ${SDK_OUTPUT}/var/lib/dpkg/* ${SDK_OUTPUT}/${SDKPATHNATIVE}/var/lib/dpkg
 	rm -rf ${SDK_OUTPUT}/var
 
 	populate_sdk_log_check populate_sdk