====== nur den FreeBSD-Kernel bauen ======
* **[[https://docs.freebsd.org/de_DE.ISO8859-1/books/developers-handbook/kernelbuild.html|Einen FreeBSD-Kernel bauen und installieren]]**
* [[https://docs.freebsd.org/de_DE.ISO8859-1/books/handbook/kernelconfig-custom-kernel.html|Wieso einen eigenen Kernel bauen?]] - Kernel-Module laden
- [[::FreeBSD:die FreeBSD-Quelle aktualisieren]]
- [[::FreeBSD:das ganze FreeBSD-System bauen]]
- [[::FreeBSD:nur den FreeBSD-Kernel bauen]]
===== ab FreeBSD 13 =====
[[https://docs.freebsd.org/de_DE.ISO8859-1/books/handbook/kernelconfig-building.html|Einen angepassten Kernel bauen und installieren]]
Subversion ist bei FreeBSD Geschichte, die 13.0 wird das erste
Release sein, welches nur noch per GIT abrufbar ist (und die älteren sind
auch jetzt schon per GIT abrufbar).
Dann müsste man das Paket "git" (oder "git-lite") installieren.
Den Quellkode bekommt man mit folgenden Befehlen:
> cd /usr/src
> rm -fr *
> git clone https://git.freebsd.org/src.git .
> git checkout releng/13.0
==== ein Beispiel für einen FreeBSD-Server ohne X11 und ohne W-LAN ====
WITHOUT_X11=yes
WITHOUT=X11
NO_X=yes
X_WINDOW_SYSTEM=
OPTIONS_UNSET+=X11
OPTIONS_UNSET+=DEBUG
DEFAULT_VERSIONS+=ssl=openssl
BATCH=YES
WITH_MPM=event
KERNCONF=MYKERNEL GENERIC
WITHOUT_MODULES= amr arcmsr ciss iir ips mly twa smartpqi tws aac aacraid ida mfi mlx mrsas twe agp cbb pccard cardbus wlan wlan_wep wlan_ccmp wlan_tkip wlan_amrr an ath ath_pci ath_hal bwi bwn ipw iwi iwn malo mwl ral wpi hyperv
include GENERIC
ident MYKERNEL
device nullfs
device nvram
nodevice speaker
nodevice isa
device zfs
device sg
nooptions COMPAT_FREEBSD32 # Compatible with i386 binaries
### die zu bauenden Kernel festlegen in /etc/src.conf
# KERNCONF=MYKERNEL GENERIC
include GENERIC
ident MYKERNEL
options DDB # Enable the ddb(4) kernel debugger
device nullfs
device nvram
#
device speaker
envvar hint.speaker.0.at="isa"
envvar hint.speaker.0.port="0x61"
device isa
#nodevice isa # Don't need to support an ISA bus
#
device zfs
device sg
### IPv6 - mit "no" davor wird abgeschaltet
nooptions INET6 # IPv6 communications protocols
nodevice gif # IPv6 and IPv4 tunneling
### oder in der /etc/src.conf mit der Variablen WITHOUT_MODULES abschalten
### WITHOUT_MODULES= amr arcmsr ciss iir ips mly twa smartpqi tws aac aacraid ida mfi mlx mrsas twe agp cbb pccard cardbus wlan wlan_wep wlan_ccmp wlan_tkip wlan_amrr an ath ath_pci ath_hal bwi bwn ipw iwi iwn malo mwl ral wpi virtio hyperv
#
nooptions COMPAT_FREEBSD32 # Compatible with i386 binaries
nooptions COMPAT_FREEBSD4 # Compatible with FreeBSD4
nooptions COMPAT_FREEBSD5 # Compatible with FreeBSD5
nooptions COMPAT_FREEBSD6 # Compatible with FreeBSD6
nooptions COMPAT_FREEBSD7 # Compatible with FreeBSD7
nooptions COMPAT_FREEBSD9 # Compatible with FreeBSD9
nooptions COMPAT_FREEBSD10 # Compatible with FreeBSD10
options COMPAT_FREEBSD11 # Compatible with FreeBSD11
options COMPAT_FREEBSD12 # Compatible with FreeBSD12
#
nodevice amr # AMI MegaRAID
nodevice arcmsr # Areca SATA II RAID
nodevice ciss # Compaq Smart RAID 5*
nodevice iir # Intel Integrated RAID
nodevice ips # IBM (Adaptec) ServeRAID
nodevice mly # Mylex AcceleRAID/eXtremeRAID
nodevice twa # 3ware 9000 series PATA/SATA RAID
nodevice smartpqi # Microsemi smartpqi driver
nodevice tws # LSI 3ware 9750 SATA+SAS 6Gb/s RAID controller
nodevice aac # Adaptec FSA RAID
nodevice aacraid # Adaptec by PMC RAID
nodevice ida # Compaq Smart RAID
nodevice mfi # LSI MegaRAID SAS
nodevice mlx # Mylex DAC960 family
nodevice mrsas # LSI/Avago MegaRAID SAS/SATA, 6Gb/s and 12Gb/s
nodevice twe # 3ware ATA RAID
#
nodevice agp # support several AGP chipsets
#
nodevice cbb # cardbus (yenta) bridge
nodevice pccard # PC Card (16-bit) bus
nodevice cardbus # CardBus (32-bit) bus
#
# Wireless NIC cards
nodevice wlan # 802.11 support
nooptions IEEE80211_DEBUG # enable debug msgs
nooptions IEEE80211_SUPPORT_MESH # enable 802.11s draft support
nodevice wlan_wep # 802.11 WEP support
nodevice wlan_ccmp # 802.11 CCMP support
nodevice wlan_tkip # 802.11 TKIP support
nodevice wlan_amrr # AMRR transmit rate control algorithm
nodevice an # Aironet 4500/4800 802.11 wireless NICs.
nodevice ath # Atheros NICs
nodevice ath_pci # Atheros pci/cardbus glue
nodevice ath_hal # pci/cardbus chip support
nooptions AH_AR5416_INTERRUPT_MITIGATION # AR5416 interrupt mitigation
nooptions ATH_ENABLE_11N # Enable 802.11n support for AR5416 and later
nodevice ath_rate_sample # SampleRate tx rate control for ath
nodevice bwi # Broadcom BCM430x/BCM431x wireless NICs.
nodevice bwn # Broadcom BCM43xx wireless NICs.
nodevice ipw # Intel 2100 wireless NICs.
nodevice iwi # Intel 2200BG/2225BG/2915ABG wireless NICs.
nodevice iwn # Intel 4965/1000/5000/6000 wireless NICs.
nodevice malo # Marvell Libertas wireless NICs.
nodevice mwl # Marvell 88W8363 802.11n wireless NICs.
nodevice ral # Ralink Technology RT2500 wireless NICs.
nodevice wpi # Intel 3945ABG wireless NICs.
#
# VirtIO support
nodevice virtio # Generic VirtIO bus (required)
nodevice virtio_pci # VirtIO PCI device
nodevice vtnet # VirtIO Ethernet device
nodevice virtio_blk # VirtIO Block device
nodevice virtio_scsi # VirtIO SCSI device
nodevice virtio_balloon # VirtIO Memory Balloon device
#
nodevice hyperv # HyperV drivers
> cp /usr/src/sys/amd64/conf/MYKERNEL_mini /usr/src/sys/amd64/conf/MYKERNEL
> cd /usr/src
> make kernel
> reboot
==== nur einen bestimmten Kernel neu bauen ====
vor dem Kernel kompilieren muss die "Welt" kompiliert werden:
> cd /usr/src/
> make buildkernel KERNCONF=MYKERNEL
> make installkernel KERNCONF=MYKERNEL
> reboot
==== einmaliger Kerneltest ====
Wenn man nur (einmal) für den nächsten Reboot einen neuen Kernel testen möchtest.
# make installkernel KERNCONF=YOUR_KERNEL_HERE KODIR=/boot/testkernel
# nextboot -k testkernel
=== einmaliger Test-Boot mit dem neuen Kernel ===
__den neuen Kernel kann man mit einem ZFS-System leider nicht testen:__
> make installkernel KERNCONF=MYKERNEL KODIR=/boot/testkernel
> nextboot -k testkernel
WARNING: loader(8) has only R/O support for ZFS
nextboot.conf will NOT be reset in case of kernel boot failure
> shutdown -r now