Index: head/sysutils/u-boot-rpi/Makefile =================================================================== --- head/sysutils/u-boot-rpi/Makefile (revision 400050) +++ head/sysutils/u-boot-rpi/Makefile (revision 400051) @@ -1,65 +1,54 @@ # $FreeBSD$ PORTNAME= u-boot -PORTVERSION= 2013.01 -PORTREVISION= 2 +PORTVERSION= 2015.10 CATEGORIES= sysutils -MASTER_SITES= LOCAL/ian/:bootfiles +MASTER_SITES= ftp://ftp.denx.de/pub/u-boot/ \ + LOCAL/ian/:bootfiles PKGNAMESUFFIX= -rpi DISTFILES= ${DISTNAME}${EXTRACT_SUFX} \ rpi-boot-files-2014.10_2.tar.bz2:bootfiles MAINTAINER= ian@FreeBSD.org COMMENT= Cross-build U-Boot loader for Raspberry Pi LICENSE= GPLv2 -BUILD_DEPENDS= ${CROSS_GCC}:${PORTSDIR}/devel/arm-none-eabi-gcc492 \ - gsed:${PORTSDIR}/textproc/gsed +BUILD_DEPENDS= arm-none-eabi-gcc:${PORTSDIR}/devel/arm-none-eabi-gcc -CROSS_GCC= arm-none-eabi-gcc-4.9.2 - -USE_GITHUB= yes -GH_ACCOUNT= gonzoua -GH_PROJECT= u-boot-pi -GH_TAGNAME= 6709570 - NO_ARCH= yes -USES= gmake -SSP_UNSAFE= yes # cross-build static linking dies with -fstack-protector +USES= gmake tar:bzip2 +SSP_UNSAFE= yes # cross-LD does not support -fstack-protector WRK_BOOTFILES= ${WRKDIR}/rpi-boot-files U_BOOT_DIR= share/u-boot/${PORTNAME}${PKGNAMESUFFIX} PLIST_FILES= ${U_BOOT_DIR}/u-boot.img \ ${U_BOOT_DIR}/LICENCE.broadcom \ ${U_BOOT_DIR}/README \ ${U_BOOT_DIR}/bootcode.bin \ ${U_BOOT_DIR}/config.txt \ ${U_BOOT_DIR}/fixup.dat \ ${U_BOOT_DIR}/fixup_cd.dat \ ${U_BOOT_DIR}/start.elf \ ${U_BOOT_DIR}/start_cd.elf MAKE_ARGS+= ARCH=arm \ - CROSS_COMPILE=arm-none-eabi- \ - HOSTCC=cc \ - CC=${CROSS_GCC} \ - SED=gsed + CROSS_COMPILE=arm-none-eabi- do-configure: - (cd ${WRKSRC}; ${GMAKE} ${MAKE_ARGS} rpi_b_config) + (cd ${WRKSRC}; ${GMAKE} rpi_defconfig) # The output of the u-boot build process is u-boot.bin. We have to put a # standard (for the RPi) image header on the front of it, and the resulting # file is named u-boot.img. Also copy the entire contents of the bootfiles # distribution (these are proprietary binary files required to boot). IMGFILE=${STAGEDIR}/${PREFIX}/${U_BOOT_DIR}/u-boot.img do-install: ${MKDIR} ${STAGEDIR}/${PREFIX}/${U_BOOT_DIR} ${GZCAT} ${FILESDIR}/imgprefix.bin.gz >${IMGFILE} ${CAT} ${WRKSRC}/u-boot.bin >>${IMGFILE} ${CP} ${WRK_BOOTFILES}/* ${STAGEDIR}/${PREFIX}/${U_BOOT_DIR}/ .include Index: head/sysutils/u-boot-rpi/distinfo =================================================================== --- head/sysutils/u-boot-rpi/distinfo (revision 400050) +++ head/sysutils/u-boot-rpi/distinfo (revision 400051) @@ -1,4 +1,4 @@ -SHA256 (gonzoua-u-boot-pi-2013.01-6709570_GH0.tar.gz) = e6c196eda2de36dce313c876f41ffa0f8353273e89c2e33382f303019fd73383 -SIZE (gonzoua-u-boot-pi-2013.01-6709570_GH0.tar.gz) = 13850358 +SHA256 (u-boot-2015.10.tar.bz2) = bdc68d5f9455ad933b059c735d983f2c8b6b552dafb062e5ff1444f623021955 +SIZE (u-boot-2015.10.tar.bz2) = 10416503 SHA256 (rpi-boot-files-2014.10_2.tar.bz2) = bcaa493d3585151fde755245bee44b7d30d0e9c7ec9cc7f4dccdad57caf18cdc SIZE (rpi-boot-files-2014.10_2.tar.bz2) = 1893216 Index: head/sysutils/u-boot-rpi/files/patch-include_configs_rpi__b.h =================================================================== --- head/sysutils/u-boot-rpi/files/patch-include_configs_rpi__b.h (revision 400050) +++ head/sysutils/u-boot-rpi/files/patch-include_configs_rpi__b.h (nonexistent) @@ -1,67 +0,0 @@ ---- include/configs/rpi_b.h.orig 2012-11-28 01:28:06 UTC -+++ include/configs/rpi_b.h -@@ -183,4 +183,64 @@ - #define CONFIG_INITRD_TAG - #define CONFIG_CMD_BMP - -+/***************************************************************************** -+ * FreeBSD customizations from here down. -+ ****************************************************************************/ -+ -+//#define CONFIG_API -+//#define CONFIG_CMD_ELF -+#define CONFIG_CMD_ENV_EXISTS -+#define CONFIG_EFI_PARTITION -+#define CONFIG_PREBOOT -+ -+/* Save the env to the fat partition. */ -+#undef CONFIG_ENV_IS_NOWHERE -+#define CONFIG_ENV_IS_IN_FAT -+#define CONFIG_FAT_WRITE -+#define FAT_ENV_INTERFACE "mmc" -+#define FAT_ENV_DEVICE 0 -+#define FAT_ENV_PART 1 -+#define FAT_ENV_FILE "u-boot.env" -+#define CONFIG_CMD_SAVEENV -+ -+/* Create a small(ish) boot environment for FreeBSD. */ -+#undef CONFIG_EXTRA_ENV_SETTINGS -+#define CONFIG_EXTRA_ENV_SETTINGS \ -+ "loadaddr=0x02000000\0" \ -+ "stdin=serial\0" \ -+ "stderr=serial,lcd\0" \ -+ "stdout=serial,lcd\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 ethact || usb start; " \ -+ "env exists loaderdev || env set loaderdev net; " \ -+ "env exists UserNetboot && run UserNetboot; " \ -+ "dhcp ${loadaddr} ${bootfile} && bootelf; " \ -+ "\0" \ -+ "Preboot=" \ -+ "fdt addr 0x100; " \ -+ "env exists bootfile || bootfile=ubldr; " \ -+ "env exists uenv_file || uenv_file=uEnv.txt; " \ -+ "env exists SetupFatdev && run SetupFatdev; " \ -+ "env exists SetupUenv && run SetupUenv; " \ -+ "env exists UserPreboot && run UserPreboot; " \ -+ "\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 Property changes on: head/sysutils/u-boot-rpi/files/patch-include_configs_rpi__b.h ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -t \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/sysutils/u-boot-rpi/files/patch-config.mk =================================================================== --- head/sysutils/u-boot-rpi/files/patch-config.mk (revision 400050) +++ head/sysutils/u-boot-rpi/files/patch-config.mk (nonexistent) @@ -1,11 +0,0 @@ ---- config.mk.orig 2012-11-28 01:28:06 UTC -+++ config.mk -@@ -90,7 +90,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) Property changes on: head/sysutils/u-boot-rpi/files/patch-config.mk ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -t \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/sysutils/u-boot-rpi/files/patch-common_cmd__nvedit.c =================================================================== --- head/sysutils/u-boot-rpi/files/patch-common_cmd__nvedit.c (revision 400050) +++ head/sysutils/u-boot-rpi/files/patch-common_cmd__nvedit.c (nonexistent) @@ -1,46 +0,0 @@ ---- common/cmd_nvedit.c.orig 2012-11-28 01:28:06 UTC -+++ common/cmd_nvedit.c -@@ -966,6 +966,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); -+ -+ return (ep == NULL) ? 1 : 0; -+} -+#endif -+ - /* - * New command line interface: "env" command with subcommands - */ -@@ -995,6 +1012,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) -@@ -1033,6 +1053,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 Property changes on: head/sysutils/u-boot-rpi/files/patch-common_cmd__nvedit.c ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -t \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/sysutils/u-boot-rpi/files/patch-api_api.c =================================================================== --- head/sysutils/u-boot-rpi/files/patch-api_api.c (revision 400050) +++ head/sysutils/u-boot-rpi/files/patch-api_api.c (revision 400051) @@ -1,79 +1,79 @@ ---- api/api.c.orig 2012-11-28 01:28:06 UTC +--- api/api.c.orig 2015-10-19 23:59:38 UTC +++ api/api.c -@@ -512,45 +512,47 @@ static int API_env_set(va_list ap) +@@ -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) { ++ 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: head/sysutils/u-boot-rpi/files/patch-arch_arm_cpu_arm11_cpu.c =================================================================== --- head/sysutils/u-boot-rpi/files/patch-arch_arm_cpu_arm11_cpu.c (nonexistent) +++ head/sysutils/u-boot-rpi/files/patch-arch_arm_cpu_arm11_cpu.c (revision 400051) @@ -0,0 +1,17 @@ +--- arch/arm/cpu/arm11/cpu.c.orig 2015-10-19 23:59:38 UTC ++++ arch/arm/cpu/arm11/cpu.c +@@ -52,6 +52,14 @@ static void cache_flush(void) + asm volatile("mcr p15, 0, %0, c7, c10, 4" : : "r" (i)); + } + ++void invalidate_icache_all(void) ++{ ++ /* invalidate entire icache and btb */ ++ asm volatile("mcr p15, 0, %0, c7, c5, 0" : : "r" (0)); ++ /* mem barrier to sync things */ ++ asm volatile("mcr p15, 0, %0, c7, c10, 4" : : "r" (0)); ++} ++ + #ifndef CONFIG_SYS_DCACHE_OFF + + #ifndef CONFIG_SYS_CACHELINE_SIZE Property changes on: head/sysutils/u-boot-rpi/files/patch-arch_arm_cpu_arm11_cpu.c ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/sysutils/u-boot-rpi/files/patch-common_cmd__boot.c =================================================================== --- head/sysutils/u-boot-rpi/files/patch-common_cmd__boot.c (nonexistent) +++ head/sysutils/u-boot-rpi/files/patch-common_cmd__boot.c (revision 400051) @@ -0,0 +1,18 @@ +--- common/cmd_boot.c.orig 2015-10-19 23:59:38 UTC ++++ common/cmd_boot.c +@@ -19,6 +19,15 @@ __attribute__((weak)) + unsigned long do_go_exec(ulong (*entry)(int, char * const []), int argc, + char * const argv[]) + { ++ /* ++ * 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 invalidate the icache (because we DMA'd new data into that ++ * memory recently) and launch the program directly. ++ */ ++ flush_dcache_all(); ++ invalidate_icache_all(); + return entry (argc, argv); + } + Property changes on: head/sysutils/u-boot-rpi/files/patch-common_cmd__boot.c ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/sysutils/u-boot-rpi/files/patch-common_cmd__elf.c =================================================================== --- head/sysutils/u-boot-rpi/files/patch-common_cmd__elf.c (nonexistent) +++ head/sysutils/u-boot-rpi/files/patch-common_cmd__elf.c (revision 400051) @@ -0,0 +1,32 @@ +--- common/cmd_elf.c.orig 2015-10-19 23:59:38 UTC ++++ common/cmd_elf.c +@@ -35,22 +35,15 @@ static unsigned long do_bootelf_exec(ulo + 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 invalidate the icache (because we DMA'd new data into that ++ * memory recently) and launch the program directly. + */ ++ flush_dcache_all(); ++ invalidate_icache_all(); + ret = entry(argc, argv); +- +- if (dcache) +- dcache_enable(); +- + return ret; + } + Property changes on: head/sysutils/u-boot-rpi/files/patch-common_cmd__elf.c ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/sysutils/u-boot-rpi/files/patch-common_cmd__test.c =================================================================== --- head/sysutils/u-boot-rpi/files/patch-common_cmd__test.c (revision 400050) +++ head/sysutils/u-boot-rpi/files/patch-common_cmd__test.c (revision 400051) @@ -1,19 +1,19 @@ ---- common/cmd_test.c.orig 2012-11-28 01:28:06 UTC +--- common/cmd_test.c.orig 2015-10-19 23:59:38 UTC +++ common/cmd_test.c -@@ -29,9 +29,14 @@ static int do_test(cmd_tbl_t *cmdtp, int +@@ -56,9 +56,14 @@ static int do_test(cmd_tbl_t *cmdtp, int char * const *ap; - int left, adv, expr, last_expr, neg, last_cmp; + 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: head/sysutils/u-boot-rpi/files/patch-include_configs_rpi-common.h =================================================================== --- head/sysutils/u-boot-rpi/files/patch-include_configs_rpi-common.h (nonexistent) +++ head/sysutils/u-boot-rpi/files/patch-include_configs_rpi-common.h (revision 400051) @@ -0,0 +1,59 @@ +--- include/configs/rpi-common.h.orig 2015-10-19 23:59:38 UTC ++++ include/configs/rpi-common.h +@@ -183,4 +183,56 @@ + + #define CONFIG_BOOTDELAY 2 + ++/***************************************************************************** ++ * FreeBSD customizations from here down. ++ ****************************************************************************/ ++ ++#define CONFIG_API ++#define CONFIG_CMD_ELF ++#define CONFIG_EFI_PARTITION ++#define CONFIG_PREBOOT ++ ++#define CONFIG_SYS_MMC_MAX_DEVICE 1 ++ ++/* Create a small(ish) boot environment for FreeBSD. */ ++#undef CONFIG_EXTRA_ENV_SETTINGS ++#define CONFIG_EXTRA_ENV_SETTINGS \ ++ ENV_MEM_LAYOUT_SETTINGS \ ++ "stdin=serial,lcd\0" \ ++ "stderr=serial,lcd\0" \ ++ "stdout=serial,lcd\0" \ ++ \ ++ "Fatboot=" \ ++ "env exists bootfile || bootfile=ubldr.bin; " \ ++ "env exists loaderdev || env set loaderdev ${fatdev}; " \ ++ "test ${loaderdev} = net && env exists SetupNetconfig && run SetupNetconfig; " \ ++ "echo Booting from: ${fatdev} ${bootfile}; " \ ++ "fatload ${fatdev} ${loadaddr} ${bootfile} && bootelf || go ${loadaddr}; " \ ++ "\0" \ ++ "Preboot=" \ ++ "fdt addr 0x100; " \ ++ "env exists uenv_file || uenv_file=uEnv.txt; " \ ++ "env exists SetupFatdev && run SetupFatdev; " \ ++ "env exists SetupUenv && run SetupUenv; " \ ++ "env exists UserPreboot && run UserPreboot; " \ ++ "\0" \ ++ "SetupFatdev=" \ ++ "env exists fatdev || fatdev='mmc 0'; " \ ++ "\0" \ ++ "SetupNetconfig=" \ ++ "env exists ethact || usb start; " \ ++ "env exists UserNetconfig && run UserNetconfig; " \ ++ "\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" ++ ++#define CONFIG_CMD_CACHE ++ + #endif Property changes on: head/sysutils/u-boot-rpi/files/patch-include_configs_rpi-common.h ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property