summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Thomas <james.thomas@codethink.co.uk>2014-07-22 11:11:27 +0000
committerJames Thomas <james.thomas@codethink.co.uk>2014-08-03 12:49:22 +0100
commit6d8b1e2d8f6b9ddc9f94ef306737a17d25ee1a48 (patch)
tree68856f740cb7d1d442746793b64a34a3a3b38762
parentd071207ed1a4a895219cb5ce4731eba52319b8b3 (diff)
downloaddefinitions-6d8b1e2d8f6b9ddc9f94ef306737a17d25ee1a48.tar.gz
Add support for a device tree to be set using DTB_PATH
-rw-r--r--writeexts.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/writeexts.py b/writeexts.py
index dec318d9..863a9351 100644
--- a/writeexts.py
+++ b/writeexts.py
@@ -259,6 +259,8 @@ class WriteExtension(cliapp.Application):
if self.bootloader_config_is_wanted():
self.install_kernel(version_root, temp_root)
+ if self.get_dtb_path() != '':
+ self.install_dtb(version_root, temp_root)
self.install_syslinux_menu(mountpoint, version_root)
if initramfs is not None:
self.install_initramfs(initramfs, version_root)
@@ -385,6 +387,23 @@ class WriteExtension(cliapp.Application):
cliapp.runcmd(['cp', '-a', try_path, kernel_dest])
break
+ def install_dtb(self, version_root, temp_root):
+ '''Install the device tree outside of 'orig' or 'run' subvolumes'''
+
+ self.status(msg='Installing devicetree')
+ device_tree_path = self.get_dtb_path()
+ dtb_dest = os.path.join(version_root, 'dtb')
+ try_path = os.path.join(temp_root, device_tree_path)
+ if os.path.exists(try_path):
+ cliapp.runcmd(['cp', '-a', try_path, dtb_dest])
+ else:
+ logging.error("Failed to find device tree %s", device_tree_path)
+ raise cliapp.AppException(
+ 'Failed to find device tree %s' % device_tree_path)
+
+ def get_dtb_path(self):
+ return os.environ.get('DTB_PATH', '')
+
def get_bootloader_install(self):
# Do we actually want to install the bootloader?
# Set this to "none" to prevent the install
@@ -435,6 +454,8 @@ class WriteExtension(cliapp.Application):
f.write('kernel /systems/default/kernel\n')
if disk_uuid is not None:
f.write('initrd /systems/default/initramfs\n')
+ if self.get_dtb_path() != '':
+ f.write('devicetree /systems/default/dtb\n')
f.write('append %s\n' % kernel_args)
def install_bootloader(self, real_root):