1e3ea6e015bde8dc2e5ae927279b823cb044c2ca
[rhbz1184405.git] / Makefile
1 kver    = 3.19.0-0.rc4.57.sa2.aarch64
2 use_efi = 1
3 kernel  = /boot/vmlinuz-$(kver)
4 moddir  = /lib/modules/$(kver)
5 qemu    = /usr/libexec/qemu-kvm
6 modules = virtio.ko virtio_ring.ko virtio_mmio.ko virtio_scsi.ko
7 disks   = sda.img sdb.img sdc.img sdd.img sde.img sdf.img
8
9 all:    initrd $(disks) AAVMF_VARS.fd
10
11 ifeq ($(use_efi),1)
12 AAVMF_VARS.fd: /usr/share/AAVMF/AAVMF_VARS.fd
13         cp $< $@
14 efi_params = \
15         -drive if=pflash,format=raw,file=/usr/share/AAVMF/AAVMF_CODE.fd,readonly \
16         -drive if=pflash,format=raw,file=AAVMF_VARS.fd
17 else
18 AAVMF_VARS.fd:
19         touch $@
20 endif
21
22 initrd: dev init $(modules)
23         ls -1d $^ | cpio -o -H newc | gzip -9 > $@
24
25 dev:
26         rm -rf $@
27         mkdir $@
28
29 %.ko:
30         find $(moddir) -name $@ -exec cp {} . \;
31
32 init:   init.c
33         gcc -Wall -Werror -static $< -o $@
34
35 %.img:
36         rm -f $@
37         truncate -s $$(( RANDOM % 3 + 1 ))G $@
38         echo '2048,,L' | sfdisk --force $@
39
40 clean:
41         rm -f *~ $(disks) $(modules) init initrd AAVMF_VARS.fd
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