Updates to u-boot script for Raspberry Pi 4b devices

Message ID ccbdf33c-440e-4a85-8d92-f1be75380464@setera.org
State New
Headers
Series Updates to u-boot script for Raspberry Pi 4b devices |

Commit Message

Craig Setera May 20, 2024, 12:17 p.m. UTC
  Updates to u-boot script for Raspberry Pi 4b devices to
properly configure the serial console and to choose the proper boot address
to be used on newer board revisions.  With these changes in place, I'm able
to fully boot into a serial console in u-boot.

The serial console configuration was derived from the Grub configuration,
while the boot address changes were taken from the IPFire Raspberry 4b
documentation page: https://www.ipfire.org/docs/hardware/arm/rpi/four

Per the conversation in the forums, I don't know why the boot
address changes are required.  I was simply trying to automate those
changes such that downloaded builds will work out of the box.
https://community.ipfire.org/t/hang-with-kernel-starting-on-raspberry-pi/11558/37

NOTE: The use of the different parameter options to the test
command to minimize the need for deeply nested conditionals.  I did
try more bash-shell like syntax, but u-boot didn't seem to like that.
The operators used here were found in the u-boot source.

Tested-by: Craig Setera <craigjunk@setera.org>
Signed-off-by: Craig Setera <craigjunk@setera.org>
---
  config/u-boot/boot.cmd | 27 ++++++++++++++++++++++++---
  1 file changed, 24 insertions(+), 3 deletions(-)

                  fi;
              else
@@ -95,11 +99,28 @@ else
      setenv ramdisk_addr -;
  fi;

+#
+# Handle Raspberry Pi 4 address differences
+# https://www.ipfire.org/docs/hardware/arm/rpi/four
+#
+setenv booti_fdt_addr ${fdt_addr_r};
+if test "${board}" -eq "rpi" -a ${cpu} -eq "armv8" -a "${fdtfile}" -eq 
"broadcom/bcm2711-rpi-4-b.dtb"; then
+    # Hardware revision 1.4
+    if test ${board_revision} -eq 0xB03114 -o ${board_revision} -eq 
0xC03114 -o ${board_revision} -eq 0xD03114; then
+        setenv booti_fdt_addr ${fdt_addr};
+    fi
+
+    # Hardware revision 1.5
+    if test ${board_revision} -eq 0xB03115 -o ${board_revision} -eq 
0xC03115 -o ${board_revision} -eq 0xD03115; then
+        setenv booti_fdt_addr ${fdt_addr};
+    fi
+fi;
+
  bootz ${kernel_addr_r} ${ramdisk_addr} ${fdt_addr_r};
-booti ${kernel_addr_r} ${ramdisk_addr} ${fdt_addr_r};
+booti ${kernel_addr_r} ${ramdisk_addr} ${booti_fdt_addr};

  bootz ${kernel_addr_r} - ${fdt_addr_r};
-booti ${kernel_addr_r} - ${fdt_addr_r};
+booti ${kernel_addr_r} - ${booti_fdt_addr};

  # Recompile with:
  # mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr
  

Comments

Michael Tremer May 23, 2024, 5:01 p.m. UTC | #1
Hello Craig,

Thank you very much for this patch. This is perfectly readable :)

It looks logical to me, however I am not an expert when it comes to SBCs, so I will leave this for Arne to review and merge.

Best,
-Michael

> On 20 May 2024, at 13:17, Craig Setera <craigjunk@setera.org> wrote:
> 
> Updates to u-boot script for Raspberry Pi 4b devices to
> properly configure the serial console and to choose the proper boot address
> to be used on newer board revisions.  With these changes in place, I'm able
> to fully boot into a serial console in u-boot.
> 
> The serial console configuration was derived from the Grub configuration,
> while the boot address changes were taken from the IPFire Raspberry 4b
> documentation page: https://www.ipfire.org/docs/hardware/arm/rpi/four
> 
> Per the conversation in the forums, I don't know why the boot
> address changes are required.  I was simply trying to automate those
> changes such that downloaded builds will work out of the box.
> https://community.ipfire.org/t/hang-with-kernel-starting-on-raspberry-pi/11558/37
> 
> NOTE: The use of the different parameter options to the test
> command to minimize the need for deeply nested conditionals.  I did
> try more bash-shell like syntax, but u-boot didn't seem to like that.
> The operators used here were found in the u-boot source.
> 
> Tested-by: Craig Setera <craigjunk@setera.org>
> Signed-off-by: Craig Setera <craigjunk@setera.org>
> ---
>  config/u-boot/boot.cmd | 27 ++++++++++++++++++++++++---
>  1 file changed, 24 insertions(+), 3 deletions(-)
> 
> diff --git a/config/u-boot/boot.cmd b/config/u-boot/boot.cmd
> index a27996780..eedd5776d 100644
> --- a/config/u-boot/boot.cmd
> +++ b/config/u-boot/boot.cmd
> @@ -51,7 +51,11 @@ if test "${SERIAL-CONSOLE}" = "ON"; then
>                      if test "${fdtfile}" = "broadcom/bcm2837-rpi-3-b.dtb"; then
>                          setenv console ttyS1,115200n8;
>                      else
> -                        setenv console ttyAMA0,115200n8;
> +                        if test "${fdtfile}" = "broadcom/bcm2711-rpi-4-b.dtb"; then
> +                            setenv console ttyS0,115200n8;
> +                        else
> +                            setenv console ttyAMA0,115200n8;
> +                        fi;
>                      fi;
>                  fi;
>              else
> @@ -95,11 +99,28 @@ else
>      setenv ramdisk_addr -;
>  fi;
> 
> +#
> +# Handle Raspberry Pi 4 address differences
> +# https://www.ipfire.org/docs/hardware/arm/rpi/four
> +#
> +setenv booti_fdt_addr ${fdt_addr_r};
> +if test "${board}" -eq "rpi" -a ${cpu} -eq "armv8" -a "${fdtfile}" -eq "broadcom/bcm2711-rpi-4-b.dtb"; then
> +    # Hardware revision 1.4
> +    if test ${board_revision} -eq 0xB03114 -o ${board_revision} -eq 0xC03114 -o ${board_revision} -eq 0xD03114; then
> +        setenv booti_fdt_addr ${fdt_addr};
> +    fi
> +
> +    # Hardware revision 1.5
> +    if test ${board_revision} -eq 0xB03115 -o ${board_revision} -eq 0xC03115 -o ${board_revision} -eq 0xD03115; then
> +        setenv booti_fdt_addr ${fdt_addr};
> +    fi
> +fi;
> +
>  bootz ${kernel_addr_r} ${ramdisk_addr} ${fdt_addr_r};
> -booti ${kernel_addr_r} ${ramdisk_addr} ${fdt_addr_r};
> +booti ${kernel_addr_r} ${ramdisk_addr} ${booti_fdt_addr};
> 
>  bootz ${kernel_addr_r} - ${fdt_addr_r};
> -booti ${kernel_addr_r} - ${fdt_addr_r};
> +booti ${kernel_addr_r} - ${booti_fdt_addr};
> 
>  # Recompile with:
>  # mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr
> -- 
> 2.40.1
> 
>
  
Craig Setera June 4, 2024, 12:40 p.m. UTC | #2
Thanks Michael,

Is there anything more you need me to do?  I assume most of the current 
effort is currently focused on the test release.

Thanks,
Craig

On 5/23/24 12:01 PM, Michael Tremer wrote:
> Hello Craig,
>
> Thank you very much for this patch. This is perfectly readable :)
>
> It looks logical to me, however I am not an expert when it comes to SBCs, so I will leave this for Arne to review and merge.
>
> Best,
> -Michael
>
>> On 20 May 2024, at 13:17, Craig Setera <craigjunk@setera.org> wrote:
>>
>> Updates to u-boot script for Raspberry Pi 4b devices to
>> properly configure the serial console and to choose the proper boot address
>> to be used on newer board revisions.  With these changes in place, I'm able
>> to fully boot into a serial console in u-boot.
>>
>> The serial console configuration was derived from the Grub configuration,
>> while the boot address changes were taken from the IPFire Raspberry 4b
>> documentation page: https://www.ipfire.org/docs/hardware/arm/rpi/four
>>
>> Per the conversation in the forums, I don't know why the boot
>> address changes are required.  I was simply trying to automate those
>> changes such that downloaded builds will work out of the box.
>> https://community.ipfire.org/t/hang-with-kernel-starting-on-raspberry-pi/11558/37
>>
>> NOTE: The use of the different parameter options to the test
>> command to minimize the need for deeply nested conditionals.  I did
>> try more bash-shell like syntax, but u-boot didn't seem to like that.
>> The operators used here were found in the u-boot source.
>>
>> Tested-by: Craig Setera <craigjunk@setera.org>
>> Signed-off-by: Craig Setera <craigjunk@setera.org>
>> ---
>>   config/u-boot/boot.cmd | 27 ++++++++++++++++++++++++---
>>   1 file changed, 24 insertions(+), 3 deletions(-)
>>
>> diff --git a/config/u-boot/boot.cmd b/config/u-boot/boot.cmd
>> index a27996780..eedd5776d 100644
>> --- a/config/u-boot/boot.cmd
>> +++ b/config/u-boot/boot.cmd
>> @@ -51,7 +51,11 @@ if test "${SERIAL-CONSOLE}" = "ON"; then
>>                       if test "${fdtfile}" = "broadcom/bcm2837-rpi-3-b.dtb"; then
>>                           setenv console ttyS1,115200n8;
>>                       else
>> -                        setenv console ttyAMA0,115200n8;
>> +                        if test "${fdtfile}" = "broadcom/bcm2711-rpi-4-b.dtb"; then
>> +                            setenv console ttyS0,115200n8;
>> +                        else
>> +                            setenv console ttyAMA0,115200n8;
>> +                        fi;
>>                       fi;
>>                   fi;
>>               else
>> @@ -95,11 +99,28 @@ else
>>       setenv ramdisk_addr -;
>>   fi;
>>
>> +#
>> +# Handle Raspberry Pi 4 address differences
>> +# https://www.ipfire.org/docs/hardware/arm/rpi/four
>> +#
>> +setenv booti_fdt_addr ${fdt_addr_r};
>> +if test "${board}" -eq "rpi" -a ${cpu} -eq "armv8" -a "${fdtfile}" -eq "broadcom/bcm2711-rpi-4-b.dtb"; then
>> +    # Hardware revision 1.4
>> +    if test ${board_revision} -eq 0xB03114 -o ${board_revision} -eq 0xC03114 -o ${board_revision} -eq 0xD03114; then
>> +        setenv booti_fdt_addr ${fdt_addr};
>> +    fi
>> +
>> +    # Hardware revision 1.5
>> +    if test ${board_revision} -eq 0xB03115 -o ${board_revision} -eq 0xC03115 -o ${board_revision} -eq 0xD03115; then
>> +        setenv booti_fdt_addr ${fdt_addr};
>> +    fi
>> +fi;
>> +
>>   bootz ${kernel_addr_r} ${ramdisk_addr} ${fdt_addr_r};
>> -booti ${kernel_addr_r} ${ramdisk_addr} ${fdt_addr_r};
>> +booti ${kernel_addr_r} ${ramdisk_addr} ${booti_fdt_addr};
>>
>>   bootz ${kernel_addr_r} - ${fdt_addr_r};
>> -booti ${kernel_addr_r} - ${fdt_addr_r};
>> +booti ${kernel_addr_r} - ${booti_fdt_addr};
>>
>>   # Recompile with:
>>   # mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr
>> -- 
>> 2.40.1
>>
>>
  
Michael Tremer June 10, 2024, 4:42 p.m. UTC | #3
Hello Craig,

Hmm, I am not the right person to talk to about this, but it looks this has all been discussed here already:

  https://community.ipfire.org/t/hang-with-kernel-starting-on-raspberry-pi/11558

-Michael

