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