博客首页 注册 建议与交流 排行榜 加入友情链接
推荐 投诉 搜索: 帮助

JordonWu's Blog

  jordonwu.cublog.cn

关于作者
姓名:
职业:
年龄:
位置:
个性介绍:大部分文章是本人
学习过程中收集于网络上各位
大侠高人的文章,如有侵权请
来信告知,我将会尽快删除。
谢谢!!
|| << >> ||
我的分类


busybox 配置错误的解决方法
busybox 配置错误的解决方法
2007-07-26 11:04
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


Reference:
http://linux.chinaunix.net/bbs/redirect.php?tid=893445&goto=lastpost
http://my.opera.com/Returner/blog/show.dml/380818


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



 原文地址 http://hi.baidu.com/zkheartboy/blog/item/7fe73e3420158a395ab5f53a.html
发表于: 2007-11-15,修改于: 2007-11-15 13:02,已浏览267次,有评论0条 推荐 投诉


网友评论
 发表评论