2014年4月10日 星期四

[Embedded] Compiler Qemu on Mipsel board

嘗試使用廠商提供的toolchain來Compiler Qemu,發生如一堆問題,如

a. toolchain don't support
ERROR: User requested feature nptl
                configure was not able to find it 

b. 缺少 net header
...  warning: ifaddrs.h: No such file or directory
or
... undefined reference to `getifaddrs`
or
... undefined reference to `freeifaddrs` 

c. 缺少 library
pixman / gettext / libiconv / glib / uclibc ......

如果你的tool chain缺少如此多的library,我想最快的解決方法應該是rebuild tool chain。Qemu非常依賴uClibc的版本,所以選擇buildroot (uClibc官網建議)來做 tool chain。

1. buildroot-2014.02  (備份)
wget http://buildroot.uclibc.org/downloads/buildroot-2014.02.tar.bz2

tar -jxvf buildroot-2014.02.tar.bz2

cd buildroot-2014.02

make qemu_mipsel_malta_defconfig

make menuconfig ( See : 2. Set .config )

make (若發生found not mipsel-linux-pkg-config , then See : 4. Note )


2.  Set .config (備份)
  • [Target options] -> [ Target Architecture (MIPS (little endian))
  • [Target options] -> [ Target Architecture Variant (mips 32r2) ]
  • [Toolchain] ->
    • <*> Enable large file (files >  2 GB) support
    • <*> Enable IPv6 support
    • <*> Enable WCHAR support
    • [Thread library implementation (Native POSIX Threading (NPTL))]
  • [Target packages] -> [Libraries] ->
    •  [Compression and decompression] ->
      • <*> zlib
    •  [Graphics] ->
      • <*> pixman
    •  [Networking] ->
      • <*> glib-networking

3. build qemu-1.7.0 (備份)
tar -jxvf qemu-1.7.0.tar.bz2

cd qemu-1.7.0

./configure  --cross-prefix=/opt/buildroot-2014.02/output/host/usr/bin/mipsel-linux-  --prefix=/home/qemu-mipsel

make; make install


4. Note : 直接使用x86 pkg-config即可 ( Ex : ln -s /usr/bin/pkg-config /opt/buildroot-2014.02/output/host/usr/bin/mipsel-linux-pkg-config )

Reference:
[1] uClibc
[2] buildroot
[2] qemu

沒有留言:

張貼留言