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 10import os 11from zipfile import ZipFile 12 13from qemu_test import LinuxKernelTest, Asset 14 15 16class Aarch64Raspi3Machine(LinuxKernelTest): 17 18 ASSET_RPI3_UEFI = Asset( 19 ('https://github.com/pbatard/RPi3/releases/download/' 20 'v1.15/RPi3_UEFI_Firmware_v1.15.zip'), 21 '8cff2e979560048b4c84921f41a91893240b9fb71a88f0b5c5d6c8edd994bd5b') 22 23 def test_aarch64_raspi3_atf(self): 24 efi_name = 'RPI_EFI.fd' 25 zip_path = self.ASSET_RPI3_UEFI.fetch() 26 27 with ZipFile(zip_path, 'r') as zf: 28 zf.extract(efi_name, path=self.workdir) 29 efi_fd = os.path.join(self.workdir, efi_name) 30 31 self.set_machine('raspi3b') 32 self.vm.set_console(console_index=1) 33 self.vm.add_args('-cpu', 'cortex-a53', 34 '-nodefaults', 35 '-device', f'loader,file={efi_fd},force-raw=true') 36 self.vm.launch() 37 self.wait_for_console_pattern('version UEFI Firmware v1.15') 38 39 40if __name__ == '__main__': 41 LinuxKernelTest.main() 42