3 source sources
/include.sh ||
exit 1
9 tar -C "$ROOT_OVERLAY" -cf - . |
tar -C "$ROOT_DIR" -xf -
13 # remove all shared libraries which aren't needed
15 if [ -z "$NO_STRIP" ]; then
17 # get library dependencies of binaries
19 for f
in `find $ROOT_DIR/usr/bin $ROOT_DIR/usr/sbin -type f -perm +0111`; do
20 if [ ! -z "`file $f | grep ELF | grep executable`" ]; then
21 for l
in `${CROSS}objdump -p $f | awk '/NEEDED/ { print $2 }'`; do
27 # get dependencies of the dependencies (should use recursion)
29 for l
in `find $ROOT_DIR/usr/lib -type f -perm +0111`; do
30 soname
="`${CROSS}objdump -p $l | awk '/SONAME/ { print $2 }'`"
31 if [[ ! -z $soname && ! -z "`echo $libs | grep $soname`" ]]; then
32 needed
="`${CROSS}objdump -p $l | awk '/NEEDED/ { print $2 }'`"
37 # remove unused sub directories which contain plugin/modules
39 for l
in `find $ROOT_DIR/usr/lib -mindepth 1 -maxdepth 1 -type d -perm +0111`; do
40 if [ ! -z "`echo $libs | grep $l`" ]; then
44 # modules required so get all dependencies
45 for m
in `find $l -type f -perm +0111`; do
46 for ml
in `${CROSS}objdump -p $m | awk '/NEEDED/ { print $2 }'`; do
53 # delete all libraries which aren't referenced by others
55 for l
in `find $ROOT_DIR/usr/lib -maxdepth 1 ! -type d -perm +0111`; do
56 if [ ! -e "$l" ]; then # remove broken symlinks
59 soname
="`${CROSS}objdump -p $l | awk '/SONAME/ { print $2 }' 2> /dev/null`"
60 if [[ ! -z $soname && -z "`echo $libs | grep $soname`" ]]; then
66 # strip binaries and libraries
68 ${STRIP} -s -R .note
-R .comment
"$ROOT_DIR"/usr
/{bin
/*,sbin
/*} 2> /dev
/null
69 find "$ROOT_DIR/usr/lib" -name '*.so' |
xargs ${STRIP} --strip-unneeded 2>/dev
/null
70 [ -e "$ROOT_DIR/lib/modules" ] && find "$ROOT_DIR/lib/modules" -name '*.ko' |
xargs ${STRIP}
72 # remove libthread_db which is used for cross debuging with gdb
73 rm -f "$ROOT_DIR"/lib
/libthread_db
*
77 # generate file with the contents of the initramfs it's later used
78 # by the kernel build system to create a gziped cpio archive which
79 # is then embedded into the kernel binary.
81 $SCRIPTS/gen_initramfs_list.sh
-u squash
-g squash
$ROOT_DIR > \
84 echo "Now run './build.sh kernel' which will build a kernel with initramfs-files as"
85 echo "CONFIG_INITRAMFS_SOURCE or run ./package.sh to create a rootfs.tar.gz tarball"
86 echo "that you can extract on a SD card."