Commit Graph

275 Commits

Author SHA1 Message Date
Mike Frysinger
df0e1a391f Revert "image_signing: use sparse partition extraction"
This reverts commit 82dec09bd5.

This flag doesn't exist on Ubuntu Precise which is what the signers
are running atm.  Until we get them upgraded to Trusty, back this
change out.

BUG=chromium:530730
TEST=`./signing_unittests.py` passes
BRANCH=None

Change-Id: I9ba508c1531dbb169fd020d06ab102f6576b7342
Reviewed-on: https://chromium-review.googlesource.com/306310
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Amey Deshpande <ameyd@google.com>
2015-10-15 19:57:13 -07:00
Amey Deshpande
dabb158ad2 signer: update legacy bootloader templates after image signing
Specifically, this patch updates 'root_hexdigest' in legacy bootloader
templates in EFI system partition to match the signed rootfs.

BRANCH=None
BUG=chromium:512940
TEST=Ran sign_official_build.sh locally and booted the image on kvm
(using BIOS).
TEST=Ran signing_unittests.py by locally changing vboot_stable_hash to
include this patch.

$ ./sign_official_build.sh base chromiumos_base_image.bin \
  ../../tests/devkeys chromiumos_base_image_signed.bin

Change-Id: Ied021c4464b113a64508f5081605069bdcecbc1f
Reviewed-on: https://chromium-review.googlesource.com/301742
Commit-Ready: Amey Deshpande <ameyd@google.com>
Tested-by: Amey Deshpande <ameyd@google.com>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2015-10-03 16:26:08 -07:00
Furquan Shaikh
45e3021c40 sign_official_build: support signing 'recovery_kernel' image type
BRANCH=None
BUG=chrome-os-partner:44227
TEST='sign_official_build.sh recovery_kernel boot.img keys
boot.img.recovery-signed' works fine and able to boot in locked recovery mode
using fastboot boot.

Change-Id: Iabde28bb2068b8294fc3d03f2f771c63368ecbb5
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://chromium-review.googlesource.com/300250
Commit-Ready: Furquan Shaikh <furquan@chromium.org>
Tested-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: David Riley <davidriley@chromium.org>
2015-09-17 17:35:14 -07:00
Mike Frysinger
82dec09bd5 image_signing: use sparse partition extraction
Often the partitions we extract have extra space in them, but the dd
utility will still write out the excess zeros.  That can mean we write
out hundreds of megs of data which could otherwise be skipped.  We thus
waste a good amount of I/O and storage.

