~ilya-yanok/ubuntu/oneiric/grub2/fix-for-948716

« back to all changes in this revision

Viewing changes to debian/hwmatch.lua

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2011-04-01 17:35:59 UTC
  • mfrom: (17.3.49 sid)
  • Revision ID: james.westby@ubuntu.com-20110401173559-774t7k0suhw04nzh
Tags: 1.99~rc1-8ubuntu1
* Resynchronise with Debian.  Remaining changes:
  - Adjust for default Ubuntu boot options ("quiet splash").
  - Default to hiding the menu; holding down Shift at boot will show it.
  - Set a monochromatic theme and an aubergine background for Ubuntu.
  - Apply Ubuntu GRUB Legacy changes to legacy update-grub script: title,
    recovery mode, quiet option, tweak how memtest86+ is displayed, and
    use UUIDs where appropriate.
  - Fix backslash-escaping in merge_debconf_into_conf.
  - Remove "GNU/Linux" from default distributor string.
  - Add crashkernel option.
  - Bypass menu unless other OSes are installed or Shift is pressed.
  - Allow Shift to interrupt 'sleep --interruptible'.
  - Reduce visual clutter in normal mode.
  - Remove verbose messages printed before reading configuration.
  - Suppress kernel/initrd progress messages, except in recovery mode.
  - Handle filesystems loop-mounted on file images.
  - Ignore devices loop-mounted from files in Linux grub.d scripts.
  - Show the boot menu if the previous boot failed.
  - Don't generate device.map during grub-install or grub-mkconfig.
  - Adjust upgrade version checks for Ubuntu.
  - Suppress "GRUB loading" message unless Shift is held down.
  - Adjust versions of grub-doc and grub-legacy-doc conflicts.
  - Fix LVM/RAID probing in the absence of /boot/grub/device.map.
  - Look for .mo files in /usr/share/locale-langpack first.
  - Build-depend on qemu-kvm rather than qemu-system for grub-pc tests.
  - Add a grub-rescue-efi-amd64 package.
  - On Wubi, don't ask for an install device, but just update wubildr
    using the diverted grub-install.
  - Check hardware support before using gfxpayload=keep.
  - Build part_msdos and vfat into EFI boot images.
  - Put second and subsequent Linux menu entries in a submenu.
  - Preferred resolution detection for VBE.
  - Set vt.handoff=7 for smooth handoff to kernel graphical mode.
* Drop patch to use qemu rather than qemu-system-i386, now that qemu-kvm
  ships a symlink.
* Rewrite hwmatch.lua in C.  Drop lua grub-extras module.
* Update ubuntu_vbe_autodetect.patch, bringing GRUB_GFXMODE documentation
  up to date.
* Fix use of freed memory when replacing existing loopback device
  (LP: #742967).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!lua
2
 
 
3
 
matches_file = grub.getenv("matches_file")
4
 
class_match = tonumber(grub.getenv("class_match"))
5
 
 
6
 
match = 0
7
 
 
8
 
function test_device(bus, dev, func, pciid, subpciid, class)
9
 
   baseclass = bit.rshift(class, 24)
10
 
 
11
 
   if (class_match and class_match ~= baseclass) then return end
12
 
 
13
 
   vendor = bit.band(0xffff, pciid)
14
 
   device = bit.rshift(pciid, 16)
15
 
   subvendor = bit.band(0xffff, subpciid)
16
 
   subdevice = bit.rshift(subpciid, 16)
17
 
   subclass = bit.band(0xff, bit.rshift(class, 16))
18
 
 
19
 
   id = string.format("v%04xd%04xsv%04xsd%04xbc%02xsc%02x",
20
 
                      vendor,
21
 
                      device,
22
 
                      subvendor,
23
 
                      subdevice,
24
 
                      baseclass,
25
 
                      subclass)
26
 
 
27
 
   matches = grub.file_open(matches_file)
28
 
 
29
 
   while (not grub.file_eof(matches)) do
30
 
      line = grub.file_getline(matches)
31
 
      if (line ~= "" and string.find(id, string.format("^%s$", line))) then
32
 
         match = 1
33
 
         return 1
34
 
      end
35
 
   end
36
 
end
37
 
 
38
 
if (grub.file_exist(matches_file)) then
39
 
   grub.enum_pci(test_device)
40
 
end
41
 
 
42
 
grub.setenv("match", match)