forked from QubesOS/qubes-vmm-xen-stubdom-linux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.stubdom
170 lines (143 loc) · 4.55 KB
/
Makefile.stubdom
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
include Makefile.vars
.PHONY: all install clean
SHELL := bash
VMLINUZ=build/linux/arch/x86/boot/bzImage
ROOTFS_IMG=build/rootfs/stubdom-linux-rootfs
SEABIOS=build/qemu/roms/seabios/builds/seabios-256k/bios.bin
# Stubdom disk content
STUBDOM_DISK_FILE= \
build/qemu/i386-softmmu/qemu-system-i386 \
rootfs/init \
rootfs/qemu-ifup \
rootfs/qemu-ifdown
Q=scripts/quilt-wrapper
all: $(VMLINUZ) $(ROOTFS_IMG)
QEMU_PATCHES := $(shell $Q -l qemu)
build/qemu/.extracted: dl/qemu-$(QEMU_VERSION).tar.xz
rm -rf build/qemu
mkdir -p build/qemu
tar -C build/qemu --strip-components=1 -xf $<
rm build/qemu/pc-bios/*.{rom,bin,dtb} # remove prebuild binaries
touch $@
build/qemu/.patched: build/qemu/.extracted qemu/patches/series $(QEMU_PATCHES)
$Q -C build/qemu -. pop -a
rm -rf build/qemu/.patches
cp -aL qemu/patches build/qemu/.patches
$Q -C build/qemu -. push -a
touch $@
QEMU_GUI_AGENT_FILES := $(shell find qemu/gui-agent -type f \! \( -name '*.sw?' -o -name '*~' -o -name '.*' -o -name '*.patch' \) | sort)
build/qemu/.gui-agent-copied-in: build/qemu/.extracted $(QEMU_GUI_AGENT_FILES)
rm -rf build/qemu/gui-agent
cp -a qemu/gui-agent build/qemu/
touch $@
build/qemu/config.status: build/qemu/.patched
cd build/qemu && ./configure \
--target-list=i386-softmmu \
--enable-xen \
--enable-xen-pci-passthrough \
--disable-werror \
--disable-sdl \
--disable-kvm \
--disable-gtk \
--disable-fdt \
--disable-bluez \
--disable-libusb \
--disable-slirp \
--disable-pie \
--disable-docs \
--disable-vhost-net \
--disable-spice \
--disable-guest-agent \
--audio-drv-list= \
--disable-smartcard \
--disable-vnc \
--disable-spice \
--enable-trace-backends=log \
--disable-gnutls \
--disable-nettle \
--disable-gcrypt \
--disable-vte \
--disable-curses \
--disable-cocoa \
--disable-virtfs \
--disable-brlapi \
--disable-curl \
--disable-rdma \
--disable-vde \
--disable-netmap \
--disable-linux-aio \
--disable-cap-ng \
--disable-attr \
--disable-rbd \
--disable-libiscsi \
--disable-libnfs \
--disable-usb-redir \
--disable-lzo \
--disable-snappy \
--disable-bzip2 \
--disable-seccomp \
--disable-coroutine-pool \
--disable-glusterfs \
--disable-tpm \
--disable-libssh2 \
--disable-numa \
--disable-tcmalloc \
--disable-jemalloc \
--disable-vhost-scsi \
--disable-qom-cast-debug \
--disable-virglrenderer \
--enable-stubdom \
--disable-tools \
--disable-replication \
--disable-vhost-vsock \
--disable-hax \
--disable-vhost-vsock \
--disable-opengl \
--disable-virglrenderer \
--disable-xfsctl \
--disable-blobs \
--cxx=/non-existent \
--extra-cflags="-DXEN_PT_LOGGING_ENABLED=1" \
--prefix=
build/qemu/i386-softmmu/qemu-system-i386: build/qemu/.patched build/qemu/config.status build/qemu/.gui-agent-copied-in
$(MAKE) -C build/qemu/roms seavgabios-{cirrus,stdvga}
$(MAKE) -C build/qemu/pc-bios/optionrom linuxboot.bin
$(MAKE) -C build/qemu
$(SEABIOS): build/qemu/.patched
$(MAKE) -C build/qemu/roms build-seabios-config-seabios-256k
LINUX_PATCHES := $(shell $Q -l linux)
build/linux/.extracted: dl/linux-$(LINUX_VERSION).tar.xz
rm -rf build/linux
mkdir -p build/linux
tar -C build/linux --strip-components=1 -xf $<
touch $@
build/linux/.patched: build/linux/.extracted linux/patches/series $(LINUX_PATCHES)
$Q -C build/linux -. pop -a
rm -rf build/linux/.patches
cp -a linux/patches build/linux/.patches
$Q -C build/linux -. push -a
touch $@
build/linux/.config: $(sort $(wildcard linux/config/[0-9][0-9]-*)) build/linux/.extracted
cd build/linux; env -u MAKEFLAGS ./scripts/kconfig/merge_config.sh -n /dev/null ../../linux/config/[0-9][0-9]-*
U2MFN_DIR = $(shell ls -d /usr/src/u2mfn-* 2>/dev/null | sort -V | tail -n 1)
ifeq ($(U2MFN_DIR),)
$(error "u2mfn dir not found in /usr/src/")
endif
build/linux/.u2mfn-copied-in: build/linux/.extracted $(U2MFN_DIR)
rm -rf build/linux/drivers/u2mfn
cp -a $(U2MFN_DIR) build/linux/drivers/u2mfn
sed -i -e 's/^obj-m/obj-y/' build/linux/drivers/u2mfn/Makefile
touch $@
$(VMLINUZ): build/linux/.patched build/linux/.config build/linux/.u2mfn-copied-in
$(MAKE) -C build/linux
DRACUT_INSTALL=/usr/lib/dracut/dracut-install
rootfs/gen: $(DRACUT_INSTALL)
export DRACUT_INSTALL
$(ROOTFS_IMG): rootfs/gen $(STUBDOM_DISK_FILE)
env -u MAKELEVEL -u MAKEFLAGS -u MFLAGS ./$<
install: $(VMLINUZ) $(ROOTFS_IMG) $(SEABIOS)
install -D -m 444 $(VMLINUZ) $(DESTDIR)/usr/lib/xen/boot/stubdom-linux-kernel
install -m 444 $(ROOTFS_IMG) $(DESTDIR)/usr/lib/xen/boot/
install -m 444 $(SEABIOS) $(DESTDIR)/usr/lib/xen/boot/seabios-256k.bin
clean:
rm -rf build