=== modified file 'linaro_image_tools/hwpack/hwpack_convert.py'
@@ -39,6 +39,8 @@
FILE_FIELD,
IN_BOOT_PART_FIELD,
DD_FIELD,
+ DTB_FILE_FIELD,
+ DTB_FILES_FIELD,
ENV_DD_FIELD,
SPL_IN_BOOT_PART_FIELD,
SPL_DD_FIELD,
@@ -80,6 +82,9 @@
SPL_KEYS = [SPL_IN_BOOT_PART_FIELD, SPL_DD_FIELD, SPL_PACKAGE_FIELD,
SPL_FILE_FIELD, ENV_DD_FIELD]
+# The default name used for renaming dtb file
+DEFAULT_DTB_NAME = 'board.dtb'
+
logger = logging.getLogger("linaro_hwpack_converter")
@@ -125,6 +130,8 @@
self.spl = {}
# The list of packages that should be installed.
self.assume_installed = []
+ # The dtb_files section
+ self.dtb_files = []
def _parse(self):
"""Parses the config file and stores its values."""
@@ -181,6 +188,10 @@
self.assume_installed,
value)
continue
+ elif key == DTB_FILE_FIELD:
+ self.dtb_files.append({DEFAULT_DTB_NAME:
+ value})
+ continue
elif key == INCLUDE_DEBS_OLD:
key = INCLUDE_DEBS_FIELD
self.hwpack[key] = value
@@ -258,6 +269,9 @@
if self.sources:
sources = {SOURCES_FIELD: self.sources}
converted += dump(sources)
+ if self.dtb_files:
+ dtb = {DTB_FILES_FIELD: self.dtb_files}
+ converted += dump(dtb)
if self.bootloaders or self.extra_boot_options or self.spl:
# The bootloaders section in the new YAML file is a dictionary
# containing a dictionary which can contains also other
=== modified file 'linaro_image_tools/hwpack/tests/test_hwpack_converter.py'
@@ -154,3 +154,15 @@
converter = HwpackConverter(input_file, output_file)
converter._parse()
self.assertEqual(out_format, str(converter))
+
+ def test_dtb_file(self):
+ """Test the dtb_file conversion."""
+ ini_format = ("[hwpack]\nformat=2.0\ndtb_file=boot/a-*-path/file.dtb")
+ out_format = ("format: '3.0'\ndtb_files:\n- board.dtb: "
+ "boot/a-*-path/file.dtb\n")
+ input_file = self.useFixture(CreateTempFileFixture(ini_format)).\
+ get_file_name()
+ output_file = self.useFixture(CreateTempFileFixture()).get_file_name()
+ converter = HwpackConverter(input_file, output_file)
+ converter._parse()
+ self.assertEqual(out_format, str(converter))