Sunday, June 4, 2017

Creating a custom data image / userdata.img for Android

This is a small description / tutorial on how to create a custom data image for flashing along with Android files. This is usually done to preload settings (if you created one e.g. from Customizing / Changing Android DPI settings or would like to load other data related files / information)

Get the required tools:


Create an ext4 img file (in the example ~10GB)
dd if=/dev/zero of=data.img bs=1M count=10240
mkfs.ext4 data.img

Populate the data (sudo might be required)
mount -o loop data1.img mnt
// copy files to mnt
umount mnt 

Convert to simg
img2simg data.img userdata.img

You can now use userdata.img to flash with fastboot and other flashers/installers.

No comments: