Hallo,
es gab in der letzten Zeit immer wieder Fragen, wie man ein Notebook unter FreeBSD konfiguriert. Diese Konfiguration hier bezieht sich auf FreeBSD 8.1-RC2. Mit ihr funktioniert das Notebook vollständig, lediglich der Fingerabdrucksensor wird nicht unterstützt. Suspend / Resume wird unterstützt, ebenso das Powermanagement.
1. Ich nutze seit langem Kernel, die alles was irgendwie geht als Modul laden. Es macht die Administration wesentlich einfacher, gerade Treiberaktualisierungen ohne Ausfallzeiten. Es wäre schön, wenn GENERIC entsprechend umgebaut werden würde, aber das passiert wohl nie. Wer das nicht will muss nur dafür sorgen, dass die in rc.suspend entladenen Treiber als Modul vorliegen. Hier die Konfiguration:
Nun brauchen wir natürlich eine entsprechende loader.conf. Diese enthält neben diversen Treibern vor allem die Powermanagementeinstellungen:
Dann haben wir da noch die rc.conf. Eigentliche keine Besonderheiten, nur C3 muss hier aktiviert werden.
Der Vollständigkeit halber noch die xorg.conf:
----
Nun die eigentliche Magie. Beginnen wir mit /etc/rc.local. Hier muss ich neben einem dreckigen Hack für webcamd (das rc-Script will nicht, der Bug ist gemeldet) vor allem das Powermanagement der Platte abschalten. Sonst erzeigt sie ca. 50 Load Cycles pro Minute und wäre in wenigen Wochen Schrott:
So, dann habe ich meine devfs.rules, auch hier nichts besonderes:
Interessanter ist die devd.conf, da hier viel Magie zusammenläuft. So werden beim Ausstecken des Netzwerkkabels die IP-Adressen entzogen und die IBM-Tasten werden an ein Script übergeben:
Tjoa, das Script für die Tasten ist dann:
Dann rc.suspend. Sieht einfach aus, war aber nicht ganz einfach es auszufummeln, was man nun genau entladen muss:
Und rc.resume zum Fortsetzen des Systems:
Dann zum Abschluss noch meine sysctl.conf. Neben diversem Standardkram schalte ich dort vor allem die IBM-Tasten ein und setzte den uralten i8254 Timecounter, da dieser anders als ACPI-fast ein sicheres Suspend / Resume ermöglicht. ACPI-fast crasht das System ab und an, HPET lässt die Grafikkarte krepieren.
Mit dieser Konfiguration läuft das Thinkpad genauso lange aus dem Akku wie unter Windows 7 und Linux. Das Ganze mag noch nicht perfekt sein und in Teilen ein wenig zusammengehackt, aber dennoch inzwischen recht okay. Ich hoffe, dass der Kram jemanden hilft.
es gab in der letzten Zeit immer wieder Fragen, wie man ein Notebook unter FreeBSD konfiguriert. Diese Konfiguration hier bezieht sich auf FreeBSD 8.1-RC2. Mit ihr funktioniert das Notebook vollständig, lediglich der Fingerabdrucksensor wird nicht unterstützt. Suspend / Resume wird unterstützt, ebenso das Powermanagement.
1. Ich nutze seit langem Kernel, die alles was irgendwie geht als Modul laden. Es macht die Administration wesentlich einfacher, gerade Treiberaktualisierungen ohne Ausfallzeiten. Es wäre schön, wenn GENERIC entsprechend umgebaut werden würde, aber das passiert wohl nie. Wer das nicht will muss nur dafür sorgen, dass die in rc.suspend entladenen Treiber als Modul vorliegen. Hier die Konfiguration:
Code:
# Allgemein -- CPU
machine amd64
cpu HAMMER
ident SCREW
options SMP
# Allgemein -- Options
options SCHED_ULE
options INET
options INET6
options IPSEC
options SCTP
options KBD_INSTALL_CDEV
options PREEMPTION
options KTRACE
options AUDIT
options PRINTF_BUFR_SIZE=128
options FLOWTABLE
options MAC
# Allgemein -- Debug
options STACK
options HWPMC_HOOKS
# Allgemein -- Dateisysteme
# UFS2
options SOFTUPDATES
options UFS_ACL
options UFS_DIRHASH
options UFS_GJOURNAL
options UFS_EXTATTR
options UFS_EXTATTR_AUTOSTART
options QUOTA
# Allgemein -- Kompatiblit<E4>t
options COMPAT_FREEBSD4
options COMPAT_FREEBSD5
options COMPAT_FREEBSD6
options COMPAT_FREEBSD7
options COMPAT_43TTY
options COMPAT_FREEBSD32
options _KPOSIX_PRIORITY_SCHEDULING
options SYSVSHM
options SYSVMSG
options SYSVSEM
options P1003_1B_SEMAPHORES
# Hardware -- GraKa
device vga
device splash
# Hardware -- Console
device sc
options SC_PIXEL_MODE
# Hardware -- Netzwerk
device loop
device ether
device bpf
# Hardware -- Pseudodevices
device pty
# Hardware -- Keyboard
device atkbdc
device atkbd
device psm
# Hardware -- Controller
device isa
device eisa
device pci
device acpi
# ALTQ
options ALTQ
options ALTQ_CBQ
options ALTQ_RED
options ALTQ_RIO
options ALTQ_HFSC
options ALTQ_CDNR
options ALTQ_PRIQ
options ALTQ_NOPCC
# Crypto fuer IPSEC
device crypto
# Kein reboot bei strg-alt-entf
options SC_DISABLE_REBOOT
Nun brauchen wir natürlich eine entsprechende loader.conf. Diese enthält neben diversen Treibern vor allem die Powermanagementeinstellungen:
Code:
# Loader
# ------
autoboot_delay="3"
# System
# ------
# Kein Strom fuer Geraete ohne Treiber
hw.pci.do_power_nodriver=3
# Kein Throtteling (braucht Strom und blockiert C2)
hint.acpi_throttle.0.disabled=1
# p4tcc ist ein Intel-Relikt aus Netburstzeiten
hint.p4tcc.0.disabled=1
hint.p4tcc.1.disabled=1
# APIC Timers blockieren C3
hint.apic.0.clock=0
# Keine dedizierte Realtime-Clock. Spart 128 Interrupts
# pro Sekunde, hat hier aber kaum Auswirkungen. Dafür
# Nebenwirkungen:
# - Tendenziell springende Uhr, die sehr seltsame
# Effekte hat. U.a. blockiertes PAM.
# - Blockierende Maus
# - 100% CPU Last kann das System blockieren
#hint.atrtc.0.clock=0
# 100 Ticks reichen aus und sind stromsparender als 1000
kern.hz=100
# Unhoerbar schlechtere Tonqualitaet und leichte Latenz, aber weniger Strom
hint.pcm.0.buffersize=65536
hint.pcm.1.buffersize=65536
hw.snd.feeder_buffersize=65536
hw.snd.latency=7
# Agressives Powermanagement fuer SATA
hint.ahcich.0.pm_level=5
hint.ahcich.1.pm_level=5
# Soundkarte
hint.hdac.0.cad0.nid22.config="as=1 seq=15 device=Headphones"
hint.hdac.0.cad0.nid26.config="as=1 seq=0 device=Line-Out"
# Equalizer
hint.pcm.0.eq=1
# Treiber
# -------
# ACPI
acpi_load="YES"
acpi_ibm_load="YES"
# Partitionstypen
geom_part_bsd_load="YES"
geom_part_mbr_load="YES"
geom_part_gpt_load="YES"
# Label
geom_label_load="YES"
# GELI
geom_eli_load="YES"
# Random
random_load="YES"
# Zlib
zlib_load="YES"
# ATA
ahci_load="YES"
# X11 Kram
mem_load="YES"
io_load="YES"
# SCSI
cam_load="YES"
atapicam_load="YES"
# Firewire
firewire_load="YES"
# NFS
nfsclient_load="YES"
nfs_common_load="YES"
# Netzwerk
miibus_load="YES"
if_bge_load="YES"
# SMBus
smbus_load="YES"
ichsmb_load="YES"
# CPUFreq
cpufreq_load="YES"
# Sound
sound_load="YES"
snd_hda_load="YES"
# CPU-Device
cpuctl_load="YES"
# USB
usb_load="YES"
ehci_load="YES"
uhci_load="YES"
ums_load="YES"
umass_load="YES"
ukbd_load="YES"
# Linux
linux_load="YES"
# Keyboard
kbdmux_load="YES"
# Bruecke
if_bridge_load="YES"
bridgestp_load="YES"
# Tap
if_tap_load="YES"
# Temperatursensoren
coretemp_load="YES"
# Tun
if_tun_load="YES"
# Wlan
wlan_load="YES"
wlan_tkip_load="YES"
wlan_amrr_load="YES"
wlan_wep_load="YES"
wlan_ccmp_load="YES"
# Intel WLAN
if_iwn_load="YES"
# DRM
agp_load="YES"
drm_load="YES"
i915_load="YES"
# ProcFS
pseudofs_load="YES"
procfs_load="YES"
# UFS
ufs_load="YES"
# Kernel RPC
krpc_load="YES"
# VirtualBox
vboxdrv_load="YES"
# FUSE
fuse_load="YES"
# MSDOSFS
msdosfs_load="YES"
msdosfs_iconv_load="YES"
# CD9660
cd9660_load="YES"
cd9660_iconv_load="YES"
# Mono
mono_load="YES"
# Cardbus
cbb_load="YES"
exca_load="YES"
# VESA
vesa_load="YES"
dpms_load="YES"
# Kartenleser
sdhci_load="YES"
# Watchdog
ichwd_load="YES"
# Netgraph
netgraph_load="YES"
# Bluetooth
ng_ubt_load="YES"
ng_hci_load="YES"
ng_bluetooth_load="YES"
# CUSE
cuse4bsd_load="YES"
Dann haben wir da noch die rc.conf. Eigentliche keine Besonderheiten, nur C3 muss hier aktiviert werden.
Code:
# Netzwerk
# --------
hostname="maka.home.yamagi.org"
ifconfig_bge0="DHCP"
wlans_iwn0="wlan0"
ifconfig_wlan0="WPA DHCP"
ipv6_enable="NO"
background_dhclient="YES"
synchronous_dhclient="NO"
# NTP
# ---
ntpd_sync_on_start="YES"
ntpd_enable="NO"
# Console
# -------
font8x14="iso15-8x14"
font8x16="iso15-8x16"
font8x8="iso15-8x8"
keymap="german.iso"
keyrate="normal"
scrnmap="NO"
keybell="visual"
keyboard="/dev/kbdmux0"
allscreens_flags="MODE_366"
# Linux
# -----
linux_enable="YES"
# NFS
# ---
nfs_client_enable="YES"
nfs_server_enable="YES"
# SSH
# ---
sshd_enable="YES"
# Powerd
# ------
powerd_enable="YES"
powerd_flags="-a hadp -b adp"
# Powermanagement
# ---------------
performance_cx_lowest="C3"
economy_cx_lowest="C3"
# Dump
# ----
dumpdev="/dev/ada0s1b"
dumpdir="/usr/dump"
# Temp löschen
# ------------
clear_tmp_enable="YES"
# Devfs
# -----
devfs_system_ruleset="yamagi"
# MusicPD
# -------
musicpd_enable="YES"
# Sendmail
# --------
sendmail_enable="NO"
# Drucker
# -------
lpd_enable="YES"
# Microcode Updates
# -----------------
microcode_update_enable="YES"
# Quotas
# ------
enable_quotas="YES"
check_quotas="NO"
# Geli
# ----
geli_devices="ada0s1g"
geli_ada0s1g_flags="-k /boot/geli/home.key"
# VirtualBox
# ----------
vboxnet_enable="YES"
# moused
# ------
moused_enable="YES"
moused_type="auto"
moused_flags="-3 -V -U 2 -L 5"
# Kein fsck
# ---------
background_fsck_delay="-1"
Der Vollständigkeit halber noch die xorg.conf:
Code:
# X.org Konfiguration für X11R7.6
# ===============================
# Layouts
# -------
Section "ServerLayout"
Identifier "dualscreen"
Screen "Screen0"
InputDevice "Keyboard0" "CoreKeyboard"
InputDevice "Mouse0" "CorePointer"
EndSection
# ============
# Servererweiterungen
# -------------------
Section "Extensions"
Option "XVideo" "Disable"
EndSection
# ============
# Dateien, die X nutzen soll
# --------------------------
Section "Files"
EndSection
# ============
# Serverkonfiguration
# -------------------
Section "ServerFlags"
Option "AllowEmptyInput" "false"
Option "OffTime" "20"
Option "DontZap" "off"
EndSection
# ============
# Module und Erweiterungen des Servers
# ------------------------------------
Section "Module"
EndSection
# ============
# Die Maus
# --------
Section "InputDevice"
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "SysMouse"
Option "Device" "/dev/sysmouse"
EndSection
# ============
# Die Tastatur
# ------------
Section "InputDevice"
Identifier "Keyboard0"
Driver "kbd"
Option "XkbModel" "pc105"
Option "XkbLayout" "de"
Option "XkbVariant" "nodeadkeys"
Option "XkbOptions" "terminate:ctrl_alt_bksp"
EndSection
# ============
# Monitore
# --------
Section "Monitor"
Identifier "Monitor0"
Option "DPMS"
EndSection
# ============
# Grafikkarten
# ------------
Section "Device"
Identifier "Card0"
Driver "intel"
Option "DRI" "true"
EndSection
# ============
# Screens
# -------
Section "Screen"
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"
DefaultDepth 24
SubSection "Display"
Viewport 0 0
Depth 24
Modes "1680x1050"
Virtual 1680 1050
EndSubSection
EndSection
----
Nun die eigentliche Magie. Beginnen wir mit /etc/rc.local. Hier muss ich neben einem dreckigen Hack für webcamd (das rc-Script will nicht, der Bug ist gemeldet) vor allem das Powermanagement der Platte abschalten. Sonst erzeigt sie ca. 50 Load Cycles pro Minute und wäre in wenigen Wochen Schrott:
Code:
#!/bin/sh
# Dies ist ein Hack
/usr/local/sbin/webcamd &
#/bin/sleep 2
#/bin/chmod 0660 /dev/video0
# Und weil es so schoen ist noch das Powermanagement
# der Platte abschalten. Sonst fliegt uns Load_Cycle-Count
# durch die Decke, da er staendig den Kopf parkt und die Platte
# ist nach einigen Monaten im Arsch
/sbin/camcontrol cmd ada0 -a "EF 85 00 00 00 00 00 00 00 00 00 00"
So, dann habe ich meine devfs.rules, auch hier nichts besonderes:
Code:
[yamagi=1]
add path cd0 mode 0660
add path pass1 mode 0660
add path xpt0 mode 0660
add path tap* mode 0660
add path da* mode 0660
add path video* mode 0666
Interessanter ist die devd.conf, da hier viel Magie zusammenläuft. So werden beim Ausstecken des Netzwerkkabels die IP-Adressen entzogen und die IBM-Tasten werden an ein Script übergeben:
Code:
options {
directory "/etc/devd";
directory "/usr/local/etc/devd";
pid-file "/var/run/devd.pid";
};
notify 0 {
match "system" "IFNET";
match "type" "LINK_UP";
media-type "ethernet";
action "/etc/rc.d/dhclient quietstart $subsystem";
};
notify 0 {
match "system" "IFNET";
match "type" "LINK_DOWN";
media-type "ethernet";
action "/etc/rc.d/dhclient quietstop $subsystem ; ifconfig $subsystem inet 0.0.0.0";
};
notify 0 {
match "system" "IFNET";
match "type" "LINK_UP";
media-type "802.11";
action "/etc/rc.d/dhclient quietstart $subsystem";
};
notify 0 {
match "system" "IFNET";
match "type" "LINK_DOWN";
media-type "802.11";
action "/etc/rc.d/dhclient quietstop $subsystem ; ifconfig $subsystem inet 0.0.0.0";
};
attach 100 {
device-name "ubt[0-9]+";
action "/etc/rc.d/bluetooth quietstart $device-name";
};
detach 100 {
device-name "ubt[0-9]+";
action "/etc/rc.d/bluetooth quietstop $device-name";
};
attach 100 {
device-name "ukbd0";
action "/etc/rc.d/syscons setkeyboard /dev/ukbd0";
};
detach 100 {
device-name "ukbd0";
action "/etc/rc.d/syscons setkeyboard /dev/kbd0";
};
attach 100 {
device-name "ums[0-9]+";
action "/etc/rc.d/moused quietstart $device-name";
};
detach 100 {
device-name "ums[0-9]+";
action "/etc/rc.d/moused stop $device-name";
};
notify 10 {
match "system" "ACPI";
match "subsystem" "ACAD";
action "/etc/rc.d/power_profile $notify";
};
notify 10 {
match "system" "ACPI";
match "subsystem" "Thermal";
match "notify" "0xcc";
action "logger -p kern.emerg 'WARNING: system temperature too high, shutting down soon!'";
};
notify 10 {
match "system" "ACPI";
match "subsystem" "Suspend";
action "/etc/rc.suspend acpi $notify";
};
notify 10 {
match "system" "ACPI";
match "subsystem" "Resume";
action "/etc/rc.resume acpi $notify";
};
notify 10 {
match "system" "ACPI";
match "subsystem" "IBM";
action "/etc/acpi/acpi_oem_exec.sh $notify ibm";
};
Tjoa, das Script für die Tasten ist dann:
Code:
#!/bin/sh
#
if [ "$1" = "" -o "$2" = "" ]
then
echo "usage: $0 notify oem_name"
exit 1
fi
NOTIFY=`echo $1`
OEM=$2
LOGGER="logger"
case ${NOTIFY} in
# WLAN an / aus
0x05)
if [ -e /var/run/wpa_supplicant/wlan0 ]
then
/usr/sbin/wpa_cli terminate
/bin/sleep 2
/sbin/ifconfig wlan0 destroy
MESSAGE="WLAN deactivated"
else
/sbin/ifconfig wlan0 create wlandev iwn0
/bin/sleep 2
/usr/sbin/wpa_supplicant -i wlan0 -c /etc/wpa_supplicant.conf -B
MESSAGE="WLAN activated"
fi
;;
# Standby
0x04)
MESSAGE="Standby"
/bin/sync
/bin/sync
/bin/sync
/usr/sbin/zzz
;;
#Bluetooth an / aus
0x08)
LEVEL=`sysctl -n dev.acpi_${OEM}.0.bluetooth`
if [ "$LEVEL" = "1" ]
then
sysctl dev.acpi_${OEM}.0.bluetooth=0
MESSAGE="bluetooth disabled"
else
sysctl dev.acpi_${OEM}.0.bluetooth=1
MESSAGE="bluetooth enabled"
fi
;;
# CD Eject
0x09)
MESSAGE="Ejecting CD"
/sbin/camcontrol eject cd0
;;
# Sync Disks
0x0c)
MESSAGE="Syncing disks"
/bin/sync
esac
${LOGGER} ${MESSAGE}
exit 0
Dann rc.suspend. Sieht einfach aus, war aber nicht ganz einfach es auszufummeln, was man nun genau entladen muss:
Code:
if [ $# -ne 2 ]; then
echo "Usage: $0 [apm|acpi] [standby,suspend|1-4]"
exit 1
fi
subsystem=$1
state=$2
if [ -r /var/run/rc.suspend.pid ]; then
exit 1
fi
echo $$ 2> /dev/null > /var/run/rc.suspend.pid
# WPA
/usr/sbin/wpa_cli terminate
# Kill webcamd
pkill webcamd
# Shutdown moused
/etc/rc.d/moused stop
# If a device driver has problems suspending, try unloading it before
# suspend and reloading it on resume. Example:
kldunload firewire
kldunload ehci
kldunload uhci
kldunload usb
kldunload if_iwn
logger -t $subsystem suspend at `date +'%Y%m%d %H:%M:%S'`
sync && sync && sync
sleep 2
sync && sync && sync
rm -f /var/run/rc.suspend.pid
if [ $subsystem = "apm" ]; then
/usr/sbin/zzz
else
# Notify the kernel to continue the suspend process
/usr/sbin/acpiconf -k 0
fi
exit 0
Und rc.resume zum Fortsetzen des Systems:
Code:
if [ $# -ne 2 ]; then
echo "Usage: $0 [apm|acpi] [standby,suspend|1-4]"
exit 1
fi
subsystem=$1
state=$2
if [ -r /var/run/rc.suspend.pid ]; then
kill -9 `cat /var/run/rc.suspend.pid`
rm -f /var/run/rc.suspend.pid
echo 'rc.resume: killed rc.suspend that was still around'
fi
# Start moused
/etc/rc.d/moused start
# If a device driver has problems resuming, try unloading it before
# suspend and reloading it on resume. Example:
kldload firewire
kldload usb
kldload uhci
kldload ehci
kldload if_iwn
# wpa_supplicant(8) doesn't seem to reassociate during resume. Uncomment
# the following to signal it to reassociate.
/usr/sbin/wpa_supplicant -i wlan0 -c /etc/wpa_supplicant.conf -B
# Our legendary webcam-hack
/bin/sleep 5
/usr/local/sbin/webcamd &
logger -t $subsystem resumed at `date +'%Y%m%d %H:%M:%S'`
sync && sync && sync
exit 0
Dann zum Abschluss noch meine sysctl.conf. Neben diversem Standardkram schalte ich dort vor allem die IBM-Tasten ein und setzte den uralten i8254 Timecounter, da dieser anders als ACPI-fast ein sicheres Suspend / Resume ermöglicht. ACPI-fast crasht das System ab und an, HPET lässt die Grafikkarte krepieren.
Code:
# Die Prozesse anderer Nutzer nicht sehen
security.bsd.see_other_uids=0
# Zufaellige IP-Paketnumemrn
net.inet.ip.random_id=1
# SHM darf wieder entfernt werden
kern.ipc.shm_allow_removed=1
# Maximale Anzahl virtueller Soundkanaele
hw.snd.maxautovchans=16
# Sound unterm Linuxulator
hw.snd.compat_linux_mmap=1
# User duerfen Tap oeffnen
net.link.tap.user_open=1
# .core bitte nach /tmp
kern.corefile=/tmp/%N.core
# Nur Root darf den Messagebuffer lesen
security.bsd.unprivileged_read_msgbuf=0
# Mehr Platz fuer Dirhashs
vfs.ufs.dirhash_maxmem=134217728
# User duerfen mounten
vfs.usermount=1
# 32 Bloecke vorauslesen
vfs.read_max=32
# Standby wenn zugeklappt
hw.acpi.lid_switch_state=S3
# Sound lauter
dev.acpi_ibm.0.mute=0
hw.snd.vpc_0db=5
# Thinkpad-Keys
dev.acpi_ibm.0.events=1
# Anderer Timecounter
kern.timecounter.hardware=i8254
Mit dieser Konfiguration läuft das Thinkpad genauso lange aus dem Akku wie unter Windows 7 und Linux. Das Ganze mag noch nicht perfekt sein und in Teilen ein wenig zusammengehackt, aber dennoch inzwischen recht okay. Ich hoffe, dass der Kram jemanden hilft.
Zuletzt bearbeitet: