MIPS Android用にbusyboxをコンパイルする


MIPS Android内のbusyboxでapkを展開しようとすると、以下のエラーがでる。

# busybox unzip ../ni*apk
Archive:  ../nicoWnnG-2011.1115.1-mips.apk
unzip: zip flags 1 and 8 are not supported
#

まぁ、これは、MIPS Androidに限らずARM系でも同じ。
busyboxのコンパイルオプション変更でなんとかならないかなぁ、と調査。

BusyBoxからソースファイルを入手し、コンパイル。

横着してAndroid SDK for MIPS内のコンパイラを使おうとしたら失敗した。
かなり初期段階でエラーがでた。

バイナリ配布のMIPS用クロスコンパイラを探したところ、MIPS DeveloperのCompiler紹介ページで紹介されているCodeSourcery G++ Lite Compilerが良さそうだったので使う。

Sourcery CodeBench Lite 2011.03-93 for MIPS GNU/Linux からAdvanced PackagesのIA32 GNU/Linux TARをダウンロードし、適当なディレクトリに展開した。

$ wget https://sourcery.mentor.com/sgpp/lite/mips/portal/package9055/public/mips-linux-gnu/mips-2011.03-93-mips-linux-gnu-i686-pc-linux-gnu.tar.bz2
<略>
$  bzip2 -dc mips-2011.03-93-mips-linux-gnu-i686-pc-linux-gnu.tar.bz2|tar xf -
$ cd mips-2011.03/bin
$ export PATH=`pwd`:$PATH
$

そのあと、busyboxをダウンロードしたディレクトリに移動。

$ make defconfig
$ make menuconfig

menuconfigを使って、いろいろカスタマイズを実施。
「CONFIG_LZOP_COMPR_HIGH」が圧縮率関連のパラメータっぽいなぁ、とyに変更。
「CONFIG_CROSS_COMPILER_PREFIX=”mips-linux-gnu-“」というポイントを忘れずに。
その他変えたポイントは・・・

CONFIG_STATIC=y
CONFIG_CROSS_COMPILER_PREFIX="mips-linux-gnu-"
CONFIG_FEATURE_SEAMLESS_Z=y
CONFIG_LZOP_COMPR_HIGH=y
CONFIG_FEATURE_VI_8BIT=y
CONFIG_TUNE2FS=y

そして「make」
….
できあがり、転送したが、実行できないバイナリだった。

$ file busybox-test
busybox-test: ELF 32-bit MSB executable, MIPS, MIPS64 version 1 (SYSV), for GNU/Linux 2.6.12, statically linked, for GNU/Linux 2.6.12, stripped
$
# ./busybox-test
./busybox-test: 1: Syntax error: "(" unexpected
#

「CONFIG_EXTRA_CFLAGS=”-march=mips32″」も付け加えてみる・・・不可

おかしいなぁ、と探してみると、busyboxのページでバイナリ配布の1.19.0を発見
以下の3種類があった。

$ file *
busybox-mips:   ELF 32-bit MSB executable, MIPS, MIPS-I version 1 (SYSV), statically linked, stripped
busybox-mips64: ELF 64-bit MSB executable, MIPS, MIPS32 version 1 (SYSV), statically linked, stripped
busybox-mipsel: ELF 32-bit LSB executable, MIPS, MIPS-I version 1 (SYSV), statically linked, stripped
$

それぞれを、ronzi A3に転送して実行してみる。

# ./busybox-mips
./busybox-mips
./busybox-mips: 1: Syntax error: "(" unexpected
# ./busybox-mips ls
./busybox-mips ls
./busybox-mips: 1: Syntax error: "(" unexpected
# ./busybox-mips64 ls
./busybox-mips64 ls
./busybox-mips64: 1: Syntax error: newline unexpected
# ./busybox-mipsel ls
./busybox-mipsel ls
busybox         busybox-mips    busybox-mips64
 busybox-mipsel
#

実行できたのはbusybox-mipselでした。
つまり「ELF 32-bit LSB executable, MIPS, MIPS-I version 1 (SYSV)」のファイルのみ。
そういえば、とsuバイナリを見てみると「su: ELF 32-bit LSB executable, MIPS, MIPS64 version 1 (SYSV), dynamically linked (uses shared libs), stripped」
少なくとも「32-bit LSB」にする必要があるようだ。

