Android版busybox编译

1下载busybox源码

2解压

tar -xvf busybox-1.23.2.tar.bz2

3 android版的配置脚本

解压后的源码里,configs文件压有android版本的配置脚本:

android2_defconfig       android_defconfig        android_ndk_defconfig

我选用的是android2_defconfig

4编译arm版busybox

1)export arm的编译工具:

export PATH=$PATH:/xxx/yyy/android_source/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6/bin

2)修改编译工具

打开android2_defconfig

CONFIG_CROSS_COMPILER_PREFIX=" arm-eabi-"

改为

CONFIG_CROSS_COMPILER_PREFIX="arm-linux-androideabi-"

3)修改sysroot路径

由于arm-linux-androideabi-4.6目录下没有sysroot目录,因此需要指定,否则编译时会出现找不到一些头文件的错误,如:

include/platform.h:141:20: fatal error:limits.h: No such file or directory

compilation terminated.

make[1]: *** [applets/applets.o]错误1

make: *** [applets_dir]错误2

打开android2_defconfig

在CONFIG_CROSS_COMPILER_PREFIX下再添加一行:

CONFIG_SYSROOT=":/xxx/yyy/android_source/prebuilts/ndk/android-ndk-r7/platforms/android-14/arch-arm"

或者是在make android2_defconfig之后,进入配置选项里改,其位置是在:

Busybox Settings  --->

BuildOptions  --->

()  Path to sysroot (NEW)

4)编译

make android2_defconfig        //选项编译脚本

make       //开始编译

5编译mips版busybox

1)export mips的编译工具:

export PATH=$PATH:/xxx/yyy/android_source/prebuilts/gcc/linux-x86/mips/mipsel-linux-android-4.7/bin

2)修改编译工具

打开android2_defconfig

CONFIG_CROSS_COMPILER_PREFIX="arm-eabi-"

改为

CONFIG_CROSS_COMPILER_PREFIX="mipsel-linux-android-"

3)修改sysroot路径

mipsel-linux-android-4.7目录下已包含sysroot目录,不需要修改,默认就行。

4)编译

make android2_defconfig        //选项编译脚本

make       //开始编译

6编译异常

编译时会出现几次错误,处理原则是将该错误对应的工具选项关闭,实际上很多工具用不上,如果确实需要,才对错误进行修复。

下面是几个错误的处理过程:

Error:

coreutils/touch.c: In function'touch_main':

coreutils/touch.c:171:21: error: 'lutimes'undeclared (first use in this function)

coreutils/touch.c:171:21: note: eachundeclared identifier is reported only once for each function it appears in

make[1]: *** [coreutils/touch.o]错误1

make: *** [coreutils]错误2

Solution:

从coreutils/touch.c可看出是core utils里的touch工具出问题,所以进入编译选项coreutiles将touch的选项的勾去掉。如下:

make menuconfig  //配置编译选项

Coreutils --->

[*]touch

将touch去掉,然后退出保存,再继续编译。

Error:

networking/udhcp/dhcpc.c: In function'udhcp_recv_raw_packet':

networking/udhcp/dhcpc.c:852:24: error: invalidapplication of 'sizeof' to incomplete type 'struct tpacket_auxdata'

networking/udhcp/dhcpc.c:915:26: error:'PACKET_AUXDATA' undeclared (first use in this function)

networking/udhcp/dhcpc.c:915:26: note: eachundeclared identifier is reported only once for each function it appears in

networking/udhcp/dhcpc.c:922:11: error:dereferencing pointer to incomplete type

networking/udhcp/dhcpc.c:852:16: warning:unused variable 'cmsgbuf' [-Wunused-variable]

networking/udhcp/dhcpc.c: In function'udhcp_raw_socket':

networking/udhcp/dhcpc.c:1050:33: error:'PACKET_AUXDATA' undeclared (first use in this function)

make[1]: *** [networking/udhcp/dhcpc.o]错误1

make: *** [networking/udhcp]错误2

Solution:

去掉:

Networking Utilities  --->

[*]udhcp client (udhcpc)

Error:

libbb/lib.a(pw_encrypt.o): In function`pw_encrypt':

pw_encrypt.c:(.text.pw_encrypt+0x10):undefined reference to `crypt'

libbb/lib.a(replace.o): In function`xmalloc_substitute_string':

replace.c:(.text.xmalloc_substitute_string+0xa8):undefined reference to `mempcpy'

