1#!/usr/bin/env python3 2# 3# Functional test that boots a Linux kernel on a Raspberry Pi machine 4# and checks the console 5# 6# Copyright (c) 2020 Philippe Mathieu-Daudé <f4bug@amsat.org> 7# 8# SPDX-License-Identifier: GPL-2.0-or-later 9 10from zipfile import ZipFile 11 12from qemu_test import LinuxKernelTest, Asset 13 14 15class Aarch64Raspi3Machine(LinuxKernelTest): 16 17 ASSET_RPI3_UEFI = Asset( 18 ('https://github.com/pbatard/RPi3/releases/download/' 19 'v1.15/RPi3_UEFI_Firmware_v1.15.zip'), 20 '8cff2e979560048b4c84921f41a91893240b9fb71a88f0b5c5d6c8edd994bd5b') 21 22 def test_aarch64_raspi3_atf(self): 23 efi_name = 'RPI_EFI.fd' 24 zip_path = self.ASSET_RPI3_UEFI.fetch() 25 26 with ZipFile(zip_path, 'r') as zf: 27 zf.extract(efi_name, path=self.workdir) 28 efi_fd = self.scratch_file(efi_name) 29 30 self.set_machine('raspi3b') 31 self.vm.set_console(console_index=1) 32 self.vm.add_args('-cpu', 'cortex-a53', 33 '-nodefaults', 34 '-device', f'loader,file={efi_fd},force-raw=true') 35 self.vm.launch() 36 self.wait_for_console_pattern('version UEFI Firmware v1.15') 37 38 39if __name__ == '__main__': 40 LinuxKernelTest.main() 41