[Q] Question: Editing init.rc and other files. - Galaxy Ace S5830 General

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

Related

[Q] init.rc

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.

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).

boot.img changes after unpack-repack without edit

I have met some problem with boot.img and need some help if there's somebody know it.
I used unmkbootimg and mkbootimg, I unpacked a boot.img then got zimage and initramfs.cpio.gz, I repacked it without any edit but the new boot.img becames smaller, it changed from 13M to 7.9M, and the phone couldn't boot from new boot.img,
and there is no question if I use a boot.img extracted from an android3.x-version rom, but if the android version changes to 4.x, the unpack-repack process would lose much size...I tested on mi2s' rom......I don't know if there are some files that will be lost in unpack process, or say the process just ignore files other than zimage and initramfs...
does anybody knows why?
binghemoye said:
I have met some problem with boot.img and need some help if there's somebody know it.
I used unmkbootimg and mkbootimg, I unpacked a boot.img then got zimage and initramfs.cpio.gz, I repacked it without any edit but the new boot.img becames smaller, it changed from 13M to 7.9M, and the phone couldn't boot from new boot.img, does anybody knows why?
Click to expand...
Click to collapse
It could be because of incorrect settings for mkbootimg or there more files,than zImage and initramfs, needed for proper work. Hard to say without more information.
Sorry for my bad English.
B.B.N. said:
It could be because of incorrect settings for mkbootimg or there more files,than zImage and initramfs, needed for proper work. Hard to say without more information.
Sorry for my bad English.
Click to expand...
Click to collapse
There is no question if I use a boot.img extracted from an android3.x version rom, but if the android version changes to 4.x, the unpack-repack would lose much size...I tested on mi2s' rom......I don't know if there are some files that will be lost in unpack process, or say the process just ignore files other than zimage and initramfs...

Adding a custom init.rc script

i know we can add a init rc script.. by using..
import /init.something.rc in init.rc or init.<hardware>.rc
but they have to be included in the ramdisk.. so i have to like unpack boot.img, decompress ramdisk,
modify files, compress, repack, flash.. modify files, compress, repack flash.. @[email protected]
is there some way i can get it to load a custom rc script.. in /system or some other partition? so i can just edit the rc script there..
i will add it later to ramdisk.. i just need this for testing.. is there some workaround for this??
hey
psych.half said:
i know we can add a init rc script.. by using..
import /init.something.rc in init.rc or init.<hardware>.rc
but they have to be included in the ramdisk.. so i have to like unpack boot.img, decompress ramdisk,
modify files, compress, repack, flash.. modify files, compress, repack flash.. @[email protected]
is there some way i can get it to load a custom rc script.. in /system or some other partition? so i can just edit the rc script there..
i will add it later to ramdisk.. i just need this for testing.. is there some workaround for this??
Click to expand...
Click to collapse
go here
http://forum.xda-developers.com/showthread.php?t=2073775
moonbutt74 said:
go here
http://forum.xda-developers.com/showthread.php?t=2073775
Click to expand...
Click to collapse
and i know how to unpack/repack boot.img and edit ramdisk... done it like hundereds times..
the problem is that the device i am working on does not have fastboot.. so testing my changes in ramdisk is really difficult...
i just want to add a custom rc script.. somewhere in /system partition.. so i can just edit the rc script there. without having to pack/repack the boot.img
something like this should be added in init.rc or init.<hardware>.rc
Code:
import /system/etc/init.custom.rc
but i don't know where to add that..
hey
psych.half said:
and i know how to unpack/repack boot.img and edit ramdisk... done it like hundereds times..
the problem is that the device i am working on does not have fastboot.. so testing my changes in ramdisk is really difficult...
i just want to add a custom rc script.. somewhere in /system partition.. so i can just edit the rc script there. without having to pack/repack the boot.img
something like this should be added in init.rc or init.<hardware>.rc
Code:
import /system/etc/init.custom.rc
but i don't know where to add that..
Click to expand...
Click to collapse
okay so, probably not what you really want but maybe useful
http://forum.xda-developers.com/galaxy-s3/help/how-to-modify-init-rc-init-d-t2135610
http://forum.xda-developers.com/showthread.php?t=1276578
maybe enabling the boot script thing and biting the bullet for a one time dd will work out
when i'm testing something i switch my boot and recovery to save button ware [DON'T DO THAT IF YOUR SANE!!]
else you'll have to find some way to get the fastboot thing going, maybe test in emulator instead?
moonbutt74 said:
okay so, probably not what you really want but maybe useful
http://forum.xda-developers.com/galaxy-s3/help/how-to-modify-init-rc-init-d-t2135610
http://forum.xda-developers.com/showthread.php?t=1276578
maybe enabling the boot script thing and biting the bullet for a one time dd will work out
when i'm testing something i switch my boot and recovery to save button ware [DON'T DO THAT IF YOUR SANE!!]
else you'll have to find some way to get the fastboot thing going, maybe test in emulator instead?
Click to expand...
Click to collapse
that requires, the root filesystem to be rw.. the initramfs is saved in mmc... :| i will have to look into implementing it..
i have done that.. OwO
hmm.. i will see..
anyways thanks for helping...
confused
psych.half said:
that requires, the root filesystem to be rw.. the initramfs is saved in mmc... :| i will have to look into implementing it..
i have done that.. OwO
hmm.. i will see..
anyways thanks for helping...
Click to expand...
Click to collapse
so, you're not rooted?
can you adb?
what device?
moonbutt74 said:
so, you're not rooted?
can you adb?
what device?
Click to expand...
Click to collapse
i am rooted.. :| i meant, changes to root filesystem are lost on reboot..
the rw kernel mentioned there saves the changes to rootfilesystem...
yeah.. adb works :v
fastboot...
psych.half said:
i am rooted.. :| i meant, changes to root filesystem are lost on reboot..
the rw kernel mentioned there saves the changes to rootfilesystem...
yeah.. adb works :v
Click to expand...
Click to collapse
maybe something helpful in this
http://forum.xda-developers.com/showthread.php?t=2317790
so what device ? what are you trying to achieve?

