3 # Builds the BootCD reference image, the first of two
4 # initramfs cpio archives that are concatenated together by
5 # isolinux/syslinux to form a custom BootCD.
7 # Aaron Klingaman <alk@absarokasoft.com>
8 # Mark Huang <mlhuang@cs.princeton.edu>
9 # Copyright (C) 2004-2006 The Trustees of Princeton University
11 # $Id: prep.sh,v 1.6 2006/05/18 22:18:07 mlhuang Exp $
14 PATH=/sbin:/bin:/usr/sbin:/usr/bin
16 # In both a normal CVS environment and a PlanetLab RPM
17 # build environment, all of our dependencies are checked out into
18 # directories at the same level as us.
19 if [ -d ../build ] ; then
23 echo "Error: Could not find sources in either . or .."
29 # Release and architecture to install
90 usr/sbin/build-locale-archive
91 usr/sbin/dbconverter-2
100 usr/share/i18n/locales/en_US
101 usr/share/i18n/charmaps/UTF-8.gz
103 usr/share/terminfo/l/linux
104 usr/share/terminfo/v/vt100
105 usr/share/terminfo/x/xterm
106 usr/share/zoneinfo/UTC
107 usr/lib/locale/en_US.utf8
112 echo "Usage: prep.sh [OPTION]..."
113 echo " -r release Fedora release number (default: $releasever)"
114 echo " -a arch Fedora architecture (default: $basearch)"
115 echo " -h This message"
120 while getopts "r:a:h" opt ; do
134 # Do not tolerate errors
137 # Root of the initramfs reference image
138 bootcd=$PWD/build/bootcd
139 install -d -m 755 $bootcd
141 # Write version number
142 rpmquery --specfile bootcd.spec --queryformat '%{VERSION}\n' | head -1 >build/version.txt
144 # Install base system
145 for package in "${packagelist[@]}" ; do
146 packages="$packages -p $package"
148 mkfedora -v -r $releasever -a $basearch -k $packages $bootcd
152 echo "* Removing unnecessary junk"
154 # Save precious files
155 tar --ignore-failed-read -cpf precious.tar ${precious[*]}
157 # Remove unnecessary junk
160 # Restore precious files
161 tar -xpf precious.tar
166 # Disable all services in reference image
167 chroot $bootcd sh -c "/sbin/chkconfig --list | awk '{ print \$1 }' | xargs -i /sbin/chkconfig {} off"
169 # Install configuration files
170 echo "* Installing configuration files"
171 for file in fstab mtab modprobe.conf inittab hosts sysctl.conf ; do
172 install -D -m 644 conf_files/$file $bootcd/etc/$file
175 # Install initscripts
176 echo "* Installing initscripts"
177 for file in pl_sysinit pl_hwinit pl_netinit pl_validateconf pl_boot ; do
178 install -D -m 755 conf_files/$file $bootcd/etc/init.d/$file
181 # Install fallback node configuration file
182 echo "* Installing fallback node configuration file"
183 install -D -m 644 conf_files/default-net.cnf $bootcd/usr/boot/default-net.cnf
185 # Build pcitable for hardware detection
186 echo "* Building pcitable for hardware detection"
187 pci_map_file=$(find $bootcd/lib/modules/ -name modules.pcimap | head -1)
188 module_dep_file=$(find $bootcd/lib/modules/ -name modules.dep | head -1)
189 pci_table=$bootcd/usr/share/hwdata/pcitable
190 $srcdir/bootmanager/source/merge_hw_tables.py \
191 $module_dep_file $pci_map_file $pci_table $bootcd/etc/pl_pcitable
193 # Copy /etc/passwd out
194 install -D -m 644 $bootcd/etc/passwd build/passwd
197 isofs=$PWD/build/isofs
198 install -d -m 755 $isofs
200 # Copy the kernel out
201 for kernel in $bootcd/boot/vmlinuz-* ; do
202 if [ -f $kernel ] ; then
203 install -D -m 644 $kernel $isofs/kernel
207 # initramfs requires that /init be present
208 ln -sf /sbin/init $bootcd/init
210 # Pack the rest into a compressed archive
211 echo "* Compressing reference image"
212 (cd $bootcd && find . | cpio --quiet -c -o) | gzip -9 >$isofs/bootcd.img
215 echo "* Building syslinux"
216 CFLAGS="-Werror -Wno-unused -finline-limit=2000" make -C syslinux
219 echo "* Installing isolinux"
220 install -D -m 644 syslinux/isolinux.bin $isofs/isolinux.bin