Skip to contentSkip to conversation

bin/writer.rpi_mount: Use kernel= and simplify logic

PATCH In review Tom Rini 2 participants 8 messages Aug 29, 2024 – Sep 4, 2024

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/2 bin/writer.rpi_mount: Use kernel= and simplify logic

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.

---
 bin/writer.rpi_mount | 25 ++++++-------------------
 1 file changed, 6 insertions(+), 19 deletions(-)
bin/writer.rpi_mount +6 -19
index 73fb8bf6af04..ab7c3b5a2430 100755
@@ -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
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH 2/2 bin/flashair.rpi: Use kernel= and simplify logic

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.

---
 bin/flashair.rpi | 32 ++++++++------------------------
 1 file changed, 8 insertions(+), 24 deletions(-)
bin/flashair.rpi +8 -24
index 874c41f76a07..2c2756c73087 100644
@@ -27,34 +27,18 @@
 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 # POSSIBILITY OF SUCH DAMAGE.
 
-flashair_rmlist=`mktemp`
-
-case "${board_type}" in
-rpi)
-    kernel_dst=kernel.img
-    ;;
-rpi_2)
-    kernel_dst=kernel7.img
-    ;;
-rpi_3)
-    kernel_dst=kernel8.img
-    ;;
-rpi_3_32b)
-    kernel_dst=kernel8-32.img
-    ;;
-*)
-    echo Unknown Pi \""${board_type}"\"
-    exit 1
-    ;;
-esac
-
-echo 'kern*.img' > "${flashair_rmlist}"
-
-cp "${U_BOOT_BUILD_DIR}"/u-boot.bin "${UL_DIR}"/"${kernel_dst}"
+cp "${U_BOOT_BUILD_DIR}"/u-boot.bin "${UL_DIR}"/u-boot.bin
 
 touch "${UL_DIR}/config.txt"
 
 echo "enable_uart=1" >> "${UL_DIR}/config.txt"
+echo "kernel=u-boot.bin" >> "${UL_DIR}/config.txt"
+
+case "${board_type}" in
+rpi_3|rpi_3b|rpi_3_b_plus|rpi_4|rpi_arm64)
+    echo "arm_64bit=1" >> "${UL_DIR}/config.txt"
+    ;;
+esac
 
 case "${board_ident}" in
 3-32-pl011)
Signature · 1 line
2.34.1
Reviewed-by on v1 2/2
#2 lore raw

Re: [u-boot-test-hooks][PATCH 2/2] bin/flashair.rpi: Use kernel= and simplify logic

Quoted 11 lines · Tom Rini

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.

---
 bin/flashair.rpi | 32 ++++++++------------------------
 1 file changed, 8 insertions(+), 24 deletions(-)
Quoted 50 lines
bin/flashair.rpi +8 -25
index 874c41f76a07..2c2756c73087 100644
@@ -27,34 +27,18 @@
 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 # POSSIBILITY OF SUCH DAMAGE.
 
-flashair_rmlist=`mktemp`
-
-case "${board_type}" in
-rpi)
-    kernel_dst=kernel.img
-    ;;
-rpi_2)
-    kernel_dst=kernel7.img
-    ;;
-rpi_3)
-    kernel_dst=kernel8.img
-    ;;
-rpi_3_32b)
-    kernel_dst=kernel8-32.img
-    ;;
-*)
-    echo Unknown Pi \""${board_type}"\"
-    exit 1
-    ;;
-esac
-
-echo 'kern*.img' > "${flashair_rmlist}"
-
-cp "${U_BOOT_BUILD_DIR}"/u-boot.bin "${UL_DIR}"/"${kernel_dst}"
+cp "${U_BOOT_BUILD_DIR}"/u-boot.bin "${UL_DIR}"/u-boot.bin
 
 touch "${UL_DIR}/config.txt"
 
 echo "enable_uart=1" >> "${UL_DIR}/config.txt"
