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