1*8a145225SThomas Huth#!/usr/bin/env python3 2*8a145225SThomas Huth# 3*8a145225SThomas Huth# Replay test that boots a Linux kernel on arm machines and checks the console 4*8a145225SThomas Huth# 5*8a145225SThomas Huth# SPDX-License-Identifier: GPL-2.0-or-later 6*8a145225SThomas Huth 7*8a145225SThomas Huthfrom qemu_test import Asset 8*8a145225SThomas Huthfrom replay_kernel import ReplayKernelBase 9*8a145225SThomas Huth 10*8a145225SThomas Huth 11*8a145225SThomas Huthclass ArmReplay(ReplayKernelBase): 12*8a145225SThomas Huth 13*8a145225SThomas Huth ASSET_VIRT = Asset( 14*8a145225SThomas Huth ('https://archives.fedoraproject.org/pub/archive/fedora/linux/' 15*8a145225SThomas Huth 'releases/29/Everything/armhfp/os/images/pxeboot/vmlinuz'), 16*8a145225SThomas Huth '18dd5f1a9a28bd539f9d047f7c0677211bae528e8712b40ca5a229a4ad8e2591') 17*8a145225SThomas Huth 18*8a145225SThomas Huth def test_virt(self): 19*8a145225SThomas Huth self.set_machine('virt') 20*8a145225SThomas Huth kernel_path = self.ASSET_VIRT.fetch() 21*8a145225SThomas Huth kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + 22*8a145225SThomas Huth 'console=ttyAMA0') 23*8a145225SThomas Huth console_pattern = 'VFS: Cannot open root device' 24*8a145225SThomas Huth self.run_rr(kernel_path, kernel_command_line, console_pattern, shift=1) 25*8a145225SThomas Huth 26*8a145225SThomas Huth ASSET_CUBIE_KERNEL = Asset( 27*8a145225SThomas Huth ('https://apt.armbian.com/pool/main/l/linux-6.6.16/' 28*8a145225SThomas Huth 'linux-image-current-sunxi_24.2.1_armhf_' 29*8a145225SThomas Huth '_6.6.16-Seb3e-D6b4a-P2359-Ce96bHfe66-HK01ba-V014b-B067e-R448a.deb'), 30*8a145225SThomas Huth '3d968c15b121ede871dce49d13ee7644d6f74b6b121b84c9a40f51b0c80d6d22') 31*8a145225SThomas Huth 32*8a145225SThomas Huth ASSET_CUBIE_INITRD = Asset( 33*8a145225SThomas Huth ('https://github.com/groeck/linux-build-test/raw/' 34*8a145225SThomas Huth '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/arm/rootfs-armv5.cpio.gz'), 35*8a145225SThomas Huth '334b8d256db67a3f2b3ad070aa08b5ade39624e0e7e35b02f4359a577bc8f39b') 36*8a145225SThomas Huth 37*8a145225SThomas Huth def test_cubieboard(self): 38*8a145225SThomas Huth self.set_machine('cubieboard') 39*8a145225SThomas Huth kernel_path = self.archive_extract(self.ASSET_CUBIE_KERNEL, 40*8a145225SThomas Huth member='boot/vmlinuz-6.6.16-current-sunxi') 41*8a145225SThomas Huth dtb_path = self.archive_extract(self.ASSET_CUBIE_KERNEL, 42*8a145225SThomas Huth member='usr/lib/linux-image-6.6.16-current-sunxi/sun4i-a10-cubieboard.dtb') 43*8a145225SThomas Huth initrd_path = self.uncompress(self.ASSET_CUBIE_INITRD) 44*8a145225SThomas Huth 45*8a145225SThomas Huth kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + 46*8a145225SThomas Huth 'console=ttyS0,115200 ' 47*8a145225SThomas Huth 'usbcore.nousb ' 48*8a145225SThomas Huth 'panic=-1 noreboot') 49*8a145225SThomas Huth console_pattern = 'Boot successful.' 50*8a145225SThomas Huth self.run_rr(kernel_path, kernel_command_line, console_pattern, shift=1, 51*8a145225SThomas Huth args=('-dtb', dtb_path, 52*8a145225SThomas Huth '-initrd', initrd_path, 53*8a145225SThomas Huth '-no-reboot')) 54*8a145225SThomas Huth 55*8a145225SThomas Huth ASSET_DAY16 = Asset( 56*8a145225SThomas Huth 'https://qemu-advcal.gitlab.io/qac-best-of-multiarch/download/day16.tar.xz', 57*8a145225SThomas Huth '63311adb2d4c4e7a73214a86d29988add87266a909719c56acfadd026b4110a7') 58*8a145225SThomas Huth 59*8a145225SThomas Huth def test_vexpressa9(self): 60*8a145225SThomas Huth self.set_machine('vexpress-a9') 61*8a145225SThomas Huth self.archive_extract(self.ASSET_DAY16) 62*8a145225SThomas Huth kernel_path = self.scratch_file('day16', 'winter.zImage') 63*8a145225SThomas Huth dtb_path = self.scratch_file('day16', 'vexpress-v2p-ca9.dtb') 64*8a145225SThomas Huth self.run_rr(kernel_path, self.REPLAY_KERNEL_COMMAND_LINE, 65*8a145225SThomas Huth 'QEMU advent calendar', args=('-dtb', dtb_path)) 66*8a145225SThomas Huth 67*8a145225SThomas Huth 68*8a145225SThomas Huthif __name__ == '__main__': 69*8a145225SThomas Huth ReplayKernelBase.main() 70