aboutsummaryrefslogtreecommitdiff
path: root/util/cbfstool/flashmap
AgeCommit message (Collapse)Author
2017-07-13Rename __attribute__((packed)) --> __packedStefan Reinauer
Also unify __attribute__ ((..)) to __attribute__((..)) and handle ((__packed__)) like ((packed)) Change-Id: Ie60a51c3fa92b5009724a5b7c2932e361bf3490c Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Reviewed-on: https://review.coreboot.org/15921 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2016-08-09flashmap: Allocate at least one entry in kv_pair_new()Stefan Reinauer
Change-Id: I971fa85ed977884d050790560a5a8f2ce955eb7c Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Reviewed-on: https://review.coreboot.org/14444 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2016-01-14cbfstool: Change FMAP granularity to 16 bytesStefan Reinauer
Instead of looking for an FMAP at every byte, only search down to a granularity of 16 bytes, reducing the time for a cbfstool call by 0.3s when no FMAP is found. Signed-off-by: Stefan Reinauner <reinauer@chromium.org> BUG=none BRANCH=none TEST=time ./cbfstool coreboot.rom add -f locale_de.bin -n locale_de.bin -t 0x50 -c lzma is 0.3s faster than before. Change-Id: Icb4937330e920ae09928ceda7c1af6a3c5130ac7 Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Original-Commit-Id: bc92d838ba9db7733870ea6e8423fa4fa41bf8fe Original-Change-Id: Idbaec58a199df93bdc10e883c56675b419ab5b8e Original-Reviewed-on: https://chromium-review.googlesource.com/317321 Original-Commit-Ready: Stefan Reinauer <reinauer@chromium.org> Original-Tested-by: Stefan Reinauer <reinauer@chromium.org> Original-Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://review.coreboot.org/12932 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth <martinroth@google.com>
2015-10-08cbfstool: allow printable characters in image nameAndrey Petrov
Currently cbfstool would reject non-alpanumeric characters in image names. Underscore is not alphanumeric and is used in some default fmaps. This change allows image names to contain all "printable" characters except spaces. Change-Id: I6ba2b581d5623f5b028149ece0169892ea63fd04 Signed-off-by: Andrey Petrov <andrey.petrov@intel.com> Reviewed-on: http://review.coreboot.org/11807 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2015-09-21cbfstool: make fmap search more strictPatrick Georgi
Since fmap doesn't come with a checksum, we resort to a number of heuristics to determine if a given location hosts an fmap (instead of another data structure that happens to store the fmap magic string at the right location). The version test is particularly effective against strings containing the magic (which either terminate with 0, or have some other ASCII data, but rarely a '\001' byte inside the string). Change-Id: Ic66eb0015c7ffdfe25e0054b7838445b8ba098e9 Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-on: http://review.coreboot.org/11690 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2015-07-07cbfstool: Fix kv_pair on WindowsStefan Reinauer
On Windows systems the archetype printf defaults to ms_printf instead of gnu_printf. Keep the archetype print for all non- Windows compiles to not break compatibility with other systems out there. Change-Id: Iad8441f4dc814366176646f6a7a5df653fda4c15 Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Signed-off-by: Scott Duplichan <scott@notabs.org> Reviewed-on: http://review.coreboot.org/10793 Tested-by: build bot (Jenkins)
2015-05-09fmap: request libc compatibility level that includes memccpyPatrick Georgi
Change-Id: I928efe6f63305a0099d64e83091aa80768582f48 Signed-off-by: Patrick Georgi <patrick@georgi-clan.de> Reviewed-on: http://review.coreboot.org/10160 Tested-by: build bot (Jenkins) Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
2015-05-08cbfstool: Restructure around support for reading/writing portions of filesSol Boucher
The buffer API that cbfstool uses to read and write files only directly supports one-shot operations on whole files. This adds an intermediate partitioned_file module that sits on top of the buffer system and has an awareness of FMAP entries. It provides an easy way to get a buffer for an individual region of a larger image file based on FMAP section name, as well as incrementally write those smaller buffers back to the backing file at the appropriate offset. The module has two distinct modes of operation: - For new images whose layout is described exclusively by an FMAP section, all the aforementioned functionality will be available. - For images in the current format, where the CBFS master header serves as the root of knowledge of the image's size and layout, the module falls back to a legacy operation mode, where it only allows manipulation of the entire image as one unit, but exposes this support through the same interface by mapping the region named SECTION_NAME_PRIMARY_CBFS ("COREBOOT") to the whole file. The tool is presently only ported onto the new module running in legacy mode: higher-level support for true "partitioned" images will be forthcoming. However, as part of this change, the crusty cbfs_image_from_file() and cbfs_image_write_file() abstractions are removed and replaced with a single cbfs_image function, cbfs_image_from_buffer(), as well as centralized image reading/writing directly in cbfstool's main() function. This reduces the boilerplate required to implement each new action, makes the create action much more similar to the others, and will make implementing additional actions and adding in support for the new format much easier. BUG=chromium:470407 TEST=Build panther and nyan_big coreboot.rom images with and without this patch and diff their hexdumps. Ensure that no differences occur at different locations from the diffs between subsequent builds of an identical source tree. Then flash a full new build onto nyan_big and watch it boot normally. BRANCH=None Change-Id: I25578c7b223bc8434c3074cb0dd8894534f8c500 Signed-off-by: Sol Boucher <solb@chromium.org> Original-Commit-Id: 7e1c96a48e7a27fc6b90289d35e6e169d5e7ad20 Original-Change-Id: Ia4a1a4c48df42b9ec2d6b9471b3a10eb7b24bb39 Original-Signed-off-by: Sol Boucher <solb@chromium.org> Original-Reviewed-on: https://chromium-review.googlesource.com/265581 Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: http://review.coreboot.org/10134 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2015-05-08fmaptool: Introduce the fmd ("flashmap descriptor") language and compilerSol Boucher
This adds a compiler for a language whose textual representation of flashmap regions will be used to describe the layout of flash chips that contain more than just a single CBFS. Direct integration with cbfstool (via a new command-line switch for the create action) is forthcoming but will be added separately. BUG=chromium:461875 TEST=Use Chromium OS's cros_bundle_firmware script on the fmap.dts file for panther. Using the latter file as a reference, write a corresponding fmap.fmd file and feed it through fmaptool. Run both binary output files though the flashmap project's own flashmap_decode utility. Observe only the expected differences. BRANCH=None Change-Id: I06b32d138dbef0a4e5ed43c81bd31c796fd5d669 Signed-off-by: Sol Boucher <solb@chromium.org> Original-Commit-Id: 005ab67eb594e21489cf31036aedaea87e0c7142 Original-Change-Id: Ia08f28688efdbbfc70c255916b8eb7eb0eb07fb2 Original-Signed-off-by: Sol Boucher <solb@chromium.org> Original-Reviewed-on: https://chromium-review.googlesource.com/255031 Original-Reviewed-by: Julius Werner <jwerner@chromium.org> Original-Reviewed-by: Stefan Reinauer <reinauer@chromium.org> Reviewed-on: http://review.coreboot.org/9942 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2015-05-08cbfstool: Fix strange flashmap whitespaceSol Boucher
This is being fixed in a separate commit so we can diff against the library as it existed in its own repo. Change-Id: Id87cd8f4e015a5ed7dd8a19302cc22ab744fefe8 Signed-off-by: Sol Boucher <solb@chromium.org> Reviewed-on: http://review.coreboot.org/10141 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2015-05-08cbfstool: Import minimal set of files from flashmapSol Boucher
flashmap was developed in a separate repository until now. Import the files from the 2012 version of the project [1]. [1] https://code.google.com/p/flashmap BUG=chromium:461875 TEST=None BRANCH=None Change-Id: Ida33f81509abc1cf2e532435adbbf31919d96bd8 Signed-off-by: Sol Boucher <solb@chromium.org> Original-Commit-Id: f44e1d1864babe244f07ca49655f0b80b84e890d Original-Change-Id: Ibf191d34df738449c9b9d7ebccca3d7f4150d4d3 Original-Signed-off-by: Sol Boucher <solb@chromium.org> Original-Reviewed-on: https://chromium-review.googlesource.com/254801 Original-Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-on: http://review.coreboot.org/9940 Tested-by: build bot (Jenkins)