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

Support for mainline u-boot v2014.10 in flash-kernel



Hello everybody,

mainline u-boot v2014.10 introduces a new default environment and
a new common bootcmd handling for all platforms (see
http://git.denx.de/?p=u-boot.git;a=commit;h=8cc96848f0a467922820895b6b2363b0c64163b5).
This new default environment is not always fully compatible with
the default environment used by older vendor-specific u-boot
trees, so adjustments to existing boot scripts written for
vendor-specific u-boot versions might be necessary to make them
work out of the box with mainline u-boot v2014.10.

Following is a patch to bootscr.sunxi in flash-kernel to make it
compatible both with the old-style u-boot-sunxi as well as with
the new-style mainline u-boot environment.  It has been tested
with u-boot-sunxi (based on u-boot v2014.04) and with current
mainline u-boot master.

Are there any objections against applying this to flash-kernel
git?

Regards,
Karsten

>From ca37a46b7ab2464361dde92b2ffa3040ab4fd849 Mon Sep 17 00:00:00 2001
From: Karsten Merker <merker@debian.org>
Date: Sat, 30 Aug 2014 13:40:59 +0200
Subject: [PATCH] Add support for mainline u-boot v2014.10 to bootscr.sunxi

Mainline u-boot v2014.10 introduces a new default environment and
a new common bootcmd handling for all platforms, which is not fully
compatible with the old-style environment used by u-boot-sunxi.
Modify bootscript/bootscr.sunxi to work with both old-style and
new-style environments.
---
 bootscript/bootscr.sunxi | 35 ++++++++++++++++++++++++++---------
 1 file changed, 26 insertions(+), 9 deletions(-)

diff --git a/bootscript/bootscr.sunxi b/bootscript/bootscr.sunxi
index 16624a9..0774762 100644
--- a/bootscript/bootscr.sunxi
+++ b/bootscript/bootscr.sunxi
@@ -1,15 +1,32 @@
 # boot script for Allwinner SunXi-based devices
 
-# u-boot-sunxi does - in contrast to u-boot on other platforms - not
-# predefine kernel_addr_r, fdt_addr_r and ramdisk_addr_r, therefore we
-# define them locally in the boot script.
-#
-# This script assumes that ${device} and ${partition} are set in the
-# environment already.
+# Mainline u-boot v2014.10 introduces a new default environment and
+# a new common bootcmd handling for all platforms, which is not fully
+# compatible with the old-style environment used by u-boot-sunxi.
+# This script therefore needs to check in which environment it
+# is running and set some variables accordingly.
 
-setenv kernel_addr_r 0x46000000
-setenv fdt_addr_r 0x47000000
-setenv ramdisk_addr_r 0x48000000
+# On u-boot-sunxi, this script assumes that ${device} and ${partition}
+# are set.
+
+# The new-style environment predefines ${boot_targets}, the old-style
+# environment does not.
+if test -n "${boot_targets}"
+then
+  echo "Mainline u-boot / new-style environment detected."
+  # Mainline u-boot v2014.10 uses ${devtype}, ${devnum} and
+  # ${bootpart} where u-boot-sunxi uses ${device} and ${partition}.
+  if test -z "${device}"; then setenv device "${devtype}"; fi
+  if test -z "${partition}"; then setenv partition "${devnum}:${bootpart}"; fi
+else
+  echo "U-boot-sunxi / old-style environment detected."
+  # U-boot-sunxi does not predefine kernel_addr_r, fdt_addr_r and
+  # ramdisk_addr_r, so they are manually set to the values used by
+  # mainline u-boot v2014.10.
+  setenv kernel_addr_r 0x42000000
+  setenv fdt_addr_r 0x43000000
+  setenv ramdisk_addr_r 0x43300000
+fi
 
 setenv bootargs ${bootargs} @@LINUX_KERNEL_CMDLINE@@
 @@UBOOT_ENV_EXTRA@@
-- 
2.1.0

- 
Gem. Par. 28 Abs. 4 Bundesdatenschutzgesetz widerspreche ich der Nutzung
sowie der Weitergabe meiner personenbezogenen Daten für Zwecke der
Werbung sowie der Markt- oder Meinungsforschung.


Reply to: