[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[PATCH 2/2] Add support for symlinking kernels/initrds on targets that use dtb.



---
 debian/changelog |  1 +
 functions        | 14 ++++++++------
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 09efe83..1af6515 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,7 @@
 flash-kernel (3.20) UNRELEASED; urgency=medium
 
   * Add support for the CuBox-i.
+  * Add support for symlinking kernels/initrds on targets that use dtb.
 
  -- Steve Langasek <vorlon@debian.org>  Fri, 30 May 2014 16:23:29 +0200
 
diff --git a/functions b/functions
index 9213145..d3009e8 100644
--- a/functions
+++ b/functions
@@ -631,14 +631,15 @@ case "$method" in
 			mount "$boot_device" "$boot_mnt_dir"
 		fi
 		if [ -n "$boot_kernel_path" ]; then
-			boot_kernel_path="$boot_mnt_dir/$boot_kernel_path"
 			# don't mv the original kernel
 			if [ "$kernel" != "$kfile" ]; then
+				boot_kernel_path="$boot_mnt_dir/$boot_kernel_path"
 				backup_and_install "$kernel" \
 					"$boot_kernel_path"
 			else
-				# TODO add support for kernel symlink
-				:
+				kernel=${kernel#$(dirname $boot_kernel_path)/}
+				boot_kernel_path="$boot_mnt_dir/$boot_kernel_path"
+				ln -sf "$kernel" "$boot_kernel_path"
 			fi
 		elif [ -n "$kmtd" ]; then
 			flash_kernel "$tmpdir/uImage" "$kmtd" ""
@@ -653,14 +654,15 @@ case "$method" in
 			initrd="$tmpdir/uInitrd"
 		fi
 		if [ -n "$boot_initrd_path" ]; then
-			boot_initrd_path="$boot_mnt_dir/$boot_initrd_path"
 			# don't mv the original initrd
 			if [ "$initrd" != "$ifile" ]; then
+				boot_initrd_path="$boot_mnt_dir/$boot_initrd_path"
 				backup_and_install "$initrd" \
 					"$boot_initrd_path"
 			else
-				# TODO add support for initrd symlink
-				:
+				initrd=${initrd#$(dirname $boot_initrd_path)/}
+				boot_initrd_path="$boot_mnt_dir/$boot_initrd_path"
+				ln -sf "$initrd" "$boot_initrd_path"
 			fi
 		elif [ -n "$imtd" ]; then
 			ipad=0
-- 
2.0.0


Reply to: