yashsingh1/xdaforums huggingface dataset:
[Motorola Droid 4] LuH:
So, finally here is a working ramdisk for CM 12.1 20150515 :) Attached as ramdisk-update.zip

Works fine, tested :) [MENTION=5003013]Mentor.37[/MENTION], you can add it to post #2 if you want to.

Also attached is mini kitchen I created for unpacking and repacking the CM 12 ramdisk as I was tired of the whole process of splitting, unpacking, packing, merging, and packaging into flashable zip - ramdisk-kitchen.zip. How to use:

Kitchen for unpacking and repacking ramdisk for CM 12+

Works on UNIX only. Install zip to have it also automatedly create flashable zip on repack (on Gentoo # emerge zip).

Contents:
unpack.sh
repack.sh
ramdisk.img - ramdisk extracted from cm-12.1-20150515-NIGHTLY-maserati.zip
update-empty.zip - empty update for Safestrap (based off Mentor.37's ramdisk updates)
howto-use.txt - this help :)

Usage:
0. unpack all to some a working directory
1. if you want to, replace ramdisk.img by ramdisk you want to edit. Provided one is from cm-12.1-20150515-NIGHTLY-maserati.zip
2. $ sh unpack.sh
3. now you have the ramdisk unpacked in ./kitchen/table/ and in ./kitchen/ there also are the two files of which the original ramdisk consisted. Edit whatever you want in ./kitchen/table/ and don't delete ./kitchen/safestrapped.cpio
4. when done editing, run $ sh repack.sh
5. now ./output/ramdisk.img was created, and if you have zip installed, also ./output/ramdisk-update.zip
6. install ramdisk-update.zip in Safestrap :) Or put ramdisk.img to update-empty.zip/system/etc/kexec/ and use this one if ramdisk-update.zip not created automatically.

Hope it helps. Created for editing ramdisk for CM 12.1 to be compatible with Mentor.37's Safestrap 3.75 for unused partitions of Motorola Droid 4 (http://xdaforums.com/droid-4/development/wip-safestrap-3-75-unused-partitions-t3023932) by LuH (http://xdaforums.com/member.php?u=566662)

EDIT: I'm not sure how compatible unpacking is with other versions of combined ramdisk (if any other exist) - it does not search for start of second file, just splits it after 144 bytes. At first I tried to split it by content, but could not find any working way (i.e. this creates over 1800 random parts).

Looks like all the tools I tried fail to read binary correctly. See "od -xca ramdisk.img | less": ascii output (second line) is right, hexadecimal (first line) is wrong - e.g. on line 0000220:

0000220 8b1f 0008 0000 0000 0300 7dbc 7c09 5553
037 213 \b \0 \0 \0 \0 \0 \0 003 274 } \t | S U
us vt bs nul nul nul nul nul nul etx < } ht | S U

third and fourth byte are switched in hex, but OK in ASCII and named output (it should be 8b1f 0800 in hex).
[Motorola Droid 4] Buglol:
Well done.
[Motorola Droid 4] mo0n_sniper:
Just installed this recovery. I'm impressed by how fast the phone is working :D

Thanks [MENTION=5003013]Mentor.37[/MENTION]
[Motorola Droid 4] Milp:
I placed 550mb swap files in both /webtop and /preinstall (mounted under storage), also smaller ones in cache, system and data. Swapped on all of them, it's like a brand new phone now, speed wise.

Using 40 swappiness. cm11.

I created the swap files in an app called swapper and moved them to the locations. If anyone is interested in the swapon script for smanager, i can post it here.

somehow using dd with if=/dev/null did not work and filling those files with /dev/urandom didn't let me swap on them.

I don't know if its a good test for how fast things got, but i'm now able to watch a 720p video in the desktop site of youtube in firefox with 3 addons. It plays fluently.

Hope this is the right place for it, not sure whether it deserves it's own thread.
[Motorola Droid 4] Borchuck:
Thats's great! I didn't know Droid's kernel allow swap...
[Motorola Droid 4] Milp:
It does as long as the swap files are on an ext filesystem and not a fat sd card, and they need to be properly created (whatever that means).

Just ran spotify, igo with an active route and g maps navigation with an active route all in background and watched a youtube video in firefox. I can't believe it actually helps that much.
[Motorola Droid 4] Milp:
Hi there, I'm using the following code. I'm using some random app to create swapfiles since dd doesn't work for me with if=/dev/null, it creates 0byte files. And swapping on a file filled with /dev/urandom doesn't seem to work. No idea how else i could go about that.

#!/system/bin/sh

echo start > /storage/sdcard0/swap.log 2>&1
echo mountstuff > /storage/sdcard0/swap.log 2>&1
umount /preinstall >> /storage/sdcard0/swap.log 2>&1
mount -o rw,remount / >> /storage/sdcard0/swap.log 2>&1
rm -r preinstall >> /storage/sdcard0/swap.log 2>&1
mkdir /storage/preinstall >> /storage/sdcard0/swap.log 2>&1
mkdir /storage/webtop >> /storage/sdcard0/swap.log 2>&1
mount -o ro,remount / >> /storage/sdcard0/swap.log 2>&1
mount -t ext3 /dev/block/preinstall /storage/preinstall >> /storage/sdcard0/swap.log 2>&1
mount -t ext4 /dev/block/webtop /storage/webtop >> /storage/sdcard0/swap.log 2>&1
chmod 777 /storage/preinstall >> /storage/sdcard0/swap.log 2>&1
chmod 777 /storage/webtop >> /storage/sdcard0/swap.log 2>&1
echo swappiness...15 >> /storage/sdcard0/swap.log 2>&1
echo 15 1> /proc/sys/vm/swappiness 2>> /storage/sdcard0/swap.log
echo cping... >> /storage/sdcard0/swap.log >> /storage/sdcard0/swap.log 2>&1
cp /storage/sdcard0/Swapper/swap.swp /storage/preinstall/swap.swp >> /storage/sdcard0/swap.log 2>&1
chmod 666 /storage/preinstall/swap.swp >> /storage/sdcard0/swap.log 2>&1
cp /storage/sdcard0/Swapper/swap.swp /cache/swap.swp >> /storage/sdcard0/swap.log 2>&1
chmod 666 /cache/swap.swp >> /storage/sdcard0/swap.log 2>&1
swapon /storage/preinstall/swap.swp >> /storage/sdcard0/swap.log 2>&1
mount -o remount,rw /dev/block/system /system >> /storage/sdcard0/swap.log 2>&1
swapon /system/swap.swp >> /storage/sdcard0/swap.log 2>&1
echo swappingon... >> /storage/sdcard0/swap.log 2>&1
swapon /storage/sdcard0/Swapper/swap.swp >> /storage/sdcard0/swap.log 2>&1
swapon /storage/webtop/swap.swp >> /storage/sdcard0/swap.log 2>&1
swapon /data/swap.swp >> /storage/sdcard0/swap.log 2>&1
swapon /cache/swap.swp >> /storage/sdcard0/swap.log 2>&1[/HIDE]

This might not be too good of a batch script, but i've never before in my life made linux batch scripts, I'm happy it works. I use smanager to execute it on boot.

There is a pre-created 100mb swapfile in /storage/sdcard0/Swapper/swap.swp that gets copied to /cache/ and /storage/preinstall/, since the files there seem to get wiped regularily.

Of course swapping on sdcard0 does not work since sdcard0 does not support permissions (fat?), i was just too lazy to remove it. A logfile is generated in sdcard0 called swap.log.

Been messing around with the swappiness a lot. 30-40 swappiness really enhances multitasking but the phone seems to get slow after some time because it has to do a lot of swap io i guess. Trying 15 now.
[Motorola Droid 4] LuH:
We're very off-topic here, I started new thread (and replied there in post #3): http://xdaforums.com/droid-4/development/wip-swap-cm-11-12-t3153636#post61777215
[Motorola Droid 4] JLPDA:
Looking to flash CM12.1 nightly for the first time. I have quite a few apps and data. Since there's a trade-off between space and speed when using the safe slot, is the safe slot that much faster then using a virtual slot?
[Motorola Droid 4] bbrovont:
[MENTION=566662]LuH[/MENTION], thanks for the work putting together the ramdisk mods. I've been beating my head against a wall trying to get the SlimKat rom to work on the safe partition, and finally figured out that my issue was in the updater-script. When using the "safe" slot, /dev/block/preinstall needs to mount as /system, and when using the "stock" slot, mount /dev/block/system as /system. I don't know if anyone else has run into this or not, but thought I'd post in case this helps.

