~ubuntu-branches/ubuntu/trusty/grub2/trusty

« back to all changes in this revision

Viewing changes to docs/osdetect.cfg

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2014-01-16 15:18:04 UTC
  • mfrom: (17.6.38 experimental)
  • Revision ID: package-import@ubuntu.com-20140116151804-3foouk7fpqcq3sxx
Tags: 2.02~beta2-2
* Convert patch handling to git-dpm.
* Add bi-endian support to ELF parser (Tomohiro B Berry).
* Adjust restore_mkdevicemap.patch to mark get_kfreebsd_version as static,
  to appease "gcc -Werror=missing-prototypes".
* Cherry-pick from upstream:
  - Change grub-macbless' manual page section to 8.
* Install grub-glue-efi, grub-macbless, grub-render-label, and
  grub-syslinux2cfg.
* grub-shell: Pass -no-pad to xorriso when building floppy images.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Sample GRUB script to autodetect operating systems
 
2
#
 
3
# Copyright (C) 2010  Free Software Foundation, Inc.
 
4
#
 
5
# GRUB is free software: you can redistribute it and/or modify
 
6
# it under the terms of the GNU General Public License as published by
 
7
# the Free Software Foundation, either version 3 of the License, or
 
8
# (at your option) any later version.
 
9
#
 
10
# GRUB is distributed in the hope that it will be useful,
 
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
# GNU General Public License for more details.
 
14
#
 
15
# You should have received a copy of the GNU General Public License
 
16
# along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
 
17
 
 
18
set saved_root=$root
 
19
 
 
20
function freebsd_ufs_variants {
 
21
    set device=$1
 
22
    set fstype=$2
 
23
    set uuid=$3
 
24
 
 
25
    menuentry "FreeBSD (on $fstype $device)" $device $uuid {
 
26
        set root=$2
 
27
        set uuid=$3
 
28
 
 
29
        freebsd /boot/kernel/kernel
 
30
        set FreeBSD.acpi_load=YES
 
31
        set FreeBSD.hint.acpi.0.disabled=0
 
32
        set FreeBSD.vfs.root.mountfrom=ufs:ufsid/$uuid
 
33
        frebsd_loadenv /boot/device.hints
 
34
    }
 
35
 
 
36
    menuentry "FreeBSD (on $fstype $device) (single)" $device $uuid {
 
37
        set root=$2
 
38
        set uuid=$3
 
39
 
 
40
        freebsd /boot/kernel/kernel --single
 
41
        set FreeBSD.acpi_load=YES
 
42
        set FreeBSD.hint.acpi.0.disabled=0
 
43
        set FreeBSD.vfs.root.mountfrom=ufs:ufsid/$uuid
 
44
        frebsd_loadenv /boot/device.hints
 
45
    }
 
46
 
 
47
    menuentry "FreeBSD (on $fstype $device) (verbose)" $device $uuid {
 
48
        set root=$2
 
49
        set uuid=$3
 
50
 
 
51
        freebsd /boot/kernel/kernel --verbose
 
52
        set FreeBSD.acpi_load=YES
 
53
        set FreeBSD.hint.acpi.0.disabled=0
 
54
        set FreeBSD.vfs.root.mountfrom=ufs:ufsid/$uuid
 
55
        frebsd_loadenv /boot/device.hints
 
56
    }
 
57
 
 
58
    menuentry "FreeBSD (on $fstype $device) (without ACPI)" $device $uuid {
 
59
        set root=$2
 
60
        set uuid=$3
 
61
 
 
62
        freebsd /boot/kernel/kernel --verbose
 
63
        unset FreeBSD.acpi_load
 
64
        set FreeBSD.hint.acpi.0.disabled=1
 
65
        set FreeBSD.loader.acpi_disabled_by_user=1
 
66
        set FreeBSD.vfs.root.mountfrom=ufs:ufsid/$uuid
 
67
        frebsd_loadenv /boot/device.hints
 
68
    }
 
69
 
 
70
    menuentry "FreeBSD (on $fstype $device) (safe mode)" $device $uuid {
 
71
        set root=$2
 
72
        set uuid=$3
 
73
 
 
74
        freebsd /boot/kernel/kernel --verbose
 
75
        unset FreeBSD.acpi_load
 
76
        set FreeBSD.hint.acpi.0.disabled=1
 
77
        set FreeBSD.loader.acpi_disabled_by_user=1
 
78
        set FreeBSD.hint.apic.0.disabled=1
 
79
        set FreeBSD.hw.ata.ata_dma=0
 
80
        set FreeBSD.hw.ata.atapi_dma=0
 
81
        set FreeBSD.hw.ata.wc=0
 
82
        set FreeBSD.hw.eisa_slots=0
 
83
        set FreeBSD.hint.kbdmux.0.disabled=1
 
84
        set FreeBSD.vfs.root.mountfrom=ufs:ufsid/$uuid
 
85
        frebsd_loadenv /boot/device.hints
 
86
    }
 
87
}
 
88
 
 
89
function freebsd_zfs_variants {
 
90
    set device=$1
 
91
    set fstype=zfs
 
92
 
 
93
    menuentry "FreeBSD (on $fstype $device)" $device {
 
94
        set root=$2
 
95
 
 
96
        freebsd /@/boot/kernel/kernel
 
97
        set FreeBSD.acpi_load=YES
 
98
        set FreeBSD.hint.acpi.0.disabled=0
 
99
        freebsd_module_elf /@/boot/kernel/opensolaris.ko
 
100
        freebsd_module_elf /@/boot/kernel/zfs.ko
 
101
        freebsd_module /@/boot/zfs/zpool.cache type=/boot/zfs/zpool.cache
 
102
        probe -l -s name $root
 
103
        set FreeBSD.vfs.root.mountfrom=zfs:$name
 
104
        freebsd_loadenv /@/boot/device.hints
 
105
    }
 
106
 
 
107
    menuentry "FreeBSD (on $fstype $device) (single)" $device {
 
108
        set root=$2
 
109
 
 
110
        freebsd /@/boot/kernel/kernel --single
 
111
        set FreeBSD.acpi_load=YES
 
112
        set FreeBSD.hint.acpi.0.disabled=0
 
113
        freebsd_module_elf /@/boot/kernel/opensolaris.ko
 
114
        freebsd_module_elf /@/boot/kernel/zfs.ko
 
115
        freebsd_module /@/boot/zfs/zpool.cache type=/boot/zfs/zpool.cache
 
116
        probe -l -s name $root
 
117
        set FreeBSD.vfs.root.mountfrom=zfs:$name
 
118
        freebsd_loadenv /@/boot/device.hints
 
119
    }
 
120
 
 
121
    menuentry "FreeBSD (on $fstype $device) (verbose)" $device {
 
122
        set root=$2
 
123
 
 
124
        freebsd /@/boot/kernel/kernel --verbose
 
125
        set FreeBSD.acpi_load=YES
 
126
        set FreeBSD.hint.acpi.0.disabled=0
 
127
        freebsd_module_elf /@/boot/kernel/opensolaris.ko
 
128
        freebsd_module_elf /@/boot/kernel/zfs.ko
 
129
        freebsd_module /@/boot/zfs/zpool.cache type=/boot/zfs/zpool.cache
 
130
        probe -l -s name $root
 
131
        set FreeBSD.vfs.root.mountfrom=zfs:$name
 
132
        freebsd_loadenv /@/boot/device.hints
 
133
    }
 
134
 
 
135
    menuentry "FreeBSD (on $fstype $device) (without ACPI)" $device {
 
136
        set root=$2
 
137
 
 
138
        freebsd /@/boot/kernel/kernel --verbose
 
139
        unset FreeBSD.acpi_load
 
140
        set FreeBSD.hint.acpi.0.disabled=1
 
141
        set FreeBSD.loader.acpi_disabled_by_user=1
 
142
        freebsd_module_elf /@/boot/kernel/opensolaris.ko
 
143
        freebsd_module_elf /@/boot/kernel/zfs.ko
 
144
        freebsd_module /@/boot/zfs/zpool.cache type=/boot/zfs/zpool.cache
 
145
        probe -l -s name $root
 
146
        set FreeBSD.vfs.root.mountfrom=zfs:$name
 
147
        freebsd_loadenv /@/boot/device.hints
 
148
    }
 
149
 
 
150
    menuentry "FreeBSD (on $fstype $device) (safe mode)" $device {
 
151
        set root=$2
 
152
 
 
153
        freebsd /@/boot/kernel/kernel --verbose
 
154
        unset FreeBSD.acpi_load
 
155
        set FreeBSD.hint.acpi.0.disabled=1
 
156
        set FreeBSD.loader.acpi_disabled_by_user=1
 
157
        set FreeBSD.hint.apic.0.disabled=1
 
158
        set FreeBSD.hw.ata.ata_dma=0
 
159
        set FreeBSD.hw.ata.atapi_dma=0
 
160
        set FreeBSD.hw.ata.wc=0
 
161
        set FreeBSD.hw.eisa_slots=0
 
162
        set FreeBSD.hint.kbdmux.0.disabled=1
 
163
        freebsd_module_elf /@/boot/kernel/opensolaris.ko
 
164
        freebsd_module_elf /@/boot/kernel/zfs.ko
 
165
        freebsd_module /@/boot/zfs/zpool.cache type=/boot/zfs/zpool.cache
 
166
        probe -l -s name $root
 
167
        set FreeBSD.vfs.root.mountfrom=zfs:$name
 
168
        freebsd_loadenv /@/boot/device.hints
 
169
    }
 
170
}
 
171
 
 
172
insmod regexp
 
173
for dev in (*); do
 
174
    # $device: parenthesis removed from $dev
 
175
    regexp -s device '\((.*)\)' $dev
 
176
    # $fstype: filesystem type identified
 
177
    probe -s fstype -f $dev
 
178
    # uuid: filesystem UUID
 
179
    probe -s uuid -u $dev
 
180
 
 
181
    if test -f ($device)/isolinux/isolinux.cfg ; then
 
182
        menuentry "ISOLINUX config (on $device)" $device {
 
183
            set root=$2
 
184
            syslinux_configfile -i /isolinux/isolinux.cfg
 
185
        }
 
186
    fi
 
187
    if test -f ($device)/bootmgr -a -f ($device)/boot/bcd; then
 
188
        menuentry "Windows Vista bootmgr (on $device)" $device {
 
189
            set root=$2
 
190
            chainloader +1
 
191
        }
 
192
    elif test -f ($device)/ntldr -a \
 
193
        -e ($device)/ntdetect.com -a -f ($device)/boot.ini; then
 
194
        menuentry "Windows NT/2000/XP loader (on $device)" $device {
 
195
            set root=$2
 
196
            regexp -s devnum 'hd([0-9]+)' $root
 
197
            if test "$devnum" != "0"; then
 
198
                drivemap -s hd0 $root
 
199
            fi
 
200
            chainloader +1
 
201
        }
 
202
    elif test -f ($device)/windows/win.com; then
 
203
        menuentry "Windows 98/ME (on $device)" $device {
 
204
            set root=$2
 
205
            regexp -s devnum 'hd([0-9]+)' $root
 
206
            if test "$devnum" != "0"; then
 
207
                drivemap -s hd0 $root
 
208
            fi
 
209
            chainloader +1
 
210
        }
 
211
    elif test -f ($device)/io.sys -a -f ($device)/command.com; then
 
212
        menuentry "MS-DOS (on $device)" $device {
 
213
            set root=$2
 
214
            regexp -s devnum 'hd([0-9]+)' $root
 
215
            if test "$devnum" != "0"; then
 
216
                drivemap -s hd0 $root
 
217
            fi
 
218
            chainloader +1
 
219
        }
 
220
    elif test -f ($device)/kernel.sys; then
 
221
        menuentry "FreeDOS (on $device)" $device {
 
222
            set root=$2
 
223
            regexp -s type '([fh])d[0-9]+' $root
 
224
            regexp -s devnum '[fh]d([0-9]+)' $root
 
225
            if test $type = 'h' -a "$devnum" != "0"; then
 
226
                drivemap -s hd0 $root
 
227
            fi
 
228
            chainloader +1
 
229
        }
 
230
    elif test "$fstype" = ufs1 -o "$fstype" = ufs2 -a \
 
231
        -e ($device)/boot/kernel/kernel -a \
 
232
        -e ($device)/boot/device.hints; then
 
233
 
 
234
        freebsd_ufs_variants $device $fstype $uuid
 
