※やたらぐだぐだですが1.8は動きました。。
むだに1.9試してみる。
$ wget http://ftp.iij.ad.jp/pub/lang/ruby/1.9/ruby-1.9.0-5.tar.bz2 $ cd ruby-1.9.0-5/ $ CC=arm-linux-gnueabi-gcc CFLAGS=--static LDFLAGS=--static ./configure --with-static-linked-ext --host=arm-linux --build=i686-gnu-linux
こんな感じ?? でも途中まで行って
checking whether setpgrp takes no argument... configure: error: cannot check setpgrp when cross compiling
うーむ。
とりあえず1.8で。。
$ wget http://ftp.iij.ad.jp/pub/lang/ruby/1.8/ruby-1.8.7-p72.tar.bz2 $ cd ruby-1.8.7-p72/ $ CC=arm-linux-gnueabi-gcc CFLAGS=--static LDFLAGS=--static ./configure --with-static-linked-ext --host=arm-linux --build=i686-gnu-linux
checking whether setpgrp takes no argument... configure: error: cannot check setpgrp when cross compiling
うぐぐ><
ここでぐぐる。
このエラーの原因は、configure.inでかかれている、autoconfのAC_FUNC_SETPGRPマクロというのが原因です。configure実行中に、プログラムをコンパイルし実行しようとするのですが、今は玄箱用にクロスコンパイルしようとしているので、コンパイルされたプログラムはFreeBSD上で実行できません。
おそらく礼儀正しい訂正方法としては、configure.inのなかのAC_FUNC_SETPGRPをコメントアウトして、autoconfを実行し、configureを生成しなおす、ということになると思いますが、多くの人にとって、その作業はかえって
めんどくさいので
configureを直接書き換えます。乱暴なやりかたですね。実は、別の理由があったりします。それはあとで。
ttt: FreeBSD上で玄箱用tcshをクロスコンパイル
なるほどなるほど。
とりあえず1.9のほうで configure 削ってみた。
$ diff -c configure.bk configure *** configure.bk 2008-12-20 13:38:18.000000000 +0900 --- configure 2008-12-20 13:41:27.000000000 +0900 *************** *** 19238,19308 **** fi - { $as_echo "$as_me:$LINENO: checking whether setpgrp takes no argument" >&5 - $as_echo_n "checking whether setpgrp takes no argument... " >&6; } - if test "${ac_cv_func_setpgrp_void+set}" = set; then - $as_echo_n "(cached) " >&6 - else - if test "$cross_compiling" = yes; then - { { $as_echo "$as_me:$LINENO: error: cannot check setpgrp when cross compiling" >&5 - $as_echo "$as_me: error: cannot check setpgrp when cross compiling" >&2;} - { (exit 1); exit 1; }; } - else - cat >conftest.$ac_ext <<_ACEOF - /* confdefs.h. */ - _ACEOF - cat confdefs.h >>conftest.$ac_ext - cat >>conftest.$ac_ext <<_ACEOF - /* end confdefs.h. */ - $ac_includes_default - int - main () - { - /* If this system has a BSD-style setpgrp which takes arguments, - setpgrp(1, 1) will fail with ESRCH and return -1, in that case - exit successfully. */ - return setpgrp (1,1) != -1; - ; - return 0; - } - _ACEOF - rm -f conftest$ac_exeext - if { (ac_try="$ac_link" - case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; - esac - eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" - $as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; - esac - eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" - $as_echo "$ac_try_echo") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_setpgrp_void=no - else - $as_echo "$as_me: program exited with status $ac_status" >&5 - $as_echo "$as_me: failed program was:" >&5 - sed 's/^/| /' conftest.$ac_ext >&5 - - ( exit $ac_status ) - ac_cv_func_setpgrp_void=yes - fi - rm -rf conftest.dSYM - rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext - fi - - - fi { $as_echo "$as_me:$LINENO: result: $ac_cv_func_setpgrp_void" >&5 $as_echo "$ac_cv_func_setpgrp_void" >&6; } if test $ac_cv_func_setpgrp_void = yes; then --- 19238,19243 ----
で、これで configure 通ったっぽい。
$ make GNUmakefile:2: uncommon.mk: そのようなファイルやディレクトリはありません sed 's/{\$([^(){}]*)[^{}]*}//g' common.mk > uncommon.mk ruby -I/home/mori/ruby-1.9.0-5 -rfake ./enc/make_encdb.rb encdb.h.new ./enc enc make: ruby: コマンドが見つかりませんでした make: *** [encdb.h] エラー 127
ちょww ruby入ってないw (Ruby1.9はRubyのビルドにRubyが必要なのです。1.8でOK) apt-get install rubyして気をとりなおしてもう一度。
$ make ... ./ext/extmk.rb:338: undefined method `<<' for nil:NilClass (NoMethodError) make: *** [all] エラー 1
あれ。。該当個所
EXEEXT = CONFIG['EXEEXT'] if CROSS_COMPILING $ruby = $mflags.defined?("MINIRUBY") || CONFIG['MINIRUBY'] elsif sep = config_string('BUILD_FILE_SEPARATOR') $ruby = "$(topdir:/=#{sep})#{sep}miniruby" + EXEEXT else $ruby = '$(topdir)/miniruby' + EXEEXT end $ruby << " -I'$(topdir)'"
どうやら CROSS_COMPILING が "i486-linux" とか入ってて、 そのあとの行が、nil になってるっぽい。
$ruby = $mflags.defined?("MINIRUBY") || CONFIG['MINIRUBY'] || ''
とかやってみたけど、そのあとグダグダなので、やめる。。また1.8で同じようにconfigureを削る。
$ diff -c configure.bk configure *** configure.bk 2008-12-20 14:12:46.000000000 +0900 --- configure 2008-12-20 14:13:49.000000000 +0900 *************** *** 14840,14918 **** fi - { echo "$as_me:$LINENO: checking whether setpgrp takes no argument" >&5 - echo $ECHO_N "checking whether setpgrp takes no argument... $ECHO_C" >&6; } - if test "${ac_cv_func_setpgrp_void+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot check setpgrp when cross compiling" >&5 - echo "$as_me: error: cannot check setpgrp when cross compiling" >&2;} - { (exit 1); exit 1; }; } - else - cat >conftest.$ac_ext <<_ACEOF - /* confdefs.h. */ - _ACEOF - cat confdefs.h >>conftest.$ac_ext - cat >>conftest.$ac_ext <<_ACEOF - /* end confdefs.h. */ - $ac_includes_default - int - main () - { - /* If this system has a BSD-style setpgrp which takes arguments, - setpgrp(1, 1) will fail with ESRCH and return -1, in that case - exit successfully. */ - return setpgrp (1,1) != -1; - ; - return 0; - } - _ACEOF - rm -f conftest$ac_exeext - if { (ac_try="$ac_link" - case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; - esac - eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; - esac - eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_setpgrp_void=no - else - echo "$as_me: program exited with status $ac_status" >&5 - echo "$as_me: failed program was:" >&5 - sed 's/^/| /' conftest.$ac_ext >&5 - - ( exit $ac_status ) - ac_cv_func_setpgrp_void=yes - fi - rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext - fi - - - fi - { echo "$as_me:$LINENO: result: $ac_cv_func_setpgrp_void" >&5 - echo "${ECHO_T}$ac_cv_func_setpgrp_void" >&6; } - if test $ac_cv_func_setpgrp_void = yes; then - - cat >>confdefs.h <<\_ACEOF - #define SETPGRP_VOID 1 - _ACEOF - - fi - - { echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6; } if test "${ac_cv_c_bigendian+set}" = set; then --- 14840,14845 ----
make. っとおもったらoops.
./ext/extmk.rb:357: undefined method `<<' for nil:NilClass (NoMethodError)
まーたこれだ。根本的に何か間違ってるっぽいw
またここでぐぐる。
— ruby_comp.sh —
export CC=/usr/local/arm-linux/bin/arm-linux-gcc
export LD=/usr/local/arm-linux/bin/arm-linux-gcc
export AR=/usr/local/arm-linux/bin/arm-linux-ar
export RANLIB=/usr/local/arm-linux/bin/arm-linux-ranlib
export ac_cv_func_getpgrp_void=yes
export ac_cv_func_setpgrp_void=yes
./configure –target=arm-linux –host=arm-linux –enable-wide-getaddrinfo –with-openssl-dir=/PATH/TO/OPENSSL/STATIC/INSTALLATION/usr
— end —
Cross compiling ruby to arm processors – the not so zen way « the zen machine
を参考に、こんなかんじでやってみた。ac_cv_func_setpgrp_void とかあるんじゃん! (これ使うと上記のconfigureの変更は要らない)
$ export CC=/usr/bin/arm-linux-gnueabi-gcc $ export LD=/usr/bin/arm-linux-gnueabi-gcc $ export AR=/usr/bin/arm-linux-gnueabi-ar $ export RANLIB=/usr/bin/arm-linux-gnueabi-ranlib $ export ac_cv_func_getpgrp_void=yes $ export ac_cv_func_setpgrp_void=yes $ ./configure --target=arm-linux --host=arm-linux --enable-wide-getaddrinfo --with-static-linked-ext
でもエラーは同じ。。。もういいやと、351行目を
$ruby = CONFIG['MINIRUBY'] || ''
とかしてみた。すると、こっち(1.8)は通った! (いいのか。。
実機転送してやってみると
$ ./ruby -e'puts "Hello Android."' ./ruby: not found
なんでー;; と思ったら、
$ file ruby ruby: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.14, not stripped
ななんと。。dynamically linked。。
正解は、
$ export CC=/usr/bin/arm-linux-gnueabi-gcc $ export LD=/usr/bin/arm-linux-gnueabi-gcc $ export AR=/usr/bin/arm-linux-gnueabi-ar $ export RANLIB=/usr/bin/arm-linux-gnueabi-ranlib $ export CFLAGS=--static $ export LDFLAGS=--static $ export ac_cv_func_getpgrp_void=yes $ export ac_cv_func_setpgrp_void=yes $ ./configure --target=arm-linux --host=arm-linux --enable-wide-getaddrinfo --with-static-linked-ext
のようでした。
実機で実行するとこんな感じ。 AndroidでC言語で書いたネイティブアプリを動かしてみる - daily gimite を全部やってみました。getaddress取れないのはエミュレータと同じっぽいです。
$ ./ruby -e'puts "Hello Android."' Hello Android. $ ./ruby -r socket -e'p IPSocket.getaddress("www.google.co.jp")' -e:1:in `getaddress': getaddrinfo: Name or service not known (SocketError) from -e:1 $ ./ruby -r socket -e'sock= TCPSocket.open("66.249.89.104", 80); sock.write("GET / HTTP/1.0\n\n"); sock.flush; sock.each_line(){ |s| puts s }' HTTP/1.0 302 Found Location: http://www.google.co.jp/ Cache-Control: private Content-Type: text/html; charset=UTF-8 Set-Cookie: PREF=ID=e22fe8a4dcd68ca5:TM=1229721343:LM=1229721343:S=R96CllLWCVRuAiiA; expires=Sun, 19-Dec-2010 21:15:43 GMT; path=/; domain=.google.com Date: Fri, 19 Dec 2008 21:15:43 GMT Server: gws Content-Length: 221 Connection: Close <HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8"> <TITLE>302 Moved</TITLE></HEAD><BODY> <H1>302 Moved</H1> The document has moved <A HREF="http://www.google.co.jp/">here</A>. </BODY></HTML>
なにはともあれコレでした。
$ dmesg <5>[ 0.000000] Linux version 2.6.25-01843-gfea26b0 (android-build@apa27.mtv.corp.google.com) (gcc version 4.2.1) #6 PREEMPT Mon Oct 6 14:13:36 PDT 2008 <4>[ 0.000000] CPU: ARMv6-compatible processor [4117b362] revision 2 (ARMv6TEJ), cr=00c5387f <4>[ 0.000000] Machine: trout <6>[ 0.000000] AKM Data size = 1018 , 0x89768976, size = 4064 <4>[ 0.000000] Memory policy: ECC disabled, Data cache writeback <7>[ 0.000000] On node 0 totalpages: 25856 <7>[ 0.000000] DMA zone: 202 pages used for memmap <7>[ 0.000000] DMA zone: 0 pages reserved <7>[ 0.000000] DMA zone: 25654 pages, LIFO batch:7 <7>[ 0.000000] Normal zone: 0 pages used for memmap <7>[ 0.000000] Movable zone: 0 pages used for memmap <4>[ 0.000000] trout_init_map_io() <6>[ 0.000000] clock_init() <6>[ 0.000000] ACPU running at 384000 KHz <4>[ 0.000000] WARNING - Bad VDD (0 != 3) for this freq <4>[ 0.000000] CPU0: D VIPT write-back cache <4>[ 0.000000] CPU0: I cache: 32768 bytes, associativity 4, 32 byte lines, 256 sets <4>[ 0.000000] CPU0: D cache: 32768 bytes, associativity 4, 32 byte lines, 256 sets <4>[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 25654 <5>[ 0.000000] Kernel command line: board_trout.disable_uart3=0 board_trout.usb_h2w_sw=0 board_trout.disable_sdcard=0 board_trout.smisize=64 androidboot.baseband=1.22.12.29 androidboot.bootloader=0.95.3000 androidboot.carrier=ALL board_trout.keycaps=qwerty androidboot.mode=charge androidboot.serialno=HT845GZ52046 no_console_suspend=1 console=null <3>[ 0.000000] Unknown boot option `board_trout.smisize=64': ignoring <3>[ 0.000000] Unknown boot option `androidboot.baseband=1.22.12.29': ignoring <3>[ 0.000000] Unknown boot option `androidboot.bootloader=0.95.3000': ignoring <3>[ 0.000000] Unknown boot option `androidboot.carrier=ALL': ignoring <3>[ 0.000000] Unknown boot option `androidboot.mode=charge': ignoring <4>[ 0.000000] trout_init_irq() <4>[ 0.000000] PID hash table entries: 512 (order: 9, 2048 bytes) <4>[ 0.000000] Console: colour dummy device 80x30 <6>[ 0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes) <6>[ 0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes) <6>[ 0.010000] Memory: 101MB = 101MB total <5>[ 0.010000] Memory: 98744KB available (2552K code, 759K data, 100K init) <7>[ 0.010000] Calibrating delay loop... 383.38 BogoMIPS (lpj=1916928) <4>[ 0.230000] Mount-cache hash table entries: 512 <6>[ 0.230000] CPU: Testing write buffer coherency: ok <6>[ 0.230000] net_namespace: 440 bytes <6>[ 0.230000] NET: Registered protocol family 16 <4>[ 0.230000] trout_init() revision=128 <4>[ 0.240000] trout_init: cpld_usb_hw2_sw = 0 <3>[ 0.240000] trout_gpio_irq_handler: got masked interrupt: 0:80 <6>[ 0.340000] msm_i2c_probe <6>[ 0.340000] msm_i2c_probe: clk_ctl 35d, 100000 Hz <6>[ 0.380000] Bluetooth: Core ver 2.11 <6>[ 0.380000] NET: Registered protocol family 31 <6>[ 0.380000] Bluetooth: HCI device and connection manager initialized <6>[ 0.380000] Bluetooth: HCI socket layer initialized <6>[ 0.380000] NET: Registered protocol family 2 <7>[ 0.390091] Switched to high resolution mode on CPU 0 <6>[ 0.470671] IP route cache hash table entries: 1024 (order: 0, 4096 bytes) <6>[ 0.472777] TCP established hash table entries: 4096 (order: 3, 32768 bytes) <6>[ 0.473112] TCP bind hash table entries: 4096 (order: 2, 16384 bytes) <6>[ 0.473356] TCP: Hash tables configured (established 4096 bind 4096) <6>[ 0.473387] TCP reno registered <6>[ 0.501495] Unpacking initramfs... done <6>[ 0.555615] Freeing initrd memory: 137K <6>[ 0.558209] Registered led device: lcd-backlight <6>[ 0.558819] smd_init() <6>[ 0.558850] smd_core_init() <6>[ 0.559063] smd_alloc_channel() 'SMD_RPCCALL' cid=2, shared=e010d9a0 <6>[ 0.559399] smd_alloc_channel() 'SMD_DATA5' cid=11, shared=e0119a18 <6>[ 0.559613] smd_alloc_channel() 'SMD_DATA6' cid=12, shared=e011da40 <6>[ 0.559826] smd_alloc_channel() 'SMD_DATA7' cid=13, shared=e0121a68 <6>[ 0.560213] smd_alloc_channel() 'SMD_DATA11' cid=17, shared=e01119c8 <6>[ 0.560488] smd_alloc_channel() 'SMD_CS_A2M' cid=33, shared=e01159f0 <6>[ 0.560793] smd_alloc_channel() 'SMD_DATA5_CNTL' cid=38, shared=e0125a90 <6>[ 0.561037] smd_alloc_channel() 'SMD_DATA6_CNTL' cid=39, shared=e0129ab8 <6>[ 0.561281] smd_alloc_channel() 'SMD_DATA7_CNTL' cid=40, shared=e012dae0 <6>[ 0.561586] smd_core_init() done <4>[ 0.564058] SMD: ch 2 OPENING -> OPENED <6>[ 0.565432] hw3d: 0 init <6>[ 0.565889] msm_perf_init(): <6>[ 0.567476] H2W: Registering H2W (headset) driver <6>[ 0.569826] input: h2w headset as /class/input/input0 <6>[ 0.584547] RPC_TIME_TOD_SET_APPS_BASES: <4>[ 0.584577] tick = 329227 <4>[ 0.584577] stamp = 385877446 <6>[ 0.586286] ashmem: initialized <4>[ 0.587446] yaffs Oct 6 2008 14:13:20 Installing. <6>[ 0.587598] io scheduler noop registered <6>[ 0.587629] io scheduler anticipatory registered (default) <6>[ 0.588239] mddi_pmdh: init() base=0xe000b000 irq=16 <6>[ 0.594058] get_smem_clock: state 10429 clock 0 <6>[ 0.630244] mddi cmd send rtd: int 3a000, stat 8063, rtd val d <6>[ 0.650793] mddi_pmdh: publish: mddi_c_d263_0000 <6>[ 0.652563] vsync on gpio 97 now 0 <6>[ 0.652624] mddi_pmdh: mddi_add_panel(c02eef78, c02b3a50) <6>[ 0.652624] mddi_pmdh: publish: mddi_panel <6>[ 0.653051] msmfb_probe() installing 320 x 480 panel <6>[ 0.683997] smd_alloc_channel() 'SMD_GPSNMEA' cid=27, shared=e0131b10 <6>[ 0.691007] msm_serial: detected port #0 <6>[ 0.691220] msm_serial.0: ttyMSM0 at MMIO 0xa9a00000 (irq = 9) is a MSM <6>[ 0.692075] msm_serial: driver initialized <6>[ 0.694028] loop: module loaded <6>[ 0.694119] PPP generic driver version 2.4.2 <6>[ 0.694394] PPP Deflate Compression module registered <6>[ 0.694425] PPP BSD Compression module registered <4>[ 0.704303] allocated dma buffer at ffc01000, dma_addr 16130000 <4>[ 0.704486] read CFG0 = aad400c0, CFG1 = 4745c <4>[ 0.704516] CFG0 = e8d408c0, CFG1 = 4745c <6>[ 0.704547] CFG0: cw/page=3 ud_sz=516 ecc_sz=10 spare_sz=1 num_addr_cycles=5 <4>[ 0.704608] NAND_READ_ID = 1500aaec <4>[ 0.705188] status: c03120 <4>[ 0.705218] nandid: 1500aaec maker ec device aa <4>[ 0.705737] CFG0: cw/page=3 ud_sz=512 ecc_sz=10 spare_sz=5 <4>[ 0.705798] DEV_CMD1: f00f3000 <6>[ 0.705859] NAND_EBI2_ECC_BUF_CFG: 1ff <4>[ 0.705889] flash_id: 1500aaec size 10000000 <5>[ 0.705920] Creating 6 MTD partitions on "msm_nand": <5>[ 0.705981] 0x024c0000-0x02500000 : "misc" <5>[ 0.706927] 0x026c0000-0x02bc0000 : "recovery" <5>[ 0.707690] 0x02bc0000-0x02e40000 : "boot" <5>[ 0.708453] 0x02e40000-0x071c0000 : "system" <5>[ 0.709277] 0x071c0000-0x0b540000 : "cache" <5>[ 0.710366] 0x0b540000-0x10000000 : "userdata" <6>[ 0.711892] usb_probe() io=c6806000, irq=47, dma=ffc02000(1613c000) <6>[ 0.712685] usb_function_register() 'adb' <6>[ 0.713021] usb_function_register() 'usb_mass_storage' <6>[ 0.713051] msm_hsusb: functions bound. starting. <6>[ 0.713082] usb_bind_func() 'usb_mass_storage' <6>[ 0.713601] usb_mass_storage usb_mass_storage: Number of LUNs=1 <6>[ 0.713631] usb_bind_func() 'adb' <6>[ 0.713662] adb_bind() c612c874, c612ca34 <6>[ 0.713814] adb_bind() allocated 4 rx and 4 tx requests <6>[ 0.714547] usb_function_register() 'diag' <6>[ 0.715035] mice: PS/2 mouse device common for all mice <6>[ 0.715157] hsusb: IDLE -> ONLINE <6>[ 0.715249] hsusb: reset controller <4>[ 0.760091] ulpi: write 0x40 to 0x31 <4>[ 0.760152] ulpi: write 0x1d to 0x0d <4>[ 0.760152] ulpi: write 0x1d to 0x10 <6>[ 0.760183] ept #0 out max:64 head:ffc02000 bit:0 <6>[ 0.760213] ept #1 out max:512 head:ffc02080 bit:1 <6>[ 0.760244] ept #2 out max:512 head:ffc02100 bit:2 <6>[ 0.760274] ept #0 in max:64 head:ffc02040 bit:16 <6>[ 0.760305] ept #1 in max:512 head:ffc020c0 bit:17 <6>[ 0.760335] ept #2 in max:512 head:ffc02140 bit:18 <6>[ 0.760488] usb: notify offline <6>[ 0.761739] smd_alloc_channel() 'SMD_DS' cid=0, shared=e0135b38 <6>[ 0.762349] smd_alloc_channel() 'SMD_DATA1' cid=7, shared=e0139b60 <6>[ 0.762899] smd_alloc_channel() 'SMD_DATA2' cid=8, shared=e013db88 <6>[ 0.763448] smd_alloc_channel() 'SMD_DATA3' cid=9, shared=e0141bb0 <6>[ 0.763540] usb: suspend <6>[ 0.763906] smd_alloc_channel() 'SMD_DATA4' cid=10, shared=e0145bd8 <3>[ 0.770640] msm_i2c msm_i2c.0: Error during data xfer (-5) <6>[ 0.780000] usb: portchange <6>[ 0.780000] usb: reset <6>[ 0.781373] synaptics_ts_probe: Product Major Version 1 <6>[ 0.782624] synaptics_ts_probe: Product Minor Version c <6>[ 0.783875] synaptics_ts_probe: product property 2 <6>[ 0.785096] synaptics_ts_probe: device control 81 <6>[ 0.786317] synaptics_ts_probe: interrupt enable 3 <6>[ 0.789735] synaptics_ts_probe: 0xe0: 1 1 1 2 1 c 0 0 <6>[ 0.790000] synaptics_ts_probe: max_x 3480, max_y 5368 <6>[ 0.790000] synaptics_ts_probe: inactive_x -80 -80, inactive_y -32 -32 <6>[ 0.790000] synaptics_ts_probe: snap_x 240-248 240-248, snap_y 80-88 80-88 <6>[ 0.790000] input: synaptics-rmi-touchscreen as /class/input/input1 <6>[ 0.840854] synaptics_ts_probe: Start touchscreen synaptics-rmi-touchscreen in interrupt mode <6>[ 0.841159] GPIO Event Driver <6>[ 0.841709] GPIO Keypad Driver: Start keypad matrix for trout-keypad-v3 in interrupt mode <4>[ 0.841922] No IRQF_TRIGGER set_type function for IRQ 191 (troutgpio) <4>[ 0.842014] No IRQF_TRIGGER set_type function for IRQ 192 (troutgpio) <6>[ 0.842075] GPIO Input Driver: Start gpio inputs for trout-keypad-v3 in interrupt mode <4>[ 0.842136] No IRQF_TRIGGER set_type function for IRQ 188 (troutgpio) <6>[ 0.842197] GPIO Input Driver: Start gpio inputs for trout-keypad-v3 in interrupt mode <6>[ 0.842838] input: trout-keypad-v3 as /class/input/input2 <4>[ 0.900976] No IRQF_TRIGGER set_type function for IRQ 186 (troutgpio) <6>[ 0.901098] GPIO Input Driver: Start gpio inputs for trout-nav in interrupt mode <6>[ 0.901709] input: trout-nav as /class/input/input3 <6>[ 0.916744] usb_mass_storage usb_mass_storage: config #1 <6>[ 0.961220] rs30000048:0da5b528 rs30000048:0da5b528: rtc core: registered msm_rtc as rtc0 <6>[ 0.964852] Registered led device: blue <6>[ 0.965188] Registered led device: green <6>[ 0.965401] Registered led device: red <6>[ 0.965584] AKM8976A compass driver: init <4>[ 0.965676] No IRQF_TRIGGER set_type function for IRQ 187 (troutgpio) <6>[ 0.966408] input: compass as /class/input/input4 <6>[ 0.991190] pdev->dev.platform_data is not NULL <6>[ 0.991312] mt9t013: probe <6>[ 0.991342] mt9t013: init <6>[ 0.991342] mt9t013: mt9t013_register_init <6>[ 0.991373] mt9t013: camera sensor_reset set as 1 <6>[ 0.993448] mt9t013: clk_get(vfe_mdc_clk): c02a4cd4 <6>[ 0.993509] mt9t013: clk_get(mdc_clk): c02a4954 <6>[ 0.993540] mt9t013: clk select 1 <6>[ 0.993570] mt9t013: clk_get(vfe_clk): c02a4cb4 <6>[ 0.993662] mt9t013: enable vfe_clk <6>[ 1.020061] mt9t013: clk select 0 <6>[ 1.028636] mt9t013: camera sensor init sequence done <6>[ 1.028667] mt9t013: camera sensor suspend sequence <6>[ 1.028728] mt9t013: disabling vfe_clk <6>[ 1.028789] mt9t013: clk_put(vfe_clk): c02a4cb4 <6>[ 1.029063] mt9t013: camera sensor suspend sequence done <6>[ 1.029704] Bluetooth: HCI UART driver ver 2.2 <6>[ 1.029765] Bluetooth: HCI H4 protocol initialized <6>[ 1.029765] Bluetooth: HCILL protocol initialized <6>[ 1.031037] mmc0: Qualcomm MSM SDCC at 0x00000000e1000000 irq 24,0 dma -1 <6>[ 1.031068] mmc0: 4 bit data mode enabled <6>[ 1.031098] mmc0: MMC clock 144000 -> 20000000 Hz, PCLK 64000000 Hz <6>[ 1.031129] mmc0: Slot eject status = 1 <6>[ 1.031159] mmc0: Power save feature enable = 0 <6>[ 1.031159] mmc0: PIO transfer enabled <6>[ 1.032227] mmc1: Qualcomm MSM SDCC at 0x00000000e1001000 irq 26,194 dma 8 <6>[ 1.032288] mmc1: 4 bit data mode enabled <6>[ 1.032319] mmc1: MMC clock 144000 -> 20000000 Hz, PCLK 64000000 Hz <6>[ 1.032349] mmc1: Slot eject status = 0 <6>[ 1.032349] mmc1: Power save feature enable = 0 <6>[ 1.032380] mmc1: DM non-cached buffer at ffc04000, dma_addr 0x1615c000 <6>[ 1.032411] mmc1: DM cmd busaddr 370524160, cmdptr busaddr 370524928 <6>[ 1.033173] Registered led device: spotlight <6>[ 1.033448] Registered led device: keyboard-backlight <6>[ 1.033784] Registered led device: button-backlight <4>[ 1.034333] No IRQF_TRIGGER set_type function for IRQ 190 (troutgpio) <6>[ 1.034913] ram_console: got buffer at 16d00000, size 20000 <6>[ 1.035401] ram_console: uncorrectable error in header <6>[ 1.035462] ram_console: no valid data in buffer (sig = 0xffffffff) <6>[ 1.035493] console [ram-1] enabled <6>[ 1.041526] logger: created 64K log 'log_main' <6>[ 1.041983] logger: created 256K log 'log_events' <6>[ 1.042411] logger: created 64K log 'log_radio' <6>[ 1.043906] pmem: 1 init <6>[ 1.044882] pmem_adsp: 0 init <6>[ 1.045920] pmem_gpu0: 0 init <6>[ 1.047446] pmem_gpu1: 0 init <6>[ 1.051129] pmem_camera: 0 init <4>[ 1.052899] nf_conntrack version 0.5.0 (2048 buckets, 8192 max) <6>[ 1.061434] ip_tables: (C) 2000-2006 Netfilter Core Team <6>[ 1.062014] TCP cubic registered <6>[ 1.062472] NET: Registered protocol family 1 <6>[ 1.063173] NET: Registered protocol family 17 <6>[ 1.063540] Bluetooth: L2CAP ver 2.9 <6>[ 1.064089] Bluetooth: L2CAP socket layer initialized <6>[ 1.064394] Bluetooth: SCO (Voice Link) ver 0.6 <6>[ 1.064669] Bluetooth: SCO socket layer initialized <6>[ 1.065615] Bluetooth: RFCOMM socket layer initialized <6>[ 1.065981] Bluetooth: RFCOMM TTY layer initialized <6>[ 1.066530] Bluetooth: RFCOMM ver 1.9 <6>[ 1.067232] clock_late_init() disabled 18 unused clocks <6>[ 1.070000] rs30000048:0da5b528 rs30000048:0da5b528: setting system clock to 2008-12-19 12:20:12 UTC (1229689212) <6>[ 1.070000] Freeing init memory: 100K <4>[ 1.070000] Warning: unable to open an initial console. <3>[ 1.267599] init: cannot open '/initlogo.rle' <6>[ 1.274120] yaffs: dev is 32505859 name is "mtdblock3" <6>[ 1.274455] yaffs: passed flags "" <4>[ 1.274760] yaffs: Attempting MTD mount on 31.3, "mtdblock3" <4>[ 1.340000] yaffs: restored from checkpoint <4>[ 1.340000] yaffs_read_super: isCheckpointed 1 <6>[ 1.340000] yaffs: dev is 32505861 name is "mtdblock5" <6>[ 1.340000] yaffs: passed flags "" <4>[ 1.340000] yaffs: Attempting MTD mount on 31.5, "mtdblock5" <4>[ 1.400000] yaffs: restored from checkpoint <4>[ 1.400000] yaffs_read_super: isCheckpointed 1 <6>[ 1.400000] yaffs: dev is 32505860 name is "mtdblock4" <6>[ 1.400000] yaffs: passed flags "" <4>[ 1.400000] yaffs: Attempting MTD mount on 31.4, "mtdblock4" <4>[ 1.400000] yaffs: restored from checkpoint <4>[ 1.400000] yaffs_read_super: isCheckpointed 1 <3>[ 1.403907] init: service 'console' requires console <6>[ 1.805952] usb_ept_queue_xfer() tried to queue busy request <4>[ 1.806318] usb_mass_storage usb_mass_storage: error in submission: bulk-out --> -16 <6>[ 1.848699] enabling adb function <6>[ 1.849126] hsusb: ONLINE -> RESET <6>[ 1.849675] hsusb: reset controller <4>[ 1.897478] mmc_sd_init_card: Delay 250 ms <4>[ 1.910062] ulpi: write 0x40 to 0x31 <4>[ 1.910612] ulpi: write 0x1d to 0x0d <4>[ 1.910917] ulpi: write 0x1d to 0x10 <6>[ 1.911192] ept #0 out max:64 head:ffc02000 bit:0 <6>[ 1.911741] ept #1 out max:512 head:ffc02080 bit:1 <6>[ 1.912016] ept #2 out max:512 head:ffc02100 bit:2 <6>[ 1.912565] ept #0 in max:64 head:ffc02040 bit:16 <6>[ 1.912840] ept #1 in max:512 head:ffc020c0 bit:17 <6>[ 1.913145] ept #2 in max:512 head:ffc02140 bit:18 <6>[ 1.913847] usb_ept_queue_xfer() tried to queue request while offline <4>[ 1.914152] usb_mass_storage usb_mass_storage: error in submission: bulk-out --> -19 <6>[ 1.914823] usb: notify offline <6>[ 1.915189] hsusb: RESET -> ONLINE <3>[ 1.918058] init: sys_prop: permission denied uid:2000 name:adb.connected <6>[ 1.918424] usb: suspend <6>[ 2.081619] usb: reset <6>[ 2.083908] usb: portchange <6>[ 2.244152] usb_mass_storage usb_mass_storage: config #1 <6>[ 2.261893] warning: `rild' uses 32-bit capabilities (legacy support in use) <4>[ 2.311924] mmc1: host does not support reading read-only switch. assuming write-enable. <6>[ 2.312687] mmc1: new SD card at address 9cf3 <6>[ 2.315525] mmcblk0: mmc1:9cf3 SU01G 992000KiB <6>[ 2.317143] mmcblk0: p1 <3>[ 2.323969] FAT: bogus number of reserved sectors <6>[ 2.324335] VFS: Can't find a valid FAT filesystem on dev mmcblk0. <6>[ 2.438882] usb_ept_queue_xfer() tried to queue busy request <4>[ 2.439218] usb_mass_storage usb_mass_storage: error in submission: bulk-out --> -16 <3>[ 2.540003] init: sys_prop: permission denied uid:2000 name:adb.connected <4>[ 2.628823] SMD: ch 0 OPENING -> OPENED <6>[ 2.630736] qmi: smd closed <4>[ 2.631133] SMD: ch 38 OPENING -> OPENED <6>[ 2.631407] qmi: smd opened <6>[ 2.632994] qmi: ctl: wds use client_id 0x01 <6>[ 2.633482] qmi: smd closed <4>[ 2.633849] SMD: ch 39 OPENING -> OPENED <6>[ 2.634398] qmi: smd opened <6>[ 2.635649] qmi: ctl: wds use client_id 0x01 <6>[ 2.636137] qmi: smd closed <4>[ 2.636717] SMD: ch 40 OPENING -> OPENED <6>[ 2.637022] qmi: smd opened <6>[ 2.638304] qmi: ctl: wds use client_id 0x01 <4>[ 12.371429] init sharp panel <6>[ 18.014794] android_power: wakeup (0->0) at 26964707031 (2008-12-19 12:20:38.103912354 UTC) <6>[ 18.690554] TIWLAN: Driver loading <4>[ 18.690951] trout_wifi_power: 1 <4>[ 18.902843] trout_wifi_reset: 0 <4>[ 18.956505] trout_wifi_set_carddetect: 1 <7>[ 18.957085] mmc0: card_present 1 <6>[ 18.957360] mmc0: Slot status change detected (0 -> 1) <4>[ 18.971165] mmc0: card claims to support voltages below the defined range. These will be ignored. <4>[ 18.971775] mmc0: SDIO card claims to support the incompletely defined 'low voltage range'. This will be ignored. <6>[ 18.980096] mmc0: new SDIO card at address 0001 <6>[ 18.982629] TIWLAN: Found SDIO controller (vendor 0x104c, device 0x9066) <6>[ 18.988702] TIWLAN: Driver initialized (rc 0) <6>[ 18.989099] TIWLAN: Driver loaded <6>[ 28.150312] audmgr_rpc_thread() start <6>[ 28.156996] audio_enable() <6>[ 28.157392] ++++++++++++++++++++++++++++++ <6>[ 28.166172] audmgr: rpc_reply status 0 <6>[ 28.180078] audmgr: rpc READY handle=0x00000000 <6>[ 28.206935] audmgr: rpc CODEC_CONFIG volume=0x00002000 <6>[ 28.207973] audpp: enable <6>[ 28.208522] adsp: opening module AUDPPTASK <6>[ 28.210526] adsp: module AUDPPTASK has been registered <6>[ 28.211167] msm_adsp_enable() 'AUDPPTASK' <6>[ 28.212601] adsp: rpc event=0, proc_id=2, module=4, image=0 <6>[ 28.213364] adsp: module AUDPPTASK: READY <6>[ 28.214982] audpp: ENABLE <6>[ 28.215318] audio_dsp_event: CFG_MSG ENABLE <3>[ 28.868553] audpp: DMA missed <6>[ 31.452483] audio_disable() <6>[ 31.453856] audio_dsp_event: CFG_MSG DISABLE <6>[ 31.454405] audpp: disable <6>[ 31.455687] msm_adsp_disable() 'AUDPPTASK' <6>[ 31.455992] audpp: DISABLE <6>[ 31.458494] adsp: closing module AUDPPTASK <6>[ 31.459135] adsp: disable interrupt <6>[ 31.460865] ------------------------------ <6>[ 31.468739] audmgr: rpc_reply status 0 <3>[ 31.492147] audmgr: DISABLED
ええー
<6>[ 0.010000] Memory: 101MB = 101MB total
Memory 192 MB DDRじゃなかったの!!??
toolboxがなんか微妙だったので、おなじみな感じのbusyboxで。
busyboxの導入 - kinneko@転職先募集中の日記を元に。現行stableの最新をやってみる。
$ wget http://busybox.net/downloads/busybox-1.13.1.tar.bz2 $ tar xvjf busybox-1.13.1.tar.bz2 $ cd busybox-1.13.1/ $ make oldconfig $ make CROSS_COMPILE=arm-linux-gnueabi- ARCH=arm CFLAGS=--static LDFLAGS=--static
2.3MBのbusyboxができあがった。早速実機で。
普通に動いた。
$ ./busybox
BusyBox v1.13.1 (2008-12-20 11:23:46 JST) multi-call binary
Copyright (C) 1998-2008 Erik Andersen, Rob Landley, Denys Vlasenko
and others. Licensed under GPLv2.
See source distribution for full notice.
Usage: busybox [function] [arguments]...
or: function [arguments]...
BusyBox is a multi-call binary that combines many common Unix
utilities into a single executable. Most people will create a
link to busybox for each function they wish to use and BusyBox
will act like whatever it was invoked as!
Currently defined functions:
[, [[, addgroup, adduser, adjtimex, ar, arp, arping, ash,
awk, basename, blkid, brctl, bunzip2, bzcat, bzip2, cal,
cat, catv, chat, chattr, chgrp, chmod, chown, chpasswd,
chpst, chroot, chrt, chvt, cksum, clear, cmp, comm, cp,
cpio, crond, crontab, cryptpw, cttyhack, cut, date, dc,
dd, deallocvt, delgroup, deluser, depmod, devmem, df, dhcprelay,
diff, dirname, dmesg, dnsd, dos2unix, du, dumpkmap, dumpleases,
echo, ed, egrep, eject, env, envdir, envuidgid, ether-wake,
expand, expr, fakeidentd, false, fbset, fbsplash, fdflush,
fdformat, fdisk, fgrep, find, findfs, fold, free, freeramdisk,
fsck, fsck.minix, ftpget, ftpput, fuser, getopt, getty,
grep, gunzip, gzip, halt, hd, hdparm, head, hexdump, hostid,
hostname, httpd, hush, hwclock, id, ifconfig, ifdown, ifenslave,
ifup, inetd, init, insmod, install, ip, ipaddr, ipcalc,
ipcrm, ipcs, iplink, iproute, iprule, iptunnel, kbd_mode,
kill, killall, killall5, klogd, last, length, less, linux32,
linux64, linuxrc, ln, loadfont, loadkmap, logger, login,
logname, logread, losetup, lpd, lpq, lpr, ls, lsattr, lsmod,
lzmacat, makedevs, makemime, man, md5sum, mdev, mesg, microcom,
mkdir, mkfifo, mkfs.minix, mknod, mkswap, mktemp, modprobe,
more, mount, mountpoint, msh, mt, mv, nameif, nc, netstat,
nice, nmeter, nohup, nslookup, od, openvt, passwd, patch,
pgrep, pidof, ping, ping6, pipe_progress, pivot_root, pkill,
popmaildir, poweroff, printenv, printf, ps, pscan, pwd,
raidautorun, rdate, rdev, readahead, readlink, readprofile,
realpath, reboot, reformime, renice, reset, resize, rm,
rmdir, rmmod, route, rtcwake, run-parts, runlevel, runsv,
runsvdir, rx, script, sed, sendmail, seq, setarch, setconsole,
setfont, setkeycodes, setlogcons, setsid, setuidgid, sh,
sha1sum, showkey, slattach, sleep, softlimit, sort, split,
start-stop-daemon, stat, strings, stty, su, sulogin, sum,
sv, svlogd, swapoff, swapon, switch_root, sync, sysctl,
syslogd, tac, tail, tar, tcpsvd, tee, telnet, telnetd, test,
tftp, tftpd, time, top, touch, tr, traceroute, true, tty,
ttysize, udhcpc, udhcpd, udpsvd, umount, uname, uncompress,
unexpand, uniq, unix2dos, unlzma, unzip, uptime, usleep,
uudecode, uuencode, vconfig, vi, vlock, watch, watchdog,
wc, wget, which, who, whoami, xargs, yes, zcat, zcip
$ ./busybox ps
PID USER VSZ STAT COMMAND
1 0 264 S /init
2 0 0 SW< [kthreadd]
3 0 0 SW< [ksoftirqd/0]
4 0 0 SW< [watchdog/0]
5 0 0 SW< [events/0]
6 0 0 SW< [khelper]
7 0 0 SW< [suspend/0]
8 0 0 SW< [kblockd/0]
9 0 0 SW< [kmmcd]
10 0 0 SW< [btaddconn]
11 0 0 SW< [btdelconn]
12 0 0 SW< [qmi]
13 0 0 DW< [rpcrouter]
14 0 0 SW< [detection/0]
15 0 0 SW< [krpcserversd]
16 0 0 SW [pdflush]
17 0 0 SW [pdflush]
18 0 0 SW< [kswapd0]
19 0 0 SW< [aio/0]
20 0 0 SW< [kadspd]
21 0 0 SW< [panel_on/0]
22 0 0 SW< [mtdblockd]
23 0 0 SW< [USB mass_storag]
24 0 0 SW< [synaptics_wq]
25 0 0 SW< [krfcommd]
26 1000 796 S /system/bin/servicemanager
27 0 1828 S /system/bin/mountd
28 0 652 S /system/bin/debuggerd
29 1001 7720 S /system/bin/rild
30 0 69604 S zygote /bin/app_process -Xzygote /system/bin --zygote
31 1013 17332 S /system/bin/mediaserver
33 1002 1164 S /system/bin/dbus-daemon --system --nofork
34 0 788 S /system/bin/installd
36 1008 1304 S /system/bin/akmd
37 2000 3332 S /sbin/adbd
44 0 0 SW< [mmcqd]
56 1000 168m S system_server
82 0 0 DW< [ksdiorqd]
83 0 0 SW< [tiwlan_wifi_wq]
86 1010 2964 S /system/bin/wpa_supplicant -Dtiwlan0 -itiwlan0 -c/dat
97 1001 96640 S com.android.phone
101 10004 110m S android.process.acore
119 10009 91932 S com.android.mms
132 10007 113m S com.google.process.gapps
134 10003 91872 S android.process.media
174 0 0 DW< [audmgr_rpc]
177 10020 92208 S com.google.android.talk
190 10018 95076 S com.android.calendar
210 10000 91700 S com.android.alarmclock
222 10006 91212 S com.google.android.gm
451 0 644 S /system/bin/logwrapper dhcpcd -d -X tiwlan0
452 1014 692 S dhcpcd -d -X tiwlan0
472 2000 724 S /system/bin/sh -
488 2000 2584 R ./busybox ps
$ ./busybox df -a
Filesystem 1K-blocks Used Available Use% Mounted on
tmpfs 49564 0 49564 0% /dev
devpts 0 0 0 0% /dev/pts
proc 0 0 0 0% /proc
sysfs 0 0 0 0% /sys
tmpfs 4096 0 4096 0% /sqlite_stmt_journals
/dev/block/mtdblock3 69120 51304 17816 74% /system
/dev/block/mtdblock5 76544 50124 26420 65% /data
/dev/block/mtdblock4 69120 1308 67812 2% /cache
/dev/block/mmcblk0p1 991488 1232 990256 0% /sdcard
おおー。ところで
$ ./busybox free
total used free shared buffers
Mem: 99128 97220 1908 0 200
Swap: 0 0 0
Total: 99128 97220 1908
メモリが99MBぐらいしかないのはなんでだぜ。
Compiling for Android - Android Wiki
なんかよさげなので、とりあえず Debian をVMWareに入れる。
Debian久々だったので、Versionすら分らなかったんですが、とりあえずLenny(現行testing)がこれには必要なのと、あと emdebian のも入れとくので apt のsource.list を以下みたいにして、apt dist-upgrade とか。
$ cat /etc/apt/sources.list deb http://ftp.riken.jp/pub/Linux/debian/debian/ testing main deb-src http://ftp.riken.jp/pub/Linux/debian/debian/ testing main deb http://security.debian.org/ etch/updates main contrib deb-src http://security.debian.org/ etch/updates main contrib deb http://buildd.emdebian.org/debian/ unstable main deb-src http://buildd.emdebian.org/debian/ unstable main deb http://buildd.emdebian.org/debian/ testing main deb-src http://buildd.emdebian.org/debian/ testing main
あとは、上記 wiki の通り
# apt-get install emdebian-tools # emsetup --arch armel
するだけ。10分ぐらいでインストールできた。
なんか入ったっぽいので、コンパイル。ついでにreadelfでヘッダ確認。
$ cat > hello.c
#include <stdio.h>
int main() { puts("hello world!"); return 0; }
$ arm-linux-gnueabi-gcc -static -o hello hello.c
$ arm-linux-gnueabi-readelf -h hello
ELF Header:
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: EXEC (Executable file)
Machine: ARM
Version: 0x1
Entry point address: 0x8130
Start of program headers: 52 (bytes into file)
Start of section headers: 475860 (bytes into file)
Flags: 0x4000002, has entry point, Version4 EABI
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 6
Size of section headers: 40 (bytes)
Number of section headers: 34
Section header string table index: 31
今度は大丈夫そうな予感。母艦転送が面倒だなあ。。
$ scp mori@192.168.237.130:hello . hello 100% 538KB 538.4KB/s 00:00 $ adb push hello /data 1043 KB/s (551284 bytes in 0.516s)
$ cd data $ ./hello hello world!
キタコレ。
inspired by AndroidでC言語で書いたネイティブアプリを動かしてみる - daily gimite
※ 以下の方法では失敗しました。
$ sudo port install arm-elf-gcc
とかできた。普通にインストールできて、あとは淡々と、、
$ cat hello.c
#include <stdio.h>
int main() { puts("hello world!"); return 0; }
$ arm-elf-gcc-4.1.1 -static -o arm-hello hello.c
$ file arm-hello
arm-hello: ELF 32-bit LSB executable, ARM, version 1 (ARM), statically linked, not stripped
$ adb push arm-hello /tmp
failed to copy 'arm-hello' to '/tmp': Read-only file system
あれれ。。adb shellでみると
$ ls /tmp /tmp: No such file or directory
なんと。まあSDcardがあるじゃないか。
$ adb push arm-hello /sdcard 1001 KB/s (56961 bytes in 0.055s)
転送できた。あとはadb shellで実行。
$ /sdcard/arm-hello /sdcard/arm-hello: permission denied $ su # /sdcard/arm-hello /sdcard/arm-hello: permission denied # cd /sdcard # ls -l d---rwxrwx system system 2008-12-16 21:42 dcim d---rwxrwx system system 2008-12-15 19:55 Nagare ----rw-rw- system system 56961 2008-12-19 22:17 arm-hello # chmod a+x arm-hello Bad mode # ./arm-hello ./arm-hello: permission denied # ls -l d---rwxrwx system system 2008-12-16 21:42 dcim d---rwxrwx system system 2008-12-15 19:55 Nagare ----rw-rw- system system 56961 2008-12-19 22:17 arm-hello # chmod 777 arm-hello # ls -l d---rwxrwx system system 2008-12-16 21:42 dcim d---rwxrwx system system 2008-12-15 19:55 Nagare ----rw-rw- system system 56961 2008-12-19 22:17 arm-hello
なんぞ>< SDcardは+xできない??(イミフ
/dataならもしやいけるのか、で強行。。。
# chmod 777 /data
母艦から
$ adb push arm-hello /data 515 KB/s (56961 bytes in 0.107s)
再度adb shellから
# cd /data # ./arm-hello [1] Segmentation fault ./arm-hello
ちょww
この所為かなあ
$ arm-elf-readelf -h arm-hello ELF Header: Magic: 7f 45 4c 46 01 01 01 61 00 00 00 00 00 00 00 00 Class: ELF32 Data: 2's complement, little endian Version: 1 (current) OS/ABI: ARM ABI Version: 0 Type: EXEC (Executable file) Machine: ARM Version: 0x1 Entry point address: 0x8100 Start of program headers: 52 (bytes into file) Start of section headers: 48652 (bytes into file) Flags: 0x2, has entry point, GNU EABI Size of this header: 52 (bytes) Size of program headers: 32 (bytes) Number of program headers: 1 Size of section headers: 40 (bytes) Number of section headers: 15 Section header string table index: 12
母艦で
$ adb shell
すると
$ ls / sqlite_stmt_journals cache sdcard etc init logo.rle init.trout.rc init.goldfish.rc init.rc default.prop system data sys proc sbin root dev
とかできる。たとえば
$ cat /proc/cpuinfo Processor : ARMv6-compatible processor rev 2 (v6l) BogoMIPS : 383.38 Features : swp half thumb fastmult edsp java CPU implementer : 0x41 CPU architecture: 6TEJ CPU variant : 0x1 CPU part : 0xb36 CPU revision : 2 Cache type : write-back Cache clean : cp15 c7 ops Cache lockdown : format C Cache format : Harvard I size : 32768 I assoc : 4 I line length : 32 I sets : 256 D size : 32768 D assoc : 4 D line length : 32 D sets : 256 Hardware : trout Revision : 0080 Serial : 0000000000000000
とか。
$ adb push hoge /sdcard
とかやるとファイル転送もできるよ!
http://typex2.wordpress.com/2009/02/24/android%EF%BC%88htc-dreamtmobile-g1%EF%BC%89%E7%AB%AF%E6%9C%AB%E3%81%A7%E7%84%A1%E9%80%A0%E4%BD%9C%E3%81%ABdmesg%E3%81%AE%E5%87%BA%E5%8A%9B%E7%B5%90%E6%9E%9C%E3%82%92%E3%83%96%E3%83%AD%E3%82%B0/