嵌入式Linux开发: 移植curl到arm平台(Tiny4412)

简介: 嵌入式Linux开发: 移植curl到arm平台(Tiny4412)

一、环境介绍

宿主机: Redhat 6.3  32位


目标开发板型号: 友善之臂Tiny4412


目标开发板操作系统:  使用busybox制作,内核使用官方3.5内核。


使用的编译器版本:  友善之臂光盘里自带的交叉编译器版本4.5.1


二、编译移植curl

  curl命令是利用URL语法在命令行下工作的文件传输工具,1997年首次发行,常用来请求 Web 服务器----可以看做是基于命令行运行的浏览器。它的名字就是客户端(client)的 URL 工具的意思。


它的功能非常强大,命令行参数多达几十种。它支持文件上传和下载,所以是综合传输工具,但按传统,习惯称cURL为下载工具,cURL还包含了用于程序开发的libcurl库,可以直接使用C语言调用。


cURL支持的通信协议有FTP、FTPS、HTTP、HTTPS、TFTP、SFTP、Gopher、SCP、Telnet、DICT、FILE、LDAP、LDAPS、IMAP、POP3、SMTP和RTSP。


curl还支持SSL认证、HTTP POST、HTTP PUT、FTP上传, HTTP form based upload、proxies、HTTP/2、cookies、用户名+密码认证(Basic, Plain, Digest, CRAM-MD5, NTLM, Negotiate and Kerberos)、file transfer resume、proxy tunneling。



2.1 下载源代码

源码下载地址:  https://curl.haxx.se/download.html

image.png

2.2 curl使用介绍

 参考文章:  https://blog.csdn.net/xiaolong1126626497/article/details/108980098

2.3 交叉编译curl

[wbyq@wbyq work]$ tar xvf /mnt/hgfs/linux-share-dir/curl-7.73.0.tar.gz 
[wbyq@wbyq work]$ cd curl-7.73.0/
[wbyq@wbyq curl-7.73.0]$ ./configure --prefix=$PWD/_install --host=arm-linux CC=arm-linux-gcc CXX=arm-linux-g++
[wbyq@wbyq curl-7.73.0]$ make && make install

2.4 部署开发板运行环境

编译成功之后,将install目录下的lib和bin目录下的文件拷贝到开发板的对应目录下即可。    

[wbyq@wbyq curl-7.73.0]$ cd _install/
[wbyq@wbyq _install]$ ls
bin  include  lib  share
[wbyq@wbyq _install]$ cp bin/* /home/wbyq/work/rootfs/bin/
[wbyq@wbyq _install]$ cp lib/*.so* /home/wbyq/work/rootfs/lib/

2.5 测试curl命令

开发板上运行测试:

image.png

使用curl命令访问百度首页: (注意: 要访问网页或者下载文件,当前开发板的网卡要先连接网络,比如使用小米随身WIFI先连接手机热点,保证能上网)

[root@wbyq ]# ls
bin         etc         linuxrc     nfs.sh      root        sys         var
code        home        lost+found  opt         rootfs      tmp         work
dev         lib         mnt         proc        sbin        usr
[root@wbyq ]# curl www.baidu.com
<!DOCTYPE html>
<!--STATUS OK--><html> <head><meta http-equiv=content-type content=text/html;charset=utf-8><meta http-equiv=X-UA-Compatible content=IE=Edge><meta content=always name=referrer><link rel=stylesheet type=text/css href=http://s1.bdstatic.com/r/www/cache/bdorz/baidu.min.css><title>百度一下,你就知道</title></head> <body link=#0000cc> <div id=wrapper> <div id=head> <div class=head_wrapper> <div class=s_form> <div class=s_form_wrapper> <div id=lg> <img hidefocus=true src=//www.baidu.com/img/bd_logo1.png width=270 height=129> </div> <form id=form name=f action=//www.baidu.com/s class=fm> <input type=hidden name=bdorz_come value=1> <input type=hidden name=ie value=utf-8> <input type=hidden name=f value=8> <input type=hidden name=rsv_bp value=1> <input type=hidden name=rsv_idx value=1> <input type=hidden name=tn value=baidu><span class="bg s_ipt_wr"><input id=kw name=wd class=s_ipt value maxlength=255 autocomplete=off autofocus></span><span class="bg s_btn_wr"><input type=submit id=su value=百度一下 class="bg s_btn"></span> </form> </div> </div> <div id=u1> <a href=http://news.baidu.com name=tj_trnews class=mnav>新闻</a> <a href=http://www.hao123.com name=tj_trhao123 class=mnav>hao123</a> <a href=http://map.baidu.com name=tj_trmap class=mnav>地图</a> <a href=http://v.baidu.com name=tj_trvideo class=mnav>视频</a> <a href=http://tieba.baidu.com name=tj_trtieba class=mnav>贴吧</a> <noscript> <a href=http://www.baidu.com/bdorz/login.gif?login&amp;tpl=mn&amp;u=http%3A%2F%2Fwww.baidu.com%2f%3fbdorz_come%3d1 name=tj_login class=lb>登录</a> </noscript> <script>document.write('<a href="http://www.baidu.com/bdorz/login.gif?login&tpl=mn&u='+ encodeURIComponent(window.location.href+ (window.location.search === "" ? "?" : "&")+ "bdorz_come=1")+ '" name="tj_login" class="lb">登录</a>');</script> <a href=//www.baidu.com/more/ name=tj_briicon class=bri style="display: block;">更多产品</a> </div> </div> </div> <div id=ftCon> <div id=ftConw> <p id=lh> <a href=http://home.baidu.com>关于百度</a> <a href=http://ir.baidu.com>About Baidu</a> </p> <p id=cp>&copy;2017&nbsp;Baidu&nbsp;<a href=http://www.baidu.com/duty/>使用百度前必读</a>&nbsp; <a href=http://jianyi.baidu.com/ class=cp-feedback>意见反馈</a>&nbsp;京ICP证030173号&nbsp; <img src=//www.baidu.com/img/gs.gif> </p> </div> </div> </div> </body> </html>
[root@wbyq ]# 

获取南昌未来7天的天气预报:

[root@wbyq ]# ls
bin         etc         linuxrc     nfs.sh      root        sys         var
code        home        lost+found  opt         rootfs      tmp         work
dev         lib         mnt         proc        sbin        usr
[root@wbyq ]# curl "http://api.k780.com:88/?app=weather.future&weaid=??&&appkey=
10003&sign=b59bc3ef6191eb9f747dd4e83c99f2a4&format=json"
{"success":"1","result":[{"weaid":"237","days":"2020-11-14","week":"星期六","cityno":"nanchang","citynm":"南昌","cityid":"101240101","temperature":"23℃/14℃","humidity":"0%/0%","weather":"晴","weather_icon":"http://api.k780.com/upload/weather/d/0.gif","weather_icon1":"http://api.k780.com/upload/weather/n/0.gif","wind":"东北风转北风","winp":"3-4级","temp_high":"23","temp_low":"14","humi_high":"0","humi_low":"0","weatid":"1","weatid1":"1","windid":"1","winpid":"1","weather_iconid":"0","weather_iconid1":"0"},{"weaid":"237","days":"2020-11-15","week":"星期日","cityno":"nanchang","citynm":"南昌","cityid":"101240101","temperature":"25℃/15℃","humidity":"0%/0%","weather":"晴","weather_icon":"http://api.k780.com/upload/weather/d/0.gif","weather_icon1":"http://api.k780.com/upload/weather/n/0.gif","wind":"东北风转北风","winp":"小于3级","temp_high":"25","temp_low":"15","humi_high":"0","humi_low":"0","weatid":"1","weatid1":"1","windid":"1","winpid":"0","weather_iconid":"0","weather_iconid1":"0"},{"weaid":"237","days":"2020-11-16","week":"星期一","cityno":"nanchang","citynm":"南昌","cityid":"101240101","temperature":"25℃/16℃","humidity":"0%/0%","weather":"晴转多云","weather_icon":"http://api.k780.com/upload/weather/d/0.gif","weather_icon1":"http://api.k780.com/upload/weather/n/1.gif","wind":"东北风转北风","winp":"小于3级","temp_high":"25","temp_low":"16","humi_high":"0","humi_low":"0","weatid":"1","weatid1":"2","windid":"1","winpid":"0","weather_iconid":"0","weather_iconid1":"1"},{"weaid":"237","days":"2020-11-17","week":"星期二","cityno":"nanchang","citynm":"南昌","cityid":"101240101","temperature":"27℃/22℃","humidity":"0%/0%","weather":"多云","weather_icon":"http://api.k780.com/upload/weather/d/1.gif","weather_icon1":"http://api.k780.com/upload/weather/n/1.gif","wind":"南风","winp":"小于3级转小于3级","temp_high":"27","temp_low":"22","humi_high":"0","humi_low":"0","weatid":"2","weatid1":"2","windid":"4","winpid":"0","weather_iconid":"1","weather_iconid1":"1"},{"weaid":"237","days":"2020-11-18","week":"星期三","cityno":"nanchang","citynm":"南昌","cityid":"101240101","temperature":"30℃/21℃","humidity":"0%/0%","weather":"多云转小雨","weather_icon":"http://api.k780.com/upload/weather/d/1.gif","weather_icon1":"http://api.k780.com/upload/weather/n/7.gif","wind":"南风转西南风","winp":"4-5级转4-5级","temp_high":"30","temp_low":"21","humi_high":"0","humi_low":"0","weatid":"2","weatid1":"8","windid":"4","winpid":"2","weather_iconid":"1","weather_iconid1":"7"},{"weaid":"237","days":"2020-11-19","week":"星期四","cityno":"nanchang","citynm":"南昌","cityid":"101240101","temperature":"26℃/16℃","humidity":"0%/0%","weather":"小雨转阴","weather_icon":"http://api.k780.com/upload/weather/d/7.gif","weather_icon1":"http://api.k780.com/upload/weather/n/2.gif","wind":"北风","winp":"3-4级","temp_high":"26","temp_low":"16","humi_high":"0","humi_low":"0","weatid":"8","weatid1":"3","windid":"8","winpid":"1","weather_iconid":"7","weather_iconid1":"2"},{"weaid":"237","days":"2020-11-20","week":"星期五","cityno":"nanchang","citynm":"南昌","cityid":"101240101","temperature":"22℃/21℃","humidity":"0%/0%","weather":"阴","weather_icon":"http://api.k780.com/upload/weather/d/2.gif","weather_icon1":"http://api.k780.com/upload/weather/n/2.gif","wind":"北风","winp":"4-5级","temp_high":"22","temp_low":"21","humi_high":"0","humi_low":"0","weatid":"3","weatid1":"3","windid":"8","winpid":"2","weather_iconid":"2","weather_iconid1":"2"}]}[root@wbyq ]# 


目录
相关文章
|
24天前
|
NoSQL Ubuntu Linux
Linux平台安装MongoDB
10月更文挑战第11天
29 5
|
22天前
|
Linux API 开发工具
FFmpeg开发笔记(五十九)Linux编译ijkplayer的Android平台so库
ijkplayer是由B站研发的移动端播放器,基于FFmpeg 3.4,支持Android和iOS。其源码托管于GitHub,截至2024年9月15日,获得了3.24万星标和0.81万分支,尽管已停止更新6年。本文档介绍了如何在Linux环境下编译ijkplayer的so库,以便在较新的开发环境中使用。首先需安装编译工具并调整/tmp分区大小,接着下载并安装Android SDK和NDK,最后下载ijkplayer源码并编译。详细步骤包括环境准备、工具安装及库编译等。更多FFmpeg开发知识可参考相关书籍。
67 0
FFmpeg开发笔记(五十九)Linux编译ijkplayer的Android平台so库
|
2月前
|
编解码 Linux 开发工具
Linux平台x86_64|aarch64架构RTMP推送|轻量级RTSP服务模块集成说明
支持x64_64架构、aarch64架构(需要glibc-2.21及以上版本的Linux系统, 需要libX11.so.6, 需要GLib–2.0, 需安装 libstdc++.so.6.0.21、GLIBCXX_3.4.21、 CXXABI_1.3.9)。
|
3月前
|
NoSQL Linux C语言
嵌入式GDB调试Linux C程序或交叉编译(开发板)
【8月更文挑战第24天】本文档介绍了如何在嵌入式环境下使用GDB调试Linux C程序及进行交叉编译。调试步骤包括:编译程序时加入`-g`选项以生成调试信息;启动GDB并加载程序;设置断点;运行程序至断点;单步执行代码;查看变量值;继续执行或退出GDB。对于交叉编译,需安装对应架构的交叉编译工具链,配置编译环境,使用工具链编译程序,并将程序传输到开发板进行调试。过程中可能遇到工具链不匹配等问题,需针对性解决。
|
3月前
|
编解码 算法 Linux
Linux平台下RTSP|RTMP播放器如何跟python交互投递RGB数据供视觉算法分析
在对接Linux平台的RTSP播放模块时,需将播放数据同时提供给Python进行视觉算法分析。技术实现上,可在播放时通过回调函数获取视频帧数据,并以RGB32格式输出。利用`SetVideoFrameCallBackV2`接口设定缩放后的视频帧回调,以满足算法所需的分辨率。回调函数中,每收到一帧数据即保存为bitmap文件。Python端只需读取指定文件夹中的bitmap文件,即可进行视频数据的分析处理。此方案简单有效,但应注意控制输出的bitmap文件数量以避免内存占用过高。
|
3月前
|
编解码 Linux 数据安全/隐私保护
Linux平台x86_64|aarch64架构如何实现轻量级RTSP服务
为满足在Linux平台(x86_64与aarch64架构)上实现轻量级RTSP服务的需求,我们开发了一套解决方案。该方案通过调用`start_rtsp_server()`函数启动RTSP服务,并设置端口号及认证信息。支持AAC音频和H.264视频编码,可推送纯音频、纯视频或音视频流。此外,还支持X11屏幕采集、部分V4L2摄像头采集、帧率/GOP/码率调整、摄像头设备选择与预览等功能。对于音频采集,支持alsa-lib和libpulse接口。整体设计旨在提供150-400ms的低延迟体验,适用于多种应用场景。
|
3月前
|
传感器 人工智能 网络协议
:嵌入式 Linux 及其用途
【8月更文挑战第24天】
162 0
|
3月前
|
编解码 Linux 开发工具
Linux平台x86_64(麒麟|统信UOS)|aarch64(飞腾)如何实现摄像头|屏幕和麦克风|扬声器采集推送RTMP服务或轻量级RTSP服务
国产化操作系统的发展,减少了外部依赖,更符合国家安全标准,并可提升自主研发能力,促进产业链发展,满足定制开发能力,减少了外部技术封锁的风险,提高了国际竞争力,推动了产业升级。目前大牛直播SDK针对Linux平台x86_64架构和aarch64架构的RTMP推送模块和轻量级RTSP服务模块
|
消息中间件 缓存 Unix
[面试必备]嵌入式Linux内核开发必须了解的三十道题
[面试必备]嵌入式Linux内核开发必须了解的三十道题
|
Linux
嵌入式Linux QT开发之如何实现获取磁盘空间大小的应用逻辑
嵌入式Linux QT开发之如何实现获取磁盘空间大小的应用逻辑
237 0