Commit Graph

47 Commits

Author SHA1 Message Date
Penny Chiu
3d0bff52c4 Add format functions to express BCT and bootloader data value
Add a new field to the value_data table, which is the function to
use to format the data value.

Signed-off-by: Penny Chiu <pchiu@nvidia.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
2014-04-15 12:02:05 -06:00
Stephen Warren
fac5875bae Bump to version 1.2
Create a release that includes Tegra124 support.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
2013-08-28 08:53:46 -06:00
Stephen Warren
ebf44ed327 Implement --soc command-line option
Implement command-line option "-s tegra20" and "--soc tegra20". These
mirror the existing -t/--tegra option, but require the full chip name
(tegra20) rather than an abbreviated name (-t20). This is more consistent
with just about everything else upstream.

Suggested-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
2013-08-28 08:53:16 -06:00
Penny Chiu
7a4b402df1 Add Tegra124 support
Add the Tegra124 chip support to cbootimage. User can use "-t124" as
option to parse .cfg and generate BCT/image for Tegra124.

Signed-off-by: Penny Chiu <pchiu@nvidia.com>
[swarren, modified change to usage() to avoid re-indenting it all]
Signed-off-by: Stephen Warren <swarren@nvidia.com>
2013-08-27 10:40:55 -06:00
Stephen Warren
ce1847a2b3 crypto: produce consistent hash for zero-length data
In real-world use-cases, hashing zero-length data likely never happens.
However, it is relevant when testing cbootimage with a dummy zero-length
bootloader binary, e.g.:

touch u-boot.bin
cbootimage -t30 ../tamonten-ng/tegra30.img.cfg tegra30-tec-ng.img

In this scenario, it's useful to create a consistent hash, so that one
can compare the resultant images before and after applying patches, to
check for regressions.

Hence, zero out the hash data so it has consistent content if it isn't
written to.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
2013-08-27 10:04:16 -06:00
Stephen Warren
902a58b463 autogen.sh: allow spaces in configure arguments
Using "$@" (rather than #@) quotes any arguments if required. This is
useful if you want to run ./autogen.sh CFLAGS="-ggdb -O0".

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
2013-08-26 14:02:57 -06:00
Stefan Agner
14574161a6 Add automake option subdir-objects to prevent warnings
The SoC specific code is in subdirectories which leads to warnings in
newer
automake versions. The option subdir-objects prevents those warnings.

Signed-off-by: Stefan Agner <stefan@agner.ch>
Reviewed-by: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
2013-08-23 10:43:06 -06:00
Allen Martin
30ffca1748 Bump version to 1.1
Signed-off-by: Allen Martin <amartin@nvidia.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
2013-06-12 14:17:46 -07:00
Penny Chiu
737ec8332c Add support for Tegra114 SPI boot device
This patch adds SpiFlashParams to generate/dump BCT for SPI flash.

Signed-off-by: Penny Chiu <pchiu@nvidia.com>
Acked-by: Allen Martin <amartin@nvidia.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
2013-06-10 12:27:16 -06:00
Marc Dietrich
79789fd80d Fix assert with help output only
This moves an assert down if only "-h" and not SOC is given on the
command line.

Signed-off-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
2013-04-12 13:09:18 -06:00
Allen Martin
624cec685c Add autotools support
Remove previous hardcoded GNUmakefile and replace with autoconf/automake
generated configure script and Makefile.

Signed-off-by: Allen Martin <amartin@nvidia.com>
Change-Id: I48d3f6f20423109dc662418b92900876a8f8d1da
Reviewed-on: http://git-master/r/217547
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Stephen Warren <swarren@nvidia.com>
2013-04-09 11:18:26 -07:00
Allen Martin
480901aba3 Add missing header files
This is in preparation of switching to autotools, add explicit #includes
for header files where there was an implicit dependency.

Signed-off-by: Allen Martin <amartin@nvidia.com>
Change-Id: I8ca5832638ac7043f2b4e687c52bbe6e0a755eef
Reviewed-on: http://git-master/r/217546
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Stephen Warren <swarren@nvidia.com>
2013-04-09 11:18:02 -07:00
Allen Martin
f536ef21b1 Move all source files to subdir "src"
This is in preparation for adding autotools support to help separate the source
code from the build support files.

Signed-off-by: Allen Martin <amartin@nvidia.com>
Change-Id: I128c258db7bbf2c1adf34fbaad188ea7678b79ff
Reviewed-on: http://git-master/r/217545
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Stephen Warren <swarren@nvidia.com>
2013-04-09 11:17:38 -07:00
Marc Dietrich
8e0070a2a8 Add install target
This adds an install target to the Makefile. cbootimage and bct_dump
are installed to /usr/bin.

Signed-off-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Change-Id: Ib4aba674a7ca206d5de998c649b65772312d510c
Reviewed-on: http://git-master/r/200182
Reviewed-by: Allen Martin <amartin@nvidia.com>
Reviewed-by: Rhyland Klein <rklein@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
2013-02-12 15:06:02 -08:00
Stephen Warren
acbfad4efb Fix type of variable used to store fgetc() result
fgetc() returns an int. Fix process_config_file() to store the result in
an int, so that comparisons against EOF succeed.

Previously, If "char" defaulted to unsigned (which may be true for armhf),
then when fgetc() returned -1, it would be truncated to 255 when stored
in the char, and then zero-filled rather than sign-extended when comparing
against EOF, which would then fail.

See http://code.google.com/p/chromium-os/issues/detail?id=25632.

Reported-by: Paul Fertser <fercerpav@gmail.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Change-Id: I018e32df9a87b7c6f9fe24d108e091a7b31a50c8
Reviewed-on: http://git-master/r/192151
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Allen Martin <amartin@nvidia.com>
2013-01-17 14:07:42 -08:00
Penny Chiu
0bbfaf91d1 Add Tegra114 support for emmc boot device
Add the Tegra114 chip support to cbootimage. User can use "-t114" as
option to parse .cfg and generate BCT/image for Tegra114.

Change-Id: I02bd3f633afccd2c9c0b01d43ed4660fa4b82ae0
Signed-off-by: Penny Chiu <pchiu@nvidia.com>
Reviewed-on: http://git-master/r/169619
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Rhyland Klein <rklein@nvidia.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
2013-01-11 08:37:01 -08:00
Penny Chiu
5f4e2a3a2e Rewrite the interface for T20/T30 bct data access
Create a structure called cbootimage_soc_config that defines a chip, and
data tables and functions for that chip.

The main function just sets appropriate instance based on
boot_data_version, then uses the same interface to access different chip
bct data.

Change-Id: I58fbc07012dce8947467c0bea62e2a50126d54fe
Signed-off-by: Penny Chiu <pchiu@nvidia.com>
Reviewed-on: http://git-master/r/173670
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Rhyland Klein <rklein@nvidia.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
2013-01-11 08:36:49 -08:00
Stephen Warren
ce21ef893f Fix warnings
warning: variable ‘...’ set but not used
warning: comparison between pointer and integer

Change-Id: Ia0b6b4ffca61bfc94a118591578e1b0af55a703f
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-on: http://git-master/r/167565
Reviewed-by: Eric Brower <ebrower@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
2012-11-30 15:10:57 -08:00
Stephen Warren
6ed46d5f0a bct_dump: dump the ODMDATA value
And leave a blank line after it, to emulate the layout of configurations
in cbootimage-configs.git.

Change-Id: Ic0ad7622503786df0c38e5ef60e6df5dc722bc4e
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-on: http://git-master/r/167475
Reviewed-by: Allen Martin <amartin@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Eric Brower <ebrower@nvidia.com>
2012-11-30 15:10:39 -08:00
Stephen Warren
b258a01dfb Indent bct_dump.c's tables with spaces not TABS
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Change-Id: I197d36c023eb7aef671b60cde59beed97c4e6683
Reviewed-on: http://git-master/r/167548
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Rhyland Klein <rklein@nvidia.com>
Reviewed-by: Eric Brower <ebrower@nvidia.com>
Reviewed-by: Allen Martin <amartin@nvidia.com>
2012-11-30 13:06:41 -08:00
Stephen Warren
4b0e5d0250 Switch to GPL-v2-only license
... and paste in the standard NVIDIA license header formatting, and
add a copy of the GPLv2 in COPYING.

Change-Id: I7ef29d4652e09776b03aa9873db5926c80f06f60
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-on: http://git-master/r/167474
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Eric Brower <ebrower@nvidia.com>
Tested-by: Eric Brower <ebrower@nvidia.com>
Reviewed-by: Allen Martin <amartin@nvidia.com>
2012-11-30 13:05:29 -08:00
Stephen Warren
2b88b19134 Add NVIDIA to CREDITS file
Change-Id: I612ef274d516073e13e8f52dbf36892e39b36409
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-on: http://git-master/r/167473
Reviewed-by: Automatic_Commit_Validation_User
2012-11-29 17:30:40 -08:00
Stephen Warren
8060724d71 Add top-level .gitignore file
This prevents "git status" from displaying generated files as new, and
hence needing commit.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Change-Id: I2c0319183ba3e8d4222f533229474cf6bc0c4049
Reviewed-on: https://gerrit.chromium.org/gerrit/23243
Reviewed-by: Simon Glass <sjg@chromium.org>
2012-05-23 07:56:07 -07:00
Stephen Warren
f13abb05ce Add PreBctPadBlocks config file option
This allows the BCT to be offset within the memory device. This is a port
of commit 883a7d0 "Add suport for MMC boot image preparation" from
git://gitorious.org/cbootimage/cbootimage.git's trimslice branch. The
description there is:

    Add suport for MMC boot image preparation

    In order to allow the MBR to be placed at offset 0,
    BCT is copied to 128K offset.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Change-Id: Icde53082f5a4645fefb70deb408a42f9920aed1f
Reviewed-on: https://gerrit.chromium.org/gerrit/22935
Reviewed-by: Simon Glass <sjg@chromium.org>
2012-05-23 07:56:07 -07:00
Stephen Warren
56bbad5511 Use correct limit in find_new_bct_blk()
The limit is max_bct_search_blks not hash_size.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Change-Id: Idbde21ef75f03c2d6d4adbbe62bd623e4ad6b70e
Reviewed-on: https://gerrit.chromium.org/gerrit/22934
Reviewed-by: Rhyland Klein <rklein@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2012-05-22 13:43:29 -07:00
Stephen Warren
fb4793a85b Allow OdmData to be specified in the config file
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Change-Id: I795131b39de2b09f77d53f2cb03a68d8ef07e2fb
Reviewed-on: https://gerrit.chromium.org/gerrit/22933
Reviewed-by: Rhyland Klein <rklein@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2012-05-21 17:12:40 -07:00
Peer Chen
de7ab55eb1 CHROMIUM: cbootimage: Specify the ODM_DATA
Add the ODM_DATA argument, u-boot remove the hardcode ODM_DATA,
need to use the ODM_DATA from BCT.

BUG=None
TEST=Done

Change-Id: I215ed99f42d02b82450130129badef2b36e6d370
Signed-off-by: Peer Chen <pchen@nvidia.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/20306
Reviewed-by: Tom Warren <twarren@nvidia.com>
Reviewed-by: Jimmy Zhang <jimmzhang@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2012-04-19 14:42:05 -07:00
Peer Chen
6f2cbc7384 CHROMIUM: cbootimage: Add t30 support
Add the t30 chip support to cbootimage file, use can append
-t20/-t30 chipname option to support the different chip
explicitly, the default is t20 if without this chipname option.

BUG=None
TEST=Test done locally with .cfg file

Change-Id: I0e77f0e0ce2a324bee3287787dcab1c15f3512e4
Reviewed-on: https://gerrit.chromium.org/gerrit/17911
Commit-Ready: Peer Chen <pchen@nvidia.com>
Tested-by: Peer Chen <pchen@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2012-04-10 10:55:18 -07:00
Peer Chen
56f4048a7b CHROMIUM: cbootimage: Add Bctcopy parameter
Add the Bctcopy parameter for the bct number in final boot image
file to save the NAND space.
In .cfg file, add "Bctcopy = n(n >= 1)" to specify the bct count.

BUG=chromium-os:17464
TEST=cfg-file

Change-Id: I873a000f9165017db9dec25fb7b18cf082e535ba
Reviewed-on: http://gerrit.chromium.org/gerrit/5207
Reviewed-by: Anton Staaf <robotboy@chromium.org>
Tested-by: Doug Anderson <dianders@chromium.org>
2011-09-16 11:58:56 -07:00
Anton Staaf
20379c18a2 Finish conversion of bct_dump to generate config files that cbootimage can parse.
This includes code to look up the human readable string names for enum
values.  The next step will be to convert all of our existing BCT files
from binary to config file format.  Then the cros_write_firmware and
cros_sign_bootstub tools will need to be changed to read the config file
instead of a binary BCT.  The tegra-bct ebuilds will also need to change
to install config files instead of binary BCT files.

BUG=chromium-os:11981
TEST=manually dump a working BCT and run cbootimage to reconstruct the BCT.
flash and boot with the new BCT.

Change-Id: I056735d0638b349580c6993b2976ca55bf4d0ea2

Review URL: http://codereview.chromium.org/6683050
2011-03-14 15:38:59 -07:00
Anton Staaf
e517a4f5ce Expose and augment parser enum and field name tables to bct_dump.
This adds the nvbctlib id value to the field_item struct and makes
the parser tables available outside of parse.c.  This lets bct_dump
use these to pretty print a BCT in a format that the parser can
later read back in.

BUG=chromium-os:11981
TEST=Sign and boot a U-Boot image on Seaboard using:

sudo emerge -av cbootimage
USE="recovery flasher" emerge-tegra2_seaboard -av chromeos-u-boot-next
cros_write_firmware --board tegra2_seaboard --firmware /build/tegra2_seaboard/u-boot/u-boot-recovery.bin --sign

Change-Id: Ibcc8ce5c2c62cbfea8ca2850ddd8122b84c0f78f

Review URL: http://codereview.chromium.org/6677007
2011-03-14 12:28:06 -07:00
Anton Staaf
240529da17 Initialize the bad block table when create the bct file from scratch,
bct file can't work if miss the bad block table field.

Change-Id: Icf4e64d761e6160f022d4934c4670f435a299933

BUG=
TEST= Test with config file on Seaboard.

Review URL: http://codereview.chromium.org/6676023
2011-03-11 13:56:27 -08:00
Vincent Palatin
994758414b Add support for SDRAM registers printing to bct_dump.
This adds human readable output for RAM controller registers default
values stored in a BCT file.

BUG=None
TEST=bct_dump burn-u-boot/bct/default.bct and check EMC_CFG value.

This CL depends on http://codereview.chromium.org/6625006/

Change-Id: I4451d17c144d0273d375e490511e2534accd6de1

Review URL: http://codereview.chromium.org/6626016
2011-03-07 16:09:25 -05:00
Peer Chen
3a834ed783 Add the SDRAM parameters support for cbootimage.
Change-Id: I15a6cacbf8b19b16b4bcccd6ea0e2740cacadee3

BUG=None.
TEST=Test with config file.

Review URL: http://codereview.chromium.org/6625006
Patch from Peer Chen <pchen@nvidia.com>.
2011-03-04 09:30:05 -08:00
Peer Chen
053d578f2b Add the nand device support for cbootimage tool.
Change-Id: Ic24dd4c971c16d00742d90830be168b41483be7a

BUG=None.
TEST=Test with the config file.

Review URL: http://codereview.chromium.org/6611009
Patch from Peer Chen <pchen@nvidia.com>.
2011-03-03 10:12:58 -08:00
Peer Chen
8f49024db8 Add the SDRAM parameter header file.
Change-Id: I9d48b5c9222a50695df00694a97f8c52729657e7

BUG=None.
TEST=None.

Review URL: http://codereview.chromium.org/6602078
Patch from Peer Chen <pchen@nvidia.com>.
2011-03-02 10:30:32 -08:00
Anton Staaf
496f965e65 Add support for flash device parameters printing to bct_dump.
This adds human readable output for SPI and SDMMC device
parameters stored in a BCT file.  This includes clock
divisors, boot flash type and various flash type specific
parameters.

BUG=None
TEST=bct_dump /build/tegra2_seaboard/u-boot/image.bin

Change-Id: I9f233abf53627ddb00159e105cfa3ff01d38ce5c

This CL depends on: http://codereview.chromium.org/6579041/

Review URL: http://codereview.chromium.org/6576041
2011-03-02 09:23:27 -08:00
Anton Staaf
2b6c88c2d9 Fix tab stops to be 8-spaces instead of 4.
Change-Id: If70ee0c550a37ad7401552c231021b966b8e368f

BUG=None
TEST=None

Review URL: http://codereview.chromium.org/6579041
2011-03-02 09:22:25 -08:00
Anton Staaf
c6244270f4 Add bct_dump tool.
This tool dumps a human readable version of the BCT file provided on
the command line to stdout.

Change-Id: Ic9609b16aee307fd78c2d5d472d8d08072573df6

BUG=chromium-os:11981
TEST=run bct_dump on SPI and NAND BCT files and verify that the expected values are displayed.

This CL depends on: http://codereview.chromium.org/6469010/

Review URL: http://codereview.chromium.org/6524004
2011-02-24 10:17:50 -08:00
Peer Chen
7557d9b11c Add the device type/parameters support for cbootimage tool.
Add the bct generated function for cbootimage tool.

Change-Id: I2ad282d7dbce1d06d54fa3ee2ef5f550598089b0

BUG=None.
TEST=Test using the cfg file.

Review URL: http://codereview.chromium.org/6579034
Patch from Peer Chen <pchen@nvidia.com>.
2011-02-24 09:29:23 -08:00
Anton Staaf
52be3bf067 Add initial CREDITS file.
Change-Id: I2eb4291c9844ca78e4cb2a14f64487c528cc4168

BUG=None
TEST=None

Review URL: http://codereview.chromium.org/6476005
2011-02-17 15:34:50 -08:00
Anton Staaf
73664ab25e Factor out the context specific functions into their own file.
These will be reused by my BCT display tool.

Change-Id: I88d595412ec439a96231b81253eb04ed4bfd377d

BUG=chromium-os:10502
TEST=run cbootimage on test config.

Review URL: http://codereview.chromium.org/6469010
2011-02-17 09:22:32 -08:00
Anton Staaf
fd81bb6a70 Add emacs coding style configuration file.
Change-Id: I49818d167126659c499ec5716bdf841560487826

BUG=None
TEST=None

Review URL: http://codereview.chromium.org/6478003
2011-02-11 09:41:20 -08:00
Anton Staaf
7cdc68c1c4 Check return code of fwrite in raw image writing code.
Change-Id: I8c52a205ae1dc559c9f8b41d4d2c50e821b3b05c

BUG=None
TEST=None

Review URL: http://codereview.chromium.org/6368153
2011-02-10 10:34:15 -08:00
Anton Staaf
9d467bfed6 Fix pointer to integer cast warning.
Change-Id: I149b901885ab09260b0d9c7d82f41a41397d4b44

BUG=None
TEST=build and observe no compiler warnings.

Review URL: http://codereview.chromium.org/6298020
2011-01-28 11:19:05 -08:00
Allen Martin
a5e1002501 Remove extra path element.
Remove extra path element that came as part of the git I cloned
this from.
2011-01-25 12:56:10 -08:00
Peer Chen
8d782eec33 tegra tools: add the cbootimage for google request
cbootimage is a tool used to combine binary .bct, bootloader
and google's component to a spi rom image file.

Change-Id: I25b6fee13d7449fc83ec3802b79cbbbcaae54494
2011-01-25 12:51:58 -08:00