2 # Copyright 1999-2005 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License v2
4 # $Header: /var/cvsroot/gentoo/src/catalyst/targets/support/bootloader-setup.sh,v 1.19 2005/11/21 17:14:32 rocket Exp $
5 . ${clst_sharedir}/targets/support/functions.sh
6 . ${clst_sharedir}/targets/support/filesystem-functions.sh
8 # $1 is the destination root
11 extract_kernels $1/boot
16 default_append_line="root=/dev/ram0 init=/linuxrc ${cmdline_opts} ${custom_kopts} cdroot"
18 case ${clst_mainarch} in
20 acfg=$1/etc/aboot.conf
22 for x in ${clst_boot_kernel}
24 echo -n "${bctr}:/boot/${x} " >> ${acfg}
25 echo -n "initrd=/boot/${x}.igz root=/dev/ram0 " >> ${acfg}
26 echo "init=/linuxrc ${cmdline_opts} cdroot" >> ${acfg}
34 icfg=$1/boot/palo.conf
35 kmsg=$1/boot/kernels.msg
37 echo "--commandline=0/${first} initrd=${first}.igz root=/dev/ram0 init=/linuxrc ${cmdline_opts}" >> ${icfg}
38 echo "--bootloader=boot/iplboot" >> ${icfg}
39 echo "--ramdisk=boot/${first}.igz" >> ${icfg}
44 # The specs indicate the kernels to be build. We need to put
45 # those kernels and the corresponding initrd.img.gz(s) in the
46 # /boot directory. This directory contains a message boot.msg
47 # containing some info to be displayed on boot, a configuration
48 # (yaboot.conf) specifying the boot options (kernel/initrd
49 # combinations). The boot directory also contains a file called
50 # yaboot, which normally gets copied from the live environment.
51 # For now we supply a prebuilt file, prebuilt configuration
52 # and prebuilt boot message. This can be enhanced later on
53 # but the following suffices for now:
55 # this sets up the config file for yaboot
56 icfg=$1/boot/yaboot.conf
58 echo "default ${first}" > ${icfg}
59 echo "timeout 300" >> ${icfg}
60 echo "device=cd:" >> ${icfg}
61 echo "root=/dev/ram" >> ${icfg}
62 echo "fgcolor=white" >> ${icfg}
63 echo "bgcolor=black" >> ${icfg}
64 echo "message=/boot/boot.msg" >> ${icfg}
65 for x in ${clst_boot_kernel}
67 eval custom_kopts=\$${x}_kernelopts
68 echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
70 echo "image=/boot/${x}" >> ${icfg}
72 if [ -e "/boot/${x}.igz" ]
74 echo "initrd=/boot/${x}.igz" >> ${icfg}
77 echo "label=${x}" >> ${icfg}
78 echo "read-write" >> ${icfg}
79 if [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
81 echo "append=\"${default_append_line} splash=silent,theme:${clst_livecd_splash_theme}\"" >> ${icfg}
83 echo "append=\"${default_append_line} splash=silent\"" >> ${icfg}
88 scfg=$1/boot/silo.conf
89 echo "default=\"help\"" > ${scfg}
90 echo "message=\"/boot/boot.msg\"" >> ${scfg}
92 for x in ${clst_boot_kernel}
95 echo "image=\"/boot/${x}\"" >> ${scfg}
96 echo -e "\tlabel=\"${x}\"" >> ${scfg}
97 echo -e "\tappend=\"initrd=/boot/${x}.igz root=/dev/ram0 init=/linuxrc ${cmdline_opts} cdroot\"" >> ${scfg}
101 echo "image=\"cat /boot/silo.conf\"" >> ${scfg}
102 echo -e "label=\"config\"" >> ${scfg}
103 echo "image=\"cat /boot/video.msg\"" >> ${scfg}
104 echo -e "label=\"video\"" >> ${scfg}
105 echo "image=\"cat /boot/help.msg\"" >> ${scfg}
106 echo -e "label=\"help\"" >> ${scfg}
109 iacfg=$1/boot/elilo.conf
110 echo 'prompt' > ${iacfg}
111 echo 'message=/efi/boot/elilo.msg' >> ${iacfg}
112 echo 'chooser=simple' >> ${iacfg}
113 echo 'timeout=50' >> ${iacfg}
115 for x in ${clst_boot_kernel}
117 echo "image=/efi/boot/${x}" >> ${iacfg}
118 echo " label=${x}" >> ${iacfg}
119 echo ' append="'initrd=${x}.igz ${default_append_line}'"' >> ${iacfg}
120 echo " initrd=/efi/boot/${x}.igz" >> ${iacfg}
122 echo "image=/efi/boot/${x}" >> ${iacfg}
123 echo " label=${x}-serial">> ${iacfg}
124 echo ' append="'initrd=${x}.igz ${default_append_line}' console=tty0 console=ttyS0,9600"' >> ${iacfg}
125 echo " initrd=/efi/boot/${x}.igz" >> ${iacfg}
128 cp ${iacfg} $1/boot/efi/boot
129 mv $1/boot/${x}{,.igz} $1/boot/efi/boot
132 if [ -e $1/isolinux/isolinux.bin ]
134 mv $1/boot/* $1/isolinux
136 # the rest of this function sets up the config file for isolinux
137 icfg=$1/isolinux/isolinux.cfg
138 kmsg=$1/isolinux/kernels.msg
139 echo "default ${first}" > ${icfg}
140 echo "timeout 150" >> ${icfg}
141 echo "prompt 1" >> ${icfg}
142 echo "display boot.msg" >> ${icfg}
143 echo "F1 kernels.msg" >> ${icfg}
144 echo "F2 F2.msg" >> ${icfg}
145 echo "F3 F3.msg" >> ${icfg}
146 echo "F4 F4.msg" >> ${icfg}
147 echo "F5 F5.msg" >> ${icfg}
148 echo "F6 F6.msg" >> ${icfg}
149 echo "F7 F7.msg" >> ${icfg}
151 echo "Available kernels:" > ${kmsg}
154 cp ${clst_sharedir}/livecd/files/x86-F$i.msg \
158 for x in ${clst_boot_kernel}
161 eval custom_kopts=\$${x}_kernelopts
162 echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
164 echo "label ${x}" >> ${icfg}
165 echo " kernel ${x}" >> ${icfg}
166 if [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
168 echo " append ${default_append_line} initrd=${x}.igz vga=791 splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet" >> ${icfg}
170 echo " append ${default_append_line} initrd=${x}.igz vga=791 splash=silent" >> ${icfg}
174 echo " ${x}" >> ${kmsg}
175 echo "label ${x}-nofb" >> ${icfg}
176 echo " kernel ${x}" >> ${icfg}
177 echo " append ${default_append_line} initrd=${x}.igz" >> ${icfg}
179 echo " ${x}-nofb" >> ${kmsg}
182 if [ -f $1/isolinux/memtest86 ]
185 echo " memtest86" >> $kmsg
186 echo "label memtest86" >> $icfg
187 echo " kernel memtest86" >> $icfg
191 if [ -e $1/boot/grub/stage2_eltorito ]
193 icfg=$1/boot/grub/grub.conf
194 echo "default 1" > ${icfg}
195 echo "timeout 150" >> ${icfg}
199 echo "title help" >> ${icfg}
200 cp ${clst_sharedir}/livecd/files/README.txt \
202 echo "cat /boot/help.msg" >> ${icfg}
204 for x in ${clst_boot_kernel}
206 eval custom_kopts=\$${x}_kernelopts
207 echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
209 echo "title ${x}" >> ${icfg}
211 if [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
213 echo "kernel /boot/${x} ${default_append_line} vga=791 splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet" >> ${icfg}
215 echo "kernel /boot/${x} ${default_append_line} vga=791 splash=silent" >> ${icfg}
218 if [ -e $1/boot/${x}.igz ]
220 echo "initrd /boot/${x}.igz" >> ${icfg}
224 echo "title ${x} [ No FrameBuffer ]" >> ${icfg}
225 echo "kernel ${x} /boot/${x} ${default_append_line}" >> ${icfg}
226 if [ -e $1/boot/${x}.igz ]
228 echo "initrd /boot/${x}.igz" >> ${icfg}
232 if [ -f $1/boot/memtest86 ]
235 echo "title memtest86" >> ${icfg}
236 echo "kernel /boot/memtest86" >> ${icfg}
241 # Mips is an interesting arch -- where most archs will
242 # use ${1} as the root of the LiveCD, an SGI LiveCD lacks
243 # such a root. Instead, we will use ${1} as a scratch
244 # directory to build the components we need for the
245 # CD image, and then pass these components to the
246 # `sgibootcd` tool which outputs a final CD image
248 mkdir ${scratch}/kernels
249 mkdir ${scratch}/kernels/misc
250 mkdir ${scratch}/arcload
251 echo "" > ${scratch}/arc.cf
253 # Move kernel binaries to ${scratch}/kernels, and
254 # move everything else to ${scratch}/kernels/misc
255 for x in ${clst_boot_kernel}; do
256 mv ${1}/boot/${x} ${scratch}/kernels
257 mv ${1}/boot/${x}.igz ${scratch}/kernels/misc
261 # Source the bashified arcload config
262 source ${clst_sharedir}/targets/support/mips-arcload_conf.sh
264 # Generate top portions of the config
265 echo -e "${topofconfig}${serial}${dbg}${cmt1}" >> ${scratch}/arc.cf
267 # Next, figure out what kernels were specified in the
268 # spec file, and generate the appropriate arcload conf
269 # blocks specific to each system
270 ip22="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip22" | tr "\n" " ")"
271 ip27="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip27" | tr "\n" " ")"
272 ip28="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip28" | tr "\n" " ")"
273 ip30="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip30" | tr "\n" " ")"
274 ip32="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip32" | tr "\n" " ")"
276 if [ -n "${ip22}" ]; then
277 echo -e "${ip22base}" >> ${scratch}/arc.cf
278 for x in ${ip22}; do echo -e "${!x}" >> ${scratch}/arc.cf; done
279 echo -e "${ip22vid}${ip22x}" >> ${scratch}/arc.cf
282 [ -n "${ip27}" ] && echo -e "${ip27base}" >> ${scratch}/arc.cf
283 [ -n "${ip28}" ] && echo -e "${ip28base}" >> ${scratch}/arc.cf
284 [ -n "${ip30}" ] && echo -e "${ip30base}" >> ${scratch}/arc.cf
286 if [ -n "${ip32}" ]; then
287 echo -e "${ip32base}" >> ${scratch}/arc.cf
288 for x in ${ip32}; do echo -e "${!x}" >> ${scratch}/arc.cf; done
289 echo -e "${ip32vid}${ip32x}" >> ${scratch}/arc.cf
292 # Finish off the config
293 echo -e "${cmt2}" >> ${scratch}/arc.cf
295 # Move the bootloader binaries & config to their destination
296 mv ${1}/sashARCS ${1}/sash64 ${1}/arc.cf ${scratch}/arcload