|CONFIG(8)||OpenBSD System Manager's Manual||CONFIG(8)|
|config||[-p] [-b builddir] [-s srcdir] [config-file]|
|config||[-u] [-f | -o outfile] -e infile|
In the second synopsis form, config allows editing of the kernel binary specified by infile. Devices may be enabled, disabled, or modified without recompiling, by editing the kernel executable. Similarly, the same editing can be done at boot-time, using the in-kernel editor, as described in boot_config(8).
For kernel building, the options are as follows:
The -p flag is expected to be used for “one-shot” profiles of existing systems; for regular profiling, it is probably wiser to make a separate configuration containing the makeoptions line.
For kernel modification, the options are as follows:
If config stops due to errors, the problems reported should be corrected and config should be run again. config attempts to avoid changing the compilation directory if there are configuration errors, but this code is not well-tested and some problems (such as running out of disk space) are unrecoverable.
If config-file is not specified, config uses the current directory as the build directory, and looks in it for a file called CONFIG. If config is run this way, the location of the top-level kernel source directory must be specified using the -s option or by using the “
source” directive at the beginning of the system configuration file.
The configuration files consists of various statements which include the following:
To debug kernels and their crash dumps with gdb, add “makeoptions DEBUG="-g"” to the kernel configuration file, along with (typically) “option KGDB”. Refer to options(4) for further details.
Many other statements exist, and the file format is fairly rich; for more information see the various configuration files included in the system, as well as files.conf(5) for the config rules base.
When invoked, the kernel identification is first shown.
# config -e -o bsd.new /bsd OpenBSD 5.3-current (GENERIC.MP) #91: Mon Mar 25 16:43:17 MDT 2013 email@example.com:/usr/src/sys/arch/i386/compile/GENERIC.MP Enter 'help' for information ukc>
One or more warnings may be printed before the
warning: no output file specified
Neither the -f nor -o option has been specified. Changes will be ignored.
WARNING kernel mismatch. -u ignored. WARNING the running kernel version:
config does not believe the running kernel is the same as the infile specified. Since the log of changes (from boot -c) in the running kernel is kernel-specific, the -u option is ignored.
The commands are as follows:
To compile a kernel from a non-writable media (such as a CD-ROM) mounted on /usr/src, do the following:
# cd /somedir # cp /usr/src/sys/arch/somearch/conf/SOMEFILE . # vi SOMEFILE (to make any changes) # config -s /usr/src/sys -b . SOMEFILE # make
To compile a kernel inside a writable source tree, do the following:
# cd /usr/src/sys/arch/somearch/conf # vi SOMEFILE (to make any changes) # config SOMEFILE # cd ../compile/SOMEFILE # make
In the examples above, somedir is a writable directory, somearch is the architecture (e.g. i386), and SOMEFILE should be a name indicative of a particular configuration (often that of the hostname). config will warn if a “make clean” is required.
The new kernel, called bsd, can be copied to /bsd and the system will boot it next time. Most people save their backup kernels as /bsd.1, /bsd.2, etc.
ukc> find ne 24 ne0 at isa0 port 0x240 size 0 iomem 0xd8000 iosiz 0 irq 9 drq -1 drq2 -1 flags 0x0 25 ne1 at isa0 port 0x300 size 0 iomem -1 iosiz 0 irq 10 drq -1 drq2 -1 flags 0x0 26 ne* at isapnp0 port -1 size 0 iomem -1 iosiz 0 irq -1 drq -1 flags 0x0 27 ne* at pci* dev -1 function -1 flags 0x0 28 ne* at pcmcia* function -1 irq -1 flags 0x0 ukc>
ne1 seems to match the configuration except it uses IRQ 10 instead of IRQ 5. So the irq on ne1 should be changed via the change command. The device can be specified by either name or number.
ukc> change ne1 25 ne1 at isa0 port 0x300 size 0 iomem -1 iosiz 0 irq 10 drq -1 drq2 -1 change (y/n) ? y port [0x300] ? size  ? iomem [-1] ? iosiz  ? irq  ? 5 drq [-1] ? drq2 [-1] ? flags  ? 25 ne1 changed 25 ne1 at isa0 port 0x300 size 0 iomem -1 iosiz 0 irq 5 drq -1 drq2 -1 flags 0x0 ukc>
It's also possible to disable all devices with a common attribute. For example:
ukc> disable port 0x300 25 ne1 disabled 72 we1 disabled 75 el0 disabled 77 ie1 disabled
The show command is useful for finding which devices have a certain attribute. It can also be used to find those devices with a particular value for an attribute.
ukc> show slot 2 ahc* at eisa0 slot -1 10 uha* at eisa0 slot -1 12 ep0 at eisa0 slot -1 17 ep* at eisa0 slot -1 102 ahb* at eisa0 slot -1 103 fea* at eisa0 slot -1 ukc> show port 0x300 25 ne1 at isa0 port 0x300 size 0 iomem -1 iosiz 0 irq 10 drq -1 drq2 -1 flags 0x0 72 we1 at isa0 port 0x300 size 0 iomem 0xcc000 iosiz 0 irq 10 drq -1 drq2 -1 flags 0x0 75 el0 at isa0 port 0x300 size 0 iomem -1 iosiz 0 irq 9 drq -1 drq2 -1 flags 0x0 77 ie1 at isa0 port 0x300 size 0 iomem -1 iosiz 0 irq 10 drq -1 drq2 -1 flags 0x0 ukc>
It is possible to add new devices, but only devices that were linked into the kernel. If a new device is added, following devices will be renumbered.
ukc> find ep 11 ep0 at isa0 port -1 size 0 iomem -1 iosiz 0 irq -1 drq -1 drq2 -1 flags 0x0 12 ep0 at eisa0 slot -1 flags 0x0 13 ep0 at pci* dev -1 function -1 flags 0x0 14 ep* at isapnp0 port -1 size 0 iomem -1 iosiz 0 irq -1 drq -1 flags 0x0 15 ep* at isa0 port -1 size 0 iomem -1 iosiz 0 irq -1 drq -1 drq2 -1 flags 0x0 16 ep* at eisa0 slot -1 flags 0x0 17 ep* at pci* dev -1 function -1 flags 0x0 18 ep* at pcmcia* dev -1 irq -1 flags 0x0 ukc> add ep1 Clone Device (DevNo, 'q' or '?') ? 13 Insert before Device (DevNo, 'q' or '?') 14 14 ep1 at pci* dev -1 function -1 ukc> change 14 14 ep1 at pci* dev -1 function -1 change (y/n) ? y dev [-1] ? 14 function [-1] ? flags  ? 18 14 ep1 changed 14 ep1 at pci* dev 14 function -1 flags 0x12 ukc>
When done, exit the program with the quit or exit commands. exit will ignore any changes while quit writes the changes to outfile (if -o or -f was given, else ignore changes).
The SYNOPSIS portion of each device in section 4 of the manual.
Building 4.4 BSD Systems with Config.
|January 20, 2014||OpenBSD 5.6|