summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/image-mklibs.bbclass69
-rw-r--r--meta/conf/local.conf.sample12
2 files changed, 80 insertions, 1 deletions
diff --git a/meta/classes/image-mklibs.bbclass b/meta/classes/image-mklibs.bbclass
new file mode 100644
index 0000000000..0e72b018c0
--- /dev/null
+++ b/meta/classes/image-mklibs.bbclass
@@ -0,0 +1,69 @@
1do_rootfs[depends] += "mklibs-native:do_populate_sysroot"
2
3IMAGE_PREPROCESS_COMMAND += "mklibs_optimize_image; "
4
5mklibs_optimize_image_doit() {
6 rm -rf ${WORKDIR}/mklibs
7 mkdir -p ${WORKDIR}/mklibs/dest
8 cd ${IMAGE_ROOTFS}
9 du -bs > ${WORKDIR}/mklibs/du.before.mklibs.txt
10 for i in `find .`; do file $i; done \
11 | grep ELF \
12 | grep "LSB executable" \
13 | grep "dynamically linked" \
14 | sed "s/:.*//" \
15 | sed "s+^\./++" \
16 > ${WORKDIR}/mklibs/executables.list
17
18 case ${TARGET_ARCH} in
19 powerpc | mips )
20 dynamic_loader="/lib/ld.so.1"
21 ;;
22 x86_64)
23 dynamic_loader="/lib/ld-linux-x86-64.so.2"
24 ;;
25 i586 )
26 dynamic_loader="/lib/ld-linux.so.2"
27 ;;
28 arm )
29 dynamic_loader="/lib/ld-linux.so.3"
30 ;;
31 * )
32 dynamic_loader="/unknown_dynamic_linker"
33 ;;
34 esac
35
36 mklibs -v \
37 --ldlib ${dynamic_loader} \
38 --sysroot ${PKG_CONFIG_SYSROOT_DIR} \
39 --root ${IMAGE_ROOTFS} \
40 --target `echo ${TARGET_PREFIX} | sed 's/-$//' ` \
41 -d ${WORKDIR}/mklibs/dest \
42 `cat ${WORKDIR}/mklibs/executables.list`
43
44 cd ${WORKDIR}/mklibs/dest
45 for i in *
46 do
47 cp $i `find ${IMAGE_ROOTFS} -name $i`
48 done
49
50 cd ${IMAGE_ROOTFS}
51 du -bs > ${WORKDIR}/mklibs/du.after.mklibs.txt
52
53 echo rootfs size before mklibs optimization: `cat ${WORKDIR}/mklibs/du.before.mklibs.txt`
54 echo rootfs size after mklibs optimization: `cat ${WORKDIR}/mklibs/du.after.mklibs.txt`
55}
56
57mklibs_optimize_image() {
58 for img in ${MKLIBS_OPTIMIZED_IMAGES}
59 do
60 if [ "${img}" == "${PN}" ] || [ "${img}" == "all" ]
61 then
62 mklibs_optimize_image_doit
63 break
64 fi
65 done
66}
67
68
69EXPORT_FUNCTIONS mklibs_optimize_image
diff --git a/meta/conf/local.conf.sample b/meta/conf/local.conf.sample
index d9f7098f0c..d61aaebdd0 100644
--- a/meta/conf/local.conf.sample
+++ b/meta/conf/local.conf.sample
@@ -73,10 +73,20 @@ EXTRA_IMAGE_FEATURES_mx31ads = "tools-testapps debug-tweaks"
73#PACKAGE_CLASSES ?= "package_rpm package_deb package_ipk" 73#PACKAGE_CLASSES ?= "package_rpm package_deb package_ipk"
74PACKAGE_CLASSES ?= "package_rpm package_ipk" 74PACKAGE_CLASSES ?= "package_rpm package_ipk"
75 75
76# mklibs library size optimization is more useful to smaller images,
77# 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
78# extended or upgraded later.
79#This enabled mklibs library size optimization just for the specified image.
80#MKLIBS_OPTIMIZED_IMAGES ?= "poky-image-minimal"
81#This enable mklibs library size optimization will be for all the images.
82#MKLIBS_OPTIMIZED_IMAGES ?= "all"
83
76# A list of additional classes to use when building the system 84# A list of additional classes to use when building the system
85# include 'image-mklibs' to reduce shared library files size for an image
77# include 'image-prelink' in order to prelink the filesystem image 86# include 'image-prelink' in order to prelink the filesystem image
78# include 'image-swab' to perform host system intrusion detection 87# include 'image-swab' to perform host system intrusion detection
79USER_CLASSES ?= "image-prelink" 88# NOTE: if listing mklibs & prelink both, then make sure mklibs is before prelink
89USER_CLASSES ?= "image-mklibs image-prelink"
80 90
81# POKYMODE controls the characteristics of the generated packages/images by 91# POKYMODE controls the characteristics of the generated packages/images by
82# telling poky which type of toolchain to use. 92# telling poky which type of toolchain to use.