binman: Move to absolute imports

At present binman sets the python path on startup so that it can access
the libraries it needs. If we convert to use absolute imports this is not
necessary.

Move binman to use absolute imports. This enables removable of the path
adjusting in Entry also.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass 2020-04-17 18:09:03 -06:00
parent 0ede00fdaf
commit 16287933a8
70 changed files with 199 additions and 214 deletions

View File

@ -20,8 +20,8 @@ import io
import struct import struct
import sys import sys
from binman import elf
import command import command
import elf
import tools import tools
# Set to True to enable printing output while working # Set to True to enable printing output while working

View File

@ -16,9 +16,9 @@ import struct
import tempfile import tempfile
import unittest import unittest
import cbfs_util from binman import cbfs_util
from cbfs_util import CbfsWriter from binman.cbfs_util import CbfsWriter
import elf from binman import elf
import test_util import test_util
import tools import tools

View File

@ -10,9 +10,9 @@ import os
import sys import sys
import tools import tools
import cbfs_util from binman import cbfs_util
from binman import elf
import command import command
import elf
import tout import tout
# List of images we plan to create # List of images we plan to create
@ -60,7 +60,7 @@ def WriteEntryDocs(modules, test_missing=None):
to show as missing even if it is present. Should be set to None in to show as missing even if it is present. Should be set to None in
normal use. normal use.
""" """
from entry import Entry from binman.entry import Entry
Entry.WriteDocs(modules, test_missing) Entry.WriteDocs(modules, test_missing)
@ -334,8 +334,8 @@ def PrepareImagesAndDtbs(dtb_fname, select_images, update_fdt):
""" """
# Import these here in case libfdt.py is not available, in which case # Import these here in case libfdt.py is not available, in which case
# the above help option still works. # the above help option still works.
import fdt from dtoc import fdt
import fdt_util from dtoc import fdt_util
global images global images
# Get the device tree ready by compiling it and copying the compiled # Get the device tree ready by compiling it and copying the compiled
@ -473,7 +473,7 @@ def Binman(args):
# Put these here so that we can import this module without libfdt # Put these here so that we can import this module without libfdt
from image import Image from image import Image
import state from binman import state
if args.cmd in ['ls', 'extract', 'replace']: if args.cmd in ['ls', 'extract', 'replace']:
try: try:

View File

@ -6,7 +6,6 @@
# #
from collections import namedtuple, OrderedDict from collections import namedtuple, OrderedDict
import command
import io import io
import os import os
import re import re
@ -14,6 +13,7 @@ import shutil
import struct import struct
import tempfile import tempfile
import command
import tools import tools
import tout import tout

View File

@ -10,8 +10,8 @@ import sys
import tempfile import tempfile
import unittest import unittest
from binman import elf
import command import command
import elf
import test_util import test_util
import tools import tools
import tout import tout

View File

@ -9,9 +9,9 @@ import importlib
import os import os
import sys import sys
import fdt_util from dtoc import fdt_util
import tools import tools
from tools import ToHex, ToHexSize from patman.tools import ToHex, ToHexSize
import tout import tout
modules = {} modules = {}
@ -63,7 +63,7 @@ class Entry(object):
def __init__(self, section, etype, node, name_prefix=''): def __init__(self, section, etype, node, name_prefix=''):
# Put this here to allow entry-docs and help to work without libfdt # Put this here to allow entry-docs and help to work without libfdt
global state global state
import state from binman import state
self.section = section self.section = section
self.etype = etype self.etype = etype
@ -108,15 +108,11 @@ class Entry(object):
# Import the module if we have not already done so. # Import the module if we have not already done so.
if not module: if not module:
old_path = sys.path
sys.path.insert(0, os.path.join(our_path, 'etype'))
try: try:
module = importlib.import_module(module_name) module = importlib.import_module('binman.etype.' + module_name)
except ImportError as e: except ImportError as e:
raise ValueError("Unknown entry type '%s' in node '%s' (expected etype/%s.py, error '%s'" % raise ValueError("Unknown entry type '%s' in node '%s' (expected etype/%s.py, error '%s'" %
(etype, node_path, module_name, e)) (etype, node_path, module_name, e))
finally:
sys.path = old_path
modules[module_name] = module modules[module_name] = module
# Look up the expected class name # Look up the expected class name
@ -590,9 +586,7 @@ features to produce new behaviours.
modules.remove('_testing') modules.remove('_testing')
missing = [] missing = []
for name in modules: for name in modules:
if name.startswith('__'): module = Entry.Lookup('WriteDocs', name)
continue
module = Entry.Lookup(name, name)
docs = getattr(module, '__doc__') docs = getattr(module, '__doc__')
if test_missing == name: if test_missing == name:
docs = None docs = None

View File

