Repository navigation
Expand file tree
/
Copy pathgConfig
More file actions
324 lines (267 loc) · 12.2 KB
/
Copy pathgConfig
File metadata and controls
324 lines (267 loc) · 12.2 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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
# Grinch build configuration.
# Types: const (structural grouping only), bool, int, string.
# Symbols with 'default' are user-tunable and live in config.mk.
# Symbols with 'value' are computed from an expression; config.h only.
const CONFIG_ARCH_GROUP "Architecture" {
string ARCH "Target architecture" {
default "riscv64"
choices "riscv64" "riscv32" "arm64"
header CONFIG_ARCH
help "Instruction set architecture to build for. Selects the toolchain prefix and arch-specific sources."
}
string PLATFORM "Target platform/board" {
default "virt" if CONFIG_ARCH_ARM64
default "any"
help "Target platform or board name. Selects platform-specific memory map and peripheral configuration."
}
# Computed arch booleans; header only (not in config.mk).
bool CONFIG_ARCH_RISCV64 { value ARCH == "riscv64" header }
bool CONFIG_ARCH_RISCV32 { value ARCH == "riscv32" header }
bool CONFIG_ARCH_RISCV { value CONFIG_ARCH_RISCV64 || CONFIG_ARCH_RISCV32 header }
bool CONFIG_ARCH_ARM64 { value ARCH == "arm64" header }
string RISCV_MODE "RISC-V privilege level" {
default "s"
choices "s" ("m" if !CONFIG_MMU)
depends CONFIG_ARCH_RISCV
help "Privilege level the kernel runs in. 's' boots in supervisor mode on top of firmware providing SBI, such as OpenSBI. 'm' boots in machine mode on the bare hart, driving timer, IPI and reset hardware itself. Machine mode cannot translate its own accesses, so it requires address translation to be off."
}
bool CONFIG_RISCV_S_MODE { value RISCV_MODE == "s" header }
bool CONFIG_RISCV_M_MODE { value RISCV_MODE == "m" header }
# 4K pages on every architecture we have.
int CONFIG_PAGE_SHIFT { value 12 header base dec }
int PAGE_SIZE { value 1 << CONFIG_PAGE_SHIFT }
}
const CONFIG_COMPILER "Compiler" {
string CROSS_COMPILE "Cross-compiler prefix" {
default "riscv64-unknown-linux-gnu-" if CONFIG_ARCH_RISCV64
default "riscv32-unknown-linux-gnu-" if CONFIG_ARCH_RISCV32
default "aarch64-none-elf-" if CONFIG_ARCH_ARM64
help "Prefix for the cross-compiler toolchain (e.g. riscv64-unknown-linux-gnu-)."
}
string OPT "Optimisation level" {
default "none"
choices "none" "speed" "size" "release"
help "Optimisation level: none (-O0), speed (-O2), size (-Os), release (-O3)."
}
}
const CONFIG_FEATURES "Features" {
bool CONFIG_MMU "Address translation" {
default y
header
help "Run the kernel on virtual addresses and give every process its own address space. Turning this off makes the kernel run where it is loaded."
}
bool CONFIG_USER_FIXED "Link userland at a fixed address" {
default n
depends CONFIG_MMU
header
help "Link programs to run at one address, so that loading them is a plain copy. Two processes cannot occupy the same address without translation, so this is unavailable there and programs are built to be placed anywhere instead."
}
bool CONFIG_USER_PIE { value !CONFIG_USER_FIXED header }
int CONFIG_USER_HEAP_SIZE "Heap given to each process" {
default 0x10000
depends !CONFIG_MMU
align PAGE_SIZE
header
help "Memory set aside for a process to allocate from. Without translation a heap cannot grow into the space above it, as something else is likely already there, so it is given its final size when the program is loaded."
}
int CONFIG_USER_STACK_SIZE "Stack given to each process" {
default 0x100000 if CONFIG_MMU
default 0x8000
align PAGE_SIZE
header
help "Memory set aside for a process's stack. With address translation the pages arrive on first use and this is only an upper bound. Without it the stack is given its final size when the program is loaded, and there is no guard page: overflowing it silently corrupts neighbouring memory."
}
int CONFIG_KERNEL_STACK_PAGES "Kernel stack pages per task" {
default 2
base dec
header
help "Pages for the kernel stack each task blocks and takes its traps on. There is no guard page: an overflow silently corrupts neighbouring memory, caught only by the signature check at the stack base."
}
int CONFIG_EARLY_POOL_PAGES "Early memory pool pages" {
default 32
base dec
header
help "Pages the kernel sets aside for allocations made before the memory of the machine is known."
}
int CONFIG_GRINCH_BASE "Kernel base address" {
default 0x80000000 if CONFIG_RISCV_M_MODE
default 0x80200000
depends !CONFIG_MMU
header
help "Address the kernel is linked at. It runs where it is loaded, so this must match the platform: the start of RAM in machine mode, and wherever the firmware places the kernel in supervisor mode. With address translation the kernel picks its own address and this is not asked."
}
string BUILTIN_DTB "Built-in device tree blob" {
default ""
header CONFIG_BUILTIN_DTB
help "Path to a device tree blob compiled into the kernel image, relative to the source tree. A tree built in outranks one handed over by the firmware. Leave empty for none."
}
bool CONFIG_OPENSBI "SBI firmware interface" {
default y
depends CONFIG_RISCV_S_MODE
header
help "Let the firmware below handle timer, IPI, remote fence and reset."
}
bool CONFIG_VMM "Virtual Machine Monitor" {
default y
depends CONFIG_RISCV_S_MODE && CONFIG_MMU
header
help "Include the virtual machine monitor (hypervisor) component."
}
# Architectures providing a hypercall transport. RISC-V rides on SBI,
# arm64 has none yet, and no hypervisor to be a guest of either.
bool CONFIG_HAVE_HYPERCALL { value CONFIG_OPENSBI header }
bool CONFIG_GRINCH_GUEST "Support for running as guest of the grinch hypervisor" {
default y
depends CONFIG_HAVE_HYPERCALL
header
help "Include the hypercall interface used when running as a guest of the grinch hypervisor."
}
bool CONFIG_DEBUG_OUTPUT "Verbose kernel log output" {
default n
header
help "Enable verbose debug messages in the kernel log."
}
const CONFIG_EARLYCON "Early console" {
string EARLYCON "Early console driver" {
default "sbi" if CONFIG_OPENSBI
default "none"
choices "none" ("sbi" if CONFIG_OPENSBI) "semihost" ("mmio" if !CONFIG_MMU)
help "Select the driver used for early console output before the serial subsystem initialises. 'sbi' uses the RISC-V SBI console extension; 'semihost' uses the processor semihosting interface; 'mmio' stores each character to a bare device register."
}
bool CONFIG_EARLYCON_SEMIHOST { value EARLYCON == "semihost" header }
bool CONFIG_EARLYCON_SBI { value EARLYCON == "sbi" header }
bool CONFIG_EARLYCON_MMIO { value EARLYCON == "mmio" header }
int CONFIG_EARLYCON_MMIO_BASE "Early console register address" {
default 0x0
depends CONFIG_EARLYCON_MMIO
header
help "Physical address of a register that transmits a character stored to it, written as a 32 bit store. The kernel must run on physical addresses."
}
}
}
const CONFIG_BUILD "Build options" {
bool CONFIG_DEBUG "GDB debug info (Kernel + Userspace)" {
default y
header
help "Compile kernel and user code with -g -ggdb for source-level debugging."
}
bool CONFIG_TOOLS_DEBUG "GDB debug info (Tools)" {
default n
help "Compile host-side tools (gcov_extract etc.) with -ggdb for source-level debugging."
}
bool CONFIG_GCOV "Coverage instrumentation" {
default n
header
help "Instrument the kernel with GCC gcov profiling support. Requires the gcov_extract host tool to retrieve counters."
}
bool CONFIG_INITCONST_STR "Move const strings into .init section" {
default n
header
help "Place constant format strings in .init to reclaim memory after boot. Disables -Wformat-security."
}
bool CONFIG_RISCV_COMPRESSED "Compressed instructions" {
default y
depends CONFIG_ARCH_RISCV
header
help "Enable the RISC-V C (compressed) extension, reducing code size by ~25%."
}
}
const CONFIG_DRIVERS "Device Drivers" {
bool CONFIG_PCI "PCI bus support" {
default y
header
help "Enable support for the PCI/PCIe bus. Required for any PCI device driver."
}
bool CONFIG_FB "Framebuffer support" {
default y
header
help "Enable the framebuffer subsystem."
bool BOCHS "Bochs/QEMU GPU" {
default y
depends CONFIG_FB && CONFIG_PCI
help "Driver for the Bochs dispi VGA adapter, used as the GPU in QEMU."
}
}
bool CONFIG_SIM_FINISH "LiteX simulation finish" {
default n
depends CONFIG_ARCH_RISCV
help "Shutdown method for simulated LiteX SoCs: a register write ends the simulator process."
}
bool CONFIG_UART "UART Drivers" {
default y
help "Enable serial console support. At least one UART driver must also be selected."
bool 8250 "8250/16550 UART" {
default y
depends CONFIG_UART
help "Driver for the classic 8250/16550 UART, present on QEMU virt and most PC-derived platforms."
}
bool APBUART "GRLIB APBUART" {
default n
depends CONFIG_UART && CONFIG_ARCH_RISCV
help "Driver for the GRLIB APBUART found in LEON-based FPGA SoCs."
}
bool LITEUART "LiteUART (LiteX)" {
default n
depends CONFIG_UART && CONFIG_ARCH_RISCV
help "Driver for the LiteUART core from the LiteX SoC framework."
}
bool UARTLITE "AXI UART Lite" {
default y if CONFIG_ARCH_RISCV
default n
depends CONFIG_UART && CONFIG_ARCH_RISCV
help "Driver for the Xilinx AXI UART Lite, common on Xilinx/AMD FPGA designs."
}
bool PL011 "PL011 UART" {
default y if CONFIG_ARCH_ARM64
default n
depends CONFIG_UART && CONFIG_ARCH_ARM64
help "Driver for the ARM PrimeCell PL011 UART, used on ARM platforms and QEMU virt."
}
}
bool CONFIG_SBI_TTY "SBI TTY device" {
default y
depends CONFIG_OPENSBI
header
help "Character device providing console I/O via the RISC-V SBI console interface."
}
const CONFIG_IRQ_DRIVERS "Interrupt controllers" {
bool CONFIG_IRQ_XPLIC "RISC-V XPLIC" {
default y
depends CONFIG_ARCH_RISCV
help "Shared detection and initialisation layer for RISC-V interrupt controllers."
}
bool CONFIG_IRQ_APLIC "RISC-V APLIC" {
default y
depends CONFIG_IRQ_XPLIC
help "Support for the RISC-V Advanced Platform-Level Interrupt Controller (APLIC), defined in the RISC-V AIA specification."
}
bool CONFIG_IRQ_PLIC "RISC-V PLIC" {
default y
depends CONFIG_IRQ_XPLIC
help "Support for the RISC-V Platform-Level Interrupt Controller (PLIC), the standard external interrupt controller for RISC-V systems."
}
bool CONFIG_IRQ_GIC_V2 "ARM GICv2" {
default y
depends CONFIG_ARCH_ARM64
help "Driver for the ARM Generic Interrupt Controller version 2 (GICv2)."
}
}
}
const CONFIG_QEMU "QEMU runtime" {
int QEMU_CPUS "Number of guest CPUs" {
default 2
help "Number of virtual CPUs to pass to QEMU via -smp."
}
string QEMU_APPEND "Extra kernel command line" {
default ""
help "Additional arguments appended to the kernel command line when running under QEMU."
}
string QEMU_DISPLAY "QEMU display backend" {
default "none"
help "QEMU display backend (none, sdl, gtk, ...)."
}
string QEMU_SERIAL "QEMU serial backend" {
default "stdio"
help "QEMU serial backend (stdio, telnet::4321, ...)."
}
}