xref: /qemu/tests/functional/test_arm_smdkc210.py (revision 513823e7521a09ed7ad1e32e6454bac3b2cbf52d)
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
10
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        kernel_path = self.archive_extract(self.ASSET_DEB,
29                                           member='boot/vmlinuz-4.19.0-6-armmp')
30        dtb_path = 'usr/lib/linux-image-4.19.0-6-armmp/exynos4210-smdkv310.dtb'
31        dtb_path = self.archive_extract(self.ASSET_DEB, member=dtb_path)
32
33        initrd_path = self.uncompress(self.ASSET_ROOTFS)
34
35        self.vm.set_console()
36        kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
37                               'earlycon=exynos4210,0x13800000 earlyprintk ' +
38                               'console=ttySAC0,115200n8 ' +
39                               'random.trust_cpu=off cryptomgr.notests ' +
40                               'cpuidle.off=1 panic=-1 noreboot')
41
42        self.vm.add_args('-kernel', kernel_path,
43                         '-dtb', dtb_path,
44                         '-initrd', initrd_path,
45                         '-append', kernel_command_line,
46                         '-no-reboot')
47        self.vm.launch()
48
49        self.wait_for_console_pattern('Boot successful.')
50        # TODO user command, for now the uart is stuck
51
52if __name__ == '__main__':
53    LinuxKernelTest.main()
54