summaryrefslogtreecommitdiff
path: root/morphlib
diff options
context:
space:
mode:
authorJames Thomas <james.thomas@codethink.co.uk>2014-07-22 11:11:27 (GMT)
committerJames Thomas <james.thomas@codethink.co.uk>2014-08-03 11:49:22 (GMT)
commit49ebc494b40a772b089961a0c74d143d017383c2 (patch)
tree7fd1836fee036f011ab1a2cb246707eda367fa61 /morphlib
parent62d9721c1cda780aacb1ca72e598a2ad969725c6 (diff)
downloadmorph-49ebc494b40a772b089961a0c74d143d017383c2.tar.gz
Add support for a device tree to be set using DTB_PATHbaserock/james/writeexts_support_jetson
Diffstat (limited to 'morphlib')
-rw-r--r--morphlib/writeexts.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/morphlib/writeexts.py b/morphlib/writeexts.py
index dec318d..863a935 100644
--- a/morphlib/writeexts.py
+++ b/morphlib/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):