SGY Bootscript - Galaxy Y GT-S5360 Android Development

What is it ?
Bootscript is small modification to SGY's init.rc, to run several shell script on spesific boot event. Right now it's support 5 event :
1. init, before system partition mounted
2. post-system, after system partition mounted
3. post-cache, after cache partition mounted
4. post-data, after data partition mounted
5. done, before service run
Bootscript also have init.d support. init.d run after "done" script running.
Why ?
Originally i write this script to make my dual boot script easier to customise. But then i relize that it can be use to create another cool thing.
How ?
First download and flash Bootscript (Link at bottom of post). Put that file on PDA field if you use Odin or unpack tar file if you use other method. It's modification from DXLC1 boot.img. If you want study my mod, unpack ramfs from boot.img and look at "init.rc" and "sbin/bootscript.sh".
Create folder ".bootscript" in your sdcard (1st,fat partition) root. Put your script there. Your script must have name "init","post-system","post-cache","post-data","done". You don't need all 5 files, use only event you needed.
Before running your script, Bootscript copy all your ".bootscript" content to "/tmp/bootscript". You can add other file(s) beside your script in ".bootscript" folder but keep it small in size because all that file(s) will eat your ram. You can delete "/tmp/bootscript" content in your script, except in "done" script. When "done" running, your root path already become read only. If you need do clean up, do it in "post-data" and use "/data" as your temporary (but make sure you don't delete "done" script).
Bootscript ramfs have build-in busybox. You have to use that for your "init" script interpreter because "init" script run before system partition mounted. Just put in first line of your script
Code:
#!/sbin/busybox.boot sh
What is the drawback ?
Depend on your script, it can slow down your boot process. With Bootscript you can easily mess up your device. Use only if you familiar with android boot process and shell scripting. If you concern about security, if used without care, Bootscript can make your device unsecure because it's put importance boot process on unsecure location (sdcard).
What it can do ?
A lot. Few example :
1. Dual boot
2. Temporary install themes
3. Data2SD
4. Backup your applications
Where I can get it
boot-script-0.1.tar

Dual Boot
Use same partition and and custom rom instalation process as in http://forum.xda-developers.com/showthread.php?t=1598803 . Save this scripts in ".bootscript" in your sdcard
post-system
Code:
#!/sbin/busybox.boot sh
BUSYBOX=/sbin/busybox.boot
PART_DEV=/dev/block/mmcblk0p2
PART_TYPE=ext3
if [ -f /tmp/bootscript/bootsdcard ]
then
$BUSYBOX umount /system
$BUSYBOX mount -t $PART_TYPE $PART_DEV /system
fi
post-cache
Code:
#!/sbin/busybox.boot sh
BUSYBOX=/sbin/busybox.boot
PART_DEV=/dev/block/mmcblk0p3
PART_TYPE=ext3
if [ -f /tmp/bootscript/bootsdcard ]
then
$BUSYBOX umount /cache
$BUSYBOX mount -t $PART_TYPE $PART_DEV /cache
fi
post-data
Code:
#!/sbin/busybox.boot sh
BUSYBOX=/sbin/busybox.boot
PART_DEV=/dev/block/mmcblk0p4
PART_TYPE=ext3
if [ -f /tmp/bootscript/bootsdcard ]
then
$BUSYBOX umount /data
$BUSYBOX mount -t $PART_TYPE $PART_DEV /data
fi
Create file "bootsdcard" inside ".bootscript" to boot from sdcard.

Temporary-install themes
Save this scripts in ".bootscript" in your sdcard
post-data
Code:
#!/sbin/busybox.boot sh
BUSYBOX=/sbin/busybox.boot
$BUSYBOX mkdir -p /data/themes
$BUSYBOX rm -r /data/themes/*
$BUSYBOX cp -r /tmp/bootscript/themes/* /data/themes
$BUSYBOX rm -r /tmp/bootscript/themes
$BUSYBOX mount -o bind /data/themes/framework-res.apk /system/framework/framework-res.apk
$BUSYBOX mount -o bind /data/themes/twframework-res.apk /system/framework/twframework-res.apk
$BUSYBOX mount -o bind /data/themes/SystemUI.apk /system/app/SystemUI.apk
Create folder "themes" inside ".bootsdcard" and put your themes (framework-res.apk,twframework-res.apk,SystemUI.apk). Reboot your phone.
Warning, this script have possibility make your phone uncleanly unmounted. I don't have any problem with it, but better to be careful. Use only for test purpose, like when you build your own themes or test downloaded themes before you decide to use. Use when you need small modification to your themes. If you do a lot of modification, use dual boot.
Remember to clean "/data/themes" after you done.

admirable idea! +1
remark to the others: It's a modified kernel image, You can't play custom kernels and this Bootscript at the same time!

Doky73 said:
admirable idea! +1
remark to the others: It's a modified kernel image, You can't play custom kernels and this Bootscript at the same time!
Click to expand...
Click to collapse
thank you, but it's just small script.
you right about custom kernel. but i'm not mod kernel image (zImage) only init.rc inside ramfs and add one script "/sbin/bootscript.sh" and of course busybox binary (busybox.boot). i try to KISS so others can easily integrated to other kernel.

we can use this mod to only use the 4th partition as /data without install a new rom in 2nd partition. sounds nice.

Data2SD
@kurotsugi
Yes, it is possible to make data2sd. Create 2nd partition in your sdcard with type ext3. Save this scripts in ".bootscript" in your sdcard 1st partition
post-data
Code:
#!/sbin/busybox.boot sh
BUSYBOX=/sbin/busybox.boot
PART_DEV=/dev/block/mmcblk0p2
PART_TYPE=ext3
$BUSYBOX umount /data
$BUSYBOX mount -t $PART_TYPE $PART_DEV /data
Edit PART_DEV if you have different partition block and PART_TYPE if you use different partition type.

something is weird. your bootscript.sh in sbin/ is empty.

kurotsugi said:
something is weird. your bootscript.sh in sbin/ is empty.
Click to expand...
Click to collapse
the file is in "/sbin/". how you open it ?
i send in attachment both bootscript.sh and init.rc. i copy that file directly from my device using scp.

using rootexplorer, view as text. its empty. the init.d script didn't work neither.
---------- Post added at 09:16 PM ---------- Previous post was at 08:50 PM ----------
I've extracted the kernel and check the files. it has exact same script with the one in your attachement. I think my cwm is not work or something. now I can't install any custom kernel into my device.

test speed
irfanbagus said:
Use same partition and and custom rom instalation process as in irfan's "DUAL BOOT" method http://forum.xda-developers.com/showthread.php?t=1598803 .
Save this scripts in ".bootscript" in your sdcard
BUSYBOX=/sbin/busybox.boot
PART_DEV=/dev/block/mmcblk0p3
PART_TYPE=ext3
if [ -f /tmp/bootscript/bootsdcard ]
then
$BUSYBOX umount /cache
$BUSYBOX mount -t $PART_TYPE $PART_DEV /cache
fi[/code]post-data
Code:
#!/sbin/busybox.boot sh
[/QUOTE]
I suggest to those who run this method: compare speed with /cache on p3 and on NAND-internal. There is no need to use cache on sdcard, I believe !! :cool::cool: its very slow !
putting /cache unecessarily on sd-card is not a good idea. it is improper to do that.
[SIZE=1]---------- Post added at 06:32 PM ---------- Previous post was at 06:03 PM ----------[/SIZE]
[B]
Test Report
[/B]
the file /sdcard/.bootscript/post-data wasn't executed. remember /sdcard/.bootscript is a dir., not a file !
boot-script-0.1.tar includes some stock kernel built on March 7th 2012. boots up nicely.
after reboot /data was still on stl11 acc. to rootexplorer.
/init.rc included mods
/sbin/bootscript.sh seemed empty in rootexplorer (use other file manager, then its OK) . after editing, was empty again after reboot. s.th. is deleting stuff from /sbin ....
clarification: your scripts naming scheme:
file path : /sdcard/.bootscript
in there, file name : "post-data" (no extension!) or some of the other mentioned names.
in post #7 irfan there is mentioning of the /sdcard/bootsdcard flagging file. it only applies for full DUAL ROM, not with /data from sd only.
but even with it, still no luck !
Click to expand...
Click to collapse

in theory we can have triple or quad boot on this thing...

mai77 said:
I suggest to those who run this method: compare speed with /cache on p3 and on NAND-internal. There is no need to use cache on sdcard, I believe !! its very slow !
putting /cache unecessarily on sd-card is not a good idea. it is improper to do that.
---------- Post added at 06:32 PM ---------- Previous post was at 06:03 PM ----------
Test Report
the file /sdcard/.bootscript/runme.sh wasnt executed. remember /sdcard/,bootscript is a dir., not a file !
boot-script-0.1.tar includes some stock kernel built on March 7th 2012. boots up nicely.
after reboot /data was still on stl11 acc. to rootexplorer.
/init.rc included mods
/sbin/bootscript.sh seemed empty in rootexplorer (use other file manager, then its OK) . after editing, was empty again after reboot. s.th. is deleting stuff from /sbin ....
clarification: your scripts naming scheme:
file path : /sdcard/.bootscript
in there, file name : "post-data" (no extension!) or some of the other mentioned names.
in post #7 irfan forgot to mention the /sdcard/bootsdcard flagging file. without it, no mounting of /data !
but even with it, still no luck !
Click to expand...
Click to collapse
Irfan work very awesome even little script but have big impact..
I use all his work with little modification and u can do with ur style.. For me cache still use internal coz 1 partition on external can use for link2sd/a2sd..

could you just clearly state whether the download worked immediatly or did it not work.
yes
or
no

mai77 said:
could you just clearly state whether the download worked immediatly or did it not work.
yes
or
no
Click to expand...
Click to collapse
If im not wrong this is 1st mod fro irfan but he finish it with dualboot kernel (he say beta but for me its final).. Then I play with his work to my kernel with modification..

the problem is: -t ext3
ext2
works better.
maybe missing ext3 module ...
test result: the download does not work unless you take further preparation. if you use ext2 fs for /data directory, then it works.

mai77 said:
the problem is: -t ext3
ext2
works better.
maybe missing ext3 module ...
test result: the download does not work unless you take further preparation. if you use ext2 fs for /data directory, then it works.
Click to expand...
Click to collapse
I prefer ext4
Working well with cm7/9 on 2nd rom with my kernel..

I tried savie kernel many times with all tricks. it never booted up over here...
---------- Post added at 09:15 PM ---------- Previous post was at 09:02 PM ----------
so, irfan's BOOTSCRIPT is quite nice. but the above .tar download does not contain the kernel that I want.
so s.o. needs to zip up a current kernel into a boot.img
---------- Post added at 09:28 PM ---------- Previous post was at 09:15 PM ----------
irfanbagus said:
@kurotsugi
Yes, it is possible to make data2sd. Create 2nd partition in your sdcard with type ext3. Save this scripts in ".bootscript" in your sdcard 1st partition
post-data
Code:
#!/sbin/busybox.boot sh
BUSYBOX=/sbin/busybox.boot
PART_DEV=/dev/block/mmcblk0p2
PART_TYPE=ext3
$BUSYBOX umount /data
$BUSYBOX mount -t $PART_TYPE $PART_DEV /data
Edit PART_DEV if you have different partition block and PART_TYPE if you use different partition type.
Click to expand...
Click to collapse
stock rom users dont have ext3 available, they should use ext2.
on first boot from sd, expect 3 minutes longer boot time ! SGY is not stuck, it copies /data !

Terminal ide app works only if installed to NAND. Not poss in /data on sd mode

hi all, another great tutorial from irfanbagus, one question can we mount a img file ?
In linux we can mount a image file with -o loop, i have tryed in android but with no sucess so far, is there a way we can mount a image file(img) in android ?
that way we dont need the partitions and we will be able to run more roms.
Just one idea.
hal_2000

Related

Android init.rc Language

Hi XDA,
I havent found much on this topic on the forum. I wonder if anyone can elaborate or link me in the right direction regarding this issue.
Im working with Amon_Ra's latest 1.6.2 ROM. I unzipped it, took the boot.img, unpacked it, add a line in /etc/fstab and init.rc, repacked it, zipped the ROM, signed it, flashed it. But my changes dont seem to do the trick.
the following was added to init.rc
Code:
mount ext2 /dev/block/mmcblk0p2 /system/sd rw noatime nodiratime
and this was added to /etc/fstab
Code:
/dev/block/mmcblk0p2 /system/sd ext2 rw
Yes /system/sd exists, and Yes my microSD is partitioned correctly. I presume my line might be in wrong syntax? Or? Wiped before I flashed, didnt help.
If I've missed a thread on init.rc syntax I pardon that
Any help is appreciated!
altso tried,
Code:
mount ext2 [email protected] /system/sd
any suggestions at all?
bump, bump!
im running a motorola cliq, but i do know that the init.rc has the ability to start services.
You may want to try adding your lines into a script (shell script), and put that script into /system/bin
THEN add a command to open console and start that particular script, in init.rc
works for me with apps2sd for cliq.

CUSTOM Script on Custom Roms

hey,
whenever i flash a new rom i edit the zip to replace keylayouts, apps in /system and /data , bootscreens and some other stuff......
i now want to symlink some directories with a script which will be loaded during rom flash because otherwise i would need a pc to access it through adb...
the script i want FOR NOW (i may use it for other things in the future)
is about symlinking the
/system/customize/resource/bootanimation.zip to /data/local/bootanimation.zip
/system/customize/resource/android_audio.mp3 to /data/local/android_audio.mp3
i can do this through adb as i said but i'd prefer it to be done automatically by a script during flash.... i know the commands to use but i need a way to implement the script into the rom.....
i think it's like the a2sd+ script but i am not sure....
if anyone knows please help me
you need to split open your boot.img and modify the init.rc (the file where services are initialised at Android startup)
See this link for notes on working with the boot.img
you can create the symlinks directly in this file, have a look at the syntax and you should be able to work it out. The ln command doesn't work though, use the format:
Code:
symlink /system/customize/resource/bootanimation.zip /data/local/bootanimation.zip
Or you can create a dummy 'service' which executes a file on your filesystem (like /etc/rc.local) and put your "ln -s" commands in there.
Why not just create a custom update.zip with your changes only, then you can apply it after flashing any rom.
Klutsh said:
Why not just create a custom update.zip with your changes only, then you can apply it after flashing any rom.
Click to expand...
Click to collapse
How would you do this?
Say I wanted an update.zip that would remove plurk and add a certain app. How would I go about creating that?
removing and adding is easy with the update signer app.....i just want to add a script that symlinks directories at boot in order to avoid the use of a pc.....i tried the trick st0kes said and i am waiting for the flashing now to complete and send my feedback
nope it didn't work.....is there any specific place to put the command ????
i put it at the very end of the init.rc file
ok after a lot of reading i created a service which runs a folder with scripts...where i have the script that symlinks the files.....
service myscripts /system/bin/logwrapper /system/xbin/busybox run-parts /system/etc/myscript.d
oneshot
Click to expand...
Click to collapse
this is the service code
and here is the code i have into the "bootanimation" script which is inside the myscript.d folder
#!/system/bin/sh
mount /system
mount /data
ln -s /system/customize/resource/bootanimation.zip /data/local/bootanimation.zip
ln -s /system/customize/resource/android_audio.mp3 /data/local/android_audio.mp3
Click to expand...
Click to collapse
what am i doing wrong here ????? please someone with knowledge enlighten me!! the script does not run
damn....it's been a long night and still haven't found a way to do it !!!!!!
i tried all the followings:
1) added a file called "myscript" (it contained two lines with the symlink commands) in init.d folder in order to execute when the boot is complete - FAILED
2) added the same file into another folder and added a service at the bottom of the init.rc file that called it
service myscript /system/etc/myscripts/myscript
oneshot
Click to expand...
Click to collapse
-FAILED
3) added the SYMLINK commands into the init.rc file
a)at the bottom -FAILED
b) before the bootanim, bootsound services -FAILED
c) before the bootcomplete = 1 value in init.rc -FAILED
d) after sysinit execution in init.rc -FAILED
e) before sysinit execution in init.rc - FAILED
f) at the top after some lines of code in init.rc - FAILED
i read that HTC change the boot process and to run custom scripts at boot you must add their commands in "bootcomplete.bravo.rc"
i tried that too but FAILED again....i think this is logical cause these scripts are executed after the boot and just when the phone is gonna show the pin dialog....
i think it's something to do with the init.rc file...but i dunno what else to add....
is there anything i have to mount in order to symlink ???? add busybox to something or anything ??????
PLEASE someone with success at scripting like a2sd+ please help me
Try naming your script
Code:
03BootAnim
and place it in
Code:
/system/etc/init.d
Also don't forget to chmod +x it
how to chmod +x ??? nvm i did it...i am now signing it to try it
in adb
Code:
adb shell chmod +x /system/etc/init.d/03BootAnim
chmod 755 does the same, makes it executable by the system
Klutsh said:
Try naming your script
Code:
03BootAnim
and place it in
Code:
/system/etc/init.d
Also don't forget to chmod +x it
Click to expand...
Click to collapse
hey klutsh i tried what you said but it didn't work...
look i created the file
Code:
03BootAnim
and placed it into the
Code:
/system/etc/init.d
the commands i have into the file are these
Code:
#!/system/bin/sh
ln -s /data/local/bootanimation.zip /system/customize/resource/bootanimation.zip
ln -s /data/local/android_audio.mp3 /system/customize/resource/android_audio.mp3
ok i edited the commands like these but no result too.....
Code:
#!/system/bin/sh
busybox mount /system
busybox mount /data
busybox ln -s /data/local/bootanimation.zip /system/customize/resource/bootanimation.zip
busybox ln -s /data/local/android_audio.mp3 /system/customize/resource/android_audio.mp3
i checked with the
Code:
ls -l /system/etc/init.d
command and the permissions are all the same (they are all enabled i think, -rwxr-xr-x )
i wiped everything, flashed, rebooted but no bootanimation!!! the default android logo with the moving shade appears (i have deleted the animation in the system/customize/resource folder in order for the symlink to work)
what am i doing wrong ???? is there something with the script ?
I'm trying to get this working, and so far it is running before the bootanimation, but I get
Code:
run-parts: can't execute '/system/etc/init.d/03BootAnim': No such file or directory
Yet it is available...
what commands do you have in yours ????
maybe a reboot will fix it o yours since it will rescan ?
edit: hey klutsh i logcated my boot and i see that the symlinks do not work cause it says that /system/customize/resource/bootanimation.zip and android_audio.mp3 directories are read-only file systems
That's the problem then.
Already got a fix that you apply once only to a flashed rom then the boot anim runs from /data/local and can be replaced.
http://www.asificanrememberthat.com/DeLite/BootAmin_to_Data.zip
Flash that after any Sense rom that normally has bootanimation in /system/customize
It will delete the 2 files in /system/customize/resource
flash my own bootanimation to /data/local
create the required symlinks that survive reboot's.
You can then just replace the files in /data/local as needed.
as i see you made it with the update sign and packager isn't it ????
nice idea....
BUT why can't we access /system files through boot ???? is there any way to get root access at booting ???
THANKS YOU VERY MUCH for the great effort you made....
is there a way to implement the update-script into the 03BootAnim in order not to have to flah anything ????
the reson i want this is cause i am cooking my roms on my own and i want them to have all i need inside....not having to flash mod1, mod2 etc
It's a feature of the desire, no write access to /system unless in recovery.
You can just take those bit's from my update-script and add them to your own rom's script.
oh yes...this is what i was asking i have tow update-scripts though, one old and one in the android.new folder
i am using dsixda kitchen....in which should i put it ??? does it matter where is it?
edit: found it....signing to flash
HURRAYYYYYYYYYYYYYYYYYYYYYYY
hey klutsh i thank you a lot.....
it was so easy to do it just copy paste the update-script but we (I) took the hard way of READ-ONLY file system....anw i learned A LOT (if you think that i am reading 15hours constantly about this)
PROBLEM SOLVED
You can delete the android.new folder, it isn't used.

[Q] How to create a symlink on every reboot?

Hi!
I'm using the Tiamat Custom ROM and am facing the problem, that the external SDcard is mounted on /mnt/external1 and symlinked to /MicroSD. But I'm using an app that needs it mounted on /sdcard-ext.
Now I have remounted / and symlinked /mnt/external1 to /sdcard-ext and that works until my next reboot (the symlink isn't reboot-proof ;-) ). Now I'm searching for a way to automatically create that symlink on each reboot.
Can anyone help me?
Thanks guys!
McDV
Create a script in /etc/init.d to do it.
You'll need to remount / to read+write first though.
PM me if you need help setting this up -- its really easy to do. You need to name your script with a specific run level (I believe).
I've done this on my phone to set up swap partitions and the like. Its really easy!!!
Thanks for your help! I'm quite firm in shell-operations, I just didn't think I could just put a script to /etc/init.d!
I'v created a shell-script named 07sdcard and with the content:
Code:
#!/system/bin/sh
rootrw
ln -s /mnt/external1 /sdcard-ext
rootro
Works geat!
You've got it now -- awesome.
HI,
Could this be a way to mount the external1 as rw at boot ?
See here: http://forum.xda-developers.com/showthread.php?t=1173195

[Q&A] Mounts2SD - Storage & Memory Management

Mounts2SD - Storage & Memory Management
The Opening Post (OP) has been moved to a new DevDB Section
This Thread has been assigned as an Q&A.
You should see a new pane above where you can navigate this project.
About dalvik-cache? It remains in phone memory?
Hi I cant understand How to use it ! any guide ?!
denzel09 said:
About dalvik-cache? It remains in phone memory?
Click to expand...
Click to collapse
dalvik-cache remains, so does all of the app related data. Only the APK's is moved.
Taki2011 said:
Hi I cant understand How to use it ! any guide ?!
Click to expand...
Click to collapse
First of all you need a custom rom. If you have a stock rom it will not work since you need a rom that will allow custom scripts during boot.
You will also need to know how to use ADB (An android tool for communicating with your phone. It is used to enter the android shell and also to transfer files to and from the phone, among other things).
And last, you will need at least 2 or 3 partitions on your sdcard (Otherwise it's a waste of time, although the script is build to adapt for these scenarios). One as a regular fat32 sdcard partition, one for the sd-ext and one for the cache. (Use ext2 for the last two. ext3 will eat your card to fast)
Here is the steps (You need to have ADB working on your computer).
Copy/Paste the script content into a file editor and safe the file with the name "99mounts2sd"
Plug your phone to your computer using a usb cable (Select charge only on your phone))
Open a terminal on your computer (In windows use "run" and type "cmd")
Type in shell: "adb shell mount -o remount,rw /system"
Type in shell: "adb push <path to script> /system/etc/init.d/"
Type in shell: "adb shell chmod a+x /system/etc/init.d/99mounts2sd"
Reboot your phone
The first time you boot your phone using the script it will take some time, because the script needs to copy all of your APK's from internal storage to the sd-ext partition.
The script has been rewritten. Better checks and more options has been added.
Great script
Sent from my GT-S5570 using Tapatalk
It didn't work for me, I made the files made sure they were in the right place and rebooted but booted normally. No delay on first boot and still seems to not be using the other two partitions on my sd card. i used cwm4 to partiton my SD card and it is partitioned correctly (3 partitons). I see the script says "log" I don't know where the log is stored or how to view it. Thanks.
To see the log, type in the terminal: "logcat | grep mounts2sd". Download a terminal or use ADB.
Also run the command "df -h" to see what is mounted where.
Sent from my HTC Desire using xda premium
thanks for the share.
#7 @dyehya
It seams that logcat has a very limited lifetime. In order to get the log info, you would have to get it during boot.
Instead I have updated the script to do this itself. Update your script and config file content with the new above code.
In the config file set VAR_DEBUG="yes" and reboot your phone. Now enter a terminal and type "cat /var/mounts2sd.log | grep mounts2sd" which will show you all the messages from the script, and possible errors, if any.
I am not sure what is going on in boot. I just saw your replies and haven't had a chance to update the script and mess with the phone. I do know that when I was playing with it before it kept using the busybox minimal that was in the kernel loaded in sbin I tried copying your version of busybox into bin and xbin (and now reverted back) but it would still use the one in sbin. What I would really like to do and would recommend is you design the script where you can put busybox in a certain location and the script will use that version over any other versions. I am still learning with all this and despite being able to create the files throw them in the correct places I don't know the code well enough to do this myself. Thanks again for all your help.
Ok i have changed the script so that it now forces the usage of /system/xbin/busybox or /system/bin/busybox and ignores /sbin/busybox
Place a full busybox version in one of the system bin folders, update the script and see what happends.
Otherwise paste a copy of "df -h" and "cat /data/mounts2sd.log | grep mounts2sd" here so that I can see what it does during boot.
Thanks for this. Just flashed the ICS beta 0.1 with your a2sd embedded. Just a suggestion, I added $CMD_CHMOD 777 $CMD_BUSYBOX at line 260, just after the affectation of CMD_BUSYBOX.
For now, it seems to work very well !
virus2013 said:
Thanks for this. Just flashed the ICS beta 0.1 with your a2sd embedded. Just a suggestion, I added $CMD_CHMOD 777 $CMD_BUSYBOX at line 260, just after the affectation of CMD_BUSYBOX.
For now, it seems to work very well !
Click to expand...
Click to collapse
That I don't get? $CMD_CHMOD is undefined at line 260 and why use busybox to change permissions on itself?
dk_zero-cool said:
That I don't get? $CMD_CHMOD is undefined at line 260 and why use busybox to change permissions on itself?
Click to expand...
Click to collapse
Sorry, I'm tired... :-\
In fact, I just wanna be sure that the busybox in /system/bin was executable as I pushed it into the rom zip. And as chmod was already used upper, I was thinking it could be a good idea. However, I'm not a script writer! ;-)
Sent from my Desire running ICS
Hello Cool,
trying ICS with your script. Here is the output of logcat an df -h command:
Code:
# cat /data/mounts2sd.log | grep mounts2sd
cat /data/mounts2sd.log | grep mounts2sd
12-14 13:05:12.905 V/mounts2sd( 96): Initiating Mounts2SD (v:1.1.1)...
12-14 13:05:12.985 V/mounts2sd( 101): Including configuration file...
12-14 13:05:14.897 V/mounts2sd( 212): Searching for sdcard...
12-14 13:05:15.277 V/mounts2sd( 231): Searching for sd-ext partition (/dev/block/mmcblk0p2)...
12-14 13:05:16.198 V/mounts2sd( 254): sd-ext partition was mounted successfully...
12-14 13:05:16.728 V/mounts2sd( 278): Moving /data/app to /sd-ext/app...
12-14 13:05:17.049 V/mounts2sd( 297): Moving /data/app-private to /sd-ext/app-private...
12-14 13:05:17.209 V/mounts2sd( 305): Searching for the sd-cache partition (/dev/block/mmcblk0p3)...
12-14 13:05:18.050 V/mounts2sd( 326): sd-cache was mounted successfully...
12-14 13:05:18.280 V/mounts2sd( 335): A device is already mounted at /cache. Umounting it...
12-14 13:05:18.420 V/mounts2sd( 341): Moving /cache to /sd-cache...
12-14 13:05:18.440 V/mounts2sd( 342): Done!
df -h
Filesystem Size Used Available Use% Mounted on
tmpfs 202.9M 32.0K 202.9M 0% /dev
tmpfs 202.9M 0 202.9M 0% /mnt/asec
tmpfs 202.9M 0 202.9M 0% /mnt/obb
/dev/block/mtdblock3 250.0M 165.0M 85.0M 66% /system
/dev/block/mtdblock5 147.6M 62.4M 85.2M 42% /data
/dev/block/mmcblk0p2 960.7M 1.2M 959.4M 0% /sd-ext
/dev/block/mmcblk0p2 960.7M 1.2M 959.4M 0% /data/app
/dev/block/mmcblk0p2 960.7M 1.2M 959.4M 0% /data/app-private
/dev/block/mmcblk0p3 295.9M 168.0K 295.8M 0% /sd-cache
/dev/block/mmcblk0p3 295.9M 168.0K 295.8M 0% /cache
/dev/block/vold/179:1
6.2G 4.6G 1.6G 75% /mnt/sdcard
/dev/block/vold/179:1
6.2G 4.6G 1.6G 75% /mnt/secure/asec
This looks good, can you please confirm?
Also, why is /data not on ext partition but on phone memory?
Thanks for the script though!
Cheers, keep up the good work.
jukyO said:
This looks good, can you please confirm?
Also, why is /data not on ext partition but on phone memory?
Thanks for the script though!
Cheers, keep up the good work.
Click to expand...
Click to collapse
That looks as it should.
The whole /data is not moved to the /sd-ext for that simple reason that there are no hboot out there with 0mb /data.
I have options in my script to move both the .apk files (The applications) and the dalvik-cache which are the biggest things in the /data partition. If I moved everything to sd-ext, there would be nothing using the remaining space available on the internal data which is a waste of good space. It's like having an extra room in your house that is not used for anything at all. If we have to have it, we might as well use it
BTW:
You don't have dalvik-cache aktivated. So if you ever need more space on /data, activate it in /system/etc/mounts2sd.conf
dk_zero-cool said:
BTW:
You don't have dalvik-cache aktivated. So if you ever need more space on /data, activate it in /system/etc/mounts2sd.conf
Click to expand...
Click to collapse
Could you provide an example mounts2sd.conf file, so that all settings could be established at first boot. This would make it much easier when updating ROMS.
uzi2 said:
Could you provide an example mounts2sd.conf file, so that all settings could be established at first boot. This would make it much easier when updating ROMS.
Click to expand...
Click to collapse
You don't need a .conf file now - it's not used. You simply install the zip and then use the m2sd commands in terminal to make changes (see instructions in OP - type m2sd help for more info)
uzi2 said:
Could you provide an example mounts2sd.conf file, so that all settings could be established at first boot. This would make it much easier when updating ROMS.
Click to expand...
Click to collapse
The config files is deprecated and replaced with the "m2sd" command, as said above. Settings is saved to /data/.m2sd which means that it keeps your settings when you flash new ROM's as long as you don't wipe data.

[KERNEL/MOD] [LINUX] [Rootbind] [Native EMMC/all TF101&TF101G/fast/tested] [2-Jul-13]

[KERNEL/MOD] [LINUX] [Rootbind] [Native EMMC/all TF101&TF101G/fast/tested] [2-Jul-13]
UPDATE 2013/11/08: New kernel released with USB and framebuffer fixed. See post #3.
UPDATE 2014/05/16: New Ubuntu 14.04 filesystem. See point #2 below under Installation.
UPDATE 2014/06/03: New kernel released with USB and framebuffer fixed, OC to 1.5 GHz. See post #3 and #326.
UPDATE 2014/07/09: New kernel released with OC to 1.5 GHz fully working, boots every time. See post #3 and #334.
This is a kernel/initrd mod that allows you to run Linux (Ubuntu, Debian, Arch,...) on your TF101 from the internal EMMC (/data partition in Android) without repartitioning your tab.
Disclaimer:
This works on my tablet and I use it daily. However, I am not responsible for any bricks or if you damage your beloved TF. YOU ARE DOING THIS AT YOUR OWN RISK!
Features and advantages:
Fast (and I mean about as fast as it's gonna get on this device). See post #2 for benchmarks.
No need to repartition to get this. Previously TF101 users could run Linux on EMMC but they had to repartition with wheelie/nvflash, but it wasn't available to TF101G users (of which I'm one).
Any free space on your /data partition is available to both Linux and Android. When you delete stuff on either operating system, the free space is available for both again, as they are running off the same partition. Previously, when you re-partitioned e.g. with OLiFE you had to allocate a certain space (8GB by default) for Linux, then this was not available for Android even if you're not using all of it in Linux.
Way faster than loopmount, especially for disk writes.
Way faster than running Linux off a MicroSD card ext4 partition (even with class 10).
Dualboot is achieved just by flashing either the Android or the Linux kernel.
So how does this work?
The kernel/initrd is modded to take an extra parameter "bind=/path/to/linux/rootfs" on the command line. This will then bind-mound that path to the Linux root mount. It works pretty similar to the way a loop-mounted linux image is loaded and set up during boot, except that now bind-mount is used, not a loop-mount. This is possible because both Android and Linux use the ext4 filesystem, so they can actually share the same partition.
N.B. This thread is not a guide on how to get Ubuntu running on your TF101. There are plenty of guides for that, e.g.
http://forum.xda-developers.com/wiki/ASUS_Eee_Pad_Transformer/How_to_install_Ubuntu
http://forum.xda-developers.com/wiki/ASUS_Eee_Pad_Transformer/How_to_install_Ubuntu/Ubuntu_Install
Tubuntu by x3maniac - http://forum.xda-developers.com/showthread.php?t=1995157
Net-Install by NoDiskNoFun - http://forum.xda-developers.com/showthread.php?t=1852702
Transformazing by transformador - http://forum.xda-developers.com/showthread.php?t=2167224
Make sure to read those threads to get an idea of how this works.
READ THESE INSTRUCTIONS CAREFULLY!
Installation:
Take a Nandroid backup, just in case something goes wrong.
Get a Linux root filesystem if you don't already have one.
See this thread for a discussion of various filesystems available for rootbind.
Alternatively roll your own using debootstrap as described by shaola:
http://forum.xda-developers.com/showthread.php?t=1476835
NEW! For a fully working Kubuntu 14.04 image (with graphics acceleration using the Nvidia drivers) see this post: http://forum.xda-developers.com/showpost.php?p=52697775&postcount=303
This is already an image in a tar file so it doesn't need to be mounted, so instead of the code below you can merely do the following:
Code:
mkdir -p /data/linuxroot
busybox chmod 755 /data/linuxroot
cd /data/linuxroot
tar -xpjf /path/to/my/saved/kubuntu-14.04.tar.bz2
Running Android, copy the root filesystem to a directory on your /data partition, preserving the permissions. The easiest is with the "tar" command (see below). The default install assumes that Linux lives in /data/linuxroot under Android.
For a Linux image in a file that is used for loop-mount (assume it is in /sdcard/ubuntu.img, or edit accordingly), run the following in a terminal when running Android (make sure you are root):
Code:
busybox mount -o remount,rw /
mkdir -p /data/linuxroot
busybox chmod 755 /data/linuxroot
mkdir -p /mnt/ubuntu
busybox mount -o loop /sdcard/ubuntu.img /mnt/ubuntu
cd /mnt/ubuntu
tar -cvp * | tar -C /data/linuxroot -xp
cd /
busybox umount /mnt/ubuntu
rmdir /mnt/ubuntu
busybox mount -o remount,ro /
(note in tar command first -c is lowercase, second -C is uppercase)
For a Linux rootfs that lives on a separate partition (e.g. 2nd part. on MicroSD), run the following (assumes linux is in /dev/block/mmcblk1p2, otherwise edit accordingly):
Code:
busybox mount -o remount,rw /
mkdir -p /data/linuxroot
busybox chmod 755 /data/linuxroot
mkdir -p /mnt/ubuntu
busybox mount -t ext4 /dev/block/mmcblk1p2 /mnt/ubuntu
cd /mnt/ubuntu
tar -cvp * | tar -C /data/linuxroot -xp
cd /
busybox umount /mnt/ubuntu
rmdir /mnt/ubuntu
busybox mount -o remount,ro /
Copy kernel modules to your rootfs. Download modules-3.1.10-9.tar.gz to your /sdcard. then:
Code:
cd /data/linuxroot/lib/modules
tar -xzf /sdcard/modules-3.1.10-9.tar.gz
Flash the Linux kernel. Either flash the zip from recovery or copy the kernelblob directly to the staging partition with dd (if you don't know what I'm talking about here, then use the recovery method).
Reboot 'n enjoy! Remember to run "sudo depmod -a" after the first Linux boot, and reboot. Otherwise your modules won't load and wifi, etc., won't work.
To re-boot into Android, simply flash the boot image/kernelblob from your Android ROM.
Notes:
The kernel is compiled from Jhinta's source with a few modifications to the config - http://forum.xda-developers.com/showthread.php?t=1683145
Make sure not to have a /host directory in your Linux rootfs - this interferes with the bind mount!
The Linux rootfs can live anywhere on your Android /data partition (the default is /data/linuxroot). If you want to change this, then you'll have to blobunpack the kernelblob-rootbind, unpack the boot image (kernelblob-rootbind.LNX) with abootimg, change the command line as desired, re-pack the boot image with abootimg, and re-pack the blob for flashing.
The "bind" cmdline argument is the location of your Linux rootfs without the initial "/data". So if your Linux rootfs lives on /data/my/linux/path under Android, then you'd have to change the cmdline parameter to "bind=/my/linux/path".
Make sure, however, not to put the Linux rootfs to the "internal storage" (/data/media) or any subdirectories thereof. This plays havoc with the Android media scanner when re-booting into Android and your tablet may slow down to a crawl.
Under Android your EMMC partitions are /dev/block/mmcblk0p1,2,3,....
Under Linux, this is /dev/mmcblk0p1,2,3....
Thanks to:
lilstevie - for bringing Ubuntu to our tablet
Jhinta - for his 3.1.10 kernel
shaola - for his debootstrap guide
x3maniac - for his Tubuntu installer
transformador - for his mountloop instructions
TomTcom - for all his Ubuntu-related guides on xda
Kingzak34 - for his dualboot guide and general help/discussion
DjDill - for putting together the collection of rootbind filesystem images
(if your name should be here and I have forgotten you, please PM me...)
Benchmarks
Using "fio" (available from Ubuntu repos). All speeds in kB/s.
In the below, loopmount refers to a loopmounted image on internal storage, MicroSD refers to running linux from an ext4 partition off a class-10 MicroSD card, and rootbind refers to the method described in this thread.
Test: sequential read (64 MB)
rootbind 31906
loopmount 29088
MicroSD 15312
Test: random read (64 MB)
rootbind 5605
loopmount 11340
MicroSD 1620
Test: sequential write (8 MB)
rootbind 9694
loopmount 1373
MicroSD 3040
Test: random write (8 MB)
rootbind 4659
loopmount 1102
MicroSD 722
New kernel
New kernel for Linux rootbind:
based on kernel source from @Sni
See here: http://forum.xda-developers.com/showpost.php?p=43203818&postcount=569
N.B. If you use this kernel you will have to copy new firmware for the wifi driver into /lib/firmware. Get it from Sni's post (link above).
USB hotplug fixed and fully working!
framebuffer fixed (Ctrl-Alt-F1 to F6 for console access)
hardware graphics acceleration now fully working with the latest Nvidia Linux-4-tegra drivers. es2gears no longer throws errors.
Two versions: one clocked to standard 1.0 GHz, the other one overclocked to 1.2GHz. Remember to extract the relevant modules to your linux root filesystem. For installation, I have provided a CWM or TWRP flashable zip, or a blob that you can flash directly with dd to the staging partition (if you don't know how to do this, use the recovery method).
I have tried at great length to overclock to higher frequencies but could not succeed. For some reason the TF just froze with a black screen after booting. I tried many combinations of voltages and frequencies. At least it's oc'ed to 1.2 and stable (in my hands), but if you are experiencing problems you can revert to the 1.0GHz or keep using the previous kernel which is oc'ed to 1.6 but USB is broken.
If anyone wants to take a stab at this you are more than welcome
My sources: https://github.com/jmrohwer/TF101-GNU-kernel
EDIT: New kernel 3.1.10-15 overclocked to 1.5GHz. Boots every time! Needs configuration of your overlock speeds with cpufrequtils. Read this post:
http://forum.xda-developers.com/showpost.php?p=54031885&postcount=334
MD5SUM:
3aee8cacf9037dfc3c8ef0363780254f Ubuntu-3.1.10-15-rootbind-oc1.5.zip
Seems to be great, and very very easy to dual boot, as TWTR will be always avaible to flash the kernels.
The reason I left linux behind on my TF is that team EOS has a plenty of updates and I like to keep up with the devs and the dual boot method i used overwrites the custom recovery.
Now it seems to be perfect forme.
Simply amazing, an other victory for TF101 ! And in addition of more speed than mountloop it's even easier to manage.
Thanks once again, I think my mounltoop will became a full install
Forgive my ignorance, but I've googled and searched the TF101 forums to no avail; what is TWTR? With Google I only found a video of someone running what looked like regular CWM touch on a TF101...
Edit: Nevermind, I figured out that it must be referring to the TeamWin recovery, which until now I've only ever seen referred to as "TWRP".
Thanks! I will test this tomorrow.
smokesignals said:
Forgive my ignorance, but I've googled and searched the TF101 forums to no avail; what is TWTR? With Google I only found a video of someone running what looked like regular CWM touch on a TF101...
Edit: Nevermind, I figured out that it must be referring to the TeamWin recovery, which until now I've only ever seen referred to as "TWRP".
Click to expand...
Click to collapse
It is TWRP, but I guess TWTR = Team Win Touch Recovery
---------- Post added at 11:52 PM ---------- Previous post was at 11:23 PM ----------
I am root, but this command says read only file system
mkdir -p /mnt/ubuntu
Made the folder using a file manager instead
Next step
mount -o loop /sdcard/ubuntu.img /mnt/ubuntu
Fails and just gives me a list of possible options for the mount command
*Detection* said:
It is TWRP, but I guess TWTR = Team Win Touch Recovery
---------- Post added at 11:52 PM ---------- Previous post was at 11:23 PM ----------
I am root, but this command says read only file system
mkdir -p /mnt/ubuntu
Made the folder using a file manager instead
Next step
mount -o loop /sdcard/ubuntu.img /mnt/ubuntu
Fails and just gives me a list of possible options for the mount command
Click to expand...
Click to collapse
I had that problem too. Not sure how to fix it on the tablet, I just copied the image I wanted to use (in this case the Arch Linux ARM one -- about which more later) to my Linux box, loop mounted it, tar'd up the files there, copied that to an SD card, and extracted it on the tablet.
However, about Arch Linux ARM, I learned not to bother using the image from the Tubuntu thread and instead just get the latest version from the ALARM downloads page. Use the "NVIDIA Tegra2 TrimSlice" one. The default root password is "root".
The reason not to use the one from the Tubuntu thread is that it is out of date -- Arch has merged /bin and /sbin into /usr, but the image in the Tubuntu thread predates that, and it's a huge pain to upgrade it properly.
smokesignals said:
I had that problem too. Not sure how to fix it on the tablet, I just copied the image I wanted to use (in this case the Arch Linux ARM one -- about which more later) to my Linux box, loop mounted it, tar'd up the files there, copied that to an SD card, and extracted it on the tablet.
However, about Arch Linux ARM, I learned not to bother using the image from the Tubuntu thread and instead just get the latest version from the ALARM downloads page. Use the "NVIDIA Tegra2 TrimSlice" one. The default root password is "root".
The reason not to use the one from the Tubuntu thread is that it is out of date -- Arch has merged /bin and /sbin into /usr, but the image in the Tubuntu thread predates that, and it's a huge pain to upgrade it properly.
Click to expand...
Click to collapse
Thanks for that, at least I know I'm not doing something wrong my end, I was trying the Ubuntu 12.04 netinstall from the Transformazing thread, I`ll no doubt try a few until I find one I like
I don't have a Linux box atm, but a quick fix with a wubi or VM install tomorrow and I`ll give your method a shot
Cheers
Hey jrohwer can you have a look at this ? It may interest you
http://forum.xda-developers.com/showpost.php?p=43203818&postcount=569
A silly question.... But do i need pre installed mountloop?
I am kinda confused though lol.
Kingzak34 said:
Hey jrohwer can you have a look at this ? It may interest you
http://forum.xda-developers.com/showpost.php?p=43203818&postcount=569
Click to expand...
Click to collapse
Looks interesting, I can see whether I can compile his sources, but it will have to wait a while (don't have a lot of time atm).
*Detection* said:
It is TWRP, but I guess TWTR = Team Win Touch Recovery
---------- Post added at 11:52 PM ---------- Previous post was at 11:23 PM ----------
I am root, but this command says read only file system
mkdir -p /mnt/ubuntu
Click to expand...
Click to collapse
Yes, sorry for got to add the step to remount / in rw mode. OP is updated.
Made the folder using a file manager instead
Next step
mount -o loop /sdcard/ubuntu.img /mnt/ubuntu
Fails and just gives me a list of possible options for the mount command
Click to expand...
Click to collapse
Most probably you are using the Android mount command. The busybox mount command has more functionality. I added the OP to explicitly call the busybox mount/umount commands (I have mine aliased by default). Indeed I checked and the Android mount command does not work for loop mount.
vietchinh said:
A silly question.... But do i need pre installed mountloop?
I am kinda confused though lol.
Click to expand...
Click to collapse
No you just need a mountloop image which you can then mount as described in the OP, to copy the files over to /data/linuxroot.
jrohwer said:
Yes, sorry for got to add the step to remount / in rw mode. OP is updated.
Most probably you are using the Android mount command. The busybox mount command has more functionality. I added the OP to explicitly call the busybox mount/umount commands (I have mine aliased by default). Indeed I checked and the Android mount command does not work for loop mount.
Click to expand...
Click to collapse
Thanks, I`ll give this another shot tonight then with the new instructions
jrohwer said:
Looks interesting, I can see whether I can compile his sources, but it will have to wait a while (don't have a lot of time atm).
Click to expand...
Click to collapse
Yup of course take your time I think something good is coming
Tapatalké depuis mon Nexus 4 MIUI !
jrohwer said:
No you just need a mountloop image which you can then mount as described in the OP, to copy the files over to /data/linuxroot.
Click to expand...
Click to collapse
Thanks, but i have new problem. Uh i cant execute this line: tar -xzf /sdcard/modules-3.1.10-9.tar.gz. It give's me this:Tar invalid option bla bla bla ;3 SO CLOSE TO COMPLETING T.T.
vietchinh said:
Thanks, but i have new problem. Uh i cant execute this line: tar -xzf /sdcard/modules-3.1.10-9.tar.gz. It give's me this:Tar invalid option bla bla bla ;3
Click to expand...
Click to collapse
Leave the - off. so it would be
Code:
tar xvf /sdcard/modules-3.1.10-9.tar.gz
Usually works for me.
bfmetcalf said:
Leave the - off. so it would be
Code:
tar xvf /sdcard/modules-3.1.10-9.tar.gz
Usually works for me.
Click to expand...
Click to collapse
In valid tar magic ._.
i assume i need extract manually heh

Categories

Resources