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.8 2006/05/30 19:09:14 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
102 usr/share/i18n/locales/en_US
103 usr/share/i18n/charmaps/UTF-8.gz
105 usr/share/terminfo/l/linux
106 usr/share/terminfo/v/vt100
107 usr/share/terminfo/x/xterm
108 usr/share/zoneinfo/UTC
109 usr/lib/locale/en_US.utf8
114 echo "Usage: prep.sh [OPTION]..."
115 echo " -r release Fedora release number (default: $releasever)"
116 echo " -a arch Fedora architecture (default: $basearch)"
117 echo " -h This message"
122 while getopts "r:a:h" opt ; do
136 # Do not tolerate errors
139 # Root of the initramfs reference image
140 bootcd=$PWD/build/bootcd
141 install -d -m 755 $bootcd
143 # Write version number
144 rpmquery --specfile bootcd.spec --queryformat '%{VERSION}\n' | head -1 >build/version.txt
146 # Install base system
147 for package in "${packagelist[@]}" ; do
148 packages="$packages -p $package"
150 mkfedora -v -r $releasever -a $basearch -k $packages $bootcd
154 echo "* Removing unnecessary junk"
156 # Save precious files
157 tar --ignore-failed-read -cpf precious.tar ${precious[*]}
159 # Remove unnecessary junk
162 # Restore precious files
163 tar -xpf precious.tar
168 # Disable all services in reference image
169 chroot $bootcd sh -c "/sbin/chkconfig --list | awk '{ print \$1 }' | xargs -i /sbin/chkconfig {} off"
171 # Install configuration files
172 echo "* Installing configuration files"
173 for file in fstab mtab modprobe.conf inittab hosts sysctl.conf ; do
174 install -D -m 644 conf_files/$file $bootcd/etc/$file
177 # Install initscripts
178 echo "* Installing initscripts"
179 for file in pl_sysinit pl_hwinit pl_netinit pl_validateconf pl_boot ; do
180 install -D -m 755 conf_files/$file $bootcd/etc/init.d/$file
183 # Install fallback node configuration file
184 echo "* Installing fallback node configuration file"
185 install -D -m 644 conf_files/default-net.cnf $bootcd/usr/boot/default-net.cnf
187 # Build pcitable for hardware detection
188 echo "* Building pcitable for hardware detection"
189 pci_map_file=$(find $bootcd/lib/modules/ -name modules.pcimap | head -1)
190 module_dep_file=$(find $bootcd/lib/modules/ -name modules.dep | head -1)
191 pci_table=$bootcd/usr/share/hwdata/pcitable
192 $srcdir/bootmanager/source/merge_hw_tables.py \
193 $module_dep_file $pci_map_file $pci_table $bootcd/etc/pl_pcitable
195 # Copy /etc/passwd out
196 install -D -m 644 $bootcd/etc/passwd build/passwd
199 isofs=$PWD/build/isofs
200 install -d -m 755 $isofs
202 # Copy the kernel out
203 for kernel in $bootcd/boot/vmlinuz-* ; do
204 if [ -f $kernel ] ; then
205 install -D -m 644 $kernel $isofs/kernel
209 # initramfs requires that /init be present
210 ln -sf /sbin/init $bootcd/init
212 # Pack the rest into a compressed archive
213 echo "* Compressing reference image"
214 (cd $bootcd && find . | cpio --quiet -c -o) | gzip -9 >$isofs/bootcd.img
217 echo "* Building syslinux"
218 CFLAGS="-Werror -Wno-unused -finline-limit=2000" make -C syslinux
221 echo "* Installing isolinux"
222 install -D -m 644 syslinux/isolinux.bin $isofs/isolinux.bin