免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1444 | 回复: 0
打印 上一主题 下一主题

busybox 配置错误的解决方法  [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-06-17 09:27 |只看该作者 |倒序浏览
1. 如何編譯2. 常見問題
- 如何將 busybox 編譯成 static linking
- make menuconfig 出現下列錯誤
In file included from scripts/kconfig/lxdialog/checklist.c:24:
環境
glibc-2.4-7mdv2007.0
gcc-4.1.1-3mdk
make-3.81-1mdv2007.0
binutils-2.16.91.0.7-3mdv2007.0
1. 如何編譯
- 先編一個 .config 之後備用
$ make defconfig
- 用 make menuconfig 選單方式方便選取
$ make menuconfig
一些參考選項
Init Utilities 下:
  init
  這個選上,用busybox來初始化系統。
  debugging aid
  這個會在使用inittab初始化時顯示額外的信息,我沒選
Login/Password Management Utilities下:
  Use internal password and group functions rather than system functions
  這個如果不選上,busybox會認不了lib下的libnss,然後解析不了uid...
Shells下:
  選擇ash
  Job control
  這個選上(雖然在/dev/console下用不了——直接造成不能ctrl+c,這是最鬱悶的)
  Standalone shell
  不選。很奇怪,選上後PATH這個環境變量似乎就無效了-.-
  Command line editing
- 編譯
$ make
- 驗證需要哪些 liberary
# ldd busybox
linux-gate.so.1 => (0xbfffe000)
libcrypt.so.1 => /lib/libcrypt.so.1 (0xb7ece000)
libm.so.6 => /lib/i686/libm.so.6 (0xb7ea9000)
libc.so.6 => /lib/i686/libc.so.6 (0xb7d7c000)
/lib/ld-linux.so.2 (0xb7f0b000)
2. 常見問題
- 如何將 busybox 編譯成 static linking
Busybox Settings -> Build Options 下:
  Build BusyBox as a static binary (no shared libs)
$ make 
會遇到
applets/applets.c:20:2: error: #warning Static linking against glibc produces buggy executables
applets/applets.c:21:2: error: #warning (glibc does not cope well with ld --gc-sections).
applets/applets.c:22:2: error: #warning See sources.redhat.com/bugzilla/show_bug.cgi?id=3400
applets/applets.c:23:2: error: #warning Note that glibc is unsuitable for static linking anyway.
applets/applets.c:24:2: error: #warning If you still want to do it, remove -Wl,--gc-sections
applets/applets.c:25:2: error: #warning from top-level Makefile and remove this warning.
make[1]: *** [applets/applets.o] Error 1
這個警告的定義在applets/applets.c中,將這段警告註釋掉就可以了。
這段的意思就是告訴你最好用uclibc編譯,而不用glibc因為glibc比較大,busybox在寸土寸金的內嵌系統中運用比較多,所以會有這樣的要求。
編輯 ~/applets/applets.c , 將警告註解掉即可 (第 20-25 行)
...
/*
#if ENABLE_STATIC && defined(__GLIBC__) && !defined(__UCLIBC__)
#warning Static linking against glibc produces buggy executables
#warning (glibc does not cope well with ld --gc-sections).
#warning See sources.redhat.com/bugzilla/show_bug.cgi?id=3400
#warning Note that glibc is unsuitable for static linking anyway.
#warning If you still want to do it, remove -Wl,--gc-sections
#warning from top-level Makefile and remove this warning.
#endif
*/
...
接下來在進行編譯即可
$ make clean; make
驗證是否為 static linking
$ ldd ./busybox
not a dynamic executable
- make menuconfig 出現下列錯誤
...
In file included from scripts/kconfig/lxdialog/checklist.c:24:
scripts/kconfig/lxdialog/dialog.h:31:20: error: curses.h: No such file or directory
In file included from scripts/kconfig/lxdialog/checklist.c:24:
scripts/kconfig/lxdialog/dialog.h:128: error: syntax error before 'use_colors'
scripts/kconfig/lxdialog/dialog.h:128: warning: type defaults to 'int' in declaration of 'use_colors'
scripts/kconfig/lxdialog/dialog.h:128: warning: data definition has no type or storage class
scripts/kconfig/lxdialog/dialog.h:129: error: syntax error before 'use_shadow'
...
原因為缺少 ncurses devel 套件 (name "libncurses5-dev" in Ubuntu),安裝後即可
$ sudo apt-get install libncurses5-dev
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u3/97105/showart_1966645.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP