# Kernel



## progeek7722 (May 31, 2009)

This is my first time building a kernel so please bare with me. 

After building it the way I wanted it I enter the command 
#make buildkernel KERNCONF=MYKERNEL
and I got this message.


```
">>> stage 1: configuring the kernel
--------------------------------------------------------------
cd /usr/src/sys/amd64/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/MYKERNEL  /usr/src/sys/amd64/conf/MYKERNEL
config: /usr/src/sys/amd64/conf/MYKERNEL:21: syntax error
*** Error code 1

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

Stop in /usr/src."
```
Can anyone help me figure this out?


----------



## ale (May 31, 2009)

It's a little bit difficult without seeing MYKERNEL.
Can you post a diff between MYKERNEL and GENERIC?


----------



## progeek7722 (May 31, 2009)

I didn't really change too much. And I'm not 100% what your asking for. But here I go.
MYKERNEL

```
machine         amd64
cpu		K8 class_CPU
ident		MYKERNEL
```

GENERIC 

```
cpu		HAMMER
ident		GENERIC
```

My Kernel

```
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_43TTY		# BSD 4.3 TTY compat [KEEP THIS!]
options 	COMPAT_IA32		# Compatible with i386 binaries
options 	COMPAT_FREEBSD4		# Compatible with FreeBSD4
options 	COMPAT_FREEBSD5		# Compatible with FreeBSD5
options 	COMPAT_FREEBSD6		# Compatible with FreeBSD6
options 	SCSI_DELAY=1000		# 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 	KBD_INSTALL_CDEV	# install a CDEV entry in /dev
options 	ADAPTIVE_GIANT		# Giant mutex is adaptive.
options 	STOP_NMI		# Stop CPUS using NMI instead of IPI
options 	AUDIT			# Security event auditing
#options 	KDTRACE_FRAME		# Ensure frames are compiled in
#options 	KDTRACE_HOOKS		# Kernel DTrace hooks
```

GENERIC

```
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_43TTY		# BSD 4.3 TTY compat [KEEP THIS!]
options 	COMPAT_IA32		# Compatible with i386 binaries
options 	COMPAT_FREEBSD4		# Compatible with FreeBSD4
options 	COMPAT_FREEBSD5		# Compatible with FreeBSD5
options 	COMPAT_FREEBSD6		# Compatible with FreeBSD6
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 	KBD_INSTALL_CDEV	# install a CDEV entry in /dev
options 	ADAPTIVE_GIANT		# Giant mutex is adaptive.
options 	STOP_NMI		# Stop CPUS using NMI instead of IPI
options 	AUDIT			# Security event auditing
#options 	KDTRACE_FRAME		# Ensure frames are compiled in
#options 	KDTRACE_HOOKS		# Kernel DTrace hooks
```

MYKERNEL

```
# ATA and ATAPI devices
#device		ata
#device		atadisk		# ATA disk drives
#device		ataraid		# ATA RAID drives
#device		atapicd		# ATAPI CDROM drives
#device		atapifd		# ATAPI floppy drives
#device		atapist		# ATAPI tape drives
#options 	ATA_STATIC_ID	# Static device numbering
```

GENERIC looks the same but nothing is commented 

MYKERNEL

```
# RAID controllers interfaced to the SCSI subsystem
#device		amr		# AMI MegaRAID
#device		arcmsr		# Areca SATA II RAID
#device		ciss		# Compaq Smart RAID 5*
#device		dpt		# DPT Smartcache III, IV - See NOTES for options
#device		hptmv		# Highpoint RocketRAID 182x
#device		hptrr		# Highpoint RocketRAID 17xx, 22xx, 23xx, 25xx
#device		iir		# Intel Integrated RAID
#device		ips		# IBM (Adaptec) ServeRAID
#device		mly		# Mylex AcceleRAID/eXtremeRAID
#device		twa		# 3ware 9000 series PATA/SATA RAID

# RAID controllers
#device		aac		# Adaptec FSA RAID
#device		aacp		# SCSI passthrough for aac (requires CAM)
#device		ida		# Compaq Smart RAID
#device		mfi		# LSI MegaRAID SAS
#device		mlx		# Mylex DAC960 family
#XXX pointer/int warnings
#device		pst		# Promise Supertrak SX6000
device		twe		# 3ware ATA RAID
```

Same as before for GENERIC


```
# PCCARD (PCMCIA) support
# PCMCIA and cardbus bridge support
#device		cbb		# cardbus (yenta) bridge
#device		pccard		# PC Card (16-bit) bus
#device		cardbus		# CardBus (32-bit) bus
```

Same as before for GENERIC


```
# PCI Ethernet NICs.
#device		de		# DEC/Intel DC21x4x (``Tulip'')
#device		em		# Intel PRO/1000 Gigabit Ethernet Family
#device		igb		# Intel PRO/1000 PCIE Server Gigabit Family
#device		ixgbe		# Intel PRO/10GbE PCIE Ethernet Family
#device		le		# AMD Am7900 LANCE and Am79C9xx PCnet
#device		txp		# 3Com 3cR990 (``Typhoon'')
#device		vx		# 3Com 3c590, 3c595 (``Vortex'')

# PCI Ethernet NICs that use the common MII bus controller code.
# NOTE: Be sure to keep the 'device miibus' line in order to use these NICs!
device		miibus		# MII bus support
#device		age		# Attansic/Atheros L1 Gigabit Ethernet
#device		ale		# Atheros AR8121/AR8113/AR8114 Ethernet
#device		bce		# Broadcom BCM5706/BCM5708 Gigabit Ethernet
#device		bfe		# Broadcom BCM440x 10/100 Ethernet
#device		bge		# Broadcom BCM570xx Gigabit Ethernet
#device		dc		# DEC/Intel 21143 and various workalikes
#device		et		# Agere ET1310 10/100/Gigabit Ethernet
#device		fxp		# Intel EtherExpress PRO/100B (82557, 82558)
#device		jme		# JMicron JMC250 Gigabit/JMC260 Fast Ethernet
#device		lge		# Level 1 LXT1001 gigabit Ethernet
device		msk		# Marvell/SysKonnect Yukon II Gigabit Ethernet
#device		nfe		# nVidia nForce MCP on-board Ethernet
#device		nge		# NatSemi DP83820 gigabit Ethernet
#device		nve		# nVidia nForce MCP on-board Ethernet Networking
#device		pcn		# AMD Am79C97x PCI 10/100 (precedence over 'le')
#device		re		# RealTek 8139C+/8169/8169S/8110S
#device		rl		# RealTek 8129/8139
#device		sf		# Adaptec AIC-6915 (``Starfire'')
#device		sis		# Silicon Integrated Systems SiS 900/SiS 7016
#device		sk		# SysKonnect SK-984x & SK-982x gigabit Ethernet
#device		ste		# Sundance ST201 (D-Link DFE-550TX)
#device		ti		# Alteon Networks Tigon I/II gigabit Ethernet
#device		tl		# Texas Instruments ThunderLAN
#device		tx		# SMC EtherPower II (83c170 ``EPIC'')
#device		vge		# VIA VT612x gigabit Ethernet
#device		vr		# VIA Rhine, Rhine II
#device		wb		# Winbond W89C840F
#device		xl		# 3Com 3c90x (``Boomerang'', ``Cyclone'')
```

Same as above for GENERIC

```
# Wireless NIC cards
#device		wlan		# 802.11 support
#device		wlan_wep	# 802.11 WEP support
#device		wlan_ccmp	# 802.11 CCMP support
#device		wlan_tkip	# 802.11 TKIP support
#device		wlan_amrr	# AMRR transmit rate control algorithm
#device		wlan_scan_ap	# 802.11 AP mode scanning
#device		wlan_scan_sta	# 802.11 STA mode scanning
#device		an		# Aironet 4500/4800 802.11 wireless NICs.
#device		ath		# Atheros pci/cardbus NIC's
#device		ath_hal		# Atheros HAL (Hardware Access Layer)
#options		AH_SUPPORT_AR5416	# enable AR5416 tx/rx descriptors
#device		ath_rate_sample	# SampleRate tx rate control for ath
#device		awi		# BayStack 660 and others
#device		ral		# Ralink Technology RT2500 wireless NICs.
#device		wi		# WaveLAN/Intersil/Symbol 802.11 wireless NICs.
```

Same as above for GENERIC


----------



## progeek7722 (May 31, 2009)

*Continue....*


```
# USB support
#device		uhci		# UHCI PCI->USB interface
#device		ohci		# OHCI PCI->USB interface
#device		ehci		# EHCI PCI->USB interface (USB 2.0)
device		usb		# USB Bus (required)
#device		udbp		# USB Double Bulk Pipe devices
device		ugen		# Generic
device		uhid		# "Human Interface Devices"
device		ukbd		# Keyboard
#device		ulpt		# Printer
device		umass		# Disks/Mass storage - Requires scbus and da
device		ums		# Mouse
#device		ural		# Ralink Technology RT2500USB wireless NICs
device		urio		# Diamond Rio 500 MP3 player
#device		uscanner	# Scanners
# USB Serial devices
device		ucom		# Generic com ttys
device		uark		# Technologies ARK3116 based serial adapters
device		ubsa		# Belkin F5U103 and compatible serial adapters
device		ubser		# BWCT console serial adapters
device		uftdi		# For FTDI usb serial adapters
device		uipaq		# Some WinCE based devices
device		uplcom		# Prolific PL-2303 serial adapters
device		uslcom		# SI Labs CP2101/CP2102 serial adapters
device		uvisor		# Visor and Palm devices
device		uvscom		# USB serial support for DDI pocket's PHS
# USB Ethernet, requires miibus
#device		aue		# ADMtek USB Ethernet
#device		axe		# ASIX Electronics USB Ethernet
#device		cdce		# Generic USB over Ethernet
#device		cue		# CATC USB Ethernet
#device		kue		# Kawasaki LSI USB Ethernet
#device		rue		# RealTek RTL8150 USB Ethernet

# FireWire support
#device		firewire	# FireWire bus code
#device		sbp		# SCSI over FireWire (Requires scbus and da)
#device		fwe		# Ethernet over FireWire (non-standard!)
#device		fwip		# IP over FireWire (RFC 2734,3146)
#device		dcons		# Dumb console driver
#device		dcons_crom	# Configuration ROM for dcons
```

Same as above for GENERIC


----------



## wonslung (May 31, 2009)

if you used the saem as generic why did you even compile a new kernel
or am i missing the point?


----------



## MG (May 31, 2009)

You use the line:


```
machine amd64
```

But I cannot find that line in my own GENERIC or LINT file.
Looks like an unknown option. Where did you get that from?



			
				wonslung said:
			
		

> if you used the saem as generic why did you even compile a new kernel
> or am i missing the point?



After an update, you can rebuild with the same kernel config file.


----------



## DutchDaemon (May 31, 2009)

Try commenting out SCTP (afaik it still needs INET6).


----------



## progeek7722 (May 31, 2009)

wonslung said:
			
		

> if you used the saem as generic why did you even compile a new kernel
> or am i missing the point?



Well, the idea was that if I commented out a lot of the services and unnecessary items I would have a faster machine. Cut me a little slack, this is only day 4 with FreeBSD.  



			
				MG said:
			
		

> You use the line:
> 
> 
> ```
> ...


http://www.freebsd.org/doc/en/books/handbook/kernelconfig-config.html

I followed this to help assist me in creating my kernel. When it first starts talking about the contents of the kernel is shows "machine    i386", since I didn't see anything under my kernel I decided to put that in there.




			
				DutchDaemon said:
			
		

> Try commenting out SCTP (afaik it still needs INET6).



Thanks, will do!



Thanks for all the help guys!


----------



## DutchDaemon (May 31, 2009)

'machine' is deprecated, though it hasn't made it to the Handbook yet(*). You will not find 'machine' in your GENERIC kernel, so there's no need to re-invent it for your own.

(*) probably because the Handbook tries to cover as much of the FreeBSD versions which are not end-of-life yet.


----------



## fronclynne (May 31, 2009)

Is

```
cpu K8 class_CPU
```
valid?

 (After editing my KERNCONF)
Answer:

```
/usr/src> sudo make buildkernel

--------------------------------------------------------------
>>> Kernel build for EARTH8 started on Sun May 31 15:26:54 EDT 2009
--------------------------------------------------------------
===> EARTH8
mkdir -p /usr/obj/home/8/src/sys

--------------------------------------------------------------
>>> stage 1: configuring the kernel
--------------------------------------------------------------
cd /home/8/src/sys/amd64/conf;  PATH=/usr/obj/home/8/src/tmp/legacy/usr/sbin:/usr/obj/home/8/src/tmp/legacy/usr/bin:/usr/obj/home/8/src/tmp
/legacy/usr/games:/usr/obj/home/8/src/tmp/usr/sbin:/usr/obj/home/8/src/tmp/usr/bin:/usr/obj/home/8/src/tmp/usr/games:/sbin:/bin:/usr/sbin:
/usr/bin  config  -d /usr/obj/home/8/src/sys/EARTH8  /home/8/src/sys/amd64/conf/EARTH8
config: /home/8/src/sys/amd64/conf/EARTH8:4: syntax error
*** Error code 1

Stop in /home/8/src.
*** Error code 1

Stop in /home/8/src.
```
So, I think you need to go back to 
	
	



```
cpu HAMMER
```


----------



## progeek7722 (May 31, 2009)

fronclynne said:
			
		

> Is
> [/code]
> So, I think you need to go back to
> 
> ...



Doing that got me a lot further this time. It starts compiling most of the way through then I get a similar error


```
/usr/src/sys/dev/msk/if_msk.c:152:23: error: miibus_if.h: No such file or directory
mkdep: compile failed
*** Error code 1

Stop in /usr/obj/usr/src/sys/MYKERNEL.
*** Error code 1

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

Any Ideas? There is a folder and directory named miibus_if.h in the msk directory.


----------



## ale (May 31, 2009)

Read the note in GENERIC about PCI ethernet NICs.


----------



## fronclynne (May 31, 2009)

progeek7722 said:
			
		

> Well, the idea was that if I commented out a lot of the services and unnecessary items I would have a faster machine.


Unused kernel drivers don't generally* slow anything down.  Unless you are very low on memory or root space there's no need to madly trim.  Go slow, removing one or two things at a time (or one class of things, like say SCSI RAID drivers . . .) until something breaks.


* the exception being WITNESS and some other debugging stuff.   SCSI_DELAY can slow probing during boot, but you shouldn't get too upset about that, unless you're rebooting every couple of minutes.  And crappy, old 5.25", full height SCSI-2 drives (the one I had sounded like a JT8 mounted on a washing machine full of angry badgers when it spun up, R.I.P.) like to have their spin-up & probe time.  Sometimes I would warm bagels on it, since it ran at around 60-80C all of the time.  Just leave a slot above it open.


----------



## jabber (Sep 24, 2009)

fronclynne said:
			
		

> the exception being WITNESS and some other debugging stuff.



Speaking of debugging...  are ALL the debugging options in the kernel file necessary?  I've been searching around and couldn't find a straight answer.

Cheers,
Jabber


----------



## DutchDaemon (Sep 24, 2009)

No, you can take them right out.


----------

