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

Re: Bug#773890: flash-kernel: No entry for BeagleBone Black when running 3.18 kernel



On 2014-12-28, Robert Nelson wrote:
> On Sun, Dec 28, 2014 at 6:26 PM, Vagrant Cascadian <vagrant@debian.org> wrote:
>> On 2014-12-28, Ian Campbell wrote:
>>> OOI, do you know how broken the white is when booting with the black's
>>> DTB? Completely unusable, missing some minor peripheral or somewhere in
>>> the middle?
...
> Oh you definitely don't want to run the wrong *.dtb on the black/white..
>
> In u-boot the findfdt function will correctly set the fdtfile variable.
>
> http://git.denx.de/?p=u-boot.git;a=blob;f=include/configs/am335x_evm.h;hb=HEAD#l176
>
> Notice:
> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/arch/arm/boot/dts/am335x-boneblack.dts?id=2ba3549352277514a8e4790adff77a783ee1b9e2
>
> IMPORTANT: booting the existing am335x-bone.dts will blow up the HDMI
> transceiver after a dozen boots with an uSD card inserted because LDO
> will be at 3.3V instead of 1.8.
>
> Also the 'white' uses DDR2, while the 'black" uses DDR3

Ok, so given that it might actually damage hardware to run with the
wrong dtb, I've written up a few UNTESTED patches to support multiple
DTB-Id entries:

* copy a .dtb file to /boot in addition to the /boot/dtb-${version}
  file, named using the ${fdtfile} variable.

* Add support to several boot script templates to first check for
  /boot/${fdtfile}-${version} and fall back to /boot/dtb-${version}.

* Allows for multiple DTB-Id files listed in the db, the last one listed
  is copied to /boot/dtb-${version} for backwards compatibility.

* The fourth patch adds the appropriate DTB-Id entry for BeagleBone
  white to coexist despite the same Machine ID as BeagleBone Black.

With those applied, then a separate stanza for the BeagleBone Black only
portion should work without ambiguity.


These might be a bit invasive for this point in the release cycle, but
they also aren't terribly large patches...  I can do some further
testing if it seems like the approach is worth pursuing at this point.


live well,
  vagrant
From 0cf302474715a1205c708bc6091fc03def149ebf Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagrant@debian.org>
Date: Sun, 28 Dec 2014 19:25:03 -0800
Subject: [PATCH 1/4] Make a copy of dtb file name in addition to the dtb-$kver
 file.

---
 functions | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/functions b/functions
index d45a4e6..683de88 100644
--- a/functions
+++ b/functions
@@ -416,12 +416,14 @@ handle_dtb() {
 
 	local dtb="/usr/lib/linux-image-$kvers/$dtb_id"
 	if [ "x$FK_KERNEL_HOOK_SCRIPT" = "xpostrm.d" ] ; then
-		rm -f "/boot/dtb-$kvers"
+		rm -f "/boot/dtb-$kvers" "/boot/$dtb_id-$kvers"
 	else
 		if [ -e $dtb ]; then
-			echo "Installing $dtb_id into /boot/dtb-$kvers" >&2
+			echo "Installing $dtb_id into /boot/dtb-$kvers and /boot/$dtb_id-$kvers" >&2
 			cp "$dtb" "/boot/dtb-$kvers.new"
+			cp "$dtb" "/boot/$dtb_id-$kvers.new"
 			backup_and_install "/boot/dtb-$kvers.new" "/boot/dtb-$kvers"
+			backup_and_install "/boot/$dtb_id-$kvers.new" "/boot/$dtb_id-$kvers"
 			ln -nfs "dtb-$kvers" "/boot/dtb"
 		else
 			echo "$dtb not found" >&2
-- 
2.1.4

From 0663f776d6c3d5d0c933f0125928300dac07bb54 Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagrant@debian.org>
Date: Sun, 28 Dec 2014 19:32:37 -0800
Subject: [PATCH 2/4] Check for dtb file defined as ${fdtfile} in the
 beaglebone, cubox-i, sunxi and wandboard boot script templates.

---
 bootscript/bootscr.beaglebone | 3 ++-
 bootscript/bootscr.cubox-i    | 3 ++-
 bootscript/bootscr.sunxi      | 3 ++-
 bootscript/bootscr.wandboard  | 3 ++-
 4 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/bootscript/bootscr.beaglebone b/bootscript/bootscr.beaglebone
index a0e5121..ec7a9ef 100644
--- a/bootscript/bootscr.beaglebone
+++ b/bootscript/bootscr.beaglebone
@@ -10,7 +10,8 @@ kvers='@@KERNEL_VERSION@@'
 for pathprefix in ${image_locations}
 do
   load ${device} ${partition} ${loadaddr} ${pathprefix}vmlinuz-${kvers} \
-  && load ${device} ${partition} ${fdtaddr} ${pathprefix}dtb-${kvers} \
+  && load ${device} ${partition} ${fdtaddr} ${pathprefix}${fdtfile}-${kvers} \
+  || load ${device} ${partition} ${fdtaddr} ${pathprefix}dtb-${kvers} \
   && load ${device} ${partition} ${rdaddr} ${pathprefix}initrd.img-${kvers} \
   && echo "Booting Debian ${kvers} from ${device} ${partition}..." \
   && bootz ${loadaddr} ${rdaddr}:${filesize} ${fdtaddr}
diff --git a/bootscript/bootscr.cubox-i b/bootscript/bootscr.cubox-i
index e9b1b09..26b8c0e 100644
--- a/bootscript/bootscr.cubox-i
+++ b/bootscript/bootscr.cubox-i
@@ -10,7 +10,8 @@ kvers='@@KERNEL_VERSION@@'
 for pathprefix in ${image_locations}
 do
   load ${device} ${partition} ${loadaddr} ${pathprefix}vmlinuz-${kvers} \
-  && load ${device} ${partition} ${fdt_addr} ${pathprefix}dtb-${kvers} \
+  && load ${device} ${partition} ${fdt_addr} ${pathprefix}${fdtfile}-${kvers} \
+  || load ${device} ${partition} ${fdt_addr} ${pathprefix}dtb-${kvers} \
   && load ${device} ${partition} ${ramdiskaddr} ${pathprefix}initrd.img-${kvers} \
   && echo "Booting Debian ${kvers} from ${device} ${partition}..." \
   && bootz ${loadaddr} ${ramdiskaddr}:${filesize} ${fdt_addr}
diff --git a/bootscript/bootscr.sunxi b/bootscript/bootscr.sunxi
index e64010f..7a3d38e 100644
--- a/bootscript/bootscr.sunxi
+++ b/bootscript/bootscr.sunxi
@@ -45,7 +45,8 @@ do
   if test -e ${device} ${partition} ${pathprefix}vmlinuz-${kvers}
   then
     load ${device} ${partition} ${kernel_addr_r} ${pathprefix}vmlinuz-${kvers} \
-    && load ${device} ${partition} ${fdt_addr_r} ${pathprefix}dtb-${kvers} \
+    && load ${device} ${partition} ${fdt_addr_r} ${pathprefix}${fdtfile}-${kvers} \
+    || load ${device} ${partition} ${fdt_addr_r} ${pathprefix}dtb-${kvers} \
     && load ${device} ${partition} ${ramdisk_addr_r} ${pathprefix}initrd.img-${kvers} \
     && echo "Booting Debian ${kvers} from ${device} ${partition}..." \
     && bootz ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r}
