meta-hpe: Update U-Boot from 2019.07 to 2020.10

Signed-off-by: Mike Garrett <mike.garrett@hpe.com>
Change-Id: I538f9e74fdc90d3eb1e7e778b2ff99777b0d07d7
diff --git a/meta-hpe/meta-gxp/conf/machine/include/fitimage-sign.inc b/meta-hpe/meta-gxp/conf/machine/include/fitimage-sign.inc
new file mode 100644
index 0000000..80af00a
--- /dev/null
+++ b/meta-hpe/meta-gxp/conf/machine/include/fitimage-sign.inc
@@ -0,0 +1,14 @@
+inherit uboot-sign
+
+UBOOT_SIGN_ENABLE = "0"
+UBOOT_SIGN_KEYDIR = "${COREBASE}/meta-hpe/meta-gxp/recipes-bsp/u-boot/u-boot-gxp/"
+UBOOT_SIGN_KEYNAME = "dev"
+FIT_HASH_ALG = "sha512"
+UBOOT_FIT_HASH_ALG = "sha512"
+
+concat_dtb_helper:append() {
+	if [ -e "${DEPLOYDIR}/${UBOOT_NODTB_IMAGE}" -a -e "$deployed_uboot_dtb_binary" ]; then
+		cd ${DEPLOYDIR}
+		cat ${UBOOT_NODTB_IMAGE} $deployed_uboot_dtb_binary | tee ${B}/${UBOOT_BINARY} > ${UBOOT_IMAGE}
+	fi
+}
diff --git a/meta-hpe/meta-gxp/conf/machine/include/gxp.inc b/meta-hpe/meta-gxp/conf/machine/include/gxp.inc
index 8f515d9..e318145 100644
--- a/meta-hpe/meta-gxp/conf/machine/include/gxp.inc
+++ b/meta-hpe/meta-gxp/conf/machine/include/gxp.inc
@@ -15,8 +15,8 @@
 DEFAULTTUNE ?= "armv6-novfp"
 require conf/machine/include/arm/arch-armv6.inc
 
-UBOOT_MACHINE = "gxp_defconfig"
-UBOOT_ENTRYPOINT = "0x40100000"
-UBOOT_LOADADDRESS = "0x40100000"
+UBOOT_MACHINE ?= "gxp_defconfig"
+UBOOT_ENTRYPOINT ?= "0x40100000"
+UBOOT_LOADADDRESS ?= "0x40100000"
 
 
diff --git a/meta-hpe/meta-gxp/conf/machine/include/hpe_soc.inc b/meta-hpe/meta-gxp/conf/machine/include/hpe_soc.inc
index 016d9c6..747e776 100644
--- a/meta-hpe/meta-gxp/conf/machine/include/hpe_soc.inc
+++ b/meta-hpe/meta-gxp/conf/machine/include/hpe_soc.inc
@@ -2,5 +2,5 @@
 
 PREFERRED_PROVIDER_virtual/bootloader ?= "u-boot-gxp"
 PREFERRED_PROVIDER_u-boot ?= "u-boot-gxp"
-//PREFERRED_PROVIDER_u-boot-fw-utils ?= "u-boot-fw-utils-gxp"
+PREFERRED_PROVIDER_u-boot-fw-utils ?= "u-boot-fw-utils-gxp"
 
diff --git a/meta-hpe/meta-gxp/recipes-bsp/u-boot/u-boot-common-gxp_2019.07.inc b/meta-hpe/meta-gxp/recipes-bsp/u-boot/u-boot-common-gxp_2020.10.inc
similarity index 66%
rename from meta-hpe/meta-gxp/recipes-bsp/u-boot/u-boot-common-gxp_2019.07.inc
rename to meta-hpe/meta-gxp/recipes-bsp/u-boot/u-boot-common-gxp_2020.10.inc
index 13cd7b4..2efeb9e 100644
--- a/meta-hpe/meta-gxp/recipes-bsp/u-boot/u-boot-common-gxp_2019.07.inc
+++ b/meta-hpe/meta-gxp/recipes-bsp/u-boot/u-boot-common-gxp_2020.10.inc
@@ -1,4 +1,4 @@
-HOMEPAGE = "https://www.github.com/HewlettPackard/gxp-uboot"
+HOMEPAGE = "https://github.com/HewlettPackard/gxp-uboot"
 DEPENDS += "flex-native bison-native bc-native"
 
 LICENSE = "GPLv2+"
