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.7 2006/05/18 22:30:22 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
89 usr/sbin/build-locale-archive
90 usr/sbin/dbconverter-2
99 usr/share/i18n/locales/en_US
100 usr/share/i18n/charmaps/UTF-8.gz
102 usr/share/terminfo/l/linux
103 usr/share/terminfo/v/vt100
104 usr/share/terminfo/x/xterm
105 usr/share/zoneinfo/UTC
106 usr/lib/locale/en_US.utf8
111 echo "Usage: prep.sh [OPTION]..."
112 echo " -r release Fedora release number (default: $releasever)"
113 echo " -a arch Fedora architecture (default: $basearch)"
114 echo " -h This message"
119 while getopts "r:a:h" opt ; do
133 # Do not tolerate errors
136 # Root of the initramfs reference image
137 bootcd=$PWD/build/bootcd
138 install -d -m 755 $bootcd
140 # Write version number
141 rpmquery --specfile bootcd.spec --queryformat '%{VERSION}\n' | head -1 >build/version.txt
143 # Install base system
144 for package in "${packagelist[@]}" ; do
145 packages="$packages -p $package"
147 mkfedora -v -r $releasever -a $basearch -k $packages $bootcd
151 echo "* Removing unnecessary junk"
153 # Save precious files
154 tar --ignore-failed-read -cpf precious.tar ${precious[*]}
156 # Remove unnecessary junk
159 # Restore precious files
160 tar -xpf precious.tar
165 # Disable all services in reference image
166 chroot $bootcd sh -c "/sbin/chkconfig --list | awk '{ print \$1 }' | xargs -i /sbin/chkconfig {} off"
168 # Install configuration files
169 echo "* Installing configuration files"
170 for file in fstab mtab modprobe.conf inittab hosts sysctl.conf ; do
171 install -D -m 644 conf_files/$file $bootcd/etc/$file
174 # Install initscripts
175 echo "* Installing initscripts"
176 for file in pl_sysinit pl_hwinit pl_netinit pl_validateconf pl_boot ; do
177 install -D -m 755 conf_files/$file $bootcd/etc/init.d/$file
180 # Install fallback node configuration file
181 echo "* Installing fallback node configuration file"
182 install -D -m 644 conf_files/default-net.cnf $bootcd/usr/boot/default-net.cnf
184 # Build pcitable for hardware detection
185 echo "* Building pcitable for hardware detection"
186 pci_map_file=$(find $bootcd/lib/modules/ -name modules.pcimap | head -1)
187 module_dep_file=$(find $bootcd/lib/modules/ -name modules.dep | head -1)
188 pci_table=$bootcd/usr/share/hwdata/pcitable
189 $srcdir/bootmanager/source/merge_hw_tables.py \
190 $module_dep_file $pci_map_file $pci_table $bootcd/etc/pl_pcitable
192 # Copy /etc/passwd out
193 install -D -m 644 $bootcd/etc/passwd build/passwd
196 isofs=$PWD/build/isofs
197 install -d -m 755 $isofs
199 # Copy the kernel out
200 for kernel in $bootcd/boot/vmlinuz-* ; do
201 if [ -f $kernel ] ; then
202 install -D -m 644 $kernel $isofs/kernel
206 # initramfs requires that /init be present
207 ln -sf /sbin/init $bootcd/init
209 # Pack the rest into a compressed archive
210 echo "* Compressing reference image"
211 (cd $bootcd && find . | cpio --quiet -c -o) | gzip -9 >$isofs/bootcd.img
214 echo "* Building syslinux"
215 CFLAGS="-Werror -Wno-unused -finline-limit=2000" make -C syslinux
218 echo "* Installing isolinux"
219 install -D -m 644 syslinux/isolinux.bin $isofs/isolinux.bin