@ -9,9 +9,9 @@ import os
import sys import sys
import unittest import unittest
import entry from binman import entry
import fdt from dtoc import fdt
import fdt_util from dtoc import fdt_util
import tools import tools
class TestEntry(unittest.TestCase): class TestEntry(unittest.TestCase):
@ -37,11 +37,11 @@ class TestEntry(unittest.TestCase):
else: else:
reload(entry) reload(entry)
else: else:
import entry from binman import entry
def testEntryContents(self): def testEntryContents(self):
"""Test the Entry bass class""" """Test the Entry bass class"""
import entry from binman import entry
base_entry = entry.Entry(None, None, None) base_entry = entry.Entry(None, None, None)
self.assertEqual(True, base_entry.ObtainContents()) self.assertEqual(True, base_entry.ObtainContents())

View File

@ -7,8 +7,8 @@
from collections import OrderedDict from collections import OrderedDict
from entry import Entry, EntryArg from binman.entry import Entry, EntryArg
import fdt_util from dtoc import fdt_util
import tools import tools

View File

@ -5,8 +5,8 @@
# Entry-type module for blobs, which are binary objects read from files # Entry-type module for blobs, which are binary objects read from files
# #
from entry import Entry from binman.entry import Entry
import fdt_util from dtoc import fdt_util
import tools import tools
import tout import tout

View File

@ -5,8 +5,8 @@
# Entry-type module for U-Boot device tree files # Entry-type module for U-Boot device tree files
# #
from entry import Entry from binman.entry import Entry
from blob import Entry_blob from binman.etype.blob import Entry_blob
class Entry_blob_dtb(Entry_blob): class Entry_blob_dtb(Entry_blob):
"""A blob that holds a device tree """A blob that holds a device tree
@ -18,7 +18,7 @@ class Entry_blob_dtb(Entry_blob):
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
# Put this here to allow entry-docs and help to work without libfdt # Put this here to allow entry-docs and help to work without libfdt
global state global state
import state from binman import state
Entry_blob.__init__(self, section, etype, node) Entry_blob.__init__(self, section, etype, node)

View File

@ -8,8 +8,8 @@
from collections import OrderedDict from collections import OrderedDict
from blob import Entry_blob from binman.etype.blob import Entry_blob
from entry import EntryArg from binman.entry import EntryArg
class Entry_blob_named_by_arg(Entry_blob): class Entry_blob_named_by_arg(Entry_blob):

View File

@ -7,10 +7,10 @@
from collections import OrderedDict from collections import OrderedDict
import cbfs_util from binman import cbfs_util
from cbfs_util import CbfsWriter from binman.cbfs_util import CbfsWriter
from entry import Entry from binman.entry import Entry
import fdt_util from dtoc import fdt_util
class Entry_cbfs(Entry): class Entry_cbfs(Entry):
"""Entry containing a Coreboot Filesystem (CBFS) """Entry containing a Coreboot Filesystem (CBFS)
@ -165,7 +165,7 @@ class Entry_cbfs(Entry):
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
# Put this here to allow entry-docs and help to work without libfdt # Put this here to allow entry-docs and help to work without libfdt
global state global state
import state from binman import state
Entry.__init__(self, section, etype, node) Entry.__init__(self, section, etype, node)
self._cbfs_arg = fdt_util.GetString(node, 'cbfs-arch', 'x86') self._cbfs_arg = fdt_util.GetString(node, 'cbfs-arch', 'x86')

View File

@ -5,7 +5,7 @@
# Entry-type module for a Chromium OS EC image (read-write section) # 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): class Entry_cros_ec_rw(Entry_blob_named_by_arg):

View File

@ -8,7 +8,7 @@ This handles putting an FDT into the image with just the information about the
image. image.
""" """
from entry import Entry from binman.entry import Entry
import tools import tools
import tout import tout
@ -82,8 +82,8 @@ class Entry_fdtmap(Entry):
global Fdt global Fdt
import libfdt import libfdt
import state from binman import state
from fdt import Fdt from dtoc.fdt import Fdt
Entry.__init__(self, section, etype, node) Entry.__init__(self, section, etype, node)

View File

@ -9,8 +9,8 @@
import glob import glob
import os import os
from section import Entry_section from binman.etype.section import Entry_section
import fdt_util from dtoc import fdt_util
import tools import tools
@ -30,7 +30,7 @@ class Entry_files(Entry_section):
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
# Put this here to allow entry-docs and help to work without libfdt # Put this here to allow entry-docs and help to work without libfdt
global state global state
import state from binman import state
Entry_section.__init__(self, section, etype, node) Entry_section.__init__(self, section, etype, node)
self._pattern = fdt_util.GetString(self._node, 'pattern') self._pattern = fdt_util.GetString(self._node, 'pattern')

View File

@ -3,8 +3,8 @@
# Written by Simon Glass <sjg@chromium.org> # Written by Simon Glass <sjg@chromium.org>
# #
from entry import Entry from binman.entry import Entry
import fdt_util from dtoc import fdt_util
import tools import tools
class Entry_fill(Entry): class Entry_fill(Entry):

