[Q] init.rc - Android Q&A, Help & Troubleshooting

Hi there!
I've been messing around with my Samsung Galaxy 5 (GT-I5500), Android 2.1-1 but can't for the life of me find out where the /init.rc come from!
I managed to get the contents of recovery.img ramdisk, but the init.rc that is there is ~ 1Kb, while the /init.rc from the device is ~18Kb (that I flashed with this same image that I extracted the ramdisk from).
I can remount / rw, but after reboot, the init.rc is back to what it was before. All I can think of is that it comes from some kind of ramdisk, but I can't find it.
Where does the /init.rc come from? How can I modify it?
Thanks!

Sharper-BR said:
Hi there!
I've been messing around with my Samsung Galaxy 5 (GT-I5500), Android 2.1-1 but can't for the life of me find out where the /init.rc come from!
I managed to get the contents of recovery.img ramdisk, but the init.rc that is there is ~ 1Kb, while the /init.rc from the device is ~18Kb (that I flashed with this same image that I extracted the ramdisk from).
I can remount / rw, but after reboot, the init.rc is back to what it was before. All I can think of is that it comes from some kind of ramdisk, but I can't find it.
Where does the /init.rc come from? How can I modify it?
Thanks!
Click to expand...
Click to collapse
It's in the boot.img file. You have to unpack the .img and then the ramdisk, but it's in there. dsixda's kitchen should do that for you. That's what I use to do it. If not, there used to be a site that explained all of that, but I cannot seem to get it to pull up in a browser.
http://android-dls.com/wiki/index.php?title=HOWTO:_Unpack,_Edit,_and_Re-Pack_Boot_Images

gnarlyc, do you know how to extract init.rc?

init.rc is stored inside ramdisk. you can extract it from a kernel. since it's stored inside the kernel, there's no way to modify except install a custom kernel.

Related

[Q] Question: Editing init.rc and other files.

Hey guys,
i have the following issue: I'm on stock KPN rom, stock kernel, etc. (only rooted and deodexed). I want to experiment al little bit with tweaking and stuff. What i am trying to do now is putting all the lines from a ramscript to my init.rc file to see what happens.
When i try this my phone saves the changes that i made, but when i reboot all the changes are gone. The same happens when i change the values in for example the lowmemorykiller file.
Does any one know something about this and how to keep all the changes?
Hope to hear from you guys.
Same problem for me. Why is this happening?
I think this is not a file permissions issue.
My English not good enough to explain. init.rc stored in initramfs (boot.img). initramfs mounted into memory at boot time, all changes to the initramfs only occur in memory rather than in boot.img. Only one way to change init.rc: unpack boot.img, change init.rc, then back repack boot.img. Learn how dsixda kitchen works to understand all this stuff
ketut.kumajaya said:
My English not good enough to explain. init.rc stored in initramfs (boot.img). initramfs mounted into memory at boot time, all changes to the initramfs only occur in memory rather than in boot.img. Only one way to change init.rc: unpack boot.img, change init.rc, then back repack boot.img. Learn how dsixda kitchen works to understand all this stuff
Click to expand...
Click to collapse
Hey Ketut,
thanks for your anwser. When i find the time i will try to understand a little more of this stuff.
Cheers
Where to find boot.img?
Sent from my GT-S5830 using Tapatalk

Init.d Explanation?

I was playing around with some scripts from Caulkin on some other versions of Froyo to try and improve performance. I have read up on the init.rc script and use of the init.d folder. I have set all this up and have edited the init.rc script to run the init.d scripts, but it gets overridden by the base init.rc on reboot. I had read somewhere that you cannot directly edit the init.rc and that it will be overridden on boot from the boot.img. Can someone confirm that? I thought most roms now have the ability to use init.d out of the box, but it doesn't look like it on Brilliant Corners. Can someone confirm that? Do you know of any Froyo ROMS, other than Caulkins, that has init.d capability? Thanks
markmac said:
I have set all this up and have edited the init.rc script to run the init.d scripts, but it gets overridden by the base init.rc on reboot.
Click to expand...
Click to collapse
Are you using the run-parts program?
I had read somewhere that you cannot directly edit the init.rc and that it will be overridden on boot from the boot.img. Can someone confirm that?
Click to expand...
Click to collapse
That's correct.
Thanks for the response. I was editing the init.rc directly which obviously won't work. So i need to look into building my own boot.img or another option. I was using run-parts setup as a service. I would have thought most kernels/ROMs would support this now, but it does not appear that way.
markmac said:
So i need to look into building my own boot.img or another option.
Click to expand...
Click to collapse
You don't need to build your own new image; you can just modify the existing one by flashing. Take a look at the attachements in these 2 posts where I've done just that. Just make sure the script is idempotent if other people will use it.
Post 1
Post 2
Thanks will definitely check this out.
Looked at this. So to update the init.rc file I would have to edit and package into a boot.img file, then flash the img file with adb or nvflash correct?
markmac said:
So to update the init.rc file I would have to edit and package into a boot.img file, then flash the img file with adb or nvflash correct?
Click to expand...
Click to collapse
No. That's too much work for the user. My technique is meant to be like flashing a new kernel. No external utilities are needed. Just CWM (or, possibly, even standard recovery).

[Q] Finding /proc/ and /sys/ Contents in ROM

Hello,
I want to determine the ROM of a phone I do not have, in particular the pseudo folder /proc and /sys/. Normally I used ADB shell in order to skim through the folders, but since I do not have the phone here now, I thought that I should be able to find these contents somewhere in the ROM. But I checked in several image parts of the ROM (boot.img, ramdisk.img, system.img e.g.), but the /proc/ as well as the /sys/ folder were always empty.
Can somebody help and tell where (or if?) these folders can be found in the ROM?
Greetings
these are runtime files in a tempfs .
Those folders are linked at runtime by the kernel. You wont find them in zip packages or anywhere else other than a running phone.
Anyways, this needs to be moved.

How to extact zImage?

So i have extracted the boot.img file from my favourite ROM using abootimg and got the following:
bootimg.cfg
intird.img
zImage
Now i can see that the bulk of the kernel is in the zImage file though for the life of me i can't work out how to extract it.. Can it even be done?
I want to add overclocking to my old Grouper device i have the commits. if i could just see the file structure i can replace the files needed within the arch/arm folder and recompile i'd be done! i've searched everywhere though no one seems to advise on how to do it.
Thanking you in advance.

Boot.img or system.img unpack / repack, different size, odin fails, no boot

Well, as the title sugests, I've tried to root my phone (Samsung Galaxy J1 SM-J100MU) and failed. Since no twrp or any other custom recovery is made for my specific model, I tried the method that involves mounting the android systems and modifying the famous build.prop, or putting su binaries inside the /system folder.
I ran an unpack script from ubuntu to decompress the boot file, and simg2img to be able to mount /system following some guides I've found, and made use of mkbootimg to repack it and flash it.
The thing is that the phone won't boot because the modified boot image size differs from the original. The system also differs but Odin won't even flash it and I'll have to reflash the stock rom.
Any ideas about what it can happen? I get no apparently errors during the process of unpacking/repacking the images so I don't know. The only thing I can think of is that the unpack script says something like "There's an extra file in ramdisk; though this file can exist, the script is not made for this type of ramdisk", so I edited the script in order to skip this warning, and everything else went well. The bootimg got unpacked and then the ramdisk and then I modified default.prop.
Well, that's it, I hope you can understand and give me some help in order to proceed.
Thank you in advance.

Categories

Resources