summaryrefslogtreecommitdiff
path: root/util
Commit message (Collapse)AuthorAgeFilesLines
* getversion: drop cryptoc from the Cr50 version stringstabilize-14396.B-cr50_stabstabilize-14395.B-cr50_stabstabilize-14388.62.B-cr50_stabstabilize-14388.61.B-cr50_stabstabilize-14388.52.B-cr50_stabrelease-R98-14388.B-cr50_stabVadim Bendebury2021-12-071-1/+1
| | | | | | | | | | | | | | | | Cr50 uses local implementation of crypto, no need to keep track of the third_party tree. BUG=None TEST=built cr50 image and ran it, verified that cryptoc is not included in the version string any more. Signed-off-by: Vadim Bendebury <vbendeb@google.com> Change-Id: Ic016492ffc203a704d9ad252a4a05cc16074863f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3318734 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Mary Ruthven <mruthven@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org>
* prepare to release 0.{5,6}.70Mary Ruthven2021-11-192-2/+2
| | | | | | | | | | | BUG=b:207143125 TEST=make buildall -j Change-Id: Ib31feddde38061df787ec78b7a2131f00b4cc634 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3291134 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> Commit-Queue: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* coil: replace non-inclusive terms with "validity"Mary Ruthven2021-11-191-1/+1
| | | | | | | | | | BUG=b:173227629 TEST=make buildall -j Change-Id: Iaf8028984cc58cc4108907fdba4ea4b38c43cf70 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3293250 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* cr50: prepare to release 0.{5,6}.60Mary Ruthven2021-10-152-2/+2
| | | | | | | | | | BUG=b:203205487 TEST=none Change-Id: I90ef2a52a40ceef6de930df2acb635cdc0b3d014 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3227259 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* fips: silence fips section fillerVadim Bendebury2021-10-111-7/+13
| | | | | | | | | | | | | | | | | | | | | | Script inserting FIPS checksum into the image uses the dd utility which generates stderr output even when there is no errors. This patch adds code which captures the dd stderr output and prints it out only if there is an actual error. stdout output of the script is suppressed unless make was invoked with V=1. Also made a few modifications as requested by shellcheck. BUG=none TEST=make output does not have extra lines. built and ran a Cr50 image, it reports successful FIPS integrity self check. Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Change-Id: I9121bc5a9a40633b9a3d18ea5766bc1ed274a9c2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3210946 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* Excise cros_logging modulestabilize-rust-14224.B-cr50_stabChris McDonald2021-09-161-1/+1
| | | | | | | | | | | | | | | Replace all usages of chromite.lib.cros_logging with the stdlib logging module. BUG=b:191490453 TEST=None BRANCH=None Signed-off-by: Chris McDonald <cjmcdonald@chromium.org> Change-Id: I661a620fb514b2b53b6e6c5d76c90cca0280959c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3162336 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Alex Klein <saklein@chromium.org>
* add script to inject the fips fingerprintMary Ruthven2021-09-071-0/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Inject the fips fingerprint into the cr50 image, so it can verify the fips module before starting to execute it. This change adds a script to calculate the checksum and inject it into a elf file before signing. If CONFIG_FIPS_CHECKSUM is defined, generate an elf file with the fips checksum and use that to create signed images and hex files. The build process doesn't change for RO artifacts. Nothing changes if CONFIG_FIPS_CHECKSUM isn't defined. The new chain for RW is ec.RW.elf -> ec.RW.elf.fips -> ec.RW.flat ec.RW.elf.fips is generated with util/inject_fips_fingerprint.sh. util/inject_fips_fingerprint.sh calculates the fips module fingerprint, copies ec.RW.elf to ec.RW.elf.fips, and then injects the fingerprint into ec.RW.elf.fips. util/signer/bs will be modified to use ec.RW.elf.fips if it exists in a followup CL. BUG=none TEST=manual # Verify cr50 is the only board that creates the fips artifacts make buildall -j objdump the text.fips_checksum section of ec.RW.elf and ec.RW_B.elf. Make sure they match ec.RW.fips.checksum and ec.RW_B.fips.checksum # Verify cr50 can update to image signed with devid and that # image shows Stored hash that matches the computed one. H1_DEVIDS="${DEVID}" make -j BOARD=cr50 CR50_DEV=1 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Change-Id: Iab857ec1b7e3ae0d23681a25467e26286bd68210 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3078053 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* cr50: prepare to release 0.{5,6}.51Mary Ruthven2021-08-242-2/+2
| | | | | | | | | | | BUG=b:194901448 TEST=none Change-Id: Ia16d194f042ab44a36e00668f699dfab4df8a536 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3114224 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org>
* cr50: prod: use 6 as the major versionMary Ruthven2021-08-241-1/+1
| | | | | | | | | | | | | | | | Use 6 as the major version in util/signer/ec_RW-manifest-prod.json to reduce merge conflicts in the branches This has no real effect since we don't prod sign TOT images. BUG=none TEST=none Change-Id: I1300a4080ea4a5fee3115f1e32736985789d9c11 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3114223 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org>
* cr50: prepare to release 0.{5,6}.50Mary Ruthven2021-08-052-2/+2
| | | | | | | | | | BUG=b:194901448 TEST=none Change-Id: I9d4d5133d26ac528b2ecf5e1b0f4be20a47badb8 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3072819 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* cr50: prepare to release 0.{5,6}.40Mary Ruthven2021-07-022-2/+2
| | | | | | | | | | | BUG=b:192269002 TEST=none Change-Id: Ied092d9dd0a909aae116f440fa545ee43ec4c6ed Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3002844 Reviewed-by: Andrey Pronin <apronin@chromium.org> Commit-Queue: Andrey Pronin <apronin@chromium.org>
* test: port to Python3Vadim Bendebury2021-06-181-2/+4
| | | | | | | | | | | | | | Porting consisted of running 2to3 and then modifying the Tee::write() function by hand. BUG=none TEST='make -j buildall' does not throw Python2 warnings any more and still succeeds. Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Change-Id: I6762bfc176ef749dccba7572db171dd2f83aaebc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2973575 Reviewed-by: Namyoon Woo <namyoon@chromium.org>
* flash_cr50: add support to reboot with the consolestabilize-14026.B-cr50_stabMary Ruthven2021-06-091-4/+33
| | | | | | | | | | | | | | If cr50 is open, flash_cr50 can just run 'reboot' on the cr50 console to reboot cr50. Add support for doing that. BUG=none TEST=flash_cr50.py -p 9999 -i $IMG -c cr50-rescue -r console_reboot Change-Id: Ibe0d7f98c64faf7f0ac35b04dfad89ad58333cac Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2945957 Reviewed-by: Namyoon Woo <namyoon@chromium.org> Commit-Queue: Namyoon Woo <namyoon@chromium.org>
* flash_cr50: wait up to 15 seconds for EC cutoffMary Ruthven2021-05-211-2/+9
| | | | | | | | | | BUG=b:188846962 TEST=run on hatch Change-Id: I1d9ea6048cec240c830dcd5d56c41b5cbfd622a1 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2911495 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* cr50: prepare to release 0.{5,6}.30Mary Ruthven2021-05-142-2/+2
| | | | | | | | | | | BUG=b:187083680 TEST=none Change-Id: I76ad8b29b32007fde0e8a6b527f08fa2333e801a Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2897918 Reviewed-by: Namyoon Woo <namyoon@chromium.org> Commit-Queue: Namyoon Woo <namyoon@chromium.org>
* signer: advance version and erase new bit in rollback mapMary Ruthven2021-05-042-4/+4
| | | | | | | | | | | | | | | | | | | BUG=b:187081660 TEST=flashing the image erases the third rollback mask bit [0.049072 update_rollback_mask: bailing out at bit 0] [0.051795 update_rollback_mask: bailing out at bit 3] [0.052886 updated 1 info map words] > sysinfo ... Rollback: 0/0/1 3/3/3 ... Change-Id: Id802e3e4b010fbc7274e34360beaa47adcd0816f Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2869128 Reviewed-by: Andrey Pronin <apronin@chromium.org>
* cr50: prepare to release 0.{5,6}.10Mary Ruthven2021-04-192-2/+2
| | | | | | | | | | | BUG=none TEST=none Change-Id: I73cca2c2e9044f9dd8b7cb9a4d558ad9c6ec83b1 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2837405 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org>
* flash_cr50: add c2d2 to allowable servo typesstabilize-rust-13795.B-cr50_stabstabilize-13799.B-cr50_stabMary Ruthven2021-02-091-1/+1
| | | | | | | | | | BUG=none TEST=run flash_cr50 with c2d2 and servo_micro Change-Id: Idba1a344fb615347ccbdca6cad3956b05be2326b Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2648393 Reviewed-by: Venkata Srinivasa Raju Penmetcha <venkataraju@chromium.org>
* cr50: prepare to release 0.{5,6}.9stabilize-rust-13776.B-cr50_stabstabilize-13768.B-cr50_stabMary Ruthven2021-02-022-2/+2
| | | | | | | | | | | BUG=b:179153941 TEST=none Change-Id: I6b35f52d94ffeb49d947abbb71eb1445e4a96e7b Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2669267 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org>
* coil: config_option_check master->mainMary Ruthven2021-01-061-6/+6
| | | | | | | | | | BUG=b:175244613 TEST=make buildall -j Change-Id: I8a5273dca838d922627d084ee6330f5be3dfa0b7 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2613454 Reviewed-by: Namyoon Woo <namyoon@chromium.org>
* coil: Replace "whitelist"Mary Ruthven2020-12-221-3/+3
| | | | | | | | | | | | Replace "whitelist" with "allowlist". BUG=b:175244613 TEST=make buildall -j Change-Id: Ie0a23cb33722fe27b76d97c2ebdd548c2ecc2aa6 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2600299 Reviewed-by: Namyoon Woo <namyoon@chromium.org>
* cr50: prepare to release 0.{5,6}.8Mary Ruthven2020-10-302-2/+2
| | | | | | | | | | BUG=b:172066114 TEST=none Change-Id: I553a06c52da3468358357fa08596e01238ed86b3 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2510463 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* cr50: prepare to release 0.{5,6}.7Mary Ruthven2020-09-172-2/+2
| | | | | | | | | | BUG=b:168502792 TEST=none Change-Id: I4151120813f37c2427747ade01fb8a43dae9518a Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2416951 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* util: modify getversion to use proper timestamps.Vadim Bendebury2020-09-141-9/+18
| | | | | | | | | | | | | | | | | | | | | | The getversion.sh utility even when compiling the version string based on the state of several git trees always uses the ec tree for timestamps, be it the latest modified file if the tree is 'dirty' or the last commit time if the tree is clean. It should be using the latest time from all of the trees included in the build. BUG=none TEST=verified operation for Cr50 with both main and secondary trees clean and dirty Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Change-Id: I72dc1d49ec997c789697b15f7d79fa9f4a8f8adc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2393101 Reviewed-by: Craig Hesling <hesling@chromium.org> (cherry picked from commit 5ab4bd06261abf1204638c8ef877a9adb041d6e8) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2410700 Reviewed-by: Mary Ruthven <mruthven@chromium.org>
* private-cr5X: add relevant git trees sha values to the version stringVadim Bendebury2020-07-231-9/+19
| | | | | | | | | | | | | | | Version strings of the boards built from the private directories should include git status information from all git trees used to build the images. BUG=none TEST=tried running 'BOARD=xyz ./util/getversion.sh' and verified that the expected git trees are added to the version string. Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Change-Id: I5414a1de07171d37277ba508551a79ba84776ac6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2310777 Reviewed-by: Namyoon Woo <namyoon@chromium.org>
* cr50: prepare to release 0.{5,6}.6Mary Ruthven2020-07-222-2/+2
| | | | | | | | | | BUG=b:161755898 TEST=none Change-Id: Ic1e719addea733a3b8d198a771e0f038f9adf854 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2310592 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* cr50: prepare to release 0.{5,6}.5Mary Ruthven2020-06-122-2/+2
| | | | | | | | | | BUG=b:158774719 TEST=none Change-Id: I4558a8d4cb9219c8d78db9982f9c5d80d8a30d84 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2242770 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* remove CR50_SQAMary Ruthven2020-06-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | SQA images won't be built anymore. This change removes the SQA support. It deletes all SQA ifdefs and replaces CR50_RELAXED with CR50_DEV. BUG=b:158011401 TEST=manual build regular image and check eraselfashinfo and rollback aren't included. build image with CR50_SQA=1 and check it's no different than the regular image. build DBG image and make sure it still starts open, it has the eraseflashinfo and rollback commands, and it can flash old cr50 images. Change-Id: I5e94c88b1903cfcf0eee0081fc871e55fc8586c7 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2227149 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Namyoon Woo <namyoon@chromium.org>
* ap_ro_flash.py: add new values and clean upVadim Bendebury2020-05-201-7/+12
| | | | | | | | | | | | | | | Add new error values reported by the VENDOR_CC_SEED_AP_RO_CHECK vendor command, and clean up the command line error processing to report all collected errors instead of just complaining that the ranges were not specified in the command line. BUG=b:153764696 TEST=used the script and observed expected error values reported. Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Change-Id: I0f5e6a28776af2afc550bd2c44e6cc3a0cb80153 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2204977 Reviewed-by: Namyoon Woo <namyoon@chromium.org>
* ap_ro_hash.py: improve error processing and help messagesVadim Bendebury2020-05-141-5/+30
| | | | | | | | | | | | | | | | | | | | This patch adds processing of the case when the Cr50 does not support the vendor command setting the AP RO areas hash. Also improve help message and include text descriptions of the encountered errors, if any. BUG=b:153764696 TEST=with the rest of the patches applied verified that programming of the AP RO verification space succeeds when expected, and proper errors are reported in case of failure. ./util/test_ap_ro_hash.py also still succeeds. Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Change-Id: Ie3898ef5ab925404decd730f457267615c9ab39c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2171397 Reviewed-by: Andrey Pronin <apronin@chromium.org>
* cr50: prepare to release 0.{5,6}.4Mary Ruthven2020-05-082-2/+2
| | | | | | | | | | BUG=none TEST=none Change-Id: Idc983499980c0211d29767bb9dfad6caac99dc00 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2189617 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* cr50: prepare to release 0.{5,6}.3Mary Ruthven2020-05-042-2/+2
| | | | | | | | | | BUG=none TEST=none Change-Id: I33ad7debedb98f8ff90b4e8eaff96e25c73da4cd Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2180880 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* util: script for generating RO hashesVadim Bendebury2020-05-042-0/+867
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This python script will be run in a Chrome OS factory image, with limited availability of chromite libraries. The command line parameters of the script are a set of AP firmware address ranges and FMAP section names. The script does the following: - use flashrom to read the FMAP area from the AP flash and dump_fmap to generate the flash map description. - verify that section names passed in as parameters (if any) are indeed are present in the flash map. - verify that all passed in ranges and sections fit into the WP_RO area of the flash (as defined if the flash map). - prepare a layout file to instruct flashrom to read only the sections of interest (as defined by ranges and section names passed in the command line). - use flashrom again to read the required sections of the AP flash into a file. - read the file and and pass the required sections through the sha256 hash calculation. - prepare the Cr50 vendor command to pass information about the flash ranges and the sha256 sum to Cr50 and send the command. A unit test is also being added. BUG=b:153764696 TEST=./util/test_ap_ro_hash.py succeeds. with the rest of the patches added end to end AP RO verification procedure also succeeds. Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Change-Id: Ic0fa3759b3a32db8cf521be28c3c7dfe0cd35278 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2161576 Reviewed-by: Mary Ruthven <mruthven@chromium.org>
* cr50: prepare to release 0.{5,6}.2stabilize-13070.B-cr50_stabMary Ruthven2020-04-282-2/+2
| | | | | | | | | | BUG=none TEST=none Change-Id: Ic84368d12832dc5bb08d7085090ad727130c3114 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2171517 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* cr50: prepare to release 0.{5,6}.1Mary Ruthven2020-04-082-4/+4
| | | | | | | | | | BUG=none TEST=none Change-Id: Ib0a272579ea750ab439a1bbede4e3ac9cc1380e6 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2142450 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* cr50: prepare to release 0.{3,4}.28Mary Ruthven2020-04-072-2/+2
| | | | | | | | | | BUG=none TEST=none Change-Id: Ia5c4b11ef217bad279b865a91c1618d9b6571c17 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2137911 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* cmsg: use two byte ints to send function name string indicesstabilize-sylas-13019.B-cr50_stabstabilize-13020.87.B-cr50_stabstabilize-13020.67.B-cr50_stabstabilize-13020.55.B-cr50_stabrelease-R83-13020.B-cr50_stabVadim Bendebury2020-04-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | When a string parameter __func__ ie encountered in the source code, the function name is saved in the format strings dictionary, and then packet is prepared, instead of sending the string, a byte of 0xff is sent and then the four byte value which is the string index. But two bytes is enough to send the string index, as it is a 16 bit value by design. This patch modifies both transmit and receive sides to start using 2 byte indices for __func__. BUG=b:149964350 TEST=built the new image, tried running it, observed correct function names in the console output. Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Change-Id: I682dd18cb4dd434e6982d33f1918ef398d5caa20 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2131046 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* util_precompile: add ability to reuse previously created blobsVadim Bendebury2020-04-012-0/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | Most strings in the Cr50 image are not going to change any time soon, the most likely change is the addition of new strings. With this in mind, it makes sense to keep the string dictionary around and just keep updating it when building a new image, maybe adding new strings, or most often just reusing the ones already in the blob. This patch tries reading the blob before processing the inputs, and if the blob is read and unzipped/unpickled successfully, its contents are used to seed the string dictionary before the inputs are processed. With this approach 100% compatibility between the Cr50 image and the blob is not required, most of the strings would be interpreted properly even with older blobs. A test case is being added to verify this behavior. BUG=b:149964350 TEST=./util/test_util_precompile.py Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Change-Id: I761d6b043dfc85b54352aadaa66d24d4027e95f8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2119144
* Make acroterm work with Cr50Vadim Bendebury2020-03-312-93/+383
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One of the difference between Acropora and Cr50 is such that in case of Acropora the format strings are transferred within packets, and in case of Cr50 only the index of the string is passed in the packet, the string itself is obtained from the list prepared by running util_precompile.py. Another difference is that in Acropora each console packet message represents a full line, in Cr50 the message could be representing just a part of the line, down to a single character. These differences require modifications of the packet header on the DUT side and modifications of the Packet class in Acroterm. Cr50Packet class inherits from Packet, to abstract header structure differences a class specific method of unpack_ph() is being added. The new method extracts packet fields, returning fields common for both packet formats, and saving the class unique values in the object attributes. This allows to consolidate the packet validation function and only divert processing when decode_packet() is invoked. Cr50Packet constructor is passed the list of format strings, the str_index field from packet header is the index of the format string in the list. The Cr50Term class inherits from Acroterm, the only difference is that Cr50Term uses Cr50Packet for packet processing, and prepares the list of strings, retrieving it from the blob created by util_precompile.py. Two new command line options are being added: --cr50_mode enables Cr50 packet mode console support --cr50_str_blob points at the strings blob, by default build/cr50/RW/str_blob is used. Note that on the DUT the Cr50 packet mode is disabled by default. To start using console packet one needs to add the line to board/cr50/board.h and rebuild the image. BUG=b:149964350 TEST=./util/test_acroterm.py succeeds. When Cr50 is built with the suggested modification of board/cr50/board.h, acroterm invoked as $ util/acroterm.py --tty /dev/ttyUSBx --cr50_mode allows to open terminal sessions with USB and UART consoles. Change-Id: I301a5515a0994dba91f2cb40a77c4b59c3becd45 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2116277 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* script for processing preprocessor outputVadim Bendebury2020-03-312-0/+715
| | | | | | | | | | | | | | | | | | | | This script is customized to be used in Chrome OS EC codebase, where functions cprintf(), cprints() and cputs()are used to generate console output. The operation of the script is extensively described in the docstring of the file, a unit test is provided to verify basic functionality. BUG=b:149964350 TEST=./util/test_util_precompile.py succeeds with the rest of the patches applied built a Cr50 image, verified that using a verified version of Acroterm one can communicate with Cr50 console the same way it works today over regular UART. Change-Id: I2c92088a8b08dcf7fdb606a01fbc94ab0d2df6e6 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2106863 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* cr50: prepare to release 0.{3,4}.27Mary Ruthven2020-03-272-2/+2
| | | | | | | | | | BUG=none TEST=none Change-Id: I67d8c30ee7ee1bfb9e75cee478a67f46feb19f88 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2124951 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* Bring in acroterm from the Dauntless project.Vadim Bendebury2020-03-252-0/+1191
| | | | | | | | | | | | | acroterm.py is a copy taken as if from Acropora core tree at sha 80bf39f and modified to add the Chromium OS authors headers. BUG=b:149964350 TEST=./util/test_acroterm.py Change-Id: I48e866e205ef62f6e776e6c50b0f970c9df5202a Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2114240 Reviewed-by: Mary Ruthven <mruthven@chromium.org>
* util: add flash_cr50 script for updating cr50.Mary Ruthven2020-03-091-0/+771
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add a flash_cr50 script for updating cr50. The script supports updating through gsctool and cr50-rescue. BUG=b:144048851 BRANCH=none TEST=manual python util/flash_cr50.py -i $IMAGE -p 9999 -c cr50-rescue on octopus. python util/flash_cr50.py -i $IMAGE -p 9999 --method=cr50_reset_odl -c cr50-rescue python util/flash_cr50.py -i $IMAGE -c 'sudo gsctool' python util/flash_cr50.py -i $IMAGE -s $SERIAL Change-Id: Ibdd213446fea4cb66f77c6b7249c02914bd0712a Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1907469 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit ba216cfef2a005717938b28ceab15b79406f7f3b) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2092916 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org>
* bs: use platform/cr50 as EC_ROOTMary Ruthven2020-03-071-1/+1
| | | | | | | | | | | | | BUG=none BRANCH=none TEST=manual sudo CR50_BOARD_ID="FFFF:0:10" H1_DEVIDS="${DEVID}" ./util/signer/bs Change-Id: I54f149bf5c0248a8672514258b596455d442ef69 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2088552 Reviewed-by: Namyoon Woo <namyoon@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* cr50: remove create_released_imageMary Ruthven2020-03-071-232/+0
| | | | | | | | | | | BUG=none BRANCH=none TEST=none Change-Id: I63a586c946f1b69547197767753e60f3319aad90 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2092211 Reviewed-by: Namyoon Woo <namyoon@chromium.org>
* cr50: prepare to release 0.{3,4}.26Mary Ruthven2020-02-272-2/+2
| | | | | | | | | | | BRANCH=cr50, cr50-mp BUG=none TEST=none Change-Id: I1dffd37d08c7d6209fafb9c18c7c5a87a1b20cba Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2076503 Reviewed-by: Namyoon Woo <namyoon@chromium.org>
* Reinstate util/chargenVadim Bendebury2020-02-211-0/+69
| | | | | | | | | | | | | | | | Cr50 related utilities should be coming from the cr50_stab branch of the EC tree. This patch brings back the ToT version of the util/chargen script which was previously dropped. BRANCH=cr50, cr50-mp BUG=b:149350081 TEST=with the rest of the patches applied installed chargen is taken from platform/cr50 Change-Id: I407c2e8676b28ecc894a59e977feb474f89e880a Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2067163 Reviewed-by: Mary Ruthven <mruthven@chromium.org>
* utils: script for calculating Cr50 version fingerprintVadim Bendebury2020-02-191-0/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | | This scrip copies the Chrome OS run time code which calculates Cr50 image hash, used as the UMA key to keep track of various TPM versions. BRANCH=none BUG=none TEST=verified that generated fingerprint values match previously generated values: $ for b in /opt/google/cr50/firmware/*; do gsctool -b $b util/tpm_hash_gen.py $b done read 524288(0x80000) bytes from ... RO_A:0.0.11 RW_A:0.4.24[FFFF:00000000:00000010]... 37564a12 928401938 /opt/google/cr50/firmware/cr50.bin.prepvt read 524288(0x80000) bytes from ... RO_A:0.0.11 RW_A:0.3.24[00000000:00000000:00000000]... 795daf5c 2036182876 /opt/google/cr50/firmware/cr50.bin.prod $ Change-Id: Ie129227cea3c68937223c81c068612b044cd5c8b Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2051306 Reviewed-by: Mary Ruthven <mruthven@chromium.org>
* cr50: prepare to release 0.{3,4}.25Mary Ruthven2020-01-222-2/+2
| | | | | | | | | | | BRANCH=cr50, cr50-mp BUG=none TEST=none Change-Id: I284e295dd2db0564b8f89832fc47cf4d0fbc6a50 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2013450 Reviewed-by: Namyoon Woo <namyoon@chromium.org>
* fizz: restore building the ecst toolVadim Bendebury2020-01-083-0/+2808
| | | | | | | | | | | | | | | | | | The patch which dropped building tools from the util directory (https://crrev.com/c/1986943) proved to be a bit too aggressive, and broke building of BOARD=fizz. This patch reintroduces building of the missing tool BRANCH=cr50, cr50-mp BUG=none TEST='make buildall -j' succeeds. Change-Id: I7e093b3c74633eabae17834353ca72653a660563 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1990359 Reviewed-by: Marius Schilder <mschilder@chromium.org> Reviewed-by: Namyoon Woo <namyoon@chromium.org>