This sections exposes how to configure LSE/OS. Basically there are two important files used for creating the LSE/OS image in the 'conf' directory:
- modules.list: specifies the modules to be embedded on the image
- init.conf: specififes the modules to be automatically launched at startup
There is a friendly tool for configuring these files for common use cases that is called generate_conf.sh, it requires to edit a file called 'config' located in the 'in' subdirectory.
This file contains the drivers to be loaded by kernel (see bootstrap).
The parser recognizes quotes " to enclose whitespaces or even a special way of quoting with less_than and greater_than signs <> (for quoting macros output).
Sharp sign '#' is used for comments.
Basically the file is the list of programs to launch and a set of variable definitions.
The parser recognizes some configuration variables. It is possible to set them at any time in the file:
name description possible values default values ---- ----------- --------------- -------------- verbose be verbose on|off off trace ltrace(2) programs on|off off fs_gate fs or vfs gate a gate number GATE_RAMFS execve_bootfs find progs on bootfs on|off on execve_show_errmsg on|off off emulate_vfs fs_gate is not a vfs on|off on rt_malloc real time malloc on|off on share_binaries on|off on execve_nbstkpgs a number 16
Programs to be launched are specified in the following way:
cpu# pl stkpgs sched file args Example: -1 0 1 no [internal] npx -1 3 1 no /modules/sec sec -1 3 1 no /modules/pic pic -1 3 1 no /modules/notify notify -1 3 1 no /modules/timer timer
The first parameter 'cpu#' specifies the cpu where the task must start, -1 means any cpu.
The second parameter 'pl' specifies the ring where the task starts. Ring 0 means processor 'supervisor mode', ring 3 is the lowest 'user mode'. In most cases there are no reason choosing a ring other than 3. Note also that 'usermode' 'superuser' (uid 0) programs could create threads of ring 1 or 2 for interrupt handlers, so there are no *good* reason to launch a driver whith a ring of 2.
The third parameter 'stkpgs' is the number of stack pages to use for task, '1' is good for a driver. Other programs could wrap SIGSEGV to enlarge dynamically their stacks.
The 4th parameter 'sched' specifies if kernel has to wait the exit of the program before passing hand to the next task. If you specify 'yes', the kernel won't wait. If you specify 'no', the system will wait for the program to yield(0) before continuing. Please note it doesn't mean that the task could not be interrupted by interrupts (see also drivers).
The 5th parameter 'file' is the bootfs path of the program file. '[internal]' means that is a kernel internal and optional service.
The last parameters, from 6 to (MAXARGV-6) correspond to arguments passed to program starting from arg0.
It is a simple list of files to be copied in boot file system. Sharp sign '#' is used for comments.
This files is a list of macros that define which modules have to be copied and/or launched launched at bootstrap. Example:
#define USE_BOCHS #define NEED_PIC #define LAUNCH_PIC #define NEED_TIMER #define LAUNCH_TIMER #define NEED_TTY #define LAUNCH_TTY #define NEED_PIPE #define LAUNCH_PIPE #define NEED_RAMFS #define LAUNCH_RAMFS #define MOUNT_RAMFS #define NEED_NOTIFY #define LAUNCH_NOTIFY #define NEED_RC #define NEED_RC_SH #define NEED_SH #define LAUNCH_SH #define NEED_PROP #define LAUNCH_PROP #define NEED_ETC_PROFILE #define NEED_CRUNCH
There are three kinds of macros:
- The NEED_module style macros: specify that module is to be copied on image.
- The LAUNCH_module style macros: specify that module is to be launched.
- Other macros, like USE_BOCHS, etc: modify some parameters of some modules to be launched, here it slows down the timer driver for beeing used within an emulator.
It is possible to see the definition of those macros in the 'in/init.conf.in' and 'in/modules.list.in' template files.
For example, here is a minimal configuration that program the PIC (Programmable Interrupt Controller) and the timer controller and launch a standalone shell:
/* Launch a simple stand-alone shell but no filesystem: */ # define NEED_PIC # define LAUNCH_PIC # define NEED_TIMER # define LAUNCH_TIMER # define NEED_SASH # define LAUNCH_SASH
Other configuration files
There are other configuration files that are used for TFTP configuration that willl be documented soon.