Kodi: Difference between revisions

From fakedWiki
Jump to: navigation, search
m (1 revision imported)
m (63 revisions imported)

Revision as of 20:10, 26 August 2016

Standalone Kodi from Scratch

This is how i installed a standalone Kodi "Jarvis" 16 on a Gigabyte GA-F2A88XN-WIFI Mini-ITX board with an AMD A8-7600 APU and a Samsung EVO 850 SSD.

I've skipped the Wifi setup because i'm using a wired connection (high quality 1080p streaming is nicer without buffering).

Install OS

  • Ubuntu 15.10 (netboot via PXE is perfect, but you can use whatever you want, preferably Ubuntu Server)
  • New User: Kodi
  • In the software selection dialog choose:
    • [x] Basic Ubuntu server
    • [x] OpenSSH server

Install Kodi

  • i used the "unstable" PPA, but if you prefer final releases just replace the "unstable" with "ppa"
sudo add-apt-repository -y ppa:team-xbmc/unstable
sudo apt-get update
sudo apt-get install -y xinit alsa-utils avahi-daemon libva-glx1 libva-egl1 upower libcurl3 mysql-client mesa-utils mesa-vdpau-drivers vdpauinfo xserver-xorg-video-radeon kodi 

  • allow "anybody" to start the X server
sudo sed -i 's/allowed_users=console/allowed_users=anybody/' /etc/X11/Xwrapper.config

  • grant the "kodi" user access to serial devices (CEC), the soundcard and to shutdown, reboot, etc.
sudo usermod -aG users,dialout,audio,video,sudo kodi

  • grant the audio thread a higher priority
echo "kodi             -       nice            -1" | sudo tee -a /etc/security/limits.conf

  • add some tweaks to /etc/X11/xorg.conf to eliminate tearing
Section "Device"
  Identifier "Radeon"
  Driver "radeon"
  Option "ColorTiling" "on"
  Option "ColorTiling2D" "on"
  Option "DRI" "3"
  Option "TearFree" "on"
  Option "AccelMethod" "glamor"
EndSection

Allow Shutdown/Reboot

  • create /etc/polkit-1/localauthority/50-local.d/custom-actions.pkla
[Actions for kodi user]
Identity=unix-user:kodi
Action=org.freedesktop.login1.reboot;org.freedesktop.login1.reboot-multiple-sessions;org.freedesktop.login1.power-off;org.freedesktop.login1.power-off-multiple-sessions;org.freedesktop.login1.suspend;org.freedesktop.login1.suspend-multiple-sessions;org.freedesktop.login1.hibernate;org.freedesktop.login1.hibernate-multiple-sessions
ResultAny=yes
ResultInactive=yes
ResultActive=yes

Splashscreen (optional)

This only started working as expexted after i disabled the "Fullscreen BIOS Logo" in my BIOS.

sudo apt-get install -y plymouth-label v86d
wget https://dl.dropboxusercontent.com/u/55728161/plymouth-theme-kodi-logo.deb
sudo dpkg -i plymouth-theme-kodi-logo.deb
echo "GRUB_GFXMODE=1920x1080" | sudo tee -a /etc/default/grub
echo "GRUB_GFXPAYLOAD_LINUX=keep" | sudo tee -a /etc/default/grub
sudo update-grub

Autostart Kodi

  • create /etc/systemd/system/kodi.service
[Unit]
Description=Job that runs Kodi
After=getty.target sound.target network.target
Wants=network-online.target

[Service]
User=kodi
Restart=always
RestartSec=1s
ExecStart=/usr/bin/xinit /usr/bin/kodi --standalone -- /usr/bin/X -bs -nocursor -nolisten tcp :0

[Install]
WantedBy=default.target

  • enable the startup script
sudo systemctl daemon-reload
sudo systemctl enable kodi.service
sudo systemctl enable systemd-networkd.service
sudo systemctl enable systemd-networkd-wait-online.service
sudo ln -s /etc/systemd/system/kodi.service /etc/systemd/system/display-manager.service

  • reboot. now. Kodi won't start with the new driver unless you reboot
sudo reboot

Custom Tweaks

ALSA Dual Audio (Digital & Analog)

I have a pair of Bass Shakers (a.k.a. Butt Kickers) that need receive audio output, too. Usually you'd use the LFE channel of surround content, but as some content (e.g. Music) is only in Stereo, i want all audio always output via S/PDIF to my AV receiver and additionally via jack to the subwoofer amp (which does the low-pass filtering itself). Surround content stays surround for the digital output, but will also be converted to stereo for the analog output, and stereo gets output as is.

This is what my /etc/asound.conf looks like:

pcm.main {
  #type    hw
  #card    1
  #device  1
  type plug
  slave.pcm "iec958:CARD=Generic,DEV=0"
  slave.rate 48000
}

pcm.shaker {
  type    hw
  card    1
  device  0
}


pcm.!default {
  type plug
  hint.show on
  hint.description "S/PDIF 2.0 & Analog 2.0"

  slave.channels 2
  slave.pcm {
    type route

    ttable.0.0 1.0
    ttable.1.1 1.0

    ttable.0.2 1.0
    ttable.1.3 1.0

    slave.channels 4
    slave.pcm {
      type multi

      slaves.a.pcm       "main"
      slaves.a.channels  2
      slaves.b.pcm       "shaker"
      slaves.b.channels  2

      bindings.0.slave   a
      bindings.0.channel 0
      bindings.1.slave   a
      bindings.1.channel 1

      bindings.2.slave   b
      bindings.2.channel 0
      bindings.3.slave   b
      bindings.3.channel 1
    }
  }
}

pcm.!surround51 {
  type plug
  hint.show on
  hint.description "S/PDIF 5.1 & Analog 2.0"

  slave.channels 6
  slave.pcm {
    type route

    ttable.0.0 1.0
    ttable.1.1 1.0
    ttable.2.2 1.0
    ttable.3.3 1.0
    ttable.4.4 1.0
    ttable.5.5 1.0

    ttable.0.6 1.0
    ttable.2.6 -0.87177978870813471044739639677192
    ttable.3.6 -0.48989794855663561963945681494118
    ttable.4.6 0.70710678118654752440084436210485
    ttable.5.6 0.70710678118654752440084436210485

    ttable.1.7 1.0
    ttable.2.7 0.48989794855663561963945681494118
    ttable.3.7 0.87177978870813471044739639677192
    ttable.4.7 0.70710678118654752440084436210485
    ttable.5.7 0.70710678118654752440084436210485

    slave.channels 8
    slave.pcm {
      type multi

      slaves.a.pcm      "main"
      slaves.a.channels 6
      slaves.b.pcm      "shaker"
      slaves.b.channels 2

      bindings.0.slave   a
      bindings.0.channel 0
      bindings.1.slave   a
      bindings.1.channel 1
      bindings.2.slave   a
      bindings.2.channel 2
      bindings.3.slave   a
      bindings.3.channel 3
      bindings.4.slave   a
      bindings.4.channel 4
      bindings.5.slave   a
      bindings.5.channel 5

      bindings.6.slave   b
      bindings.6.channel 0
      bindings.7.slave   b
      bindings.7.channel 1
    }
  }
}

If you're interested in something similar, i can recommend the BS-200 bass shakers and the A-408 amp from Reckhorn - they're also offering a sets with 2 shakers and an amp. The A-500 is basically the same amp with less controls, but i guess that would have been more that sufficient, too.

Lightpack

  • /etc/systemd/system/hyperion.service
[Unit]
Description=Job that starts Hyperion

[Service]
User=root
Restart=always
RestartSec=1s
ExecStart=/usr/bin/hyperiond /etc/hyperion.config.json

[Install]
WantedBy=default.target

  • /etc/systemd/system/hyperion-x11.service
[Unit]
Description=Job that starts Hyperion-X11
After=kodi.service

[Service]
User=root
Restart=always
RestartSec=1s
Environment=DISPLAY=:0
ExecStart=/usr/bin/hyperion-x11

[Install]
WantedBy=default.target

  • enable units
systemctl enable hyperion
systemctl enable hyperion-x11