many of you, including me, may find that it's time consuming to rebuild the kernel even for minor changes to init.rc, or to modify the init itself. with this small tip, you can change the init process on boot time and perhaps to perform different init processes easily.
reminded and inspired by sztupy's work, i change the whole init for easy customization and be able to let the init to process in a more dynamic way (for the term 'dynamic', it's borrowed from the internet - dynamic and static internet web pages)
let's start
the original file structure on the root looks like this (extracted):
init.rc
init
where init will be processed on boot time, and init.rc will be read to create dir/mount and services, etc
with dynamic init, the root will look like (sample):
init --> myinit.sh
init.original
myinit.sh
the original init is moved/renamed to init.original, with a symlink created named init pointing to a shell script or program, in this case, myinit.sh. a sample myinit.sh looks like this (u need to have a busybox resides on /sbin in this case):
#!/sbin/busybox sh
mount -t ext2 -o rw,noatime,nodiratime /dev/block/stl9 /system
mount -t rfs -o rw,noatime,nodiratime /dev/block/stl9 /system
/system/scripts/init/myinit2.sh
exec /init.original
###end###
in this example, the /system will be mounted, by attempt to mout it as ext2 first (it wont mount if /system is not in ext2), followed by mounting it as rfs. note that only one mount command line will be succeessfully performed here (PS -o remount is needed for remounting the system, so no need to worry the system will be mounted as ext2 first, and then mounted again as rfs).
i also added a file called myinit2.sh under /system/scripts/init/ (you can choose other dir but make sure u've mounted it), which contains some commmands you want to perform like a while loop, etc (becareful, if a infinite loop is used in myinit2.sh, append a "&" at the end to run it in background, so it will look like:
/system/scripts/init/myinit2.sh &
and finally, call init.original (if you wish)
the reason i call it dynamic is, the original init can be replaced or generated base on certain criteria in myinit.sh or myinit2.sh. below is an example which the original init is completely replaced in myinit2.sh:
#!/sbin/busybox sh
mount -o remount,rw rootfs /
rm /init.rc
rm /init.original
ln -s /system/scripts/init/myinit.rc /init.rc
ln -s /system/scripts/init/myinit /init.original
### end
since root is mounted as rw, the original init and init.rc can be removed and link to your own init and init.rc
that's it! you can now modify init and init.rc without the need to recmpile the kernel again
some possible usages:
- add/remove/modify services contained in init.rc
- change the filesystem for specific mount point in init.rc like switching from rfs to ext2 or jfs
- remove repeating dir creations in init.rc, and much more..
hope this help!
PS do it at ur own risk
Have you tried this? I don't think it's going to work without 'mknod' before doing the mounts.
RyanZA said:
Have you tried this? I don't think it's going to work without 'mknod' before doing the mounts.
Click to expand...
Click to collapse
Yes.
I don need mknod
Related
Didn't see much on this as I was looking around today, so I decided to post my eventual fix:
After first setting up froyo on my Rhodium 400, I was having alot of issues with the phone running out of memory and crashing, so I ended up adding a swap partition. Below is an easy way to do this and have the swap mounted at boot without having to use an external app like swapper:
NOTE - before doing this I suggest that you copy rootfs.img from your SD card onto your computer, and then copy it back once you're finished. I also suggest you make a backup copy of rootfs (rootfs.img.backup etc) before trying mods like this so you can recover your file system if something goes wrong.
on a linux machine, make a mount point and mount the kernel image as a loop device:
Code:
mkdir /mnt/mounthere
mount -o loop rootfs.img /mnt/mounthere
cd into mount point you created (ie, cd /mnt/mounthere) and list the contents with ls. You'll see something like this:
Code:
acct dbgfs init.cfg mnt shared_prefs
bin default.prop init.etc proc sqlite_stmt_journals
cache dev init.rc res sys
config etc installer sbin system
d init lib scripts tmp
data init.android lost+found sdcard ueventd.rc
you want to open the script init with a text editor like nano and add the following lines just before the line that says exec /init.android:
Code:
modprobe ramzswap
swapon /dev/block/mmcblk0p2
where /dev/block/mmcblk0p2 is a pre-created linux swap partition on your SD card.
Once you're done, simply unmount rootfs.img and copy it back onto the SD card you're using for android
Its a pretty simple solution that I've found to make my own phone much more stable and responsive, and you only have to worry about it once. The downside is that on slower sd cards, the phone may slow to a crawl when installing apps, but hey, it beats the phone locking up and crashing back to windows mobile, right?
This really is not needed if you are running the latest versions of everything (and using XDANDROID). If you are experiencing problems with the full official latest version of everything (all info is in the thread in my sig) make sure you post in the ANDROID section
I recently (successfully) upgraded my Samsung i9505 with Janjan's Pure Google ROM version 4.3-2.1. While everything worked like a charm, I was frustrated with the little space I had in /sdcard, whereas I have a 32Gb sdcard plugged on that smartphone.
Android is GNU/Linux based, and the shell commands provided by most ROMs know how to handle mountpoints, especially mount -o bind, which permits to mount a directory on another directory. This is the trick you can use in order to have a lot more space within your DCIM directory:
Code:
# mkdir /storage/extSdCard/DCIM
# mount -o bind /storage/extSdCard/DCIM /sdcard/DCIM
There you go:
Code:
# df|grep DCIM
/mnt/shell/emulated/0/DCIM 29.5G 11.8G 17.7G 32768
Much better
Those commands are to be used with the root user. Obviously, you can use this trick for every other directory you'd like to extend. In order to make that mount point permanent, use the ROM's init script capabilities, for example with Janjan's ROM:
Code:
# mount -o remount,rw /system
# cat > /etc/init.d/99local
#!/system/bin/sh
/system/bin/mount -o bind /storage/extSdCard/DCIM /sdcard/DCIM
^D # press Control-D here
# chmod 755 /etc/init.d/99local
# mount -o remount,ro /system
Enjoy more space!
SM-T705, cf-autoroot (incl. SuperSU) checked with root-checker, platform.xml adapted
e.g. if I want to copy /dev to my sdcard ... there comes a message similar to "copying went wrong ... 4.4+ .... in non-root mode some limitations ..."
I won't search for you, please have a read through Q&A and General for a number of other similar questions and corresponding answer I would suggest you please contact a Mod to delete this unneeded thread
Sorry I searched and read a lot of older suggestions but did not get a clue ... and I know about the kitkat probs regarding SD (platform.xml). But still dont understand, why there are just few folders affected ...
So sorry but it seem I need a Little push into the right direction
+1 solid explorer has struggled for me, but root explorer hasn't. Seems to be only certain directories. ...idk
just to make shure - we are talking about Root Explorer (File Manager) non free app. Did you try to copy System dirs like /dev ??
if yes, where to did you copy them. I just figured out that my ext3 partition (1st=exFat, 2nd=ext3) on the SD is mounted to /data/sdext2.
but copying /dev to /data/sdext2 doesnt work either
Could someone please tell me how to Mount /mnt RW
some folder cant be copy. the only way for you to have those are extracting it from the original firmware.
THX - 2 Pprobs now
1
mount -o remount rw /System worked, but still
[email protected]:/ # mkdir /mnt/extSD2
mkdir failed for /mnt/extSD2, Read-only file System
a) with Root Explorer it seemed to work, but was gone after restart ?
b) where to mount my ext3 SDcard partition (1st exfat, 2nd ext3)
c) can I do it by modifying init.rc, universal5420.rc or fstab.goldfish ...
2 how to extract Folders from Firmware files like T705XXU1ANF7_T705DBT1ANF1_T705XXU1ANF7_HOME.tar
I extracted the files within. But how can I Mount those Image files on W8 (ext2fs does not work with my sdcard) ?
2nd best would be to go to my Linux PC (but I'm a Linux DAU) ...
try learn about kitchen or use this software on windows... ^_^ http://sourceforge.net/projects/ext2read/
sorry my english is not good enough ... kitchen seems to be a Linux tool ... this seems to be a good start http://www.modaco.com/topic/366230-tools-useful-tools-for-tinkerers/ or this http://www.diskinternals.com/linux-reader/
Best use OSFMount to Mount the *.img and "Paragon ExtFS for Windows" to view the files
mount -o remount rw /System worked, but still
[email protected]:/ # mkdir /mnt/extSD2
mkdir failed for /mnt/extSD2, Read-only file System
a) with Root Explorer it seemed to work, but was gone after restart ?
b) where to mount my ext3 SDcard partition (1st exfat, 2nd ext3)
c) can I do it by modifying init.rc, universal5420.rc or fstab.goldfish ...
mounting system.img does not work
del
Hello everyone, I've been using android since Eclair and I had a couple of different brands under my ownership. Sony Ericsson, Samsung, Alcatel...
I've always been rooting my phones. After that, each time I needed rw privileges in order to be able to delete files (like built-in apps), place ringtones, alarms and notifications sounds directly into /system/media/audio, rename or backup system files etc., I was using a simple command from a terminal app or via ssh from a desktop giving this syntax:
mount -o remount, rw /dev/block/mtdblock3 /system
Then, until next reboot I could write in /system.
Unfortunately since I got G3 this command won't work. Apparently, either lollipop's or LG's partitions are a bit different that the usual...
After looking around for a while, I came up with a page which shows that this command "ls -al /dev/block/platform/msm_sdcc.1/by-name", lists all partitions' paths by label and that according to the list, /system corresponds to mmcblk0p40. So I was thinking of trying the command a bit altered, like this:
mount -o remount, rw /dev/block/mmcblk0p40 /system
Since I don't have good knowledge of linux -I can't even tell if the old syntax is not working because of LG's implementation or of android's new version (lollipop)- I'd just like someone who has already done this to confirm that I'm right and it works. I'd really not like to brick the phone atm. I feel too old for this s...
Thanks, George...
P.S.: Now, if someone would be kind enough to provide an in-depth explanation of how I could always find by myself (in any newer version of android and any different android implementation), which partition is the appropriate one to use in this command in order to obtain rw for /system, that would be more than welcome!
Edit: I should have mentioned this to avoid getting answers about 3rd party apps which do those stuff like root explorer: I'm looking for a solution, not a workaround. I need the syntax of the command, not a list with apps which do what I'm trying to do using terminal. But thanks adamzki anyway...
Use root explorer pro. That's it.
This command is enough to mount /system as rw;
Code:
mount - o rw,remount /system
forumber2 said:
This command is enough to mount /system as rw;
Code:
mount - o rw,remount /system
Click to expand...
Click to collapse
That's really strange, I had used "mount -o remount,rw /system /system" and it didn't work
I now used "mount -o remount,rw /system" and it works! I'll never understand Linux...
Thanks anyway man!
Thread can be locked.
I cannot write to my phones system partition. I can successfully run
Code:
mount -o remount,rw /system
from the shell but doing
Code:
mount | grep system
afterwards reveals that the partition is still read only. Root apps like Link2SD and ES File explorer also fail to write to system. I can still do it from inside of TWRP but I'd like to get it working in Android. Is there any fix for this as of now?