summaryrefslogtreecommitdiff
path: root/tools/binman
diff options
context:
space:
mode:
Diffstat (limited to 'tools/binman')
l---------tools/binman/binman2
-rw-r--r--tools/binman/cbfs_util.py8
-rwxr-xr-xtools/binman/cbfs_util_test.py12
-rw-r--r--tools/binman/control.py20
-rw-r--r--tools/binman/elf.py8
-rw-r--r--tools/binman/elf_test.py10
-rw-r--r--tools/binman/entry.py22
-rw-r--r--tools/binman/entry_test.py12
-rw-r--r--tools/binman/etype/__init__.py0
-rw-r--r--tools/binman/etype/_testing.py6
-rw-r--r--tools/binman/etype/blob.py8
-rw-r--r--tools/binman/etype/blob_dtb.py6
-rw-r--r--tools/binman/etype/blob_named_by_arg.py4
-rw-r--r--tools/binman/etype/cbfs.py10
-rw-r--r--tools/binman/etype/cros_ec_rw.py2
-rw-r--r--tools/binman/etype/fdtmap.py10
-rw-r--r--tools/binman/etype/files.py8
-rw-r--r--tools/binman/etype/fill.py6
-rw-r--r--tools/binman/etype/fmap.py10
-rw-r--r--tools/binman/etype/gbb.py8
-rw-r--r--tools/binman/etype/image_header.py4
-rw-r--r--tools/binman/etype/intel_cmc.py4
-rw-r--r--tools/binman/etype/intel_descriptor.py4
-rw-r--r--tools/binman/etype/intel_fit.py2
-rw-r--r--tools/binman/etype/intel_fit_ptr.py2
-rw-r--r--tools/binman/etype/intel_fsp.py4
-rw-r--r--tools/binman/etype/intel_fsp_m.py4
-rw-r--r--tools/binman/etype/intel_fsp_s.py4
-rw-r--r--tools/binman/etype/intel_fsp_t.py4
-rw-r--r--tools/binman/etype/intel_ifwi.py8
-rw-r--r--tools/binman/etype/intel_me.py4
-rw-r--r--tools/binman/etype/intel_mrc.py4
-rw-r--r--tools/binman/etype/intel_refcode.py4
-rw-r--r--tools/binman/etype/intel_vbt.py4
-rw-r--r--tools/binman/etype/intel_vga.py4
-rw-r--r--tools/binman/etype/powerpc_mpc85xx_bootpg_resetvec.py4
-rw-r--r--tools/binman/etype/section.py10
-rw-r--r--tools/binman/etype/text.py6
-rw-r--r--tools/binman/etype/u_boot.py4
-rw-r--r--tools/binman/etype/u_boot_dtb.py4
-rw-r--r--tools/binman/etype/u_boot_dtb_with_ucode.py10
-rw-r--r--tools/binman/etype/u_boot_elf.py8
-rw-r--r--tools/binman/etype/u_boot_img.py4
-rw-r--r--tools/binman/etype/u_boot_nodtb.py4
-rw-r--r--tools/binman/etype/u_boot_spl.py7
-rw-r--r--tools/binman/etype/u_boot_spl_bss_pad.py10
-rw-r--r--tools/binman/etype/u_boot_spl_dtb.py4
-rw-r--r--tools/binman/etype/u_boot_spl_elf.py4
-rw-r--r--tools/binman/etype/u_boot_spl_nodtb.py4
-rw-r--r--tools/binman/etype/u_boot_spl_with_ucode_ptr.py6
-rw-r--r--tools/binman/etype/u_boot_tpl.py7
-rw-r--r--tools/binman/etype/u_boot_tpl_dtb.py4
-rw-r--r--tools/binman/etype/u_boot_tpl_dtb_with_ucode.py5
-rw-r--r--tools/binman/etype/u_boot_tpl_elf.py4
-rw-r--r--tools/binman/etype/u_boot_tpl_with_ucode_ptr.py10
-rw-r--r--tools/binman/etype/u_boot_ucode.py6
-rw-r--r--tools/binman/etype/u_boot_with_ucode_ptr.py12
-rw-r--r--tools/binman/etype/vblock.py6
-rw-r--r--tools/binman/etype/x86_reset16.py4
-rw-r--r--tools/binman/etype/x86_reset16_spl.py4
-rw-r--r--tools/binman/etype/x86_reset16_tpl.py4
-rw-r--r--tools/binman/etype/x86_start16.py4
-rw-r--r--tools/binman/etype/x86_start16_spl.py4
-rw-r--r--tools/binman/etype/x86_start16_tpl.py4
-rw-r--r--tools/binman/fdt_test.py8
-rw-r--r--tools/binman/fmap_util.py2
-rw-r--r--tools/binman/ftest.py49
-rw-r--r--tools/binman/image.py18
-rw-r--r--tools/binman/image_test.py2
-rwxr-xr-xtools/binman/main.py (renamed from tools/binman/binman.py)110
-rw-r--r--tools/binman/state.py10
71 files changed, 252 insertions, 346 deletions
diff --git a/tools/binman/binman b/tools/binman/binman
index 979b7e4d4b..11a5d8e18a 120000
--- a/tools/binman/binman
+++ b/tools/binman/binman
@@ -1 +1 @@
-binman.py \ No newline at end of file
+main.py \ No newline at end of file
diff --git a/tools/binman/cbfs_util.py b/tools/binman/cbfs_util.py
index 99d77878c9..39973371b9 100644
--- a/tools/binman/cbfs_util.py
+++ b/tools/binman/cbfs_util.py
@@ -15,16 +15,14 @@ Currently supported: raw and stage types with compression, padding empty areas
with empty files, fixed-offset files
"""
-from __future__ import print_function
-
from collections import OrderedDict
import io
import struct
import sys
-import command
-import elf
-import tools
+from binman import elf
+from patman import command
+from patman import tools
# Set to True to enable printing output while working
DEBUG = False
diff --git a/tools/binman/cbfs_util_test.py b/tools/binman/cbfs_util_test.py
index ddc2e09e35..2c62c8a0f8 100755
--- a/tools/binman/cbfs_util_test.py
+++ b/tools/binman/cbfs_util_test.py
@@ -9,8 +9,6 @@ These create and read various CBFSs and compare the results with expected
values and with cbfstool
"""
-from __future__ import print_function
-
import io
import os
import shutil
@@ -18,11 +16,11 @@ import struct
import tempfile
import unittest
-import cbfs_util
-from cbfs_util import CbfsWriter
-import elf
-import test_util
-import tools
+from binman import cbfs_util
+from binman.cbfs_util import CbfsWriter
+from binman import elf
+from patman import test_util
+from patman import tools
U_BOOT_DATA = b'1234'
U_BOOT_DTB_DATA = b'udtb'
diff --git a/tools/binman/control.py b/tools/binman/control.py
index 68ad5fc2c0..dc1dd2a7dc 100644
--- a/tools/binman/control.py
+++ b/tools/binman/control.py
@@ -5,17 +5,15 @@
# Creates binary images from input files controlled by a description
#
-from __future__ import print_function
-
from collections import OrderedDict
import os
import sys
-import tools
+from patman import tools
-import cbfs_util
-import command
-import elf
-import tout
+from binman import cbfs_util
+from binman import elf
+from patman import command
+from patman import tout
# List of images we plan to create
# Make this global so that it can be referenced from tests
@@ -62,7 +60,7 @@ def WriteEntryDocs(modules, test_missing=None):
to show as missing even if it is present. Should be set to None in
normal use.
"""
- from entry import Entry
+ from binman.entry import Entry
Entry.WriteDocs(modules, test_missing)
@@ -336,8 +334,8 @@ def PrepareImagesAndDtbs(dtb_fname, select_images, update_fdt):
"""
# Import these here in case libfdt.py is not available, in which case
# the above help option still works.
- import fdt
- import fdt_util
+ from dtoc import fdt
+ from dtoc import fdt_util
global images
# Get the device tree ready by compiling it and copying the compiled
@@ -475,7 +473,7 @@ def Binman(args):
# Put these here so that we can import this module without libfdt
from image import Image
- import state
+ from binman import state
if args.cmd in ['ls', 'extract', 'replace']:
try:
diff --git a/tools/binman/elf.py b/tools/binman/elf.py
index de1ce73f2a..f88031c2bf 100644
--- a/tools/binman/elf.py
+++ b/tools/binman/elf.py
@@ -5,10 +5,7 @@
# Handle various things related to ELF images
#
-from __future__ import print_function
-
from collections import namedtuple, OrderedDict
-import command
import io
import os
import re
@@ -16,8 +13,9 @@ import shutil
import struct
import tempfile
-import tools
-import tout
+from patman import command
+from patman import tools
+from patman import tout
ELF_TOOLS = True
try:
diff --git a/tools/binman/elf_test.py b/tools/binman/elf_test.py
index ac26fd51e4..37e1b423cf 100644
--- a/tools/binman/elf_test.py
+++ b/tools/binman/elf_test.py
@@ -10,11 +10,11 @@ import sys
import tempfile
import unittest
-import command
-import elf
-import test_util
-import tools
-import tout
+from binman import elf
+from patman import command
+from patman import test_util
+from patman import tools
+from patman import tout
binman_dir = os.path.dirname(os.path.realpath(sys.argv[0]))
diff --git a/tools/binman/entry.py b/tools/binman/entry.py
index b6f1b2c93f..90ffd27617 100644
--- a/tools/binman/entry.py
+++ b/tools/binman/entry.py
@@ -4,17 +4,15 @@
# Base class for all entries
#
-from __future__ import print_function
-
from collections import namedtuple
import importlib
import os
import sys
-import fdt_util
-import tools
-from tools import ToHex, ToHexSize
-import tout
+from dtoc import fdt_util
+from patman import tools
+from patman.tools import ToHex, ToHexSize
+from patman import tout
modules = {}
@@ -65,7 +63,7 @@ class Entry(object):
def __init__(self, section, etype, node, name_prefix=''):
# Put this here to allow entry-docs and help to work without libfdt
global state
- import state
+ from binman import state
self.section = section
self.etype = etype
@@ -110,15 +108,11 @@ class Entry(object):
# Import the module if we have not already done so.
if not module:
- old_path = sys.path
- sys.path.insert(0, os.path.join(our_path, 'etype'))
try:
- module = importlib.import_module(module_name)
+ module = importlib.import_module('binman.etype.' + module_name)
except ImportError as e:
raise ValueError("Unknown entry type '%s' in node '%s' (expected etype/%s.py, error '%s'" %
(etype, node_path, module_name, e))
- finally:
- sys.path = old_path
modules[module_name] = module
# Look up the expected class name
@@ -592,9 +586,7 @@ features to produce new behaviours.
modules.remove('_testing')
missing = []
for name in modules:
- if name.startswith('__'):
- continue
- module = Entry.Lookup(name, name)
+ module = Entry.Lookup('WriteDocs', name)
docs = getattr(module, '__doc__')
if test_missing == name:
docs = None
diff --git a/tools/binman/entry_test.py b/tools/binman/entry_test.py
index 277e10b585..80802f33de 100644
--- a/tools/binman/entry_test.py
+++ b/tools/binman/entry_test.py
@@ -9,10 +9,10 @@ import os
import sys
import unittest
-import entry
-import fdt
-import fdt_util
-import tools
+from binman import entry
+from dtoc import fdt
+from dtoc import fdt_util
+from patman import tools
class TestEntry(unittest.TestCase):
def setUp(self):
@@ -37,11 +37,11 @@ class TestEntry(unittest.TestCase):
else:
reload(entry)
else:
- import entry
+ from binman import entry
def testEntryContents(self):
"""Test the Entry bass class"""
- import entry
+ from binman import entry
base_entry = entry.Entry(None, None, None)
self.assertEqual(True, base_entry.ObtainContents())
diff --git a/tools/binman/etype/__init__.py b/tools/binman/etype/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
--- a/tools/binman/etype/__init__.py
+++ /dev/null
diff --git a/tools/binman/etype/_testing.py b/tools/binman/etype/_testing.py
index 25a6206bf3..ed718eed14 100644
--- a/tools/binman/etype/_testing.py
+++ b/tools/binman/etype/_testing.py
@@ -7,9 +7,9 @@
from collections import OrderedDict
-from entry import Entry, EntryArg
-import fdt_util
-import tools
+from binman.entry import Entry, EntryArg
+from dtoc import fdt_util
+from patman import tools
class Entry__testing(Entry):
diff --git a/tools/binman/etype/blob.py b/tools/binman/etype/blob.py
index d34c7b51bf..ede7a7a68c 100644
--- a/tools/binman/etype/blob.py
+++ b/tools/binman/etype/blob.py
@@ -5,10 +5,10 @@
# Entry-type module for blobs, which are binary objects read from files
#
-from entry import Entry
-import fdt_util
-import tools
-import tout
+from binman.entry import Entry
+from dtoc import fdt_util
+from patman import tools
+from patman import tout
class Entry_blob(Entry):
"""Entry containing an arbitrary binary blob
diff --git a/tools/binman/etype/blob_dtb.py b/tools/binman/etype/blob_dtb.py
index b2afa064c1..6c06943763 100644
--- a/tools/binman/etype/blob_dtb.py
+++ b/tools/binman/etype/blob_dtb.py
@@ -5,8 +5,8 @@
# Entry-type module for U-Boot device tree files
#
-from entry import Entry
-from blob import Entry_blob
+from binman.entry import Entry
+from binman.etype.blob import Entry_blob
class Entry_blob_dtb(Entry_blob):
"""A blob that holds a device tree
@@ -18,7 +18,7 @@ class Entry_blob_dtb(Entry_blob):
def __init__(self, section, etype, node):
# Put this here to allow entry-docs and help to work without libfdt
global state
- import state
+ from binman import state
Entry_blob.__init__(self, section, etype, node)
diff --git a/tools/binman/etype/blob_named_by_arg.py b/tools/binman/etype/blob_named_by_arg.py
index 344112bc42..3b4593f071 100644
--- a/tools/binman/etype/blob_named_by_arg.py
+++ b/tools/binman/etype/blob_named_by_arg.py
@@ -8,8 +8,8 @@
from collections import OrderedDict
-from blob import Entry_blob
-from entry import EntryArg
+from binman.etype.blob import Entry_blob
+from binman.entry import EntryArg
class Entry_blob_named_by_arg(Entry_blob):
diff --git a/tools/binman/etype/cbfs.py b/tools/binman/etype/cbfs.py
index 35b78370b2..e9aed8310c 100644
--- a/tools/binman/etype/cbfs.py
+++ b/tools/binman/etype/cbfs.py
@@ -7,10 +7,10 @@
from collections import OrderedDict
-import cbfs_util
-from cbfs_util import CbfsWriter
-from entry import Entry
-import fdt_util
+from binman import cbfs_util
+from binman.cbfs_util import CbfsWriter
+from binman.entry import Entry
+from dtoc import fdt_util
class Entry_cbfs(Entry):
"""Entry containing a Coreboot Filesystem (CBFS)
@@ -165,7 +165,7 @@ class Entry_cbfs(Entry):
def __init__(self, section, etype, node):
# Put this here to allow entry-docs and help to work without libfdt
global state
- import state
+ from binman import state
Entry.__init__(self, section, etype, node)
self._cbfs_arg = fdt_util.GetString(node, 'cbfs-arch', 'x86')
diff --git a/tools/binman/etype/cros_ec_rw.py b/tools/binman/etype/cros_ec_rw.py
index 261f8657a6..0dbe14b342 100644
--- a/tools/binman/etype/cros_ec_rw.py
+++ b/tools/binman/etype/cros_ec_rw.py
@@ -5,7 +5,7 @@
# Entry-type module for a Chromium OS EC image (read-write section)
#
-from blob_named_by_arg import Entry_blob_named_by_arg
+from binman.etype.blob_named_by_arg import Entry_blob_named_by_arg
class Entry_cros_ec_rw(Entry_blob_named_by_arg):
diff --git a/tools/binman/etype/fdtmap.py b/tools/binman/etype/fdtmap.py
index 5dc08b8289..aa8807990b 100644
--- a/tools/binman/etype/fdtmap.py
+++ b/tools/binman/etype/fdtmap.py
@@ -8,9 +8,9 @@ This handles putting an FDT into the image with just the information about the
image.
"""
-from entry import Entry
-import tools
-import tout
+from binman.entry import Entry
+from patman import tools
+from patman import tout
FDTMAP_MAGIC = b'_FDTMAP_'
FDTMAP_HDR_LEN = 16
@@ -82,8 +82,8 @@ class Entry_fdtmap(Entry):
global Fdt
import libfdt
- import state
- from fdt import Fdt
+ from binman import state
+ from dtoc.fdt import Fdt
Entry.__init__(self, section, etype, node)
diff --git a/tools/binman/etype/files.py b/tools/binman/etype/files.py
index 3473a2b1ef..10ab585f0e 100644
--- a/tools/binman/etype/files.py
+++ b/tools/binman/etype/files.py
@@ -9,9 +9,9 @@
import glob
import os
-from section import Entry_section
-import fdt_util
-import tools
+from binman.etype.section import Entry_section
+from dtoc import fdt_util
+from patman import tools
class Entry_files(Entry_section):
@@ -30,7 +30,7 @@ class Entry_files(Entry_section):
def __init__(self, section, etype, node):
# Put this here to allow entry-docs and help to work without libfdt
global state
- import state
+ from binman import state
Entry_section.__init__(self, section, etype, node)
self._pattern = fdt_util.GetString(self._node, 'pattern')
diff --git a/tools/binman/etype/fill.py b/tools/binman/etype/fill.py
index 623b7f4e95..860410ed6e 100644
--- a/tools/binman/etype/fill.py
+++ b/tools/binman/etype/fill.py
@@ -3,9 +3,9 @@
# Written by Simon Glass <sjg@chromium.org>
#
-from entry import Entry
-import fdt_util
-import tools
+from binman.entry import Entry
+from dtoc import fdt_util
+from patman import tools
class Entry_fill(Entry):
"""An entry which is filled to a particular byte value
diff --git a/tools/binman/etype/fmap.py b/tools/binman/etype/fmap.py
index 835ba5012e..a43fac38de 100644
--- a/tools/binman/etype/fmap.py
+++ b/tools/binman/etype/fmap.py
@@ -5,11 +5,11 @@
# Entry-type module for a Flash map, as used by the flashrom SPI flash tool
#
-from entry import Entry
-import fmap_util
-import tools
-from tools import ToHexSize
-import tout
+from binman.entry import Entry
+from binman import fmap_util
+from patman import tools
+from patman.tools import ToHexSize
+from patman import tout
class Entry_fmap(Entry):
diff --git a/tools/binman/etype/gbb.py b/tools/binman/etype/gbb.py
index a94c0fca9d..dd10599717 100644
--- a/tools/binman/etype/gbb.py
+++ b/tools/binman/etype/gbb.py
@@ -8,11 +8,11 @@
from collections import OrderedDict
-import command
-from entry import Entry, EntryArg
+from patman import command
+from binman.entry import Entry, EntryArg
-import fdt_util
-import tools
+from dtoc import fdt_util
+from patman import tools
# Build GBB flags.
# (src/platform/vboot_reference/firmware/include/gbb_header.h)
diff --git a/tools/binman/etype/image_header.py b/tools/binman/etype/image_header.py
index b9327dd799..176bdeb29b 100644
--- a/tools/binman/etype/image_header.py
+++ b/tools/binman/etype/image_header.py
@@ -11,8 +11,8 @@ image.
import struct
-from entry import Entry
-import fdt_util
+from binman.entry import Entry
+from dtoc import fdt_util
IMAGE_HEADER_MAGIC = b'BinM'
IMAGE_HEADER_LEN = 8
diff --git a/tools/binman/etype/intel_cmc.py b/tools/binman/etype/intel_cmc.py
index fa6f7793c6..5e6edbe4df 100644
--- a/tools/binman/etype/intel_cmc.py
+++ b/tools/binman/etype/intel_cmc.py
@@ -5,8 +5,8 @@
# Entry-type module for Intel Chip Microcode binary blob
#
-from entry import Entry
-from blob import Entry_blob
+from binman.entry import Entry
+from binman.etype.blob import Entry_blob
class Entry_intel_cmc(Entry_blob):
"""Entry containing an Intel Chipset Micro Code (CMC) file
diff --git a/tools/binman/etype/intel_descriptor.py b/tools/binman/etype/intel_descriptor.py
index b6477931d6..d4d7a26901 100644
--- a/tools/binman/etype/intel_descriptor.py
+++ b/tools/binman/etype/intel_descriptor.py
@@ -7,8 +7,8 @@
import struct
-from entry import Entry
-from blob import Entry_blob
+from binman.entry import Entry
+from binman.etype.blob import Entry_blob
FD_SIGNATURE = struct.pack('<L', 0x0ff0a55a)
MAX_REGIONS = 5
diff --git a/tools/binman/etype/intel_fit.py b/tools/binman/etype/intel_fit.py
index 2a34a05f95..ea482a6125 100644
--- a/tools/binman/etype/intel_fit.py
+++ b/tools/binman/etype/intel_fit.py
@@ -7,7 +7,7 @@
import struct
-from blob import Entry_blob
+from binman.etype.blob import Entry_blob
class Entry_intel_fit(Entry_blob):
"""Intel Firmware Image Table (FIT)
diff --git a/tools/binman/etype/intel_fit_ptr.py b/tools/binman/etype/intel_fit_ptr.py
index 148b206c3c..df118a68f2 100644
--- a/tools/binman/etype/intel_fit_ptr.py
+++ b/tools/binman/etype/intel_fit_ptr.py
@@ -7,7 +7,7 @@
import struct
-from blob import Entry_blob
+from binman.etype.blob import Entry_blob
class Entry_intel_fit_ptr(Entry_blob):
"""Intel Firmware Image Table (FIT) pointer
diff --git a/tools/binman/etype/intel_fsp.py b/tools/binman/etype/intel_fsp.py
index 00a78e7083..7db3d96b43 100644
--- a/tools/binman/etype/intel_fsp.py
+++ b/tools/binman/etype/intel_fsp.py
@@ -5,8 +5,8 @@
# Entry-type module for Intel Firmware Support Package binary blob
#
-from entry import Entry
-from blob import Entry_blob
+from binman.entry import Entry
+from binman.etype.blob import Entry_blob
class Entry_intel_fsp(Entry_blob):
"""Entry containing an Intel Firmware Support Package (FSP) file
diff --git a/tools/binman/etype/intel_fsp_m.py b/tools/binman/etype/intel_fsp_m.py
index bb1de73e41..51b4e7e1ac 100644
--- a/tools/binman/etype/intel_fsp_m.py
+++ b/tools/binman/etype/intel_fsp_m.py
@@ -5,8 +5,8 @@
# Entry-type module for Intel Firmware Support Package binary blob (M section)
#
-from entry import Entry
-from blob import Entry_blob
+from binman.entry import Entry
+from binman.etype.blob import Entry_blob
class Entry_intel_fsp_m(Entry_blob):
"""Entry containing Intel Firmware Support Package (FSP) memory init
diff --git a/tools/binman/etype/intel_fsp_s.py b/tools/binman/etype/intel_fsp_s.py
index 3d6900d1fb..b3683e476a 100644
--- a/tools/binman/etype/intel_fsp_s.py
+++ b/tools/binman/etype/intel_fsp_s.py
@@ -5,8 +5,8 @@
# Entry-type module for Intel Firmware Support Package binary blob (S section)
#
-from entry import Entry
-from blob import Entry_blob
+from binman.entry import Entry
+from binman.etype.blob import Entry_blob
class Entry_intel_fsp_s(Entry_blob):
"""Entry containing Intel Firmware Support Package (FSP) silicon init
diff --git a/tools/binman/etype/intel_fsp_t.py b/tools/binman/etype/intel_fsp_t.py
index 813a81f2e6..0f196f0f1c 100644
--- a/tools/binman/etype/intel_fsp_t.py
+++ b/tools/binman/etype/intel_fsp_t.py
@@ -5,8 +5,8 @@
# Entry-type module for Intel Firmware Support Package binary blob (T section)
#
-from entry import Entry
-from blob import Entry_blob
+from binman.entry import Entry
+from binman.etype.blob import Entry_blob
class Entry_intel_fsp_t(Entry_blob):
"""Entry containing Intel Firmware Support Package (FSP) temp ram init
diff --git a/tools/binman/etype/intel_ifwi.py b/tools/binman/etype/intel_ifwi.py
index 36aadc210c..6a96f6be55 100644
--- a/tools/binman/etype/intel_ifwi.py
+++ b/tools/binman/etype/intel_ifwi.py
@@ -7,10 +7,10 @@
from collections import OrderedDict
-from entry import Entry
-from blob import Entry_blob
-import fdt_util
-import tools
+from binman.entry import Entry
+from binman.etype.blob import Entry_blob
+from dtoc import fdt_util
+from patman import tools
class Entry_intel_ifwi(Entry_blob):
"""Entry containing an Intel Integrated Firmware Image (IFWI) file
diff --git a/tools/binman/etype/intel_me.py b/tools/binman/etype/intel_me.py
index c932ec5222..41c9c6b920 100644
--- a/tools/binman/etype/intel_me.py
+++ b/tools/binman/etype/intel_me.py
@@ -5,8 +5,8 @@
# Entry-type module for Intel Management Engine binary blob
#
-from entry import Entry
-from blob import Entry_blob
+from binman.entry import Entry
+from binman.etype.blob import Entry_blob
class Entry_intel_me(Entry_blob):
"""Entry containing an Intel Management Engine (ME) file
diff --git a/tools/binman/etype/intel_mrc.py b/tools/binman/etype/intel_mrc.py
index 4dbc99a04f..854a4dda61 100644
--- a/tools/binman/etype/intel_mrc.py
+++ b/tools/binman/etype/intel_mrc.py
@@ -5,8 +5,8 @@
# Entry-type module for Intel Memory Reference Code binary blob
#
-from entry import Entry
-from blob import Entry_blob
+from binman.entry import Entry
+from binman.etype.blob import Entry_blob
class Entry_intel_mrc(Entry_blob):
"""Entry containing an Intel Memory Reference Code (MRC) file
diff --git a/tools/binman/etype/intel_refcode.py b/tools/binman/etype/intel_refcode.py
index 045db589d1..a1059f787e 100644
--- a/tools/binman/etype/intel_refcode.py
+++ b/tools/binman/etype/intel_refcode.py
@@ -5,8 +5,8 @@
# Entry-type module for Intel Memory Reference Code binary blob
#
-from entry import Entry
-from blob import Entry_blob
+from binman.entry import Entry
+from binman.etype.blob import Entry_blob
class Entry_intel_refcode(Entry_blob):
"""Entry containing an Intel Reference Code file
diff --git a/tools/binman/etype/intel_vbt.py b/tools/binman/etype/intel_vbt.py
index d93dd19634..4d465ad017 100644
--- a/tools/binman/etype/intel_vbt.py
+++ b/tools/binman/etype/intel_vbt.py
@@ -4,8 +4,8 @@
# Entry-type module for Intel Video BIOS Table binary blob
#
-from entry import Entry
-from blob import Entry_blob
+from binman.entry import Entry
+from binman.etype.blob import Entry_blob
class Entry_intel_vbt(Entry_blob):
"""Entry containing an Intel Video BIOS Table (VBT) file
diff --git a/tools/binman/etype/intel_vga.py b/tools/binman/etype/intel_vga.py
index 40982c8665..04cd72f3dc 100644
--- a/tools/binman/etype/intel_vga.py
+++ b/tools/binman/etype/intel_vga.py
@@ -5,8 +5,8 @@
# Entry-type module for x86 VGA ROM binary blob
#
-from entry import Entry
-from blob import Entry_blob
+from binman.entry import Entry
+from binman.etype.blob import Entry_blob
class Entry_intel_vga(Entry_blob):
"""Entry containing an Intel Video Graphics Adaptor (VGA) file
diff --git a/tools/binman/etype/powerpc_mpc85xx_bootpg_resetvec.py b/tools/binman/etype/powerpc_mpc85xx_bootpg_resetvec.py
index 59fedd2b54..cefd425a5d 100644
--- a/tools/binman/etype/powerpc_mpc85xx_bootpg_resetvec.py
+++ b/tools/binman/etype/powerpc_mpc85xx_bootpg_resetvec.py
@@ -4,8 +4,8 @@
# Entry-type module for the PowerPC mpc85xx bootpg and resetvec code for U-Boot
#
-from entry import Entry
-from blob import Entry_blob
+from binman.entry import Entry
+from binman.etype.blob import Entry_blob
class Entry_powerpc_mpc85xx_bootpg_resetvec(Entry_blob):
"""PowerPC mpc85xx bootpg + resetvec code for U-Boot
diff --git a/tools/binman/etype/section.py b/tools/binman/etype/section.py
index 89b7bf67fa..91b8e0c110 100644
--- a/tools/binman/etype/section.py
+++ b/tools/binman/etype/section.py
@@ -8,16 +8,14 @@ Sections are entries which can contain other entries. This allows hierarchical
images to be created.
"""
-from __future__ import print_function
-
from collections import OrderedDict
import re
import sys
-from entry import Entry
-import fdt_util
-import tools
-import tout
+from binman.entry import Entry
+from dtoc import fdt_util
+from patman import tools
+from patman import tout
class Entry_section(Entry):
diff --git a/tools/binman/etype/text.py b/tools/binman/etype/text.py
index da1813a638..3577135adb 100644
--- a/tools/binman/etype/text.py
+++ b/tools/binman/etype/text.py
@@ -5,9 +5,9 @@
from collections import OrderedDict
-from entry import Entry, EntryArg
-import fdt_util
-import tools
+from binman.entry import Entry, EntryArg
+from dtoc import fdt_util
+from patman import tools
class Entry_text(Entry):
diff --git a/tools/binman/etype/u_boot.py b/tools/binman/etype/u_boot.py
index 23dd12ce43..ab1019b00c 100644
--- a/tools/binman/etype/u_boot.py
+++ b/tools/binman/etype/u_boot.py
@@ -5,8 +5,8 @@
# Entry-type module for U-Boot binary
#
-from entry import Entry
-from blob import Entry_blob
+from binman.entry import Entry
+from binman.etype.blob import Entry_blob
class Entry_u_boot(Entry_blob):
"""U-Boot flat binary
diff --git a/tools/binman/etype/u_boot_dtb.py b/tools/binman/etype/u_boot_dtb.py
index 6c805a666d..e98350088f 100644
--- a/tools/binman/etype/u_boot_dtb.py
+++ b/tools/binman/etype/u_boot_dtb.py
@@ -5,8 +5,8 @@
# Entry-type module for U-Boot device tree
#
-from entry import Entry
-from blob_dtb import Entry_blob_dtb
+from binman.entry import Entry
+from binman.etype.blob_dtb import Entry_blob_dtb
class Entry_u_boot_dtb(Entry_blob_dtb):
"""U-Boot device tree
diff --git a/tools/binman/etype/u_boot_dtb_with_ucode.py b/tools/binman/etype/u_boot_dtb_with_ucode.py
index 6efd24a9b3..aec145533e 100644
--- a/tools/binman/etype/u_boot_dtb_with_ucode.py
+++ b/tools/binman/etype/u_boot_dtb_with_ucode.py
@@ -5,9 +5,9 @@
# Entry-type module for U-Boot device tree with the microcode removed
#
-from entry import Entry
-from blob_dtb import Entry_blob_dtb
-import tools
+from binman.entry import Entry
+from binman.etype.blob_dtb import Entry_blob_dtb
+from patman import tools
class Entry_u_boot_dtb_with_ucode(Entry_blob_dtb):
"""A U-Boot device tree file, with the microcode removed
@@ -26,7 +26,7 @@ class Entry_u_boot_dtb_with_ucode(Entry_blob_dtb):
def __init__(self, section, etype, node):
# Put this here to allow entry-docs and help to work without libfdt
global state
- import state
+ from binman import state
Entry_blob_dtb.__init__(self, section, etype, node)
self.ucode_data = b''
@@ -44,7 +44,7 @@ class Entry_u_boot_dtb_with_ucode(Entry_blob_dtb):
def ProcessFdt(self, fdt):
# So the module can be loaded without it
- import fdt
+ from dtoc import fdt
# If the section does not need microcode, there is nothing to do
ucode_dest_entry = self.section.FindEntryType(
diff --git a/tools/binman/etype/u_boot_elf.py b/tools/binman/etype/u_boot_elf.py
index f83860dc0a..5f906e520c 100644
--- a/tools/binman/etype/u_boot_elf.py
+++ b/tools/binman/etype/u_boot_elf.py
@@ -5,11 +5,11 @@
# Entry-type module for U-Boot ELF image
#
-from entry import Entry
-from blob import Entry_blob
+from binman.entry import Entry
+from binman.etype.blob import Entry_blob
-import fdt_util
-import tools
+from dtoc import fdt_util
+from patman import tools
class Entry_u_boot_elf(Entry_blob):
"""U-Boot ELF image
diff --git a/tools/binman/etype/u_boot_img.py b/tools/binman/etype/u_boot_img.py
index 1ec0757c7f..50cc71d3ce 100644
--- a/tools/binman/etype/u_boot_img.py
+++ b/tools/binman/etype/u_boot_img.py
@@ -5,8 +5,8 @@
# Entry-type module for U-Boot binary
#
-from entry import Entry
-from blob import Entry_blob
+from binman.entry import Entry
+from binman.etype.blob import Entry_blob
class Entry_u_boot_img(Entry_blob):
"""U-Boot legacy image
diff --git a/tools/binman/etype/u_boot_nodtb.py b/tools/binman/etype/u_boot_nodtb.py
index a4b95a4390..e8c0e1a1d6 100644
--- a/tools/binman/etype/u_boot_nodtb.py
+++ b/tools/binman/etype/u_boot_nodtb.py
@@ -5,8 +5,8 @@
# Entry-type module for 'u-boot-nodtb.bin'
#
-from entry import Entry
-from blob import Entry_blob
+from binman.entry import Entry
+from binman.etype.blob import Entry_blob
class Entry_u_boot_nodtb(Entry_blob):
"""U-Boot flat binary without device tree appended
diff --git a/tools/binman/etype/u_boot_spl.py b/tools/binman/etype/u_boot_spl.py
index 7fedd00021..a6fddbe8f1 100644
--- a/tools/binman/etype/u_boot_spl.py
+++ b/tools/binman/etype/u_boot_spl.py
@@ -5,10 +5,9 @@
# Entry-type module for spl/u-boot-spl.bin
#
-import elf
-
-from entry import Entry
-from blob import Entry_blob
+from binman import elf
+from binman.entry import Entry
+from binman.etype.blob import Entry_blob
class Entry_u_boot_spl(Entry_blob):
"""U-Boot SPL binary
diff --git a/tools/binman/etype/u_boot_spl_bss_pad.py b/tools/binman/etype/u_boot_spl_bss_pad.py
index 66a296a6f8..a6a177a128 100644
--- a/tools/binman/etype/u_boot_spl_bss_pad.py
+++ b/tools/binman/etype/u_boot_spl_bss_pad.py
@@ -7,11 +7,11 @@
# to it will appear to SPL to be at the end of BSS rather than the start.
#
-import command
-import elf
-from entry import Entry
-from blob import Entry_blob
-import tools
+from binman import elf
+from binman.entry import Entry
+from patman import command
+from binman.etype.blob import Entry_blob
+from patman import tools
class Entry_u_boot_spl_bss_pad(Entry_blob):
"""U-Boot SPL binary padded with a BSS region
diff --git a/tools/binman/etype/u_boot_spl_dtb.py b/tools/binman/etype/u_boot_spl_dtb.py
index 1bcd449bf3..a0761eeacd 100644
--- a/tools/binman/etype/u_boot_spl_dtb.py
+++ b/tools/binman/etype/u_boot_spl_dtb.py
@@ -5,8 +5,8 @@
# Entry-type module for U-Boot device tree in SPL (Secondary Program Loader)
#
-from entry import Entry
-from blob_dtb import Entry_blob_dtb
+from binman.entry import Entry
+from binman.etype.blob_dtb import Entry_blob_dtb
class Entry_u_boot_spl_dtb(Entry_blob_dtb):
"""U-Boot SPL device tree
diff --git a/tools/binman/etype/u_boot_spl_elf.py b/tools/binman/etype/u_boot_spl_elf.py
index 24ee77237e..f99f74abab 100644
--- a/tools/binman/etype/u_boot_spl_elf.py
+++ b/tools/binman/etype/u_boot_spl_elf.py
@@ -5,8 +5,8 @@
# Entry-type module for U-Boot SPL ELF image
#
-from entry import Entry
-from blob import Entry_blob
+from binman.entry import Entry
+from binman.etype.blob import Entry_blob
class Entry_u_boot_spl_elf(Entry_blob):
"""U-Boot SPL ELF image
diff --git a/tools/binman/etype/u_boot_spl_nodtb.py b/tools/binman/etype/u_boot_spl_nodtb.py
index 41c17366b1..072b915ff3 100644
--- a/tools/binman/etype/u_boot_spl_nodtb.py
+++ b/tools/binman/etype/u_boot_spl_nodtb.py
@@ -5,8 +5,8 @@
# Entry-type module for 'u-boot-nodtb.bin'
#
-from entry import Entry
-from blob import Entry_blob
+from binman.entry import Entry
+from binman.etype.blob import Entry_blob
class Entry_u_boot_spl_nodtb(Entry_blob):
"""SPL binary without device tree appended
diff --git a/tools/binman/etype/u_boot_spl_with_ucode_ptr.py b/tools/binman/etype/u_boot_spl_with_ucode_ptr.py
index b650cf0146..b1543a5ef3 100644
--- a/tools/binman/etype/u_boot_spl_with_ucode_ptr.py
+++ b/tools/binman/etype/u_boot_spl_with_ucode_ptr.py
@@ -7,11 +7,7 @@
import struct
-import command
-from entry import Entry
-from blob import Entry_blob
-from u_boot_with_ucode_ptr import Entry_u_boot_with_ucode_ptr
-import tools
+from binman.etype.u_boot_with_ucode_ptr import Entry_u_boot_with_ucode_ptr
class Entry_u_boot_spl_with_ucode_ptr(Entry_u_boot_with_ucode_ptr):
"""U-Boot SPL with embedded microcode pointer
diff --git a/tools/binman/etype/u_boot_tpl.py b/tools/binman/etype/u_boot_tpl.py
index 1b69c4f4a7..6562457c9a 100644
--- a/tools/binman/etype/u_boot_tpl.py
+++ b/tools/binman/etype/u_boot_tpl.py
@@ -5,10 +5,9 @@
# Entry-type module for tpl/u-boot-tpl.bin
#
-import elf
-
-from entry import Entry
-from blob import Entry_blob
+from binman import elf
+from binman.entry import Entry
+from binman.etype.blob import Entry_blob
class Entry_u_boot_tpl(Entry_blob):
"""U-Boot TPL binary
diff --git a/tools/binman/etype/u_boot_tpl_dtb.py b/tools/binman/etype/u_boot_tpl_dtb.py
index 81a3970459..890155f271 100644
--- a/tools/binman/etype/u_boot_tpl_dtb.py
+++ b/tools/binman/etype/u_boot_tpl_dtb.py
@@ -5,8 +5,8 @@
# Entry-type module for U-Boot device tree in TPL (Tertiary Program Loader)
#
-from entry import Entry
-from blob_dtb import Entry_blob_dtb
+from binman.entry import Entry
+from binman.etype.blob_dtb import Entry_blob_dtb
class Entry_u_boot_tpl_dtb(Entry_blob_dtb):
"""U-Boot TPL device tree
diff --git a/tools/binman/etype/u_boot_tpl_dtb_with_ucode.py b/tools/binman/etype/u_boot_tpl_dtb_with_ucode.py
index ce19a49e2e..ca1bf85ace 100644
--- a/tools/binman/etype/u_boot_tpl_dtb_with_ucode.py
+++ b/tools/binman/etype/u_boot_tpl_dtb_with_ucode.py
@@ -5,10 +5,7 @@
# Entry-type module for U-Boot device tree with the microcode removed
#
-import control
-from entry import Entry
-from u_boot_dtb_with_ucode import Entry_u_boot_dtb_with_ucode
-import tools
+from binman.etype.u_boot_dtb_with_ucode import Entry_u_boot_dtb_with_ucode
class Entry_u_boot_tpl_dtb_with_ucode(Entry_u_boot_dtb_with_ucode):
"""U-Boot TPL with embedded microcode pointer
diff --git a/tools/binman/etype/u_boot_tpl_elf.py b/tools/binman/etype/u_boot_tpl_elf.py
index 9cc1cc2c45..7fa8e96364 100644
--- a/tools/binman/etype/u_boot_tpl_elf.py
+++ b/tools/binman/etype/u_boot_tpl_elf.py
@@ -5,8 +5,8 @@
# Entry-type module for U-Boot TPL ELF image
#
-from entry import Entry
-from blob import Entry_blob
+from binman.entry import Entry
+from binman.etype.blob import Entry_blob
class Entry_u_boot_tpl_elf(Entry_blob):
"""U-Boot TPL ELF image
diff --git a/tools/binman/etype/u_boot_tpl_with_ucode_ptr.py b/tools/binman/etype/u_boot_tpl_with_ucode_ptr.py
index 8d94dded69..7f7fab7105 100644
--- a/tools/binman/etype/u_boot_tpl_with_ucode_ptr.py
+++ b/tools/binman/etype/u_boot_tpl_with_ucode_ptr.py
@@ -7,11 +7,11 @@
import struct
-import command
-from entry import Entry
-from blob import Entry_blob
-from u_boot_with_ucode_ptr import Entry_u_boot_with_ucode_ptr
-import tools
+from patman import command
+from binman.entry import Entry
+from binman.etype.blob import Entry_blob
+from binman.etype.u_boot_with_ucode_ptr import Entry_u_boot_with_ucode_ptr
+from patman import tools
class Entry_u_boot_tpl_with_ucode_ptr(Entry_u_boot_with_ucode_ptr):
"""U-Boot TPL with embedded microcode pointer
diff --git a/tools/binman/etype/u_boot_ucode.py b/tools/binman/etype/u_boot_ucode.py
index dee8848db7..d9e1a605ef 100644
--- a/tools/binman/etype/u_boot_ucode.py
+++ b/tools/binman/etype/u_boot_ucode.py
@@ -5,9 +5,9 @@
# Entry-type module for a U-Boot binary with an embedded microcode pointer
#
-from entry import Entry
-from blob import Entry_blob
-import tools
+from binman.entry import Entry
+from binman.etype.blob import Entry_blob
+from patman import tools
class Entry_u_boot_ucode(Entry_blob):
"""U-Boot microcode block
diff --git a/tools/binman/etype/u_boot_with_ucode_ptr.py b/tools/binman/etype/u_boot_with_ucode_ptr.py
index 960a5efeb4..06047b654d 100644
--- a/tools/binman/etype/u_boot_with_ucode_ptr.py
+++ b/tools/binman/etype/u_boot_with_ucode_ptr.py
@@ -7,12 +7,12 @@
import struct
-import command
-import elf
-from entry import Entry
-from blob import Entry_blob
-import fdt_util
-import tools
+from binman import elf
+from binman.entry import Entry
+from binman.etype.blob import Entry_blob
+from dtoc import fdt_util
+from patman import tools
+from patman import command
class Entry_u_boot_with_ucode_ptr(Entry_blob):
"""U-Boot with embedded microcode pointer
diff --git a/tools/binman/etype/vblock.py b/tools/binman/etype/vblock.py
index 91fa2f7808..5753de7ec7 100644
--- a/tools/binman/etype/vblock.py
+++ b/tools/binman/etype/vblock.py
@@ -9,10 +9,10 @@
from collections import OrderedDict
import os
-from entry import Entry, EntryArg
+from binman.entry import Entry, EntryArg
-import fdt_util
-import tools
+from dtoc import fdt_util
+from patman import tools
class Entry_vblock(Entry):
"""An entry which contains a Chromium OS verified boot block
diff --git a/tools/binman/etype/x86_reset16.py b/tools/binman/etype/x86_reset16.py
index 54eb814ea3..ad864e5442 100644
--- a/tools/binman/etype/x86_reset16.py
+++ b/tools/binman/etype/x86_reset16.py
@@ -5,8 +5,8 @@
# Entry-type module for the 16-bit x86 reset code for U-Boot
#
-from entry import Entry
-from blob import Entry_blob
+from binman.entry import Entry
+from binman.etype.blob import Entry_blob
class Entry_x86_reset16(Entry_blob):
"""x86 16-bit reset code for U-Boot
diff --git a/tools/binman/etype/x86_reset16_spl.py b/tools/binman/etype/x86_reset16_spl.py
index 699a0c6bcb..9a663f0ae2 100644
--- a/tools/binman/etype/x86_reset16_spl.py
+++ b/tools/binman/etype/x86_reset16_spl.py
@@ -5,8 +5,8 @@
# Entry-type module for the 16-bit x86 reset code for U-Boot
#
-from entry import Entry
-from blob import Entry_blob
+from binman.entry import Entry
+from binman.etype.blob import Entry_blob
class Entry_x86_reset16_spl(Entry_blob):
"""x86 16-bit reset code for U-Boot
diff --git a/tools/binman/etype/x86_reset16_tpl.py b/tools/binman/etype/x86_reset16_tpl.py
index 4eedb8d601..864508f367 100644
--- a/tools/binman/etype/x86_reset16_tpl.py
+++ b/tools/binman/etype/x86_reset16_tpl.py
@@ -5,8 +5,8 @@
# Entry-type module for the 16-bit x86 reset code for U-Boot
#
-from entry import Entry
-from blob import Entry_blob
+from binman.entry import Entry
+from binman.etype.blob import Entry_blob
class Entry_x86_reset16_tpl(Entry_blob):
"""x86 16-bit reset code for U-Boot
diff --git a/tools/binman/etype/x86_start16.py b/tools/binman/etype/x86_start16.py
index 6736b692d5..d8345f6722 100644
--- a/tools/binman/etype/x86_start16.py
+++ b/tools/binman/etype/x86_start16.py
@@ -5,8 +5,8 @@
# Entry-type module for the 16-bit x86 start-up code for U-Boot
#
-from entry import Entry
-from blob import Entry_blob
+from binman.entry import Entry
+from binman.etype.blob import Entry_blob
class Entry_x86_start16(Entry_blob):
"""x86 16-bit start-up code for U-Boot
diff --git a/tools/binman/etype/x86_start16_spl.py b/tools/binman/etype/x86_start16_spl.py
index c8c70639de..ad520d3c6d 100644
--- a/tools/binman/etype/x86_start16_spl.py
+++ b/tools/binman/etype/x86_start16_spl.py
@@ -5,8 +5,8 @@
# Entry-type module for the 16-bit x86 start-up code for U-Boot SPL
#
-from entry import Entry
-from blob import Entry_blob
+from binman.entry import Entry
+from binman.etype.blob import Entry_blob
class Entry_x86_start16_spl(Entry_blob):
"""x86 16-bit start-up code for SPL
diff --git a/tools/binman/etype/x86_start16_tpl.py b/tools/binman/etype/x86_start16_tpl.py
index 5261a8adf0..ccc8727d1d 100644
--- a/tools/binman/etype/x86_start16_tpl.py
+++ b/tools/binman/etype/x86_start16_tpl.py
@@ -5,8 +5,8 @@
# Entry-type module for the 16-bit x86 start-up code for U-Boot TPL
#
-from entry import Entry
-from blob import Entry_blob
+from binman.entry import Entry
+from binman.etype.blob import Entry_blob
class Entry_x86_start16_tpl(Entry_blob):
"""x86 16-bit start-up code for TPL
diff --git a/tools/binman/fdt_test.py b/tools/binman/fdt_test.py
index ac6f910d3c..c491d40e9e 100644
--- a/tools/binman/fdt_test.py
+++ b/tools/binman/fdt_test.py
@@ -9,10 +9,10 @@ import sys
import tempfile
import unittest
-import fdt
-from fdt import FdtScan
-import fdt_util
-import tools
+from dtoc import fdt
+from dtoc import fdt_util
+from dtoc.fdt import FdtScan
+from patman import tools
class TestFdt(unittest.TestCase):
@classmethod
diff --git a/tools/binman/fmap_util.py b/tools/binman/fmap_util.py
index d0f956b622..25fe60a9cc 100644
--- a/tools/binman/fmap_util.py
+++ b/tools/binman/fmap_util.py
@@ -10,7 +10,7 @@ import collections
import struct
import sys
-import tools
+from patman import tools
# constants imported from lib/fmap.h
FMAP_SIGNATURE = b'__FMAP__'
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 872b855444..5e24920088 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -6,8 +6,7 @@
#
# python -m unittest func_test.TestFunctional.testHelp
-from __future__ import print_function
-
+import gzip
import hashlib
from optparse import OptionParser
import os
@@ -17,24 +16,23 @@ import sys
import tempfile
import unittest
-import binman
-import cbfs_util
-import cmdline
-import command
-import control
-import elf
-import elf_test
-import fdt
-from etype import fdtmap
-from etype import image_header
-import fdt_util
-import fmap_util
-import test_util
-import gzip
+from binman import cbfs_util
+from binman import cmdline
+from binman import control
+from binman import elf
+from binman import elf_test
+from binman import fmap_util
+from binman import main
+from binman import state
+from dtoc import fdt
+from dtoc import fdt_util
+from binman.etype import fdtmap
+from binman.etype import image_header
from image import Image
-import state
-import tools
-import tout
+from patman import command
+from patman import test_util
+from patman import tools
+from patman import tout
# Contents of test files, corresponding to different entry types
U_BOOT_DATA = b'1234'
@@ -103,7 +101,7 @@ class TestFunctional(unittest.TestCase):
@classmethod
def setUpClass(cls):
global entry
- import entry
+ from binman import entry
# Handle the case where argv[0] is 'python'
cls._binman_dir = os.path.dirname(os.path.realpath(sys.argv[0]))
@@ -1290,8 +1288,8 @@ class TestFunctional(unittest.TestCase):
with self.assertRaises(ValueError) as e:
self._DoReadFile('057_unknown_contents.dts', True)
self.assertIn("Image '/binman': Internal error: Could not complete "
- "processing of contents: remaining [<_testing.Entry__testing ",
- str(e.exception))
+ "processing of contents: remaining ["
+ "<binman.etype._testing.Entry__testing ", str(e.exception))
def testBadChangeSize(self):
"""Test that trying to change the size of an entry fails"""
@@ -1338,7 +1336,8 @@ class TestFunctional(unittest.TestCase):
with self.assertRaises(ValueError) as e:
self._DoReadFileDtb('061_fdt_update_bad.dts', update_dtb=True)
self.assertIn('Could not complete processing of Fdt: remaining '
- '[<_testing.Entry__testing', str(e.exception))
+ '[<binman.etype._testing.Entry__testing',
+ str(e.exception))
def testEntryArgs(self):
"""Test passing arguments to entries from the command line"""
@@ -1430,14 +1429,14 @@ class TestFunctional(unittest.TestCase):
def testEntryDocs(self):
"""Test for creation of entry documentation"""
with test_util.capture_sys_output() as (stdout, stderr):
- control.WriteEntryDocs(binman.GetEntryModules())
+ control.WriteEntryDocs(main.GetEntryModules())
self.assertTrue(len(stdout.getvalue()) > 0)
def testEntryDocsMissing(self):
"""Test handling of missing entry documentation"""
with self.assertRaises(ValueError) as e:
with test_util.capture_sys_output() as (stdout, stderr):
- control.WriteEntryDocs(binman.GetEntryModules(), 'u_boot')
+ control.WriteEntryDocs(main.GetEntryModules(), 'u_boot')
self.assertIn('Documentation is missing for modules: u_boot',
str(e.exception))
diff --git a/tools/binman/image.py b/tools/binman/image.py
index 2beab7fd4d..523b274c31 100644
--- a/tools/binman/image.py
+++ b/tools/binman/image.py
@@ -5,8 +5,6 @@
# Class for an image, the output of binman
#
-from __future__ import print_function
-
from collections import OrderedDict
import fnmatch
from operator import attrgetter
@@ -14,14 +12,14 @@ import os
import re
import sys
-from entry import Entry
-from etype import fdtmap
-from etype import image_header
-from etype import section
-import fdt
-import fdt_util
-import tools
-import tout
+from binman.entry import Entry
+from binman.etype import fdtmap
+from binman.etype import image_header
+from binman.etype import section
+from dtoc import fdt
+from dtoc import fdt_util
+from patman import tools
+from patman import tout
class Image(section.Entry_section):
"""A Image, representing an output from binman
diff --git a/tools/binman/image_test.py b/tools/binman/image_test.py
index 10f85d1081..f85c3c51c0 100644
--- a/tools/binman/image_test.py
+++ b/tools/binman/image_test.py
@@ -7,7 +7,7 @@
import unittest
from image import Image
-from test_util import capture_sys_output
+from patman.test_util import capture_sys_output
class TestImage(unittest.TestCase):
def testInvalidFormat(self):
diff --git a/tools/binman/binman.py b/tools/binman/main.py
index 9e6fd72117..efa7fa8386 100755
--- a/tools/binman/binman.py
+++ b/tools/binman/main.py
@@ -9,11 +9,8 @@
"""See README for more information"""
-from __future__ import print_function
-
from distutils.sysconfig import get_python_lib
import glob
-import multiprocessing
import os
import site
import sys
@@ -23,8 +20,9 @@ import unittest
# Bring in the patman and dtoc libraries (but don't override the first path
# in PYTHONPATH)
our_path = os.path.dirname(os.path.realpath(__file__))
-for dirname in ['../patman', '../dtoc', '..', '../concurrencytest']:
- sys.path.insert(2, os.path.join(our_path, dirname))
+sys.path.insert(2, os.path.join(our_path, '..'))
+
+from patman import test_util
# Bring in the libfdt module
sys.path.insert(2, 'scripts/dtc/pylibfdt')
@@ -37,15 +35,9 @@ sys.path.insert(2, os.path.join(our_path,
# that is not available in a virtualenv.
sys.path.append(get_python_lib())
-import cmdline
-import command
-use_concurrent = True
-try:
- from concurrencytest import ConcurrentTestSuite, fork_for_tests
-except:
- use_concurrent = False
-import control
-import test_util
+from binman import cmdline
+from binman import control
+from patman import test_util
def RunTests(debug, verbosity, processes, test_preserve_dirs, args, toolpath):
"""Run the functional tests and any embedded doctests
@@ -63,83 +55,27 @@ def RunTests(debug, verbosity, processes, test_preserve_dirs, args, toolpath):
name to execute (as in 'binman test testSections', for example)
toolpath: List of paths to use for tools
"""
- import cbfs_util_test
- import elf_test
- import entry_test
- import fdt_test
- import ftest
- import image_test
- import test
+ from binman import cbfs_util_test
+ from binman import elf_test
+ from binman import entry_test
+ from binman import fdt_test
+ from binman import ftest
+ from binman import image_test
+ from binman import test
import doctest
result = unittest.TestResult()
- for module in []:
- suite = doctest.DocTestSuite(module)
- suite.run(result)
-
- sys.argv = [sys.argv[0]]
- if debug:
- sys.argv.append('-D')
- if verbosity:
- sys.argv.append('-v%d' % verbosity)
- if toolpath:
- for path in toolpath:
- sys.argv += ['--toolpath', path]
+ test_name = args and args[0] or None
# Run the entry tests first ,since these need to be the first to import the
# 'entry' module.
- test_name = args and args[0] or None
- suite = unittest.TestSuite()
- loader = unittest.TestLoader()
- for module in (entry_test.TestEntry, ftest.TestFunctional, fdt_test.TestFdt,
- elf_test.TestElf, image_test.TestImage,
- cbfs_util_test.TestCbfs):
- # Test the test module about our arguments, if it is interested
- if hasattr(module, 'setup_test_args'):
- setup_test_args = getattr(module, 'setup_test_args')
- setup_test_args(preserve_indir=test_preserve_dirs,
- preserve_outdirs=test_preserve_dirs and test_name is not None,
- toolpath=toolpath, verbosity=verbosity)
- if test_name:
- try:
- suite.addTests(loader.loadTestsFromName(test_name, module))
- except AttributeError:
- continue
- else:
- suite.addTests(loader.loadTestsFromTestCase(module))
- if use_concurrent and processes != 1:
- concurrent_suite = ConcurrentTestSuite(suite,
- fork_for_tests(processes or multiprocessing.cpu_count()))
- concurrent_suite.run(result)
- else:
- suite.run(result)
-
- # Remove errors which just indicate a missing test. Since Python v3.5 If an
- # ImportError or AttributeError occurs while traversing name then a
- # synthetic test that raises that error when run will be returned. These
- # errors are included in the errors accumulated by result.errors.
- if test_name:
- errors = []
- for test, err in result.errors:
- if ("has no attribute '%s'" % test_name) not in err:
- errors.append((test, err))
- result.testsRun -= 1
- result.errors = errors
-
- print(result)
- for test, err in result.errors:
- print(test.id(), err)
- for test, err in result.failures:
- print(err, result.failures)
- if result.skipped:
- print('%d binman test%s SKIPPED:' %
- (len(result.skipped), 's' if len(result.skipped) > 1 else ''))
- for skip_info in result.skipped:
- print('%s: %s' % (skip_info[0], skip_info[1]))
- if result.errors or result.failures:
- print('binman tests FAILED')
- return 1
- return 0
+ test_util.RunTestSuites(
+ result, debug, verbosity, test_preserve_dirs, processes, test_name,
+ toolpath,
+ [entry_test.TestEntry, ftest.TestFunctional, fdt_test.TestFdt,
+ elf_test.TestElf, image_test.TestImage, cbfs_util_test.TestCbfs])
+
+ return test_util.ReportResult('binman', test_name, result)
def GetEntryModules(include_testing=True):
"""Get a set of entry class implementations
@@ -157,8 +93,8 @@ def RunTestCoverage():
glob_list = GetEntryModules(False)
all_set = set([os.path.splitext(os.path.basename(item))[0]
for item in glob_list if '_testing' not in item])
- test_util.RunTestCoverage('tools/binman/binman.py', None,
- ['*test*', '*binman.py', 'tools/patman/*', 'tools/dtoc/*'],
+ test_util.RunTestCoverage('tools/binman/binman', None,
+ ['*test*', '*main.py', 'tools/patman/*', 'tools/dtoc/*'],
args.build_dir, all_set)
def RunBinman(args):
diff --git a/tools/binman/state.py b/tools/binman/state.py
index d704ed2c7c..36bc513535 100644
--- a/tools/binman/state.py
+++ b/tools/binman/state.py
@@ -8,10 +8,10 @@
import hashlib
import re
-import fdt
+from dtoc import fdt
import os
-import tools
-import tout
+from patman import tools
+from patman import tout
# Records the device-tree files known to binman, keyed by entry type (e.g.
# 'u-boot-spl-dtb'). These are the output FDT files, which can be updated by
@@ -167,8 +167,8 @@ def Prepare(images, dtb):
global output_fdt_info, main_dtb, fdt_path_prefix
# Import these here in case libfdt.py is not available, in which case
# the above help option still works.
- import fdt
- import fdt_util
+ from dtoc import fdt
+ from dtoc import fdt_util
# If we are updating the DTBs we need to put these updated versions
# where Entry_blob_dtb can find them. We can ignore 'u-boot.dtb'