日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > Android >内容正文

Android

android+busybox+编译,Android版busybox编译

發布時間:2023/12/15 Android 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 android+busybox+编译,Android版busybox编译 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

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编译的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。