-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
73 lines (54 loc) · 2.06 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
# Some configuration.
LINUX_VERSION=4.6.2
RISCV-LINUX-BRANCH=broom
RISCV-LINUX-SHA=df91b31830ef24f748ef1b38c31ad4f913861b0b
linux=linux-$(LINUX_VERSION)
all: bblvmlinux
initramfs: initramfs.txt
# This setups the repository for automatic generation of ramdisk images
# by running through the manual configuration stages of linux and busybox
setup: busybox/.config.old $(linux)/.config.old
###############################################################################
# Get sources and configure
###############################################################################
# Busybox is a submodule. Init it before commencing
busybox/.config: busybox_config
cp -f $< $@
# Configure busybox. Hopefully this is a NOP!
busybox/.config.old: busybox/.config
make -C $(@D) oldconfig
# Fetch linux sources and apply RISCV patch
$(linux):
curl -L https://cdn.kernel.org/pub/linux/kernel/v4.x/$(linux).tar.xz | tar -xJ
cd $(linux); \
git init; \
git remote add origin https://github.com/firesim/riscv-linux.git; \
git fetch; git checkout -f $(RISCV-LINUX-SHA)
$(linux)/.config: linux_config $(linux)
cp -f $< $@
# Configure linux. Hopefully this is a nop.
$(linux)/.config.old: $(linux)/.config
make -C $(@D) ARCH=riscv oldconfig
###############################################################################
# Build
###############################################################################
profile:
@echo "Give me a real profile script! Using a dummy instead."
cp dummy_profile profile
DIRNAME ?= none
initramfs.txt: build-initram.py
@echo "Building initramfs.txt; using directory:" $(DIRNAME)
./build-initram.py --dir=$(DIRNAME)
busybox/busybox: busybox/.config.old profile
@echo "Building busybox."
time make -C $(@D) -j
$(linux)/vmlinux: $(linux)/.config.old initramfs.txt busybox/busybox
@echo "Building riscv linux."
time make -C $(@D) -j ARCH=riscv vmlinux
bblvmlinux: $(linux)/vmlinux
@echo "Building an bbl instance with your payload."
time ./build-pk.sh
clean:
rm -rf $(linux) initramfs.txt bblvmlinux
cd busybox && git clean -x -d -f
.PHONY: setup all clean