81ab185bbd2a30ad346be9325e49500d3f050c1b
[rhbz1184405.git] / Makefile
1 kver    = 3.19.0-0.rc4.57.sa2.aarch64
2 use_efi = 1
3 modules = virtio.ko virtio_ring.ko virtio_mmio.ko virtio_scsi.ko
4 disks   = sda.img sdb.img sdc.img sdd.img sde.img sdf.img
5
6 all:    initrd $(disks) AAVMF_VARS.fd
7
8 ifeq ($(use_efi),1)
9 AAVMF_VARS.fd: /usr/share/AAVMF/AAVMF_VARS.fd
10         cp $< $@
11 efi_params = \
12         -drive if=pflash,format=raw,file=/usr/share/AAVMF/AAVMF_CODE.fd,readonly \
13         -drive if=pflash,format=raw,file=AAVMF_VARS.fd
14 else
15 AAVMF_VARS.fd:
16         touch $@
17 endif
18
19 initrd: dev init $(modules)
20         ls -1d $^ | cpio -o -H newc | gzip -9 > $@
21
22 dev:
23         rm -rf $@
24         mkdir $@
25
26 %.ko:
27         find /lib/modules/$(kver) -name $@ -exec cp {} . \;
28
29 init:   init.c
30         gcc -Wall -Werror -static $< -o $@
31
32 %.img:
33         rm -f $@
34         truncate -s $$(( RANDOM % 3 + 1 ))G $@
35         echo '2048,,L' | sfdisk --force $@
36
37 clean:
38         rm -f $(disks) $(modules) init initrd AAVMF_VARS.fd
39
40 kernel  = /boot/vmlinuz-$(kver)
41 qemu    = qemu-system-aarch64
42
43 run:    initrd $(disks) AAVMF_VARS.fd
44         $(qemu) \
45           -nodefconfig -nodefaults -display none \
46           -machine virt,accel=kvm \
47           -no-reboot \
48           -cpu host \
49           -m 1024 \
50           $(efi_params) \
51           -kernel $(kernel) -initrd initrd \
52           -append 'panic=1 earlyprintk=pl011,0x9000000 ignore_loglevel console=ttyAMA0 no_timer_check printk.time=1' \
53           -serial stdio \
54           -device virtio-scsi-device,id=scsi \
55           -drive file=sda.img,cache=writeback,format=raw,if=none,id=sda \
56           -device scsi-hd,drive=sda \
57           -drive file=sdb.img,cache=writeback,format=raw,if=none,id=sdb \
58           -device scsi-hd,drive=sdb \
59           -drive file=sdc.img,cache=writeback,format=raw,if=none,id=sdc \
60           -device scsi-hd,drive=sdc \
61           -drive file=sdd.img,cache=writeback,format=raw,if=none,id=sdd \
62           -device scsi-hd,drive=sdd \
63           -drive file=sde.img,cache=writeback,format=raw,if=none,id=sde \
64           -device scsi-hd,drive=sde \
65           -drive file=sdf.img,cache=writeback,format=raw,if=none,id=sdf \
66           -device scsi-hd,drive=sdf