Experience report: u-boot update 2020.07 -> 2020.10 seems to go fairly well on the few u-boots that I've tested

Mark Millard marklmi at yahoo.com
Sat Oct 17 01:27:27 UTC 2020


I've built (via poudriere), installed, and booted the
following upgrades (ones that I've working hardware
for):

        u-boot-orangepi-plus-2e: 2020.07 -> 2020.10
        u-boot-rock64: 2020.07 -> 2020.10
        u-boot-rpi2: 2020.07 -> 2020.10
        u-boot-rpi3: 2020.07 -> 2020.10
        u-boot-rpi4: 2020.07 -> 2020.10

The rpi*'s were for experiments with using modern
firmware (and eeprom content for the rpi4). Initial
problems turned out to be RPi* firmware problems,
instead of u-boot or armstub8*.bin problems.

One issue for the RPi3 and RPi4 is that FreeBSD
ended up with no /dev/mmcsd*'s. But this may well
be rpi .dtb files or fdt output from the firmware
needing to be tracked --instead of being a u-boot
issue.

Like before 2020.10, u-boot does not yet deal with
8 GiByte RPi4B's xHCI/USB. I'd not count this
against any potential u-boot vintage upgrade.

All my testing is from/for a head -r365932 context.

I've built the following upgrades but the hardware
for using them bit the dust some time ago or is
now very flaky/unreliable to use:

        u-boot-pine64: 2020.07 -> 2020.10
        u-boot-sinovoip-bpi-m3: 2020.07 -> 2020.10


The updates above are all based on:

# svnlite status /usr/ports/sysutils/
M       /usr/ports/sysutils/u-boot-master/Makefile
M       /usr/ports/sysutils/u-boot-master/distinfo
M       /usr/ports/sysutils/u-boot-pine64/Makefile
?       /usr/ports/sysutils/u-boot-rpi3/files/patch-board__raspberrypi__rpi__lowlevel_init.S
?       /usr/ports/sysutils/u-boot-rpi3/files/patch-board__raspberrypi__rpi__rpi.c
?       /usr/ports/sysutils/u-boot-rpi4/files/patch-board__raspberrypi__rpi__lowlevel_init.S
?       /usr/ports/sysutils/u-boot-rpi4/files/patch-board__raspberrypi__rpi__rpi.c
M       /usr/ports/sysutils/u-boot-tools/Makefile
M       /usr/ports/sysutils/u-boot-tools/distinfo

One possible oddity in the below is that I added
u-boot (the ELF file) to UBOOT_PLIST_RPI in order
to have a file that my normal tools could look at
easily. Either (A) that change should be removed
or (B) having the ELF file installed for that
purpose should be done more generally. Something
to consider.

The pine64 change just avoids a race during its
build activity: adding MAKE_JOBS_UNSAFE=yes .
(This has been in my environment for a long time.)

I will note that the ports activity is against
head -r544650. I've not updated the port trees
in some time but the ports involved do not change
often.

# svnlite diff /usr/ports/sysutils/u-boot-tools/
Index: /usr/ports/sysutils/u-boot-tools/Makefile
===================================================================
--- /usr/ports/sysutils/u-boot-tools/Makefile	(revision 544650)
+++ /usr/ports/sysutils/u-boot-tools/Makefile	(working copy)
@@ -2,7 +2,7 @@
 # $FreeBSD$
 
 PORTNAME=	u-boot-tools
-DISTVERSION=	2020.07
+DISTVERSION=	2020.10
 CATEGORIES=	sysutils
 MASTER_SITES=	ftp://ftp.denx.de/pub/u-boot/
 DISTNAME=	u-boot-${PORTVERSION}
Index: /usr/ports/sysutils/u-boot-tools/distinfo
===================================================================
--- /usr/ports/sysutils/u-boot-tools/distinfo	(revision 544650)
+++ /usr/ports/sysutils/u-boot-tools/distinfo	(working copy)
@@ -1,3 +1,3 @@
-TIMESTAMP = 1594115686
-SHA256 (u-boot-2020.07.tar.bz2) = c1f5bf9ee6bb6e648edbf19ce2ca9452f614b08a9f886f1a566aa42e8cf05f6a
-SIZE (u-boot-2020.07.tar.bz2) = 15338841
+TIMESTAMP = 1602203101
+SHA256 (u-boot-2020.10.tar.bz2) = 0d481bbdc05c0ee74908ec2f56a6daa53166cc6a78a0e4fac2ac5d025770a622
+SIZE (u-boot-2020.10.tar.bz2) = 15784894


# svnlite diff /usr/ports/sysutils/u-boot-master/
Index: /usr/ports/sysutils/u-boot-master/Makefile
===================================================================
--- /usr/ports/sysutils/u-boot-master/Makefile	(revision 544650)
+++ /usr/ports/sysutils/u-boot-master/Makefile	(working copy)
@@ -79,7 +79,7 @@
 UBOOT_MOVE_ZYNQ_7000=${WRKSRC}/spl/boot.bin ${.CURDIR}/files/uEnv.txt
 
 # Overrides for RPI family
