# custom kernel compile error



## thegolum35 (Jun 21, 2011)

Hello,

When I try to compile my custom kernel, I get this error:


```
===> zlib (all)
cc -O2 -pipe -fno-strict-aliasing -Werror -D_KERNEL -DKLD_MODULE -nostdinc   -DH
AVE_KERNEL_OPTION_HEADERS -include /usr/obj/usr/src/sys/GOLLUM/opt_global.h -I.
-I@ -I@/contrib/altq -finline-limit=8000 --param inline-unit-growth=100 --param
large-function-growth=1000 -fno-common  -I/usr/obj/usr/src/sys/GOLLUM -mno-align
-long-strings -mpreferred-stack-boundary=2  -mno-mmx -mno-3dnow -mno-sse -mno-ss
e2 -mno-sse3 -ffreestanding -fstack-protector -std=iso9899:1999 -fstack-protecto
r -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes  -Wmissing-protot
ypes -Wpointer-arith -Winline -Wcast-qual  -Wundef -Wno-pointer-sign -fformat-ex
tensions -c /usr/src/sys/modules/zlib/../../net/zlib.c
ld  -d -warn-common -r -d -o zlib.kld zlib.o
:> export_syms
awk -f /usr/src/sys/conf/kmod_syms.awk zlib.kld  export_syms | xargs -J% objcopy
 % zlib.kld
ld -Bshareable  -d -warn-common -o zlib.ko zlib.kld
objcopy --strip-debug zlib.ko
1 error
*** Error code 2
1 error
*** Error code 2
1 error
```

Here is my custom kernel file:


```
cpu		I686_CPU
ident		GOLLUM

hints		"GENERIC.hints"	

options 	SCHED_ULE		
options 	PREEMPTION		
options 	INET			

options 	SCTP			
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 	NFSLOCKD		# Network Lock Manager

options 	GEOM_LABEL		# Provides labelization
options 	COMPAT_43TTY		# BSD 4.3 TTY compat (sgtty)

options 	COMPAT_FREEBSD6		# Compatible with FreeBSD6
options 	COMPAT_FREEBSD7		# Compatible with FreeBSD7

options 	STACK			# stack(9) support
options 	SYSVSHM			# SYSV-style shared memory
options 	SYSVMSG			# SYSV-style message queues
options 	SYSVSEM			# SYSV-style semaphores
options 	P1003_1B_SEMAPHORES	# POSIX-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

device		cpufreq

device		acpi
device		eisa

device		ata
device		atadisk		
device		atapicd	
options 	ATA_STATIC_ID	

device		scbus	

device		atkbdc		
device		atkbd		


device		vga	

device		sc

device		pmtimer

# Wireless NIC cards
device		wlan		# 802.11 support
options 	IEEE80211_DEBUG	# enable debug msgs
options 	IEEE80211_AMPDU_AGE # age frames in AMPDU reorder q's
options 	IEEE80211_SUPPORT_MESH	# enable 802.11s draft support

device		wlan_ccmp	# 802.11 CCMP support
device		wlan_tkip	# 802.11 TKIP support
device		wlan_amrr	# AMRR transmit rate control algorithm

# Pseudo devices.
device		loop		# Network loopback
device		random		# Entropy device
device		ether		# Ethernet support
device		pty		# BSD-style compatibility pseudo ttys
device		md		# Memory "disks"

device		pf
device 		pflog
device 		pfsync					

# USB support
options 	USB_DEBUG	# enable debug msgs
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		uhid		# "Human Interface Devices"
device		umass		# Disks/Mass storage - Requires scbus and da
device		ums		# Mouse
device		urtw
```

Thanks, Gollum


----------



## richardpl (Jun 21, 2011)

To avoid error from being lost, rebuild with -DNO_CLEAN and with single job.

Is there any reason why you removed bpf?

The only way for me to know what is missing is to try to compile your kernel.


----------



## Sushil-Handa (Jun 23, 2011)

*Error is still not solved*

Error mentioned by thegolum35 still remains. Do you have any other suggestion Richardpl? Your quick response will be much appreciated.



			
				richardpl said:
			
		

> To avoid error from being lost, rebuild with -DNO_CLEAN and with single job.
> 
> Is there any reason why you removed bpf?
> 
> The only way for me to know what is missing is to try to compile your kernel.


----------



## SirDice (Jun 23, 2011)

Are there any CFLAGS or related flags in /etc/make.conf?

Is so, remove them. Do a *make clean* and try again.


----------



## richardpl (Jun 23, 2011)

Sushil-Handa said:
			
		

> Error mentioned by thegolum35 still remains. Do you have any other suggestion Richardpl? Your quick response will be much appreciated.



It is hard to guess. If the error is same with only one job running than it looks like ld or something in binutilus (objcopy) is broken - but this is obviously not case if GENERIC builds fine in which case kernel configuration file is seriously broken.

From second look:

You can not have scbus without cam(4) stuff.

Also for next time look at /sys/conf/files* for device dependencies.


----------



## thegolum35 (Jun 24, 2011)

The above error is no longer. However, I get this now:


```
linking kernel
OsdHardware.o(.text+0xcd): In function `AcpiOsWritePciConfiguration':
: undefined reference to `pci_cfgregopen'
OsdHardware.o(.text+0x107): In function `AcpiOsWritePciConfiguration':
: undefined reference to `pci_cfgregwrite'
OsdHardware.o(.text+0x13d): In function `AcpiOsReadPciConfiguration':
: undefined reference to `pci_cfgregopen'
OsdHardware.o(.text+0x170): In function `AcpiOsReadPciConfiguration':
: undefined reference to `pci_cfgregread'
acpi.o(.text+0x3f5f): In function `acpi_attach':
: undefined reference to `pcie_cfgregopen'
acpi_cpu.o(.text+0x51b): In function `acpi_cpu_startup':
: undefined reference to `pci_find_device' 
[...]
```

Here is /etc/make.conf:

```
PERL_VERSION=5.12.3
SRCCONF=/etc/src.conf
```

Thanks


----------



## richardpl (Jun 24, 2011)

That is because your kernel is missing *device pci*.

Is there any arch (not useless one) where pci is not mandatory?


----------