@@ -7,10 +7,10 @@
 
 # We use the revision in order to avoid having to fetch it from the
 # repo during parse
-SRCREV = "e15b2ace2d7f38d470ba3b0415d47e05281c7660"
-UBRANCH = "v2019.07-gxp-openbmc"
+SRCREV = "b139a8a9e6e89e4115741498d454847d99239eda"
+UBRANCH = "v2020.10-gxp-openbmc"
 SRC_URI = "git://github.com/HewlettPackard/gxp-uboot.git;branch=${UBRANCH}"
 
 S = "${WORKDIR}/git"
 
-PV = "v2019.07+git${SRCPV}"
+PV = "v2020.10+git${SRCPV}"
diff --git a/meta-hpe/meta-gxp/recipes-bsp/u-boot/u-boot-fw-utils-gxp/alt_fw_env.config b/meta-hpe/meta-gxp/recipes-bsp/u-boot/u-boot-fw-utils-gxp/alt_fw_env.config
new file mode 100644
index 0000000..3d85f99
--- /dev/null
+++ b/meta-hpe/meta-gxp/recipes-bsp/u-boot/u-boot-fw-utils-gxp/alt_fw_env.config
@@ -0,0 +1,25 @@
+# Configuration file for fw_(printenv/setenv) utility.
+# Up to two entries are valid, in this case the redundant
+# environment sector is assumed present.
+# Notice, that the "Number of sectors" is ignored on NOR and SPI-dataflash.
+# Furthermore, if the Flash sector size is omitted, this value is assumed to
+# be the same as the Environment size, which is valid for NOR and SPI-dataflash
+
+# NOR example
+# MTD device name	Device offset	Env. size	Flash sector size	Number of sectors
+#/dev/mtd1		0x0000		0x20000		0x20000
+#/dev/mtd2		0x0000		0x4000		0x4000
+
+# MTD SPI-dataflash example
+# MTD device name	Device offset	Env. size	Flash sector size	Number of sectors
+#/dev/mtd2		0x00000		0x20000
+/dev/mtd/alt-u-boot-env	0x00000		0x10000
+/dev/mtd/alt-u-boot-env	0x10000		0x10000
+#/dev/mtd5		0x4200		0x4200
+#/dev/mtd6		0x4200		0x4200
+
+# NAND example
+#/dev/mtd0		0x4000		0x4000		0x20000			2
+
+# Block device example
+#/dev/mmcblk0		0xc0000		0x20000
diff --git a/meta-hpe/meta-gxp/recipes-bsp/u-boot/u-boot-fw-utils-gxp/fw_env.config b/meta-hpe/meta-gxp/recipes-bsp/u-boot/u-boot-fw-utils-gxp/fw_env.config
new file mode 100644
index 0000000..19ace4b
--- /dev/null
+++ b/meta-hpe/meta-gxp/recipes-bsp/u-boot/u-boot-fw-utils-gxp/fw_env.config
@@ -0,0 +1,25 @@
+# Configuration file for fw_(printenv/setenv) utility.
+# Up to two entries are valid, in this case the redundant
+# environment sector is assumed present.
+# Notice, that the "Number of sectors" is ignored on NOR and SPI-dataflash.
+# Furthermore, if the Flash sector size is omitted, this value is assumed to
+# be the same as the Environment size, which is valid for NOR and SPI-dataflash
+
+# NOR example
+# MTD device name	Device offset	Env. size	Flash sector size	Number of sectors
+#/dev/mtd1		0x0000		0x20000		0x20000
+#/dev/mtd2		0x0000		0x4000		0x4000
+
+# MTD SPI-dataflash example
+# MTD device name	Device offset	Env. size	Flash sector size	Number of sectors
+#/dev/mtd2		0x00000		0x20000
+/dev/mtd/u-boot-env	0x00000		0x10000
+/dev/mtd/u-boot-env	0x10000		0x10000
+#/dev/mtd5		0x4200		0x4200
+#/dev/mtd6		0x4200		0x4200
+
+# NAND example
+#/dev/mtd0		0x4000		0x4000		0x20000			2
+
+# Block device example
+#/dev/mmcblk0		0xc0000		0x20000
diff --git a/meta-hpe/meta-gxp/recipes-bsp/u-boot/u-boot-fw-utils-gxp_2020.10.bb b/meta-hpe/meta-gxp/recipes-bsp/u-boot/u-boot-fw-utils-gxp_2020.10.bb
new file mode 100644
index 0000000..daf5a2c
--- /dev/null
+++ b/meta-hpe/meta-gxp/recipes-bsp/u-boot/u-boot-fw-utils-gxp_2020.10.bb
@@ -0,0 +1,46 @@
+require u-boot-common-gxp_2020.10.inc
+
+SRC_URI += "file://fw_env.config"
+SRC_URI += "file://alt_fw_env.config"
+
+# FIXME - Get fw_printenv/fw_setenv tool
+UBOOT_MACHINE ?= "gxp_defconfig"
+
+SUMMARY = "U-Boot bootloader fw_printenv/setenv utilities"
+DEPENDS += "mtd-utils"
+
+PROVIDES += "u-boot-fw-utils"
+
+INSANE_SKIP:${PN} = "already-stripped"
+EXTRA_OEMAKE:class-target = 'CROSS_COMPILE=${TARGET_PREFIX} CC="${CC} ${CFLAGS} ${LDFLAGS}" HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" V=1'
+EXTRA_OEMAKE:class-cross = 'ARCH=${TARGET_ARCH} CC="${CC} ${CFLAGS} ${LDFLAGS}" V=1'
+
+inherit uboot-config
+
+do_compile () {
+	oe_runmake ${UBOOT_MACHINE}
+	oe_runmake envtools
+}
+
+do_install () {
+	install -d ${D}${base_sbindir}
+	install -m 755 ${S}/tools/env/fw_printenv ${D}${base_sbindir}/fw_printenv
+	ln -sf fw_printenv ${D}${base_sbindir}/fw_setenv
+
+	install -d ${D}${sysconfdir}
+	install -m 644 ${WORKDIR}/fw_env.config ${D}${sysconfdir}/fw_env.config
+	install -m 644 ${WORKDIR}/alt_fw_env.config ${D}${sysconfdir}/alt_fw_env.config
+}
+
+do_install:class-cross () {
+	install -d ${D}${bindir_cross}
+	install -m 755 ${S}/tools/env/fw_printenv ${D}${bindir_cross}/fw_printenv
+	ln -sf fw_printenv ${D}${bindir_cross}/fw_setenv
+}
+
+SYSROOT_DIRS:append:class-cross = " ${bindir_cross}"
+
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+BBCLASSEXTEND = "cross"
+
+RDEPENDS:${PN} = "udev-gxp-mtd-partitions"
diff --git a/meta-hpe/meta-gxp/recipes-bsp/u-boot/u-boot-gxp_2019.07.bb b/meta-hpe/meta-gxp/recipes-bsp/u-boot/u-boot-gxp_2019.07.bb
deleted file mode 100644
index 58a65b3..0000000
--- a/meta-hpe/meta-gxp/recipes-bsp/u-boot/u-boot-gxp_2019.07.bb
+++ /dev/null
@@ -1,7 +0,0 @@
-require recipes-bsp/u-boot/u-boot-common.inc
-require recipes-bsp/u-boot/u-boot.inc
-require u-boot-common-gxp_2019.07.inc
-
-S = "${WORKDIR}/git"
-
-PROVIDES += "u-boot"
diff --git a/meta-hpe/meta-gxp/recipes-bsp/u-boot/u-boot-gxp_2020.10.bb b/meta-hpe/meta-gxp/recipes-bsp/u-boot/u-boot-gxp_2020.10.bb
new file mode 100644
index 0000000..92e1975
--- /dev/null
+++ b/meta-hpe/meta-gxp/recipes-bsp/u-boot/u-boot-gxp_2020.10.bb
@@ -0,0 +1,8 @@
+require recipes-bsp/u-boot/u-boot-common.inc
+require recipes-bsp/u-boot/u-boot.inc
+require u-boot-common-gxp_2020.10.inc
+require conf/machine/include/fitimage-sign.inc
+
+S = "${WORKDIR}/git"
+
+PROVIDES += "u-boot"