aboutsummaryrefslogtreecommitdiff
path: root/linaro_image_tools/media_create
diff options
context:
space:
mode:
authorGeorgy Redkozubov <georgy.redkozubov@linaro.org>2013-10-24 22:44:58 +0400
committerGeorgy Redkozubov <georgy.redkozubov@linaro.org>2013-10-24 22:44:58 +0400
commita5038baff7826b9073b3ef7b46a83b8e973e5cdf (patch)
tree2abac67196bfa50673d38ecd40b01d669c50b81c /linaro_image_tools/media_create
parent0ebe866633d2c64540b3a8f420b8acc513bb04f7 (diff)
downloadlinaro-image-tools-a5038baff7826b9073b3ef7b46a83b8e973e5cdf.tar.gz
Added command line option --dtb-file
Diffstat (limited to 'linaro_image_tools/media_create')
-rw-r--r--linaro_image_tools/media_create/__init__.py5
-rw-r--r--linaro_image_tools/media_create/boards.py21
2 files changed, 24 insertions, 2 deletions
diff --git a/linaro_image_tools/media_create/__init__.py b/linaro_image_tools/media_create/__init__.py
index d22b929..3fda1bd 100644
--- a/linaro_image_tools/media_create/__init__.py
+++ b/linaro_image_tools/media_create/__init__.py
@@ -174,6 +174,11 @@ def get_args_parser():
help="Select a bootloader from a hardware pack that contains more "
"than one. If not specified, it will default to '%s'." %
DEFAULT_BOOTLOADER)
+ parser.add_argument(
+ '--dtb-file',
+ help="Select a DTB file from a hardware pack that contains more "
+ "than one. If not specified, it will default to the first "
+ "entry in 'dtb_files' list.")
add_common_options(parser)
return parser
diff --git a/linaro_image_tools/media_create/boards.py b/linaro_image_tools/media_create/boards.py
index 4e6e3f5..0c42a49 100644
--- a/linaro_image_tools/media_create/boards.py
+++ b/linaro_image_tools/media_create/boards.py
@@ -257,7 +257,8 @@ class BoardConfig(object):
data, _ = self.hardwarepack_handler.get_field(field_name)
return data
- def set_metadata(self, hwpacks, bootloader=None, board=None):
+ def set_metadata(self, hwpacks, bootloader=None, board=None,
+ dtb_file=None):
self.hardwarepack_handler = HardwarepackHandler(hwpacks, bootloader,
board)
with self.hardwarepack_handler:
@@ -310,6 +311,12 @@ class BoardConfig(object):
logger.warn("Deprecation warning: use the 'dtb_files' field "
"instead of 'dtb_file'.")
self.dtb_files = self.get_metadata_field(DTB_FILES_FIELD)
+ if dtb_file:
+ dtb_dict = self._find_dtb_dict(dtb_file)
+ if dtb_dict:
+ self.dtb_files = []
+ self.dtb_files.append(dtb_dict)
+
self.extra_boot_args_options = self.get_metadata_field(
EXTRA_BOOT_OPTIONS_FIELD)
self.boot_script = self.get_metadata_field(BOOT_SCRIPT_FIELD)
@@ -890,7 +897,7 @@ class BoardConfig(object):
# the file.
if not to_file:
to_file = os.path.basename(from_file)
- dtb = _get_file_matching(os.path.join(path, to_file))
+ dtb = _get_file_matching(os.path.join(path, from_file))
if not self.dtb_files or not dtb:
logger.warn("Could not find a valid dtb file, skipping it.")
@@ -919,6 +926,16 @@ class BoardConfig(object):
presence = True
return presence
+ def _find_dtb_dict(self, dtb):
+ """Returns dictionary entry from dt_files containing dtb file."""
+ for dtb_file in self.dtb_files:
+ if isinstance(dtb_file, dict):
+ for key, value in dtb_file.iteritems():
+ # The name of the dtb file.
+ if dtb in key:
+ return dtb_file
+ return None
+
class OmapConfig(BoardConfig):
def __init__(self):