# FreeBSD 9.0 Release and Kernel with PF and ALTQ



## meciarz (Feb 15, 2012)

I had installed fresh FreeBSD 9.0 Release, but I need PF with ALTQ support in kernel, so in /usr/src/sys/i386/conf/ROUTER I put

```
include GENERIC

ident ROUTER

## Pf firewall
device pf
device pflog
device pfsync
options ALTQ
options ALTQ_CBQ
options ALTQ_RED
options ALTQ_RIO
options ALTQ_HFSC
options ALTQ_PRIQ
options ALTQ_NOPCC
```

*M*y /etc/make.conf

```
WITHOUT_X11=yes
WITH_UTF8=yes
WITHOUT_HAL=yes
WITHOUT_DBUS=yes

# optimizations
WITH_SSE=yes
WITH_3DNOW=yes
WITH_MMX=yes
WITH_THREADS=yes

CPUTYPE=i686
CFLAGS= -Os -fno-strict-aliasing -pipe -s
CXXFLAGS= -Os -fno-strict-aliasing -pipe -s
COPTFLAGS= -Os -fno-strict-aliasing -pipe -s

INSTALL_NODEBUG=yes

# /usr/ports/databases/mysql55-server
.if ${.CURDIR:M*/ports/databases/mysql55-server}
WITH_CHARSET=utf8
WITH_COLLATION=utf8_general_ci
.endif

BATCH=yes
```
gw# pwd
/usr/src
gw# make buildkernel KERNCONF=ROUTER

```
...
cc -c -Os -fno-strict-aliasing -pipe -s -march=pentiumpro -std=c99 -g -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes
 -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign -fformat-extensions -Wmissing-include-dirs -fdiagnostics-show-option -nostdinc -I. -I/usr/src/sys
 -I/usr/src/sys/contrib/altq -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -fno-common -finline-limit=8000 --param inline-unit-growth=100
 --param large-function-growth=1000 -mno-align-long-strings -mpreferred-stack-boundary=2 -mno-sse -mno-mmx -msoft-float -ffreestanding -fstack-protector
 -Werror /usr/src/sys/cam/scsi/scsi_pass.c
cc -c -Os -fno-strict-aliasing -pipe -s -march=pentiumpro -std=c99 -g -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes
 -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign -fformat-extensions -Wmissing-include-dirs -fdiagnostics-show-option -nostdinc -I. -I/usr/src/sys
 -I/usr/src/sys/contrib/altq -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -fno-common -finline-limit=8000 --param inline-unit-growth=100
 --param large-function-growth=1000 -mno-align-long-strings -mpreferred-stack-boundary=2 -mno-sse -mno-mmx -msoft-float -ffreestanding -fstack-protector
 -Werror /usr/src/sys/cam/scsi/scsi_sa.c
cc1: warnings being treated as errors
/usr/src/sys/cam/scsi/scsi_sa.c: In function 'samount':
/usr/src/sys/cam/scsi/scsi_sa.c:1886: warning: 'comp_supported' may be used uninitialized in this function
/usr/src/sys/cam/scsi/scsi_sa.c:1887: warning: 'write_protect' may be used uninitialized in this function
/usr/src/sys/cam/scsi/scsi_sa.c:1886: warning: 'comp_enabled' may be used uninitialized in this function
/usr/src/sys/cam/scsi/scsi_sa.c:2734: warning: 'current_speed' may be used uninitialized in this function
/usr/src/sys/cam/scsi/scsi_sa.c:2734: note: 'current_speed' was declared here
/usr/src/sys/cam/scsi/scsi_sa.c:2733: warning: 'current_density' may be used uninitialized in this function
/usr/src/sys/cam/scsi/scsi_sa.c:2733: note: 'current_density' was declared here
/usr/src/sys/cam/scsi/scsi_sa.c:2731: warning: 'current_blocksize' may be used uninitialized in this function
/usr/src/sys/cam/scsi/scsi_sa.c:2731: note: 'current_blocksize' was declared here
/usr/src/sys/cam/scsi/scsi_sa.c:2734: warning: 'current_speed' may be used uninitialized in this function
/usr/src/sys/cam/scsi/scsi_sa.c:2734: note: 'current_speed' was declared here
/usr/src/sys/cam/scsi/scsi_sa.c:2731: warning: 'current_blocksize' may be used uninitialized in this function
/usr/src/sys/cam/scsi/scsi_sa.c:2731: note: 'current_blocksize' was declared here
/usr/src/sys/cam/scsi/scsi_sa.c:2734: warning: 'current_speed' may be used uninitialized in this function
/usr/src/sys/cam/scsi/scsi_sa.c:2734: note: 'current_speed' was declared here
/usr/src/sys/cam/scsi/scsi_sa.c:2731: warning: 'current_blocksize' may be used uninitialized in this function
/usr/src/sys/cam/scsi/scsi_sa.c:2731: note: 'current_blocksize' was declared here
/usr/src/sys/cam/scsi/scsi_sa.c:2734: warning: 'current_speed' may be used uninitialized in this function
/usr/src/sys/cam/scsi/scsi_sa.c:2734: note: 'current_speed' was declared here
/usr/src/sys/cam/scsi/scsi_sa.c:2731: warning: 'current_blocksize' may be used uninitialized in this function
/usr/src/sys/cam/scsi/scsi_sa.c:2731: note: 'current_blocksize' was declared here
*** Error code 1

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

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

Stop in /usr/src.
```