View File

@ -5,10 +5,10 @@
# Entry-type module for a Flash map, as used by the flashrom SPI flash tool # Entry-type module for a Flash map, as used by the flashrom SPI flash tool
# #
from entry import Entry from binman.entry import Entry
import fmap_util from binman import fmap_util
import tools import tools
from tools import ToHexSize from patman.tools import ToHexSize
import tout import tout

View File

@ -9,9 +9,9 @@
from collections import OrderedDict from collections import OrderedDict
import command import command
from entry import Entry, EntryArg from binman.entry import Entry, EntryArg
import fdt_util from dtoc import fdt_util
import tools import tools
# Build GBB flags. # Build GBB flags.

View File

@ -11,8 +11,8 @@ image.
import struct import struct
from entry import Entry from binman.entry import Entry
import fdt_util from dtoc import fdt_util
IMAGE_HEADER_MAGIC = b'BinM' IMAGE_HEADER_MAGIC = b'BinM'
IMAGE_HEADER_LEN = 8 IMAGE_HEADER_LEN = 8

View File

@ -5,8 +5,8 @@
# Entry-type module for Intel Chip Microcode binary blob # Entry-type module for Intel Chip Microcode binary blob
# #
from entry import Entry from binman.entry import Entry
from blob import Entry_blob from binman.etype.blob import Entry_blob
class Entry_intel_cmc(Entry_blob): class Entry_intel_cmc(Entry_blob):
"""Entry containing an Intel Chipset Micro Code (CMC) file """Entry containing an Intel Chipset Micro Code (CMC) file

View File

@ -7,8 +7,8 @@
import struct import struct
from entry import Entry from binman.entry import Entry
from blob import Entry_blob from binman.etype.blob import Entry_blob
FD_SIGNATURE = struct.pack('<L', 0x0ff0a55a) FD_SIGNATURE = struct.pack('<L', 0x0ff0a55a)
MAX_REGIONS = 5 MAX_REGIONS = 5

View File

@ -7,7 +7,7 @@
import struct import struct
from blob import Entry_blob from binman.etype.blob import Entry_blob
class Entry_intel_fit(Entry_blob): class Entry_intel_fit(Entry_blob):
"""Intel Firmware Image Table (FIT) """Intel Firmware Image Table (FIT)

View File

@ -7,7 +7,7 @@
import struct import struct
from blob import Entry_blob from binman.etype.blob import Entry_blob
class Entry_intel_fit_ptr(Entry_blob): class Entry_intel_fit_ptr(Entry_blob):
"""Intel Firmware Image Table (FIT) pointer """Intel Firmware Image Table (FIT) pointer

View File

@ -5,8 +5,8 @@
# Entry-type module for Intel Firmware Support Package binary blob # Entry-type module for Intel Firmware Support Package binary blob
# #
from entry import Entry from binman.entry import Entry
from blob import Entry_blob from binman.etype.blob import Entry_blob
class Entry_intel_fsp(Entry_blob): class Entry_intel_fsp(Entry_blob):
"""Entry containing an Intel Firmware Support Package (FSP) file """Entry containing an Intel Firmware Support Package (FSP) file

View File

@ -5,8 +5,8 @@
# Entry-type module for Intel Firmware Support Package binary blob (M section) # Entry-type module for Intel Firmware Support Package binary blob (M section)
# #
from entry import Entry from binman.entry import Entry
from blob import Entry_blob from binman.etype.blob import Entry_blob
class Entry_intel_fsp_m(Entry_blob): class Entry_intel_fsp_m(Entry_blob):
"""Entry containing Intel Firmware Support Package (FSP) memory init """Entry containing Intel Firmware Support Package (FSP) memory init

View File

@ -5,8 +5,8 @@
# Entry-type module for Intel Firmware Support Package binary blob (S section) # Entry-type module for Intel Firmware Support Package binary blob (S section)
# #
from entry import Entry from binman.entry import Entry
from blob import Entry_blob from binman.etype.blob import Entry_blob
class Entry_intel_fsp_s(Entry_blob): class Entry_intel_fsp_s(Entry_blob):
"""Entry containing Intel Firmware Support Package (FSP) silicon init """Entry containing Intel Firmware Support Package (FSP) silicon init

View File

@ -5,8 +5,8 @@
# Entry-type module for Intel Firmware Support Package binary blob (T section) # Entry-type module for Intel Firmware Support Package binary blob (T section)
# #
from entry import Entry from binman.entry import Entry
from blob import Entry_blob from binman.etype.blob import Entry_blob
class Entry_intel_fsp_t(Entry_blob): class Entry_intel_fsp_t(Entry_blob):
"""Entry containing Intel Firmware Support Package (FSP) temp ram init """Entry containing Intel Firmware Support Package (FSP) temp ram init

View File

@ -7,9 +7,9 @@
from collections import OrderedDict from collections import OrderedDict
from entry import Entry from binman.entry import Entry
from blob import Entry_blob from binman.etype.blob import Entry_blob
import fdt_util from dtoc import fdt_util
import tools import tools
class Entry_intel_ifwi(Entry_blob): class Entry_intel_ifwi(Entry_blob):

View File

@ -5,8 +5,8 @@
# Entry-type module for Intel Management Engine binary blob # Entry-type module for Intel Management Engine binary blob
# #
from entry import Entry from binman.entry import Entry
from blob import Entry_blob from binman.etype.blob import Entry_blob
class Entry_intel_me(Entry_blob): class Entry_intel_me(Entry_blob):
"""Entry containing an Intel Management Engine (ME) file """Entry containing an Intel Management Engine (ME) file

View File

@ -5,8 +5,8 @@
# Entry-type module for Intel Memory Reference Code binary blob # Entry-type module for Intel Memory Reference Code binary blob
# #
from entry import Entry from binman.entry import Entry
from blob import Entry_blob from binman.etype.blob import Entry_blob
class Entry_intel_mrc(Entry_blob): class Entry_intel_mrc(Entry_blob):
"""Entry containing an Intel Memory Reference Code (MRC) file """Entry containing an Intel Memory Reference Code (MRC) file

View File

@ -5,8 +5,8 @@
# Entry-type module for Intel Memory Reference Code binary blob # Entry-type module for Intel Memory Reference Code binary blob
# #
from entry import Entry from binman.entry import Entry
from blob import Entry_blob from binman.etype.blob import Entry_blob
class Entry_intel_refcode(Entry_blob): class Entry_intel_refcode(Entry_blob):
"""Entry containing an Intel Reference Code file """Entry containing an Intel Reference Code file

View File

@ -4,8 +4,8 @@
# Entry-type module for Intel Video BIOS Table binary blob # Entry-type module for Intel Video BIOS Table binary blob
# #
from entry import Entry from binman.entry import Entry
from blob import Entry_blob from binman.etype.blob import Entry_blob
class Entry_intel_vbt(Entry_blob): class Entry_intel_vbt(Entry_blob):
"""Entry containing an Intel Video BIOS Table (VBT) file """Entry containing an Intel Video BIOS Table (VBT) file

View File

@ -5,8 +5,8 @@
# Entry-type module for x86 VGA ROM binary blob # Entry-type module for x86 VGA ROM binary blob
# #
from entry import Entry from binman.entry import Entry
from blob import Entry_blob from binman.etype.blob import Entry_blob
class Entry_intel_vga(Entry_blob): class Entry_intel_vga(Entry_blob):
"""Entry containing an Intel Video Graphics Adaptor (VGA) file """Entry containing an Intel Video Graphics Adaptor (VGA) file

View File

@ -4,8 +4,8 @@
# Entry-type module for the PowerPC mpc85xx bootpg and resetvec code for U-Boot # Entry-type module for the PowerPC mpc85xx bootpg and resetvec code for U-Boot
# #
from entry import Entry from binman.entry import Entry
from blob import Entry_blob from binman.etype.blob import Entry_blob
class Entry_powerpc_mpc85xx_bootpg_resetvec(Entry_blob): class Entry_powerpc_mpc85xx_bootpg_resetvec(Entry_blob):
"""PowerPC mpc85xx bootpg + resetvec code for U-Boot """PowerPC mpc85xx bootpg + resetvec code for U-Boot

View File

@ -12,8 +12,8 @@ from collections import OrderedDict
import re import re
import sys import sys
from entry import Entry from binman.entry import Entry
import fdt_util from dtoc import fdt_util
import tools import tools
import tout import tout

View File

@ -5,8 +5,8 @@
from collections import OrderedDict from collections import OrderedDict
from entry import Entry, EntryArg from binman.entry import Entry, EntryArg
import fdt_util from dtoc import fdt_util
import tools import tools

View File

@ -5,8 +5,8 @@
# Entry-type module for U-Boot binary # Entry-type module for U-Boot binary
# #
from entry import Entry from binman.entry import Entry
from blob import Entry_blob from binman.etype.blob import Entry_blob
class Entry_u_boot(Entry_blob): class Entry_u_boot(Entry_blob):
"""U-Boot flat binary """U-Boot flat binary

View File

@ -5,8 +5,8 @@
# Entry-type module for U-Boot device tree # Entry-type module for U-Boot device tree
# #
from entry import Entry from binman.entry import Entry
from blob_dtb import Entry_blob_dtb from binman.etype.blob_dtb import Entry_blob_dtb
class Entry_u_boot_dtb(Entry_blob_dtb): class Entry_u_boot_dtb(Entry_blob_dtb):
"""U-Boot device tree """U-Boot device tree

View File

@ -5,8 +5,8 @@
# Entry-type module for U-Boot device tree with the microcode removed # Entry-type module for U-Boot device tree with the microcode removed
# #
from entry import Entry from binman.entry import Entry
from blob_dtb import Entry_blob_dtb from binman.etype.blob_dtb import Entry_blob_dtb
import tools import tools
class Entry_u_boot_dtb_with_ucode(Entry_blob_dtb): class Entry_u_boot_dtb_with_ucode(Entry_blob_dtb):
@ -26,7 +26,7 @@ class Entry_u_boot_dtb_with_ucode(Entry_blob_dtb):
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
# Put this here to allow entry-docs and help to work without libfdt # Put this here to allow entry-docs and help to work without libfdt
global state global state
import state from binman import state
Entry_blob_dtb.__init__(self, section, etype, node) Entry_blob_dtb.__init__(self, section, etype, node)
self.ucode_data = b'' self.ucode_data = b''
@ -44,7 +44,7 @@ class Entry_u_boot_dtb_with_ucode(Entry_blob_dtb):
def ProcessFdt(self, fdt): def ProcessFdt(self, fdt):
# So the module can be loaded without it # 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 # If the section does not need microcode, there is nothing to do
ucode_dest_entry = self.section.FindEntryType( ucode_dest_entry = self.section.FindEntryType(

View File

@ -5,10 +5,10 @@
# Entry-type module for U-Boot ELF image # Entry-type module for U-Boot ELF image
# #
from entry import Entry from binman.entry import Entry
from blob import Entry_blob from binman.etype.blob import Entry_blob
import fdt_util from dtoc import fdt_util
import tools import tools
class Entry_u_boot_elf(Entry_blob): class Entry_u_boot_elf(Entry_blob):

View File

@ -5,8 +5,8 @@
# Entry-type module for U-Boot binary # Entry-type module for U-Boot binary
# #
from entry import Entry from binman.entry import Entry
from blob import Entry_blob from binman.etype.blob import Entry_blob
class Entry_u_boot_img(Entry_blob): class Entry_u_boot_img(Entry_blob):
"""U-Boot legacy image """U-Boot legacy image

View File

@ -5,8 +5,8 @@
# Entry-type module for 'u-boot-nodtb.bin' # Entry-type module for 'u-boot-nodtb.bin'
# #
from entry import Entry from binman.entry import Entry
from blob import Entry_blob from binman.etype.blob import Entry_blob
class Entry_u_boot_nodtb(Entry_blob): class Entry_u_boot_nodtb(Entry_blob):
"""U-Boot flat binary without device tree appended """U-Boot flat binary without device tree appended

View File

@ -5,10 +5,9 @@
# Entry-type module for spl/u-boot-spl.bin # Entry-type module for spl/u-boot-spl.bin
# #
import elf from binman import elf
from binman.entry import Entry
from entry import Entry from binman.etype.blob import Entry_blob
from blob import Entry_blob
class Entry_u_boot_spl(Entry_blob): class Entry_u_boot_spl(Entry_blob):
"""U-Boot SPL binary """U-Boot SPL binary

View File

@ -7,10 +7,10 @@
# to it will appear to SPL to be at the end of BSS rather than the start. # to it will appear to SPL to be at the end of BSS rather than the start.
# #
from binman import elf
from binman.entry import Entry
import command import command
import elf from binman.etype.blob import Entry_blob
from entry import Entry
from blob import Entry_blob
import tools import tools
class Entry_u_boot_spl_bss_pad(Entry_blob): class Entry_u_boot_spl_bss_pad(Entry_blob):

View File

@ -5,8 +5,8 @@
# Entry-type module for U-Boot device tree in SPL (Secondary Program Loader) # Entry-type module for U-Boot device tree in SPL (Secondary Program Loader)
# #
from entry import Entry from binman.entry import Entry
from blob_dtb import Entry_blob_dtb from binman.etype.blob_dtb import Entry_blob_dtb
class Entry_u_boot_spl_dtb(Entry_blob_dtb): class Entry_u_boot_spl_dtb(Entry_blob_dtb):
"""U-Boot SPL device tree """U-Boot SPL device tree

View File

@ -5,8 +5,8 @@
# Entry-type module for U-Boot SPL ELF image # Entry-type module for U-Boot SPL ELF image
# #
from entry import Entry from binman.entry import Entry
from blob import Entry_blob from binman.etype.blob import Entry_blob
class Entry_u_boot_spl_elf(Entry_blob): class Entry_u_boot_spl_elf(Entry_blob):
"""U-Boot SPL ELF image """U-Boot SPL ELF image

View File

@ -5,8 +5,8 @@
# Entry-type module for 'u-boot-nodtb.bin' # Entry-type module for 'u-boot-nodtb.bin'
# #
from entry import Entry from binman.entry import Entry
from blob import Entry_blob from binman.etype.blob import Entry_blob
class Entry_u_boot_spl_nodtb(Entry_blob): class Entry_u_boot_spl_nodtb(Entry_blob):
"""SPL binary without device tree appended """SPL binary without device tree appended

View File

@ -7,11 +7,7 @@
import struct import struct
import command from binman.etype.u_boot_with_ucode_ptr import Entry_u_boot_with_ucode_ptr
from entry import Entry
from blob import Entry_blob
from u_boot_with_ucode_ptr import Entry_u_boot_with_ucode_ptr
import tools
class Entry_u_boot_spl_with_ucode_ptr(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 """U-Boot SPL with embedded microcode pointer

View File

@ -5,10 +5,9 @@
# Entry-type module for tpl/u-boot-tpl.bin # Entry-type module for tpl/u-boot-tpl.bin
# #
import elf from binman import elf
from binman.entry import Entry
from entry import Entry from binman.etype.blob import Entry_blob
from blob import Entry_blob
class Entry_u_boot_tpl(Entry_blob): class Entry_u_boot_tpl(Entry_blob):
"""U-Boot TPL binary """U-Boot TPL binary

View File

@ -5,8 +5,8 @@
# Entry-type module for U-Boot device tree in TPL (Tertiary Program Loader) # Entry-type module for U-Boot device tree in TPL (Tertiary Program Loader)
# #
from entry import Entry from binman.entry import Entry
from blob_dtb import Entry_blob_dtb from binman.etype.blob_dtb import Entry_blob_dtb
class Entry_u_boot_tpl_dtb(Entry_blob_dtb): class Entry_u_boot_tpl_dtb(Entry_blob_dtb):
"""U-Boot TPL device tree """U-Boot TPL device tree

View File

@ -5,10 +5,7 @@
# Entry-type module for U-Boot device tree with the microcode removed # Entry-type module for U-Boot device tree with the microcode removed
# #
import control from binman.etype.u_boot_dtb_with_ucode import Entry_u_boot_dtb_with_ucode
from entry import Entry
from u_boot_dtb_with_ucode import Entry_u_boot_dtb_with_ucode
import tools
class Entry_u_boot_tpl_dtb_with_ucode(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 """U-Boot TPL with embedded microcode pointer

View File

@ -5,8 +5,8 @@
# Entry-type module for U-Boot TPL ELF image # Entry-type module for U-Boot TPL ELF image
# #
from entry import Entry from binman.entry import Entry
from blob import Entry_blob from binman.etype.blob import Entry_blob
class Entry_u_boot_tpl_elf(Entry_blob): class Entry_u_boot_tpl_elf(Entry_blob):
"""U-Boot TPL ELF image """U-Boot TPL ELF image

View File

@ -8,9 +8,9 @@
import struct import struct
import command import command
from entry import Entry from binman.entry import Entry
from blob import Entry_blob from binman.etype.blob import Entry_blob
from u_boot_with_ucode_ptr import Entry_u_boot_with_ucode_ptr from binman.etype.u_boot_with_ucode_ptr import Entry_u_boot_with_ucode_ptr
import tools import tools
class Entry_u_boot_tpl_with_ucode_ptr(Entry_u_boot_with_ucode_ptr): class Entry_u_boot_tpl_with_ucode_ptr(Entry_u_boot_with_ucode_ptr):

View File

@ -5,8 +5,8 @@
# Entry-type module for a U-Boot binary with an embedded microcode pointer # Entry-type module for a U-Boot binary with an embedded microcode pointer
# #
from entry import Entry from binman.entry import Entry
from blob import Entry_blob from binman.etype.blob import Entry_blob
import tools import tools
class Entry_u_boot_ucode(Entry_blob): class Entry_u_boot_ucode(Entry_blob):

View File

@ -7,12 +7,12 @@
import struct import struct
import command from binman import elf
import elf from binman.entry import Entry
from entry import Entry from binman.etype.blob import Entry_blob
from blob import Entry_blob from dtoc import fdt_util
import fdt_util
import tools import tools
import command
class Entry_u_boot_with_ucode_ptr(Entry_blob): class Entry_u_boot_with_ucode_ptr(Entry_blob):
"""U-Boot with embedded microcode pointer """U-Boot with embedded microcode pointer

View File

@ -9,9 +9,9 @@
from collections import OrderedDict from collections import OrderedDict
import os import os
from entry import Entry, EntryArg from binman.entry import Entry, EntryArg
import fdt_util from dtoc import fdt_util
import tools import tools
class Entry_vblock(Entry): class Entry_vblock(Entry):

View File

@ -5,8 +5,8 @@
# Entry-type module for the 16-bit x86 reset code for U-Boot # Entry-type module for the 16-bit x86 reset code for U-Boot
# #
from entry import Entry from binman.entry import Entry
from blob import Entry_blob from binman.etype.blob import Entry_blob
class Entry_x86_reset16(Entry_blob): class Entry_x86_reset16(Entry_blob):
"""x86 16-bit reset code for U-Boot """x86 16-bit reset code for U-Boot

View File

@ -5,8 +5,8 @@
# Entry-type module for the 16-bit x86 reset code for U-Boot # Entry-type module for the 16-bit x86 reset code for U-Boot
# #
from entry import Entry from binman.entry import Entry
from blob import Entry_blob from binman.etype.blob import Entry_blob
class Entry_x86_reset16_spl(Entry_blob): class Entry_x86_reset16_spl(Entry_blob):
"""x86 16-bit reset code for U-Boot """x86 16-bit reset code for U-Boot

View File

@ -5,8 +5,8 @@
# Entry-type module for the 16-bit x86 reset code for U-Boot # Entry-type module for the 16-bit x86 reset code for U-Boot
# #
from entry import Entry from binman.entry import Entry
from blob import Entry_blob from binman.etype.blob import Entry_blob
class Entry_x86_reset16_tpl(Entry_blob): class Entry_x86_reset16_tpl(Entry_blob):
"""x86 16-bit reset code for U-Boot """x86 16-bit reset code for U-Boot

View File

@ -5,8 +5,8 @@
# Entry-type module for the 16-bit x86 start-up code for U-Boot # Entry-type module for the 16-bit x86 start-up code for U-Boot
# #
from entry import Entry from binman.entry import Entry
from blob import Entry_blob from binman.etype.blob import Entry_blob
class Entry_x86_start16(Entry_blob): class Entry_x86_start16(Entry_blob):
"""x86 16-bit start-up code for U-Boot """x86 16-bit start-up code for U-Boot

View File

@ -5,8 +5,8 @@
# Entry-type module for the 16-bit x86 start-up code for U-Boot SPL # Entry-type module for the 16-bit x86 start-up code for U-Boot SPL
# #
from entry import Entry from binman.entry import Entry
from blob import Entry_blob from binman.etype.blob import Entry_blob
class Entry_x86_start16_spl(Entry_blob): class Entry_x86_start16_spl(Entry_blob):
"""x86 16-bit start-up code for SPL """x86 16-bit start-up code for SPL

View File

@ -5,8 +5,8 @@
# Entry-type module for the 16-bit x86 start-up code for U-Boot TPL # Entry-type module for the 16-bit x86 start-up code for U-Boot TPL
# #
from entry import Entry from binman.entry import Entry
from blob import Entry_blob from binman.etype.blob import Entry_blob
class Entry_x86_start16_tpl(Entry_blob): class Entry_x86_start16_tpl(Entry_blob):
"""x86 16-bit start-up code for TPL """x86 16-bit start-up code for TPL

View File

@ -9,9 +9,9 @@ import sys
import tempfile import tempfile
import unittest import unittest
import fdt from dtoc import fdt
from fdt import FdtScan from dtoc import fdt_util
import fdt_util from dtoc.fdt import FdtScan
import tools import tools
class TestFdt(unittest.TestCase): class TestFdt(unittest.TestCase):

View File

@ -6,6 +6,7 @@
# #
# python -m unittest func_test.TestFunctional.testHelp # python -m unittest func_test.TestFunctional.testHelp
import gzip
import hashlib import hashlib
from optparse import OptionParser from optparse import OptionParser
import os import os
@ -15,22 +16,21 @@ import sys
import tempfile import tempfile
import unittest import unittest
import main from binman import cbfs_util
import cbfs_util from binman import cmdline
import cmdline from binman import control
import command from binman import elf
import control from binman import elf_test
import elf from binman import fmap_util
import elf_test from binman import main
import fdt from binman import state
from etype import fdtmap from dtoc import fdt
from etype import image_header from dtoc import fdt_util
import fdt_util from binman.etype import fdtmap
import fmap_util from binman.etype import image_header
import test_util
import gzip
from image import Image from image import Image
import state import command
import test_util
import tools import tools
import tout import tout
@ -101,7 +101,7 @@ class TestFunctional(unittest.TestCase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
global entry global entry
import entry from binman import entry
# Handle the case where argv[0] is 'python' # Handle the case where argv[0] is 'python'
cls._binman_dir = os.path.dirname(os.path.realpath(sys.argv[0])) cls._binman_dir = os.path.dirname(os.path.realpath(sys.argv[0]))
@ -1288,8 +1288,8 @@ class TestFunctional(unittest.TestCase):
with self.assertRaises(ValueError) as e: with self.assertRaises(ValueError) as e:
self._DoReadFile('057_unknown_contents.dts', True) self._DoReadFile('057_unknown_contents.dts', True)
self.assertIn("Image '/binman': Internal error: Could not complete " self.assertIn("Image '/binman': Internal error: Could not complete "
"processing of contents: remaining [<_testing.Entry__testing ", "processing of contents: remaining ["
str(e.exception)) "<binman.etype._testing.Entry__testing ", str(e.exception))
def testBadChangeSize(self): def testBadChangeSize(self):
"""Test that trying to change the size of an entry fails""" """Test that trying to change the size of an entry fails"""
@ -1336,7 +1336,8 @@ class TestFunctional(unittest.TestCase):
with self.assertRaises(ValueError) as e: with self.assertRaises(ValueError) as e:
self._DoReadFileDtb('061_fdt_update_bad.dts', update_dtb=True) self._DoReadFileDtb('061_fdt_update_bad.dts', update_dtb=True)
self.assertIn('Could not complete processing of Fdt: remaining ' 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): def testEntryArgs(self):
"""Test passing arguments to entries from the command line""" """Test passing arguments to entries from the command line"""

View File

@ -12,12 +12,12 @@ import os
import re import re
import sys import sys
from entry import Entry from binman.entry import Entry
from etype import fdtmap from binman.etype import fdtmap
from etype import image_header from binman.etype import image_header
from etype import section from binman.etype import section
import fdt from dtoc import fdt
import fdt_util from dtoc import fdt_util
import tools import tools
import tout import tout

View File

@ -7,7 +7,7 @@
import unittest import unittest
from image import Image from image import Image
from test_util import capture_sys_output from patman.test_util import capture_sys_output
class TestImage(unittest.TestCase): class TestImage(unittest.TestCase):
def testInvalidFormat(self): def testInvalidFormat(self):

View File

@ -20,8 +20,8 @@ import unittest
# Bring in the patman and dtoc libraries (but don't override the first path # Bring in the patman and dtoc libraries (but don't override the first path
# in PYTHONPATH) # in PYTHONPATH)
our_path = os.path.dirname(os.path.realpath(__file__)) our_path = os.path.dirname(os.path.realpath(__file__))
for dirname in ['../patman', '../dtoc', '..', '../concurrencytest']: for dirname in ['../patman', '../dtoc', '../concurrencytest', '..']:
sys.path.insert(2, os.path.join(our_path, dirname)) sys.path.insert(2, os.path.realpath(os.path.join(our_path, dirname)))
# Bring in the libfdt module # Bring in the libfdt module
sys.path.insert(2, 'scripts/dtc/pylibfdt') sys.path.insert(2, 'scripts/dtc/pylibfdt')
@ -34,9 +34,8 @@ sys.path.insert(2, os.path.join(our_path,
# that is not available in a virtualenv. # that is not available in a virtualenv.
sys.path.append(get_python_lib()) sys.path.append(get_python_lib())
import cmdline from binman import cmdline
import command from binman import control
import control
import test_util import test_util
def RunTests(debug, verbosity, processes, test_preserve_dirs, args, toolpath): def RunTests(debug, verbosity, processes, test_preserve_dirs, args, toolpath):
@ -55,13 +54,13 @@ def RunTests(debug, verbosity, processes, test_preserve_dirs, args, toolpath):
name to execute (as in 'binman test testSections', for example) name to execute (as in 'binman test testSections', for example)
toolpath: List of paths to use for tools toolpath: List of paths to use for tools
""" """
import cbfs_util_test from binman import cbfs_util_test
import elf_test from binman import elf_test
import entry_test from binman import entry_test
import fdt_test from binman import fdt_test
import ftest from binman import ftest
import image_test from binman import image_test
import test from binman import test
import doctest import doctest
result = unittest.TestResult() result = unittest.TestResult()

View File

@ -8,7 +8,7 @@
import hashlib import hashlib
import re import re
import fdt from dtoc import fdt
import os import os
import tools import tools
import tout import tout
@ -167,8 +167,8 @@ def Prepare(images, dtb):
global output_fdt_info, main_dtb, fdt_path_prefix global output_fdt_info, main_dtb, fdt_path_prefix
# Import these here in case libfdt.py is not available, in which case # Import these here in case libfdt.py is not available, in which case
# the above help option still works. # the above help option still works.
import fdt from dtoc import fdt
import fdt_util from dtoc import fdt_util
# If we are updating the DTBs we need to put these updated versions # 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' # where Entry_blob_dtb can find them. We can ignore 'u-boot.dtb'

View File

@ -13,19 +13,19 @@ import sys
import unittest import unittest
if __name__ == "__main__": if __name__ == "__main__":
# Allow 'from patman import xxx to work' # Allow 'import xxx to work'
our_path = os.path.dirname(os.path.realpath(__file__)) our_path = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(our_path, '..')) sys.path.append(os.path.join(our_path, '..'))
# Our modules # Our modules
from patman import checkpatch import checkpatch
from patman import command import command
from patman import gitutil import gitutil
from patman import patchstream import patchstream
from patman import project import project
from patman import settings import settings
from patman import terminal import terminal
from patman import test import test
parser = OptionParser() parser = OptionParser()
@ -86,7 +86,7 @@ if __name__ != "__main__":
# Run our meagre tests # Run our meagre tests
elif options.test: elif options.test:
import doctest import doctest
from patman import func_test import func_test
sys.argv = [sys.argv[0]] sys.argv = [sys.argv[0]]
result = unittest.TestResult() result = unittest.TestResult()