Skip navigation.

Fat R笔记……与减肥无关

Fat awful terrible Rubbish-bin

Ncurses 与 bash的交叉编译

,

目录/LX-SIS是用nfs export给狗剩NC作为root目录使用的。两个东西的编译步骤如下:

Ncurses-5.5:
#./configure --build=i686-linux --host=mipsel-linux --prefix=/LX-SIS/usr
#make BUILD_CC=gcc
#make install
(安装到/LX-SIS/usr)
#make install --prefix=/opt/crosstool-godson/mipsel-linux
(/opt/crosstool-godson是交叉编译工具链的目录,这里安装多一份给工具链用)
#cd /opt/crosstool-godson/mipsel-linux/lib
#ln -s libncurses.a libcurses.a
#cd /LX-SIS/usr/lib
#ln -s libncurses.a libcurses.a
#cd /LX-SIS
#mkdir /LX-SIS
#cd LX-SIS
#ln -s ../usr usr

bash-2.05a:
#ac_cv_sys_restartable_syscalls=yes \
ac_cv_func_setvbuf_reversed=yes \
./configure --build=i686-linux --host=mipsel-linux --enable-readline --enable-static-link --with-curses --prefix=/LX-SIS/usr
#make
#make install prefix=/LX-SIS/usr (直接make install也可以)
#cd /LX-SIS/bin
#ln -s ../usr/bin/bash sh


参考资料:
Linux From Scratch ver. 20021030
http://www.ailis.de/~k/docs/crosscompiling/#bash
以及这个网页
http://www.openqnx.com/index.php?name=PNphpBB2&file=printview&t=1585&start=0

Ncurses的编译遇到了一些麻烦,刚开始我用的是5.3,总是编译出错,后来换了5.5就好使了
刚开始make完后只是make install,然后就跑去编译bash,理所当然地出现了ncurses库不存在的错误提示。因为这只是安装到了狗剩的本地开发环境里,也就是说,在狗剩上进行本地编译应该是没有问题的,但在我的P4上交叉编译就不行了,因为没有安装到我的交叉编译工具链里。所以要安装多一份:
#make install --prefix=/opt/crosstool-godson/mipsel-linux
#cd /opt/crosstool-godson/mipsel-linux/lib
#ln -s libncurses.a libcurses.a

这样,再去编译bash就没问题了
然而bash编译完(bash在交叉编译时需要修改makefile.in,可以参考上面提到的参考资料),在狗剩上运行的时候,执行clear会提示Unknown terminal type。google了一下,是terminfo的问题
在狗剩上
#TERMINFO=/usr/lib/terminfo clear

可以实现clear,或者一了百了地在/LX-SIS/etc/rc.d里加上
#export TERMINFO=/usr/lib/terminfo

看起来问题似乎是clear那个程序找不到terminfo文件造成的
之前被网上的一些文章误导,试着在opt等目录下建立符号链接,都解决不了
后来想想,因为clear是编译Ncurses的时候生成的,会不会是--prefix参数把terminfo的位置编译到clear中了呢?交叉编译的时候指定的目录是/LX-SIS/usr,然而在狗剩上运行时,/LX-SIS变成了root,也就是说/LX-SIS/usr变成了/usr,但clear仍然是在/LX-SIS/usr/lib/terminfo下面找terminfo文件,自然就找不到了
于是,在LX-SIS下面创建一个符号链接
#cd /LX-SIS
#mkdir /LX-SIS
#cd LX-SIS
#ln -s ../usr usr

这样,在狗剩下,就有一个/LX-SIS/usr目录了,而这个目录实际上是链接到/usr下面的
再到狗剩下试试,已经没有问题了
这种方法感觉有些龌龊,不过我懒得研究chroot之类的东西了,龌龊就龌龊了点,Stupid但是Simple嘛

JavaMagic的更新纯粹是体力活openssh的交叉编译

How to use Quote function:

  1. Select some text
  2. Click on the Quote link

Write a comment

Comment
(BBcode and HTML is turned off for anonymous user comments.)

If you can't read the words, press the small reload icon.


Smilies