歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux編程 >> Linux編程

BusyBox 1.19.3編譯錯誤解決辦法

在busybox官網上或在 http://www.linuxidc.com/Linux/2011-08/40704.htm 上下載最新的busybox1.19.3,同時將補丁也打上。采用默認配置即:make defconfig 之後,采用make menuconfig 配置幾個重要的配置項目。同時修改交叉編譯器的環境:

ARCH            ?= arm
CROSS_COMPILE   ?= /usr/local/arm/3.3.2/bin/arm-linux-

之後,正式編譯busybox,哇嗚啊,出現了UBI的錯誤哦。

miscutils/ubi_tools.c:63:26: error: mtd/ubi-user.h: No such file or directory
miscutils/ubi_tools.c: In function 'ubi_tools_main':
miscutils/ubi_tools.c:133: error: 'UBI_DEV_NUM_AUTO' undeclared (first use in this function)
miscutils/ubi_tools.c:133: error: (Each undeclared identifier is reported only once
miscutils/ubi_tools.c:133: error: for each function it appears in.)
miscutils/ubi_tools.c:134: error: 'UBI_VOL_NUM_AUTO' undeclared (first use in this function)
miscutils/ubi_tools.c:153: error: storage size of 'req' isn't known
miscutils/ubi_tools.c:161: error: 'UBI_IOCATT' undeclared (first use in this function)
miscutils/ubi_tools.c:153: warning: unused variable 'req'
miscutils/ubi_tools.c:167: error: 'UBI_IOCDET' undeclared (first use in this function)
miscutils/ubi_tools.c:170: error: storage size of 'req' isn't known
miscutils/ubi_tools.c:177: error: 'UBI_MAX_VOLUME_NAME' undeclared (first use in this function)
miscutils/ubi_tools.c:184: error: 'UBI_STATIC_VOLUME' undeclared (first use in this function)
miscutils/ubi_tools.c:186: error: 'UBI_DYNAMIC_VOLUME' undeclared (first use in this function)
miscutils/ubi_tools.c:195: error: 'UBI_IOCMKVOL' undeclared (first use in this function)
miscutils/ubi_tools.c:170: warning: unused variable 'req'
miscutils/ubi_tools.c:201: error: 'UBI_IOCRMVOL' undeclared (first use in this function)
miscutils/ubi_tools.c:204: error: storage size of 'req' isn't known
miscutils/ubi_tools.c:214: error: 'UBI_IOCRSVOL' undeclared (first use in this function)
miscutils/ubi_tools.c:204: warning: unused variable 'req'
miscutils/ubi_tools.c:222: error: 'UBI_IOCVOLUP' undeclared (first use in this function)
make[1]: *** [miscutils/ubi_tools.o] 錯誤 1
make: *** [miscutils] 錯誤 2

出現這麼多的錯誤,核心問題就是出現在miscutils/ubi_tools.c:63:26: error: mtd/ubi-user.h: No such file or directory這個上面,無法找到mtd/ubi-user.h頭文件,查閱了相關資料後,原來這是一個Linux下新支持的UBI文件系統,需要手工加入。從Linux2.6.29的include\mtd\ubi-user.h拷貝到busybox下的include\mtd下,如果busybox下的include沒有mtd文件夾,那就先建立一個mtd文件夾,然後復制了。這樣做了之後,編譯就OK了。出現下面的信息就說明編譯成功了。

LINK    busybox_unstripped
Trying libraries: crypt m
 Library crypt is not needed, excluding it
 Library m is needed, can't exclude it (yet)
Final link with: m
  DOC     busybox.pod
  DOC     BusyBox.txt
  DOC     busybox.1
  DOC     BusyBox.html

之後就是安裝busybox了。make install 等一會就可以看到_install文件夾了。差不多300多MB啊。當然你可以根據自己的需要去裁剪busybox啊。見下面部分信息:

  ./_install//usr/sbin/ubimkvol -> ../../bin/busybox
  ./_install//usr/sbin/ubirmvol -> ../../bin/busybox
  ./_install//usr/sbin/ubirsvol -> ../../bin/busybox
  ./_install//usr/sbin/ubiupdatevol -> ../../bin/busybox
  ./_install//usr/sbin/udhcpd -> ../../bin/busybox


--------------------------------------------------
You will probably need to make your busybox binary
setuid root to ensure all configured applets will
work properly.

Copyright © Linux教程網 All Rights Reserved