diff mbox series

[v4,5/7] tests/boot_linux_console: Test booting U-Boot on the Raspberry Pi 2

Message ID 20200120235159.18510-6-f4bug@amsat.org
State New
Headers show
Series hw/arm/raspi: Run U-Boot on the raspi machines | expand

Commit Message

Philippe Mathieu-Daudé Jan. 20, 2020, 11:51 p.m. UTC
This test runs U-Boot on the Raspberry Pi 2.
It is very simple and fast:

  $ avocado --show=app,console run -t raspi2 -t u-boot tests/acceptance/
  JOB LOG    : avocado/job-results/job-2020-01-20T23.40-2424777/job.log
   (1/1) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_raspi2_uboot:
  console: MMC:   sdhci@7e300000: 0
  console: Loading Environment from FAT... Card did not respond to voltage select!
  console: In:    serial
  console: Out:   vidconsole
  console: Err:   vidconsole
  console: Net:   No ethernet found.
  console: starting USB...
  console: USB0:   Port not available.
  console: Hit any key to stop autoboot:  0
  console: U-Boot>
  console: U-Boot> bdinfo
  console: arch_number = 0x00000000
  console: boot_params = 0x00000100
  console: DRAM bank   = 0x00000000
  console: -> start    = 0x00000000
  console: -> size     = 0x3c000000
  console: baudrate    = 115200 bps
  console: TLB addr    = 0x3bff0000
  console: relocaddr   = 0x3bf64000
  console: reloc off   = 0x3bf5c000
  console: irq_sp      = 0x3bb5fec0
  console: sp start    = 0x3bb5feb0
  console: Early malloc usage: 2a4 / 400
  console: fdt_blob    = 0x3bfbdfb0
  console: U-Boot> version
  console: U-Boot 2019.01+dfsg-7 (May 14 2019 - 02:07:44 +0000)
  console: gcc (Debian 8.3.0-7) 8.3.0
  console: GNU ld (GNU Binutils for Debian) 2.31.1
  console: U-Boot> reset
  console: resetting ...
  PASS (0.46 s)

U-Boot is built by the Debian project, see:
https://wiki.debian.org/InstallingDebianOn/Allwinner#Creating_a_bootable_SD_Card_with_u-boot

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 tests/acceptance/boot_linux_console.py | 28 ++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

Comments

Gerd Hoffmann Jan. 21, 2020, 6:57 a.m. UTC | #1
On Tue, Jan 21, 2020 at 12:51:57AM +0100, Philippe Mathieu-Daudé wrote:
> This test runs U-Boot on the Raspberry Pi 2.

> U-Boot is built by the Debian project, see:
> https://wiki.debian.org/InstallingDebianOn/Allwinner#Creating_a_bootable_SD_Card_with_u-boot

We already have a u-boot submodule in roms/

I guess it makes sense to just build & ship our own binaries
instead of downloading them from Debian?

cheers,
  Gerd
Philippe Mathieu-Daudé Jan. 21, 2020, 8:32 a.m. UTC | #2
On 1/21/20 7:57 AM, Gerd Hoffmann wrote:
> On Tue, Jan 21, 2020 at 12:51:57AM +0100, Philippe Mathieu-Daudé wrote:
>> This test runs U-Boot on the Raspberry Pi 2.
> 
>> U-Boot is built by the Debian project, see:
>> https://wiki.debian.org/InstallingDebianOn/Allwinner#Creating_a_bootable_SD_Card_with_u-boot
> 
> We already have a u-boot submodule in roms/
> 
> I guess it makes sense to just build & ship our own binaries
> instead of downloading them from Debian?

Your comment made me realize I pasted the wrong link, I meant this one:
https://wiki.debian.org/U-boot/Status

Maybe the commit description is not clear enough. I don't want to test 
U-Boot, I want to test all future QEMU releases with this particular 
pre-built binary, which has been:
1/ built with the proper configuration for the board
2/ tested by someone from the Debian project on physical hardware.

(Goal: catch regressions in QEMU).

