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

[PATCH 1/3] Honour FK_MACHINE and /etc/flash-kernel/machine in get_machine



---
 debian/changelog |    8 ++++++++
 functions        |   10 ++++++----
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index b077391..a2732ce 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+flash-kernel (3.9) UNRELEASED; urgency=low
+
+  * Honour FK_MACHINE in get_machine, to allow initramfs hooks etc to
+    work inside a chroot. Also support reading the machine from
+    /etc/flash-kernel/machine.
+
+ -- Ian Campbell <ijc@hellion.org.uk>  Thu, 15 Aug 2013 09:00:17 +0100
+
 flash-kernel (3.8) unstable; urgency=low
 
   [ Dmitrijs Ledkovs ]
diff --git a/functions b/functions
index df00a86..808206a 100644
--- a/functions
+++ b/functions
@@ -99,7 +99,12 @@ get_dt_model() {
 	cat "$PROC_DTMODEL"
 }
 get_machine() {
-	if [ -f "$PROC_DTMODEL" ] ; then
+	if [ -n "$FK_MACHINE" ]; then
+		[ "x$FK_MACHINE" = "xnone" ] && exit
+		echo "$FK_MACHINE"
+	elif [ -f "${FK_ETC_MACHINE:-/etc/flash-kernel/machine}" ] ; then
+		cat "${FK_ETC_MACHINE:-/etc/flash-kernel/machine}"
+	elif [ -f "$PROC_DTMODEL" ] ; then
 		get_dt_model
 	else
 		get_cpuinfo_hardware
@@ -320,9 +325,6 @@ main() {
 if [ "x$1" = "x--machine" ]; then
 	machine="$2"
 	shift 2
-elif [ -n "$FK_MACHINE" ]; then
-	machine="$FK_MACHINE"
-	[ "x$machine" = "xnone" ] && exit
 else
 	machine="$(get_machine)"
 fi
-- 
1.7.10.4


Reply to: