3 #****************************************************************************
6 # Copyright 2004 Broadcom Corp. All Rights Reserved.
7 # This program is free software; you can distribute it and/or modify it
8 # under the terms of the GNU General Public License (Version 2) as
9 # published by the Free Software Foundation.
10 # This program is distributed in the hope it will be useful, but WITHOUT
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 # You should have received a copy of the GNU General Public License along
15 # with this program; if not, write to the Free Software Foundation, Inc.,
16 # 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
19 #****************************************************************************
23 if [ "$MOD_DIR" == "" ] ; then
24 MOD_DIR=$PROFILE/modules
27 if [ "$FSSRC_DIR" == "" ]; then
34 # Create file system dir
37 # Copy files onto root file system
38 echo "Creating target root file system..."
39 cp -av $FSSRC_DIR/* $ROOTFS
40 # Create directories as needed
45 mkdir $ROOTFS/etc/adsl
46 cp -av $BRCMDRIVERS_DIR/broadcom/char/adsl/bcm9$BRCM_CHIP/*.bin $ROOTFS/etc/adsl
47 DEFAULTCFG=`echo $DEFAULTCFG_DIR/$BRCM_DEFAULTCFG|sed -e 's/\"//g'`
48 if [ -f "$DEFAULTCFG" ]; then
49 cp -v $DEFAULTCFG $ROOTFS/etc/default.cfg; chmod a+r $ROOTFS/etc/default.cfg
50 elif [ $BRCM_DEFAULTCFG != '""' ]; then
52 echo " No default run-time config file called $BRCM_DEFAULTCFG in $DEFAULTCFG_DIR"
53 echo " Check your profile setting!"
60 # Create symbolic links
61 ln -s /var/log/log $ROOTFS/dev/log
62 ln -s /var/sysmsg $ROOTFS/etc/sysmsg
63 ln -s /var/passwd $ROOTFS/etc/passwd
64 ln -s /var/group $ROOTFS/etc/group
65 ln -s /var/ppp/pppmsg $ROOTFS/etc/pppmsg
66 ln -s /var/fyi/sys/dns $ROOTFS/etc/resolv.conf
67 ln -s /var/fyi/sys/gateway $ROOTFS/etc/gateway.conf
68 ln -s /var/udhcpd/udhcpd.conf $ROOTFS/etc/udhcpd.conf
69 ln -s /var/udhcpd/udhcpd.leases $ROOTFS/etc/udhcpd.leases
71 if [ -x $PROFILE/special-buildFS ]; then
72 $PROFILE/special-buildFS
75 # Copy proprietary binaries if any
76 FSBIN=`ls $TOP_DIR/fs.bin|wc -l`
77 if [ $FSBIN != 0 ]; then
78 echo "Copying proprietary binaries..."
80 cp -avf fs.bin/* $ROOTFS
83 # Stripping unneeded module symbols
85 cp -a lib $TOP_DIR/$ROOTFS/.
86 chown -R root:root $TOP_DIR/$ROOTFS/lib
87 echo "Stripping kernel modules..."
88 find $TOP_DIR/$ROOTFS/lib/modules -name "*.ko"
89 #Modules that need parameters cannot be stripped
90 #MODS_KEEPSYM='! -name "ip_conntrack_pt.ko" ! -name "ip_nat_pt.ko"'
91 MODS_KEEPSYM='! -name "ip*.ko"'
92 eval "find $TOP_DIR/$ROOTFS/lib/modules -name '*.ko' $MODS_KEEPSYM |xargs $STRIP --strip-unneeded"
94 # Continue to strip user apps and shared libraries using sstrip
95 echo "Stripping userapps and shared libraries more..."
96 $SSTRIP $TOP_DIR/$ROOTFS/bin/* $TOP_DIR/$ROOTFS/lib/*.so*