[U-Boot] [PATCH v3] arm: mx5: Add support for USB armory board

Vagrant Cascadian
2015-03-24T23:25:34Z

On 2015-03-24, andrej at inversepath.com wrote:
> Add support for Inverse Path USB armory board, an open source
> flash-drive sized computer based on Freescale i.MX53 SoC.

Thanks!

Unfortunately, this fails to build with numerous errors such as:

CC arch/arm/lib/asm-offsets.s
In file included from include/config.h:6:0,
from /?BUILDDIR?/u-boot-2015.04~rc4+dfsg1/include/common.h:18,
from /?BUILDDIR?/u-boot-2015.04~rc4+dfsg1/lib/asm-offsets.c:15:
/?BUILDDIR?/u-boot-2015.04~rc4+dfsg1/include/configs/usbarmory.h:86:0: warning: "CONFIG_BOOTCOMMAND" redefined
#define CONFIG_BOOTCOMMAND \
^
In file included from /?BUILDDIR?/u-boot-2015.04~rc4+dfsg1/include/configs/usbarmory.h:27:0,
from include/config.h:6,
from /?BUILDDIR?/u-boot-2015.04~rc4+dfsg1/include/common.h:18,
from /?BUILDDIR?/u-boot-2015.04~rc4+dfsg1/lib/asm-offsets.c:15:
/?BUILDDIR?/u-boot-2015.04~rc4+dfsg1/include/config_distro_bootcmd.h:232:0: note: this is the location of the previous definition
#define CONFIG_BOOTCOMMAND "run distro_bootcmd"
^

It is caused by including config_distro_bootcmd.h too early, and
config_distro_bootcmd.h defines CONFIG_BOOTCOMMAND before it is set in
include/configs/usbarmory.h.

The include for config_distro_bootcmd.h should be *after*
CONFIG_BOOTCOMMAND and BOOT_TARGET_DEVICES are defined, at least. There
are also other conditionals that may be impacted but are more subtle.

So here's a tested trivial patch to fix that:

Index: u-boot/include/configs/usbarmory.h
===================================================================
--- u-boot.orig/include/configs/usbarmory.h
+++ u-boot/include/configs/usbarmory.h
@@ -24,7 +24,6 @@
#include <config_cmd_default.h>

#include <config_distro_defaults.h>
-#include <config_distro_bootcmd.h>

/* U-Boot commands */
#define CONFIG_CMD_MEMTEST
@@ -92,6 +91,8 @@
#define BOOT_TARGET_DEVICES(func) \
func(MMC, mmc, 0)

+#include <config_distro_bootcmd.h>
+
#define MEM_LAYOUT_ENV_SETTINGS \
"kernel_addr_r=0x70800000\0" \
"fdt_addr_r=0x71000000\0" \

I'd like to propose only setting bootargs when the default action is
kicking in to allow for a different root device, or root device
discovery from an initramfs, or boot scripts, etc... Something along
these lines (untested):

Index: u-boot/include/configs/usbarmory.h
===================================================================
--- u-boot.orig/include/configs/usbarmory.h
+++ u-boot/include/configs/usbarmory.h
@@ -80,10 +80,9 @@
#define CONFIG_SYS_TEXT_BASE 0x77800000
#define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR
#define CONFIG_HOSTNAME usbarmory
-#define CONFIG_BOOTARGS \
- "console=ttymxc0,115200 root=/dev/mmcblk0p1 rootwait rw"
#define CONFIG_BOOTCOMMAND \
"run distro_bootcmd; " \
+ "setenv bootargs console=${console} ${bootargs_default}; " \
"ext2load mmc 0:1 ${kernel_addr_r} /boot/uImage; " \
"ext2load mmc 0:1 ${fdt_addr_r} /boot/${fdtfile}; " \
"bootm ${kernel_addr_r} - ${fdt_addr_r}"
@@ -102,6 +101,7 @@

#define CONFIG_EXTRA_ENV_SETTINGS \
MEM_LAYOUT_ENV_SETTINGS \
+ "bootargs_default=root=/dev/mmcblk0p1 rootwait rw\0" \
"fdtfile=imx53-usbarmory.dtb\0" \
"console=ttymxc0,115200\0" \
BOOTENV

live well,
vagrant
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150324/5abfd308/attachment.sig>