The source is available, with build scripts, and reproducible builds:
https://salsa.debian.org/debian/u-boot/blob/master/.gitlab-ci.yml
Thomas Huth Jan. 27, 2020, 4:02 p.m. UTC | #3
On 21/01/2020 00.51, Philippe Mathieu-Daudé wrote:
> This test runs U-Boot on the Raspberry Pi 2.
> It is very simple and fast:
> 
>   $ avocado --show=app,console run -t raspi2 -t u-boot tests/acceptance/
>   JOB LOG    : avocado/job-results/job-2020-01-20T23.40-2424777/job.log
>    (1/1) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_raspi2_uboot:
>   console: MMC:   sdhci@7e300000: 0
>   console: Loading Environment from FAT... Card did not respond to voltage select!
>   console: In:    serial
>   console: Out:   vidconsole
>   console: Err:   vidconsole
>   console: Net:   No ethernet found.
>   console: starting USB...
>   console: USB0:   Port not available.
>   console: Hit any key to stop autoboot:  0
>   console: U-Boot>
>   console: U-Boot> bdinfo
>   console: arch_number = 0x00000000
>   console: boot_params = 0x00000100
>   console: DRAM bank   = 0x00000000
>   console: -> start    = 0x00000000
>   console: -> size     = 0x3c000000
>   console: baudrate    = 115200 bps
>   console: TLB addr    = 0x3bff0000
>   console: relocaddr   = 0x3bf64000
>   console: reloc off   = 0x3bf5c000
>   console: irq_sp      = 0x3bb5fec0
>   console: sp start    = 0x3bb5feb0
>   console: Early malloc usage: 2a4 / 400
>   console: fdt_blob    = 0x3bfbdfb0
>   console: U-Boot> version
>   console: U-Boot 2019.01+dfsg-7 (May 14 2019 - 02:07:44 +0000)
>   console: gcc (Debian 8.3.0-7) 8.3.0
>   console: GNU ld (GNU Binutils for Debian) 2.31.1
>   console: U-Boot> reset
>   console: resetting ...
>   PASS (0.46 s)
> 
> U-Boot is built by the Debian project, see:
> https://wiki.debian.org/InstallingDebianOn/Allwinner#Creating_a_bootable_SD_Card_with_u-boot
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  tests/acceptance/boot_linux_console.py | 28 ++++++++++++++++++++++++++
>  1 file changed, 28 insertions(+)
> 
> diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
> index e40b84651b..682b801b4f 100644
> --- a/tests/acceptance/boot_linux_console.py
> +++ b/tests/acceptance/boot_linux_console.py

The file is called boot_*linux*_console.py ... so shouldn't tests that
don't use Linux rather go into another file instead?
Either machine_arm_raspi.py or maybe a boot_firmware_console.py file?

 Thomas
Philippe Mathieu-Daudé Jan. 27, 2020, 4:09 p.m. UTC | #4
On 1/27/20 5:02 PM, Thomas Huth wrote:
> On 21/01/2020 00.51, Philippe Mathieu-Daudé wrote:
>> This test runs U-Boot on the Raspberry Pi 2.
>> It is very simple and fast:
>>
>>    $ avocado --show=app,console run -t raspi2 -t u-boot tests/acceptance/
>>    JOB LOG    : avocado/job-results/job-2020-01-20T23.40-2424777/job.log
>>     (1/1) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_raspi2_uboot:
>>    console: MMC:   sdhci@7e300000: 0
>>    console: Loading Environment from FAT... Card did not respond to voltage select!
>>    console: In:    serial
>>    console: Out:   vidconsole
>>    console: Err:   vidconsole
>>    console: Net:   No ethernet found.
>>    console: starting USB...
>>    console: USB0:   Port not available.
>>    console: Hit any key to stop autoboot:  0
>>    console: U-Boot>
>>    console: U-Boot> bdinfo
>>    console: arch_number = 0x00000000
>>    console: boot_params = 0x00000100
>>    console: DRAM bank   = 0x00000000
>>    console: -> start    = 0x00000000
>>    console: -> size     = 0x3c000000
>>    console: baudrate    = 115200 bps
>>    console: TLB addr    = 0x3bff0000
>>    console: relocaddr   = 0x3bf64000
>>    console: reloc off   = 0x3bf5c000
>>    console: irq_sp      = 0x3bb5fec0
>>    console: sp start    = 0x3bb5feb0
>>    console: Early malloc usage: 2a4 / 400
>>    console: fdt_blob    = 0x3bfbdfb0
>>    console: U-Boot> version
>>    console: U-Boot 2019.01+dfsg-7 (May 14 2019 - 02:07:44 +0000)
>>    console: gcc (Debian 8.3.0-7) 8.3.0
>>    console: GNU ld (GNU Binutils for Debian) 2.31.1
>>    console: U-Boot> reset
>>    console: resetting ...
>>    PASS (0.46 s)
>>
>> U-Boot is built by the Debian project, see:
>> https://wiki.debian.org/InstallingDebianOn/Allwinner#Creating_a_bootable_SD_Card_with_u-boot
>>
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> ---
>>   tests/acceptance/boot_linux_console.py | 28 ++++++++++++++++++++++++++
>>   1 file changed, 28 insertions(+)
>>
>> diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
>> index e40b84651b..682b801b4f 100644
>> --- a/tests/acceptance/boot_linux_console.py
>> +++ b/tests/acceptance/boot_linux_console.py
> 
> The file is called boot_*linux*_console.py ... so shouldn't tests that
> don't use Linux rather go into another file instead?
> Either machine_arm_raspi.py or maybe a boot_firmware_console.py file?

Yes I have a series ready splitting boot_linux_console.py per machines 
(as suggested machine_arm_raspi.py) not for consistency with fw/linux 
but because I'm tired of fixing conflicts while rebasing since months.
Thomas Huth Jan. 27, 2020, 4:15 p.m. UTC | #5
On 27/01/2020 17.09, Philippe Mathieu-Daudé wrote:
> On 1/27/20 5:02 PM, Thomas Huth wrote:
>> On 21/01/2020 00.51, Philippe Mathieu-Daudé wrote:
>>> This test runs U-Boot on the Raspberry Pi 2.
>>> It is very simple and fast:
>>>
>>>    $ avocado --show=app,console run -t raspi2 -t u-boot
>>> tests/acceptance/
>>>    JOB LOG    : avocado/job-results/job-2020-01-20T23.40-2424777/job.log
>>>     (1/1)
>>> tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_raspi2_uboot:
>>>
>>>    console: MMC:   sdhci@7e300000: 0
>>>    console: Loading Environment from FAT... Card did not respond to
>>> voltage select!
>>>    console: In:    serial
>>>    console: Out:   vidconsole
>>>    console: Err:   vidconsole
>>>    console: Net:   No ethernet found.
>>>    console: starting USB...
>>>    console: USB0:   Port not available.
>>>    console: Hit any key to stop autoboot:  0
>>>    console: U-Boot>
>>>    console: U-Boot> bdinfo
>>>    console: arch_number = 0x00000000
>>>    console: boot_params = 0x00000100
>>>    console: DRAM bank   = 0x00000000
>>>    console: -> start    = 0x00000000
>>>    console: -> size     = 0x3c000000
>>>    console: baudrate    = 115200 bps
>>>    console: TLB addr    = 0x3bff0000
>>>    console: relocaddr   = 0x3bf64000
>>>    console: reloc off   = 0x3bf5c000
>>>    console: irq_sp      = 0x3bb5fec0
>>>    console: sp start    = 0x3bb5feb0
>>>    console: Early malloc usage: 2a4 / 400
>>>    console: fdt_blob    = 0x3bfbdfb0
>>>    console: U-Boot> version
>>>    console: U-Boot 2019.01+dfsg-7 (May 14 2019 - 02:07:44 +0000)
>>>    console: gcc (Debian 8.3.0-7) 8.3.0
>>>    console: GNU ld (GNU Binutils for Debian) 2.31.1
>>>    console: U-Boot> reset
>>>    console: resetting ...
>>>    PASS (0.46 s)
>>>
>>> U-Boot is built by the Debian project, see:
>>> https://wiki.debian.org/InstallingDebianOn/Allwinner#Creating_a_bootable_SD_Card_with_u-boot
>>>
>>>
>>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>>> ---
>>>   tests/acceptance/boot_linux_console.py | 28 ++++++++++++++++++++++++++
>>>   1 file changed, 28 insertions(+)
>>>
>>> diff --git a/tests/acceptance/boot_linux_console.py
>>> b/tests/acceptance/boot_linux_console.py
>>> index e40b84651b..682b801b4f 100644
>>> --- a/tests/acceptance/boot_linux_console.py
>>> +++ b/tests/acceptance/boot_linux_console.py
>>
>> The file is called boot_*linux*_console.py ... so shouldn't tests that
>> don't use Linux rather go into another file instead?
>> Either machine_arm_raspi.py or maybe a boot_firmware_console.py file?
> 
> Yes I have a series ready splitting boot_linux_console.py per machines
> (as suggested machine_arm_raspi.py) not for consistency with fw/linux
> but because I'm tired of fixing conflicts while rebasing since months.

Ah, great, good idea. That will also make it easier to assign the files
to entries in MAINTAINERS, I guess.

 Thanks,
  Thomas
Wainer dos Santos Moschetta Jan. 28, 2020, 8:08 p.m. UTC | #6
On 1/20/20 9:51 PM, Philippe Mathieu-Daudé wrote:
> This test runs U-Boot on the Raspberry Pi 2.
> It is very simple and fast:
>
>    $ avocado --show=app,console run -t raspi2 -t u-boot tests/acceptance/
>    JOB LOG    : avocado/job-results/job-2020-01-20T23.40-2424777/job.log
>     (1/1) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_raspi2_uboot:
>    console: MMC:   sdhci@7e300000: 0
>    console: Loading Environment from FAT... Card did not respond to voltage select!
>    console: In:    serial
>    console: Out:   vidconsole
>    console: Err:   vidconsole
>    console: Net:   No ethernet found.
>    console: starting USB...
>    console: USB0:   Port not available.
>    console: Hit any key to stop autoboot:  0
>    console: U-Boot>
>    console: U-Boot> bdinfo
>    console: arch_number = 0x00000000
>    console: boot_params = 0x00000100
>    console: DRAM bank   = 0x00000000
>    console: -> start    = 0x00000000
>    console: -> size     = 0x3c000000
>    console: baudrate    = 115200 bps
>    console: TLB addr    = 0x3bff0000
>    console: relocaddr   = 0x3bf64000
>    console: reloc off   = 0x3bf5c000
>    console: irq_sp      = 0x3bb5fec0
>    console: sp start    = 0x3bb5feb0
>    console: Early malloc usage: 2a4 / 400
>    console: fdt_blob    = 0x3bfbdfb0
>    console: U-Boot> version
>    console: U-Boot 2019.01+dfsg-7 (May 14 2019 - 02:07:44 +0000)
>    console: gcc (Debian 8.3.0-7) 8.3.0
>    console: GNU ld (GNU Binutils for Debian) 2.31.1
>    console: U-Boot> reset
>    console: resetting ...
>    PASS (0.46 s)
>
> U-Boot is built by the Debian project, see:
> https://wiki.debian.org/InstallingDebianOn/Allwinner#Creating_a_bootable_SD_Card_with_u-boot
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>   tests/acceptance/boot_linux_console.py | 28 ++++++++++++++++++++++++++
>   1 file changed, 28 insertions(+)


Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>


>
> diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
> index e40b84651b..682b801b4f 100644
> --- a/tests/acceptance/boot_linux_console.py
> +++ b/tests/acceptance/boot_linux_console.py
> @@ -16,6 +16,7 @@ import shutil
>   from avocado import skipUnless
>   from avocado_qemu import Test
>   from avocado_qemu import exec_command_and_wait_for_pattern
> +from avocado_qemu import interrupt_interactive_console_until_pattern
>   from avocado_qemu import wait_for_console_pattern
>   from avocado.utils import process
>   from avocado.utils import archive
> @@ -485,6 +486,33 @@ class BootLinuxConsole(Test):
>           exec_command_and_wait_for_pattern(self, 'reboot',
>                                                   'reboot: Restarting system')
>   
> +    def test_arm_raspi2_uboot(self):
> +        """
> +        :avocado: tags=arch:arm
> +        :avocado: tags=machine:raspi2
> +        :avocado: tags=u-boot
> +        """
> +        deb_url = ('https://snapshot.debian.org/archive/debian/'
> +                   '20190514T084354Z/pool/main/u/u-boot/'
> +                   'u-boot-rpi_2019.01%2Bdfsg-7_armhf.deb')
> +        deb_hash = 'ad858cf3afe623b6c3fa2e20dcdd1768fcb9ae83'
> +        deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
> +        uboot_path = '/usr/lib/u-boot/rpi_2/uboot.elf'
> +        uboot_path = self.extract_from_deb(deb_path, uboot_path)
> +
> +        self.vm.set_console()
> +        self.vm.add_args('-kernel', uboot_path,
> +                         # VideoCore starts CPU with only 1 core enabled
> +                         '-global', 'bcm2836.enabled-cpus=1',
> +                         '-no-reboot')
> +        self.vm.launch()
> +        interrupt_interactive_console_until_pattern(self,
> +                                       'Hit any key to stop autoboot:',
> +                                       'Config file not found')
> +        exec_command_and_wait_for_pattern(self, 'bdinfo', 'U-Boot')
> +        exec_command_and_wait_for_pattern(self, 'version', 'U-Boot')
> +        exec_command_and_wait_for_pattern(self, 'reset', 'resetting ...')
> +
>       def test_s390x_s390_ccw_virtio(self):
>           """
>           :avocado: tags=arch:s390x
diff mbox series

Patch

diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
index e40b84651b..682b801b4f 100644
--- a/tests/acceptance/boot_linux_console.py
+++ b/tests/acceptance/boot_linux_console.py
@@ -16,6 +16,7 @@  import shutil
 from avocado import skipUnless
 from avocado_qemu import Test
 from avocado_qemu import exec_command_and_wait_for_pattern
+from avocado_qemu import interrupt_interactive_console_until_pattern
 from avocado_qemu import wait_for_console_pattern
 from avocado.utils import process
 from avocado.utils import archive
@@ -485,6 +486,33 @@  class BootLinuxConsole(Test):
         exec_command_and_wait_for_pattern(self, 'reboot',
                                                 'reboot: Restarting system')
 
+    def test_arm_raspi2_uboot(self):
+        """
+        :avocado: tags=arch:arm
+        :avocado: tags=machine:raspi2
+        :avocado: tags=u-boot
+        """
+        deb_url = ('https://snapshot.debian.org/archive/debian/'
+                   '20190514T084354Z/pool/main/u/u-boot/'
+                   'u-boot-rpi_2019.01%2Bdfsg-7_armhf.deb')
+        deb_hash = 'ad858cf3afe623b6c3fa2e20dcdd1768fcb9ae83'
+        deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
+        uboot_path = '/usr/lib/u-boot/rpi_2/uboot.elf'
+        uboot_path = self.extract_from_deb(deb_path, uboot_path)
+
+        self.vm.set_console()
+        self.vm.add_args('-kernel', uboot_path,
+                         # VideoCore starts CPU with only 1 core enabled
+                         '-global', 'bcm2836.enabled-cpus=1',
+                         '-no-reboot')
+        self.vm.launch()
+        interrupt_interactive_console_until_pattern(self,
+                                       'Hit any key to stop autoboot:',
+                                       'Config file not found')
+        exec_command_and_wait_for_pattern(self, 'bdinfo', 'U-Boot')
+        exec_command_and_wait_for_pattern(self, 'version', 'U-Boot')
+        exec_command_and_wait_for_pattern(self, 'reset', 'resetting ...')
+
     def test_s390x_s390_ccw_virtio(self):
         """
         :avocado: tags=arch:s390x