~darkmuggle-deactivatedaccount/ubuntu/quantal/grub2/fix-872244

« back to all changes in this revision

Viewing changes to efiemu/prepare.c

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2010-01-11 11:12:55 UTC
  • mfrom: (17.3.7 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100111111255-lr8ebkqw5x41gq6j
Tags: 1.98~20100101-1ubuntu1
* 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 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.
  - Conflict with grub (<< 0.97-54) as well as grub-legacy.
  - Fix backslash-escaping in merge_debconf_into_conf.
  - Remove "GNU/Linux" from default distributor string.
  - Add crashkernel= options if kdump and makedumpfile are available.
  - If other operating systems are installed, then automatically unhide
    the menu. Otherwise, if GRUB_HIDDEN_TIMEOUT is 0, then use keystatus
    if available to check whether Shift is pressed. If it is, show the
    menu, otherwise boot immediately. If keystatus is not available, then
    fall back to a short delay interruptible with Escape.
  - Allow Shift to interrupt 'sleep --interruptible'.
  - Don't display introductory message about line editing unless we're
    actually offering a shell prompt. Don't clear the screen just before
    booting if we never drew the menu in the first place.
  - Remove some verbose messages printed before reading the configuration
    file.
  - If the environment variable "quiet" is set to something other than 0,
    suppress progress messages as the kernel and initrd load. Set this for
    non-recovery kernel menu entries.
  - Add GRUB_DEFAULT=saved, as well as grub-set-default and grub-reboot
    utilities. Provides functionality essentially equivalent to GRUB
    Legacy's savedefault.
  - Keep the loopback file open so that subsequent changes to the "root"
    environment variable don't affect it.
  - Change prepare_grub_to_access_device to handle filesystems
    loop-mounted on file images.
  - Ignore devices loop-mounted from files in 10_linux.
  - Show the boot menu if the previous boot failed, that is if it failed
    to get to the end of one of the normal runlevels.
  - Handle RAID devices containing virtio components.
* Update savedefault patch from current Bazaar branch, fixing grub-reboot
  to have distinct behaviour from grub-set-default (LP: #497326).
* Fix grub-mkisofs compilation error with FORTIFY_SOURCE.
* Convert recordfail boilerplate in each menu entry to use a function.

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
 
37
37
  int cntconftables = 0;
38
38
  struct SUFFIX (grub_efiemu_configuration_table) *conftables = 0;
39
 
  struct SUFFIX (grub_efiemu_runtime_services) *runtime_services;
40
39
  int i;
41
40
  int handle;
42
41
  grub_off_t off;
54
53
  /* Switch from phase 1 (counting) to phase 2 (real job) */
55
54
  grub_efiemu_alloc_syms ();
56
55
  grub_efiemu_mm_do_alloc ();
 
56
  grub_efiemu_write_sym_markers ();
57
57
 
58
58
  grub_efiemu_system_table32 = 0;
59
59
  grub_efiemu_system_table64 = 0;
81
81
    = (struct SUFFIX (grub_efi_system_table) *)
82
82
    ((grub_uint8_t *) grub_efiemu_mm_obtain_request (handle) + off);
83
83
 
84
 
  /* compute CRC32 of runtime_services */
85
 
  if ((err = grub_efiemu_resolve_symbol ("efiemu_runtime_services",
86
 
                                         &handle, &off)))
87
 
    return err;
88
 
  runtime_services = (struct SUFFIX (grub_efiemu_runtime_services) *)
89
 
        ((grub_uint8_t *) grub_efiemu_mm_obtain_request (handle) + off);
90
 
  runtime_services->hdr.crc32 = 0;
91
 
  runtime_services->hdr.crc32 = grub_getcrc32
92
 
    (0, runtime_services, runtime_services->hdr.header_size);
93
 
 
94
84
  /* Put pointer to the list of configuration tables in system table */
95
85
  grub_efiemu_write_value
96
86
    (&(SUFFIX (grub_efiemu_system_table)->configuration_table), 0,
113
103
        conftables[i].vendor_table = PTR_TO_UINT64 (cur->data);
114
104
    }
115
105
 
 
106
  err = SUFFIX (grub_efiemu_crc) ();
 
107
  if (err)
 
108
    {
 
109
      grub_efiemu_unload ();
 
110
      return err;
 
111
    }
 
112
 
 
113
  grub_dprintf ("efiemu","system_table = %p, conftables = %p (%d entries)\n",
 
114
                SUFFIX (grub_efiemu_system_table), conftables, cntconftables);
 
115
 
 
116
  return GRUB_ERR_NONE;
 
117
}
 
118
 
 
119
grub_err_t
 
120
SUFFIX (grub_efiemu_crc) (void)
 
121
{
 
122
  grub_err_t err;
 
123
  int handle;
 
124
  grub_off_t off;
 
125
  struct SUFFIX (grub_efiemu_runtime_services) *runtime_services;
 
126
 
 
127
  /* compute CRC32 of runtime_services */
 
128
  err = grub_efiemu_resolve_symbol ("efiemu_runtime_services",
 
129
                                    &handle, &off);
 
130
  if (err)
 
131
    return err;
 
132
 
 
133
  runtime_services = (struct SUFFIX (grub_efiemu_runtime_services) *)
 
134
        ((grub_uint8_t *) grub_efiemu_mm_obtain_request (handle) + off);
 
135
  runtime_services->hdr.crc32 = 0;
 
136
  runtime_services->hdr.crc32 = grub_getcrc32
 
137
    (0, runtime_services, runtime_services->hdr.header_size);
 
138
 
 
139
  err = grub_efiemu_resolve_symbol ("efiemu_system_table", &handle, &off);
 
140
  if (err)
 
141
    return err;
 
142
 
116
143
  /* compute CRC32 of system table */
117
144
  SUFFIX (grub_efiemu_system_table)->hdr.crc32 = 0;
118
145
  SUFFIX (grub_efiemu_system_table)->hdr.crc32
119
146
    = grub_getcrc32 (0, SUFFIX (grub_efiemu_system_table),
120
147
                     SUFFIX (grub_efiemu_system_table)->hdr.header_size);
121
148
 
122
 
  grub_dprintf ("efiemu","system_table = %p, runtime_services = %p,"
123
 
                " conftables = %p (%d entries)\n",
124
 
                SUFFIX (grub_efiemu_system_table), runtime_services,
125
 
                conftables, cntconftables);
 
149
  grub_dprintf ("efiemu","system_table = %p, runtime_services = %p\n",
 
150
                SUFFIX (grub_efiemu_system_table), runtime_services);
126
151
 
127
152
  return GRUB_ERR_NONE;
128
153
}