aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorTom Rini2020-04-28 09:52:01 -0400
committerTom Rini2020-04-28 09:52:01 -0400
commit545c747447706d9601cc5c65a85ec44e688bfe08 (patch)
tree398a874161673df9656e271a6dbb4b127a45f725 /tools
parent08977f873f4034307796173784fc17a11188a0cb (diff)
parentc1f39edc62adc81775e750957aa557bcf994e607 (diff)
Merge tag 'dm-pull-27apr20' of git://git.denx.de/u-boot-dm
Move Python tools to use absolute paths Minor buildman fixes for new features Make libfdt code more similar to upsteam
Diffstat (limited to 'tools')
-rw-r--r--tools/Makefile13
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
-rw-r--r--tools/buildman/README3
-rw-r--r--tools/buildman/builder.py17
-rw-r--r--tools/buildman/builderthread.py37
l---------tools/buildman/buildman2
-rw-r--r--tools/buildman/cmdline.py3
-rw-r--r--tools/buildman/control.py26
-rw-r--r--tools/buildman/func_test.py35
-rwxr-xr-xtools/buildman/main.py (renamed from tools/buildman/buildman.py)27
-rw-r--r--tools/buildman/test.py25
-rw-r--r--tools/buildman/toolchain.py8
-rw-r--r--tools/dtoc/dtb_platdata.py6
l---------tools/dtoc/dtoc2
-rw-r--r--tools/dtoc/fdt.py4
-rw-r--r--tools/dtoc/fdt_util.py4
-rwxr-xr-xtools/dtoc/main.py (renamed from tools/dtoc/dtoc.py)10
-rwxr-xr-xtools/dtoc/test_dtoc.py12
-rwxr-xr-xtools/dtoc/test_fdt.py17
-rw-r--r--tools/fdtgrep.c1
-rwxr-xr-xtools/genboardscfg.py3
-rw-r--r--tools/image-host.c1
-rw-r--r--tools/libfdt/fdt_ro.c2
-rwxr-xr-xtools/moveconfig.py8
-rw-r--r--tools/patman/checkpatch.py8
-rw-r--r--tools/patman/command.py5
-rw-r--r--tools/patman/func_test.py15
-rw-r--r--tools/patman/get_maintainer.py5
-rw-r--r--tools/patman/gitutil.py12
-rwxr-xr-xtools/patman/main.py (renamed from tools/patman/patman.py)27
-rw-r--r--tools/patman/patchstream.py8
l---------tools/patman/patman2
-rw-r--r--tools/patman/project.py2
-rw-r--r--tools/patman/series.py12
-rw-r--r--tools/patman/settings.py13
-rw-r--r--tools/patman/terminal.py2
-rw-r--r--tools/patman/test.py10
-rw-r--r--tools/patman/test_util.py125
-rw-r--r--tools/patman/tools.py6
-rw-r--r--tools/patman/tout.py4
-rwxr-xr-xtools/rmboard.py7
111 files changed, 565 insertions, 562 deletions
diff --git a/tools/Makefile b/tools/Makefile
index c2b26340047..1f9144f0288 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -63,14 +63,8 @@ FIT_CIPHER_OBJS-$(CONFIG_FIT_CIPHER) := common/image-cipher.o
# The following files are synced with upstream DTC.
# Use synced versions from scripts/dtc/libfdt/.
-LIBFDT_SRCS_SYNCED := fdt.c fdt_wip.c fdt_sw.c fdt_rw.c \
- fdt_strerror.c fdt_empty_tree.c fdt_addresses.c fdt_overlay.c
-# The following files are locally modified for U-Boot (unfotunately).
-# Use U-Boot own versions from lib/libfdt/.
-LIBFDT_SRCS_UNSYNCED := fdt_ro.c fdt_region.c
-
-LIBFDT_OBJS := $(addprefix libfdt/, $(patsubst %.c, %.o, $(LIBFDT_SRCS_SYNCED))) \
- $(addprefix lib/libfdt/, $(patsubst %.c, %.o, $(LIBFDT_SRCS_UNSYNCED)))
+LIBFDT_OBJS := $(addprefix libfdt/, fdt.o fdt_ro.o fdt_wip.o fdt_sw.o fdt_rw.o \
+ fdt_strerror.o fdt_empty_tree.o fdt_addresses.o fdt_overlay.o)
RSA_OBJS-$(CONFIG_FIT_SIGNATURE) := $(addprefix lib/rsa/, \
rsa-sign.o rsa-verify.o rsa-checksum.o \
@@ -87,6 +81,7 @@ dumpimage-mkimage-objs := aisimage.o \
$(FIT_OBJS-y) \
$(FIT_SIG_OBJS-y) \
$(FIT_CIPHER_OBJS-y) \
+ common/fdt_region.o \
common/bootm.o \
lib/crc32.o \
default_image.o \
@@ -211,7 +206,7 @@ hostprogs-$(CONFIG_STATIC_RELA) += relocate-rela
hostprogs-$(CONFIG_RISCV) += prelink-riscv
hostprogs-y += fdtgrep
-fdtgrep-objs += $(LIBFDT_OBJS) fdtgrep.o
+fdtgrep-objs += $(LIBFDT_OBJS) common/fdt_region.o fdtgrep.o
ifneq ($(TOOLS_ONLY),y)
hostprogs-y += spl_size_limit
diff --git a/tools/binman/binman b/tools/binman/binman
index 979b7e4d4b8..11a5d8e18ab 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 99d77878c9a..39973371b93 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 ddc2e09e358..2c62c8a0f81 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 68ad5fc2c0c..dc1dd2a7dcf 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 de1ce73f2ae..f88031c2bf9 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 ac26fd51e41..37e1b423cf6 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 b6f1b2c93fb..90ffd276177 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 277e10b5859..80802f33de6 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 e69de29bb2d..00000000000
--- a/tools/binman/etype/__init__.py
+++ /dev/null
diff --git a/tools/binman/etype/_testing.py b/tools/binman/etype/_testing.py
index 25a6206bf33..ed718eed145 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 d34c7b51bff..ede7a7a68cf 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 b2afa064c11..6c069437633 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 344112bc420..3b4593f071a 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 35b78370b2e..e9aed8310c7 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 261f8657a62..0dbe14b342a 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 5dc08b8289a..aa8807990b7 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 3473a2b1efd..10ab585f0ed 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 623b7f4e95e..860410ed6e5 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 835ba5012e5..a43fac38de2 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 a94c0fca9d5..dd105997179 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 b9327dd799b..176bdeb29b3 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 fa6f7793c64..5e6edbe4dfd 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 b6477931d6c..d4d7a26901d 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 2a34a05f955..ea482a61254 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 148b206c3c6..df118a68f2d 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 00a78e70832..7db3d96b432 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 bb1de73e414..51b4e7e1ac3 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 3d6900d1fba..b3683e476a0 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 813a81f2e66..0f196f0f1c1 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 36aadc210c4..6a96f6be552 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 c932ec52225..41c9c6b9203 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 4dbc99a04f2..854a4dda615 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 045db589d17..a1059f787e6 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 d93dd196341..4d465ad0173 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 40982c86656..04cd72f3dc1 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 59fedd2b54b..cefd425a5dc 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 89b7bf67fa6..91b8e0c1100 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 da1813a638e..3577135adbe 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 23dd12ce435..ab1019b00c7 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 6c805a666da..e98350088f5 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 6efd24a9b33..aec145533eb 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 f83860dc0a8..5f906e520cf 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 1ec0757c7f8..50cc71d3ce2 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 a4b95a4390a..e8c0e1a1d6c 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 7fedd000212..a6fddbe8f14 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 66a296a6f85..a6a177a1287 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 1bcd449bf3a..a0761eeacd6 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 24ee77237ed..f99f74abab2 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 41c17366b1d..072b915ff3a 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 b650cf0146c..b1543a5ef32 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 1b69c4f4a74..6562457c9a6 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 81a39704598..890155f271f 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 ce19a49e2e6..ca1bf85ace7 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 9cc1cc2c450..7fa8e963640 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 8d94dded694..7f7fab71051 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 dee8848db7a..d9e1a605efa 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 960a5efeb41..06047b654df 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 91fa2f7808f..5753de7ec7a 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 54eb814ea3d..ad864e54429 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 699a0c6bcbe..9a663f0ae23 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 4eedb8d601d..864508f3672 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 6736b692d51..d8345f67221 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 c8c70639de0..ad520d3c6d9 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 5261a8adf04..ccc8727d1d4 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 ac6f910d3c0..c491d40e9ee 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 d0f956b6221..25fe60a9cc3 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 872b8554440..5e24920088c 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 2beab7fd4d2..523b274c319 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 10f85d1081f..f85c3c51c0f 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 9e6fd721175..efa7fa8386f 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 d704ed2c7cd..36bc5135354 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'
diff --git a/tools/buildman/README b/tools/buildman/README
index f3a0dc7288d..b2f983c715d 100644
--- a/tools/buildman/README
+++ b/tools/buildman/README
@@ -1091,7 +1091,8 @@ the -w option, for example:
buildman -o /tmp/build --board sandbox -w
-This will write the full build into /tmp/build including object files.
+This will write the full build into /tmp/build including object files. You must
+specify the output directory with -o when using -w.
Other options
diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index 30ebe1d820a..f8e71de4272 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -17,12 +17,12 @@ import sys
import threading
import time
-import builderthread
-import command
-import gitutil
-import terminal
-from terminal import Print
-import toolchain
+from buildman import builderthread
+from buildman import toolchain
+from patman import command
+from patman import gitutil
+from patman import terminal
+from patman.terminal import Print
"""
Theory of Operation
@@ -479,6 +479,9 @@ class Builder:
Args:
commit_upto: Commit number to use (0..self.count-1)
"""
+ if self.work_in_output:
+ return self._working_dir
+
commit_dir = None
if self.commits:
commit = self.commits[commit_upto]
@@ -502,6 +505,8 @@ class Builder:
target: Target name
"""
output_dir = self._GetOutputDir(commit_upto)
+ if self.work_in_output:
+ return output_dir
return os.path.join(output_dir, target)
def GetDoneFile(self, commit_upto, target):
diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py
index fc6e1ab25da..48fcd6cf7e2 100644
--- a/tools/buildman/builderthread.py
+++ b/tools/buildman/builderthread.py
@@ -9,8 +9,8 @@ import shutil
import sys
import threading
-import command
-import gitutil
+from patman import command
+from patman import gitutil
RETURN_CODE_RETRY = -1
@@ -280,8 +280,6 @@ class BuilderThread(threading.Thread):
work_in_output: Use the output directory as the work directory and
don't write to a separate output directory.
"""
- if work_in_output:
- return
# Fatal error
if result.return_code < 0:
return
@@ -333,7 +331,7 @@ class BuilderThread(threading.Thread):
# Write out the image and function size information and an objdump
env = result.toolchain.MakeEnvironment(self.builder.full_path)
- with open(os.path.join(build_dir, 'env'), 'w') as fd:
+ with open(os.path.join(build_dir, 'out-env'), 'w') as fd:
for var in sorted(env.keys()):
print('%s="%s"' % (var, env[var]), file=fd)
lines = []
@@ -379,7 +377,8 @@ class BuilderThread(threading.Thread):
capture_stderr=True, cwd=result.out_dir,
raise_on_error=False, env=env)
ubootenv = os.path.join(result.out_dir, 'uboot.env')
- self.CopyFiles(result.out_dir, build_dir, '', ['uboot.env'])
+ if not work_in_output:
+ self.CopyFiles(result.out_dir, build_dir, '', ['uboot.env'])
# Write out the image sizes file. This is similar to the output
# of binutil's 'size' utility, but it omits the header line and
@@ -391,17 +390,21 @@ class BuilderThread(threading.Thread):
with open(sizes, 'w') as fd:
print('\n'.join(lines), file=fd)
- # Write out the configuration files, with a special case for SPL
- for dirname in ['', 'spl', 'tpl']:
- self.CopyFiles(result.out_dir, build_dir, dirname, ['u-boot.cfg',
- 'spl/u-boot-spl.cfg', 'tpl/u-boot-tpl.cfg', '.config',
- 'include/autoconf.mk', 'include/generated/autoconf.h'])
-
- # Now write the actual build output
- if keep_outputs:
- self.CopyFiles(result.out_dir, build_dir, '', ['u-boot*', '*.bin',
- '*.map', '*.img', 'MLO', 'SPL', 'include/autoconf.mk',
- 'spl/u-boot-spl*'])
+ if not work_in_output:
+ # Write out the configuration files, with a special case for SPL
+ for dirname in ['', 'spl', 'tpl']:
+ self.CopyFiles(
+ result.out_dir, build_dir, dirname,
+ ['u-boot.cfg', 'spl/u-boot-spl.cfg', 'tpl/u-boot-tpl.cfg',
+ '.config', 'include/autoconf.mk',
+ 'include/generated/autoconf.h'])
+
+ # Now write the actual build output
+ if keep_outputs:
+ self.CopyFiles(
+ result.out_dir, build_dir, '',
+ ['u-boot*', '*.bin', '*.map', '*.img', 'MLO', 'SPL',
+ 'include/autoconf.mk', 'spl/u-boot-spl*'])
def CopyFiles(self, out_dir, build_dir, dirname, patterns):
"""Copy files from the build directory to the output.
diff --git a/tools/buildman/buildman b/tools/buildman/buildman
index e4fba2d4b03..11a5d8e18ab 120000
--- a/tools/buildman/buildman
+++ b/tools/buildman/buildman
@@ -1 +1 @@
-buildman.py \ No newline at end of file
+main.py \ No newline at end of file
diff --git a/tools/buildman/cmdline.py b/tools/buildman/cmdline.py
index 1377b9d2bec..680c072d662 100644
--- a/tools/buildman/cmdline.py
+++ b/tools/buildman/cmdline.py
@@ -76,8 +76,7 @@ def ParseArgs():
default=False, help="Do a dry run (describe actions, but do nothing)")
parser.add_option('-N', '--no-subdirs', action='store_true', dest='no_subdirs',
default=False, help="Don't create subdirectories when building current source for a single board")
- parser.add_option('-o', '--output-dir', type='string',
- dest='output_dir', default='..',
+ parser.add_option('-o', '--output-dir', type='string', dest='output_dir',
help='Directory where all builds happen and buildman has its workspace (default is ../)')
parser.add_option('-O', '--override-toolchain', type='string',
help="Override host toochain to use for sandbox (e.g. 'clang-7')")
diff --git a/tools/buildman/control.py b/tools/buildman/control.py
index 30c030fd16e..071c2613ecf 100644
--- a/tools/buildman/control.py
+++ b/tools/buildman/control.py
@@ -5,18 +5,18 @@
import multiprocessing
import os
import shutil
+import subprocess
import sys
-import board
-import bsettings
-from builder import Builder
-import gitutil
-import patchstream
-import terminal
-from terminal import Print
-import toolchain
-import command
-import subprocess
+from buildman import board
+from buildman import bsettings
+from buildman import toolchain
+from buildman.builder import Builder
+from patman import command
+from patman import gitutil
+from patman import patchstream
+from patman import terminal
+from patman.terminal import Print
def GetPlural(count):
"""Returns a plural 's' if count is not 1"""
@@ -175,6 +175,10 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None,
if options.incremental:
print(col.Color(col.RED,
'Warning: -I has been removed. See documentation'))
+ if not options.output_dir:
+ if options.work_in_output:
+ sys.exit(col.Color(col.RED, '-w requires that you specify -o'))
+ options.output_dir = '..'
# Work out what subset of the boards we are building
if not boards:
@@ -207,7 +211,7 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None,
sys.exit(col.Color(col.RED, 'No matching boards found'))
if options.print_prefix:
- err = ShowToolchainInfo(boards, toolchains)
+ err = ShowToolchainPrefix(boards, toolchains)
if err:
sys.exit(col.Color(col.RED, err))
return 0
diff --git a/tools/buildman/func_test.py b/tools/buildman/func_test.py
index 1fbc6f6b003..418677f9ccb 100644
--- a/tools/buildman/func_test.py
+++ b/tools/buildman/func_test.py
@@ -8,15 +8,15 @@ import sys
import tempfile
import unittest
-import board
-import bsettings
-import cmdline
-import command
-import control
-import gitutil
-import terminal
-import toolchain
-import tools
+from buildman import board
+from buildman import bsettings
+from buildman import cmdline
+from buildman import control
+from buildman import toolchain
+from patman import command
+from patman import gitutil
+from patman import terminal
+from patman import tools
settings_data = '''
# Buildman settings file
@@ -546,6 +546,13 @@ class TestFunctional(unittest.TestCase):
self.assertEqual(self._builder.count, self._total_builds)
self.assertEqual(self._builder.fail, 0)
+ def testEnvironment(self):
+ """Test that the done and environment files are written to out-env"""
+ self._RunControl('-o', self._output_dir)
+ board0_dir = os.path.join(self._output_dir, 'current', 'board0')
+ self.assertTrue(os.path.exists(os.path.join(board0_dir, 'done')))
+ self.assertTrue(os.path.exists(os.path.join(board0_dir, 'out-env')))
+
def testWorkInOutput(self):
"""Test the -w option which should write directly to the output dir"""
board_list = board.Boards()
@@ -554,6 +561,10 @@ class TestFunctional(unittest.TestCase):
boards=board_list)
self.assertTrue(
os.path.exists(os.path.join(self._output_dir, 'u-boot')))
+ self.assertTrue(
+ os.path.exists(os.path.join(self._output_dir, 'done')))
+ self.assertTrue(
+ os.path.exists(os.path.join(self._output_dir, 'out-env')))
def testWorkInOutputFail(self):
"""Test the -w option failures"""
@@ -569,3 +580,9 @@ class TestFunctional(unittest.TestCase):
self._RunControl('-b', self._test_branch, '-o', self._output_dir,
'-w', clean_dir=False, boards=board_list)
self.assertIn("single commit", str(e.exception))
+
+ board_list = board.Boards()
+ board_list.AddBoard(board.Board(*boards[0]))
+ with self.assertRaises(SystemExit) as e:
+ self._RunControl('-w', clean_dir=False)
+ self.assertIn("specify -o", str(e.exception))
diff --git a/tools/buildman/buildman.py b/tools/buildman/main.py
index 30a8690f935..2b714739a20 100755
--- a/tools/buildman/buildman.py
+++ b/tools/buildman/main.py
@@ -6,8 +6,7 @@
"""See README for more information"""
-from __future__ import print_function
-
+import doctest
import multiprocessing
import os
import re
@@ -16,20 +15,18 @@ import unittest
# Bring in the patman libraries
our_path = os.path.dirname(os.path.realpath(__file__))
-sys.path.insert(1, os.path.join(our_path, '../patman'))
+sys.path.insert(1, os.path.join(our_path, '..'))
# Our modules
-import board
-import bsettings
-import builder
-import checkpatch
-import cmdline
-import control
-import doctest
-import gitutil
-import patchstream
-import terminal
-import toolchain
+from buildman import board
+from buildman import bsettings
+from buildman import builder
+from buildman import cmdline
+from buildman import control
+from buildman import toolchain
+from patman import patchstream
+from patman import gitutil
+from patman import terminal
def RunTests(skip_net_tests):
import func_test
@@ -37,7 +34,7 @@ def RunTests(skip_net_tests):
import doctest
result = unittest.TestResult()
- for module in ['toolchain', 'gitutil']:
+ for module in ['buildman.toolchain', 'patman.gitutil']:
suite = doctest.DocTestSuite(module)
suite.run(result)
diff --git a/tools/buildman/test.py b/tools/buildman/test.py
index d32b22653fb..40811ba9f9e 100644
--- a/tools/buildman/test.py
+++ b/tools/buildman/test.py
@@ -11,18 +11,17 @@ import unittest
# Bring in the patman libraries
our_path = os.path.dirname(os.path.realpath(__file__))
-sys.path.append(os.path.join(our_path, '../patman'))
-
-import board
-import bsettings
-import builder
-import control
-import command
-import commit
-import terminal
-import test_util
-import toolchain
-import tools
+
+from buildman import board
+from buildman import bsettings
+from buildman import builder
+from buildman import control
+from buildman import toolchain
+from patman import commit
+from patman import command
+from patman import terminal
+from patman import test_util
+from patman import tools
use_network = True
@@ -583,7 +582,7 @@ class TestBuild(unittest.TestCase):
url = self.toolchains.LocateArchUrl('arm')
self.assertRegexpMatches(url, 'https://www.kernel.org/pub/tools/'
'crosstool/files/bin/x86_64/.*/'
- 'x86_64-gcc-.*-nolibc_arm-.*linux-gnueabi.tar.xz')
+ 'x86_64-gcc-.*-nolibc[-_]arm-.*linux-gnueabi.tar.xz')
def testGetEnvArgs(self):
"""Test the GetEnvArgs() function"""
diff --git a/tools/buildman/toolchain.py b/tools/buildman/toolchain.py
index 4456a805c74..acb5a29c8fb 100644
--- a/tools/buildman/toolchain.py
+++ b/tools/buildman/toolchain.py
@@ -10,10 +10,10 @@ import sys
import tempfile
import urllib.request, urllib.error, urllib.parse
-import bsettings
-import command
-import terminal
-import tools
+from buildman import bsettings
+from patman import command
+from patman import terminal
+from patman import tools
(PRIORITY_FULL_PREFIX, PRIORITY_PREFIX_GCC, PRIORITY_PREFIX_GCC_PATH,
PRIORITY_CALC) = list(range(4))
diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py
index 90a9e1a6269..ecfe0624d10 100644
--- a/tools/dtoc/dtb_platdata.py
+++ b/tools/dtoc/dtb_platdata.py
@@ -15,9 +15,9 @@ import collections
import copy
import sys
-import fdt
-import fdt_util
-import tools
+from dtoc import fdt
+from dtoc import fdt_util
+from patman import tools
# When we see these properties we ignore them - i.e. do not create a structure member
PROP_IGNORE_LIST = [
diff --git a/tools/dtoc/dtoc b/tools/dtoc/dtoc
index 896ca44e62f..11a5d8e18ab 120000
--- a/tools/dtoc/dtoc
+++ b/tools/dtoc/dtoc
@@ -1 +1 @@
-dtoc.py \ No newline at end of file
+main.py \ No newline at end of file
diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py
index 1b7b730359a..188490b728f 100644
--- a/tools/dtoc/fdt.py
+++ b/tools/dtoc/fdt.py
@@ -8,10 +8,10 @@
import struct
import sys
-import fdt_util
+from dtoc import fdt_util
import libfdt
from libfdt import QUIET_NOTFOUND
-import tools
+from patman import tools
# This deals with a device tree, presenting it as an assortment of Node and
# Prop objects, representing nodes and properties, respectively. This file
diff --git a/tools/dtoc/fdt_util.py b/tools/dtoc/fdt_util.py
index b105faec749..b0407937723 100644
--- a/tools/dtoc/fdt_util.py
+++ b/tools/dtoc/fdt_util.py
@@ -13,8 +13,8 @@ import struct
import sys
import tempfile
-import command
-import tools
+from patman import command
+from patman import tools
def fdt32_to_cpu(val):
"""Convert a device tree cell to an integer
diff --git a/tools/dtoc/dtoc.py b/tools/dtoc/main.py
index f31cba900e5..b94d9c301f4 100755
--- a/tools/dtoc/dtoc.py
+++ b/tools/dtoc/main.py
@@ -25,8 +25,6 @@ options. For more information about the use of this options and tool please
see doc/driver-model/of-plat.rst
"""
-from __future__ import print_function
-
from optparse import OptionParser
import os
import sys
@@ -34,15 +32,15 @@ import unittest
# Bring in the patman libraries
our_path = os.path.dirname(os.path.realpath(__file__))
-sys.path.append(os.path.join(our_path, '../patman'))
+sys.path.append(os.path.join(our_path, '..'))
# Bring in the libfdt module
sys.path.insert(0, 'scripts/dtc/pylibfdt')
sys.path.insert(0, os.path.join(our_path,
'../../build-sandbox_spl/scripts/dtc/pylibfdt'))
-import dtb_platdata
-import test_util
+from dtoc import dtb_platdata
+from patman import test_util
def run_tests(args):
"""Run all the test we have for dtoc
@@ -79,7 +77,7 @@ def run_tests(args):
def RunTestCoverage():
"""Run the tests and check that we get 100% coverage"""
sys.argv = [sys.argv[0]]
- test_util.RunTestCoverage('tools/dtoc/dtoc.py', '/dtoc.py',
+ test_util.RunTestCoverage('tools/dtoc/dtoc', '/main.py',
['tools/patman/*.py', '*/fdt*', '*test*'], options.build_dir)
diff --git a/tools/dtoc/test_dtoc.py b/tools/dtoc/test_dtoc.py
index d733b706558..8498e8303c2 100755
--- a/tools/dtoc/test_dtoc.py
+++ b/tools/dtoc/test_dtoc.py
@@ -9,22 +9,20 @@ This includes unit tests for some functions and functional tests for the dtoc
tool.
"""
-from __future__ import print_function
-
import collections
import os
import struct
import unittest
-import dtb_platdata
+from dtoc import dtb_platdata
from dtb_platdata import conv_name_to_c
from dtb_platdata import get_compat_name
from dtb_platdata import get_value
from dtb_platdata import tab_to
-import fdt
-import fdt_util
-import test_util
-import tools
+from dtoc import fdt
+from dtoc import fdt_util
+from patman import test_util
+from patman import tools
our_path = os.path.dirname(os.path.realpath(__file__))
diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py
index 3316757e61e..375e906424c 100755
--- a/tools/dtoc/test_fdt.py
+++ b/tools/dtoc/test_fdt.py
@@ -4,8 +4,6 @@
# Written by Simon Glass <sjg@chromium.org>
#
-from __future__ import print_function
-
from optparse import OptionParser
import glob
import os
@@ -16,17 +14,16 @@ import unittest
# Bring in the patman libraries
our_path = os.path.dirname(os.path.realpath(__file__))
-for dirname in ['../patman', '..']:
- sys.path.insert(0, os.path.join(our_path, dirname))
+sys.path.insert(1, os.path.join(our_path, '..'))
-import command
-import fdt
+from dtoc import fdt
+from dtoc import fdt_util
+from dtoc.fdt_util import fdt32_to_cpu
from fdt import TYPE_BYTE, TYPE_INT, TYPE_STRING, TYPE_BOOL, BytesToValue
-import fdt_util
-from fdt_util import fdt32_to_cpu
import libfdt
-import test_util
-import tools
+from patman import command
+from patman import test_util
+from patman import tools
def _GetPropertyValue(dtb, node, prop_name):
"""Low-level function to get the property value based on its offset
diff --git a/tools/fdtgrep.c b/tools/fdtgrep.c
index 2a8058f57fa..7e168a1e6be 100644
--- a/tools/fdtgrep.c
+++ b/tools/fdtgrep.c
@@ -17,6 +17,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <fdt_region.h>
#include "fdt_host.h"
#include "libfdt_internal.h"
diff --git a/tools/genboardscfg.py b/tools/genboardscfg.py
index 4f6382bc7ca..4ee7aa1f891 100755
--- a/tools/genboardscfg.py
+++ b/tools/genboardscfg.py
@@ -22,8 +22,7 @@ import sys
import tempfile
import time
-sys.path.insert(1, os.path.join(os.path.dirname(__file__), 'buildman'))
-import kconfiglib
+from buildman import kconfiglib
### constant variables ###
OUTPUT_FILE = 'boards.cfg'
diff --git a/tools/image-host.c b/tools/image-host.c
index 5bb68965e76..9a83b7f6755 100644
--- a/tools/image-host.c
+++ b/tools/image-host.c
@@ -10,6 +10,7 @@
#include "mkimage.h"
#include <bootm.h>
+#include <fdt_region.h>
#include <image.h>
#include <version.h>
diff --git a/tools/libfdt/fdt_ro.c b/tools/libfdt/fdt_ro.c
new file mode 100644
index 00000000000..8a9735a48c5
--- /dev/null
+++ b/tools/libfdt/fdt_ro.c
@@ -0,0 +1,2 @@
+#include "fdt_host.h"
+#include "../scripts/dtc/libfdt/fdt_ro.c"
diff --git a/tools/moveconfig.py b/tools/moveconfig.py
index d8bf7fd0717..36361f9ed1b 100755
--- a/tools/moveconfig.py
+++ b/tools/moveconfig.py
@@ -314,11 +314,9 @@ import tempfile
import threading
import time
-sys.path.append(os.path.join(os.path.dirname(__file__), 'buildman'))
-sys.path.append(os.path.join(os.path.dirname(__file__), 'patman'))
-import bsettings
-import kconfiglib
-import toolchain
+from buildman import bsettings
+from buildman import kconfiglib
+from buildman import toolchain
SHOW_GNU_MAKE = 'scripts/show-gnu-make'
SLEEP_TIME=0.03
diff --git a/tools/patman/checkpatch.py b/tools/patman/checkpatch.py
index d47ea438b7d..795b5193145 100644
--- a/tools/patman/checkpatch.py
+++ b/tools/patman/checkpatch.py
@@ -3,12 +3,14 @@
#
import collections
-import command
-import gitutil
import os
import re
import sys
-import terminal
+
+from patman import command
+from patman import gitutil
+from patman import terminal
+from patman import tools
def FindCheckPatch():
top_level = gitutil.GetTopLevel()
diff --git a/tools/patman/command.py b/tools/patman/command.py
index 5fbd2c4a3e9..e67ac159e5a 100644
--- a/tools/patman/command.py
+++ b/tools/patman/command.py
@@ -3,8 +3,9 @@
#
import os
-import cros_subprocess
-import tools
+
+from patman import cros_subprocess
+from patman import tools
"""Shell command ease-ups for Python."""
diff --git a/tools/patman/func_test.py b/tools/patman/func_test.py
index 76319fff37e..b7e2825de88 100644
--- a/tools/patman/func_test.py
+++ b/tools/patman/func_test.py
@@ -12,15 +12,12 @@ import sys
import tempfile
import unittest
-try:
- from StringIO import StringIO
-except ImportError:
- from io import StringIO
-
-import gitutil
-import patchstream
-import settings
-import tools
+from io import StringIO
+
+from patman import gitutil
+from patman import patchstream
+from patman import settings
+from patman import tools
@contextlib.contextmanager
diff --git a/tools/patman/get_maintainer.py b/tools/patman/get_maintainer.py
index 0ffb55a8219..473f0feebf4 100644
--- a/tools/patman/get_maintainer.py
+++ b/tools/patman/get_maintainer.py
@@ -2,10 +2,11 @@
# Copyright (c) 2012 The Chromium OS Authors.
#
-import command
-import gitutil
import os
+from patman import command
+from patman import gitutil
+
def FindGetMaintainer():
"""Look for the get_maintainer.pl script.
diff --git a/tools/patman/gitutil.py b/tools/patman/gitutil.py
index a2a225c6b90..770a0510142 100644
--- a/tools/patman/gitutil.py
+++ b/tools/patman/gitutil.py
@@ -2,17 +2,17 @@
# Copyright (c) 2011 The Chromium OS Authors.
#
-import command
import re
import os
-import series
import subprocess
import sys
-import terminal
-import checkpatch
-import settings
-import tools
+from patman import checkpatch
+from patman import command
+from patman import series
+from patman import settings
+from patman import terminal
+from patman import tools
# True to use --no-decorate - we check this in Setup()
use_no_decorate = True
diff --git a/tools/patman/patman.py b/tools/patman/main.py
index 7f4ac9aef48..f3d9c0c4348 100755
--- a/tools/patman/patman.py
+++ b/tools/patman/main.py
@@ -12,19 +12,20 @@ import re
import sys
import unittest
+if __name__ == "__main__":
+ # Allow 'from patman import xxx to work'
+ our_path = os.path.dirname(os.path.realpath(__file__))
+ sys.path.append(os.path.join(our_path, '..'))
+
# Our modules
-try:
- from patman import checkpatch, command, gitutil, patchstream, \
- project, settings, terminal, test
-except ImportError:
- import checkpatch
- import command
- import gitutil
- import patchstream
- import project
- import settings
- import terminal
- import test
+from patman import checkpatch
+from patman import command
+from patman import gitutil
+from patman import patchstream
+from patman import project
+from patman import settings
+from patman import terminal
+from patman import test
parser = OptionParser()
@@ -85,7 +86,7 @@ if __name__ != "__main__":
# Run our meagre tests
elif options.test:
import doctest
- import func_test
+ from patman import func_test
sys.argv = [sys.argv[0]]
result = unittest.TestResult()
diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py
index df3eb7483bb..405297505c9 100644
--- a/tools/patman/patchstream.py
+++ b/tools/patman/patchstream.py
@@ -9,10 +9,10 @@ import re
import shutil
import tempfile
-import command
-import commit
-import gitutil
-from series import Series
+from patman import command
+from patman import commit
+from patman import gitutil
+from patman.series import Series
# Tags that we detect and remove
re_remove = re.compile('^BUG=|^TEST=|^BRANCH=|^Review URL:'
diff --git a/tools/patman/patman b/tools/patman/patman
index 6cc3d7a56a5..11a5d8e18ab 120000
--- a/tools/patman/patman
+++ b/tools/patman/patman
@@ -1 +1 @@
-patman.py \ No newline at end of file
+main.py \ No newline at end of file
diff --git a/tools/patman/project.py b/tools/patman/project.py
index 1d9cfc06252..2dfc303729b 100644
--- a/tools/patman/project.py
+++ b/tools/patman/project.py
@@ -4,7 +4,7 @@
import os.path
-import gitutil
+from patman import gitutil
def DetectProject():
"""Autodetect the name of the current project.
diff --git a/tools/patman/series.py b/tools/patman/series.py
index 6d9d48b1233..e5e28cebdf5 100644
--- a/tools/patman/series.py
+++ b/tools/patman/series.py
@@ -2,16 +2,14 @@
# Copyright (c) 2011 The Chromium OS Authors.
#
-from __future__ import print_function
-
import itertools
import os
-import get_maintainer
-import gitutil
-import settings
-import terminal
-import tools
+from patman import get_maintainer
+from patman import gitutil
+from patman import settings
+from patman import terminal
+from patman import tools
# Series-xxx tags that we understand
valid_series = ['to', 'cc', 'version', 'changes', 'prefix', 'notes', 'name',
diff --git a/tools/patman/settings.py b/tools/patman/settings.py
index 5dc83a85002..ca74fc611ff 100644
--- a/tools/patman/settings.py
+++ b/tools/patman/settings.py
@@ -2,8 +2,6 @@
# Copyright (c) 2011 The Chromium OS Authors.
#
-from __future__ import print_function
-
try:
import configparser as ConfigParser
except:
@@ -12,9 +10,9 @@ except:
import os
import re
-import command
-import gitutil
-import tools
+from patman import command
+from patman import gitutil
+from patman import tools
"""Default settings per-project.
@@ -36,10 +34,7 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
- Merge general default settings/aliases with project-specific ones.
# Sample config used for tests below...
- >>> try:
- ... from StringIO import StringIO
- ... except ImportError:
- ... from io import StringIO
+ >>> from io import StringIO
>>> sample_config = '''
... [alias]
... me: Peter P. <likesspiders@example.com>
diff --git a/tools/patman/terminal.py b/tools/patman/terminal.py
index 5c9e3eea20c..c709438bdc4 100644
--- a/tools/patman/terminal.py
+++ b/tools/patman/terminal.py
@@ -7,8 +7,6 @@
This module handles terminal interaction including ANSI color codes.
"""
-from __future__ import print_function
-
import os
import re
import shutil
diff --git a/tools/patman/test.py b/tools/patman/test.py
index 889e186606e..e7f709e34c7 100644
--- a/tools/patman/test.py
+++ b/tools/patman/test.py
@@ -8,11 +8,11 @@ import os
import tempfile
import unittest
-import checkpatch
-import gitutil
-import patchstream
-import series
-import commit
+from patman import checkpatch
+from patman import gitutil
+from patman import patchstream
+from patman import series
+from patman import commit
class TestPatch(unittest.TestCase):
diff --git a/tools/patman/test_util.py b/tools/patman/test_util.py
index 09f258c26b4..4d28d9fc922 100644
--- a/tools/patman/test_util.py
+++ b/tools/patman/test_util.py
@@ -3,21 +3,23 @@
# Copyright (c) 2016 Google, Inc
#
-from __future__ import print_function
-
from contextlib import contextmanager
import glob
+import multiprocessing
import os
import sys
+import unittest
-import command
+from patman import command
+from patman import test_util
-try:
- from StringIO import StringIO
-except ImportError:
- from io import StringIO
+from io import StringIO
-PYTHON = 'python%d' % sys.version_info[0]
+use_concurrent = True
+try:
+ from concurrencytest import ConcurrentTestSuite, fork_for_tests
+except:
+ use_concurrent = False
def RunTestCoverage(prog, filter_fname, exclude_list, build_dir, required=None):
@@ -46,12 +48,15 @@ def RunTestCoverage(prog, filter_fname, exclude_list, build_dir, required=None):
glob_list = []
glob_list += exclude_list
glob_list += ['*libfdt.py', '*site-packages*', '*dist-packages*']
- test_cmd = 'test' if 'binman.py' in prog else '-t'
- cmd = ('PYTHONPATH=$PYTHONPATH:%s/sandbox_spl/tools %s-coverage run '
- '--omit "%s" %s %s -P1' % (build_dir, PYTHON, ','.join(glob_list),
+ test_cmd = 'test' if 'binman' in prog else '-t'
+ prefix = ''
+ if build_dir:
+ prefix = 'PYTHONPATH=$PYTHONPATH:%s/sandbox_spl/tools ' % build_dir
+ cmd = ('%spython3-coverage run '
+ '--omit "%s" %s %s -P1' % (prefix, ','.join(glob_list),
prog, test_cmd))
os.system(cmd)
- stdout = command.Output('%s-coverage' % PYTHON, 'report')
+ stdout = command.Output('python3-coverage', 'report')
lines = stdout.splitlines()
if required:
# Convert '/path/to/name.py' just the module name 'name'
@@ -70,8 +75,8 @@ def RunTestCoverage(prog, filter_fname, exclude_list, build_dir, required=None):
print(coverage)
if coverage != '100%':
print(stdout)
- print("Type '%s-coverage html' to get a report in "
- 'htmlcov/index.html' % PYTHON)
+ print("Type 'python3-coverage html' to get a report in "
+ 'htmlcov/index.html')
print('Coverage error: %s, but should be 100%%' % coverage)
ok = False
if not ok:
@@ -90,3 +95,95 @@ def capture_sys_output():
yield capture_out, capture_err
finally:
sys.stdout, sys.stderr = old_out, old_err
+
+
+def ReportResult(toolname:str, test_name: str, result: unittest.TestResult):
+ """Report the results from a suite of tests
+
+ Args:
+ toolname: Name of the tool that ran the tests
+ test_name: Name of test that was run, or None for all
+ result: A unittest.TestResult object containing the results
+ """
+ # 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
+
+
+def RunTestSuites(result, debug, verbosity, test_preserve_dirs, processes,
+ test_name, toolpath, test_class_list):
+ """Run a series of test suites and collect the results
+
+ Args:
+ result: A unittest.TestResult object to add the results to
+ debug: True to enable debugging, which shows a full stack trace on error
+ verbosity: Verbosity level to use (0-4)
+ test_preserve_dirs: True to preserve the input directory used by tests
+ so that it can be examined afterwards (only useful for debugging
+ tests). If a single test is selected (in args[0]) it also preserves
+ the output directory for this test. Both directories are displayed
+ on the command line.
+ processes: Number of processes to use to run tests (None=same as #CPUs)
+ test_name: Name of test to run, or None for all
+ toolpath: List of paths to use for tools
+ test_class_list: List of test classes to run
+ """
+ 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]
+
+ suite = unittest.TestSuite()
+ loader = unittest.TestLoader()
+ for module in test_class_list:
+ # 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)
diff --git a/tools/patman/tools.py b/tools/patman/tools.py
index 3feddb292fc..b50370dfe8d 100644
--- a/tools/patman/tools.py
+++ b/tools/patman/tools.py
@@ -3,9 +3,6 @@
# Copyright (c) 2016 Google, Inc
#
-from __future__ import print_function
-
-import command
import glob
import os
import shutil
@@ -13,7 +10,8 @@ import struct
import sys
import tempfile
-import tout
+from patman import command
+from patman import tout
# Output directly (generally this is temporary)
outdir = None
diff --git a/tools/patman/tout.py b/tools/patman/tout.py
index 2a384851b0d..c7e32720965 100644
--- a/tools/patman/tout.py
+++ b/tools/patman/tout.py
@@ -4,11 +4,9 @@
# Terminal output logging.
#
-from __future__ import print_function
-
import sys
-import terminal
+from patman import terminal
# Output verbosity levels that we support
ERROR, WARNING, NOTICE, INFO, DETAIL, DEBUG = range(6)
diff --git a/tools/rmboard.py b/tools/rmboard.py
index df4f04b01c5..06c3562ad81 100755
--- a/tools/rmboard.py
+++ b/tools/rmboard.py
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#! /usr/bin/python3
# SPDX-License-Identifier: GPL-2.0+
# Copyright 2019 Google LLC
#
@@ -23,8 +23,6 @@ This script works by:
Search for ## to update the commit message manually.
"""
-from __future__ import print_function
-
import glob
import os
import re
@@ -32,9 +30,8 @@ import sys
# Bring in the patman libraries
our_path = os.path.dirname(os.path.realpath(__file__))
-sys.path.append(os.path.join(our_path, '../tools/patman'))
-import command
+from patman import command
def rm_kconfig_include(path):
"""Remove a path from Kconfig files