For now, only use this flag when extracting a partition to a new file
as this should be safe (there's no pre-existing data to clobber/merge).

BUG=chromium:530730
TEST=`./signing_unittests.py` passes
BRANCH=None

Change-Id: Ic32665cf7c38fc0a5efc3f8b227fa8ff408ca9e3
Reviewed-on: https://chromium-review.googlesource.com/299450
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: David Riley <davidriley@chromium.org>
2015-09-11 18:36:29 -07:00
Mike Frysinger
df9bf4eef3 image_signing: use sparse copying when creating the signed image
This should speed up the copies significantly by using less disk
storage & I/O when the unpacked file is not sparse already.  This
option has been in cp for a long time, and works in Ubuntu Precise
(coreutils-8.13) & Trusty (coreutils-8.21).

BUG=chromium:530730
TEST=`./signing_unittests.py` passes
BRANCH=None

Change-Id: I82192455a623eabf96abf4f25296f3dc0c129ca2
Reviewed-on: https://chromium-review.googlesource.com/299440
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: David Riley <davidriley@chromium.org>
Reviewed-by: Amey Deshpande <ameyd@google.com>
2015-09-11 17:10:41 -07:00
Mike Frysinger
afb07f4967 image_signing: do not delete output when signing loem firmware
Rather than use the existence of the output as a marker for running the
gbb step, key off the loem index.  We want to run it the first time and
not bother after that.

BUG=chrome-os-partner:44227
BRANCH=None
TEST=signer can still sign loem keysets

Change-Id: I26e9ccaf1333f769d6993a8e0d84c63644bb2597
Reviewed-on: https://chromium-review.googlesource.com/298980
Reviewed-by: David Riley <davidriley@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2015-09-10 20:37:32 +00:00
Mike Frysinger
907bc34086 keygeneration: fix some portability aspects
The "function" keyword is not portable -- use the normal function style.

The awk command uses a non-portable regex (the word anchor \>).  Rework
it to avoid regexes entirely.

BUG=chromium:475101
TEST=keyset_version_check.sh works on a POSIX system
BRANCH=None

Change-Id: I5446f63aa9181d06da1898aafb8fab17f5042989
Reviewed-on: https://chromium-review.googlesource.com/296562
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: David Riley <davidriley@chromium.org>
2015-09-08 18:43:42 -07:00
David Riley
69898e6c51 signer: Add signing support for nvidia lp0 firmware from signer
Signer was calling sign_official_build.sh in a manner that wasn't
being accepted correctly.  Also add test keys from firmware branch.

BUG=chrome-os-partner:44227
TEST=sign_official_build.sh nv_lp0_firmware tegra_lp0_resume.fw tests/devkeys tegra_lp0_resume.fw.signed versions.default
BRANCH=signer

Change-Id: Icd298ac75e3da746220826dc2fb9cc2466e41f1d
Signed-off-by: David Riley <davidriley@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/297802
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2015-09-08 18:21:23 +00:00
Mike Frysinger
7d08454755 image_signing: rework input/output files and firmware signing
The new nvidia logic expects to have the "real" output filename and not
yet another temp path.  Since sign_firmware.sh supports being passed in
the input as the output and doing in-place signing, just document it and
update the callers.

BUG=chrome-os-partner:44227
BRANCH=None
TEST=signer outputs pubkey.sha to the same location as the output firmware

Change-Id: Iadc5dc5aaace6be9e22ff2c55bfbc58b7e1b3ef0
Reviewed-on: https://chromium-review.googlesource.com/296574
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: David Riley <davidriley@chromium.org>
2015-09-04 23:02:14 -07:00
Furquan Shaikh
90cd023d01 signer: Add signing support for nvidia lp0 firmware
BUG=chrome-os-partner:44227
BRANCH=None
TEST=unittests run fine.

Change-Id: I7d623a22d73a1749ebebd323fe09cbbeb8cbd61e
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://chromium-review.googlesource.com/296429
Commit-Ready: Furquan Shaikh <furquan@chromium.org>
Tested-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2015-09-01 19:19:04 -07:00
Furquan Shaikh
1196aa05d4 sign_firmware: Add nv_pkc_signing step if required
If nv_pkc.pem file is present for a device, use nv_pkc_signing for
adding PKC signature in the firmware image.

BUG=chrome-os-partner:44227
BRANCH=None
TEST=unittests run fine. verified image boots on fused system.

Change-Id: I9b2f48da55137a0e4a75f23d16d3779be1aa94c8
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://chromium-review.googlesource.com/296452
Commit-Ready: Furquan Shaikh <furquan@chromium.org>
Tested-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2015-09-01 19:19:04 -07:00
David Riley
076a5395e9 sign_official_build: support signing 'kernel' image type
BRANCH=signer
BUG=chrome-os-partner:44227
TEST='sign_official_build.sh kernel boot_devsigned.img keys boot_resigned.img'

Change-Id: I805231ef4bd4ed86b35c0d7ca2d3fe1e704caabc
Signed-off-by: David Riley <davidriley@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/294954
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2015-08-21 20:08:56 +00:00
Amey Deshpande
d8ace3dee9 sign_official_build: support signing 'base' image type
BRANCH=signer
BUG=chromium:512940
TEST=Tested with the following command:

$ ./sign_official_build.sh base chromiumos_base_image.bin ../../tests/devkeys \
    chromiumos_base_image_signed.bin ../../tests/devkeys/key.versions

Change-Id: Ife2284a6ca82f4306ca26278159859928c0ff2b5
Reviewed-on: https://chromium-review.googlesource.com/293636
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Amey Deshpande <ameyd@google.com>
Commit-Queue: Amey Deshpande <ameyd@google.com>
2015-08-18 01:46:10 +00:00
Hung-Te Lin
0ab72c307a image_signing: Add more description to set_gbb_flags.
There are two new GBB flags added (lid/fastboot) and we should update the
description in set_gbb_flags.

BRANCH=none
BUG=none
TEST=emerge-link vboot_reference

Change-Id: I0d16df03e9427ec1c8780fbb6be10c31eed9bf9e
Signed-off-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/286052
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2015-07-21 04:50:36 +00:00
Amey Deshpande
05371345b7 sign_official_build: preserve /boot for legacy BIOS
This patch checks for 'cros_legacy' in the kernel config, and skips
running strip_boot_from_image.sh if present.  This is because
'cros_installer postinst' on legacy BIOS relies on presence of /boot in
rootfs.

BRANCH=signer
BUG=b:20947354
TEST=Ran the script with devkeys, and checked presence of /boot in the
signed .bin file by mounting locally

$ ./sign_official_build.sh ssd chromiumos_image.bin ../../tests/devkeys \
    chromiumos_image_signed.bin ../../tests/devkeys/key.versions

Change-Id: Ieb919067b353839019bc1c561d7bb66bebac1040
Reviewed-on: https://chromium-review.googlesource.com/272742
Tested-by: Amey Deshpande <ameyd@google.com>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Amey Deshpande <ameyd@google.com>
2015-05-22 16:49:06 +00:00
Amey Deshpande
7dd3bd0fcf image_signing: use per-board release file blacklist
This patch changes ensure_no_nonrelease_files.sh to use per-board
release file blacklist instead of the default one.  It also uses this
opportunity to make ensure_no_nonrelease_files.sh consistently
formatted.

BRANCH=none
TEST=Ran ./security_test_image on a lakitu image and --vboot_hash
pointing to this commit, and verified ensure_no_nonrelease_files.sh passes.
BUG=brillo:823

Change-Id: I2cff56192a5ff0b917faba7549e7adafb4757a47
Reviewed-on: https://chromium-review.googlesource.com/267335
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Amey Deshpande <ameyd@google.com>
Tested-by: Amey Deshpande <ameyd@google.com>
2015-04-29 19:43:14 +00:00
Amey Deshpande
4ce1cc01c0 image_signing: emit required_dmparams_regex in case of mismatch
BRANCH=none
TEST=none
BUG=none

Change-Id: Iece5272622467829050ca50a4842ef771addf7ae
Reviewed-on: https://chromium-review.googlesource.com/267739
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Amey Deshpande <ameyd@google.com>
Tested-by: Amey Deshpande <ameyd@google.com>
2015-04-29 19:43:11 +00:00
Hung-Te Lin
a0185aecc9 make_dev_ssd: Add '--edit_config' to support in-place editing.
The '--save_config' and '--set_config' are found to be very useful for
developers but it's sometimes inconvenient that developer must specify a
temporary path and to know the implicit rules of how the files are generated.

Since most people just want to do in-place editing, we can add a --edit_config
so developers can simply invoke "make_dev_ssd --edit_config --partitions 2" to
start changing kernel command line without worrying about where to store the
temporary files.

BRANCH=none
BUG=none
TEST=./make_dev_ssd.sh --edit_config --partition 2

Change-Id: Ib8f19115df31f3f250b4378201d0f7ea562fec15
Reviewed-on: https://chromium-review.googlesource.com/266814
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Hung-Te Lin <hungte@chromium.org>
2015-04-23 02:36:26 +00:00
Mike Frysinger
2e13d59080 add_loem_keys: new helper for quickly creating loem keys
This is largely geared for testing for quickly creating a set of loem keys.

BUG=chromium:381862
TEST=`./add_loem_keys.sh 0` converted an existing keyset to a loem keyset
TEST=`./add_loem_keys.sh 3` added three more keysets
TEST=ran sign_official_build.sh with new keysets against a recovery.bin
BRANCH=none

Change-Id: I598b7a453b747a231df850657df50bede01768c2
Reviewed-on: https://chromium-review.googlesource.com/203940
Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
2015-04-15 04:51:00 +00:00
Chirantan Ekbote
eee1b3d227 Add sanity check for dev_boot_signed_only
Removing rootfs verification or resigning kernels can lead to an
unusable system if the dev_boot_signed_only flag is set.  Add a sanity
check to print out an error when this happens.

BRANCH=none
BUG=none
TEST=manual
Run /usr/share/vboot/bin/make_dev_ssd.sh with the dev_boot_signed_only
flag set to 1 and observe that an error message is printed.

Change-Id: If116538152ee3122e3b742918bf1676982754fdd
Reviewed-on: https://chromium-review.googlesource.com/260970
Trybot-Ready: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
2015-03-19 23:48:46 +00:00
Mike Frysinger
d574f070c5 avoid git status
When trying to build out-of-tree, running `git status` will attempt to
write to the .git/ dir which causes a sandbox violation.

Since this code doesn't seem to actually do anything, drop it.

BUG=chromium:466499
TEST=precq still passes
TEST=build now passes when building out of tree
TEST=`./scripts/getversion.sh` produces good output with clean & dirty trees
BRANCH=None

Change-Id: Ia722fedef692876ffc87109b3a1d2e4a76235532
Reviewed-on: https://chromium-review.googlesource.com/259541
Trybot-Ready: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2015-03-13 07:04:19 +00:00
Hung-Te Lin
26af0da4f7 make_dev_ssd: Allow smaller kernel partition.
Some Brillo devices may have smaller kernel partition and we need to reduce the
size limit.

BUG=none
BRANCH=none
TEST=make_dev_ssd.sh applied on a Brillo config with 8MB kernel partition.

Change-Id: I9ca37445a6cdb20138f13dbe975c207383a1474c
Reviewed-on: https://chromium-review.googlesource.com/255341
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Mao Huang <littlecvr@chromium.org>
Commit-Queue: Hung-Te Lin <hungte@chromium.org>
2015-03-03 21:37:59 +00:00
Mike Frysinger
d7d9d3b669 keygeneration: fix typos in previous commit
Forgot to update the bitsizes in the variable constants.

BUG=chromium:454651
TEST=`./create_new_keys.sh` still generates 8k keys
TEST=`./create_new_keys.sh --4k` now generates 4k keys
BRANCH=None

Change-Id: Ie285649f4d58ad2e2cba71f4cab737cc2235e3ab
Reviewed-on: https://chromium-review.googlesource.com/245890
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2015-02-03 22:46:06 +00:00
Mike Frysinger
79add75aa3 create_new_keys: add options for generating 4k keys
BUG=chromium:454651
TEST=`./create_new_keys.sh` still generates 8k keys
TEST=`./create_new_keys.sh --4k` now generates 4k keys
BRANCH=None

Change-Id: I2203536880b9320959fd741c4bbcf814aded603c
Reviewed-on: https://chromium-review.googlesource.com/245318
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2015-02-03 22:03:34 +00:00
Mike Frysinger
37b6afe030 create_new_keys: add a proper main func
While we do this, clean up:
 - use braces everywhere
 - convert local vars from $VAR to $var
 - parse all command line args properly
 - run in `set -e` mode

BUG=chromium:454651
TEST=`./create_new_keys.sh` still generates sane keys
TEST=`./create_new_keys.sh --help` shows help output
TEST=`./create_new_keys.sh --asdfasdf` shows an error
TEST=`./create_new_keys.sh` outside chroot (w/out vboot binaries) aborts after first failure
BRANCH=None

Change-Id: I1ba0db0b24c0f2f10cf397b47115f0e98384d991
Reviewed-on: https://chromium-review.googlesource.com/245317
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2015-02-03 07:06:32 +00:00
Bill Richardson
190eefb3ff sign_official_build.sh should work without dev-firmware keys
The signing scripts pass a bunch of args around, including paths
to the keys used to sign dev-mode-specific firmware. That was
only used on Alex and ZGB, so all the newer systems don't have
those keys and the script falls over.

This uses the normal firmware keys if the dev-firmware keys don't
exist. This was an oversight with the original CL that touched
resign_firmwarefd.sh

BUG=chromium:453901
BRANCH=ToT
TEST=manual

Download a newer signed recovery image, say for nyan, and save it as

  scripts/image_signing/nyan-recovery-mp.bin

Temporarily delete the developer firmware keys from the devkeys:

  rm -f tests/devkeys/dev_firmware*

Now try resigning the recovery image:

  cd scripts/image_signing
  ./sign_official_build.sh recovery nyan-recovery-mp.bin \
                           ../../tests/devkeys/ signed.bin \
                           ../../tests/devkeys/key.versions

It should work.

Change-Id: I474811158cb33e16ad09c16b0db825c40217dd70
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/245151
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2015-01-31 04:32:31 +00:00
Hung-Te Lin
b6ebb1ab1c sign_official_build: Support old images without kernel in partition 4.
Old images don't put kernel on partition 4 and rely on vblock for installation.
The signer script has to support both old and new images, by testing if kernel
partition has valid data.

BRANCH=signer
BUG=chromium:449450
TEST=(get old image without kernel blob on partition 4)
     sign_official_build.sh usb image.bin ../../tests/devkeys signed.bin \
     ../../tests/devkeys/key.versions

Change-Id: I92542ffb162660d86c30d9598fe1ca59ff69afe4
Signed-off-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/243874
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2015-01-29 21:34:56 +00:00
Hung-Te Lin
4083725867 sign_official_buid: Fix "incorrect rootfs hash" when image has no firmware updater .
For each mount_image_partition, we have to unmount explicitly before doing other
changes (especially when using dd) to image. Otherwise system may flush data
when releaseing loop device and cause output image to be corrupted.

BUG=chromium:449450
TEST=sign_official_build.sh factory factory_install_shim.bin \
     ../../../tests/devkeys signed.bin ../../../tests/devkeys/key.versions
     sign_official_build.sh verify signed.bin
BRANCH=signer

Change-Id: I20756d9769c3737e25cfea348a9a4d64cc43b202
Signed-off-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/243496
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2015-01-28 11:14:03 +00:00
Mike Frysinger
4edc75daa6 image_signing: work around shar invocation changing
The shar utility changed the flag name and newer versions no longer
accept -w.  Mung the shellball on the fly to use the newer flag.

BUG=chrome-os-partner:33719
TEST=signing old firmware shellball inside chroot passes
BRANCH=none

Change-Id: If5c2da3062bd72062baa779bb26ea56304c31558
Reviewed-on: https://chromium-review.googlesource.com/241064
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2015-01-16 18:12:04 +00:00
Hung-Te Lin
42f02139d5 make_dev_ssd: support devices using /dev/dm-1 as root device.
Some devices may use rootdev=/dev/dm-1 as root device (the default one was
dm-0, according to build scripts). Running make_dev_ssd.sh
--remove_rootfs_verification on these devices will fail changing rootdev kernel
command line, and cause people not able to re-mount root device as writable.

To support running make_dev_ssd on these devices, we want to change the rootdev
pattern to dm[0-9].

BUG=chromium:428041.
TEST=make_dev_ssd.sh --remove_rootfs_verification
BRANCH=none

Change-Id: Idfd251c58e7d39b0b80ec1fc68989c2f49bdd1b2
Reviewed-on: https://chromium-review.googlesource.com/226782
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
2014-11-01 09:39:04 +00:00
Bill Richardson
e1486c3234 futility: add version command
BUG=none
BRANCH=none
TEST=manual

make && ./build/futility/futility version

Change-Id: I362b13d3befba62a33bc9fd2e87ad68f4bc62a84
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/226779
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-10-31 20:55:24 +00:00
Hung-Te Lin
e54e656b9f sign_official_build: Support new image layout (always installable kernel in B).
ChromiumOS images have recently changed the installable vblock from stateful
partition to kernel + vblock in slot B. sign_official_build script should
follow that layout so other scripts (ex, cros_generate_update_payload) won't
find wrong blob.

BRANCH=none
BUG=chrome-os-partner:32156
TEST=for image_t in ssd usb install recovery; do
       ./sign_official_build.sh $image_t IMAGE KEYDIR output$image_t.bin
       ./sign_official_build.sh verify output$image_t.bin
     done
     # Also boots images without problem.

Change-Id: I04e2b50f3f3355263ba6de9567b4a82c040c5826
Reviewed-on: https://chromium-review.googlesource.com/221890
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Commit-Queue: Hung-Te Lin <hungte@chromium.org>
2014-10-16 04:25:08 +00:00
Mike Frysinger
2b802de836 image_signing: ignore missing chrome_dev.conf
If we try to sign an image w/out Chrome, this file won't exist.
Run grep with the -s flag to silence those warnings.

BUG=chromium:418817
TEST=`cbuildbot storm-release` no longer warns
BRANCH=None

Change-Id: Ibac0978e3e4d9f89c00206a2dd21c1d71544f710
Reviewed-on: https://chromium-review.googlesource.com/221184
Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
2014-10-07 05:54:06 +00:00
Bill Richardson
bc3f0b74f9 cleanup: remove a couple of unused functions and files
scripts/sign_data.sh is just a wrapper to do this:

  ./signature_digest_utility $1 $3 \
    | openssl rsautl -sign -pkcs -inkey $2

AFAICT, that script is only invoked by the SignatureFile()
function in host/lib/file_keys.c, which is not referenced by
anything. I think I can remove both of those things.

Also remove utility/gbb_utility.cc, which should have been done
long ago in commit 6f39615.

BUG=none
BRANCH=ToT
TEST=make runalltests

Also ran it on daisy_spring-paladin and link-tot-paladin.

Change-Id: I16de5022765806f11bf6144d7ffd8cc849578a68
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/216719
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2014-09-12 03:39:46 +00:00
Bill Richardson
a19b00dfd0 futility: make resign_firmwarefd.sh simply invoke futility
Since all of the functionality of the resign_firmwarefd.sh script
is built in to futility, let's just make that script invoke
futility to do the work. We'll come back and remove the script
entirely, once all outside references to it have been changed to
do the right thing.

BUG=chromium:224734
BRANCH=ToT
TEST=make runtests

Also tested by editing tests/futility/test_resign_firmware.sh to
invoke the resign_firmwarefd.sh script instead of futility.
Everything passed.

Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Change-Id: Id068e551067a956cd7ddc3f9b9e23488261d8d94
Reviewed-on: https://chromium-review.googlesource.com/216716
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-09-12 03:39:34 +00:00
Gaurav Shah
fcefaedf62 keygeneration: Add a script to sanity check versions for a keyset
Add a script that runs sanity checks on the versions in a keyset.
In particular, tests whether the actual key versions match those
in key.versions. Also runs consistency checks (for example: firmware
version should match kernel subkey version).

BUG=none
TEST=run on all of our keysets
BRANCH=none

Change-Id: I5b509ba33127364f6b63252ad167646eb7dce710
Reviewed-on: https://chromium-review.googlesource.com/190790
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Gaurav Shah <gauravsh@chromium.org>
2014-08-26 02:25:59 +00:00
Hung-Te Lin
8f15d74fd6 make_dev_ssd: Allow chromeos-install to run on a modified image.
chromeos-install always expects DM verity information from install source,
because even when --noenable_rootfs_verification is applied, the output image
will still include DM verity in kernel command line (just not enabled).

To support developers installing a modified image (by
--remove_rootfs_verification), we have to change the command line to keep DM
verity data, just like how --noenable_rootfs_verification is done.

BRANCH=none
BUG=none
TEST=make_dev_ssd.sh --noenable_rootfs_verification; reboot;
     chromeos-install # success.

Change-Id: I3b2c8cbf1b89086ed91b5549c7147cd940fbda14
Reviewed-on: https://chromium-review.googlesource.com/207321
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
Commit-Queue: Hung-Te Lin <hungte@chromium.org>
2014-08-25 04:53:36 +00:00
Duncan Laurie
277dc5274c Add GBB flag to disable PD software sync
In order to disable PD software sync but still do EC software sync
it is useful to have a separate GBB flag for it.

This will allow me to release a Samus P2B firmware image that will
update the EC but not the PD, since the PD FW that comes on P2B
devices cannot be updated with software sync.

BUG=chrome-os-partner:30079
BRANCH=None
TEST=flash BIOS with updated EC+PD:
1) no GBB flags to override behavior updates both EC and PD
2) GBB flag to disable EC software sync disables both EC and PD update
3) GBB flag to disable PD software sync disables only PD update

