Index | Thread | Search

From:
Jeremie Courreges-Anglas <jca@wxcvbn.org>
Subject:
Re: UPDATE: sysutils/u-boot
To:
Marcus Glocker <marcus@nazgul.ch>
Cc:
ports@openbsd.org, Mark Kettenis <mark.kettenis@xs4all.nl>
Date:
Mon, 11 Aug 2025 23:20:18 +0200

Download raw body.

Thread
On Mon, Aug 11, 2025 at 10:29:34PM +0200, Marcus Glocker wrote:
> On Mon, Aug 11, 2025 at 10:21:57PM +0200, Marcus Glocker wrote:
> 
> > Hi,
> > 
> > As discussed today with kettenis@ on icb hackers, we would like to make
> > two changes to sysutils/u-boot:
> > 
> > 	1. Split out the rpi part from aarch64, and move it to an own
> > 	   subdir.  This for example simplifies the testing during
> > 	   updates, by having a smaller subset of devices being
> > 	   impacted.
> > 
> > 	2. Update the rpi u-boot to 2025.07, the same version as we
> > 	   already use for rk356x and rk3588.  This is required to
> > 	   progress on the Raspberry Pi 5-B support.
> > 
> > I've decided to put both changes in to one diff.  I've tested the
> > new rpi u-boot successfully on the Raspberry Pi 3-B Plus, and the
> > Raspberry Pi 4-B.  My ask:
> > 
> > 	- Call for testing on the other supported Raspberry Pi devices.
> > 
> > 	- Any feedback on the diff itself.
> > 
> > Thanks,
> > Marcus
> 
> And as always, missed the aarch64 revision bump, noticed 5 seconds
> after hitting the send button.  Updated diff.

Fixes inline,

> 
> Index: sysutils/u-boot/Makefile
> ===================================================================
> RCS file: /cvs/ports/sysutils/u-boot/Makefile,v
> diff -u -p -u -p -r1.101 Makefile
> --- sysutils/u-boot/Makefile	9 Apr 2024 13:03:23 -0000	1.101
> +++ sysutils/u-boot/Makefile	11 Aug 2025 20:25:04 -0000
> @@ -4,6 +4,7 @@
>       SUBDIR += riscv64
>       SUBDIR += rk356x
>       SUBDIR += rk3588
> +     SUBDIR += rpi
>       SUBDIR += sun50i
>       SUBDIR += sunxi
>  
> Index: sysutils/u-boot/aarch64/Makefile
> ===================================================================
> RCS file: /cvs/ports/sysutils/u-boot/aarch64/Makefile,v
> diff -u -p -u -p -r1.8 Makefile
> --- sysutils/u-boot/aarch64/Makefile	21 Dec 2024 11:38:54 -0000	1.8
> +++ sysutils/u-boot/aarch64/Makefile	11 Aug 2025 20:25:04 -0000
> @@ -1,5 +1,5 @@
>  VERSION=	2021.10
> -REVISION=	10
> +REVISION=	11
>  
>  SOC=		aarch64
>  
> @@ -17,8 +17,7 @@ BOARDS=\
>  	rock960-rk3399 \
>  	rock-pi-4-rk3399 \
>  	rock-pi-n10-rk3399pro \
> -	rockpro64-rk3399 \
> -	rpi_arm64
> +	rockpro64-rk3399
>  
>  BUILD_DEPENDS+= devel/arm-none-eabi/gcc,aarch64 \
>  		devel/py-elftools \
> Index: sysutils/u-boot/aarch64/patches/patch-drivers_pci_pcie_brcmstb_c
> ===================================================================
> RCS file: sysutils/u-boot/aarch64/patches/patch-drivers_pci_pcie_brcmstb_c
> diff -N sysutils/u-boot/aarch64/patches/patch-drivers_pci_pcie_brcmstb_c
> --- sysutils/u-boot/aarch64/patches/patch-drivers_pci_pcie_brcmstb_c	11 Aug 2023 19:48:27 -0000	1.1
> +++ /dev/null	1 Jan 1970 00:00:00 -0000
> @@ -1,42 +0,0 @@
> -revert 'pci: brcmstb: Cleanup controller state before handover'
> -85f3fddbcc2e8282f1c26dcef4684f59490d47ba
> -
> -resetting pcie breaks pcie xhci on rpi4
> -
> -Index: drivers/pci/pcie_brcmstb.c
> ---- drivers/pci/pcie_brcmstb.c.orig
> -+++ drivers/pci/pcie_brcmstb.c
> -@@ -577,24 +577,6 @@ static int brcm_pcie_probe(struct udevice *dev)
> - 	return 0;
> - }
> - 
> --static int brcm_pcie_remove(struct udevice *dev)
> --{
> --	struct brcm_pcie *pcie = dev_get_priv(dev);
> --	void __iomem *base = pcie->base;
> --
> --	/* Assert fundamental reset */
> --	setbits_le32(base + PCIE_RGR1_SW_INIT_1, RGR1_SW_INIT_1_PERST_MASK);
> --
> --	/* Turn off SerDes */
> --	setbits_le32(base + PCIE_MISC_HARD_PCIE_HARD_DEBUG,
> --		     PCIE_HARD_DEBUG_SERDES_IDDQ_MASK);
> --
> --	/* Shutdown bridge */
> --	setbits_le32(base + PCIE_RGR1_SW_INIT_1, RGR1_SW_INIT_1_INIT_MASK);
> --
> --	return 0;
> --}
> --
> - static int brcm_pcie_of_to_plat(struct udevice *dev)
> - {
> - 	struct brcm_pcie *pcie = dev_get_priv(dev);
> -@@ -634,8 +616,6 @@ U_BOOT_DRIVER(pcie_brcm_base) = {
> - 	.ops			= &brcm_pcie_ops,
> - 	.of_match		= brcm_pcie_ids,
> - 	.probe			= brcm_pcie_probe,
> --	.remove			= brcm_pcie_remove,
> - 	.of_to_plat	= brcm_pcie_of_to_plat,
> - 	.priv_auto	= sizeof(struct brcm_pcie),
> --	.flags		= DM_FLAG_OS_PREPARE,
> - };
> Index: sysutils/u-boot/aarch64/pkg/PLIST
> ===================================================================
> RCS file: /cvs/ports/sysutils/u-boot/aarch64/pkg/PLIST,v
> diff -u -p -u -p -r1.3 PLIST
> --- sysutils/u-boot/aarch64/pkg/PLIST	24 Feb 2024 11:57:37 -0000	1.3
> +++ sysutils/u-boot/aarch64/pkg/PLIST	11 Aug 2025 20:25:04 -0000
> @@ -98,6 +98,3 @@ share/u-boot/rockpro64-rk3399/u-boot-roc
>  @comment share/u-boot/rockpro64-rk3399/u-boot.bin
>  @comment share/u-boot/rockpro64-rk3399/u-boot.img
>  share/u-boot/rockpro64-rk3399/u-boot.itb
> -share/u-boot/rpi_arm64/
> -@comment share/u-boot/rpi_arm64/u-boot
> -share/u-boot/rpi_arm64/u-boot.bin
> Index: sysutils/u-boot/rpi/Makefile
> ===================================================================
> RCS file: sysutils/u-boot/rpi/Makefile
> diff -N sysutils/u-boot/rpi/Makefile
> --- /dev/null	1 Jan 1970 00:00:00 -0000
> +++ sysutils/u-boot/rpi/Makefile	11 Aug 2025 20:25:04 -0000
> @@ -0,0 +1,28 @@
> +VERSION=	2025.07
> +
> +SOC=		rpi
> +
> +BOARDS=\
> +	rpi_arm64
> +
> +BUILD_DEPENDS+= devel/arm-none-eabi/gcc,aarch64 \
> +		devel/py-elftools \

You're missing shells/bash and security/gnutls, the build fails
without them installed.  Other recent u-boot ports also have a dep on
sysutils/e2fsprogs, but it doesn't seem required here.

> +		sysutils/arm-trusted-firmware>=2.2p0v0
> +CROSS_COMPILE=	aarch64-none-elf-
> +
> +do-build:
> +.for BOARD in ${BOARDS}
> +	cd ${WRKSRC} && \
> +	    mkdir -p build/${BOARD} && \
> +	    ${SETENV} ${MAKE_ENV} ${MAKE_PROGRAM} ${MAKE_FLAGS} \
> +	        O="build/${BOARD}" \
> +	        -f ${MAKE_FILE} "${BOARD}"_defconfig
> +	cd ${WRKSRC}/build/${BOARD} && \
> +	    ../../scripts/config --set-val BAUDRATE 115200
> +	cd ${WRKSRC} && \
> +	    ${SETENV} ${MAKE_ENV} ${MAKE_PROGRAM} ${MAKE_FLAGS} \
> +	        O="build/${BOARD}" \
> +	        -f ${MAKE_FILE} ${ALL_TARGET}
> +.endfor
> +
> +.include <bsd.port.mk>
> Index: sysutils/u-boot/rpi/distinfo
> ===================================================================
> RCS file: sysutils/u-boot/rpi/distinfo
> diff -N sysutils/u-boot/rpi/distinfo
> --- /dev/null	1 Jan 1970 00:00:00 -0000
> +++ sysutils/u-boot/rpi/distinfo	11 Aug 2025 20:25:04 -0000
> @@ -0,0 +1,2 @@
> +SHA256 (u-boot-2025.07.tar.bz2) = D5M/bFpCaJW/MG6T5qxTxghw5LVM2lbZUhG+yZ5jvsc=
> +SIZE (u-boot-2025.07.tar.bz2) = 33516210
> Index: sysutils/u-boot/rpi/patches/patch-drivers_pci_pcie_brcmstb_c
> ===================================================================
> RCS file: sysutils/u-boot/rpi/patches/patch-drivers_pci_pcie_brcmstb_c
> diff -N sysutils/u-boot/rpi/patches/patch-drivers_pci_pcie_brcmstb_c
> --- /dev/null	1 Jan 1970 00:00:00 -0000
> +++ sysutils/u-boot/rpi/patches/patch-drivers_pci_pcie_brcmstb_c	11 Aug 2025 20:25:04 -0000
> @@ -0,0 +1,41 @@
> +revert 'pci: brcmstb: Cleanup controller state before handover'
> +85f3fddbcc2e8282f1c26dcef4684f59490d47ba
> +
> +resetting pcie breaks pcie xhci on rpi4
> +
> +--- drivers/pci/pcie_brcmstb.c.orig	Mon Jul  7 17:48:28 2025
> ++++ drivers/pci/pcie_brcmstb.c	Sun Aug 10 19:49:25 2025
> +@@ -508,24 +508,6 @@ static int brcm_pcie_probe(struct udevice *dev)
> + 	return 0;
> + }
> + 
> +-static int brcm_pcie_remove(struct udevice *dev)
> +-{
> +-	struct brcm_pcie *pcie = dev_get_priv(dev);
> +-	void __iomem *base = pcie->base;
> +-
> +-	/* Assert fundamental reset */
> +-	setbits_le32(base + PCIE_RGR1_SW_INIT_1, PCIE_RGR1_SW_INIT_1_PERST_MASK);
> +-
> +-	/* Turn off SerDes */
> +-	setbits_le32(base + PCIE_MISC_HARD_PCIE_HARD_DEBUG,
> +-		     PCIE_HARD_DEBUG_SERDES_IDDQ_MASK);
> +-
> +-	/* Shutdown bridge */
> +-	setbits_le32(base + PCIE_RGR1_SW_INIT_1, PCIE_RGR1_SW_INIT_1_INIT_MASK);
> +-
> +-	return 0;
> +-}
> +-
> + static int brcm_pcie_of_to_plat(struct udevice *dev)
> + {
> + 	struct brcm_pcie *pcie = dev_get_priv(dev);
> +@@ -565,8 +547,6 @@ U_BOOT_DRIVER(pcie_brcm_base) = {
> + 	.ops			= &brcm_pcie_ops,
> + 	.of_match		= brcm_pcie_ids,
> + 	.probe			= brcm_pcie_probe,
> +-	.remove			= brcm_pcie_remove,
> + 	.of_to_plat	= brcm_pcie_of_to_plat,
> + 	.priv_auto	= sizeof(struct brcm_pcie),
> +-	.flags		= DM_FLAG_OS_PREPARE,
> + };
> Index: sysutils/u-boot/rpi/pkg/DESCR
> ===================================================================
> RCS file: sysutils/u-boot/rpi/pkg/DESCR
> diff -N sysutils/u-boot/rpi/pkg/DESCR
> --- /dev/null	1 Jan 1970 00:00:00 -0000
> +++ sysutils/u-boot/rpi/pkg/DESCR	11 Aug 2025 20:25:04 -0000
> @@ -0,0 +1,8 @@
> +U-Boot is a firmware for embedded boards based on PowerPC, ARM, MIPS and
> +several other processors, which can be installed in a boot ROM and used to
> +initialize and test the hardware or to download and run application code.
> +
> +As ARM systems often do not come with firmware it must be supplied on
> +an SD card or MMC device to have a bootable system.
> +
> +This package provides U-Boot for various Raspberry Pi boards using 64-bit ARM processors.

Please fold to 80 characters (as hinted by portcheck(1)).

> Index: sysutils/u-boot/rpi/pkg/PLIST
> ===================================================================
> RCS file: sysutils/u-boot/rpi/pkg/PLIST
> diff -N sysutils/u-boot/rpi/pkg/PLIST
> --- /dev/null	1 Jan 1970 00:00:00 -0000
> +++ sysutils/u-boot/rpi/pkg/PLIST	11 Aug 2025 20:25:04 -0000
> @@ -0,0 +1,5 @@
> +@pkgpath sysutils/u-boot,rpi

Please drop this line which isn't needed - when sysutils/u-boot was a
single port there was no "rpi" FLAVOR - and instead add

@conflict u-boot-aarch64-<2021.10p11

In my tests this is needed for pkg_add -U u-boot-rpi to work out of
the box.  With these fixes applied ok jca@ ports-wise (no rpi at hand
to test).

> +share/u-boot/
> +share/u-boot/rpi_arm64/
> +@comment share/u-boot/rpi_arm64/u-boot
> +share/u-boot/rpi_arm64/u-boot.bin
> 

-- 
jca