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

Bug#667681: Updated patches for Dreamplug / Marvell Kirkwood FDT



I must confess I've sort of lost track over what is happening with this
patch/bug.

I've included my latest pair patches. They switch to
using /proc/device-tree/model to identify the board (only when that node
is available) and implement support for copying a DTB supplied by the
kernel package (per [0]) into /boot. They don't currently support
appending the DTB to the kernel image but that would be easy enough to
add if/when we have made a decision to go that route.

Ian.

[0] http://lists.debian.org/debian-kernel/2012/04/msg00571.html

-- 
Ian Campbell


To err is human -- but it feels divine.
		-- Mae West
From 79e9954a98f0e6b90bbdf7bc89a887598360a83f Mon Sep 17 00:00:00 2001
From: Ian Campbell <ian.campbell@citrix.com>
Date: Sat, 31 Mar 2012 07:00:54 +0000
Subject: [PATCH 1/2] Use /proc/device-tree/model in preference to
 /proc/cpuinfo:Hardware

If a system uses Device Tree then this node will be present and will identify
the actual hardware platform whereas /proc/cpuinfo:Hardware will only identify
the general class of platform.

Add support for "Marvell Kirkwood (Flattened Device Tree)" using this scheme.
---
 db/all.db        |    9 +++++++++
 debian/changelog |    5 +++++
 functions        |   13 ++++++++++++-
 3 files changed, 26 insertions(+), 1 deletions(-)

diff --git a/db/all.db b/db/all.db
index b7f7caa..5597c0c 100644
--- a/db/all.db
+++ b/db/all.db
@@ -199,6 +199,15 @@ Boot-Initrd-Path: /boot/uInitrd
 Required-Packages: u-boot-tools
 Bootloader-sets-root: no
 
+Machine: Globalscale Technologies Dreamplug
+Kernel-Flavors: kirkwood
+U-Boot-Kernel-Address: 0x00008000
+U-Boot-Initrd-Address: 0x0
+Boot-Kernel-Path: /boot/uImage
+Boot-Initrd-Path: /boot/uInitrd
+Required-Packages: u-boot-tools
+Bootloader-sets-root: no
+
 Machine: Marvell GuruPlug Reference Board
 Kernel-Flavors: kirkwood
 U-Boot-Kernel-Address: 0x00008000
diff --git a/debian/changelog b/debian/changelog
index 42b7122..3162b41 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,6 @@
 flash-kernel (3.0~rc.5) UNRELEASED; urgency=low
 
+  [ Hector Oron ]
   * Add support for FK_MACHINE and FK_PROC_CPUINFO.
     - Makes it possible to pass machine name for use under chrooted setups.
       Setting FK_MACHINE to none avoids flash-kernel run.
@@ -7,6 +8,10 @@ flash-kernel (3.0~rc.5) UNRELEASED; urgency=low
   * Add support for LaCie Kirkwood NASes.
     Thanks Simon Guinot for patch. (Closes: #670938)
 
+  [ Ian Campbell ]
+  * Add support for FDT based devices using /proc/device-tree/model for detection.
+  * Add support for DreamPlug.
+
  -- Hector Oron <zumbi@debian.org>  Sun, 11 Mar 2012 16:02:39 +0100
 
 flash-kernel (3.0~rc.4) unstable; urgency=low
diff --git a/functions b/functions
index bbfa772..82bb09e 100644
--- a/functions
+++ b/functions
@@ -21,6 +21,7 @@
 BOOTSCRIPTS_DIR="${FK_CHECKOUT:-$FK_DIR}/bootscript"
 MACHINE_DB="$(cat "${FK_CHECKOUT:-$FK_DIR}/db/"*.db)"
 PROC_CPUINFO="${FK_PROC_CPUINFO:-/proc/cpuinfo}"
+PROC_DTMODEL="${FK_PROC_DRMODEL:-/proc/device-tree/model}"
 PROC_MTD="/proc/mtd"
 
 
@@ -94,6 +95,16 @@ check_supported() {
 get_cpuinfo_hardware() {
 	grep "^Hardware" "$PROC_CPUINFO" | sed 's/Hardware\s*:\s*//'
 }
+get_dt_model() {
+	cat "$PROC_DTMODEL"
+}
+get_machine() {
+	if [ -f "$PROC_DTMODEL" ] ; then
+		get_dt_model
+	else
+		get_cpuinfo_hardware
+	fi
+}
 
 get_kfile_suffix() {
 	local kfile="$1"
@@ -302,7 +313,7 @@ elif [ -n "$FK_MACHINE" ]; then
 	machine="$FK_MACHINE"
 	[ "x$machine" = "xnone" ] && exit
 else
-	machine="$(get_cpuinfo_hardware)"
+	machine="$(get_machine)"
 fi
 
 if [ "x$1" = "x--supported" ]; then
-- 
1.7.9.1

From cca9ea2e8db088ed903ffeef4f6b3e29f5091145 Mon Sep 17 00:00:00 2001
From: Ian Campbell <ian.campbell@citrix.com>
Date: Sat, 21 Apr 2012 20:06:10 +0100
Subject: [PATCH 2/2] Add support for installing a DTB binary into /boot

Use this new functionality for the dreamplug
---
 README    |    6 ++++++
 db/all.db |    2 ++
 functions |    9 +++++++++
 3 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/README b/README
index 1d2c600..f8c2c1e 100644
--- a/README
+++ b/README
@@ -89,6 +89,8 @@ The supported fields are:
 * Machine-Id: (optional) linux mach-type to set before starting vmlinuz;
   will be set by a small piece of ARM code prepended to the kernel image
 
+* DTB-Id: (optional) specifies the name of the DTB file for this device
+
 * U-Boot-Kernel-Address, U-Boot-Initrd-Address: (optional) address where
   to load in (physical) RAM the kernel and initrd, respectively; this
   also indicates that U-Boot images should be generated with mkimage
@@ -108,6 +110,10 @@ The supported fields are:
   Boot-Initrd-Path but for an U-Boot boot script; see also
   U-Boot-Script-Name and Boot-Device
 
+* Boot-DTB-Path: (optional) like Boot-Kernel-Path and Boot-Initrd-Path
+  but for a DTB file. The DTB file named by DTB-Id will be copied
+  here; see also DTB-Id
+
 * Required-packages: (optional) list of packages which must be added
   during installer phase for flash-kernel to work properly; failure to
   add these packages aborts the installation
diff --git a/db/all.db b/db/all.db
index 5597c0c..b6c3448 100644
--- a/db/all.db
+++ b/db/all.db
@@ -201,10 +201,12 @@ Bootloader-sets-root: no
 
 Machine: Globalscale Technologies Dreamplug
 Kernel-Flavors: kirkwood
+DTB-Id: kirkwood-dreamplug.dtb
 U-Boot-Kernel-Address: 0x00008000
 U-Boot-Initrd-Address: 0x0
 Boot-Kernel-Path: /boot/uImage
 Boot-Initrd-Path: /boot/uInitrd
+Boot-DTB-Path: /boot/dtb
 Required-Packages: u-boot-tools
 Bootloader-sets-root: no
 
diff --git a/functions b/functions
index 82bb09e..a46bfed 100644
--- a/functions
+++ b/functions
@@ -382,6 +382,7 @@ machine_id="$(get_machine_field "$machine" "Machine-Id")" || :
 method="$(get_machine_field "$machine" "Method")" || method="generic"
 mtd_kernel="$(get_machine_field "$machine" "Mtd-Kernel")" || :
 mtd_initrd="$(get_machine_field "$machine" "Mtd-Initrd")" || :
+dtb_name="$(get_machine_field "$machine" "DTB-Id")" || :
 ukaddr="$(get_machine_field "$machine" "U-Boot-Kernel-Address")" || :
 uiaddr="$(get_machine_field "$machine" "U-Boot-Initrd-Address")" || :
 umaddr="$(get_machine_field "$machine" "U-Boot-Multi-Address")" || :
@@ -391,6 +392,7 @@ boot_device="$(get_machine_field "$machine" "Boot-Device")" || :
 boot_kernel_path="$(get_machine_field "$machine" "Boot-Kernel-Path")" || :
 boot_initrd_path="$(get_machine_field "$machine" "Boot-Initrd-Path")" || :
 boot_script_path="$(get_machine_field "$machine" "Boot-Script-Path")" || :
+boot_dtb_path="$(get_machine_field "$machine" "Boot-DTB-Path")" || :
 boot_multi_path="$(get_machine_field "$machine" "Boot-Multi-Path")" || :
 android_boot_device="$(get_machine_field "$machine" "Android-Boot-Device")" || :
 
@@ -537,6 +539,13 @@ case "$method" in
 			boot_script="$tmpdir/boot.scr"
 			backup_and_install "$boot_script" "$boot_script_path"
 		fi
+		if [ -n "$boot_dtb_path" ] ; then
+			boot_dtb_path="$boot_mnt_dir/$boot_dtb_path"
+			boot_dtb="/usr/lib/linux-image-$kvers/$dtb_name"
+			dtb="$tmpdir/dtb"
+			cp "$boot_dtb" "$dtb"
+			backup_and_install "$dtb" "$boot_dtb_path"
+		fi
 	;;
 	"symlink")
 		rm -f /boot/initrd /boot/zImage
-- 
1.7.9.1

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: