diff mbox series

[u-boot-test-hooks,1/2] bin/writer.rpi_mount: Use kernel= and simplify logic

Message ID 20240829185602.3179812-1-trini@konsulko.com
State Accepted
Delegated to: Tom Rini
Headers show
Series [u-boot-test-hooks,1/2] bin/writer.rpi_mount: Use kernel= and simplify logic | expand

Commit Message

Tom Rini Aug. 29, 2024, 6:56 p.m. UTC
Rather than guess what we need to name our u-boot.bin file as for it to
boot make use of the kernel= option to always call it u-boot.bin and
then on 64bit platforms (and since future platforms use rpi_arm64 this
list should not grow) also pass in arm_64bit=1.

Signed-off-by: Tom Rini <trini@konsulko.com>
---
 bin/writer.rpi_mount | 25 ++++++-------------------
 1 file changed, 6 insertions(+), 19 deletions(-)

Comments

Simon Glass Aug. 30, 2024, 1:06 a.m. UTC | #1
On Thu, 29 Aug 2024 at 12:56, Tom Rini <trini@konsulko.com> wrote:
>
> Rather than guess what we need to name our u-boot.bin file as for it to
> boot make use of the kernel= option to always call it u-boot.bin and
> then on 64bit platforms (and since future platforms use rpi_arm64 this
> list should not grow) also pass in arm_64bit=1.
>
> Signed-off-by: Tom Rini <trini@konsulko.com>
> ---
>  bin/writer.rpi_mount | 25 ++++++-------------------
>  1 file changed, 6 insertions(+), 19 deletions(-)
>

Reviewed-by: Simon Glass <sjg@chromium.org>

> diff --git a/bin/writer.rpi_mount b/bin/writer.rpi_mount
> index 73fb8bf6af04..ab7c3b5a2430 100755
> --- a/bin/writer.rpi_mount
> +++ b/bin/writer.rpi_mount
> @@ -25,30 +25,17 @@ build=${U_BOOT_BUILD_DIR}
>
>  echo "Writing to ${mount_dir} from build at ${build}"
>
> +sudo cp -v ${build}/u-boot.bin ${mount_dir}/u-boot.bin
> +
> +echo "enable_uart=1" | sudo tee ${mount_dir}/config.txt
> +echo "kernel=u-boot.bin" | sudo tee -a ${mount_dir}/config.txt

Does this keep appending more and more lines?

> +
>  case "${board_type}" in
> -rpi)
> -    kernel_dst=kernel.img
> -    ;;
> -rpi_2)
> -    kernel_dst=kernel7.img
> -    ;;
>  rpi_3|rpi_3b|rpi_3_b_plus|rpi_4|rpi_arm64)
> -    kernel_dst=kernel8.img
> -    ;;
> -rpi_3_32b|rpi_4_32b)
> -    kernel_dst=kernel8-32.img
> -    ;;
> -*)
> -    echo Unknown Pi \""${board_type}"\"
> -    exit 1
> +    echo "arm_64bit=1" | sudo tee -a ${mount_dir}/config.txt
>      ;;
>  esac
>
> -sudo rm -f ${mount_dir}/kernel*img
> -sudo cp -v ${build}/u-boot.bin ${mount_dir}/${kernel_dst}
> -
> -echo "enable_uart=1" | sudo tee ${mount_dir}/config.txt
> -
>  case "${board_ident}" in
>  3-32-pl011)
>      echo "dtoverlay=pi3-miniuart-bt" | sudo tee -a ${mount_dir}/config.txt
> --
> 2.34.1
>