Change-Id: I49ffb59238bee4a2dd66b24f2516e3ce46ea06cd
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/211910
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-08-12 02:50:56 +00:00
Hung-Te Lin
119140eae5 resign_firmwarefd: Correct output file name for VBLOCK B.
In commit https://chromium-review.googlesource.com/203682 the output file names
were always vblock_A, and should be changed to vblock_A and vblock_B.

BUG=chrome-os-partner:30611
TEST=Signed a recovery image and checked output.
BRANCH=none

Change-Id: I91901ba2c24032c6af3e6ab3f731bb7dd384ae2d
Reviewed-on: https://chromium-review.googlesource.com/208610
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
Commit-Queue: Hung-Te Lin <hungte@chromium.org>
2014-07-17 09:51:33 +00:00
Mike Frysinger
4521c1f19f image_signing: tweak loem firmware signing to have real keys
Rather than leave the default set of keys in the firmware untouched
(which are dev keys), insert the first loem keyset we find.  This is
for people who extract the bios.bin by hand and then blindly burn it
into their flash.  This way they'll still get some valid loem keys.
It's not a great solution, but it's better than nothing.

BUG=chromium:381862
TEST=signed recovery image by hand w/loemkeys and looked at packed bios.bin
TEST=signed recovery image by hand w/devkeys and looked at packed bios.bin
TEST=signed recovery image by hand w/custom loemkeys and looked at packed bios.bin
BRANCH=none

