|
Loop Mounting SGSII (i9100) ROMs
|
|
|
|
|
As you're probably aware, the stock rom tarball for Samsung ROMs is comprised of several .img files. These img files don't seem to be any specific file system, and as such, cannot simply be loop mounted. As it turns out, they are simply sparse ext4 images, and the AOSP source tree already contains the necessary utilities to both unpack and repack these img files via "ext4_utils" in system/extras.
Thanks to jazzor and fguy from XDA-Developers for coming up with this simple method for loop mounting and modifying the images directly.
For your convenience, Jazzor has provided a repackage of the source code for ext4_utils with a simple Makefile, for keen developers to make the necessary tools for unpacking and repacking the stock img files. Making these tools requires a linux development environment, which is beyond the scope of this topic. A virtual machine is fine, and our guide can be found by simply searching for 'linux virtual machine'.
To make the tools, simply extract the following file, and type "make" from within the directory.
EXT4_UTILS DOWNLOAD
To unpack the .img file, copy the factoryfs.img from the tarball (tar.md5) into the same folder as your ext4_utils, and type the following command.
./simg2img factoryfs.img output.img
This will create output.img into the standard ext4 file system type.
To view the contents of .img file:
sudo mkdir tempdir
sudo mount -o loop output.img tempdir
To make your changes, simply use sudo commands:
sudo cp build.prop /tempdir/build.prop
(for example)
To repack the .img file when finished:
sudo ./mkuserimg.sh -s /some/directory/with/files ./factoryfs_custom.img ext4 ./temp 512M
Then simply create the tarball using the files from the stock firmware and your new factoryfs_custom.img. First of all, copy the factoryfs_custom.img to the folder where you extracted the firmware, and rename it to factoryfs.img.
tar -H ustar -c factoryfs.img Sbl.bin modem.bin zImage > ROM.tar
md5sum -t ROM.tar >> ROM.tar
mv ROM.tar ROM.tar.md5
And there you go...
Thanks again to jazzor for this guide, which has been modified slightly to offer a little more detail. Please visit THIS THREAD to thank him for his work.
|
|
|