aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbrd <brd@FreeBSD.org>2016-07-13 01:04:18 +0800
committerbrd <brd@FreeBSD.org>2016-07-13 01:04:18 +0800
commit33c0736394f1ab00599cdd3c643db193ab2a39a9 (patch)
tree849c8d4612d4b91779b51fa3cf1fb9fc70c54b52
parent2429d446d3120bb913442087cab59dd7046ce9c6 (diff)
downloadfreebsd-ports-gnome-33c0736394f1ab00599cdd3c643db193ab2a39a9.tar.gz
freebsd-ports-gnome-33c0736394f1ab00599cdd3c643db193ab2a39a9.tar.zst
freebsd-ports-gnome-33c0736394f1ab00599cdd3c643db193ab2a39a9.zip
Add sysutils/u-boot-sinovoip-bpi-m3
Submitted by: jmcneill Approved by: bdrewery (implicit)
-rw-r--r--sysutils/Makefile1
-rw-r--r--sysutils/u-boot-sinovoip-bpi-m3/Makefile53
-rw-r--r--sysutils/u-boot-sinovoip-bpi-m3/distinfo3
-rw-r--r--sysutils/u-boot-sinovoip-bpi-m3/files/patch-api_api.c81
-rw-r--r--sysutils/u-boot-sinovoip-bpi-m3/files/patch-api_api__net.c11
-rw-r--r--sysutils/u-boot-sinovoip-bpi-m3/files/patch-board_sunxi_board.c13
-rw-r--r--sysutils/u-boot-sinovoip-bpi-m3/files/patch-cmd_elf.c29
-rw-r--r--sysutils/u-boot-sinovoip-bpi-m3/files/patch-cmd_test.c19
-rw-r--r--sysutils/u-boot-sinovoip-bpi-m3/files/patch-configs_Sinovoip__BPI__M3__defconfig14
-rw-r--r--sysutils/u-boot-sinovoip-bpi-m3/files/patch-drivers_mmc_mmc.c78
-rw-r--r--sysutils/u-boot-sinovoip-bpi-m3/files/patch-drivers_power_Kconfig16
-rw-r--r--sysutils/u-boot-sinovoip-bpi-m3/files/patch-drivers_power_axp818.c24
-rw-r--r--sysutils/u-boot-sinovoip-bpi-m3/files/patch-include_axp818.h10
-rw-r--r--sysutils/u-boot-sinovoip-bpi-m3/files/patch-include_axp__pmic.h10
-rw-r--r--sysutils/u-boot-sinovoip-bpi-m3/files/patch-include_configs_sunxi-common.h78
-rw-r--r--sysutils/u-boot-sinovoip-bpi-m3/pkg-descr19
16 files changed, 459 insertions, 0 deletions
diff --git a/sysutils/Makefile b/sysutils/Makefile
index 1676d87d1d72..2a643a76a74c 100644
--- a/sysutils/Makefile
+++ b/sysutils/Makefile
@@ -1098,6 +1098,7 @@
SUBDIR += u-boot-pine64
SUBDIR += u-boot-rpi
SUBDIR += u-boot-rpi2
+ SUBDIR += u-boot-sinovoip-bpi-m3
SUBDIR += u-boot-utilite
SUBDIR += u-boot-wandboard
SUBDIR += ua
diff --git a/sysutils/u-boot-sinovoip-bpi-m3/Makefile b/sysutils/u-boot-sinovoip-bpi-m3/Makefile
new file mode 100644
index 000000000000..c48e607992f1
--- /dev/null
+++ b/sysutils/u-boot-sinovoip-bpi-m3/Makefile
@@ -0,0 +1,53 @@
+# $FreeBSD$
+
+PORTNAME= u-boot
+PORTVERSION= 2016.05
+CATEGORIES= sysutils
+MASTER_SITES= ftp://ftp.denx.de/pub/u-boot/
+PKGNAMESUFFIX?= -sinovoip-bpi-m3
+
+MAINTAINER= jmcneill@FreeBSD.org
+COMMENT= Cross-build U-Boot loader for Sinovoip Banana Pi M3
+
+LICENSE= GPLv2
+
+BUILD_DEPENDS= arm-none-eabi-gcc:devel/arm-none-eabi-gcc
+
+USES= gmake tar:bzip2
+WRKSRC= ${WRKDIR}/u-boot-${DISTVERSION}
+
+.include <bsd.port.pre.mk>
+NO_ARCH= yes
+.if ${OSVERSION} < 1001000
+IGNORE= requires dtc
+.endif
+
+MODEL?= sinovoip-bpi-m3
+CONF_TARGET?= Sinovoip_BPI_M3_defconfig
+
+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}/u-boot-sunxi-with-spl.bin \
+ ${U_BOOT_DIR}/sunxi-spl.bin \
+ ${U_BOOT_DIR}/README
+
+MAKE_ARGS+= ARCH=arm \
+ CROSS_COMPILE=arm-none-eabi-
+
+post-patch:
+ @${REINPLACE_CMD} -e "s,%%MODEL%%,${MODEL}," \
+ ${WRKSRC}/include/configs/sunxi-common.h
+
+do-configure:
+ (cd ${WRKSRC}; ${GMAKE} ${CONF_TARGET})
+
+do-install:
+ ${MKDIR} ${STAGEDIR}/${PREFIX}/${U_BOOT_DIR}
+ ${CP} ${WRKSRC}/spl/sunxi-spl.bin ${STAGEDIR}/${PREFIX}/${U_BOOT_DIR}
+ ${CP} ${WRKSRC}/u-boot-sunxi-with-spl.bin ${STAGEDIR}/${PREFIX}/${U_BOOT_DIR}
+ ${CP} ${WRKSRC}/u-boot.img ${STAGEDIR}/${PREFIX}/${U_BOOT_DIR}
+ ${CP} ${.CURDIR}/pkg-descr ${STAGEDIR}/${PREFIX}/${U_BOOT_DIR}/README
+
+.include <bsd.port.post.mk>
diff --git a/sysutils/u-boot-sinovoip-bpi-m3/distinfo b/sysutils/u-boot-sinovoip-bpi-m3/distinfo
new file mode 100644
index 000000000000..ad6ab6f6e838
--- /dev/null
+++ b/sysutils/u-boot-sinovoip-bpi-m3/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1467921377
+SHA256 (u-boot-2016.05.tar.bz2) = 87d02275615aaf0cd007b54cbe9fbadceef2bee7c79e6c323ea1ae8956dcb171
+SIZE (u-boot-2016.05.tar.bz2) = 11325053
diff --git a/sysutils/u-boot-sinovoip-bpi-m3/files/patch-api_api.c b/sysutils/u-boot-sinovoip-bpi-m3/files/patch-api_api.c
new file mode 100644
index 000000000000..4eb4fed747dc
--- /dev/null
+++ b/sysutils/u-boot-sinovoip-bpi-m3/files/patch-api_api.c
@@ -0,0 +1,81 @@
+--- api/api.c.orig 2016-04-12 02:22:25 UTC
++++ api/api.c
+@@ -495,45 +495,49 @@ 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;
++ size_t buflen;
+
+ 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;
++ buflen = strlen(match->key) + strlen(match->data) + 2;
++ buf = realloc(buf, buflen);
++ snprintf(buf, buflen, "%s=%s", match->key, match->data);
++ *next = buf;
+ return 0;
++done:
++ free(buf);
++ buf = NULL;
++ *next = NULL;
++ return i;
+ }
+
+ /*
diff --git a/sysutils/u-boot-sinovoip-bpi-m3/files/patch-api_api__net.c b/sysutils/u-boot-sinovoip-bpi-m3/files/patch-api_api__net.c
new file mode 100644
index 000000000000..fbe964d69993
--- /dev/null
+++ b/sysutils/u-boot-sinovoip-bpi-m3/files/patch-api_api__net.c
@@ -0,0 +1,11 @@
+--- api/api_net.c.orig 2016-04-12 02:22:25 UTC
++++ api/api_net.c
+@@ -25,7 +25,7 @@ DECLARE_GLOBAL_DATA_PTR;
+
+ #define errf(fmt, args...) do { printf("ERROR @ %s(): ", __func__); printf(fmt, ##args); } while (0)
+
+-#ifdef CONFIG_CMD_NET
++#if defined(CONFIG_CMD_NET) && !defined(CONFIG_DM_ETH)
+
+ static int dev_valid_net(void *cookie)
+ {
diff --git a/sysutils/u-boot-sinovoip-bpi-m3/files/patch-board_sunxi_board.c b/sysutils/u-boot-sinovoip-bpi-m3/files/patch-board_sunxi_board.c
new file mode 100644
index 000000000000..d7d9b11018ee
--- /dev/null
+++ b/sysutils/u-boot-sinovoip-bpi-m3/files/patch-board_sunxi_board.c
@@ -0,0 +1,13 @@
+--- board/sunxi/board.c.orig 2016-04-12 02:22:25 UTC
++++ board/sunxi/board.c
+@@ -524,6 +524,10 @@ void sunxi_board_init(void)
+ power_failed |= axp_set_fldo(2, CONFIG_AXP_FLDO2_VOLT);
+ power_failed |= axp_set_fldo(3, CONFIG_AXP_FLDO3_VOLT);
+ #endif
++
++#ifdef CONFIG_AXP818_POWER
++ power_failed |= axp_set_dc1sw(CONFIG_AXP_DC1SW_EN);
++#endif
+ #endif
+ printf("DRAM:");
+ ramsize = sunxi_dram_init();
diff --git a/sysutils/u-boot-sinovoip-bpi-m3/files/patch-cmd_elf.c b/sysutils/u-boot-sinovoip-bpi-m3/files/patch-cmd_elf.c
new file mode 100644
index 000000000000..e2c29472c189
--- /dev/null
+++ b/sysutils/u-boot-sinovoip-bpi-m3/files/patch-cmd_elf.c
@@ -0,0 +1,29 @@
+--- cmd/elf.c.orig 2016-04-12 02:22:25 UTC
++++ cmd/elf.c
+@@ -110,22 +110,12 @@ 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 launch the program directly.
+ */
+ ret = entry(argc, argv);
+-
+- if (dcache)
+- dcache_enable();
+-
+ return ret;
+ }
+
diff --git a/sysutils/u-boot-sinovoip-bpi-m3/files/patch-cmd_test.c b/sysutils/u-boot-sinovoip-bpi-m3/files/patch-cmd_test.c
new file mode 100644
index 000000000000..0b6a757ad13b
--- /dev/null
+++ b/sysutils/u-boot-sinovoip-bpi-m3/files/patch-cmd_test.c
@@ -0,0 +1,19 @@
+--- cmd/test.c.orig 2016-04-12 02:22:25 UTC
++++ cmd/test.c
+@@ -56,9 +56,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
+ {
diff --git a/sysutils/u-boot-sinovoip-bpi-m3/files/patch-configs_Sinovoip__BPI__M3__defconfig b/sysutils/u-boot-sinovoip-bpi-m3/files/patch-configs_Sinovoip__BPI__M3__defconfig
new file mode 100644
index 000000000000..2d52a657c787
--- /dev/null
+++ b/sysutils/u-boot-sinovoip-bpi-m3/files/patch-configs_Sinovoip__BPI__M3__defconfig
@@ -0,0 +1,14 @@
+--- configs/Sinovoip_BPI_M3_defconfig.orig 2016-05-16 11:40:32.000000000 -0300
++++ configs/Sinovoip_BPI_M3_defconfig 2016-07-07 17:05:19.339338000 -0300
+@@ -32,3 +32,11 @@
+ CONFIG_AXP_DLDO3_VOLT=2500
+ CONFIG_USB_EHCI_HCD=y
+ CONFIG_USB_MUSB_HOST=y
++
++# FreeBSD changes
++CONFIG_CMD_GPIO=y
++CONFIG_AXP_DCDC1_VOLT=3300
++CONFIG_AXP_DC1SW_EN=1
++# SATA port
++#CONFIG_INITIAL_USB_SCAN_DELAY=500
++#CONFIG_SYS_EXTRA_OPTIONS="SATAPWR=SUNXI_GPD(25)"
diff --git a/sysutils/u-boot-sinovoip-bpi-m3/files/patch-drivers_mmc_mmc.c b/sysutils/u-boot-sinovoip-bpi-m3/files/patch-drivers_mmc_mmc.c
new file mode 100644
index 000000000000..63f0547f2b27
--- /dev/null
+++ b/sysutils/u-boot-sinovoip-bpi-m3/files/patch-drivers_mmc_mmc.c
@@ -0,0 +1,78 @@
+--- drivers/mmc/mmc.c.orig 2016-04-12 02:22:25 UTC
++++ drivers/mmc/mmc.c
+@@ -23,6 +23,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)
+ {
+@@ -1586,9 +1587,14 @@ void mmc_destroy(struct mmc *mmc)
+ struct blk_desc *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
+@@ -1623,7 +1629,7 @@ int mmc_start_init(struct mmc *mmc)
+ err = mmc->cfg->ops->init(mmc);
+
+ if (err)
+- return err;
++ goto done;
+
+ mmc->ddr_mode = 0;
+ mmc_set_bus_width(mmc, 1);
+@@ -1633,7 +1639,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->block_dev.hwpart = 0;
+@@ -1650,15 +1656,31 @@ int mmc_start_init(struct mmc *mmc)
+
+ if (err) {
+ #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;
++ goto done;
+ }
+ }
+
+ if (!err)
+ 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;
+ }
+
diff --git a/sysutils/u-boot-sinovoip-bpi-m3/files/patch-drivers_power_Kconfig b/sysutils/u-boot-sinovoip-bpi-m3/files/patch-drivers_power_Kconfig
new file mode 100644
index 000000000000..cc82068afd0f
--- /dev/null
+++ b/sysutils/u-boot-sinovoip-bpi-m3/files/patch-drivers_power_Kconfig
@@ -0,0 +1,16 @@
+--- drivers/power/Kconfig.orig 2016-04-12 02:22:25 UTC
++++ drivers/power/Kconfig
+@@ -125,6 +125,13 @@ config AXP_DCDC5_VOLT
+ On A23 / A31 / A33 / A83T boards dcdc5 is VCC-DRAM and should be 1.5V,
+ 1.35V if DDR3L is used.
+
++config AXP_DC1SW_EN
++ int "axp pmic dc1sw enable"
++ depends on AXP818_POWER
++ default 0 if AXP818_POWER
++ ---help---
++ Enable DC1SW switch.
++
+ config AXP_ALDO1_VOLT
+ int "axp pmic (a)ldo1 voltage"
+ depends on AXP221_POWER || AXP818_POWER
diff --git a/sysutils/u-boot-sinovoip-bpi-m3/files/patch-drivers_power_axp818.c b/sysutils/u-boot-sinovoip-bpi-m3/files/patch-drivers_power_axp818.c
new file mode 100644
index 000000000000..18760fefde64
--- /dev/null
+++ b/sysutils/u-boot-sinovoip-bpi-m3/files/patch-drivers_power_axp818.c
@@ -0,0 +1,24 @@
+--- drivers/power/axp818.c.orig 2016-04-12 02:22:25 UTC
++++ drivers/power/axp818.c
+@@ -225,6 +225,21 @@ int axp_set_fldo(int fldo_num, unsigned
+ AXP818_OUTPUT_CTRL3_FLDO1_EN << (fldo_num - 1));
+ }
+
++int
++axp_set_dc1sw(int onoff)
++{
++ int ret;
++
++ if (onoff)
++ ret = pmic_bus_setbits(AXP818_OUTPUT_CTRL2,
++ AXP818_OUTPUT_CTRL2_DC1SW_EN);
++ else
++ ret = pmic_bus_clrbits(AXP818_OUTPUT_CTRL2,
++ AXP818_OUTPUT_CTRL2_DC1SW_EN);
++
++ return ret;
++}
++
+ int axp_init(void)
+ {
+ u8 axp_chip_id;
diff --git a/sysutils/u-boot-sinovoip-bpi-m3/files/patch-include_axp818.h b/sysutils/u-boot-sinovoip-bpi-m3/files/patch-include_axp818.h
new file mode 100644
index 000000000000..180a9a21beb4
--- /dev/null
+++ b/sysutils/u-boot-sinovoip-bpi-m3/files/patch-include_axp818.h
@@ -0,0 +1,10 @@
+--- include/axp818.h.orig 2016-04-12 02:22:25 UTC
++++ include/axp818.h
+@@ -24,6 +24,7 @@
+ #define AXP818_OUTPUT_CTRL2_DLDO2_EN (1 << 4)
+ #define AXP818_OUTPUT_CTRL2_DLDO3_EN (1 << 5)
+ #define AXP818_OUTPUT_CTRL2_DLDO4_EN (1 << 6)
++#define AXP818_OUTPUT_CTRL2_DC1SW_EN (1 << 7)
+ #define AXP818_OUTPUT_CTRL3 0x13
+ #define AXP818_OUTPUT_CTRL3_FLDO1_EN (1 << 2)
+ #define AXP818_OUTPUT_CTRL3_FLDO2_EN (1 << 3)
diff --git a/sysutils/u-boot-sinovoip-bpi-m3/files/patch-include_axp__pmic.h b/sysutils/u-boot-sinovoip-bpi-m3/files/patch-include_axp__pmic.h
new file mode 100644
index 000000000000..b525e168f149
--- /dev/null
+++ b/sysutils/u-boot-sinovoip-bpi-m3/files/patch-include_axp__pmic.h
@@ -0,0 +1,10 @@
+--- include/axp_pmic.h.orig 2016-04-12 02:22:25 UTC
++++ include/axp_pmic.h
+@@ -32,6 +32,7 @@ int axp_set_aldo4(unsigned int mvolt);
+ int axp_set_dldo(int dldo_num, unsigned int mvolt);
+ int axp_set_eldo(int eldo_num, unsigned int mvolt);
+ int axp_set_fldo(int fldo_num, unsigned int mvolt);
++int axp_set_dc1sw(int onoff);
+ int axp_init(void);
+ int axp_get_sid(unsigned int *sid);
+
diff --git a/sysutils/u-boot-sinovoip-bpi-m3/files/patch-include_configs_sunxi-common.h b/sysutils/u-boot-sinovoip-bpi-m3/files/patch-include_configs_sunxi-common.h
new file mode 100644
index 000000000000..11b3ca5d7412
--- /dev/null
+++ b/sysutils/u-boot-sinovoip-bpi-m3/files/patch-include_configs_sunxi-common.h
@@ -0,0 +1,78 @@
+--- include/configs/sunxi-common.h.orig 2016-05-16 11:40:32.000000000 -0300
++++ include/configs/sunxi-common.h 2016-07-07 17:00:25.673890000 -0300
+@@ -513,4 +513,75 @@
+ #define CONFIG_EXTRA_ENV_SETTINGS
+ #endif
+
++/*****************************************************************************
++ * FreeBSD customizations from here down.
++ ****************************************************************************/
++
++/* Add the API and ELF features needed for ubldr. */
++#ifndef CONFIG_SPL_BUILD
++#define CONFIG_API
++#ifndef CONFIG_CMD_ELF
++#define CONFIG_CMD_ELF
++#endif
++#ifndef CONFIG_CMD_ENV_EXISTS
++#define CONFIG_CMD_ENV_EXISTS
++#endif
++#define CONFIG_EFI_PARTITION
++#endif
++
++/* Turn off dcache. */
++#ifndef CONFIG_SPL_BUILD
++#define CONFIG_SYS_DCACHE_OFF
++#define CONFIG_CMD_CACHE
++#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
++#undef CONFIG_ENV_IS_IN_SPI_FLASH
++#define CONFIG_ENV_IS_IN_FAT
++#define CONFIG_FAT_WRITE
++#define CONFIG_SYS_MMC_MAX_DEVICE 4
++#define FAT_ENV_INTERFACE "mmc"
++#define FAT_ENV_DEVICE_AND_PART "0:1"
++#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 \
++ MEM_LAYOUT_ENV_SETTINGS \
++ CONSOLE_STDOUT_SETTINGS \
++ "stdin=serial,usbkbd\0" \
++ "fdtfile=%%MODEL%%.dtb\0" \
++ "console=ttyS0,115200\0" \
++ "Fatboot=" \
++ "env exists loaderdev || env set loaderdev ${fatdev}; " \
++ "env exists UserFatboot && run UserFatboot; " \
++ "echo Booting from: ${fatdev} ${bootfile}; " \
++ "fatload ${fatdev} ${kernel_addr_r} ${bootfile} && bootelf; " \
++ "\0" \
++ "Netboot=" \
++ "env exists loaderdev || env set loaderdev net; " \
++ "env exists UserNetboot && run UserNetboot; " \
++ "dhcp ${kernel_addr_r} ${bootfile} && bootelf; " \
++ "\0" \
++ "preboot=usb start; " \
++ "env exists bootfile || env set bootfile ubldr; " \
++ "env exists SetupFatdev && run SetupFatdev; " \
++ "env exists UserPreboot && run UserPreboot; " \
++ "\0" \
++ "SetupFatdev=" \
++ "env exists fatdev || env set fatdev 'mmc 0'; " \
++ "\0"
++
++#undef CONFIG_BOOTCOMMAND
++#define CONFIG_BOOTCOMMAND "run Fatboot"
++#undef CONFIG_PREBOOT
++#define CONFIG_PREBOOT "run preboot"
++#endif
++
+ #endif /* _SUNXI_COMMON_CONFIG_H */
diff --git a/sysutils/u-boot-sinovoip-bpi-m3/pkg-descr b/sysutils/u-boot-sinovoip-bpi-m3/pkg-descr
new file mode 100644
index 000000000000..d415a123bb85
--- /dev/null
+++ b/sysutils/u-boot-sinovoip-bpi-m3/pkg-descr
@@ -0,0 +1,19 @@
+U-Boot loader for Banana Pi M3.
+
+To install this bootloader, follow the instructions in
+ http://linux-sunxi.org/Bootable_SD_card#Bootloader
+
+This version is patched so that:
+ * ELF and API features are enabled.
+ * The default environment is trimmed to just what's needed to boot.
+ * The saveenv command writes to the file u-boot.env on the FAT partition.
+ * The DTB file name is chosen based on the board model and passed to ubldr
+ using the fdtfile env variable. ubldr loads the DTB from /boot/dtb/ on
+ the FreeBSD partition.
+ * By default, it loads ELF ubldr from file ubldr on the FAT partition
+ to address 0x42000000, and launches it.
+
+For information about running FreeBSD on Banana Pi M3, see
+ https://wiki.freebsd.org/FreeBSD/arm/Allwinner
+
+For general information about U-Boot see WWW: http://www.denx.de/wiki/U-Boot