#!/bin/bash
-# Copyright 1999-2005 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/targets/support/bootloader-setup.sh,v 1.19 2005/11/21 17:14:32 rocket Exp $
-. ${clst_sharedir}/targets/support/functions.sh
-. ${clst_sharedir}/targets/support/filesystem-functions.sh
+source ${clst_sharedir}/targets/support/functions.sh
+source ${clst_sharedir}/targets/support/filesystem-functions.sh
# $1 is the destination root
extract_cdtar $1
extract_kernels $1/boot
-check_dev_manager
check_bootargs
check_filesystem_type
default_append_line="root=/dev/ram0 init=/linuxrc ${cmdline_opts} ${custom_kopts} cdroot"
+[ -n "${clst_splash_theme}" ] && default_append_line="${default_append_line} splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet"
-case ${clst_mainarch} in
+case ${clst_hostarch} in
alpha)
+ # NO SOFTLEVEL SUPPORT YET
acfg=$1/etc/aboot.conf
bctr=0
+ # Pass 1 is for non-serial
for x in ${clst_boot_kernel}
do
echo -n "${bctr}:/boot/${x} " >> ${acfg}
echo "init=/linuxrc ${cmdline_opts} cdroot" >> ${acfg}
((bctr=${bctr}+1))
done
- ;;
-
+ # Pass 2 is for serial
+ cmdline_opts="${cmdline_opts} console=ttyS0"
+ for x in ${clst_boot_kernel}
+ do
+ echo -n "${bctr}:/boot/${x} " >> ${acfg}
+ echo -n "initrd=/boot/${x}.igz root=/dev/ram0 " >> ${acfg}
+ echo "init=/linuxrc ${cmdline_opts} cdroot" >> ${acfg}
+ ((bctr=${bctr}+1))
+ done
+ ;;
arm)
- ;;
+ # NO SOFTLEVEL SUPPORT YET
+ ;;
hppa)
+ # NO SOFTLEVEL SUPPORT YET
icfg=$1/boot/palo.conf
kmsg=$1/boot/kernels.msg
hmsg=$1/boot/help.msg
- echo "--commandline=0/${first} initrd=${first}.igz root=/dev/ram0 init=/linuxrc ${cmdline_opts}" >> ${icfg}
+ # Make sure we strip the extension to the kernel to allow palo to choose
+ boot_kernel_common_name=${first/%32/}
+ boot_kernel_common_name=${boot_kernel_common_name/%64/}
+ echo "--commandline=0/${boot_kernel_common_name} initrd=${first}.igz root=/dev/ram0 init=/linuxrc cdroot ${cmdline_opts}" >> ${icfg}
echo "--bootloader=boot/iplboot" >> ${icfg}
echo "--ramdisk=boot/${first}.igz" >> ${icfg}
- ;;
- ppc)
- # PPC requirements:
- # -----------------
- # The specs indicate the kernels to be build. We need to put
- # those kernels and the corresponding initrd.img.gz(s) in the
- # /boot directory. This directory contains a message boot.msg
- # containing some info to be displayed on boot, a configuration
- # (yaboot.conf) specifying the boot options (kernel/initrd
- # combinations). The boot directory also contains a file called
- # yaboot, which normally gets copied from the live environment.
- # For now we supply a prebuilt file, prebuilt configuration
- # and prebuilt boot message. This can be enhanced later on
- # but the following suffices for now:
-
- # this sets up the config file for yaboot
+ for x in ${clst_boot_kernel}
+ do
+ echo "--recoverykernel=boot/${x}" >> ${icfg}
+ done
+ ;;
+ ppc*|powerpc*)
+ # NO SOFTLEVEL SUPPORT YET
icfg=$1/boot/yaboot.conf
kmsg=$1/boot/boot.msg
- echo "default ${first}" > ${icfg}
- echo "timeout 300" >> ${icfg}
+
echo "device=cd:" >> ${icfg}
echo "root=/dev/ram" >> ${icfg}
echo "fgcolor=white" >> ${icfg}
echo "bgcolor=black" >> ${icfg}
echo "message=/boot/boot.msg" >> ${icfg}
+
+ # Here is where I fix up the boot.msg file.
+ sed -e 's/ARCH/PowerPC/' \
+ -e 's/HARDWARE/Apple and IBM hardware/' \
+ -i $kmsg
+
+ # Setup the IBM yaboot.conf
+ etc_icfg=$1/etc/yaboot.conf
+ mkdir -p $1/etc
+ IBM_YABOOT="FALSE"
+ echo "root=/dev/ram" >> ${etc_icfg}
+ echo "fgcolor=white" >> ${etc_icfg}
+ echo "bgcolor=black" >> ${etc_icfg}
+ echo "message=/boot/boot.msg" >> ${etc_icfg}
+
for x in ${clst_boot_kernel}
do
+ eval "clst_kernel_console=\$clst_boot_kernel_${x}_console"
+ eval "clst_kernel_machine_type=\$clst_boot_kernel_${x}_machine_type"
eval custom_kopts=\$${x}_kernelopts
+
echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
- echo >> ${icfg}
- echo "image=/boot/${x}" >> ${icfg}
-
- if [ -e "/boot/${x}.igz" ]
- then
- echo "initrd=/boot/${x}.igz" >> ${icfg}
- fi
-
- echo "label=${x}" >> ${icfg}
- echo "read-write" >> ${icfg}
- if [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
+ if [ "${clst_kernel_machine_type}" == "ibm" ]
then
- echo "append=\"${default_append_line} splash=silent,theme:${clst_livecd_splash_theme}\"" >> ${icfg}
+ IBM_YABOOT="true"
+ if [ -n "${clst_kernel_console}" ]
+ then
+ echo >> ${etc_icfg}
+ echo "image=/boot/${x}" >> ${etc_icfg}
+
+ if [ -e "$1/boot/${x}.igz" ]
+ then
+ echo "initrd=/boot/${x}.igz" >> ${etc_icfg}
+ fi
+
+ echo "label=${x}" >> ${etc_icfg}
+ echo "read-write" >> ${icfg}
+ echo "append=\"${default_append_line}\"" >> ${etc_icfg}
+
+ for y in ${clst_kernel_console}
+ do
+ echo ${y}
+ echo >> ${etc_icfg}
+ echo "image=/boot/${x}" >> ${etc_icfg}
+
+ if [ -e "$1/boot/${x}.igz" ]
+ then
+ echo "initrd=/boot/${x}.igz" >> ${etc_icfg}
+ fi
+
+ echo "label=${x}-${y} " >> ${etc_icfg}
+ echo "read-write" >> ${icfg}
+ echo "append=\"${default_append_line} console=${y}\"" >> ${etc_icfg}
+ done
+ else
+ echo >> ${etc_icfg}
+ echo "image=/boot/${x}" >> ${etc_icfg}
+
+ if [ -e "$1/boot/${x}.igz" ]
+ then
+ echo "initrd=/boot/${x}.igz" >> ${etc_icfg}
+ fi
+
+ echo "label=${x}" >> ${etc_icfg}
+ echo "read-write" >> ${etc_icfg}
+ echo "append=\"${default_append_line}\"" >> ${etc_icfg}
+ fi
else
- echo "append=\"${default_append_line} splash=silent\"" >> ${icfg}
+ # Here we wipe out the /ppc directory, if it exists.
+ rm -rf $1/ppc
+ if [ -n "${clst_kernel_console}" ]
+ then
+ echo >> ${icfg}
+ echo "image=/boot/${x}" >> ${icfg}
+
+ if [ -e "$1/boot/${x}.igz" ]
+ then
+ echo "initrd=/boot/${x}.igz" >> ${icfg}
+ fi
+
+ echo "label=${x}" >> ${icfg}
+ echo "read-write" >> ${icfg}
+ echo "append=\"${default_append_line}\"" >> ${icfg}
+
+ for y in ${clst_kernel_console}
+ do
+ echo >> ${icfg}
+ echo "image=/boot/${x}" >> ${icfg}
+
+ if [ -e "$1/boot/${x}.igz" ]
+ then
+ echo "initrd=/boot/${x}.igz" >> ${icfg}
+ fi
+
+ echo "label=${x}-${y} " >> ${icfg}
+ echo "read-write" >> ${icfg}
+ echo "append=\"${default_append_line} console=${y}\"" >> ${icfg}
+ done
+ else
+ echo >> ${icfg}
+ echo "image=/boot/${x}" >> ${icfg}
+
+ if [ -e "$1/boot/${x}.igz" ]
+ then
+ echo "initrd=/boot/${x}.igz" >> ${icfg}
+ fi
+
+ echo "label=${x}" >> ${icfg}
+ echo "read-write" >> ${icfg}
+ echo "append=\"${default_append_line}\"" >> ${icfg}
+ fi
fi
done
- ;;
+
+ if [ "${IBM_YABOOT}" == "FALSE" ]
+ then
+ rm ${etc_kmsg}
+ rmdir $1/etc
+ if [ -d $1/ppc ]
+ then
+ rm -r $1/ppc
+ fi
+ fi
+
+ ;;
sparc*)
+ # NO SOFTLEVEL SUPPORT YET
scfg=$1/boot/silo.conf
echo "default=\"help\"" > ${scfg}
echo "message=\"/boot/boot.msg\"" >> ${scfg}
echo -e "label=\"video\"" >> ${scfg}
echo "image=\"cat /boot/help.msg\"" >> ${scfg}
echo -e "label=\"help\"" >> ${scfg}
- ;;
+ echo "image=\"cat /boot/parameters.msg\"" >> ${scfg}
+ echo -e "label=\"parameters\"" >> ${scfg}
+ ;;
ia64)
+ # NO SOFTLEVEL SUPPORT YET
iacfg=$1/boot/elilo.conf
echo 'prompt' > ${iacfg}
echo 'message=/efi/boot/elilo.msg' >> ${iacfg}
echo 'chooser=simple' >> ${iacfg}
echo 'timeout=50' >> ${iacfg}
+ echo 'relocatable' >> ${iacfg}
echo >> ${iacfg}
for x in ${clst_boot_kernel}
do
echo ' append="'initrd=${x}.igz ${default_append_line}' console=tty0 console=ttyS0,9600"' >> ${iacfg}
echo " initrd=/efi/boot/${x}.igz" >> ${iacfg}
echo >> ${iacfg}
+ echo "image=/efi/boot/${x}" >> ${iacfg}
+ echo " label=${x}-ilo">> ${iacfg}
+ echo ' append="'initrd=${x}.igz ${default_append_line}' console=tty0 console=ttyS3,9600"' >> ${iacfg}
+ echo " initrd=/efi/boot/${x}.igz" >> ${iacfg}
+ echo >> ${iacfg}
+ echo "image=/efi/boot/${x}" >> ${iacfg}
+ echo " label=${x}-sgi">> ${iacfg}
+ echo ' append="'initrd=${x}.igz ${default_append_line}' console=tty0 console=ttySG0,115200"' >> ${iacfg}
+ echo " initrd=/efi/boot/${x}.igz" >> ${iacfg}
+ echo >> ${iacfg}
+ mv $1/boot/${x}{,.igz} $1/boot/efi/boot
done
cp ${iacfg} $1/boot/efi/boot
- mv $1/boot/${x}{,.igz} $1/boot/efi/boot
- ;;
+ ;;
x86|amd64)
if [ -e $1/isolinux/isolinux.bin ]
then
- mv $1/boot/* $1/isolinux
- rmdir $1/boot
+ cp -f $1/boot/* $1/isolinux
# the rest of this function sets up the config file for isolinux
icfg=$1/isolinux/isolinux.cfg
kmsg=$1/isolinux/kernels.msg
echo "default ${first}" > ${icfg}
echo "timeout 150" >> ${icfg}
+ echo "ontimeout localhost" >> ${icfg}
echo "prompt 1" >> ${icfg}
echo "display boot.msg" >> ${icfg}
echo "F1 kernels.msg" >> ${icfg}
for x in ${clst_boot_kernel}
do
-
eval custom_kopts=\$${x}_kernelopts
echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
echo >> ${icfg}
- echo "label ${x}" >> ${icfg}
- echo " kernel ${x}" >> ${icfg}
- if [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
+
+ eval "clst_kernel_softlevel=\$clst_boot_kernel_${x}_softlevel"
+
+ if [ -n "${clst_kernel_softlevel}" ]
then
- echo " append ${default_append_line} initrd=${x}.igz vga=791 splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet" >> ${icfg}
+ for y in ${clst_kernel_softlevel}
+ do
+ echo "label ${x}-${y}" >> ${icfg}
+ echo " kernel ${x}" >> ${icfg}
+ echo " append ${default_append_line} softlevel=${y} initrd=${x}.igz vga=791" >> ${icfg}
+
+ echo >> ${icfg}
+ echo " ${x}" >> ${kmsg}
+ echo "label ${x}-${y}-nofb" >> ${icfg}
+ echo " kernel ${x}" >> ${icfg}
+ echo " append ${default_append_line} softlevel=${y} initrd=${x}.igz" >> ${icfg}
+ echo >> ${icfg}
+ echo " ${x}-nofb" >> ${kmsg}
+ done
else
- echo " append ${default_append_line} initrd=${x}.igz vga=791 splash=silent" >> ${icfg}
+ echo "label ${x}" >> ${icfg}
+ echo " kernel ${x}" >> ${icfg}
+ echo " append ${default_append_line} initrd=${x}.igz vga=791" >> ${icfg}
+ echo >> ${icfg}
+ echo " ${x}" >> ${kmsg}
+ echo "label ${x}-nofb" >> ${icfg}
+ echo " kernel ${x}" >> ${icfg}
+ echo " append ${default_append_line} initrd=${x}.igz" >> ${icfg}
+ echo >> ${icfg}
+ echo " ${x}-nofb" >> ${kmsg}
fi
-
- echo >> ${icfg}
- echo " ${x}" >> ${kmsg}
- echo "label ${x}-nofb" >> ${icfg}
- echo " kernel ${x}" >> ${icfg}
- echo " append ${default_append_line} initrd=${x}.igz" >> ${icfg}
- echo >> ${icfg}
- echo " ${x}-nofb" >> ${kmsg}
done
if [ -f $1/isolinux/memtest86 ]
echo "label memtest86" >> $icfg
echo " kernel memtest86" >> $icfg
fi
+ echo >> $icfg
+ echo "label localhost" >> $icfg
+ echo " localboot -1" >> $icfg
+ echo " MENU HIDE" >> $icfg
+ fi
+
+ if [ -e $1/boot/efi/elilo.efi ]
+ then
+ [ -e $1/isolinux/elilo.efi ] && rm -f $1/isolinux/elilo.efi
+ iacfg=$1/boot/elilo.conf
+ echo 'prompt' > ${iacfg}
+ echo 'message=/efi/boot/elilo.msg' >> ${iacfg}
+ echo 'chooser=simple' >> ${iacfg}
+ echo 'timeout=50' >> ${iacfg}
+ echo >> ${iacfg}
+ for x in ${clst_boot_kernel}
+ do
+ echo "image=/efi/boot/${x}" >> ${iacfg}
+ echo " label=${x}" >> ${iacfg}
+ echo ' append="'initrd=${x}.igz ${default_append_line}'"' >> ${iacfg}
+ echo " initrd=/efi/boot/${x}.igz" >> ${iacfg}
+ echo >> ${iacfg}
+ echo "image=/efi/boot/${x}" >> ${iacfg}
+ echo >> ${iacfg}
+ cp -f $1/boot/${x}{,.igz} $1/boot/efi/boot > /dev/null
+ cp -f $1/isolinux/${x}{,.igz} $1/boot/efi/boot > /dev/null
+ done
+ cp ${iacfg} $1/boot/efi/boot
fi
if [ -e $1/boot/grub/stage2_eltorito ]
then
- icfg=$1/boot/grub/grub.conf
- echo "default 1" > ${icfg}
- echo "timeout 150" >> ${icfg}
+ icfg=$1/boot/grub/menu.lst
+ echo "default 0" > ${icfg}
+ echo "timeout 15" >> ${icfg}
+ echo "pager on" >> ${icfg}
- # Setup help message
- echo >> ${icfg}
- echo "title help" >> ${icfg}
- cp ${clst_sharedir}/livecd/files/README.txt \
- $1/boot/help.msg
- echo "cat /boot/help.msg" >> ${icfg}
+ # Copy our splash if we're a Gentoo release
+ case ${clst_livecd_type} in
+ gentoo-*)
+ [ -e ${clst_chroot_path}/boot/grub/splash.xpm.gz ] && \
+ cp -f ${clst_chroot_path}/boot/grub/splash.xpm.gz \
+ ${1}/boot/grub
+ ;;
+ esac
+
+ if [ -e ${1}/boot/grub/splash.xpm.gz ]; then
+ echo "splashimage=/boot/grub/splash.xpm.gz" >> ${icfg}
+ fi
for x in ${clst_boot_kernel}
do
eval custom_kopts=\$${x}_kernelopts
echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
echo >> ${icfg}
- echo "title ${x}" >> ${icfg}
-
- if [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
+
+ eval "clst_kernel_softlevel=\$clst_boot_kernel_${x}_softlevel"
+
+ if [ -n "${clst_kernel_softlevel}" ]
then
- echo "kernel /boot/${x} ${default_append_line} vga=791 splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet" >> ${icfg}
+ for y in ${clst_kernel_softlevel}
+ do
+ echo "title ${x}-${y}" >> ${icfg}
+ echo " append ${default_append_line} softlevel=${y} initrd=${x}.igz vga=791" >> ${icfg}
+ if [ -e $1/boot/${x}.igz ]
+ then
+ echo "initrd /boot/${x}.igz" >> ${icfg}
+ fi
+ echo >> ${icfg}
+ echo "title ${x}-${y} [ No FrameBuffer ]" >> ${icfg}
+ echo "kernel /boot/${x} softlevel=${y} ${default_append_line}" >> ${icfg}
+ if [ -e $1/boot/${x}.igz ]
+ then
+ echo "initrd /boot/${x}.igz" >> ${icfg}
+ fi
+ echo >> ${icfg}
+ done
else
- echo "kernel /boot/${x} ${default_append_line} vga=791 splash=silent" >> ${icfg}
+ echo "title ${x}" >> ${icfg}
+ echo "kernel /boot/${x} ${default_append_line} vga=791" >> ${icfg}
+ if [ -e $1/boot/${x}.igz ]
+ then
+ echo "initrd /boot/${x}.igz" >> ${icfg}
+ fi
+ echo >> ${icfg}
+ echo "title ${x} [ No FrameBuffer ]" >> ${icfg}
+ echo "kernel /boot/${x} ${default_append_line}" >> ${icfg}
+ if [ -e $1/boot/${x}.igz ]
+ then
+ echo "initrd /boot/${x}.igz" >> ${icfg}
+ fi
fi
- if [ -e $1/boot/${x}.igz ]
- then
- echo "initrd /boot/${x}.igz" >> ${icfg}
- fi
-
- echo >> ${icfg}
- echo "title ${x} [ No FrameBuffer ]" >> ${icfg}
- echo "kernel ${x} /boot/${x} ${default_append_line}" >> ${icfg}
- if [ -e $1/boot/${x}.igz ]
- then
- echo "initrd /boot/${x}.igz" >> ${icfg}
- fi
done
+ # Setup help message
+ echo >> ${icfg}
+ echo "title help" >> ${icfg}
+ cp ${clst_sharedir}/livecd/files/README.txt \
+ $1/boot/help.msg
+ echo "cat /boot/help.msg" >> ${icfg}
+
if [ -f $1/boot/memtest86 ]
then
echo >> ${icfg}
echo "kernel /boot/memtest86" >> ${icfg}
fi
fi
- ;;
+ ;;
mips)
+ # NO SOFTLEVEL SUPPORT YET
+
# Mips is an interesting arch -- where most archs will
# use ${1} as the root of the LiveCD, an SGI LiveCD lacks
# such a root. Instead, we will use ${1} as a scratch
# CD image, and then pass these components to the
# `sgibootcd` tool which outputs a final CD image
scratch="${1}"
- mkdir ${scratch}/kernels
- mkdir ${scratch}/kernels/misc
- mkdir ${scratch}/arcload
+ [ ! -d "${scratch}/kernels" ] && mkdir ${scratch}/kernels
+ [ ! -d "${scratch}/kernels/misc" ] && mkdir ${scratch}/kernels/misc
+ [ ! -d "${scratch}/arcload" ] && mkdir ${scratch}/arcload
echo "" > ${scratch}/arc.cf
# Move kernel binaries to ${scratch}/kernels, and
# move everything else to ${scratch}/kernels/misc
for x in ${clst_boot_kernel}; do
- mv ${1}/boot/${x} ${scratch}/kernels
- mv ${1}/boot/${x}.igz ${scratch}/kernels/misc
+ [ -e "${1}/boot/${x}" ] && mv ${1}/boot/${x} ${scratch}/kernels
+ [ -e "${1}/boot/${x}.igz" ] && mv ${1}/boot/${x}.igz ${scratch}/kernels/misc
done
- rmdir ${1}/boot
+ [ -d "${1}/boot" ] && rmdir ${1}/boot
- # Source the bashified arcload config
+ # Source the arcload source file to generated required sections of arc.cf
source ${clst_sharedir}/targets/support/mips-arcload_conf.sh
# Generate top portions of the config
echo -e "${cmt2}" >> ${scratch}/arc.cf
# Move the bootloader binaries & config to their destination
- mv ${1}/sashARCS ${1}/sash64 ${1}/arc.cf ${scratch}/arcload
+ [ -e "${1}/sashARCS" ] && mv ${1}/sashARCS ${scratch}/arcload
+ [ -e "${1}/sash64" ] && mv ${1}/sash64 ${scratch}/arcload
+ [ -e "${1}/arc.cf" ] && mv ${1}/arc.cf ${scratch}/arcload
;;
esac
exit $?