Update SolidRun Cubox and Hummingboard U-Boot to use the new master port;

also effectively updates the u-boot version from 2013.10 to 2017.01

Reviewed by:	imp
Approved by:	imp
This commit is contained in:
Ian Lepore 2017-03-09 22:44:33 +00:00
parent 0169aa1c5e
commit 4c8183f1e7
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=435808
11 changed files with 11 additions and 457 deletions

View file

@ -1,51 +1,18 @@
# $FreeBSD$
PORTNAME= u-boot
PORTVERSION= 2013.10
PORTREVISION= 1
CATEGORIES= sysutils
PKGNAMESUFFIX= -cubox-hummingboard
MAINTAINER= imp@FreeBSD.org
MASTERDIR= ${.CURDIR}/../u-boot-master
MAINTAINER= ian@FreeBSD.org
COMMENT= Cross-build U-Boot loader for SolidRun Cubox
MODEL= cubox-hummingboard
BOARD_CONFIG= mx6cuboxi_defconfig
FAMILY= imx6
LICENSE= GPLv2
IMXFILE= u-boot.imx
UBOOT_PLIST= ${IMXFILE}
BUILD_DEPENDS= ${CROSS_GCC}:devel/arm-none-eabi-gcc492
ALL_TARGET= u-boot-with-spl.imx
CROSS_GCC= arm-none-eabi-gcc-4.9.2
pre-install: .PHONY
@${CP} ${WRKSRC}/u-boot-with-spl.imx ${WRKSRC}/${IMXFILE}
USE_GITHUB= yes
GH_ACCOUNT= SolidRun
GH_PROJECT= u-boot-imx6
GH_TAGNAME= e4bc4c3
NO_ARCH= yes
USES= gmake
SSP_UNSAFE= yes # cross-build static linking dies with -fstack-protector
U_BOOT_DIR= share/u-boot/${PORTNAME}${PKGNAMESUFFIX}
PLIST_DIRS= ${U_BOOT_DIR} share/u-boot
PLIST_FILES= ${U_BOOT_DIR}/u-boot.imx \
${U_BOOT_DIR}/README
MAKE_ARGS+= ARCH=arm \
CC=${CROSS_GCC} \
CROSS_COMPILE=arm-none-eabi- \
HOSTCC=cc
do-configure:
cd ${WRKSRC}; ${MAKE_CMD} ${MAKE_ARGS} mx6_cubox-i_config
# The build results in two output files: SPL, and u-boot.img.
# Combine them into a single u-boot.imx so that there is only one file to be
# copied onto the boot media starting at a 1K offset on the disk.
IMXFILE= ${STAGEDIR}/${PREFIX}/${U_BOOT_DIR}/u-boot.imx
do-install:
${MKDIR} ${STAGEDIR}/${PREFIX}/${U_BOOT_DIR}
dd bs=1k oseek=0 conv=sync of=${IMXFILE} if=${WRKSRC}/SPL
dd bs=1k oseek=41 conv=sync of=${IMXFILE} if=${WRKSRC}/u-boot.img
${INSTALL_DATA} ${DESCR} ${STAGEDIR}/${PREFIX}/${U_BOOT_DIR}/README
.include <bsd.port.mk>
.include "${MASTERDIR}/Makefile"

View file

@ -1,2 +0,0 @@
SHA256 (SolidRun-u-boot-imx6-2013.10-e4bc4c3_GH0.tar.gz) = eace7d45f85c39bef3f0aebf128ba426dc7bf629498370d5167a1e455165d5f4
SIZE (SolidRun-u-boot-imx6-2013.10-e4bc4c3_GH0.tar.gz) = 13030994

View file