diff --git a/bootscript/bootscr.wandboard b/bootscript/bootscr.wandboard
index 847c4ec..6cfb591 100644
--- a/bootscript/bootscr.wandboard
+++ b/bootscript/bootscr.wandboard
@@ -13,7 +13,8 @@ kvers='@@KERNEL_VERSION@@'
 for pathprefix in ${image_locations}
 do
   load ${device} ${partition} ${loadaddr} ${pathprefix}vmlinuz-${kvers} \
-  && load ${device} ${partition} ${fdt_addr} ${pathprefix}dtb-${kvers} \
+  && load ${device} ${partition} ${fdt_addr} ${pathprefix}${fdtfile}-${kvers} \
+  || load ${device} ${partition} ${fdt_addr} ${pathprefix}dtb-${kvers} \
   && load ${device} ${partition} ${ramdiskaddr} ${pathprefix}initrd.img-${kvers} \
   && echo "Booting Debian ${kvers} from ${device} ${partition}..." \
   && bootz ${loadaddr} ${ramdiskaddr}:${filesize} ${fdt_addr}
-- 
2.1.4

From 9a16e6a6ca8826030b7d1412f9de7bc358b782f0 Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagrant@debian.org>
Date: Sun, 28 Dec 2014 19:40:43 -0800
Subject: [PATCH 3/4] Allow specifying multiple DTB-Id entries, and copying all
 DTB files.

---
 functions | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/functions b/functions
index 683de88..b78e591 100644
--- a/functions
+++ b/functions
@@ -409,11 +409,12 @@ android_flash() {
 }
 
 handle_dtb() {
-	local dtb_id="$(get_machine_field "$machine" "DTB-Id")" || :
-	if [ "x$dtb_id" = "x" ]; then
+	local dtb_ids="$(get_machine_field "$machine" "DTB-Id")" || :
+	if [ "x$dtb_ids" = "x" ]; then
 		return
 	fi
 
+	for dtb_id in $dtb_ids ; do
 	local dtb="/usr/lib/linux-image-$kvers/$dtb_id"
 	if [ "x$FK_KERNEL_HOOK_SCRIPT" = "xpostrm.d" ] ; then
 		rm -f "/boot/dtb-$kvers" "/boot/$dtb_id-$kvers"
@@ -429,6 +430,7 @@ handle_dtb() {
 			echo "$dtb not found" >&2
 		fi
 	fi
+	done
 }
 
 main() {
-- 
2.1.4

From 7a729c5f37a48d89ef523ae5f020e17bdb3b07eb Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagrant@debian.org>
Date: Sun, 28 Dec 2014 19:48:54 -0800
Subject: [PATCH 4/4] Add additional DTB-Id for BeagleBone white where it is
 impossible to distinguish between BeagleBone white and BeagleBone Black.

---
 db/all.db | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/db/all.db b/db/all.db
index 1d4686c..6a9940a 100644
--- a/db/all.db
+++ b/db/all.db
@@ -582,7 +582,7 @@ Bootloader-Sets-Incorrect-Root: yes
 
 Machine: TI AM335x BeagleBone
 Kernel-Flavors: armmp
-DTB-Id: am335x-boneblack.dtb
+DTB-Id: am335x-bone.dtb am335x-boneblack.dtb
 Boot-Script-Path: /boot/boot.scr
 U-Boot-Script-Name: bootscr.beaglebone
 Required-Packages: u-boot-tools
-- 
2.1.4

Attachment: signature.asc
Description: PGP signature


Reply to: