-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
136 lines (95 loc) · 3.33 KB
/
Makefile
File metadata and controls
136 lines (95 loc) · 3.33 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
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
PLATFORM ?= x86
JOBS ?= $(shell jmax=16 ; j=$$(nproc); echo $$((j < jmax ? j : jmax)))
PLATFORMCONFIG = configs/platform-$(PLATFORM)/platformconfig
KERNELCONFIG = configs/platform-$(PLATFORM)/kernelconfig
PTXDIST = ptxdist --quiet --progress -j$(JOBS) --platformconfig=$(PLATFORMCONFIG)
all: install
@echo "#############################################"
@echo "Build completed successfully!"
install: update
@cd boot \
&& $(PTXDIST) images
update: .initramfs keygen
@cd root \
&& ln -sf platform-$(PLATFORM) platform-any \
&& $(PTXDIST) images
.initramfs:
@cd boot \
&& $(PTXDIST) image root.cpio
get:
@for p in boot root; do( \
cd $$p \
&& $(PTXDIST) get \
);done
clean:
@for p in boot/base boot root/base root; do( \
echo "Removing: $$p/platform-*" \
&& rm -rf $$p/platform-* \
);done
clean-target:
@for p in boot root; do( \
cd $$p \
&& $(PTXDIST) clean target \
);done
kernel-oldconfig:
@cd boot \
&& cat base/$(KERNELCONFIG).d/* $(KERNELCONFIG).d/* > $(KERNELCONFIG) \
&& yes "" | $(PTXDIST) oldconfig kernel > /dev/null
@cd root/base \
&& cat base/$(KERNELCONFIG).d/* $(KERNELCONFIG).d/* > $(KERNELCONFIG) \
&& yes "" | $(PTXDIST) oldconfig kernel > /dev/null
@if [ -d "root/$(KERNELCONFIG).d" ]; then \
cd root \
&& cat base/base/$(KERNELCONFIG).d/* base/$(KERNELCONFIG).d/* $(KERNELCONFIG).d/* > $(KERNELCONFIG) \
&& rm -f $(KERNELCONFIG).diff \
&& yes "" | $(PTXDIST) oldconfig kernel > /dev/null \
;fi
oldconfig:
@for p in boot root; do( \
cd $$p \
&& $(PTXDIST) oldconfig \
&& $(PTXDIST) oldconfig platform \
);done
include ptxdist/config
migrate:
@for p in boot root; do( \
echo "####################\n\n Migrating: $$p \n\n####################" \
&& cd $$p \
&& /usr/local/lib/ptxdist-$(PTXDIST_VERSION)/bin/$(PTXDIST) migrate \
);done
menuconfig:
@cd root \
&& $(PTXDIST) menuconfig
select-platform:
@for p in boot/base boot root/base; do( \
cd $$p \
&& ln -sf $(PLATFORMCONFIG) selected_platformconfig \
);done
keygen: \
keys/sb.key \
keys/projectroot/etc/gpg/update.pubkey \
keys/projectroot/etc/gpg/backup.pubkey \
keys/projectroot/etc/gpg/common.symkey \
keys/projectroot/etc/ssh/ssh_host_rsa_key \
keys/projectroot/root/.ssh/authorized_keys \
keys/projectroot/root/.ssh/id_rsa
keys/projectroot/etc/gpg/%.pubkey:
@mkdir -p keys/projectroot/etc/gpg \
&& gpg --homedir=keys --batch --passphrase='' --quick-generate-key $* default default never \
&& gpg --homedir=keys --output=keys/projectroot/etc/gpg/$*.pubkey --export $*
keys/projectroot/etc/gpg/common.symkey:
@mkdir -p keys/projectroot/etc/gpg \
&& gpg --homedir=keys --no-random-seed-file --armor --gen-random 2 64 > keys/common.symkey \
&& cp keys/common.symkey keys/projectroot/etc/gpg
keys/projectroot/etc/ssh/ssh_host_rsa_key:
@mkdir -p keys/projectroot/etc/ssh \
&& ssh-keygen -f keys/projectroot/etc/ssh/ssh_host_rsa_key -N ""
keys/projectroot/root/.ssh/authorized_keys:
@mkdir -p keys/projectroot/root/.ssh \
&& ssh-keygen -f keys/id_rsa -N "" \
&& cp keys/id_rsa.pub keys/projectroot/root/.ssh/authorized_keys
keys/projectroot/root/.ssh/id_rsa:
@mkdir -p keys/projectroot/root/.ssh \
&& ssh-keygen -f keys/projectroot/root/.ssh/id_rsa -N ""
keys/sb.key:
@openssl req -new -x509 -newkey rsa:2048 -sha256 -nodes -keyout keys/sb.key -out keys/sb.crt -days 365000 -subj "/CN=controlOS/"