This is a small project for building hdparm for Android. In practice, it gives you a ready Docker environment and a build script that produces binaries for multiple architectures (armv5, armv6, armv7, aarch64, x86, x86_64), so you can pick the one you need and test storage on a device.
Important: this project is meant for rooted devices only. Without root, hdparm on Android usually cannot access block devices (/dev/block/...) properly, so running it is mostly pointless.
Build is simple: run it with Docker Compose, then grab the binaries from the out folder.
docker compose up --buildThe usual flow after that is to push the needed binary to the device (for example into /data/local/tmp), make it executable, and run it as root against the block device you want.
adb push out/hdparm-armv7 /data/local/tmp/hdparm
adb shell chmod 755 /data/local/tmp/hdparm
adb shell su -c '/data/local/tmp/hdparm -I /dev/block/mmcblk0'If needed, you can change the hdparm version with the HDPARM_VERSION environment variable.
One extra detail: this build replaces part of the low-level Linux SCSI/ATA calls with Android-friendly stubs, so the binary can be built and launched reliably across Android targets. Because of that, some commands that depend on those mechanisms may return ENOSYS ("not implemented"), and that is expected for this build.