1#!/usr/bin/env python3 2# 3# Functional test that boots a Linux kernel and checks the console 4# 5# SPDX-License-Identifier: GPL-2.0-or-later 6 7import os 8 9from qemu_test import LinuxKernelTest, Asset 10from qemu_test.utils import gzip_uncompress 11 12class Smdkc210Machine(LinuxKernelTest): 13 14 ASSET_DEB = Asset( 15 ('https://snapshot.debian.org/archive/debian/20190928T224601Z/pool/' 16 'main/l/linux/linux-image-4.19.0-6-armmp_4.19.67-2+deb10u1_armhf.deb'), 17 '421804e7579ef40d554c962850dbdf1bfc79f7fa7faec9d391397170dc806c3e') 18 19 ASSET_ROOTFS = Asset( 20 ('https://github.com/groeck/linux-build-test/raw/' 21 '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/arm/' 22 'rootfs-armv5.cpio.gz'), 23 '334b8d256db67a3f2b3ad070aa08b5ade39624e0e7e35b02f4359a577bc8f39b') 24 25 def test_arm_exynos4210_initrd(self): 26 self.set_machine('smdkc210') 27 28 deb_path = self.ASSET_DEB.fetch() 29 kernel_path = self.extract_from_deb(deb_path, 30 '/boot/vmlinuz-4.19.0-6-armmp') 31 dtb_path = '/usr/lib/linux-image-4.19.0-6-armmp/exynos4210-smdkv310.dtb' 32 dtb_path = self.extract_from_deb(deb_path, dtb_path) 33 34 initrd_path_gz = self.ASSET_ROOTFS.fetch() 35 initrd_path = self.scratch_file('rootfs.cpio') 36 gzip_uncompress(initrd_path_gz, initrd_path) 37 38 self.vm.set_console() 39 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + 40 'earlycon=exynos4210,0x13800000 earlyprintk ' + 41 'console=ttySAC0,115200n8 ' + 42 'random.trust_cpu=off cryptomgr.notests ' + 43 'cpuidle.off=1 panic=-1 noreboot') 44 45 self.vm.add_args('-kernel', kernel_path, 46 '-dtb', dtb_path, 47 '-initrd', initrd_path, 48 '-append', kernel_command_line, 49 '-no-reboot') 50 self.vm.launch() 51 52 self.wait_for_console_pattern('Boot successful.') 53 # TODO user command, for now the uart is stuck 54 55if __name__ == '__main__': 56 LinuxKernelTest.main() 57