Fixing some bootloader isolinux/boot stuff for x86/amd64.
[catalyst.git] / targets / support / bootloader-setup.sh
1 #!/bin/bash
2 # Copyright 1999-2005 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License v2
4 # $Header: /var/cvsroot/gentoo/src/catalyst/targets/support/bootloader-setup.sh,v 1.5 2005/06/16 13:40:01 wolf31o2 Exp $
5 . ${clst_sharedir}/targets/support/functions.sh
6 . ${clst_sharedir}/targets/support/filesystem-functions.sh
7
8 # $1 is the destination root
9
10 extract_cdtar $1
11 extract_kernels $1/boot
12 check_dev_manager
13 check_filesystem_type
14
15 default_append_line="initrd=${x}.igz root=/dev/ram0 init=/linuxrc acpi=off ${cmdline_opts} ${custom_kopts} cdroot"
16
17 case ${clst_mainarch} in
18         alpha)
19                 acfg=$1/etc/aboot.conf
20                 bctr=0
21                 for x in ${clst_boot_kernel}
22                 do
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}
26                         ((bctr=${bctr}+1))
27                 done
28                 ;;
29
30         arm)
31                 ;;
32         hppa)
33                 icfg=$1/boot/palo.conf
34                 kmsg=$1/boot/kernels.msg
35                 hmsg=$1/boot/help.msg
36                 echo "--commandline=0/${first} initrd=${x}.igz root=/dev/ram0 init=/linuxrc ${cmdline_opts}" >> ${icfg}
37                 echo "--bootloader=boot/iplboot" >> ${icfg}
38                 echo "--ramdisk=boot/${x}.igz" >> ${icfg}
39
40 #               for x in $clst_boot_kernel
41 #               do
42 #
43 #                       eval custom_kopts=\$${x}_kernelopts
44 #                       echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
45 #                       echo >> $icfg
46 #                       echo "label $x" >> $icfg
47 #                       echo "  kernel $x" >> $icfg
48 #                       echo "  append initrd=$x.igz root=/dev/ram0 init=/linuxrc ${cmdline_opts} ${custom_kopts} cdroot vga=0x317 splash=silent" >> $icfg
49 #                       echo >> $icfg
50 #                       echo "   $x" >> $kmsg
51 #                       echo "label $x-nofb" >> $icfg
52 #                       echo "  kernel $x" >> $icfg
53 #                       echo "  append initrd=$x.igz root=/dev/ram0 init=/linuxrc ${cmdline_opts} ${custom_kopts} cdroot" >> $icfg
54 #                       echo >> $icfg
55 #                       echo "   ${x}-nofb" >> $kmsg
56 #               done
57                 ;;
58         ppc)
59                 # PPC requirements: 
60                 # -----------------
61                 # The specs indicate the kernels to be build. We need to put
62                 # those kernels and the corresponding initrd.img.gz(s) in the
63                 # /boot directory. This directory contains a message boot.msg 
64                 # containing some info to be displayed on boot, a configuration
65                 # (yaboot.conf) specifying the boot options (kernel/initrd 
66                 # combinations). The boot directory also contains a file called
67                 # yaboot, which normally gets copied from the live environment.
68                 # For now we supply a prebuilt file, prebuilt configuration 
69                 # and prebuilt boot message. This can be enhanced later on
70                 # but the following suffices for now:
71                 ;;
72         sparc*)
73                 scfg=$1/boot/silo.conf
74                 echo "default=\"help\"" > ${scfg}
75                 echo "message=\"/boot/boot.msg\"" >> ${scfg}
76
77                 for x in ${clst_boot_kernel}
78                 do
79                         echo >> ${icfg}
80                         echo "image=\"/boot/${x}\"" >> ${scfg}
81                         echo -e "\tlabel=\"${x}\"" >> ${scfg}
82                         echo -e "\tappend=\"initrd=/boot/${x}.igz root=/dev/ram0 init=/linuxrc ${cmdline_opts} cdroot\"" >> ${scfg}
83
84                 done
85
86                 echo "image=\"cat /boot/silo.conf\"" >> ${scfg}
87                 echo -e "label=\"config\"" >> ${scfg}
88                 echo "image=\"cat /boot/video.msg\"" >> ${scfg}
89                 echo -e "label=\"video\"" >> ${scfg}
90                 echo "image=\"cat /boot/help.msg\"" >> ${scfg}
91                 echo -e "label=\"help\"" >> ${scfg}
92                 ;;
93         x86|amd64)
94                 if [ -e $1/boot/isolinux.bin ]
95                 then
96                         # the rest of this function sets up the config file for isolinux
97                         icfg=$1/boot/isolinux.cfg
98                         kmsg=$1/boot/kernels.msg
99                         hmsg=$1/boot/help.msg
100                         echo "default ${first}" > ${icfg}
101                         echo "timeout 150" >> ${icfg}
102                         echo "prompt 1" >> ${icfg}
103                         echo "display boot.msg" >> ${icfg}
104                         echo "F1 kernels.msg" >> ${icfg}
105                         echo "F2 help.msg" >> ${icfg}
106
107                         echo "Available kernels:" > ${kmsg}
108                         cp ${clst_sharedir}/livecd/files/x86-help.msg ${hmsg}
109
110                         for x in ${clst_boot_kernel}
111                         do
112
113                                 eval custom_kopts=\$${x}_kernelopts
114                                 echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
115                                 echo >> ${icfg}
116                                 echo "label ${x}" >> ${icfg}
117                                 echo "  kernel ${x}" >> ${icfg}
118                                 if [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
119                                 then
120                                         echo "  append ${default_append_line} vga=791 dokeymap splash=silent,theme:${clst_livecd_splash_theme}" >> ${icfg}
121                                 else
122                                         echo "  append ${default_append_line} vga=791 dokeymap splash=silent" >> ${icfg}
123                                 fi
124                         
125                                 echo >> ${icfg}
126                                 echo "   ${x}" >> ${kmsg}
127                                 echo "label ${x}-nofb" >> ${icfg}
128                                 echo "  kernel ${x}" >> ${icfg}
129                                 echo "  append ${default_append_line} " >> ${icfg}
130                                 echo >> ${icfg}
131                                 echo "   ${x}-nofb" >> ${kmsg}
132                         done
133
134                         if [ -f $1/boot/memtest86 ]
135                         then
136                                 echo >> $icfg
137                                 echo "   memtest86" >> $kmsg
138                                 echo "label memtest86" >> $icfg
139                                 echo "  kernel memtest86" >> $icfg
140                         fi
141                 fi
142
143                 if [ -e $1/boot/grub/stage2_eltorito ]
144                 then
145                         icfg=$1/boot/grub/grub.conf
146                         echo "default 1" > ${icfg}
147                         echo "timeout 150" >> ${icfg}
148                         
149                         
150                         # Setup help message    
151                         hmsg=${clst_sharedir}/livecd/files/x86-help.msg
152                         hmsg_txt="$(cat ${hmsg})"
153                         
154                         echo >> ${icfg}
155                         echo "title help" >> ${icfg}
156                         echo "pause ${hmsg_txt}" >> ${icfg}
157                         
158                         
159                         for x in ${clst_boot_kernel}
160                         do
161                                 eval custom_kopts=\$${x}_kernelopts
162                                 echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
163                                 echo >> ${icfg}
164                                 echo "title ${x}" >> ${icfg}
165                                 
166                                 if [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
167                                 then
168                                         echo "kernel /boot/${x} ${default_append_line} vga=791 dokeymap splash=silent,theme:${clst_livecd_splash_theme}" >> ${icfg}
169                                 else
170                                         echo "kernel /boot/${x} ${default_append_line} vga=791 dokeymap splash=silent" >> ${icfg}
171                                 fi
172
173                                 if [ -e $1/boot/${x}.igz ]
174                                 then
175                                         echo "initrd /boot/${x}.igz" >> ${icfg}
176                                 fi
177                                 
178                                 echo >> ${icfg}
179                                 echo "title ${x} [ No FrameBuffer ]" >> ${icfg}
180                                 echo "kernel ${x} /boot/${x} ${default_append_line}" >> ${icfg}
181                                 if [ -e $1/boot/${x}.igz ]
182                                 then
183                                         echo "initrd /boot/${x}.igz" >> ${icfg}
184                                 fi
185                         done
186
187                         if [ -f $1/boot/memtest86 ]
188                         then
189                                 echo >> ${icfg}
190                                 echo "title memtest86" >> ${icfg}
191                                 echo "kernel /boot/memtest86" >> ${icfg}
192                         fi
193                 fi
194                 ;;
195 esac
196 exit $?