Regards,
Simon
Tom Rini Aug. 30, 2024, 1:49 a.m. UTC | #2
On Thu, Aug 29, 2024 at 07:06:06PM -0600, Simon Glass wrote:
> On Thu, 29 Aug 2024 at 12:56, Tom Rini <trini@konsulko.com> wrote:
> >
> > Rather than guess what we need to name our u-boot.bin file as for it to
> > boot make use of the kernel= option to always call it u-boot.bin and
> > then on 64bit platforms (and since future platforms use rpi_arm64 this
> > list should not grow) also pass in arm_64bit=1.
> >
> > Signed-off-by: Tom Rini <trini@konsulko.com>
> > ---
> >  bin/writer.rpi_mount | 25 ++++++-------------------
> >  1 file changed, 6 insertions(+), 19 deletions(-)
> >
> 
> Reviewed-by: Simon Glass <sjg@chromium.org>
> 
> > diff --git a/bin/writer.rpi_mount b/bin/writer.rpi_mount
> > index 73fb8bf6af04..ab7c3b5a2430 100755
> > --- a/bin/writer.rpi_mount
> > +++ b/bin/writer.rpi_mount
> > @@ -25,30 +25,17 @@ build=${U_BOOT_BUILD_DIR}
> >
> >  echo "Writing to ${mount_dir} from build at ${build}"
> >
> > +sudo cp -v ${build}/u-boot.bin ${mount_dir}/u-boot.bin
> > +
> > +echo "enable_uart=1" | sudo tee ${mount_dir}/config.txt
> > +echo "kernel=u-boot.bin" | sudo tee -a ${mount_dir}/config.txt
> 
> Does this keep appending more and more lines?

No, the first tee will zero the file and subsequent -a's append.
Simon Glass Aug. 30, 2024, 2:19 p.m. UTC | #3
Hi Tom,

On Thu, Aug 29, 2024, 19:49 Tom Rini <trini@konsulko.com> wrote:
>
> On Thu, Aug 29, 2024 at 07:06:06PM -0600, Simon Glass wrote:
> > On Thu, 29 Aug 2024 at 12:56, Tom Rini <trini@konsulko.com> wrote:
> > >
> > > Rather than guess what we need to name our u-boot.bin file as for it to
> > > boot make use of the kernel= option to always call it u-boot.bin and
> > > then on 64bit platforms (and since future platforms use rpi_arm64 this
> > > list should not grow) also pass in arm_64bit=1.
> > >
> > > Signed-off-by: Tom Rini <trini@konsulko.com>
> > > ---
> > >  bin/writer.rpi_mount | 25 ++++++-------------------
> > >  1 file changed, 6 insertions(+), 19 deletions(-)
> > >
> >
> > Reviewed-by: Simon Glass <sjg@chromium.org>
> >
> > > diff --git a/bin/writer.rpi_mount b/bin/writer.rpi_mount
> > > index 73fb8bf6af04..ab7c3b5a2430 100755
> > > --- a/bin/writer.rpi_mount
> > > +++ b/bin/writer.rpi_mount
> > > @@ -25,30 +25,17 @@ build=${U_BOOT_BUILD_DIR}
> > >
> > >  echo "Writing to ${mount_dir} from build at ${build}"
> > >
> > > +sudo cp -v ${build}/u-boot.bin ${mount_dir}/u-boot.bin
> > > +
> > > +echo "enable_uart=1" | sudo tee ${mount_dir}/config.txt
> > > +echo "kernel=u-boot.bin" | sudo tee -a ${mount_dir}/config.txt
> >
> > Does this keep appending more and more lines?
>
> No, the first tee will zero the file and subsequent -a's append.

Oh yes.

This is one trouble I have with rpi - there is an existing config.txt
and some of it seems to be necessary on some boards. But I don't have
the code to set up everything. Typically I just get a config from a
distro and that is how stays, with just an addition or two. If we can
generate it from scratch as you do here, then things are easier.

