# This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # u-boot-pandaboard # u-boot-pandaboard/files # u-boot-pandaboard/files/patch-api_api.c # u-boot-pandaboard/files/patch-api_api__storage.c # u-boot-pandaboard/files/patch-common_cmd__elf.c # u-boot-pandaboard/files/patch-common_cmd__test.c # u-boot-pandaboard/files/patch-drivers_mmc_mmc.c # u-boot-pandaboard/files/patch-include_configs_omap4_panda.h # u-boot-pandaboard/Makefile # u-boot-pandaboard/distinfo # u-boot-pandaboard/pkg-descr # echo c - u-boot-pandaboard mkdir -p u-boot-pandaboard > /dev/null 2>&1 echo c - u-boot-pandaboard/files mkdir -p u-boot-pandaboard/files > /dev/null 2>&1 echo x - u-boot-pandaboard/files/patch-api_api.c sed 's/^X//' >u-boot-pandaboard/files/patch-api_api.c << '2bd7127e427212632344c62e9d5f2ad6' X--- api/api.c.orig 2014-10-14 08:47:15 UTC X+++ api/api.c X@@ -495,45 +495,47 @@ static int API_env_set(va_list ap) X */ X static int API_env_enum(va_list ap) X { X- int i, n; X- char *last, **next; X+ int i; X+ char *last, **next, *s; X+ ENTRY *match, search; X+ static char *buf; X X last = (char *)va_arg(ap, u_int32_t); X X if ((next = (char **)va_arg(ap, u_int32_t)) == NULL) X return API_EINVAL; X X- if (last == NULL) X- /* start over */ X- *next = ((char *)env_get_addr(0)); X- else { X- *next = last; X- X- for (i = 0; env_get_char(i) != '\0'; i = n + 1) { X- for (n = i; env_get_char(n) != '\0'; ++n) { X- if (n >= CONFIG_ENV_SIZE) { X- /* XXX shouldn't we set *next = NULL?? */ X- return 0; X- } X- } X- X- if (envmatch((uchar *)last, i) < 0) X- continue; X- X- /* try to get next name */ X- i = n + 1; X- if (env_get_char(i) == '\0') { X- /* no more left */ X- *next = NULL; X- return 0; X- } X- X- *next = ((char *)env_get_addr(i)); X- return 0; X+ /* X+ * This leverages realloc's behavior of growing but never shrinking the X+ * existing buffer. X+ */ X+ if (last == NULL) { X+ i = 0; X+ buf = realloc(buf, 512); /* Start with reasonable size buf. */ X+ } else { X+ buf = realloc(buf, strlen(last) + 1); X+ strcpy(buf, last); X+ if ((s = strchr(buf, '=')) != NULL) X+ *s = 0; X+ search.key = buf; X+ if ((i = hsearch_r(search, FIND, &match, &env_htab, 0)) == 0) { X+ i = API_EINVAL; X+ goto done; X } X } X X+ /* hmatch on empty string is effectively "get next entry after i". */ X+ if ((i = hmatch_r("", i, &match, &env_htab)) == 0) X+ goto done; X+ buf = realloc(buf, strlen(match->key) + strlen(match->data) + 2); X+ snprintf(buf, buflen, "%s=%s", match->key, match->data); X+ *next = buf; X return 0; X+done: X+ free(buf); X+ buf = NULL; X+ *next = NULL; X+ return i; X } X X /* 2bd7127e427212632344c62e9d5f2ad6 echo x - u-boot-pandaboard/files/patch-api_api__storage.c sed 's/^X//' >u-boot-pandaboard/files/patch-api_api__storage.c << '5171083a98c29b04b2953a1ac9b88347' X--- api/api_storage.c.orig 2014-10-14 08:47:15 UTC X+++ api/api_storage.c X@@ -107,10 +107,13 @@ static int dev_stor_get(int type, int fi X X if (first) { X di->cookie = (void *)get_dev(specs[type].name, 0); X- if (di->cookie == NULL) X+ if (di->cookie == NULL) { X return 0; X- else X+ } else { X found = 1; X+ if (specs[type].max_dev > 1) X+ *more = 1; X+ } X X } else { X for (i = 0; i < specs[type].max_dev; i++) X@@ -146,7 +149,8 @@ static int dev_stor_get(int type, int fi X dd = (block_dev_desc_t *)di->cookie; X if (dd->type == DEV_TYPE_UNKNOWN) { X debugf("device instance exists, but is not active.."); X- found = 0; X+ di->di_stor.block_count = 0; X+ di->di_stor.block_size = 0; X } else { X di->di_stor.block_count = dd->lba; X di->di_stor.block_size = dd->blksz; 5171083a98c29b04b2953a1ac9b88347 echo x - u-boot-pandaboard/files/patch-common_cmd__elf.c sed 's/^X//' >u-boot-pandaboard/files/patch-common_cmd__elf.c << '96624a56739458a76914cb388946342f' X--- common/cmd_elf.c.orig 2014-10-14 08:47:15 UTC X+++ common/cmd_elf.c X@@ -35,22 +35,12 @@ unsigned long do_bootelf_exec(ulong (*en X unsigned long ret; X X /* X- * QNX images require the data cache is disabled. X- * Data cache is already flushed, so just turn it off. X- */ X- int dcache = dcache_status(); X- if (dcache) X- dcache_disable(); X- X- /* X- * pass address parameter as argv[0] (aka command name), X- * and all remaining args X+ * FreeBSD wants the caches enabled while ubldr runs, and as of r276397 X+ * the kernel can tolerate being entered with internal (but not external X+ * PL310) caches enabled on armv6/7 systems. So don't disable caches X+ * here, just launch the program directly. X */ X ret = entry(argc, argv); X- X- if (dcache) X- dcache_enable(); X- X return ret; X } X 96624a56739458a76914cb388946342f echo x - u-boot-pandaboard/files/patch-common_cmd__test.c sed 's/^X//' >u-boot-pandaboard/files/patch-common_cmd__test.c << '81954b90efbb0a2c8f719e5c44aa3237' X--- common/cmd_test.c.orig 2014-10-14 08:47:15 UTC X+++ common/cmd_test.c X@@ -65,9 +65,14 @@ static int do_test(cmd_tbl_t *cmdtp, int X char * const *ap; X int i, op, left, adv, expr, last_expr, last_unop, last_binop; X X- /* args? */ X- if (argc < 3) X+ /* X+ * If no args, that's bogus, return false. X+ * If op is -z and no other args, answer is Yes, string is empty. X+ */ X+ if (argc < 2) X return 1; X+ else if (argc == 2) X+ return !(strcmp(argv[1], "-z") == 0); X X #ifdef DEBUG X { 81954b90efbb0a2c8f719e5c44aa3237 echo x - u-boot-pandaboard/files/patch-drivers_mmc_mmc.c sed 's/^X//' >u-boot-pandaboard/files/patch-drivers_mmc_mmc.c << '4dd56383f6b02291bc9c43910cb38c27' X--- drivers/mmc/mmc.c.orig 2014-10-14 08:47:15 UTC X+++ drivers/mmc/mmc.c X@@ -20,6 +20,7 @@ X X static struct list_head mmc_devices; X static int cur_dev_num = -1; X+static int mmc_error_print_max = -1; X X __weak int board_mmc_getwp(struct mmc *mmc) X { X@@ -1270,9 +1271,14 @@ void mmc_destroy(struct mmc *mmc) X block_dev_desc_t *mmc_get_dev(int dev) X { X struct mmc *mmc = find_mmc_device(dev); X- if (!mmc || mmc_init(mmc)) X+ if (!mmc) X return NULL; X X+ /* If mmc_init fails, mmc->block_dev will be of type X+ * DEV_TYPE_UNKNOWN with blksz and lba set to zero. X+ */ X+ mmc_init(mmc); X+ X return &mmc->block_dev; X } X #endif X@@ -1297,7 +1303,7 @@ int mmc_start_init(struct mmc *mmc) X err = mmc->cfg->ops->init(mmc); X X if (err) X- return err; X+ goto done; X X mmc_set_bus_width(mmc, 1); X mmc_set_clock(mmc, 1); X@@ -1306,7 +1312,7 @@ int mmc_start_init(struct mmc *mmc) X err = mmc_go_idle(mmc); X X if (err) X- return err; X+ goto done; X X /* The internal partition reset to user partition(0) at every CMD0*/ X mmc->part_num = 0; X@@ -1323,15 +1329,33 @@ int mmc_start_init(struct mmc *mmc) X X if (err && err != IN_PROGRESS) { X #if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT) X- printf("Card did not respond to voltage select!\n"); X+ if (mmc_error_print_max < 4) { X+ mmc_error_print_max++; X+ printf("Card did not respond to voltage select!\n"); X+ X+ if (mmc_error_print_max == 4) { X+ printf("Discarding further error messages\n"); X+ } X+ } X #endif X- return UNUSABLE_ERR; X+// return UNUSABLE_ERR; X+ goto done; X } X } X X if (err == IN_PROGRESS) X mmc->init_in_progress = 1; X X+done: X+ if (err) { X+ mmc->has_init = 0; X+ mmc->block_dev.type = DEV_TYPE_UNKNOWN; X+ mmc->block_dev.blksz = 0; X+ mmc->block_dev.lba = 0; X+ } else { X+ mmc->has_init = 1; X+ } X+ X return err; X } X 4dd56383f6b02291bc9c43910cb38c27 echo x - u-boot-pandaboard/files/patch-include_configs_omap4_panda.h sed 's/^X//' >u-boot-pandaboard/files/patch-include_configs_omap4_panda.h << 'ef6892e37838716788d11085d1a4a76f' X--- include/configs/omap4_panda.h.orig 2015-01-03 17:44:28.000000000 -0500 X+++ include/configs/omap4_panda.h 2015-01-04 09:54:40.000000000 -0500 X@@ -47,4 +47,76 @@ X X #define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG X X+/***************************************************************************** X+ * FreeBSD customizations from here down. X+ ****************************************************************************/ X+ X+#define CONFIG_SYS_DCACHE_OFF X+ X+/* Add the API and ELF features needed for ubldr. */ X+#ifndef CONFIG_SPL_BUILD X+#define CONFIG_API X+#define CONFIG_CMD_ELF X+#define CONFIG_CMD_ENV_EXISTS X+#define CONFIG_EFI_PARTITION X+#define CONFIG_SYS_MMC_MAX_DEVICE 2 X+#ifndef CONFIG_SYS_DCACHE_OFF X+#define CONFIG_CMD_CACHE X+#endif X+#endif X+ X+/* Save the env to the fat partition. */ X+#ifndef CONFIG_SPL_BUILD X+#undef CONFIG_ENV_IS_NOWHERE X+#undef CONFIG_ENV_IS_IN_NAND X+#undef CONFIG_ENV_IS_IN_MMC X+#define CONFIG_ENV_IS_IN_FAT X+#define CONFIG_FAT_WRITE X+#define FAT_ENV_INTERFACE "mmc" X+#define FAT_ENV_DEVICE_AND_PART "0" X+#define FAT_ENV_FILE "u-boot.env" X+#endif X+ X+/* Create a small(ish) boot environment for FreeBSD. */ X+#ifndef CONFIG_SPL_BUILD X+#undef CONFIG_EXTRA_ENV_SETTINGS X+#define CONFIG_EXTRA_ENV_SETTINGS \ X+ "loadaddr=88000000\0" \ X+ "Fatboot=" \ X+ "env exists loaderdev || env set loaderdev ${fatdev}; " \ X+ "env exists UserFatboot && run UserFatboot; " \ X+ "echo Booting from: ${fatdev} ${bootfile}; " \ X+ "fatload ${fatdev} ${loadaddr} ${bootfile} && bootelf; " \ X+ "\0" \ X+ "Netboot=" \ X+ "env exists loaderdev || env set loaderdev net; " \ X+ "env exists UserNetboot && run UserNetboot; " \ X+ "dhcp ${loadaddr} ${bootfile} && bootelf; " \ X+ "\0" \ X+ "Preboot=" \ X+ "env exists bootfile || bootfile=ubldr; " \ X+ "env exists uenv_file || uenv_file=uEnv.txt; " \ X+ "env exists SetupFdtfile && run SetupFdtfile; " \ X+ "env exists SetupFatdev && run SetupFatdev; " \ X+ "env exists SetupUenv && run SetupUenv; " \ X+ "env exists UserPreboot && run UserPreboot; " \ X+ "\0" \ X+ "SetupFdtfile=" \ X+ "env set fdt_file omap4-panda.dtb; " \ X+ "\0" \ X+ "SetupFatdev=" \ X+ "env exists fatdev || " \ X+ "fatsize ${fatdev:=mmc 0} ${bootfile}; " \ X+ "\0" \ X+ "SetupUenv=" \ X+ "fatload ${fatdev} ${loadaddr} ${uenv_file} && " \ X+ "env import -t ${loadaddr} ${filesize}; " \ X+ "\0" X+ X+#undef CONFIG_BOOTCOMMAND X+#define CONFIG_BOOTCOMMAND "run Fatboot" X+#undef CONFIG_PREBOOT X+#define CONFIG_PREBOOT "run Preboot" X+#endif X+ X #endif /* __CONFIG_PANDA_H */ ef6892e37838716788d11085d1a4a76f echo x - u-boot-pandaboard/Makefile sed 's/^X//' >u-boot-pandaboard/Makefile << 'a5283dc3db0f8acb9794fd0380489a93' X# $FreeBSD$ X XPORTNAME= u-boot XPORTVERSION= 2014.10 XPORTREVISION= 1 XCATEGORIES= sysutils XMASTER_SITES= ftp://ftp.denx.de/pub/u-boot/ XPKGNAMESUFFIX= -pandaboard X XMAINTAINER= ian@FreeBSD.org XCOMMENT= Cross-build U-Boot loader for PandaBoard X XLICENSE= GPLv2 X XBUILD_DEPENDS= arm-none-eabi-gcc:${PORTSDIR}/devel/arm-none-eabi-gcc X XNO_ARCH= yes X XWRKSRC= ${WRKDIR}/u-boot-${PORTVERSION} XUSES= gmake tar:bzip2 XSSP_UNSAFE= yes # cross-LD does not support -fstack-protector X XU_BOOT_DIR= share/u-boot/${PORTNAME}${PKGNAMESUFFIX} XPLIST_FILES= ${U_BOOT_DIR}/u-boot.img \ X ${U_BOOT_DIR}/MLO \ X ${U_BOOT_DIR}/README X XMAKE_ARGS+= ARCH=arm \ X CROSS_COMPILE=arm-none-eabi- X Xdo-configure: X (cd ${WRKSRC}; ${GMAKE} omap4_panda_config) X Xdo-install: X ${MKDIR} ${STAGEDIR}/${PREFIX}/${U_BOOT_DIR} X ${CP} ${WRKSRC}/MLO ${STAGEDIR}/${PREFIX}/${U_BOOT_DIR} X ${CP} ${WRKSRC}/u-boot.img ${STAGEDIR}/${PREFIX}/${U_BOOT_DIR}/u-boot.img X ${CP} ${.CURDIR}/pkg-descr ${STAGEDIR}/${PREFIX}/${U_BOOT_DIR}/README X X.include a5283dc3db0f8acb9794fd0380489a93 echo x - u-boot-pandaboard/distinfo sed 's/^X//' >u-boot-pandaboard/distinfo << '84d3c6a3fd72fad23335ab0befe59d27' XSHA256 (u-boot-2014.10.tar.bz2) = d3b132a7a9b3f3182b7aad71c2dfbd4fc15bea83e12c76134eb3ffefc07d1c71 XSIZE (u-boot-2014.10.tar.bz2) = 10217685 84d3c6a3fd72fad23335ab0befe59d27 echo x - u-boot-pandaboard/pkg-descr sed 's/^X//' >u-boot-pandaboard/pkg-descr << '4ba576c536e24f8231547b3e233afa9d' XU-Boot loader for PandaBoard. X XTo install this bootloader, copy the files MLO and u-boot.img to the FAT Xpartition on an SD card. Normally this is partition 1, but different Xpartitions can be set with U-Boot environment variables. X XThis version is patched so that: X * ELF and API features are enabled. X * The default environment is trimmed to just what's needed to boot. X * The saveenv command writes to the file uboot.env on the FAT partition. X * The DTB file name is passed to ubldr using the fdtfile env variable. X It defaults to omap4-panda.dtb unless you override it. ubldr loads X the DTB from /boot/dtb/ on the FreeBSD partition. X (Not tested) X * By default, it loads ELF ubldr from file ubldr on the FAT partition X to address 0x88000000, and launches it. X XFor information about running FreeBSD on the PandaBoard, see X https://wiki.freebsd.org/FreeBSD/arm/PandaBoard X XFor general information about U-Boot see WWW: http://www.denx.de/wiki/U-Boot 4ba576c536e24f8231547b3e233afa9d exit