$ make CFLAGS="-EL -march=mips32" LDFLAGS="-EL -march=mips32"
<略>
$ file busybox
busybox: ELF 32-bit LSB executable, MIPS, MIPS64 version 1 (SYSV), for GNU/Linux 2.6.12, statically linked, for GNU/Linux 2.6.12, stripped
$

目的とするものが作成されました。

そして、

# ./busybox unzip /sdcard/nico*apk
./busybox unzip /sdcard/nicoWnnG-2011.1115.1-mips.apk
Archive:  /sdcard/nicoWnnG-2011.1115.1-mips.apk
  inflating: META-INF/MANIFEST.MF
  inflating: META-INF/OSAKANAT.SF
  inflating: META-INF/OSAKANAT.RSA
  inflating: assets/and3ime.png
<略>

ということで、無事、apkファイルを展開できるunzip機能をもったbusyboxが完成しました。

これが何のために必要だったのかというと・・・

# ../busybox unzip /sdcard/nicoWnnG-2011.1115.1-mips.apk lib/mips/libnicoWnnGEngDic.so lib/mips/libnicoWnnGJpnDic.so lib/mips/libnicownngdict.so
Archive:  /sdcard/nicoWnnG-2011.1115.1-mips.apk
  inflating: lib/mips/libnicoWnnGEngDic.so
  inflating: lib/mips/libnicoWnnGJpnDic.so
  inflating: lib/mips/libnicownngdict.so
# ls
lib
#

というような感じで、カスタマイズ時に必要なlibファイルの取り出しを自動化できるように、ということだったります。

コンパイルしたバイナリをbusybox-1.19.3-mips.zipに置きました。
中身は「busyboxバイナリ」と「busyboxをコンパイルする際に使う.config」です。

“MIPS Android用にbusyboxをコンパイルする” への10件の返信

  1. 名誉osakana
    あなたは、BusyBoxは1.18.2 MIPSをコンパイルすることができますか?
    “V6スーパーチャージャー” zeppelinrox@ xdadevelopers”
    BusyBoxは1.18.2はが必要です
    それAINOL NOVO7 BASIC MIPSを使用するには

    ありがとうございました

    1. I read Super charget v6 thread.
      This program required “Busybox v1.16.2 OR ABOVE” and “BusyBox WARNING: Some versions are “minimal” with many missing applets and functions! I also find v1.18.3, v1.18.4 and 1.18.5 VERY much a hassle with errors that should NOT be errors! Avoid any such versions! Minimal is BAD!“.

      My busybox created by defconfig setting.
      I think my busybox config is some missing applets.

      you try following binary.
      http://androtab.info/mips/ingenic/clockworkmod/

    1. I try to execute V6_SuperCharger_for_Android-update8.sh on my ronzi A3.

      1st time. following error
      # sh V6_SuperCharger_for_Android-update8.sh
      REMINDER: ONLY USE BUSYBOX v1.18.2 OR LOWER!!
      pgrep: not found
      pidof: not found
      /proc//oom_adj: No such file or directory
      [[: not found
      clear: not found
      REMINDER: ONLY USE BUSYBOX v1.18.2 OR LOWER!!

      [[: not found
      Try Script Manager... it's easier!

      Scrolling speed options...

      0(no waiting), 1(fast), 2(normal), 3(slow)

      Please select scrolling speed (0 - 3): ^C

      I think missing busybox’s symblic links.
      then I create these link.
      # busybox --install /system/bin
      # sh V6_SuperCharger_for_Android-update8.sh
      REMINDER: ONLY USE BUSYBOX v1.18.2 OR LOWER!!
       REMINDER: ONLY USE BUSYBOX v1.18.2 OR LOWER!!

      Try Script Manager... it's easier!

      Scrolling speed options...

      0(no waiting), 1(fast), 2(normal), 3(slow)

      Please select scrolling speed (0 - 3):

      I look work fine.

osakanataro へ返信する コメントをキャンセル

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください