# Problem building a new kernel



## leboeuf (Feb 28, 2011)

First, sorry for my English which is not so good.

I will try to explain my problem here,

I have a server on FreeBSD 7.1 32 bits. I would compile a new kernel because I have a special kernel of my hoster (OVH). So, I downloaded sources with cvsup. Everything is ok, I have now the repository /usr/src/sys with all the files.

Now I want to compile a new kernel, so I look at this page http://www.freebsd.org/doc/handbook/kernelconfig-building.html

So I start to build a new kernel, with taking for example the GENERIC. I create a file which I give a name: NOYAUFIRST
There is is content here:

```
machine "i386"
cpu "I686_CPU"
ident NOYAUFIRST
maxusers 10

makeoptionsDEBUG=-g# Build kernel with gdb(1) debug symbols

options SCHED_ULE# ULE scheduler
options PREEMPTION# Enable kernel thread preemption
options INET# InterNETworking
options INET6# IPv6 communications protocols
options SCTP# Stream Control Transmission Protocol
options FFS# Berkeley Fast Filesystem
options SOFTUPDATES# Enable FFS soft updates support
options UFS_ACL# Support for access control lists
options UFS_DIRHASH# Improve performance on big directories
options UFS_GJOURNAL# Enable gjournal-based UFS journaling
options MD_ROOT# MD is a potential root device
options NFSCLIENT# Network Filesystem Client
options NFSSERVER# Network Filesystem Server
options NFSLOCKD# Network Lock Manager
options NFS_ROOT# NFS usable as /, requires NFSCLIENT
options MSDOSFS# MSDOS Filesystem
options CD9660# ISO 9660 Filesystem
options PROCFS# Process filesystem (requires PSEUDOFS)
options PSEUDOFS# Pseudo-filesystem framework
options GEOM_PART_GPT# GUID Partition Tables.
options GEOM_LABEL# Provides labelization
options COMPAT_FREEBSD4# Compatible with FreeBSD4
options COMPAT_FREEBSD5# Compatible with FreeBSD5
options COMPAT_FREEBSD6# Compatible with FreeBSD6
options COMPAT_FREEBSD7# Compatible with FreeBSD7
options SCSI_DELAY=5000# Delay (in ms) before probing SCSI
options KTRACE# ktrace(1) support
options STACK# stack(9) support
options SYSVSHM# SYSV-style shared memory
options SYSVMSG# SYSV-style message queues
options SYSVSEM# SYSV-style semaphores
options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions
options PRINTF_BUFR_SIZE=128# Prevent printf output being interspersed.
options KBD_INSTALL_CDEV# install a CDEV entry in /dev
options HWPMC_HOOKS# Necessary kernel hooks for hwpmc(4)
options AUDIT# Security event auditing
options MAC# TrustedBSD MAC Framework
options FLOWTABLE# per-cpu routing cache
#options KDTRACE_HOOKS# Kernel DTrace hooks
options INCLUDE_CONFIG_FILE     # Include this file in kernel

#options kernel OVH
options GEOM_MIRROR
options GEOM_STRIPE
options QUOTA

# Debugging for use in -current
options KDB# Enable kernel debugger support.
options DDB# Support DDB.
options GDB# Support remote GDB.
options DEADLKRES# Enable the deadlock resolver
options INVARIANTS# Enable calls of extra sanity checking
options INVARIANT_SUPPORT# Extra sanity checks of internal structures, required by INVARIANTS
options WITNESS# Enable checks to detect deadlocks and cycles
options WITNESS_SKIPSPIN# Don't run witness on spinlocks for speed
options MALLOC_DEBUG_MAXZONES=8# Separate malloc(9) zones

# To make an SMP kernel, the next two lines are needed
options SMP# Symmetric MultiProcessor Kernel
deviceapic# I/O APIC

# CPU frequency control
devicecpufreq

# The pf packet filter consists of three devices:
#  The `pf' device provides /dev/pf and the firewall code itself.
#  The `pflog' device provides the pflog0 interface which logs packets.
#  The `pfsync' device provides the pfsync0 interface used for
#   synchronization of firewall state tables (over the net).
devicepf
devicepflog
devicepfsync

# Bus support.
deviceacpi
deviceeisa
devicepci

# Floppy drives
devicefdc