@ -1,79 +0,0 @@
--- api/api.c.orig 2014-09-16 12:12:11 UTC
+++ api/api.c
@@ -495,45 +495,47 @@ static int API_env_set(va_list ap)
*/
static int API_env_enum(va_list ap)
{
- int i, n;
- char *last, **next;
+ int i;
+ char *last, **next, *s;
+ ENTRY *match, search;
+ static char *buf;
last = (char *)va_arg(ap, u_int32_t);
if ((next = (char **)va_arg(ap, u_int32_t)) == NULL)
return API_EINVAL;
- if (last == NULL)
- /* start over */
- *next = ((char *)env_get_addr(0));
- else {
- *next = last;
-
- for (i = 0; env_get_char(i) != '\0'; i = n + 1) {
- for (n = i; env_get_char(n) != '\0'; ++n) {
- if (n >= CONFIG_ENV_SIZE) {
- /* XXX shouldn't we set *next = NULL?? */
- return 0;
- }
- }
-
- if (envmatch((uchar *)last, i) < 0)
- continue;
-
- /* try to get next name */
- i = n + 1;
- if (env_get_char(i) == '\0') {
- /* no more left */
- *next = NULL;
- return 0;
- }
-
- *next = ((char *)env_get_addr(i));
- return 0;
+ /*
+ * This leverages realloc's behavior of growing but never shrinking the
+ * existing buffer.
+ */
+ if (last == NULL) {
+ i = 0;
+ buf = realloc(buf, 512); /* Start with reasonable size buf. */
+ } else {
+ buf = realloc(buf, strlen(last) + 1);
+ strcpy(buf, last);
+ if ((s = strchr(buf, '=')) != NULL)
+ *s = 0;
+ search.key = buf;
+ if ((i = hsearch_r(search, FIND, &match, &env_htab, 0)) == 0) {
+ i = API_EINVAL;
+ goto done;
}
}
+ /* hmatch on empty string is effectively "get next entry after i". */
+ if ((i = hmatch_r("", i, &match, &env_htab)) == 0)
+ goto done;
+ buf = realloc(buf, strlen(match->key) + strlen(match->data) + 2);
+ snprintf(buf, buflen, "%s=%s", match->key, match->data);
+ *next = buf;
return 0;
+done:
+ free(buf);
+ buf = NULL;
+ *next = NULL;
+ return i;
}
/*

View file

@ -1,28 +0,0 @@
--- api/api_storage.c.orig 2014-09-16 12:12:11 UTC
+++ api/api_storage.c
@@ -107,10 +107,13 @@ static int dev_stor_get(int type, int fi
if (first) {
di->cookie = (void *)get_dev(specs[type].name, 0);
- if (di->cookie == NULL)
+ if (di->cookie == NULL) {
return 0;
- else
+ } else {
found = 1;
+ if (specs[type].max_dev > 1)
+ *more = 1;
+ }
} else {
for (i = 0; i < specs[type].max_dev; i++)
@@ -146,7 +149,8 @@ static int dev_stor_get(int type, int fi
dd = (block_dev_desc_t *)di->cookie;
if (dd->type == DEV_TYPE_UNKNOWN) {
debugf("device instance exists, but is not active..");
- found = 0;
+ di->di_stor.block_count = 0;
+ di->di_stor.block_size = 0;
} else {
di->di_stor.block_count = dd->lba;
di->di_stor.block_size = dd->blksz;

View file

@ -1,51 +0,0 @@
--- board/solidrun/mx6_cubox-i/mx6_cubox-i.c.orig 2014-09-16 12:12:11 UTC
+++ board/solidrun/mx6_cubox-i/mx6_cubox-i.c
@@ -443,6 +443,7 @@ static void detect_board(void)
hb_cuboxi_ = 1;
config_sys_prompt = config_sys_prompt_hummingboard;
}
+
}
int board_early_init_f(void)
@@ -498,15 +499,19 @@ int board_init(void)
}
static char const *board_type = "uninitialized";
+static char const *fdt_board = "uninitialized";
int checkboard(void)
{
+
if (hb_cuboxi_ == 0) {
puts("Board: MX6-CuBox-i\n");
board_type = "mx6-cubox-i";
+ fdt_board = "cubox-i";
} else {
puts("Board: MX6-HummingBoard\n");
board_type = "mx6-hummingboard";
+ fdt_board = "hummingboard";
}
return 0;
}
@@ -521,10 +526,20 @@ static const struct boot_mode board_boot
int board_late_init(void)
{
+ const char *fdt_soc;
int cpurev = get_cpu_rev();
setenv("cpu",get_imx_type((cpurev & 0xFF000) >> 12));
setenv("board",board_type);
+ if (((cpurev & 0xFF000) >> 12) == MXC_CPU_MX6Q)
+ fdt_soc = "imx6q";
+ else
+ fdt_soc = "imx6dl";
+ if (getenv("fdt_soc") == NULL)
+ setenv("fdt_soc", fdt_soc);
+ if (getenv("fdt_board") == NULL)
+ setenv("fdt_board", fdt_board);
+
#ifdef CONFIG_CMD_BMODE
add_board_boot_modes(board_boot_modes);
#endif

View file

@ -1,29 +0,0 @@
--- common/cmd_elf.c.orig 2014-09-16 12:12:11 UTC
+++ common/cmd_elf.c
@@ -35,22 +35,12 @@ unsigned long do_bootelf_exec(ulong (*en
unsigned long ret;
/*
- * QNX images require the data cache is disabled.
- * Data cache is already flushed, so just turn it off.
- */
- int dcache = dcache_status();
- if (dcache)
- dcache_disable();
-
- /*
- * pass address parameter as argv[0] (aka command name),
- * and all remaining args
+ * FreeBSD wants the caches enabled while ubldr runs, and as of r276397
+ * the kernel can tolerate being entered with internal (but not external
+ * PL310) caches enabled on armv6/7 systems. So don't disable caches
+ * here, just launch the program directly.
*/
ret = entry(argc, argv);
-
- if (dcache)
- dcache_enable();
-
return ret;
}

View file

@ -1,46 +0,0 @@
--- common/cmd_nvedit.c.orig 2014-09-16 12:12:11 UTC
+++ common/cmd_nvedit.c
@@ -1061,6 +1061,23 @@ sep_err:
}
#endif
+#if defined(CONFIG_CMD_ENV_EXISTS)
+static int do_env_exists(cmd_tbl_t *cmdtp, int flag, int argc,
+ char * const argv[])
+{
+ ENTRY e, *ep;
+
+ if (argc < 2)
+ return CMD_RET_USAGE;
+
+ e.key = argv[1];
+ e.data = NULL;
+ hsearch_r(e, FIND, &ep, &env_htab, 0);
+
+ return (ep == NULL) ? 1 : 0;
+}
+#endif
+
/*
* New command line interface: "env" command with subcommands
*/
@@ -1096,6 +1113,9 @@ static cmd_tbl_t cmd_env_sub[] = {
U_BOOT_CMD_MKENT(save, 1, 0, do_env_save, "", ""),
#endif
U_BOOT_CMD_MKENT(set, CONFIG_SYS_MAXARGS, 0, do_env_set, "", ""),
+#if defined(CONFIG_CMD_ENV_EXISTS)
+ U_BOOT_CMD_MKENT(exists, 2, 0, do_env_exists, "", ""),
+#endif
};
#if defined(CONFIG_NEEDS_MANUAL_RELOC)
@@ -1138,6 +1158,9 @@ static char env_help_text[] =
#if defined(CONFIG_CMD_EDITENV)
"env edit name - edit environment variable\n"
#endif
+#if defined(CONFIG_CMD_ENV_EXISTS)
+ "env exists name - tests for existence of variable\n"
+#endif
#if defined(CONFIG_CMD_EXPORTENV)
"env export [-t | -b | -c] [-s size] addr [var ...] - export environment\n"
#endif

