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
13 default_append_line="root=/dev/ram0 init=/linuxrc ${cmdline_opts} ${custom_kopts} cdroot"
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 echo "--commandline=0/${first} initrd=${first}.igz root=/dev/ram0 init=/linuxrc ${cmdline_opts}" >> ${icfg}
47 echo "--bootloader=boot/iplboot" >> ${icfg}
48 echo "--ramdisk=boot/${first}.igz" >> ${icfg}
51 # NO SOFTLEVEL SUPPORT YET
55 # The specs indicate the kernels to be build. We need to put
56 # those kernels and the corresponding initrd.img.gz(s) in the
57 # /boot directory. This directory contains a message boot.msg
58 # containing some info to be displayed on boot, a configuration
59 # (yaboot.conf) specifying the boot options (kernel/initrd
60 # combinations). The boot directory also contains a file called
61 # yaboot, which normally gets copied from the live environment.
62 # For now we supply a prebuilt file, prebuilt configuration
63 # and prebuilt boot message. This can be enhanced later on
64 # but the following suffices for now:
66 # this sets up the config file for yaboot
69 # ADD RUNLEVEL SUPPORT ???
71 icfg=$1/boot/yaboot.conf
74 echo "default ${first}" > ${icfg}
75 echo "timeout 300" >> ${icfg}
76 echo "device=cd:" >> ${icfg}
77 echo "root=/dev/ram" >> ${icfg}
78 echo "fgcolor=white" >> ${icfg}
79 echo "bgcolor=black" >> ${icfg}
80 echo "message=/boot/boot.msg" >> ${icfg}
82 # Here is where I fix up the boot.msg file.
83 sed -e 's/ARCH/PPC/' \
84 -e 's/HARDWARE/32-bit Apple and Pegasos hardware/' \
87 # Here we wipe out the /ppc directory, if it exists.
90 for x in ${clst_boot_kernel}
92 eval custom_kopts=\$${x}_kernelopts
93 echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
94 echo "image=/boot/${x}" >> ${icfg}
96 if [ -e "$1/boot/${x}.igz" ]
98 echo "initrd=/boot/${x}.igz" >> ${icfg}
101 echo "label=${x}" >> ${icfg}
102 echo "read-write" >> ${icfg}
103 if [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
105 echo "append=\"${default_append_line} splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet\"" >> ${icfg}
107 echo "append=\"${default_append_line}\"" >> ${icfg}
113 # NO SOFTLEVEL SUPPORT YET
117 # The specs indicate the kernels to be build. We need to put
118 # those kernels and the corresponding initrd.img.gz(s) in the
119 # /boot directory. This directory contains a message boot.msg
120 # containing some info to be displayed on boot, a configuration
121 # (yaboot.conf) specifying the boot options (kernel/initrd
122 # combinations). The boot directory also contains a file called
123 # yaboot, which normally gets copied from the live environment.
124 # For now we supply a prebuilt file, prebuilt configuration
125 # and prebuilt boot message. This can be enhanced later on
126 # but the following suffices for now:
128 # this sets up the config file for yaboot
131 # ADD RUNLEVEL SUPPORT ???
133 icfg=$1/boot/yaboot.conf
134 kmsg=$1/boot/boot.msg
136 echo "device=cd:" >> ${icfg}
137 echo "root=/dev/ram" >> ${icfg}
138 echo "fgcolor=white" >> ${icfg}
139 echo "bgcolor=black" >> ${icfg}
140 echo "message=/boot/boot.msg" >> ${icfg}
142 # Here is where I fix up the boot.msg file.
143 sed -e 's/ARCH/PPC/' \
144 -e 's/HARDWARE/64-bit Apple and IBM hardware/' \
147 # Setup the IBM yaboot.conf
148 etc_icfg=$1/etc/yaboot.conf
151 echo "root=/dev/ram" >> ${etc_icfg}
152 echo "fgcolor=white" >> ${etc_icfg}
153 echo "bgcolor=black" >> ${etc_icfg}
154 echo "message=/boot/boot.msg" >> ${etc_icfg}
156 for x in ${clst_boot_kernel}
158 eval "clst_kernel_console=\$clst_boot_kernel_${x}_console"
159 eval "clst_kernel_machine_type=\$clst_boot_kernel_${x}_machine_type"
160 eval custom_kopts=\$${x}_kernelopts
162 echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
163 if [ "${clst_kernel_machine_type}" == "ibm" ]
166 if [ -n "${clst_kernel_console}" ]
169 echo "image=/boot/${x}" >> ${etc_icfg}
171 if [ -e "$1/boot/${x}.igz" ]
173 echo "initrd=/boot/${x}.igz" >> ${etc_icfg}
176 echo "label=${x}" >> ${etc_icfg}
177 echo "read-write" >> ${icfg}
178 if [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
180 echo "append=\"${default_append_line} splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet\"" >> ${etc_icfg}
182 echo "append=\"${default_append_line}\"" >> ${etc_icfg}
185 for y in ${clst_kernel_console}
189 echo "image=/boot/${x}" >> ${etc_icfg}
191 if [ -e "$1/boot/${x}.igz" ]
193 echo "initrd=/boot/${x}.igz" >> ${etc_icfg}
196 echo "label=${x}-${y} " >> ${etc_icfg}
197 echo "read-write" >> ${icfg}
198 echo "append=\"${default_append_line} console=${y}\"" >> ${etc_icfg}
202 echo "image=/boot/${x}" >> ${etc_icfg}
204 if [ -e "$1/boot/${x}.igz" ]
206 echo "initrd=/boot/${x}.igz" >> ${etc_icfg}
209 echo "label=${x}" >> ${etc_icfg}
210 echo "read-write" >> ${etc_icfg}
211 if [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
213 echo "append=\"${default_append_line} splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet\"" >> ${etc_icfg}
215 echo "append=\"${default_append_line}\"" >> ${etc_icfg}
219 if [ -n "${clst_kernel_console}" ]
222 echo "image=/boot/${x}" >> ${icfg}
224 if [ -e "$1/boot/${x}.igz" ]
226 echo "initrd=/boot/${x}.igz" >> ${icfg}
229 echo "label=${x}" >> ${icfg}
230 echo "read-write" >> ${icfg}
231 if [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
233 echo "append=\"${default_append_line} splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet\"" >> ${icfg}
235 echo "append=\"${default_append_line}\"" >> ${icfg}
238 for y in ${clst_kernel_console}
241 echo "image=/boot/${x}" >> ${icfg}
243 if [ -e "$1/boot/${x}.igz" ]
245 echo "initrd=/boot/${x}.igz" >> ${icfg}
248 echo "label=${x}-${y} " >> ${icfg}
249 echo "read-write" >> ${icfg}
250 echo "append=\"${default_append_line} console=${y}\"" >> ${icfg}
254 echo "image=/boot/${x}" >> ${icfg}
256 if [ -e "$1/boot/${x}.igz" ]
258 echo "initrd=/boot/${x}.igz" >> ${icfg}
261 echo "label=${x}" >> ${icfg}
262 echo "read-write" >> ${icfg}
263 if [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
265 echo "append=\"${default_append_line} splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet\"" >> ${icfg}
267 echo "append=\"${default_append_line}\"" >> ${icfg}
273 if [ "${IBM_YABOOT}" == "FALSE" ]
285 # NO SOFTLEVEL SUPPORT YET
287 scfg=$1/boot/silo.conf
288 echo "default=\"help\"" > ${scfg}
289 echo "message=\"/boot/boot.msg\"" >> ${scfg}
291 for x in ${clst_boot_kernel}
294 echo "image=\"/boot/${x}\"" >> ${scfg}
295 echo -e "\tlabel=\"${x}\"" >> ${scfg}
296 echo -e "\tappend=\"initrd=/boot/${x}.igz root=/dev/ram0 init=/linuxrc ${cmdline_opts} cdroot\"" >> ${scfg}
300 echo "image=\"cat /boot/silo.conf\"" >> ${scfg}
301 echo -e "label=\"config\"" >> ${scfg}
302 echo "image=\"cat /boot/video.msg\"" >> ${scfg}
303 echo -e "label=\"video\"" >> ${scfg}
304 echo "image=\"cat /boot/help.msg\"" >> ${scfg}
305 echo -e "label=\"help\"" >> ${scfg}
306 echo "image=\"cat /boot/parameters.msg\"" >> ${scfg}
307 echo -e "label=\"parameters\"" >> ${scfg}
310 # NO SOFTLEVEL SUPPORT YET
312 iacfg=$1/boot/elilo.conf
313 echo 'prompt' > ${iacfg}
314 echo 'message=/efi/boot/elilo.msg' >> ${iacfg}
315 echo 'chooser=simple' >> ${iacfg}
316 echo 'timeout=50' >> ${iacfg}
317 echo 'relocatable' >> ${iacfg}
319 for x in ${clst_boot_kernel}
321 echo "image=/efi/boot/${x}" >> ${iacfg}
322 echo " label=${x}" >> ${iacfg}
323 echo ' append="'initrd=${x}.igz ${default_append_line}'"' >> ${iacfg}
324 echo " initrd=/efi/boot/${x}.igz" >> ${iacfg}
326 echo "image=/efi/boot/${x}" >> ${iacfg}
327 echo " label=${x}-serial">> ${iacfg}
328 echo ' append="'initrd=${x}.igz ${default_append_line}' console=tty0 console=ttyS0,9600"' >> ${iacfg}
329 echo " initrd=/efi/boot/${x}.igz" >> ${iacfg}
331 echo "image=/efi/boot/${x}" >> ${iacfg}
332 echo " label=${x}-sgi">> ${iacfg}
333 echo ' append="'initrd=${x}.igz ${default_append_line}' console=tty0 console=ttySG0,115200"' >> ${iacfg}
334 echo " initrd=/efi/boot/${x}.igz" >> ${iacfg}
336 mv $1/boot/${x}{,.igz} $1/boot/efi/boot
338 cp ${iacfg} $1/boot/efi/boot
341 if [ -e $1/isolinux/isolinux.bin ]
343 cp -f $1/boot/* $1/isolinux
344 # the rest of this function sets up the config file for isolinux
345 icfg=$1/isolinux/isolinux.cfg
346 kmsg=$1/isolinux/kernels.msg
347 echo "default ${first}" > ${icfg}
348 echo "timeout 150" >> ${icfg}
349 echo "prompt 1" >> ${icfg}
350 echo "display boot.msg" >> ${icfg}
351 echo "F1 kernels.msg" >> ${icfg}
352 echo "F2 F2.msg" >> ${icfg}
353 echo "F3 F3.msg" >> ${icfg}
354 echo "F4 F4.msg" >> ${icfg}
355 echo "F5 F5.msg" >> ${icfg}
356 echo "F6 F6.msg" >> ${icfg}
357 echo "F7 F7.msg" >> ${icfg}
359 echo "Available kernels:" > ${kmsg}
362 cp ${clst_sharedir}/livecd/files/x86-F$i.msg \
366 for x in ${clst_boot_kernel}
368 eval custom_kopts=\$${x}_kernelopts
369 echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
372 eval "clst_kernel_softlevel=\$clst_boot_kernel_${x}_softlevel"
374 if [ -n "${clst_kernel_softlevel}" ]
376 for y in ${clst_kernel_softlevel}
378 echo "label ${x}-${y}" >> ${icfg}
379 echo " kernel ${x}" >> ${icfg}
380 if [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
382 echo " append ${default_append_line} softlevel=${y} initrd=${x}.igz vga=791 splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet" >> ${icfg}
383 elif [ "${clst_livecd_splash_type}" == "bootplash" -a -n "${clst_livecd_splash_theme}" ]
385 echo " append ${default_append_line} softlevel=${y} initrd=${x}.igz vga=791 splash=silent" >> ${icfg}
387 echo " append ${default_append_line} softlevel=${y} initrd=${x}.igz vga=791" >> ${icfg}
391 echo " ${x}" >> ${kmsg}
392 echo "label ${x}-${y}-nofb" >> ${icfg}
393 echo " kernel ${x}" >> ${icfg}
394 echo " append ${default_append_line} softlevel=${y} initrd=${x}.igz" >> ${icfg}
396 echo " ${x}-nofb" >> ${kmsg}
399 echo "label ${x}" >> ${icfg}
400 echo " kernel ${x}" >> ${icfg}
401 if [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
403 echo " append ${default_append_line} initrd=${x}.igz vga=791 splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet" >> ${icfg}
404 elif [ "${clst_livecd_splash_type}" == "bootplash" -a -n "${clst_livecd_splash_theme}" ]
406 echo " append ${default_append_line} initrd=${x}.igz vga=791 splash=silent" >> ${icfg}
408 echo " append ${default_append_line} initrd=${x}.igz vga=791" >> ${icfg}
411 echo " ${x}" >> ${kmsg}
412 echo "label ${x}-nofb" >> ${icfg}
413 echo " kernel ${x}" >> ${icfg}
414 echo " append ${default_append_line} initrd=${x}.igz" >> ${icfg}
416 echo " ${x}-nofb" >> ${kmsg}
420 if [ -f $1/isolinux/memtest86 ]
423 echo " memtest86" >> $kmsg
424 echo "label memtest86" >> $icfg
425 echo " kernel memtest86" >> $icfg
429 if [ -e $1/boot/efi/elilo.efi ]
431 [ -e $1/isolinux/elilo.efi ] && rm -f $1/isolinux/elilo.efi
432 iacfg=$1/boot/elilo.conf
433 echo 'prompt' > ${iacfg}
434 echo 'message=/efi/boot/elilo.msg' >> ${iacfg}
435 echo 'chooser=simple' >> ${iacfg}
436 echo 'timeout=50' >> ${iacfg}
438 for x in ${clst_boot_kernel}
440 echo "image=/efi/boot/${x}" >> ${iacfg}
441 echo " label=${x}" >> ${iacfg}
442 echo ' append="'initrd=${x}.igz ${default_append_line}'"' >> ${iacfg}
443 echo " initrd=/efi/boot/${x}.igz" >> ${iacfg}
445 echo "image=/efi/boot/${x}" >> ${iacfg}
447 cp -f $1/boot/${x}{,.igz} $1/boot/efi/boot > /dev/null
448 cp -f $1/isolinux/${x}{,.igz} $1/boot/efi/boot > /dev/null
450 cp ${iacfg} $1/boot/efi/boot
453 if [ -e $1/boot/grub/stage2_eltorito ]
455 icfg=$1/boot/grub/grub.conf
456 echo "default 1" > ${icfg}
457 echo "timeout 150" >> ${icfg}
461 echo "title help" >> ${icfg}
462 cp ${clst_sharedir}/livecd/files/README.txt \
464 echo "cat /boot/help.msg" >> ${icfg}
466 for x in ${clst_boot_kernel}
468 eval custom_kopts=\$${x}_kernelopts
469 echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
472 eval "clst_kernel_softlevel=\$clst_boot_kernel_${x}_softlevel"
474 if [ -n "${clst_kernel_softlevel}" ]
476 for y in ${clst_kernel_softlevel}
478 echo "title ${x}-${y}" >> ${icfg}
479 if [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
481 echo "kernel /boot/${x} softlevel=${y} ${default_append_line} vga=791 splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet" >> ${icfg}
482 elif [ "${clst_livecd_splash_type}" == "bootplash" -a -n "${clst_livecd_splash_theme}" ]
484 echo " append ${default_append_line} softlevel=${y} initrd=${x}.igz vga=791 splash=silent" >> ${icfg}
486 echo " append ${default_append_line} softlevel=${y} initrd=${x}.igz vga=791" >> ${icfg}
488 if [ -e $1/boot/${x}.igz ]
490 echo "initrd /boot/${x}.igz" >> ${icfg}
493 echo "title ${x}-${y} [ No FrameBuffer ]" >> ${icfg}
494 echo "kernel /boot/${x} softlevel=${y} ${default_append_line}" >> ${icfg}
495 if [ -e $1/boot/${x}.igz ]
497 echo "initrd /boot/${x}.igz" >> ${icfg}
502 echo "title ${x}" >> ${icfg}
503 if [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
505 echo "kernel /boot/${x} ${default_append_line} vga=791 splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet" >> ${icfg}
506 elif [ "${clst_livecd_splash_type}" == "bootplash" -a -n "${clst_livecd_splash_theme}" ]
508 echo "kernel /boot/${x} ${default_append_line} vga=791 splash=silent" >> ${icfg}
510 echo "kernel /boot/${x} ${default_append_line} vga=791" >> ${icfg}
512 if [ -e $1/boot/${x}.igz ]
514 echo "initrd /boot/${x}.igz" >> ${icfg}
517 echo "title ${x} [ No FrameBuffer ]" >> ${icfg}
518 echo "kernel /boot/${x} ${default_append_line}" >> ${icfg}
519 if [ -e $1/boot/${x}.igz ]
521 echo "initrd /boot/${x}.igz" >> ${icfg}
527 if [ -f $1/boot/memtest86 ]
530 echo "title memtest86" >> ${icfg}
531 echo "kernel /boot/memtest86" >> ${icfg}
537 # NO SOFTLEVEL SUPPORT YET
540 # Mips is an interesting arch -- where most archs will
541 # use ${1} as the root of the LiveCD, an SGI LiveCD lacks
542 # such a root. Instead, we will use ${1} as a scratch
543 # directory to build the components we need for the
544 # CD image, and then pass these components to the
545 # `sgibootcd` tool which outputs a final CD image
547 [ ! -d "${scratch}/kernels" ] && mkdir ${scratch}/kernels
548 [ ! -d "${scratch}/kernels/misc" ] && mkdir ${scratch}/kernels/misc
549 [ ! -d "${scratch}/arcload" ] && mkdir ${scratch}/arcload
550 echo "" > ${scratch}/arc.cf
552 # Move kernel binaries to ${scratch}/kernels, and
553 # move everything else to ${scratch}/kernels/misc
554 for x in ${clst_boot_kernel}; do
555 [ -e "${1}/boot/${x}" ] && mv ${1}/boot/${x} ${scratch}/kernels
556 [ -e "${1}/boot/${x}.igz" ] && mv ${1}/boot/${x}.igz ${scratch}/kernels/misc
558 [ -d "${1}/boot" ] && rmdir ${1}/boot
560 # Source the arcload source file to generated required sections of arc.cf
561 source ${clst_sharedir}/targets/support/mips-arcload_conf.sh
563 # Generate top portions of the config
564 echo -e "${topofconfig}${serial}${dbg}${cmt1}" >> ${scratch}/arc.cf
566 # Next, figure out what kernels were specified in the
567 # spec file, and generate the appropriate arcload conf
568 # blocks specific to each system
569 ip22="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip22" | tr "\n" " ")"
570 ip27="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip27" | tr "\n" " ")"
571 ip28="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip28" | tr "\n" " ")"
572 ip30="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip30" | tr "\n" " ")"
573 ip32="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip32" | tr "\n" " ")"
575 if [ -n "${ip22}" ]; then
576 echo -e "${ip22base}" >> ${scratch}/arc.cf
577 for x in ${ip22}; do echo -e "${!x}" >> ${scratch}/arc.cf; done
578 echo -e "${ip22vid}${ip22x}" >> ${scratch}/arc.cf
581 [ -n "${ip27}" ] && echo -e "${ip27base}" >> ${scratch}/arc.cf
582 [ -n "${ip28}" ] && echo -e "${ip28base}" >> ${scratch}/arc.cf
583 [ -n "${ip30}" ] && echo -e "${ip30base}" >> ${scratch}/arc.cf
585 if [ -n "${ip32}" ]; then
586 echo -e "${ip32base}" >> ${scratch}/arc.cf
587 for x in ${ip32}; do echo -e "${!x}" >> ${scratch}/arc.cf; done
588 echo -e "${ip32vid}${ip32x}" >> ${scratch}/arc.cf
591 # Finish off the config
592 echo -e "${cmt2}" >> ${scratch}/arc.cf
594 # Move the bootloader binaries & config to their destination
595 [ -e "${1}/sashARCS" ] && mv ${1}/sashARCS ${scratch}/arcload
596 [ -e "${1}/sash64" ] && mv ${1}/sash64 ${scratch}/arcload
597 [ -e "${1}/arc.cf" ] && mv ${1}/arc.cf ${scratch}/arcload