3 # Shell script to build and install the zfcpdump ramdisk
5 # > create_rd.sh (ARCH) : build ramdisk
6 # > create_rd.sh -r : cleanup
7 # > create_rd.sh -i : install files
9 # Copyright IBM Corp. 2003, 2006.
10 # Author(s): Michael Holzheu <holzheu@de.ibm.com>
15 E2FS_PROGS
="../extern/$E2FS_PROGS_TARBALL"
28 # check() function to check error codes
42 # build(): build the ramdisk
49 echo "==============================================================="
50 echo "Removing old installation"
51 echo "==============================================================="
55 echo "==============================================================="
56 echo "Creating RD dir structure"
57 echo "==============================================================="
69 if [ ! -f e2fsprogs-
$E2FS_PROGS_VERSION/e2fsck
/e2fsck
]
71 echo "==============================================================="
72 echo "Extracting E2FSPROGS"
73 echo "==============================================================="
76 echo "==============================================================="
77 echo "Compiling E2FSPROGS"
78 echo "==============================================================="
79 cd e2fsprogs-
$E2FS_PROGS_VERSION
85 echo "==============================================================="
86 echo "Installing e2fsck"
87 echo "==============================================================="
88 strip e2fsprogs-
$E2FS_PROGS_VERSION/e2fsck
/e2fsck
89 cp e2fsprogs-
$E2FS_PROGS_VERSION/e2fsck
/e2fsck
$RD_TMP/sbin
93 # copy additional files
97 cp zfcp_dumper
$RD_TMP/sbin
/init
98 ln -s /proc
/mounts
"$RD_TMP/etc/mtab"
104 echo "==============================================================="
105 echo "Creating ramdisk ($RD_FS)"
106 echo "==============================================================="
108 if [ "$RD_FS" == "romfs" ]
110 printf "%-30s: " "Creating romfs"
111 genromfs
-f $ZFCPDUMP_RD -d $RD_TMP
113 printf "%-30s: " "zip romfs"
116 mv "$ZFCPDUMP_RD.gz" $ZFCPDUMP_RD
117 elif [ "$RD_FS" == "ext2" ]
119 RD_MIN_SIZE
=`du -k -s $RD_TMP | awk '{print $1}'`
120 RD_SIZE
=`expr $RD_MIN_SIZE + $EXT2_RD_FREE_SIZE`
122 printf "creating rd with size $RD_SIZE KB (used $RD_MIN_SIZE):"
123 dd if=/dev
/zero of
=$RD_IMAGE bs
=1k count
=$RD_SIZE
126 printf "%-30s: " "Creating ext2"
127 yes | mke2fs
$RD_IMAGE
129 printf "%-30s: " "Mounting RD"
134 mount
$RD_IMAGE "`pwd`/mnt" -o loop
137 printf "%-30s: " "Copy RD"
146 printf "%-30s: " "Umount RD"
150 printf "%-30s: " "packing RD"
153 mv "$RD_IMAGE.gz" $ZFCPDUMP_RD
156 echo "ERROR: Invalid ramdisk filesystem '$RD_FS'"
159 echo "=============================================================="
160 echo "SUCCESS: built ramdisk '$ZFCPDUMP_RD'"
161 echo "=============================================================="
165 # cleanup(): function to remove build files
178 # install(): function to install zfcpdump kernel
182 cp $ZFCPDUMP_RD "$INSTROOT/$ZFCPDUMP_DIR"; chmod 644 "$INSTROOT/$ZFCPDUMP_DIR/$ZFCPDUMP_RD"
192 elif [ "$1" == "-i" ]