Regards,
Simon
Tom Rini Aug. 30, 2024, 4:45 p.m. UTC | #4
On Fri, Aug 30, 2024 at 08:19:04AM -0600, Simon Glass wrote:
> Hi Tom,
> 
> On Thu, Aug 29, 2024, 19:49 Tom Rini <trini@konsulko.com> wrote:
> >
> > On Thu, Aug 29, 2024 at 07:06:06PM -0600, Simon Glass wrote:
> > > On Thu, 29 Aug 2024 at 12:56, Tom Rini <trini@konsulko.com> wrote:
> > > >
> > > > Rather than guess what we need to name our u-boot.bin file as for it to
> > > > boot make use of the kernel= option to always call it u-boot.bin and
> > > > then on 64bit platforms (and since future platforms use rpi_arm64 this
> > > > list should not grow) also pass in arm_64bit=1.
> > > >
> > > > Signed-off-by: Tom Rini <trini@konsulko.com>
> > > > ---
> > > >  bin/writer.rpi_mount | 25 ++++++-------------------
> > > >  1 file changed, 6 insertions(+), 19 deletions(-)
> > > >
> > >
> > > Reviewed-by: Simon Glass <sjg@chromium.org>
> > >
> > > > diff --git a/bin/writer.rpi_mount b/bin/writer.rpi_mount
> > > > index 73fb8bf6af04..ab7c3b5a2430 100755
> > > > --- a/bin/writer.rpi_mount
> > > > +++ b/bin/writer.rpi_mount
> > > > @@ -25,30 +25,17 @@ build=${U_BOOT_BUILD_DIR}
> > > >
> > > >  echo "Writing to ${mount_dir} from build at ${build}"
> > > >
> > > > +sudo cp -v ${build}/u-boot.bin ${mount_dir}/u-boot.bin
> > > > +
> > > > +echo "enable_uart=1" | sudo tee ${mount_dir}/config.txt
> > > > +echo "kernel=u-boot.bin" | sudo tee -a ${mount_dir}/config.txt
> > >
> > > Does this keep appending more and more lines?
> >
> > No, the first tee will zero the file and subsequent -a's append.
> 
> Oh yes.
> 
> This is one trouble I have with rpi - there is an existing config.txt
> and some of it seems to be necessary on some boards. But I don't have
> the code to set up everything. Typically I just get a config from a
> distro and that is how stays, with just an addition or two. If we can
> generate it from scratch as you do here, then things are easier.

Yeah, it's very possible to go down a large rabbit-hole with Pi and the
config.txt and getting everything Just Right(tm). Enabling the UART and
as needed, saying it's 64bit is enough for basic testing but more is
likely needed if say a follow up step was to run some wayland tests and
confirm that output.
Tom Rini Sept. 4, 2024, 10:57 p.m. UTC | #5
On Thu, 29 Aug 2024 12:56:01 -0600, Tom Rini wrote:

> Rather than guess what we need to name our u-boot.bin file as for it to
> boot make use of the kernel= option to always call it u-boot.bin and
> then on 64bit platforms (and since future platforms use rpi_arm64 this
> list should not grow) also pass in arm_64bit=1.
> 
> 

Applied to u-boot/u-boot-test-hooks.git/master, thanks!
diff mbox series

Patch

diff --git a/bin/writer.rpi_mount b/bin/writer.rpi_mount
index 73fb8bf6af04..ab7c3b5a2430 100755
--- a/bin/writer.rpi_mount
+++ b/bin/writer.rpi_mount
@@ -25,30 +25,17 @@  build=${U_BOOT_BUILD_DIR}
 
 echo "Writing to ${mount_dir} from build at ${build}"
 
+sudo cp -v ${build}/u-boot.bin ${mount_dir}/u-boot.bin
+
+echo "enable_uart=1" | sudo tee ${mount_dir}/config.txt
+echo "kernel=u-boot.bin" | sudo tee -a ${mount_dir}/config.txt
+
 case "${board_type}" in
-rpi)
-    kernel_dst=kernel.img
-    ;;
-rpi_2)
-    kernel_dst=kernel7.img
-    ;;
 rpi_3|rpi_3b|rpi_3_b_plus|rpi_4|rpi_arm64)
-    kernel_dst=kernel8.img
-    ;;
-rpi_3_32b|rpi_4_32b)
-    kernel_dst=kernel8-32.img
-    ;;
-*)
-    echo Unknown Pi \""${board_type}"\"
-    exit 1
+    echo "arm_64bit=1" | sudo tee -a ${mount_dir}/config.txt
     ;;
 esac
 
-sudo rm -f ${mount_dir}/kernel*img
-sudo cp -v ${build}/u-boot.bin ${mount_dir}/${kernel_dst}
-
-echo "enable_uart=1" | sudo tee ${mount_dir}/config.txt
-
 case "${board_ident}" in
 3-32-pl011)
     echo "dtoverlay=pi3-miniuart-bt" | sudo tee -a ${mount_dir}/config.txt