EDIT - I want to make a few changes to the update zips, to lock them to the rom they are built for, and then I'll repost when done.
[Motorola Droid 4] rpadula:
i'ts a sensible improvement.

not a powerhouse in performance, but safe slot + cm12.1 + Overclock kernel runs fine.
[Motorola Droid 4] Cyber-Logic:
Can't Access SafeStrap from BP Tools Anymore

Hey. Uh. So I installed the cm-12.1-20150515-NIGHTLY-maserati.zip in the SAFE Slot and then installed ramdisk-update.zip right after that. The SAFE Slot was set as Active during this, not Stock.

But after rebooting I just went into a boot loop with the Motorola logo and a black screen. So I thought I'd boot into SafeStrap, but now selecting BP Tools ALSO gives me a black screen. IDK what happened. Is SafeStrap not accessible because /preinstall has been set as /system and can't be changed or something?

I can't access SafeStrap. Help? Can I do something with fastboot while connected to my computer?
[Motorola Droid 4] sd_shadow:
about the only thing you can do is flash stock firmware with RSD Lite
[Motorola Droid 4] Cyber-Logic:
I can do that. I took a backup of Stock before trying the Safe Slot Install.

But I don't understand, what happened here? I thought I was following the correct steps.
[Motorola Droid 4] sd_shadow:
Cm12 barely fits on safeslot, which gapps did you use?
[Motorola Droid 4] Cyber-Logic:
The minimal package, around 90MB. But what I don't understand is why did flashing something to the Safe Slot make SafeStrap inaccessible from BP Tools?

Is there a .img file for just SafeStrap anywhere? Maybe I could try booting into it using the fastboot boot option. I need to somehow access Safestrap and make sure my data on SD is ok. The Droid 4 Utility / RSD Lite has a warning saying that there's a risk of losing all data in the Internal SD.

EDIT: Ok, WTH... even Stock Recovery won't boot from the V+V- menu.... :-/ Blinking black screen.
[Motorola Droid 4] sd_shadow:
happens

no option for that

if BP Tools option, doesn't work, may need to use RSD Lite

I have never lost data using RSD Lite with my droid 4

---------- Post added at 01:42 AM ---------- Previous post was at 01:36 AM ----------

edit
[Motorola Droid 4] Cyber-Logic:
I used option 2 from the Droid 4 Utility and it flashed everything... except that it's been stuck at the boot animation for like 45 minutes. Looks like the radio files didn't get flashed. :-/
[Motorola Droid 4] sd_shadow:
unless you did something to change radio files, 99% of the time you don't need to flash radio.img

---------- Post added at 01:47 AM ---------- Previous post was at 01:46 AM ----------

if it doesn't boot in 10 minutes after RSD Lite is done, you need to factory reset in Stock recovery
[Motorola Droid 4] Cyber-Logic:
Oh, but that step can't be skipped in the Droid 4 Utility... what do I do now?
[Motorola Droid 4] sd_shadow:
Even if radio files are wrong, device will usually boot rom, just may not connect to network

---------- Post added at 01:50 AM ---------- Previous post was at 01:49 AM ----------

so utility is stuck?

---------- Post added at 01:51 AM ---------- Previous post was at 01:50 AM ----------

device needs to be in fastboot mode to use the utility
[Motorola Droid 4] Cyber-Logic:
The utility's last step was "Your device will now reboot and install radio files, then fully boot." after which it turned off, then on, but never got past the boot animation.
[Motorola Droid 4] sd_shadow:
I would force power off, and factory reset
[Motorola Droid 4] Cyber-Logic:
Stuck on Android with red triangle, no menu, and the Power + Volume+ and Volume- isn't doing anything.... FML.

