chromiumos/third_party/grub2.git
15 months agoForward-port gptpriority command to GRUB 2.00 86/63986/8 master release-R30-4537.B
Josh Triplett [Wed, 31 Jul 2013 21:03:00 +0000 (14:03 -0700)]
Forward-port gptpriority command to GRUB 2.00

Forward-ported from git commit 9866f9750a38a175849ca04439922ac1ffe8a0e7
with significant edits: Ported from the previous Ruby-based build system
to the new autogen-based Makefile.am generator, and updated for GRUB API
changes.  In particular, the previous version of gptpriority counted on
GRUB's part_gpt to provide access to the original partition table data
in a field of "struct grub_partition" that no longer exists; this
updated version modifies part_gpt to directly export the relevant
attribute field as a new field in grub_partition.

Since this adds a new source file and a new module, and the GRUB ebuild
expects source in "make dist" form (with configure and Makefile.in
already generated), this commit also updates the corresponding generated
files via autogen.sh.

BUG=chromium:265918
TEST=With the complete patch series, built a complete x86-generic image,
     and booted it via UEFI on both 32-bit and 64-bit UEFI platforms.

CQ-DEPEND=Ie865f3d5ab0ecd8e9138bfd5b576a8147a205757

Change-Id: I238f4ad26af3b1d924d5d5ac5fbcd567415cfb3f
Reviewed-on: https://gerrit.chromium.org/gerrit/63986
Tested-by: Josh Triplett <josh@joshtriplett.org>
Reviewed-by: Liam McLoughlin <lmcloughlin@chromium.org>
Commit-Queue: Josh Triplett <josh@joshtriplett.org>

15 months agoForward-port ChromeOS-specific GRUB environment variables for boot disk and partitions 85/63985/8
Josh Triplett [Wed, 31 Jul 2013 20:54:36 +0000 (13:54 -0700)]
Forward-port ChromeOS-specific GRUB environment variables for boot disk and partitions

This commit forward-ports the following changes previously applied in the
ChromeOS version of GRUB, with updates for changes to the surrounding code and
GRUB API changes:

144e40aca61589db1d286c82508f9328ec861158 Add variables to grub2 for Chrome OS bringup workarounds.
as modified by e63c2ee074c3c0abb5717fc8b7df62cf32066782 Support standard EFI ordering
and 5dfc8e1ae8c7d6836f2faef2545e4c5e6d516dff Add variable 'grubdisk' to export boot disk

In particular, grub2 now has a grub_snprintf, and no longer has a grub_sprintf.

BUG=chromium:265918
TEST=With the complete patch series, built a complete x86-generic image,
     and booted it via UEFI on both 32-bit and 64-bit UEFI platforms.

CQ-DEPEND=I8d4cdde878efe73e15fddb250b10cfd4b88d88d1

Change-Id: Ie865f3d5ab0ecd8e9138bfd5b576a8147a205757
Reviewed-on: https://gerrit.chromium.org/gerrit/63985
Tested-by: Josh Triplett <josh@joshtriplett.org>
Reviewed-by: Liam McLoughlin <lmcloughlin@chromium.org>
Commit-Queue: Josh Triplett <josh@joshtriplett.org>

15 months agoUPSTREAM: Sort cipher_files, to make build system generation more deterministic 83/63983/8
Josh Triplett [Wed, 31 Jul 2013 20:44:54 +0000 (13:44 -0700)]
UPSTREAM: Sort cipher_files, to make build system generation more deterministic

This applies the upstream patch to util/import_gcry.py in bzr commit
4572 (http://bzr.savannah.gnu.org/lh/grub/trunk/grub/revision/4572),
which makes the generated build system files independent of the
(system-dependent) order of files in os.listdir.  Applying this patch
and re-running autogen.sh eliminates a huge amount of noise in
subsequent commits.

BUG=chromium:265918
TEST=With the complete patch series, built a complete x86-generic image,
     and booted it via UEFI on both 32-bit and 64-bit UEFI platforms.

CQ-DEPEND=I9e4265f6a102f9800a77e0f368e266fa8d165c7b

Change-Id: I8d4cdde878efe73e15fddb250b10cfd4b88d88d1
Reviewed-on: https://gerrit.chromium.org/gerrit/63983
Tested-by: Josh Triplett <josh@joshtriplett.org>
Reviewed-by: Liam McLoughlin <lmcloughlin@chromium.org>
Commit-Queue: Josh Triplett <josh@joshtriplett.org>

15 months agoUpdate to GNU GRUB 2.00 from upstream. 93/63293/8
Josh Triplett [Wed, 24 Jul 2013 19:14:18 +0000 (12:14 -0700)]
Update to GNU GRUB 2.00 from upstream.

This incorporates the code from upstream grub-2.00.tar.xz, including all the
generated files in the tarball, as with the previous import of 1.97.

Among other things, GRUB 2.00 fixes numerous bugs in 32-bit UEFI boot support.
This upgrade was deferred from previous versions of ChromeOS when GRUB was a
part of the normal boot process, but GRUB is now used exclusively for UEFI boot
support, so this is a low-risk change.

Note that this commit includes only the GRUB 2.00 upstream source, with
none of the ChromeOS changes.  Subsequent commits will forward-port the
ChromeOS changes previously applied to 1.97.  Those changes do not
directly apply to the updated source, and require reworks to apply and
build.

BUG=chromium:265918
TEST=With the complete patch series, built a complete x86-generic image,
     and booted it via UEFI on both 32-bit and 64-bit UEFI platforms.

Change-Id: I9e4265f6a102f9800a77e0f368e266fa8d165c7b
Reviewed-on: https://gerrit.chromium.org/gerrit/63293
Tested-by: Josh Triplett <josh@joshtriplett.org>
Reviewed-by: Liam McLoughlin <lmcloughlin@chromium.org>
Commit-Queue: Josh Triplett <josh@joshtriplett.org>

16 months agoAdd gptpriority.mod to makefile 02/61502/2 factory-4455.B factory-pit-4471.B firmware-pit-4482.B stabilize-4443.B stabilize-4512.B
kuppuswa [Wed, 10 Jul 2013 21:34:19 +0000 (14:34 -0700)]
Add gptpriority.mod to makefile

This patch appends gptpriority.mod to grub commom
makefile so that scripts that depends on this
grub command can run and exit smoothly. These
changes are generated by running autogen.sh manually.

BUG=None
TEST=Built chromeOS with this patch and verified
     the scripts that depend on this command can
     succesfully find gptpriority.mod.

Change-Id: I7cce1079b356e8459409113a4c17d62b25c5cd4e
Reviewed-on: https://gerrit.chromium.org/gerrit/61502
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Tested-by: Sathish Kuppuswamy <sathish.kuppuswamy@intel.com>
Reviewed-by: Shawn Nematbakhsh_ <shawnn@chromium.org>
Commit-Queue: Josh Triplett <josh@joshtriplett.org>

16 months agoAdding gptpriority grub command 74/58274/3 factory-pit-4390.B firmware-falco_peppy-4389.B firmware-leon-4389.26.B firmware-wolf-4389.24.B
Sathish Kuppuswamy [Tue, 11 Jun 2013 18:32:20 +0000 (11:32 -0700)]
Adding gptpriority grub command

gptpriority grub command takes diskname, partition number
and environment variable(optional) as its arguments and returns the
priority the of the specified partition in the given disk. If
environment variable is given, the result value is exported to it.
Decription and usage of the command can be obtained with
"gptpriority --help" in grub shell.

During image_to_live rebooting, system always booted to default image instead
of booting newly installed image. This command is needed to obtain the
highest priority parition in the disk(updated by image_to_live for new image)
and boot the image from that parition. Note: This changes are for UEFI boot.

BUG=None
TEST=Built the changes with chromeOS image and checked the usage of
     gptpriority command in grub shell. And also the results of this
     command is used in grub.cfg to update the "default" value and
     verified the selection of the image to boot based on that default
     value.

Change-Id: I0175a5d22099bfb4387bb2d2e2a0810d23f126b4
Reviewed-on: https://gerrit.chromium.org/gerrit/58274
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Queue: Sathish Kuppuswamy <sathish.kuppuswamy@intel.com>
Tested-by: Sathish Kuppuswamy <sathish.kuppuswamy@intel.com>
17 months agoAdd variable 'grubdisk' to export boot disk 73/58273/2 factory-4290.B factory-pit-4280.B release-R29-4319.B stabilize-4287.B
Sathish Kuppuswamy [Tue, 11 Jun 2013 18:22:42 +0000 (11:22 -0700)]
Add variable 'grubdisk' to export boot disk

Boot disk name is required by 'gptpriority' grub command to read the
priority of partitions from the GPT disk and set the default
partition to boot accordingly in grub.cfg

BUG=None
TEST=Built the changes along with chromeOS. Verified the value being
     exported to grubdisk in grub shell and also the usage of this
     variable with "gptprioriry" grub command in grub.cfg.

Change-Id: Ib52de5e2ab32eb9538b5f537d11c549eeb25278d
Reviewed-on: https://gerrit.chromium.org/gerrit/58273
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Josh Triplett <josh@joshtriplett.org>
Tested-by: Josh Triplett <josh@joshtriplett.org>
2 years agoFix grub2 for gcc 4.7. factory-2846.B factory-2848.B factory-2914.B factory-2985.B factory-2993.B factory-3004.B factory-3536.B factory-4128.B factory-spring-3842.B factory-spring-4131.B factory-spring-4262.B firmware-butterfly-2788.B firmware-spring-3824.4.B firmware-spring-3824.55.B firmware-spring-3824.84.B firmware-spring-3824.B firmware-stout-2817.B release-R23-2913.B release-R25-3428.B release-R26-3701.B release-R27-3912.B release-R28-4100.B stabilize stabilize-3428.110.0 stabilize-3428.149 stabilize-3428.149.B stabilize-3428.193 stabilize-3658.0.0 stabilize-3701.30.0 stabilize-3701.30.0b stabilize-3701.46.B stabilize-3701.81.B stabilize-3881.0.B stabilize-3912.79.B stabilize-4008.0.B stabilize-4035.0.B stabilize-4068.0.B stabilize-4100.38.B stabilize-4255.B stabilize-bluetooth-smart stabilize-daisy stabilize-link stabilize-link-2913.278 stabilize-spring-4100.53.B stabilize2 toolchain-3428.65.B toolchain-3701.42.B toolchainA toolchainB
Han Shen [Thu, 16 Aug 2012 00:44:32 +0000 (17:44 -0700)]
Fix grub2 for gcc 4.7.

"-melf_x86_64" is a linker option, prefix it with "-Wl".

Gcc prior to 4.7 seems to pass this option to ld, but 4.7 doesn't.

TEST=Built using gcc 4.7
BUG=None

Change-Id: I5908d34fd0f9dc939581a2eaed5cd20d282c6d3a
Reviewed-on: https://gerrit.chromium.org/gerrit/30486
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: Han Shen <shenhan@chromium.org>
Tested-by: Han Shen <shenhan@chromium.org>
2 years agoFix EFI boot on certain non-Chromebook platforms. factory-2717.B factory-2723.14.B firmware-link-2695.2.B firmware-link-2695.B firmware-parrot-2685.B firmware-snow-2695.90.B firmware-snow-2695.B release-R22-2723.B
Shawn Nematbakhsh [Fri, 20 Jul 2012 19:14:39 +0000 (12:14 -0700)]
Fix EFI boot on certain non-Chromebook platforms.

Some non-chromebook platforms cannot EFI boot Chromium OS due to "cannot
allocate protected mode pages" error. This is a very old grub2 bug, and
is worked around in this change. A better fix is to upgrade to a newer
version of grub2, but this has caused big problems in the past. This
change is relatively risk-free because it only takes effect if EFI boot
were to fail.

BUG=32776.
TEST=build image with new grub-mkimage, EFI boot on platform.

Change-Id: Ic332f3af3a771d084189dca7fc2f88b281e653b3
Reviewed-on: https://gerrit.chromium.org/gerrit/28043
Reviewed-by: Micah Catlin <micahc@chromium.org>
Commit-Ready: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-by: Shawn Nematbakhsh <shawnn@chromium.org>
Tested-by: Shawn Nematbakhsh <shawnn@chromium.org>
2 years agoFix grub2 compile errors.
Shawn Nematbakhsh [Fri, 20 Jul 2012 01:20:51 +0000 (18:20 -0700)]
Fix grub2 compile errors.

grub2 does not compile due to strict warning checks. This is fixed by
removing variables that are declared + assigned but never used.

BUG=32776.
TEST=configure / make, copy grub-mkimage binary, then build_image.

Change-Id: I9fe488c06edcde01dfdf244773323a2088285879
Reviewed-on: https://gerrit.chromium.org/gerrit/27961
Tested-by: Shawn Nematbakhsh <shawnn@chromium.org>
Commit-Ready: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-by: Micah Catlin <micahc@chromium.org>
4 years agogrub2: Add missing inherit-review-settings-ok file 0.11.241.B 0.11.257.B 0.11.257.B90 0.12.362.B 0.12.369.B 0.12.392.B 0.12.433.B 0.12.433.B109 0.12.433.B62 0.13.434.B 0.13.509.B 0.13.558.B 0.13.587.B 0.14.811.B 0.15.877.B 11.1.241.B 780.B factory-1020.B factory-1235.B factory-1284.B factory-1412.B factory-1987.B factory-2268.16.B factory-2305.B factory-2338.B factory-2368.B factory-2394.B factory-2460.B factory-2475.B factory-2569.B factory-980.B firmware-881-u-boot-v1 firmware-kiev-2.112.B firmware-link-2348.B firmware-u-boot-v1 firmware-uboot_v2-1299.B release-1011.B release-R16-1193.B release-R17-1412.B release-R18-1660.B release-R19-2046.B release-R20-2268.B release-R21-2465.B test-982.B
Daniel Erat [Wed, 16 Jun 2010 15:51:39 +0000 (08:51 -0700)]
grub2: Add missing inherit-review-settings-ok file

BUG=none
TEST=none
TBR=anush

Review URL: http://codereview.chromium.org/2863006

4 years agoSupport standard EFI ordering
Nick Sanders [Wed, 9 Jun 2010 23:52:42 +0000 (16:52 -0700)]
Support standard EFI ordering

4 years agoAdd variables to grub2 for Chrome OS bringup workarounds.
Bill Richardson [Fri, 14 May 2010 23:58:57 +0000 (16:58 -0700)]
Add variables to grub2 for Chrome OS bringup workarounds.

This adds a temporary hack to grub2, which we're using while the full BIOS
changes aren't yet completed. We set four variables automatically that we
can use in the grub.cfg file to ensure that we get the kernel and rootfs
from the boot device, regardless of which device that is.

Grub refers to the boot device as hd0, hd1, etc. The kernel needs it to be
sda, sdb (and yes, I know that's dependent on the architecture and media,
but so is grub). In addtion, our current BIOS doesn't enumerate the hard
disk in recovery mode, so the first removable drive is hd0, not hd1. Linux
always sees it though.

Grub now sets two variables to specify the rootfs in grub's terms:

  grubpartA == (hdX,3)
  grubpartB == (hdX,5)

where X is the boot device, so we can pick the right kernel in grub.cfg:

  linux $grubpartA/boot/vmlinuz ...
  linux $grubpartB/boot/vmlinuz ...

But we also need to provide "rootfs=/dev/sdX" for the kernel.

We'll map this normally:
  (hd0) -> sda
  (hd1) -> sdb
  etc.

But if the booted media is removable, we'll map like this:
  (hd0) -> sdb
  (hd1) -> sdc
  etc.

and so grub can set two more variables:

  linuxpartA == /dev/sdX3
  linuxpartB == /dev/sdX5

and now our grub.cfg can say:

  linux $grubpartA/boot/vmlinuz root=/dev/$linuxpartA ...
  linux $grubpartB/boot/vmlinuz root=/dev/$linuxpartB ...

And this will let the same grub.cfg file work on any boot device, regardless
of how many others are plugged in or how they're numbered.

Note that once we've switched to our official BIOS we'll no longer be
needing grub at all, so this is just temporary.

Review URL: http://codereview.chromium.org/2113004

4 years agoImport grub-1.97.tar.gz release from gnu.org
Bill Richardson [Thu, 1 Apr 2010 22:26:56 +0000 (15:26 -0700)]
Import grub-1.97.tar.gz release from gnu.org