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: build.sh,v 1.5 2006/03/29 17:08:45 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
81 echo "Usage: prep.sh [OPTION]..."
82 echo " -r release Fedora release number (default: $releasever)"
83 echo " -a arch Fedora architecture (default: $basearch)"
84 echo " -h This message"
89 while getopts "r:a:h" opt ; do
103 # Do not tolerate errors
106 # Root of the initramfs reference image
107 bootcd=$PWD/build/bootcd
108 install -d -m 755 $bootcd
110 # Write version number
111 rpmquery --specfile bootcd.spec --queryformat '%{VERSION}\n' | head -1 >build/version.txt
113 # Install base system
114 for package in "${packagelist[@]}" ; do
115 packages="$packages -p $package"
117 mkfedora -v -r $releasever -a $basearch $packages $bootcd
119 # Disable all services in reference image
120 chroot $bootcd sh -c "/sbin/chkconfig --list | awk '{ print \$1 }' | xargs -i /sbin/chkconfig {} off"
122 # Install configuration files
123 echo "* Installing configuration files"
124 for file in fstab mtab modprobe.conf inittab hosts sysctl.conf ; do
125 install -D -m 644 conf_files/$file $bootcd/etc/$file
128 # Install initscripts
129 echo "* Installing initscripts"
130 for file in pl_sysinit pl_hwinit pl_netinit pl_validateconf pl_boot ; do
131 install -D -m 755 conf_files/$file $bootcd/etc/init.d/$file
134 # Install fallback node configuration file
135 echo "* Installing fallback node configuration file"
136 install -D -m 644 conf_files/default-net.cnf $bootcd/usr/boot/default-net.cnf
138 # Build pcitable for hardware detection
139 echo "* Building pcitable for hardware detection"
140 pci_map_file=$(find $bootcd/lib/modules/ -name modules.pcimap | head -1)
141 module_dep_file=$(find $bootcd/lib/modules/ -name modules.dep | head -1)
142 pci_table=$bootcd/usr/share/hwdata/pcitable
143 $srcdir/bootmanager/source/merge_hw_tables.py \
144 $module_dep_file $pci_map_file $pci_table $bootcd/etc/pl_pcitable
146 # Copy /etc/passwd out
147 install -D -m 644 $bootcd/etc/passwd build/passwd
150 isofs=$PWD/build/isofs
151 install -d -m 755 $isofs
153 # Copy the kernel out
154 for kernel in $bootcd/boot/vmlinuz-* ; do
155 if [ -f $kernel ] ; then
156 install -D -m 644 $kernel $isofs/kernel
160 # initramfs requires that /init be present
161 ln -sf /sbin/init $bootcd/init
163 # Pack the rest into a compressed archive
164 echo "* Compressing reference image"
165 (cd $bootcd && find . | cpio --quiet -c -o) | gzip -9 >$isofs/bootcd.img
168 echo "* Building syslinux"
169 CFLAGS="-Werror -Wno-unused -finline-limit=2000" make -C syslinux
172 echo "* Installing isolinux"
173 install -D -m 644 syslinux/isolinux.bin $isofs/isolinux.bin