Change-Id: I8db1e34d9f4d85be6edf81fecf79a72031571b01
Reviewed-on: https://chromium-review.googlesource.com/204262
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2014-06-18 01:40:05 +00:00
Mike Frysinger
51ca0b82a6 create_new_keys: drop redundant settings
The common.sh file already defines these variables/funcs, so drop them.

BUG=chromium:381862
TEST=`./create_new_keys.sh` created new keys correctly
BRANCH=none

Change-Id: Ie7f0f683d4971c188d4629b520938b4b65bb0a9f
Reviewed-on: https://chromium-review.googlesource.com/203685
Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2014-06-17 05:21:07 +00:00
Mike Frysinger
aa888463b8 image_signing: support loem keysets with firmware shellballs
With an loem keyset in a recovery shellball, we don't want to write the
rootkeys & vblocks to the firmware image directly.  Instead, we'll put
them into a keyset subdir that the firmware updater will process later.

bios.bin
keyset/
  rootkey.LOEMID
  vblock_A.LOEMID
  vblock_B.LOEMID

We still write the recovery key to the firmware image though as that is
shared between all the keysets.

BUG=chromium:381862
TEST=Ran against a recovery image with devkeys & loemkeys and checked shellball
TEST=`cbuildbot daisy-release` works
BRANCH=none

