How to run SRS on ARM pcu?
The use scenario:
Install the ARM cross build tool for SRS:
sudo aptitude install -y gcc-arm-linux-gnueabi g++-arm-linux-gnueabi
The tools compare:
x86 | armhf(v7cpu) |
---|---|
gcc | arm-linux-gnueabi-gcc |
g++ | arm-linux-gnueabi-g++ |
ar | arm-linux-gnueabi-ar |
as | arm-linux-gnueabi-as |
ld | arm-linux-gnueabi-ld |
ranlib | arm-linux-gnueabi-ranlib |
strip | arm-linux-gnueabi-strip |
Cross build:
./configure --with-arm-ubuntu12 && make
The bellow features can used for ARM-SRS:
Copy the binary to ARM and run:
winlin@winlin-VirtualBox:~/srs$ file objs/srs
objs/srs: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked,
for GNU/Linux 2.6.31, BuildID[sha1]=0xfba434cea50d6b02fd6e21ce67f01c39772c724b,
not stripped
SRS supports to modify the Default cross build tools:
configure
then build.Modify the configure:
SrsArmCC="arm-linux-gnueabi-gcc"
SrsArmGCC="arm-linux-gnueabi-gcc"
SrsArmCXX="arm-linux-gnueabi-g++"
SrsArmAR="arm-linux-gnueabi-ar"
SrsArmLD="arm-linux-gnueabi-ld"
SrsArmRANDLIB="arm-linux-gnueabi-ranlib"
Then configure and build:
./configure --with-arm-ubuntu12 --with-ssl --with-hls --with-librtmp && make
Export env variables
export SrsArmCC="arm-linux-gnueabi-gcc" &&
export SrsArmGCC="arm-linux-gnueabi-gcc" &&
export SrsArmCXX="arm-linux-gnueabi-g++" &&
export SrsArmAR="arm-linux-gnueabi-ar" &&
export SrsArmLD="arm-linux-gnueabi-ld" &&
export SrsArmRANDLIB="arm-linux-gnueabi-ranlib" &&
./configure --with-arm-ubuntu12 --with-ssl --with-hls --with-librtmp && make
SRS can be build on ARM os, for example, raspbian:
sudo aptitude install -y lsb-release
sudo aptitude install -y zip
./configure --pi && make
./scripts/package.sh --pi
The package, for instance, objs/SRS-RaspberryPi7-armv6l-0.9.37.zip
,
can be unzip and install.
The error Illegal instruction
is the cpu not compatible,
the cross build target cpu too high, read
http://stackoverflow.com/questions/14253626/arm-cross-compiling
The bellow is a simple test program:
/*
arm-linux-gnueabi-g++ -o test test.cpp -static
arm-linux-gnueabi-strip test
*/
#include <stdio.h>
int main(int argc, char** argv) {
printf("hello, arm!\n");
return 0;
}
To get the target cpu:
arm-linux-gnueabi-readelf --file-header --arch-specific test
Result:
Machine: ARM
File Attributes
Tag_CPU_name: "7-A"
Tag_CPU_arch: v7
So, the ubuntu12 cross build target cpu is cpuv7(debian armhf).
The debian armel, cpu is armv5:
root@debian-armel:~# cat /proc/cpuinfo
Processor : ARM926EJ-S rev 5 (v5l)
CPU revision : 5
While the debian armhf, cpu is armv7:
root@debian-armhf:~# cat /proc/cpuinfo
Processor : ARMv7 Processor rev 0 (v7l)
CPU architecture: 7
Run test program on armhf:
root@debian-armhf:~# ./test
hello, arm!
SRS is MIT license, ok for ARM.
I fixed a bug for ARM in st, the setjmp.h layout changed:
Remark: Here is just a example to patch longjmp and setjmp, while michaeltalyansky and xzh3836598 fix it, please read ST#1.
// md.h
#elif defined(__i386__)
#if defined(__GLIBC__) && __GLIBC__ >= 2
#define MD_GET_SP(_t) (_t)->context[0].__jmpbuf[4]
#elif defined(__amd64__) || defined(__x86_64__)
#define MD_GET_SP(_t) (_t)->context[0].__jmpbuf[6]
#elif defined(__arm__)
#if defined(__GLIBC__) && __GLIBC__ >= 2
#define MD_GET_SP(_t) (_t)->context[0].__jmpbuf[20]
When st_init(), we should never fork process, read bug #190
Winlin 2014.11
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。