0.交叉編譯
1. 官方 https://www.cnblogs.com/cursorhu/p/5760415.html
https://www.cnblogs.com/xieyajie/p/4699724.html
https://m.linuxidc.com/Linux/2010-03/25002.htm
https://www.cnblogs.com/ningci/p/10033940.html
2. 三方1https://github.com/abhiTronix/raspberry-pi-cross-compilers/wik
https://github.com/abhiTronix/raspberry-pi-cross-compilers/blob/master/docs/cross-gcc-buster.md#optimization-flags-involved
http://blog.chinaunix.net/uid-105044-id-2952235.html【echo "CFLAGS += -march=i486 -mtune=native" > configparms】
3. crosstool-ng
1. 調試
Raspberry Pi Zero W? 調試有幾個方式可選锰镀,usb接口、串口咖刃、wifi泳炉,因為開始調wifi不太順利,所以最后選擇了用usb嚎杨。
這里文章推薦 一根數據線玩轉樹莓派Zero
1.1 燒錄鏡像
燒錄這里推薦官方的燒錄工具 Raspberry Pi Imager花鹅,去官方下載 ,鏡像有三個版本枫浙,選擇lite版本刨肃,聽說zero燒普通版會比較卡。
1.2 修改調試設置
燒好鏡像以后會出現一個boot分區(qū)箩帚,很多配置可以直接在這里改
step 1.
# 修改boot分區(qū)里的config.txt文件真友,在新一行增加如下內容dtoverlay=dwc2
# 修改boot分區(qū)里的cmdline.txt文件紧帕,在rootwait后面增加如下內容挺尾,注意每個參數之間空格分開,且都是在同一行modules-load=dwc2,g_ether
step 2.
在boot下建立ssh的空文件掂僵,開啟ssh
然后開機上電
1.3 樹莓派開機后
window 7 篇
windows會有等燈的聲音芹扭,我的win7沒有直接加載,需要加載驅動,驅動是win7自帶的舍杜,需要通過設備管理器->更新驅動軟件->網絡適配器->在網絡適配器窗口的制造商列表中選擇微軟公司(Microsoft Corporation)饲握,右側列表中選擇遠端NDIS兼容設備。
可以看這篇文章,或者百度win7 RNDIS Gadget骑疆。
網卡有了以后推薦用putty連接raspberrypi.local诈火,看之前文章既可以了刀崖,但是win7 要安裝bonjour軟件充活。
Ubuntu 16.04 篇
樹莓派連上以后需要設置一下網卡,可以參考這篇蚁滋,或者下圖拥知。
1.4 安裝攝像頭
1. 樹莓派啟動后,先運行"sudo raspi-config" 然后選擇"Interfacing Options",在里面enable camera.
2.在/etc/modules文件最后加入一行"bcm2835-v4l2",保存退出,重啟涧黄。
3. 重啟后窄潭,可以用"vcgencmd get_camera"查看是不是識別到了攝像頭均抽。識別到的話,結果如下:
supported=1 detected=1。
1.5 推流
因為項目需要使用rtmp则酝,發(fā)現基本繞不開ffmpeg,樹莓派Zero編譯是很慢的武鲁,網上要編譯4個小時乘盖,而官方也對此進行了吐槽布蔗,并給出了詳細的交叉編譯文檔纵揍。但是這里建議使用這個編譯好的項目泽谨,直接安裝(實際操作的時候其實按照這個文章先安裝了x264吧雹,有沒有用就不知道了)雄卷,或者找個做好的docker揣钦,或者這兩個項目0,1,2宇姚。
如果是攝像跺嗽,參考這個文檔 https://www.raspberrypi.org/documentation/usage/camera/raspicam/raspivid.md
1.6 配置wifi
寫不動了战授,看這吧。
1.7 UART
uart還是要折騰一下的桨嫁,先上兩篇文檔:
1. 官方說明
2. 針腳定義
2. 樹莓派有兩個串口植兰,據說性能有差別,有需要可以交換串口
==>可以通過raspi-config(強烈建議)命令配置璃吧,或者手動配置
1. 串口的console禁用掉楣导,在/boot/cmdline.txt,刪掉刪除線的部分:
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1
root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes
rootwait
2. 在/boot/config.txt 中加入 enable_uart=1
==>編程推薦wiring pi :sudo apt-get install wiringpi 即可
1.8 ffmpeg
https://yq.aliyun.com/articles/367741
https://blog.csdn.net/zz531987464/article/details/100087755
udp? https://blog.csdn.net/big_wong/article/details/79240087
最后的命令
//raspivid -t 0 -w 1280 -h 720 -fps 20 -o - | nc -k -l 8090
raspivid -o - -t 0 -vf -hf -w 640 -h 480 -fps 25 -b 500000 | nc -k -l 8090
ffmpeg? -i tcp://127.0.0.1:8090 -vcodec copy -f h264 udp://127.0.0.1:8091 -vcodec copy -f h264 udp://127.0.0.1:8092
ffmpeg -re -i udp://127.0.0.1:8092 -vcodec copy -strict experimental -f flv rtmp://192.168.31.150:1935/live/10056496867160040390829
ffmpeg -re -i udp://127.0.0.1:8091 -vcodec copy -f segment -segment_time 5 -segment_format flv "/home/pi/file/%03d.flv"
試試用服務器
https://blog.csdn.net/luotong86/article/details/79113047
https://www.cnblogs.com/qiantuo1234/p/6611845.html
最新 apt 安裝libnginx-mod-rtmp
https://aaronparecki.com/2020/09/07/7/raspberry-pi-streaming-server#:~:text=%20How%20to%20make%20an%20RTMP%20Streaming%20Server,boot%20it%20up%20it%20will%20take...%20More%20
踩坑:編譯安裝pcre 畜挨,編譯安裝openssl 1.1.0筒繁,apt 安裝zlib
1.9 內核編譯
https://blog.csdn.net/Groot_Lee/article/details/105333542
http://www.shumeipai.net/thread-20933-1-1.html
https://blog.csdn.net/wxh0000mm/article/details/88567468
加速
https://hub.fastgit.org/raspberrypi/linux
使用make bcm2709_defconfig 生成 .config?
部分編譯 https://blog.csdn.net/liuxiao19890212/article/details/98766917?utm_medium=distribute.pc_relevant_bbs_down.none-task-blog-baidujs-1.nonecase&depth_1-utm_source=distribute.pc_relevant_bbs_down.none-task-blog-baidujs-1.nonecase