From patchwork Mon Jul 8 19:18:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1129221 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="k9tHXL3c"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45jFcd08HFz9sNH for ; Tue, 9 Jul 2019 05:19:12 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id ABA8CC21DD7; Mon, 8 Jul 2019 19:19:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 6E2B1C21C3F; Mon, 8 Jul 2019 19:19:05 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 55A39C21C3F; Mon, 8 Jul 2019 19:19:04 +0000 (UTC) Received: from mail-io1-f67.google.com (mail-io1-f67.google.com [209.85.166.67]) by lists.denx.de (Postfix) with ESMTPS id E90E4C21BE5 for ; Mon, 8 Jul 2019 19:19:02 +0000 (UTC) Received: by mail-io1-f67.google.com with SMTP id o9so22242323iom.3 for ; Mon, 08 Jul 2019 12:19:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=VKpRuQflXdNEB8KHibswv4ZvVTd7QGmQpFXAkH/lI4g=; b=k9tHXL3ce8mIoc5tV5oKTc4kzJjB5b4weaddModMdPDzAyFOxG1vWhPIYLYNM+E5RO C6rm2ajwOnpKnUwiadZzzT/PEFqJagXlGn3cTiFKIvlYpWsp4KsCM9DKDGySyht6NIhk vRAip2ue7AJivzjJZeqdr6SFN2UTiGp36pE0w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=VKpRuQflXdNEB8KHibswv4ZvVTd7QGmQpFXAkH/lI4g=; b=KNMv+dcn589ekDZmBw7Q93OsEplwuV8xp7ON2y7b5W4VOt1FRSjwY5SlCQaBTVwp3+ 0Es+f9YuJgppe+7hGHdXTEEzyvv5jONXsHUzemyqdO7rYwjI/9X0q44UAtDkHX96DZjS FYGepL/8Knv8lRgQOeAYI/TVLUgN52IKvTsZtabsOqBg5cbb4xhCwuA8YYPLdfdeFzGI EIS08z4ihTckQDGyYWJ9lmdCRoSeXzZgiCXLJwr1Zs0Xp2Znd3nWkepWDVFdfCPjxxDK H9sZ0HRYzRdyUqTp6IkrQc1LpKfRowgqt2A23Yx8N5fQETsf+gTQcQwA10X/kYIOwKYN RnZQ== X-Gm-Message-State: APjAAAXbZUzmIK6a45VEGUFmzmm9R/SWLGVw2ZB+yQPHeeQIiC+gqYBF JwHEwu0AZR4g/ldRcJOX+O2ptsV3POE= X-Google-Smtp-Source: APXvYqyXEEB4uFLPHrUqwm9v/Z81gv1C8suenliItW7MQTlDUcl9dnxVSbLXByV637jaKw2bzbiUIw== X-Received: by 2002:a6b:b593:: with SMTP id e141mr21913841iof.203.1562613541499; Mon, 08 Jul 2019 12:19:01 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id j1sm15545094iop.14.2019.07.08.12.18.59 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 08 Jul 2019 12:19:00 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Mon, 8 Jul 2019 13:18:19 -0600 Message-Id: <20190708191856.138863-1-sjg@chromium.org> X-Mailer: git-send-email 2.22.0.410.gd8fdbe21b5-goog MIME-Version: 1.0 Cc: Stefan Reinauer Subject: [U-Boot] [PATCH v2 00/37] binman: Add CBFS support X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" CBFS (Coreboot Filesystem) is a simple ROM-based filesystem used for locating data needed during booting. It has particular features for x86 such as defining a boot block at the top of the ROM image. At run-time, boot loaders can locate files in the ROM by searching for a header and magic strings in the ROM. It is common to have multiple, separate CBFSs in the ROM. Binman provides its own way of locating data, typically with a device tree built into the image, or linker symbols when space is short. But it is useful to be able to create images containing CBFSs with binman, since it allows all image structure to defined in one place, rather than spread out over multiple cbfstool invocations, etc. The approach taken here is to directly create the CBFS in binman rather than calling out to cbfstool. The latter is quite slow for multiple invocations and the tool itself has no tests. Also included is ifwitool lifted from coreboot, which is needed to package images for Intel apollo lake SoCs. This seems easier than implementing this functionality in binman. Tests are provided for new binman functionality, although ifwitool has no tests and is tested only by invocation from binman. This series does not support all CBFS features, just raw binaries and Elf files (called 'stages' in CBFS). Changes in v2: - Deal with travis's old lz4 version by skipping tests as necessary - Install lzma tool in travis - Skip use of cbfstool in tests if it is not available Simon Glass (37): x86: Add ifwitool for Intel Integrated Firmware Image cbfs: Add an enum and comment for the magic number cbfs: Rename checksum to attributes_offset tools: Drop duplicate raise_on_error argument binman: Fix comment in bsection.GetEntries() binman: Correct two typos in function names in ftest binman: Add coverage tools info for Python 3 patman: Add a way to set the search path for tools binman: Add a --toolpath option to set the tool search path binman: Add missing comments to bsection binman: Add missing comments toentry binman: Tidy up help for --indir binman: Use a better error for missing Intel descriptor binman: Detect skipped tests binman: Add a function to create a sample ELF file binman: Add a function to decode an ELF file binman: Ensure that coverage has access to site packages binman: Assume Intel descriptor is at the start of the image binman: Don't assume there is an ME region binman: Update entry.SetOffsetSize to be optional binman: Allow text directly in the node patman: Add functions to compress and decompress data binman: Use the tools.Decompress method binman: Drop unnecessary debug handling binman: Use tools compression function for blob handling binman: Correct comment in u_boot_spl_elf binman: Support ELF files for TPL binman: Fix up the _DoTestFile() function -u argument binman: Allow verbosity control when running tests binman: Allow preserving test directories binman: Pass the toolpath to tests patman: Add a function to write ifwitool binman: Add a utility library for coreboot CBFS binman: Add support for CBFS entries binman: Add support for Intel IFWI entries binman: Pad empty areas of the CBFS with files binman: Add support for fixed-offset files in CBFS .travis.yml | 3 +- fs/cbfs/cbfs.c | 4 +- include/cbfs.h | 16 +- test/run | 9 +- tools/Makefile | 3 + tools/binman/README | 25 +- tools/binman/README.entries | 204 +- tools/binman/binman.py | 52 +- tools/binman/bsection.py | 42 +- tools/binman/cbfs_util.py | 861 ++++++ tools/binman/cbfs_util_test.py | 625 +++++ tools/binman/cmdline.py | 8 +- tools/binman/control.py | 3 + tools/binman/elf.py | 174 ++ tools/binman/elf_test.py | 41 + tools/binman/entry.py | 38 +- tools/binman/etype/blob.py | 16 +- tools/binman/etype/cbfs.py | 205 ++ tools/binman/etype/intel_descriptor.py | 16 +- tools/binman/etype/intel_ifwi.py | 100 + tools/binman/etype/intel_me.py | 2 + tools/binman/etype/text.py | 23 +- tools/binman/etype/u_boot_spl_elf.py | 2 +- tools/binman/etype/u_boot_tpl_elf.py | 24 + tools/binman/ftest.py | 266 +- tools/binman/test/066_text.dts | 5 + tools/binman/test/096_elf.dts | 2 + tools/binman/test/102_cbfs_raw.dts | 20 + tools/binman/test/103_cbfs_raw_ppc.dts | 21 + tools/binman/test/104_cbfs_stage.dts | 19 + tools/binman/test/105_cbfs_raw_compress.dts | 26 + tools/binman/test/106_cbfs_bad_arch.dts | 15 + tools/binman/test/107_cbfs_no_size.dts | 13 + tools/binman/test/108_cbfs_no_contents.dts | 17 + tools/binman/test/109_cbfs_bad_compress.dts | 18 + tools/binman/test/110_cbfs_name.dts | 24 + tools/binman/test/111_x86-rom-ifwi.dts | 29 + tools/binman/test/112_x86-rom-ifwi-nodesc.dts | 28 + tools/binman/test/113_x86-rom-ifwi-nodata.dts | 29 + tools/binman/test/114_cbfs_offset.dts | 26 + tools/binman/test/fitimage.bin.gz | Bin 0 -> 8418 bytes tools/binman/test/ifwi.bin.gz | Bin 0 -> 1884 bytes tools/ifwitool.c | 2314 +++++++++++++++++ tools/patman/command.py | 4 +- tools/patman/tools.py | 141 +- 45 files changed, 5434 insertions(+), 79 deletions(-) create mode 100644 tools/binman/cbfs_util.py create mode 100755 tools/binman/cbfs_util_test.py create mode 100644 tools/binman/etype/cbfs.py create mode 100644 tools/binman/etype/intel_ifwi.py create mode 100644 tools/binman/etype/u_boot_tpl_elf.py create mode 100644 tools/binman/test/102_cbfs_raw.dts create mode 100644 tools/binman/test/103_cbfs_raw_ppc.dts create mode 100644 tools/binman/test/104_cbfs_stage.dts create mode 100644 tools/binman/test/105_cbfs_raw_compress.dts create mode 100644 tools/binman/test/106_cbfs_bad_arch.dts create mode 100644 tools/binman/test/107_cbfs_no_size.dts create mode 100644 tools/binman/test/108_cbfs_no_contents.dts create mode 100644 tools/binman/test/109_cbfs_bad_compress.dts create mode 100644 tools/binman/test/110_cbfs_name.dts create mode 100644 tools/binman/test/111_x86-rom-ifwi.dts create mode 100644 tools/binman/test/112_x86-rom-ifwi-nodesc.dts create mode 100644 tools/binman/test/113_x86-rom-ifwi-nodata.dts create mode 100644 tools/binman/test/114_cbfs_offset.dts create mode 100644 tools/binman/test/fitimage.bin.gz create mode 100644 tools/binman/test/ifwi.bin.gz create mode 100644 tools/ifwitool.c