fix clearing kernel attributes

Change-Id: Id353323d268835cbcc1fb13c8669cee420c8fb6a

BUG=chrome-os-partner:1046
TEST=manual

Make sure your chromeos install on the hard drive has 2 good kernel
partitions. Do:

sudo cgpt show /dev/sda

If partition 2 has success=1, do:

sudo dd if=/dev/sda2 of=/dev/sda4 bs=1M
sudo dd if=/dev/sda3 of=/dev/sda5 bs=1M
cgpt add -i 4 -S 1 -P 2

(if instead partition 4 has success=1, do:)

sudo dd if=/dev/sda4 of=/dev/sda2 bs=1M
sudo dd if=/dev/sda5 of=/dev/sda3 bs=1M
cgpt add -i 2 -S 1 -P 2

Reboot and do the following:

sudo cgpt show /dev/sda

If the partition you just marked active still has success=1
priority=2, the bug is fixed.  If it has success=0 priority=0, the bug
is still there.

Review URL: http://codereview.chromium.org/3324014
This commit is contained in:
Randall Spangler
2010-09-09 17:37:51 -07:00
parent 60bcbe3cd4
commit 77ae389799

View File

@@ -213,10 +213,15 @@ int LoadKernel(LoadKernelParams* params) {
found_partitions++; found_partitions++;
/* Read the first part of the kernel partition */ /* Read the first part of the kernel partition */
if (part_size < kbuf_sectors) if (part_size < kbuf_sectors) {
VBDEBUG(("Partition too small to hold kernel.\n"));
goto bad_kernel; goto bad_kernel;
if (0 != BootDeviceReadLBA(part_start, kbuf_sectors, kbuf)) }
if (0 != BootDeviceReadLBA(part_start, kbuf_sectors, kbuf)) {
VBDEBUG(("Unable to read start of partition.\n"));
goto bad_kernel; goto bad_kernel;
}
/* Verify the key block. In developer mode, we ignore the key /* Verify the key block. In developer mode, we ignore the key
* and use only the SHA-512 hash to verify the key block. */ * and use only the SHA-512 hash to verify the key block. */
@@ -255,8 +260,10 @@ int LoadKernel(LoadKernelParams* params) {
/* Get the key for preamble/data verification from the key block */ /* Get the key for preamble/data verification from the key block */
data_key = PublicKeyToRSA(&key_block->data_key); data_key = PublicKeyToRSA(&key_block->data_key);
if (!data_key) if (!data_key) {
VBDEBUG(("Data key bad.\n"));
goto bad_kernel; goto bad_kernel;
}
/* Verify the preamble, which follows the key block */ /* Verify the preamble, which follows the key block */
preamble = (VbKernelPreambleHeader*)(kbuf + key_block->key_block_size); preamble = (VbKernelPreambleHeader*)(kbuf + key_block->key_block_size);
@@ -285,9 +292,9 @@ int LoadKernel(LoadKernelParams* params) {
/* If we already have a good kernel, no need to read another /* If we already have a good kernel, no need to read another
* one; we only needed to look at the versions to check for * one; we only needed to look at the versions to check for
* rollback. */ * rollback. So skip to the next kernel preamble. */
if (-1 != good_partition) if (-1 != good_partition)
goto bad_kernel; continue;
/* Verify body load address matches what we expect */ /* Verify body load address matches what we expect */
if ((preamble->body_load_address != (size_t)params->kernel_buffer) && if ((preamble->body_load_address != (size_t)params->kernel_buffer) &&