+echo "kernel=u-boot.bin" >> "${UL_DIR}/config.txt"
+
+case "${board_type}" in
+rpi_3|rpi_3b|rpi_3_b_plus|rpi_4|rpi_arm64)
+    echo "arm_64bit=1" >> "${UL_DIR}/config.txt"
+    ;;
+esac
 
 case "${board_ident}" in
 3-32-pl011)
--

2.34.1

Reviewed-by on v1 1/2
#3 lore raw
In reply to Tom Rini
Quoted 11 lines · Tom Rini

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.

---
 bin/writer.rpi_mount | 25 ++++++-------------------
 1 file changed, 6 insertions(+), 19 deletions(-)

bin/writer.rpi_mount build=${U_BOOT_BUILD_DIR} · line 31

Quoted 12 lines
bin/writer.rpi_mount +4 -0
index 73fb8bf6af04..ab7c3b5a2430 100755
@@ -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?

Quoted 30 lines
bin/writer.rpi_mount +2 -20
+
 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
--
Quoted 2 lines

2.34.1

Regards,
Simon

author
#4 lore raw
Quoted 21 lines · Simon Glass
Quoted 11 lines · Tom Rini

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.

---
 bin/writer.rpi_mount | 25 ++++++-------------------
 1 file changed, 6 insertions(+), 19 deletions(-)
Quoted 6 lines
bin/writer.rpi_mount +0 -0
index 73fb8bf6af04..ab7c3b5a2430 100755
@@ -25,30 +25,17 @@ build=${U_BOOT_BUILD_DIR}
 
Quoted 8 lines

bin/writer.rpi_mount build=${U_BOOT_BUILD_DIR} · line 31

Quoted 6 lines
bin/writer.rpi_mount +4 -0
 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.

Signature · 1 line
Tom
#5 lore raw

Hi Tom,

Quoted 25 lines · On Thu, Aug 29, 2024, 19:49 Tom Rini <[email protected]> wrote:
Quoted 23 lines · Simon Glass
Quoted 11 lines · Tom Rini

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.

---
 bin/writer.rpi_mount | 25 ++++++-------------------
 1 file changed, 6 insertions(+), 19 deletions(-)
Quoted 8 lines
bin/writer.rpi_mount +0 -0
index 73fb8bf6af04..ab7c3b5a2430 100755
@@ -25,30 +25,17 @@ build=${U_BOOT_BUILD_DIR}
 
 echo "Writing to ${mount_dir} from build at ${build}"
 
Quoted 8 lines
Quoted 6 lines

bin/writer.rpi_mount build=${U_BOOT_BUILD_DIR} · line 31

Quoted 4 lines
bin/writer.rpi_mount +4 -0
+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

author
#6 lore raw
Quoted 37 lines · Simon Glass

Hi Tom,

Quoted 25 lines · On Thu, Aug 29, 2024, 19:49 Tom Rini <[email protected]> wrote:
Quoted 23 lines · Simon Glass
Quoted 11 lines · Tom Rini

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.

---
 bin/writer.rpi_mount | 25 ++++++-------------------
 1 file changed, 6 insertions(+), 19 deletions(-)
Quoted 8 lines
bin/writer.rpi_mount +0 -0
index 73fb8bf6af04..ab7c3b5a2430 100755
@@ -25,30 +25,17 @@ build=${U_BOOT_BUILD_DIR}
 
 echo "Writing to ${mount_dir} from build at ${build}"
 
Quoted 8 lines
Quoted 6 lines

bin/writer.rpi_mount build=${U_BOOT_BUILD_DIR} · line 31

Quoted 4 lines
bin/writer.rpi_mount +4 -0
+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.

Quoted 7 lines

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.

Signature · 1 line
Tom
author
#7 lore raw
In reply to Tom Rini
Quoted 6 lines · Tom Rini

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!

Signature · 1 line
Tom