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
52 icfg=$1/boot/yaboot.conf
55 echo "default ${first}" > ${icfg}
56 echo "timeout 300" >> ${icfg}
57 echo "device=cd:" >> ${icfg}
58 echo "root=/dev/ram" >> ${icfg}
59 echo "fgcolor=white" >> ${icfg}
60 echo "bgcolor=black" >> ${icfg}
61 echo "message=/boot/boot.msg" >> ${icfg}
63 # Here is where I fix up the boot.msg file.
64 sed -e 's/ARCH/PowerPC/' \
65 -e 's/HARDWARE/32-bit Apple and Pegasos hardware/' \
68 # Here we wipe out the /ppc directory, if it exists.
71 for x in ${clst_boot_kernel}
73 eval custom_kopts=\$${x}_kernelopts
74 echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
75 echo "image=/boot/${x}" >> ${icfg}
77 if [ -e "$1/boot/${x}.igz" ]
79 echo "initrd=/boot/${x}.igz" >> ${icfg}
82 echo "label=${x}" >> ${icfg}
83 echo "read-write" >> ${icfg}
84 if [ -n "${clst_livecd_splash_theme}" ]
86 echo "append=\"${default_append_line} splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet\"" >> ${icfg}
88 echo "append=\"${default_append_line}\"" >> ${icfg}
93 # NO SOFTLEVEL SUPPORT YET
94 icfg=$1/boot/yaboot.conf
97 echo "device=cd:" >> ${icfg}
98 echo "root=/dev/ram" >> ${icfg}
99 echo "fgcolor=white" >> ${icfg}
100 echo "bgcolor=black" >> ${icfg}
101 echo "message=/boot/boot.msg" >> ${icfg}
103 # Here is where I fix up the boot.msg file.
104 sed -e 's/ARCH/PowerPC/' \
105 -e 's/HARDWARE/64-bit Apple and IBM hardware/' \
108 # Setup the IBM yaboot.conf
109 etc_icfg=$1/etc/yaboot.conf
112 echo "root=/dev/ram" >> ${etc_icfg}
113 echo "fgcolor=white" >> ${etc_icfg}
114 echo "bgcolor=black" >> ${etc_icfg}
115 echo "message=/boot/boot.msg" >> ${etc_icfg}
117 for x in ${clst_boot_kernel}
119 eval "clst_kernel_console=\$clst_boot_kernel_${x}_console"
120 eval "clst_kernel_machine_type=\$clst_boot_kernel_${x}_machine_type"
121 eval custom_kopts=\$${x}_kernelopts
123 echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
124 if [ "${clst_kernel_machine_type}" == "ibm" ]
127 if [ -n "${clst_kernel_console}" ]
130 echo "image=/boot/${x}" >> ${etc_icfg}
132 if [ -e "$1/boot/${x}.igz" ]
134 echo "initrd=/boot/${x}.igz" >> ${etc_icfg}
137 echo "label=${x}" >> ${etc_icfg}
138 echo "read-write" >> ${icfg}
139 if [ -n "${clst_livecd_splash_theme}" ]
141 echo "append=\"${default_append_line} splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet\"" >> ${etc_icfg}
143 echo "append=\"${default_append_line}\"" >> ${etc_icfg}
146 for y in ${clst_kernel_console}
150 echo "image=/boot/${x}" >> ${etc_icfg}
152 if [ -e "$1/boot/${x}.igz" ]
154 echo "initrd=/boot/${x}.igz" >> ${etc_icfg}
157 echo "label=${x}-${y} " >> ${etc_icfg}
158 echo "read-write" >> ${icfg}
159 echo "append=\"${default_append_line} console=${y}\"" >> ${etc_icfg}
163 echo "image=/boot/${x}" >> ${etc_icfg}
165 if [ -e "$1/boot/${x}.igz" ]
167 echo "initrd=/boot/${x}.igz" >> ${etc_icfg}
170 echo "label=${x}" >> ${etc_icfg}
171 echo "read-write" >> ${etc_icfg}
172 if [ -n "${clst_livecd_splash_theme}" ]
174 echo "append=\"${default_append_line} splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet\"" >> ${etc_icfg}
176 echo "append=\"${default_append_line}\"" >> ${etc_icfg}
180 if [ -n "${clst_kernel_console}" ]
183 echo "image=/boot/${x}" >> ${icfg}
185 if [ -e "$1/boot/${x}.igz" ]
187 echo "initrd=/boot/${x}.igz" >> ${icfg}
190 echo "label=${x}" >> ${icfg}
191 echo "read-write" >> ${icfg}
192 if [ -n "${clst_livecd_splash_theme}" ]
194 echo "append=\"${default_append_line} splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet\"" >> ${icfg}
196 echo "append=\"${default_append_line}\"" >> ${icfg}
199 for y in ${clst_kernel_console}
202 echo "image=/boot/${x}" >> ${icfg}
204 if [ -e "$1/boot/${x}.igz" ]
206 echo "initrd=/boot/${x}.igz" >> ${icfg}
209 echo "label=${x}-${y} " >> ${icfg}
210 echo "read-write" >> ${icfg}
211 echo "append=\"${default_append_line} console=${y}\"" >> ${icfg}
215 echo "image=/boot/${x}" >> ${icfg}
217 if [ -e "$1/boot/${x}.igz" ]
219 echo "initrd=/boot/${x}.igz" >> ${icfg}
222 echo "label=${x}" >> ${icfg}
223 echo "read-write" >> ${icfg}
224 if [ -n "${clst_livecd_splash_theme}" ]
226 echo "append=\"${default_append_line} splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet\"" >> ${icfg}
228 echo "append=\"${default_append_line}\"" >> ${icfg}
234 if [ "${IBM_YABOOT}" == "FALSE" ]
246 # NO SOFTLEVEL SUPPORT YET
247 scfg=$1/boot/silo.conf
248 echo "default=\"help\"" > ${scfg}
249 echo "message=\"/boot/boot.msg\"" >> ${scfg}
251 for x in ${clst_boot_kernel}
254 echo "image=\"/boot/${x}\"" >> ${scfg}
255 echo -e "\tlabel=\"${x}\"" >> ${scfg}
256 echo -e "\tappend=\"initrd=/boot/${x}.igz root=/dev/ram0 init=/linuxrc ${cmdline_opts} cdroot\"" >> ${scfg}
260 echo "image=\"cat /boot/silo.conf\"" >> ${scfg}
261 echo -e "label=\"config\"" >> ${scfg}
262 echo "image=\"cat /boot/video.msg\"" >> ${scfg}
263 echo -e "label=\"video\"" >> ${scfg}
264 echo "image=\"cat /boot/help.msg\"" >> ${scfg}
265 echo -e "label=\"help\"" >> ${scfg}
266 echo "image=\"cat /boot/parameters.msg\"" >> ${scfg}
267 echo -e "label=\"parameters\"" >> ${scfg}
270 # NO SOFTLEVEL SUPPORT YET
271 iacfg=$1/boot/elilo.conf
272 echo 'prompt' > ${iacfg}
273 echo 'message=/efi/boot/elilo.msg' >> ${iacfg}
274 echo 'chooser=simple' >> ${iacfg}
275 echo 'timeout=50' >> ${iacfg}
276 echo 'relocatable' >> ${iacfg}
278 for x in ${clst_boot_kernel}
280 echo "image=/efi/boot/${x}" >> ${iacfg}
281 echo " label=${x}" >> ${iacfg}
282 echo ' append="'initrd=${x}.igz ${default_append_line}'"' >> ${iacfg}
283 echo " initrd=/efi/boot/${x}.igz" >> ${iacfg}
285 echo "image=/efi/boot/${x}" >> ${iacfg}
286 echo " label=${x}-serial">> ${iacfg}
287 echo ' append="'initrd=${x}.igz ${default_append_line}' console=tty0 console=ttyS0,9600"' >> ${iacfg}
288 echo " initrd=/efi/boot/${x}.igz" >> ${iacfg}
290 echo "image=/efi/boot/${x}" >> ${iacfg}
291 echo " label=${x}-sgi">> ${iacfg}
292 echo ' append="'initrd=${x}.igz ${default_append_line}' console=tty0 console=ttySG0,115200"' >> ${iacfg}
293 echo " initrd=/efi/boot/${x}.igz" >> ${iacfg}
295 mv $1/boot/${x}{,.igz} $1/boot/efi/boot
297 cp ${iacfg} $1/boot/efi/boot
300 if [ -e $1/isolinux/isolinux.bin ]
302 cp -f $1/boot/* $1/isolinux
303 # the rest of this function sets up the config file for isolinux
304 icfg=$1/isolinux/isolinux.cfg
305 kmsg=$1/isolinux/kernels.msg
306 echo "default ${first}" > ${icfg}
307 echo "timeout 150" >> ${icfg}
308 echo "prompt 1" >> ${icfg}
309 echo "display boot.msg" >> ${icfg}
310 echo "F1 kernels.msg" >> ${icfg}
311 echo "F2 F2.msg" >> ${icfg}
312 echo "F3 F3.msg" >> ${icfg}
313 echo "F4 F4.msg" >> ${icfg}
314 echo "F5 F5.msg" >> ${icfg}
315 echo "F6 F6.msg" >> ${icfg}
316 echo "F7 F7.msg" >> ${icfg}
318 echo "Available kernels:" > ${kmsg}
321 cp ${clst_sharedir}/livecd/files/x86-F$i.msg \
325 for x in ${clst_boot_kernel}
327 eval custom_kopts=\$${x}_kernelopts
328 echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
331 eval "clst_kernel_softlevel=\$clst_boot_kernel_${x}_softlevel"
333 if [ -n "${clst_kernel_softlevel}" ]
335 for y in ${clst_kernel_softlevel}
337 echo "label ${x}-${y}" >> ${icfg}
338 echo " kernel ${x}" >> ${icfg}
339 if [ -n "${clst_livecd_splash_theme}" ]
341 echo " append ${default_append_line} softlevel=${y} initrd=${x}.igz vga=791 splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet" >> ${icfg}
343 echo " append ${default_append_line} softlevel=${y} initrd=${x}.igz vga=791" >> ${icfg}
347 echo " ${x}" >> ${kmsg}
348 echo "label ${x}-${y}-nofb" >> ${icfg}
349 echo " kernel ${x}" >> ${icfg}
350 echo " append ${default_append_line} softlevel=${y} initrd=${x}.igz" >> ${icfg}
352 echo " ${x}-nofb" >> ${kmsg}
355 echo "label ${x}" >> ${icfg}
356 echo " kernel ${x}" >> ${icfg}
357 if [ -n "${clst_livecd_splash_theme}" ]
359 echo " append ${default_append_line} initrd=${x}.igz vga=791 splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet" >> ${icfg}
361 echo " append ${default_append_line} initrd=${x}.igz vga=791" >> ${icfg}
364 echo " ${x}" >> ${kmsg}
365 echo "label ${x}-nofb" >> ${icfg}
366 echo " kernel ${x}" >> ${icfg}
367 echo " append ${default_append_line} initrd=${x}.igz" >> ${icfg}
369 echo " ${x}-nofb" >> ${kmsg}
373 if [ -f $1/isolinux/memtest86 ]
376 echo " memtest86" >> $kmsg
377 echo "label memtest86" >> $icfg
378 echo " kernel memtest86" >> $icfg
382 if [ -e $1/boot/efi/elilo.efi ]
384 [ -e $1/isolinux/elilo.efi ] && rm -f $1/isolinux/elilo.efi
385 iacfg=$1/boot/elilo.conf
386 echo 'prompt' > ${iacfg}
387 echo 'message=/efi/boot/elilo.msg' >> ${iacfg}
388 echo 'chooser=simple' >> ${iacfg}
389 echo 'timeout=50' >> ${iacfg}
391 for x in ${clst_boot_kernel}
393 echo "image=/efi/boot/${x}" >> ${iacfg}
394 echo " label=${x}" >> ${iacfg}
395 echo ' append="'initrd=${x}.igz ${default_append_line}'"' >> ${iacfg}
396 echo " initrd=/efi/boot/${x}.igz" >> ${iacfg}
398 echo "image=/efi/boot/${x}" >> ${iacfg}
400 cp -f $1/boot/${x}{,.igz} $1/boot/efi/boot > /dev/null
401 cp -f $1/isolinux/${x}{,.igz} $1/boot/efi/boot > /dev/null
403 cp ${iacfg} $1/boot/efi/boot
406 if [ -e $1/boot/grub/stage2_eltorito ]
408 icfg=$1/boot/grub/grub.conf
409 # echo "default 1" > ${icfg}
410 echo "timeout 15" >> ${icfg}
411 echo "pager on" >> ${icfg}
413 # Copy our splash if we're a Gentoo release
414 case ${clst_livecd_type} in
416 [ -e ${clst_chroot_path}/boot/grub/splash.xpm.gz ] && \
417 cp -f ${clst_chroot_path}/boot/grub/splash.xpm.gz \
422 if [ -e ${1}/boot/grub/splash.xpm.gz ]; then
423 echo "splashimage=/boot/grub/splash.xpm.gz" >> ${icfg}
426 for x in ${clst_boot_kernel}
428 eval custom_kopts=\$${x}_kernelopts
429 echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
432 eval "clst_kernel_softlevel=\$clst_boot_kernel_${x}_softlevel"
434 if [ -n "${clst_kernel_softlevel}" ]
436 for y in ${clst_kernel_softlevel}
438 echo "title ${x}-${y}" >> ${icfg}
439 if [ -n "${clst_livecd_splash_theme}" ]
441 echo "kernel /boot/${x} softlevel=${y} ${default_append_line} vga=791 splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet" >> ${icfg}
443 echo " append ${default_append_line} softlevel=${y} initrd=${x}.igz vga=791" >> ${icfg}
445 if [ -e $1/boot/${x}.igz ]
447 echo "initrd /boot/${x}.igz" >> ${icfg}
450 echo "title ${x}-${y} [ No FrameBuffer ]" >> ${icfg}
451 echo "kernel /boot/${x} softlevel=${y} ${default_append_line}" >> ${icfg}
452 if [ -e $1/boot/${x}.igz ]
454 echo "initrd /boot/${x}.igz" >> ${icfg}
459 echo "title ${x}" >> ${icfg}
460 if [ -n "${clst_livecd_splash_theme}" ]
462 echo "kernel /boot/${x} ${default_append_line} vga=791 splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet" >> ${icfg}
464 echo "kernel /boot/${x} ${default_append_line} vga=791" >> ${icfg}
466 if [ -e $1/boot/${x}.igz ]
468 echo "initrd /boot/${x}.igz" >> ${icfg}
471 echo "title ${x} [ No FrameBuffer ]" >> ${icfg}
472 echo "kernel /boot/${x} ${default_append_line}" >> ${icfg}
473 if [ -e $1/boot/${x}.igz ]
475 echo "initrd /boot/${x}.igz" >> ${icfg}
483 echo "title help" >> ${icfg}
484 cp ${clst_sharedir}/livecd/files/README.txt \
486 echo "cat /boot/help.msg" >> ${icfg}
488 if [ -f $1/boot/memtest86 ]
491 echo "title memtest86" >> ${icfg}
492 echo "kernel /boot/memtest86" >> ${icfg}
497 # NO SOFTLEVEL SUPPORT YET
499 # Mips is an interesting arch -- where most archs will
500 # use ${1} as the root of the LiveCD, an SGI LiveCD lacks
501 # such a root. Instead, we will use ${1} as a scratch
502 # directory to build the components we need for the
503 # CD image, and then pass these components to the
504 # `sgibootcd` tool which outputs a final CD image
506 [ ! -d "${scratch}/kernels" ] && mkdir ${scratch}/kernels
507 [ ! -d "${scratch}/kernels/misc" ] && mkdir ${scratch}/kernels/misc
508 [ ! -d "${scratch}/arcload" ] && mkdir ${scratch}/arcload
509 echo "" > ${scratch}/arc.cf
511 # Move kernel binaries to ${scratch}/kernels, and
512 # move everything else to ${scratch}/kernels/misc
513 for x in ${clst_boot_kernel}; do
514 [ -e "${1}/boot/${x}" ] && mv ${1}/boot/${x} ${scratch}/kernels
515 [ -e "${1}/boot/${x}.igz" ] && mv ${1}/boot/${x}.igz ${scratch}/kernels/misc
517 [ -d "${1}/boot" ] && rmdir ${1}/boot
519 # Source the arcload source file to generated required sections of arc.cf
520 source ${clst_sharedir}/targets/support/mips-arcload_conf.sh
522 # Generate top portions of the config
523 echo -e "${topofconfig}${serial}${dbg}${cmt1}" >> ${scratch}/arc.cf
525 # Next, figure out what kernels were specified in the
526 # spec file, and generate the appropriate arcload conf
527 # blocks specific to each system
528 ip22="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip22" | tr "\n" " ")"
529 ip27="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip27" | tr "\n" " ")"
530 ip28="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip28" | tr "\n" " ")"
531 ip30="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip30" | tr "\n" " ")"
532 ip32="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip32" | tr "\n" " ")"
534 if [ -n "${ip22}" ]; then
535 echo -e "${ip22base}" >> ${scratch}/arc.cf
536 for x in ${ip22}; do echo -e "${!x}" >> ${scratch}/arc.cf; done
537 echo -e "${ip22vid}${ip22x}" >> ${scratch}/arc.cf
540 [ -n "${ip27}" ] && echo -e "${ip27base}" >> ${scratch}/arc.cf
541 [ -n "${ip28}" ] && echo -e "${ip28base}" >> ${scratch}/arc.cf
542 [ -n "${ip30}" ] && echo -e "${ip30base}" >> ${scratch}/arc.cf
544 if [ -n "${ip32}" ]; then
545 echo -e "${ip32base}" >> ${scratch}/arc.cf
546 for x in ${ip32}; do echo -e "${!x}" >> ${scratch}/arc.cf; done
547 echo -e "${ip32vid}${ip32x}" >> ${scratch}/arc.cf
550 # Finish off the config
551 echo -e "${cmt2}" >> ${scratch}/arc.cf
553 # Move the bootloader binaries & config to their destination
554 [ -e "${1}/sashARCS" ] && mv ${1}/sashARCS ${scratch}/arcload
555 [ -e "${1}/sash64" ] && mv ${1}/sash64 ${scratch}/arcload
556 [ -e "${1}/arc.cf" ] && mv ${1}/arc.cf ${scratch}/arcload