Index: sysutils/u-boot-beaglebone/Makefile =================================================================== --- sysutils/u-boot-beaglebone/Makefile +++ sysutils/u-boot-beaglebone/Makefile @@ -1,43 +1,10 @@ # $FreeBSD$ -PORTNAME= u-boot -PORTVERSION= 2014.10 -PORTREVISION= 1 -CATEGORIES= sysutils -MASTER_SITES= ftp://ftp.denx.de/pub/u-boot/ -PKGNAMESUFFIX= -beaglebone +MAINTAINER= imp@FreeBSD.org +MASTERDIR= ${.CURDIR}/../u-boot-master -MAINTAINER= ian@FreeBSD.org -COMMENT= Cross-build U-Boot loader for BeagleBone and BeagleBone Black +MODEL= beaglebone +BOARD_CONFIG= am335x_boneblack_defconfig +FAMILY= omap -LICENSE= GPLv2 - -BUILD_DEPENDS= ${CROSS_GCC}:devel/arm-none-eabi-gcc492 - -CROSS_GCC= arm-none-eabi-gcc-4.9.2 - -NO_ARCH= yes - -WRKSRC= ${WRKDIR}/u-boot-${PORTVERSION} -USES= gmake tar:bzip2 -SSP_UNSAFE= yes # cross-LD does not support -fstack-protector - -U_BOOT_DIR= share/u-boot/${PORTNAME}${PKGNAMESUFFIX} -PLIST_FILES= ${U_BOOT_DIR}/u-boot.img \ - ${U_BOOT_DIR}/MLO \ - ${U_BOOT_DIR}/README - -MAKE_ARGS+= ARCH=arm \ - CC=${CROSS_GCC} \ - CROSS_COMPILE=arm-none-eabi- - -do-configure: - (cd ${WRKSRC}; ${MAKE_CMD} am335x_boneblack_defconfig) - -do-install: - ${MKDIR} ${STAGEDIR}/${PREFIX}/${U_BOOT_DIR} - ${INSTALL_DATA} ${WRKSRC}/MLO ${STAGEDIR}/${PREFIX}/${U_BOOT_DIR} - ${INSTALL_DATA} ${WRKSRC}/u-boot.img ${STAGEDIR}/${PREFIX}/${U_BOOT_DIR} - ${INSTALL_DATA} ${DESCR} ${STAGEDIR}/${PREFIX}/${U_BOOT_DIR}/README - -.include +.include "${MASTERDIR}/Makefile" Index: sysutils/u-boot-beaglebone/distinfo =================================================================== --- sysutils/u-boot-beaglebone/distinfo +++ sysutils/u-boot-beaglebone/distinfo @@ -1,2 +1,3 @@ -SHA256 (u-boot-2014.10.tar.bz2) = d3b132a7a9b3f3182b7aad71c2dfbd4fc15bea83e12c76134eb3ffefc07d1c71 -SIZE (u-boot-2014.10.tar.bz2) = 10217685 +TIMESTAMP = 1476714127 +SHA256 (bsdimp-u-boot-beaglebone-ports-v2016.05_GH0.tar.gz) = aa9dfb1167398dc7e649f7a9062f628a6bbe89f018a6b1ab856a8a8cd81c8ac0 +SIZE (bsdimp-u-boot-beaglebone-ports-v2016.05_GH0.tar.gz) = 14363966 Index: sysutils/u-boot-beaglebone/files/patch-api_api.c =================================================================== --- sysutils/u-boot-beaglebone/files/patch-api_api.c +++ /dev/null @@ -1,79 +0,0 @@ ---- api/api.c.orig 2014-10-14 08:47:15 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; - } - - /* Index: sysutils/u-boot-beaglebone/files/patch-api_api__storage.c =================================================================== --- sysutils/u-boot-beaglebone/files/patch-api_api__storage.c +++ /dev/null @@ -1,28 +0,0 @@ ---- api/api_storage.c.orig 2014-10-14 08:47:15 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; Index: sysutils/u-boot-beaglebone/files/patch-common_cmd__elf.c =================================================================== --- sysutils/u-boot-beaglebone/files/patch-common_cmd__elf.c +++ /dev/null @@ -1,29 +0,0 @@ ---- common/cmd_elf.c.orig 2014-10-14 08:47:15 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; - } - Index: sysutils/u-boot-beaglebone/files/patch-common_cmd__test.c =================================================================== --- sysutils/u-boot-beaglebone/files/patch-common_cmd__test.c +++ /dev/null @@ -1,19 +0,0 @@ ---- common/cmd_test.c.orig 2014-10-14 08:47:15 UTC -+++ common/cmd_test.c -@@ -65,9 +65,14 @@ static int do_test(cmd_tbl_t *cmdtp, int - char * const *ap; - int i, op, left, adv, expr, last_expr, last_unop, last_binop; - -- /* 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 - { Index: sysutils/u-boot-beaglebone/files/patch-drivers_mmc_mmc.c =================================================================== --- sysutils/u-boot-beaglebone/files/patch-drivers_mmc_mmc.c +++ /dev/null @@ -1,80 +0,0 @@ ---- drivers/mmc/mmc.c.orig 2014-10-14 08:47:15 UTC -+++ drivers/mmc/mmc.c -@@ -20,6 +20,7 @@ - - static struct list_head mmc_devices; - static int cur_dev_num = -1; -+static int mmc_error_print_max = -1; - - __weak int board_mmc_getwp(struct mmc *mmc) - { -@@ -1270,9 +1271,14 @@ void mmc_destroy(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 -@@ -1297,7 +1303,7 @@ int mmc_start_init(struct mmc *mmc) - err = mmc->cfg->ops->init(mmc); - - if (err) -- return err; -+ goto done; - - mmc_set_bus_width(mmc, 1); - mmc_set_clock(mmc, 1); -@@ -1306,7 +1312,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; -@@ -1323,15 +1329,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; - } - Index: sysutils/u-boot-beaglebone/files/patch-include_configs_am335x__evm.h =================================================================== --- sysutils/u-boot-beaglebone/files/patch-include_configs_am335x__evm.h +++ /dev/null @@ -1,82 +0,0 @@ ---- include/configs/am335x_evm.h.orig 2014-10-14 08:47:15 UTC -+++ include/configs/am335x_evm.h -@@ -479,4 +479,79 @@ - #endif - #endif /* NOR support */ - -+/***************************************************************************** -+ * FreeBSD customizations from here down. -+ ****************************************************************************/ -+ -+/* Add the API and ELF features needed for ubldr. */ -+#ifndef CONFIG_SPL_BUILD -+#define CONFIG_API -+#define CONFIG_CMD_ELF -+#define CONFIG_CMD_ENV_EXISTS -+#define CONFIG_EFI_PARTITION -+#define CONFIG_SYS_MMC_MAX_DEVICE 2 -+#ifndef CONFIG_SYS_DCACHE_OFF -+#define CONFIG_CMD_CACHE -+#endif -+#endif -+ -+/* Save the env to the fat partition. */ -+#ifndef CONFIG_SPL_BUILD -+#undef CONFIG_ENV_IS_NOWHERE -+#undef CONFIG_ENV_IS_IN_NAND -+#undef CONFIG_ENV_IS_IN_MMC -+#define CONFIG_ENV_IS_IN_FAT -+#define CONFIG_FAT_WRITE -+#define FAT_ENV_INTERFACE "mmc" -+#define FAT_ENV_DEVICE_AND_PART "0" -+#define FAT_ENV_FILE "u-boot.env" -+#endif -+ -+/* Create a small(ish) boot environment for FreeBSD. */ -+#ifndef CONFIG_SPL_BUILD -+#undef CONFIG_EXTRA_ENV_SETTINGS -+#define CONFIG_EXTRA_ENV_SETTINGS \ -+ "loadaddr=88000000\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=" \ -+ "if test ${board_name} = A335BONE; then " \ -+ "env set fdt_file beaglebone.dtb; " \ -+ "elif test ${board_name} = A335BNLT; then " \ -+ "env set fdt_file beaglebone-black.dtb; " \ -+ "fi; " \ -+ "\0" \ -+ "SetupFatdev=" \ -+ "env exists fatdev || " \ -+ "fatsize ${fatdev:=mmc 0} ${bootfile} || " \ -+ "fatdev='mmc 1'; " \ -+ "\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 -+ - #endif /* ! __CONFIG_AM335X_EVM_H */ Index: sysutils/u-boot-duovero/Makefile =================================================================== --- sysutils/u-boot-duovero/Makefile +++ sysutils/u-boot-duovero/Makefile @@ -1,42 +1,10 @@ # $FreeBSD$ -PORTNAME= u-boot -PORTVERSION= 2014.10 -CATEGORIES= sysutils -MASTER_SITES= ftp://ftp.denx.de/pub/u-boot/ -PKGNAMESUFFIX= -duovero +MAINTAINER= imp@FreeBSD.org +MASTERDIR= ${.CURDIR}/../u-boot-master -MAINTAINER= ian@FreeBSD.org -COMMENT= Cross-build U-Boot loader for Duovero +MODEL= duovero +BOARD_CONFIG= duovero_config +FAMILY= omap -LICENSE= GPLv2 - -BUILD_DEPENDS= ${CROSS_GCC}:devel/arm-none-eabi-gcc492 - -CROSS_GCC= arm-none-eabi-gcc-4.9.2 - -NO_ARCH= yes - -WRKSRC= ${WRKDIR}/u-boot-${PORTVERSION} -USES= gmake tar:bzip2 -SSP_UNSAFE= yes # cross-LD does not support -fstack-protector - -U_BOOT_DIR= share/u-boot/${PORTNAME}${PKGNAMESUFFIX} -PLIST_FILES= ${U_BOOT_DIR}/u-boot.img \ - ${U_BOOT_DIR}/MLO \ - ${U_BOOT_DIR}/README - -MAKE_ARGS+= ARCH=arm \ - CC=${CROSS_GCC} \ - CROSS_COMPILE=arm-none-eabi- - -do-configure: - (cd ${WRKSRC}; ${MAKE_CMD} duovero_config) - -do-install: - ${MKDIR} ${STAGEDIR}/${PREFIX}/${U_BOOT_DIR} - ${INSTALL_DATA} ${WRKSRC}/MLO ${STAGEDIR}/${PREFIX}/${U_BOOT_DIR} - ${INSTALL_DATA} ${WRKSRC}/u-boot.img ${STAGEDIR}/${PREFIX}/${U_BOOT_DIR} - ${INSTALL_DATA} ${DESCR} ${STAGEDIR}/${PREFIX}/${U_BOOT_DIR}/README - -.include +.include "${MASTERDIR}/Makefile" Index: sysutils/u-boot-duovero/distinfo =================================================================== --- sysutils/u-boot-duovero/distinfo +++ sysutils/u-boot-duovero/distinfo @@ -1,2 +1,3 @@ -SHA256 (u-boot-2014.10.tar.bz2) = d3b132a7a9b3f3182b7aad71c2dfbd4fc15bea83e12c76134eb3ffefc07d1c71 -SIZE (u-boot-2014.10.tar.bz2) = 10217685 +TIMESTAMP = 1476682023 +SHA256 (bsdimp-u-boot-duovero-ports-v2016.05_GH0.tar.gz) = aa9dfb1167398dc7e649f7a9062f628a6bbe89f018a6b1ab856a8a8cd81c8ac0 +SIZE (bsdimp-u-boot-duovero-ports-v2016.05_GH0.tar.gz) = 14363966 Index: sysutils/u-boot-duovero/files/patch-api_api.c =================================================================== --- sysutils/u-boot-duovero/files/patch-api_api.c +++ /dev/null @@ -1,79 +0,0 @@ ---- api/api.c.orig 2014-10-14 08:47:15 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; - } - - /* Index: sysutils/u-boot-duovero/files/patch-api_api__storage.c =================================================================== --- sysutils/u-boot-duovero/files/patch-api_api__storage.c +++ /dev/null @@ -1,28 +0,0 @@ ---- api/api_storage.c.orig 2014-10-14 08:47:15 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; Index: sysutils/u-boot-duovero/files/patch-common_cmd__elf.c =================================================================== --- sysutils/u-boot-duovero/files/patch-common_cmd__elf.c +++ /dev/null @@ -1,29 +0,0 @@ ---- common/cmd_elf.c.orig 2014-10-14 08:47:15 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; - } - Index: sysutils/u-boot-duovero/files/patch-common_cmd__test.c =================================================================== --- sysutils/u-boot-duovero/files/patch-common_cmd__test.c +++ /dev/null @@ -1,19 +0,0 @@ ---- common/cmd_test.c.orig 2014-10-14 08:47:15 UTC -+++ common/cmd_test.c -@@ -65,9 +65,14 @@ static int do_test(cmd_tbl_t *cmdtp, int - char * const *ap; - int i, op, left, adv, expr, last_expr, last_unop, last_binop; - -- /* 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 - { Index: sysutils/u-boot-duovero/files/patch-drivers_mmc_mmc.c =================================================================== --- sysutils/u-boot-duovero/files/patch-drivers_mmc_mmc.c +++ /dev/null @@ -1,80 +0,0 @@ ---- drivers/mmc/mmc.c.orig 2014-10-14 08:47:15 UTC -+++ drivers/mmc/mmc.c -@@ -20,6 +20,7 @@ - - static struct list_head mmc_devices; - static int cur_dev_num = -1; -+static int mmc_error_print_max = -1; - - __weak int board_mmc_getwp(struct mmc *mmc) - { -@@ -1270,9 +1271,14 @@ void mmc_destroy(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 -@@ -1297,7 +1303,7 @@ int mmc_start_init(struct mmc *mmc) - err = mmc->cfg->ops->init(mmc); - - if (err) -- return err; -+ goto done; - - mmc_set_bus_width(mmc, 1); - mmc_set_clock(mmc, 1); -@@ -1306,7 +1312,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; -@@ -1323,15 +1329,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; - } - Index: sysutils/u-boot-duovero/files/patch-include_configs_duovero.h =================================================================== --- sysutils/u-boot-duovero/files/patch-include_configs_duovero.h +++ /dev/null @@ -1,78 +0,0 @@ ---- include/configs/duovero.h.orig 2014-10-14 08:47:15 UTC -+++ include/configs/duovero.h -@@ -59,4 +59,75 @@ - - #define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG - -+/***************************************************************************** -+ * FreeBSD customizations from here down. -+ ****************************************************************************/ -+ -+#define CONFIG_SYS_DCACHE_OFF -+ -+/* Add the API and ELF features needed for ubldr. */ -+#ifndef CONFIG_SPL_BUILD -+#define CONFIG_API -+#define CONFIG_CMD_ELF -+#define CONFIG_CMD_ENV_EXISTS -+#define CONFIG_EFI_PARTITION -+#define CONFIG_SYS_MMC_MAX_DEVICE 2 -+#ifndef CONFIG_SYS_DCACHE_OFF -+#define CONFIG_CMD_CACHE -+#endif -+#endif -+ -+/* Save the env to the fat partition. */ -+#ifndef CONFIG_SPL_BUILD -+#undef CONFIG_ENV_IS_NOWHERE -+#undef CONFIG_ENV_IS_IN_NAND -+#undef CONFIG_ENV_IS_IN_MMC -+#define CONFIG_ENV_IS_IN_FAT -+#define CONFIG_FAT_WRITE -+#define FAT_ENV_INTERFACE "mmc" -+#define FAT_ENV_DEVICE_AND_PART "0" -+#define FAT_ENV_FILE "u-boot.env" -+#endif -+ -+/* Create a small(ish) boot environment for FreeBSD. */ -+#ifndef CONFIG_SPL_BUILD -+#undef CONFIG_EXTRA_ENV_SETTINGS -+#define CONFIG_EXTRA_ENV_SETTINGS \ -+ "loadaddr=88000000\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 omap4-duovero-parlor.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 -+ - #endif /* __CONFIG_DUOVERO_H */ Index: sysutils/u-boot-master/Makefile =================================================================== --- /dev/null +++ sysutils/u-boot-master/Makefile @@ -0,0 +1,82 @@ +# $FreeBSD$ +# +# Common infrastructure for u-boot ports +# + +NO_ARCH= yes + +# Sanity checks +.if !defined(MODEL) +IGNORE+= "MODEL is not defined" +.endif +.if !defined(BOARD_CONFIG) +IGNORE+= "BOARD_CONFIG is not defined" +.endif +.if !defined(FAMILY) +IGNORE+= "FAMILY is not defined" +.endif + +# Family overrides + +# Defines for OMAP family +UBOOT_PLIST_OMAP=u-boot.img MLO +UBOOT_VERSION_OMAP=2016.05 + +# Uboot variables +.if !defined(UBOOT_VERSION) && defined(UBOOT_VERSION_${FAMILY:tu}) +UBOOT_VERSION=${UBOOT_VERSION_${FAMILY:tu}} +.endif +UBOOT_VERSION?= 2016.05 + +.if !defined(UBOOT_PLIST) && defined(UBOOT_PLIST_${FAMILY:tu}) +UBOOT_PLIST=${UBOOT_PLIST_${FAMILY:tu}} +.endif +UBOOT_PLIST?=u-boot.img + +.if !defined(UBOOT_ARCH) && defined(UBOOT_ARCH_${FAMILY:tu}) +UBOOT_ARCH=${UBOOT_ARCH_${FAMILY:tu}} +.endif +UBOOT_ARCH?= arm + +# More conventional stuff +PORTNAME= u-boot +PORTVERSION= ${UBOOT_VERSION} +DISTVERSIONPREFIX= ports-v +CATEGORIES= sysutils +PKGNAMESUFFIX?= -${MODEL} + +MAINTAINER= imp@FreeBSD.org +COMMENT= Cross-build das u-boot for ${MODEL} + +LICENSE= GPLv2 + +USES= gmake + +USE_GITHUB= yes +GH_ACCOUNT= bsdimp +GH_PROJECT= u-boot + +SSP_UNSAFE= yes +UBOOT_DIR= share/u-boot/${PORTNAME}${PKGNAMESUFFIX} +DATADIR= ${PREFIX}/${UBOOT_DIR} +DESCR?= ${.CURDIR}/pkg-descr + +MAKE_ARGS+= ARCH=${UBOOT_ARCH} CROSS_COMPILE=${UBOOT_ARCH}-none-eabi- + +# Each u-boot family has different files to include, bring them in. +.for i in ${UBOOT_PLIST} +PLIST_FILES+= ${UBOOT_DIR}/${i} +.endfor +PLIST_FILES+= ${UBOOT_DIR}/README + +do-configure: + (cd ${WRKSRC}; ${SETENV} ${CONFIGURE_ENV} ${MAKE_CMD} ${BOARD_CONFIG}) + +do-install: + ${MKDIR} ${STAGEDIR}/${DATADIR} +.for i in ${UBOOT_PLIST} + ${INSTALL_DATA} ${WRKSRC}/${i} ${STAGEDIR}/${DATADIR} +.endfor + ${INSTALL_DATA} ${DESCR} ${STAGEDIR}/${DATADIR}/README + +.include Index: sysutils/u-boot-master/distinfo =================================================================== --- /dev/null +++ sysutils/u-boot-master/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1476745087 +SHA256 (bsdimp-u-boot-ports-v2016.05_GH0.tar.gz) = aa9dfb1167398dc7e649f7a9062f628a6bbe89f018a6b1ab856a8a8cd81c8ac0 +SIZE (bsdimp-u-boot-ports-v2016.05_GH0.tar.gz) = 14363966 Index: sysutils/u-boot-pandaboard/Makefile =================================================================== --- sysutils/u-boot-pandaboard/Makefile +++ sysutils/u-boot-pandaboard/Makefile @@ -1,42 +1,10 @@ # $FreeBSD$ -PORTNAME= u-boot -PORTVERSION= 2014.10 -CATEGORIES= sysutils -MASTER_SITES= ftp://ftp.denx.de/pub/u-boot/ -PKGNAMESUFFIX= -pandaboard +MAINTAINER= imp@FreeBSD.org +MASTERDIR= ${.CURDIR}/../u-boot-master -MAINTAINER= ian@FreeBSD.org -COMMENT= Cross-build U-Boot loader for PandaBoard +MODEL= pandaboard +BOARD_CONFIG= omap4_panda_config +FAMILY= omap -LICENSE= GPLv2 - -BUILD_DEPENDS= ${CROSS_GCC}:devel/arm-none-eabi-gcc492 - -CROSS_GCC= arm-none-eabi-gcc-4.9.2 - -NO_ARCH= yes - -WRKSRC= ${WRKDIR}/u-boot-${PORTVERSION} -USES= gmake tar:bzip2 -SSP_UNSAFE= yes # cross-LD does not support -fstack-protector - -U_BOOT_DIR= share/u-boot/${PORTNAME}${PKGNAMESUFFIX} -PLIST_FILES= ${U_BOOT_DIR}/u-boot.img \ - ${U_BOOT_DIR}/MLO \ - ${U_BOOT_DIR}/README - -MAKE_ARGS+= ARCH=arm \ - CC=${CROSS_GCC} \ - CROSS_COMPILE=arm-none-eabi- - -do-configure: - (cd ${WRKSRC}; ${MAKE_CMD} omap4_panda_config) - -do-install: - ${MKDIR} ${STAGEDIR}/${PREFIX}/${U_BOOT_DIR} - ${INSTALL_DATA} ${WRKSRC}/MLO ${STAGEDIR}/${PREFIX}/${U_BOOT_DIR} - ${INSTALL_DATA} ${WRKSRC}/u-boot.img ${STAGEDIR}/${PREFIX}/${U_BOOT_DIR} - ${INSTALL_DATA} ${DESCR} ${STAGEDIR}/${PREFIX}/${U_BOOT_DIR}/README - -.include +.include "${MASTERDIR}/Makefile" Index: sysutils/u-boot-pandaboard/distinfo =================================================================== --- sysutils/u-boot-pandaboard/distinfo +++ /dev/null @@ -1,2 +0,0 @@ -SHA256 (u-boot-2014.10.tar.bz2) = d3b132a7a9b3f3182b7aad71c2dfbd4fc15bea83e12c76134eb3ffefc07d1c71 -SIZE (u-boot-2014.10.tar.bz2) = 10217685 Index: sysutils/u-boot-pandaboard/files/patch-api_api.c =================================================================== --- sysutils/u-boot-pandaboard/files/patch-api_api.c +++ /dev/null @@ -1,79 +0,0 @@ ---- api/api.c.orig 2014-10-14 08:47:15 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; - } - - /* Index: sysutils/u-boot-pandaboard/files/patch-api_api__storage.c =================================================================== --- sysutils/u-boot-pandaboard/files/patch-api_api__storage.c +++ /dev/null @@ -1,28 +0,0 @@ ---- api/api_storage.c.orig 2014-10-14 08:47:15 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; Index: sysutils/u-boot-pandaboard/files/patch-common_cmd__elf.c =================================================================== --- sysutils/u-boot-pandaboard/files/patch-common_cmd__elf.c +++ /dev/null @@ -1,29 +0,0 @@ ---- common/cmd_elf.c.orig 2014-10-14 08:47:15 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; - } - Index: sysutils/u-boot-pandaboard/files/patch-common_cmd__test.c =================================================================== --- sysutils/u-boot-pandaboard/files/patch-common_cmd__test.c +++ /dev/null @@ -1,19 +0,0 @@ ---- common/cmd_test.c.orig 2014-10-14 08:47:15 UTC -+++ common/cmd_test.c -@@ -65,9 +65,14 @@ static int do_test(cmd_tbl_t *cmdtp, int - char * const *ap; - int i, op, left, adv, expr, last_expr, last_unop, last_binop; - -- /* 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 - { Index: sysutils/u-boot-pandaboard/files/patch-drivers_mmc_mmc.c =================================================================== --- sysutils/u-boot-pandaboard/files/patch-drivers_mmc_mmc.c +++ /dev/null @@ -1,80 +0,0 @@ ---- drivers/mmc/mmc.c.orig 2014-10-14 08:47:15 UTC -+++ drivers/mmc/mmc.c -@@ -20,6 +20,7 @@ - - static struct list_head mmc_devices; - static int cur_dev_num = -1; -+static int mmc_error_print_max = -1; - - __weak int board_mmc_getwp(struct mmc *mmc) - { -@@ -1270,9 +1271,14 @@ void mmc_destroy(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 -@@ -1297,7 +1303,7 @@ int mmc_start_init(struct mmc *mmc) - err = mmc->cfg->ops->init(mmc); - - if (err) -- return err; -+ goto done; - - mmc_set_bus_width(mmc, 1); - mmc_set_clock(mmc, 1); -@@ -1306,7 +1312,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; -@@ -1323,15 +1329,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; - } - Index: sysutils/u-boot-pandaboard/files/patch-include_configs_omap4__panda.h =================================================================== --- sysutils/u-boot-pandaboard/files/patch-include_configs_omap4__panda.h +++ /dev/null @@ -1,78 +0,0 @@ ---- include/configs/omap4_panda.h.orig 2014-10-14 08:47:15 UTC -+++ include/configs/omap4_panda.h -@@ -47,4 +47,75 @@ - - #define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG - -+/***************************************************************************** -+ * FreeBSD customizations from here down. -+ ****************************************************************************/ -+ -+#define CONFIG_SYS_DCACHE_OFF -+ -+/* Add the API and ELF features needed for ubldr. */ -+#ifndef CONFIG_SPL_BUILD -+#define CONFIG_API -+#define CONFIG_CMD_ELF -+#define CONFIG_CMD_ENV_EXISTS -+#define CONFIG_EFI_PARTITION -+#define CONFIG_SYS_MMC_MAX_DEVICE 2 -+#ifndef CONFIG_SYS_DCACHE_OFF -+#define CONFIG_CMD_CACHE -+#endif -+#endif -+ -+/* Save the env to the fat partition. */ -+#ifndef CONFIG_SPL_BUILD -+#undef CONFIG_ENV_IS_NOWHERE -+#undef CONFIG_ENV_IS_IN_NAND -+#undef CONFIG_ENV_IS_IN_MMC -+#define CONFIG_ENV_IS_IN_FAT -+#define CONFIG_FAT_WRITE -+#define FAT_ENV_INTERFACE "mmc" -+#define FAT_ENV_DEVICE_AND_PART "0" -+#define FAT_ENV_FILE "u-boot.env" -+#endif -+ -+/* Create a small(ish) boot environment for FreeBSD. */ -+#ifndef CONFIG_SPL_BUILD -+#undef CONFIG_EXTRA_ENV_SETTINGS -+#define CONFIG_EXTRA_ENV_SETTINGS \ -+ "loadaddr=88000000\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 omap4-panda.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 -+ - #endif /* __CONFIG_PANDA_H */