Change-Id: I6fc99c71e6c7dee25f7f9a466a97314ff750fda9
Reviewed-on: https://chromium-review.googlesource.com/203682
Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2014-06-16 10:02:43 +00:00
Mike Frysinger
d81a3269b8 sign_firmware: clean up style to use a main func
No real functional changes here.  Tidying up to make the next CL easier.

BUG=chromium:381862
TEST=ran by hand and checked output
BRANCH=none

Change-Id: I9ffea6eba17560797135f39cf861318b545b9a54
Reviewed-on: https://chromium-review.googlesource.com/203681
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
2014-06-13 20:36:52 +00:00
Daniel Erat
bdc2c94343 vboot_reference: Don't use session_manager_use_flags.txt.
Make ensure_no_nonrelease_files.sh stop grepping
/etc/session_manager_use_flags.txt for USE flags. Instead,
look for non-comment lines in /etc/chrome_dev.conf.

BUG=chromium:377301
TEST=manual: ran against images both with and without
     extra config directives
BRANCH=none
CQ-DEPEND=I86d01f4a551433527bb434dc62c30fb44082f774
CQ-DEPEND=Ic030207840b6be79b51486d1706573241a01c08d

Change-Id: Iefeefd936dc7706ed74340edb6521621885bbe25
Reviewed-on: https://chromium-review.googlesource.com/203463
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Daniel Erat <derat@chromium.org>
Tested-by: Daniel Erat <derat@chromium.org>
2014-06-12 08:39:59 +00:00
Hung-Te Lin
9fc41a02f5 make_dev_firmware.sh: Correct firmware body size when changing rootkey.
make_dev_firmware.sh calls resign_firmwarefd.sh, which extracts rootkey from
input image for checking VBLOCK firmware body size. As a result, we should
resign firmware before changing rootkey / GBB.

