summaryrefslogtreecommitdiff
path: root/host
Commit message (Collapse)AuthorAgeFilesLines
* Make crossystem.h more polite and more useful.test-4980.Btest-4824.Bstabilize-R33-4982.Bstabilize-5062.Bstabilize-4920.6.Brelease-R32-4920.Bfirmware-bolt_kirby-4979.Bfactory-panther-4920.23.BJ. Richard Barnette2013-10-315-6/+27
| | | | | | | | | | | | | | | | | | | This adds a VB_MAX_STRING_PROPERTY for callers that don't want to guess at how big to make their buffers. Additionally, it changes the size parameter to VbGetPropertyString() from int to size_t. BUG=None TEST=compile the code BRANCH=none Change-Id: I22809d48e13b535593cb22a56444e2dcb27791a5 Reviewed-on: https://chromium-review.googlesource.com/175039 Reviewed-by: Randall Spangler <rspangler@chromium.org> Tested-by: Richard Barnette <jrbarnette@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Queue: Richard Barnette <jrbarnette@chromium.org>
* Allow <vboot/crossystem.h> to be usable in C++ code.stabilize-4886.BJ. Richard Barnette2013-10-251-0/+8
| | | | | | | | | | | | BUG=None TEST=build update_engine with a change that uses the header. BRANCH=none Change-Id: Icbfe9be615a4f7f4078a0a0cde64324908dea2a7 Reviewed-on: https://chromium-review.googlesource.com/174428 Commit-Queue: Richard Barnette <jrbarnette@chromium.org> Tested-by: Richard Barnette <jrbarnette@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Add a "debug_build" query to crossystem.J. Richard Barnette2013-10-231-7/+38
| | | | | | | | | | | | | | | | | Querying "debug_build" allows the caller to determine whether the image has requested debug, independent of the setting of the dev_mode switch. BUG=chromium:308678 BRANCH=none TEST=use the new command option on both base and dev images Change-Id: I369f26d75156f2e88d9f6f467efbf8f633e78bda Reviewed-on: https://chromium-review.googlesource.com/174107 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Tested-by: Richard Barnette <jrbarnette@chromium.org> Reviewed-by: Will Drewry <wad@chromium.org> Commit-Queue: Richard Barnette <jrbarnette@chromium.org>
* Add memory leak checkingSimon Glass2013-09-171-4/+4
| | | | | | | | | | | | | | | | | Add checks that the vboot library does not leak memory. This works by tracking VbExMalloc() calls and making sure that they have an associated VbExFree(). Adjust host_signature to use VbExFree() instead of free(), so that this scheme works correctly for existing code. BUG=chrome-os-partner:21115 BRANCH=pit TEST=FEATURES=test emerge-peach_pit vboot_reference Change-Id: I6ccccfbcc162fc43fb75862cd0eddad78ce8b18a Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/66175
* Correct some minor compiler warningsSimon Glass2013-08-252-2/+5
| | | | | | | | | | | | | | | | | | | | | A few places in the code through up warnings when building with strict compiler flags. Correct these. BUG=chrome-os-partner:21115 BRANCH=pit TEST=manual Build with: FEATURES=test emerge-peach_pit vboot_reference and see that iot now succeeds. Warnings include: host/arch/arm/lib/crossystem_arch.c: In function 'ReadFdtValue': host/arch/arm/lib/crossystem_arch.c:93:8: error: ignoring return value of 'fread', declared with attribute warn_unused_result [-Werror=unused-result] Change-Id: I765723636e5f8979b794925c7b610081b2849026 Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/66174
* Improve kernel tests to pass valgrindSimon Glass2013-08-251-1/+1
| | | | | | | | | | | | | | | | | At present the kernel tests produce valgrind errors since the GPT data is sometimes accessed before it is read. This is unnecessary, so update the code to avoid this. BUG=chrome-os-partner:21115 BRANCH=pit TEST=manual valgrind --leak-check=full ./build/tests/vboot_kernel_tests See that we no longer get valgrind errors. Change-Id: I9e9660e38a62a735cf01a37c2d81ddb5ab8b1528 Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/66173
* Fix some issues with LBA vs byte offsetsAlbert Chaulk2013-07-311-0/+1
| | | | | | | | | | | | | | | | | | | In several places the existing code assumes LBA, but was improperly converted to use byte offsets, so multiply by the sector size to correct it and maintain the same interface between MTD & GPT. Also, since we will need to cgpt create on /dev/fts, which isn't a stat()able device, allow providing the disk size on the commandline. BRANCH=none BUG=chromium:221745 TEST=make runtests; cgpt create -s 12345 on MTD image Change-Id: Icc89a4505aba9a3dfc39b176a372f6e12d106aed Reviewed-on: https://gerrit.chromium.org/gerrit/62675 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Tested-by: Albert Chaulk <achaulk@chromium.org> Commit-Queue: Albert Chaulk <achaulk@chromium.org>
* dump_fmap: Find correct FMAP structure by checking version.Hung-Te Lin2013-06-212-3/+9
| | | | | | | | | | | | | | | | | | | Firmware images reading its own FMAP structure may have FMAP signature in code and cause dump_fmap to parse incorrectly. Since currently there is only one major version for FMAP (and the structure defined in fmap.h also applies only to current version), we can improve that by checking major version number to skip signatures in firmware code. BUG=chromium:236347 TEST=emerge vboot_reference; dump_fmap /build/daisy/firmware/image.bin # success BRANCH=none Change-Id: I1d8f49bb88357e7a3a945fbdba9d9a7c4e177ac4 Reviewed-on: https://gerrit.chromium.org/gerrit/59362 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: David Hendricks <dhendrix@chromium.org> Tested-by: Hung-Te Lin <hungte@chromium.org> Commit-Queue: Gabe Black <gabeblack@chromium.org>
* Add 5420 to the set of recognizable platformsVadim Bendebury2013-06-201-0/+1
| | | | | | | | | | | | | | | | | | | It is used on peach_pit. BRANCH=none BUG=none TEST=manual . on peach-pit: localhost ~ # echo $(crossystem arch) arm localhost ~ # Change-Id: Ia9a4ea2291d6b672fca1c9e1305961eedc4f60cf Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/59339 Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* crossystem: Add device IDs for haswellDuncan Laurie2013-05-231-0/+2
| | | | | | | | | | | | | | | | | 0x8086,0x0a04 is Haswell ULT 0x8086,0x0c04 is Haswell Mobile BUG=chrome-os-partner:19263 BRANCH=none TEST=manual test on slippy hardware: $ crossystem platform_family Haswell Change-Id: Ia885d0c8f0be2fb626257ca513f581df50259173 Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/56075 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* crossystem: Add LynxPoint to list of valid x86 chipset typesDuncan Laurie2013-05-061-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Haswell CPUs are paired with the LynxPoint chipset and this needs to be a valid controller name for crossystem. BUG=chrome-os-partner:19263 BRANCH=none TEST=manual This was tested on a wtm2 system to ensure that a GPIO defined in chromeos ACPI that is exported by the kernel at /sys/devices/platform/chromeos_acpi/GPIO.# is used by crossystem and the GPIO is exported in /sys/class/gpio and read. $ cat /sys/devices/platform/chromeos_acpi/GPIO.1/GPIO.2 34 $ cat /sys/class/gpio/gpio196/value 1 $ crossystem wpsw_cur 1 Change-Id: I04064109e99270d7d26b27182b17fffbf47b025b Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/50224 Reviewed-by: Aaron Durbin <adurbin@chromium.org>
* Refactor CgptAdd and CgptPrioitize to remove gpt-specific codeAlbert Chaulk2013-05-061-1/+1
| | | | | | | | | | | | | | | | | | | | - Refactor cgpt_prioitize.c to completely remove gpt-specific code. - Refactor cgpt_add.c to isolate gpt-dependence to one helper function and the backup/restore logic - Change several common apis to take a struct drive* rather than a GptData*, this provides a path to cleanly implement mtd versions BUG=chromium:221745 TEST=no functional changes, existing tests cover this BRANCH=none Change-Id: I27ed166aae390aa5dc83062f62939e45122edc76 Original-Change-Id: I1b0a73509efbf22411c4ae5cf044feede0a49a33 Reviewed-on: https://gerrit.chromium.org/gerrit/46548 Tested-by: Albert Chaulk <achaulk@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Queue: Albert Chaulk <achaulk@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/49788
* Massive refactoring of external header files.Bill Richardson2013-04-0213-3/+163
| | | | | | | | | | | | | | | | | | | | | | | | This reduces the number of exported header files to the minimum needed by the existing userspace utilities and firmware implementations. BUG=chromium:221544 BRANCH=none TEST=manual, trybots CQ-DEPEND=CL:47019,CL:47022,CL:47023 sudo FEATURES=test emerge vboot_reference FEATURES=test emerge-$BOARD \ vboot_reference \ chromeos-cryptohome \ chromeos-installer \ chromeos-u-boot \ peach-u-boot \ depthcharge Change-Id: I2946cc2dbaf5459a6c5eca92ca57d546498e6d85 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47021 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* crossystem: Fix cros_debug detection on non-chrome systems.toolchainAstabilize-3912.79.Brelease-R27-3912.BHung-Te Lin2013-03-201-1/+3
| | | | | | | | | | | | | | | | | | | "cros_debug" is usually the last token of kernel command line on UEFI/legacy BIOS systems. However, kernel command line may end with new line ("\n") and that may cause strcmp to fail (i.e., can't detect "cros_debug" if it's the last parameter in command line), so we need to add that into strtok delimiters. BRANCH=none BUG=chromium:222248 TEST=crossystem cros_debug # display 1 on UEFI system with cros_debug Change-Id: I9aed1562291469118acbadcc5211ff5c45eb9feb Reviewed-on: https://gerrit.chromium.org/gerrit/46106 Tested-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Queue: Hung-Te Lin <hungte@chromium.org>
* Remove dead ECPreamble codeRandall Spangler2013-01-252-198/+140
| | | | | | | | | | | BUG=none BRANCH=none TEST=make runtests Change-Id: I99d8124a7d5a3a644f0d8d64ad36f51e78d851e5 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/42018 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Fix architecture definitions.Randall Spangler2013-01-231-0/+0
| | | | | | | | | | | | | | | | | | | | We should use only arm, x86, and x86_64; currently we also use i386 to mean x86, and amd64 to mean x86_64. BUG=chromium-os:26317 BRANCH=none TEST=manual sudo FEATURES=test emerge vboot_reference FEATURES=test emerge-link vboot_reference chromeos-u-boot chromeos-installer FEATURES=test emerge-daisy vboot_reference chromeos-u-boot chromeos-installer FEATURES=test emerge-x86-alex vboot_reference chromeos-installer make && make runtests (both inside and outside chroot) Change-Id: I4fb64fafa9c48a76ded862e074776cab9ea54ab3 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/41838 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Unify vboot build into a single makefileRandall Spangler2013-01-111-46/+0
| | | | | | | | | | | | | | | | | | This is a necessary precursor to getting coverage working. BUG=chromium-os:26317 BRANCH=none TEST=manual sudo emerge vboot_reference emerge-link vboot_reference chromeos-u-boot emerge-daisy vboot_reference chromeos-u-boot Change-Id: Ibed91c64a5ca5fa486169d64fb01a9e868ce27e5 Signed-off-by: Randall Spangler <rspangler@chromium.org> (cherry picked from commit 13ed1f4812f810ee0a47b946ad990f1fa93f366c) Reviewed-on: https://gerrit.chromium.org/gerrit/40906 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Add recovery_subcode field to nvstorage and crossystemBill Richardson2012-12-171-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This just adds a one-byte field in the nvstorage region for use in debugging hard-to-catch errors. There's no official meaning or expectation for this field. It's just a handy place to emit some information. BUG=chrome-os-partner:11534 BRANCH=parrot TEST=manual Just change the value and ensure that it persists across a (working) reboot. It's only updated at specific points under very exacting error conditions, so all we really want to test is that it works as a place to store some extra info. crossystem recovery_subcode crossystem recovery_subcode=14 reboot crossystem recovery_subcode The recovery_subcode byte is at index [6] of the VbNv.raw bytes that appear when you press TAB, so you can find it there too: VbNv.raw: 60 20 00 00 00 00 0e 00 00 00 00 00 00 00 00 65 Decimal 14 == 0x0e Change-Id: I1930b8f81a03ab838dbee99a8d72c35a444efdfd Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/39803 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* crossystem devsw_cur returns devsw_boot if virtual dev switchRandall Spangler2012-10-042-5/+16
| | | | | | | | | | | | | | | | | | | | | | | | devsw_cur is really a meaningless concept on systems with virtual dev switches; it exists primarily to support factory test of physical developer switches. However, some plugins use this instead of the preferred devsw_boot, and it's easier to modify crossystem than the plugins at this point in time. BUG=chrome-os-partner:12928 BRANCH=none (affects all current products, but is an OS-level change, not FW) TEST=manual - On link, 'crossystem devsw_cur devsw_boot' with dev switch on -> '1 1' - On link, 'crossystem devsw_cur devsw_boot' with dev switch off -> '0 0' - On lumpy or earlier, 'crossystem devsw_cur' should return current dev switch position; check this by toggling the physical switch without rebooting and see that the reported value follows the switch value. Change-Id: Ie7416e5cb03c133572c32af677b55ed18884dfb8 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/34531 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org>
* crossystem should not grumble about older firmwareChe-Liang Chiou2012-09-241-8/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | Older firmware does not provide nonvolatile-context-storage FDT property, and crossystem complains about it. This is harmless; so just make it quiet. Signed-off-by: Che-Liang Chiou <clchiou@chromium.org> BRANCH=none BUG=chrome-os-partner:14475 TEST=manual, see blow Run crossystem and make sure its output does not contain "Unable to open FDT property nonvolatile-context-storage" messages. Check crossystem still works by comparing its output w/ and w/o this change. Change-Id: I0b8f40775833457a75d801f185344e931ac08847 Reviewed-on: https://gerrit.chromium.org/gerrit/33896 Commit-Ready: Che-Liang Chiou <clchiou@chromium.org> Tested-by: Che-Liang Chiou <clchiou@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add CTRL-L in dev screen to support a "legacy boot option"Stefan Reinauer2012-09-201-0/+4
| | | | | | | | | | | | | | | | | | | | | This option is disabled per default and can be enabled with crossystem dev_boot_legacy=1 or by setting the GBB flag GBB_FLAG_FORCE_DEV_BOOT_LEGACY 0x00000080 BUG=chrome-os-partner:6108 TEST=crossystem dev_boot_legacy=1 boot to dev mode screen, press CTRL-L, see SeaBIOS start (other CLs needed) BRANCH=link Signed-off-by: Stefan Reinauer <reinauer@chromium.org> Change-Id: I593d2be7cff5ca07b8d08012c4514a172bd75a38 Reviewed-on: https://gerrit.chromium.org/gerrit/31265 Reviewed-by: Stefan Reinauer <reinauer@chromium.org> Tested-by: Stefan Reinauer <reinauer@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Ready: Stefan Reinauer <reinauer@chromium.org>
* crossystem should switch on VbNvContext storage typeChe-Liang Chiou2012-09-181-2/+117
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We may have multiple storage types (disk or mkbp) of VbNvContext. crossystem should switch the type and choose the corresponding device driver. After patching U-Boot, you may check storage type: [ "mkbp" = "$(cat /proc/device-tree/firmware/chromeos/nonvolatile-context-storage)" ] And cross-verify crossystem with mosys: $ mosys nvram vboot read 70000000000000000000000000000020 $ crossystem recovery_request 0 $ crossystem recovery_request=123 $ mosys nvram vboot read 70007b0000000000000000000000005d $ mosys nvram vboot write 70000000000000000000000000000020 $ crossystem recovery_request 0 More importantly, crossystem should also work with older version of firmware, which does not pass down this information. Signed-off-by: Che-Liang Chiou <clchiou@chromium.org> BRANCH=none BUG=chrome-os-partner:13766 TEST=Check storage type on a Snow device: [ "mkbp" = "$(cat /proc/device-tree/firmware/chromeos/nonvolatile-context-storage)" ] Make sure that FAFT is still happy: ./run_remote_tests.sh --remote $ADDR --board daisy 'firmware_TryFwB/control$' ./run_remote_tests.sh --remote $ADDR --board daisy 'firmware_TryFwB/control.dev$' More importantly, check crossystem worked well even when ChromeOS is booted from an older version of firmware. Change-Id: I3989a8c181efe03cd9f06127743763e0ad97e281 Reviewed-on: https://gerrit.chromium.org/gerrit/32470 Reviewed-by: Che-Liang Chiou <clchiou@chromium.org> Tested-by: Che-Liang Chiou <clchiou@chromium.org> Commit-Ready: Che-Liang Chiou <clchiou@chromium.org>
* Revert "Change FMAP search stride from 4-byte to 64-byte."Louis Yung-Chieh Lo2012-08-291-1/+1
| | | | | | | | | | | | | | This reverts commit 92951c813dc416c24d8a9eda39d037f46baeb077. BUG=chromium-os:33963, TEST=None BRANCH=None Change-Id: I186432ab4cdb91495f81a1574863fada28f59603 Reviewed-on: https://gerrit.chromium.org/gerrit/31690 Commit-Ready: Yung-Chieh Lo <yjlou@chromium.org> Reviewed-by: Yung-Chieh Lo <yjlou@chromium.org> Tested-by: Yung-Chieh Lo <yjlou@chromium.org>
* Add VB_INIT_FLAG_SW_WP_ENABLED to VbInit() input flags.Bill Richardson2012-08-281-3/+9
| | | | | | | | | | | | | | | | | | We need to know not only whether the HW WP pin is asserted, but whether the flash chip has configured its software protection registers to actually protect anything. This flag can be used to indicate that. BUG=chrome-os-partner:13265 BRANCH=link TEST=none This just adds the flag. Nothing actually sets the flag yet, so there's nothing to test. Change-Id: Icba9945fb56eb3a4681486c630cbbdc9232485ef Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/31642 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Change FMAP search stride from 4-byte to 64-byte.Louis Yung-Chieh Lo2012-08-271-1/+1
| | | | | | | | | | | | | | | | | | The FMAP requires to be aligned at 64-byte. Searchin at 4-byte could lead bug if a designated FMAP is located at 4-byte address. BUG=chrome-os-partner:13143, TEST=Tested in CL https://gerrit.chromium.org/gerrit/#/c/31436/ BRANCH=link,snow Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org> Change-Id: Ib7f36dc89d7d2763b1a72b641433d45bec6c2bef Reviewed-on: https://gerrit.chromium.org/gerrit/31442 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: David Hendricks <dhendrix@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Commit-Ready: Yung-Chieh Lo <yjlou@chromium.org> Tested-by: Yung-Chieh Lo <yjlou@chromium.org>
* Fix reporting TPM kernel version and firmware version on ZGBRandall Spangler2012-08-231-6/+6
| | | | | | | | | | | | | | | | These fields are part of the version 1 struct, but were mistakenly labeled as version 2 fields. Since ZGB firmware produces a version 1 struct, crossystem was treating the fields as unavailable. BUG=chromium-os:33685 TEST=crossystem tpm_fwver tpm_kernver BRANCH=none (OS utility change, not firmware, and affects only Alex/ZGB) Change-Id: Ic857ee2da9a7ae7f0d42317b711bf102d068de64 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/30904 Tested-by: Sonny Rao <sonnyrao@chromium.org> Reviewed-by: Sonny Rao <sonnyrao@chromium.org>
* Make crossystem look for the write protect switch in the chromeos_arm deviceGabe Black2012-08-161-2/+20
| | | | | | | | | | | | | | | | | | The value of the ChromeOS write protect switch is now provided through the new chromeos_arm platform device which avoids the mismatch between U-Boot and kernel GPIO numbering. BUG=chrome-os-partner:11297 TEST=gmerge-ed onto a snow and verified that crossystem got the right value of the write protect switch. BRANCH=snow Change-Id: I466370e4f6bf2d14c067518a9d620e9e60142a0b Signed-off-by: Gabe Black <gabeblack@google.com> Reviewed-on: https://gerrit.chromium.org/gerrit/30534 Reviewed-by: Simon Glass <sjg@chromium.org> Commit-Ready: Randall Spangler <rspangler@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add clear TPM owner requestRandall Spangler2012-08-151-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds two new flags to crossystem: clear_tpm_owner_request clear_tpm_owner_done The first one requests that the firmware clear the TPM owner on the next boot. When the firmware does this, it will set clear_tpm_owner_request=0, and set clear_tpm_owner_done=1. The OS can use the done-flag as a hint that trusted things guarded by the TPM are no longer trustable. BUG=chromium-os:31974 TEST=manual crossystem // both flags initially 0 crossystem clear_tpm_owner_request=1 crossystem clear_tpm_owner_done=1 // request=1, done=0; done can be cleared but not set by crossystem reboot tpmc getownership // owned=no crossystem // request=0, done=1 crossystem clear_tpm_owner_done=0 crossystem // both flags 0 again Signed-off-by: Randall Spangler <rspangler@chromium.org> Change-Id: I49f83f3c39c3efc3945116c51a241d255c2e42cd Reviewed-on: https://gerrit.chromium.org/gerrit/25646
* rename common.mk to build.mkMike Frysinger2012-08-081-1/+1
| | | | | | | | | | | | | | This is to avoid confusion with the canonical common.mk file that is a CrOS build system. BUG=chromium-os:33327 TEST=`cros_run_unit_tests --board x86-alex -p vboot_reference` still works Change-Id: I4b6719d58a4a8ab44b62c23c0e2c45b154374958 Reviewed-on: https://gerrit.chromium.org/gerrit/29578 Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Ready: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org>
* Crossystem should return at-boot switch positions from VbSharedDataRandall Spangler2012-08-064-62/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is more reliable than reading them through FDT/ACPI, since it reflects the positions as shown to verified boot code. Notes: 1. This affects ALL platforms with virtual dev switches (x86 AND arm) 2. The fix should have no effect on older platforms, but I haven't tested those. BUG=chrome-os-partner:11805 TEST=manual 1. boot in normal mode. devsw_boot = 0 # Developer switch position at boot recovery_reason = 0 # Recovery mode reason for current boot recoverysw_boot = 0 # Recovery switch position at boot wpsw_boot = 1 # Firmware write protect hardware switch position at boot 2. boot in developer mode. localhost ~ # crossystem devsw_boot = 1 # Developer switch position at boot recovery_reason = 0 # Recovery mode reason for current boot recoverysw_boot = 0 # Recovery switch position at boot wpsw_boot = 1 # Firmware write protect hardware switch position at boot 3. boot in developer-recovery mode using keyboard combo. devsw_boot = 1 # Developer switch position at boot recovery_reason = 2 # Recovery mode reason for current boot recoverysw_boot = 1 # Recovery switch position at boot wpsw_boot = 1 # Firmware write protect hardware switch position at boot 4. disable WP and reboot. wpsw_boot should be 0. Change-Id: If4156b5e14c6923c5b331c7e5feaabbffe1dad37 Reviewed-on: https://gerrit.chromium.org/gerrit/29199 Commit-Ready: Randall Spangler <rspangler@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Tested-by: Randall Spangler <rspangler@chromium.org>
* crossystem: Let kernel worry about active_low stuffChe-Liang Chiou2012-07-121-3/+2
| | | | | | | | | | | | | | | | | | | As kernel has adjusted the value of /sys/class/gpio/gpio${PORT}/ with active_low stuff before returning it to user, crossystem should not do another adjustment. Signed-off-by: Che-Liang Chiou <clchiou@chromium.org> BUG=chrome-os-partner:11297 TEST=On Snow, run crossystem and see wpsw_boot equals to wpsw_cur. Then invert /sys/class/gpio/gpio${PORT}/active_low value, and see wpsw_boot does not equal to wpsw_cur. Change-Id: I09fec89788bc4393775d5cf9763b8cebeb645ad4 Reviewed-on: https://gerrit.chromium.org/gerrit/27252 Commit-Ready: Che-Liang Chiou <clchiou@chromium.org> Tested-by: Che-Liang Chiou <clchiou@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* crossystem: Return error when trying to read GPIO port zeroChe-Liang Chiou2012-07-121-1/+10
| | | | | | | | | | | | | | | | | | | | For the record, zero is a valid GPIO port number. Unfortunately firmware uses port zero to denote that a GPIO port is not exist. So crossystem should not attempt to read GPIO port zero, but return error instead. Signed-off-by: Che-Liang Chiou <clchiou@chromium.org> BUG=chrome-os-partner:11296 TEST=On Snow, run crossystem and see devsw_cur and recoverysw_cur are "(error)" Change-Id: I70b15824f613df1e46bf152515ad4e9362c9f066 Reviewed-on: https://gerrit.chromium.org/gerrit/27251 Commit-Ready: Che-Liang Chiou <clchiou@chromium.org> Tested-by: Che-Liang Chiou <clchiou@chromium.org> Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org> Tested-by: Cheng-Yi Chiang <cychiang@chromium.org>
* Revert "Read virtual switch current values correctly"Che-Liang Chiou2012-07-091-21/+5
| | | | | | | | | | | | | | | | | | | | This reverts commit 7ec59576f6f61effdc35482c8cfd4aa32b643b1a. We would like to keep dev_cur and recovery_cur output "(error)" so that factory process knows that firmware uses virtual switches. I think this is strange, but this is how factory process works for now. Signed-off-by: Che-Liang Chiou <clchiou@chromium.org> BUG=chromium-os:10007 TEST=none Change-Id: I370a3e9f5a8847916445348abb81f7c4bbf3d27f Reviewed-on: https://gerrit.chromium.org/gerrit/26909 Commit-Ready: Che-Liang Chiou <clchiou@chromium.org> Tested-by: Che-Liang Chiou <clchiou@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org>
* Exporting GPIO if the sysfs node does not existRong Chang2012-07-031-3/+21
| | | | | | | | | | | | | | | | This change exports gpio number if it can not be accessed. Ignore the active_low checking for compatibility. Signed-off-by: Rong Chang <rongchang@chromium.org> BUG=chrome-os-partner:11029 TEST=manual Run crossystem and check WP pin status Change-Id: I0885ab21c6c6d614945e4fda49a373e8619772a9 Reviewed-on: https://gerrit.chromium.org/gerrit/26563 Commit-Ready: Tom Wai-Hong Tam <waihong@chromium.org> Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org> Tested-by: Tom Wai-Hong Tam <waihong@chromium.org>
* Read virtual switch current values correctlyChe-Liang Chiou2012-07-021-5/+21
| | | | | | | | | | | | | | | | | | | As dev switch and recovery switch may be virtual, crossystem has to distinguish virtual switches from physical ones. Since to a virtual switch, its current value should always equal to its boot value, return a boot value when asked for a current value. Signed-off-by: Che-Liang Chiou <clchiou@chromium.org> BUG=chrome-os-partner:10007 TEST=crossystem devsw_cur|recoverysw_cur show correct value on Snow Change-Id: Ia73147ecd5528a3cc5276aff02a632ce4f52ea8b Reviewed-on: https://gerrit.chromium.org/gerrit/26568 Commit-Ready: Che-Liang Chiou <clchiou@chromium.org> Tested-by: Che-Liang Chiou <clchiou@chromium.org> Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org>
* crossystem: Add the ddr_type field on crossystem for querying DDR RAM typeTom Wai-Hong Tam2012-07-022-0/+6
| | | | | | | | | | | | | | | | | | Samsung want to know what memory type on the device. So this CL adds a new field ddr_type to crossystem utility in order to query this info. It is only available on ARM platform so far. BUG=chrome-os-partner:10857 TEST=Built and boot on Snow successfuly. On userspace, query the field via: localhost ~ # crossystem ddr_type ddr3 Change-Id: I01d1dec412fe4052e1ea6cfe2e53830da97a710b Signed-off-by: Tom Wai-Hong Tam <waihong@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/26411 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* Add bits to request and acknowledge Option ROM loading.Bill Richardson2012-06-271-0/+4
| | | | | | | | | | | | | | | | | | | | | For fastest boot, we don't want to load the VGA Option ROM every time, but only when we need it. Coreboot does that loading, but it can't always know when it's needed (with keyboard-based dev-mode, coreboot can't tell if we're in dev-mode or not). By the time we get to U-Boot, it's too late, so we need two extra bits - one for vboot to tell coreboot to load the Option ROM and another for coreboot to let vboot know it's been done. BUG=chrome-os-partner:8789 TEST=manual The only visible change is that crossystem will now have an "oprom_needed" flag that can be set or cleared. Nothing actually pays attention to it yet, though. Signed-off-by: Bill Richardson <wfrichar@chromium.org> Change-Id: I521a6afdfb8ea17a8148b32eeb858844c981de9c Reviewed-on: https://gerrit.chromium.org/gerrit/26272 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* add EXYNOS{4,5} to platform_name tables on armOlof Johansson2012-06-261-0/+2
| | | | | | | | | | | | BUG=chrome-os-partner:10872 TEST=run crossystem on snow, check output Change-Id: I413cbd86833fc8abff9afbf12a85abe53b586af4 Reviewed-on: https://gerrit.chromium.org/gerrit/26090 Reviewed-by: Bernie Thompson <bhthompson@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Ready: Olof Johansson <olofj@chromium.org> Tested-by: Olof Johansson <olofj@chromium.org>
* Remove unused test fields from VbNvStorageRandall Spangler2012-06-111-9/+1
| | | | | | | | | | | | | | Confirmed via codesearch that these fields are not used outside of vboot_reference itself, and the only use inside vboot_reference is one test which checked that the test error generation itself worked. BUG=chromium-os:31668 TEST=make && make runtests Signed-off-by: Randall Spangler <rspangler@chromium.org> Change-Id: Ic393e126ca2853f7aaff19ffd6fcdbdb1c47689f Reviewed-on: https://gerrit.chromium.org/gerrit/24895 Reviewed-by: Simon Glass <sjg@chromium.org>
* Add DISABLE_DEV_REQUEST flag to nvram.factory-2394.Bfactory-2368.BBill Richardson2012-05-251-0/+4
| | | | | | | | | | | | | | | | | This just creates the bit. It doesn't actually do anything yet. BUG=chrome-os-partner:9980 TEST=manual crossystem disable_dev_request=1 crossystem crossystem disable_dev_request=0 crossystem Change-Id: I0e92a6b5ef5074ee5eae2d6d469c1c9826faecb3 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/23752 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Create vbutil_ec tool for signing EC firmware.Bill Richardson2012-05-044-0/+93
| | | | | | | | | | | | | | | | | | This just adds the vbutil_ec tool (and a simple test of the library functions related to it). BUG=chrome-os-partner:7459, chromium-os:27142 TEST=manual make make runtests Change-Id: I2a2c4e7cfb8ac6ce2229c5de4252a5cc89321fa5 Reviewed-on: https://gerrit.chromium.org/gerrit/21868 Commit-Ready: Bill Richardson <wfrichar@chromium.org> Tested-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Stefan Reinauer <reinauer@google.com> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* Require -Wall -Werror for everything.Bill Richardson2012-05-032-3/+2
| | | | | | | | | | | BUG=none TEST=none Change-Id: Ib9781238274285f73d00d8fca4ecda28fc2c6678 Reviewed-on: https://gerrit.chromium.org/gerrit/21748 Commit-Ready: Bill Richardson <wfrichar@chromium.org> Tested-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
* crossystem: introduce a new main firmware type, 'netboot'Vadim Bendebury2012-04-202-0/+3
| | | | | | | | | | | | | | | | | | | | We need to be able to tell when a ChromeOS machine was brought up using netboot. This condition will be communicated from firmware using the BINF.3 ACPI object (upcoming u-boot change). BUG=chrome-os-partner:7952 TEST=manual . boot a ChromeOS machine using the updated firmware and examine the main firmware type reported by crossystem: localhost ~ # echo $(/var/crossystem mainfw_type) netboot Change-Id: I35b10f41eb1f928a122c384d0179c9027f263acd Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/20707 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Adjust the behavior of 'crossystem cros_debug' for recovery modeJ. Richard Barnette2012-04-171-15/+6
| | | | | | | | | | | | | | | | | Previously, 'cros_debug' would ignore the kernel command line if the system was booted in recovery mode. The check provided no particular security benefit; it served only to complicate the work of developers who wanted to boot debug images over USB with dev-key signed firmware. BUG=chromium-os:19236 TEST=Test 'crossystem cros_debug' on a system in the cited use case Change-Id: Ie664c50984411340a10896137022d7d4ff503d0a Reviewed-on: https://gerrit.chromium.org/gerrit/6663 Commit-Ready: Richard Barnette <jrbarnette@chromium.org> Tested-by: Richard Barnette <jrbarnette@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Modify crossystem to recognize Panther Point GPIO controllerrelease-R19-2046.BVadim Bendebury2012-03-231-1/+2
| | | | | | | | | | | | | | | | | | | There is a filter in crossystem which makes sure that it accepts GPIO information only from a subset of GPIO controllers. Panther Point needs to be included in the list. BUG=chrome-os-partner:8615 TEST=manual . run the new crossystem on a Link . modify write protect and and recovery (as it comes from servo-2) pins' status . observe the appropriate crossystem values change Change-Id: I3ac269a9ea520f2c44ee090fe71ec8ad808692ba Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/18936 Reviewed-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Major refactoring of vbutil_kernelBill Richardson2012-03-201-4/+7
| | | | | | | | | | | | | | | | | | | This started out as a simple fix for a minor bug and turned into a nearly complete rewrite. Now that it's done I'm not sure it really matters. This version is a lot cleaner about handling command-line args, but isn't otherwise noticeably better. Sigh. BUG=none TEST=manual make make runtests Change-Id: I9c194e9c0e6418488635989ef666bc83c6e39816 Reviewed-on: https://gerrit.chromium.org/gerrit/18268 Commit-Ready: Bill Richardson <wfrichar@chromium.org> Tested-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add a failure check to ReadFdtBlock in ReadFdtPlatformFamilyBernie Thompson2012-01-191-1/+2
| | | | | | | | | | | | | | | | This adds in logic to check that ReadFdtBlock within ReadFdtPlatformFamily succeeded, returning NULL on failure. BUG=None TEST=Manual, run crossystem on an ARM system without a valid compatible FDT entry and ensure (error) is returned for platform_family. Change-Id: I6351292ff73e4bc08b028f85e72ccfe62159194a Reviewed-on: https://gerrit.chromium.org/gerrit/14321 Reviewed-by: Olof Johansson <olofj@chromium.org> Reviewed-by: Bernie Thompson <bhthompson@chromium.org> Tested-by: Bernie Thompson <bhthompson@chromium.org> Commit-Ready: Bernie Thompson <bhthompson@chromium.org>
* Allow crossystem ReadFdtBlock() to use a direct path starting with '/'Bernie Thompson2012-01-181-4/+8
| | | | | | | | | | | | | | | | | This extends the ReadFdtBlock function for ARM to allow for a direct path to a FDT entry by starting the property with a '/'. This allows the ReadFdtPlatformFamily function to use a direct path instead of stepping back through folders, and will enable future crossystem entries to do the same. BUG=chromium-os:24669 TEST=Manual Change-Id: Ibddb881815947259c2532d7f5474eda5fdc9f803 Reviewed-on: https://gerrit.chromium.org/gerrit/14305 Reviewed-by: Olof Johansson <olofj@chromium.org> Reviewed-by: Bernie Thompson <bhthompson@chromium.org> Tested-by: Bernie Thompson <bhthompson@chromium.org> Commit-Ready: Bernie Thompson <bhthompson@chromium.org>
* Add in a platform_family value to crossystemBernie Thompson2012-01-092-0/+106
| | | | | | | | | | | | | | | | | | | | | | This implements a platform_family value within the crossystem utility, as the platform (particularly for ARM) is not easily accessable elsewhere at runtime. For the ARM side this contains a table which is used to determine the platform family based on the /proc/device-tree/compatible entry. Similarly on x86 the table is used to check against PCI entries. Additional entries can be made as new platform families emerge. BUG=chromium-os:24669 TEST=Manual, verified that crossystem runs properly and returns a valid platform_family value on various platforms (mario, alex, z600, x220, etc). Change-Id: Id0e973902d27ead471c1243bcc6c3292acc8479d Reviewed-on: https://gerrit.chromium.org/gerrit/13520 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Ready: Olof Johansson <olofj@chromium.org> Reviewed-by: Olof Johansson <olofj@chromium.org> Tested-by: Olof Johansson <olofj@chromium.org>
* Fix crossystem on amd64 boardsSonny Rao2011-11-231-57/+1
| | | | | | | | | | | | | | | | | Since x86 and amd64 boards use the same firmware and are otherwise identical use the same implementation for crossystem on both BUG=chromium-os:21386 TEST=emerge-x86-generic ; test crossystem works on Samsung Series 5 TEST=emerge-amd64-generic ; test crossystem works on Samsung Series 5 TEST=run unit tests on build machine with: RUNTESTS=1 make Change-Id: Ica516cca7ead6cb9cdfae0894bd532669ba3ba88 Reviewed-on: https://gerrit.chromium.org/gerrit/12059 Tested-by: Sonny Rao <sonnyrao@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Ready: Sonny Rao <sonnyrao@chromium.org>