生于忧患,咸鱼安乐
Toggle navigation
Home
About Me
Archives
Tags
树莓派4体验ubuntu20.04之编译安装Kodi
树莓派
2020-08-27 14:46:27
962
0
0
squarefong
树莓派
*本来想在Ubuntu上编译安装Kodi,实现类似LibreELEC的效果。折腾一天发现和apt安装区别不大,不仅卡,而且Ubuntu这个是Server版本,默认最多1080分辨率,看起来很模糊。本文仅记录折腾过程。* 操作步骤主要参考: [xmbc项目README](https://github.com/xbmc/xbmc/blob/master/docs/README.Linux.md) # 1. 下载源代码 git clone https://github.com/xbmc/xbmc kodi # 2. 安装依赖 sudo apt install autoconf automake autopoint gettext autotools-dev cmake curl openjdk-8-jre gawk gcc g++ cpp gdc gperf libasound2-dev libass-dev libavahi-client-dev libavahi-common-dev libbluetooth-dev libbluray-dev libbz2-dev libcdio-dev libcec-dev libp8-platform-dev libcrossguid-dev libcurl4-openssl-dev libcwiid-dev libdbus-1-dev libegl1-mesa-dev libenca-dev libflac-dev libfontconfig1-dev libfmt-dev libfreetype6-dev libfribidi-dev libfstrcmp-dev libcrypt-dev libgif-dev libgles2-mesa-dev libglew-dev libglu1-mesa-dev libgnutls28-dev libgpg-error-dev libgtest-dev libiso9660-dev libjpeg-dev liblcms2-dev liblirc-dev libltdl-dev liblzo2-dev libmicrohttpd-dev libmysqlclient-dev libnfs-dev libogg-dev libomxil-bellagio-dev libpcre3-dev libplist-dev libpng-dev libpulse-dev libsmbclient-dev libspdlog-dev libsqlite3-dev libssl-dev libtag1-dev libtiff5-dev libtinyxml-dev libtool libudev-dev libva-dev libvdpau-dev libvorbis-dev libxkbcommon-dev libxmu-dev libxrandr-dev libxslt1-dev libxt-dev waylandpp-dev netcat wayland-protocols wipe lsb-release meson nasm ninja-build python3-dev python3-pil python3-minimal rapidjson-dev swig uuid-dev yasm zip zlib1g-dev 相比于README文件的推荐依赖,Ubuntu20已经没有了flatbuffers。因此需要进行下一步,编译安装部分依赖。 sudo make -C tools/depends/target/flatbuffers PREFIX=/usr/local 整个Kodi的编译中还会缺个依赖libunistring-dev和libdrm-dev,但是文档没写,这里补上: sudo apt install libunistring-dev libdrm-dev # 3. 编译安装 在kodi文件夹同级新建一个文件夹,并执行cmake mkdir kodi-build cd kodi-build/ cmake ../kodi -DCMAKE_INSTALL_PREFIX=/usr/local -DX11_RENDER_SYSTEM=gl 如果没有报错就可以进行编译了 cmake --build . -- VERBOSE=1 -j$(getconf _NPROCESSORS_ONLN) sudo make install 树莓派4编译安装这个需要6小时以上,建议睡前编译。如果是ssh上去的,而且有设置定时重启的话,记得取消定时重启~~(别问我怎么知道的)~~ # 4. 设置开机启动 此处参考[Arch Wiki](https://wiki.archlinux.org/index.php/Kodi#kodi-standalone_service) ~~(Arch大法好哇)~~ 主要思路就是AUR里面有一个kodi-standalone-service,这里会提供一个systemd用的文件来实现开机启动。虽然这不是arch,但是包还是可以看的。 根据archwiki,需要创建用户kodi,且主目录是/var/lib/kodi/。 sudo useradd -d /var/lib/kodi kodi sudo mkdir /var/lib/kodi sudo chown -R kodi:kodi /var/lib/kodi 将[$kodi-standalone-service^{AUR}$](https://aur.archlinux.org/cgit/aur.git/snapshot/kodi-standalone-service.tar.gz)下载下来后直接解压,查看PKGBUILD,会发现这其实来自于一个Github项目。我们打开[这个项目](https://github.com/graysky2/kodi-standalone-service),发现其实主要是几个.service文件,这里我们直接取x11的版本就行。直接下载[kodi.service](https://raw.githubusercontent.com/graysky2/kodi-standalone-service/master/init/kodi.service),保存到```/etc/systemd/system/kodi.service``` 然后是熟悉的```systemctl enable kodi```,然后重启。发现还是没启动。不要急,arch和debian还是有区别的,这里我们需要更改kodi.service文件。在```ExecStart```里,kodi-standalone的位置是```/usr/bin/kodi-standalone```,而编译安装后默认位置是```/usr/local/bin/kodi-standalone```,因此,改掉kodi.service里面目录就行。 改完发现还是没有开机启动,这里问题在于```After```里面有没配置好就不会启动的项目,这里为了快点看到效果就不折腾了,直接删掉启动不了的就行。我删掉了```bluetooth.target```和```mysqld.service``` 改完后文件内容如下: [Unit] Description=Kodi standalone (X11) After=remote-fs.target systemd-user-sessions.service network-online.target nss-lookup.target sound.target polkit.service upower.service Wants=network-online.target polkit.service upower.service Conflicts=getty@tty1.service [Service] User=kodi Group=kodi PAMName=login TTYPath=/dev/tty1 Environment=WINDOWING=x11 ExecStart=/usr/bin/xinit /usr/local/bin/kodi-standalone -- :0 -nolisten tcp vt1 Restart=on-abort StandardInput=tty StandardOutput=journal [Install] Alias=display-manager.service # 5. 调整优化 现在能看到Kodi的界面了,但是整个界面又模糊又卡,CPU占用率很高。这说明GPU部分还有很大问题。主要原因有二:1. Ubuntu server作为服务器优化的系统,没有给集成显卡分配显存。2. 没有让内核调用GPU。这里只需要更改修改```/boot/firmware/config.txt```,在最后添加两行 gpu_mem=256 dtoverlay=vc4-fkms-v3d 保存退出重启,即可体验流畅的4K输出。 但是问题依然还是有的,播放视频几乎是CPU在解码,不知道怎么交给GPU,所以看1080P以上的视频还是会卡顿。。。
Pre:
用systemd将双网口设备打造成软路由
Next:
树莓派4体验ubuntu20.04之搭建WiFi热点
0
likes
962
Weibo
Wechat
Tencent Weibo
QQ Zone
RenRen
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus
Table of content