• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Root Creating Custom ROMs/Backups for Odin

You are probably missing the cpio program. Run the Cygwin installer again and when prompted to choose packages search for "cpio" and add it. It should be listed under the Archive category.
Yes, "cpio" was not there. I reinstalled a bunch of packages and I finally got it .


Try "$ which find" to see what ones you will be using.
My system is using the correct find.

I have a question on permissions. I list the files but it doesn't list "root" or "root.root" as owners. It only lists my Windows username and group as having ownership, ie: "steven" "Domain Admins". Is this ok or do I need to change something in my Cygwin profile so that I am using root?

Thanks
 
Upvote 0
I have a question on permissions. I list the files but it doesn't list "root" or "root.root" as owners. It only lists my Windows username and group as having ownership, ie: "steven" "Domain Admins". Is this ok or do I need to change something in my Cygwin profile so that I am using root?

Thanks

The cpio command uses "-R 0.0" which will assign root.root as owner for all files when copied into the archive.

You could chmod 0.0 * the files in the directory before if you want. You will see that you are still listed as the owner and "root" is now the group. But if you do "ls -ln" you will see the uid's and gid's are actually 0 and 0.

I guess that since Windows doesn't do ACL's the same way as Linux, nor does it have a "root" user, Cygwin will just interpret uid 0 as the current Windows user. The uid number is what matters, though.

I don't know what the uid's and gid's are for users and groups on the phone. I would keep everything as root and then change them with the init.rc on boot. Root is always '0'.
 
Upvote 0
Someone can try using my kernel/recovery customization instructions to extract and rebuild the image leaving the files untouched. Let me know if its clear enough.

Ok, I have successfully rebuilt the images from my phone and downloaded them via Odin One Package. My phone boots back up but there are a few apps giving me issues. Some FC and others appear to be there but aren't installed or something. I'll have to try a few things to see if I can get them back.
I built the package using the kernel and recovery files that I extracted and then rebuilt. I also added my untouched userdata and system files that I dumped along with the others. Maybe I shouldn't have added these two and just built the package from the kernel and recovery.:thinking:

Anyway I was able to follow along with the instructions but a few things were no very clear.

1. Do I need to do all of the dumps from recovery mode or should just the 'system' ROM be dumped in recovery?

2. At first I didn't realize that the instructions jumped from adb dumps to working in Cygwin/linux ie:
  1. Run the following command to dump the recovery partition:
    Code:
    # dd if=/dev/block/bml6 of=/sdcard/recovery bs=4096
  2. Retrieve the dumped file from the SD Card.
  3. Make a copy for backup purposes! We will be editing these.
  4. Create a working folder for each of the dumped kernel and/or recovery images and move them there.
The commands that follow are from Cygwin:
  1. Split the images in each working folder into the binary and ramdisk.
  2. Code:
  1. $ head -c 1785856 kernel > krnl.bin
$ tail -c +1785857 kernel > rd.cgz
---------------------------------------------------------

3. I guessed and changed directories inbetween these commands:
ran from the /initramfs directory
$ find | cpio -H newc -R 0.0 -oa | gzip -cn1 > ../rd.cgz
then cd ..
$ cat rd.cgz >> krnl.bin
hopefully this was correct.

That's it, everything else seemed clear. Thanks for the information. I guess the next step will be to figure out where to customize the rom and get really dangerous.
 
Upvote 0
So I ended up unable to restore the Samsung Camera and what appeared to be a corrupt /data/app directory. When I listed the directory there were some files listed but many entries with just '~'. I could not remove the directory or any files and try to restore them.

At this point I just did a Master Reset, restoring factory settings. One good thing that I learned and was surprised at, is that the reset put me back to microhaxo's 1.6 ota V2 rom along with a rooted kernel! Talk about persistent root, well done guys.
 
Upvote 0
So I ended up unable to restore the Samsung Camera and what appeared to be a corrupt /data/app directory. When I listed the directory there were some files listed but many entries with just '~'. I could not remove the directory or any files and try to restore them.

At this point I just did a Master Reset, restoring factory settings. One good thing that I learned and was surprised at, is that the reset put me back to microhaxo's 1.6 ota V2 rom along with a rooted kernel! Talk about persistent root, well done guys.

Thanks for the feedback. I'll update the instructions to be more clear at those points.


As for what needs to be extracted in recovery mode..

When you make the dump you are reading out from an active device. Basically you don't want the ROM's state to change while the dump is underway.

Normally /system is read only (not so when rooted but still minimal activity here). /data will be pretty busy, though.

The best way to prevent this would be to make the ROM dump while in the simplest environment possible. You could try copying busybox into / so its loaded into the ramdisk, unmounting all the flash file systems, mount the sdcard, and do the dump then. That would be pretty thorough.

Laid out that would be:

  1. boot into recovery
  2. copy busybox to / or /sbin
  3. unmount /data, /system, and /cache
  4. mount the sdcard
  5. busybox dd the flash block devices out to the sdcard
I hope that isn't too much. If you need help with the exact commands I can get those to you.

This means I better make "Dumping your ROMs rev2" before people start making corrupt backups...
 
Upvote 0
The kernel and recovery dumps don't include the boot stuff do they (I don't want to backup the boot loader).

The boot process is multipart and uses 3 different partitions before loading the kernel and the Android environment. I didn't include those 3 partitions in the dump instructions because they don't ever need to be updated and it would be dangerous to try.

The kernel and recovery images only contain the kernel binary and ramdisk filesystem (and its contents) in Android format.

The kernel and recovery partitions can be backed up and reflashed without risk as the flash control software is actually in the 3rd boot partition.

If you want to modify the kernel boot parameters, init.rc script, ramdisk filesystem, or recovery tools you will want to dump kernel and/or recovery.
 
  • Like
Reactions: lych
Upvote 0
hello, sorry for bumping old thread up.

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Users\humy>adb shell
shell@android:/ $ su
su
root@android:/ # dd if=/dev/block/stl14 of=/sdcard/userdata bs=4096
dd if=/dev/block/stl14 of=/sdcard/userdata bs=4096
/dev/block/stl14: cannot open for read: No such file or directory
1|root@android:/ #

same result when i use cygwin terminal

what should i do?
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones