-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
v3_EN_SrsLinuxArm
How to run SRS on ARM pcu?
- Application on ARM to publish stream to SRS, use srs-librtmp.
- Run SRS on ARM: Client can play stream from ARM server.
The use scenario:
- There are lots of ARM device, and the center server cannot accept so many streams.
- User can directly play stream on ARM when ARM running SRS server.
- SRS can output RTMP and HLS, for both PC and mobile(Android+IOS).
Cross build ST and OpenSSL on Ubuntu16.
CrossBuild SRS in Ubuntu16
Use docker,Ubuntu 16(xenial):
docker pull registry.cn-hangzhou.aliyuncs.com/ossrs/srs:ubuntu16
Build SRS in docker:
cd ~/git && docker run -it -v `pwd`:/tmp/git -w /tmp/git/srs/trunk \
registry.cn-hangzhou.aliyuncs.com/ossrs/srs:ubuntu16 bash
Install toolchain, for example Acqua or RoadRunner board
apt-get install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf
Cross build SRS:
./configure --arm --cc=arm-linux-gnueabihf-gcc --cxx=arm-linux-gnueabihf-g++ \
--ar=arm-linux-gnueabihf-ar --ld=arm-linux-gnueabihf-ld --randlib=arm-linux-gnueabihf-randlib &&
make
Run SRS on ARM board
Run SRS on ARMv7 docker:
docker pull armv7/armhf-ubuntu &&
cd ~/git && docker run -it -v `pwd`:/tmp/git -w /tmp/git/srs/trunk \
-p 1935:1935 -p 1985:1985 -p 8080:8080 armv7/armhf-ubuntu \
./objs/srs -c conf/console.conf
Publish stream:
ffmpeg -re -i doc/source.200kbps.768x320.flv -c copy \
-f flv -y rtmp://127.0.0.1:1935/live/livestream
SRS configure options for cross build:
root@4c618f90fc4c:/tmp/git/srs/trunk# ./configure -h
Toolchain options: @see https://github.com/ossrs/srs/issues/1547#issuecomment-576078411
--arm Enable crossbuild for ARM.
--mips Enable crossbuild for MIPS.
--cc=<CC> Use c compiler CC, default is gcc.
--cxx=<CXX> Use c++ compiler CXX, default is g++.
--ar=<AR> Use archive tool AR, default is ar.
--ld=<LD> Use linker tool LD, default is ld.
--randlib=<RANDLIB> Use randlib tool RANDLIB, default is randlib.
--extra-flags=<EFLAGS> Set EFLAGS as CFLAGS and CXXFLAGS. Also passed to ST as EXTRA_CFLAGS.
We can directly build and run SRS on RespberryPI, without crossbuild.
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!
Winlin 2014.11
Welcome to SRS wiki!
Please select your language:
Please select your language:
Please select your language:
Please select your language:
Please select your language: