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 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 "device=cd:" >> ${icfg}
56 echo "root=/dev/ram" >> ${icfg}
57 echo "fgcolor=white" >> ${icfg}
58 echo "bgcolor=black" >> ${icfg}
59 echo "message=/boot/boot.msg" >> ${icfg}
61 # Here is where I fix up the boot.msg file.
62 sed -e 's/ARCH/PowerPC/' \
63 -e 's/HARDWARE/Apple and IBM hardware/' \
66 # Setup the IBM yaboot.conf
67 etc_icfg=$1/etc/yaboot.conf
70 echo "root=/dev/ram" >> ${etc_icfg}
71 echo "fgcolor=white" >> ${etc_icfg}
72 echo "bgcolor=black" >> ${etc_icfg}
73 echo "message=/boot/boot.msg" >> ${etc_icfg}
75 for x in ${clst_boot_kernel}
77 eval "clst_kernel_console=\$clst_boot_kernel_${x}_console"
78 eval "clst_kernel_machine_type=\$clst_boot_kernel_${x}_machine_type"
79 eval custom_kopts=\$${x}_kernelopts
81 echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
82 if [ "${clst_kernel_machine_type}" == "ibm" ]
85 if [ -n "${clst_kernel_console}" ]
88 echo "image=/boot/${x}" >> ${etc_icfg}
90 if [ -e "$1/boot/${x}.igz" ]
92 echo "initrd=/boot/${x}.igz" >> ${etc_icfg}
95 echo "label=${x}" >> ${etc_icfg}
96 echo "read-write" >> ${icfg}
97 echo "append=\"${default_append_line}\"" >> ${etc_icfg}
99 for y in ${clst_kernel_console}
103 echo "image=/boot/${x}" >> ${etc_icfg}
105 if [ -e "$1/boot/${x}.igz" ]
107 echo "initrd=/boot/${x}.igz" >> ${etc_icfg}
110 echo "label=${x}-${y} " >> ${etc_icfg}
111 echo "read-write" >> ${icfg}
112 echo "append=\"${default_append_line} console=${y}\"" >> ${etc_icfg}
116 echo "image=/boot/${x}" >> ${etc_icfg}
118 if [ -e "$1/boot/${x}.igz" ]
120 echo "initrd=/boot/${x}.igz" >> ${etc_icfg}
123 echo "label=${x}" >> ${etc_icfg}
124 echo "read-write" >> ${etc_icfg}
125 echo "append=\"${default_append_line}\"" >> ${etc_icfg}
128 # Here we wipe out the /ppc directory, if it exists.
130 if [ -n "${clst_kernel_console}" ]
133 echo "image=/boot/${x}" >> ${icfg}
135 if [ -e "$1/boot/${x}.igz" ]
137 echo "initrd=/boot/${x}.igz" >> ${icfg}
140 echo "label=${x}" >> ${icfg}
141 echo "read-write" >> ${icfg}
142 echo "append=\"${default_append_line}\"" >> ${icfg}
144 for y in ${clst_kernel_console}
147 echo "image=/boot/${x}" >> ${icfg}
149 if [ -e "$1/boot/${x}.igz" ]
151 echo "initrd=/boot/${x}.igz" >> ${icfg}
154 echo "label=${x}-${y} " >> ${icfg}
155 echo "read-write" >> ${icfg}
156 echo "append=\"${default_append_line} console=${y}\"" >> ${icfg}
160 echo "image=/boot/${x}" >> ${icfg}
162 if [ -e "$1/boot/${x}.igz" ]
164 echo "initrd=/boot/${x}.igz" >> ${icfg}
167 echo "label=${x}" >> ${icfg}
168 echo "read-write" >> ${icfg}
169 echo "append=\"${default_append_line}\"" >> ${icfg}
174 if [ "${IBM_YABOOT}" == "FALSE" ]
186 # NO SOFTLEVEL SUPPORT YET
187 scfg=$1/boot/silo.conf
188 echo "default=\"help\"" > ${scfg}
189 echo "message=\"/boot/boot.msg\"" >> ${scfg}
191 for x in ${clst_boot_kernel}
194 echo "image=\"/boot/${x}\"" >> ${scfg}
195 echo -e "\tlabel=\"${x}\"" >> ${scfg}
196 echo -e "\tappend=\"initrd=/boot/${x}.igz root=/dev/ram0 init=/linuxrc ${cmdline_opts} cdroot\"" >> ${scfg}
200 echo "image=\"cat /boot/silo.conf\"" >> ${scfg}
201 echo -e "label=\"config\"" >> ${scfg}
202 echo "image=\"cat /boot/video.msg\"" >> ${scfg}
203 echo -e "label=\"video\"" >> ${scfg}
204 echo "image=\"cat /boot/help.msg\"" >> ${scfg}
205 echo -e "label=\"help\"" >> ${scfg}
206 echo "image=\"cat /boot/parameters.msg\"" >> ${scfg}
207 echo -e "label=\"parameters\"" >> ${scfg}
210 # NO SOFTLEVEL SUPPORT YET
211 iacfg=$1/boot/elilo.conf
212 echo 'prompt' > ${iacfg}
213 echo 'message=/efi/boot/elilo.msg' >> ${iacfg}
214 echo 'chooser=simple' >> ${iacfg}
215 echo 'timeout=50' >> ${iacfg}
216 echo 'relocatable' >> ${iacfg}
218 for x in ${clst_boot_kernel}
220 echo "image=/efi/boot/${x}" >> ${iacfg}
221 echo " label=${x}" >> ${iacfg}
222 echo ' append="'initrd=${x}.igz ${default_append_line}'"' >> ${iacfg}
223 echo " initrd=/efi/boot/${x}.igz" >> ${iacfg}
225 echo "image=/efi/boot/${x}" >> ${iacfg}
226 echo " label=${x}-serial">> ${iacfg}
227 echo ' append="'initrd=${x}.igz ${default_append_line}' console=tty0 console=ttyS0,9600"' >> ${iacfg}
228 echo " initrd=/efi/boot/${x}.igz" >> ${iacfg}
230 echo "image=/efi/boot/${x}" >> ${iacfg}
231 echo " label=${x}-sgi">> ${iacfg}
232 echo ' append="'initrd=${x}.igz ${default_append_line}' console=tty0 console=ttySG0,115200"' >> ${iacfg}
233 echo " initrd=/efi/boot/${x}.igz" >> ${iacfg}
235 mv $1/boot/${x}{,.igz} $1/boot/efi/boot
237 cp ${iacfg} $1/boot/efi/boot
240 if [ -e $1/isolinux/isolinux.bin ]
242 cp -f $1/boot/* $1/isolinux
243 # the rest of this function sets up the config file for isolinux
244 icfg=$1/isolinux/isolinux.cfg
245 kmsg=$1/isolinux/kernels.msg
246 echo "default ${first}" > ${icfg}
247 echo "timeout 150" >> ${icfg}
248 echo "prompt 1" >> ${icfg}
249 echo "display boot.msg" >> ${icfg}
250 echo "F1 kernels.msg" >> ${icfg}
251 echo "F2 F2.msg" >> ${icfg}
252 echo "F3 F3.msg" >> ${icfg}
253 echo "F4 F4.msg" >> ${icfg}
254 echo "F5 F5.msg" >> ${icfg}
255 echo "F6 F6.msg" >> ${icfg}
256 echo "F7 F7.msg" >> ${icfg}
258 echo "Available kernels:" > ${kmsg}
261 cp ${clst_sharedir}/files/livecd/x86-F$i.msg \
265 for x in ${clst_boot_kernel}
267 eval custom_kopts=\$${x}_kernelopts
268 echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
271 eval "clst_kernel_softlevel=\$clst_boot_kernel_${x}_softlevel"
273 if [ -n "${clst_kernel_softlevel}" ]
275 for y in ${clst_kernel_softlevel}
277 echo "label ${x}-${y}" >> ${icfg}
278 echo " kernel ${x}" >> ${icfg}
279 echo " append ${default_append_line} softlevel=${y} initrd=${x}.igz vga=791" >> ${icfg}
282 echo " ${x}" >> ${kmsg}
283 echo "label ${x}-${y}-nofb" >> ${icfg}
284 echo " kernel ${x}" >> ${icfg}
285 echo " append ${default_append_line} softlevel=${y} initrd=${x}.igz" >> ${icfg}
287 echo " ${x}-nofb" >> ${kmsg}
290 echo "label ${x}" >> ${icfg}
291 echo " kernel ${x}" >> ${icfg}
292 echo " append ${default_append_line} initrd=${x}.igz vga=791" >> ${icfg}
294 echo " ${x}" >> ${kmsg}
295 echo "label ${x}-nofb" >> ${icfg}
296 echo " kernel ${x}" >> ${icfg}
297 echo " append ${default_append_line} initrd=${x}.igz" >> ${icfg}
299 echo " ${x}-nofb" >> ${kmsg}
303 if [ -f $1/isolinux/memtest86 ]
306 echo " memtest86" >> $kmsg
307 echo "label memtest86" >> $icfg
308 echo " kernel memtest86" >> $icfg
312 if [ -e $1/boot/efi/elilo.efi ]
314 [ -e $1/isolinux/elilo.efi ] && rm -f $1/isolinux/elilo.efi
315 iacfg=$1/boot/elilo.conf
316 echo 'prompt' > ${iacfg}
317 echo 'message=/efi/boot/elilo.msg' >> ${iacfg}
318 echo 'chooser=simple' >> ${iacfg}
319 echo 'timeout=50' >> ${iacfg}
321 for x in ${clst_boot_kernel}
323 echo "image=/efi/boot/${x}" >> ${iacfg}
324 echo " label=${x}" >> ${iacfg}
325 echo ' append="'initrd=${x}.igz ${default_append_line}'"' >> ${iacfg}
326 echo " initrd=/efi/boot/${x}.igz" >> ${iacfg}
328 echo "image=/efi/boot/${x}" >> ${iacfg}
330 cp -f $1/boot/${x}{,.igz} $1/boot/efi/boot > /dev/null
331 cp -f $1/isolinux/${x}{,.igz} $1/boot/efi/boot > /dev/null
333 cp ${iacfg} $1/boot/efi/boot
336 if [ -e $1/boot/grub/stage2_eltorito ]
338 icfg=$1/boot/grub/menu.lst
339 echo "default 0" > ${icfg}
340 echo "timeout 15" >> ${icfg}
341 echo "pager on" >> ${icfg}
343 # Copy our splash if we're a Gentoo release
344 case ${clst_livecd_type} in
346 [ -e ${clst_chroot_path}/boot/grub/splash.xpm.gz ] && \
347 cp -f ${clst_chroot_path}/boot/grub/splash.xpm.gz \
352 if [ -e ${1}/boot/grub/splash.xpm.gz ]; then
353 echo "splashimage=/boot/grub/splash.xpm.gz" >> ${icfg}
356 for x in ${clst_boot_kernel}
358 eval custom_kopts=\$${x}_kernelopts
359 echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
362 eval "clst_kernel_softlevel=\$clst_boot_kernel_${x}_softlevel"
364 if [ -n "${clst_kernel_softlevel}" ]
366 for y in ${clst_kernel_softlevel}
368 echo "title ${x}-${y}" >> ${icfg}
369 echo " append ${default_append_line} softlevel=${y} initrd=${x}.igz vga=791" >> ${icfg}
370 if [ -e $1/boot/${x}.igz ]
372 echo "initrd /boot/${x}.igz" >> ${icfg}
375 echo "title ${x}-${y} [ No FrameBuffer ]" >> ${icfg}
376 echo "kernel /boot/${x} softlevel=${y} ${default_append_line}" >> ${icfg}
377 if [ -e $1/boot/${x}.igz ]
379 echo "initrd /boot/${x}.igz" >> ${icfg}
384 echo "title ${x}" >> ${icfg}
385 echo "kernel /boot/${x} ${default_append_line} vga=791" >> ${icfg}
386 if [ -e $1/boot/${x}.igz ]
388 echo "initrd /boot/${x}.igz" >> ${icfg}
391 echo "title ${x} [ No FrameBuffer ]" >> ${icfg}
392 echo "kernel /boot/${x} ${default_append_line}" >> ${icfg}
393 if [ -e $1/boot/${x}.igz ]
395 echo "initrd /boot/${x}.igz" >> ${icfg}
403 echo "title help" >> ${icfg}
404 cp ${clst_sharedir}/files/livecd/README.txt \
406 echo "cat /boot/help.msg" >> ${icfg}
408 if [ -f $1/boot/memtest86 ]
411 echo "title memtest86" >> ${icfg}
412 echo "kernel /boot/memtest86" >> ${icfg}
417 # NO SOFTLEVEL SUPPORT YET
419 # Mips is an interesting arch -- where most archs will
420 # use ${1} as the root of the LiveCD, an SGI LiveCD lacks
421 # such a root. Instead, we will use ${1} as a scratch
422 # directory to build the components we need for the
423 # CD image, and then pass these components to the
424 # `sgibootcd` tool which outputs a final CD image
426 [ ! -d "${scratch}/kernels" ] && mkdir ${scratch}/kernels
427 [ ! -d "${scratch}/kernels/misc" ] && mkdir ${scratch}/kernels/misc
428 [ ! -d "${scratch}/arcload" ] && mkdir ${scratch}/arcload
429 echo "" > ${scratch}/arc.cf
431 # Move kernel binaries to ${scratch}/kernels, and
432 # move everything else to ${scratch}/kernels/misc
433 for x in ${clst_boot_kernel}; do
434 [ -e "${1}/boot/${x}" ] && mv ${1}/boot/${x} ${scratch}/kernels
435 [ -e "${1}/boot/${x}.igz" ] && mv ${1}/boot/${x}.igz ${scratch}/kernels/misc
437 [ -d "${1}/boot" ] && rmdir ${1}/boot
439 # Source the arcload source file to generated required sections of arc.cf
440 source ${clst_sharedir}/targets/support/mips-arcload_conf.sh
442 # Generate top portions of the config
443 echo -e "${topofconfig}${serial}${dbg}${cmt1}" >> ${scratch}/arc.cf
445 # Next, figure out what kernels were specified in the
446 # spec file, and generate the appropriate arcload conf
447 # blocks specific to each system
448 ip22="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip22" | tr "\n" " ")"
449 ip27="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip27" | tr "\n" " ")"
450 ip28="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip28" | tr "\n" " ")"
451 ip30="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip30" | tr "\n" " ")"
452 ip32="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip32" | tr "\n" " ")"
454 if [ -n "${ip22}" ]; then
455 echo -e "${ip22base}" >> ${scratch}/arc.cf
456 for x in ${ip22}; do echo -e "${!x}" >> ${scratch}/arc.cf; done
457 echo -e "${ip22vid}${ip22x}" >> ${scratch}/arc.cf
460 [ -n "${ip27}" ] && echo -e "${ip27base}" >> ${scratch}/arc.cf
461 [ -n "${ip28}" ] && echo -e "${ip28base}" >> ${scratch}/arc.cf
462 [ -n "${ip30}" ] && echo -e "${ip30base}" >> ${scratch}/arc.cf
464 if [ -n "${ip32}" ]; then
465 echo -e "${ip32base}" >> ${scratch}/arc.cf
466 for x in ${ip32}; do echo -e "${!x}" >> ${scratch}/arc.cf; done
467 echo -e "${ip32vid}${ip32x}" >> ${scratch}/arc.cf
470 # Finish off the config
471 echo -e "${cmt2}" >> ${scratch}/arc.cf
473 # Move the bootloader binaries & config to their destination
474 [ -e "${1}/sashARCS" ] && mv ${1}/sashARCS ${scratch}/arcload
475 [ -e "${1}/sash64" ] && mv ${1}/sash64 ${scratch}/arcload
476 [ -e "${1}/arc.cf" ] && mv ${1}/arc.cf ${scratch}/arcload