ports/sysutils/u-boot-cubieboard/files/patch-include_configs_sunxi-common.h
Luiz Otavio O Souza ae95160278 Adds the U-Boot loader for Banana pi, Cubieboard and Cubieboard2.
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 Allwinner SoCs, see
 https://wiki.freebsd.org/FreeBSD/arm/Allwinner

Differential Revision:	https://reviews.freebsd.org/D2874
Reviewed by:	garga
Approved by:	garga
2015-07-06 19:50:03 +00:00

74 lines
2.3 KiB
C

--- include/configs/sunxi-common.h.orig 2015-04-13 14:53:03 UTC
+++ include/configs/sunxi-common.h
@@ -406,4 +406,71 @@ extern int soft_i2c_gpio_scl;
#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
+#define CONFIG_CMD_ELF
+#define CONFIG_CMD_ENV_EXISTS
+#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 */