User startup script location in system partition_how to enable init.d support? - Asus Transformer TF700

I am working on a startup script to allow browser2RAM to work with other browsers that don't use the android.browser.com agent (Chrome, Firefox) and don't know where to put this 00script file I wrote in the system. This device has no etc/init.d directory. Where should this go to get executed on boot?
Sent from my ASUS Transformer Pad TF700T using xda app-developers app

Re: User startup script location in system partition?
elfaure said:
I am working on a startup script to allow browser2RAM to work with other browsers that don't use the android.browser.com agent (Chrome, Firefox) and don't know where to put this 00script file I wrote in the system. This device has no etc/init.d directory. Where should this go to get executed on boot?
Click to expand...
Click to collapse
If you have a custom ROM like CleanROM Inheritance, you should have a (/system)/etc/init.d - which ROM are you running?

Re: User startup script location in system partition?
_that said:
If you have a custom ROM like CleanROM Inheritance, you should have a (/system)/etc/init.d - which ROM are you running?
Click to expand...
Click to collapse
Hi-
Thanks for your reply. I am locked and rooted on stock ROM.
Sent from my ASUS Transformer Pad TF700T using xda app-developers app

elfaure said:
I am locked and rooted on stock ROM.
Click to expand...
Click to collapse
OK, that means no support for init.d by the kernel's init.rc. You can try the following:
Create a shell script named "/system/etc/install-recovery.sh" with the following content:
Code:
#!/system/bin/sh
/system/bin/logwrapper /system/xbin/busybox run-parts /system/etc/init.d
Remember to make it executable and to create the /system/etc/init.d directory. Put your init script there and make it executable.
If you have busybox installed in /system/xbin and a little luck, this could enable support for running init.d scripts with the stock ROM. Tell us if it worked.

_that said:
OK, that means no support for init.d by the kernel's init.rc. You can try the following:
Create a shell script named "/system/etc/install-recovery.sh" with the following content:
Code:
#!/system/bin/sh
/system/bin/logwrapper /system/xbin/busybox run-parts /system/etc/init.d
Remember to make it executable and to create the /system/etc/init.d directory. Put your init script there and make it executable.
If you have busybox installed in /system/xbin and a little luck, this could enable support for running init.d scripts with the stock ROM. Tell us if it worked.
Click to expand...
Click to collapse
I thank you for the method but I'm a newb (nOOb) and this looks a little scary. I found two market apps that can do it (execute a script as root on boot): Autostart-Root and ROM Toolbox (Lite or Pro). I'm using the latter's Scripter tool to execute this script on boot as root. Seems to be working. (Appended the .txt extension to the filename in order to upload the file)

Here's another thead i found here on the subject
http://forum.xda-developers.com/showthread.php?t=690564

_That
Using your method above, how would you run the script as root (su)? This script needs to run as root to properly mount the /data partition.

elfaure said:
Using your method above, how would you run the script as root (su)? This script needs to run as root to properly mount the /data partition.
Click to expand...
Click to collapse
It should run as root because it's started by init - /data is already mounted at that time. If I understand your intention correctly, you don't need to (re)mount /data anyway, just /data/data/<whatever_directory_your_browser_uses>.

_that said:
It should run as root because it's started by init - /data is already mounted at that time. If I understand your intention correctly, you don't need to (re)mount /data anyway, just /data/data/<whatever_directory_your_browser_uses>.
Click to expand...
Click to collapse
If I run my script as normal user (not as root ie su) then I get script /data mount errors.
exec /system/bin/sh '/Removable/MicroSD/Scripts/autostart.sh'
[email protected]:/ $ exec /system/bin/sh '/Removable/MicroSD/Scripts/autostart.sh'
failed: Invalid argument
rm failed for -rf, No such file or directory
mount: Operation not permitted
failed: Invalid argument
rm failed for -rf, No such file or directory
mount: Operation not permitted
failed: Invalid argument
rm failed for -rf, No such file or directory
mount: Operation not permitted
failed: Invalid argument
rm failed for -rf, No such file or directory
mount: Operation not permitted
But when I run it as root user
exec /system/bin/sh '/Removable/MicroSD/Scripts/autostart.sh'
failed: Invalid argument
rm failed for -rf, No such file or directory
failed: Invalid argument
rm failed for -rf, No such file or directory
failed: Invalid argument
rm failed for -rf, No such file or directory
failed: Invalid argument
rm failed for -rf, No such file or directory
The rm failed for -rt really isn't an error, just an indication there was no cache file to delete, correct?

elfaure said:
If I run my script as normal user (not as root ie su) then I get script /data mount errors.
Click to expand...
Click to collapse
I don't see where "/data" is mentioned in your error messages. You get "invalid argument" from umount because there is nothing mounted on that directory, and "operation not permitted" from mount because only root is allowed to mount filesystems.
elfaure said:
The rm failed for -rt really isn't an error, just an indication there was no cache file to delete, correct?
Click to expand...
Click to collapse
Correct.

