Training courses

Kernel and Embedded Linux

Bootlin training courses

Embedded Linux, kernel,
Yocto Project, Buildroot, real-time,
graphics, boot time, debugging...

Bootlin logo

Elixir Cross Referencer

# SPDX-License-Identifier: GPL-2.0-only
#
# For a description of the syntax of this configuration file,
# see Documentation/kbuild/kconfig-language.rst.
#

config CONFIG_64BIT
	bool

config CONFIG_32BIT
	bool

config CONFIG_RISCV
	def_bool y
	# even on 32-bit, physical (and DMA) addresses are > 32-bits
	select CONFIG_PHYS_ADDR_T_64BIT
	select CONFIG_OF
	select CONFIG_OF_EARLY_FLATTREE
	select CONFIG_OF_IRQ
	select CONFIG_ARCH_HAS_BINFMT_FLAT
	select CONFIG_ARCH_WANT_FRAME_POINTERS
	select CONFIG_CLONE_BACKWARDS
	select CONFIG_COMMON_CLK
	select CONFIG_GENERIC_CLOCKEVENTS
	select CONFIG_GENERIC_CPU_DEVICES
	select CONFIG_GENERIC_IRQ_SHOW
	select CONFIG_GENERIC_PCI_IOMAP
	select CONFIG_GENERIC_SCHED_CLOCK
	select CONFIG_GENERIC_STRNCPY_FROM_USER
	select CONFIG_GENERIC_STRNLEN_USER
	select CONFIG_GENERIC_SMP_IDLE_THREAD
	select CONFIG_GENERIC_ATOMIC64 if !CONFIG_64BIT
	select CONFIG_HAVE_ARCH_AUDITSYSCALL
	select CONFIG_HAVE_ASM_MODVERSIONS
	select CONFIG_HAVE_MEMBLOCK_NODE_MAP
	select CONFIG_HAVE_DMA_CONTIGUOUS
	select CONFIG_HAVE_FUTEX_CMPXCHG if CONFIG_FUTEX
	select CONFIG_HAVE_PERF_EVENTS
	select CONFIG_HAVE_PERF_REGS
	select CONFIG_HAVE_PERF_USER_STACK_DUMP
	select CONFIG_HAVE_SYSCALL_TRACEPOINTS
	select CONFIG_IRQ_DOMAIN
	select CONFIG_SPARSE_IRQ
	select CONFIG_SYSCTL_EXCEPTION_TRACE
	select CONFIG_HAVE_ARCH_TRACEHOOK
	select CONFIG_HAVE_PCI
	select CONFIG_MODULES_USE_ELF_RELA if CONFIG_MODULES
	select CONFIG_MODULE_SECTIONS if CONFIG_MODULES
	select CONFIG_THREAD_INFO_IN_TASK
	select CONFIG_PCI_DOMAINS_GENERIC if CONFIG_PCI
	select CONFIG_PCI_MSI if CONFIG_PCI
	select CONFIG_RISCV_TIMER
	select CONFIG_GENERIC_IRQ_MULTI_HANDLER
	select CONFIG_GENERIC_ARCH_TOPOLOGY if CONFIG_SMP
	select CONFIG_ARCH_HAS_PTE_SPECIAL
	select CONFIG_ARCH_HAS_MMIOWB
	select CONFIG_HAVE_EBPF_JIT if CONFIG_64BIT
	select CONFIG_EDAC_SUPPORT
	select CONFIG_ARCH_HAS_GIGANTIC_PAGE
	select CONFIG_ARCH_WANT_HUGE_PMD_SHARE if CONFIG_64BIT
	select CONFIG_SPARSEMEM_STATIC if CONFIG_32BIT
	select CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if CONFIG_MMU
	select CONFIG_HAVE_ARCH_MMAP_RND_BITS

config CONFIG_ARCH_MMAP_RND_BITS_MIN
	default 18 if CONFIG_64BIT
	default 8

# max bits determined by the following formula:
#  CONFIG_VA_BITS - PAGE_SHIFT - 3
config CONFIG_ARCH_MMAP_RND_BITS_MAX
	default 24 if CONFIG_64BIT # SV39 based
	default 17

config CONFIG_MMU
	def_bool y

config CONFIG_ZONE_DMA32
	bool
	default y if CONFIG_64BIT

config CONFIG_VA_BITS
	int
	default 32 if CONFIG_32BIT
	default 39 if CONFIG_64BIT

config CONFIG_PA_BITS
	int
	default 34 if CONFIG_32BIT
	default 56 if CONFIG_64BIT

config CONFIG_PAGE_OFFSET
	hex
	default 0xC0000000 if CONFIG_32BIT && CONFIG_MAXPHYSMEM_2GB
	default 0xffffffff80000000 if CONFIG_64BIT && CONFIG_MAXPHYSMEM_2GB
	default 0xffffffe000000000 if CONFIG_64BIT && CONFIG_MAXPHYSMEM_128GB

config CONFIG_ARCH_FLATMEM_ENABLE
	def_bool y

config CONFIG_ARCH_SPARSEMEM_ENABLE
	def_bool y
	select CONFIG_SPARSEMEM_VMEMMAP_ENABLE

config CONFIG_ARCH_SELECT_MEMORY_MODEL
	def_bool CONFIG_ARCH_SPARSEMEM_ENABLE

config CONFIG_ARCH_WANT_GENERAL_HUGETLB
	def_bool y

config CONFIG_SYS_SUPPORTS_HUGETLBFS
	def_bool y

config CONFIG_STACKTRACE_SUPPORT
	def_bool y

config CONFIG_TRACE_IRQFLAGS_SUPPORT
	def_bool y

config CONFIG_GENERIC_BUG
	def_bool y
	depends on CONFIG_BUG
	select CONFIG_GENERIC_BUG_RELATIVE_POINTERS if CONFIG_64BIT

config CONFIG_GENERIC_BUG_RELATIVE_POINTERS
	bool

config CONFIG_GENERIC_CALIBRATE_DELAY
	def_bool y

config CONFIG_GENERIC_CSUM
	def_bool y

config CONFIG_GENERIC_HWEIGHT
	def_bool y

config CONFIG_FIX_EARLYCON_MEM
	def_bool y

config CONFIG_PGTABLE_LEVELS
	int
	default 3 if CONFIG_64BIT
	default 2

source "arch/riscv/Kconfig.socs"

menu "Platform type"

choice
	prompt "Base ISA"
	default CONFIG_ARCH_RV64I
	help
	  This selects the base CONFIG_ISA that this kernel will target and must match
	  the target platform.

config CONFIG_ARCH_RV32I
	bool "RV32I"
	select CONFIG_32BIT
	select CONFIG_GENERIC_LIB_ASHLDI3
	select CONFIG_GENERIC_LIB_ASHRDI3
	select CONFIG_GENERIC_LIB_LSHRDI3
	select CONFIG_GENERIC_LIB_UCMPDI2

config CONFIG_ARCH_RV64I
	bool "RV64I"
	select CONFIG_64BIT
	select CONFIG_ARCH_SUPPORTS_INT128 if CONFIG_GCC_VERSION >= 50000
	select CONFIG_HAVE_FUNCTION_TRACER
	select CONFIG_HAVE_FUNCTION_GRAPH_TRACER
	select CONFIG_HAVE_FTRACE_MCOUNT_RECORD
	select CONFIG_HAVE_DYNAMIC_FTRACE
	select CONFIG_HAVE_DYNAMIC_FTRACE_WITH_REGS
	select CONFIG_SWIOTLB

endchoice

# We must be able to map all physical memory into the kernel, but the compiler
# is still a bit more efficient when generating code if it's setup in a manner
# such that it can only map 2GiB of memory.
choice
	prompt "Kernel Code Model"
	default CONFIG_CMODEL_MEDLOW if CONFIG_32BIT
	default CONFIG_CMODEL_MEDANY if CONFIG_64BIT

	config CONFIG_CMODEL_MEDLOW
		bool "medium low code model"
	config CONFIG_CMODEL_MEDANY
		bool "medium any code model"
endchoice

config CONFIG_MODULE_SECTIONS
	bool
	select CONFIG_HAVE_MOD_ARCH_SPECIFIC

choice
	prompt "Maximum Physical Memory"
	default CONFIG_MAXPHYSMEM_2GB if CONFIG_32BIT
	default CONFIG_MAXPHYSMEM_2GB if CONFIG_64BIT && CONFIG_CMODEL_MEDLOW
	default CONFIG_MAXPHYSMEM_128GB if CONFIG_64BIT && CONFIG_CMODEL_MEDANY

	config CONFIG_MAXPHYSMEM_2GB
		bool "2GiB"
	config CONFIG_MAXPHYSMEM_128GB
		depends on CONFIG_64BIT && CONFIG_CMODEL_MEDANY
		bool "128GiB"
endchoice


config CONFIG_SMP
	bool "Symmetric Multi-Processing"
	help
	  This enables support for systems with more than one CPU.  If
	  you say N here, the kernel will run on single and
	  multiprocessor machines, but will use only one CPU of a
	  multiprocessor machine. If you say Y here, the kernel will run
	  on many, but not all, single processor machines. On a single
	  processor machine, the kernel will run faster if you say N
	  here.

	  If you don't know what to do here, say N.

config CONFIG_NR_CPUS
	int "Maximum number of CPUs (2-32)"
	range 2 32
	depends on CONFIG_SMP
	default "8"

choice
	prompt "CPU Tuning"
	default CONFIG_TUNE_GENERIC

config CONFIG_TUNE_GENERIC
	bool "generic"

endchoice

config CONFIG_RISCV_ISA_C
	bool "Emit compressed instructions when building Linux"
	default y
	help
	   Adds "C" to the CONFIG_ISA subsets that the toolchain is allowed to emit
	   when building Linux, which results in compressed instructions in the
	   Linux binary.

	   If you don't know what to do here, say Y.

menu "supported PMU type"
	depends on CONFIG_PERF_EVENTS

config CONFIG_RISCV_BASE_PMU
	bool "Base Performance Monitoring Unit"
	def_bool y
	help
	  CONFIG_A base PMU that serves as a reference implementation and has limited
	  feature of perf.  It can run on any RISC-V machines so serves as the
	  fallback, but this option can also be disable to reduce kernel size.

endmenu

config CONFIG_FPU
	bool "FPU support"
	default y
	help
	  Say N here if you want to disable all floating-point related procedure
	  in the kernel.

	  If you don't know what to do here, say Y.

endmenu

menu "Kernel features"

source "kernel/Kconfig.hz"

endmenu

menu "Boot options"

config CONFIG_CMDLINE
	string "Built-in kernel command line"
	help
	  For most platforms, the arguments for the kernel's command line
	  are provided at run-time, during boot. However, there are cases
	  where either no arguments are being provided or the provided
	  arguments are insufficient or even invalid.

	  When that occurs, it is possible to define a built-in command
	  line here and choose how the kernel should use it later on.

choice
	prompt "Built-in command line usage" if CONFIG_CMDLINE != ""
	default CONFIG_CMDLINE_FALLBACK
	help
	  Choose how the kernel will handle the provided built-in command
	  line.

config CONFIG_CMDLINE_FALLBACK
	bool "Use bootloader kernel arguments if available"
	help
	  Use the built-in command line as fallback in case we get nothing
	  during boot. This is the default behaviour.

config CONFIG_CMDLINE_EXTEND
	bool "Extend bootloader kernel arguments"
	help
	  The command-line arguments provided during boot will be
	  appended to the built-in command line. This is useful in
	  cases where the provided arguments are insufficient and
	  you don't want to or cannot modify them.


config CONFIG_CMDLINE_FORCE
	bool "Always use the default kernel command string"
	help
	  Always use the built-in command line, even if we get one during
	  boot. This is useful in case you need to override the provided
	  command line on systems where you don't have or want control
	  over it.

endchoice

endmenu

menu "Power management options"

source "kernel/power/Kconfig"

endmenu