2017年10月30日の日記の1番目の記事へのコメント
■RetroN 5ハック
Linaroのtoolchain(gcc-linaro-4.9.4-2017.01)を使って、RetroN 5とかで動くバイナリが作れることを確認。さっそく、ファイルやディレクトリの監視をするためのintofiy-toolsをビルドしてみました。
% PATH=~/gcc-linaro-4.9.4/bin:$PATH % tar zvxf inotify-tools-3.14.tar.gz % cd inotify-tools-3.14 % LDFLAGS=-static ./configure --host=arm-linux-gnueabi --enable-static
そのままmakeすると、isdirと_niceassertが多重定義と言われるので、こんな感じの変更を加えてstatic関数化 (´・ω・`)
--- libinotifytools/src/inotifytools.c.org 2017-11-16 19:10:14.630551165 +0900 +++ libinotifytools/src/inotifytools.c 2017-11-16 19:11:54.683737511 +0900 @@ -150,7 +150,7 @@ static char* timefmt = 0; static regex_t* regex = 0; -int isdir( char const * path ); +static int isdir( char const * path ); void record_stats( struct inotify_event const * event ); int onestr_to_event(char const * event); @@ -193,7 +193,7 @@ * * @param mesg A human-readable error message shown if assertion fails. */ -void _niceassert( long cond, int line, char const * file, char const * condstr, +static void _niceassert( long cond, int line, char const * file, char const * condstr, char const * mesg ) { if ( cond ) return; @@ -1594,7 +1594,7 @@ /** * @internal */ -int isdir( char const * path ) { +static int isdir( char const * path ) { static struct stat64 my_stat; if ( -1 == lstat64( path, &my_stat ) ) {
あとはstaticになるようにmakeするだけ。
% make AM_LDFLAGS=-all-static
stripして、ダイナミックリンクしてないか確認。
% arm-linux-gnueabi-strip src/inotifywait % arm-linux-gnueabi-objdump -p src/inotifywait
無事RetroN 5で動くinotifywaitのバイナリができました。これを使うことで、ROMがダンプされたのを契機に、何らかの処理を開始することができます。
ついでに、アプリが使っているデータベースも見てみました。こちらは、普通にsqlite3で読めるやつですね。最初のフィールドが CRC32みたいですな。ダンプした結果を検索すればいいですね・・・って、cksumだとCRC32にならないんだっけ。
2017年10月30日の日記の1番目の記事へのコメント
[コメントを書く]