```
gw# gcc -v
Using built-in specs.
Target: i386-undermydesk-freebsd
Configured with: FreeBSD/i386 system compiler
Thread model: posix
gcc version 4.2.1 20070831 patched [FreeBSD]
gw# cc -v
Using built-in specs.
Target: i386-undermydesk-freebsd
Configured with: FreeBSD/i386 system compiler
Thread model: posix
gcc version 4.2.1 20070831 patched [FreeBSD]
```
I don't know how pass it.


----------



## meciarz (Feb 15, 2012)

The solution is to remove

```
CPUTYPE=i686
CFLAGS= -Os -fno-strict-aliasing -pipe -s
CXXFLAGS= -Os -fno-strict-aliasing -pipe -s
COPTFLAGS= -Os -fno-strict-aliasing -pipe -s
```
Which I used is 8.2 Release.


----------



## SirDice (Feb 15, 2012)

meciarz said:
			
		

> ```
> CFLAGS= -Os -fno-strict-aliasing -pipe -s
> CXXFLAGS= -Os -fno-strict-aliasing -pipe -s
> COPTFLAGS= -Os -fno-strict-aliasing -pipe -s
> ```


Remove these.


----------



## felix (Feb 15, 2012)

Works fine - /etc/make.conf:

```
CPUTYPE?=native
CFLAGS+= -O2 -fno-strict-aliasing -pipe
COPTFLAGS+= -O -pipe

#NO_ACPI=		# do not build acpiconf(8) and related programs
#NO_ATM=		# do not build ATM related programs and libraries
#NO_AUTHPF=		# do not build and install authpf (setuid/gid)
NO_BLUETOOTH=YES	# do not build Bluetooth related stuff
#NO_BOOT=		# do not build boot blocks and loader
#NO_CRYPT=		# do not build any crypto code
#NO_CVS=		# do not build CVS
#NO_CXX=		# do not build C++ and friends
#NO_DICT=		# do not build the Webster dictionary files
#NO_DYNAMICROOT=	# do not link /bin and /sbin dynamically
#NO_FORTRAN=		# do not build g77 and related libraries
#NO_GAMES=		# do not build games (games/ subdir)
#NO_GDB=		# do not build GDB
#NO_GPIB=		# do not build GPIB support
#NO_I4B=		# do not build isdn4bsd package
NO_INET6=YES		# do not build IPv6 related programs and libraries
#NO_INFO=		# do not make or install info files
#NO_IPFILTER=		# do not build IP Filter package
#NO_KERBEROS=		# do not build and install Kerberos 5 (KTH Heimdal)
#NO_LIBC_R=		# do not build libc_r (re-entrant version of libc)
#NO_LIBPTHREAD=		# do not build libpthread (M:N threading library)
#NO_LIBTHR=		# do not build libthr (1:1 threading library)
#NO_LPR=		# do not build lpr and related programs
#NO_MAILWRAPPER=	# do not build the mailwrapper(8) MTA selector
#NO_MAN=		# do not build manual pages
NO_MODULES=YES		# do not build modules with the kernel
#NO_NETCAT=		# do not build netcat
#NO_NIS=		# do not build NIS support and related programs.
#			# If NO_NIS is set, you might need to adopt your
#			# nsswitch.conf(5) and remove "nis" entries.
#NO_NLS_CATALOGS=	# do not build NLS catalog support for csh(1)
#NO_OBJC=		# do not build Objective C support
#NO_OPENSSH=		# do not build OpenSSH
#NO_OPENSSL=		# do not build OpenSSL (implies NO_KERBEROS/NO_OPENSSH)
#NO_PF=			# do not build PF firewall package
NO_PROFILE=YES		# Avoid compiling profiled libraries
#NO_RCMDS=		# do not build or install BSD r* commands (rsh, etc).
#NO_SENDMAIL=		# do not build sendmail and related programs
#NO_SHARE=		# do not go into the share subdir
#NO_SHARED= 		# build /bin and /sbin statically linked (bad idea)
#NO_SHAREDOCS=		# do not build the 4.4BSD legacy docs
#NO_TCSH=		# do not build and install /bin/csh (which is tcsh)
#NO_TOOLCHAIN=		# do not build programs for program development
NO_USB=YES		# do not build usbd(8) and related programs

WITHOUT_X11=YES
WITHOUT_GUI=yes

DEFAULT_MYSQL_VER=51

.if ${.CURDIR} == ${PORTSDIR}/databases/mysql51-server
WITH_CHARSET=utf8
WITH_XCHARSET=all
WITH_COLLATION=utf8_bin
#WITH_LINUXTHREADS=yes
BUILD_OPTIMIZED=yes
BUILD_STATIC=yes
.endif

.if ${.CURDIR} == ${PORTSDIR}/databases/mysql51-client
WITH_CHARSET=utf8
WITH_COLLATION=utf8_bin
BUILD_OPTIMIZED=yes
.endif
```


----------



## meciarz (Feb 15, 2012)

When I changed -Os to -O2 compilation finished successfully.


----------

