ausil pushed to extlinux-bootloader (master). "add a function to copy the dtbs to the rescue boot target if one exists"

notifications at fedoraproject.org notifications at fedoraproject.org
Wed Apr 1 17:39:23 UTC 2015


>From 0c5918ed6ed9905f32daa649d9ab7a1f458360bd Mon Sep 17 00:00:00 2001
From: Dennis Gilmore <dennis at ausil.us>
Date: Wed, 1 Apr 2015 12:39:16 -0500
Subject: add a function to copy the dtbs to the rescue boot target if one
 exists


diff --git a/extlinux b/extlinux
index a52ef36..4ca33a9 100755
--- a/extlinux
+++ b/extlinux
@@ -9,6 +9,7 @@
 # option) any later version.  See http://www.gnu.org/copyleft/gpl.html for
 # the full text of the license.
 
+import os
 
 def is_calxeda():
     #is the system a calxeda one
@@ -57,6 +58,26 @@ def insert_fdtdir():
     fd.writelines(newextlinux)
     fd.close()
 
+def copy_rescue_dtbs():
+    '''
+    check if there is a rescue image and copy the dtb files if there is
+    '''
+    boot = os.listdir('boot')
+    dtbsource = ''
+    dtbdest = ''
+    has_rescue = False
+    for target in boot:
+       if target.startswith('vmlinuz-0-rescue'):
+           has_rescue = True
+           dtbdest = '/boot/%s' % target.replace('vmlinuz', 'dtb')
+       if target.startswith('dtb'):
+           dtbsource = '/boot/%s' % target
+    if has_rescue:
+       if not os.path.isdir(dtbdest):
+           os.mkdir(dtbdest)
+           for dtb in os.listdir(dtbsource):
+               os.link(os.path.join(dtbsource, dtb), os.path.join(dtbdest, dtb))
+
 if __name__ == "__main__":
     # platform ships its own dtb
     if is_calxeda():
@@ -64,3 +85,4 @@ if __name__ == "__main__":
     else:
     # need to add fdtdir to extlinux.conf
         insert_fdtdir()
+        copy_rescue_dtbs()
diff --git a/extlinux-bootloader.spec b/extlinux-bootloader.spec
index e347fe5..8279df3 100644
--- a/extlinux-bootloader.spec
+++ b/extlinux-bootloader.spec
@@ -38,6 +38,9 @@ install -p %{SOURCE1} %{buildroot}%{_sbindir}
 
 
 %changelog
+* Wed Apr 01 2015 Dennis Gilmore <dennis at ausil.us> - 1.1-2
+- add a function to copy the dtbs to the rescue boot target if one exists
+
 * Mon Mar 30 2015 Dennis Gilmore <dennis at ausil.us> - 1.1-1
 - add a new extlinux script to setup dtb handling on arm 
 
-- 
cgit v0.10.2


	http://pkgs.fedoraproject.org/cgit/extlinux-bootloader.git/commit/?h=master&id=0c5918ed6ed9905f32daa649d9ab7a1f458360bd


More information about the scm-commits mailing list