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

« back to all changes in this revision

Viewing changes to video/i386/pc/vbe.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:
33
33
static struct grub_vbe_info_block controller_info;
34
34
static struct grub_vbe_mode_info_block active_vbe_mode_info;
35
35
 
 
36
/* Track last mode to support cards which fail on get_mode.  */
 
37
static grub_uint32_t last_set_mode = 3;
 
38
 
36
39
static struct
37
40
{
38
41
  struct grub_video_mode_info mode_info;
160
163
  status = grub_vbe_bios_set_mode (vbe_mode, 0);
161
164
  if (status != GRUB_VBE_STATUS_OK)
162
165
    return grub_error (GRUB_ERR_BAD_DEVICE, "cannot set VBE mode %x", vbe_mode);
 
166
  last_set_mode = vbe_mode;
163
167
 
164
168
  /* Save information for later usage.  */
165
169
  framebuffer.active_vbe_mode = vbe_mode;
203
207
        case 8: framebuffer.bytes_per_pixel = 1; break;
204
208
        default:
205
209
          grub_vbe_bios_set_mode (old_vbe_mode, 0);
 
210
          last_set_mode = old_vbe_mode;
206
211
          return grub_error (GRUB_ERR_BAD_DEVICE,
207
212
                             "cannot set VBE mode %x",
208
213
                             vbe_mode);
256
261
 
257
262
  /* Try to query current mode from VESA BIOS.  */
258
263
  status = grub_vbe_bios_get_mode (mode);
 
264
  /* XXX: ATI cards don't support get_mode.  */
259
265
  if (status != GRUB_VBE_STATUS_OK)
260
 
    return grub_error (GRUB_ERR_BAD_DEVICE, "cannot get current VBE mode");
 
266
    *mode = last_set_mode;
261
267
 
262
268
  return GRUB_ERR_NONE;
263
269
}
350
356
  if (status != GRUB_VBE_STATUS_OK)
351
357
    /* TODO: Decide, is this something we want to do.  */
352
358
    return grub_errno;
 
359
  last_set_mode = initial_vbe_mode;
353
360
 
354
361
  /* TODO: Free any resources allocated by driver.  */
355
362
  grub_free (vbe_mode_list);
391
398
        /* If not available, skip it.  */
392
399
        continue;
393
400
 
394
 
      if ((vbe_mode_info.mode_attributes & 0x002) == 0)
395
 
        /* Not enough information.  */
396
 
        continue;
397
 
 
398
401
      if ((vbe_mode_info.mode_attributes & 0x008) == 0)
399
402
        /* Monochrome is unusable.  */
400
403
        continue;
497
500
    }
498
501
 
499
502
  /* Couldn't found matching mode.  */
500
 
  return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "no matching mode found.");
 
503
  return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "no matching mode found");
501
504
}
502
505
 
503
506
static grub_err_t