Cross compile static e2fsprogs for Android

Get the latest version. Alternate locations here.

I worked with 1.42.6. Download it and extract.

tar -jxvvf e2fsprogs-1.42.6.tar.bz2
cd e2fsprogs-1.42.6
mkdir ~/e2progs
./configure --prefix=/home/droidzone/e2progs --host=arm-linux-gnueabihf
kate Makefile

Add -static to CFLAGS.

The final CFLAGS look like this:

CFLAGS = -g -O2 -static

make and install:

make install

The final binaries are put in ~/e2progs/sbin/

The final file is said to be dynamically linked, but I doubt if that’s actually true, since under lib, there’s only one file: e2initrd_helper

file ~/e2progs/sbin/e2fsck 
/home/droidzone/e2progs/sbin/e2fsck: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.31, not stripped


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.