-UBOOT_PLIST_RPI=	u-boot.bin
+UBOOT_PLIST_RPI=	u-boot.bin u-boot
 UBOOT_METADATA_RPI_FILES=	${UBOOT_PLIST_RPI}
 UBOOT_METADATA_RPI_METHOD=	file
 
@@ -111,7 +111,7 @@
 .if !defined(UBOOT_VERSION) && defined(UBOOT_VERSION_${FAMILY:tu})
 UBOOT_VERSION=${UBOOT_VERSION_${FAMILY:tu}}
 .endif
-UBOOT_VERSION?=	2020.07
+UBOOT_VERSION?=	2020.10
 
 # If a slave port defines a PORTREVISION use it
 .if defined(U_BOOT_SLAVE_PORTREVISION_${UBOOT_VERSION})
Index: /usr/ports/sysutils/u-boot-master/distinfo
===================================================================
--- /usr/ports/sysutils/u-boot-master/distinfo	(revision 544650)
+++ /usr/ports/sysutils/u-boot-master/distinfo	(working copy)
@@ -1,13 +1,5 @@
-TIMESTAMP = 1594110266
-SHA256 (u-boot/u-boot-2020.07.tar.bz2) = c1f5bf9ee6bb6e648edbf19ce2ca9452f614b08a9f886f1a566aa42e8cf05f6a
-SIZE (u-boot/u-boot-2020.07.tar.bz2) = 15338841
+TIMESTAMP = 1602204297
+SHA256 (u-boot/u-boot-2020.10.tar.bz2) = 0d481bbdc05c0ee74908ec2f56a6daa53166cc6a78a0e4fac2ac5d025770a622
+SIZE (u-boot/u-boot-2020.10.tar.bz2) = 15784894
 SHA256 (u-boot/939129/raw) = 2a4ebf283aec8e74ec77b3cb071c6883f73807454ca94fea78361c7391187b97
 SIZE (u-boot/939129/raw) = 310
-SHA256 (u-boot/1036621/raw) = 28dbd66d14fab9dc782ce091d3c132a226b8425f6503c329ee8a7031b79b52f7
-SIZE (u-boot/1036621/raw) = 480
-SHA256 (u-boot/1173473/raw) = 4f182d6f99b1d868237607200d64a1d8a2d57ea44fc25ca49bce929ad6457228
-SIZE (u-boot/1173473/raw) = 433
-SHA256 (u-boot/1172554/raw) = d1a39d7d6487cfb481392e7ea4f0bf0d209c08e0c3426c29d7eeaeb9b806cf42
-SIZE (u-boot/1172554/raw) = 640
-SHA256 (u-boot/1172555/raw) = 09d17a62fb6bc7c7ab73bfc7061fc5da2b5a32e7deb098c9f76aed8ff8991751
-SIZE (u-boot/1172555/raw) = 568


# svnlite diff /usr/ports/sysutils/u-boot-pine64/
Index: /usr/ports/sysutils/u-boot-pine64/Makefile
===================================================================
--- /usr/ports/sysutils/u-boot-pine64/Makefile	(revision 544650)
+++ /usr/ports/sysutils/u-boot-pine64/Makefile	(working copy)
@@ -6,4 +6,6 @@
 BOARD_CONFIG=	pine64_plus_defconfig
 FAMILY=		allwinner64
 
+MAKE_JOBS_UNSAFE=yes
+
 .include "${MASTERDIR}/Makefile"


The RPi3 and RPi4 patches are for handling extra behavior
of the armstub8.bin and armstub8-gic.bin : having u-boot
explicitly avoid using some associated memory. So far as
I know this goes beyond what upstream expects and would
require upstream to update interface definitions before
they would accept even similar code.

The content is the same for the RPi3 and RPi4, despite
the duplications as I've done things in my environment.

# more /usr/ports/sysutils/u-boot-rpi3/files/patch-board__raspberrypi__rpi__lowlevel_init.S
--- board/raspberrypi/rpi/lowlevel_init.S.orig  2020-10-05 08:15:32.000000000 -0700
+++ board/raspberrypi/rpi/lowlevel_init.S       2020-10-13 11:33:39.273950000 -0700
@@ -18,9 +18,22 @@
 #ifdef CONFIG_ARM64
        adr     x8, fw_dtb_pointer
        str     x0, [x8]
+#if defined(CONFIG_EFI_LOADER)
+       /* Setup to allow reserving the stack and such that is */
+       /* after the likes of FreeBSD armstub8-gic.bin in RAM. */
+       adr     x8, armstub_rsrvd
+       str     x1, [x8]
+#endif
 #else
        ldr     r8, =fw_dtb_pointer
        str     r2, [r8]
+#if defined(CONFIG_EFI_LOADER)
+#error "Before aarch64 does not use armstub*.bin files"
+       /* Setup to allow reserving the stack and such that is */
+       /* after the likes of a armstub*.bin in RAM. */
+       ldr     r8, =armstub_rsrvd
+       str     r3, [r8]
+#endif
 #endif
 
        /* Returns */


(After the #error, I choose to show what the code would be like
if later put to use. It is another thing an actual update might
want to omit.)

# more /usr/ports/sysutils/u-boot-rpi4/files/patch-board__raspberrypi__rpi__lowlevel_init.S
--- board/raspberrypi/rpi/lowlevel_init.S.orig  2020-10-05 08:15:32.000000000 -0700
+++ board/raspberrypi/rpi/lowlevel_init.S       2020-10-13 11:33:39.273950000 -0700
@@ -18,9 +18,22 @@
 #ifdef CONFIG_ARM64
        adr     x8, fw_dtb_pointer
        str     x0, [x8]
+#if defined(CONFIG_EFI_LOADER)
+       /* Setup to allow reserving the stack and such that is */
+       /* after the likes of FreeBSD armstub8-gic.bin in RAM. */
+       adr     x8, armstub_rsrvd
+       str     x1, [x8]
+#endif
 #else
        ldr     r8, =fw_dtb_pointer
        str     r2, [r8]
+#if defined(CONFIG_EFI_LOADER)
+#error "Before aarch64 does not use armstub*.bin files"
+       /* Setup to allow reserving the stack and such that is */
+       /* after the likes of a armstub*.bin in RAM. */
+       ldr     r8, =armstub_rsrvd
+       str     r3, [r8]
+#endif
 #endif
 
        /* Returns */


# more /usr/ports/sysutils/u-boot-rpi3/files/patch-board__raspberrypi__rpi__rpi.c
--- board/raspberrypi/rpi/rpi.c.orig    2020-10-05 08:15:32.000000000 -0700
+++ board/raspberrypi/rpi/rpi.c 2020-10-13 11:02:15.582706000 -0700
@@ -12,6 +12,7 @@
 #include <fdt_simplefb.h>
 #include <init.h>
 #include <lcd.h>
+#include <lmb.h>
 #include <memalign.h>
 #include <mmc.h>
 #include <asm/gpio.h>
@@ -33,6 +34,7 @@
  * does not get cleared later.
  */
 unsigned long __section(".data") fw_dtb_pointer;
+unsigned long __section(".data") armstub_rsrvd;
 
 /* TODO(sjg at chromium.org): Move these to the msg.c file */
 struct msg_get_arm_mem {
@@ -494,4 +496,29 @@
 #endif
 
        return 0;
+}
+
+void board_lmb_reserve(struct lmb *lmb)
+{
+#ifdef CONFIG_EFI_LOADER
+       /*
+        * NOTE: lmb_reserve (and more) does not deal with overlaps with
+        *       pre-existing reservations.
+        *       But board_lmb_reserve is called before the original
+        *       first-page is added. So use knowledge of what will happen
+        *       later to avoid overlaps.
+        */
+
+       phys_addr_t base = 0x0u;
+       phys_addr_t size = CONFIG_RPI_EFI_NR_SPIN_PAGES << EFI_PAGE_SHIFT;
+       if (size < armstub_rsrvd) size = armstub_rsrvd;
+
+       if (size <= EFI_PAGE_SIZE) return;
+
+       /* Avoid future overlap */
+       base += EFI_PAGE_SIZE;
+       size -= EFI_PAGE_SIZE;
+
+       lmb_reserve(lmb, base, size);
+#endif
 }


# more /usr/ports/sysutils/u-boot-rpi4/files/patch-board__raspberrypi__rpi__rpi.c
--- board/raspberrypi/rpi/rpi.c.orig    2020-10-05 08:15:32.000000000 -0700
+++ board/raspberrypi/rpi/rpi.c 2020-10-13 11:02:15.582706000 -0700
@@ -12,6 +12,7 @@
 #include <fdt_simplefb.h>
 #include <init.h>
 #include <lcd.h>
+#include <lmb.h>
 #include <memalign.h>
 #include <mmc.h>
 #include <asm/gpio.h>
@@ -33,6 +34,7 @@
  * does not get cleared later.
  */
 unsigned long __section(".data") fw_dtb_pointer;
+unsigned long __section(".data") armstub_rsrvd;
 
 /* TODO(sjg at chromium.org): Move these to the msg.c file */
 struct msg_get_arm_mem {
@@ -494,4 +496,29 @@
 #endif
 
        return 0;
+}
+
+void board_lmb_reserve(struct lmb *lmb)
+{
+#ifdef CONFIG_EFI_LOADER
+       /*
+        * NOTE: lmb_reserve (and more) does not deal with overlaps with
+        *       pre-existing reservations.
+        *       But board_lmb_reserve is called before the original
+        *       first-page is added. So use knowledge of what will happen
+        *       later to avoid overlaps.
+        */
+
+       phys_addr_t base = 0x0u;
+       phys_addr_t size = CONFIG_RPI_EFI_NR_SPIN_PAGES << EFI_PAGE_SHIFT;
+       if (size < armstub_rsrvd) size = armstub_rsrvd;
+
+       if (size <= EFI_PAGE_SIZE) return;
+
+       /* Avoid future overlap */
+       base += EFI_PAGE_SIZE;
+       size -= EFI_PAGE_SIZE;
+
+       lmb_reserve(lmb, base, size);
+#endif
 }


===
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)



More information about the freebsd-arm mailing list