Ich bin gerade dabei einen VDR/XBMC Client auf einen Mac Mini unter Ubuntu zu installieren.
Das Projekt ist noch in der Weiterentwicklung ich wollte hier aber schon mal den aktuellen Stand als Howto dokumentieren (work in progress)
Voraussetzungen
- Mac Mini (2009)
- Technotrend 3600 DVB-S USB Karte
- Logitech Harmony Fernbedienung
- Server mit VDR und Festplatten
Aktueller Stand
- Linux startet automatisch
- X & vdr-sxfe werden beim booten automatisch gestartet
- vdr-sxfe & xbmc können mit der Fernbedienung gesteuert werden
- Es kann mit der Fernbedienung zwischen vdr & xbmc umgeschaltet werden
- Client / Server Funktionalität geht soweit (Timer werden auf Server gestartet, Remote OSD geht)
- Die Satellitenkarte ist im System eingebunden und wird vom vdr lokal verwendet
Baustellen
- Ich will den Rechner über die Fernbedienung in den Ruhezustand bringen und auch wieder aufwachen lassen
- Bei ersten Start wird zwar der X Server gestartet, vdr-sxfe beendet sich aber sofort wieder (wahrscheinlich startet das Skript zu schnell)
- Reboot geht nicht (bekanntes Mac Mini Ubuntu Thema)
- Testweise habe ich eine vdr 1.7.8 Lösung mit vdr/xmbc Integration zum Laufen bekommen. Ist aber aus meiner Sicht noch nichts für den produkten Einsatz weil:
- vdr-sxfe nur sehr schlecht mit dem neuen vdr funktioniert
- xbmc sehr langsam wird mit vdr (wahrscheinlich das bekannte Thema mit sehr vielen Aufnahmen, was bei meinen 1.2TB wohl wirklich war ist)
- Ich bekomme das remotetimer & remoteosd plugin nicht kompiliert, gerade die sind aber für das Client Server setup sehr wichtig
+ Es funktioniert vdpau basiertes HDTV, wenn das auch noch recht instabil ist
Installation von Ubuntu auf Mac Mini
Bootcamp Installation
- Mac OS booten und BootCamp starten (befindet sich im Dienstprogramme Ordner)
- In Bootcamp die Festplatte in zwei Partitionen aufteilen (Größe je nach Wunsch) und formatieren
- Nach dem Formatieren abbrechen und keine Boot CD einlegen
rEFIt installieren
- rEFIt unter Mac OS herunterladen und starten rEFIt Link
- rEFIt Disk Image mounten und rEFIT..mpkg starten
- Anweisungen ausführen und das MAC OS X Laufwerk als Ziellaufwerk auswählen
- In der fEFIt Konfigurationsdatei refit.conf die Option legacyfirst setzen, dann wir Linux als Default Filesystem gestartet, weiterhin die Option timeout auf einen kleinen Wert setzen, damit schneller an Linux gebootet wird.
Ubuntu Installation
- Von einer normalen Ubuntu CD/DVD booten (Taste C gedrückt halten während des Startens damit der Mac Mini von der DVD bootet
- Die normale Installation ausführen, und im Partitionierungs Dialog im Manuell Modus die von Mac OS erzeugte Partition wieder löschen und durch eine neue swap Partition und eine Linux Partition ersetzen (ich verwende EXT4 als Dateisystem)
- Wichtig grub nicht in den mbr schreiben, sondern in die Linux Partition
- Nach der Installation alle Pakte auf den neusten Stand bringen (Z.B. mit apt-get update ; apt-get upgrade)
NFSV4 installieren
Ich verwende NFSV4 um das Server Aufnahmeverzeichnis in den Client zu mappen und dort auch direkt als Aufnahmeverzeichnis zu verwenden. Das geht natürlich auch mit NFS V3.
- apt-get install nfs-common
- In /etc/default/nfs-common => NEED_IDMAPD=yes , Domain = home.local (Muss mit Server übereinstimmen)
- In /etc/fstab => server:/ /mnt/server nfs4 _netdev,auto 0 0
Kleiner Treiberanpassungen
- Fix für Nvidia Ethernet-Treiber: /etc/modprobe.d/local.conf => options forcedeth max_interrupt_work=20
- Richtige Erkennung der Soundkarte durch Alsa: /etc/modprobe.d/alsa-base.conf => options snd-hda-intel model=imac24 einfügen
Löschen von pulseaudio
Für mein Setup will ich den Ton digital an einen AV-Receiver ausgeben, das ist mir nicht gelungen, weiterhin wird auf diversen Seiten darauf hingewissen, das pulseaudio nicht sinnvoll für den Einsatz auf einen Mediacenter Rechner ist (im wesentlich wegen der hohen Latenz-Zeit). Mit folgender Prozedur kann man pulseaudio löschen und direkt alsa verwenden (und plötzlich geht sofort der Sound).
- rm /etc/X11/Xsession.d/70pulseaudio
- als user vdr (sudo -s -u vdr) : asoundconf list ; asoundconf set-default-card NVidia (oder was auch immer als Soundkarte ausgegeben wird)
- /etc/pulse/client.conf: autospawn = no
- /etc/pulse/default.pa: load-module module-alsa-sink device=dmix & load-module module-alsa-source device=dsnoop
Alsa Standard Device auf Digitalausgang setzen
Um den Digitalen Ausgang als Standard Device unter Alsa zu setzten legt man sich eine
/etc/asound.conf Datei an mit:
Damit wird systemweit die Karte 0 und das Device 1 als Standard Ausgabedevice gesetzt, das sollte eigentlich bei allen Mac Minis gleich sein. Ansonsten kann man mit aplay -l bzw aplay -L sich einen Überblick über die Audiogeräte verschaffen.
DVB Treiber Installation
Die Technotrend 3600 DVB-S USB Karte wird nicht von den Standard Treibern in Ubuntu unterstützt, sondern am besten installiert man die dvb Treiber aus dem aktuellen s2-liplianin Tree:
Nach einem Reboot wird die Karte automatisch erkannt und der Treiber (dvb_usb_pctv452e) installiert.
Es muesste sich in syslog folgende Meldung finden:
X Server Konfiguration
Der Mac Mini enthält eine Nvidia Onboard Grafikkarte, dafür sollte unbedingt der closed-source nvidia Treiber verwendet werden (schon wegen VDPAU). Neben der Installation der dafür notwendigen Ubuntu Treiber-Pakete muss nur noch das X Konfigurationsfile angepasst werden. In meinen Fall ist das File für eine 720p@50Hz Ausgabe optimiert:
/etc/X11/xorg.conf
- Section "Monitor"
- Identifier "Toshiba 32"
- Option "ExactModeTimingsDVI" "True"
- # Option "DPMS"
- # Option "BlankTime" "0"
- # Option "StandbyTime" "0"
- # Option "SuspendTime" "0"
- # Option "OffTime" "0"
- EndSection
- Section "Screen"
- Identifier "Default Screen"
- Monitor "Toshiba 32"
- Device "GeForce 9400"
- DefaultDepth 24
- Option "ModeValidation" "AllowNon60HzDFPModes, NoDFPNativeResolutionCheck"
- SubSection "Display"
- Depth 24
- Modes "1280x720_50" "1368x768_50"
- EndSubSection
- EndSection
- Section "Module"
- Load "glx"
- EndSection
- Section "Device"
- Identifier "GeForce 9400"
- Driver "nvidia"
- Option "NoLogo" "True"
- Option "UseEvents" "True"
- Option "CustomEdid" "DFP-0:/etc/X11/edid.bin"
- Option "ConnectedMonitor" "DFP-0"
- Option "UseDisplayDevice" "DFP-0"
- EndSection
Es gibt hier noch zwei kleinere Spezialitäten:
- Ich kann nicht garantieren, dass der Fernseher immer schon an ist, wenn der Rechner bootet, falls das nicht der Fall ist wird der Monitor nicht erkannt und auch nicht auf den HDMI Port geschaltet, deswegen wird in der Xorg Config der Ausgage DFP-0 erzwungen und es werden lokal gespeicherte Monitor-Informationen (edid.bin) verwendet. Dieses File kann mit dem nvidia-setting Programm erstellt werden (Genau Beschreibung)
- Mir macht der DPMS Modus ein Problem, da nach einiger Zeit der Bildschirm abgeschaltet wird. Ich weiss immer noch nicht woher das Problem kommt, den eigentlich ist DPMS nicht aktiviert. Mein Workaround ist aber einfach ein xset -dpms in den Start Skripten
Lirc auf Mac Mini
Für den internen Empfänger gibt es das lirc device macmini. Dieses wird über das /etc/lirc/hardware.conf konfiguriert:
- # /etc/lirc/hardware.conf
- #
- #Chosen Remote Control
- REMOTE="MACmini"
- REMOTE_MODULES=""
- REMOTE_DRIVER="macmini"
- REMOTE_DEVICE="/dev/usb/hiddev0"
- REMOTE_LIRCD_CONF=""
- REMOTE_LIRCD_ARGS=""
- #Chosen IR Transmitter
- TRANSMITTER="None"
- TRANSMITTER_MODULES=""
- TRANSMITTER_DRIVER=""
- TRANSMITTER_DEVICE=""
- TRANSMITTER_LIRCD_CONF=""
- TRANSMITTER_LIRCD_ARGS=""
- Für Harmony Fernbedinungen gibt es schon ein fertig konfiguriertes Device das kompatibel mit dem Mac Mini IR Empfänger ist. Die entsprechende Daten und das lircd.conf file finden sich unter folgendem Link: PLEX/ Harmony
Das passende lircd.conf file sieht dann wie folgt aus:
- #This configuration has been automatically generated via
- #the Ubuntu LIRC package maintainer scripts.
- #
- #It includes the default configuration for the remote and/or
- #transmitter that you have selected during package installation.
- #
- #Feel free to add any custom remotes to the configuration
- #via additional include directives or below the existing
- #Ubuntu include directives from your selected remote and/or
- #transmitter.
- # Please make this file available to others
- # by sending it to <l...@bartelmus.de>
- #
- # this config file was automatically generated
- # using lirc-0.8.3(macmini) on Sat Feb 21 01:52:50 2009
- #
- # contributed by
- #
- # brand: /etc/lirc/stuff.conf
- # model no. of remote control:
- # devices being controlled by this remote:
- #
- # From: http://www.mail-archive.com/atv-bootloader@googlegroups.com/msg00268.html
- # Setup for Harmony Remote
- # Harmony Setup
- # Type: Media Center PC
- # Manufacturer: Plex
- # Model: Plex Player
- begin remote
- name MacMini
- bits 32
- eps 30
- aeps 100
- one 0 0
- zero 0 0
- gap 203981
- toggle_bit_mask 0x0
- begin codes
- LargeUp 0x87EE9F0B
- LargeDown 0x87EE9F0D
- Aspect 0x87EE9D0A
- Queue 0x87EE9D0C
- PwrToggle 0x87EE9D03
- Sleep 0x87EE9A02
- Stop 0x87EE9705
- SkipBackward 0x87EEA00B
- SkipForward 0x87EEA00D
- Play 0x87EE9703
- Record 0x87EE9B0C
- Rewind 0x87EE9A0B
- FastForward 0x87EE9A0D
- Pause 0x87EE9803
- Guide 0x87EE9D05
- Info 0x87EE990B
- Exit 0x87EE9B0A
- Menu 0x87EE9602
- VolumeUp 0x87EE980A
- VolumeDown 0x87EE980C
- Mute 0x87EE9805
- ChannelUp 0x87EE9E0A
- ChannelDown 0x87EE9E0C
- Back 0x87EE990D
- DirectionUp 0x87EE960B
- DirectionDown 0x87EE960D
- DirectionLeft 0x87EE9608
- DirectionRight 0x87EE9607
- OK 0x87EE9604
- 1 0x87EE970A
- 2 0x87EE970C
- 3 0x87EE9709
- 4 0x87EE9706
- 5 0x87EE9809
- 6 0x87EE9806
- 7 0x87EE9908
- 8 0x87EE9907
- 9 0x87EE9A08
- 0 0x87EE9A07
- Clear 0x87EE9A04
- Enter 0x87EE9902
- Red 0x87EE9F08
- Green 0x87EE9F07
- Yellow 0x87EE9F04
- Blue 0x87EE9F02
- F1 0x87EE9B09
- F2 0x87EE9B06
- F3 0x87EE9B05
- F4 0x87EE9B03
- F5 0x87EEA008
- F6 0x87EEA007
- F7 0x87EEA004
- F8 0x87EEA002
- F9 0x87EE9E09
- F10 0x87EE9E06
- F11 0x87EE9E05
- F12 0x87EE9E03
- F13 0x87EE9D09
- F14 0x87EE9D06
- end codes
- end remote
VDR aus E-Tobi Paketen installieren
Ich verwende für die VDR Installation die E-Tobi Pakete unter Ubuntu. Es gibt die Pakte in drei Varianten standard, multipatch und extensions. Ich verwende Extensions weil ich dort einige für mich wichtige Features finde (z.B. einstellbare Sortierung in den Aufnahmen) die es in Multipatch nicht gibt.
- Zusätzliche Sourcen für die Pakete eintragen in /etc/apt/source.list
- Priorität für die neuen Sourcen einstellen in /etc/apt/preferences
Folgende grundlegende Pakete werden benötigt:
- vdr : offensichtlich
- vdr-plugin-streamdev-client: zum streamen von Kanälen vom Server
- libxineliboutput-sxfe: Als lokales Ausgabe-Device für vdr
Client / Server VDR Plugins
- vdr-plugin-remoteosd
- vdr-plugin-remotetimers
- vdr-plugin-streamdev-server
- vdr-plugin-epgsync
Weitere VDR Plugins
Die folgenden Plugins sind sehr sinnvoll
- vdr-plugin-osdpip
- vdr-pluvdr-plugin-burn
- vdr-plugin-fritzbox
- vdr-plugin-mplayer
- vdr-plugin-osdteletext
- vdr-plugin-dvd
- vdr-plugin-skinenigmang
- vdr-enigmang-icons
- vdr-addon-noad
VDR Konfiguration
Streamdev-plugin
libxineliboutput
Automatisches Starten von vdr-sxfe beim booten
Das starten wird in diesem Fall über ein /etc/init.d/ Skript erreicht, dass sowohl einen X Server, den vdr-sxfe client, sowie den irexec Client startet (vdr-sxfe und irexec werden als user vdr gestartet)
Das neue Init Skript wird dann in den aktuellen Runlevel verlinkt und sollte dabei typischerweise den gdm Aufruf ersetzten (also S30vdr-sxfe in /etc/rc2.d/)
Hier das dafür notwendige Skript /etc/init.d/vdr-sxfe:
- #! /bin/sh
- ### BEGIN INIT INFO
- # Provides: vdr-sxfe
- # Required-Start: $remote_fs vdr
- # Required-Stop: $remote_fs
- # Default-Start: 2 3 4 5
- # Default-Stop: 0 1 6
- # Short-Description Start vdr-sxfe
- # Description: Start X server and vdr-sxfe
- # placed in /etc/init.d.
- ### END INIT INFO
- # Author: Foo Bar
- #
- # Please remove the "Author" lines above and replace them
- # with your own name if you copy and modify this script.
- # Do NOT "set -e"
- # PATH should only include /usr/* if it runs after the mountnfs.sh script
- PATH=/sbin:/usr/sbin:/bin:/usr/bin
- DESC="start vdr-sxfe on X on VT8/Display 1"
- NAME=vdr-sxfe
- DAEMON=/usr/bin/$NAME
- DAEMON_ARGS=" xvdr:tcp://localhost:37890 --lirc --reconnect --fullscreen --post tvtime:method=Linear,cheap_mode=1,pulldown=0,use_progressive_
- frame_flag=1"
- PIDFILE=/var/run/$NAME.pid
- PIDFILEX=/var/run/$NAME\_X.pid
- SCRIPTNAME=/etc/init.d/$NAME
- IREXEC=/usr/bin/irexec
- IREXEC_ARGS="-d /etc/irexec.conf"
- USER=vdr
- # Exit if the package is not installed
- [ -x "$DAEMON" ] || exit 0
- # Read configuration variable file if it is present
- [ -r /etc/default/$NAME ] && . /etc/default/$NAME
- # Load the VERBOSE setting and other rcS variables
- . /lib/init/vars.sh
- # Define LSB log_* functions.
- # Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
- . /lib/lsb/init-functions
- #
- # Function that starts the daemon/service
- #
- do_start()
- {
- start-stop-daemon --start --background --pidfile $PIDFILEX --make-pidfile --exec /usr/bin/X11/X -- :1 vt8 -br -nolisten tcp
- if [ $? -gt 0 ]; then
- echo "Error starting X-Server."
- exit $?
- fi
- export DISPLAY=:1
- export LANG="de_DE.UTF-8"
- # Return
- # 0 if daemon has been started
- # 1 if daemon was already running
- start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
- || return 1
- start-stop-daemon --start --background --quiet --pidfile $PIDFILE --make-pidfile --chuid $USER --exec $DAEMON -- \
- $DAEMON_ARGS \
- || return 2
- start-stop-daemon --start --background --quiet --chuid $USER --exec $IREXEC -- $IREXEC_ARGS
- chown vdr:vdr $PIDFILE
- /usr/bin/xset -dpms
- }
- #
- # Function that stops the daemon/service
- #
- do_stop()
- {
- # Return
- # 0 if daemon has been stopped
- # 1 if daemon was already stopped
- # 2 if daemon could not be stopped
- # other if a failure occurred
- start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
- RETVAL="$?"
- [ "$RETVAL" = 2 ] && return 2
- # Wait for children to finish too if this is a daemon that forks
- # and if the daemon is only ever run from this initscript.
- # If the above conditions are not satisfied then add some other code
- # that waits for the process to drop all resources that could be
- # needed by services started subsequently. A last resort is to
- # sleep for some time.
- start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
- [ "$?" = 2 ] && return 2
- # Many daemons don't delete their pidfiles when they exit.
- rm -f $PIDFILE
- start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILEX
- rm -f $PIDFILEX
- return "$RETVAL"
- }
- #
- # Function that sends a SIGHUP to the daemon/service
- #
- do_reload() {
- #
- # If the daemon can reload its configuration without
- # restarting (for example, when it is sent a SIGHUP),
- # then implement that here.
- #
- start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
- return 0
- }
- case "$1" in
- start)
- [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
- do_start
- case "$?" in
- 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
- 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
- esac
- ;;
- stop)
- [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
- do_stop
- case "$?" in
- 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
- 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
- esac
- ;;
- #reload|force-reload)
- #
- # If do_reload() is not implemented then leave this commented out
- # and leave 'force-reload' as an alias for 'restart'.
- #
- #log_daemon_msg "Reloading $DESC" "$NAME"
- #do_reload
- #log_end_msg $?
- #;;
- restart|force-reload)
- #
- # If the "reload" option is implemented then remove the
- # 'force-reload' alias
- #
- log_daemon_msg "Restarting $DESC" "$NAME"
- do_stop
- case "$?" in
- 0|1)
- do_start
- case "$?" in
- 0) log_end_msg 0 ;;
- 1) log_end_msg 1 ;; # Old process is still running
- *) log_end_msg 1 ;; # Failed to start
- esac
- ;;
- *)
- # Failed to stop
- log_end_msg 1
- ;;
- esac
- ;;
- *)
- #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
- echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
- exit 3
- ;;
- esac
- :
Umschalten VDR/XBMC
Für das Umschalten zwischen VDR und XBMC wir das irexec Programm verwendet mit einem shell Skript das zwischen vdr-sxfe und xbmc umschaltet, bzw falls keins von beiden läuft vdr-sxfe startet. Dabei wird auch das .pid File für den vdr-sxfe aktuallisert für das herunterfahren mittels init.d Skript.
Es ist dafür ein shell Skript nötig, bei mir unter /usr/local/bin/switchtv liegt:
- #!/bin/bash
- XBMC="/usr/bin/xbmc -fs"
- VDR="/usr/bin/vdr-sxfe xvdr:tcp://localhost:37890 --nokbd --lirc --fullscreen --reconnect --syslog --post tvtime:method=Linear,cheap_mode=1,pulldown=0,use_progressive_frame_flag=1"
- PIDFILE=/var/run/vdr-sxfe.pid
- export DISPLAY=:1
- export LANG="de_DE.UTF-8"
- if [ "`ps -ef | grep -v grep | grep '/usr/bin/vdr-sxfe'`" != "" ];then
- echo "VDR application is running => starting XBMC ..."
- PID=`pidof -s /usr/bin/vdr-sxfe`
- kill $PID
- export HOME="/var/lib/vdr/xbmc"
- $XBMC 1> /var/log/xmbc.log 2>&1 &
- sleep 1
- xset -dpms
- PID=`pidof -s /usr/share/xbmc/xbmc.bin`
- echo $PID > $PIDFILE
- elif [ "`ps -ef | grep -v grep | grep '/usr/bin/xbmc'`" != "" ];then
- echo "XBMC application is running => starting VDR ..."
- PID=`pidof -s /usr/share/xbmc/xbmc.bin`
- kill $PID
- $VDR 1> /var/log/vdr-sxfe.log 2>&1 &
- xset -dpms
- PID=`pidof -s /usr/bin/vdr-sxfe`
- echo $PID > $PIDFILE
- else
- echo "no application is running => starting VDR ..."
- $VDR 1>/dev/null 2>&1 &
- xset -dpms
- PID=`pidof -s /usr/bin/vdr-sxfe`
- echo $PID > $PIDFILE
- fi
Weiterhin muss das Konfigurationsfile für irexec angepasst werden /etc/irexec.conf. Bei mir wird hier die Tase F1 verwendet für das Umschalten. Diese Taste habe ich dann In der Harmony Fernbedienung in die frei belegbaren TAsen gelegt.
Links
Installation von Linux auf Mac Mini
E-Tobi VDR Pakete unter Ubuntu
E-Tobi VDR Pakete
Mac-Mini FAQ
Löschen von Pulse-Audio für Ubuntu Jaunty