Removing acpi=off from default kernel arguments and adding ia64 livecd-stage2 support...
[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.10 2005/07/05 17:48:21 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_bootargs
14 check_filesystem_type
15
16 default_append_line="initrd=${x}.igz root=/dev/ram0 init=/linuxrc ${cmdline_opts} ${custom_kopts} cdroot"
17
18 case ${clst_mainarch} in
19         alpha)
20                 acfg=$1/etc/aboot.conf
21                 bctr=0
22                 for x in ${clst_boot_kernel}
23                 do
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}
27                         ((bctr=${bctr}+1))
28                 done
29                 ;;
30
31         arm)
32                 ;;
33         hppa)
34                 icfg=$1/boot/palo.conf
35                 kmsg=$1/boot/kernels.msg
36                 hmsg=$1/boot/help.msg
37                 echo "--commandline=0/${first} initrd=${x}.igz root=/dev/ram0 init=/linuxrc ${cmdline_opts}" >> ${icfg}
38                 echo "--bootloader=boot/iplboot" >> ${icfg}
39                 echo "--ramdisk=boot/${x}.igz" >> ${icfg}
40
41 #               for x in $clst_boot_kernel
42 #               do
43 #
44 #                       eval custom_kopts=\$${x}_kernelopts
45 #                       echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
46 #                       echo >> $icfg
47 #                       echo "label $x" >> $icfg
48 #                       echo "  kernel $x" >> $icfg
49 #                       echo "  append initrd=$x.igz root=/dev/ram0 init=/linuxrc ${cmdline_opts} ${custom_kopts} cdroot vga=0x317 splash=silent" >> $icfg
50 #                       echo >> $icfg
51 #                       echo "   $x" >> $kmsg
52 #                       echo "label $x-nofb" >> $icfg
53 #                       echo "  kernel $x" >> $icfg
54 #                       echo "  append initrd=$x.igz root=/dev/ram0 init=/linuxrc ${cmdline_opts} ${custom_kopts} cdroot" >> $icfg
55 #                       echo >> $icfg
56 #                       echo "   ${x}-nofb" >> $kmsg
57 #               done
58                 ;;
59         ppc)
60                 # PPC requirements: 
61                 # -----------------
62                 # The specs indicate the kernels to be build. We need to put
63                 # those kernels and the corresponding initrd.img.gz(s) in the
64                 # /boot directory. This directory contains a message boot.msg 
65                 # containing some info to be displayed on boot, a configuration
66                 # (yaboot.conf) specifying the boot options (kernel/initrd 
67                 # combinations). The boot directory also contains a file called
68                 # yaboot, which normally gets copied from the live environment.
69                 # For now we supply a prebuilt file, prebuilt configuration 
70                 # and prebuilt boot message. This can be enhanced later on
71                 # but the following suffices for now:
72                 ;;
73         sparc*)
74                 scfg=$1/boot/silo.conf
75                 echo "default=\"help\"" > ${scfg}
76                 echo "message=\"/boot/boot.msg\"" >> ${scfg}
77
78                 for x in ${clst_boot_kernel}
79                 do
80                         echo >> ${icfg}
81                         echo "image=\"/boot/${x}\"" >> ${scfg}
82                         echo -e "\tlabel=\"${x}\"" >> ${scfg}
83                         echo -e "\tappend=\"initrd=/boot/${x}.igz root=/dev/ram0 init=/linuxrc ${cmdline_opts} cdroot\"" >> ${scfg}
84
85                 done
86
87                 echo "image=\"cat /boot/silo.conf\"" >> ${scfg}
88                 echo -e "label=\"config\"" >> ${scfg}
89                 echo "image=\"cat /boot/video.msg\"" >> ${scfg}
90                 echo -e "label=\"video\"" >> ${scfg}
91                 echo "image=\"cat /boot/help.msg\"" >> ${scfg}
92                 echo -e "label=\"help\"" >> ${scfg}
93                 ;;
94         ia64)
95                 iacfg=$1/boot/elilo.conf
96                 echo 'prompt' > ${iacfg}
97                 echo 'message=/efi/boot/elilo.msg' >> ${iacfg}
98                 echo 'chooser=simple' >> ${iacfg}
99                 echo 'timeout=50' >> ${iacfg}
100                 echo >> ${iacfg}
101                 for x in ${clst_boot_kernel}
102                 do
103                         echo "image=/efi/boot/${x}" >> ${iacfg}
104                         echo "  label=${x}" >> ${iacfg}
105                         echo '  append="'${default_append_line}'"' >> ${iacfg}
106                         echo "  initrd=/efi/boot/${x}.igz" >> ${iacfg}
107                         echo >> ${iacfg}
108                         echo "image=/efi/boot/${x}" >> ${iacfg}
109                         echo "  label=${x}-serial">> ${iacfg}
110                         echo '  append="'${default_append_line}' console=tty0 console=ttyS0,9600"' >> ${iacfg}
111                         echo "  initrd=/efi/boot/${x}.igz" >> ${iacfg}
112                         echo >> ${iacfg}
113                 done
114                 cp ${iacfg} $1/boot/efi/boot
115                 mv $1/boot/${x}{,.igz} $1/boot/efi/boot
116                 ;;
117         x86|amd64)
118                 if [ -e $1/boot/isolinux.bin ]
119                 then
120                         # the rest of this function sets up the config file for isolinux
121                         icfg=$1/boot/isolinux.cfg
122                         kmsg=$1/boot/kernels.msg
123                         hmsg=$1/boot/help.msg
124                         echo "default ${first}" > ${icfg}
125                         echo "timeout 150" >> ${icfg}
126                         echo "prompt 1" >> ${icfg}
127                         echo "display boot.msg" >> ${icfg}
128                         echo "F1 kernels.msg" >> ${icfg}
129                         echo "F2 help.msg" >> ${icfg}
130
131                         echo "Available kernels:" > ${kmsg}
132                         cp ${clst_sharedir}/livecd/files/x86-help.msg ${hmsg}
133
134                         case ${clst_livecd_type} in
135                         gentoo-*)
136                                 keymap="dokeymap"
137                                 ;;
138                         esac
139
140                         for x in ${clst_boot_kernel}
141                         do
142
143                                 eval custom_kopts=\$${x}_kernelopts
144                                 echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
145                                 echo >> ${icfg}
146                                 echo "label ${x}" >> ${icfg}
147                                 echo "  kernel ${x}" >> ${icfg}
148                                 if [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
149                                 then
150                                         echo "  append ${default_append_line} vga=791 splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet ${keymap}" >> ${icfg}
151                                 else
152                                         echo "  append ${default_append_line} vga=791 splash=silent ${keymap}" >> ${icfg}
153                                 fi
154                         
155                                 echo >> ${icfg}
156                                 echo "   ${x}" >> ${kmsg}
157                                 echo "label ${x}-nofb" >> ${icfg}
158                                 echo "  kernel ${x}" >> ${icfg}
159                                 echo "  append ${default_append_line} ${keymap}" >> ${icfg}
160                                 echo >> ${icfg}
161                                 echo "   ${x}-nofb" >> ${kmsg}
162                         done
163
164                         if [ -f $1/boot/memtest86 ]
165                         then
166                                 echo >> $icfg
167                                 echo "   memtest86" >> $kmsg
168                                 echo "label memtest86" >> $icfg
169                                 echo "  kernel memtest86" >> $icfg
170                         fi
171                 fi
172
173                 if [ -e $1/boot/grub/stage2_eltorito ]
174                 then
175                         icfg=$1/boot/grub/grub.conf
176                         echo "default 1" > ${icfg}
177                         echo "timeout 150" >> ${icfg}
178                         
179                         
180                         # Setup help message    
181                         hmsg=${clst_sharedir}/livecd/files/x86-help.msg
182                         hmsg_txt="$(cat ${hmsg})"
183                         
184                         echo >> ${icfg}
185                         echo "title help" >> ${icfg}
186                         echo "pause ${hmsg_txt}" >> ${icfg}
187                         
188                         
189                         for x in ${clst_boot_kernel}
190                         do
191                                 eval custom_kopts=\$${x}_kernelopts
192                                 echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
193                                 echo >> ${icfg}
194                                 echo "title ${x}" >> ${icfg}
195                                 
196                                 if [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
197                                 then
198                                         echo "kernel /boot/${x} ${default_append_line} vga=791 dokeymap splash=silent,theme:${clst_livecd_splash_theme}" >> ${icfg}
199                                 else
200                                         echo "kernel /boot/${x} ${default_append_line} vga=791 dokeymap splash=silent" >> ${icfg}
201                                 fi
202
203                                 if [ -e $1/boot/${x}.igz ]
204                                 then
205                                         echo "initrd /boot/${x}.igz" >> ${icfg}
206                                 fi
207                                 
208                                 echo >> ${icfg}
209                                 echo "title ${x} [ No FrameBuffer ]" >> ${icfg}
210                                 echo "kernel ${x} /boot/${x} ${default_append_line}" >> ${icfg}
211                                 if [ -e $1/boot/${x}.igz ]
212                                 then
213                                         echo "initrd /boot/${x}.igz" >> ${icfg}
214                                 fi
215                         done
216
217                         if [ -f $1/boot/memtest86 ]
218                         then
219                                 echo >> ${icfg}
220                                 echo "title memtest86" >> ${icfg}
221                                 echo "kernel /boot/memtest86" >> ${icfg}
222                         fi
223                 fi
224                 ;;
225 esac
226 exit $?