BUG=chromium:365738
TEST=Install Nyan/Peppy PreMP-signed firmware, run make_dev_firmware.sh, and
     then boot in normal mode.
BRANCH=none

Change-Id: I45dbcacb40b7b77bbf89f1ba244bf7fb25f9ae27
Signed-off-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/196521
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2014-04-25 01:55:21 +00:00
Hung-Te Lin
4ff446b493 set_gbb_flags: Aborts only if HW & SW WP are both enabled.
Early proto devices (for testers and developers) may have hardware write
protection enabled and software disabled. They can still flash SPI ROM  in that
case, and no need to disable hardware WP switch.

BRANCH=none
BUG=chromium:341242
TEST=./set_gbb_flags.sh 0x39 # see WP messages.

Change-Id: Id320410795a162a009b80360c2225c7510337591
Reviewed-on: https://chromium-review.googlesource.com/186336
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Shawn Nematbakhsh <shawnn@chromium.org>
Commit-Queue: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-02-14 15:29:59 +00:00
Hung-Te Lin
e8117120b6 set_gbb_flags: Check write protection status before starting to flash.
People trying to override GBB flags and not having write protection disabled may
corrupt whole RW section of firmware.

To avoid that, we should check write protection before starting to invoke
flashrom commands.

BUG=chromium:341242
TEST=./set_gbb_flags.sh 0x39 # Aborted on a write-protected system, as expected.
BRANCH=none