# ATA and ATAPI devices
deviceata
deviceatadisk# ATA disk drives
deviceataraid# ATA RAID drives
deviceatapicd# ATAPI CDROM drives
deviceatapifd# ATAPI floppy drives
deviceatapist# ATAPI tape drives
options ATA_STATIC_ID# Static device numbering

# SCSI Controllers
deviceahb# EISA AHA1742 family
deviceahc# AHA2940 and onboard AIC7xxx devices
options AHC_REG_PRETTY_PRINT# Print register bitfields in debug
# output.  Adds ~128k to driver.
deviceahd# AHA39320/29320 and onboard AIC79xx devices
options AHD_REG_PRETTY_PRINT# Print register bitfields in debug
# output.  Adds ~215k to driver.
deviceamd# AMD 53C974 (Tekram DC-390(T))
devicehptiop# Highpoint RocketRaid 3xxx series
deviceisp# Qlogic family
#deviceispfw# Firmware for QLogic HBAs- normally a module
devicempt# LSI-Logic MPT-Fusion
#devicencr# NCR/Symbios Logic
devicesym# NCR/Symbios Logic (newer chipsets + those of `ncr')
devicetrm# Tekram DC395U/UW/F DC315U adapters

deviceadv# Advansys SCSI adapters
deviceadw# Advansys wide SCSI adapters
deviceaha# Adaptec 154x SCSI adapters
deviceaic# Adaptec 15[012]x SCSI adapters, AIC-6[23]60.
devicebt# Buslogic/Mylex MultiMaster SCSI adapters

devicencv# NCR 53C500
devicensp# Workbit Ninja SCSI-3
devicestg# TMC 18C30/18C50

# SCSI peripherals
devicescbus# SCSI bus (required for SCSI)
devicech# SCSI media changers
deviceda# Direct Access (disks)
devicesa# Sequential Access (tape etc)
devicecd# CD
devicepass# Passthrough device (direct SCSI access)
deviceses# SCSI Environmental Services (and SAF-TE)

# RAID controllers interfaced to the SCSI subsystem
deviceamr# AMI MegaRAID
devicearcmsr# Areca SATA II RAID
deviceasr# DPT SmartRAID V, VI and Adaptec SCSI RAID
deviceciss# Compaq Smart RAID 5*
devicedpt# DPT Smartcache III, IV - See NOTES for options
devicehptmv# Highpoint RocketRAID 182x
devicehptrr# Highpoint RocketRAID 17xx, 22xx, 23xx, 25xx
deviceiir# Intel Integrated RAID
deviceips# IBM (Adaptec) ServeRAID
devicemly# Mylex AcceleRAID/eXtremeRAID
devicetwa# 3ware 9000 series PATA/SATA RAID

# RAID controllers
deviceaac# Adaptec FSA RAID
deviceaacp# SCSI passthrough for aac (requires CAM)
deviceida# Compaq Smart RAID
devicemfi# LSI MegaRAID SAS
devicemlx# Mylex DAC960 family
devicepst# Promise Supertrak SX6000
devicetwe# 3ware ATA RAID

# atkbdc0 controls both the keyboard and the PS/2 mouse
deviceatkbdc# AT keyboard controller
deviceatkbd# AT keyboard
devicepsm# PS/2 mouse

devicekbdmux# keyboard multiplexer

devicevga# VGA video card driver

devicesplash# Splash screen and screen saver support

# syscons is the default console driver, resembling an SCO console
devicesc

deviceagp# support several AGP chipsets

# Power management support (see NOTES for more options)
#deviceapm
# Add suspend/resume support for the i8254.
devicepmtimer

# PCCARD (PCMCIA) support
# PCMCIA and cardbus bridge support
devicecbb# cardbus (yenta) bridge
devicepccard# PC Card (16-bit) bus
devicecardbus# CardBus (32-bit) bus

# Serial (COM) ports
deviceuart# Generic UART driver

# Parallel port
deviceppc
deviceppbus# Parallel port bus (required)
devicelpt# Printer
deviceplip# TCP/IP over parallel
deviceppi# Parallel port interface device
#devicevpo# Requires scbus and da

# If you've got a "dumb" serial or parallel PCI card that is
# supported by the puc(4) glue driver, uncomment the following
# line to enable it (connects to sio, uart and/or ppc drivers):
#devicepuc
...
```

Sorry I must post it in two parts...


----------



## SirDice (Mar 1, 2011)

Please use something like Pastebin. And watch how you cut and paste, there are a lot of spaces missing.

Also check to make sure you checked out RELENG_7_1 as it looks like you got -CURRENT, not 7.1-RELEASE.


----------



## leboeuf (Mar 1, 2011)

Ok, there is my full content of my future kernel: http://pastebin.com/P3NZ3CWE

So after creating that file, I follow this page: http://www.freebsd.org/doc/handbook/kernelconfig-building.html

So I make

```
# cd /usr/src
# make buildkernel KERNCONF=NOYAUFIRST
```
That gave me a strange message:

```
>>> Kernel build for NOYAUFIRST started on Mon Feb 28 22:31:32 CET 2011
--------------------------------------------------------------
===> NOYAUFIRST
mkdir -p /usr/obj/usr/src/sys

--------------------------------------------------------------
>>> stage 1: configuring the kernel
--------------------------------------------------------------
cd /usr/src/sys/i386/conf;  PATH=/usr/obj/usr/src/tmp/legacy/usr/sbin:/usr/obj/usr/src/tmp/legacy/usr/bin:/usr/obj/usr/src/tmp/legacy/usr/games:
/usr/obj/usr/src/tmp/usr/sbin:/usr/obj/usr/src/tmp/usr/bin:/usr/obj/usr/src/tmp/usr/games:/sbin:/bin:/usr/sbin:/usr/bin  
config  -d /usr/obj/usr/src/sys/NOYAUFIRST  
/usr/src/sys/i386/conf/NOYAUFIRST
/usr/src/sys/i386/conf/NOYAUFIRST: unknown option "MAXUSERS"
*** Error code 1

Stop in /usr/src.
*** Error code 1

Stop in /usr/src.
```

I think the problem is 
	
	



```
unknown option "MAXUSERS"
```
but the first time I try to building a new kernel I haven't put in my file the 
	
	



```
maxusers 10
```
So I try to add this, to put "maxusers 0" but nothing is working.



> Also check to make sure you checked out RELENG_7_1 as it looks like you got -CURRENT, not 7.1-RELEASE.


I'm not sure to understand very well. Do you think I have a strange release ?
When I run uname -a:

```
FreeBSD nsxxxxxx.ovh.net 7.1-RELEASE FreeBSD 7.1-RELEASE #0: Fri Feb 13 04:58:44 CET 2009
     root@stock.ovh.net:/usr/obj/usr/src/sys/OVH  i386
```


----------



## SirDice (Mar 1, 2011)

Remove maxusers, you don't want to play with it. The automatic setting is usually good enough.



> I'm not sure to understand very well. Do you think I have a strange release ?


I'm saying it looks like you checked out the source for -current, not release 7.1.


----------



## leboeuf (Mar 1, 2011)

Ok, I think I understand what you mean. The downloading of sources witch cvsup is the problem? How can I check if the sources are -current or -release?
The file I use with cvsup:

```
*default host=cvsup.fr.FreeBSD.org
*default base=/var/db
*default prefix=/usr
*default release=cvs
*default delete use-rel-suffix
*default compress
src-base
src-sys
```

I can easily reinstall my server, if this problem is too important for be repaired. But how can I download the sources? The distibution is given without the /usr/src/sys sources. I must download them, cvsup is it good for that? The content of cvsup file I post here is it good? How can I download only sources for FreeBSD 7.1 release?


----------



## leboeuf (Mar 1, 2011)

Sorry for the double post but I forgot to say the file in /usr/src/sys are ending with ,v : GENERIC,v
Is it normal?


----------



## SirDice (Mar 1, 2011)

leboeuf said:
			
		

> ```
> *default release=cvs
> ```


Change it to:

```
*default release=cvs tag=RELENG_7_1
```

Remove what's now in /usr/src/ and run csup(1) again.



> Sorry for the double post but I forgot saying the file in /usr/src/sys are ending with ,v : GENERIC,v
> Is it normal ?


No, it means you made a full copy of the CVS repository. Not what you want if you just want to build a kernel or world.


----------



## leboeuf (Mar 2, 2011)

Thant you very much, you solved my problem. It came about the sources which were not good.


----------

