summaryrefslogtreecommitdiff
path: root/scripts/image_signing/make_dev_firmware.sh
Commit message (Collapse)AuthorAgeFilesLines
* vboot: deprecate v1 GoogleBinaryBlockHeader structJoel Kitching2019-05-171-1/+2
| | | | | | | | | | | | | | | | | Deprecate internal usage of GoogleBinaryBlockHeader struct in favour of vb2_gbb_header struct. Keep the v1 struct around until we remove references in other repos. BUG=b:124141368, chromium:954774 TEST=make clean && make runtests BRANCH=none Change-Id: I396d2e624bd5dcac9c461cc86e8175e8f7692d26 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/1583826 Commit-Ready: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* make_dev_firmware.sh: correct typoNick Sanders2018-05-101-1/+1
| | | | | | | | | | | | | | | chromoes-tpm-recovery was misspelled, correct to chromeos-tpm-recovery BRANCH=None BUG=None TEST=None Change-Id: Ia3109348eed59f27b08d5261fbcc3d1d93067e89 Reviewed-on: https://chromium-review.googlesource.com/1043494 Commit-Ready: Nick Sanders <nsanders@chromium.org> Tested-by: Nick Sanders <nsanders@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* make_dev_firmware.sh supports switching EC RO keyWai-Hong Tam2018-02-021-102/+208
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For the EC supporting EFS boot, the RO section contains a public key, and the RW is signed. For running FAFT, should replace the RO key to a known one (the dev key under vboot_reference), such that FAFT tests can resign the RW using a known private key. For BIOS image, we use make_dev_firmware.sh to do a similar job to replace the key in BIOS. This CL makes the make_dev_firmware script support changing EC key. BUG=b:71769443 BRANCH=none TEST=Modify files $ # Check the original BIOS and EC images $ futility show ec.bin $ futility show bios.bin $ ./make_dev_firmware.sh --change_ec -f bios.bin -t new_bios.bin \ -e ec.bin -o new_ec.bin --backup_dir backup $ # Check the new images, using new keys and verification succeeded $ futility show new_ec.bin $ futility show new_bios.bin TEST=Modify live firmware $ ./make_dev_firmware.sh --change_ec And then run firmware_ECUpdateId with a Type-C charger. TEST=Run sign_official_build.sh $ sign_official_build.sh recovery recovery_image.bin \ ~/trunk/src/platform/vboot_reference/tests/devkeys /tmp/out.bin TEST=make runalltests Change-Id: Id51e2c411a4e6d016e619cec91453ce918b7fff7 Reviewed-on: https://chromium-review.googlesource.com/889406 Commit-Ready: Wai-Hong Tam <waihong@google.com> Tested-by: Wai-Hong Tam <waihong@google.com> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* Change invocation of "gbb_utility" to "futility gbb"Hung-Te Lin2017-06-211-6/+7
| | | | | | | | | | | | | Replace commands using gbb_utility by the new 'gbb' futility command. BRANCH=none BUG=None TEST=USE=test emerge-$BOARD vboot_reference Change-Id: I8c1547d295a955373413482509a33964b0e0c06f Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/538442 Reviewed-by: Stefan Reinauer <reinauer@google.com>
* image_signing: unify output helpersMike Frysinger2017-05-191-11/+11
| | | | | | | | | | | | | | | | | | | | We have `err_die` and `die` helpers that do the same thing, but some scripts just have to know which one to use based on their runtime. Just unify them as the more common `die` so all scripts can use it. Similarly, we provide info, warn, and error to dev scripts, but not to the runtime ones. Add small stubs in common_minimal.sh so the API is consistent. BRANCH=None BUG=chromium:718184 TEST=scripts still work Change-Id: Id44fb27900c37f4e357d20817f909e4534d1c5b3 Reviewed-on: https://chromium-review.googlesource.com/507990 Tested-by: Mike Frysinger <vapier@chromium.org> Reviewed-by: David Riley <davidriley@chromium.org> Commit-Queue: Mike Frysinger <vapier@chromium.org>
* scripts: Add "-p host" to make_dev_firmware.sh.stabilize-9157.BHung-Te Lin2016-12-281-7/+9
| | | | | | | | | | | | | | Always add "-p host" for flashrom to find right programmer. BRANCH=None BUG=chrome-os-partner:60894 TEST=./make_dev_firmware.sh Change-Id: Iee66e143e77ea258a2a9ff3757d9446b7cf37dbc Reviewed-on: https://chromium-review.googlesource.com/419860 Commit-Ready: Hung-Te Lin <hungte@chromium.org> Tested-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Ting Shen <phoenixshen@chromium.org>
* scripts: Change anti-rollback check from error to warning for make_dev_firmware.Hung-Te Lin2016-12-141-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | Currently make_dev_firmware will abort if the stored TPM version is higher and ask user to reset TPM; however that is not very feasible because: (1) If the device is still MP-signed, external users can't boot dev-signed factory shim or recovery or test images. (2) Even if the user is able to reset TPM, the stored TPM version will be increased again when user boots into the image for running make_dev_firmware. As a result, the right flow is to allow user (with warning and instructions) resign firmware with dev-keys, boot into recovery mode due to anti-rollback check, and then boot any dev-signed image to reset TPM. BRANCH=none BUG=None TEST=./make_dev_firmware.sh # see warning message. Change-Id: Ifd4cd9912ab505427c985154b3f469e1485789b2 Reviewed-on: https://chromium-review.googlesource.com/419898 Commit-Ready: Hung-Te Lin <hungte@chromium.org> Tested-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Mattias Nissler <mnissler@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* scripts: Improve make_dev_firmware and allow working with more MP firmware.Hung-Te Lin2016-10-011-10/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Verified boot has "TPM anti-rollback check" that prohibits booting firmware if the device has been installed with a firmware that has higher signing version. This is causing problems when people are trying to use make_dev_firmware script on MP devices (which usually has a higher version than DEV keyset, which is always 1). Previously, make_dev_firmware won't alert about this so developers will first see boot failure, figure out what happened, and then either uprev the devkeys folder manually (which we don't provide scripts on DUT so it's hard), or reset the device by using factory reset shim. Since make_dev_firmware already knows all information, it should check and increase version number automatically. This change has implemented checking and increasing 'firmware version'. The 'data key version' is also checked, but increasing that is more complicated and we probably don't have all required tools yet on DUT, so it is only checked. Also added one flag --[no]mod_hwid so MP device users can keep their HWID easier, when they need to switch back and forth between DEV / real MP firmware. BRANCH=none BUG=none TEST=Grab a firmware from daisy mp-v4.bin and do ./make_dev_firmware.sh -f bios.bin -t out.bin --nomod_hwid Change-Id: If81ef60e6debdcd1c6d899b5a2c03bdacb4fd4f7 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/390871 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* make_dev_firmware.sh should use key.versions filestabilize-8798.BBill Richardson2016-09-121-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The 'key.versions' file is used by the image signing scripts to ensure that newly generated keys and re-signed buildbot images have the correct version numbers to avoid rollback in officially-signed Chrome OS images. If a skilled user is re-keying her Chromebook to use personal keys in normal mode (which requires disabling WP and changing the GBB and VBLOCK_A/B), she can avoid clearing the TPM rollback counters if make_dev_firmware.sh will obtain the firmware_version from the key.versions file in her personal key directory. BUG=none BRANCH=none TEST=make runtests, manual tests Extract an MP-signed BIOS from a Chromebook Peppy. flashrom -p host -r peppy.bin Resign it without this CL: make_dev_firmware.sh -f peppy.bin -k tests/devkeys -t dev_peppy.bin Resign it with this CL: make_dev_firmware.sh -f peppy.bin -k tests/devkeys -t dev_peppy_new.bin Confirm no difference: cmp dev_peppy.bin dev_peppy_new.bin Temporarily edit tests/devkeys/key.versions to contain firmware_key_version=2 firmware_version=3 kernel_key_version=4 kernel_version=5 Resign again: make_dev_firmware.sh -f peppy.bin -k tests/devkeys -t dev_peppy_new2.bin Confirm that the only difference is the firmware version in VBLOCK_A/B: futility show dev_peppy_new*.bin Change-Id: I133f1b58fb969eaeb239a44a4800750c4eee1d5f Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/383887 Reviewed-by: Mike Frysinger <vapier@chromium.org>
* make_dev_firmware.sh: Correct firmware body size when changing rootkey.stabilize-5807.0.BHung-Te Lin2014-04-251-25/+28
| | | | | | | | | | | | | | | | 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>
* vboot_reference: Improve make_dev_firmware script.Hung-Te Lin2012-08-011-48/+35
| | | | | | | | | | | | | | | | | | | | | | Developers testing firmware preamble flags (usually for turn on/off RO-NORMAL bits) need a easy way to change existing firmware, without hacking FDT source / looking for complex script. Also included some minor improvements: * Always enable FORCE_DEV_BOOT_USB and DISABLE_FW_ROLLBACK_CHECK. These are flags most developers need when leaving official signed normal firmware. * --bmpfv is deprecated because our latest firmware now always include official bitmaps in updater, no more DEV bitmaps. BUG=none TEST=./make_dev_firmware.sh -f bios.bin -t new_bios.bin --preamble_flags 0 ./make_dev_firmware.sh -f bios.bin -t new_bios.bin --preamble_flags 1 Change-Id: I7ee72d32b4b7fa28f2be635fd8c7bb678852e132 Reviewed-on: https://gerrit.chromium.org/gerrit/28792 Tested-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Ready: Hung-Te Lin <hungte@chromium.org>
* make_dev_firmware: handle developer firmware keyblock correctlyfirmware-u-boot-v1firmware-881-u-boot-v1Hung-Te Lin2011-08-101-0/+29
| | | | | | | | | | | | | | | | | | We should detect keyblock from existing firmware and decide if a developer firmware keyblock should be used. BUG=chromium-os:18946 TEST=./make_dev_firmware.sh -f zgb.bin -t zgb_dev.bin # seeing Using keyblocks (developer, normal)... ./make_dev_firmware.sh -f mario.bin -t mario_dev.bin # seeing Using keyblocks (normal, normal)... ./make_dev_firmware.sh -f arm.bin -t arm_dev.bin # seeing Using keyblocks (normal, normal)... Change-Id: I74fa0db980e26a6a19a4393303e8c5b3260c84c7 Reviewed-on: http://gerrit.chromium.org/gerrit/5623 Tested-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org>
* resign_firmwarefd.sh: support new "flag" (for hinting two-stop FW)Hung-Te Lin2011-07-221-0/+4
| | | | | | | | | | | | | | The two-stop firmware relies on the "flag" field which may be useful for the resign_firmwarefd.sh. BUG=chrome-os-partner:5095 TEST=./resign_firmwarefd [params] 1 vbutil_firmware --verify ..... # seeing flag = 1 Change-Id: I56b44ee5b610e36384e15e6eb31286f0f838734b Reviewed-on: http://gerrit.chromium.org/gerrit/4561 Tested-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
* vboot_reference: fix make_dev_firmware failureHung-Te Lin2011-03-241-0/+4
| | | | | | | | | | | | | | | The script to resign firmware (resign_firmwarefd.sh) has changed its syntax, due to the new "dev firmware" design. BUG=chromium-os:13375 TEST=./make_dev_firmware.sh # seeing the "changed firmware to Developer Keys" message. Change-Id: Id553f3ce1641f13e732bd5e208cb2fb00ca9c078 R=rspangler@chromium.org,gauravsh@chromium.org Review URL: http://codereview.chromium.org/6727019
* vboot/make_dev_firmware: extract bitmaps from system firmware instead of ↵Hung-Te Lin2011-03-041-6/+40
| | | | | | | | | | | | | | | | | | | prebuilts. make_dev_firmware should trust system firmware blobs instead of using its own prebuilt binaries. BUG=chromium-os:12400 TEST=1. make a build with .49+ BIOS, and create the firmware updater 2. install the new BIOS, turn on developer switch and reboot 3. an ugly "DEV" screen (in .49) is shown on screen 4. run the new make_dev_firmware.sh 5. reboot. seeing the ugly DEV instead of the prebuilt blue screen (verified successfully) Change-Id: If75d2821170649fa869db6a82d879b697f7588e6 Review URL: http://codereview.chromium.org/6614006
* Split common.sh into bash-only and dash-only sectionsGaurav Shah2011-01-181-2/+2
| | | | | | | | | Change-Id: I044331dc3558a4f7428b75fe43ef739498d65803 BUG=chromium-os:10836 TEST=scripts that use common.sh seem to work, would appreciate help in testing Chrome OS client scripts! Review URL: http://codereview.chromium.org/6294002
* vboot_reference/make_dev_firmware: check write protection status before ↵Hung-Te Lin2011-01-061-1/+23
| | | | | | | | | | | | | | | | | | | making changes Complete the missing part of "checking (and disabling) write protection status. This also helps to prevent erasing RW regions on system with WP enabled and then causing boot failure. BUG=chrome-os-partner:1276 TEST=(1) On CR-48 with WP enabled, run make_dev_firmware.sh without turning off WP. Result: Error message "Write protection is still enabled. Please verify that hardware write protection is disabled." (as expected) (2) Disable WP and run again. Result: firmware has been changed successfully. Change-Id: Iaf2243cb2cd3c7f83ce4f36543ea3da1e3ca55a1 Review URL: http://codereview.chromium.org/5987010
* Check in tofactory script.Randall Spangler2011-01-041-18/+0
| | | | | | | | | | | Also refactor the other scripts to move more common functions (debug output, etc.) to common.sh. BUG=chrome-os-partner:1903 TEST=manual; ran on a Chrome notebook, verified the right things got copied. Review URL: http://codereview.chromium.org/5878005 Change-Id: Ib7131356ecb6f88eee3d529a518f23b94756d0c0
* make_dev_firmware: provide more usage help for backup filesHung-Te Lin2010-10-191-1/+18
| | | | | | | | | | | | Provide more clear instruction on how to use the backup files, and to try more effort to store backup files BUG=none TEST=emerge-x86-generic vboot-reference; executed make_dev_firmware and got correct message Change-Id: I2062f45dd3019d0e56adc18bdd1861991aafe5ed Review URL: http://codereview.chromium.org/3785014
* make_dev_ssd: new script to change SSD image to dev keyHung-Te Lin2010-10-161-37/+30
| | | | | | | | | | | | | | | | | | | | | The make_dev_ssd.sh is made for devinstall shim to change SSD kernels to be signed by dev keys. - Kernel A, B will be resigned with dev keys (ignore if A/B seems not bootable) - Adding param --remove_rootfs_verification can even disable rootfs hash check This CL also includes some shared refine/fix to make_dev_firmware.sh BUG=chrome-os-partner:1276 TEST=sudo ./make_dev_ssd.sh; (seeing Kernel A is resigned and B is ignored) then reboot without developer mode (OK), rootdev shows /dev/dm-0, rootdev -s shows /dev/sda3 sudo ./make_dev_ssd.sh --remove_rootfs_verification; then reboot without developer mode (OK), rootdev shows /dev/sda3 Change-Id: Ic20f734b2af42e50a43c19a565a166a39d57a7fd Review URL: http://codereview.chromium.org/3772013
* make_dev_firmware: new script to change firmware to dev keyHung-Te Lin2010-10-151-0/+231
The make_dev_firmware.sh is made for devinstall shim to change firmware rootkey/HWID/BMPFV smoothly. - HWID will be changed to "$ORIGINAL_FWID DEV" (no change if already postfixed with DEV) - rootkey/recoverykey will be changed by keyset from --keys - FVMAIN/FVMAINB will be resigned by keyset from --keys - BMPFV will be changed to anything assigned by --bmpfv If --from and --to are omitted, the system firmware will be changed. A new ebuild is be created to put all resources (bmpfv and keyset) into devinstall shim (ref: http://codereview.chromium.org/3776003) BUG=chrome-os-partner:1276 TEST=sudo ./make_dev_firmware.sh --from input_bios.bin --to output_bios.in \ --keys ../../tests/devkeys --bmpfv some_bmpfv.bin HWID is changed from "XXX MARIO EVT DDDD" to "XXX MARIO EVT DDDD DEV". System can then boot a USB signed with devkey without developer mode. Change-Id: Id80126495dcbf4d993a4372af645580cd4b60ca6 Review URL: http://codereview.chromium.org/3822002