Changed sed line for 1024x768-only splash for x86 and amd64 only, as we control the...
[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.8 2005/06/30 16:07:46 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 acpi=off ${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         x86|amd64)
95                 if [ -e $1/boot/isolinux.bin ]
96                 then
97                         # the rest of this function sets up the config file for isolinux
98                         icfg=$1/boot/isolinux.cfg
99                         kmsg=$1/boot/kernels.msg
100                         hmsg=$1/boot/help.msg
101                         echo "default ${first}" > ${icfg}
102                         echo "timeout 150" >> ${icfg}
103                         echo "prompt 1" >> ${icfg}
104                         echo "display boot.msg" >> ${icfg}
105                         echo "F1 kernels.msg" >> ${icfg}
106                         echo "F2 help.msg" >> ${icfg}
107
108                         echo "Available kernels:" > ${kmsg}
109                         cp ${clst_sharedir}/livecd/files/x86-help.msg ${hmsg}
110
111                         case ${clst_livecd_type} in
112                         gentoo-*)
113                                 keymap="dokeymap"
114                                 ;;
115                         esac
116
117                         for x in ${clst_boot_kernel}
118                         do
119
120                                 eval custom_kopts=\$${x}_kernelopts
121                                 echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
122                                 echo >> ${icfg}
123                                 echo "label ${x}" >> ${icfg}
124                                 echo "  kernel ${x}" >> ${icfg}
125                                 if [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
126                                 then
127                                         echo "  append ${default_append_line} vga=791 splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet ${keymap}" >> ${icfg}
128                                 else
129                                         echo "  append ${default_append_line} vga=791 splash=silent ${keymap}" >> ${icfg}
130                                 fi
131                         
132                                 echo >> ${icfg}
133                                 echo "   ${x}" >> ${kmsg}
134                                 echo "label ${x}-nofb" >> ${icfg}
135                                 echo "  kernel ${x}" >> ${icfg}
136                                 echo "  append ${default_append_line} ${keymap}" >> ${icfg}
137                                 echo >> ${icfg}
138                                 echo "   ${x}-nofb" >> ${kmsg}
139                         done
140
141                         if [ -f $1/boot/memtest86 ]
142                         then
143                                 echo >> $icfg
144                                 echo "   memtest86" >> $kmsg
145                                 echo "label memtest86" >> $icfg
146                                 echo "  kernel memtest86" >> $icfg
147                         fi
148                 fi
149
150                 if [ -e $1/boot/grub/stage2_eltorito ]
151                 then
152                         icfg=$1/boot/grub/grub.conf
153                         echo "default 1" > ${icfg}
154                         echo "timeout 150" >> ${icfg}
155                         
156                         
157                         # Setup help message    
158                         hmsg=${clst_sharedir}/livecd/files/x86-help.msg
159                         hmsg_txt="$(cat ${hmsg})"
160                         
161                         echo >> ${icfg}
162                         echo "title help" >> ${icfg}
163                         echo "pause ${hmsg_txt}" >> ${icfg}
164                         
165                         
166                         for x in ${clst_boot_kernel}
167                         do
168                                 eval custom_kopts=\$${x}_kernelopts
169                                 echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
170                                 echo >> ${icfg}
171                                 echo "title ${x}" >> ${icfg}
172                                 
173                                 if [ "${clst_livecd_splash_type}" == "gensplash" -a -n "${clst_livecd_splash_theme}" ]
174                                 then
175                                         echo "kernel /boot/${x} ${default_append_line} vga=791 dokeymap splash=silent,theme:${clst_livecd_splash_theme}" >> ${icfg}
176                                 else
177                                         echo "kernel /boot/${x} ${default_append_line} vga=791 dokeymap splash=silent" >> ${icfg}
178                                 fi
179
180                                 if [ -e $1/boot/${x}.igz ]
181                                 then
182                                         echo "initrd /boot/${x}.igz" >> ${icfg}
183                                 fi
184                                 
185                                 echo >> ${icfg}
186                                 echo "title ${x} [ No FrameBuffer ]" >> ${icfg}
187                                 echo "kernel ${x} /boot/${x} ${default_append_line}" >> ${icfg}
188                                 if [ -e $1/boot/${x}.igz ]
189                                 then
190                                         echo "initrd /boot/${x}.igz" >> ${icfg}
191                                 fi
192                         done
193
194                         if [ -f $1/boot/memtest86 ]
195                         then
196                                 echo >> ${icfg}
197                                 echo "title memtest86" >> ${icfg}
198                                 echo "kernel /boot/memtest86" >> ${icfg}
199                         fi
200                 fi
201                 ;;
202 esac
203 exit $?