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"
14 [ -n "${clst_splash_theme}" ] && default_append_line="${default_append_line} splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet"
16 case ${clst_hostarch} in
18 # NO SOFTLEVEL SUPPORT YET
19 acfg=$1/etc/aboot.conf
21 # Pass 1 is for non-serial
22 for x in ${clst_boot_kernel}
24 echo -n "${bctr}:/boot/${x} " >> ${acfg}
25 echo -n "initrd=/boot/${x}.igz root=/dev/ram0 " >> ${acfg}
26 echo "init=/linuxrc ${cmdline_opts} cdroot" >> ${acfg}
29 # Pass 2 is for serial
30 cmdline_opts="${cmdline_opts} console=ttyS0"
31 for x in ${clst_boot_kernel}
33 echo -n "${bctr}:/boot/${x} " >> ${acfg}
34 echo -n "initrd=/boot/${x}.igz root=/dev/ram0 " >> ${acfg}
35 echo "init=/linuxrc ${cmdline_opts} cdroot" >> ${acfg}
40 # NO SOFTLEVEL SUPPORT YET
43 # NO SOFTLEVEL SUPPORT YET
44 icfg=$1/boot/palo.conf
45 kmsg=$1/boot/kernels.msg
47 echo "--commandline=0/${first} initrd=${first}.igz root=/dev/ram0 init=/linuxrc ${cmdline_opts}" >> ${icfg}
48 echo "--bootloader=boot/iplboot" >> ${icfg}
49 echo "--ramdisk=boot/${first}.igz" >> ${icfg}
52 # NO SOFTLEVEL SUPPORT YET
53 icfg=$1/boot/yaboot.conf
56 echo "device=cd:" >> ${icfg}
57 echo "root=/dev/ram" >> ${icfg}
58 echo "fgcolor=white" >> ${icfg}
59 echo "bgcolor=black" >> ${icfg}
60 echo "message=/boot/boot.msg" >> ${icfg}
62 # Here is where I fix up the boot.msg file.
63 sed -e 's/ARCH/PowerPC/' \
64 -e 's/HARDWARE/Apple and IBM hardware/' \
67 # Setup the IBM yaboot.conf
68 etc_icfg=$1/etc/yaboot.conf
71 echo "root=/dev/ram" >> ${etc_icfg}
72 echo "fgcolor=white" >> ${etc_icfg}
73 echo "bgcolor=black" >> ${etc_icfg}
74 echo "message=/boot/boot.msg" >> ${etc_icfg}
76 for x in ${clst_boot_kernel}
78 eval "clst_kernel_console=\$clst_boot_kernel_${x}_console"
79 eval "clst_kernel_machine_type=\$clst_boot_kernel_${x}_machine_type"
80 eval custom_kopts=\$${x}_kernelopts
82 echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
83 if [ "${clst_kernel_machine_type}" == "ibm" ]
86 if [ -n "${clst_kernel_console}" ]
89 echo "image=/boot/${x}" >> ${etc_icfg}
91 if [ -e "$1/boot/${x}.igz" ]
93 echo "initrd=/boot/${x}.igz" >> ${etc_icfg}
96 echo "label=${x}" >> ${etc_icfg}
97 echo "read-write" >> ${icfg}
98 echo "append=\"${default_append_line}\"" >> ${etc_icfg}
100 for y in ${clst_kernel_console}
104 echo "image=/boot/${x}" >> ${etc_icfg}
106 if [ -e "$1/boot/${x}.igz" ]
108 echo "initrd=/boot/${x}.igz" >> ${etc_icfg}
111 echo "label=${x}-${y} " >> ${etc_icfg}
112 echo "read-write" >> ${icfg}
113 echo "append=\"${default_append_line} console=${y}\"" >> ${etc_icfg}
117 echo "image=/boot/${x}" >> ${etc_icfg}
119 if [ -e "$1/boot/${x}.igz" ]
121 echo "initrd=/boot/${x}.igz" >> ${etc_icfg}
124 echo "label=${x}" >> ${etc_icfg}
125 echo "read-write" >> ${etc_icfg}
126 echo "append=\"${default_append_line}\"" >> ${etc_icfg}
129 # Here we wipe out the /ppc directory, if it exists.
131 if [ -n "${clst_kernel_console}" ]
134 echo "image=/boot/${x}" >> ${icfg}
136 if [ -e "$1/boot/${x}.igz" ]
138 echo "initrd=/boot/${x}.igz" >> ${icfg}
141 echo "label=${x}" >> ${icfg}
142 echo "read-write" >> ${icfg}
143 echo "append=\"${default_append_line}\"" >> ${icfg}
145 for y in ${clst_kernel_console}
148 echo "image=/boot/${x}" >> ${icfg}
150 if [ -e "$1/boot/${x}.igz" ]
152 echo "initrd=/boot/${x}.igz" >> ${icfg}
155 echo "label=${x}-${y} " >> ${icfg}
156 echo "read-write" >> ${icfg}
157 echo "append=\"${default_append_line} console=${y}\"" >> ${icfg}
161 echo "image=/boot/${x}" >> ${icfg}
163 if [ -e "$1/boot/${x}.igz" ]
165 echo "initrd=/boot/${x}.igz" >> ${icfg}
168 echo "label=${x}" >> ${icfg}
169 echo "read-write" >> ${icfg}
170 echo "append=\"${default_append_line}\"" >> ${icfg}
175 if [ "${IBM_YABOOT}" == "FALSE" ]
187 # NO SOFTLEVEL SUPPORT YET
188 scfg=$1/boot/silo.conf
189 echo "default=\"help\"" > ${scfg}
190 echo "message=\"/boot/boot.msg\"" >> ${scfg}
192 for x in ${clst_boot_kernel}
195 echo "image=\"/boot/${x}\"" >> ${scfg}
196 echo -e "\tlabel=\"${x}\"" >> ${scfg}
197 echo -e "\tappend=\"initrd=/boot/${x}.igz root=/dev/ram0 init=/linuxrc ${cmdline_opts} cdroot\"" >> ${scfg}
201 echo "image=\"cat /boot/silo.conf\"" >> ${scfg}
202 echo -e "label=\"config\"" >> ${scfg}
203 echo "image=\"cat /boot/video.msg\"" >> ${scfg}
204 echo -e "label=\"video\"" >> ${scfg}
205 echo "image=\"cat /boot/help.msg\"" >> ${scfg}
206 echo -e "label=\"help\"" >> ${scfg}
207 echo "image=\"cat /boot/parameters.msg\"" >> ${scfg}
208 echo -e "label=\"parameters\"" >> ${scfg}
211 # NO SOFTLEVEL SUPPORT YET
212 iacfg=$1/boot/elilo.conf
213 echo 'prompt' > ${iacfg}
214 echo 'message=/efi/boot/elilo.msg' >> ${iacfg}
215 echo 'chooser=simple' >> ${iacfg}
216 echo 'timeout=50' >> ${iacfg}
217 echo 'relocatable' >> ${iacfg}
219 for x in ${clst_boot_kernel}
221 echo "image=/efi/boot/${x}" >> ${iacfg}
222 echo " label=${x}" >> ${iacfg}
223 echo ' append="'initrd=${x}.igz ${default_append_line}'"' >> ${iacfg}
224 echo " initrd=/efi/boot/${x}.igz" >> ${iacfg}
226 echo "image=/efi/boot/${x}" >> ${iacfg}
227 echo " label=${x}-serial">> ${iacfg}
228 echo ' append="'initrd=${x}.igz ${default_append_line}' console=tty0 console=ttyS0,9600"' >> ${iacfg}
229 echo " initrd=/efi/boot/${x}.igz" >> ${iacfg}
231 echo "image=/efi/boot/${x}" >> ${iacfg}
232 echo " label=${x}-sgi">> ${iacfg}
233 echo ' append="'initrd=${x}.igz ${default_append_line}' console=tty0 console=ttySG0,115200"' >> ${iacfg}
234 echo " initrd=/efi/boot/${x}.igz" >> ${iacfg}
236 mv $1/boot/${x}{,.igz} $1/boot/efi/boot
238 cp ${iacfg} $1/boot/efi/boot
241 if [ -e $1/isolinux/isolinux.bin ]
243 cp -f $1/boot/* $1/isolinux
244 # the rest of this function sets up the config file for isolinux
245 icfg=$1/isolinux/isolinux.cfg
246 kmsg=$1/isolinux/kernels.msg
247 echo "default ${first}" > ${icfg}
248 echo "timeout 150" >> ${icfg}
249 echo "prompt 1" >> ${icfg}
250 echo "display boot.msg" >> ${icfg}
251 echo "F1 kernels.msg" >> ${icfg}
252 echo "F2 F2.msg" >> ${icfg}
253 echo "F3 F3.msg" >> ${icfg}
254 echo "F4 F4.msg" >> ${icfg}
255 echo "F5 F5.msg" >> ${icfg}
256 echo "F6 F6.msg" >> ${icfg}
257 echo "F7 F7.msg" >> ${icfg}
259 echo "Available kernels:" > ${kmsg}
262 cp ${clst_sharedir}/livecd/files/x86-F$i.msg \
266 for x in ${clst_boot_kernel}
268 eval custom_kopts=\$${x}_kernelopts
269 echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
272 eval "clst_kernel_softlevel=\$clst_boot_kernel_${x}_softlevel"
274 if [ -n "${clst_kernel_softlevel}" ]
276 for y in ${clst_kernel_softlevel}
278 echo "label ${x}-${y}" >> ${icfg}
279 echo " kernel ${x}" >> ${icfg}
280 echo " append ${default_append_line} softlevel=${y} initrd=${x}.igz vga=791" >> ${icfg}
283 echo " ${x}" >> ${kmsg}
284 echo "label ${x}-${y}-nofb" >> ${icfg}
285 echo " kernel ${x}" >> ${icfg}
286 echo " append ${default_append_line} softlevel=${y} initrd=${x}.igz" >> ${icfg}
288 echo " ${x}-nofb" >> ${kmsg}
291 echo "label ${x}" >> ${icfg}
292 echo " kernel ${x}" >> ${icfg}
293 echo " append ${default_append_line} initrd=${x}.igz vga=791" >> ${icfg}
295 echo " ${x}" >> ${kmsg}
296 echo "label ${x}-nofb" >> ${icfg}
297 echo " kernel ${x}" >> ${icfg}
298 echo " append ${default_append_line} initrd=${x}.igz" >> ${icfg}
300 echo " ${x}-nofb" >> ${kmsg}
304 if [ -f $1/isolinux/memtest86 ]
307 echo " memtest86" >> $kmsg
308 echo "label memtest86" >> $icfg
309 echo " kernel memtest86" >> $icfg
313 if [ -e $1/boot/efi/elilo.efi ]
315 [ -e $1/isolinux/elilo.efi ] && rm -f $1/isolinux/elilo.efi
316 iacfg=$1/boot/elilo.conf
317 echo 'prompt' > ${iacfg}
318 echo 'message=/efi/boot/elilo.msg' >> ${iacfg}
319 echo 'chooser=simple' >> ${iacfg}
320 echo 'timeout=50' >> ${iacfg}
322 for x in ${clst_boot_kernel}
324 echo "image=/efi/boot/${x}" >> ${iacfg}
325 echo " label=${x}" >> ${iacfg}
326 echo ' append="'initrd=${x}.igz ${default_append_line}'"' >> ${iacfg}
327 echo " initrd=/efi/boot/${x}.igz" >> ${iacfg}
329 echo "image=/efi/boot/${x}" >> ${iacfg}
331 cp -f $1/boot/${x}{,.igz} $1/boot/efi/boot > /dev/null
332 cp -f $1/isolinux/${x}{,.igz} $1/boot/efi/boot > /dev/null
334 cp ${iacfg} $1/boot/efi/boot
337 if [ -e $1/boot/grub/stage2_eltorito ]
339 icfg=$1/boot/grub/menu.lst
340 echo "default 0" > ${icfg}
341 echo "timeout 15" >> ${icfg}
342 echo "pager on" >> ${icfg}
344 # Copy our splash if we're a Gentoo release
345 case ${clst_livecd_type} in
347 [ -e ${clst_chroot_path}/boot/grub/splash.xpm.gz ] && \
348 cp -f ${clst_chroot_path}/boot/grub/splash.xpm.gz \
353 if [ -e ${1}/boot/grub/splash.xpm.gz ]; then
354 echo "splashimage=/boot/grub/splash.xpm.gz" >> ${icfg}
357 for x in ${clst_boot_kernel}
359 eval custom_kopts=\$${x}_kernelopts
360 echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
363 eval "clst_kernel_softlevel=\$clst_boot_kernel_${x}_softlevel"
365 if [ -n "${clst_kernel_softlevel}" ]
367 for y in ${clst_kernel_softlevel}
369 echo "title ${x}-${y}" >> ${icfg}
370 echo " append ${default_append_line} softlevel=${y} initrd=${x}.igz vga=791" >> ${icfg}
371 if [ -e $1/boot/${x}.igz ]
373 echo "initrd /boot/${x}.igz" >> ${icfg}
376 echo "title ${x}-${y} [ No FrameBuffer ]" >> ${icfg}
377 echo "kernel /boot/${x} softlevel=${y} ${default_append_line}" >> ${icfg}
378 if [ -e $1/boot/${x}.igz ]
380 echo "initrd /boot/${x}.igz" >> ${icfg}
385 echo "title ${x}" >> ${icfg}
386 echo "kernel /boot/${x} ${default_append_line} vga=791" >> ${icfg}
387 if [ -e $1/boot/${x}.igz ]
389 echo "initrd /boot/${x}.igz" >> ${icfg}
392 echo "title ${x} [ No FrameBuffer ]" >> ${icfg}
393 echo "kernel /boot/${x} ${default_append_line}" >> ${icfg}
394 if [ -e $1/boot/${x}.igz ]
396 echo "initrd /boot/${x}.igz" >> ${icfg}
404 echo "title help" >> ${icfg}
405 cp ${clst_sharedir}/livecd/files/README.txt \
407 echo "cat /boot/help.msg" >> ${icfg}
409 if [ -f $1/boot/memtest86 ]
412 echo "title memtest86" >> ${icfg}
413 echo "kernel /boot/memtest86" >> ${icfg}
418 # NO SOFTLEVEL SUPPORT YET
420 # Mips is an interesting arch -- where most archs will
421 # use ${1} as the root of the LiveCD, an SGI LiveCD lacks
422 # such a root. Instead, we will use ${1} as a scratch
423 # directory to build the components we need for the
424 # CD image, and then pass these components to the
425 # `sgibootcd` tool which outputs a final CD image
427 [ ! -d "${scratch}/kernels" ] && mkdir ${scratch}/kernels
428 [ ! -d "${scratch}/kernels/misc" ] && mkdir ${scratch}/kernels/misc
429 [ ! -d "${scratch}/arcload" ] && mkdir ${scratch}/arcload
430 echo "" > ${scratch}/arc.cf
432 # Move kernel binaries to ${scratch}/kernels, and
433 # move everything else to ${scratch}/kernels/misc
434 for x in ${clst_boot_kernel}; do
435 [ -e "${1}/boot/${x}" ] && mv ${1}/boot/${x} ${scratch}/kernels
436 [ -e "${1}/boot/${x}.igz" ] && mv ${1}/boot/${x}.igz ${scratch}/kernels/misc
438 [ -d "${1}/boot" ] && rmdir ${1}/boot
440 # Source the arcload source file to generated required sections of arc.cf
441 source ${clst_sharedir}/targets/support/mips-arcload_conf.sh
443 # Generate top portions of the config
444 echo -e "${topofconfig}${serial}${dbg}${cmt1}" >> ${scratch}/arc.cf
446 # Next, figure out what kernels were specified in the
447 # spec file, and generate the appropriate arcload conf
448 # blocks specific to each system
449 ip22="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip22" | tr "\n" " ")"
450 ip27="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip27" | tr "\n" " ")"
451 ip28="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip28" | tr "\n" " ")"
452 ip30="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip30" | tr "\n" " ")"
453 ip32="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip32" | tr "\n" " ")"
455 if [ -n "${ip22}" ]; then
456 echo -e "${ip22base}" >> ${scratch}/arc.cf
457 for x in ${ip22}; do echo -e "${!x}" >> ${scratch}/arc.cf; done
458 echo -e "${ip22vid}${ip22x}" >> ${scratch}/arc.cf
461 [ -n "${ip27}" ] && echo -e "${ip27base}" >> ${scratch}/arc.cf
462 [ -n "${ip28}" ] && echo -e "${ip28base}" >> ${scratch}/arc.cf
463 [ -n "${ip30}" ] && echo -e "${ip30base}" >> ${scratch}/arc.cf
465 if [ -n "${ip32}" ]; then
466 echo -e "${ip32base}" >> ${scratch}/arc.cf
467 for x in ${ip32}; do echo -e "${!x}" >> ${scratch}/arc.cf; done
468 echo -e "${ip32vid}${ip32x}" >> ${scratch}/arc.cf
471 # Finish off the config
472 echo -e "${cmt2}" >> ${scratch}/arc.cf
474 # Move the bootloader binaries & config to their destination
475 [ -e "${1}/sashARCS" ] && mv ${1}/sashARCS ${scratch}/arcload
476 [ -e "${1}/sash64" ] && mv ${1}/sash64 ${scratch}/arcload
477 [ -e "${1}/arc.cf" ] && mv ${1}/arc.cf ${scratch}/arcload