View file

@ -1,19 +0,0 @@
--- common/cmd_test.c.orig 2014-09-16 12:12:11 UTC
+++ common/cmd_test.c
@@ -22,9 +22,14 @@ static int do_test(cmd_tbl_t *cmdtp, int
char * const *ap;
int left, adv, expr, last_expr, neg, last_cmp;
- /* args? */
- if (argc < 3)
+ /*
+ * If no args, that's bogus, return false.
+ * If op is -z and no other args, answer is Yes, string is empty.
+ */
+ if (argc < 2)
return 1;
+ else if (argc == 2)
+ return !(strcmp(argv[1], "-z") == 0);
#ifdef DEBUG
{

View file

@ -1,11 +0,0 @@
--- config.mk.orig 2014-09-16 12:12:11 UTC
+++ config.mk
@@ -92,7 +92,7 @@ HOSTCC = $(call os_x_before, 10, 5, "c
HOSTCFLAGS += $(call os_x_before, 10, 4, "-traditional-cpp")
HOSTLDFLAGS += $(call os_x_before, 10, 5, "-multiply_defined suppress")
else
-HOSTCC = gcc
+HOSTCC ?= gcc
endif
ifeq ($(HOSTOS),cygwin)

View file

@ -1,80 +0,0 @@
--- drivers/mmc/mmc.c.orig 2014-09-16 12:12:11 UTC
+++ drivers/mmc/mmc.c
@@ -24,6 +24,7 @@
static struct list_head mmc_devices;
static int cur_dev_num = -1;
+static int mmc_error_print_max = -1;
int __weak board_mmc_getwp(struct mmc *mmc)
{
@@ -1175,9 +1176,14 @@ int mmc_register(struct mmc *mmc)
block_dev_desc_t *mmc_get_dev(int dev)
{
struct mmc *mmc = find_mmc_device(dev);
- if (!mmc || mmc_init(mmc))
+ if (!mmc)
return NULL;
+ /* If mmc_init fails, mmc->block_dev will be of type
+ * DEV_TYPE_UNKNOWN with blksz and lba set to zero.
+ */
+ mmc_init(mmc);
+
return &mmc->block_dev;
}
#endif
@@ -1200,7 +1206,7 @@ int mmc_start_init(struct mmc *mmc)
err = mmc->init(mmc);
if (err)
- return err;
+ goto done;
mmc_set_bus_width(mmc, 1);
mmc_set_clock(mmc, 1);
@@ -1209,7 +1215,7 @@ int mmc_start_init(struct mmc *mmc)
err = mmc_go_idle(mmc);
if (err)
- return err;
+ goto done;
/* The internal partition reset to user partition(0) at every CMD0*/
mmc->part_num = 0;
@@ -1226,15 +1232,33 @@ int mmc_start_init(struct mmc *mmc)
if (err && err != IN_PROGRESS) {
#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
- printf("Card did not respond to voltage select!\n");
+ if (mmc_error_print_max < 4) {
+ mmc_error_print_max++;
+ printf("Card did not respond to voltage select!\n");
+
+ if (mmc_error_print_max == 4) {
+ printf("Discarding further error messages\n");
+ }
+ }
#endif
- return UNUSABLE_ERR;
+// return UNUSABLE_ERR;
+ goto done;
}
}
if (err == IN_PROGRESS)
mmc->init_in_progress = 1;
+done:
+ if (err) {
+ mmc->has_init = 0;
+ mmc->block_dev.type = DEV_TYPE_UNKNOWN;
+ mmc->block_dev.blksz = 0;
+ mmc->block_dev.lba = 0;
+ } else {
+ mmc->has_init = 1;
+ }
+
return err;
}

View file

@ -1,68 +0,0 @@
--- include/configs/mx6_cubox-i.h.orig 2014-09-16 12:12:11 UTC
+++ include/configs/mx6_cubox-i.h
@@ -363,4 +363,65 @@ extern char *config_sys_prompt;
#define CONFIG_CMD_CACHE
#endif
+/*****************************************************************************
+ * FreeBSD customizations from here down.
+ ****************************************************************************/
+
+#ifndef CONFIG_SYS_TEXT_BASE
+#define CONFIG_SYS_TEXT_BASE 0x17800000
+#endif
+
+#define CONFIG_API
+#define CONFIG_CMD_ELF
+#define CONFIG_CMD_ENV_EXISTS
+
+#undef CONFIG_CMD_BMODE
+#define CONFIG_CMD_BMODE
+
+#undef CONFIG_SYS_MMC_MAX_DEVICE
+#define CONFIG_SYS_MMC_MAX_DEVICE CONFIG_SYS_FSL_USDHC_NUM
+
+#undef CONFIG_LOADADDR
+#define CONFIG_LOADADDR 0x11000000
+
+/* Create a small(ish) boot environment for FreeBSD. */
+#undef CONFIG_EXTRA_ENV_SETTINGS
+#define CONFIG_EXTRA_ENV_SETTINGS \
+ "loadaddr=0x11000000\0" \
+ \
+ "Fatboot=" \
+ "env exists loaderdev || env set loaderdev ${fatdev}; " \
+ "env exists UserFatboot && run UserFatboot; " \
+ "echo Booting from: ${fatdev} ${bootfile}; " \
+ "fatload ${fatdev} ${loadaddr} ${bootfile} && bootelf; " \
+ "\0" \
+ "Netboot=" \
+ "env exists loaderdev || env set loaderdev net; " \
+ "env exists UserNetboot && run UserNetboot; " \
+ "dhcp ${loadaddr} ${bootfile} && bootelf; " \
+ "\0" \
+ "Preboot=" \
+ "env exists bootfile || bootfile=ubldr; " \
+ "env exists uenv_file || uenv_file=uEnv.txt; " \
+ "env exists SetupFdtfile && run SetupFdtfile; " \
+ "env exists SetupFatdev && run SetupFatdev; " \
+ "env exists SetupUenv && run SetupUenv; " \
+ "env exists UserPreboot && run UserPreboot; " \
+ "\0" \
+ "SetupFdtfile=" \
+ "env exists fdt_file || env set fdt_file ${fdt_soc}-${fdt_board}.dtb; " \
+ "\0" \
+ "SetupFatdev=" \
+ "env exists fatdev || fatdev='mmc 0'; " \
+ "\0" \
+ "SetupUenv=" \
+ "fatload ${fatdev} ${loadaddr} ${uenv_file} && " \
+ "env import -t ${loadaddr} ${filesize}; " \
+ "\0"
+
+#undef CONFIG_BOOTCOMMAND
+#define CONFIG_BOOTCOMMAND "run Fatboot"
+#undef CONFIG_PREBOOT
+#define CONFIG_PREBOOT "run Preboot"
+
#endif /* __CONFIG_H * */