EDIT: AH, it was Power + Volume+ and Volume- AND M key on the keyboard.
[Motorola Droid 4] sd_shadow:
From the*Droidtriage screen, simultaneously press the Volume Up and Volume Down buttons . Select wipe data/factory reset*then press the Power button. Select Yes -- delete all user data then press the Power button.

---------- Post added at 02:16 AM ---------- Previous post was at 02:14 AM ----------

http://www.verizonwireless.com/support/knowledge-base-103991/
[Motorola Droid 4] Cyber-Logic:
Yep, got it, I had to press Power button plus Volume Up, Volume Down, AND the M key on the Keyboard. :D
[Motorola Droid 4] Mentor.37:
ramdisks for cm11, cm12.1 and cm13

A lot of users from the xt894 and xt912 sections asked me in pm an help to build updates ramdisks for cm12.1 and a ramdisk for cm13 because with the old builds and with their own builds they had a phone restart after the kexec vibration, this happened because now the ramdisks have to be built as superuser to not break the new selinux permissions.

Anyway yesterday I built new ramdisks for the last versions of the cm11 and cm12.1 and a ramdisk for cm13 based on the 22 nightly that will work also on the further updates until some relevant thing will not change in the ramdisk.

I provided the ramdisks in a zip that can be flashed in recovery that also install a script to make the ramdisk persistent at the rom updates so you don't have to install the ramdisk every time, you only have to update the rom and the ramdisk will be automatically replaced.

I'm not more using my droid 4 so i haven't personally tested the ramdisks, let me know if there are problems.

Download
[Motorola Droid 4] moodroid:
Thanks very much, Mentor. CM13 is working great in my safe slot now:)
[Motorola Droid 4] mo0n_sniper:
Could this be integrated in the official builds?
[Motorola Droid 4] Dakkaron:
Hey! I am trying to get this to work with arbitrary partitions. Especially, I'd like it to run with webtop as system partition (preinstall is a little bit small, I can't even get OpenGapps to run on it) and a partition on my external SD card as userdata. What do I need to edit for this to work?

I alredy tried changing /data/data/com.hashcode.safestrap/install-files.zip/ss.config and /data/data/com.hashcode.safestrap/ss.config and reinstalling the safestrap recovery, but that didn't stick. Also editing /system/etc/safestrap/ss.config did not change anything. When I boot into recovery /ss.config still has the original values.
[Motorola Droid 4] aiamuzz:
Hello,

just finished reading the thread ...

@sd_shadow ... do you mean our Droid 4 Supports microSD cards upto 64GB, 128GB, 256GB ?

the specs of our phone cap it at 32GB, did you try loading SD cards on a droid 4 to discover such a possibility ?

@Milp ... thats a nice way to use the safe slots ... COULD YOU PLEASE OPEN A NEW THREAD WITH A STEP-BY-STEP NOOB GUIDE TO ACHIEVE THE SAME ? THANKS.

@Mentor.37 ... so that is the order in which things have to be flashed

EVEN ON A VIRTUAL SLOT ? ********* sorry a question un-worthy !!!, was all jumbled up inside my head, ramdisk does not apply to virtual slots. *********

@Mentor.37 ... THANKS A TON ... IT WAS A MUCH NEEDED NOOB OPTION.

so these files will work when flashed over CM official builds(subsequent update builds included) higher than the 22 nightly builds ?

And the included script you are talking about will this save us from having to flash the ramdisks zips after every ROM update ?

Some inferences i've drawn after going through this thread ... PLEASE CORRECT ME IF I AM WRONG ... AND UPDATE THE CORRECT UNDERSTANDINGS.

1. Its not a safe idea to flash a custom ROM on the stock rom slot ! in the spirit of the effort called 'safestrap' !

If 'No' ... a list of ROMs that can run without issues on stock rom slot would be appreciated.

BTW ... what is the /data partition size on Stock ROM slot ?

2. The Safe ROM slot isn't practical beyond trying and testing ROM's on the go, but never practical in the long run, for the small /system and /data partition ?

3. WITH THE 8GB INTERNAL MEMORY REAL ESTATE AVAILABLE ON PREMIUM FOR ROM SLOTS AND TESTING, IS THERE SOME WAY ONE CAN MAKE THE EXTERNAL SD CARD BE TREATED AS THE DEFAULT PLACE FOR ALL VIRTUAL ROM'S INSTALLED ON OUR DROID 4 and HIDE THIS VALUABLE REAL ESTATE FROM ALL VIRTUAL ROMS, SO THAT THEY DO NOT END UP USING IT ?

i used a custom vold file in the stock jellybean on stock rom slot for this purpose, but the vold system is phased out/unn available on cm rom's

If somebody can create a mandatory(to be flashed along with gapps) flashable file to set the external SD card as the default memory(THE SAME WAY I COULD USE A CUSTOM VOLD FILE ON JELLYBEAN) for all other purposes for all virtual roms, noobs like me would certainly be grateful.

4. An optional flashable zip to enable the safe partitions for the virtual roms would be fantastic as well. we can easily create swap files on them and speed up our droid 4.

Besides swap file on an extended partition, any other way we can use these partitions from virtual roms ?

thanks in advance.
[Motorola Droid 4] sd_shadow:
Don't be fooled by the spec sheet; Your Android phone supports up to 128GB microSD cards

List of phones that work with 128GB MicroSDXC card by SanDisk
[Motorola Droid 4] simonsmh:
any ideas to twrp 3.0 ?

从我的 XT894 上通过 XDA Forums 发送
[Motorola Droid 4] sd_shadow:
unlikely
[Motorola Droid 4] simonsmh:
no I means if it possible to upgrade safestrap to twrp 3.0 version. It is still 2.7.1.0 now and needs to be upgraded.

从我的 XT894 上通过 XDA Forums 发送
[Motorola Droid 4] Dakkaron:
On a virtual slot you don't need to flash the ramdisk, the rest is the same. That said, flashing the ramdisk should do no harm.

The reason for the stock slot is so that you always have a backup OS on there in case something goes wrong. Basically every ROM can be run in stock rom slot, but if you manage to brick that stock slot somehow, that may be it. So better don't use that one, or at least not for nightly ROMs or other instable ROMs.

Stock sizes are 640 MB for /system and 3.1 GB for /data

That is sadly true. This is why I am trying to move the safe slot to partitions on the SD card, but I can't get it to work, since I can't seem to change ss.config, as said in my last post. Btw, does anyone know what I need to do to permanently change the values in ss.config? Doing that would allow for the virtual slots and the safe slot to be located wherever one would like. These are only some values in one config file, but I don't know how to change them permanently.

Same answer as for the last question.

Enabling is not quite what you want, you want to MOUNT these partitions. For that you can use the app "Universal Init.d" to activate init.d. Then create a script under /system/etc/init.d/mountpartitions.sh with this content:

#!/bin/sh
mkdir /mnt/webtop
mkdir /mnt/preinstall
busybox mount /dev/block/webtop /mnt/webtop
busybox mount /dev/block/preinstall /mnt/preinstall

