-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathJustfile
More file actions
230 lines (184 loc) · 6.26 KB
/
Copy pathJustfile
File metadata and controls
230 lines (184 loc) · 6.26 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
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
_default:
@just --list
make-opts := '--time-summary --hide-uninteresting'
# make-opts := '--quiet'
# Update all dependencies
[group("maintenance")]
deps-up:
cargo update
# Build default hw kernel and run chainofcommand to boot this kernel onto the board
[group("hw")]
boot: chainofcommand
cargo make {{ make-opts }} chainboot # make boot-kernel ?
# Build and run kernel in QEMU with serial port emulation
[group("emu")]
zellij:
cargo make {{ make-opts }} --makefile $(pwd)/nucleus/Makefile.toml --cwd nucleus zellij-nucleus
zellij --layout emulation/layout.zellij
# Build and run chainboot in QEMU with serial port emulation
[group("emu")]
cb-zellij:
# Connect to it via chainofcommand to load an actual kernel
# TODO: actually run chainofcommand in a zellij session too
cargo make {{ make-opts }} --makefile $(pwd)/bin/chainboot/Makefile.toml --cwd bin/chainboot zellij
zellij --layout emulation/layout.zellij
# Run chainboot with GDB in zellij window
cb-zellij-gdb:
cargo make {{ make-opts }} --makefile $(pwd)/bin/chainboot/Makefile.toml --cwd bin/chainboot zellij-gdb
zellij --layout emulation/layout.zellij
# Build chainofcommand serial loader
[group("hw")]
chainofcommand:
cargo make {{ make-opts }} --makefile $(pwd)/bin/chainofcommand/Makefile.toml --cwd bin/chainofcommand build
alias coc := chainofcommand
# Build and run kernel in QEMU
[group("emu")]
qemu:
cargo make {{ make-opts }} --makefile $(pwd)/nucleus/Makefile.toml --cwd nucleus qemu
# Build and run kernel in QEMU with GDB port enabled
[group("emu")]
qemu-gdb:
cargo make {{ make-opts }} --makefile $(pwd)/nucleus/Makefile.toml --cwd nucleus qemu-gdb
# Build and run chainboot in QEMU
[group("emu")]
cb-qemu:
# Connect to it via chainofcommand to load an actual kernel
cargo make {{ make-opts }} --makefile $(pwd)/bin/chainboot/Makefile.toml --cwd bin/chainboot qemu
# Build and run chainboot in QEMU with GDB port enabled
[group("emu")]
cb-qemu-gdb:
# Connect to it via chainofcommand to load an actual kernel
cargo make {{ make-opts }} --makefile $(pwd)/bin/chainboot/Makefile.toml --cwd bin/chainboot qemu-gdb
# Build and write kernel to an SD Card
[group("hw")]
device:
cargo make {{ make-opts }} sdcard
# Build and write kernel to an SD Card, then eject the SD Card volume
[group("hw")]
device-eject:
cargo make {{ make-opts }} sdeject
# Build and write chainboot to an SD Card, then eject the SD Card volume
[group("hw")]
cb-eject:
cargo make {{ make-opts }} --makefile $(pwd)/bin/chainboot/Makefile.toml --cwd bin/chainboot sdeject
# Build default hw kernel
[group("hw")]
build:
cargo make {{ make-opts }} build
# Build default hw kernel (quietly)
[group("hw")]
qbuild:
cargo make {{ make-opts }} build
alias b := build
# Clean project
[group("maintenance")]
clean:
cargo make {{ make-opts }} clean
# Run clippy checks
[group("maintenance")]
clippy:
# TODO: use cargo-hack
cargo make {{ make-opts }} clippy
env CLIPPY_FEATURES=noserial cargo make {{ make-opts }} clippy
env CLIPPY_FEATURES=qemu cargo make {{ make-opts }} clippy
env CLIPPY_FEATURES=noserial,qemu cargo make {{ make-opts }} clippy
env CLIPPY_FEATURES=jtag cargo make {{ make-opts }} clippy
env CLIPPY_FEATURES=noserial,jtag cargo make {{ make-opts }} clippy
# Run shortened clippy checks
[group("maintenance")]
clippy-pre-push:
cargo make {{ make-opts }} clippy
# Run tests in QEMU
[group("emu")]
test:
cargo make {{ make-opts }} test
alias disasm := hopper
# Build and disassemble kernel
[group("debug")]
hopper:
cargo make {{ make-opts }} xtool-hopper
alias ocd := openocd
# Start openocd (by default connected via JTAG to a target device)
[group("hw")]
openocd:
cargo make {{ make-opts }} openocd
# Build and run kernel in GDB using openocd or QEMU as target (gdb port 5555)
[group("debug")]
gdb:
cargo make {{ make-opts }} --makefile $(pwd)/nucleus/Makefile.toml --cwd nucleus gdb
# Build and run chainboot in GDB using openocd or QEMU as target (gdb port 5555)
[group("debug")]
cb-gdb:
cargo make {{ make-opts }} --makefile $(pwd)/bin/chainboot/Makefile.toml --cwd bin/chainboot gdb
# Build and print all symbols in the kernel
[group("maintenance")]
nm:
cargo make {{ make-opts }} xtool-nm
# Run `cargo expand` on nucleus
[group("maintenance")]
expand:
cargo make {{ make-opts }} xtool-expand-target -- nucleus
#==============================================================================
# Modules dependency visualization
#==============================================================================
# Render modules dependency tree
[group("modules")]
modules:
cargo make {{ make-opts }} xtool-modules
# Render modules dependency tree with versions
[group("modules")]
tree:
cargo tree
[private]
gen-deps-graph MOD:
cargo modules dependencies --max-depth 5 --no-sysroot --no-externs -p {{ MOD }} > target/{{ MOD }}.dot \
&& dot -Tpng target/{{ MOD }}.dot -o target/{{ MOD }}.png
# Render modules' usage graph
[group("modules")]
[macos]
deps-graph MOD: (gen-deps-graph MOD)
open target/{{ MOD }}.png
# Render modules' usage graph
[group("modules")]
[windows]
deps-graph MOD: (gen-deps-graph MOD)
start target/{{ MOD }}.png
# Render modules' usage graph
[group("modules")]
[linux]
deps-graph MOD: (gen-deps-graph MOD)
xdg-open target/{{ MOD }}.png
# Render modules symbol visibility
[group("modules")]
exports MOD:
cargo modules structure -p {{ MOD }}
# Find orphan files in the module sources
[group("modules")]
orphans MOD:
cargo modules orphans -p {{ MOD }}
# Modules dependency visualization end
#==============================================================================
# Generate and open documentation
[group("maintenance")]
doc:
cargo make {{ make-opts }} docs-flow
# Check formatting
[group("maintenance")]
fmt-check:
cargo fmt -- --check
# Run lint tasks
[group("maintenance")]
lint: fmt-check clippy
# Run pre-push local checks
[group("ci")]
pre-push: fmt-check clippy-pre-push test
# Run CI tasks
[group("ci")]
ci: clean lint build test
# Prepare local dev tools and set-up git hooks
[group("maintenance")]
setup-local-dev:
commit-emoji --help || cargo install commit-emoji
commit-emoji -i
# Run local shortened clippy before pushing to remote
cp .hooks/pre-push .git/hooks/pre-push