[help]Editing boot.img results in bootloop[help]

I need help editing the default.prop of my rooted boot.img for an LG LM-X210ULM K8+. I want to mark ro.debuggable off as 1 instead of 0 but which i have no problem doing but when i use any kitchen program it puts it back together as 15mb instead of 32mb and when i flash it to my device it always bootloops.
If any one could help i would appreciate it. Im including a copy of the rooted boot.img freshly pulled ftom my device
The size probably isn't the issue. Using AIK the size was even bigger than the original.
It's all just 0x00 the rest of that partition...
By using my old uImage/_recovery unpack-repack batch file
http://cxzstuff.blogspot.com/2013/03/uimagerecovery-unpack-repack-batch-file.html
the result was smaller but still a bit bigger than the Magisk had made.
But that is irrelevant really... result attached.
Yea i dont get it. The size doesnt matter as long as it diesnt exceed the max amount of space the partition can hold. But why does changing one value cause the boot.img to boot loop after flashing.
Even the boot.img you made looped after flashing
Duhjoker said:
Even the boot.img you made looped after flashing
Click to expand...
Click to collapse
Just tells that it's not the tool used. Or mine oldie is as bad/good as the newer one in this case.
What that Magisk img had was like it had some signature but it should not be needed and probably just garbage left there from the stock...
Should not matter, but how about doing it other way around? Modify the stock boot first and then give it to Magisk for rooting.
I think it was stock. Ill have to make sure though. wonder why magisk doesnt make the image debuggable to begin with. But your right it might be that im using a magisk patched image. Ive got some firmware already broke down ill give it another try here in a bit and post my results.
Duhjoker said:
I think it was stock. Ill have to make sure though. wonder why magisk doesnt make the image debuggable to begin with. But your right it might be that im using a magisk patched image. Ive got some firmware already broke down ill give it another try here in a bit and post my results.
Click to expand...
Click to collapse
So here we are. There should be some shortcut or something left to the original sub forum at least for a week or two when you boys move these threads - dammit...
Any luck? You have a customized recovery? How about these?
https://forum.xda-developers.com/an...g/mod-bootimage-adb-unsecure-patcher-t3618558
Yes luck tonight i did a fresh reflashing on my QC Lg k8+ and decided to break open the boot.bin from the kdz i used and made my changes to default.prop then i put the renamed to boot.img on my phone and let magisk patch it then flashed it via fastboot and dared it to go into system. Then i double dared it. Then for safe measure i double dog dared it to boot into system to which it had no choice but to go along with the or be labled a @!%\**__(€.
It booted.
So the lesson learned is to patch a fresh boot.img with your default.prop changes then have magisk patch it for root.
Now oddly when i patched and tweaked my recovery using carlive kitchen, i also made sure that the same changes to default.prop or rather i made sure they had been made and they had. But any terminal like emulator or termux pulls up the props using getprop with the changes unmade and i still cannot change the values of the system build.prop and when i patch it manually it reverts on reboot.
I literally have to open a vi in twrp to make changes. And forget about copying my own patched build.prop to system in twrp. Because that leads to boot loop as well
Ok so is there a reason that you dont make those changes in the boot.img any more? Because the past two days i have woke up to no root. I have had to reflash my boot.img both times
Ok i just compiled my first kernel from lg source code and now i dont know which of the split images in my folder is the zimage
Back to the drawing board quite literally. Im stuck for sure.
I need to make edits to a few files like init.rc and init.lge.power.rc to allow for changes in my newly compiled kernels. Basically im adding a couple properties and some cpu frequency stuff. Plus i want to make it back to adoptable storage and add a second sd partition for ext4 projects im working that would work best right off the root file system.
Im using the stock extracted boot.img from a kdz using salt and carliv kitchen to unpack and repack i have also mkbootimg tools that i compiled myself and some static arm version.
I extracted the ramdisk place my new kernel image in and repack with the init files changed and flash using recovery or fastboot and bootloop every time. And magisk isnt signing with the verity key.
ok i dont know whst was going on the other day but i can split boot.img again and make changes with out looping.
i used gparted on my linux machine to partition my 128gb sd card with 3/4 vfat and 1/4 ext4 i know that by using adb it will automount but thats one timr and i may need to switch out every now and then plus it put a center part in it of about 15mb. with gparted i get the two parts with no bs. any way i created a script that mounts the second part and even symlinks some stuff. it works good but im having trouble getting init.rc to run it.
on early-init
chmod 0755 /system/etc/init/init.mntsd.sh
exec system system /system/bin/sh /system/etc/init.mntsd.sh
any tips

Categories

Resources