During my time hacking on android I've discovered some nice easter eggs deep in the android platform. One such easter egg is the mounting of ext4 images directly in the init.rc script. This is a feature I have never seen used by any oems and only by one custom rom [ EDIT: and by letama in his Sony Xperia Boot Manager ]! looking at the git logs this functionality has been present since September 2010 [ commit 49b8124a1759cb8b27e0c21a1a5a54b8a81bdb19 ]. What this effectively gives us is the ability to overlay a pseudo partition layout over the top over the existing layout, thus avoiding any "Danger" of accidental bricking the device by reformatting the SDCard. This is very similar to the way archos mount the stock file system and a variation/extension on the existing methods we use for the SDE Roms.
Although the explanation assumes the use of the SD models it should be fairly straightforward to apply the the HDD models.
THE METHOD:
PART 1 - Prepare a recovery ext4 image file
1. Build CWM6 from the CM10 source.
2. Modify The Recovery's init.rc file to look something similar to this
Code:
on early-init
start ueventd
on init
export PATH /sbin
export ANDROID_ROOT /system
export ANDROID_DATA /data
export EXTERNAL_STORAGE /sdcard
symlink /system/etc /etc
mkdir /boot
mkdir /sdcard
mkdir /system
mkdir /data
mkdir /cache
mount /tmp /tmp tmpfs
mkdir /partitions 0771 system system
mount ext4 /dev/block/mmcblk0p4 /partitions
# Mount /system rw first to give the filesystem a chance to save a checkpoint
mount ext4 [email protected]/partitions/CAC /cache nosuid nodev
mount ext4 [email protected]/partitions/DATA /data nosuid nodev
mount ext4 [email protected]/partitions/SYS /system
mount ext4 [email protected]/partitions/SDCARD /sdcard nosuid nodev
mount ext4 [email protected]/partitions/BOOT /boot
on boot
ifup lo
hostname localhost
domainname localdomain
class_start default
service ueventd /sbin/ueventd
critical
service recovery /sbin/recovery
service adbd /sbin/adbd recovery
disabled
# Always start adbd on userdebug and eng builds
# In recovery, always run adbd as root.
on property:ro.debuggable=1
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/idVendor 18D1
write /sys/class/android_usb/android0/idProduct D001
write /sys/class/android_usb/android0/functions adb
#write /sys/class/android_usb/android0/enable 1
write /sys/class/android_usb/android0/iManufacturer $ro.product.manufacturer
write /sys/class/android_usb/android0/iProduct $ro.product.model
write /sys/class/android_usb/android0/iSerial A101S_REC
#start adbd
setprop service.adb.root 1
# Restart adbd so it can run as root
on property:service.adb.root=1
write /sys/class/android_usb/android0/enable 0
restart adbd
write /sys/class/android_usb/android0/enable 1
3. Modify the etc/recovery.fstab to look like this
Code:
# mount point fstype device
/cache ext4 /dev/block/loop1
/data ext4 /dev/block/loop2
/system ext4 /dev/block/loop3
/sdcard ext4 /dev/block/loop4
4. Creating an empty ext4 image file name REC and mount it on your pc. [ 5MB should do it ]
5. Copy the contents of the built recovery/root directory to the root of your mounted image.
6. chmod init.rc , default.prop and ueventd.rc to 644 ( rw-r-r- )
7. umount the ext4 image and push it to the root of you data partition
That's stage 1 complete. Part 2 Will Follow Shortly.....
Part 2 - Make a dual boot initramfs.cpio.lzo
1. Change the name of the /data directory to /bootdata by modifying the etc/mountpoints file in the initramfs.cpio.lzo. This stops CWM getting confused when trying to un/mount the data partition
Code:
mount_name mount_dev mount_point mount_fs mount_opts volume_name error_code custom_opt
rawfs /dev/mmcblk0p1 /mnt/rawfs rawfs none 150
system /dev/mmcblk0p2 /mnt/system ext4 rw,noatime,noexec system 152
bootdata /dev/mmcblk0p4 /bootdata ext4 rw,noatime,noexec bootdata 154 crypt_compat
storage /dev/mmcblk1p1 /mnt/storage ext4 rw,noatime #storage_name# 155
storage_A80S /bootdata/media /mnt/storage bind bootdata none 155
storage_A101S /bootdata/media /mnt/storage bind bootdata none 155
storage_A101XS /bootdata/media /mnt/storage bind bootdata none 155
storage_LUDO /bootdata/media /mnt/storage bind bootdata none 155
storage_A80H /dev/hdd1 /mnt/storage ext4 rw,noatime #storage_name# 155
storage_A101H /dev/hdd1 /mnt/storage ext4 rw,noatime #storage_name# 155
usbhost_ehci /dev/storage_ehci1 /mnt/usbhost_ehci vfat rw,noatime,utf8,shortname=mixed none 156
usbhost_otg /dev/storage_otg1 /mnt/usbhost_otg vfat rw,noatime,utf8,shortname=mixed none 156
rfsext4 /dev/loop0 /new-root ext4 rw,noatime none 157
rfsext3 /dev/loop0 /new-root ext3 rw,noatime none 157
rootfs /dev/loop0 /new-root squashfs ro,cts_compat none 157
ramdisk /tmp/ramdisk /ramdisk vfat loop,rw,utf8,shortname=mixed #ramdisk_name# 158 ramdisk,ramdisk_size=256
2. Using sirduke989 dmenu initramfs you can modify the init script in the initramfs to mount /bootdata instead of /data and also add /bootdata/REC and /bootdata/BOOT to the list
of known locations , I see this a temporary measure as there are a number of other ways to enable dual ( Triple?!? ) booting
3. Flash the modified initramfs and your choice of kernel using either the recovery menu or kd_flasher, I used the 3.0.21 kernel extracted from the 4.0.24 aos file.
You should now be able to boot into CWM Recovery!
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Clearly I'm a developer not a photographer!!
Part 3 - Create rest of the "partition" images.
You should have a /partitions directory in you device root, This is what is normally mounted as your /data ( /dev/block/mmcblk0p4) and contains normal android user data e.g installed app settings databases etc. This is where I've created the reset of my Partitions which are just more ext4 images files. I did this using "dd if=/dev/zero ...." and "mke2fs -text4 ...." on the device through adb whilst booted into CWM. This saved time in pushing large empty ext4 files from my pc.
I called my image CAC ( cache ) DATA ( data ) SYS ( system ) SDCARD ( sdcard ) BOOT ( boot ) you can obviously call them what you like and place them anywhere as long as you match up the image names with those in init.rc and make sure the loop numbers are correct in the etc/recovery.fstab everything should be fine.
You can play around with the files sizes, I have an 8gb my current file sizes at the moment are
BOOT = 25MB
CAC = 500MB
DATA = 3GB
SYS = 500MB
SDCARD = 2GB
The sdcard mount point is probably worth pointing at an external sd if you have one available. I have a 32GB Class 10 that I'll probably set up.
After you've setup your psuedo partitions you should then be able to reboot into recovery, if you've done things correctly you mount output should contain the following
Code:
/dev/block/mmcblk0p4 on /partitions type ext4 (rw,relatime,user_xattr,barrier=1,data=ordered)
/dev/block/loop1 on /cache type ext4 (rw,nosuid,nodev,relatime,user_xattr,barrier=1,data=ordered)
/dev/block/loop2 on /data type ext4 (rw,nosuid,nodev,relatime,user_xattr,barrier=1,data=ordered)
/dev/block/loop3 on /system type ext4 (rw,relatime,user_xattr,barrier=1,data=ordered)
/dev/block/loop4 on /sdcard type ext4 (rw,nosuid,nodev,relatime,user_xattr,barrier=1,data=ordered)
/dev/block/loop5 on /boot type ext4 (rw,relatime,user_xattr,barrier=1,data=ordered)
Everything seems to function correctly, I have successful done a backup and restore of my system partition. I have also applied CWM-SuperSU.zip through install zip from sdcard. Mounting and Remounting works although I'm not sure if Mount USB Storage works yet, I didn't on linux and I've not tested on windows and finally wiping and formating was also successful.
Part 4 - Notes on setting up rom images.
Now you may of already realized normal archos images don't come as separate the /boot and /system images so work is require to split them up.
Also if you want to split the /system from the reset of a archos image your boot partition will need to be about 50MB as archos have they /bin /lib /usr directories which contains binary files that use /lib/libuClibc-*.so as it's libc which brings there root filesystem in at around 38MB.
There is a very strong case for ditching these binaries especially when using AOSP/CM based roms. My intial tests show this is possible.
Just like the recovery init.rc Similar changes have to be made to the roms init.rc
Moving Forward:
of course, there's a lot to do but I wanted to at least get this initial information out there for people to consider. I'm currently booting a Linaro 4.1.1 rom using the split partitions. I have also been working on better booting methods which is why I haven't given any details re the initramfs init script but It's fairly straight forward to adjust and adapt. I'll write up more details soon!
More Research!
As I mentioned, I've been further looking into different booting methods and I think I'm approaching what could be a workable solution that will make the Gen9 more like standard android devices
Here's some more of my findings
1. It turns out that we can dump the existing initramfs.cpio.lzo and we can use a standard android ramdisk layout as the android init will load instead of the init script that is currently being used, this also removes the need for switch root and other nonsense that archos have in there. There was one gotcha when had me stumped for about ten minutes, I needed to add "write /sys/class/leds/lcd-backlight/brightness 75" to the init.rc to turn the screen on.
2. It's possible to stop android either using adb shell stop or stopping each service zygote etc, and start CWM while android is booted. It's probably also feasible the manage booting between recovery and android using the persist properties system which should make switching between the 2 fairly easy to control without much tweaking to any binaries. Looking at other devices, namely samsung, they seem to do something similar with recovery being in the same boot.img as the standard files, they simply load a recovery.rc instead of the main init.rc, this might mean that we have to patch CWM to load the correct init.rc I've not looked at the code properly yet but It's not going to be an issue anyway as all the code is fully available, You've gotta love open source.
3. By mounting /dev/block/mmcblk0p1 to /mnt/rawfs we are still able to use abcbox, reboot_into writes to the params file in the partition to control boot switching, so we can maintain booting into sde while leaving the stock android partition in place. I was unable to get any immediate joy from kd_flasher, that maybe because we currently have the ramdisk we want to overwrite mounted as the rootfs. Again I can't imagine it being too difficult to jig this, It can probably be worked out by looking at the current recovery ramdisk scripts should kd_flasher style functionality be required at any point.
4. Most of the binaries that rely on uClibc can be recompiled against bionic without any issue, usb_modeswitch for example. If there are any closed source ones, then the dynamic linker ld-uclibc or whatever is called, ultimately symlinks back to uClibc and we can just grab the one file and place it in the /lib directory. I tested /usr/bin/lsdvd in this way and It seemed to work fine.
I've got all this going on while still leaving a stock android fully intact, which is a great fallback Just in case.... Keeping these modifications at a safe level is one of the primary goals to enable much wider use
I'll put together some examples within the next couple of days to demostrate what I'm talking about here.
I've got a Linaro 4.1.1 ( JRO03R ) which has working powervr drivers with a 3.0.21 kernel, although that's about all that's working on it at the minute.
It's more a proof of concept than anything else, The kernel would need recompiling to add tracefs functionality which is required by jellybean but using the same magic should leave the powervr drivers functioning still, If anyone's interested I can stick that up, I've foolishly deleted ( misplaced/can't remember ) the device files I used to build this.... Too many android source trees and not using git properly leads to school boy errors.
I'm currently working on an omapzoom 4.1.2 tree using the blaze_tablet device as a base, I think this may yield the best results for the archos.
I suppose one other thing to do is the fix up a stock rom to use these methods and give it CWM, that should be pretty simple to do. Although ICS is ooold and I'm really not a fan of some of archos' methods e.g booting 4 different devices off one firmware. Although to their credit they do demostrate just what possible with deviating android from it's normal standard structures.
Hopefully this has whetted your appetites, I'm pretty excited about what's possible here as I feel it brings these archos devices in line with most others.
Me Again!
Just a cheeky little update, I been trying the figure out the best approach to handle switching between android and recovery mode. In effect I kind of wanted to create a Stage 4 bootloader! because you can never have too many bootloaders LOL I certainly wanted to do a "proper" job on it and try to avoid changes to the android platform code.
While to doing research into this I found this patch to the linux kernel which the android team submitted for review, Reading the mailing list thread I don't think it's been accepted yet! It's true what they say about the Kernel Mailing List, You need to bring your A game and be sure of what your doing..
Anyways the patch add a boot-control-block driver to kernel which check for a boot flag, which is exactly what I need to make booting into alternative configuration nice and simple. I suppose it wouldn't be too difficult to chuck in support for the fastboot protocol on one of those configurations. So a CWM Shouldn't be too far off now!!!
As a little treat I've attached a recovery based ram disk if anyone what's to play, just flash it with you favourite kernel on to your sde partition. Then You can boot into recovery and set your self up a pseudo partition image layout through adb. You won't be able to be into android, obviously until you put your old initramfs back.......
This is totally unsupported.
Click to expand...
Click to collapse
I'm just chucking up for those who want to get a feel for to do so. If your uncomfortable playing around in this area then stand well back, It's not prime time yet!!!!
However Feel free to ask questions of a technical bent but If you can't get it to boot then tough luck I'm afraid for now! :laugh:
You shouldn't be able to do any damage with this be I wouldn't go selecting wipe/format etc until you've got some partition images sorted.
I've add abcbox to sbin and symlink reboot_into. It does not seem to fully reboot but It will set the boot flag which you then follow with a call to reboot, That will reboot back into CWM (sde).
Onward
EDIT: Here's the Init.rc and etc/recovery.fstab that It attempts to use.
Code:
on early-init
start ueventd
on init
export PATH /sbin
export ANDROID_ROOT /system
export ANDROID_DATA /data
export EXTERNAL_STORAGE /sdcard
symlink /system/etc /etc
mkdir /boot
mkdir /sdcard
mkdir /system
mkdir /data
mkdir /cache
mkdir /mnt
mkdir /mnt/rawfs
mount /tmp /tmp tmpfs
mkdir /partitions 0771 system system
mount ext4 /dev/block/mmcblk0p4 /partitions
mount rawfs /dev/block/mmcblk0p1 /mnt/rawfs
# Mount /system rw first to give the filesystem a chance to save a checkpoint
mount ext4 [email protected]/partitions/CAC /cache nosuid nodev
mount ext4 [email protected]/partitions/DATA /data nosuid nodev
mount ext4 [email protected]/partitions/SYS /system
mount ext4 [email protected]/partitions/SDCARD /sdcard nosuid nodev
mount ext4 [email protected]/partitions/BOOT /boot
on boot
ifup lo
hostname localhost
domainname localdomain
class_start default
service ueventd /sbin/ueventd
critical
service recovery /sbin/recovery
service adbd /sbin/adbd recovery
disabled
# Always start adbd on userdebug and eng builds
# In recovery, always run adbd as root.
on property:ro.debuggable=1
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/idVendor 18D1
write /sys/class/android_usb/android0/idProduct D001
write /sys/class/android_usb/android0/functions adb
#write /sys/class/android_usb/android0/enable 1
write /sys/class/android_usb/android0/iManufacturer $ro.product.manufacturer
write /sys/class/android_usb/android0/iProduct $ro.product.model
write /sys/class/android_usb/android0/iSerial A101S_REC
write /sys/class/leds/lcd-backlight/brightness 75
#start adbd
setprop service.adb.root 1
# Restart adbd so it can run as root
on property:service.adb.root=1
write /sys/class/android_usb/android0/enable 0
restart adbd
write /sys/class/android_usb/android0/enable 1
Recovery.fstab
Code:
# mount point fstype device
/cache ext4 /dev/block/loop0
/data ext4 /dev/block/loop1
/system ext4 /dev/block/loop2
/sdcard ext4 /dev/block/loop3
Any words about hdd versions?
DragosP2010 said:
Any words about hdd versions?
Click to expand...
Click to collapse
I all depends how you want the structure it, What it would change is the mount point of the paritions directory. After that. everything is loop mounted and sitting on top of the existing structure.
Code:
mount ext4 /dev/block/mmcblk0p4 /partitions
Great stuff!!!!
Hey trevd,
that's fantastic... i will definitely try this CWM in a few days with my custom kernel and bootloader (mountpoint will need some tweaks as well ).
I'm very busy these days, so i gess i'll leave some longer statements to the recent developments in a few days.
Just in short... it's very pleasant to see all these open developments popping up and i really, really appreciate this kind of hacking!
Keep on your great work... you rock!!
Cheers,
scholbert
Hi Trevd,
Nice job!
I've been using the same kind of trick on my Xperia S boot manager project, recovery on loops and mount [email protected] in inits. You may want to take a look at what I did there (see my sig), it may have some use for your project.
Basically, what I do is storing multiple kernels+cpios on the regular kernel partition. I use one (trimmed down to maximize space) to handle the boot logic and cwm, and I have enough space to handle two "regular" kernels. I handle kernel switch just before they load with a small assembly loader. It works very nicely on Xperia, and it's very nice to be able to dual boot with isolated cwms. I can't remember maximum size on a g9 kernel rawfs file, but I think you could have at least enough space to have two kernels to isolate recovery.
Hey letama,
nice to read you :highfive:
letama said:
I've been using the same kind of trick on my Xperia S boot manager project, recovery on loops and mount [email protected] in inits. You may want to take a look at what I did there (see my sig), it may have some use for your project.
Click to expand...
Click to collapse
Cool stuff again...
letama said:
Basically, what I do is storing multiple kernels+cpios on the regular kernel partition. I use one (trimmed down to maximize space) to handle the boot logic and cwm, and I have enough space to handle two "regular" kernels. I handle kernel switch just before they load with a small assembly loader. It works very nicely on Xperia, and it's very nice to be able to dual boot with isolated cwms. I can't remember maximum size on a g9 kernel rawfs file, but I think you could have at least enough space to have two kernels to isolate recovery.
Click to expand...
Click to collapse
AFAIK, we got around ~30MBytes in the raws partition on our tablets so would be possible to put some more kernel+cpios here easily.
Anyway, made some experiments with my latest u-boot port for the tablet this weekend.
I was able to bring up my A80S completely from MicroSD and boot into CWM by using uImage and uInitramfs (based on trevd's CWM image).
There's also some lowlevel multiboot implemented now by using the volume keys... but i know that i use a very special setup, so this is more a proof of concept and not a suitable environment for the average user
Cheers,
scholbert
Thanks Letama + Scholbert
I'll look at all this stuff this week....As a aside, I've played around with mmcblk0p3 and given myself an mmcblk0p5 / 6 of 4MB each. I found parted to be pretty useful (read:safe) for this..... I'm dubious about playing around with the rawfs too much at this point, mainly because I don't understand it fully, yet!.
Have you guy seen this https://github.com/swetland/omap4boot ( I think it's along the line of what Scholbert been working with/on )
Like I've mentioned to ultimate goal is a solution that is "safe" for the average user and also leaves the rest of the tablet in-tact, it maybe a lofty goal but worth a shot. :good:
Thanks for the input guys!
scholbert said:
AFAIK, we got around ~30MBytes in the raws partition on our tablets so would be possible to put some more kernel+cpios here easily.
Click to expand...
Click to collapse
30 for init kernel ? That's plenty indeed! Cool!
Anyway, made some experiments with my latest u-boot port for the tablet this weekend.
I was able to bring up my A80S completely from MicroSD and boot into CWM by using uImage and uInitramfs (based on trevd's CWM image).
There's also some lowlevel multiboot implemented now by using the volume keys... but i know that i use a very special setup, so this is more a proof of concept and not a suitable environment for the average user
Click to expand...
Click to collapse
Nice job! Too bad that Archos doesn't do this on their board with a small internal switch. Would be cool for people like me with big fingers and poor soldering skills
trevd said:
I'll look at all this stuff this week....As a aside, I've played around with mmcblk0p3 and given myself an mmcblk0p5 / 6 of 4MB each. I found parted to be pretty useful (read:safe) for this..... I'm dubious about playing around with the rawfs too much at this point, mainly because I don't understand it fully, yet!.
Click to expand...
Click to collapse
Hummm... You're going to end with a full re-partitioning scheme with system and data if you continue this way . Just be careful when you recreate partitions to let the empty space at the beginning of the disk untouched, instant brick ahead if you go there...
Just in case, here is what I did with my repartition script (do you have it ?): delete p3, delete p4, re-create p3 (careful with start point, leave the hole! it should start just after p2) as extended partition, big enough to hold the new partitions, recreate p4 (same thing about the hole, it should start after p3) with what remains and then you can create p5,p6,p7 with the size you want inside p3.
Last advice: rawfs, don't touch it .
Anyway, the good thing with what I did on Xperia S is that you don't mess with rawfs and re-partition, it's just like flashing a very big SDE kernel from recovery with unmodfified sde firmware, that's all. If I find some time, I'll take a look to see if we can do the same thing here.
letama said:
Just in case, here is what I did with my repartition script (do you have it ?): delete p3, delete p4, re-create p3 (careful with start point, leave the hole! it should start just after p2) as extended partition, big enough to hold the new partitions, recreate p4 (same thing about the hole, it should start after p3) with what remains and then you can create p5,p6,p7 with the size you want inside p3.
Click to expand...
Click to collapse
Hi
Yes I have read your previous threads on the subject which provided alot of the inspiration for the work currently at hand, It is also why I am being ultra careful around the partitions
I think maybe I'm just being too clever trying too pull everything back a step into the intramfs when we can just do the old switch root method method.... It's a little messy on the inside but it will get the job done!
Well, I don't like much the switch root too, it's not a very "Android way" of doing things and make some apps not very happy with it, but yes, it will get the job done, one root for recovery, one root for firmware. And Archos stock would be difficult without switch root, they did put far too much stuff outside of system.
letama said:
Well, I don't like much the switch root too, it's not a very "Android way" of doing things and make some apps not very happy with it, but yes, it will get the job done, one root for recovery, one root for firmware. And Archos stock would be difficult without switch root, they did put far too much stuff outside of system.
Click to expand...
Click to collapse
I'm very much for the "Android Way" I believe the archos stock roms can be re-jigged as the stuff outside of the system is not required by the system, this is all stuff that is a result of the BuildRoot build system and has a dependency on uClibc.
I'm going to try and get something usable this week, can I store additional files in the rawfs partition without running into trouble?
trevd said:
I'm very much for the "Android Way" I believe the archos stock roms can be re-jigged as the stuff outside of the system is not required by the system, this is all stuff that is a result of the BuildRoot build system and has a dependency on uClibc.
Click to expand...
Click to collapse
Well, it's required. It's used inside Android, it handles audio, wifi, codecs, smb...
I'm going to try and get something usable this week, can I store additional files in the rawfs partition without running into trouble?
Click to expand...
Click to collapse
In rawfs or initramfs ? I wouldn't add any file in rawfs, it would be difficult to do and I don't know how would behave the bootloader if it sees new files there. Initramfs you're free to do whatever you want until you reach maximum size of kernel+initramfs.
trevd said:
Have you guy seen this https://github.com/swetland/omap4boot ( I think it's along the line of what Scholbert been working with/on )
Click to expand...
Click to collapse
Well kind of... while i try to stick with the MicroSD our fellow vincencb follows the omap4boot path.
He already made a port of barebox bootloader to work with this tool and pushed it to the repos.
This way you may put anything you like on the tablet's RAM by using MicroUSB for communication and file transfer.
My way is more to get a full featured u-boot and put it into a state, where it might replace stock loader.
Last step is to put it in internal eMMC... so this is also research and development for now.
trevd said:
Like I've mentioned to ultimate goal is a solution that is "safe" for the average user and also leaves the rest of the tablet in-tact, it maybe a lofty goal but worth a shot. :good:
Click to expand...
Click to collapse
Yepp that sounds like a reasonable approach.
letama said:
30 for init kernel ? That's plenty indeed! Cool!
Click to expand...
Click to collapse
To be even more precisely, there are 32512*1K blocks for the rawfs partition.
On my device there's ~12MB left...
letama said:
Nice job! Too bad that Archos doesn't do this on their board with a small internal switch. Would be cool for people like me with big fingers and poor soldering skills
Click to expand...
Click to collapse
Yeah, a real switch would be nice indeed... there's some unused testpoints giving us additional GPIO
Need to solder though...
trevd said:
I'm very much for the "Android Way" I believe the archos stock roms can be re-jigged as the stuff outside of the system is not required by the system, this is all stuff that is a result of the BuildRoot build system and has a dependency on uClibc.
Click to expand...
Click to collapse
Some stuff outside of system is quite useful and gives us something like a minimal linux ecosystem.
Very useful at console level... some tools seem to be used by the Android system as well.
trevd said:
I'm going to try and get something usable this week, can I store additional files in the rawfs partition without running into trouble?
Click to expand...
Click to collapse
Mmmh, letama maybe right with being very careful with this part of internal storage. If it get's corrupt you'll risk a brick (could be restored though by using external boot mechanism).
Anyway the best would be to mount it RW and use the kernel driver to access it... the unknown part is still the bootcode.
There's some kind of allocation table at the beginning of rawfs partition. It is yet unknown how bootcode behaves with an additional entry
Anyway, this is a real nice project and i would really appreciate to see it pushing forward.
Take your time trevd, and again thanks a lot for contribution!!
Have a nice day,
scholbert
Not to put this down in any way, but wouldn't TWRP be better for the G9? It has a full touch tablet UI, which is better than CWM's
Sent from my Galaxy Nexus using Tapatalk 2
Quinny899 said:
Not to put this down in any way, but wouldn't TWRP be better for the G9? It has a full touch tablet UI, which is better than CWM's
Sent from my Galaxy Nexus using Tapatalk 2
Click to expand...
Click to collapse
Hi Quinny
There's nothing to stop us using whatever recovery we like.... they all work the same way ( I think ) , i.e the code is compiled into a recovery binary. Unfortunately my touch screen stopped working long ago so I wouldn't really benefit
scholbert said:
To be even more precisely, there are 32512*1K blocks for the rawfs partition.
On my device there's ~12MB left...
Click to expand...
Click to collapse
Ah, yes, but there is space reserved for each file there, what I have to figure is how much is reserved for custom file (sde kernel). I don't want to have to shift the files located after custom to make room for sde kernel , it would defeat the "no-fuss/no-risk" of the method.
Anyway the best would be to mount it RW and use the kernel driver to access it... the unknown part is still the bootcode.
There's some kind of allocation table at the beginning of rawfs partition. It is yet unknown how bootcode behaves with an additional entry
Click to expand...
Click to collapse
Definitely. Re-partitioning is much safer if space is needed.
trevd said:
.... they all work the same way ( I think ) , i.e the code is compiled into a recovery binary.
Click to expand...
Click to collapse
This is a good keyword: The recovery binary itself!
Most tools inside the recovery are simply linked to busybox, which itself is a link to recovery executable.
In other words, we have some code responsable for the menu and framebuffer stuff and we have busybox.
The strings command gave me version 1.2.0. Now my question...
How to configure this part of code?
I'd like to enhance the busybox part.
Could you please provide a little to howto for a compiler run?
Will i need all that Android stuff installed...
I you have any clue, please point me in the right direction.
Lazy,
scholbert
scholbert said:
How to configure this part of code?
I'd like to enhance the busybox part.
Could you please provide a little to howto for a compiler run?
Will i need all that Android stuff installed...
Click to expand...
Click to collapse
Yes, you need full android repo. Android Build system is messy and tightly coupled, busybox is compiled with bionic (android libc), recovery is built on top of it with few android libraries links. Isolating all this "mess" would be difficult. Except disk space required, there is no big deal in getting full android repo.
I'd suggest to take a look at this, you should do the "Prepare the Build Environment" section.
I don't know how trevd built his recovery, but what I did is create a gen9 device to get proper configuration for recovery (frame buffer config, ...). You can get mine if you want, it's a little outdated (latest cwm doesn't need a specific gfx anymore, the custom one I used has been moved to upstream for instance), but it should give you a base.
To do that, you have to create an "archos" directory in cm9/device directory, then from inside it do:
Code:
git clone git://gitorious.org/archos-ics/device-g9.git gen9
Then, you need to setup the build env once. From cm9 root, you have to do that:
Code:
. build/envsetup.sh
(it setups android build environment)
then
Code:
lunch
then choose full_gen9-eng.
(it selects device target for build)
You should have something like that:
Code:
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=4.0.4
TARGET_PRODUCT=full_gen9
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a-neon
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=IMM76L
============================================
from this point, you can compile:
make -j4 recoveryimage (change j4 with the number of parallel build you want depending on your cpu).
whole recovery fs should be in out/target/product/gen9/recovery/root, with recovery command in sbin
Last, how do you want to extend it? If you want to add custom commands, take a look at cwm bootable/recovery/extendedcommands.c, it may be easier to add stuff there than in busybox.
Related
For the last couple of weeks i'm trying to get a Blur-rom working on my G1, but sadly it's giving me alot of problems.
I mainly tried flashing it from scratch, which means im running the following setup:
Running a class 6, microsd card;
fat32 (7200mb)
ext3 (500mb)
linux-swap (128mb)
Click to expand...
Click to collapse
I also tried the same setup, except i used ext2 instead of ex3.
The problems I have;
After flashing the rom everything works ok. I sign in to motoblur, and set everything up. But after doing a reboot, the problems start. Right after I enter my pincode, and the homescreen starts loading, i'm getting force closes all over. In the end all I see is a blackscreen, and the white taskbar.
Is my setup wrong? If you ppl want more information, I can flash it again, and will try to collect some logs.
Thx in advance.
*bump*
Still having the same problems, also when running the newest blur rom around (Motorola Blur / S-Blur_1.071 - Bluetooth).
Here is more info (my logs)
http://pastebin.com/m1b544f9c
Hopefully somebody can help, since I wanna run this one on my phone badly
FREAKJAM said:
*bump*
Still having the same problems, also when running the newest blur rom around (Motorola Blur / S-Blur_1.071 - Bluetooth).
Here is more info (my logs)
http://pastebin.com/m1b544f9c
Hopefully somebody can help, since I wanna run this one on my phone badly
Click to expand...
Click to collapse
First what kind of phone do you have? G1/MT3G/Hero ?
Next, did you make sure and do a COMPLETE wipe on your phone?
This means erase:
/system/sd/app_s
/system/sd/dalvik-cache
/system/sd/app
/system/sd/app-private
All of /data
You would do that from the Recovery screen. You can't just go into Recovery, then choose Drop to a terminal and then type
Code:
busybox rm -rf /system/sd
That won't work, when you boot into Recovery none of your partitions are mounted. And choosing "Do a data wipe" from the recovery menu DOES NOT erase your /system/sd partition. You need to mount /system/sd before clearing everything off of it.
As far as your partitions are concerned, keep it as ext2 and not ext3. Read the first post in the Blur thread and it explains how your sdcard should be partitioned.
You should also probably run a fsck on your ext2 partition to make sure it's still functional.
Code:
e2fsck -fy /dev/block/mmcblk0p2
And also verify your swap is still good
Code:
mkswap /dev/block/mmcblk0p3
Given the errors you're having it sounds like you did not do a complete wipe as explained in the first thread, or your ext2 partition is corrupt and you just need to run a fsck on it
I installed the rom completely fresh on a G1 (dream), formatted my sdcard and made 3 new partitions using parted on the recovery console.
So basically saying this isn't enough?
reformatting my sd card now and did the following;
mkpartfs primary fat32 0 7200
mkpartfs primary ext2 7200 7700
mkpartfs primary linux-swap 7700-7828
busybox rm -rf /system/sd
e2fsck -fy /dev/block/mmcblk0p2 (no errors)
mkswap /dev/block/mmcblk0p3 (swap information 128mb, so seems good)
Click to expand...
Click to collapse
will flash now, and get back to you when i have more info
FREAKJAM said:
I installed the rom completely fresh on a G1 (dream), formatted my sdcard and made 3 new partitions using parted on the recovery console.
So basically saying this isn't enough?
Click to expand...
Click to collapse
Technically yes that is all you would need, but once again follow the steps I outlined. No need to blow away partitions. I don't know your level of expertise so I don't know if you're doing it correctly. For all I know you could be creating the partitions, then forgetting to format /dev/block/mmcblk0p1 as fat32, or forgetting to format /dev/block/mmcblk0p2 as ext2, or forgetting to mkswap on /dev/block/mmcblk0p3.
Since you are the only one having this issue it basically means you are missing a step somewhere along the way. The ROM does not hate your phone, lol.
Please follow the regular ROM flashing guidelines. After you create the partitions make sure you can manually mount the fat32 partition at /sdcard and the ext3 partition at /system/sd. Also make sure you didn't somehow screw up the phone parititions, IE /dev/block/mtdblock[1-5]
I think I flashed my phone atleast 200x in the last 6 months..
I'm very addicited to flashing, and I setup a hero rom just like that using parted.
I always reformat my sdcard to start "fresh".
Anyways, flashing now
parted /dev/block/mmcblk0
GNU Parted 1.8.8.1.179-aef3
Using /dev/block/mmcblk0
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
print
print
Model: SD USD (sd/mmc)
Disk /dev/block/mmcblk0: 8017MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 512B 7200MB 7200MB primary fat32 lba
2 7200MB 7700MB 500MB primary ext2
3 7700MB 7828MB 128MB primary linux-swap(v1)
Click to expand...
Click to collapse
e2fsck -fy /dev/block/mmcblk0p2
e2fsck 1.41.6 (30-May-2009)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/block/mmcblk0p2: 11/244320 files (0.0% non-contiguous), 30701/488281 blocks
Click to expand...
Click to collapse
mkswap /dev/block/mmcblk0p3
Setting up swapspace version 1, size = 127995904 bytes
Click to expand...
Click to collapse
FREAKJAM said:
I think I flashed my phone atleast 200x in the last 6 months..
I'm very addicited to flashing, and I setup a hero rom just like that using parted.
I always reformat my sdcard to start "fresh".
Anyways, flashing now
Click to expand...
Click to collapse
K lemme know how that goes. If it crashes like that again do something for me, open up a shell using "adb shell" and do "cat /data/a2sd.log" and tell me what it says
Here is my log, phone is still booting tho, but seems a2sd is done already.
Beginning a2sd at 05:50 06/16/2009
Does post install script exist: No
Does /dev/block/mmcblk0p2 exist: Yes
Running fsck ....
e2fsck 1.41.6 (30-May-2009)
ext2fs_check_if_mount: Can't check if filesystem is mounted due to missing mtab file while determining whether /dev/block/mmcblk0p2 is mounted.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/block/mmcblk0p2: 11/244320 files (0.0% non-contiguous), 30701/488281 blocks
Mounting /system/sd : Ok
Changing owner on /system/sd to app user: Ok
Changing permissions on /system/sd to 771: Ok
Cleaning up any symlinks in /data
Moving apps to SD finally....
Created /system/sd/app
Changed uid/guid to app user on /system/sd/app
Changed permissions to 771 on /system/sd/app
*****CRITICAL / Watch below for errors ******
Moving /data/app: Ok
Deleting /data/app: Ok
Creating symlink to /system/sd/app: Ok
***** CRITICAL DONE ******
Created /system/sd/app-private
Changed uid/guid to app user on /system/sd/app-private
Changed permissions to 771 on /system/sd/app-private
Created /system/sd/dalvik-cache
Changed uid/guid to app user on /system/sd/dalvik-cache
Changed permissions to 771 on /system/sd/dalvik-cache
*****CRITICAL / Watch below for errors ******
***** CRITICAL DONE ******
Mounting dalvik-cache: Ok
Setting owner to app use for /data/dalvik-cache: Ok
Setting permissions to 771 on /data/dalvik-cache: Ok
Finished 05:50 06/16/2009
Click to expand...
Click to collapse
Still splashscreen on my phone atm.. booting takes longer then normal! Waiting for around 5 mins now.. will wait a bit longer
FREAKJAM said:
Here is my log, phone is still booting tho, but seems a2sd is done already.
Still splashscreen on my phone atm.. booting takes longer then normal! Waiting for around 5 mins now.. will wait a bit longer
Click to expand...
Click to collapse
Well what is adb logcat showing? Is it still progressing? Is it throwing errors?
Redid a total new format and flash cuz it was taking pretty long..
here is some stuff from the logcat;
http://pastebin.com/d2fef07f0
still on the splashscreen for some minutes now..
FREAKJAM said:
Redid a total new format and flash cuz it was taking pretty long..
here is some stuff from the logcat;
http://pastebin.com/d2fef07f0
Click to expand...
Click to collapse
The ONLY way to get the errors you got there are from a pre-existing installation on your phone.
#
E/PackageManager( 1714): Package com.arcsoft.mediagallery has no signatures that
#
match those in shared user android.media; ignoring!
Click to expand...
Click to collapse
Your md5sum for the update should be:
62b9b3925e95b70eda1c77e8317dc7a9 S-Blur_1.071-full.zip
If it is not then re-download the update again and try flashing.
Redo a wipe and when you are positive you have wiped, check manually that all the files are gone. Don't re-partition/format. Just do the following from recovery shell
Code:
mount /system/sd
busybox rm -f /system/sd/app_s/*
busybox rm -f /system/sd/dalvik-cache/*
busybox rm -f /system/sd/app/*
busybox rm -f /system/sd/app-private/*
umount /system/sd
mount /data
busybox rm -f /data/app/*
busybox rm -f /data/app_s/*
umount /data
mount /system
busybox rm -f /system/app/*
umount /system
Phewww, then do a flippin flash of the ROM. That should GUARANTEE that you have a clean wipe.
G:\>md5 S-Blur_1.071-full.zip
62B9B3925E95B70EDA1C77E8317DC7A9 S-Blur_1.071-full.zip
Click to expand...
Click to collapse
did the whipe just like u said..
and now flashing again.. pfew
will keep u posted!
thanks for the help so far!
It installed, and I logged in to gmail etc.
after first reboot, again FC all over. This rom really must hate my phone
http://pastebin.com/dc9c4e47
E/AndroidRuntime( 1844): java.lang.NullPointerException
E/AndroidRuntime( 1844): at java.util.Locale.setDefault(Locale.java:855)
did you make it through set up?
can u make it into settings and mess with that?
what blur rom are you flashing? it may be messed up
I can set everything up, all the info bout what rom I am currently trying to flash is found in the 2nd post.
After the first reboot, it's giving all the force closes.
FREAKJAM said:
It installed, and I logged in to gmail etc.
after first reboot, again FC all over. This rom really must hate my phone
http://pastebin.com/dc9c4e47
Click to expand...
Click to collapse
Where are you located? The US/Europe/somewhere else? It's having issues setting your locale. When the setup first comes up, are you selecting US English?
I'm from Holland. I select US English yes, but I vaguely remember that it jumped to Deutsch, and that I can't change it back to English.
Perhaps it won't let me run this rom since i'm from the EU.
FREAKJAM said:
I'm from Holland. I select US English yes, but I vaguely remember that it jumped to Deutsch, and that I can't change it back to English.
Perhaps it won't let me run this rom since i'm from the EU.
Click to expand...
Click to collapse
Hmmm there's a very good chance that it wouldn't work if you chose anything but English. You may need to use a different libril.so since the one in the ROM is for US. Or Motorola might have designated this only for US users as they will have a different device (the Dext ?) for Europe. Basically it's the Cliq but for overseas. Anyways, erase everything again, reflash and this time make sure you select US English and everything else US just in case Motorola is not allowing anyone outside of US. If that doesn't work you might be out of luck.
You would need to unpack the ROM and hack it to work on your device. Kind of how we hack it to work on G1's
I don't have to skills to "hack" system files. I'll try one more time, trying a US setup. Otherwise ill just have to live with it. Thanks for all the help, esp shafty.
So I tried this baby again after playing with Hero Eclair for a while.
The problem is that the setup-language during the first setup keeps jumping back to German. What files do I have to edit to remove the languages I dont need?
Thnx.
NOTE: This method has been somewhat superseded by JustAnotherCrowd's method in this thread:
http://forum.xda-developers.com/showthread.php?t=744655
It should still work, however, if you don't want to mess with Odin, but if you want to use ext4 and get the max speed AND stability, I recommend using JACs method.
There are two zip files attached. Consider them "Beginner" and "Advanced". You can only use one or the other, not both. No wipe is required for either, but you will want to clean and repair your ext partition if you plan on using one.
Beginner: If you have an SD card with an ext partition on it (no swap partition, just FAT/ext), ttabal has created a fantastic script to mount it on startup. This zip file runs that script at startup. Credit to ttabbal for the script.
IMPORTANT: You will need to install the latest version of busybox before installing this update or it will not work. You can find busybox on the market for free; download and install it and then open it and click "update busybox".
http://getyourboneon.com/vibranta2sd.zip
Advanced: Enables you to place a custom userinit.sh script in /data/local (make sure premissions are set to 755) and it will run on startup.
http://getyourboneon.com/enableuserinit.zip
An explanation of how this was done:
When looking through the init.rc, I realized that there was only one thing running as root that could safely be replaced; the boot logo player. So, all this does is replace the boot logo player with a script that calls userinit.sh from /data/local and then calls the (now renamed) bootlogo player for those of you who want that nifty startup screen
A super simple (and slightly dirty) hack but I figured it might come in handy for those of us who are impatient and would like to do our own tweaks.
Nice....
I'll be looking forward to this.
Edit:
Working great.
??
Can some one elaborate on what this does?:
BM1515 said:
Can some one elaborate on what this does?:
Click to expand...
Click to collapse
http://wiki.cyanogenmod.com/index.php?title=Userinit.sh
anomalous3 said:
I found a way to get a userinit.sh script working for the vibrant for those of us who would like to run anything at startup. Already got the proof of concept working, and am now busy packaging it into an easy script that will set everything up for you. Will update this post later tonight with the finalized script once it's done.
Click to expand...
Click to collapse
Nice work. What can you do on bootup on the vibrant? I havent looked at all the kernel settings.
oh, just stuff like mounting an ext partition or initializing the modules for the FM radio (assuming we can find them and the hardware's there).
anomalous3 said:
oh, just stuff like mounting an ext partition or initializing the modules for the FM radio (assuming we can find them and the hardware's there).
Click to expand...
Click to collapse
Yes the userinit can contain quite a few script functions and technically almost all of them that would be needed on a modifed rom.
E.G
Code:
insmod /system/lib/compcache/ramzswap.ko;
rzscontrol /dev/block/ramzswap0 -i -d 32768;
busybox swapon /dev/block/ramzswap0;
echo 528000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq;
echo 0 > /proc/sys/vm/page-cluster;
# Set "deadline" scheduler fifo batch to 1 for mtdblocks and mmc
for i in `ls -1 /sys/block/mtdblock*` /sys/block/mmcblk0
do
echo 1 > $i/queue/iosched/fifo_batch
done
busybox mount -o noatime,nodiratime -t auto /dev/block/mmcblk0p2 /system/sdcard/sd;
if [ "$?" = 0 ];
then
busybox chown 1000:1000 /system/sd;
busybox chmod 771 /system/sd;
# clean up any old symlinks, create data directories
for i in dalvik-cache data;
do
if [ -h /data/$i ];
then
rm /data/$i;
fi;
if [ ! -d /data/$i ];
then
mkdir /data/$i;
busybox chown 1000:1000 /data/$i;
busybox chmod 771 /data/$i;
fi;
done;
Updated. And to mount an ext partition you'd want to mount /dev/block/mmcblk1p2.
Got my ext mounted but haven't yet figured out how to get app data over to the external sd card without tons of force closes (I'm probably setting the permissions wrong).
anomalous3 said:
Updated. And to mount an ext partition you'd want to mount /dev/block/mmcblk1p2.
Got my ext mounted but haven't yet figured out how to get app data over to the external sd card without tons of force closes (I'm probably setting the permissions wrong).
Click to expand...
Click to collapse
Those were some examples not specifically for the Vibrant.
justanothercrowd said:
Those were some examples not specifically for the Vibrant.
Click to expand...
Click to collapse
I know I could tell by the echo 528000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq;
I was just sayin' though in case anyone was interested in making this work....too tired to mess with it anymore tonight.
anomalous3 said:
Updated. And to mount an ext partition you'd want to mount /dev/block/mmcblk1p2.
Got my ext mounted but haven't yet figured out how to get app data over to the external sd card without tons of force closes (I'm probably setting the permissions wrong).
Click to expand...
Click to collapse
I've been trying to get the ext partition to mount, but I keep getting errors from mount. This is just with "adb shell". I did "su", and have root. What command are you using? Does it only work from the userinit?
# mount /dev/block/mmcblk1p2 /system/sd
Usage: mount [-r] [-w] [-o options] [-t type] device directory
# mount -t auto /dev/block/mmcblk1p2 /system/sd
mount: No such device
# ls /dev/block/mmcblk1p2
/dev/block/mmcblk1p2
The device and mount directory do exist, so I'm a bit lost. I'll give it a go with the userinit hack and see if that gets things running.
EDIT: Nevermind, I forgot to do "busybox mount". grrrrr.. that works now.
EDIT2: Ummm... it mounts as a j4fs with a bunch of crap I've never seen on there. WTF?!? I didn't even know that filesystem existed.
maybe try
Code:
busybox mount -t ext3 /dev/block/mmcblk1p1 /system/sd
? I got it to mount and recognize the ext partition, my trouble was getting the data over to it. maybe a symlink isn't the best way to do it and I could try a bind mount.....
OK. I got it working, had to use mkfs.ext2 to re-format the ext partition. I have no idea what put that other crap there, but it wasn't me and formatting doesn't seem to have bothered anything.
Here's a rough draft of my userinit.sh. I have booted with it, and it seems to work fine. No warranty, obviously. It bind mounts /data/data to a directory on the ext partition, copying files if needed. It might do with some more cleanup and safety checking, but seems to work OK for me.
Speed wise, it seems to work pretty good.
Oh, you need to create the /system/sd directory yourself. I didn't add that in the script. remount rw and "mkdir /system/sd". A root file manager should be able to handle that as well, or add it to the script.
I've never had lag on my Vibrant so the lag fixes have always confused me a bit. Screwing with the phone is what its all about though.
well I'll be damned. It works. I wonder if we'll see an improvement from moving the dalvik-cache over too, seeing as how those are the actual executables for the applications.
[edit] It seems to have killed my mobile data connection.[/edit]
anomalous3 said:
well I'll be damned. It works. I wonder if we'll see an improvement from moving the dalvik-cache over too, seeing as how those are the actual executables for the applications.
Click to expand...
Click to collapse
Possibly. I haven't tried that yet. Maybe I'll toss it on and see. I did another version that moves the mount to /sd-ext like CM5. I'll add that in here, it automated, no need to make the mount point yourself. It feels a little more "standard" to have it there.
OK. For grins, I moved dalvik-cache as well. Here's the update, same mechanism. It feels like it might be a little faster, I'm not sure. I'll let everyone have a try at it and see what you think.
it works and data works too! Also seems noticeably quicker!
With your permission, I'd like to package this into an update.zip along with the userinit enabler (once you feel it's ready) so we can have a reliable way to get apps2sd working.
so with this userinit.sh we can apply the mimocan fix, not that i have noticed a hell lot of stalling but there is somewhat stalling after a while. only to make a great phone even better.
anomalous3 said:
it works and data works too! Also seems noticeably quicker!
With your permission, I'd like to package this into an update.zip along with the userinit enabler (once you feel it's ready) so we can have a reliable way to get apps2sd working.
Click to expand...
Click to collapse
just one question... why would we need a2sd? i remember when i had my mt3g and whenever i ran any sense rom or regular rom that a2sd slows it down significantly but when i stored everything on the phone it was way smoother and its not like we dont have the space..
SD Tweakz v2
Only works on custom ROMs with init.d(aka busybox runparts) support
UPDATED 04/11/11(added a few battery tweaks)
Wondering around on XDA will sometimes lead you to threads with scripts/tweaks that may or may not help you improve your android device in one way or another. Now most of these scripts/tweaks are not boot resistant. Meaning, after rebooting the tweaks gets disabled and you need to enter/execute them once again.
Well here's another script that would help you initialize those scrips/tweaks every time you restart/reboot you phone and make your life a lot more easier.
Instructions / How does it work?
1. Download the initial script here (SD Tweakz v2)
2. Flash via recovery This will install/copy the initial script into a portion of your android system which initializes/runs every time the phone boots
3. Create a folder on SD called "scriptz" (/sdcard/scriptz)
4. Place your tweaks/scripts inside "scriptz" folder. Usefull scripts/tweaks with explanation below
5. Reboot and see your script run on boot time By this point, every time you boot, the initial script will check your sdcard(/sdcard/sctiptz) if any scripts/tweaks are present. Once found it will then run the scripts for you each and every time you boot
What is it good for
Well there are lots of tweaks out there just waiting to be discovered. Some can yield great performance and some can provide you with a better battery management that can extend your battery life for hours. Unfortunately, some tweaks can only give you one of the benefits above and a bad performance on the other. Meaning you just can't have 'em all. Here you can choose which tweaks/scripts to apply, modify the values as you want as well as debugging which script provides the benefits that you expect. Another reason for using this mod is compatibility as some tweaks/scripts can be ROM dependent. Most of the time it's a kernel issue but some libraries can get involved too.
The Scripts
Scripts are just plain linux compliant text document which has certain linux commands that can be issued using adb/terminal.
You can make one yourself using some android text editors(from es file explorer, dropbox, root explorer etc.). Don't forget to add a ".sh" file extension.
Here's a few example of the scripts I use:
Code:
#These scripts are from various sources from different sites including [URL="http://forum.samdroid.net/"]Samdroid.net[/URL]
#And of course in collaboration with FranciscoFranco
#
#My approach in the scripts/tweaks that I use is basically just to
#squeeze more juice out of my phone. So in contrast to the tweaks
#included in FranciscoFranco's thread, the tweaks/scripts I use are less
#aggressive in terms of performance and more inclined to save battery.
#
#non-rotational.sh
#this script tells android that you are not using spinning disks
DM=`ls -d /sys/block/dm*`;
MTD=`ls -d /sys/block/mtd*`;
LOOP=`ls -d /sys/block/loop*`;
RAM=`ls -d /sys/block/ram*`;
for j in $DM $MTD $LOOP $RAM;
do
echo 0 > $j/queue/rotational;
done
#noatime.sh
#Remount all partitions with noatime, for more info visit [URL="http://forum.xda-developers.com/showpost.php?p=8708125&postcount=1"]http://forum.xda-developers.com/showpost.php?p=8708125&postcount=1[/URL]
for k in $(busybox mount | grep relatime | cut -d " " -f3)
do
sync
busybox mount -o remount,noatime $k
done
#scheduler.sh
#Changes the scheduler used by the system, for more info visit [URL="http://forum.xda-developers.com/showpost.php?p=4806456&postcount=1"]http://forum.xda-developers.com/showpost.php?p=4806456&postcount=1[/URL]
for i in `busybox ls -1 /sys/block/mtdblock*`
do
echo "noop" > $i/queue/scheduler;
done
echo "noop" > /sys/block/mmcblk0/queue/scheduler;
echo "noop" > /sys/block/dm-0/queue/scheduler;
echo "noop" > /sys/block/dm-1/queue/scheduler;
#setprop.sh (currently testing)
#various build.prop settings
setprop wifi.supplicant_scan_interval 600
These are few of the tweaks that I have tested(and using right now), I will update it every time I test something out and will eventually add some of FranciscoFranco's tweaks for you to try out.
You can get some useful scripts from here - Performance and battery tweaks - by Franciscofranco (just read along)
Note: These scripts are no different from the scripts in FranciscoFranco's thread, I just categorized each individual tweaks and separated them for you to be able to apply each one separately. I will be more inclined to describe only battery saving tweaks as I am only interested with tweaks that could extend battery life(this includes performance tweaks that doesn't seem to affect the battery behavior at all)
Here's the my initial script again: SD Tweakz v2
Here's the downloadable version of each tweak mentioned above:
non-rotational.sh
scheduler.sh
noatime.sh
setprop.sh
If anything bad happens, just flash this Undo.zip(unsigned so just toggle signature verification) and everything should be back as it was before.
Huge thanks to NervGaz for providing a solution to the mount point conflict issue and of course Franciscofranco for those lively discussions and ideas we exchange.
Awesome job, I already linked this on my first page
@Ungaze
what is the difference from Tweakz V2?
bluviper said:
@Ungaze
what is the difference from Tweakz V2?
Click to expand...
Click to collapse
almost everything. Flashing this script alone won't do anything. You need to get your tweaks from here first and save it to /sdcard/tweakz folder. reboot and this way it will do exactly what Tweakz V2 did. Now if you notice any lag or performance drop, apply each tweak/script one by one to debug/troubleshoot which one is causing it.
Additionally if you found anything useful, you can make your own script.sh and place it on the /tweakz folder to run it on every boot.
ungaze said:
almost everything. Flashing this script alone won't do anything. You need to get your tweaks from here first and save it to /sdcard/tweakz folder. reboot and this way it will do exactly what Tweakz V2 did. Now if you notice any lag or performance drop, apply each tweak/script one by one to debug/troubleshoot which one is causing it.
Additionally if you found anything useful, you can make your own script.sh and place it on the /tweakz folder to run it on every boot.
Click to expand...
Click to collapse
Yes please, keep posting feedback either here or the other thread. Anything is useful since some users say they suffer some ocasional lag, others don't notice improvements, others say their phone became super fast...
ok now i get it... so the first batch of scripts on zip cannot be run on boot...
thats why you created this...
..ok i have finally applied everything! hehehe since i love smorgasbords...
and its very hard to tell that its there.... hehehe.. seems like fine to me.
no hiccups whatsoever..
but i feel its OK... thanks again man..
ok now i get it... so the first batch of scripts on zip cannot be run on boot...
thats why you created this...
Click to expand...
Click to collapse
the first batch of scripts had to be manually moved to init.d and had to be in a specific filename with a specific header and containing all the tweaks altogether in order to run on boot.
now what I did with the update.zips(Tweakz V1, Tweakz V2) was make moving it to init.d, renaming and fixing the header all easier for you guys but it still contain all the tweaks with no option for you guys to modify/add/remove lines that you want. This time it already runs on boot.
with this tweak, everything is easily manipulated through the sd card and a simple file explorer for more flexibility and easy troubleshooting. This should also work on most phones with init.d support.
Yes please, keep posting feedback either here or the other thread.
Click to expand...
Click to collapse
And to make things neater, just post stuff regarding only this script here and everything about tweaks on the other thread mentioned above.
You don't really need to move the scripts to the data partition, just invoke the with sh, ie. "sh /sdcard/scriptz/script.sh" it would make your for loop something like this:
for script in $list
do
sh /sdcard/scriptz/$script
done
Also I'd be careful with mounting SD ahead of vold, atleast on /sdcard or /mnt/sdcard make a tempfolder somewhere as a mount point instead and you shouldn't to worry about vold throwing up on you... Just a thought.
You don't really need to move the scripts to the data partition, just invoke the with sh, ie. "sh /sdcard/scriptz/script.sh" it would make your for loop something like this:
Click to expand...
Click to collapse
didn't work last time i tried running the scripts directly from sdcard but will try it with your script.
Also I'd be careful with mounting SD ahead of vold, atleast on /sdcard or /mnt/sdcard make a tempfolder somewhere as a mount point instead and you shouldn't to worry about vold throwing up on you... Just a thought.
Click to expand...
Click to collapse
I don't really have a choice right now but to use the same method as "VOID rom" is using when loading modules. Any ideas?
BTW thanks so much
A quick and simple solution would be to just add something along the lines of
mount -o rw,remount auto /
mkdir /tmp
<mount the sdcard>
<run the scripts>
<unmount the sdcard>
rmdir /tmp
mount -o ro,remount auto /
Not the cleanest solution of all time, but it should work and no risk of conflicting mount points. Another solution is to just have people install the scripts on the /data partition in a directory there as /data is mounted rw.
Sent from my LG-P500 using Tapatalk
NervGaz said:
A quick and simple solution would be to just add something along the lines of
mount -o rw,remount auto /
mkdir /tmp
<mount the sdcard>
<run the scripts>
<unmount the sdcard>
rmdir /tmp
mount -o ro,remount auto /
Not the cleanest solution of all time, but it should work and no risk of conflicting mount points. Another solution is to just have people install the scripts on the /data partition in a directory there as /data is mounted rw.
Sent from my LG-P500 using Tapatalk
Click to expand...
Click to collapse
I was worried about the mount point traffic as well, but I guess I will be implementing the second solution instead, with a very different approach, and a more complex script.
You seem to know your trade, too bad we didn't get to collaborate before I made this script(from scratch, with no knowledge at all with scripting and how they work). Was asking and trolling on different threads with no help at all. Good thing mr. google was always there for anyone who needs help .
I'll start working and hope to hear from you about my next release as well.
You might want to look at the userinit script in the CM based ROM's around if you're going down that route, it does what you want and there's no point reinventing the wheel if you know what I mean.
Sent from my LG-P500 using Tapatalk
Great! Nice tip, never done that before. Thanks alot man.
so all in all, is this script really running on boot or not?
It runs, only problem encountered is with CM7 roms. (mount point traffic or something like that in a sense) will edit 1st page till I finish the reworked script.
Hey ungaze,I have just flashed the script and everything. I'm on CM7. What is the problem? Do I have to wait for a fix and do everything over again? Because I'm currently not experiencing any problems
Nope, it worked once, it should also work every time. Dunno which beta version of CM7 some people are having problem with. I still think this method is easier and faster for testing scripts to run on boot, but the next script will just be more lets say "compatible to a wider variety of ROMs and even other devices".
The issue can occur on rom's that mount the sdcard on /mnt/sdcard and symlink that to /sdcard as your mountpoint doesn't exist. If memory serves me right this is the correct mount procedure since 2.2 and is more in line with FHS. Potentially you can see issues with this if it mounts before vold runs as well as vold with throw an error if the mountpoint is in use. This can occur on rom's that mount to /sdcard. Hope that clears it up a bit.
Sent from my LG-P500 using Tapatalk
How does this look?
Code:
mount -o rw,remount auto /
mkdir /tmp
mount sd
mount -t vfat /dev/block/mmcblk0p1 /tmp
if [ -e /tmp/scriptz ]
then
list=`ls /tmp/scriptz/*.sh`
for script in $list
do
sh $script
done
fi
umount sd
umount /tmp
rmdir /tmp
mount -o ro,remount auto /
Also "ls /tmp/scriptz/*.sh" would show the complete path including /tmp/scriptz/------ and so I just used sh $script on line 10. is this ok?
No need to mount the sdcard in the script, vold handles all that and its not used anyway. Apart from that it looks good to me.
Sent from my LG-P500 using Tapatalk
[Q] encryption, ext2/4, and "filesystem too large to mount safely" error fix?
Hello again,
With my Droid 3 (thanks to Minimoto) again working great, I've turned my attention back to encrypting some of my data on the external SD card. I had used "LUKS Manager" some time ago so that seemed the logical place to start.
Okay, the short *short* version is: What does the error message (from dmesg output) "EXT4-fs (dm-4): filesystem too large to mount safely on this system" mean and how do I fix it or work around it?
The details:
I have a 32 GB SD card with a normal ~20 GB FAT partition that Android sees and uses just fine. On my laptop I created an ext4 file system on the second partition (the remaining ~12 GB of space). Android does not see or use this, but from a terminal I *can* mount it without problems. I chose to mount /dev/block/mmcblk0p2 (external SD partition 2) at /mnt/sdcard-ext-p2. Just FYI, but I wrote a short script and put it at /etc/init.d/03mount_sdpart2 to mount this second partition at the correct mount point and it works fine. Even after a reboot the script runs without problems and now I always have my new ext4 file system present.
The reason for creating the ext4 file system is because FAT does not support files larger than 4 GB and therefore my encrypted volume cannot be larger than 4 GB *if* I create that volume on a FAT file system. With the new ext4 file system, now using the LUKS Manager app, I created a new volume at the above mount point with a size of approximately 11.25 GB. This worked fine, too. The last step, however, actually mounting this encrypted volume, keeps failing. It was supposed to be mounted at /mnt/sdcard/LUKS. Unfortunately, LUKS Manager did not produce much in the way of information about why it had failed.
A quick note about file sizes: If I use an app like "ES File Explorer" and go to /mnt/sdcard-ext-p2 where the large volume file exists, ES says the volume file has a size of -805306366 bytes, obviously wrong. Fortunately, if I use the terminal and look at the file size with "ls -l" it has the correct size. Furthermore, after I opened the volume below using lm.cryptsetup I can use its "status" command and after converting the values from sectors (each sector is 512 bytes) it also displays the correct size of the encrypted volume.
So, back to the terminal where I decided to do the steps manually and see where it failed. For the most part, I used different device and directory names than what LUKS Manager would have used, mostly to be sure I wouldn't accidentally conflict with another process/app. The 'lm.cryptsetup' binary is provided by LUKS Manager and placed in /system/bin. I have the version of busybox that, I assume, ships with Minimoto which is busybox v1.20.0. This is where the 'losetup' I am using comes from.
Concerning loopback devices: LUKS Manager defaults to using/creating high numbered loopback devices, 300 for the first volume created. On Android the loop devices are created in /dev/block, but some tools don't seem to look there. In particular, lm.cryptsetup complains about not being able to find a free loopback device and 'losetup -f' (which displays the next free/available loopback device) always refers to devices in /dev regardless of where they really are. Making symlinks such as "ln -s /dev/block/loop0 /dev/loop0" for each of the currently present loop devs (0 through 7, and 300) fixes both of these problems. That said, whatever manner LUKS Manager uses to execute the underlying tools works properly with the loop devs being located in /dev/block. This can be verified by using "lm.cryptsetup status <crypt_dev>" and the status output shows that it is correctly attached to, for example, /dev/block/loop300. Making these symlinks is more of a convenience/fix for when one is working directly on the command line.
Where, before, 'losetup -f' indicated that /dev/loop0 was free (even though it did not exist), after making the symlinks the same command indicates that /dev/loop4 is the next free loop. On my phone, at that moment in time, that was the correct answer. loop4 also makes sense because I have four apps that I have "moved to SD" and for each app that you do this one loopback device is used (so loop0 - loop3 were used by apps "moved" from main internal storage). Creating these symlinks also made lm.cryptsetup stop complaining/erroring about not being able to find a free loop dev. Finally, running "losetup" without arguments is supposed to list the used loop devs and what is using them. Before making the symlinks is produced no output, and now, after the symlinks, it displays:
Code:
/dev/loop0: 0 /mnt/secure/asec/blah_appA.asec
/dev/loop1: 0 /mnt/secure/asec/blah_appB.asec
/dev/loop2: 0 /mnt/secure/asec/blah_appC.asec
/dev/loop3: 0 /mnt/secure/asec/blah_appD.asec
/dev/loop5: 0 /ss/safestrap/rom-slot2/cache.img
/dev/loop6: 0 /ss/safestrap/rom-slot2/userdata.img
/dev/loop7: 0 /ss/safestrap/rom-slot2/system.img
As you can see, loop4 is missing/available. Also, rom-slot2 is correct as it is where I opted to install Minimoto, rom-slot1 currently containing CM 10.1.
With the loop device issues taken care of, the steps I performed are as follows:
Code:
$ su
# lm.cryptsetup luksOpen /mnt/sdcard-ext-p2/MyCrypto.vol MyCrypto
<type in passphrase>
# ls /dev/mapper
MyCrypto control
# mkdir /mnt/sdcard/luks-tst
# mount /dev/mapper/MyCrypto /mnt/sdcard/luks-tst
mount: mounting /dev/mapper/MyCrypto of /mnt/sdcard/luks-tst failed: File too large
# dmesg | tail -2
[20665.748504] EXT4-fs (dm-4): filesystem too large to mount safely on this system
[20665.750732] EXT4-fs (dm-4): filesystem too large to mount safely on this system
You can see from the above block my commands and the output, especially errors, that followed. Clearly, the file is "too large"... but how? The whole point of this extra partition and ext4 file system stuff was specifically to get around the FAT 4GB file size limitation. Unfortunately, while these errors tell me that something is too large, what *part* is too large? Is the 11.25 GB volume *container* too large, or the ext2/4 file system that exists inside the volume? And if either is too large, what is the maximum size I can make them? I did try adding "-t ext2" and "-t ext4" to the mount command, but neither one changed the outcome nor did they change the messages that were output.
The 'mount' binary (like most others) is provided by busybox, so it could possibly be part of the problem. However, the last two errors above come from the kernel log (via dmesg) which means that at least part of the issue is the kernel, maybe the file system modules. I also checked the logcat output, just in case, but it did not contain anything related or useful. Minimoto 1.7 is using kernel version 2.6.35.7 and perhaps it has some maximum size issues I am unaware of. With the exception of my Droid 3, I haven't used a 2.6.x Linux kernel in a very long time.
I've searched around here as well as the fairly small LUKS Manager message board and the Net at large, but I haven't been able to find the answers I'm looking for. Any ideas as to what I might have done wrong, or something I haven't done but should? I'm not sure how to proceed. Just to be perfectly safe, I did try rebooting but it made no difference.
--John Gruenenfelder
Re: [Q] encryption, ext2/4, and "filesystem too large to mount safely" error fix?
Could it be that your mount point is within the FAT fs, what about creating a new mount point at say /mnt/LUKS
Sent from my XT860 using xda premium
Re: [Q] encryption, ext2/4, and "filesystem too large to mount safely" error fix?
I tried using /mnt/LUKS (instead of the previous /mnt/sdcard/LUKS) as the mount point, but nothing changed. The "filesystem is too large..." messages still appeared.
I don't know why there are two such messages separated by about 2/1000th of a second in the dmesg output even though I issued just one command. It was the same way in my first post.
If I recall, the original reason for putting the mount point under /mnt/sdcard was so that most apps could see/use the new area without having any extra knowledge.
--Sent from my DROID3 using xda app-developers app
I think a huge number of users will be helped greatly if there will be a guide to swap internal sd card to a larger external.
In 4.2 versions and before, the process was fairly easy in Note, with the use of root explorer and just changing some values in vold.fstab file.
In 4.3 what will be the process and which values you should change?
Sent from my Transformer TF101 using XDA Premium 4 mobile app
That would also be of interest for me. In fact, there ar still no instructions, how to do that (external to internal SD).
there are use the search for crying out loud
Sent from my GT-N7000 using Tapatalk 2
Android 4.3 Swap External With Internal
Since baz is an obvious douche. Here's how you do it (and yes it's posted *somewhere* on the xda threads)
Pull your build.prop from your phone and add the following lines to the bottom: (adb pull /system/build.prop)
Edit the build.prop with Notepad++
If it contains the line remove ro.vold.switchablepair=/emmc,/storage/sdcard0 (or any variant - remove it)
Paste the following at the bottom of the build.prop.
# Switch External With Internal
persist.sys.vold.switchexternal=1
# Storage configuration
ro.vold.switchablepair=/storage/sdcard0,/storage/sdcard1
Save the file, (at command prompt type)
adb root
adb shell mount -o rw,remount /system
adb push build.prop /system
adb reboot
These instructions are obviously not completely in depth and don't hold your hand all the way. You'll need to somewhat know what you're doing.
As always make sure to make a nandroid backup in the rare case that something goes wrong.
help
viiron said:
Since baz is an obvious douche. Here's how you do it (and yes it's posted *somewhere* on the xda threads)
Pull your build.prop from your phone and add the following lines to the bottom: (adb pull /system/build.prop)
Edit the build.prop with Notepad++
If it contains the line remove ro.vold.switchablepair=/emmc,/storage/sdcard0 (or any variant - remove it)
Paste the following at the bottom of the build.prop.
# Switch External With Internal
persist.sys.vold.switchexternal=1
# Storage configuration
ro.vold.switchablepair=/storage/sdcard0,/storage/sdcard1
Save the file, (at command prompt type)
adb root
adb shell mount -o rw,remount /system
adb push build.prop /system
adb reboot
These instructions are obviously not completely in depth and don't hold your hand all the way. You'll need to somewhat know what you're doing.
As always make sure to make a nandroid backup in the rare case that something goes wrong.
Click to expand...
Click to collapse
Can someone explain this a little better I download the app and changed the settings but how do I change the build number
bigevil124 said:
Can someone explain this a little better I download the app and changed the settings but how do I change the build number
Click to expand...
Click to collapse
I dont know which app You're taking about, but You can do it without using adb. Just copy build.prop to Your pc (make a backup copy), edit necessary lines and paste it paste back (and set good permissions).
Sent from d605
Sorry im really a newbie when coming to 4.3 I downloaded the root external 2 sd app and I thought thats where I change these settings. Im not sure down to edit the permissions or build numbers or linesÉ when running 4.1 I flashed a zip and it changed my storage so this is all new to me. Sorry for the hassel but your help is much appreciated
Hi all!
That's the trick i'm looking for! I have an Archos 45 Helium 4G with Android 4.3. I've just tried to edit my build.prop. I have rebooted the phone and..... nothing....
That method is OK with all android 4.3 devices or just for the Samsung Galaxy Note GT-N7000?
Also i've got that on my build.prop
Code:
# system prop for storage test
ro.external.sd.path=/storage/sdcard1
Maybe i have to change that one... but i don't know...
or maybe the solution is in the fstab.qcom but i'm afraid to touch that one.... and there are other fstab files, so i don't know which one is used....
Code:
# Android fstab file.
# The filesystem that contains the filesystem checker binary (typically /system) cannot
# specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK
#TODO: Add 'check' as fs_mgr_flags with data partition.
# Currently we dont have e2fsck compiled. So fs check would failed.
#<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags>
/dev/block/platform/msm_sdcc.1/by-name/system /system ext4 ro,barrier=1 wait
/dev/block/platform/msm_sdcc.1/by-name/userdata /data ext4 nosuid,nodev,barrier=1,noauto_da_alloc wait,check,encryptable=footer
/devices/msm_sdcc.1/mmc_host /storage/sdcard0 vfat nosuid,nodev wait,voldmanaged=internal_sdcard:25
/devices/msm_sdcc.2/mmc_host /storage/sdcard1 vfat nosuid,nodev wait,voldmanaged=external_sdcard:auto
#/dev/block/mmcblk0p11 /system ext4 ro,barrier=1 wait
#/dev/block/mmcblk0p12 /data ext4 nosuid,nodev,barrier=1,noauto_da_alloc wait,check,encryptable=footer
or the last thing i know is "the ADB method" > techgage.com/article/moving_your_non-movable_android_apps_to_an_sd_card/
but it seems a not working all the time... I'm also a bit afraid to completely mess up that new phone i don't really know in depth for now.....
Some advices???
try this:
Before
# Change to 1 for swapping SD cards
persist.sys.vold.switchexternal=0
After
# Change to 1 for swapping SD cards
persist.sys.vold.switchexternal=1
if it dont work you have to edit the void fstab:
http://forum.xda-developers.com/showthread.php?t=2229848
btw: forum search is the box on the upper right