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.13 2006/08/21 20:45:23 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 .."
88 usr/sbin/build-locale-archive
89 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
110 # Do not tolerate errors
113 # Root of the initramfs reference image
114 bootcd=$PWD/build/bootcd
115 install -d -m 755 $bootcd
117 # Write version number
118 rpmquery --specfile bootcd.spec --queryformat '%{VERSION}\n' | head -1 >build/version.txt
120 # Install base system
121 for package in "${packagelist[@]}" ; do
122 packages="$packages -p $package"
125 pl_setup_chroot $bootcd $packages
129 echo "* Removing unnecessary junk"
131 # Save precious files
132 tar --ignore-failed-read -cpf precious.tar ${precious[*]}
134 # Remove unnecessary junk
137 # Restore precious files
138 tar -xpf precious.tar
143 # Install ipnmac (for SuperMicro machines with IPMI)
144 echo "* Installing IPMI utilities"
145 install -D -m 755 ipnmac/ipnmac.x86 $bootcd/usr/sbin/ipnmac
147 # Install configuration files
148 echo "* Installing configuration files"
149 for file in fstab mtab modprobe.conf inittab hosts sysctl.conf ; do
150 install -D -m 644 conf_files/$file $bootcd/etc/$file
153 # Install initscripts
154 echo "* Installing initscripts"
155 for file in pl_sysinit pl_hwinit pl_netinit pl_validateconf pl_boot ; do
156 install -D -m 755 conf_files/$file $bootcd/etc/init.d/$file
159 # Install fallback node configuration file
160 echo "* Installing fallback node configuration file"
161 install -D -m 644 conf_files/default-net.cnf $bootcd/usr/boot/default-net.cnf
163 # Build pcitable for hardware detection
164 echo "* Building pcitable for hardware detection"
165 pci_map_file=$(find $bootcd/lib/modules/ -name modules.pcimap | head -1)
166 module_dep_file=$(find $bootcd/lib/modules/ -name modules.dep | head -1)
167 pci_table=$bootcd/usr/share/hwdata/pcitable
168 $srcdir/bootmanager/source/merge_hw_tables.py \
169 $module_dep_file $pci_map_file $pci_table $bootcd/etc/pl_pcitable
171 # Copy /etc/passwd out
172 install -D -m 644 $bootcd/etc/passwd build/passwd
175 isofs=$PWD/build/isofs
176 install -d -m 755 $isofs
178 # Copy the kernel out
179 for kernel in $bootcd/boot/vmlinuz-* ; do
180 if [ -f $kernel ] ; then
181 install -D -m 644 $kernel $isofs/kernel
185 # Don't need /boot anymore
188 # initramfs requires that /init be present
189 ln -sf /sbin/init $bootcd/init
191 # Pack the rest into a compressed archive
192 echo "* Compressing reference image"
193 (cd $bootcd && find . | cpio --quiet -c -o) | gzip -9 >$isofs/bootcd.img
196 echo "* Building syslinux"
197 CFLAGS="-Werror -Wno-unused -finline-limit=2000" make -C syslinux
200 echo "* Installing isolinux"
201 install -D -m 644 syslinux/isolinux.bin $isofs/isolinux.bin