1.修改LibreELEC系统镜像

LibreELEC系统镜像为只读,无法创建opt文件夹。
mac系统下安装brew,然后brew install squashfs
插入SD卡在终端中输入如下:

cd /Volumes/LIBREELEC
mkdir -p new/opt
mksquashfs new SYSTEM -all-root
rm -rf new

现在LibreELEC系统镜像就会生成一个opt文件夹,每次LibreELEC升级都需要重新创建这个opt文件夹。

2.启动LIbreELEC系统并登入SSH

在LibreELEC的系统设置中开启ssh,然后在终端中输入ssh root@LibreELEC.local
输入密码后登入LibreELEC

3.安装Entware

尽管/根目录还是只读,但是/storage是可读写的,所以先创建/storage/opt,然后把/opt挂载到/storage/opt,然后安装opkg,在终端中输入如下:

mkdir -p /storage/opt
mount -o bind /storage/opt /opt
wget -O - http://bin.entware.net/armv7sf-k3.2/installer/generic.sh | sh
export PATH=$PATH:/opt/bin:/opt/sbin
opkg update
opkg install coreutils-expr

这里面的安装脚本需要根据你的设备来修改
可以到http://bin.entware.net/来查看支持的设备类型
可以选择的有

[aarch64-k3.10/](http://bin.entware.net/aarch64-k3.10/)
[armv5sf-k3.2/](http://bin.entware.net/armv5sf-k3.2/)
[armv7sf-k2.6/](http://bin.entware.net/armv7sf-k2.6/)
[armv7sf-k3.2/](http://bin.entware.net/armv7sf-k3.2/)
[mipselsf-k3.4/](http://bin.entware.net/mipselsf-k3.4/)
[mipssf-k3.4/](http://bin.entware.net/mipssf-k3.4/)
[x64-k3.2/](http://bin.entware.net/x64-k3.2/)

修改启动项,LibreELEC启动自动挂载/opt到/storage/opt

输入nano -w /storage/.config/system.d/opt.mount
[Unit]
DefaultDependencies=no
Conflicts=umount.target
Before=local-fs.target umount.target

[Mount]
What=/storage/opt
Where=/opt
Type=none
Options=bind

[Install]
WantedBy=local-fs.target

启动开机自动挂载

systemctl enable opt.mount

添加环境变量nano /storage/.profile
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8

export PATH=$PATH:/opt/bin:/opt/sbin

重启系统,ssh登入,检查/opt是否挂载ls /opt看是否有相应文件夹
输入opkg list检测环境变量是否设置成功

4.设置Entware启动项

输入nano -w /storage/.config/system.d/entware.service
[Unit]
Requires=network-online.service

[Service]
Type=oneshot
ExecStart=/opt/etc/init.d/rc.unslung start
ExecStop=/opt/etc/init.d/rc.unslung stop
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

开机自启动systemctl enable entware.service
启动服务systemctl start entware.service

5.安装Entware应用

opkg list
opkg list | grep package
opkg install package
opkg uninstall package

原文来自:https://www.linuxidc.com/Linux/2019-02/156693.htm

本文地址:https://www.linuxprobe.com/install-libreelec-entware.html编辑:上官,审核员:逄增宝

Linux命令大全:https://www.linuxcool.com/