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