Change-Id: I6b2dcc75b87dc5ceace0d7caec62ded787b2b534
Signed-off-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/185653
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Hung-Te Lin <hungte@google.com>
2014-02-11 05:40:14 +00:00
Hung-Te Lin
798cc91de1 Change flashrom target selection parameter.
The "-p internal:bus=*" is now deprecated by "-p {host,ec}" because we may have
EC on SPI bus.

BUG=none
TEST=manually executed dev_debug_vboot and see correct output.
BRANCH=none

Change-Id: I6363c09c2ebf57812bf35b7db220303a2786db20
Reviewed-on: https://gerrit.chromium.org/gerrit/66321
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Yung-Chieh Lo <yjlou@chromium.org>
Commit-Queue: Hung-Te Lin <hungte@chromium.org>
2013-08-21 19:19:43 -07:00
Don Garrett
7a3a467667 Add a script to remove /boot and its contents from an image.
This is a helper script intended for the signing servers to use to strip
out the /boot directory from images just before signing.

BUG=chromium:210352
TEST=Manually used to strip and image and validated the results.
BRANCH=None

Change-Id: I814522284143d8f90651e13000d428718aeca1e4
Reviewed-on: https://gerrit.chromium.org/gerrit/60828
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Don Garrett <dgarrett@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
2013-08-05 19:16:24 -07:00
Paul Taysom
f5c62bd7dc Fixed sign_official_build.sh to work with PARTUUID
Fixed sign_official_build.sh to work with PARTUUID in the linux format,
PARTUUID=%U/PARTNROFF=1. Had to handle the '/'.

Also fixed a misspelled variable name, devcie -> device. It worked
before because a NULL string generated the right results in the
current configuration.

BUG=chromium:224066
TEST=~/trunk/src/platform/vboot_reference/scripts/image_signing/sign_official_build.sh recovery /home/taysom/trunk/src/build/images/$B/latest/recovery_image.bin /home/taysom/trunk/src/platform/vboot_reference/tests/devkeys /tmp/taysom.bin
BRANCH=none

Change-Id: Id201885a63c6eba4cdb7c9216c0d3d35e6d3f0c4
Reviewed-on: https://gerrit.chromium.org/gerrit/61889
Tested-by: Paul Taysom <taysom@chromium.org>
Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
Commit-Queue: Paul Taysom <taysom@chromium.org>
2013-07-24 12:09:45 -07:00