add added files
[bcm963xx.git] / targets / buildFS
1 #!/bin/bash
2
3 #****************************************************************************
4 #
5 #  Copyright (c) 2001, 2002  Broadcom Corporation
6 #  All Rights Reserved
7 #  No portions of this material may be reproduced in any form without the
8 #  written permission of:
9 #          Broadcom Corporation
10 #          16251 Laguna Canyon Road
11 #          Irvine, California 92618
12 #  All information contained in this document is Broadcom Corporation
13 #  company private, proprietary, and trade secret.
14 #
15 #****************************************************************************
16
17 TOP_DIR=`pwd`
18
19 if [ "$MOD_DIR" == "" ] ; then
20     MOD_DIR=$PROFILE/modules
21 fi
22
23 if [ "$FSSRC_DIR" == "" ]; then
24     FSSRC_DIR=./fs.src
25 fi
26
27 ROOTFS=$PROFILE/fs
28
29 rm -rf $ROOTFS
30 # Create file system dir
31 mkdir $ROOTFS
32 chmod 777 $ROOTFS
33 # Copy files onto root file system
34 echo "Creating target root file system..."
35 cp -av $FSSRC_DIR/* $ROOTFS
36 # Create directories as needed
37 mkdir $ROOTFS/dev
38 mkdir $ROOTFS/mnt
39 mkdir $ROOTFS/proc
40 mkdir $ROOTFS/var
41 mkdir $ROOTFS/etc/adsl
42 cp -av $BRCMDRIVERS_DIR/broadcom/char/adsl/bcm9$BRCM_CHIP/*.bin  $ROOTFS/etc/adsl
43 DEFAULTCFG=`echo $DEFAULTCFG_DIR/$BRCM_DEFAULTCFG|sed -e 's/\"//g'`
44 if [ -f "$DEFAULTCFG" ]; then
45    cp -v $DEFAULTCFG $ROOTFS/etc/default.cfg; chmod a+r $ROOTFS/etc/default.cfg
46 elif [ $BRCM_DEFAULTCFG != '""' ]; then
47    echo
48    echo "        No default run-time config file called $BRCM_DEFAULTCFG in $DEFAULTCFG_DIR"
49    echo "        Check your profile setting!"
50    exit 1
51 else
52    echo
53 fi
54 # Create devices
55 ./makeDevs
56 # Create symbolic links
57 ln -s /var/log/log $ROOTFS/dev/log
58 ln -s /var/sysmsg $ROOTFS/etc/sysmsg
59 ln -s /var/passwd $ROOTFS/etc/passwd
60 ln -s /var/group $ROOTFS/etc/group
61 ln -s /var/ppp/pppmsg $ROOTFS/etc/pppmsg
62 ln -s /var/fyi/sys/dns $ROOTFS/etc/resolv.conf
63 ln -s /var/fyi/sys/gateway $ROOTFS/etc/gateway.conf
64 ln -s /var/udhcpd/udhcpd.conf $ROOTFS/etc/udhcpd.conf
65 ln -s /var/udhcpd/udhcpd.leases $ROOTFS/etc/udhcpd.leases
66
67 if [ -x $PROFILE/special-buildFS ]; then
68    $PROFILE/special-buildFS
69 fi
70
71 # Copy proprietary binaries if any
72 FSBIN=`ls $TOP_DIR/fs.bin|wc -l`
73 if [ $FSBIN != 0 ]; then
74    echo "Copying proprietary binaries..."
75    cd $TOP_DIR
76    cp -avf fs.bin/* $ROOTFS
77 fi
78
79 # Stripping unneeded module symbols
80 cd $MOD_DIR
81 cp -a lib $TOP_DIR/$ROOTFS/.
82 chown -R root:root $TOP_DIR/$ROOTFS/lib
83 echo "Stripping kernel modules..."
84 find $TOP_DIR/$ROOTFS/lib/modules -name "*.ko"
85 #Modules that need parameters cannot be stripped
86 #MODS_KEEPSYM='! -name "ip_conntrack_pt.ko" ! -name "ip_nat_pt.ko"'
87 MODS_KEEPSYM='! -name "ip*.ko"'
88 eval "find $TOP_DIR/$ROOTFS/lib/modules -name '*.ko' $MODS_KEEPSYM |xargs $STRIP --strip-unneeded"
89
90 # Continue to strip user apps and shared libraries using sstrip
91 echo "Stripping userapps and shared libraries more..."
92 $SSTRIP $TOP_DIR/$ROOTFS/bin/* $TOP_DIR/$ROOTFS/lib/*.so*
93
94