搭建群晖交叉编译环境(DS718+/ubuntu 16.04.6/DSM 6.2.1-23824 Update 6),以 tcl 8.4.19/expect 5.45.4/dos2unix 7.4.0的编译为例,如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
$ sudo apt-get -y install git $ mkdir -p toolkit $ cd toolkit $ git clone https://github.com/SynologyOpenSource/pkgscripts-ng.git # 如果访问github存在困难,可用本站下载一份代码拷贝 # wget https://www.mobibrw.com/wp-content/uploads/2019/04/pkgscripts-ng.zip $ cd pkgscripts-ng $ sudo ./EnvDeploy -v 6.2 -p x64 # 如果已经通过其他途径下载,或者已经下载完成,执行如下命令 # `sudo ./EnvDeploy -v 6.2 -p x64 -t ../toolkit_tarballs/` # 比如: # wget https://www.mobibrw.com/wp-content/uploads/2019/04/base_env-6.2.txz -O ../toolkit_tarballs/ # wget https://www.mobibrw.com/wp-content/uploads/2019/04/ds.x64-6.2.dev.txz -O ../toolkit_tarballs/ # wget https://www.mobibrw.com/wp-content/uploads/2019/04/ds.x64-6.2.env.txz -O ../toolkit_tarballs/ # sudo ./EnvDeploy -v 6.2 -p x64 -t ../toolkit_tarballs/ # 下载 TCL 8.4.19 (不要超过这个版本号,否则 expect 链接不通过) $ sudo wget https://sourceforge.net/projects/tcl/files/Tcl/8.4.19/tcl8.4.19-src.tar.gz -O ../build_env/ds.x64-6.2/root/tcl8.4.19-src.tar.gz # 也可本站下载 sudo wget https://www.mobibrw.com/wp-content/uploads/2019/04/tcl8.4.19-src.tar.gz -O ../build_env/ds.x64-6.2/root/tcl8.4.19-src.tar.gz # 下载 Expect 5.45.4 $ sudo wget https://sourceforge.net/projects/expect/files/Expect/5.45.4/expect5.45.4.tar.gz -O ../build_env/ds.x64-6.2/root/expect5.45.4.tar.gz # 也可以本站下载 sudo wget https://www.mobibrw.com/wp-content/uploads/2019/04/expect5.45.4.tar.gz -O ../build_env/ds.x64-6.2/root/expect5.45.4.tar.gz $ sudo chroot ../build_env/ds.x64-6.2/ $ cd root $ export PREFIX="/root/build_libs" $ export HOST="x86_64-linux-gnu" $ mkdir -p $PREFIX # 编译 TCL 8.4.19 $ tar xvf tcl8.4.19-src.tar.gz $ cd tcl8.4.19 $ PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig/ \ LD_LIBRARY_PATH=$PREFIX/lib/ \ ./unix/configure \ --build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` \ --host=$HOST \ --prefix=$PREFIX \ --disable-shared $ make clean $ make $ make install $ cd .. # 编译 Expect 5.45.4 $ tar xvf expect5.45.4.tar.gz $ cd expect5.45.4 $ CPPFLAGS="-I$PREFIX/include" $ PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig/ \ LD_LIBRARY_PATH=$PREFIX/lib/ \ LDFLAGS="-lutil" \ ./configure \ --build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` \ --host=$HOST \ --prefix=$PREFIX \ --enable-static \ --disable-shared $ make clean $ make $ make install $ cd .. # 下载 dos2unix 7.4 # 也可本站下载 https://www.mobibrw.com/wp-content/uploads/2019/04/dos2unix-7.4.0.tar.gz $ sudo wget https://sourceforge.net/projects/dos2unix/files/dos2unix/7.4.0/dos2unix-7.4.0.tar.gz ../build_env/ds.x64-6.2/root/dos2unix-7.4.0.tar.gz $ tar xvf dos2unix-7.4.0.tar.gz $ cd dos2unix-7.4.0 $ make # 下载 sshpass 1.06 # 也可本站下载 https://www.mobibrw.com/wp-content/uploads/2019/04/sshpass_1.06.orig_.tar.gz $ sudo wget http://deb.debian.org/debian/pool/main/s/sshpass/sshpass_1.06.orig.tar.gz ../build_env/ds.x64-6.2/root/sshpass_1.06.orig.tar.gz $ tar xvf sshpass_1.06.orig.tar.gz $ cd sshpass-1.06 $ make |
对于编译好的程序,复杂的可以自己制作安装包,简单的可以直接通过SSH推送到设备的/usr/local/bin目录下即可。
比如本次编译结果:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
$ scp -r $PREFIX/lib/tcl8.4 username@10.10.10.111:~/ $ scp $PREFIX/bin/expect username@10.10.10.111:~/ $ scp /root/dos2unix-7.4.0/dos2unix username@10.10.10.111:~/ $ scp /root/sshpass-1.06/sshpass username@10.10.10.111:~/ $ ssh 10.10.10.111 -l username $ sudo mv ~/tcl8.4 /usr/local/lib/ $ sudo mv ~/expect /usr/local/bin/ $ sudo mv ~/dos2unix /usr/local/bin/ $ sudo mv ~/sshpass /usr/local/bin/ |
接触linux 有一小段时间,因为使用路由器和黑群晖,了解了一些命令行,因为手中有三星数码相框,想在黑群晖上使用,需要编译 lcd4linux 软件,在 ubuntu 上 已经编译成功了。目前遇到问题是 ubuntu:群晖交叉编译 lcd4linux 不成功。
具体的编译问题,还是需要自己查资料解决的,这个没办法。