Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 0/2] Improvements for U-Boot on RPi boards
@ 2024-06-18 19:39 Fiona Klute via buildroot
  2024-06-18 19:40 ` [Buildroot] [PATCH 1/2] board/raspberrypi: Support boot.scr for U-Boot Fiona Klute via buildroot
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Fiona Klute via buildroot @ 2024-06-18 19:39 UTC (permalink / raw)
  To: buildroot; +Cc: José Mendes, Fiona Klute

I'm working on a system that needs U-Boot to manage booting on an
RPi-based board. These two patches make working with this setup
easier, though they aren't a complete setup (they do not include a
boot script, and do not prescribe where the Linux kernel is stored).

If there's interest it should be possible to expand this into an
RPi/U-Boot defconfig.

Fiona Klute (2):
  board/raspberrypi: Support boot.scr for U-Boot
  board/raspberrypi: Enable nullglob for DTBs

 board/raspberrypi/post-image.sh | 7 +++++++
 1 file changed, 7 insertions(+)

--
2.45.2

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH 1/2] board/raspberrypi: Support boot.scr for U-Boot
  2024-06-18 19:39 [Buildroot] [PATCH 0/2] Improvements for U-Boot on RPi boards Fiona Klute via buildroot
@ 2024-06-18 19:40 ` Fiona Klute via buildroot
  2024-08-30 21:47   ` Yann E. MORIN
  2024-06-18 19:40 ` [Buildroot] [PATCH 2/2] board/raspberrypi: Enable nullglob for DTBs Fiona Klute via buildroot
  2024-08-30 21:45 ` [Buildroot] [PATCH 0/2] Improvements for U-Boot on RPi boards Yann E. MORIN
  2 siblings, 1 reply; 6+ messages in thread
From: Fiona Klute via buildroot @ 2024-06-18 19:40 UTC (permalink / raw)
  To: buildroot; +Cc: José Mendes, Fiona Klute

If using U-Boot as "kernel" for the raspberrypi bootloader, include
boot.scr in the boot partition if it exists.

To use this, use BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE to set a config
file that uses U-Boot, and enable building a boot script in the U-Boot
host tool settings.

Signed-off-by: Fiona Klute <fiona.klute+wiwa@gmx.de>
---
 board/raspberrypi/post-image.sh | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/board/raspberrypi/post-image.sh b/board/raspberrypi/post-image.sh
index 9b9eac972b..e4611d05dd 100755
--- a/board/raspberrypi/post-image.sh
+++ b/board/raspberrypi/post-image.sh
@@ -19,6 +19,12 @@ if [ ! -e "${GENIMAGE_CFG}" ]; then
 	KERNEL=$(sed -n 's/^kernel=//p' "${BINARIES_DIR}/rpi-firmware/config.txt")
 	FILES+=( "${KERNEL}" )

+	# If config.txt calls for running U-Boot, include the boot
+	# script if any.
+	if [ "${KERNEL}" = "u-boot.bin" ] && [ -e "${BINARIES_DIR}/boot.scr" ]; then
+		FILES+=( "boot.scr" )
+	fi
+
 	BOOT_FILES=$(printf '\\t\\t\\t"%s",\\n' "${FILES[@]}")
 	sed "s|#BOOT_FILES#|${BOOT_FILES}|" "${BOARD_DIR}/genimage.cfg.in" \
 		> "${GENIMAGE_CFG}"
--
2.45.2

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH 2/2] board/raspberrypi: Enable nullglob for DTBs
  2024-06-18 19:39 [Buildroot] [PATCH 0/2] Improvements for U-Boot on RPi boards Fiona Klute via buildroot
  2024-06-18 19:40 ` [Buildroot] [PATCH 1/2] board/raspberrypi: Support boot.scr for U-Boot Fiona Klute via buildroot
@ 2024-06-18 19:40 ` Fiona Klute via buildroot
  2024-08-30 21:50   ` Yann E. MORIN
  2024-08-30 21:45 ` [Buildroot] [PATCH 0/2] Improvements for U-Boot on RPi boards Yann E. MORIN
  2 siblings, 1 reply; 6+ messages in thread
From: Fiona Klute via buildroot @ 2024-06-18 19:40 UTC (permalink / raw)
  To: buildroot; +Cc: José Mendes, Fiona Klute

With "nullglob" the post image script does not fail if there's no DTB
directly in BINARIES_DIR. This is required when using DTBs from the
rpi-firmware package (BR2_PACKAGE_RPI_FIRMWARE_INSTALL_DTBS=y),
because in that case the kernel build doesn't provide one.

Using pre-compiled DTBs is discouraged, but useful for using mainline
kernels until suitable DTS can be merged.

Signed-off-by: Fiona Klute <fiona.klute+wiwa@gmx.de>
---
 board/raspberrypi/post-image.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/board/raspberrypi/post-image.sh b/board/raspberrypi/post-image.sh
index e4611d05dd..b7ccf5d0b3 100755
--- a/board/raspberrypi/post-image.sh
+++ b/board/raspberrypi/post-image.sh
@@ -1,6 +1,7 @@
 #!/bin/bash

 set -e
+shopt -s nullglob

 BOARD_DIR="$(dirname $0)"
 BOARD_NAME="$(basename ${BOARD_DIR})"
--
2.45.2

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Buildroot] [PATCH 0/2] Improvements for U-Boot on RPi boards
  2024-06-18 19:39 [Buildroot] [PATCH 0/2] Improvements for U-Boot on RPi boards Fiona Klute via buildroot
  2024-06-18 19:40 ` [Buildroot] [PATCH 1/2] board/raspberrypi: Support boot.scr for U-Boot Fiona Klute via buildroot
  2024-06-18 19:40 ` [Buildroot] [PATCH 2/2] board/raspberrypi: Enable nullglob for DTBs Fiona Klute via buildroot
@ 2024-08-30 21:45 ` Yann E. MORIN
  2 siblings, 0 replies; 6+ messages in thread
From: Yann E. MORIN @ 2024-08-30 21:45 UTC (permalink / raw)
  To: Fiona Klute; +Cc: José Mendes, buildroot

Fiona, All,

On 2024-06-18 21:39 +0200, Fiona Klute via buildroot spake thusly:
> I'm working on a system that needs U-Boot to manage booting on an
> RPi-based board. These two patches make working with this setup
> easier, though they aren't a complete setup (they do not include a
> boot script, and do not prescribe where the Linux kernel is stored).
> 
> If there's interest it should be possible to expand this into an
> RPi/U-Boot defconfig.

It would be tremendously useful to have a rpi[12345] defconfig that uses
u-boot, indeed!

Regards,
Yann E. MORIN.

> Fiona Klute (2):
>   board/raspberrypi: Support boot.scr for U-Boot
>   board/raspberrypi: Enable nullglob for DTBs
> 
>  board/raspberrypi/post-image.sh | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> --
> 2.45.2
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Buildroot] [PATCH 1/2] board/raspberrypi: Support boot.scr for U-Boot
  2024-06-18 19:40 ` [Buildroot] [PATCH 1/2] board/raspberrypi: Support boot.scr for U-Boot Fiona Klute via buildroot
@ 2024-08-30 21:47   ` Yann E. MORIN
  0 siblings, 0 replies; 6+ messages in thread
From: Yann E. MORIN @ 2024-08-30 21:47 UTC (permalink / raw)
  To: Fiona Klute; +Cc: José Mendes, buildroot

Fiona, All,

On 2024-06-18 21:40 +0200, Fiona Klute via buildroot spake thusly:
> If using U-Boot as "kernel" for the raspberrypi bootloader, include
> boot.scr in the boot partition if it exists.
> 
> To use this, use BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE to set a config
> file that uses U-Boot, and enable building a boot script in the U-Boot
> host tool settings.
> 
> Signed-off-by: Fiona Klute <fiona.klute+wiwa@gmx.de>

Reviewed-by: Yann E. MORIN <yann.morin.1998@free.fr>

I've not applied yet, in the hope that a defconfig that uses u-boot will
come soon! ;-)

Regards,
Yann E. MORIN.

> ---
>  board/raspberrypi/post-image.sh | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/board/raspberrypi/post-image.sh b/board/raspberrypi/post-image.sh
> index 9b9eac972b..e4611d05dd 100755
> --- a/board/raspberrypi/post-image.sh
> +++ b/board/raspberrypi/post-image.sh
> @@ -19,6 +19,12 @@ if [ ! -e "${GENIMAGE_CFG}" ]; then
>  	KERNEL=$(sed -n 's/^kernel=//p' "${BINARIES_DIR}/rpi-firmware/config.txt")
>  	FILES+=( "${KERNEL}" )
> 
> +	# If config.txt calls for running U-Boot, include the boot
> +	# script if any.
> +	if [ "${KERNEL}" = "u-boot.bin" ] && [ -e "${BINARIES_DIR}/boot.scr" ]; then
> +		FILES+=( "boot.scr" )
> +	fi
> +
>  	BOOT_FILES=$(printf '\\t\\t\\t"%s",\\n' "${FILES[@]}")
>  	sed "s|#BOOT_FILES#|${BOOT_FILES}|" "${BOARD_DIR}/genimage.cfg.in" \
>  		> "${GENIMAGE_CFG}"
> --
> 2.45.2
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Buildroot] [PATCH 2/2] board/raspberrypi: Enable nullglob for DTBs
  2024-06-18 19:40 ` [Buildroot] [PATCH 2/2] board/raspberrypi: Enable nullglob for DTBs Fiona Klute via buildroot
@ 2024-08-30 21:50   ` Yann E. MORIN
  0 siblings, 0 replies; 6+ messages in thread
From: Yann E. MORIN @ 2024-08-30 21:50 UTC (permalink / raw)
  To: Fiona Klute; +Cc: José Mendes, buildroot

Fiona, All,

On 2024-06-18 21:40 +0200, Fiona Klute via buildroot spake thusly:
> With "nullglob" the post image script does not fail if there's no DTB
> directly in BINARIES_DIR. This is required when using DTBs from the
> rpi-firmware package (BR2_PACKAGE_RPI_FIRMWARE_INSTALL_DTBS=y),
> because in that case the kernel build doesn't provide one.
> 
> Using pre-compiled DTBs is discouraged, but useful for using mainline
> kernels until suitable DTS can be merged.
> 
> Signed-off-by: Fiona Klute <fiona.klute+wiwa@gmx.de>
> ---
>  board/raspberrypi/post-image.sh | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/board/raspberrypi/post-image.sh b/board/raspberrypi/post-image.sh
> index e4611d05dd..b7ccf5d0b3 100755
> --- a/board/raspberrypi/post-image.sh
> +++ b/board/raspberrypi/post-image.sh
> @@ -1,6 +1,7 @@
>  #!/bin/bash
> 
>  set -e
> +shopt -s nullglob

I'm not too fond of this. Indeed, when reading the glob itself, it is
not obvious what happens when there's no file, as the usual behaviour is
to expand with a single word where the glob character is not replaced.

Instead, I'd use the following:

    for i in "${BINARIES_DIR}"/*.dtb "${BINARIES_DIR}"/rpi-firmware/*; do
        [ -e "${i}" ] || continue
        FILES+=( "${i#${BINARIES_DIR}/}" )
    done

Regards,
Yann E. MORIN.

>  BOARD_DIR="$(dirname $0)"
>  BOARD_NAME="$(basename ${BOARD_DIR})"
> --
> 2.45.2
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-08-30 21:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-18 19:39 [Buildroot] [PATCH 0/2] Improvements for U-Boot on RPi boards Fiona Klute via buildroot
2024-06-18 19:40 ` [Buildroot] [PATCH 1/2] board/raspberrypi: Support boot.scr for U-Boot Fiona Klute via buildroot
2024-08-30 21:47   ` Yann E. MORIN
2024-06-18 19:40 ` [Buildroot] [PATCH 2/2] board/raspberrypi: Enable nullglob for DTBs Fiona Klute via buildroot
2024-08-30 21:50   ` Yann E. MORIN
2024-08-30 21:45 ` [Buildroot] [PATCH 0/2] Improvements for U-Boot on RPi boards Yann E. MORIN

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox