Configuration
As discussed in the previous section, there are a number of files that specify the configuration for the
NetBSD kernel. Some of the files are specific to the processor, and
shared by any machine which uses that processor, while others are
specific to the machine (development board).
Directories
The files (configuration, source and header) associated with an ARM SoC
or platform port are placed in subdirectories created for that SoC or
platform. The SoC-specific directory is created in the sys/arch/arm
directory; it's sys/arch/arm/vx115 in this case. The
platform-specific directory is created in the sys/arch/evbarm
directory; here, it's sys/arch/evbarm/vx115_vep.
Processor Configuration Files
These are files that are specific to the SoC, and present regardless of
the board it is used on. These files are placed within the
sys/arch/arm/<processor-name> subdirectory
(sys/arch/arm/vx115 in this case).
This specification file contains fundamental device specifications,
attachment indications and source-file inclusions for peripherals
associated with the processor, i.e., used by any platform based on the
processor. This includes things like
- basic irq and bus operations
- system buses (we have an AHB and APB in this case)
- system timer (clock) used for the fundamental system time
reference
- interrupt controller
- console serial interface (UART)
This file is used by the NetBSD autoconfiguration system, to include
appropriate source files for compilation and to create appropriate
structures reflecting the organization of the system (which peripherals
are attached to which bus, what parameters the buses pass to their
children, etc.) This file is included by the board-specific
configuration file (in this case, files.vx115_vep, described below).
As can bee seen in files.vx115, each bus or device has 3 basic parts to
its specification
- device <device-name>
- Provides a name for the device, for use in further
references in the code and configuration files.
- For buses, this also supplies a list of the parameters
that it will supply to its children when they are initialized by the
bus, as well as default values for the parameters if specific values
are not specified for the child in the machine-specific configuration file
(here VX115_VEP, discussed below)
- attach <device-name> at
<bus-name>
- Indicates the device is to be a child of a particular
bus; this is used during autoconfiguration, when each bus probes for
and initializes its children
- file <source-file-path>
- Indicates the specified file should be included in the
compilation
The vx115.files configuration file has just the basic set of
configuration options (buses, interrupts, timers and serial interface)
needed to initially bring up the system. Additional lines would be
added as support is added for each of the additional on-chip system
peripherals.
Note that the system AHB and APB buses are attached to something called
"mainbus". This is the root bus in NetBSD. The CPU itself (the ARM926
core) is attached to this as part of the standard ARM system
configuration (specified in the file sys/arch/arm/conf/files.arm).
Board Configuration Files
These files provide configuration for features that are board-specific.
Note that this includes things like startup code (since this depends on
the specific memory selects used on a board), as well as the
exact specification of kernel features to be supported.
These files are placed in the directory sys/arch/evbarm/conf.
This specifies board-specific files to be included in the build,
including:
- CPU and integrated peripheral support, by including
"arch/arm/vx115/files.vx115"
- board machdep file, which contains some of the principal
startup code for the board (see the section on initial startup for description of startup sequence)
- softinterrupt support (just the generic ARM support is used
here)
Again, the particular file files.vx115_vep specifies the bare
minimum to get the system going.
This file is used in building the system Makefile, and adds defines and
extra specifications to the build. For us, it specifies the following.
- Indicate first file in image (start code)
SYSTEM_FIRST_OBJ=
vx115_vep_start.o
SYSTEM_FIRST_SFILE=
${THISARM}/vx115_vep/vx115_vep_start.S
- Indicate any final steps to perform on image
after main image made
SYSTEM_LD_TAIL_EXTRA+=; \
echo ${OBJCOPY} -S -O binary $@ $@.bin; \
${OBJCOPY} -S -O binary $@ $@.bin; \
echo gzip \< $@.bin \> $@.bin.gz; \
gzip < $@.bin > $@.bin.gz
- Specify make target additions to make above further kernel
images
EXTRA_KERNELS+=
${KERNELS:@.KERNEL.@${.KERNEL.}.bin@}
EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.bin.gz@}
This specifies general build options for board.
- Specify the machine and processor architecture
machine evbarm arm
- Specify the value to be used for HZ, the system clock tick rate
(default is HZ=100; we use 64 to get a better divisor for our 32kHz
clock)
options HZ=64
- Specify kernel virtual and physical load locations, used in arch/evbarm/conf/Makefile.evbarm.inc
makeoptions KERNEL_BASE_PHYS=0x24300000
makeoptions KERNEL_BASE_VIRT=0xc0200000
- Define board type and include makefile additons
makeoptions BOARDTYPE="vx115_vep"
makeoptions BOARDMKFRAG="${THISARM}/conf/mk.vx115_vep"
- Specify interrupt implementation
options ARM_INTR_IMPL="<arch/arm/vx115/vx115_intr.h>"
This is the main config file, passed as argument to nbconfig.
It's similar to the Linux .config file.
- Include std.vx115_vep (which includes
files.vx115_vep and specifies mk.vx115_vep)
- All other main kernel options
- Specifies instances of devices and buses defined in VX115_VEP,
and locator parameter values to be passed to devices during
autoconfiguration. The syntax of this device instance specification is described in the autoconfiguration section, and in detail in the NetBSD config(5) man page.
# The main bus device
mainbus0 at root
# The boot cpu
cpu0 at mainbus?
# Vx115 AHB and APB
vx115_ahb0 at mainbus?
vx115_apb0 at mainbus?
# On-chip interrupt controller
vx115_pic0 at vx115_apb? addr 0x700C1000 size 0x14c
# On-chip timer
vx115_clk0 at vx115_apb? addr 0x700C5000 size 0x68 intr 9
# On-chip serial UART
vx115_com0 at vx115_apb? addr 0x700E2000 size 0x7c intr 19
Comments/questions: jsevy@cs.drexel.edu