[Tutorial] NOOB-Friendly Instructions on Packing and Repacking system.new.dat file - Android General

I am a Windows user, and I was having quite the trouble unpacking and repacking system.new.dat files. I tried all sorts of Windows Chinese tools for the job, but no matter what I did, when I put the system.new.dat file and system.transfer.list file back into the flashable zip (even if I made no changes to the system.new.dat file... just unpacked and repacked), I would get an error flashing the file.
I finally got around this by installing Ubuntu 16.04 Xenial Xerus on VirtualBox. You can find a lot of tutorials online about how to do that. I am basing my instructions off of xpirt's tutorial on unpacking and repacking with the tools he provides. But it took me about 2 days to figure it out because I kept running into problems since some of the instructions made assumptions that the user knows how to use Linux. I am very new to Linux. I am not completely sure how to do *everything* from the command line, so if someone wants to add to my instructions to make it easier, please do so. But these are the things I did to figure it out.
So here are the noob-friendly Linux Ubuntu instructions on how to unpack and repack:
Section 1: Getting everything Ready
1. Download your flashable .zip rom. In my case, I downloaded cm-12.1-20150619-UNOFFICIAL-afyonltetmo.zip to my Ubuntu Desktop. You can download it to your Home Directory as well. Doesn't matter.
2. Download sdat2img. I downloaded mine to my Home Directory.
3. Download img2sdat. I also downloaded this to my Home Directory.
4. Extract all 3 zips, by right clicking on them and choosing 'Extract Here.' It will extract them into their own directories. The main directories that you need to pay attention to are /sdat2img-master/ and /img2sdat-master/
5. Download ext4fs either right into the sdat2img-master folder, or anywhere you want and then drag and drop it into the sdat2img-master folder.
6. Open Terminal, and install Python 2.7, if it's not already installed. Put
Code:
sudo apt-get install python-2.7 python-pip
Section 2: Beginning the Unpacking Process
*Note, you can copy and paste the codes; however, you can't use keyboard shortcuts in terminal. You have to right click and choose your option.
*Another note: Where you see "user" in the terminal commands, substitute it with your Linux username.
1. In your extracted folder from your flashable zip, right click on system.new.dat and system.transfer.list and choose 'cut.' Then paste them in the sdat2img-master folder.
2. Back in Terminal put
Code:
cd sdat2img-master
. That will get you into the right directory.
3. Now put
Code:
./sdat2img.py system.transfer.list system.new.dat system.img
. That will create your raw ext4 .img file.
4. You want to create an output directory for all the files that are in system.img. Put
Code:
mkdir output
5. Now you can mount system.img, and it will mount it into that output folder. Put
Code:
sudo mount -t ext4 -o loop system.img output/
6. You might have the problem that you don't have ownership of all the files (they have little "locks" on them). To gain ownership, put
Code:
sudo chown -R user:user /home/user/sdat2img-master/output
. If you still can't get read and write access, just try rebooting your Ubuntu virtual computer. That was the only thing that finally worked for me. You can start modifying stuff as you wish.
Section 3: Compress files back to a raw ext4 image
1. You are now going to need your file_contexts file from your original extract rom zip. COPY (not cut) and paste it into the sdat2img-master folder.
2. You are also going to need your 'make_ext4fs' file. Make sure it is in the sdat2img-master folder. You might have trouble with permissions, so just in case, put
Code:
chmod 777 /home/user/sdat2img-master/make_ext4fs
into terminal.
3. In Files (Ubuntu's "File Manager"), in the sdat2img-master folder, right click on your system.img file and go to 'Properties'. Notice the information in "Size." Ignore the GB, but look at the bytes. Mine is 2,411,724,800. Copy that number, but remove the commas. So mine is 2411724800.
4. Next is the actual compressing part. Put
Code:
./make_ext4fs -T 0 -S file_contexts -l 2411724800 -a system system_new.img output/
into terminal, but substitute '2411724800' with whatever size you got from the Properties in system.img. You will now how a new file called system_new.img.
Section 4: Converting ext4 (raw image) to img (sparse image)
1. Now you will need to install img2simg. In Terminal, put
Code:
sudo apt-get install android-tools-fsutils
2. Now you can put
Code:
img2simg system_new.img system_new_sparse.img
You will now have a file called system_new_sparse.img that is ready to be packed in a new dat file.
Section 5: Converting img (sparse image) to dat (sparse data)
1. Cut and paste your system_new_sparse.img into img2sdat-master folder that you made earlier.
2. Now you need to navigate to that folder in terminal. Put
Code:
cd /home/user/img2sdat-master
3. Now you can put
Code:
./img2sdat.py system_new_sparse.img
to create your new dat file. It will first ask you which Android version it's for. Enter the number corresponding and hit enter.
4. You're now pretty much done. As you'll see, it created 3 files: system.new.dat, system.patch.dat, and system.transfer.list. Just paste these files into your folder where your flashable zip files are, replacing any original ones in there. Make sure you also have your file_contexts file in there as well. Highlight all the files in there, right click, and zip them up. Then name your flashable zip whatever you want and try flashing!

Related

How to make a ROM

Hey XDA
This might be a dumb question, but i dont know where else to ask
I would like to try and make my own ROM for my magic, but i have no idea about where to start, so i was wondering if someone knew of a guide, or some other form of "getting startet" thingy?
And what about apps, how do you make them?
Does it require a Linux machine, or can it be done in windows?
Per
I'm interested in this as well , guys nobody wants to share with us your knowledge??
I too would like to know.
bump
I would like to know also. A quick guide or write-up would be supper nice.
Not to burst anyone's bubble but I seriously doubt a quick write-up would explain the steps on to creating your own ROM or how to write apps. If you really want to learn, I would suggest you take some programing classes at your local community college.
cptandroid said:
Not to burst anyone's bubble but I seriously doubt a quick write-up would explain the steps on to creating your own ROM or how to write apps. If you really want to learn, I would suggest you take some programing classes at your local community college.
Click to expand...
Click to collapse
A quick write up doesn't explain it, but equally going to college isn't applicable to rom cooking either.
All the information you need is on the Internet, have a look in this link where the basics are explained, and use google to fill in the blanks ...
http://www.johandekoning.nl/index.php/2009/06/07/building-android-15-build-environment/
The documentation in ASOP recommends Ubuntu for your dev machine (http://source.android.com/download) so familiarity with Linux is essential, also knowing how to use git will save you some time.
Also use the resources in the Dream section in this site. It's been around much longer than the Magic and most dev topics are already covered in a lot more detail than in Sapphire rom development. Above all I think you need a lot of time on your hands and understanding wifes/girlfriends etc as a lot of reading is necessary!
You basically need a Linux distro to be able to do the most modding. Here are the port tools:
http://www.4shared.com/file/122118622/fd190fe1/PortTools.html
Here's a nice quide that you can use as reference:
1. Download the original Nandroid backup of the Rogers-Wiped from Skittleguy (http://forum.xda-developers.com/showpost.php?p=4029461&postcount=4).
2. Unzip Rogers-Wiped.zip and move boot.img to a directory called "Org".
3. Download nk02ion_r4_LITE-signed.zip and upzip it to a directory called "nk02".
4. Move boot.img out of the nk02ion_r4_LITE-signed directory into a directory called "temp".
5. Open your Terminal window and navigate to your "temp" directory.
6. Unpack the boot image inside the "temp" directory :
Execute : $unpack-H.pl boot.img
This should give you 2 new files : boot.img-kernel and boot-img-ramdisk.gz
7. Remove boot.img and boot.img-kernel from the "temp" directory by doing :
Execute : $rm boot.img
Execute : $rm boot.img-kernel
You should now have only one file called boot.img-ramdisk.gz in your temp directory.
8. Navigate to the "org" directory.
9. Unpack the boot image inside the "org" folder :
Execute : $unpack-H.pl boot.img
This should give you 2 new files : boot.img-kernel and boot-img-ramdisk.gz
10. Move the boot.img-kernel file from the "org" directory to the "temp" directory.
Execute : $mv boot.img-kernel ../temp/
11. Remove the "org" directory
12. Navigate to the "temp" direcory
You should now have 2 files inside the "temp" directory, boot.img-kernel and boot.img-ramdisk.gz
13. Create a directory called boot.img-ramdisk inside the "temp" directory :
Execute : $mkdir boot.img-ramdisk
14. Move inside the newly created boot.img-ramdisk directory :
Execute : $cd boot.img-ramdisk
14. Unzip the boot.img-ramdisk.gz file :
Execute : $gunzip -c ../boot.img-ramdisk.gz | cpio -i
15. Check that the ramdisk is unpacked :
Execute : $ls -l
You should now see a bunch of files
16. Remove the boot.img-ramdisk.gz file inside the boot.img-ramdisk directory :
Execute : $rm boot.img-ramdisk.gz
17. Navigate to the temp folder and also delete the boot.img-ramdisk.gz file :
Execute : $rm boot.img-ramdisk.gz
You should now have 1 file called boot.img-kernel and 1 directory called boot.img-ramdisk inside the "temp" folder
18. Repack the kernel and ramdisk to a boot.img file :
Execute : $repack-H.pl boot.img-kernel boot.img-ramdisk boot.img
You should now have a new boot.img inside the "temp" directory.
19. Move the boot.img file to the nk02 directory :
Execute : $mv boot.img ../nk02/
20. Remove the "temp" folder.
21. Navigate to the nk02 folder and check that you have 1 boot.img file and 2 directories (META-INF and system)
22. Zip the boot.img and the 2 directories into an nk02.zip file
Execute : $zip -r nk02.zip *
23. Sign the nk02.zip file :
Execute : $java -jar signapk.jar testkey.x509.pem testkey.pk8 nk02.zip update.zip
24. Push update.zip to your SDcard :
Execute : adb push update.zip /sdcard/update.zip
25. Boot the device in fastboot mode.
27. $fastboot boot recovery-RAv1.0H.img
28. Select "Wipe data/factory reset"
29. Select "Apply sdcard:update.zip"
30. Select "Reboot system now"
31. Enjoy nk02ion_r4_LITE on your HTC branded Magic.
Click to expand...
Click to collapse
The above guide shows you how to modify the boot.img and how to sign the updates. That's a good start...
ok this is a dumb question i imagine but how to i sign a zip file? i have already made my rom but it wont work because it says its not signed
thejesster said:
ok this is a dumb question i imagine but how to i sign a zip file? i have already made my rom but it wont work because it says its not signed
Click to expand...
Click to collapse
Here is the thread where signing is explained.
I am no expert, but I managed to use this to modify other ROM's (Adding wallpaper, ringtones and removing apps etc.)
Signing made easy thread

[GUIDE] How to create a your own ROM

How to create your own ROM update.zip for the T-Mobile MyTouch 3G
Things you will need to perform this:
Java SE Dev Kit from Sun. java.sun.com
May need Cygwin with zlib0 package, from cygwin.com
This will give you Android 1.6 with all the Google applications, Root access.
I never found one place where all this information is all together, so that is why I compiled this together.
Now anyone can do this themselves.
Thanks to all the hard work others have done before this.
1.
First Root your phone and install a new Recovery image, either Amon Ra or Cyanogens Recovery image.
Instructions for one-click root: http://theunlockr.com/2009/08/22/how-to-root-the-mytouch-3g-or-g1-in-one-click/
2.
Download the Android 1.6 System image from
http://developer.htc.com/google-io-device.html
extract the contents of signed-google_ion-img-14721.zip.
3.
You now need to extract the contents of system.img using a tool called unyaffs. The source code is here:
http://code.google.com/p/unyaffs/downloads/list
Or download a prebuilt win32 version here.
http://jiggawatt.org/badc0de/android/index.html
Note you may also need cygwin1.dll and cygz.dll (zlib0 package). Found at cygwin.com
Of course if you already have Cygwin installed with the GCC packages, you can just compile it yourself. Then also
if you comment out the line 67 to "// symlink(oh->alias, full_path_name);"
then it will not create the copies of the symbolic link file, and you will not have to worry about deleting duplicate
symbolic link files later.
Now in the directory where system.img exists, create a new directory called "system"
go into the "system" directory.
type the following command:
unyaffs ..\system.img
That should extract all the files from the system.img file into the system directory.
4.
Now we just need to clean up some items. Since the system.img is a linux file system, it has symbolic
links built into it, but when we extracted it, it just created duplicate files, if you used the prebuilt unyaffs.exe.
So we can just delete the duplicates and have a script recreate the symlink on install.
So we need to delete some extra files from the system\bin directory.
Run the attached DeleteExtras.bat file from the same directory where system.img is in.
If you notice, all the files it deletes are 28 byte files, and if you open them in notepad only contain:
"!<symlink>toolbox..."
And we will remake the symbolic link when it is installed.
5.
Now from the directory where the system.img is, enter the following commands
mkdir META-INF
mkdir META-INF\com
mkdir META-INF\com\google
mkdir META-INF\com\google\android
Now copy the included file "update-script.txt" into the "META-INF\com\google\android" directory
and RENAME it to just "update-script".
This update-script gets run to recreate the symbolic links.
Not sure if these two are needed but they are in some custom ROMs here:
Copy the two files "fix_permissions" and "flash_image" to the "system\bin" directory.
6.
-- Optional --
These add root and Superuser access to the ROM, plus the Terminal Emulator application.
Copy the file "su" from Cyanogen's rom to the folder "system\bin"
Copy the file "Superuser.apk" to the folder "system\app"
Copy the file "Term.apk" to the folder "system\app"
You can also replace the "system\etc\apns-conf.xml" with a more complete one from here:
http://forum.xda-developers.com/showthread.php?t=547718
or here
http://docs.google.com/Doc?docid=0AZNbAmKkmakoZGZxZHNwMnpfMjJkaHg3ejN3eg&hl=en
Turn data roaming off by default by editing line in the build.prop file:
ro.com.android.dataroaming=false
Also to fix the Market program to show "Protected" applications change the ro.build.fingerprint line to the following:
ro.build.fingerprint=tmobile/opal/sapphire/sapphire:1.5/COC10/150449:user/ota-rel-keys,release-keys
Only phones with a fingerprint of a "released" device can access some market applications.
--------------
7.
Now we just need to create a ZIP file for the final ROM
Zip up the following file and two folders:
boot.img
META-INF
system
8.
Now sign the zip file.
See here how to sign a ZIP file for flashing it.
http://androidforums.com/developer-101/8665-how-signing-roms.html
9.
Copy it to your SD card, boot into recovery, wipe, apply the update, Reboot.
You are now running Android 1.6!
the finger print is found in build.prop is this correct and what app do you use to edit your build.prop
Yes the fingerprint is in build.prop
Make sure to use an advanced text editor like TextPad, UltraEdit, or EditPlus. It has to handle UNIX text files.
Also use this for the update_script.
how abt kernel parameters?
How would one go about customizing this with Hero? Or is that not possible at this point?
detox702 said:
How would one go about customizing this with Hero? Or is that not possible at this point?
Click to expand...
Click to collapse
Would like more info on hot to incorporate senseui
Thanks for sharing... Got nothing to do today, so I experimented on my phone... I gotta say, I'm pretty amazed w/ this feature. Was able to sort out and organize my files.
Kudos!
How does one create the system.img file once one has the system files...
What I want to do is use some of the custom roms here and put it on an AVD emulator system.
Can someone help with this please.
NOTE: I dont have linux. So if there is an alternative to mkbootimg, it will be excellent.
the ion is the 32b if I'm not mistaken?
Is there an image for the 32a or do we always have to use the ion and throw a patch over it?
Sorry if this is a stupid question
in step 5. it says
Not sure if these two are needed but they are in some custom ROMs here:
Copy the two files "fix_permissions" and "flash_image" to the "system\bin" directory.
Where do i copy the files from or download please?
thanks in advance
P.S. any tips on changing the splash screen would be much appreciated.
DeleteExtras.txt or DeleteExtras.bat doesn't work. I have to delete the extra files by myself - one by one.
codysoloman said:
DeleteExtras.txt or DeleteExtras.bat doesn't work. I have to delete the extra files by myself - one by one.
Click to expand...
Click to collapse
check this: http://forum.xda-developers.com/showthread.php?t=633246
Perhaps someone here knows or could point me to the right resources, but if the phone isn't supported by Cyanogen, how would a custom rom be made in that case?
How is a custom rom made from scratch? Since android is just linux, is it simply a matter of building it with the right drivers for the phone and installing it? How can an image be manually copied to the phone if it isn't supported by Clockwork recovery? How can it's steps be manually done?
ping pong...
Can i install my own rom on samsung ace?????
anybody knows how to make a ROM customized and make a "update.img" to run on a un-rootable device? I know when you backup a linux image for example ubuntu, this image will run on all other PCs, the image will automatically knows the new PC's drivers and adapt everything with that, is it what happening to an android too ?
---------- Post added at 08:36 AM ---------- Previous post was at 08:33 AM ----------
and pls let me know how to open/edit a "update.img" file, thnx
Question
androidcustomrom said:
How to create your own ROM update.zip for the T-Mobile MyTouch 3G
Things you will need to perform this:
Java SE Dev Kit from Sun. java.sun.com
May need Cygwin with zlib0 package, from cygwin.com
This will give you Android 1.6 with all the Google applications, Root access.
I never found one place where all this information is all together, so that is why I compiled this together.
Now anyone can do this themselves.
Thanks to all the hard work others have done before this.
1.
First Root your phone and install a new Recovery image, either Amon Ra or Cyanogens Recovery image.
Instructions for one-click root: http://theunlockr.com/2009/08/22/how-to-root-the-mytouch-3g-or-g1-in-one-click/
2.
Download the Android 1.6 System image from
http://developer.htc.com/google-io-device.html
extract the contents of signed-google_ion-img-14721.zip.
3.
You now need to extract the contents of system.img using a tool called unyaffs. The source code is here:
http://code.google.com/p/unyaffs/downloads/list
Or download a prebuilt win32 version here.
http://jiggawatt.org/badc0de/android/index.html
Note you may also need cygwin1.dll and cygz.dll (zlib0 package). Found at cygwin.com
Of course if you already have Cygwin installed with the GCC packages, you can just compile it yourself. Then also
if you comment out the line 67 to "// symlink(oh->alias, full_path_name);"
then it will not create the copies of the symbolic link file, and you will not have to worry about deleting duplicate
symbolic link files later.
Now in the directory where system.img exists, create a new directory called "system"
go into the "system" directory.
type the following command:
unyaffs ..\system.img
That should extract all the files from the system.img file into the system directory.
4.
Now we just need to clean up some items. Since the system.img is a linux file system, it has symbolic
links built into it, but when we extracted it, it just created duplicate files, if you used the prebuilt unyaffs.exe.
So we can just delete the duplicates and have a script recreate the symlink on install.
So we need to delete some extra files from the system\bin directory.
Run the attached DeleteExtras.bat file from the same directory where system.img is in.
If you notice, all the files it deletes are 28 byte files, and if you open them in notepad only contain:
"!<symlink>toolbox..."
And we will remake the symbolic link when it is installed.
5.
Now from the directory where the system.img is, enter the following commands
mkdir META-INF
mkdir META-INF\com
mkdir META-INF\com\google
mkdir META-INF\com\google\android
Now copy the included file "update-script.txt" into the "META-INF\com\google\android" directory
and RENAME it to just "update-script".
This update-script gets run to recreate the symbolic links.
Not sure if these two are needed but they are in some custom ROMs here:
Copy the two files "fix_permissions" and "flash_image" to the "system\bin" directory.
6.
-- Optional --
These add root and Superuser access to the ROM, plus the Terminal Emulator application.
Copy the file "su" from Cyanogen's rom to the folder "system\bin"
Copy the file "Superuser.apk" to the folder "system\app"
Copy the file "Term.apk" to the folder "system\app"
You can also replace the "system\etc\apns-conf.xml" with a more complete one from here:
http://forum.xda-developers.com/showthread.php?t=547718
or here
http://docs.google.com/Doc?docid=0AZNbAmKkmakoZGZxZHNwMnpfMjJkaHg3ejN3eg&hl=en
Turn data roaming off by default by editing line in the build.prop file:
ro.com.android.dataroaming=false
Also to fix the Market program to show "Protected" applications change the ro.build.fingerprint line to the following:
ro.build.fingerprint=tmobile/opal/sapphire/sapphire:1.5/COC10/150449:user/ota-rel-keys,release-keys
Only phones with a fingerprint of a "released" device can access some market applications.
--------------
7.
Now we just need to create a ZIP file for the final ROM
Zip up the following file and two folders:
boot.img
META-INF
system
8.
Now sign the zip file.
See here how to sign a ZIP file for flashing it.
http://androidforums.com/developer-101/8665-how-signing-roms.html
9.
Copy it to your SD card, boot into recovery, wipe, apply the update, Reboot.
You are now running Android 1.6!
Click to expand...
Click to collapse
Could you tell me where I can correct the fake data in the phone like the real RAM is 512 MB but it say 1GB ,can you tell me how to
correct it thanks in advance:good:

[DEV-GUIDE] Flytouch 3 Superpad 2 - Custom ROM building tutorial

Dear All,
I have been building some custom Android ROMS for the past few years, and my latest toy is a Flytouch 3 I wanted to share some of my findings and methods here, perhaps other newbies like me will find it useful.
1. FT3 ROM contents:
FT3 ROMs will be in RAR or ZIP format and have 2 or 3 files in them as explained below. Just unzip or unrar the package to use them:
firmware2 - flash tool which burns the firmware ( I guess...lol)
bootloader-discovery - 7zip file which contains the bootloader
IMPORTANT! Do not flash a wrong bootloader to your device or it will be bricked! Actually this is the only way you can brick the thing, it's pretty sturdy in that sense. If you are not sure, do not copy bootloader-recovery to your sdcard when flashing, it will boot with your existing bootloader anyway.
firmware-discovery - 7zip file which contains the firmware and it's the main file you want to edit.
2. firmware-discovery contents:
This is the easy part! Modifying this file will let you modify system and data partitions. You can also use different ramdisks and kernels compatible with your device. It's a 7zip file and you can unpack and repack easily with the 7-zip file manager (http://www.7-zip.org/).
I use 7-zip on Windows although I use Ubuntu Linux as my main OS. There is something wrong with my 7-zip installation most probably, but I was too lazy to check it If you are on Windows anyway, you are good, just download and use 7-zip from the URL above. I advise that you do all your firmware-discovery editing within 7-zip file manager. That way, you won't have to worry about re-packing with the correct 7-zip settings. At least, that's how I do it and had no problems.
firmware-discovery will have these files in the 7zip package:
uImage - kernel
Very important Your kernel will make the difference between having and not having certain functionality, even if your hardware supports it.
uImage_recovery - recovery file - I beleive this is what runs when you push menu+power.
ramdisk.img - ramdisk
This is one of the interesting files you might want to play with. Ramdisk is a simple file system with some crucial files, mainly init.rc that lets you control the boot process. You can also stick a initlogo.rle image here to display a splash image in initial boot. More details below at title 4.
data.tar - /data partition - tar archive
All user data is stored here, including apps and user definable settings. This is what gets wiped when you do a recovery by pushing menu+power.
system.tar - /system partition - tar archive
System data, drivers and apps, including Android OS itself (except kernel). Certainly the most interesting part for the average modder
3. Editing system.tar and data.tar:
This might be the bulk of your modding, and most probably what will be most visible to the end user.
I very strongly suggest that you use a Linux system to edit these files. If you use Windows, file permissions will not be saved! If Windows is your main OS, simply install a VM host such as VirtualBox and install your fav Linux distro inside it. Most of them will have an Archive Manager with a GUI and will certainly support TAR. Even without a GUI, you can use "tar" and "untar" commands from a terminal to unpack and repack these files. When you are on Linux, TAR files will preserve file ownership and file permissions. This can be very crucial in your modding.
For modders who are new to Linux, I can recommend Ubuntu. It's very user friendly and easy to use in my opinion.
When you are done editing system.tar and data.tar copy them to your Windows box and drop and them to firmware-recovery file within 7-zip file manager.
4. Unpack, Edit and Repack ramdisk.img:
Now we are on to more serious stuff ramdisk.img consists of a 64 byte U-Boot header, followed by a gzip compressed ramdisk cpio image. So we need to strip the first 64 bytes, and use gunzip to extract it to a folder. After making the changes in the folder, we need apply cpio+gzip compression to the folder and add the 64 byte u-boot header again. You will need to use Linux and install the mkimage tool for these operations.
Here's the command to install mkimage tool in Ubuntu:
Code:
sudo apt-get install uboot-mkimage
It sounds complicated, but no worries, I have some shell scripts that can do all that for you! Thanks to leeh33 from Techknow for the scripts below:
unpack_ramdisk.sh
Code:
mkdir ramdisk
cd ramdisk
dd if=../ramdisk.img bs=64 skip=1 of=ramdisk.gz
gzip -dc ramdisk.gz | cpio -idmv
rm ramdisk.gz
repack_ramdisk.sh
Code:
cd ramdisk
find . | cpio -o -H newc -C 512 | gzip -n > ../ramdisk.cpio.gz
cd ..
mkimage -A ARM -O Linux -T ramdisk -C none -a 0x41000000 -e 0x41000000 -n hRamdisk -d ramdisk.cpio.gz ramdisk.img
rm ramdisk.cpio.gz
Create the scripts above using a text editor or download the attachment to this post and put the scripts together with your ramdisk.img file in a new folder. Executing unpack_ramdisk.sh will create a folder named ramdisk and extract the ramdisk contents here. You can edit e.g. init.rc in this folder, or add a static bootlogo. To add a custom bootlogo create a initlogo.rle image file by following this guide: http://www.androidtablets.net/forum/android-tablet-hacking/438-how-setup-static-bootlogo-before-animated-boot-animation.html Then place the resulting initlogo.rle file directly in the ramdisk directory.
After you are done editing the ramdisk folder, simply run repack_ramdisk.sh and your new ramdisk.img will be created, replacing the old one. Copy the ramdisk.img file to your Windows box again and drop it to firmware-recovery file within 7-zip file manager.
That's it, you have a custom ROM now! Please feel free to ask questions or correct me if you think I have any errors in the info above.
Happy Modding!!!
Tolga
Big problem about my device...
Thank you for this useful post!
I have seen a good knowledge about these devices(flytouch 3) and decided to post my question here:
I have a big problem! I used IUW Burning tool to flash my device. my device is:
SuperPad III (As box says)
Model: ANDR P1001
I decided to try tim's custom rom. It doesn't work. After restarting the device, screen become black (There was no connection
with screen, it was not turned on). The device had vibration when I pressed power button. It continued vibrating periodically(like it was restarting).
After that I flashed my device using IUW with most likely firmware, but during the process I FORGOT TO CHOOSE userdata.img FILE!
Now the device can't even communicate with pc.
OTG method is not working. The device no more vibrates at start up! At motherboard led is lighting when pressing power button.So IS MY DEVICE DEAD? Or is there any solution in this situation(Alternative communication, or whatever...)

[GUIDE] How to extract system files from stock firmware

Ok, so I know many users are looking forward to create a custom rom. Where are you gonna get the system files from? Sure you can get it from a CWM backup. You can also extract the system files and the respective kernel from PDA.tar. Sure everyone knows it's in there but very few exactly know how to extract them. The system files are in the file "system.img".
So the 1st step is to open the PDA.tar using 7-zip and extract the system.img to a particular folder.
Download sgs2toext4.jar from attachment. It's a .jar file created by dphrozen to convert .img files to .ext4.img. Place that file anywhere in C:\ and then open the Command Prompt. In the command prompt, set the directory to the folder where sgs2toext4.jar is placed. Then type this command :-
Code:
java -jar sgs2toext4.jar
A window will open which is gonna ask you to drop the .img file in it. Simply drag the system.img to the window and the process of converting it to system.ext4.img will start. After the process is complete, you'll find system.ext4.img file in the same folder where your system.img file was placed.
Now, download Linux Reader. Install and then open it. At top left, go to Drives -> Mount Image. A window will open up. Browse to system.ext4.img and select it.
That's it! Now you can view all the system files. Export all of them to a particular folder. After exporting, you'll see an extension .efs.ntfs at the end of each file. Just delete that extension and you're good to go!

[DEV] Android M Apps and Framework deodexing (LINUX)

Okay so I decided I'd make a thread on this, so that everyone would know. (why else? )
Pretty Noob friendly...
needed libs:
https://drive.google.com/file/d/0B9uqk9InEzCYMUtaZGI0ekJRNUU/view?usp=sharing
EDIT: FRAMEWORK.jar IS TRASH
READ HERE
https://github.com/testwhat/SmaliEx/issues/3
If you just want nexus 5 andorid preview 1 (first) apps to add to your rom, https://drive.google.com/folder/d/0...3WVBuaHNMeVQwZ3lzbkZIM0ZLRGJIZTUxMWpFd00/edit
Put apps, some priv-apps, and even less frameworks
Requirements:
Java 8 JRE or JDK
git
Device targeted
Okay so first you need to
1. take your system.img (If you don't have that check the bottom of this post) and unexact it (if you don't know how, bottom of post).
2. "git clone --recursive https://github.com/Aaahh/deodex-app" to your home folder or folder of choosing
3. "cd ~/deodex-app" or to where you cloned it
4. Now copy that unextracted system.img (/system folder) to deodex-app's folder
5. Now open terminal and run "./all"
6. that will deodex everything, but bootclass frameworks are different.
7. Take your device, plug it in, run "./oat2dex devfw"
8. take the boot-jar-result and copy it to deodex-app/out/framework
9. Now copy the contents of deodex-app/out to /system
10. repack system (bottom of post)
11. fastboot flash system system_new.img and your done.
Dump system image from device:
If you don't have system.img than follow this: http://forum.xda-developers.com/showthread.php?t=2450045
Decompile system.img
Depending on how you got your system image,
if you took it from a flashable zip, http://forum.xda-developers.com/and.../how-to-conver-lollipop-dat-files-to-t2978952 (Post two, after mounting, make a copy of the mounted folder, thats /system)
if you took it from google preview, (or sparse)
1. git clone https://android.googlesource.com/platform/system/extras -b android-m-preview
2. cd extras/ext4_utils
3. cd ../../
4. ./extras/ext4_utils/simg2img system.img system.raw.img
5. then mount that and make a copy of the mouted folder, that's your /system folder
How to repack /system
Download this, https://mega.co.nz/#!8cxUALSK!tNFals1oIxqKzd51Czf7vORlc8NA_WKeHPxbDNfOYsg
then use it like this
./make_ext4fs -T 0 -S file_contexts -l 1073741824 -a system system_new.img output/
file_contexts is from your zip, if you can't find it check your boot.img, if you can't do that and you have selinux permissive, then just find any device's file and use it.
awesome
Nice
Sent from my LG-P705 using Tapatalk
Aaahh said:
Okay so I decided I'd make a thread on this, so that everyone would know. (why else? )
Pretty Noob friendly...
If you just want nexus 5 andorid preview 1 (first) apps to add to your rom, https://drive.google.com/folder/d/0...3WVBuaHNMeVQwZ3lzbkZIM0ZLRGJIZTUxMWpFd00/edit
Put apps, some priv-apps, and even less frameworks
Requirements:
Java 8 JRE or JDK
git
Device targeted
Okay so first you need to
1. take your system.img (If you don't have that check the bottom of this post) and unexact it (if you don't know how, bottom of post).
2. "git clone --recursive https://github.com/Aaahh/deodex-app" to your home folder or folder of choosing
3. "cd ~/deodex-app" or to where you cloned it
4. Now copy that unextracted system.img (/system folder) to deodex-app's folder
5. Now open terminal and run "./all"
6. that will deodex everything, but bootclass frameworks are different.
7. Take your device, plug it in, run "./oat2dex devfw"
8. take the boot-jar-result and copy it to deodex-app/out/framework
9. Now copy the contents of deodex-app/out to /system
10. repack system (bottom of post)
11. fastboot flash system system_new.img and your done.
Dump system image from device:
If you don't have system.img than follow this: http://forum.xda-developers.com/showthread.php?t=2450045
Decompile system.img
Depending on how you got your system image,
if you took it from a flashable zip, http://forum.xda-developers.com/and.../how-to-conver-lollipop-dat-files-to-t2978952 (Post two, after mounting, make a copy of the mounted folder, thats /system)
if you took it from google preview, (or sparse)
1. git clone https://android.googlesource.com/platform/system/extras -b android-m-preview
2. cd extras/ext4_utils
3. cd ../../
4. ./extras/ext4_utils/simg2img system.img system.raw.img
5. then mount that and make a copy of the mouted folder, that's your /system folder
How to repack /system
Download this, https://mega.co.nz/#!8cxUALSK!tNFals1oIxqKzd51Czf7vORlc8NA_WKeHPxbDNfOYsg
then use it like this
./make_ext4fs -T 0 -S file_contexts -l 1073741824 -a system system_new.img output/
file_contexts is from your zip, if you can't find it check your boot.img, if you can't do that and you have selinux permissive, then just find any device's file and use it.
Click to expand...
Click to collapse
Sorry for the question but ^^ you did upload the N5 apps and framework but what about libs for Google apps?
manups4e said:
Sorry for the question but ^^ you did upload the N5 apps and framework but what about libs for Google apps?
Click to expand...
Click to collapse
Ay you got me there
Forgot about that
Framework.jar is trash
https://github.com/testwhat/SmaliEx/issues/3

Categories

Resources