summaryrefslogtreecommitdiff
path: root/libre-testing
diff options
context:
space:
mode:
authorIsaac David <isacdaavid@isacdaavid.info>2017-03-28 17:34:51 -0600
committerIsaac David <isacdaavid@isacdaavid.info>2017-03-28 17:34:51 -0600
commit338073efe069972cfcab2267e407a34c8a4c83aa (patch)
tree6e801dc63eda123effcd7b41b7d128fd34e7dd3c /libre-testing
parent412992925db7b8719c4be054d0297ef8ee5963c2 (diff)
downloadabslibre-338073efe069972cfcab2267e407a34c8a4c83aa.tar.gz
abslibre-338073efe069972cfcab2267e407a34c8a4c83aa.tar.bz2
abslibre-338073efe069972cfcab2267e407a34c8a4c83aa.zip
add uboot-am335x_green to [libre-testing]\nBug #1249 -> https://labs.parabola.nu/issues/1249
Diffstat (limited to 'libre-testing')
-rw-r--r--libre-testing/uboot-am335x_green/0001-am335x_evm-uEnv.txt-bootz-n-fixes.patch668
-rw-r--r--libre-testing/uboot-am335x_green/0002-Forward-port-parabola-patch.patch113
-rw-r--r--libre-testing/uboot-am335x_green/0003-Beaglebone-green.patch26
-rw-r--r--libre-testing/uboot-am335x_green/PKGBUILD54
-rw-r--r--libre-testing/uboot-am335x_green/boot.cmd7
-rw-r--r--libre-testing/uboot-am335x_green/uEnv.txt1
-rw-r--r--libre-testing/uboot-am335x_green/uboot-am335x_green.install32
7 files changed, 901 insertions, 0 deletions
diff --git a/libre-testing/uboot-am335x_green/0001-am335x_evm-uEnv.txt-bootz-n-fixes.patch b/libre-testing/uboot-am335x_green/0001-am335x_evm-uEnv.txt-bootz-n-fixes.patch
new file mode 100644
index 000000000..05eb48490
--- /dev/null
+++ b/libre-testing/uboot-am335x_green/0001-am335x_evm-uEnv.txt-bootz-n-fixes.patch
@@ -0,0 +1,668 @@
+From 1457e5e6623dd33c4d20341afc270f7ae75847ea Mon Sep 17 00:00:00 2001
+From: Robert Nelson <robertcnelson@gmail.com>
+Date: Tue, 14 Mar 2017 09:35:43 -0500
+Subject: [PATCH 1/3] am335x_evm: uEnv.txt, bootz, n fixes
+
+Signed-off-by: Robert Nelson <robertcnelson@gmail.com>
+---
+ board/ti/am335x/board.c | 43 +++++-
+ board/ti/am335x/board.h | 20 +++
+ board/ti/am335x/mux.c | 9 +-
+ configs/am335x_boneblack_defconfig | 3 +-
+ configs/am335x_evm_defconfig | 27 ++--
+ include/configs/am335x_evm.h | 59 ++++++--
+ include/configs/ti_armv7_common.h | 276 +++++++++++++++++++++++++++++++++++--
+ 7 files changed, 397 insertions(+), 40 deletions(-)
+
+diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c
+index 8eaf3e9a5c..cde6c3ba32 100644
+--- a/board/ti/am335x/board.c
++++ b/board/ti/am335x/board.c
+@@ -556,6 +556,24 @@ static struct clk_synth cdce913_data = {
+ */
+ int board_init(void)
+ {
++ u32 sys_reboot;
++
++ sys_reboot = readl(PRM_RSTST);
++ if (sys_reboot & (1 << 9))
++ puts("Reset Source: IcePick reset has occurred.\n");
++
++ if (sys_reboot & (1 << 5))
++ puts("Reset Source: Global external warm reset has occurred.\n");
++
++ if (sys_reboot & (1 << 4))
++ puts("Reset Source: watchdog reset has occurred.\n");
++
++ if (sys_reboot & (1 << 1))
++ puts("Reset Source: Global warm SW reset has occurred.\n");
++
++ if (sys_reboot & (1 << 0))
++ puts("Reset Source: Power-on reset has occurred.\n");
++
+ #if defined(CONFIG_HW_WATCHDOG)
+ hw_watchdog_init();
+ #endif
+@@ -651,8 +669,26 @@ int board_late_init(void)
+ #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
+ char *name = NULL;
+
++ if (board_is_bone_lt()) {
++ puts("Board: BeagleBone Black\n");
++ name = "A335BNLT";
++ if (!strncmp(board_ti_get_rev(), "BW", 2)) {
++ puts("Model: BeagleBone Black Wireless\n");
++ name = "BBBW";
++ }
++ if (!strncmp(board_ti_get_rev(), "BLA", 3)) {
++ puts("Model: BeagleBone Blue\n");
++ name = "BBBL";
++ }
++ if (!strncmp(board_ti_get_rev(), "SE", 2)) {
++ puts("Model: SanCloud BeagleBone Enhanced\n");
++ name = "SBBE";
++ }
++ }
++
+ if (board_is_bbg1())
+ name = "BBG1";
++
+ set_board_info_env(name);
+
+ /*
+@@ -788,18 +824,21 @@ int board_eth_init(bd_t *bis)
+ (defined(CONFIG_SPL_ETH_SUPPORT) && defined(CONFIG_SPL_BUILD))
+
+ #ifdef CONFIG_DRIVER_TI_CPSW
+- if (board_is_bone() || board_is_bone_lt() ||
++ if (board_is_bone() || (board_is_bone_lt() && !board_is_bone_lt_enhanced() && !board_is_m10a()) ||
+ board_is_idk()) {
++ puts("eth0: MII MODE\n");
+ writel(MII_MODE_ENABLE, &cdev->miisel);
+ cpsw_slaves[0].phy_if = cpsw_slaves[1].phy_if =
+ PHY_INTERFACE_MODE_MII;
+ } else if (board_is_icev2()) {
++ puts("eth0: icev2: RGMII MODE\n");
+ writel(RMII_MODE_ENABLE | RMII_CHIPCKL_ENABLE, &cdev->miisel);
+ cpsw_slaves[0].phy_if = PHY_INTERFACE_MODE_RMII;
+ cpsw_slaves[1].phy_if = PHY_INTERFACE_MODE_RMII;
+ cpsw_slaves[0].phy_addr = 1;
+ cpsw_slaves[1].phy_addr = 3;
+ } else {
++ puts("eth0: RGMII MODE\n");
+ writel((RGMII_MODE_ENABLE | RGMII_INT_DELAY), &cdev->miisel);
+ cpsw_slaves[0].phy_if = cpsw_slaves[1].phy_if =
+ PHY_INTERFACE_MODE_RGMII;
+@@ -824,7 +863,7 @@ int board_eth_init(bd_t *bis)
+ #define AR8051_DEBUG_RGMII_CLK_DLY_REG 0x5
+ #define AR8051_RGMII_TX_CLK_DLY 0x100
+
+- if (board_is_evm_sk() || board_is_gp_evm()) {
++ if (board_is_evm_sk() || board_is_gp_evm() || board_is_bone_lt_enhanced() || board_is_m10a()) {
+ const char *devname;
+ devname = miiphy_get_current_dev();
+
+diff --git a/board/ti/am335x/board.h b/board/ti/am335x/board.h
+index 48c139a817..fdf8c56258 100644
+--- a/board/ti/am335x/board.h
++++ b/board/ti/am335x/board.h
+@@ -34,11 +34,31 @@ static inline int board_is_bone_lt(void)
+ return board_ti_is("A335BNLT");
+ }
+
++static inline int board_is_bbbw(void)
++{
++ return board_is_bone_lt() && !strncmp(board_ti_get_rev(), "BW", 2);
++}
++
++static inline int board_is_blue(void)
++{
++ return board_is_bone_lt() && !strncmp(board_ti_get_rev(), "BLA", 3);
++}
++
+ static inline int board_is_bbg1(void)
+ {
+ return board_is_bone_lt() && !strncmp(board_ti_get_rev(), "BBG1", 4);
+ }
+
++static inline int board_is_bone_lt_enhanced(void)
++{
++ return board_is_bone_lt() && !strncmp(board_ti_get_rev(), "SE", 2);
++}
++
++static inline int board_is_m10a(void)
++{
++ return board_is_bone_lt() && !strncmp(board_ti_get_rev(), "M10A", 4);
++}
++
+ static inline int board_is_evm_sk(void)
+ {
+ return board_ti_is("A335X_SK");
+diff --git a/board/ti/am335x/mux.c b/board/ti/am335x/mux.c
+index ad85b3a19a..6d65e99a1a 100644
+--- a/board/ti/am335x/mux.c
++++ b/board/ti/am335x/mux.c
+@@ -381,7 +381,14 @@ void enable_board_pin_mux(void)
+ configure_module_pin_mux(mmc0_pin_mux_sk_evm);
+ } else if (board_is_bone_lt()) {
+ /* Beaglebone LT pinmux */
+- configure_module_pin_mux(mii1_pin_mux);
++ if(board_is_bone_lt_enhanced() || board_is_m10a()) {
++ /* SanCloud Beaglebone LT Enhanced pinmux */
++ configure_module_pin_mux(rgmii1_pin_mux);
++ }
++ else {
++ /* Beaglebone LT pinmux */
++ configure_module_pin_mux(mii1_pin_mux);
++ }
+ configure_module_pin_mux(mmc0_pin_mux);
+ #if defined(CONFIG_NAND) && defined(CONFIG_EMMC_BOOT)
+ configure_module_pin_mux(nand_pin_mux);
+diff --git a/configs/am335x_boneblack_defconfig b/configs/am335x_boneblack_defconfig
+index d0e1bcc8a3..ca1c746054 100644
+--- a/configs/am335x_boneblack_defconfig
++++ b/configs/am335x_boneblack_defconfig
+@@ -5,7 +5,6 @@ CONFIG_TARGET_AM335X_EVM=y
+ CONFIG_SPL_STACK_R_ADDR=0x82000000
+ CONFIG_DISTRO_DEFAULTS=y
+ CONFIG_FIT=y
+-CONFIG_SYS_EXTRA_OPTIONS="EMMC_BOOT"
+ CONFIG_SYS_CONSOLE_INFO_QUIET=y
+ CONFIG_VERSION_VARIABLE=y
+ CONFIG_ARCH_MISC_INIT=y
+@@ -47,3 +46,5 @@ CONFIG_G_DNL_MANUFACTURER="Texas Instruments"
+ CONFIG_G_DNL_VENDOR_NUM=0x0451
+ CONFIG_G_DNL_PRODUCT_NUM=0xd022
+ CONFIG_OF_LIBFDT=y
++CONFIG_OF_LIBFDT_OVERLAY=y
++CONFIG_PHY_MSCC=y
+diff --git a/configs/am335x_evm_defconfig b/configs/am335x_evm_defconfig
+index ab7b9aa6aa..6fcfa5216f 100644
+--- a/configs/am335x_evm_defconfig
++++ b/configs/am335x_evm_defconfig
+@@ -1,20 +1,21 @@
+ CONFIG_ARM=y
+ CONFIG_AM33XX=y
++# CONFIG_SPL_NAND_SUPPORT is not set
+ CONFIG_TARGET_AM335X_EVM=y
+ CONFIG_SPL_STACK_R_ADDR=0x82000000
+-CONFIG_DEFAULT_DEVICE_TREE="am335x-evm"
+ CONFIG_DISTRO_DEFAULTS=y
+ CONFIG_FIT=y
+-CONFIG_SPL_LOAD_FIT=y
+-CONFIG_SYS_EXTRA_OPTIONS="NAND"
+ CONFIG_SYS_CONSOLE_INFO_QUIET=y
+ CONFIG_VERSION_VARIABLE=y
+ CONFIG_ARCH_MISC_INIT=y
+ CONFIG_SPL=y
+ CONFIG_SPL_STACK_R=y
+-CONFIG_SPL_MTD_SUPPORT=y
+ CONFIG_SPL_MUSB_NEW_SUPPORT=y
+ CONFIG_SPL_OS_BOOT=y
++CONFIG_AUTOBOOT_KEYED=y
++CONFIG_AUTOBOOT_PROMPT="Press SPACE to abort autoboot in %d seconds\n"
++CONFIG_AUTOBOOT_DELAY_STR="d"
++CONFIG_AUTOBOOT_STOP_STR=" "
+ # CONFIG_CMD_IMLS is not set
+ CONFIG_CMD_ASKENV=y
+ # CONFIG_CMD_FLASH is not set
+@@ -24,37 +25,27 @@ CONFIG_CMD_SF=y
+ CONFIG_CMD_SPI=y
+ CONFIG_CMD_I2C=y
+ CONFIG_CMD_USB=y
++CONFIG_CMD_USB_MASS_STORAGE=y
+ CONFIG_CMD_DFU=y
+ CONFIG_CMD_GPIO=y
+ # CONFIG_CMD_SETEXPR is not set
+ CONFIG_CMD_EXT4_WRITE=y
+-CONFIG_OF_CONTROL=y
+-CONFIG_OF_LIST="am335x-evm am335x-bone am335x-boneblack am335x-evmsk am335x-bonegreen am335x-icev2"
+ # CONFIG_BLK is not set
+ CONFIG_DFU_MMC=y
+-CONFIG_DFU_NAND=y
+ CONFIG_DFU_RAM=y
+-CONFIG_DM_I2C=y
+-CONFIG_MISC=y
+-CONFIG_DM_MMC=y
+-# CONFIG_DM_MMC_OPS is not set
+ CONFIG_MMC_OMAP_HS=y
+ CONFIG_SPI_FLASH=y
+ CONFIG_SPI_FLASH_WINBOND=y
+-CONFIG_DM_ETH=y
+ CONFIG_SYS_NS16550=y
+-CONFIG_TIMER=y
+-CONFIG_OMAP_TIMER=y
+ CONFIG_USB=y
+-CONFIG_DM_USB=y
+ CONFIG_USB_MUSB_HOST=y
+ CONFIG_USB_MUSB_GADGET=y
+-CONFIG_USB_MUSB_TI=y
+ CONFIG_USB_STORAGE=y
+ CONFIG_USB_GADGET=y
+ CONFIG_USB_GADGET_DOWNLOAD=y
+ CONFIG_G_DNL_MANUFACTURER="Texas Instruments"
+ CONFIG_G_DNL_VENDOR_NUM=0x0451
+ CONFIG_G_DNL_PRODUCT_NUM=0xd022
+-CONFIG_RSA=y
+-CONFIG_SPL_OF_LIBFDT=y
++CONFIG_OF_LIBFDT=y
++CONFIG_OF_LIBFDT_OVERLAY=y
++CONFIG_PHY_MSCC=y
+diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
+index 27126871f7..399b25f47a 100644
+--- a/include/configs/am335x_evm.h
++++ b/include/configs/am335x_evm.h
+@@ -18,6 +18,7 @@
+
+ #include <configs/ti_am335x_common.h>
+ #include <environment/ti/dfu.h>
++#define CONFIG_ENV_IS_NOWHERE
+
+ #ifndef CONFIG_SPL_BUILD
+ # define CONFIG_TIMESTAMP
+@@ -61,9 +62,14 @@
+
+ #define BOOTENV_DEV_LEGACY_MMC(devtypeu, devtypel, instance) \
+ "bootcmd_" #devtypel #instance "=" \
++ "gpio clear 56; " \
++ "gpio clear 55; " \
++ "gpio clear 54; " \
++ "gpio set 53; " \
++ "setenv devtype mmc; " \
+ "setenv mmcdev " #instance"; "\
+- "setenv bootpart " #instance":2 ; "\
+- "run mmcboot\0"
++ "setenv bootpart " #instance":1 ; "\
++ "run boot\0"
+
+ #define BOOTENV_DEV_NAME_LEGACY_MMC(devtypeu, devtypel, instance) \
+ #devtypel #instance " "
+@@ -80,7 +86,6 @@
+ func(LEGACY_MMC, legacy_mmc, 0) \
+ func(MMC, mmc, 1) \
+ func(LEGACY_MMC, legacy_mmc, 1) \
+- func(NAND, nand, 0) \
+ func(PXE, pxe, na) \
+ func(DHCP, dhcp, na)
+
+@@ -134,12 +139,41 @@
+ "run ramargs; " \
+ "bootz ${loadaddr} ${rdaddr} ${fdtaddr}\0" \
+ "findfdt="\
++ "echo board_name=[$board_name] ...; " \
+ "if test $board_name = A335BONE; then " \
+- "setenv fdtfile am335x-bone.dtb; fi; " \
++ "setenv fdtfile am335x-bone.dtb; setenv fdtbase am335x-bone; fi; " \
+ "if test $board_name = A335BNLT; then " \
+- "setenv fdtfile am335x-boneblack.dtb; fi; " \
++ "echo board_rev=[$board_rev] ...; " \
++ "if test $board_rev = GH01; then " \
++ "setenv fdtfile am335x-boneblack.dtb; setenv fdtbase am335x-boneblack; " \
++ "elif test $board_rev = BBG1; then " \
++ "setenv fdtfile am335x-bonegreen.dtb; setenv fdtbase am335x-bonegreen; " \
++ "elif test $board_rev = BP00; then " \
++ "setenv fdtfile am335x-pocketbone.dtb; setenv fdtbase am335x-pocketbone; " \
++ "elif test $board_rev = GW1A; then " \
++ "setenv fdtfile am335x-bonegreen-wireless.dtb; setenv fdtbase am335x-bonegreen-wireless; " \
++ "elif test $board_rev = AIA0; then " \
++ "setenv fdtfile am335x-abbbi.dtb; setenv fdtbase am335x-abbbi; " \
++ "elif test $board_rev = EIA0; then " \
++ "setenv fdtfile am335x-boneblack.dtb; setenv fdtbase am335x-boneblack; " \
++ "elif test $board_rev = SE0A; then " \
++ "setenv fdtfile am335x-sancloud-bbe.dtb; setenv fdtbase am335x-sancloud-bbe; " \
++ "elif test $board_rev = ME06; then " \
++ "setenv fdtfile am335x-bonegreen.dtb; setenv fdtbase am335x-bonegreen; " \
++ "elif test $board_rev = M10A; then " \
++ "setenv fdtfile am335x-vsc8531bbb.dtb; setenv fdtbase am335x-vsc8531bbb; " \
++ "else " \
++ "setenv fdtfile am335x-boneblack.dtb; setenv fdtbase am335x-boneblack; " \
++ "fi; " \
++ "fi; " \
+ "if test $board_name = BBG1; then " \
+- "setenv fdtfile am335x-bonegreen.dtb; fi; " \
++ "setenv fdtfile am335x-bonegreen.dtb; setenv fdtbase am335x-bonegreen; fi; " \
++ "if test $board_name = BBBW; then " \
++ "setenv fdtfile am335x-boneblack-wireless.dtb; setenv fdtbase am335x-boneblack-wireless; fi; " \
++ "if test $board_name = BBBL; then " \
++ "setenv fdtfile am335x-boneblue.dtb; setenv fdtbase am335x-boneblue; fi; " \
++ "if test $board_name = SBBE; then " \
++ "setenv fdtfile am335x-sancloud-bbe.dtb; setenv fdtbase am335x-sancloud-bbe; fi; " \
+ "if test $board_name = A33515BB; then " \
+ "setenv fdtfile am335x-evm.dtb; fi; " \
+ "if test $board_name = A335X_SK; then " \
+@@ -147,13 +181,20 @@
+ "if test $board_name = A335_ICE; then " \
+ "setenv fdtfile am335x-icev2.dtb; fi; " \
+ "if test $fdtfile = undefined; then " \
+- "echo WARNING: Could not determine device tree to use; fi; \0" \
++ "setenv board_name A335BNLT; " \
++ "setenv board_rev EMMC; " \
++ "setenv fdtbase am335x-boneblack-emmc-overlay; " \
++ "setenv fdtfile am335x-boneblack-emmc-overlay.dtb; " \
++ "fi; \0" \
+ "init_console=" \
+ "if test $board_name = A335_ICE; then "\
+ "setenv console ttyO3,115200n8;" \
+ "else " \
+ "setenv console ttyO0,115200n8;" \
+ "fi;\0" \
++ EEWIKI_NFS \
++ EEWIKI_BOOT \
++ EEWIKI_UNAME_BOOT \
+ NANDARGS \
+ NETARGS \
+ DFUARGS \
+@@ -273,9 +314,7 @@
+ #endif
+
+ #ifdef CONFIG_USB_MUSB_GADGET
+-#define CONFIG_USB_ETHER
+-#define CONFIG_USB_ETH_RNDIS
+-#define CONFIG_USBNET_HOST_ADDR "de:ad:be:af:00:00"
++#define CONFIG_USB_FUNCTION_MASS_STORAGE
+ #endif /* CONFIG_USB_MUSB_GADGET */
+
+ /*
+diff --git a/include/configs/ti_armv7_common.h b/include/configs/ti_armv7_common.h
+index a4ec4ce00a..bb3676b57f 100644
+--- a/include/configs/ti_armv7_common.h
++++ b/include/configs/ti_armv7_common.h
+@@ -54,20 +54,60 @@
+ #define DEFAULT_MMC_TI_ARGS \
+ "mmcdev=0\0" \
+ "mmcrootfstype=ext4 rootwait\0" \
+- "finduuid=part uuid mmc ${bootpart} uuid\0" \
++ "finduuid=part uuid ${devtype} ${bootpart} uuid\0" \
+ "args_mmc=run finduuid;setenv bootargs console=${console} " \
++ "${cape_disable} " \
++ "${cape_enable} " \
++ "${cape_uboot} " \
++ "root=PARTUUID=${uuid} ro " \
++ "rootfstype=${mmcrootfstype} " \
++ "${cmdline}\0" \
++ "args_mmc_old=setenv bootargs console=${console} " \
+ "${optargs} " \
+- "root=PARTUUID=${uuid} rw " \
+- "rootfstype=${mmcrootfstype}\0" \
+- "loadbootscript=load mmc ${mmcdev} ${loadaddr} boot.scr\0" \
+- "bootscript=echo Running bootscript from mmc${mmcdev} ...; " \
++ "${cape_disable} " \
++ "${cape_enable} " \
++ "${cape_uboot} " \
++ "root=${oldroot} ro " \
++ "rootfstype=${mmcrootfstype} " \
++ "${cmdline}\0" \
++ "args_mmc_uuid=setenv bootargs console=${console} " \
++ "${optargs} " \
++ "${cape_disable} " \
++ "${cape_enable} " \
++ "${cape_uboot} " \
++ "root=UUID=${uuid} ro " \
++ "rootfstype=${mmcrootfstype} " \
++ "${cmdline}\0" \
++ "args_uenv_root=setenv bootargs console=${console} " \
++ "${optargs} " \
++ "${cape_disable} " \
++ "${cape_enable} " \
++ "${cape_uboot} " \
++ "root=${uenv_root} ro " \
++ "rootfstype=${mmcrootfstype} " \
++ "${cmdline}\0" \
++ "args_netinstall=setenv bootargs ${netinstall_bootargs} " \
++ "${optargs} " \
++ "${cape_disable} " \
++ "${cape_enable} " \
++ "${cape_uboot} " \
++ "root=/dev/ram rw " \
++ "${cmdline}\0" \
++ "script=boot.scr\0" \
++ "scriptfile=${script}\0" \
++ "loadbootscript=load ${devtype} ${bootpart} ${loadaddr} ${scriptfile};\0" \
++ "bootscript=echo Running bootscript from mmc${bootpart} ...; " \
+ "source ${loadaddr}\0" \
+ "bootenvfile=uEnv.txt\0" \
+- "importbootenv=echo Importing environment from mmc${mmcdev} ...; " \
++ "bootenv=uEnv.txt\0" \
++ "importbootenv=echo Importing environment from ${devtype} ...; " \
+ "env import -t ${loadaddr} ${filesize}\0" \
+- "loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenvfile}\0" \
++ "loadbootenv=load ${devtype} ${bootpart} ${loadaddr} ${bootenvfile}\0" \
+ "loadimage=load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${bootfile}\0" \
+- "loadfdt=load ${devtype} ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \
++ "loadrd=load ${devtype} ${bootpart} ${rdaddr} ${bootdir}/${rdfile}; setenv rdsize ${filesize}\0" \
++ "loadfdt=echo loading ${fdtdir}/${fdtfile} ...; load ${devtype} ${bootpart} ${fdtaddr} ${fdtdir}/${fdtfile}\0" \
++ "failumsboot=echo; echo FAILSAFE: U-Boot UMS (USB Mass Storage) enabled, media now available over the usb slave port ...; " \
++ "ums 0 ${devtype} 1;\0" \
+ "envboot=mmc dev ${mmcdev}; " \
+ "if mmc rescan; then " \
+ "echo SD/MMC found on device ${mmcdev};" \
+@@ -120,6 +160,226 @@
+ "args_fit=setenv bootargs console=${console} \0" \
+ "loadfit=run args_fit; bootm ${loadaddr}#${fdtfile};\0" \
+
++#define EEWIKI_NFS \
++ "server_ip=192.168.1.100\0" \
++ "gw_ip=192.168.1.1\0" \
++ "netmask=255.255.255.0\0" \
++ "hostname=\0" \
++ "device=eth0\0" \
++ "autoconf=off\0" \
++ "root_dir=/home/userid/targetNFS\0" \
++ "tftp_dir=\0" \
++ "nfs_options=,vers=3\0" \
++ "nfsrootfstype=ext4 rootwait fixrtc\0" \
++ "nfsargs=setenv bootargs console=${console} " \
++ "${optargs} " \
++ "${cape_disable} " \
++ "${cape_enable} " \
++ "${cape_uboot} " \
++ "root=/dev/nfs rw " \
++ "rootfstype=${nfsrootfstype} " \
++ "nfsroot=${nfsroot} " \
++ "ip=${ip} " \
++ "${cmdline}\0" \
++ "nfsboot=echo Booting from ${server_ip} ...; " \
++ "setenv nfsroot ${server_ip}:${root_dir}${nfs_options}; " \
++ "setenv ip ${client_ip}:${server_ip}:${gw_ip}:${netmask}:${hostname}:${device}:${autoconf}; " \
++ "setenv autoload no; " \
++ "setenv serverip ${server_ip}; " \
++ "setenv ipaddr ${client_ip}; " \
++ "tftp ${loadaddr} ${tftp_dir}${bootfile}; " \
++ "tftp ${fdtaddr} ${tftp_dir}dtbs/${fdtfile}; " \
++ "run nfsargs; " \
++ "bootz ${loadaddr} - ${fdtaddr}\0" \
++ "nfsboot_uname_r=echo Booting from ${server_ip} ...; " \
++ "setenv nfsroot ${server_ip}:${root_dir}${nfs_options}; " \
++ "setenv ip ${client_ip}:${server_ip}:${gw_ip}:${netmask}:${hostname}:${device}:${autoconf}; " \
++ "setenv autoload no; " \
++ "setenv serverip ${server_ip}; " \
++ "setenv ipaddr ${client_ip}; " \
++ "tftp ${loadaddr} ${tftp_dir}vmlinuz-${uname_r}; " \
++ "tftp ${fdtaddr} ${tftp_dir}dtbs/${uname_r}/${fdtfile}; " \
++ "run nfsargs; " \
++ "bootz ${loadaddr} - ${fdtaddr}\0" \
++
++#define EEWIKI_BOOT \
++ "boot=${devtype} dev ${mmcdev}; " \
++ "if ${devtype} rescan; then " \
++ "gpio set 54;" \
++ "setenv bootpart ${mmcdev}:1; " \
++ "if test -e ${devtype} ${bootpart} /etc/fstab; then " \
++ "setenv mmcpart 1;" \
++ "fi; " \
++ "echo Checking for: /uEnv.txt ...;" \
++ "if test -e ${devtype} ${bootpart} /uEnv.txt; then " \
++ "if run loadbootenv; then " \
++ "gpio set 55;" \
++ "echo Loaded environment from /uEnv.txt;" \
++ "run importbootenv;" \
++ "fi;" \
++ "if test -n ${cape}; then " \
++ "if test -e ${devtype} ${bootpart} ${fdtdir}/${fdtbase}-${cape}.dtb; then " \
++ "setenv fdtfile ${fdtbase}-${cape}.dtb; " \
++ "fi; " \
++ "echo using: $fdtfile...; " \
++ "fi; " \
++ "echo Checking if uenvcmd is set ...;" \
++ "if test -n ${uenvcmd}; then " \
++ "gpio set 56; " \
++ "echo Running uenvcmd ...;" \
++ "run uenvcmd;" \
++ "fi;" \
++ "echo Checking if client_ip is set ...;" \
++ "if test -n ${client_ip}; then " \
++ "if test -n ${dtb}; then " \
++ "setenv fdtfile ${dtb};" \
++ "echo using ${fdtfile} ...;" \
++ "fi;" \
++ "gpio set 56; " \
++ "if test -n ${uname_r}; then " \
++ "echo Running nfsboot_uname_r ...;" \
++ "run nfsboot_uname_r;" \
++ "fi;" \
++ "echo Running nfsboot ...;" \
++ "run nfsboot;" \
++ "fi;" \
++ "fi; " \
++ "echo Checking for: /${script} ...;" \
++ "if test -e ${devtype} ${bootpart} /${script}; then " \
++ "gpio set 55;" \
++ "setenv scriptfile ${script};" \
++ "run loadbootscript;" \
++ "echo Loaded script from ${scriptfile};" \
++ "gpio set 56; " \
++ "run bootscript;" \
++ "fi; " \
++ "echo Checking for: /boot/${script} ...;" \
++ "if test -e ${devtype} ${bootpart} /boot/${script}; then " \
++ "gpio set 55;" \
++ "setenv scriptfile /boot/${script};" \
++ "run loadbootscript;" \
++ "echo Loaded script from ${scriptfile};" \
++ "gpio set 56; " \
++ "run bootscript;" \
++ "fi; " \
++ "echo Checking for: /boot/uEnv.txt ...;" \
++ "for i in 1 2 3 4 5 6 7 ; do " \
++ "setenv mmcpart ${i};" \
++ "setenv bootpart ${mmcdev}:${mmcpart};" \
++ "if test -e ${devtype} ${bootpart} /boot/uEnv.txt; then " \
++ "gpio set 55;" \
++ "load ${devtype} ${bootpart} ${loadaddr} /boot/uEnv.txt;" \
++ "env import -t ${loadaddr} ${filesize};" \
++ "echo Loaded environment from /boot/uEnv.txt;" \
++ "if test -n ${cape}; then " \
++ "echo debug: [cape=${cape}] ... ;" \
++ "setenv fdtfile ${fdtbase}-${cape}.dtb; " \
++ "echo Using: dtb=${fdtfile} ...;" \
++ "fi; " \
++ "if test -n ${dtb}; then " \
++ "echo debug: [dtb=${dtb}] ... ;" \
++ "setenv fdtfile ${dtb};" \
++ "echo Using: dtb=${fdtfile} ...;" \
++ "fi;" \
++ "echo Checking if uname_r is set in /boot/uEnv.txt...;" \
++ "if test -n ${uname_r}; then " \
++ "gpio set 56; " \
++ "setenv oldroot /dev/mmcblk${mmcdev}p${mmcpart};" \
++ "echo Running uname_boot ...;" \
++ "run uname_boot;" \
++ "fi;" \
++ "fi;" \
++ "done;" \
++ "fi;\0" \
++
++#define EEWIKI_UNAME_BOOT \
++ "uname_boot="\
++ "setenv bootdir /boot; " \
++ "setenv bootfile vmlinuz-${uname_r}; " \
++ "if test -e ${devtype} ${bootpart} ${bootdir}/${bootfile}; then " \
++ "echo loading ${bootdir}/${bootfile} ...; "\
++ "run loadimage;" \
++ "setenv fdtdir /boot/dtbs/${uname_r}; " \
++ "if test -e ${devtype} ${bootpart} ${fdtdir}/${fdtfile}; then " \
++ "run loadfdt;" \
++ "else " \
++ "setenv fdtdir /usr/lib/linux-image-${uname_r}; " \
++ "if test -e ${devtype} ${bootpart} ${fdtdir}/${fdtfile}; then " \
++ "run loadfdt;" \
++ "else " \
++ "setenv fdtdir /lib/firmware/${uname_r}/device-tree; " \
++ "if test -e ${devtype} ${bootpart} ${fdtdir}/${fdtfile}; then " \
++ "run loadfdt;" \
++ "else " \
++ "setenv fdtdir /boot/dtb-${uname_r}; " \
++ "if test -e ${devtype} ${bootpart} ${fdtdir}/${fdtfile}; then " \
++ "run loadfdt;" \
++ "else " \
++ "setenv fdtdir /boot/dtbs; " \
++ "if test -e ${devtype} ${bootpart} ${fdtdir}/${fdtfile}; then " \
++ "run loadfdt;" \
++ "else " \
++ "setenv fdtdir /boot/dtb; " \
++ "if test -e ${devtype} ${bootpart} ${fdtdir}/${fdtfile}; then " \
++ "run loadfdt;" \
++ "else " \
++ "setenv fdtdir /boot; " \
++ "if test -e ${devtype} ${bootpart} ${fdtdir}/${fdtfile}; then " \
++ "run loadfdt;" \
++ "else " \
++ "if test -e ${devtype} ${bootpart} ${fdtfile}; then " \
++ "run loadfdt;" \
++ "else " \
++ "echo; echo unable to find [dtb=${fdtfile}] did you name it correctly? ...; " \
++ "run failumsboot;" \
++ "fi;" \
++ "fi;" \
++ "fi;" \
++ "fi;" \
++ "fi;" \
++ "fi;" \
++ "fi;" \
++ "fi; " \
++ "setenv rdfile initrd.img-${uname_r}; " \
++ "if test -e ${devtype} ${bootpart} ${bootdir}/${rdfile}; then " \
++ "echo loading ${bootdir}/${rdfile} ...; "\
++ "run loadrd;" \
++ "if test -n ${netinstall_enable}; then " \
++ "run args_netinstall; run message;" \
++ "echo debug: [${bootargs}] ... ;" \
++ "echo debug: [bootz ${loadaddr} ${rdaddr}:${rdsize} ${fdtaddr}] ... ;" \
++ "bootz ${loadaddr} ${rdaddr}:${rdsize} ${fdtaddr}; " \
++ "fi;" \
++ "if test -n ${uenv_root}; then " \
++ "run args_uenv_root;" \
++ "echo debug: [${bootargs}] ... ;" \
++ "echo debug: [bootz ${loadaddr} ${rdaddr}:${rdsize} ${fdtaddr}] ... ;" \
++ "bootz ${loadaddr} ${rdaddr}:${rdsize} ${fdtaddr}; " \
++ "fi;" \
++ "if test -n ${uuid}; then " \
++ "run args_mmc_uuid;" \
++ "echo debug: [${bootargs}] ... ;" \
++ "echo debug: [bootz ${loadaddr} ${rdaddr}:${rdsize} ${fdtaddr}] ... ;" \
++ "bootz ${loadaddr} ${rdaddr}:${rdsize} ${fdtaddr}; " \
++ "fi;" \
++ "run args_mmc_old;" \
++ "echo debug: [${bootargs}] ... ;" \
++ "echo debug: [bootz ${loadaddr} ${rdaddr}:${rdsize} ${fdtaddr}] ... ;" \
++ "bootz ${loadaddr} ${rdaddr}:${rdsize} ${fdtaddr}; " \
++ "else " \
++ "if test -n ${uenv_root}; then " \
++ "run args_uenv_root;" \
++ "echo debug: [${bootargs}] ... ;" \
++ "echo debug: [bootz ${loadaddr} - ${fdtaddr}] ... ;" \
++ "bootz ${loadaddr} - ${fdtaddr}; " \
++ "fi;" \
++ "run args_mmc_old;" \
++ "echo debug: [${bootargs}] ... ;" \
++ "echo debug: [bootz ${loadaddr} - ${fdtaddr}] ... ;" \
++ "bootz ${loadaddr} - ${fdtaddr}; " \
++ "fi;" \
++ "fi;\0" \
++
+ /*
+ * DDR information. If the CONFIG_NR_DRAM_BANKS is not defined,
+ * we say (for simplicity) that we have 1 bank, always, even when
+--
+2.12.1
+
diff --git a/libre-testing/uboot-am335x_green/0002-Forward-port-parabola-patch.patch b/libre-testing/uboot-am335x_green/0002-Forward-port-parabola-patch.patch
new file mode 100644
index 000000000..79da7fc91
--- /dev/null
+++ b/libre-testing/uboot-am335x_green/0002-Forward-port-parabola-patch.patch
@@ -0,0 +1,113 @@
+From ab424dd74098de8e8704c238d305f0983016c8cf Mon Sep 17 00:00:00 2001
+From: Denis 'GNUtoo' Carikli <GNUtoo@no-log.org>
+Date: Wed, 22 Mar 2017 11:48:58 +0100
+Subject: [PATCH 2/3] Forward-port parabola patch
+
+Like in the original patch:
+- The default boot partition is changed
+- The kernel image name has been changed to comply with parabola naming
+- An initrd path has been added
+- A base directory where to find the dtb has been added.
+ Here's are the sed scripts that I ran to help do that:
+ sed 's#setenv fdtbase #setenv fdtbase ${fdtdir}/#g' -i include/configs/am335x_evm.h
+ sed 's#setenv fdtfile #setenv fdtfile ${fdtdir}/#g' -i include/configs/am335x_evm.h
+
+Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@no-log.org>
+---
+ include/configs/am335x_evm.h | 47 +++++++++++++++++++++++---------------------
+ 1 file changed, 25 insertions(+), 22 deletions(-)
+
+diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
+index 399b25f47a..1a7d3e88a3 100644
+--- a/include/configs/am335x_evm.h
++++ b/include/configs/am335x_evm.h
+@@ -105,10 +105,13 @@
+ DEFAULT_LINUX_BOOT_ENV \
+ DEFAULT_MMC_TI_ARGS \
+ DEFAULT_FIT_TI_ARGS \
+- "bootpart=0:2\0" \
++ "bootpart=0:1\0" \
+ "bootdir=/boot\0" \
+- "bootfile=zImage\0" \
++ "bootfile=vmlinuz-linux-libre\0" \
++ "ramdiskfile=initramfs-linux-libre.img\0" \
+ "fdtfile=undefined\0" \
++ "fdtdir=/boot/dtbs/linux-libre\0" \
++ "rdfile=initramfs-linux-libre.img\0" \
+ "console=ttyO0,115200n8\0" \
+ "partitions=" \
+ "uuid_disk=${uuid_gpt_disk};" \
+@@ -141,50 +144,50 @@
+ "findfdt="\
+ "echo board_name=[$board_name] ...; " \
+ "if test $board_name = A335BONE; then " \
+- "setenv fdtfile am335x-bone.dtb; setenv fdtbase am335x-bone; fi; " \
++ "setenv fdtfile ${fdtdir}/am335x-bone.dtb; setenv fdtbase ${fdtdir}/am335x-bone; fi; " \
+ "if test $board_name = A335BNLT; then " \
+ "echo board_rev=[$board_rev] ...; " \
+ "if test $board_rev = GH01; then " \
+- "setenv fdtfile am335x-boneblack.dtb; setenv fdtbase am335x-boneblack; " \
++ "setenv fdtfile ${fdtdir}/am335x-boneblack.dtb; setenv fdtbase ${fdtdir}/am335x-boneblack; " \
+ "elif test $board_rev = BBG1; then " \
+- "setenv fdtfile am335x-bonegreen.dtb; setenv fdtbase am335x-bonegreen; " \
++ "setenv fdtfile ${fdtdir}/am335x-bonegreen.dtb; setenv fdtbase ${fdtdir}/am335x-bonegreen; " \
+ "elif test $board_rev = BP00; then " \
+- "setenv fdtfile am335x-pocketbone.dtb; setenv fdtbase am335x-pocketbone; " \
++ "setenv fdtfile ${fdtdir}/am335x-pocketbone.dtb; setenv fdtbase ${fdtdir}/am335x-pocketbone; " \
+ "elif test $board_rev = GW1A; then " \
+- "setenv fdtfile am335x-bonegreen-wireless.dtb; setenv fdtbase am335x-bonegreen-wireless; " \
++ "setenv fdtfile ${fdtdir}/am335x-bonegreen-wireless.dtb; setenv fdtbase ${fdtdir}/am335x-bonegreen-wireless; " \
+ "elif test $board_rev = AIA0; then " \
+- "setenv fdtfile am335x-abbbi.dtb; setenv fdtbase am335x-abbbi; " \
++ "setenv fdtfile ${fdtdir}/am335x-abbbi.dtb; setenv fdtbase ${fdtdir}/am335x-abbbi; " \
+ "elif test $board_rev = EIA0; then " \
+- "setenv fdtfile am335x-boneblack.dtb; setenv fdtbase am335x-boneblack; " \
++ "setenv fdtfile ${fdtdir}/am335x-boneblack.dtb; setenv fdtbase ${fdtdir}/am335x-boneblack; " \
+ "elif test $board_rev = SE0A; then " \
+- "setenv fdtfile am335x-sancloud-bbe.dtb; setenv fdtbase am335x-sancloud-bbe; " \
++ "setenv fdtfile ${fdtdir}/am335x-sancloud-bbe.dtb; setenv fdtbase ${fdtdir}/am335x-sancloud-bbe; " \
+ "elif test $board_rev = ME06; then " \
+- "setenv fdtfile am335x-bonegreen.dtb; setenv fdtbase am335x-bonegreen; " \
++ "setenv fdtfile ${fdtdir}/am335x-bonegreen.dtb; setenv fdtbase ${fdtdir}/am335x-bonegreen; " \
+ "elif test $board_rev = M10A; then " \
+- "setenv fdtfile am335x-vsc8531bbb.dtb; setenv fdtbase am335x-vsc8531bbb; " \
++ "setenv fdtfile ${fdtdir}/am335x-vsc8531bbb.dtb; setenv fdtbase ${fdtdir}/am335x-vsc8531bbb; " \
+ "else " \
+- "setenv fdtfile am335x-boneblack.dtb; setenv fdtbase am335x-boneblack; " \
++ "setenv fdtfile ${fdtdir}/am335x-boneblack.dtb; setenv fdtbase ${fdtdir}/am335x-boneblack; " \
+ "fi; " \
+ "fi; " \
+ "if test $board_name = BBG1; then " \
+- "setenv fdtfile am335x-bonegreen.dtb; setenv fdtbase am335x-bonegreen; fi; " \
++ "setenv fdtfile ${fdtdir}/am335x-bonegreen.dtb; setenv fdtbase ${fdtdir}/am335x-bonegreen; fi; " \
+ "if test $board_name = BBBW; then " \
+- "setenv fdtfile am335x-boneblack-wireless.dtb; setenv fdtbase am335x-boneblack-wireless; fi; " \
++ "setenv fdtfile ${fdtdir}/am335x-boneblack-wireless.dtb; setenv fdtbase ${fdtdir}/am335x-boneblack-wireless; fi; " \
+ "if test $board_name = BBBL; then " \
+- "setenv fdtfile am335x-boneblue.dtb; setenv fdtbase am335x-boneblue; fi; " \
++ "setenv fdtfile ${fdtdir}/am335x-boneblue.dtb; setenv fdtbase ${fdtdir}/am335x-boneblue; fi; " \
+ "if test $board_name = SBBE; then " \
+- "setenv fdtfile am335x-sancloud-bbe.dtb; setenv fdtbase am335x-sancloud-bbe; fi; " \
++ "setenv fdtfile ${fdtdir}/am335x-sancloud-bbe.dtb; setenv fdtbase ${fdtdir}/am335x-sancloud-bbe; fi; " \
+ "if test $board_name = A33515BB; then " \
+- "setenv fdtfile am335x-evm.dtb; fi; " \
++ "setenv fdtfile ${fdtdir}/am335x-evm.dtb; fi; " \
+ "if test $board_name = A335X_SK; then " \
+- "setenv fdtfile am335x-evmsk.dtb; fi; " \
++ "setenv fdtfile ${fdtdir}/am335x-evmsk.dtb; fi; " \
+ "if test $board_name = A335_ICE; then " \
+- "setenv fdtfile am335x-icev2.dtb; fi; " \
++ "setenv fdtfile ${fdtdir}/am335x-icev2.dtb; fi; " \
+ "if test $fdtfile = undefined; then " \
+ "setenv board_name A335BNLT; " \
+ "setenv board_rev EMMC; " \
+- "setenv fdtbase am335x-boneblack-emmc-overlay; " \
+- "setenv fdtfile am335x-boneblack-emmc-overlay.dtb; " \
++ "setenv fdtbase ${fdtdir}/am335x-boneblack-emmc-overlay; " \
++ "setenv fdtfile ${fdtdir}/am335x-boneblack-emmc-overlay.dtb; " \
+ "fi; \0" \
+ "init_console=" \
+ "if test $board_name = A335_ICE; then "\
+--
+2.12.1
+
diff --git a/libre-testing/uboot-am335x_green/0003-Beaglebone-green.patch b/libre-testing/uboot-am335x_green/0003-Beaglebone-green.patch
new file mode 100644
index 000000000..59986cf2f
--- /dev/null
+++ b/libre-testing/uboot-am335x_green/0003-Beaglebone-green.patch
@@ -0,0 +1,26 @@
+From c830e24b1f197e5888a6471dcadb211d0c30c164 Mon Sep 17 00:00:00 2001
+From: Denis 'GNUtoo' Carikli <GNUtoo@no-log.org>
+Date: Wed, 22 Mar 2017 12:11:36 +0100
+Subject: [PATCH 3/3] Beaglebone green
+
+Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@no-log.org>
+---
+ include/configs/am335x_evm.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
+index 1a7d3e88a3..a6a326d54c 100644
+--- a/include/configs/am335x_evm.h
++++ b/include/configs/am335x_evm.h
+@@ -105,7 +105,7 @@
+ DEFAULT_LINUX_BOOT_ENV \
+ DEFAULT_MMC_TI_ARGS \
+ DEFAULT_FIT_TI_ARGS \
+- "bootpart=0:1\0" \
++ "bootpart=1:1\0" \
+ "bootdir=/boot\0" \
+ "bootfile=vmlinuz-linux-libre\0" \
+ "ramdiskfile=initramfs-linux-libre.img\0" \
+--
+2.12.1
+
diff --git a/libre-testing/uboot-am335x_green/PKGBUILD b/libre-testing/uboot-am335x_green/PKGBUILD
new file mode 100644
index 000000000..52cf1a2e6
--- /dev/null
+++ b/libre-testing/uboot-am335x_green/PKGBUILD
@@ -0,0 +1,54 @@
+# U-Boot: BeagleBone Green
+# Maintainer: Isaac David <isacdaavid@at@isacdaavid@dot@info>
+
+pkgname=uboot-am335x_green
+_gitver='d5abcf94c7123167725fc22ace342f0d455093c1'
+pkgver=20170328.g${_gitver:0:10}
+pkgrel=1
+pkgdesc="U-Boot for BeagleBone Green"
+arch=('armv7h')
+url="http://git.denx.de/u-boot.git/"
+makedepends=('git' 'bc' 'uboot-tools')
+depends=('linux-libre')
+replaces=('uboot-beaglebone')
+conflicts=('uboot4extlinux-am335x_bone' 'uboot4grub-am335x_bone'
+ 'grub-am335x_bone' 'uboot-am335x_bone')
+license=('GPL')
+install=${pkgname}.install
+source=("u-boot-${_gitver:0:10}::git+http://git.denx.de/u-boot.git"
+ '0001-am335x_evm-uEnv.txt-bootz-n-fixes.patch'
+ '0002-Forward-port-parabola-patch.patch'
+ '0003-Beaglebone-green.patch'
+ 'uEnv.txt'
+ 'boot.cmd')
+sha256sums=('SKIP'
+ 'c02bdad650f62e5fc465a2113f9b8c19f55833afc99d14230952cce712496502'
+ 'ca21d84c57f31878ee3288f52450dc09d5dc9de807de77d5bdf7d9b88d8dba59'
+ '7a659bf26d6c126da41723b6005d95fe0bb1e989ee42134104fbb757bb108c90'
+ '4ef3c3177e4476cdb1790dd021d2383ef9913c029d005ffbeb61b958e753672e'
+ '34e920015ba60acebd443b5d4d9b060cc9ae8aa6ed5f405f86645b6cdec0dbc1')
+
+prepare() {
+ cd u-boot-${_gitver:0:10}
+ git reset --hard ${_gitver}
+ patch -Np1 -i ../0001-am335x_evm-uEnv.txt-bootz-n-fixes.patch
+ patch -Np1 -i ../0002-Forward-port-parabola-patch.patch
+ patch -Np1 -i ../0003-Beaglebone-green.patch
+}
+
+build() {
+ cd u-boot-${pkgver}
+
+ unset CFLAGS CXXFLAGS LDFLAGS
+
+ make distclean
+ make am335x_evm_config
+ make
+ mkimage -A arm -O linux -T script -C none -d "${srcdir}"/boot.cmd boot.scr
+}
+
+package() {
+ cd u-boot-${pkgver}
+ mkdir -p "${pkgdir}"/boot
+ cp MLO u-boot.img boot.scr "${srcdir}"/uEnv.txt "${pkgdir}"/boot
+}
diff --git a/libre-testing/uboot-am335x_green/boot.cmd b/libre-testing/uboot-am335x_green/boot.cmd
new file mode 100644
index 000000000..8f738e508
--- /dev/null
+++ b/libre-testing/uboot-am335x_green/boot.cmd
@@ -0,0 +1,7 @@
+setenv bootargs console=ttyO0,115200n8 root=/dev/mapper/internal-rootfs coherent_pool=1M
+echo "Booting /boot/boot.scr"
+ext4load mmc 1:1 $loadaddr /boot/vmlinuz-linux-libre
+ext4load mmc 1:1 $rdaddr /boot/initramfs-linux-libre.img
+set rdsize ${filesize}
+ext4load mmc 1:1 $fdtaddr /boot/dtbs/linux-libre/am335x-bonegreen.dtb
+bootz ${loadaddr} ${rdaddr}:${rdsize} ${fdtaddr}
diff --git a/libre-testing/uboot-am335x_green/uEnv.txt b/libre-testing/uboot-am335x_green/uEnv.txt
new file mode 100644
index 000000000..f432efc6b
--- /dev/null
+++ b/libre-testing/uboot-am335x_green/uEnv.txt
@@ -0,0 +1 @@
+optargs=coherent_pool=1M
diff --git a/libre-testing/uboot-am335x_green/uboot-am335x_green.install b/libre-testing/uboot-am335x_green/uboot-am335x_green.install
new file mode 100644
index 000000000..24ccc1acb
--- /dev/null
+++ b/libre-testing/uboot-am335x_green/uboot-am335x_green.install
@@ -0,0 +1,32 @@
+flash_instructions() {
+ echo "# dd if=/boot/MLO of=/dev/mmcblk0 count=1 seek=1 conv=notrunc bs=128k"
+ echo "# dd if=/boot/u-boot.img of=/dev/mmcblk0 count=2 seek=1 conv=notrunc bs=384k"
+}
+
+flash_uboot() {
+ root=$(mount | awk '/ on \/ / { print $1; }')
+ if [[ $root =~ ^/dev/mmcblk.*$ ]]; then
+ root=${root:0:12}
+ echo "A new U-Boot version needs to be flashed onto $root."
+ echo "Do this now? [y|N]"
+ read -r shouldwe
+ if [[ $shouldwe =~ ^([yY][eE][sS]|[yY])$ ]]; then
+ dd if=/boot/MLO of=$root count=1 seek=1 conv=notrunc bs=128k
+ dd if=/boot/u-boot.img of=$root count=2 seek=1 conv=notrunc bs=384k
+ else
+ echo "You can do this later by running:"
+ flash_instructions
+ fi
+ else
+ echo "Flash the new U-Boot version onto your boot device. For example:"
+ flash_instructions
+ fi
+}
+
+post_install() {
+ flash_uboot
+}
+
+post_upgrade() {
+ flash_uboot
+}