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.23 2006/01/16 15:45:03 wolf31o2 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 eval "clst_kernel_softlevel=\$clst_boot_kernel_${clst_kname}_softlevel"
18 default_append_line="root=/dev/ram0 init=/linuxrc ${cmdline_opts} ${custom_kopts} cdroot"
20 if ${clst_kernel_softlevel}
22 default_append_line="${default_append_line} softlevel=${clst_kernel_softlevel}"
25 case ${clst_mainarch} in
27 acfg=$1/etc/aboot.conf
29 for x in ${clst_boot_kernel}
31 echo -n "${bctr}:/boot/${x} " >> ${acfg}
32 echo -n "initrd=/boot/${x}.igz root=/dev/ram0 " >> ${acfg}
33 echo "init=/linuxrc ${cmdline_opts} cdroot" >> ${acfg}
40 icfg=$1/boot/palo.conf
41 kmsg=$1/boot/kernels.msg
43 echo "--commandline=0/${first} initrd=${first}.igz root=/dev/ram0 init=/linuxrc ${cmdline_opts}" >> ${icfg}
44 echo "--bootloader=boot/iplboot" >> ${icfg}
45 echo "--ramdisk=boot/${first}.igz" >> ${icfg}
50 # The specs indicate the kernels to be build. We need to put
51 # those kernels and the corresponding initrd.img.gz(s) in the
52 # /boot directory. This directory contains a message boot.msg
53 # containing some info to be displayed on boot, a configuration
54 # (yaboot.conf) specifying the boot options (kernel/initrd
55 # combinations). The boot directory also contains a file called
56 # yaboot, which normally gets copied from the live environment.
57 # For now we supply a prebuilt file, prebuilt configuration
58 # and prebuilt boot message. This can be enhanced later on
59 # but the following suffices for now:
61 # this sets up the config file for yaboot
62 icfg=$1/boot/yaboot.conf
64 echo "default ${first}" > ${icfg}
65 echo "timeout 300" >> ${icfg}
66 echo "device=cd:" >> ${icfg}
67 echo "root=/dev/ram" >> ${icfg}
68 echo "fgcolor=white" >> ${icfg}
69 echo "bgcolor=black" >> ${icfg}
70 echo "message=/boot/boot.msg" >> ${icfg}
71 for x in ${clst_boot_kernel}
73 eval custom_kopts=\$${x}_kernelopts
74 echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
76 echo "image=/boot/${x}" >> ${icfg}
78 if [ -e "$1/boot/${x}.igz" ]
80 echo "initrd=/boot/${x}.igz" >> ${icfg}
83 echo "label=${x}" >> ${icfg}
84 echo "read-write" >> ${icfg}
85 if [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
87 echo "append=\"${default_append_line} splash=silent,theme:${clst_livecd_splash_theme}\"" >> ${icfg}
89 echo "append=\"${default_append_line} splash=silent\"" >> ${icfg}
94 scfg=$1/boot/silo.conf
95 echo "default=\"help\"" > ${scfg}
96 echo "message=\"/boot/boot.msg\"" >> ${scfg}
98 for x in ${clst_boot_kernel}
101 echo "image=\"/boot/${x}\"" >> ${scfg}
102 echo -e "\tlabel=\"${x}\"" >> ${scfg}
103 echo -e "\tappend=\"initrd=/boot/${x}.igz root=/dev/ram0 init=/linuxrc ${cmdline_opts} cdroot\"" >> ${scfg}
107 echo "image=\"cat /boot/silo.conf\"" >> ${scfg}
108 echo -e "label=\"config\"" >> ${scfg}
109 echo "image=\"cat /boot/video.msg\"" >> ${scfg}
110 echo -e "label=\"video\"" >> ${scfg}
111 echo "image=\"cat /boot/help.msg\"" >> ${scfg}
112 echo -e "label=\"help\"" >> ${scfg}
115 iacfg=$1/boot/elilo.conf
116 echo 'prompt' > ${iacfg}
117 echo 'message=/efi/boot/elilo.msg' >> ${iacfg}
118 echo 'chooser=simple' >> ${iacfg}
119 echo 'timeout=50' >> ${iacfg}
121 for x in ${clst_boot_kernel}
123 echo "image=/efi/boot/${x}" >> ${iacfg}
124 echo " label=${x}" >> ${iacfg}
125 echo ' append="'initrd=${x}.igz ${default_append_line}'"' >> ${iacfg}
126 echo " initrd=/efi/boot/${x}.igz" >> ${iacfg}
128 echo "image=/efi/boot/${x}" >> ${iacfg}
129 echo " label=${x}-serial">> ${iacfg}
130 echo ' append="'initrd=${x}.igz ${default_append_line}' console=tty0 console=ttyS0,9600"' >> ${iacfg}
131 echo " initrd=/efi/boot/${x}.igz" >> ${iacfg}
134 cp ${iacfg} $1/boot/efi/boot
135 mv $1/boot/${x}{,.igz} $1/boot/efi/boot
138 if [ -e $1/isolinux/isolinux.bin ]
140 mv $1/boot/* $1/isolinux
142 # the rest of this function sets up the config file for isolinux
143 icfg=$1/isolinux/isolinux.cfg
144 kmsg=$1/isolinux/kernels.msg
145 echo "default ${first}" > ${icfg}
146 echo "timeout 150" >> ${icfg}
147 echo "prompt 1" >> ${icfg}
148 echo "display boot.msg" >> ${icfg}
149 echo "F1 kernels.msg" >> ${icfg}
150 echo "F2 F2.msg" >> ${icfg}
151 echo "F3 F3.msg" >> ${icfg}
152 echo "F4 F4.msg" >> ${icfg}
153 echo "F5 F5.msg" >> ${icfg}
154 echo "F6 F6.msg" >> ${icfg}
155 echo "F7 F7.msg" >> ${icfg}
157 echo "Available kernels:" > ${kmsg}
160 cp ${clst_sharedir}/livecd/files/x86-F$i.msg \
164 for x in ${clst_boot_kernel}
166 eval custom_kopts=\$${x}_kernelopts
167 echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
169 echo "label ${x}" >> ${icfg}
170 echo " kernel ${x}" >> ${icfg}
171 if [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
173 echo " append ${default_append_line} initrd=${x}.igz vga=791 splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet" >> ${icfg}
175 echo " append ${default_append_line} initrd=${x}.igz vga=791 splash=silent" >> ${icfg}
179 echo " ${x}" >> ${kmsg}
180 echo "label ${x}-nofb" >> ${icfg}
181 echo " kernel ${x}" >> ${icfg}
182 echo " append ${default_append_line} initrd=${x}.igz" >> ${icfg}
184 echo " ${x}-nofb" >> ${kmsg}
187 if [ -f $1/isolinux/memtest86 ]
190 echo " memtest86" >> $kmsg
191 echo "label memtest86" >> $icfg
192 echo " kernel memtest86" >> $icfg
196 if [ -e $1/boot/grub/stage2_eltorito ]
198 icfg=$1/boot/grub/grub.conf
199 echo "default 1" > ${icfg}
200 echo "timeout 150" >> ${icfg}
204 echo "title help" >> ${icfg}
205 cp ${clst_sharedir}/livecd/files/README.txt \
207 echo "cat /boot/help.msg" >> ${icfg}
209 for x in ${clst_boot_kernel}
211 eval custom_kopts=\$${x}_kernelopts
212 echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
214 echo "title ${x}" >> ${icfg}
216 if [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
218 echo "kernel /boot/${x} ${default_append_line} vga=791 splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet" >> ${icfg}
220 echo "kernel /boot/${x} ${default_append_line} vga=791 splash=silent" >> ${icfg}
223 if [ -e $1/boot/${x}.igz ]
225 echo "initrd /boot/${x}.igz" >> ${icfg}
229 echo "title ${x} [ No FrameBuffer ]" >> ${icfg}
230 echo "kernel ${x} /boot/${x} ${default_append_line}" >> ${icfg}
231 if [ -e $1/boot/${x}.igz ]
233 echo "initrd /boot/${x}.igz" >> ${icfg}
237 if [ -f $1/boot/memtest86 ]
240 echo "title memtest86" >> ${icfg}
241 echo "kernel /boot/memtest86" >> ${icfg}
246 # Mips is an interesting arch -- where most archs will
247 # use ${1} as the root of the LiveCD, an SGI LiveCD lacks
248 # such a root. Instead, we will use ${1} as a scratch
249 # directory to build the components we need for the
250 # CD image, and then pass these components to the
251 # `sgibootcd` tool which outputs a final CD image
253 mkdir ${scratch}/kernels
254 mkdir ${scratch}/kernels/misc
255 mkdir ${scratch}/arcload
256 echo "" > ${scratch}/arc.cf
258 # Move kernel binaries to ${scratch}/kernels, and
259 # move everything else to ${scratch}/kernels/misc
260 for x in ${clst_boot_kernel}; do
261 mv ${1}/boot/${x} ${scratch}/kernels
262 mv ${1}/boot/${x}.igz ${scratch}/kernels/misc
266 # Source the bashified arcload config
267 source ${clst_sharedir}/targets/support/mips-arcload_conf.sh
269 # Generate top portions of the config
270 echo -e "${topofconfig}${serial}${dbg}${cmt1}" >> ${scratch}/arc.cf
272 # Next, figure out what kernels were specified in the
273 # spec file, and generate the appropriate arcload conf
274 # blocks specific to each system
275 ip22="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip22" | tr "\n" " ")"
276 ip27="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip27" | tr "\n" " ")"
277 ip28="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip28" | tr "\n" " ")"
278 ip30="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip30" | tr "\n" " ")"
279 ip32="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip32" | tr "\n" " ")"
281 if [ -n "${ip22}" ]; then
282 echo -e "${ip22base}" >> ${scratch}/arc.cf
283 for x in ${ip22}; do echo -e "${!x}" >> ${scratch}/arc.cf; done
284 echo -e "${ip22vid}${ip22x}" >> ${scratch}/arc.cf
287 [ -n "${ip27}" ] && echo -e "${ip27base}" >> ${scratch}/arc.cf
288 [ -n "${ip28}" ] && echo -e "${ip28base}" >> ${scratch}/arc.cf
289 [ -n "${ip30}" ] && echo -e "${ip30base}" >> ${scratch}/arc.cf
291 if [ -n "${ip32}" ]; then
292 echo -e "${ip32base}" >> ${scratch}/arc.cf
293 for x in ${ip32}; do echo -e "${!x}" >> ${scratch}/arc.cf; done
294 echo -e "${ip32vid}${ip32x}" >> ${scratch}/arc.cf
297 # Finish off the config
298 echo -e "${cmt2}" >> ${scratch}/arc.cf
300 # Move the bootloader binaries & config to their destination
301 mv ${1}/sashARCS ${1}/sash64 ${1}/arc.cf ${scratch}/arcload