> On 4 Jun 2024, at 13:40, Craig Setera <craigjunk@setera.org> wrote:
> 
> Thanks Michael,
> 
> Is there anything more you need me to do?  I assume most of the current effort is currently focused on the test release.
> 
> Thanks,
> Craig
> 
> On 5/23/24 12:01 PM, Michael Tremer wrote:
>> Hello Craig,
>> 
>> Thank you very much for this patch. This is perfectly readable :)
>> 
>> It looks logical to me, however I am not an expert when it comes to SBCs, so I will leave this for Arne to review and merge.
>> 
>> Best,
>> -Michael
>> 
>>> On 20 May 2024, at 13:17, Craig Setera <craigjunk@setera.org> wrote:
>>> 
>>> Updates to u-boot script for Raspberry Pi 4b devices to
>>> properly configure the serial console and to choose the proper boot address
>>> to be used on newer board revisions.  With these changes in place, I'm able
>>> to fully boot into a serial console in u-boot.
>>> 
>>> The serial console configuration was derived from the Grub configuration,
>>> while the boot address changes were taken from the IPFire Raspberry 4b
>>> documentation page: https://www.ipfire.org/docs/hardware/arm/rpi/four
>>> 
>>> Per the conversation in the forums, I don't know why the boot
>>> address changes are required.  I was simply trying to automate those
>>> changes such that downloaded builds will work out of the box.
>>> https://community.ipfire.org/t/hang-with-kernel-starting-on-raspberry-pi/11558/37
>>> 
>>> NOTE: The use of the different parameter options to the test
>>> command to minimize the need for deeply nested conditionals.  I did
>>> try more bash-shell like syntax, but u-boot didn't seem to like that.
>>> The operators used here were found in the u-boot source.
>>> 
>>> Tested-by: Craig Setera <craigjunk@setera.org>
>>> Signed-off-by: Craig Setera <craigjunk@setera.org>
>>> ---
>>>  config/u-boot/boot.cmd | 27 ++++++++++++++++++++++++---
>>>  1 file changed, 24 insertions(+), 3 deletions(-)
>>> 
>>> diff --git a/config/u-boot/boot.cmd b/config/u-boot/boot.cmd
>>> index a27996780..eedd5776d 100644
>>> --- a/config/u-boot/boot.cmd
>>> +++ b/config/u-boot/boot.cmd
>>> @@ -51,7 +51,11 @@ if test "${SERIAL-CONSOLE}" = "ON"; then
>>>                      if test "${fdtfile}" = "broadcom/bcm2837-rpi-3-b.dtb"; then
>>>                          setenv console ttyS1,115200n8;
>>>                      else
>>> -                        setenv console ttyAMA0,115200n8;
>>> +                        if test "${fdtfile}" = "broadcom/bcm2711-rpi-4-b.dtb"; then
>>> +                            setenv console ttyS0,115200n8;
>>> +                        else
>>> +                            setenv console ttyAMA0,115200n8;
>>> +                        fi;
>>>                      fi;
>>>                  fi;
>>>              else
>>> @@ -95,11 +99,28 @@ else
>>>      setenv ramdisk_addr -;
>>>  fi;
>>> 
>>> +#
>>> +# Handle Raspberry Pi 4 address differences
>>> +# https://www.ipfire.org/docs/hardware/arm/rpi/four
>>> +#
>>> +setenv booti_fdt_addr ${fdt_addr_r};
>>> +if test "${board}" -eq "rpi" -a ${cpu} -eq "armv8" -a "${fdtfile}" -eq "broadcom/bcm2711-rpi-4-b.dtb"; then
>>> +    # Hardware revision 1.4
>>> +    if test ${board_revision} -eq 0xB03114 -o ${board_revision} -eq 0xC03114 -o ${board_revision} -eq 0xD03114; then
>>> +        setenv booti_fdt_addr ${fdt_addr};
>>> +    fi
>>> +
>>> +    # Hardware revision 1.5
>>> +    if test ${board_revision} -eq 0xB03115 -o ${board_revision} -eq 0xC03115 -o ${board_revision} -eq 0xD03115; then
>>> +        setenv booti_fdt_addr ${fdt_addr};
>>> +    fi
>>> +fi;
>>> +
>>>  bootz ${kernel_addr_r} ${ramdisk_addr} ${fdt_addr_r};
>>> -booti ${kernel_addr_r} ${ramdisk_addr} ${fdt_addr_r};
>>> +booti ${kernel_addr_r} ${ramdisk_addr} ${booti_fdt_addr};
>>> 
>>>  bootz ${kernel_addr_r} - ${fdt_addr_r};
>>> -booti ${kernel_addr_r} - ${fdt_addr_r};
>>> +booti ${kernel_addr_r} - ${booti_fdt_addr};
>>> 
>>>  # Recompile with:
>>>  # mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr
>>> -- 
>>> 2.40.1
>>> 
>>>
  
Craig Setera June 11, 2024, 12:10 a.m. UTC | #4
Thanks.  That was my original conversation! :-)  I will just wait for 
Arne to find some time.

On 6/10/24 11:42 AM, Michael Tremer wrote:
> Hello Craig,
>
> Hmm, I am not the right person to talk to about this, but it looks this has all been discussed here already:
>
>    https://community.ipfire.org/t/hang-with-kernel-starting-on-raspberry-pi/11558
>
> -Michael
>
>> On 4 Jun 2024, at 13:40, Craig Setera <craigjunk@setera.org> wrote:
>>
>> Thanks Michael,
>>
>> Is there anything more you need me to do?  I assume most of the current effort is currently focused on the test release.
>>
>> Thanks,
>> Craig
>>
>> On 5/23/24 12:01 PM, Michael Tremer wrote:
>>> Hello Craig,
>>>
>>> Thank you very much for this patch. This is perfectly readable :)
>>>
>>> It looks logical to me, however I am not an expert when it comes to SBCs, so I will leave this for Arne to review and merge.
>>>
>>> Best,
>>> -Michael
>>>
>>>> On 20 May 2024, at 13:17, Craig Setera <craigjunk@setera.org> wrote:
>>>>
>>>> Updates to u-boot script for Raspberry Pi 4b devices to
>>>> properly configure the serial console and to choose the proper boot address
>>>> to be used on newer board revisions.  With these changes in place, I'm able
>>>> to fully boot into a serial console in u-boot.
>>>>
>>>> The serial console configuration was derived from the Grub configuration,
>>>> while the boot address changes were taken from the IPFire Raspberry 4b
>>>> documentation page: https://www.ipfire.org/docs/hardware/arm/rpi/four
>>>>
>>>> Per the conversation in the forums, I don't know why the boot
>>>> address changes are required.  I was simply trying to automate those
>>>> changes such that downloaded builds will work out of the box.
>>>> https://community.ipfire.org/t/hang-with-kernel-starting-on-raspberry-pi/11558/37
>>>>
>>>> NOTE: The use of the different parameter options to the test
>>>> command to minimize the need for deeply nested conditionals.  I did
>>>> try more bash-shell like syntax, but u-boot didn't seem to like that.
>>>> The operators used here were found in the u-boot source.
>>>>
>>>> Tested-by: Craig Setera <craigjunk@setera.org>
>>>> Signed-off-by: Craig Setera <craigjunk@setera.org>
>>>> ---
>>>>   config/u-boot/boot.cmd | 27 ++++++++++++++++++++++++---
>>>>   1 file changed, 24 insertions(+), 3 deletions(-)
>>>>
>>>> diff --git a/config/u-boot/boot.cmd b/config/u-boot/boot.cmd
>>>> index a27996780..eedd5776d 100644
>>>> --- a/config/u-boot/boot.cmd
>>>> +++ b/config/u-boot/boot.cmd
>>>> @@ -51,7 +51,11 @@ if test "${SERIAL-CONSOLE}" = "ON"; then
>>>>                       if test "${fdtfile}" = "broadcom/bcm2837-rpi-3-b.dtb"; then
>>>>                           setenv console ttyS1,115200n8;
>>>>                       else
>>>> -                        setenv console ttyAMA0,115200n8;
>>>> +                        if test "${fdtfile}" = "broadcom/bcm2711-rpi-4-b.dtb"; then
>>>> +                            setenv console ttyS0,115200n8;
>>>> +                        else
>>>> +                            setenv console ttyAMA0,115200n8;
>>>> +                        fi;
>>>>                       fi;
>>>>                   fi;
>>>>               else
>>>> @@ -95,11 +99,28 @@ else
>>>>       setenv ramdisk_addr -;
>>>>   fi;
>>>>
>>>> +#
>>>> +# Handle Raspberry Pi 4 address differences
>>>> +# https://www.ipfire.org/docs/hardware/arm/rpi/four
>>>> +#
>>>> +setenv booti_fdt_addr ${fdt_addr_r};
>>>> +if test "${board}" -eq "rpi" -a ${cpu} -eq "armv8" -a "${fdtfile}" -eq "broadcom/bcm2711-rpi-4-b.dtb"; then
>>>> +    # Hardware revision 1.4
>>>> +    if test ${board_revision} -eq 0xB03114 -o ${board_revision} -eq 0xC03114 -o ${board_revision} -eq 0xD03114; then
>>>> +        setenv booti_fdt_addr ${fdt_addr};
>>>> +    fi
>>>> +
>>>> +    # Hardware revision 1.5
>>>> +    if test ${board_revision} -eq 0xB03115 -o ${board_revision} -eq 0xC03115 -o ${board_revision} -eq 0xD03115; then
>>>> +        setenv booti_fdt_addr ${fdt_addr};
>>>> +    fi
>>>> +fi;
>>>> +
>>>>   bootz ${kernel_addr_r} ${ramdisk_addr} ${fdt_addr_r};
>>>> -booti ${kernel_addr_r} ${ramdisk_addr} ${fdt_addr_r};
>>>> +booti ${kernel_addr_r} ${ramdisk_addr} ${booti_fdt_addr};
>>>>
>>>>   bootz ${kernel_addr_r} - ${fdt_addr_r};
>>>> -booti ${kernel_addr_r} - ${fdt_addr_r};
>>>> +booti ${kernel_addr_r} - ${booti_fdt_addr};
>>>>
>>>>   # Recompile with:
>>>>   # mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr
>>>> -- 
>>>> 2.40.1
>>>>
>>>>
  
