-
Notifications
You must be signed in to change notification settings - Fork 0
/
usage_guide.tex
150 lines (125 loc) · 4.01 KB
/
usage_guide.tex
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
\documentclass{article}
\usepackage{hyperref}
\title{Usage Guide for ADAM}
\author{AOx0}
\date{\today}
\begin{document}
\maketitle
\section{Introduction}
This document provides detailed instructions on how to run the ADAM project. It includes sections on prerequisites, dependencies, and running the code.
\section{Prerequisites}
Before running the code, ensure you have the following prerequisites installed:
\subsection{Cranelift Codegen Backend}
\begin{verbatim}
rustup component add rustc-codegen-cranelift-preview --toolchain nightly
\end{verbatim}
\subsection{Dependencies}
\begin{enumerate}
\item Install \texttt{lld}: \texttt{paru -S lld} or \texttt{sudo apt-get install lld}
\item Install \texttt{bpf-linker}: \texttt{cargo install bpf-linker}
\item Install \texttt{zellij}: \texttt{cargo install zellij}
\item Install \texttt{cargo-watch}: \texttt{cargo install cargo-watch}
\item Install \texttt{just}: \texttt{cargo install just}
\item Install \texttt{hurl}: \texttt{cargo install hurl}
\end{enumerate}
You may install all packages via your package manager, for example, for Arch Linux:
\begin{verbatim}
paru -S just hurl zellij cargo-watch lld
cargo install bpf-linker
\end{verbatim}
\section{Running the Code}
All recipe definitions are available in the \texttt{justfile}.
\subsection{Running Everything}
To run all components, execute:
\begin{verbatim}
just run
\end{verbatim}
You may also specify the firewall wifi interface you want to attach to:
\begin{verbatim}
just run wlan0
\end{verbatim}
\subsection{Running Backend}
To run up to the \texttt{controller}, perform:
\begin{verbatim}
just run-simple
\end{verbatim}
\subsection{Running Frontend}
To run the frontend, perform:
\begin{verbatim}
just run-front-watch
\end{verbatim}
\section{Firewall Component}
The firewall component has additional instructions for building and running.
\subsection{Prerequisites}
Install \texttt{bpf-linker}:
\begin{verbatim}
cargo install bpf-linker
\end{verbatim}
\subsection{Build eBPF}
\begin{verbatim}
cargo xtask build-ebpf <NAME>
\end{verbatim}
To perform a release build, use the \texttt{--release} flag. You may also change the target architecture with the \texttt{--target} flag.
\subsection{Build Userspace}
\begin{verbatim}
cargo build
\end{verbatim}
\subsection{Build eBPF and Userspace}
\begin{verbatim}
cargo xtask build <NAME>
\end{verbatim}
\subsection{Run}
\begin{verbatim}
RUST_LOG=info cargo xtask run <NAME>
\end{verbatim}
\section{Building the Project}
To build the entire project, use the following command:
\begin{verbatim}
cargo build
\end{verbatim}
\section{Testing the Project}
To run tests for the project, use the following command:
\begin{verbatim}
cargo test
\end{verbatim}
\section{Detailed Explanations and Examples}
\subsection{Example 1: Running the Firewall Component}
Here is a step-by-step example of running the firewall component:
\begin{enumerate}
\item Install the prerequisites as mentioned in the prerequisites section.
\item Build the eBPF component:
\begin{verbatim}
cargo xtask build-ebpf firewall
\end{verbatim}
\item Build the userspace component:
\begin{verbatim}
cargo build
\end{verbatim}
\item Run the firewall component:
\begin{verbatim}
RUST_LOG=info cargo xtask run firewall
\end{verbatim}
\end{enumerate}
\subsection{Example 2: Running the Entire Project}
Here is a step-by-step example of running the entire project:
\begin{enumerate}
\item Install the prerequisites as mentioned in the prerequisites section.
\item Run all components:
\begin{verbatim}
just run
\end{verbatim}
\item Specify the firewall wifi interface if needed:
\begin{verbatim}
just run wlan0
\end{verbatim}
\end{enumerate}
\subsection{Example 3: Running the Frontend}
Here is a step-by-step example of running the frontend:
\begin{enumerate}
\item Install the prerequisites as mentioned in the prerequisites section.
\item Run the frontend:
\begin{verbatim}
just run-front-watch
\end{verbatim}
\end{enumerate}
\end{document}