_that said:
I don't see where "/data" is mentioned in your error messages. You get "invalid argument" from umount because there is nothing mounted on that directory, and "operation not permitted" from mount because only root is allowed to mount filesystems.
Correct.
Click to expand...
Click to collapse
Thanks very much for that explaination. Sorry, I'm just getting started with scripts. In fact, this is my first one. Another question:
I added: (got the idea from this post, pg 2 http://forum.xda-developers.com/showthread.php?t=690564)
>/data/opt/autostart.out 2>/data/opt/autostart.err​to the end of the script.
The original call is shown here:
"I simulate it by the following contents in /system/etc/init.d/20autostart :
/system/bin/sh /data/opt/autostart.sh >/data/opt/autostart.out 2>/data/opt/autostart.err
which not only calls /data/opt/autostart.sh at boot time, but
also dumps its stdout to /data/opt/autostart.out
and dumps its stderr to /data/opt/autostart.err
which is very helpful for debugging the commands in /data/opt/autostart.sh
Note that you need to enter recovery mode before you can write to /system/etc/init.d/" ​Now when it runs it dumps the two files, which are sucessfully created. But both files are blank, no data, and autostart.err does not have any error messages like I show above. What's wrong with this call statement? Can't it be executed from within this same script, or do I have to use another script to call this one to make that work?

_that said:
OK, that means no support for init.d by the kernel's init.rc. You can try the following:
Create a shell script named "/system/etc/install-recovery.sh" with the following content:
Code:
#!/system/bin/sh
/system/bin/logwrapper /system/xbin/busybox run-parts /system/etc/init.d
Remember to make it executable and to create the /system/etc/init.d directory. Put your init script there and make it executable.
If you have busybox installed in /system/xbin and a little luck, this could enable support for running init.d scripts with the stock ROM. Tell us if it worked.
Click to expand...
Click to collapse
From that another post, he calls:
service sysinit /system/bin/logwrapper /system/xbin/busybox run-parts /system/etc/init.d
disabled
oneshot
which looks quite similar. Can you describe the differences between them? Is this one only for CWM?

Is this even possible on stock ROM?
_that said:
OK, that means no support for init.d by the kernel's init.rc. You can try the following:
Create a shell script named "/system/etc/install-recovery.sh" with the following content:
Code:
#!/system/bin/sh
/system/bin/logwrapper /system/xbin/busybox run-parts /system/etc/init.d
Remember to make it executable and to create the /system/etc/init.d directory. Put your init script there and make it executable.
If you have busybox installed in /system/xbin and a little luck, this could enable support for running init.d scripts with the stock ROM. Tell us if it worked.
Click to expand...
Click to collapse
I got a bit educated then got brave and tried it and it doesn't seem to work. I added the file tracer output line, files> /data/opt, to my startup script, made yours executable via "chmod 776 install-recovery.sh", put it where you said, put mine where you said, made mine executable same way except had to mount system R/W to do it (should have done this before I put it there but I am learning), ran your script without error, then rebooted. I see no files in data/oct so my script did not run at boot? I even renamed my script 00autostart1.sh and still didn't work.
Also, both other methods failed to run my script at boot. Any other ideas on stock ROM or is this just not possible?

elfaure said:
>/data/opt/autostart.out 2>/data/opt/autostart.err​to the end of the script.
Click to expand...
Click to collapse
You need to add these redirections to each command whose output you want to redirect, not to the end of the script. So to capture the output of your script, write another script that calls your original one with these redirections, as suggested by that other person.
elfaure said:
From that another post, he calls:
service sysinit /system/bin/logwrapper /system/xbin/busybox run-parts /system/etc/init.d
disabled
oneshot
which looks quite similar. Can you describe the differences between them? Is this one only for CWM?
Click to expand...
Click to collapse
The above is the block that needs to be added to /init.rc, but this is part of the kernel's ramdisk which you can only modify on an unlocked device.
elfaure said:
I got a bit educated then got brave and tried it and it doesn't seem to work.
Click to expand...
Click to collapse
Post the output of:
su
ls -l /etc/install-recovery.sh
cat /etc/install-recovery.sh
ls -ld /etc/init.d
ls -l /etc/init.d
ls -l /system/xbin/busybox

_that said:
You need to add these redirections to each command whose output you want to redirect, not to the end of the script. So to capture the output of your script, write another script that calls your original one with these redirections, as suggested by that other person.
The above is the block that needs to be added to /init.rc, but this is part of the kernel's ramdisk which you can only modify on an unlocked device.
Post the output of:
su
ls -l /etc/install-recovery.sh
cat /etc/install-recovery.sh
ls -ld /etc/init.d
ls -l /etc/init.d
ls -l /system/xbin/busybox
Click to expand...
Click to collapse
I created a script called that_script.sh that contains your command set above. I make it executable and run it (as root) and:
****************************************
There is no output because the script never completes execution? Just runs forever (Script Manager) or times out (ROM Toolbox Lite Scripter). Some kind of script-loop is created?? Upon break (exit) I get the following output:
exec sh -c '/Removable/MicroSD/Scripts/that_script.sh '
exit
-rw-rw-r-- root sdcard_rw 90 2013-03-19 18:28 install-recovery.sh
#!/system/bin/sh
/system/bin/logwrapper /system/xbin/busybox run-parts /system/etc/init.ddrwx------ root root 2013-03-19 18:45 init.d
-rwxrwxrw- root root 938 2013-03-19 18:35 00autostart1.sh
-rwsr-xr-x root root 497964 2013-03-03 17:59 busybox

elfaure said:
I created a script called that_script.sh that contains your command set above. I make it executable and run it (as root) and:
****************************************
There is no output because the script never completes execution? Just runs forever (Script Manager) or times out (ROM Toolbox Lite Scripter). Some kind of script-loop is created??
Click to expand...
Click to collapse
I don't know what strange tools you are using, the commands were meant to simply type into an interactive shell (adb or a local terminal app).
However, the original problem why your script doesn't run at boot is obvious from your output:
Code:
-rw-rw-r-- root sdcard_rw 90 2013-03-19 18:28 install-recovery.sh
You forgot to make install-recovery.sh executable (or you forgot to become root first).

I use these script tools so I can copy all the text into a file and run the file (script) rather than typing each line individually into the terminal. My tools show the script is executable (I ran "chmod 776 filename.ext" = "chmod +x filename.ext" on the script file) and ran it as root? I'll try it again and post back. I'll also try it from the terminal app.
Thks

_that said:
It should run as root because it's started by init - /data is already mounted at that time. If I understand your intention correctly, you don't need to (re)mount /data anyway, just /data/data/<whatever_directory_your_browser_uses>.
Click to expand...
Click to collapse
I'm not (re)mounting /data.
So the mount is still needed, that's the key to the whole process. *The mount isn't (re)mounting the data partition, it's creating a mount point inside the data partition for the RAM cache.
What the script is doing is creating a tmpfs filesystem where the browsers expect to put their cache files. This filesystem is actually fully in memory (RAM), and never backed by any permanent storage. The -t tmpfs option tells mount to create a tmpfs filesystem, and -o size=50m tells it to reserve 50 MB of memory. The unmount is for when I use a different browser (one that doesn't use the com.android.browser agent like chrome, firefox, naked, etc.) and need to create a new mount point but want to reuse the 50MB already allocated for the existing mount point. Hope this clarifies my intent with creating this script and how it is supposed to work.

elfaure said:
I'm not (re)mounting /data.
So the mount is still needed, that's the key to the whole process. *The mount isn't (re)mounting the data partition, it's creating a mount point inside the data partition for the RAM cache.
What the script is doing is creating a tmpfs filesystem where the browsers expect to put their cache files. This filesystem is actually fully in memory (RAM), and never backed by any permanent storage. The -t tmpfs option tells mount to create a tmpfs filesystem, and -o size=50m tells it to reserve 50 MB of memory. The unmount is for when I use a different browser (one that doesn't use the com.android.browser agent like chrome, firefox, naked, etc.) and need to create a new mount point but want to reuse the 50MB already allocated for the existing mount point. Hope this clarifies my intent with creating this script and how it is supposed to work.
Click to expand...
Click to collapse
Assumed that you script is working, you could use "script manager - SManager" from the market. This app will allow yours to run as root and during start up. All you need is root. The script can be at any location (even on sdcard if you like). I used to use this with my cell phone.

elfaure said:
I'm not (re)mounting /data.
Click to expand...
Click to collapse
Well, you originally wrote:
This script needs to run as root to properly mount the /data partition.
Click to expand...
Click to collapse
Does it work now as it should?
Be sure to read also this thread about mounting in Android 4.2:
http://forum.xda-developers.com/showthread.php?t=2227123

Related

using the internal memory as a virtual sdcard

I managed to break my micro sd card in half today and I wasn't able to pickup a class 10 or 6 replacement locally so I thought I could use some of the 6gb of internal memory as a virtual filesystem to get me out of trouble.
So, after quickly looking at the android docs and the supported busybox commands I created a 2gb sdcard.img in /data and mounted to /sdcard. I copied some files to it with astro filemanager and fired up raging thunder 2 and it went ahead and downloaded the game data to /sdcard/ and worked correctly.
But, a few apps won't recognise it as an sdcard (Motorola SD card and phone storage settings applet) as well as things like PlayPro (states I have no sdcard present). I thought perhaps I could modify the /etc/vold.fstab file to auto mount the sdcard.img I created using vi but I'm a bit clueless as to what I should change on the dev_mount /sdcard line to get it automounted at boot and hopefully fool the rest of the apps into thinking it is a physical sdcard.
Can anyone possibly point me in the right direction? Not sure how to invoke cmd mode in vi using the milestone qwerty either but I'll keep digging.
What I did (roughly), maybe I'm going about it wrong but any advice would be appreciated.
1. rooted device
2. installed the free terminal app from the market
3. fired up the terminal shell
4. su
5. dd if/dev/zero of=/data/sdcard.img bs=1024 count=1 seek=2000000
6. busybox mkfs.vfat /data/sdcard.img (didn't seem to support -F 32)
7. busybox mount -o loop /data/sdcard.img /sdcard/
+ 1 for this, it would be great to can use internal storage for user data
Why do you let this nice post die.. so "flibbulator" found anything more out?.. I'd like to know more.. like if you got it to work with Music Players and Video players??
Try to mount /data/sdcard.img to /mnt/sdcard (/sdcard is a link to /mnt/sdcard)
or try "export EXTERNAL_STORAGE /sdcard"
I made in a different way: created a 4GB storage.img in /data and mounted it in /sdcard/storage, so internal storage is finally usable for user data
the problem was to set mount point on boot, I can't find a way to execute a script on boot (you can't permanently modify init.rc)
flibbulator said:
What I did (roughly), maybe I'm going about it wrong but any advice would be appreciated.
1. rooted device
2. installed the free terminal app from the market
3. fired up the terminal shell
4. su
5. dd if/dev/zero of=/data/sdcard.img bs=1024 count=1 seek=2000000
6. busybox mkfs.vfat /data/sdcard.img (didn't seem to support -F 32)
7. busybox mount -o loop /data/sdcard.img /sdcard/
Click to expand...
Click to collapse
I have actually tried this on my Droid2Global, and I get the error "unknown operand if/dev/zero" I feel like I am missing the point or do not fully understanding how to use the "dd" command?
the correct syntax is:
dd if=/dev/zero of=/data/sdcard.img bs=1024 count=4194340
4194340 --> 4GB
patton82 said:
the correct syntax is:
dd if=/dev/zero of=/data/sdcard.img bs=1024 count=4194340
4194340 --> 4GB
Click to expand...
Click to collapse
Thank you bro.
Quick question I keep getting these errors. I do have a folder in "/" named "sdcard-int"
Better Terminal Emulator Pro
/ # busybox mount -o loop /data/sdcard.img /sdcard-int/
mount: can't setup loop device: No such file or directory
/ # busybox mount -o /data/sdcard.img /sdcard-int
mount: can't read /etc/fstab: No such file or directory
/ #
Sent from my DROID2 GLOBAL using Tapatalk
you can't place anything in root folder, /sdcard is a link to /mnt/sdcard and is created by init.rc (you can't edit init.rc, it's provided by boot.img, so need to extract from boot.img and repack)
I made in this way but I have to manually execute a script or a command from terminal after every boot to mount storage.img
mkdir /sdcard/storage
su
dd if=/dev/zero of=/data/storage.img bs=1024 count=4194340
busybox mkfs.vfat /data.storage.img
mount -o loop -t vfat /data/storage.img /sdcard/storage
Will be lost anything after reboot when use this storage?
Sent from my MotoA953 using XDA App
all the stuff in img file will not be lost, as long as you put it in /data/
on the contrary the mount point must be restored after reboot
patton82 said:
you can't place anything in root folder, /sdcard is a link to /mnt/sdcard and is created by init.rc (you can't edit init.rc, it's provided by boot.img, so need to extract from boot.img and repack)
I made in this way but I have to manually execute a script or a command from terminal after every boot to mount storage.img
mkdir /sdcard/storage
su
dd if=/dev/zero of=/data/storage.img bs=1024 count=4194340
busybox mkfs.vfat /data.storage.img
mount -o loop -t vfat /data/storage.img /sdcard/storage
Click to expand...
Click to collapse
Thank you, I will use the Thank you button when I login via PC.
I still get the same error, I know that I'm doing something incorrectly or maybe I don't understand "mount" comment correctly?
/ $ su
/ # mkdir /sdcard/storage
/ # dd if=/dev/zero of=/data/storage.img bs=1024 count=41943404194340+0 recordsn
4194340+0 records out
4295004160 bytes (4.0GB) copied, 339.823883 seconds, 12.1MB/s
/ # busybox mkfs.vfat /data/storage.img
/ # mount -o loop -t vfat /data/storage.img /sdcard/storage
mount: can't setup loop device: No such file or directory
/ #
I am using my sdcard also, I'm not too sure if that makes any difference?
Sent from my DROID2 GLOBAL using Tapatalk
Better terminal pro uses BASH shell, I presume
try to switch to android shell, in preferences
or to use terminal emulator (free) from market
Okay, I tried Android Terminal Emulator, and this is a new error.
export PATH=/data/local/bin:$PATH
$ $ su
# mount -o loop -t vfat /data/storage.img /sdcard/storage
ioctl LOOP_SET_FD failed: Device or resource busy
#
Not too sure where to go now. I thank you again for all your help, and time.
Sent from my DROID2 GLOBAL using Tapatalk
resource busy, you have to reboot the phone
I use Gscript lite, add a script with the string
mount -o loop -t vfat /data/storage.img /sdcard/storage
and create a shortcut to homescreen, so when I reboot, I can mount the img file in one click
Cool mod for my ROM. Could I take it??
sure, they are simple shell commands
the best would be to do what happen with Samsung Galaxy S: internal storage mounted as sdcard and physical sdcard mounted in a folder /sdcard/sd
storage.img is 3-4 times faster than my peak 8GB class 6
There is an application "Autostart" in the market, which can automatially execute a script with root after boot up.
I up because I'm now also interested in making profit of the huge internal storage. I'd like to put my wikipedia data from wikidroyd to the internal storage. Hopefully I'm skilled enough to follow the given steps...I doubt that though
fKngFtd said:
Okay, I tried Android Terminal Emulator, and this is a new error.
export PATH=/data/local/bin:$PATH
$ $ su
# mount -o loop -t vfat /data/storage.img /sdcard/storage
ioctl LOOP_SET_FD failed: Device or resource busy
#
Not too sure where to go now. I thank you again for all your help, and time.
Click to expand...
Click to collapse
Guys, I need your help! I have exactly. The same problem:
Every time I try to mount my storage.img I get
Ioctl LOOP_SET_FD failed: Device or resource busy.
I rebooted several times and also tried to mount smaller images (first I tried 3gb then I tried 1mb).
Any solution?
Edit: I solved it myself. I always forgot to punch in busybox before the command. Now it worked for me!!
I do have a question now. With help of Gscript I made a shortcut to mount the storage.img to my sdcard. But my pc wont recognise the sdcard as long as the image is mounted. What is the command to unmount the partition so I wouldnt have to reboot my phone before connecting it to the pc...?
Any help is much appreciated! Thx
(Something like busybox unmount -o loop -t vfat...?)
Sent from my MotoA953 using XDA App

BackTrack 5 for Android Smartphones - VERY UNSTABLE

WARNING: THIS IS NOT FOR THE FAINT OF HEART
UPDATE: My goal was to create a version of BackTrack 5 for ARM that was easy to use and install. As of this time, that IS NOT the case! The versions posted here are **probably not** going to work straight out of the box. If you know what you are doing in a Linux environment, you'll probably be able to get it working.
Because of this, the project is currently completely unsupported. You are free to dive in, but you are doing so with no support for me, and I'm not liable for any damage that might be done to your device's ROM.
I encourage you to pass this up unless you know what you are getting yourself into!
If you were referred here from the XDA-Developers.com article...
Hi there! Let's get one thing on the record here... this is *not* a native client! This is the chroot + VNC method that we'd been using to get Ubuntu running with Android for a while. The article makes it sound like that's the case, but sadly it's not. However, with the chroot + VNC method we can really run BackTrack 5 on an Android device, and it really does work. This takes some technical skills, and isn't for the non-Linux experienced user.
Requires a rooted device!
BackTrack 5 installation guides are making their way around this forum. I've tried to synthesize it all, but I've also added my own touches to help with usability and features, along with a workaround for the "ioctl LOOP_SET_FD failed" error message some people have been getting.
In theory this build is nearly universal, so if you have an Android device it should work. I've put it all in one zip file that you can download directly from my website, no hassles or wait timers.
If you are interested have a look, feel free to re-post. Credit goes to the BackTrack team and xda member anantshri (he's got skills, give him props guys), who built the base image file.
Information, download link, and installation guide at:
(SERVER OFFLINE, SEE BELOW)
If you like what you see help me out, hosting is expensive!
http://www.mattslifebytes.com/donate
(alternatively, you can show interest in the products and services featured on my website, if you know what I mean )
msullivan said:
If you don't know what BackTrack is, you probably don't want it
BackTrack is an operating system based on Ubuntu Linux that is used for security testing (aka hacking) and digital forensics. I'm a master's degree student in computer security, so I love this OS... it can do awesome things. Turn on your Wi-Fi and you can do advanced network scans and tests right from your phone, no laptop required. For me this is hella-useful.
But besides just being an OS for hacking ****, it's also fully Ubuntu-based, so you can run it like a desktop, including running Firefox and other Linux applications.
Click to expand...
Click to collapse
Well guys my server had hardware failure (lol, my luck), so here's the website's content:
msullivan said:
The Download
This installation of BackTrack 5 is available as a compressed file that will need to be extracted. I recommend downloading this using Chrome or Firefox. Internet Explorer often doesn’t play well with large HTTP downloads.
The root account’s password and the VNC server password are both set to ‘root’ by default!
Mirror 1
Part 1: http://www.mediafire.com/?1z5sbxdxv3naxp1
Part 2: http://www.mediafire.com/?0zz1vac0k59d58p
Part 3: http://www.mediafire.com/?kxpb7ug0x55ppde
Mirror 2
http://www.megaupload.com/?d=M6YCKZLR
Mirror 3 (Provided by shenshang)
http://www.shenye.co.uk/files/BackTrack5ForARM-MattsLifeBytesEditionv2.zip
Mirror 4 (Provided by brilldoctor)
http://brilldoctor.co.cc/Files/BackTrack5ForARM-MattsLifeBytesEditionv2.zip
Mirror 5 (Thanks for uploading, PIIcoding)
Part 1: https://rapidshare.com/files/3602140493/BackTrack5ForARM-MattsLifeBytesEditionv2.part1.rar
Part 2: https://rapidshare.com/files/2384880899/BackTrack5ForARM-MattsLifeBytesEditionv2.part2.rar
Part 3: https://rapidshare.com/files/3314159192/BackTrack5ForARM-MattsLifeBytesEditionv2.part3.rar
Part 4: https://rapidshare.com/files/3073073580/BackTrack5ForARM-MattsLifeBytesEditionv2.part4.rar
Part 5: https://rapidshare.com/files/2486943841/BackTrack5ForARM-MattsLifeBytesEditionv2.part5.rar
Part 6: https://rapidshare.com/files/3545372402/BackTrack5ForARM-MattsLifeBytesEditionv2.part6.rar
Part 7: https://rapidshare.com/files/2371728719/BackTrack5ForARM-MattsLifeBytesEditionv2.part7.rar
Part 8: https://rapidshare.com/files/1437974805/BackTrack5ForARM-MattsLifeBytesEditionv2.part8.rar
Part 9: https://rapidshare.com/files/1758571109/BackTrack5ForARM-MattsLifeBytesEditionv2.part9.rar
The Description
If you want to run BackTrack 5 on your Android-powered device, read on, you’re in the right place! So the big news is that BackTrack 5 runs on Android phones. We’ve been able to run Ubuntu on these devices for quite some time too, but admittedly BackTrack on a smartphone is just awesome.
Anyway, files for using BackTrack 5 on an Android phone have been running around the internet, but sadly it’s kind of a mish-mash of links saying, “go download this, then get this, to then this, blah blah blah”. Too confusing for my simple brain, so I’ve rounded it all up and posted it in one place… right here. The version posted here has everything you should need to run BackTrack 5 on your Android device. I’ve also added a lot of goodies to help with the user experience that the other offerings don’t include:
Works around the ioctl LOOP_SET_FD failed error that many people have been receiving on Galaxy S devices (and others)
Asks the user if they want a VNC session upon start-up
Starts the SSH service automatically and displays device IP on start-up
Enables the Ubuntu repositories to Aptitude, so you can do package installation
Adds vim. Really, what distribution doesn’t come with vim by default? Seriously…
Sets the screen resolution to 800×480 default (should be compatible with most smartphone devices)
SU
This requires root!
You must be able to "su" at terminal. This ability is usually provided by software for rooting your phone. To see if you have rooted your phone correctly and it's working, go to your terminal emulator and type "su" <enter>. If it is working, you'll probably get a prompt asking you if you want to allow your terminal emulator root access. Hit accept/yes. Now you'll be back in your terminal emulator. Type "whoami" <enter>. If it responds with "root" or "uid 0", then you are properly rooted.
Busybox
This requires Busybox!
I am no longer providing an installer for Busybox because of issues getting it to work universally, so instead YOU need to go get a working build and install it (I believe "Busybox Installer" will work, but not tested). If you want to know if you have Busybox and it's working, go to your terminal emulator and type "su" <enter>, then "busybox ls" <enter>. If you get a printout of all the files in your current directory, then your Busybox will likely work with BackTrack 5 just fine. If you get an error, "busybox: not found", that means you either do not have Busybox, or it is not properly installed.
WARNING FOR CyanogenMod USERS
Before doing ANYTHING, please test for ext2 support by running (as root, at terminal) --> "modprobe ext2" <enter>
If this fails probably your device lacks ext2 support and the whole thing will screw up if you try to run it! Support for ext2 in CM is being worked on.
The Installation Guide
Enable Wi-Fi and connect to a Wi-Fi access point (* not required, but BT5 cannot use your data plan for internet access)
Download the zip file, extract anywhere
After extraction you’ll have one folder “bt5″; copy this folder to the root of your phone’s SD Card
Put card back in phone and/or unplug from USB
In a terminal emulator, type “su” <enter>, “cd /sdcard/bt5″ <enter>
Now you are ready to rock and roll, so issue “sh bt” <enter> (in the future to start BT5 skip the line above and come straight to this command)
If all is well you’ll now be running BackTrack 5 on your Android device; you can SSH to it via Wi-Fi (password ‘root’), or access it from VNC if you said “Yes” to the prompt asking if you wanted a VNC session
To get a GUI for BackTrack on your smartphone’s screen, download a VNC viewer from the market (many are free), then connect to host “127.0.0.1″, port “5901″, password “root”
Enjoy, boys and girls.
The Credits
The BackTrack 5 Development Team
anantshri on xda-developers (his blog: http://blog.anantshri.info/) for creating the image file to fit FAT32 filesystems
anantshi's original thread where it all began: http://forum.xda-developers.com/showthread.php?t=1074169
Click to expand...
Click to collapse
Known Incompatibility
Voodoo lagfix kernel (possibly? reported, not confirmed)
Hi thanks for the great work, I try it on my HTC WildFire with CyanogenMod7 2.3 CFW
this what i got when try it install it from the terminal:
$ su
# id
uid=0(root) guid=0(root)
#
# cd /sdcard/bt5
# sh installbusybox
installbusybox: 14: Syntax error: end of file unexpected (expecting "fi")
#
# sh bt
bt: 36: Syntex error: end of file unexpected (expecting "then")
#
Click to expand...
Click to collapse
Which terminal emulator are you using?
Terminal emulator
Open up "installbusybox" in a text editor and axe the first two lines, then try again.
Hrm... I failed when packaging the version that got put up online (sorry). I'm fixing now, will update shortly.
ok i remove the first two lines, and i got:
# sh installbusybox
BeginningBusyBox installation...
mount: mounting /dev/block/mtdbloc faild: No such file or directory
/sdcard/busybox: No such file or directory
cd:can't cd to /data/local
installbusybox: ./busybox: permission denied
cd:can't cd to /system/xbin
: No such file or directory
installbusybox: ./busybox: permission denied
If there were no error messages given above then installation was successfull
#
Click to expand...
Click to collapse
not sure why when i try to chmod 755 busybox nothing change!
msullivan said:
Hrm... I failed when packaging the version that got put up online (sorry). I'm fixing now, will update shortly.
Click to expand...
Click to collapse
aha, ok thanks again
Awesome.
Sent from a super smooth captivate running andromeda
Old news...
Btw.. if you're having problems, migrate apps from SDCard to Internal memory.
edit: Just realized this came off kinda ****-like... So here http://forum.xda-developers.com/showpost.php?p=13924701&postcount=109
AdamOutler said:
Old news...
Click to expand...
Click to collapse
News isn't that BT5 runs on these; the news is that my builds resolve a lot of issues and makes it as simple as dropping in the files and saying go.
Fixed version now posted at the website.
http://www.mattslifebytes.com/?p=456
export PATH=/data/local/bin:$PATH
$ $su
# cd /sdcard/bt5
# sh bt
mkdir failed for /data/local/mnt, File exists
mount: No such device
mount: No such file or directory
mount: No such file or directory
mount: No such file or directory
net.ipv4.ip_forward = 1
bt: cannot create /data/local/mnt/etc/resolv.conf: directory nonexistent
bt: cannot create /data/local/mnt/etc/resolv.conf: directory nonexistent
bt: cannot create /data/local/mnt/etc/hosts: directory nonexistent
Ubuntu is configured with SSH and VNC servers that can be accessed from the IP:
eth0: No such device
chroot: can't execute '/bin/bash': No such file or directory
Shutting down BackTrack ARM
failed.
failed.
failed.
failed.
losetup: /dev/loop7: No such device or address
#
I have this error when i try
Sent from my A953 using Tapatalk
Motodoido said:
export PATH=/data/local/bin:$PATH
$ $su
# cd /sdcard/bt5
# sh bt
mkdir failed for /data/local/mnt, File exists
mount: No such device
mount: No such file or directory
mount: No such file or directory
mount: No such file or directory
net.ipv4.ip_forward = 1
bt: cannot create /data/local/mnt/etc/resolv.conf: directory nonexistent
bt: cannot create /data/local/mnt/etc/resolv.conf: directory nonexistent
bt: cannot create /data/local/mnt/etc/hosts: directory nonexistent
Ubuntu is configured with SSH and VNC servers that can be accessed from the IP:
eth0: No such device
chroot: can't execute '/bin/bash': No such file or directory
Shutting down BackTrack ARM
failed.
failed.
failed.
failed.
losetup: /dev/loop7: No such device or address
#
I have this error when i try
Sent from my A953 using Tapatalk
Click to expand...
Click to collapse
Same error here, Verizon Fascinate.
Motodoido, tripacer99: have you remembered to do the "sh installbusybox" command first?
I download the new package, and this what i got:
[[email protected] tools]$ ./adb shell
# id
uid=0(root) gid=0(root)
# cd sdcard/bt5
# ls
bt busybox installbusybox unionfs
bt5.img fsrw mountonly
# sh installbusybox
Beginning BusyBox installation...
/sdcard/busybox: No such file or directory
--install: applet not found
If there were no error messages given above then installation was successful!
# sh bt
mkdir: can't create directory '/data/local/mnt': File exists
Loop device exists
losetup: /dev/block/loop7: No such file or directory
mount: mounting /dev/block/loop7 on /data/local/mnt failed: Device or resource busy
mount: mounting devpts on /data/local/mnt/dev/pts failed: No such file or directory
mount: mounting proc on /data/local/mnt/proc failed: No such file or directory
mount: mounting sysfs on /data/local/mnt/sys failed: No such file or directory
net.ipv4.ip_forward = 1
bt: cannot create /data/local/mnt/etc/resolv.conf: directory nonexistent
bt: cannot create /data/local/mnt/etc/resolv.conf: directory nonexistent
bt: cannot create /data/local/mnt/etc/hosts: directory nonexistent
Ubuntu is configured with SSH and VNC servers that can be accessed from the IP:
eth0: ip 192.168.2.13 mask 255.255.255.0 flags [up broadcast running multicast]
chroot: can't execute '/bin/bash': No such file or directory
Shutting down BackTrack ARM
umount: can't umount /data/local/mnt/dev/pts: No such file or directory
umount: can't umount /data/local/mnt/proc: No such file or directory
umount: can't umount /data/local/mnt/sys: No such file or directory
umount: can't umount /data/local/mnt: Invalid argument
losetup: /dev/loop7: Device or resource busy
#
Click to expand...
Click to collapse
Hrm yet another small error in one of the scripts. So sorry :S (this script is from the BT5 team though, so I take no fault in it not working, lol).
Open "installbusybox" in a text editor and replace the text "cat /sdcard/busybox" with "cat /sdcard/bt5/busybox" it should work. I'll fix it and put it up online once I'm home from work today.
msullivan said:
Hrm yet another small error in one of the scripts. So sorry :S (this script is from the BT5 team though, so I take no fault in it not working, lol).
Open "installbusybox" in a text editor and replace the text "cat /sdcard/busybox" with "cat /sdcard/bt5/busybox" it should work. I'll fix it and put it up online once I'm home from work today.
Click to expand...
Click to collapse
thanks for your time and for your help
now i got:
# sh installbusybox
Beginning BusyBox installation...
[1] Illegal instruction ./busybox cp /da...
--install: applet not found
If there were no error messages given above then installation was successful!
#
# cat installbusybox
perm=$(id|cut -b 5)
if [ "$perm" != "0" ];then echo "This script requires root! Type: su"; exit; fi
echo "Beginning BusyBox installation..."
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
cat /sdcard/bt5/busybox > /data/local/busybox
chmod 755 /data/local/busybox
#/data/local/busybox mkdir /system/xbin
cd /data/local
./busybox cp /data/local/busybox /system/xbin
cd /system/xbin
chmod 755 busybox
./busybox --install -s /system/xbin
rm /data/local/busybox
echo "If there were no error messages given above then installation was successful!"
# ls /data/local/busybox
ls: /data/local/busybox: No such file or directory
#
Click to expand...
Click to collapse
Dr_Death said:
thanks for your time and for your help
now i got:
Click to expand...
Click to collapse
I'll have to play when I get home... at the moment I don't have an answer :-/
Link is offline....

Debshell bash error on HTC Gratia with latest CM7

As it is my first message, I have permissions only to post messages here.
I want to run Backtrack 5 on my Gratia. I installed Debdroid as written at gitbrew's website[/url]
I use oririnal BT image from this website.
I renamed btandr35.img to debian.img to make no changes to .conf file.
After "mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system", "export ...", "su", "bash" I've got this error
localhost / # debshell bash
/system/bin/debshell: line 17: /data/local/debian/etc/hostname: No such file or directory
Opening debdroid chroot on loop255
chroot: can't execute 'bash' No such file or directory
Exiting debdroid chroot - System is still running
localhost / #
Anybody knows solution?
Syavick said:
As it is my first message, I have permissions only to post messages here.
I want to run Backtrack 5 on my Gratia. I installed Debdroid as written at gitbrew's website[/url]
I use oririnal BT image from this website.
I renamed btandr35.img to debian.img to make no changes to .conf file.
After "mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system", "export ...", "su", "bash" I've got this error
localhost / # debshell bash
/system/bin/debshell: line 17: /data/local/debian/etc/hostname: No such file or directory
Opening debdroid chroot on loop255
chroot: can't execute 'bash' No such file or directory
Exiting debdroid chroot - System is still running
localhost / #
Anybody knows solution?
Click to expand...
Click to collapse
I have the exact same problem as you, I am running the Droid 2 CM 7 Nightly build (latest). I have bash, etc. Bash exists in two places: /system/xbin and /etc/bash, but even using the command (after you are in bash) "chroot /data/local/debian /system/xbin/bash" (chroot command goes: "chroot directory [FILE ARGS]") and still got the same exact error: chroot: can't execute 'bash': No such file or directory.
I have used two different GB roms (leaked motorola stock and CM 7). I must have spent over a hundred hours this week looking for and testing out possible solutions, to no avail.
What are we missing?
/system/bin/debshell: line 17: /data/local/debian/etc/hostname: No such file or directory
I fixed this error by creating empty file "hostname" in "etc" directory. But I still have chroot error. I made some experiments with copying bash to different folders - no results.
Yeah that part of the problem was an easy fix, and even though I can use the bash command wherever I am in my filesystem as well as when I am using bash, it seems that chroot cannot find the bash command. Trouble is, I can't find chroot, and I would assume that chroot would be in the same directories as bash. Even using the command ls /*/chroot gives me nothing.
Nothing works as before!

Issues with c4droid. "Permission Denied". [Solved]

I have a rooted ASUS Transformer running Revolver 2.1.1 (Android 3.2).
I am a programmer and want a simple programming environment for my Transformer. I purchased an app called c4droid the other day and have had issues compiling c++ code using the g++ compiler.
When I try to compile/run code, I get the messages below:
C4droid has been granted superuser permissions
Click to expand...
Click to collapse
Then....
sh: /sdcard/Android/data/com.n0n3m4.droidc/files/gcc/compile-g++.sh: Permission Denied
Click to expand...
Click to collapse
How can I get this to work? Did I root wrong?
If you face these issues, click on the link below -
http://forum.xda-developers.com/showpost.php?p=16604606&postcount=6
What about trying this:
$su
#chmod 755 /sdcard/Android/data/com.n0n3m4.droidc/files/gcc/compile-g++.sh
I'm not sure what type of FS /sdcard is on the TF, so I don't know if those permissions will a) be allowed to be set, and b) work, but I doubt if any shell script will give anything but a permissions error without having +x permissions.
By the way:: If you can't do a chmod and that is due also to a permissions error, then I'm guessing you're not really rooted or not correctly rooted.
Good luck.
hachamacha said:
What about trying this:
$su
#chmod 755 /sdcard/Android/data/com.n0n3m4.droidc/files/gcc/compile-g++.sh
I'm not sure what type of FS /sdcard is on the TF, so I don't know if those permissions will a) be allowed to be set, and b) work, but I doubt if any shell script will give anything but a permissions error without having +x permissions.
By the way:: If you can't do a chmod and that is due also to a permissions error, then I'm guessing you're not really rooted or not correctly rooted.
Good luck.
Click to expand...
Click to collapse
did.......
su then chmod 755 /sdcard/Android/data/com.n0n3m4.droidc/files/gcc/compile-g++.sh and it had no such error but if I ran both on the same line I got a "Permission Denied" error. Either way, it still provided me with the permission denied error through c4droid.
Also, I've used root checker to verify that it's rooted.
So is it a sure thing that the .sh file you're getting the error on is actually the problem or could it be something inside it that is also having a permissions error?
I guess you could easily test that by writing a single line test.sh script that does an ls or a ps command.
Code:
example:
--start of test.sh--
#!/system/bin/sh #or whatever the path is for your case
ls > /sdcard/ls.txt
-- end of file ---
# cd {pathoftestfile}
# chmod 755 test.sh
# ./test.sh
# more ls.txt # or cat ls.txt, etc.
If that doesn't give an error then something in your 'real' shell script is.
One other thing worth a shot, which I "think" I've noticed on droids in the past is to just test the script inside the /system FS and see if it does any better there. At least we know that scripts have no problems in for example, /system/xbin or /system/bin, so mount /system rw (mount -o remount,rw /system) and move the test.sh over there , fix permissions, (mount -o remount,ro /system) and cd to /system/*bin/ and ./test.sh.
You've probably tried all this already, but if not.
NOTE: Never mind: I just tested my stuff ^^ myself, and it just doesn't work in the /sdcard tree. I moved it to /system/xbin after mounting rw and it works fine without any change.
There might be some way past this, but I can't recall ever getting a shell script working while on the /sdcard share.
I tried making the shell script but I had no luck actually running it. I chmodded it without error and ran it without error but it didn't produce a .txt file so I guess it failed to run or didn't have permissions to create a file.
The app developer/creator specifies that the compiler I'm using should work fine on rooted phones. I don't have an android phone to test it. I've tried working out problems with the developer but he couldn't figure it out either.
Okay, the creator helped me out and we resolved it. Here are the steps I took to do it, for other users.-
Pre-requisites: You must have BusyBox, SuperUser, C4droid, GCC for C4droid, and a Terminal Emulator installed. You also need a rooted device.
1. Open Terminal emulator and type "su" and press enter. A superuser screen will pop up and you need to click allow.
2. Type the following lines into the terminal (one by one):
cd /Removable/MicroSD/
mkdir Android
mkdir Android/data
cp -r /sdcard/Android/data/com.n0n3m4.droidc/ /Removable/MicroSD/Android/data/
su
mount -o remount,rw,exec -t vfat /dev/block/vold/179:9 /Removable/MicroSD
/system/xbin/mount -o bind /Removable/MicroSD/Android/data/com.n0n3m4.droidc/ /sdcard/Android/data/com.n0n3m4.droidc/
3. Change the default compiler in C4droid to G++ + bionic (Root required)
4. Done
Congratulations!
I guess it was mainly the 'noexec' switch of the mount -o {} that kept things from being executable.
I didn't notice that and am glad you posted the solution and I also wasn't really aware of the use of the "mount -o bind" for dual-pathing as well.
-- Thanks.

[DISCUSSION]All about boot.img's and kernels!!!

So, I've seen many a people talk about boot.imgs, and kernels, and mostly spamming dev threads. So, why not create a new thread for it?
Here, ask your questions related to kernels and boot.imgs, and feel free to post any *improvements* that you've made to an existing boot.img/kernel, and so...
Also, feel free to join the discussion, feature requests, whether or not possible, etc, etc.
This thread might be one whole lot of junk, but still if it helps from keeping people from spamming dev threads, why not
So, start!
Lets start from the basics...
Compiling a kernel is easy, IMO :fingers-crossed:
But, the unpacking repacking stuff is a bit difficult...
Anyways, here's the basics:
Packaging kernel for flashing on target device (by sakindia123): http://forum.xda-developers.com/showpost.php?p=31656992&postcount=3
Packaging kernel for flashing on target device (by #define): http://forum.xda-developers.com/showthread.php?t=2114594 (start from step 6)
New CM11 Ramdisk changes...
Well, this was taking up a lot of space on the main thread... Read it here :fingers-crossed:
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
edit: some more thoughts...
If you're going to boot this ROM from your SD Card, then, better beware of the new changes in the mounting process... A new fstab.pico is handling the mounting processes..
And, its moved from init.rc to init.pico.rc :|
So, If you're gonna do the editing stuff, you'd find that init.pico.rc has:
Code:
on fs
# mount mtd partitions
# Mount /system rw first to give the filesystem a chance to save a checkpoint
mount yaffs2 [email protected] /system
mount yaffs2 [email protected] /system ro remount
mount yaffs2 [email protected] /data nosuid nodev
mount yaffs2 [email protected] /cache nosuid nodev
# mount partitions
mount_all /fstab.pico
So, if you're gonna just edit those lines, and just change the [email protected], or the [email protected] lines, then, you'd likely be pretty much booting the ROM again from your internal nand. the main reason for this being the line below: mount_all /fstab.pico, which is the fstab.pico I was talking about...
Now, if you'd open up fstab.pico, its pretty much like the /etc/fstab that you'd find on any linux system. the typical device, mountpoint, type and all... If you'd open it, you'll find this:
Code:
#<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags>
/dev/block/mtdblock3 /system yaffs2 ro,barrier=1 wait
/dev/block/mtdblock4 /cache yaffs2 nosuid,nodev,barrier=1 wait,check
/dev/block/mtdblock5 /data yaffs2 nosuid,nodev,noauto_da_alloc,barrier=1 wait,check
/devices/platform/msm_sdcc.1/mmc_host/mmc0 auto vfat defaults voldmanaged=sdcard0:auto
Well, those were the lines from the CM11 preview, not exactly the same, the last line was derped by me in my vain attempts to get the sdcard running... Oh, and the mounting of the SD Card's completely changed too :silly:
BTW, getting back to mounting the ROM from the sdcard, you'd need to edit this fstab.pico file, to something similar to this:
Code:
#<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags>
/dev/block/mmcblk0p2 /system ext4 ro,barrier=1 wait
/dev/block/mmcblk0p4 /cache ext4 nosuid,nodev,barrier=1 wait,check
/dev/block/mmcblk0p3 /data ext4 nosuid,nodev,noauto_da_alloc,barrier=1 wait,check
/devices/platform/msm_sdcc.1/mmc_host/mmc0 auto vfat defaults voldmanaged=sdcard0:auto
Well this is the first post, asking for help... Hope you get the hint *wink *wink
In case you can't get something done, ask for help here!
I tried porting the touchscreen gestures from Siyah Kernel with reference from this commit: https://github.com/gokhanmoral/siyahkernel3/commit/9f57d9efc7458c1a9f540cd04bc5cb14e08fb342
Well, that more or less turned out to be like this: https://github.com/vineethraj49/android_kernel_htc_pico/tree/gestures (check the last few commits...)
And, turns out it works :laugh: with a small bug
1. only single finger gestures work, i think....
2. no way to get the infinite while loop started at init.d
Here's how I did it... Reference thread: http://forum.xda-developers.com/showthread.php?t=1831254
the init.d script is as belows, doesn't work...
Code:
#!/system/bin/sh
echo "
# Gesture 1 - swipe 1 finger near the top
1:1:(0|150,0|150)
1:1:(210|320,0|150)
" > /sys/devices/virtual/misc/touch_gestures/gesture_patterns
while [ 1 ]
do
GESTURE=`cat /sys/devices/virtual/misc/touch_gestures/wait_for_gesture`
if [ "$GESTURE" == "1" ]; then
screencap > /sdcard/`date +%H%M%S.png`
fi;
done
So, inputted those commands using adb, in adb shell, and it works... Got a hell lot of screenshots... but, any way to fix the bugs I mentioned?
Hey, one question
I'd like to know about one thing, I've seen people talking about memory increasing kernels and kernels that mount certain partitions(like cache, data etc. etc. ) . i want to know how this works? I mean, what all things are to be done in both things for them to work?
I'll be glad if you tell this to me in a noob-friendly way. :victory:
Thank You! :fingers-crossed:
#Superuser said:
Hey, one question
I'd like to know about one thing, I've seen people talking about memory increasing kernels and kernels that mount certain partitions(like cache, data etc. etc. ) . i want to know how this works? I mean, what all things are to be done in both things for them to work?
I'll be glad if you tell this to me in a noob-friendly way. :victory:
Thank You! :fingers-crossed:
Click to expand...
Click to collapse
Note: memory increasing kernels and, kernels that mount certain partitions(like cache, data etc. etc. ) both do the exact same thing.
Clarifications:
1. There's no such thing as a memory increasing kernel, and there can't be. No!? Why not? Because, however much memory's present, so, remains. This particular *myth* comes from the slang "memory increasing scripts", i.e. scripts that mount an external SD Card's partition as the internal /data partition.
2. The kernel doesn't increase the memory (check clarification 1). The increasing in memory is done by reverse-mounting (yes, reverse-mounting partitions, is a fairly popular slang for this practice) partitions from the SDCard as the internal partitions, and thus, the phone thinks that it has a more storage, than its own internal storage.
So, how does the memory increasing get done?
Ramdisks! These are the files that go on form the root file system. The kernel itself is packed with the ramdisk. A typical android bootup sequence is this: (thanks to the writers of this article here: http://elinux.org/Android_Booting)
1. The first program which runs on any Android system is the bootloader. Technically, the bootloader is outside the realm of Android itself, and is used to do very low-level system initialization, before loading the Linux kernel. The kernel then does the bulk of hardware, driver and file system initialization, before starting up the user-space programs and applications that make up Android.
2. 'init'
A key component of the Android bootup sequence is the program 'init', which is a specialized program for initializing elements of the Android system. Unlike other Linux systems (embedded or otherwise), Android uses its own initialization program. (Linux desktop systems have historically used some combination of /etc/inittab and sysV init levels - e.g. /etc/rc.d/init.d with symlinks in /etc/rc.d/rc.). Some embedded Linux systems use simplified forms of these -- such as the init program included in busybox, which processes a limited form of /etc/inittab, or a direct invocation of a shell script or small program to do fixed initialization steps.
The Android 'init' program processes two files, executing the commands it finds in them, called 'init.rc' and 'init.<machine_name>.rc', where <machine_name> is the name of the hardware that Android is running on. (Usually, this is a code word. The name of the HTC1 hardware for the ADP1 is 'trout', and the name of the emulator is 'goldfish'.
The 'init.rc' file is intended to provide the generic initialization instructions, while the 'init.<machine_name>.rc' file is intended to provide the machine-specific initialization instructions.
====================================================================================================
Now, that's the general booting process. Now, lets look into our phone's booting process. The bootloader is "HBOOT" specialised for our phones, made by HTC.
This boots up the hardware, loads the kernel, and, the "init" process starts running. If you unpack any kernel you'd find these two files:
Code:
init.rc
init.pico.rc
As you'd have guessed by now, the init.rc is general instructions, and init.pico.rc is the hardware device specific parts.
The init process is what will set up all native services and this is similar to a regular Linux system boot.
So, the init process is also the reason why the filesystems are mounted. If you'd open up any init.rc file, you'd find these lines:
Code:
on fs
# mount mtd partitions
# Mount /system rw first to give the filesystem a chance to save a checkpoint
mount yaffs2 [email protected] /system
mount yaffs2 [email protected] /system ro remount
mount yaffs2 [email protected] /data nosuid nodev
mount yaffs2 [email protected] /cache nosuid nodev
This language is commonly known as the "Android Init Language", and you can look up for help here: https://android.googlesource.com/platform/system/core/+/master/init/readme.txt
So, this is where the filesystems get mounted.
Now, to make a reverse-mounting boot.img, we'd need to modify these lines. Lets mount the second partition in the SD Card in the data partition. So, we'd simply replace this line:
Code:
mount yaffs2 [email protected] /data nosuid nodev
with a modified line, like this:
Code:
mount ext4 /dev/block/mmcblk0p2 /data nosuid nodev
If you'd see, this follows this configuration:
mount <type> <device> <dir> [ <mountoption> ]*
Now, the nosuid, nodev, etc are mountoptions. There are a variety of mount options, and the right choice of them, is likely to make your mounted partition accessible faster. Example: You can disable journaling, or use a different method of journaling, so that, you get access to the partitions faster, and as a direct result, your phone *might* become faster. The general mount options can be found here: http://linux.die.net/man/8/mount
So, that's about how you do the "reverse-mounting" thing.
p.s. here's the mount config that I usually use. Also posting the reasons
p.p.s. I use an ext4 partition
Code:
mount ext4 /dev/block/mmcblk0p2 /data nosuid nodev noatime nodiratime nouser norelatime nostrictatime noiversion nobarrier noauto_da_alloc nouser_xattr data=writeback commit=30 inode_readahead_blks=64 errors=continue
Code:
# [*]nosuid - Do not allow set-user-identifier or set-group-identifier bits to take effect.
# [*]nodev - Do not interpret character or block special devices on the file system.
# [*]noatime - Do not update inode access times on this filesystem.
# [*]nodiratime - Do not update directory inode access times on this filesystem.
# [*]nouser - Forbid an ordinary (i.e., non-root) user to mount the filesystem. This is the default.
# [*]norelatime - Do not use relatime feature. See also the strictatime mount option.
# [*]nostrictatime - Use the kernel's default behaviour for inode access time updates.
# [*]noiversion - Do not increment the i_version inode field.
# [**]nobarrier - This enables/disables barriers. nobarrier disables it, barrier enables it. Write barriers enforce proper on-disk ordering of journal commits, making volatile disk write caches safe to use, at some performance penalty.
# data=writeback - Data ordering is not preserved - data may be written into the main filesystem after its metadata has been committed to the journal. This is rumoured to be the highest-throughput option. It guarantees internal filesystem integrity, however it can allow old data to appear in files after a crash and journal recovery.
# commit=30 - Sync all data and metadata every 30 seconds. The default value is 5 seconds. Zero means default. (Setting it to very large values will improve performance.)
# noauto_da_alloc - http://forum.xda-developers.com/showthread.php?t=876069
# nouser_xattr - Support "user." extended attributes (or not).
# errors=continue - errors={continue|remount-ro|panic} Define the behaviour when an error is encountered. (Either ignore errors and just mark the filesystem erroneous and continue,
# inode_readahead_blks=64 -set to 64 from default 32
thewisenerd said:
Note: memory increasing kernels and, kernels that mount certain partitions(like cache, data etc. etc. ) both do the exact same thing.
Clarifications:
1. There's no such thing as a memory increasing kernel, and there can't be. No!? Why not? Because, however much memory's present, so, remains. This particular *myth* comes from the slang "memory increasing scripts", i.e. scripts that mount an external SD Card's partition as the internal /data partition.
2. The kernel doesn't increase the memory (check clarification 1). The increasing in memory is done by reverse-mounting (yes, reverse-mounting partitions, is a fairly popular slang for this practice) partitions from the SDCard as the internal partitions, and thus, the phone thinks that it has a more storage, than its own internal storage.
So, how does the memory increasing get done?
Ramdisks! These are the files that go on form the root file system. The kernel itself is packed with the ramdisk. A typical android bootup sequence is this: (thanks to the writers of this article here: http://elinux.org/Android_Booting)
1. The first program which runs on any Android system is the bootloader. Technically, the bootloader is outside the realm of Android itself, and is used to do very low-level system initialization, before loading the Linux kernel. The kernel then does the bulk of hardware, driver and file system initialization, before starting up the user-space programs and applications that make up Android.
2. 'init'
A key component of the Android bootup sequence is the program 'init', which is a specialized program for initializing elements of the Android system. Unlike other Linux systems (embedded or otherwise), Android uses its own initialization program. (Linux desktop systems have historically used some combination of /etc/inittab and sysV init levels - e.g. /etc/rc.d/init.d with symlinks in /etc/rc.d/rc.). Some embedded Linux systems use simplified forms of these -- such as the init program included in busybox, which processes a limited form of /etc/inittab, or a direct invocation of a shell script or small program to do fixed initialization steps.
The Android 'init' program processes two files, executing the commands it finds in them, called 'init.rc' and 'init.<machine_name>.rc', where <machine_name> is the name of the hardware that Android is running on. (Usually, this is a code word. The name of the HTC1 hardware for the ADP1 is 'trout', and the name of the emulator is 'goldfish'.
The 'init.rc' file is intended to provide the generic initialization instructions, while the 'init.<machine_name>.rc' file is intended to provide the machine-specific initialization instructions.
====================================================================================================
Now, that's the general booting process. Now, lets look into our phone's booting process. The bootloader is "HBOOT" specialised for our phones, made by HTC.
This boots up the hardware, loads the kernel, and, the "init" process starts running. If you unpack any kernel you'd find these two files:
Code:
init.rc
init.pico.rc
As you'd have guessed by now, the init.rc is general instructions, and init.pico.rc is the hardware device specific parts.
The init process is what will set up all native services and this is similar to a regular Linux system boot.
So, the init process is also the reason why the filesystems are mounted. If you'd open up any init.rc file, you'd find these lines:
Code:
on fs
# mount mtd partitions
# Mount /system rw first to give the filesystem a chance to save a checkpoint
mount yaffs2 [email protected] /system
mount yaffs2 [email protected] /system ro remount
mount yaffs2 [email protected] /data nosuid nodev
mount yaffs2 [email protected] /cache nosuid nodev
This language is commonly known as the "Android Init Language", and you can look up for help here: https://android.googlesource.com/platform/system/core/+/master/init/readme.txt
So, this is where the filesystems get mounted.
Now, to make a reverse-mounting boot.img, we'd need to modify these lines. Lets mount the second partition in the SD Card in the data partition. So, we'd simply replace this line:
Code:
mount yaffs2 [email protected] /data nosuid nodev
with a modified line, like this:
Code:
mount ext4 /dev/block/mmcblk0p2 /data nosuid nodev
If you'd see, this follows this configuration:
mount <type> <device> <dir> [ <mountoption> ]*
Now, the nosuid, nodev, etc are mountoptions. There are a variety of mount options, and the right choice of them, is likely to make your mounted partition accessible faster. Example: You can disable journaling, or use a different method of journaling, so that, you get access to the partitions faster, and as a direct result, your phone *might* become faster. The general mount options can be found here: http://linux.die.net/man/8/mount
So, that's about how you do the "reverse-mounting" thing.
p.s. here's the mount config that I usually use. Also posting the reasons
p.p.s. I use an ext4 partition
Code:
mount ext4 /dev/block/mmcblk0p2 /data nosuid nodev noatime nodiratime nouser norelatime nostrictatime noiversion nobarrier noauto_da_alloc nouser_xattr data=writeback commit=30 inode_readahead_blks=64 errors=continue
Code:
# [*]nosuid - Do not allow set-user-identifier or set-group-identifier bits to take effect.
# [*]nodev - Do not interpret character or block special devices on the file system.
# [*]noatime - Do not update inode access times on this filesystem.
# [*]nodiratime - Do not update directory inode access times on this filesystem.
# [*]nouser - Forbid an ordinary (i.e., non-root) user to mount the filesystem. This is the default.
# [*]norelatime - Do not use relatime feature. See also the strictatime mount option.
# [*]nostrictatime - Use the kernel's default behaviour for inode access time updates.
# [*]noiversion - Do not increment the i_version inode field.
# [**]nobarrier - This enables/disables barriers. nobarrier disables it, barrier enables it. Write barriers enforce proper on-disk ordering of journal commits, making volatile disk write caches safe to use, at some performance penalty.
# data=writeback - Data ordering is not preserved - data may be written into the main filesystem after its metadata has been committed to the journal. This is rumoured to be the highest-throughput option. It guarantees internal filesystem integrity, however it can allow old data to appear in files after a crash and journal recovery.
# commit=30 - Sync all data and metadata every 30 seconds. The default value is 5 seconds. Zero means default. (Setting it to very large values will improve performance.)
# noauto_da_alloc - http://forum.xda-developers.com/showthread.php?t=876069
# nouser_xattr - Support "user." extended attributes (or not).
# errors=continue - errors={continue|remount-ro|panic} Define the behaviour when an error is encountered. (Either ignore errors and just mark the filesystem erroneous and continue,
# inode_readahead_blks=64 -set to 64 from default 32
Click to expand...
Click to collapse
Three words - YOU ARE GREAT! I mean, in the whole explanation you did, I just knew that there is some reverse mounting in init.rc in which few partitions are mounted as data/cache and you cleared my concepts. One more thing related to this I'd like to ask, in sense based roms(For our device) is it possible to do changes in init.rc(which I guess would be required) so that apps are directly installed in sd-ext and the symlink also gets done.
Once again,
THANKS
thewisenerd said:
Note: memory increasing kernels and, kernels that mount certain partitions(like cache, data etc. etc. ) both do the exact same thing.
Clarifications:
Click to expand...
Click to collapse
Lol thats a huge explanation! :good: :highfive:
#Superuser said:
Three words - YOU ARE GREAT! I mean, in the whole explanation you did, I just knew that there is some reverse mounting in init.rc in which few partitions are mounted as data/cache and you cleared my concepts. One more thing related to this I'd like to ask, in sense based roms(For our device) is it possible to do changes in init.rc(which I guess would be required) so that apps are directly installed in sd-ext and the symlink also gets done.
Once again,
THANKS
Click to expand...
Click to collapse
Yes, it is possible. Open your init.rc and find the following line:
Code:
mkdir /data/app 0771 system system
mkdir /data/app-private 0771 system system
mkdir /data/app-asec 0700 root root
mkdir /data/app-lib 0771 system system
Now change it like this:
Code:
# For installing apps directly to /sd-ext:
mkdir /sd-ext/app 0771 system system
mkdir /sd-ext/app-private 0771 system system
mkdir /sd-ext/app-asec 0700 root root
mkdir /sd-ext/app-lib 0771 system system
# Now the symlinking part:
symlink /sd-ext/app /data/app
symlink /sd-ext/app-private /data/app-private
symlink /sd-ext/app-asec /data/app-asec
symlink /sd-ext/app-lib /data/app-lib
NOTE: Before doing this make sure that you have mounted /sd-ext partition.
@thewisenerd....excellent post.....cleared so many doubts....You are really great.
I have a question, I am no dev but just trying to learn some basics about android. As u said that ramdisk does the job of mounting sd partitions using the reverse mounting thing. What is the job of the scripts like int2ext or ungaze or mount2sd.
Is it like when the reverse mounting is not done in ramdisk we need to use these scripts. If yes, then how do these scripts talk 2 ramdisk or kernel to tell them to mount these sd partitions.
I know this may sound noob to you. But m just trying to learn some basics.
@cute_prince Thanks. Now, I'm gonna post all my doubt related to kernels and ramdisks! Thanks to @thewisenerd as well!
cuteitsme said:
@thewisenerd....excellent post.....cleared so many doubts....You are really great.
I have a question, I am no dev but just trying to learn some basics about android. As u said that ramdisk does the job of mounting sd partitions using the reverse mounting thing. What is the job of the scripts like int2ext or ungaze or mount2sd.
Is it like when the reverse mounting is not done in ramdisk we need to use these scripts. If yes, then how do these scripts talk 2 ramdisk or kernel to tell them to mount these sd partitions.
I know this may sound noob to you. But m just trying to learn some basics.
Click to expand...
Click to collapse
Everyone's a newbie (unless they remain to stay a n00b). Anyways, let's get back to on-topic.
So... How does these files in
Code:
/system/init.d/<insert-script-name>
cause the reverse-mount?
For this, we look back, into the init.rc and init.pico.rc files
If you'd read this, https://android.googlesource.com/platform/system/core/+/master/init/readme.txt, you'd find that the Android Init Language gives you an "exec" command for running apps/scripts. So, you should have gotten the hint by now
So, open up init.rc and search for any "exec" command. I can just make it easier, but I want you to find any "exec" call that runs processes from /system/*.
OFC, I'd be telling the answer below, but I want you to find it too
So, here's the key. You're likely to find lines as the same as, or similar to below lines:
Code:
# Run sysinit
exec /system/bin/sysinit
in any one of the *.rc files (mostly init.rc or init.pico.rc).
So, lets take a look at this file.
Below is the above file (/system/bin/sysinit) from CM10.2, weekly 9
Code:
#!/system/bin/sh
export PATH=/sbin:/system/sbin:/system/bin:/system/xbin
/system/bin/logwrapper /system/xbin/run-parts /system/etc/init.d
So, what's this, exactly?
Linux users would be familiar with the PATH variable name
And, logwrapper? Here's standard help:
Code:
Usage: logwrapper [-d] BINARY [ARGS ...]
Forks and executes BINARY ARGS, redirecting stdout and stderr to
the Android logging system. Tag is set to BINARY, priority is
always LOG_INFO.
-d: Causes logwrapper to SIGSEGV when BINARY terminates
fault address is set to the status of wait()
So, its going to execute a binary file, but which?
The next "argument" reads "/system/xbin/run-parts"
Again, here's standard help:
Code:
BusyBox v1.20.2-cm9 bionic (2012-11-18 13:31 +0100) multi-call binary.
Usage: run-parts [-t] [-l] [-a ARG] [-u MASK] DIRECTORY
Run a bunch of scripts in DIRECTORY
-t Print what would be run, but don't actually run anything
-a ARG Pass ARG as argument for every program
-u MASK Set the umask to MASK before running every program
-l Print names of all matching files even if they are not executable
So, run a bunch of scripts in a directory?
That pretty much explains why the next "argument" follows as "/system/etc/init.d ".
So, that's how init.d works :cyclops:
============================================================================================================
Now, moving on to memory increasing scripts (oh! I hate that slang)
Anyways, so, we found out that during the boot, the init.rc file is calling the /system/bin/sysinit file. If you'd notice, a few lines "above",
Here's something from http://www.kpbird.com/2012/11/in-depth-android-boot-sequence-process.html
Below is the sequence of android booting. Note that until all these processes are completed, you still see the boot logo. So, if your phone's struck at green htc screen, then, any one of this processes is.. hung.
on early-init:
Set init and its forked children's oom_adj.
Set the security context for the init process.
on init
setup the global environment
Create cgroup mount point for cpu accounting and many other things...
on fs
mount mtd partitions
on post-fs
change permissions of system directories
on post-fs-data
change permission of /data folders and sub folders
on boot
basic network init ,Memory Management ,etc
service servicemanager
start system manager to manage all native services like location, audio, shared preference etc..
service zygote
start zygote as app_process
So, the "/system/bin/sysinit" runs at the "boot" service. Also, it is run by the bootloader. So, it has full access to the root file system that the ramdisk creates. Now, to be noted: the "boot" service runs after the "fs" service, evidently, because else, you wouldn't be able to access the "/system/bin/sysinit" otherwise.
So, the "sysinit" script runs, running all the files from /system/etc/init.d with the help of busybox
That's about it
But, how does the reverse-mounting take place!?
Let me take the example of the simplest reverse mounting script I've ever found: int2ext. I've seen the mounts2sd script, and think its bloated, IMO, because why have a 1000+ lines script, when a script with >40 lines can do it :angel: ) (no offense). For me, just placing script, setting permissions, rebooting should increase the memory of my device. No roundabout stuff.
So, I'd be explaining how int2ext works, below:
Note: before you proceed, you'd have noticed that the sysinit file set the PATH variable. Its the location for all the accessible binary files. (if you don't understand this, using linux might help you understand this better ) This is similar to the PATH variable in windows too.. This just tells the system where to look for executable binary files/programs.
So, here's a very minimal int2ext script (modified to make this post smaller):
The purple lines ("Royal Blue" according to XDA), are the lines of code. Rest are my comments.
Credits go to original file, got from here: https://github.com/croniccorey/cronmod-scripts/blob/master/int2ext%20scripts/INT2EXT
## Only continue if mmcblk0p2 exists
if [ ! -e /dev/block/mmcblk0p2 ] //If /dev/block/mmcblk0p2 doesn't exist
then //then
exit //this script exists. this code's here for safety.
fi;
## Set SD cache size
SD_CACHE=/sys/devices/virtual/bdi/179:0/read_ahead_kb //read_ahead_kb is the amount of kb that the kernel reads, beforehand.
if [ -e $SD_CACHE ] //checking the existence of the file, just in case...
then
busybox echo "2048" > $SD_CACHE; //2048 is found to be an optimum value for sdcards, class 4 and better.
fi;
## Make /sd-ext directory if needed and unmount /sd-ext if it already mounted
##why? because the writer croniccorey, has done some thinking here
##will explain side by side... If the directory /sd-ext doesn't exist, its created here.
##note: the commands run by the init.rc have full access to the root file system created.
if [ ! -e /sd-ext ] //if doesn't exist sd-ext foler in root file system
then
busybox mount -o remount,rw /; //mount the root file system "/" as rewritable
busybox mkdir /sd-ext; //create a directory named sd-ext
busybox mount -o remount,ro /; //mount the file system as read-only again
else
busybox umount /sd-ext; //else, unmount the sd-ext partition, i.e. partition in the sd-card.
fi;
## Move /data mount point to /sd-ext
INT_DATA=$(busybox mountpoint -n /data | cut -d ' ' -f1) //this gets the mountpoint of the data partition.
// this command "busybox mountpoint -n /data | cut -d ' ' -f1" is actually runnable, and you'd get the mount point
// of the /data partition in the internal memory (which is this: /dev/block/mtdblock5)
busybox umount /data; //unmount the /data partition too/
// the data partition is unmounted because we're going to do some stuff
busybox mount $INT_DATA /sd-ext;
// mount the internal data partition in the sd-ext folder
## Mount mmcblk0p2 to /data
busybox mount -o noatime,nodiratime,nosuid,nodev /dev/block/mmcblk0p2 /data; //well, this is self-explanatory. mount the partition in sdcard into internal memory.
busybox chown 1000:1000 /data; //chown the folder by root (get more help by running "man chown" in a shell)
busybox chmod 771 /data; //chmod the folder (get more help by running "man chmod" in a shell)
## Move existing files
if [ ! -e /data/app ] //why /data/app? simply, it can also be anything else like /data/data...
then
busybox mv /sd-ext/* /data;
// the sd-ext folder has the files of the internal /data partition
// those are moved to the sd-card's partition, which is mounted in /data now.
fi;
## Unmount /sd-ext
//unmount the internal data partition.
// we have the partition from the sd-card mounted in the /data partition currently.
busybox umount /sd-ext;
sync;
//sync changes with file system
Click to expand...
Click to collapse
the comments should explain almost everything...
This script, is almost flawless. Couldn't find any bugs in it. Does what would have been done by changing the mount point in the "on fs" part, where it mounts the file system.
An added advantage is that this can be put into use any time you want... Example, you use your phone, internal memory gets filled up, just put this script in /system/etc/init.d, and set permissions, and reboot! voila! memory increased!
Note: reversing this can't be done by just deleting the script. an appropriate script that moves back user data to internal partitions may be needed.
Also note:
You can always tweak this command:
busybox mount -o noatime,nodiratime,nosuid,nodev /dev/block/mmcblk0p2 /data;
for better performance. Check my config, in post 8 or so... 1'st page..
You should've also guessed why we set permissions to executable, by now... Else, the file wouldn't be able to "execute"
P.S. Adding a few lines to init.rc should make it possible to have no permission change, but, that can wait for another day...
Simply awesome.....what an explanation sirji....
Still trying to understand some part but i will have to do more reading for that first....that i will do.....but must say U rock man.....thanks a lot for this....
thewisenerd said:
Everyone's a newbie (unless they remain to stay a n00b). Anyways, let's get back to on-topic.
So... How does these files in
Code:
/system/init.d/<insert-script-name>
cause the reverse-mount?
For this, we look back, into the init.rc and init.pico.rc files
If you'd read this, https://android.googlesource.com/platform/system/core/+/master/init/readme.txt, you'd find that the Android Init Language gives you an "exec" command for running apps/scripts. So, you should have gotten the hint by now
So, open up init.rc and search for any "exec" command. I can just make it easier, but I want you to find any "exec" call that runs processes from /system/*.
OFC, I'd be telling the answer below, but I want you to find it too
So, here's the key. You're likely to find lines as the same as, or similar to below lines:
Code:
# Run sysinit
exec /system/bin/sysinit
in any one of the *.rc files (mostly init.rc or init.pico.rc).
So, lets take a look at this file.
Below is the above file (/system/bin/sysinit) from CM10.2, weekly 9
Code:
#!/system/bin/sh
export PATH=/sbin:/system/sbin:/system/bin:/system/xbin
/system/bin/logwrapper /system/xbin/run-parts /system/etc/init.d
So, what's this, exactly?
Linux users would be familiar with the PATH variable name
And, logwrapper? Here's standard help:
Code:
Usage: logwrapper [-d] BINARY [ARGS ...]
Forks and executes BINARY ARGS, redirecting stdout and stderr to
the Android logging system. Tag is set to BINARY, priority is
always LOG_INFO.
-d: Causes logwrapper to SIGSEGV when BINARY terminates
fault address is set to the status of wait()
So, its going to execute a binary file, but which?
The next "argument" reads "/system/xbin/run-parts"
Again, here's standard help:
Code:
BusyBox v1.20.2-cm9 bionic (2012-11-18 13:31 +0100) multi-call binary.
Usage: run-parts [-t] [-l] [-a ARG] [-u MASK] DIRECTORY
Run a bunch of scripts in DIRECTORY
-t Print what would be run, but don't actually run anything
-a ARG Pass ARG as argument for every program
-u MASK Set the umask to MASK before running every program
-l Print names of all matching files even if they are not executable
So, run a bunch of scripts in a directory?
That pretty much explains why the next "argument" follows as "/system/etc/init.d ".
So, that's how init.d works :cyclops:
============================================================================================================
Now, moving on to memory increasing scripts (oh! I hate that slang)
Anyways, so, we found out that during the boot, the init.rc file is calling the /system/bin/sysinit file. If you'd notice, a few lines "above",
Here's something from http://www.kpbird.com/2012/11/in-depth-android-boot-sequence-process.html
Below is the sequence of android booting. Note that until all these processes are completed, you still see the boot logo. So, if your phone's struck at green htc screen, then, any one of this processes is.. hung.
on early-init:
Set init and its forked children's oom_adj.
Set the security context for the init process.
on init
setup the global environment
Create cgroup mount point for cpu accounting and many other things...
on fs
mount mtd partitions
on post-fs
change permissions of system directories
on post-fs-data
change permission of /data folders and sub folders
on boot
basic network init ,Memory Management ,etc
service servicemanager
start system manager to manage all native services like location, audio, shared preference etc..
service zygote
start zygote as app_process
So, the "/system/bin/sysinit" runs at the "boot" service. Also, it is run by the bootloader. So, it has full access to the root file system that the ramdisk creates. Now, to be noted: the "boot" service runs after the "fs" service, evidently, because else, you wouldn't be able to access the "/system/bin/sysinit" otherwise.
So, the "sysinit" script runs, running all the files from /system/etc/init.d with the help of busybox
That's about it
But, how does the reverse-mounting take place!?
Let me take the example of the simplest reverse mounting script I've ever found: int2ext. I've seen the mounts2sd script, and think its bloated, IMO, because why have a 1000+ lines script, when a script with >40 lines can do it :angel: ) (no offense). For me, just placing script, setting permissions, rebooting should increase the memory of my device. No roundabout stuff.
So, I'd be explaining how int2ext works, below:
Note: before you proceed, you'd have noticed that the sysinit file set the PATH variable. Its the location for all the accessible binary files. (if you don't understand this, using linux might help you understand this better ) This is similar to the PATH variable in windows too.. This just tells the system where to look for executable binary files/programs.
So, here's a very minimal int2ext script (modified to make this post smaller):
The purple lines ("Royal Blue" according to XDA), are the lines of code. Rest are my comments.
Credits go to original file, got from here: https://github.com/croniccorey/cronmod-scripts/blob/master/int2ext%20scripts/INT2EXT
the comments should explain almost everything...
This script, is almost flawless. Couldn't find any bugs in it. Does what would have been done by changing the mount point in the "on fs" part, where it mounts the file system.
An added advantage is that this can be put into use any time you want... Example, you use your phone, internal memory gets filled up, just put this script in /system/etc/init.d, and set permissions, and reboot! voila! memory increased!
Note: reversing this can't be done by just deleting the script. an appropriate script that moves back user data to internal partitions may be needed.
Also note:
You can always tweak this command:
busybox mount -o noatime,nodiratime,nosuid,nodev /dev/block/mmcblk0p2 /data;
for better performance. Check my config, in post 8 or so... 1'st page..
You should've also guessed why we set permissions to executable, by now... Else, the file wouldn't be able to "execute"
P.S. Adding a few lines to init.rc should make it possible to have no permission change, but, that can wait for another day...
Click to expand...
Click to collapse
I read somewhere, that init.d scripts run alphabetically, maybe this is the reason int2ext is named as 40int2ext so that it starts first?
#Superuser said:
I read somewhere, that init.d scripts run alphabetically, maybe this is the reason int2ext is named as 40int2ext so that it starts first?
Click to expand...
Click to collapse
Yeah....I guess that's the linux thing. I think the higher the no. the late the script will be called. This is basically to run the more important scripts before the other scripts.
hi i unpacked the boot.img files of cm11 beta 1 and 2 in order to understand this better and understood many things which u have explained.
I did found those lines starting with exec in some init. files.
Thanks a lot for this. Since u must be aware that the sd-ext is not mounting in buid 2 and thus int2ext is not working. So, out of curiosity I was trying to understand the difference between these two files from different builds(beta 1 and 2) but not able to find any.
Can u give any hint as to why even after having the same lines in fstab.pico of build 1 and build 2 int2ext was working in buld 1 and not in build 2. Of course by doing reverse mounting we can overcome this issue. But I am just trying to understand the difference between the two builds at ramdisk level.
cuteitsme said:
hi i unpacked the boot.img files of cm11 beta 1 and 2 in order to understand this better and understood many things which u have explained.
I did found those lines starting with exec in some init. files.
Thanks a lot for this. Since u must be aware that the sd-ext is not mounting in buid 2 and thus int2ext is not working. So, out of curiosity I was trying to understand the difference between these two files from different builds(beta 1 and 2) but not able to find any.
Can u give any hint as to why even after having the same lines in fstab.pico of build 1 and build 2 int2ext was working in buld 1 and not in build 2. Of course by doing reverse mounting we can overcome this issue. But I am just trying to understand the difference between the two builds at ramdisk level.
Click to expand...
Click to collapse
Hmm... Could you post the two boot.img's here? I'd like to have a look
thewisenerd said:
Hmm... Could you post the two boot.img's here? I'd like to have a look
Click to expand...
Click to collapse
Sure y not.....here u go
@thewisenerd: does the ION Kernel used in cyanogenmod 11 support swap
PiCo HackR said:
@thewisenerd: does the ION Kernel used in cyanogenmod 11 support swap
Click to expand...
Click to collapse
The question is: Why do you need swap?

Categories

Resources