Jump to content


Photo

[MOD] [SCRIPT] Multiboot via loop file [19/12]

* * * * * 3 votes

  • Please log in to reply
394 replies to this topic

#1
Snap.IT

Snap.IT

    Addict

  • Members
  • PipPipPipPipPip
  • 861 posts
  • Gender:Male
  • Location:Stockholm, Sweden
  • Devices:ZTE Blade 3, Alcatel OT995
The script is now completely rewritten and a lot easier to use.

This is the general walkthrough for this script, if you have more questions than this answers please ask in this thread.

Download and unpack the script to the root of your sdcard, the easiest way to do this is to download it to the root of the sdcard and do the following:

1. start terminal session
2. cd /sdcard
3. tar xvf MakeLoopROM-Android-V13.tar

===============================================================================================================================
NEW! READ THIS! - The original ROMs and Packages are now stored in /sdcard/MakeLoopROM/original-roms and /sdcard/MakeLoopROM/original-packages. Copy the ROMs and packages
that you want to convert into those folders!
===============================================================================================================================

Ok, once you're done there you're ready to start the script, it's now completely menu driven.

1. start terminal session
2. cd /sdcard/MakeLoopROM
3. sh startup

That will start up the menu, for a new ROM work your way from 1 - 4 to make your first loop ROM, at the end of 4 it will be ready for installation, for upgrades that install into
existing loop files (that you have made once with step 1) start at step 2.

The menu options and how they work:

1. Make system, data or both loop files

This option will allow you to do just what it says, make the system and data images you'll install your ROM into, it's very
straightforward but i'll give a brief summary of how
it works.

"Do you want to make an image file to hold the system for this ROM? (not neccessary if it's an upgrade from a previous ROM) Y
for yes N for no."

Pretty straightforward, if you don't have a system loop file enter y for yes, if you're going to upgrade then running this
step is completely unneccessary but since you have
chosen to run it, press no.

"What do you want to call your system image? (give it a name you'll remember, like cm-7-system for a cm-7 loop install)"

Name the system loop file, call it whatever you want but make it something relevant to the ROM or you'll end up wondering what
that file is for when you stumble upon it at a
later time. it'll be stored under /multiboot/system-loop-files when it's done.

"What size do you want your system image to be (in MB's)? (WARNING: if you make it too small your ROM +other packages like
gapps might not fit, make it 250)"

The size of /system for the loop ROM, read the thread you downloaded the ROM from to find out what size is ok, i just use 250
for everything in case i want to reuse it with full
at a later time.

"Do you want to make an image file to hold the data for this ROM? (not neccessary if it's an upgrade from a previous ROM or
you want to share a data image with another ROM)
Y for yes N for no."

Same as with the system loop file, if you don't have one, you'll want one, if you're upgrading you shouldn't be running this
step but there is another time when you want to say
no to this, when you want to share a loop file with another installation (not with NAND ROMS). Like for example if you want to
share the data partition between CM-10 and PA-JB.

"What do you want to call your data image? (give it a name you'll remember like cm-7-data for a cm-7 loopinstall)"

Same as for the system loop file, just name it something relevant, the name is of no importance to it's function.

"What size do you want your data image to be (in MB's)? (This file will hold all of your data, don't skimp on the size)"

How many apps do you plan to install? 10 - 50 - 500?

Make it a size that you can live with and that will fit on your sdcard, it really depends on how many apps you'll install.

2. Make a Loop ROM

It's exactly what it says, this will make your loop ROM ready for installation.

"Available ROMs:"

just enter the number that's next to the ROM you want to convert, if it's not there it's because you didn't copy it to /sdcard
/MakeLoopROM/original-roms, you can do so now and
hit r to refresh the list.

"You previously created the system loop file [nameofyourfile], do you want to use it for this ROM? (y/n)"

You'll only get this question if you created a system loop file by going through step 1. If you did so and that's the file you
want to use (check the [nameofyourfile]) then
answer y for yes, otherwise you answer n for no and the following question comes up.

"Available system loop files:"

This choice will only come up if you answered no to the previous question or didn't make your system loop file with the script
in step 1 during this session. Anyways, just enter
the number next to the file you want to use as a system loop file.

