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.25 2006/01/25 16:07:35 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 # NO SOFTLEVEL SUPPORT YET
21 acfg=$1/etc/aboot.conf
23 for x in ${clst_boot_kernel}
25 echo -n "${bctr}:/boot/${x} " >> ${acfg}
26 echo -n "initrd=/boot/${x}.igz root=/dev/ram0 " >> ${acfg}
27 echo "init=/linuxrc ${cmdline_opts} cdroot" >> ${acfg}
32 # NO SOFTLEVEL SUPPORT YET
35 # NO SOFTLEVEL SUPPORT YET
36 icfg=$1/boot/palo.conf
37 kmsg=$1/boot/kernels.msg
39 echo "--commandline=0/${first} initrd=${first}.igz root=/dev/ram0 init=/linuxrc ${cmdline_opts}" >> ${icfg}
40 echo "--bootloader=boot/iplboot" >> ${icfg}
41 echo "--ramdisk=boot/${first}.igz" >> ${icfg}
44 # NO SOFTLEVEL SUPPORT YET
48 # The specs indicate the kernels to be build. We need to put
49 # those kernels and the corresponding initrd.img.gz(s) in the
50 # /boot directory. This directory contains a message boot.msg
51 # containing some info to be displayed on boot, a configuration
52 # (yaboot.conf) specifying the boot options (kernel/initrd
53 # combinations). The boot directory also contains a file called
54 # yaboot, which normally gets copied from the live environment.
55 # For now we supply a prebuilt file, prebuilt configuration
56 # and prebuilt boot message. This can be enhanced later on
57 # but the following suffices for now:
59 # this sets up the config file for yaboot
62 # ADD RUNLEVEL SUPPORT ???
64 icfg=$1/boot/yaboot.conf
66 echo "default ${first}" > ${icfg}
67 echo "timeout 300" >> ${icfg}
68 echo "device=cd:" >> ${icfg}
69 echo "root=/dev/ram" >> ${icfg}
70 echo "fgcolor=white" >> ${icfg}
71 echo "bgcolor=black" >> ${icfg}
72 echo "message=/boot/boot.msg" >> ${icfg}
73 for x in ${clst_boot_kernel}
75 eval custom_kopts=\$${x}_kernelopts
76 echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
78 echo "image=/boot/${x}" >> ${icfg}
80 if [ -e "$1/boot/${x}.igz" ]
82 echo "initrd=/boot/${x}.igz" >> ${icfg}
85 echo "label=${x}" >> ${icfg}
86 echo "read-write" >> ${icfg}
87 if [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
89 echo "append=\"${default_append_line} splash=silent,theme:${clst_livecd_splash_theme}\"" >> ${icfg}
91 echo "append=\"${default_append_line} splash=silent\"" >> ${icfg}
96 # NO SOFTLEVEL SUPPORT YET
98 scfg=$1/boot/silo.conf
99 echo "default=\"help\"" > ${scfg}
100 echo "message=\"/boot/boot.msg\"" >> ${scfg}
102 for x in ${clst_boot_kernel}
105 echo "image=\"/boot/${x}\"" >> ${scfg}
106 echo -e "\tlabel=\"${x}\"" >> ${scfg}
107 echo -e "\tappend=\"initrd=/boot/${x}.igz root=/dev/ram0 init=/linuxrc ${cmdline_opts} cdroot\"" >> ${scfg}
111 echo "image=\"cat /boot/silo.conf\"" >> ${scfg}
112 echo -e "label=\"config\"" >> ${scfg}
113 echo "image=\"cat /boot/video.msg\"" >> ${scfg}
114 echo -e "label=\"video\"" >> ${scfg}
115 echo "image=\"cat /boot/help.msg\"" >> ${scfg}
116 echo -e "label=\"help\"" >> ${scfg}
119 # NO SOFTLEVEL SUPPORT YET
121 iacfg=$1/boot/elilo.conf
122 echo 'prompt' > ${iacfg}
123 echo 'message=/efi/boot/elilo.msg' >> ${iacfg}
124 echo 'chooser=simple' >> ${iacfg}
125 echo 'timeout=50' >> ${iacfg}
127 for x in ${clst_boot_kernel}
129 echo "image=/efi/boot/${x}" >> ${iacfg}
130 echo " label=${x}" >> ${iacfg}
131 echo ' append="'initrd=${x}.igz ${default_append_line}'"' >> ${iacfg}
132 echo " initrd=/efi/boot/${x}.igz" >> ${iacfg}
134 echo "image=/efi/boot/${x}" >> ${iacfg}
135 echo " label=${x}-serial">> ${iacfg}
136 echo ' append="'initrd=${x}.igz ${default_append_line}' console=tty0 console=ttyS0,9600"' >> ${iacfg}
137 echo " initrd=/efi/boot/${x}.igz" >> ${iacfg}
140 cp ${iacfg} $1/boot/efi/boot
141 mv $1/boot/${x}{,.igz} $1/boot/efi/boot
144 if [ -e $1/isolinux/isolinux.bin ]
146 mv $1/boot/* $1/isolinux
148 # the rest of this function sets up the config file for isolinux
149 icfg=$1/isolinux/isolinux.cfg
150 kmsg=$1/isolinux/kernels.msg
151 echo "default ${first}" > ${icfg}
152 echo "timeout 150" >> ${icfg}
153 echo "prompt 1" >> ${icfg}
154 echo "display boot.msg" >> ${icfg}
155 echo "F1 kernels.msg" >> ${icfg}
156 echo "F2 F2.msg" >> ${icfg}
157 echo "F3 F3.msg" >> ${icfg}
158 echo "F4 F4.msg" >> ${icfg}
159 echo "F5 F5.msg" >> ${icfg}
160 echo "F6 F6.msg" >> ${icfg}
161 echo "F7 F7.msg" >> ${icfg}
163 echo "Available kernels:" > ${kmsg}
166 cp ${clst_sharedir}/livecd/files/x86-F$i.msg \
170 for x in ${clst_boot_kernel}
172 eval custom_kopts=\$${x}_kernelopts
173 echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
176 eval "clst_kernel_softlevel=\$clst_boot_kernel_${x}_softlevel"
178 if [ -n "${clst_kernel_softlevel}" ]
180 for y in ${clst_kernel_softlevel}
182 echo "label ${x}-${y}" >> ${icfg}
183 echo " kernel ${x}" >> ${icfg}
184 if [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
186 echo " append ${default_append_line} softlevel=${y} initrd=${x}.igz vga=791 splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet" >> ${icfg}
188 echo " append ${default_append_line} softlevel=${y} initrd=${x}.igz vga=791 splash=silent" >> ${icfg}
192 echo " ${x}" >> ${kmsg}
193 echo "label ${x}-${y}-nofb" >> ${icfg}
194 echo " kernel ${x}" >> ${icfg}
195 echo " append ${default_append_line} softlevel=${y} initrd=${x}.igz" >> ${icfg}
197 echo " ${x}-nofb" >> ${kmsg}
200 echo "label ${x}" >> ${icfg}
201 echo " kernel ${x}" >> ${icfg}
202 if [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
204 echo " append ${default_append_line} initrd=${x}.igz vga=791 splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet" >> ${icfg}
206 echo " append ${default_append_line} initrd=${x}.igz vga=791 splash=silent" >> ${icfg}
210 echo " ${x}" >> ${kmsg}
211 echo "label ${x}-nofb" >> ${icfg}
212 echo " kernel ${x}" >> ${icfg}
213 echo " append ${default_append_line} initrd=${x}.igz" >> ${icfg}
215 echo " ${x}-nofb" >> ${kmsg}
219 if [ -f $1/isolinux/memtest86 ]
222 echo " memtest86" >> $kmsg
223 echo "label memtest86" >> $icfg
224 echo " kernel memtest86" >> $icfg
228 if [ -e $1/boot/grub/stage2_eltorito ]
230 icfg=$1/boot/grub/grub.conf
231 echo "default 1" > ${icfg}
232 echo "timeout 150" >> ${icfg}
236 echo "title help" >> ${icfg}
237 cp ${clst_sharedir}/livecd/files/README.txt \
239 echo "cat /boot/help.msg" >> ${icfg}
241 for x in ${clst_boot_kernel}
243 eval custom_kopts=\$${x}_kernelopts
244 echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
247 eval "clst_kernel_softlevel=\$clst_boot_kernel_${x}_softlevel"
249 if [ -n "${clst_kernel_softlevel}" ]
251 for y in ${clst_kernel_softlevel}
253 echo "title ${x}-${y}" >> ${icfg}
254 if [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
256 echo "kernel /boot/${x} softlevel=${y} ${default_append_line} vga=791 splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet" >> ${icfg}
258 echo "kernel /boot/${x} softlevel=${y} ${default_append_line} vga=791 splash=silent" >> ${icfg}
260 if [ -e $1/boot/${x}.igz ]
262 echo "initrd /boot/${x}.igz" >> ${icfg}
265 echo "title ${x}-${y} [ No FrameBuffer ]" >> ${icfg}
266 echo "kernel ${x} /boot/${x} softlevel=${y} ${default_append_line}" >> ${icfg}
267 if [ -e $1/boot/${x}.igz ]
269 echo "initrd /boot/${x}.igz" >> ${icfg}
274 echo "title ${x}" >> ${icfg}
275 if [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
277 echo "kernel /boot/${x} ${default_append_line} vga=791 splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet" >> ${icfg}
279 echo "kernel /boot/${x} ${default_append_line} vga=791 splash=silent" >> ${icfg}
281 if [ -e $1/boot/${x}.igz ]
283 echo "initrd /boot/${x}.igz" >> ${icfg}
286 echo "title ${x} [ No FrameBuffer ]" >> ${icfg}
287 echo "kernel ${x} /boot/${x} ${default_append_line}" >> ${icfg}
288 if [ -e $1/boot/${x}.igz ]
290 echo "initrd /boot/${x}.igz" >> ${icfg}
296 if [ -f $1/boot/memtest86 ]
299 echo "title memtest86" >> ${icfg}
300 echo "kernel /boot/memtest86" >> ${icfg}
306 # NO SOFTLEVEL SUPPORT YET
309 # Mips is an interesting arch -- where most archs will
310 # use ${1} as the root of the LiveCD, an SGI LiveCD lacks
311 # such a root. Instead, we will use ${1} as a scratch
312 # directory to build the components we need for the
313 # CD image, and then pass these components to the
314 # `sgibootcd` tool which outputs a final CD image
316 mkdir ${scratch}/kernels
317 mkdir ${scratch}/kernels/misc
318 mkdir ${scratch}/arcload
319 echo "" > ${scratch}/arc.cf
321 # Move kernel binaries to ${scratch}/kernels, and
322 # move everything else to ${scratch}/kernels/misc
323 for x in ${clst_boot_kernel}; do
324 mv ${1}/boot/${x} ${scratch}/kernels
325 mv ${1}/boot/${x}.igz ${scratch}/kernels/misc
329 # Source the bashified arcload config
330 source ${clst_sharedir}/targets/support/mips-arcload_conf.sh
332 # Generate top portions of the config
333 echo -e "${topofconfig}${serial}${dbg}${cmt1}" >> ${scratch}/arc.cf
335 # Next, figure out what kernels were specified in the
336 # spec file, and generate the appropriate arcload conf
337 # blocks specific to each system
338 ip22="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip22" | tr "\n" " ")"
339 ip27="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip27" | tr "\n" " ")"
340 ip28="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip28" | tr "\n" " ")"
341 ip30="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip30" | tr "\n" " ")"
342 ip32="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip32" | tr "\n" " ")"
344 if [ -n "${ip22}" ]; then
345 echo -e "${ip22base}" >> ${scratch}/arc.cf
346 for x in ${ip22}; do echo -e "${!x}" >> ${scratch}/arc.cf; done
347 echo -e "${ip22vid}${ip22x}" >> ${scratch}/arc.cf
350 [ -n "${ip27}" ] && echo -e "${ip27base}" >> ${scratch}/arc.cf
351 [ -n "${ip28}" ] && echo -e "${ip28base}" >> ${scratch}/arc.cf
352 [ -n "${ip30}" ] && echo -e "${ip30base}" >> ${scratch}/arc.cf
354 if [ -n "${ip32}" ]; then
355 echo -e "${ip32base}" >> ${scratch}/arc.cf
356 for x in ${ip32}; do echo -e "${!x}" >> ${scratch}/arc.cf; done
357 echo -e "${ip32vid}${ip32x}" >> ${scratch}/arc.cf
360 # Finish off the config
361 echo -e "${cmt2}" >> ${scratch}/arc.cf
363 # Move the bootloader binaries & config to their destination
364 mv ${1}/sashARCS ${1}/sash64 ${1}/arc.cf ${scratch}/arcload