トップ «前の日記(2014-10-12(Sun)) 最新 次の日記(2014-10-14(Tue))» 編集

屑俺日記

僕の備忘録(PC、UN*X、ネットワーク関連が中心)なんです。
自分の書いたところは適当(な時とか)に書き換えますので御了承を。


2014-10-13(Mon) 台風19号:ヴォンフォン通過直後

Hello World on chroot x86 to arm

chrootはx86のwheezy。ホストはx86_64のUbuntu-14.03。

$ tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian\
/bin/arm-linux-gnueabihf-gcc-4.8.3  \
 -Wall -o hello_arm -marm hello.c 
$ file hello_arm 
hello_arm: ELF 32-bit LSB executable, ARM, version 1 (SYSV), \
dynamically linked (uses shared libs), for GNU/Linux 2.6.26, \
 BuildID[sha1]=0x1828f579fc9d079652998180349e2f6d09313971, not stripped
 
$ ldd hello_arm 
	not a dynamic executable
 
$ ./hello_arm 
bash: ./hello_arm: cannot execute binary file

Raspbian上にコピーすると当然のごとく実行できた。
file(1)の表示は同じだったが、lddは違っていた。

$ ./hello_arm 
hello,world
 
$ ldd ./hello_arm 
        /usr/lib/arm-linux-gnueabihf/libcofi_rpi.so (0xb6f3b000)
        libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xb6dfe000)
        /lib/ld-linux-armhf.so.3 (0xb6f49000)
 
$ ls -l hello_arm 
-rwxr-xr-x 1 user group 5931 10月 13 23:04 hello_arm
 
$ strip hello_arm 
$ ls -l hello_arm
-rwxr-xr-x 1 user group 3008 10月 13 23:13 hello_arm

リンクはご自由にどうぞ。でもURLや内容が変った場合はあしからず。

index.htmlは ここから。