All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] mklibs optimization and mesa-demos dso linking fix
@ 2011-02-03 22:45 Nitin A Kamble
  2011-02-03 22:45 ` [PATCH 1/2] image-mklibs.bbclass: add the library optimization functionality Nitin A Kamble
  2011-02-03 22:45 ` [PATCH 2/2] mesa-demos: fix build issue with gcc dso linking change Nitin A Kamble
  0 siblings, 2 replies; 3+ messages in thread
From: Nitin A Kamble @ 2011-02-03 22:45 UTC (permalink / raw)
  To: poky

From: Nitin A Kamble <nitin.a.kamble@intel.com>

The mesa-demos recipe's dso linking issue is fixed in 1 commit.
and the other commit is for adding the mklibs library optimization in poky 
tree, and enabling it for poky-image-minimal image.

Pull URL: git://git.pokylinux.org/poky-contrib.git
  Branch: nitin/misc
  Browse: http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=nitin/misc

Thanks,
    Nitin A Kamble <nitin.a.kamble@intel.com>
---


Nitin A Kamble (2):
  image-mklibs.bbclass: add the library optimization functionality
  mesa-demos: fix build issue with gcc dso linking change

 meta/classes/image-mklibs.bbclass                  |   70 ++++++++++++++++++++
 meta/conf/local.conf.sample                        |   10 +++-
 .../mesa-demos/dso_linking_change_build_fix.patch  |   23 +++++++
 meta/recipes-graphics/mesa/mesa-demos_8.0.1.bb     |    5 +-
 4 files changed, 105 insertions(+), 3 deletions(-)
 create mode 100644 meta/classes/image-mklibs.bbclass
 create mode 100644 meta/recipes-graphics/mesa/mesa-demos/dso_linking_change_build_fix.patch

-- 
1.7.3.4



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

* [PATCH 2/2] mesa-demos: fix build issue with gcc dso linking change
  2011-02-03 22:45 [PATCH 0/2] mklibs optimization and mesa-demos dso linking fix Nitin A Kamble
  2011-02-03 22:45 ` [PATCH 1/2] image-mklibs.bbclass: add the library optimization functionality Nitin A Kamble
@ 2011-02-03 22:45 ` Nitin A Kamble
  1 sibling, 0 replies; 3+ messages in thread
From: Nitin A Kamble @ 2011-02-03 22:45 UTC (permalink / raw)
  To: poky

From: Nitin A Kamble <nitin.a.kamble@intel.com>

All the libraries needs to be specified explicitely with the new gcc dso
linking change patch. This was causing build errors for this
recipe. Specifying the libpthread library explicitely for linking to work
without errors.

Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
---
 .../mesa-demos/dso_linking_change_build_fix.patch  |   23 ++++++++++++++++++++
 meta/recipes-graphics/mesa/mesa-demos_8.0.1.bb     |    5 ++-
 2 files changed, 26 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-graphics/mesa/mesa-demos/dso_linking_change_build_fix.patch

diff --git a/meta/recipes-graphics/mesa/mesa-demos/dso_linking_change_build_fix.patch b/meta/recipes-graphics/mesa/mesa-demos/dso_linking_change_build_fix.patch
new file mode 100644
index 0000000..aa2faf9
--- /dev/null
+++ b/meta/recipes-graphics/mesa/mesa-demos/dso_linking_change_build_fix.patch
@@ -0,0 +1,23 @@
+after gcc linking has changed, all the libraries must be explicitely specified 
+This patch avoids these linking errors:
+
+|   CCLD   xeglgears
+| /build_disk/poky_build/build0/tmp/sysroots/x86_64-linux/usr/libexec/armv5te-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/4.5.1/ld: xeglthreads.o: undefined reference to symbol 'pthread_join@@GLIBC_2.4'
+| /build_disk/poky_build/build0/tmp/sysroots/x86_64-linux/usr/libexec/armv5te-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/4.5.1/ld: note: 'pthread_join@@GLIBC_2.4' is defined in DSO /build_disk/poky_build/build0/tmp/sysroots/qemuarm/lib/libpthread.so.0 so try adding it to the linker command line
+| /build_disk/poky_build/build0/tmp/sysroots/qemuarm/lib/libpthread.so.0: could not read symbols: Invalid operation
+| collect2: ld returned 1 exit status
+
+
+Nitin A Kamble <nitin.a.kamble@intel.com>
+Date: 2011/02/03
+
+
+Index: mesa-demos-8.0.1/src/egl/opengl/Makefile.am
+===================================================================
+--- mesa-demos-8.0.1.orig/src/egl/opengl/Makefile.am	2010-07-07 10:57:15.000000000 -0700
++++ mesa-demos-8.0.1/src/egl/opengl/Makefile.am	2011-02-03 14:30:13.928486381 -0800
+@@ -67,3 +67,4 @@
+ 
+ eglgears_x11_LDADD = ../eglut/libeglut_x11.la
+ egltri_x11_LDADD = ../eglut/libeglut_x11.la
++xeglthreads_LDADD = -lpthread
diff --git a/meta/recipes-graphics/mesa/mesa-demos_8.0.1.bb b/meta/recipes-graphics/mesa/mesa-demos_8.0.1.bb
index e3a84be..504a8b7 100644
--- a/meta/recipes-graphics/mesa/mesa-demos_8.0.1.bb
+++ b/meta/recipes-graphics/mesa/mesa-demos_8.0.1.bb
@@ -11,9 +11,10 @@ LIC_FILES_CHKSUM = "file://src/xdemos/glxgears.c;beginline=1;endline=20;md5=9142
 
 DEPENDS = "virtual/libx11 virtual/libgl glew"
 
-PR = "r0"
+PR = "r1"
 
-SRC_URI = "ftp://ftp.freedesktop.org/pub/mesa/demos/${PV}/${PN}-${PV}.tar.bz2"
+SRC_URI = "ftp://ftp.freedesktop.org/pub/mesa/demos/${PV}/${PN}-${PV}.tar.bz2 \
+	file://dso_linking_change_build_fix.patch"
 
 inherit autotools pkgconfig
 
-- 
1.7.3.4



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

* [PATCH 1/2] image-mklibs.bbclass: add the library optimization functionality
  2011-02-03 22:45 [PATCH 0/2] mklibs optimization and mesa-demos dso linking fix Nitin A Kamble
@ 2011-02-03 22:45 ` Nitin A Kamble
  2011-02-03 22:45 ` [PATCH 2/2] mesa-demos: fix build issue with gcc dso linking change Nitin A Kamble
  1 sibling, 0 replies; 3+ messages in thread
From: Nitin A Kamble @ 2011-02-03 22:45 UTC (permalink / raw)
  To: poky

From: Nitin A Kamble <nitin.a.kamble@intel.com>

Now by default the mklibs library size optimization for poky-image-minimal is
enabled.

If you want to enable the mklibs library size optimization for your image
then, edit the MKLIBS_OPTIMIZED_IMAGES line in the local.conf like this:

  MKLIBS_OPTIMIZED_IMAGES ?= "poky-image-minimal your-own-image"

on qemux86 machine this reduced the rootfs size from 7.9MB to 7.2MB.
That is around 11% image foot print reduction. that image had 38 elf
executables. Generally the size optimization by mklibs is reversely
proportional to the number of elf executables in the rootfs. so
bigger images won't see less optimization, and smaller images will see
large image size reductions.

Thanks to mark hatle for his help in implementation of this.

Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
---
 meta/classes/image-mklibs.bbclass |   70 +++++++++++++++++++++++++++++++++++++
 meta/conf/local.conf.sample       |   10 +++++-
 2 files changed, 79 insertions(+), 1 deletions(-)
 create mode 100644 meta/classes/image-mklibs.bbclass

diff --git a/meta/classes/image-mklibs.bbclass b/meta/classes/image-mklibs.bbclass
new file mode 100644
index 0000000..8ba3eb4
--- /dev/null
+++ b/meta/classes/image-mklibs.bbclass
@@ -0,0 +1,70 @@
+do_rootfs[depends] += "mklibs-native:do_populate_sysroot"
+
+IMAGE_PREPROCESS_COMMAND += "mklibs_optimize_image; "
+
+mklibs_optimize_image_doit() {
+	rm -rf ${WORKDIR}/mklibs
+	mkdir -p ${WORKDIR}/mklibs/dest
+	cd ${IMAGE_ROOTFS}
+	du -bs > ${WORKDIR}/mklibs/du.before.mklibs.txt
+	for i in `find .`; do file $i; done \
+		| grep ELF \
+		| grep "LSB executable" \
+		| grep "dynamically linked" \
+		| sed "s/:.*//" \
+		| sed "s+^\./++" \
+		> ${WORKDIR}/mklibs/executables.list
+
+	case ${TARGET_ARCH} in
+		powerpc | mips )
+			dynamic_loader="/lib/ld.so.1"
+			;;
+		x86_64)
+			dynamic_loader="/lib/ld-linux-x86-64.so.2"
+			;;
+		i586 )
+			dynamic_loader="/lib/ld-linux.so.2"
+			;;
+		arm )
+			dynamic_loader="/lib/ld-linux.so.3"
+			;;
+		* )
+			dynamic_loader="/unknown_dynamic_linker"
+			;;
+	esac
+
+	mklibs -v \
+		--ldlib ${dynamic_loader} \
+		--sysroot ${PKG_CONFIG_SYSROOT_DIR} \
+		--root ${IMAGE_ROOTFS} \
+		--target `echo ${TARGET_PREFIX} | sed 's/-$//' ` \
+		-d ${WORKDIR}/mklibs/dest \
+		`cat ${WORKDIR}/mklibs/executables.list`
+
+	cd ${WORKDIR}/mklibs/dest
+	for i in *
+	do
+		cp $i `find ${IMAGE_ROOTFS} -name $i`
+	done
+
+	cd ${IMAGE_ROOTFS}
+	du -bs > ${WORKDIR}/mklibs/du.after.mklibs.txt
+
+	echo rootfs size before mklibs optimization: `cat ${WORKDIR}/mklibs/du.before.mklibs.txt`
+	echo rootfs size after mklibs optimization: `cat ${WORKDIR}/mklibs/du.after.mklibs.txt`
+}
+
+mklibs_optimize_image() {
+	for img in ${MKLIBS_OPTIMIZED_IMAGES}
+	do
+		if [ "${img}" == "${PN}" ]
+		then
+			mklibs_optimize=1
+			mklibs_optimize_image_doit
+			break
+		fi
+	done
+}
+
+
+EXPORT_FUNCTIONS mklibs_optimize_image
diff --git a/meta/conf/local.conf.sample b/meta/conf/local.conf.sample
index f9953d1..362dbf0 100644
--- a/meta/conf/local.conf.sample
+++ b/meta/conf/local.conf.sample
@@ -73,10 +73,18 @@ EXTRA_IMAGE_FEATURES_mx31ads = "tools-testapps debug-tweaks"
 #PACKAGE_CLASSES ?= "package_rpm package_deb package_ipk"
 PACKAGE_CLASSES ?= "package_rpm package_ipk"
 
+# mklibs library size optimization is more useful to smaller images, 
+# and less useful for bigger images. Also mklibs library optimization can break the ABI compatibility, so should not be applied to the images which are tobe
+# extended or upgraded later.
+# mklibs librarys size optimization will be enabled just for these images.
+MKLIBS_OPTIMIZED_IMAGES ?= "poky-image-minimal"
+
 # A list of additional classes to use when building the system
+# include 'image-mklibs' to reduce shared library files size for an image
 # include 'image-prelink' in order to prelink the filesystem image
 # include 'image-swab' to perform host system intrusion detection
-USER_CLASSES ?= "image-prelink"
+# NOTE: if listing mklibs & prelink both, then make sure mklibs is before prelink
+USER_CLASSES ?= "image-mklibs image-prelink"
 
 # POKYMODE controls the characteristics of the generated packages/images by
 # telling poky which type of toolchain to use.
-- 
1.7.3.4



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

end of thread, other threads:[~2011-02-03 22:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-03 22:45 [PATCH 0/2] mklibs optimization and mesa-demos dso linking fix Nitin A Kamble
2011-02-03 22:45 ` [PATCH 1/2] image-mklibs.bbclass: add the library optimization functionality Nitin A Kamble
2011-02-03 22:45 ` [PATCH 2/2] mesa-demos: fix build issue with gcc dso linking change Nitin A Kamble

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.