Fat R笔记……与减肥无关

Fat awful terrible Rubbish-bin

openssh的交叉编译

,

这个有点麻烦……而且我不太确定到底搞定没有,因为狗剩台机的网络接口坏掉了。。。 反正程序是编译出来了,姑且当它成功吧……

  openssh需要先安装Zlib和OpenSSL。首先说说Zlib的安装。这东西俺在上古时期在MS-DOS下编译过,还算简单,不过现在要交叉编译,所以还是得做一些工作。首先是config:
./configure --prefix=/LX-SIS/usr

然后修改Makefile:
CC=gcc
-->
CC=mipsel-linux-gcc
 
CFLAGS=-O3 -DUSE_MMAP
-->
CFLAGS= -mtune=r4600 -mips2 -O3 -DUSE_MMAP
 
LDSHARED=gcc
CPP=gcc -E
-->
LDSHARED=mipsel-linux-gcc
CPP=mipsel-linux-gcc -E


AR和RANLIB可以不改(用x86下面的ar好像也可以得到libz.a文件)。然后make,再make install。然后把/LX-SIS/usr/lib和/LX-SIS/usr/include下面的东西分别复制到/opt/crosstool-godson/mipsel-linux/lib和/opt/crosstool-godson/mipsel-linux/include(其实也就是libz.a zconf.h zlib.h三个文件)。这样Zlib算是搞定了。

  接下来是openssl。用./Configure可以看到一堆编译平台,不过似乎没有哪个比较合适,还是自己来吧,手工加上一个"linux-mipsel"平台。修改Configure,在my %table=(里面加入一行:
"linux-mipsel", "mipsel-linux-gcc:-mtune=r4600 -mips2 -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl::${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",

保存后,执行:
./Configure linux-mipsel no-asm zlib --prefix=/LX-SIS/usr

(或者先make TABLE,然后看看TABLE文件里面的变量有没问题)
然后make , make install(因为生成的文件不能在x86下运行,所make test没啥意义),把lib和include复制一份到交叉编译工具链里(复制include用cp -a --reply=yes openssl/ /opt/crosstool-godson/mipsel-linux/include/),搞定。

  openssh的脚本对交叉编译支持比较好,首先config:
./configure --build=i686-linux --host=mipsel-linux --prefix=/LX-SIS/usr

如果直接make,会出现In function `dlfcn_load'之类的错误,我在这个网页
http://if.ustc.edu.cn/~zhouwei/tech/archives/2006_01.html
找到了解决方法,就是在Makefile的LIBS=里加上-ldl,添加链接libdl这个库,然后make,就没有问题了。
  接着make install……嗯,出现了strip错误。可以在configure后面加--disable-strip关掉strip功能,或者在Makefile里把STRIP_OPT=-s改成STRIP_OPT=,然后再make install……没有strip过体积虽然大了点,不过懒得研究了-.-(好像在Makefile里指定STRIP=mipsel-linux-strip,并export都不行,搞不懂……)然后make install,出现无法执行ssh-keygen的错误,这就没办法了,只好等狗剩的网络端口正常了才能继续了……

Ncurses 与 bash的交叉编译被这破开发板郁闷了两天...

Comments

Unregistered user Monday, January 10, 2011 2:48:12 AM

Wick writes: strip问题的解决 install 用 --strip-program 来指定strip程序 因此更改配置即可 STRIP_OPT=-s --strip-program=arm-linux-strip

Write a comment

New comments have been disabled for this post.