Craig Setera June 16, 2024, 3:28 p.m. UTC | #5
FWIW... I just used my updated u-boot script to update the image for 186 
and went through the setup process using serial console for my Raspberry 
Pi.  My process:

* Download backup from IPFire
* Flash new image to SD Card
* Update u-boot script
* Make new image using script
* Boot and do initial setup via serial console
* Login to web admin and restore backup

Even though this is a few more steps than just doing an "in place" 
upgrade, I actually like that I am keeping the previous SD card and can 
swap back if something goes wrong.

Craig

On 6/10/24 7:10 PM, Craig Setera wrote:
> Thanks. That was my original conversation! :-)  I will just wait for 
> Arne to find some time.
>
> On 6/10/24 11:42 AM, Michael Tremer wrote:
>> Hello Craig,
>>
>> Hmm, I am not the right person to talk to about this, but it looks 
>> this has all been discussed here already:
>>
>> https://community.ipfire.org/t/hang-with-kernel-starting-on-raspberry-pi/11558
>>
>> -Michael
>>
>>> On 4 Jun 2024, at 13:40, Craig Setera <craigjunk@setera.org> wrote:
>>>
>>> Thanks Michael,
>>>
>>> Is there anything more you need me to do?  I assume most of the 
>>> current effort is currently focused on the test release.
>>>
>>> Thanks,
>>> Craig
>>>
>>> On 5/23/24 12:01 PM, Michael Tremer wrote:
>>>> Hello Craig,
>>>>
>>>> Thank you very much for this patch. This is perfectly readable :)
>>>>
>>>> It looks logical to me, however I am not an expert when it comes to 
>>>> SBCs, so I will leave this for Arne to review and merge.
>>>>
>>>> Best,
>>>> -Michael
>>>>
>>>>> On 20 May 2024, at 13:17, Craig Setera <craigjunk@setera.org> wrote:
>>>>>
>>>>> Updates to u-boot script for Raspberry Pi 4b devices to
>>>>> properly configure the serial console and to choose the proper 
>>>>> boot address
>>>>> to be used on newer board revisions.  With these changes in place, 
>>>>> I'm able
>>>>> to fully boot into a serial console in u-boot.
>>>>>
>>>>> The serial console configuration was derived from the Grub 
>>>>> configuration,
>>>>> while the boot address changes were taken from the IPFire 
>>>>> Raspberry 4b
>>>>> documentation page: https://www.ipfire.org/docs/hardware/arm/rpi/four
>>>>>
>>>>> Per the conversation in the forums, I don't know why the boot
>>>>> address changes are required.  I was simply trying to automate those
>>>>> changes such that downloaded builds will work out of the box.
>>>>> https://community.ipfire.org/t/hang-with-kernel-starting-on-raspberry-pi/11558/37 
>>>>>
>>>>>
>>>>> NOTE: The use of the different parameter options to the test
>>>>> command to minimize the need for deeply nested conditionals.  I did
>>>>> try more bash-shell like syntax, but u-boot didn't seem to like that.
>>>>> The operators used here were found in the u-boot source.
>>>>>
>>>>> Tested-by: Craig Setera <craigjunk@setera.org>
>>>>> Signed-off-by: Craig Setera <craigjunk@setera.org>
>>>>> ---
>>>>>   config/u-boot/boot.cmd | 27 ++++++++++++++++++++++++---
>>>>>   1 file changed, 24 insertions(+), 3 deletions(-)
>>>>>
>>>>> diff --git a/config/u-boot/boot.cmd b/config/u-boot/boot.cmd
>>>>> index a27996780..eedd5776d 100644
>>>>> --- a/config/u-boot/boot.cmd
>>>>> +++ b/config/u-boot/boot.cmd
>>>>> @@ -51,7 +51,11 @@ if test "${SERIAL-CONSOLE}" = "ON"; then
>>>>>                       if test "${fdtfile}" = 
>>>>> "broadcom/bcm2837-rpi-3-b.dtb"; then
>>>>>                           setenv console ttyS1,115200n8;
>>>>>                       else
>>>>> -                        setenv console ttyAMA0,115200n8;
>>>>> +                        if test "${fdtfile}" = 
>>>>> "broadcom/bcm2711-rpi-4-b.dtb"; then
>>>>> +                            setenv console ttyS0,115200n8;
>>>>> +                        else
>>>>> +                            setenv console ttyAMA0,115200n8;
>>>>> +                        fi;
>>>>>                       fi;
>>>>>                   fi;
>>>>>               else
>>>>> @@ -95,11 +99,28 @@ else
>>>>>       setenv ramdisk_addr -;
>>>>>   fi;
>>>>>
>>>>> +#
>>>>> +# Handle Raspberry Pi 4 address differences
>>>>> +# https://www.ipfire.org/docs/hardware/arm/rpi/four
>>>>> +#
>>>>> +setenv booti_fdt_addr ${fdt_addr_r};
>>>>> +if test "${board}" -eq "rpi" -a ${cpu} -eq "armv8" -a 
>>>>> "${fdtfile}" -eq "broadcom/bcm2711-rpi-4-b.dtb"; then
>>>>> +    # Hardware revision 1.4
>>>>> +    if test ${board_revision} -eq 0xB03114 -o ${board_revision} 
>>>>> -eq 0xC03114 -o ${board_revision} -eq 0xD03114; then
>>>>> +        setenv booti_fdt_addr ${fdt_addr};
>>>>> +    fi
>>>>> +
>>>>> +    # Hardware revision 1.5
>>>>> +    if test ${board_revision} -eq 0xB03115 -o ${board_revision} 
>>>>> -eq 0xC03115 -o ${board_revision} -eq 0xD03115; then
>>>>> +        setenv booti_fdt_addr ${fdt_addr};
>>>>> +    fi
>>>>> +fi;
>>>>> +
>>>>>   bootz ${kernel_addr_r} ${ramdisk_addr} ${fdt_addr_r};
>>>>> -booti ${kernel_addr_r} ${ramdisk_addr} ${fdt_addr_r};
>>>>> +booti ${kernel_addr_r} ${ramdisk_addr} ${booti_fdt_addr};
>>>>>
>>>>>   bootz ${kernel_addr_r} - ${fdt_addr_r};
>>>>> -booti ${kernel_addr_r} - ${fdt_addr_r};
>>>>> +booti ${kernel_addr_r} - ${booti_fdt_addr};
>>>>>
>>>>>   # Recompile with:
>>>>>   # mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr
>>>>> -- 
>>>>> 2.40.1
>>>>>
>>>>>
  

Patch

diff --git a/config/u-boot/boot.cmd b/config/u-boot/boot.cmd
index a27996780..eedd5776d 100644
--- a/config/u-boot/boot.cmd
+++ b/config/u-boot/boot.cmd
@@ -51,7 +51,11 @@  if test "${SERIAL-CONSOLE}" = "ON"; then
                      if test "${fdtfile}" = 
"broadcom/bcm2837-rpi-3-b.dtb"; then
                          setenv console ttyS1,115200n8;
                      else
-                        setenv console ttyAMA0,115200n8;
+                        if test "${fdtfile}" = 
"broadcom/bcm2711-rpi-4-b.dtb"; then
+                            setenv console ttyS0,115200n8;
+                        else
+                            setenv console ttyAMA0,115200n8;
+                        fi;
                      fi;