-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
81 lines (67 loc) · 2.37 KB
/
Makefile
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
ARCH ?= $(shell uname -m)
LINUX_VERSION ?= 6.1.58
UROOT_GIT_REF ?= v0.11.0
BUILDER_IMAGE ?= quay.io/elastx/elx-pba-builder:$(shell git describe --tags --exact-match 2> /dev/null || git symbolic-ref -q --short HEAD || git rev-parse --short HEAD)
ifeq ($(shell uname),Linux)
ACCEL ?= kvm
else ifeq ($(shell uname),Darwin)
ACCEL ?= hvf
else
ACCEL ?= tcg
endif
.PHONY: checksum
checksum: elx-pba-$(ARCH).img elx-pba-interactive-$(ARCH).img
sha256sum elx-pba-*.img | tee SHA256SUMS
.PHONY: all
all: elx-pba-$(ARCH).img elx-pba-interactive-$(ARCH).img checksum
.EXPORT_ALL_VARIABLES:
GOPATH = $(PWD)/go
UROOT_PATH = $(PWD)/go/src/github.com/u-root/u-root
GBB_PATH = $(PWD):$(PWD)/go/src/github.com/u-root/u-root
.DELETE_ON_ERROR:
include kernel.mk
include u-root.mk
include rootfs.mk
include image.mk
.PHONY: qemu-x86_64
qemu-x86_64: elx-pba-x86_64.img arch/x86_64/ovmf.fd
qemu-system-x86_64 \
-m 1024 \
-uuid 00000000-0000-0000-0000-000000000001 \
-smbios type=1,serial=SYSTEM01 \
-smbios type=2,serial=BOARD01 \
-smbios type=3,serial=CHASSIS01 \
-device "virtio-scsi-pci,id=scsi0" \
-device "scsi-hd,bus=scsi0.0,drive=hd0" \
-drive "id=hd0,if=none,format=raw,readonly=on,file=$<" \
-drive "if=pflash,format=raw,readonly,file=arch/x86_64/ovmf.fd" \
-accel "$(ACCEL)" \
-machine "type=q35,smm=on,usb=on" \
-no-reboot
.PHONY: qemu-x86_64-interactive
qemu-x86_64-interactive: elx-pba-interactive-x86_64.img arch/x86_64/ovmf.fd
qemu-system-x86_64 \
-m 1024 \
-uuid 00000000-0000-0000-0000-000000000001 \
-smbios type=1,serial=SYSTEM01 \
-smbios type=2,serial=BOARD01 \
-smbios type=3,serial=CHASSIS01 \
-device "virtio-scsi-pci,id=scsi0" \
-device "scsi-hd,bus=scsi0.0,drive=hd0" \
-drive "id=hd0,if=none,format=raw,readonly=on,file=$<" \
-drive "if=pflash,format=raw,readonly,file=arch/x86_64/ovmf.fd" \
-accel "$(ACCEL)" \
-machine "type=q35,smm=on,usb=on" \
-no-reboot
.PHONY: clean
clean:
\rm -vf elx-pba-*.img elx-pba-*.fs rootfs-*.img rootfs-*.cpio go/bin/*
.PHONY: dist_clean
dist_clean: clean
rm -rf go/{bin,pkg,src}/* linux-$(LINUX_VERSION) linux-$(LINUX_VERSION).*
builder:
docker build -t "$(BUILDER_IMAGE)" -f builder.dockerfile .
docker_build:
docker run --user $(shell id -u):$(shell id -g) -it --rm -v $(PWD):/src $(BUILDER_IMAGE)
docker_clean:
docker run --user $(shell id -u):$(shell id -g) -it --rm -v $(PWD):/src $(BUILDER_IMAGE) make clean