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
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 .."
31 # pldistro expected as $1 - defaults to planetlab
33 [ -n "$@" ] && pldistro=$1
35 # Packages to install : see <pldistro>-<fcdistro>-bootcd.lst
48 usr/sbin/build-locale-archive
49 usr/sbin/dbconverter-2
60 usr/share/i18n/locales/en_US
61 usr/share/i18n/charmaps/UTF-8.gz
63 usr/share/terminfo/l/linux
64 usr/share/terminfo/v/vt100
65 usr/share/terminfo/x/xterm
66 usr/share/zoneinfo/UTC
67 usr/lib/locale/en_US.utf8
70 # Do not tolerate errors
73 # Root of the initramfs reference image
74 bootcd=$PWD/build/bootcd
75 install -d -m 755 $bootcd
77 # Write version number
78 rpmquery --specfile bootcd.spec --queryformat '%{VERSION}\n' | head -1 >build/version.txt
81 lst=${pldistro}-${pl_DISTRO_NAME}-bootcd.lst
82 options=$(pl_getPackagesOptions $lst)
84 pl_setup_chroot $bootcd $options -k
88 echo "* Removing unnecessary junk"
91 tar --ignore-failed-read -cpf precious.tar ${precious[*]}
93 # Remove unnecessary junk
96 # Restore precious files
102 # Install ipnmac (for SuperMicro machines with IPMI)
103 echo "* Installing IPMI utilities"
104 install -D -m 755 ipnmac/ipnmac.x86 $bootcd/usr/sbin/ipnmac
106 # Install configuration files
107 echo "* Installing configuration files"
108 for file in fstab mtab modprobe.conf inittab hosts sysctl.conf ; do
109 install -D -m 644 conf_files/$file $bootcd/etc/$file
112 # Install initscripts
113 echo "* Installing initscripts"
114 for file in pl_sysinit pl_hwinit pl_netinit pl_validateconf pl_boot ; do
115 install -D -m 755 conf_files/$file $bootcd/etc/init.d/$file
118 # Install fallback node configuration file
119 echo "* Installing fallback node configuration file"
120 install -D -m 644 conf_files/default-net.cnf $bootcd/usr/boot/default-net.cnf
122 # Build pcitable for hardware detection
123 echo "* Building pcitable for hardware detection"
124 pci_map_file=$(find $bootcd/lib/modules/ -name modules.pcimap | head -1)
125 module_dep_file=$(find $bootcd/lib/modules/ -name modules.dep | head -1)
126 pci_table=$bootcd/usr/share/hwdata/pcitable
127 $srcdir/BootManager/source/merge_hw_tables.py \
128 $module_dep_file $pci_map_file $pci_table $bootcd/etc/pl_pcitable
130 # Copy /etc/passwd out
131 install -D -m 644 $bootcd/etc/passwd build/passwd
134 isofs=$PWD/build/isofs
135 install -d -m 755 $isofs
137 # Copy the kernel out
138 for kernel in $bootcd/boot/vmlinuz-* ; do
139 if [ -f $kernel ] ; then
140 install -D -m 644 $kernel $isofs/kernel
144 # Don't need /boot anymore
147 # initramfs requires that /init be present
148 ln -sf /sbin/init $bootcd/init
150 # Pack the rest into a compressed archive
151 echo "* Compressing reference image"
152 (cd $bootcd && find . | cpio --quiet -c -o) | gzip -9 >$isofs/bootcd.img
155 echo "* Building syslinux"
156 CFLAGS="-Werror -Wno-unused -finline-limit=2000" make -C syslinux
159 echo "* Installing isolinux"
160 install -D -m 644 syslinux/isolinux.bin $isofs/isolinux.bin