"You previously created the data loop file [nameofyourfile], do you want to use it for this ROM? (y/n)"

See the system loop file above, this is the same but for the data loop file

"Available data loop files:"

See the system loop file above, this is the same but for the data loop files

Do you want this installation to format the data image used with this ROM?
Answer Y for yes if it's a new installation and N for no if you are upgrading
and want to keep the data on the data image. (Say yes if you would run wipe
data/factory reset in recovery if this was a normal install)

Y if this is a new install or you're reusing an old data loop file that you want to wipe.

when done hit enter to get back to the menu.

3. Make a loop package (such as gapps)

This, like it says, is for converting non-rom packages (not kernel packages though) such as gapps or bravia or what have you.

"Available packages:"

type the number that is next to the package you want to convert, if the package isn't there you didn't copy it to /sdcard
/MakeLoopROM/original-packages

"You previously created the system loop file [nameofyourfile], do you want to use it for this ROM? (y/n)"

You'll only get this question if you created a system loop file by going through step 1. If you did so and that's the file you
want to use (check the [nameofyourfile]) then
answer y for yes, otherwise you answer n for no and the following question comes up.

"Available system loop files:"

This choice will only come up if you answered no to the previous question or didn't make your system loop file with the script
in step 1 during this session. Anyways, just enter
the number next to the file you want to use as a system loop file.


Repeat No. 3 for all your packages

4. Make (or update) NAND boot image.

This will read the information in your boot partition and store it as boot.img under /sdcard/multiboot so you can boot back to
your NAND installed ROM by running step 6 or
flashing nandboot.zip (also stored under /sdcard/multiboot) from cwm.

Run this every time you update your NAND ROM so the boot.img is fresh.

"This script will update your nand boot.img in the multiboot folder to the version of boot.img you're currently running, make
sure you're running the updated ROM and not
a loop ROM before hitting Y for yes here. If you're not sure type N for no."

If you updated your NAND ROM or haven't run this option before you have to say y for yes here, you have to run this option at
least once or you can't boot back to NAND. Just
make sure you've got your NAND ROM booted and not a loop rom because this will take the boot partition content of your
currently running ROM.

5. Remove a loop installation

If you've come this far you know what you're doing in this option. I'm not going to go through all combinations but they are
self-explanatory.

6. Boot an installed ROM.

Exactly what it says, just remember that even non-installed ROMs may be listed here, if you happen to try to boot to one of
those it will hang at boot, in that case, pull the
battery, reboot to recovery (press and hold vol down while you press power) and use the boot zips that have been created for
your roms.

the Boot zips are located in /sdcard/multiboot/nandboot.zip for the NAND and /sdcard/multiboot/loop-roms
/[namofyoursystemloopfile]/[nameofyourROM]boot.zip

7. Clear Dalvik Cache.

Will clear the Dalvik Cache of the currently running ROM, run this before installation of any package that requires you to
wipe Dalvik Cache.



I think that's all, if there is any questions, feel free to ask.

Android version: MakeLoopROM-Android-V13.tar
MD5: a13646bba6757bf017290244a47cdc30












===============================================DEPRECATED==============================================================

It took a while but i managed to sort out how to boot to loop filesystems stored on the SD-card.

This means that you don't have to partition anything and you can have as many ROMs installed as you can fit on your SD-card.
You don't have to worry about a2sd/S2E/mounts2sd or anything like that (just make your data partition large enough to hold your apps, you can share the data partition between as many loop ROMs as you like) but this doesn't prevent it either, your sd-ext partition will be untouched and mountable by any ROM you install into a loop file (if the ROM supports sd-ext, that is). Swap will work just fine too.

The script is self explanatory but there are a few things it doesn't explain so i'll explain it here.

Here we go:

1a. Download the MakeLoopROM(version).zip and unpack it to any directory of your choice, just remember where you put it, if you're going to do this under cygwin i suggest you put it in a directory that is easily accessible from the cygwin terminal (IE cygwin/home/"yourusername") and if you're using Linux, just unzip it to your home directory.
1b. Download the MakeLoopROM-Android.tar and unpack it to the root of your sdcard or copy the file to the root directory of your sdcard, open up a terminal session and run tar -xvf MakeLoopROM-Android.tar.

2. Copy the rom and gapps and whatever other package you want to convert to the MakeLoopROM directory that was created during the unzipping above.

3a. In Linux, open up a terminal, cd to the MakeLoopROM directory and type sudo ./makelooprom (losetup requires root permissions).
3b. In windows, open up the cygwin terminal, cd to the MakeLoopROM directory and type ./makelooprom-cygwin
3c. On Android, open up a terminal session, type su and hit enter, type cd /sdcard/MakeLoopROM and hit enter and then sh mkrom and hit enter.

4. Follow the instructions, it should be easy enough to understand.

5. If you want to convert a gapps package and/or other packages you repeat step 3 but type ./makeloopgapps instead of ./makelooprom it'll work for any package you want to install into your loop files, root is not needed for this step.
5a. For android you type sh mkgapps to make gapps and other packages.

6. To be able to reboot back to NAND (the ROM on your phones internal storage) you need to copy the boot.img of your current ROM into the multiboot directory.
6a. The android version now copies the running boot.img if you answer yes when you get the question if you want it to so there is no need to copy it in another way.

After you're done converting your ROM and the packages you'll find all important stuff in the multiboot folder within the MakeLoopROM directory, just copy the whole folder to the root of your SD-card (if you are running on android this step is unneccessary, the script will copy the files for you). You'll find your image files under multiboot (if you created them) along with the "nameofyourrom"boot.img and boot"namofyourrom".sh that you'll need to boot into the ROM from another ROM and finally under loop-roms/[nameofyoursysimage] you'll find all your converted ROMs and packages, ready for installation.


Now you're ready to install the loop ROM and the loop packages, it installs like any other ROM/package via your recovery of choice (I recommend my CWM Touch 6.0.1.1, it's what this is tested on but it should work fine on any recovery).

To switch between ROMs you open up a terminal window, type su to get root permissions, cd to the multiboot folder (cd /sdcard/multiboot) and type sh bootnand.sh to switch to your internal ROM or boot"nameofrom".sh (bootcm-7.2.0-blade.sh if you installed cm-7.2.0-blade for example) for any of the loop roms. You can also install script manager and script manager widgets and make widgets for those scripts on your homescreen, that way rebooting to another rom is as easy as pressing the icon on your homescreen. :)

I'm sure there'll be a lot of questions about things i haven't thought of, but if you should fail or do something wrong then just hit ctrl-c and start over, the script cleans up and restarts the build.


Thanks to:
android@sam for some ideas.
championswimmer for some scripts from his Kernel Kitchen.
Tilal for suggestions that helped fix running this script on the phone itself as well as the app he's making to make reboots between the different installs much easier and better.
De@n for being a very patient tester.

Files:

Linux version: MakeLoopROM-Linux.tar
MD5: 8907e2519276f4abcbb5bab0de168ae5

Windows Cygwin version: MakeLoopROM-Windows.zip
MD5: 096921e7a08eba98329bb7ec486068f0

Android version: MakeLoopROM-Android-V8.tar
MD5: f4ee326faf65bd032a95a1e2b4e8bc9f

Edited by Snap.IT, 19 December 2012 - 09:48 PM.

  • 11

#2
Snap.IT

Snap.IT

    Addict

  • Members
  • PipPipPipPipPip
  • 861 posts
  • Gender:Male
  • Location:Stockholm, Sweden
  • Devices:ZTE Blade 3, Alcatel OT995
19/12 v13:

* Fixed "no available loop device" thanks to android@sam who suggested to add a loop device.
Should now work for those who had problems with no free loop devices.
* Added option to clear Dalvik Cache of currently running ROM (option 7) per the suggestion of andr0idbeliev3r.


19/12:

* Fixed faulty error messages.
* Fixed some typos.
* Fixed updateboot so nandboot.zip can be installed directly from CWM.
* Minor adjustments and updated binaries.

25/10:
* Completely rewritten, it's now entirely menu driven with choices so you don't have to type filenames.
* Fixed faulty boot flashing
* Now copies a flashable zip of each loop ROM and NAND ROM boot images to /sdcard/multiboot for NAND and /sdcard/multiboot/loop-roms/[nameofyoursystemloopfile/[nameofyourrom]boot.zip so you can flash it via CWM if you need to.
* Includes a cross compiled version of bash for arm to fix a lot of scripting problems.

12/10:
* Streamlined, a LOT faster now.
* Possible fix for the random faulty boot.img flashing when switching between ROMs, need feedback on this.
* Removed unnecessary file creation (all of it runs within one loop file and questions (if you create the system and data images you won't get the question twice, it checks if your ROM is a JB rom without your interference).
* Added cleanup script, to use it run sh cleanup as su and follow the instructions.
* Lots of other bits and pieces that makes it safer and faster to use.

3/9:
* Fixed the Android version to work with CM7 roms [changed let=size to size=$(expr], thanks to Sulthekk for the heads up on that
* Added a failsafe to the Android version on creation of system loop file if it already exists and on giving the script a name for system and data image that doesn't exist. You get one retry, if you can't get it right after that... It is possible to multitask on android, just open a file manager if you forgot the name of the system or data image.
* Fixed the Linux and Windows versions to work with JellyBean ROMs, thanks to jpeg729 for the heads up on that
* Change the file names to reflect which version is which

1/9:
* Finally fixed the problems with no permissions running the script on some ROMs.

1/9:
* Added the choice to copy your currently running roms boot.img to your multiboot automatically, no user interaction needed for the process.

31/8:
* Fixed the android version so that it runs on CM-10 and PA as well as all other roms (i hope).
* Fixed the android versions makeloopgapps.

31/8:
* Changed the zip for android version into a tar to keep file permissions intact.

30/8:
* Release of the Android version, now runs completely on your phone.

28/8:
* Changed the Linux version to tar format to ensure that permissions are correctly set.
* Fixed the Cygwin version so it can make the data and system image files, they will be formatted on install and if it's a new installation you have to choose y to format the data image file or it will not have a filesystem.
* Changed a few misspellings in user interaction texts and tried to make it easier to understand.

Edited by Snap.IT, 19 December 2012 - 09:52 PM.

  • 2

#3
jakuza2

jakuza2

    Newbie

  • Members
  • Pip
  • 2 posts
  • Devices:zte blade
awesome, test this when got some time, thank you for your work!

  • 0

#4
Snap.IT

Snap.IT

    Addict

  • Members
  • PipPipPipPipPip
  • 861 posts
  • Gender:Male
  • Location:Stockholm, Sweden
  • Devices:ZTE Blade 3, Alcatel OT995

awesome, test this when got some time, thank you for your work!


I've used it on five different ROMs that i currently have installed, three different gapps packages, a lot of other packages and it works like a charm.

It's extremely easy to use.

  • 0

#5
jjk_charles

jjk_charles

    Newbie

  • Members
  • Pip
  • 3 posts
  • Devices:ZTE Blade
Can I assume this is a safe way (without causing any damage to the phone?) to test a custom built ROM (say, I compile something from source), without flashing it?

  • 0

#6
Snap.IT

Snap.IT

    Addict

  • Members
  • PipPipPipPipPip
  • 861 posts
  • Gender:Male
  • Location:Stockholm, Sweden
  • Devices:ZTE Blade 3, Alcatel OT995

Can I assume this is a safe way (without causing any damage to the phone?) to test a custom built ROM (say, I compile something from source), without flashing it?


That's how i use it and why i made this script, it'll save tons of time for me and any dev choosing to use it and it's universal.

You can run it as many times as you choose, i'm multibooting six roms right now and i make all installs via this script. Don't forget that you have to run makeloopgapps on EVERY script you want to install though, like bravia engine, awesome beats or what have you.

  • 0

#7
Snap.IT

Snap.IT

    Addict

  • Members
  • PipPipPipPipPip
  • 861 posts
  • Gender:Male
  • Location:Stockholm, Sweden
  • Devices:ZTE Blade 3, Alcatel OT995
I'm going to try to make a script to install the rom into the loop file on your computer.

Should be easy enough.

That way, all you would have to do is copy the system and data loop files to your phone and you can boot into them via a shell script.

It'll be in the next version, ETA is when it's ready.

  • 0

#8
tilal6991

tilal6991

    Hardcore

  • Developer Team
  • PipPipPipPipPipPip
  • 3,781 posts
  • Gender:Male
  • Devices:ZTE Skate, Huawei U8150
I've had a look at the shell scripts and wow. You've put a lot of effort in to this. Well done.

  • 0
If you like my work or if I helped, click the Plus button.

#9
Snap.IT

Snap.IT

    Addict

  • Members
  • PipPipPipPipPip
  • 861 posts
  • Gender:Male
  • Location:Stockholm, Sweden
  • Devices:ZTE Blade 3, Alcatel OT995

I've had a look at the shell scripts and wow. You've put a lot of effort in to this. Well done.


Thank you and yeah, heh, i tried to eliminat user problems and then i had to adapt it to cygwin, some of the solutions aren't pretty but they work with both and that was the intention. :)

I just realized that i need to put $SYS_NAME in the converted packages though or they will look the same for any rom and the update-script will differ.

Well either that or put the whole thing in a directory of $SYS_NAME which would probably be a better idea.

Again thank you, it means quite a bit coming from you. :)

Edited by Snap.IT, 25 August 2012 - 11:11 AM.

  • 0

#10
BabyAndroid

BabyAndroid

    Newbie

  • Members
  • Pip
  • 9 posts
  • Gender:Female
  • Location:UK
  • Devices:San Francisco 2
Would be cool if you could use this without a pc

  • 0

#11
Snap.IT

Snap.IT

    Addict

  • Members
  • PipPipPipPipPip
  • 861 posts
  • Gender:Male
  • Location:Stockholm, Sweden
  • Devices:ZTE Blade 3, Alcatel OT995

Would be cool if you could use this without a pc


I'm trying to compile gcc for android and get it to work but it doesn't seem to work (i know what the problem is, i just don't know how to sove it).

There is a chance that i can use a precompiled binary for android rather than compile it at script time but i'll still need a working version of gcc for android to do that.

When i have fixed it it could run on the phone, it's the only thing stopping it from running on the phone which would be ideal, i'm fairly sure that i could make an app for the entire thing.

  • 1

#12
Snap.IT

Snap.IT

    Addict

  • Members
  • PipPipPipPipPip
  • 861 posts
  • Gender:Male
  • Location:Stockholm, Sweden
  • Devices:ZTE Blade 3, Alcatel OT995
If anyone is familiar with a command line util to create loop files on windows i'd be much obliged.

It would be great to add to the second release along with some other fixes.

  • 0

#13
tilal6991

tilal6991

    Hardcore

  • Developer Team
  • PipPipPipPipPipPip
  • 3,781 posts
  • Gender:Male
  • Devices:ZTE Skate, Huawei U8150
Why do you need GCC for android? Can't you just cross compile binaries for Android using Linux?

  • 0
If you like my work or if I helped, click the Plus button.

#14
android@sam

android@sam

    Enthusiast

  • Members
  • PipPipPip
  • 259 posts
  • Gender:Male
  • Location:Nagpur,India
  • Interests:Computers, MObilez...
  • Devices:DELL XCD35 aka ZTE BLADE
Great work man.As tilal said,really you have put lot of efforts in the scripts.Well done.

  • 0

Sony Ericsson UI On your ZTE BLADE

"CYANSCAPE"


#15
tilal6991

tilal6991

    Hardcore

  • Developer Team
  • PipPipPipPipPipPip
  • 3,781 posts
  • Gender:Male
  • Devices:ZTE Skate, Huawei U8150
Right. A bit of feedback. And some good news.

For JB roms /sdcard/ in init.rc is wrong and should not be mounted - it should be /storage/sdcard0. It messes up the system completely and prevents sd card from being mounted and UMS from working.

Also I've updated my app to work so that you don't need script manager and the like - it dyanmically allows changing between ROMs. I'll post this soon - just testing now.

  • 2
If you like my work or if I helped, click the Plus button.

#16
Snap.IT

Snap.IT

    Addict

  • Members
  • PipPipPipPipPip
  • 861 posts
  • Gender:Male
  • Location:Stockholm, Sweden
  • Devices:ZTE Blade 3, Alcatel OT995

Right. A bit of feedback. And some good news.

For JB roms /sdcard/ in init.rc is wrong and should not be mounted - it should be /storage/sdcard0. It messes up the system completely and prevents sd card from being mounted and UMS from working.

Also I've updated my app to work so that you don't need script manager and the like - it dyanmically allows changing between ROMs. I'll post this soon - just testing now.


Hmmm, well that's easy enough to fix, thanks for the heads up. :)

Looking through the init.rc of a few JB's and there is nothing in them that sets them apart from ics versions.

I need something to grep.

Or will i have to make that another question from the script?

Edited by Snap.IT, 25 August 2012 - 08:19 PM.

  • 0

#17
tilal6991

tilal6991

    Hardcore

  • Developer Team
  • PipPipPipPipPipPip
  • 3,781 posts
  • Gender:Male
  • Devices:ZTE Skate, Huawei U8150
How about grepping build.prop? The version number?

Also on Skate custom ROMs which are based on stock weird stuff happens in the init.rc - double creation and mounting of sdcard and of system as well - not sure if this could apply to some Blade ROMs?

I don't have an example right now but I'll post one tomorrow.

Moreover some roms wipe data directly but this unfortunately is wiping NAND data not the sdcard loop ROM data. Is there a way that can be removed if present?

Also my app source is now up to date - I'll post an apk to test tomorrow but it can be compiled with eclipse etc if you want a look.

  • 0
If you like my work or if I helped, click the Plus button.

#18
Snap.IT

Snap.IT

    Addict

  • Members
  • PipPipPipPipPip
  • 861 posts
  • Gender:Male
  • Location:Stockholm, Sweden
  • Devices:ZTE Blade 3, Alcatel OT995

How about grepping build.prop? The version number?


Yeah, that'd work, i made it a question but i'll have a look at the build prop instead.

Also on Skate custom ROMs which are based on stock weird stuff happens in the init.rc - double creation and mounting of sdcard and of system as well - not sure if this could apply to some Blade ROMs?

I don't have an example right now but I'll post one tomorrow.

Moreover some roms wipe data directly but this unfortunately is wiping NAND data not the sdcard loop ROM data. Is there a way that can be removed if present?

Also my app source is now up to date - I'll post an apk to test tomorrow but it can be compiled with eclipse etc if you want a look.


I'll need an example, from what i've seen on the only ROM for the blade that is stock and i tested it on it adds one line that isn't needed but doesn't break anything either so i kinda ignored it, if you have examples then i'd be grateful if you attached them to a post so i can fix that. (my blade stock test was on SSRLS7)

An app for it sounds awesome and i'd love to take a look at the code, it could be injected by the script into the resulting loopinstall rom so it would be easy to switch roms. :)

Eventually i will probably make an app for running the entire script but that'll take a while because this is one of three projects i'm running concurrently.

I included makefs.Linux.armv6l and mkbootimg.Linux.armv6l and am testing it on my blade as i'm typing this.

  • 0

#19
tilal6991

tilal6991

    Hardcore

  • Developer Team
  • PipPipPipPipPipPip
  • 3,781 posts
  • Gender:Male
  • Devices:ZTE Skate, Huawei U8150
The sources are at github.com/tilal6991.

  • 0
If you like my work or if I helped, click the Plus button.

#20
Snap.IT

Snap.IT

    Addict

  • Members
  • PipPipPipPipPip
  • 861 posts
  • Gender:Male
  • Location:Stockholm, Sweden
  • Devices:ZTE Blade 3, Alcatel OT995

The sources are at github.com/tilal6991.


Awesom, i'll have a look see.

:)

Running the script on my phone now, dd takes forever to make a 500MB data loop file. :D

Some commands are different, causing the script to not work, like unzip, i'll fix that though.

  • 0




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users