在
http://wiki.ok-labs.com/Microkernel
arm-linux-gnueabi-4.2.4.tar.gz,sdk-xscale-3.0.tar.gz,Skyeye 1.2.1n和skyeye.conf,並按照tut-sdk-singlecell.pdf來操作, 並把
export PATH=$PATH:`pwd`/arm-unknown-linux-gnueabi/bin
進入singlecell目錄,執行make命令,得到如下錯誤:
make -C hello KERNEL=micro BUILD=debug make[1]: 進入目錄“/home/xuzhina/Downloads/singlecell/hello” cp hello.xml.in build.micro-debug/bin/hello.xml make[1]: arm-unknown-linux-gnueabi-gcc:命令未找到 arm-unknown-linux-gnueabi-ld -o build.micro-debug/bin/hello -Ttext=0x80000000 -L/home/xuzhina/Downloads/sdk/okl4/xscale/micro-debug/libs /home/xuzhina/Downloads/sdk/okl4/xscale/micro-debug/libs/crt0.o build.micro-debug/src/hello.o --start-group /home/xuzhina/Downloads/sdk/okl4/xscale/micro-debug/libs/libc.a /home/xuzhina/Downloads/sdk/okl4/xscale/micro-debug/libs/libokl4.a --end-group make[1]: arm-unknown-linux-gnueabi-ld:命令未找到 make[1]: *** [build.micro-debug/bin/hello] 錯誤 127 make[1]: 離開目錄“/home/xuzhina/Downloads/singlecell/hello” make: *** [hello/build.micro-debug/bin/hello.xml] 錯誤 2
arm-unknown-linux-gnueabi
並按TAB鍵,出現這樣的結果:
[xuzhina@localhost singlecell]$ arm-unknown-linux-gnueabi- arm-unknown-linux-gnueabi-addr2line arm-unknown-linux-gnueabi-gprof arm-unknown-linux-gnueabi-ar arm-unknown-linux-gnueabi-ld arm-unknown-linux-gnueabi-as arm-unknown-linux-gnueabi-nm arm-unknown-linux-gnueabi-c++ arm-unknown-linux-gnueabi-objcopy arm-unknown-linux-gnueabi-c++filt arm-unknown-linux-gnueabi-objdump arm-unknown-linux-gnueabi-cpp arm-unknown-linux-gnueabi-ranlib arm-unknown-linux-gnueabi-g++ arm-unknown-linux-gnueabi-readelf arm-unknown-linux-gnueabi-gcc arm-unknown-linux-gnueabi-size arm-unknown-linux-gnueabi-gcc-4.2.4 arm-unknown-linux-gnueabi-strings arm-unknown-linux-gnueabi-gccbug arm-unknown-linux-gnueabi-strip arm-unknown-linux-gnueabi-gcov
把上面的錯誤信息中一條命令拷貝出來執行一下,
arm-unknown-linux-gnueabi-ld -o build.micro-debug/bin/hello -Ttext=0x80000000 -L/home/xuzhina/Downloads/sdk/okl4/xscale/micro-debug/libs /home/xuzhina/Downloads/sdk/okl4/xscale/micro-debug/libs/crt0.o build.micro-debug/src/hello.o --start-group /home/xuzhina/Downloads/sdk/okl4/xscale/micro-debug/libs/libc.a /home/xuzhina/Downloads/sdk/okl4/xscale/micro-debug/libs/libokl4.a --end-group出現這樣的錯誤信息:
bash: /home/xuzhina/Downloads/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-ld: /lib/ld-linux.so.2: bad ELF interpreter: 沒有那個文件或目錄
那為什麼其它程序可以執行,比如/bin/ls?
先看一下arm-unknown-linux-gnueabi-ld和/bin/ls的類型:
[xuzhina@localhost singlecell]$ file /home/xuzhina/Downloads/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-ld /home/xuzhina/Downloads/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-ld: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.8, not stripped [xuzhina@localhost singlecell]$ file /bin/ls /bin/ls: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=0xec333a104e045327c5e3d0ca6dda16c610a210f3, stripped
可以看到,arm-unknown-linux-gnueabi-ld是32位的程序,/bin/ls是64位的程序。
但64位系統不是兼容運行32位程序嗎?難道64位程序的加載器不一樣。看一下兩者的ldd結果。
[xuzhina@localhost singlecell]$ ldd /bin/ls linux-vdso.so.1 => (0x00007fffbf1fe000) libselinux.so.1 => /lib64/libselinux.so.1 (0x00007fe71af3b000) libcap.so.2 => /lib64/libcap.so.2 (0x00007fe71ad36000) libacl.so.1 => /lib64/libacl.so.1 (0x00007fe71ab2c000) libc.so.6 => /lib64/libc.so.6 (0x00007fe71a76b000) libpcre.so.1 => /lib64/libpcre.so.1 (0x00007fe71a50a000) liblzma.so.5 => /lib64/liblzma.so.5 (0x00007fe71a2e4000) libdl.so.2 => /lib64/libdl.so.2 (0x00007fe71a0e0000) /lib64/ld-linux-x86-64.so.2 (0x00007fe71b178000) libattr.so.1 => /lib64/libattr.so.1 (0x00007fe719edb000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fe719cbe000) [xuzhina@localhost singlecell]$ ldd /home/xuzhina/Downloads/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-ld 不是動態可執行文件 [xuzhina@localhost singlecell]$ ls /lib/ld-linux.so.2 ls: 無法訪問/lib/ld-linux.so.2: 沒有那個文件或目錄
那麼,ld-linux.so.2是在哪個軟件包呢,由於我的系統是centos 7,所以,我從rpmfind.net知道ld-linux.so.2屬於glibc.i686。
安裝了glibc.i686之後,再重新make,得到下面的結果:
[xuzhina@localhost singlecell]$ make make -C hello KERNEL=micro BUILD=debug make[1]: 進入目錄“/home/xuzhina/Downloads/singlecell/hello” cp hello.xml.in build.micro-debug/bin/hello.xml arm-unknown-linux-gnueabi-ld -o build.micro-debug/bin/hello -Ttext=0x80000000 -L/home/xuzhina/Downloads/sdk/okl4/xscale/micro-debug/libs /home/xuzhina/Downloads/sdk/okl4/xscale/micro-debug/libs/crt0.o build.micro-debug/src/hello.o --start-group /home/xuzhina/Downloads/sdk/okl4/xscale/micro-debug/libs/libc.a /home/xuzhina/Downloads/sdk/okl4/xscale/micro-debug/libs/libokl4.a /home/xuzhina/Downloads/arm-unknown-linux-gnueabi/bin/../lib/gcc/arm-unknown-linux-gnueabi/4.2.4/libgcc.a --end-group make[1]: 離開目錄“/home/xuzhina/Downloads/singlecell/hello”