-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
57 lines (46 loc) · 1.44 KB
/
Makefile
File metadata and controls
57 lines (46 loc) · 1.44 KB
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
KERNEL=../kernel/linux/arch/x86/boot/bzImage
RECOVERY_SIZE = 512M
DISK_SIZE = 2G
SUDO = sudo
.PHONY: all
all: appctl/appctl appctl-rpc/appctl init/init init/initrd.img recover/recover recovery.iso disk.iso
appctl/appctl: always
$(MAKE) -C common all
$(MAKE) -C appctl appctl
appctl-rpc/appctl: always
$(MAKE) -C common all
$(MAKE) -C appctl-rpc all
init/init: always
$(MAKE) -C common all
$(MAKE) -C init init
init/initrd.img: always
$(MAKE) -C common all
$(MAKE) -C init initrd.img
recover/recover: always
$(MAKE) -C common all
$(MAKE) -C recover all
.PHONY: clean
clean:
$(MAKE) -C appctl clean
$(MAKE) -C appctl-rpc clean
$(MAKE) -C common clean
$(MAKE) -C init clean
$(MAKE) -C recover clean
rm -rf recovery.iso disk.iso
.PHONY: always
always:
.PHONY: run
run: init/initrd.img recovery.iso disk.iso
$(SUDO) qemu-system-x86_64 -kernel $(KERNEL) -initrd $< -nographic -append "console=ttyS0" -drive "format=raw,file=recovery.iso" -drive "format=raw,file=disk.iso" | tee serial.log
recovery.iso: always recover/recover
mkdir -p mnt
[ -f $@ ] || (fallocate -l $(RECOVERY_SIZE) $@ && mkfs.ext4 $@)
$(SUDO) mount $@ mnt
$(SUDO) $(MAKE) -C mnt -f ../recovery.iso.mk || ($(SUDO) umount mnt && false)
$(SUDO) umount mnt
disk.iso: always appctl/appctl
mkdir -p mnt
[ -f $@ ] || (fallocate -l $(DISK_SIZE) $@ && mkfs.ext4 $@)
$(SUDO) mount $@ mnt
$(SUDO) $(MAKE) -C mnt -f ../disk.iso.mk || ($(SUDO) umount mnt && false)
$(SUDO) umount mnt