replace.c:(.text.xmalloc_substitute_string+0xbc):undefined reference to `mempcpy'

collect2: error: ld returned 1 exit status

make: *** [busybox_unstripped]错误1

Solution:

Crypt错误改起来麻烦,就直接将libbb/ pw_encrypt.c里的crypt(clear, salt);摒蔽掉了。

libbb/replace.c则将mempcpy改为memcpy

然后编译就通过了,并在源码根目录下产生busybox,如果只是要提取busybox里的某个工具,则继续下面的编译。

7编译出工具包

将Don't use/usr选项勾上,会将工具包编出到源码根目录下。

make menuconfig  //配置编译选项

Busybox Settings  --->

GeneralConfiguration  --->

[*]Don't use /usr

make //开始编译

编译完成后会生成_install文件夹,里面有各种工具文件。

android+busybox+编译,Android版busybox编译相关推荐

  1. 编译小米android系统软件,为Android加入busybox工具之小米(开发版本)

    本人用的手机是小米,某次发现Android的adb下有很多命令不能实现,所以加入busybox. 2.下载arm-none-linux-gnueabi-gcc编译工具,并且导入到环境变量中 expor ...

  2. android 编译busybox,给android添加busybox

    默认状况下,android使用的是精简的toolbox工具,相对习惯了busybox的朋友来讲,使用toolbox 简直没法忍受.网上介绍了一些移植busybox到android平台的文章,可是用起来 ...

  3. openssl库android版的编译

    今天在编译andorid版libevent最新版2.1.6时报错can not find opensll,作为初次编译的新手,一头雾水啊,后幸得公司大神CTO的指点,需要android 版本的open ...

  4. windows 环境下,编译android 版opencv-4.5.5,并添加opencv_contrib-4.5.5 扩展模块

    参考博客:(130条消息) windows10 vs2019 版本:cmake将 opencv_contrib-4.5.5 扩展模块编译添加到 opencv-4.5.5 正式版中_Chhjnavy的博 ...

  5. win7下编译android版ffmpeg

    参考: http://www.roman10.net/how-to-build-ffmpeg-with-ndk-r9/ ffmpeg用的是2.3.2版本. 困扰了很久,终于使用参考链接里的脚本成功编译 ...

  6. 高通Android智能平台环境搭建_编译流程分析

    高通Android智能平台环境搭建_编译流程分析 高通平台环境搭建,编译,系统引导流程分析 TOC \o \h \z \u 1. 高通平台android开发总结. 7 1.1 搭建高通平台环境开发环境 ...

  7. 【Android 插件化】DroidPlugin 编译运行 ( DroidPlugin 简介 | 编译 DroidPlugin 官方示例 | 运行 DroidPlugin 官方示例 )

    文章目录 一.DroidPlugin 简介 二.DroidPlugin 编译运行 1.编译 DroidPlugin 官方示例 2.运行 DroidPlugin 官方示例 一.DroidPlugin 简 ...

  8. 《深入解析Android 虚拟机》——第1章,第1.3节编译Android源码

    本节书摘来自异步社区<深入解析Android 虚拟机>一书中的第1章,第1.3节编译Android源码,作者 钟世礼,更多章节内容可以访问云栖社区"异步社区"公众号查看 ...

  9. 编译Android VNC Server

    1,在如下地址checkout源代码,我checkout的版本为0.9.7 http://code.google.com/p/android-vnc-server/source/checkout 2, ...

最新文章

  1. FLASH基础概念 [一]
  2. python语言的官方网站地址-字符串中的街道地址搜索-Python或Ruby
  3. Android—— ScrollView 与 ListView 滑动冲突处理
  4. 5分钟教你写出一份完美的PRD文档(附案例)
  5. 【VS开发】C++线程安全
  6. 关于prefrenceactivity和preferencefragment的作用
  7. C#基础——C#入门
  8. Hibernate单表开发步骤
  9. struts json序列化遇上replaceAll就出问题
  10. 洛谷P2134 百日旅行
  11. Java Socket分发服务负载均衡
  12. GitHub的SSH免密连接
  13. OpenSSL生成root CA及签发证书
  14. 「leetcode」18. 四数之和:双指针法
  15. node.js历史版本下载安装
  16. 怎么在PDF中插入文本框并输入文字?
  17. JavaScript实现的转盘抽奖html页面前端源码
  18. 为什么天下布魔维护服务器进不去,2017年3月9日服务器停机维护公告
  19. 智能小车项目之L9110前后左右控制小车
  20. 我所理解的开源软件供应链安全

热门文章

  1. cache_purge php
  2. Linux 下搭建 php 开发环境完整教程
  3. qpython3可视图形界面_PySide——Python图形化界面入门教程(三)
  4. linux的lnmp环境,Ubuntu 16.04 LTS下LNMP环境配置简述
  5. C语言编程序输出SCHAR_MAX的,运用堆栈把十进制变换成二进制
  6. 你真的认真想过了吗?
  7. 小程序开发学习(4)---天气预报接口API篇
  8. android 自定义菜单开发,Android开发学习笔记:浅谈3大类菜单
  9. 【论文阅读】A Gentle Introduction to Graph Neural Networks [图神经网络入门](6)
  10. 关于计算机英语手抄报全国一等奖,英语手抄报:Walking to School