Contents of /smage/branches/alx-0_6_0/core/grub/alx/files/10_alx
Parent Directory | Revision Log
Revision 2732 -
(show annotations)
(download)
Thu Aug 11 14:46:07 2011 UTC (13 years, 1 month ago) by niro
File size: 5388 byte(s)
Thu Aug 11 14:46:07 2011 UTC (13 years, 1 month ago) by niro
File size: 5388 byte(s)
-let grub search for special boot params for zotac devices and co
1 | #! /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 | if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then |
32 | OS=ALX |
33 | else |
34 | OS="${GRUB_DISTRIBUTOR}" |
35 | CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1) ${CLASS}" |
36 | fi |
37 | |
38 | if [ "x${GRUB_DEVICE_UUID}" = "x" ] || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \ |
39 | || ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" \ |
40 | || uses_abstraction "${GRUB_DEVICE}" lvm; then |
41 | LINUX_ROOT_DEVICE=${GRUB_DEVICE} |
42 | else |
43 | LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID} |
44 | fi |
45 | |
46 | if [ "x`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2>/dev/null || true`" = xbtrfs ]; then |
47 | rootsubvol="`make_system_path_relative_to_its_root /`" |
48 | rootsubvol="${rootsubvol#/}" |
49 | if [ "x${rootsubvol}" != x ]; then |
50 | GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}" |
51 | fi |
52 | fi |
53 | |
54 | # check for special hardware |
55 | if [ -x "`which hwinfo`" ] |
56 | then |
57 | # zotac |
58 | if [ "x`hwinfo --bios --storage --pci | grep -i zotac 2> /dev/null || true`" != x ] |
59 | then |
60 | GRUB_CMDLINE_LINUX="rootdelay=8 ${GRUB_CMDLINE_LINUX}" |
61 | fi |
62 | fi |
63 | |
64 | linux_entry () |
65 | { |
66 | os="$1" |
67 | version="$2" |
68 | recovery="$3" |
69 | args="$4" |
70 | if ${recovery} ; then |
71 | title="$(gettext_quoted "%s [ %s ] (recovery mode)")" |
72 | else |
73 | title="$(gettext_quoted "%s [ %s ]")" |
74 | fi |
75 | printf "menuentry '${title}' ${CLASS} {\n" "${os}" "${version}" |
76 | if ! ${recovery} ; then |
77 | save_default_entry | sed -e "s/^/\t/" |
78 | fi |
79 | |
80 | # Use ELILO's generic "efifb" when it's known to be available. |
81 | # FIXME: We need an interface to select vesafb in case efifb can't be used. |
82 | if [ "x$GRUB_GFXPAYLOAD_LINUX" = x ]; then |
83 | cat << EOF |
84 | load_video |
85 | EOF |
86 | else |
87 | if [ "x$GRUB_GFXPAYLOAD_LINUX" != xtext ]; then |
88 | cat << EOF |
89 | load_video |
90 | EOF |
91 | fi |
92 | cat << EOF |
93 | set gfxpayload=$GRUB_GFXPAYLOAD_LINUX |
94 | EOF |
95 | fi |
96 | |
97 | cat << EOF |
98 | insmod gzio |
99 | EOF |
100 | |
101 | if [ x$dirname = x/ ]; then |
102 | if [ -z "${prepare_root_cache}" ]; then |
103 | prepare_root_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE} | sed -e "s/^/\t/")" |
104 | fi |
105 | printf '%s\n' "${prepare_root_cache}" |
106 | else |
107 | if [ -z "${prepare_boot_cache}" ]; then |
108 | prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")" |
109 | fi |
110 | printf '%s\n' "${prepare_boot_cache}" |
111 | fi |
112 | message="$(gettext_printf "Loading Linux %s ..." ${version})" |
113 | cat << EOF |
114 | echo '$message' |
115 | linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args} |
116 | EOF |
117 | if test -n "${initrd}" ; then |
118 | message="$(gettext_printf "Loading initial ramdisk ...")" |
119 | cat << EOF |
120 | echo '$message' |
121 | initrd ${rel_dirname}/${initrd} |
122 | EOF |
123 | fi |
124 | cat << EOF |
125 | } |
126 | EOF |
127 | } |
128 | |
129 | case x`uname -m` in |
130 | xi?86 | xx86_64) |
131 | list=`for i in /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* ; do |
132 | if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi |
133 | done` ;; |
134 | *) |
135 | list=`for i in /boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* /boot/kernel-* ; do |
136 | if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi |
137 | done` ;; |
138 | esac |
139 | |
140 | prepare_boot_cache= |
141 | prepare_root_cache= |
142 | |
143 | while [ "x$list" != "x" ] ; do |
144 | linux=`version_find_latest $list` |
145 | echo "Found linux image: $linux" >&2 |
146 | basename=`basename $linux` |
147 | dirname=`dirname $linux` |
148 | rel_dirname=`make_system_path_relative_to_its_root $dirname` |
149 | version=`echo $basename | sed -e "s,^[^0-9]*-,,g"` |
150 | alt_version=`echo $version | sed -e "s,\.old$,,g"` |
151 | linux_root_device_thisversion="${LINUX_ROOT_DEVICE}" |
152 | |
153 | initrd= |
154 | for i in "initrd-${version}.img" \ |
155 | "initramfs-${version}.img" \ |
156 | "initrd-${alt_version}.img" \ |
157 | "initramfs-${alt_version}.img"; do |
158 | if test -e "${dirname}/${i}" ; then |
159 | initrd="$i" |
160 | break |
161 | fi |
162 | done |
163 | |
164 | config= |
165 | for i in "${dirname}/config-${version}" "${dirname}/config-${alt_version}" "/etc/kernels/kernel-config-${version}" ; do |
166 | if test -e "${i}" ; then |
167 | config="${i}" |
168 | break |
169 | fi |
170 | done |
171 | |
172 | initramfs= |
173 | if test -n "${config}" ; then |
174 | initramfs=`grep CONFIG_INITRAMFS_SOURCE= "${config}" | cut -f2 -d= | tr -d \"` |
175 | fi |
176 | |
177 | if test -n "${initrd}" ; then |
178 | echo "Found initrd image: ${dirname}/${initrd}" >&2 |
179 | elif test -z "${initramfs}" ; then |
180 | # "UUID=" magic is parsed by initrd or initramfs. Since there's |
181 | # no initrd or builtin initramfs, it can't work here. |
182 | linux_root_device_thisversion=${GRUB_DEVICE} |
183 | fi |
184 | |
185 | linux_entry "${OS}" "${version}" false \ |
186 | "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" |
187 | |
188 | list=`echo $list | tr ' ' '\n' | grepvx $linux | tr '\n' ' '` |
189 | done |