235
 
 
236
    elif test "$fstype" = zfs -a \
 
237
        -e ($device)/@/boot/kernel/kernel -a \
 
238
        -e ($device)/@/boot/device.hints; then
 
239
 
 
240
        freebsd_zfs_variants $device
 
241
 
 
242
    elif test "$fstype" = hfsplus -a -f ($device)/mach_kernel; then
 
243
        menuentry "Mac OS X/Darwin" $device $uuid {
 
244
            set root=$2
 
245
            set uuid=$3
 
246
 
 
247
            insmod vbe
 
248
            do_resume=0
 
249
            if [ /var/vm/sleepimage -nt10 / ]; then
 
250
                if xnu_resume /var/vm/sleepimage; then
 
251
                    do_resume=1
 
252
                fi
 
253
            fi
 
254
            if [ $do_resume = 1 ]; then
 
255
                xnu_uuid $uuid uuid
 
256
                if [ -f /Extra/DSDT.aml ]; then
 
257
                    acpi -e /Extra/DSDT.aml
 
258
                fi
 
259
                xnu_kernel /mach_kernel boot-uuid=${uuid} rd=*uuid
 
260
                if [ /System/Library/Extensions.mkext -nt /System/Library/Extensions ]; then
 
261
                    xnu_mkext /System/Library/Extensions.mkext
 
262
                else
 
263
                    xnu_mkext /System/Library/Extensions
 
264
                fi
 
265
                if [ -f /Extra/Extensions.mkext ]; then
 
266
                    xnu_mkext /Extra/Extensions.mkext
 
267
                fi
 
268
                if [ -d /Extra/Extensions ]; then
 
269
                    xnu_kextdir /Extra/Extensions
 
270
                fi
 
271
                if [ -f /Extra/devtree.txt ]; then
 
272
                    xnu_devtree /Extra/devtree.txt
 
273
                fi
 
274
                if [ -f /Extra/splash.jpg ]; then
 
275
                    insmod jpeg
 
276
                    xnu_splash /Extra/splash.jpg
 
277
                fi
 
278
                if [ -f /Extra/splash.png ]; then
 
279
                    insmod png
 
280
                    xnu_splash /Extra/splash.png
 
281
                fi
 
282
                if [ -f /Extra/splash.tga ]; then
 
283
                    insmod tga
 
284
                    xnu_splash /Extra/splash.tga
 
285
                fi
 
286
            fi
 
287
        }
 
288
    else
 
289
        set root=$device
 
290
        for file in /boot/vmlinuz-* /boot/linux-*; do
 
291
            if test -f $file; then
 
292
                regexp -s version '/boot/vmlinuz-(.*)' $file
 
293
                regexp -s version '/boot/linux-(.*)' $file
 
294
 
 
295
                menuentry "Linux $file" $device $uuid $file $version {
 
296
                    set root=$2
 
297
                    set uuid=$3
 
298
                    set kernel=$4
 
299
                    set version=$5
 
300
 
 
301
                    linux $kernel root=UUID=$uuid ro
 
302
                    if test -f /boot/initrd-$version.img; then
 
303
                        initrd /boot/initrd-$version.img
 
304
                    elif test -f /boot/initrd.img-$version; then
 
305
                        initrd /boot/initrd.img-$version
 
306
                    elif test -f /boot/initrd-$version; then
 
307
                        initrd /boot/initrd-$version
 
308
                    fi
 
309
                }
 
310
 
 
311
                menuentry "Linux $file (single)" $device $uuid $file $version {
 
312
                    set root=$2
 
313
                    set uuid=$3
 
314
                    set kernel=$4
 
315
                    set version=$5
 
316
 
 
317
                    linux $kernel root=UUID=$uuid ro single
 
318
                    if test -f /boot/initrd-$version.img; then
 
319
                        initrd /boot/initrd-$version.img
 
320
                    elif test -f /boot/initrd.img-$version; then
 
321
                        initrd /boot/initrd.img-$version
 
322
                    elif test -f /boot/initrd-$version; then
 
323
                        initrd /boot/initrd-$version
 
324
                    fi
 
325
                }
 
326
            fi
 
327
        done
 
328
    fi
 
329
done
 
330
 
 
331
set root=$saved_root