2 . ${clst_sharedir}/targets/support/functions.sh
3 . ${clst_sharedir}/targets/support/filesystem-functions.sh
5 # $1 is the destination root
8 extract_kernels $1/boot
12 default_append_line="root=/dev/ram0 init=/linuxrc ${cmdline_opts} ${custom_kopts} cdroot"
13 [ -n "${clst_splash_theme}" ] && default_append_line="${default_append_line} splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet"
15 case ${clst_hostarch} in
17 # NO SOFTLEVEL SUPPORT YET
18 acfg=$1/etc/aboot.conf
20 # Pass 1 is for non-serial
21 for x in ${clst_boot_kernel}
23 echo -n "${bctr}:/boot/${x} " >> ${acfg}
24 echo -n "initrd=/boot/${x}.igz root=/dev/ram0 " >> ${acfg}
25 echo "init=/linuxrc ${cmdline_opts} cdroot" >> ${acfg}
28 # Pass 2 is for serial
29 cmdline_opts="${cmdline_opts} console=ttyS0"
30 for x in ${clst_boot_kernel}
32 echo -n "${bctr}:/boot/${x} " >> ${acfg}
33 echo -n "initrd=/boot/${x}.igz root=/dev/ram0 " >> ${acfg}
34 echo "init=/linuxrc ${cmdline_opts} cdroot" >> ${acfg}
39 # NO SOFTLEVEL SUPPORT YET
42 # NO SOFTLEVEL SUPPORT YET
43 icfg=$1/boot/palo.conf
44 kmsg=$1/boot/kernels.msg
46 # Make sure we strip the extension to the kernel to allow palo to choose
47 boot_kernel_common_name=${first/%32/}
48 boot_kernel_common_name=${boot_kernel_common_name/%64/}
49 echo "--commandline=0/${boot_kernel_common_name} initrd=${first}.igz root=/dev/ram0 init=/linuxrc cdroot ${cmdline_opts}" >> ${icfg}
50 echo "--bootloader=boot/iplboot" >> ${icfg}
51 echo "--ramdisk=boot/${first}.igz" >> ${icfg}
52 for x in ${clst_boot_kernel}
54 echo "--recoverykernel=boot/${x}" >> ${icfg}
58 # NO SOFTLEVEL SUPPORT YET
59 icfg=$1/boot/yaboot.conf
62 echo "device=cd:" >> ${icfg}
63 echo "root=/dev/ram" >> ${icfg}
64 echo "fgcolor=white" >> ${icfg}
65 echo "bgcolor=black" >> ${icfg}
66 echo "message=/boot/boot.msg" >> ${icfg}
68 # Here is where I fix up the boot.msg file.
69 sed -e 's/ARCH/PowerPC/' \
70 -e 's/HARDWARE/Apple and IBM hardware/' \
73 # Setup the IBM yaboot.conf
74 etc_icfg=$1/etc/yaboot.conf
77 echo "root=/dev/ram" >> ${etc_icfg}
78 echo "fgcolor=white" >> ${etc_icfg}
79 echo "bgcolor=black" >> ${etc_icfg}
80 echo "message=/boot/boot.msg" >> ${etc_icfg}
82 for x in ${clst_boot_kernel}
84 eval "clst_kernel_console=\$clst_boot_kernel_${x}_console"
85 eval "clst_kernel_machine_type=\$clst_boot_kernel_${x}_machine_type"
86 eval custom_kopts=\$${x}_kernelopts
88 echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
89 if [ "${clst_kernel_machine_type}" == "ibm" ]
92 if [ -n "${clst_kernel_console}" ]
95 echo "image=/boot/${x}" >> ${etc_icfg}
97 if [ -e "$1/boot/${x}.igz" ]
99 echo "initrd=/boot/${x}.igz" >> ${etc_icfg}
102 echo "label=${x}" >> ${etc_icfg}
103 echo "read-write" >> ${icfg}
104 echo "append=\"${default_append_line}\"" >> ${etc_icfg}
106 for y in ${clst_kernel_console}
110 echo "image=/boot/${x}" >> ${etc_icfg}
112 if [ -e "$1/boot/${x}.igz" ]
114 echo "initrd=/boot/${x}.igz" >> ${etc_icfg}
117 echo "label=${x}-${y} " >> ${etc_icfg}
118 echo "read-write" >> ${icfg}
119 echo "append=\"${default_append_line} console=${y}\"" >> ${etc_icfg}
123 echo "image=/boot/${x}" >> ${etc_icfg}
125 if [ -e "$1/boot/${x}.igz" ]
127 echo "initrd=/boot/${x}.igz" >> ${etc_icfg}
130 echo "label=${x}" >> ${etc_icfg}
131 echo "read-write" >> ${etc_icfg}
132 echo "append=\"${default_append_line}\"" >> ${etc_icfg}
135 # Here we wipe out the /ppc directory, if it exists.
137 if [ -n "${clst_kernel_console}" ]
140 echo "image=/boot/${x}" >> ${icfg}
142 if [ -e "$1/boot/${x}.igz" ]
144 echo "initrd=/boot/${x}.igz" >> ${icfg}
147 echo "label=${x}" >> ${icfg}
148 echo "read-write" >> ${icfg}
149 echo "append=\"${default_append_line}\"" >> ${icfg}
151 for y in ${clst_kernel_console}
154 echo "image=/boot/${x}" >> ${icfg}
156 if [ -e "$1/boot/${x}.igz" ]
158 echo "initrd=/boot/${x}.igz" >> ${icfg}
161 echo "label=${x}-${y} " >> ${icfg}
162 echo "read-write" >> ${icfg}
163 echo "append=\"${default_append_line} console=${y}\"" >> ${icfg}
167 echo "image=/boot/${x}" >> ${icfg}
169 if [ -e "$1/boot/${x}.igz" ]
171 echo "initrd=/boot/${x}.igz" >> ${icfg}
174 echo "label=${x}" >> ${icfg}
175 echo "read-write" >> ${icfg}
176 echo "append=\"${default_append_line}\"" >> ${icfg}
181 if [ "${IBM_YABOOT}" == "FALSE" ]
193 # NO SOFTLEVEL SUPPORT YET
194 scfg=$1/boot/silo.conf
195 echo "default=\"help\"" > ${scfg}
196 echo "message=\"/boot/boot.msg\"" >> ${scfg}
198 for x in ${clst_boot_kernel}
201 echo "image=\"/boot/${x}\"" >> ${scfg}
202 echo -e "\tlabel=\"${x}\"" >> ${scfg}
203 echo -e "\tappend=\"initrd=/boot/${x}.igz root=/dev/ram0 init=/linuxrc ${cmdline_opts} cdroot\"" >> ${scfg}
207 echo "image=\"cat /boot/silo.conf\"" >> ${scfg}
208 echo -e "label=\"config\"" >> ${scfg}
209 echo "image=\"cat /boot/video.msg\"" >> ${scfg}
210 echo -e "label=\"video\"" >> ${scfg}
211 echo "image=\"cat /boot/help.msg\"" >> ${scfg}
212 echo -e "label=\"help\"" >> ${scfg}
213 echo "image=\"cat /boot/parameters.msg\"" >> ${scfg}
214 echo -e "label=\"parameters\"" >> ${scfg}
217 # NO SOFTLEVEL SUPPORT YET
218 iacfg=$1/boot/elilo.conf
219 echo 'prompt' > ${iacfg}
220 echo 'message=/efi/boot/elilo.msg' >> ${iacfg}
221 echo 'chooser=simple' >> ${iacfg}
222 echo 'timeout=50' >> ${iacfg}
223 echo 'relocatable' >> ${iacfg}
225 for x in ${clst_boot_kernel}
227 echo "image=/efi/boot/${x}" >> ${iacfg}
228 echo " label=${x}" >> ${iacfg}
229 echo ' append="'initrd=${x}.igz ${default_append_line}'"' >> ${iacfg}
230 echo " initrd=/efi/boot/${x}.igz" >> ${iacfg}
232 echo "image=/efi/boot/${x}" >> ${iacfg}
233 echo " label=${x}-serial">> ${iacfg}
234 echo ' append="'initrd=${x}.igz ${default_append_line}' console=tty0 console=ttyS0,9600"' >> ${iacfg}
235 echo " initrd=/efi/boot/${x}.igz" >> ${iacfg}
237 echo "image=/efi/boot/${x}" >> ${iacfg}
238 echo " label=${x}-ilo">> ${iacfg}
239 echo ' append="'initrd=${x}.igz ${default_append_line}' console=tty0 console=ttyS3,9600"' >> ${iacfg}
240 echo " initrd=/efi/boot/${x}.igz" >> ${iacfg}
242 echo "image=/efi/boot/${x}" >> ${iacfg}
243 echo " label=${x}-sgi">> ${iacfg}
244 echo ' append="'initrd=${x}.igz ${default_append_line}' console=tty0 console=ttySG0,115200"' >> ${iacfg}
245 echo " initrd=/efi/boot/${x}.igz" >> ${iacfg}
247 mv $1/boot/${x}{,.igz} $1/boot/efi/boot
249 cp ${iacfg} $1/boot/efi/boot
252 if [ -e $1/isolinux/isolinux.bin ]
254 cp -f $1/boot/* $1/isolinux
255 # the rest of this function sets up the config file for isolinux
256 icfg=$1/isolinux/isolinux.cfg
257 kmsg=$1/isolinux/kernels.msg
258 echo "default ${first}" > ${icfg}
259 echo "timeout 150" >> ${icfg}
260 echo "ontimeout localhost" >> ${icfg}
261 echo "prompt 1" >> ${icfg}
262 echo "display boot.msg" >> ${icfg}
263 echo "F1 kernels.msg" >> ${icfg}
264 echo "F2 F2.msg" >> ${icfg}
265 echo "F3 F3.msg" >> ${icfg}
266 echo "F4 F4.msg" >> ${icfg}
267 echo "F5 F5.msg" >> ${icfg}
268 echo "F6 F6.msg" >> ${icfg}
269 echo "F7 F7.msg" >> ${icfg}
271 echo "Available kernels:" > ${kmsg}
274 cp ${clst_sharedir}/livecd/files/x86-F$i.msg \
278 for x in ${clst_boot_kernel}
280 eval custom_kopts=\$${x}_kernelopts
281 echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
284 eval "clst_kernel_softlevel=\$clst_boot_kernel_${x}_softlevel"
286 if [ -n "${clst_kernel_softlevel}" ]
288 for y in ${clst_kernel_softlevel}
290 echo "label ${x}-${y}" >> ${icfg}
291 echo " kernel ${x}" >> ${icfg}
292 echo " append ${default_append_line} softlevel=${y} initrd=${x}.igz vga=791" >> ${icfg}
295 echo " ${x}" >> ${kmsg}
296 echo "label ${x}-${y}-nofb" >> ${icfg}
297 echo " kernel ${x}" >> ${icfg}
298 echo " append ${default_append_line} softlevel=${y} initrd=${x}.igz" >> ${icfg}
300 echo " ${x}-nofb" >> ${kmsg}
303 echo "label ${x}" >> ${icfg}
304 echo " kernel ${x}" >> ${icfg}
305 echo " append ${default_append_line} initrd=${x}.igz vga=791" >> ${icfg}
307 echo " ${x}" >> ${kmsg}
308 echo "label ${x}-nofb" >> ${icfg}
309 echo " kernel ${x}" >> ${icfg}
310 echo " append ${default_append_line} initrd=${x}.igz" >> ${icfg}
312 echo " ${x}-nofb" >> ${kmsg}
316 if [ -f $1/isolinux/memtest86 ]
319 echo " memtest86" >> $kmsg
320 echo "label memtest86" >> $icfg
321 echo " kernel memtest86" >> $icfg
324 echo "label localhost" >> $icfg
325 echo " localboot -1" >> $icfg
326 echo " MENU HIDE" >> $icfg
329 if [ -e $1/boot/efi/elilo.efi ]
331 [ -e $1/isolinux/elilo.efi ] && rm -f $1/isolinux/elilo.efi
332 iacfg=$1/boot/elilo.conf
333 echo 'prompt' > ${iacfg}
334 echo 'message=/efi/boot/elilo.msg' >> ${iacfg}
335 echo 'chooser=simple' >> ${iacfg}
336 echo 'timeout=50' >> ${iacfg}
338 for x in ${clst_boot_kernel}
340 echo "image=/efi/boot/${x}" >> ${iacfg}
341 echo " label=${x}" >> ${iacfg}
342 echo ' append="'initrd=${x}.igz ${default_append_line}'"' >> ${iacfg}
343 echo " initrd=/efi/boot/${x}.igz" >> ${iacfg}
345 echo "image=/efi/boot/${x}" >> ${iacfg}
347 cp -f $1/boot/${x}{,.igz} $1/boot/efi/boot > /dev/null
348 cp -f $1/isolinux/${x}{,.igz} $1/boot/efi/boot > /dev/null
350 cp ${iacfg} $1/boot/efi/boot
353 if [ -e $1/boot/grub/stage2_eltorito ]
355 icfg=$1/boot/grub/menu.lst
356 echo "default 0" > ${icfg}
357 echo "timeout 15" >> ${icfg}
358 echo "pager on" >> ${icfg}
360 # Copy our splash if we're a Gentoo release
361 case ${clst_livecd_type} in
363 [ -e ${clst_chroot_path}/boot/grub/splash.xpm.gz ] && \
364 cp -f ${clst_chroot_path}/boot/grub/splash.xpm.gz \
369 if [ -e ${1}/boot/grub/splash.xpm.gz ]; then
370 echo "splashimage=/boot/grub/splash.xpm.gz" >> ${icfg}
373 for x in ${clst_boot_kernel}
375 eval custom_kopts=\$${x}_kernelopts
376 echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
379 eval "clst_kernel_softlevel=\$clst_boot_kernel_${x}_softlevel"
381 if [ -n "${clst_kernel_softlevel}" ]
383 for y in ${clst_kernel_softlevel}
385 echo "title ${x}-${y}" >> ${icfg}
386 echo " append ${default_append_line} softlevel=${y} initrd=${x}.igz vga=791" >> ${icfg}
387 if [ -e $1/boot/${x}.igz ]
389 echo "initrd /boot/${x}.igz" >> ${icfg}
392 echo "title ${x}-${y} [ No FrameBuffer ]" >> ${icfg}
393 echo "kernel /boot/${x} softlevel=${y} ${default_append_line}" >> ${icfg}
394 if [ -e $1/boot/${x}.igz ]
396 echo "initrd /boot/${x}.igz" >> ${icfg}
401 echo "title ${x}" >> ${icfg}
402 echo "kernel /boot/${x} ${default_append_line} vga=791" >> ${icfg}
403 if [ -e $1/boot/${x}.igz ]
405 echo "initrd /boot/${x}.igz" >> ${icfg}
408 echo "title ${x} [ No FrameBuffer ]" >> ${icfg}
409 echo "kernel /boot/${x} ${default_append_line}" >> ${icfg}
410 if [ -e $1/boot/${x}.igz ]
412 echo "initrd /boot/${x}.igz" >> ${icfg}
420 echo "title help" >> ${icfg}
421 cp ${clst_sharedir}/livecd/files/README.txt \
423 echo "cat /boot/help.msg" >> ${icfg}
425 if [ -f $1/boot/memtest86 ]
428 echo "title memtest86" >> ${icfg}
429 echo "kernel /boot/memtest86" >> ${icfg}
434 # NO SOFTLEVEL SUPPORT YET
436 # Mips is an interesting arch -- where most archs will
437 # use ${1} as the root of the LiveCD, an SGI LiveCD lacks
438 # such a root. Instead, we will use ${1} as a scratch
439 # directory to build the components we need for the
440 # CD image, and then pass these components to the
441 # `sgibootcd` tool which outputs a final CD image
443 [ ! -d "${scratch}/kernels" ] && mkdir ${scratch}/kernels
444 [ ! -d "${scratch}/kernels/misc" ] && mkdir ${scratch}/kernels/misc
445 [ ! -d "${scratch}/arcload" ] && mkdir ${scratch}/arcload
446 echo "" > ${scratch}/arc.cf
448 # Move kernel binaries to ${scratch}/kernels, and
449 # move everything else to ${scratch}/kernels/misc
450 for x in ${clst_boot_kernel}; do
451 [ -e "${1}/boot/${x}" ] && mv ${1}/boot/${x} ${scratch}/kernels
452 [ -e "${1}/boot/${x}.igz" ] && mv ${1}/boot/${x}.igz ${scratch}/kernels/misc
454 [ -d "${1}/boot" ] && rmdir ${1}/boot
456 # Source the arcload source file to generated required sections of arc.cf
457 source ${clst_sharedir}/targets/support/mips-arcload_conf.sh
459 # Generate top portions of the config
460 echo -e "${topofconfig}${serial}${dbg}${cmt1}" >> ${scratch}/arc.cf
462 # Next, figure out what kernels were specified in the
463 # spec file, and generate the appropriate arcload conf
464 # blocks specific to each system
465 ip22="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip22" | tr "\n" " ")"
466 ip27="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip27" | tr "\n" " ")"
467 ip28="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip28" | tr "\n" " ")"
468 ip30="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip30" | tr "\n" " ")"
469 ip32="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip32" | tr "\n" " ")"
471 if [ -n "${ip22}" ]; then
472 echo -e "${ip22base}" >> ${scratch}/arc.cf
473 for x in ${ip22}; do echo -e "${!x}" >> ${scratch}/arc.cf; done
474 echo -e "${ip22vid}${ip22x}" >> ${scratch}/arc.cf
477 [ -n "${ip27}" ] && echo -e "${ip27base}" >> ${scratch}/arc.cf
478 [ -n "${ip28}" ] && echo -e "${ip28base}" >> ${scratch}/arc.cf
479 [ -n "${ip30}" ] && echo -e "${ip30base}" >> ${scratch}/arc.cf
481 if [ -n "${ip32}" ]; then
482 echo -e "${ip32base}" >> ${scratch}/arc.cf
483 for x in ${ip32}; do echo -e "${!x}" >> ${scratch}/arc.cf; done
484 echo -e "${ip32vid}${ip32x}" >> ${scratch}/arc.cf
487 # Finish off the config
488 echo -e "${cmt2}" >> ${scratch}/arc.cf
490 # Move the bootloader binaries & config to their destination
491 [ -e "${1}/sashARCS" ] && mv ${1}/sashARCS ${scratch}/arcload
492 [ -e "${1}/sash64" ] && mv ${1}/sash64 ${scratch}/arcload
493 [ -e "${1}/arc.cf" ] && mv ${1}/arc.cf ${scratch}/arcload