Unpacking and repacking stock rom .img files
http://forum.xda-developers.com/galaxy-s2/general/ref-unpacking-repacking-stock-rom-img-t1081239
OP jazzor
16th May 2011, 07:42 AM | #1
OP Member
Thanks Meter: 140
51 posts
Join Date:Joined: Mar 2010
As most of you are aware, the stock rom tarball is comprised of several .img files which don't seem to be of any file system format and it is difficult at first to see what is inside these files without flashing via Odin.
Well, thanks to fguy, this thread http://forum.xda-developers.com/show....php?t=1054836 provided me the necessary inspiration to investigate just exactly what are these img made of.
Hopefully, this will allow easy removal of all the Samsung junk, deodexing, rooting etc etc without going through adb.
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 (https://android.googlesource.com/pla...system/extras/)
For your convenience, I have 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.
To make the tools, simple extract the attached source code and type "make".
To unpack the .img file:
Code:
./simg2img factoryfs.img output.img
To view the contents of .img file:
Code:
mkdir tempdir; mount -o loop output.img tempdir
To repack .img file:
Code:
./mkuserimg.sh -s /some/directory/with/files ./factoryfs_custom.img ext4 ./temp 512M
As I do not have Odin at the moment, I am not able to test the repacked files can be reflashed successfully. I will test this shortly.
UPDATE
I have just tested repacking the stock factoryfs.img. It so happens that the original ext4_utils does not properly preserve permissions on the new ext4 image. I have made a slight modification to the source and reuploaded the zip.
You can now successfully unpack, remove and change the stock apps, root and modify the stock image using instructions above!!
I hope this will help people create their own custom roms.
UPDATE 27th MAY FOR GALAXY S4 TESTING (i9500 i9505)
A few people have messaged me asking why these tools do not work for the new Galaxy S4. Unfortunately I do not have a Galaxy S4 so I can not test any of these utilities. HOWEVER, it seems there has been quite a bit of updates by Google in the ext4_utils package. I have updated the sources according to 4.2.2 which is the latest version of the tools. I must stress that I DO NOT HAVE A GALAXY S4 TO TEST so don't be expecting miracles. In any case I have uploaded the new code now. As it was before, I have provided a MAKEFILE and you simply type "make" in order to build the tools. They are contained in ext4_utils_new.zip.
Thanks for your support guys. And I do apologize for replying late to my inbox...
Update 9th November 2014
Thanks to qwerty_7564 for providing the fixes for cygwin compilation.
Ext4 utils new still missing link arguments to compile. Investigating. I will update the sources to that of the 4.3 branch later.
Update 3rd December 2014
I have updated the tools to 4.3 branch. Note that no attempts has been made to make this compatible with cygwin as I have no cygwin to test.
As I have mentioned earlier, I do not have a newer samsung device to test any of these files, use at your own discretion. The new files are in ext4_utils_r4.3.tar.gz and is based on the jb release 2.0.0 branch.
Attached Files
ext4_utils_cygwin_fixed.zip - [Click for QR Code] (59.8 KB, 4026 views)
ext4_utils_new_cygwin_fixed.tar.gz - [Click for QR Code] (64.9 KB, 3289 views)
ext4_utils_r4.3.tar.gz - [Click for QR Code] (110.0 KB, 5732 views)
Last edited by jazzor; 4th December 2013 at 01:14 AM. Reason: updated to 4.3
如果编译遇到下面错误:
borou@borou-casa:~/discoduro/BASURILLA/GSII/Varios/ext4_utils$ make
gcc -I. -DANDROID -c make_ext4fs.c
gcc -I. -DANDROID -c make_ext4fs_main.c
gcc -I. -DANDROID -c ext4_utils.c
gcc -I. -DANDROID -c allocate.c
gcc -I. -DANDROID -c backed_block.c
gcc -I. -DANDROID -c output_file.c
output_file.c:25:18: fatal error: zlib.h: No existe el fichero o el directorio
compilation terminated.
make: *** [output_file.o] Error 1
apt-get install zlib1g-dev
Unpacking and repacking stock rom .img files的更多相关文章
- 如何解包,编辑,重新打包boot images
HOWTO: Unpack, Edit, and Repack Boot Images http://forum.xda-developers.com/showthread.php?t=443994 ...
- [How to] ROOT, Backup & Flash (MTKDroidTools, Spflashtool, CWM)
这是一篇来自xda论坛的文章,写得很详细,很有用,以下是原文: Hi This is a guide to ROOT, backup and flash your MTK65xx or Other d ...
- How-to: Tune Your Apache Spark Jobs (Part 1)
Learn techniques for tuning your Apache Spark jobs for optimal efficiency. When you write Apache Spa ...
- 2019-1-7Xiaomi Mi5 刷全球版MIUI教程
2019-1-7Xiaomi Mi5 刷全球版MIUI教程 mi5 教程 小书匠 欢迎走进zozo的学习之旅. 前言 固件下载 刷机 刷recovery,root 试用体验 其他参考 前言 机器是老 ...
- Spark的job调优(1)
本文翻译之cloudera的博客,本系列有两篇,第二篇看心情了 概论 当我们理解了transformation,action和rdd后,我们就可以写一些基础的spark的应用了,但是如果需要对应用进行 ...
- HTTPS数据包抓取的可行性分析
HTTPS数据包抓取的可行性分析 相信只要是从事软件开发, 多多少少都会涉及到数据包的抓取.常见的有网页数据抓取(即网页爬虫),应用程序数据包抓取等.网页数据抓取比较简单, 在chrome下可以非常方 ...
- 一加5安卓P刷入twrp的recovery
本文介绍的方法属于普适性的一般方法,比网上的各种工具箱会繁琐.但是工具箱不一定一直会更新(之前一加论坛的刷机工具箱已经停止更新了,估计是作者不用一加5了吧,毕竟已经好几年的手机了).并且如果你手机更新 ...
- Android开发学习---android下的数据持久化,保存数据到rom文件,android_data目录下文件访问的权限控制
一.需求 做一个类似QQ登录似的app,将数据写到ROM文件里,并对数据进行回显. 二.截图 登录界面: 文件浏览器,查看文件的保存路径:/data/data/com.amos.datasave/fi ...
- android recovery模式及ROM制作
转自android recovery模式及ROM制作 1.总述 为了方便客户日后的固件升级,本周研究了一下android的recovery模式.网上有不少这类的资料,但都比较繁杂,没有一个系统的介绍与 ...
随机推荐
- makefile之strip函数
#$(strip <string> ) #名称:去空格函数--strip. #功能:去掉<string>字串中开头和结尾的空字符,并将中间的多个连续空字符(如果有的话)合并为一 ...
- nyoj983 首尾相连数组的最大子数组和
首尾相连数组的最大子数组和 时间限制:1000 ms | 内存限制:65535 KB 难度:4 描述 给定一个由N个整数元素组成的数组arr,数组中有正数也有负数,这个数组不是一般的数组,其首尾是 ...
- Nokia Imaging SDK
Nokia Imaging SDK 目前为 beta 版本,是诺基亚在自己的图像应用中使用的技术同时提供给开发者 使用.这是一个运行在手机设备上处理图片数据的高效的类库.功能包括 JEPG 图片的编码 ...
- 如何重设 MySQL 的 root 密码
MySQL下创建新用户.新数据库.设定访问权限控制都需要用到root密码.万一把root密码忘了,该怎么办? 幸运地是,重设密码很容易. 安全模式重置法 基本的思路是,以安全模式启动mysql,这样不 ...
- Delphi之Raise抛出异常
相关资料: http://blog.csdn.net/a20071426/article/details/10160171 实例代码: unit Unit1; interface uses Windo ...
- ZooKeepr日志清理(转)
转载请用注明:@ni掌柜 nileader@gmail.com 在使用zookeeper过程中,我们知道,会有dataDir和dataLogDir两个目录,分别用于snapshot和事务日志的输出(默 ...
- PostgreSQL入门指南
默认端口:5432 创建用户与数据库 PostgreSQL初次安装后,默认会生成一个名为postgres的数据库和一个名为postgres的数据库用户.这里需要注意的是,同时还生成了一个名为postg ...
- Application应用程序级变量
对于每一个网站访问用户都要访问的变量,应该将它设为________变量.(选择1项) A. Session B. Reques C. Response D. Application 解答:D
- NANDflash和NORflash的区别(设计师在使用闪存时需要慎重选择)
NANDflash和NORflash的区别(设计师在使用闪存时需要慎重选择) NOR和NAND是现在市场上两种主要的非易失闪存技术.Intel于1988年首先开发出NOR flash技术,彻底 ...
- Restful Web Service初识
一.Web Services Web Services 是一种基于组件的软件平台,是面向服务的Internet 应用.Web Services 框架的核心技术包括SOAP ,WSDL 和UDDI ,它 ...