You can just add any other partitions that you want mounted as well. Now you can access these partitions under /mnt/webtop and /mnt/preinstall respectively.
[Motorola Droid 4] aiamuzz:
:( ... says my kernel does not have init.d support ...

i am using cm12.1 ROM on slot 1 ...
[Motorola Droid 4] Dakkaron:
Universal Init.d allows you to run init.d even if your kernel does not support it. It only tests for it first, so that the scripts aren't executed twice. If you open the app, there is a big on/off switch right in the middle of the first screen. Put it to "ON" and now the scripts in /system/etc/init.d will be run at boot. They will be executed after the OS finished booting and Universal Init.d's boot hook is called. So they will be executed a few seconds after boot, but that's early enough for a script like this one.
[Motorola Droid 4] aiamuzz:
:( ... nope ... i switched it ON ... but ... dont see the 2 folders the script was supposed to create ... mounting them comes later !!!
[Motorola Droid 4] Dakkaron:
Did you make your script executable? I missed writing that. Just type this into the Terminal Emulator:

chmod 755 /system/etc/init.d/yourscriptnamehere
[Motorola Droid 4] daniel_m:
Thanks a lot for this mini kitchen! :o

Unfortunately I can't get my ramdisk to work (in CM13). As a start, I simply extracted the ramdisk and repacked it again without modifying anything. I even tried to do all steps manually. After "installing" the ramdisk, I only get to see a blank screen. The phone boots to the point were it vibrates and switches off the background light. When the background light turns on again, the screen stays blank instead of showing the boot animation. Nothing happens and I cannot adb into the phone. Any ideas?

I use Linux Mint and also tried to edit/extract the ramdisk as root.

Edit: ramdisk.img has correct permissions (root:root, rw-r--r--)
[Motorola Droid 4] aiamuzz:
Hey i just figured that on my CM13 latest Marshmellow nightly 256MB of Swap has been inherently implemented already !!!

How can i tell if it is a swapfile or swap partition or Swap on RAM(zram) implementation ?

can i play around with the size ?

If so how ?

[MENTION=4885896]daniel_m[/MENTION] ... unless behind your efforts to modify the ramdisk yourself is to learn and educate yourself, i think there are already flashable zips that will inject the modified ramdisk into your ROM.

i was finally able to mount the safe slots on my rom as additional memory storage, the universal init app now shows my cm13 ram as supported after installing busybox from playstore, now i am able to access the safe partitions.

thanks
[Motorola Droid 4] daniel_m:
Well, I'd like to edit the ramdisk in order to prevent Android from mounting the internal SD-card. I would like to mount mmcblk0p25 to /data/sdext2, so that I can use it with Link2SD. Alternatively, I would like to prevent Android from mounting the 2nd partition of my external SD-card, also for use with Link2SD.

I was able to get init.d to work with help of joojoobee666's SELinux permissive kernel. But I had to find out that simply umounting partitions with an init.d script is not enough. Apparently, Android is extremely aggressive at mounting SD-cards.
[Motorola Droid 4] aiamuzz:
If so ... you can download the relevant ROM version ZIPs and flash it through recovery

CM11, CM12.1, & CM13 ... zip's are available

HERE

!!!
[Motorola Droid 4] daniel_m:
Thanks, but this mounts preinstal and webtop. Not exactly what I am trying to do ... ?

Edit: I think I know what I did wrong. The scripts had to be executed by sudo. Being the root user was apparently not doing the job ...
[Motorola Droid 4] Mentor.37:
I don't think that this will ever happen.

You are going for attempts and you are totally on the wrong way, whit which logic you are trying to alter the safestrap's behavior editing the files in /data?

Did you understand a little as safestrap works? Did you understand when and from where the ss.config is loaded? For example when you are in the recovery the ss.config is loaded from the recovery's ramdisk.img.

Isn't so simple editing SafeStrap.

This depend from you, I don't use any gapp, I use the great microG GmsCore project with Fdroid and for me the space in the Safe Rom slot is enough.

I will not more develop this project, so if you want you can try to update at the twrp 3.0 by you.

This don't seems to depend from a permission problem in the building of the ramdisk, in that case you should have a continuous reboot after the kexec vibration but seems that you broke the ramdisk in some other way.

I just updated the zip ramdisk for the cm13 with the cm-13.0-20160221-NIGHTLY.
[Motorola Droid 4] daniel_m:
I am beginning to think that there is something wrong with my phone? :(

One time, I managed to adb into the phone after having installed ramdisk-update.zip. The safetrap folder was missing from /system/etc, which would explain why the phone won't boot. I just don't know why this is happening...

Hm, updater-script mounts /system as ext3. The updater-script from CM13 mounts /system as ext4. Looks kind of suspicious. Even though I would expect a mount error in case the file system is wrong. Or will mounting an ext4 partition as ext3 work but break stuff?

Well, only one way to find out ... back to RSDLite ...:rolleyes::crying:

Edit: Installing CM13 again and Safestrap tells me that /dev/block/system is ext3...