Magellan Linux

Annotation of /smage/branches/alx-0_6_0/core/grub/alx/files/10_alx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4843 - (hide annotations) (download)
Mon May 13 12:00:07 2013 UTC (11 years ago) by niro
File size: 7608 byte(s)
-fixed a typo i815->i845
1 niro 2542 #! /bin/sh
2     set -e
3    
4     # grub-mkconfig helper script.
5     # Copyright (C) 2006,2007,2008,2009,2010 Free Software Foundation, Inc.
6     #
7     # GRUB is free software: you can redistribute it and/or modify
8     # it under the terms of the GNU General Public License as published by
9     # the Free Software Foundation, either version 3 of the License, or
10     # (at your option) any later version.
11     #
12     # GRUB is distributed in the hope that it will be useful,
13     # but WITHOUT ANY WARRANTY; without even the implied warranty of
14     # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15     # GNU General Public License for more details.
16     #
17     # You should have received a copy of the GNU General Public License
18     # along with GRUB. If not, see <http://www.gnu.org/licenses/>.
19    
20     prefix=/usr
21     exec_prefix=${prefix}
22     bindir=/bin
23     libdir=/lib
24     . ${libdir}/grub/grub-mkconfig_lib
25    
26     export TEXTDOMAIN=grub
27     export TEXTDOMAINDIR=${prefix}/share/locale
28    
29     CLASS="--class gnu-linux --class gnu --class os"
30    
31 niro 3251 if [ "x${GRUB_CMDLINE_ALX_HWDETECT}" = "x" ]; then
32     GRUB_CMDLINE_ALX_HWDETECT="splash=verbose,theme=default hardware-auto-detection"
33     fi
34    
35     if [ "x${GRUB_CMDLINE_ALX_RESET}" = "x" ]; then
36     GRUB_CMDLINE_ALX_RESET="splash=verbose,theme=default alx-reset-settings"
37     fi
38    
39     if [ "x${GRUB_ALX_FB_FALLBACK}" = "x" ]; then
40     # use vesafb instead of uvesafb, 1024x768-16@60
41     GRUB_ALX_FB_FALLBACK="video=vesafb:mtrr:3,ywrap vga=791"
42     fi
43    
44 niro 2542 if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
45     OS=ALX
46     else
47     OS="${GRUB_DISTRIBUTOR}"
48     CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1) ${CLASS}"
49     fi
50    
51     if [ "x${GRUB_DEVICE_UUID}" = "x" ] || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \
52     || ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" \
53     || uses_abstraction "${GRUB_DEVICE}" lvm; then
54     LINUX_ROOT_DEVICE=${GRUB_DEVICE}
55     else
56     LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
57     fi
58    
59     if [ "x`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2>/dev/null || true`" = xbtrfs ]; then
60     rootsubvol="`make_system_path_relative_to_its_root /`"
61     rootsubvol="${rootsubvol#/}"
62     if [ "x${rootsubvol}" != x ]; then
63     GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}"
64     fi
65     fi
66    
67 niro 2732 # check for special hardware
68     if [ -x "`which hwinfo`" ]
69 niro 3251 then
70     hwinfo="`hwinfo --bios --storage --pci`"
71    
72 niro 2732 # zotac
73 niro 3251 if [ "x`echo ${hwinfo} | grep -i zotac 2> /dev/null || true`" != x ]
74 niro 2732 then
75     GRUB_CMDLINE_LINUX="rootdelay=8 ${GRUB_CMDLINE_LINUX}"
76 niro 3358 # use noop scheduler on flash memory drivers for better i/o perfomance
77     GRUB_CMDLINE_LINUX="elevator=noop ${GRUB_CMDLINE_LINUX}"
78 niro 2732 fi
79 niro 3251
80     # rangee / VIA CLE-266 chipset
81     if [ "x`echo ${hwinfo} | grep -i CLE266 2> /dev/null || true`" != x ]
82     then
83     # use fallback
84     GRUB_CMDLINE_LINUX="${GRUB_ALX_FB_FALLBACK} ${GRUB_CMDLINE_LINUX}"
85 niro 3358 # use noop scheduler on flash memory drivers for better i/o perfomance
86     GRUB_CMDLINE_LINUX="elevator=noop ${GRUB_CMDLINE_LINUX}"
87 niro 3251 fi
88 niro 3261
89     # maxdata / Intel i810 / i815 chipset
90 niro 3355 if [ "x`echo ${hwinfo} | grep -i i810 2> /dev/null || true`" != x ]
91 niro 3261 then
92     # disable KMS
93     GRUB_CMDLINE_LINUX="nomodeset ${GRUB_CMDLINE_LINUX}"
94     fi
95 niro 3355 if [ "x`echo ${hwinfo} | grep -i i815 2> /dev/null || true`" != x ]
96 niro 3261 then
97     # disable KMS
98     GRUB_CMDLINE_LINUX="nomodeset ${GRUB_CMDLINE_LINUX}"
99     fi
100 niro 3356
101     # disable bootsplash for i845, which must have kms, but fbmode is not supported with kms
102 niro 4843 if [ "x`echo ${hwinfo} | grep -i i845 2> /dev/null || true`" != x ]
103 niro 3356 then
104     GRUB_CMDLINE_LINUX="splash=verbose,theme=default ${GRUB_CMDLINE_LINUX}"
105     fi
106 niro 3357
107     # disable KMS for Radeon RV250
108     if [ "x`echo ${hwinfo} | grep -i rv250 2> /dev/null || true`" != x ]
109     then
110     GRUB_CMDLINE_LINUX="nomodeset ${GRUB_CMDLINE_LINUX}"
111     fi
112 niro 2732 fi
113 niro 3535 # check for intel-kms
114     if [ -e /proc/fb ]
115     then
116 niro 3542 if [ x"`grep inteldrmfb /proc/fb`" != "x" ]
117 niro 3535 then
118     # unset framebuffer, use KMS
119     export GRUB_GFXPAYLOAD_LINUX=""
120     fi
121     fi
122 niro 2732
123 niro 2542 linux_entry ()
124     {
125     os="$1"
126     version="$2"
127     recovery="$3"
128     args="$4"
129 niro 3453 entry_args="$5"
130 niro 2542 if ${recovery} ; then
131     title="$(gettext_quoted "%s [ %s ] (recovery mode)")"
132     else
133     title="$(gettext_quoted "%s [ %s ]")"
134     fi
135 niro 3453 printf "menuentry '${title}' ${CLASS} ${entry_args} {\n" "${os}" "${version}"
136 niro 2542 if ! ${recovery} ; then
137     save_default_entry | sed -e "s/^/\t/"
138     fi
139    
140     # Use ELILO's generic "efifb" when it's known to be available.
141     # FIXME: We need an interface to select vesafb in case efifb can't be used.
142     if [ "x$GRUB_GFXPAYLOAD_LINUX" = x ]; then
143     cat << EOF
144     load_video
145     EOF
146     else
147     if [ "x$GRUB_GFXPAYLOAD_LINUX" != xtext ]; then
148     cat << EOF
149     load_video
150     EOF
151     fi
152     cat << EOF
153     set gfxpayload=$GRUB_GFXPAYLOAD_LINUX
154     EOF
155     fi
156    
157     cat << EOF
158     insmod gzio
159     EOF
160    
161     if [ x$dirname = x/ ]; then
162     if [ -z "${prepare_root_cache}" ]; then
163     prepare_root_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE} | sed -e "s/^/\t/")"
164     fi
165     printf '%s\n' "${prepare_root_cache}"
166     else
167     if [ -z "${prepare_boot_cache}" ]; then
168     prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")"
169     fi
170     printf '%s\n' "${prepare_boot_cache}"
171     fi
172     message="$(gettext_printf "Loading Linux %s ..." ${version})"
173     cat << EOF
174     echo '$message'
175     linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
176     EOF
177     if test -n "${initrd}" ; then
178     message="$(gettext_printf "Loading initial ramdisk ...")"
179     cat << EOF
180     echo '$message'
181     initrd ${rel_dirname}/${initrd}
182     EOF
183     fi
184     cat << EOF
185     }
186     EOF
187     }
188    
189     case x`uname -m` in
190     xi?86 | xx86_64)
191     list=`for i in /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* ; do
192     if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
193     done` ;;
194     *)
195     list=`for i in /boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* /boot/kernel-* ; do
196     if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
197     done` ;;
198     esac
199    
200     prepare_boot_cache=
201     prepare_root_cache=
202    
203     while [ "x$list" != "x" ] ; do
204     linux=`version_find_latest $list`
205     echo "Found linux image: $linux" >&2
206     basename=`basename $linux`
207     dirname=`dirname $linux`
208     rel_dirname=`make_system_path_relative_to_its_root $dirname`
209     version=`echo $basename | sed -e "s,^[^0-9]*-,,g"`
210     alt_version=`echo $version | sed -e "s,\.old$,,g"`
211     linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
212    
213     initrd=
214     for i in "initrd-${version}.img" \
215     "initramfs-${version}.img" \
216     "initrd-${alt_version}.img" \
217     "initramfs-${alt_version}.img"; do
218     if test -e "${dirname}/${i}" ; then
219     initrd="$i"
220     break
221     fi
222     done
223    
224     config=
225     for i in "${dirname}/config-${version}" "${dirname}/config-${alt_version}" "/etc/kernels/kernel-config-${version}" ; do
226     if test -e "${i}" ; then
227     config="${i}"
228     break
229     fi
230     done
231    
232     initramfs=
233     if test -n "${config}" ; then
234     initramfs=`grep CONFIG_INITRAMFS_SOURCE= "${config}" | cut -f2 -d= | tr -d \"`
235     fi
236    
237     if test -n "${initrd}" ; then
238     echo "Found initrd image: ${dirname}/${initrd}" >&2
239     elif test -z "${initramfs}" ; then
240     # "UUID=" magic is parsed by initrd or initramfs. Since there's
241     # no initrd or builtin initramfs, it can't work here.
242     linux_root_device_thisversion=${GRUB_DEVICE}
243     fi
244    
245     linux_entry "${OS}" "${version}" false \
246 niro 3453 "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" ""
247 niro 2542
248 niro 3251 linux_entry "${OS} - Re-run hardware detection" "${version}" false \
249 niro 3520 "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT} ${GRUB_CMDLINE_ALX_HWDETECT}" "--users alx"
250 niro 3251
251     linux_entry "${OS} - Reset *all* local settings" "${version}" false \
252 niro 3520 "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT} ${GRUB_CMDLINE_ALX_RESET}" "--users alx"
253 niro 3251
254 niro 2542 list=`echo $list | tr ' ' '\n' | grepvx $linux | tr '\n' ' '`
255     done