嵌入式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 ]# 


目录
相关文章
|
1月前
|
前端开发 Java 编译器
阿里巴巴生态应用在Arm平台性能优化实践
本次方案的主题是阿里巴巴生态应用在 Arm 平台性能优化实践,分别从背景介绍、编译优化实践、总结和展望三个方面介绍了本主题。 1. 背景介绍 2. 编译优化实践 3. 总结和展望
|
1月前
|
机器学习/深度学习 边缘计算 PyTorch
PyTorch团队为TorchAO引入1-8比特量化,提升ARM平台性能
PyTorch团队推出创新技术,在其低精度计算库TorchAO中引入低位运算符支持,实现1至8位精度的嵌入层权重量化及8位动态量化激活的线性运算符。该技术通过模块化设计和高效硬件利用,优化了资源受限环境下的深度学习计算,提升了计算效率并降低了资源消耗。新内核与PyTorch生态系统无缝集成,支持即时执行、编译优化及边缘计算,为开发者提供全方位性能优势。测试结果显示,多层次量化策略显著提升了计算效率,保持了模型精度。这一突破为深度学习框架优化开辟了多个研究方向,推动了人工智能在边缘计算等领域的广泛应用。
86 11
PyTorch团队为TorchAO引入1-8比特量化,提升ARM平台性能
|
4月前
|
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开发知识可参考相关书籍。
144 0
FFmpeg开发笔记(五十九)Linux编译ijkplayer的Android平台so库
|
5月前
|
存储 Linux 开发工具
如何进行Linux内核开发【ChatGPT】
如何进行Linux内核开发【ChatGPT】
|
6月前
|
Web App开发 Linux 数据安全/隐私保护
Linux curl命令详解
Linux curl命令详解
|
6月前
|
Java Linux API
Linux设备驱动开发详解2
Linux设备驱动开发详解
71 6
|
6月前
|
消息中间件 算法 Unix
Linux设备驱动开发详解1
Linux设备驱动开发详解
80 5
|
6月前
|
编解码 安全 Linux
基于arm64架构国产操作系统|Linux下的RTMP|RTSP低延时直播播放器开发探究
这段内容讲述了国产操作系统背景下,大牛直播SDK针对国产操作系统与Linux平台发布的RTMP/RTSP直播播放SDK。此SDK支持arm64架构,基于X协议输出视频,采用PulseAudio和Alsa Lib处理音频,具备实时静音、快照、缓冲时间设定等功能,并支持H.265编码格式。此外,提供了示例代码展示如何实现多实例播放器的创建与管理,包括窗口布局调整、事件监听、视频分辨率变化和实时快照回调等关键功能。这一技术实现有助于提高直播服务的稳定性和响应速度,适应国产操作系统在各行业中的应用需求。
181 3
|
7月前
|
JSON Java Linux
linux 命令使用总结:vim,nohup,find,df,du,sudo,netstat,ll,curl,lastlog
linux 命令使用总结:vim,nohup,find,df,du,sudo,netstat,ll,curl,lastlog
88 5