Skip to content

Commit 8277edb

Browse files
committed
build: Add build and configuration framework
Makefile system for building and configuration. This contains kconfig from buildroot and checkpatch.pl from the Linux kernel. Signed-off-by: Simon Kuenzer <[email protected]> Signed-off-by: Florian Schmidt <[email protected]> Signed-off-by: Felipe Huici <[email protected]>
1 parent 60c57a3 commit 8277edb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+35699
-0
lines changed

.checkpatch.conf

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
--no-tree
2+
--ignore ASSIGN_IN_IF
3+
--ignore NEW_TYPEDEFS

.clang-format

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Style is similar to Linux Kernel
2+
# https://www.kernel.org/doc/Documentation/CodingStyle
3+
BasedOnStyle: LLVM
4+
IndentWidth: 8
5+
UseTab: Always
6+
BreakBeforeBraces: Linux
7+
BreakBeforeBinaryOperators: NonAssignment
8+
AllowShortFunctionsOnASingleLine: Empty
9+
AllowShortIfStatementsOnASingleLine: false
10+
IndentCaseLabels: false
11+
SortIncludes: false

Config.uk

+189
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
#
2+
# For a description of the syntax of this configuration file,
3+
# see https://www.kernel.org/doc/Documentation/kbuild/Config.in-language.txt.
4+
#
5+
mainmenu "Unikraft/$UK_FULLVERSION Configuration"
6+
config KCONFIG_APP_IN
7+
string
8+
option env="KCONFIG_APP_IN"
9+
config KCONFIG_ELIB_IN
10+
string
11+
option env="KCONFIG_ELIB_IN"
12+
config UK_FULLVERSION
13+
string
14+
option env="UK_FULLVERSION"
15+
config UK_CODENAME
16+
string
17+
option env="UK_CODENAME"
18+
config UK_ARCH
19+
string
20+
option env="UK_ARCH"
21+
config UK_BASE
22+
string
23+
option env="UK_BASE"
24+
config UK_APP
25+
string
26+
option env="UK_APP"
27+
config UK_DEFNAME
28+
string
29+
option env="UK_NAME"
30+
31+
menu "Architecture Selection"
32+
source "arch/Config.uk"
33+
endmenu
34+
35+
menu "Platform Support"
36+
source "plat/Config.uk"
37+
endmenu
38+
39+
menu "Library Configuration"
40+
source "lib/Config.uk"
41+
source "$KCONFIG_ELIB_IN"
42+
endmenu
43+
44+
menu "Build Options"
45+
choice
46+
prompt "Optimization level"
47+
default OPTIMIZE_PERF
48+
help
49+
Set the optimization level for gcc
50+
51+
config OPTIMIZE_NONE
52+
bool "No optimizations"
53+
help
54+
Do not optimize, use -O0.
55+
56+
config OPTIMIZE_PERF
57+
bool "Optimize for performance"
58+
help
59+
Optimize code for performance,
60+
61+
config OPTIMIZE_SIZE
62+
bool "Optimize for size"
63+
help
64+
Optimize code for size.
65+
endchoice
66+
67+
comment "Hint: Specify a CPU type to get most benefits from performance optimization"
68+
depends on OPTIMIZE_PERF && MARCH_GENERIC
69+
70+
config OPTIMIZE_DEADELIM
71+
bool "Drop unused functions and data"
72+
default n
73+
help
74+
Drop unused functions and data. They will not be copied
75+
into the final binary. This might save further space but linking time
76+
will increase.
77+
78+
comment "Hint: Enable dropping of unused code to further reduce target image size"
79+
depends on OPTIMIZE_SIZE && !OPTIMIZE_DEADELIM
80+
81+
config DEBUG_SYMBOLS
82+
bool "Debugging information"
83+
default n
84+
help
85+
Build with debugging information.
86+
87+
if DEBUG_SYMBOLS
88+
choice
89+
prompt "Debug information level"
90+
default DEBUG_SYMBOLS_LVL3
91+
help
92+
Set the level of available debugging information.
93+
94+
config DEBUG_SYMBOLS_LVL1
95+
bool "Level 1 (-g1)"
96+
help
97+
Minimal debugging information, enough
98+
for making backtraces in parts of the program that
99+
you don't plan to debug. This includes descriptions
100+
of functions and external variables, but no information
101+
about local variables and no line numbers.
102+
103+
config DEBUG_SYMBOLS_LVL2
104+
bool "Level 2 (-g2)"
105+
help
106+
gcc's default setting
107+
108+
config DEBUG_SYMBOLS_LVL3
109+
bool "Level 3 (-g3)"
110+
help
111+
Level 3 includes extra information, such as all the
112+
macro definitions present in the program. Some debuggers
113+
support macro expansion.
114+
endchoice
115+
116+
config OPTIMIZE_DBGFILE
117+
bool "Create a debugging information file"
118+
default y
119+
help
120+
Create a separate file with debugging information
121+
122+
config OPTIMIZE_SYMFILE
123+
bool "Create a symbols file"
124+
default n
125+
help
126+
Create a separate file with all symbol locations
127+
endif
128+
129+
config OPTIMIZE_STRIP
130+
bool "Strip final image"
131+
default y
132+
help
133+
Strip any extra information from image
134+
135+
config RECORD_BUILDTIME
136+
bool "Keep track of Building time"
137+
default n
138+
help
139+
Record time (and resources) used by each build step
140+
141+
if RECORD_BUILDTIME
142+
choice
143+
prompt "Tool for recording"
144+
default RECORD_BUILDTIME_TIME
145+
help
146+
Select which tool is used for recording the build steps
147+
148+
config RECORD_BUILDTIME_TIME
149+
bool "time"
150+
help
151+
Use time command to record process statistics during building
152+
153+
config RECORD_BUILDTIME_LIFTOFF
154+
bool "liftoff"
155+
help
156+
Use liftoff to record process statistics during building
157+
Get it from https://github.com/sysml/liftoff
158+
159+
endchoice
160+
endif
161+
162+
config CROSS_COMPILE
163+
string "Custom cross-compiler tool prefix (optional)"
164+
help
165+
Same as running 'make CROSS_COMPILE=prefix-' but stored for
166+
default make runs in this build directory. You don't
167+
need to set this unless you want the configured build
168+
directory to select the cross-compiler automatically.
169+
170+
#config PARALLEL_JOBS
171+
# int "Number of jobs to run simultaneously (0 for auto)"
172+
# default "0"
173+
# help
174+
# Number of jobs to run simultaneously. If 0, determine
175+
# automatically according to number of CPUs on the host
176+
# system.
177+
endmenu
178+
179+
if UK_APP != UK_BASE
180+
menu "Application Options"
181+
source "$KCONFIG_APP_IN"
182+
endmenu
183+
endif
184+
185+
config UK_NAME
186+
string "Image name"
187+
default $UK_DEFNAME
188+
help
189+
Name to be used for final image

0 commit comments

Comments
 (0)