Lg aristo 2 a2plus and k8plus>>> 64-bit kernel and mount 2nd partition of ext4 sd card at boot and more - General Topics

howdy folks the mad clown from memphis is back with more goodies for the Aristo 2, Aristo 2 plus and K8plus.
We have a 64bit kernel in the included magisk patched boot image plus a modification made to init.lge.fs.rc that will automatically mount the 2nd partition of your ext4 formatted external sdcard at boot to root folder called linux.
also included in the zip file is a proot binary and two script files. the first script file simply named linux will start a root file system in your linux folder as [email protected] from your terminal emulator the 2nd script resolves any intenet issues getting "apt" working in your linux rootfs distribution.
so heres how to do it.
1st flash the magisk patched boot image using fastboot or twrp. then reboot.
2. install aparted from the playstore and make repartition your external sdcard to have 2 partitions making sure that the first partition mmcblk1p1 is v-fat and the 2nd partition mmcblk1p2 is ext4. the modification made to the rc file will only mount mmcblk1p2 formatted as ext4 plus its rewritable.
3. copy the rootfs of your choice to the new root folder named linux. untar or unzip and paste the inetbutu.sh file as well into the folder.
4. boot into twrp and copy the linux script and proot binary to your system/bin folder and chmod both files 0755 and reboot
5. start your terminal emulator then type
su
linux
and you should see your [email protected] prompt change to [email protected] congratulations it was that easy to start a rootfs such as ubuntu on your device.
6. to get "apt" running properly just type
sh inetbutu.sh
and now you have a fully running and working linux distribution working on your cv1 device that you can use to do what ever you like with and hopefully in the future we can boot that distribution from LAF and have a native working OS boot on your cv1 device.
have fun enjoy and laugh away at all the fun things you can now do so easily. if any one has queations or for some reason needs help feel free to post.

Related

Ubuntu / Backtrack on Android [Complete Solution]

This guide had been on the Thunderbolt forum for quite some time and I decided it was time to share with the rest of the community
Having reviewed almost every other option I can safely and honestly say this is the most simplified, thorough, and customizable install available since its original launch. I will gladly retract this statement when it becomes false, but until then...
Installing Ubuntu onto Thunderbolt/Droid/Droid2/Etc:
Create a folder on the sdcard named ext2ubuntu, which is /sdcard/ext2ubuntu when listed in terminal or adb
Required files for Ubuntu install:
Ubuntu.sh http://db.tt/KgDNlMtb
Custom Packages for AutoConfig:
Coming soon
You will also want to download either an ubuntu image or archive. The major difference is that the image must be the same size as your ubuntu installation, so they are larger downloads, or need to be resized before you use them.
Ubuntu Prebuilt tar and img downloads:
(img: Extract only ubuntu.img and place in /sdcard/ext2ubuntu)
(tar: Rename, if desired, and put archive in /sdcard/ext2ubuntu)
10.04: http://android-cruft.googlecode.com/files/lucid-on-android-0.1.tar
(This image DOES need to be resized, see next post)
10.10 img: http://www.megaupload.com/?d=56AT71WD
(This image file does NOT need to be resized)
11.04 tar: http://db.tt/fuzoy8Te
Backtrack img: http://bit.ly/kJweA9
Borrowed from http://forum.xda-developers.com/showthread.php?t=1146255
(This image file does NOT need to be resized)
How to build your own Ubuntu Image:
http://androlinux.com/android-ubuntu-development/how-to-build-chroot-arm-ubuntu-images-for-android/
Notice:
The ubuntu mount folder is symlinked to /system/sd-ext allowing access to it there also.
First off you should have a running ubuntu install on your computer or at least a live cd running to create the ext2 partition.
Use gparted to add a 4gb (or whatever size you want) ext2 partition to your sdcard. I did this while the phone was mounted in disk drive mode, so you dont need to take the card out.
Ubuntu: Get gparted in synaptics or in terminal enter:
Code:
sudo apt-get install gparted
Widows: *Paragon Partition Manager*
If you do not need to partition, skip this step.
Use adb to run /sdcard/ext2ubuntu/ubuntu.sh
Code:
adb shell
su
sh /sdcard/ext2ubuntu/ubuntu.sh
Or from terminal (only supported on some ROMs)
Code:
su
bash /sdcard/ext2ubuntu/ubuntu.sh
All required scripts will download and install themselves automatically. Currently only ubuntu.sh and the chosen ubuntu image need to be placed in /sdcard/ext2ubuntu for proper install. Scripts include an autoupdate feature that will also keep them current.
Follow the instructions and select the appropriate options for your system configuration and download choices.
You can now open terminal and type "bootubuntu" to test install
A new Sdcard Direct option was added allowing user to replace the installed scripts with a unified "ubuntu" command that runs the scripts directly from the sdcard. This option was offered due to the frequency of updates to allow the user to simply replace the files in /sdcard/ext2ubuntu with newer versions that would run without any further steps.
If you get a localhost prompt, you are in but still need a couple things to move past command line.
Here is where we part from borrowed and modified instructions that recommend lxde and ice and all the dinky handheld ubuntu shells, and move to the Thunderbolt method.
Update vs Restore scripts: Update will base what scripts are put in system on the ones currently there, while restore determines what scripts are currently available on the sdcard.
For automatic installation of ubuntu applications, you will want to enter these commands next:
Code:
su
backubuntu
4
Choose your options
To view your ubuntu desktop, you will want a vnc viewer for android. I use real vnc, but android-vnc-viewer is free and has all the same features (i just liked the layout of realvnc)
The address for ubuntu is 127.0.0.1
The port is 5901
The password is the tightvncserver one you set.
i recommend making a folder named android in "your mounted ubuntu folder"/home/ for your personal files since /root is your local folder, but causes permission issues.
From your new ubuntu you can use synaptics and download eclipse there, but it can also be downloaded from the localhost prompt using "apt-get install eclipse" I also recommend downloading the android-sdk. To run the sdk from the localhost prompt, simply cd to the android-sdk directory and issue the command:
Code:
tools/android update sdk -u -s
and if you want to specify the downloads performed add
Code:
-t [specific items such as platform, platform-tool]
If you need help with any commands you can add
Code:
-h
to your existing command
The htc kitchen can be downloaded from ubuntu using the same instructions found: http://forum.xda-developers.com/showthread.php?t=633246
After it is installed, you have the option to launch this kitchen either from inside your ubuntu install, or from the localhost prompt, which avoids having to run vnc to use it.
A compiler toolchain is available http://www.codesourcery.com/sgpp/lite/arm by choosing download the latest release. I use gnu/linux even though it seems to be eabi included in the android source, but I have never used it to be sure. I have been told this one is a lot easier to use anyway.
I recommend backing up the ext2 once everything is done. This can be done by (entering "exit" at the localhost prompt and then) entering "backubuntu" in terminal.
backubuntu can also update newly downloaded scripts without having to use root explorer or worry about permissions. Just put any new versions in your sdcard/ubuntu folder and select the update option.
This replaces the ubuntu2.img with your backup so you dont have to "apt-get" everything over again. This will also save your tightvnc password so make sure you remember it.
Sent from my ADR6400L using Tapatalk
Screenshots:
https://picasaweb.google.com/110545...authkey=Gv1sRgCLDd48n2oMWzpAE&feat=directlink
References:
Personal insanity and the inability to accept whats already available
http://code.google.com/p/android-cruft/wiki/LucidWithAndroid
http://androlinux.com/android-ubuntu-development/how-to-install-ubuntu-on-android/
http://nexusonehacks.net/nexus-one-hacks/how-to-install-ubuntu-on-your-android/
http://forum.cyanogenmod.com/topic/15702-ubuntu-on-your-g2-anyone/
http://forum.xda-developers.com/showthread.php?t=633246
http://www.codesourcery.com/sgpp/lite/arm
http://forum.xda-developers.com/showthread.php?t=987740
http://androidclone.com/forums/showthread.php?tid=23
Sent from my ADR6400L using Tapatalk

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

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

[HOWTO] Dual-boot Android ROMs, e.g. CROMI-X and CM

Tired of backup, wipe, flash, backup, wipe, restore, ... just to try a different ROM?
Today we will cook a nice tasty dual-boot for the TF700T. You will have two separate environments with different ROMs, apps and data that share only the common Linux kernel binary.
Difficulty: medium. No programming skills required, but not for noobs.
Ingredients
1 TF700T running a rooted stock-based ROM with busybox and a kernel with preinit support (hint: -that kernels work fine )
1 PC running Linux with a microSD card reader
1 fast microSD card with at least 4 GB
1 CyanogenMod 10.2 nightly ZIP (should also work for other ROMs - post your results)
1 seasoned chef
Time required: about 30 to 45 minutes.
Directions
Preheat oven to 220 degree celsius ... oops, wrong recipe.
If done right, the internal ROM and its data are perfectly safe. But I assume you have a backup nevertheless - don't blame me if anything goes wrong.
Prepare the microSD card
Insert microSD card into PC card reader. Using gparted, create and format 3 primary partitions:
p1: fat32, this will be your external sdcard as before.
p2: ext4, this will become /data
p3: ext4, this will become /system
Make sure to align the partitions to MiB, or even better multiples of 4 MiB. This may improve I/O performance.
In most cases you can simply shrink the existing FAT32 partition and then create the remaining ext4 partitions.
Partition 3 should be 700 to 800 MB - anything bigger is a waste of space, and anything smaller than 500 MB might cause problems.
Partition 2 will be your whole "internal storage" for the second operating system, so size it according to your storage needs for apps, app data and the emulated /sdcard.
I am using a Samsung 16 GB card with the following partition sizes:
p1: ~ 8 GB
p2: ~ 6 GB
p3: ~ 800 MB
Prepare the new ROM
Before installing the second ROM to the microSD card, the ZIP file must be slightly modified. I assume you know how to unpack and repack a ZIP file and how to use a text editor - if not, find a tutorial elsewhere. .
Note: This step can now be automated, see http://forum.xda-developers.com/showpost.php?p=47333729&postcount=31
To do it manually:
First, extract boot.blob and set it aside for later. Then carefully remove it from the ZIP. Second, find META-INF/com/google/android/updater-script and modify it:
Replace all occurrences of mmcblk0p1 with mmcblk1p3. I had 3 occurrences in CM's updater-script - make sure you modify all of them, otherwise your internal ROM might not survive the installation. This change will redirect the installation to the external microSD card. Finally, remove the line that says package_extract_file("boot.blob", ...) near the end - it would overwrite the kernel and we don't want that.
Now we need to add the WiFi modules. These are compiled directly into the CM kernel, but separate modules in the stock kernel.
Get the kernel modules from your running ROM - they are in /system/lib/modules (e.g. using adb pull /system/lib/modules), and copy at least these two into the ZIP into /system/lib/modules:
cfg80211.ko
bcmdhd.ko (note: for TF300, I think you need bcmdhd_29.ko instead)
Finally, repack the ZIP, mount the first partition of your microSD card and copy the ZIP file there.
Extract the ramdisk files
Note: This step can now be automated, see http://forum.xda-developers.com/showpost.php?p=47333729&postcount=31
To do it manually:
Here comes the tricky part. You need to extract the ramdisk from the boot.blob you saved from the ZIP file in the previous step.
To do that, you need tools that may not be in every household, but should be easy to find using your favorite search engine. In case you have trouble finding and/or compiling them, you can find the result of this step in post #2.
First we need to unpack the blob (https://github.com/AndroidRoot/BlobTools):
Code:
blobunpack boot.blob
This will create boob.blob.LNX. This is the boot image, from which we need to extract the ramdisk (https://github.com/huaixzk/unpackbootimg):
Code:
unpackbootimg -i boot.blob.LNX
This will create several files, we are interested in boot.blob.LNX-ramdisk.gz - copy this one to your tablet, e.g. into /sdcard. For example:
Code:
adb push boot.blob.LNX-ramdisk.gz /sdcard/
Prepare the preinit script and the ramdisk files
Note: This step can now be automated, see http://forum.xda-developers.com/showpost.php?p=47333729&postcount=31
To do it manually:
On the tablet, open a shell in a terminal app or use adb shell and become root (su). Run the following commands:
Code:
mount -o remount,rw /system
cd /system
mkdir boot
cd boot
mkdir rootfs_cm
cd rootfs_cm
gzip -d -c /sdcard/boot.blob.LNX-ramdisk.gz | cpio -i
The first line makes /system writable until the next reboot. The next few lines are self-explanatory. The last line uncompresses the ramdisk image we created in the previous step and extracts the contained files. We are doing this on the tablet itself to preserve the file permissions.
Now modify the file fstab.cardhu (one of the files just extracted).
Replace mmcblk0p1 with mmcblk1p3 and mmcblk0p8 with mmcblk1p2.
mmcblk0p2 can stay as it is, it's the /cache partition that is only used to communicate with the recovery.
Next we need to make sure the WiFi modules that we added are loaded at boot time. Edit init.cardhu.rc and find the "on boot" line. Add below (indentation is important):
Code:
insmod /system/lib/modules/cfg80211.ko
insmod /system/lib/modules/bcmdhd.ko
Near the end of init.cardhu.rc is another reference to mmcblk0p8 that needs to be modified to mmcblk1p2 - near "service setup_fs".
Finally create the file /system/boot/preinit with the following content:
Code:
#!/system/bin/sh
# preinit: only /sys and /system are mounted (ro), / is still rw
PATH=/sbin:/system/bin:/system/xbin
# auto-detect rom2sd
if [ -d /sys/block/mmcblk1/mmcblk1p3 ]; then
echo "\nsystem/boot/preinit: mmcblk1p3 detected, setting up for ROM2SD.\n"
cp -a /system/boot/rootfs_cm/* /
fi
Make sure to make it executable:
Code:
chmod 744 /system/boot/preinit
This script is run by the kernel before the real Android init. It. detects if a microSD card with 3 partitions is inserted, and if yes, it copies the files for the CM root filesystem into the ramdisk. The following Android boot procedure will then mount /system and /data to the partitions on the microSD card and the whole operating system will run from the microSD card. If no card is inserted, nothing is modified and the normal internal ROM is started.
Flashing the ROM
Insert your microSD card into the tablet, boot to TWRP and flash your modified ZIP as usual - but disable signature checking because we didn't sign the modified ZIP.
Recovery
The recovery doesn't know about the external ROM, so you can't use the recovery to backup or restore its system or data. I prefer using the PC for that anyway.
Booting
To boot from internal storage, make sure the microSD card is not inserted when you start the tablet (you can insert it as soon as the boot animation appears). To boot from the microSD card, make sure it is inserted before you turn the tablet on.
That's all. Add more microSD cards for triple-boot, quad-boot, etc.
Notes
My kernel currently has not enabled SELINUX in the config, but CM appears to work anyway.
Update: -that6 enables SELinux.
Shortcut
In case you don't want to extract the CM ramdisk from the blob yourself (or you have trouble finding/compiling the tools to do so), you can try using mine - from my unofficial build of cm-10.2-20131024: View attachment boot.blob.LNX-ramdisk.gz
Automated solution
See http://forum.xda-developers.com/showpost.php?p=47333729&postcount=31
(reserved for additions)
_that said:
Tired of backup, wipe, flash, backup, wipe, restore, ... just to try a different ROM?
Today we will cook a nice tasty dual-boot for the TF700T. You will have two separate environments with different ROMs, apps and data that share only the common Linux kernel binary.
Difficulty: medium. No programming skills required, but not for noobs.
Ingredients
1 TF700T running a rooted stock-based ROM with busybox and a kernel with preinit support (hint: -that kernels work fine )
1 PC running Linux with a microSD card reader
1 fast microSD card with at least 4 GB
1 CyanogenMod 10.2 nightly ZIP (should also work for other ROMs - post your results)
1 seasoned chef
Time required: about 30 to 45 minutes.
Directions
Preheat oven to 220 degree celsius ... oops, wrong recipe.
If done right, the internal ROM and its data are perfectly safe. But I assume you have a backup nevertheless - don't blame me if anything goes wrong.
Prepare the microSD card
Insert microSD card into PC card reader. Using gparted, create and format 3 primary partitions:
p1: fat32, this will be your external sdcard as before.
p2: ext4, this will become /data
p3: ext4, this will become /system
Make sure to align the partitions to MiB, or even better multiples of 4 MiB. This may improve I/O performance.
In most cases you can simply shrink the existing FAT32 partition and then create the remaining ext4 partitions.
Partition 3 should be 700 to 800 MB - anything bigger is a waste of space, and anything smaller than 500 MB might cause problems.
Partition 2 will be your whole "internal storage" for the second operating system, so size it according to your storage needs for apps, app data and the emulated /sdcard.
I am using a Samsung 16 GB card with the following partition sizes:
p1: ~ 8 GB
p2: ~ 6 GB
p3: ~ 800 MB
Prepare the new ROM
Before installing the second ROM to the microSD card, the ZIP file must be slightly modified. I assume you know how to unpack and repack a ZIP file and how to use a text editor - if not, find a tutorial elsewhere. .
First, extract boot.blob and set it aside for later. Then carefully remove it from the ZIP. Second, find META-INF/com/google/android/updater-script and modify it:
Replace all occurrences of mmcblk0p1 with mmcblk1p3. I had 3 occurrences in CM's updater-script - make sure you modify all of them, otherwise your internal ROM might not survive the installation. This change will redirect the installation to the external microSD card. Finally, remove the line that says package_extract_file("boot.blob", ...) near the end - it would overwrite the kernel and we don't want that.
Now we need to add the WiFi modules. These are compiled directly into the CM kernel, but separate modules in the stock kernel.
Get the kernel modules from your running ROM - they are in /system/lib/modules (e.g. using adb pull /system/lib/modules), and copy at least these two into the ZIP into /system/lib/modules:
cfg80211.ko
bcmdhd.ko
Finally, repack the ZIP, mount the first partition of your microSD card and copy the ZIP file there.
Extract the ramdisk files
Here comes the tricky part. You need to extract the ramdisk from the boot.blob you saved from the ZIP file in the previous step.
To do that, you need tools that may not be in every household, but should be easy to find using your favorite search engine.
First we need to unpack the blob (https://github.com/AndroidRoot/BlobTools):
Code:
blobunpack boot.blob
This will create boob.blob.LNX. This is the boot image, from which we need to extract the ramdisk (https://github.com/huaixzk/unpackbootimg):
Code:
unpackbootimg -i boot.blob.LNX
This will create several files, we are interested in boot.blob.LNX-ramdisk.gz - copy this one to your tablet, e.g. into /sdcard. For example:
Code:
adb push boot.blob.LNX-ramdisk.gz /sdcard/
Prepare the preinit script and the ramdisk files
On the tablet, open a shell in a terminal app or use adb shell and become root (su). Run the following commands:
Code:
mount -o remount,rw /system
cd /system
mkdir boot
cd boot
mkdir rootfs_cm
cd rootfs_cm
gzip -d -c /sdcard/boot.blob.LNX-ramdisk.gz | cpio -i
The first line makes /system writable until the next reboot. The next few lines are self-explanatory. The last line uncompresses the ramdisk image we created in the previous step and extracts the contained files. We are doing this on the tablet itself to preserve the file permissions.
Now modify the file fstab.cardhu (one of the files just extracted).
Replace mmcblk0p1 with mmcblk1p3 and mmcblk0p8 with mmcblk1p2.
mmcblk0p2 can stay as it is, it's the /cache partition that is only used to communicate with the recovery.
Next we need to make sure the WiFi modules that we added are loaded at boot time. Edit init.cardhu.rc and find the "on boot" line. Add below (indentation is important):
Code:
insmod /system/lib/modules/cfg80211.ko
insmod /system/lib/modules/bcmdhd.ko
Near the end of init.cardhu.rc is another reference to mmcblk0p8 that needs to be modified to mmcblk1p2 - near "service setup_fs".
Finally create the file /system/boot/preinit with the following content:
Code:
#!/system/bin/sh
# preinit: only /sys and /system are mounted (ro), / is still rw
PATH=/sbin:/system/bin:/system/xbin
# auto-detect rom2sd
if [ -d /sys/block/mmcblk1/mmcblk1p3 ]; then
echo "\nsystem/boot/preinit: mmcblk1p3 detected, setting up for ROM2SD.\n"
cp -a /system/boot/rootfs_cm/* /
fi
Make sure to make it executable:
Code:
chmod 744 /system/boot/preinit
This script is run by the kernel before the real Android init. It. detects if a microSD card with 3 partitions is inserted, and if yes, it copies the files for the CM root filesystem into the ramdisk. The following Android boot procedure will then mount /system and /data to the partitions on the microSD card and the whole operating system will run from the microSD card. If no card is inserted, nothing is modified and the normal internal ROM is started.
Flashing the ROM
Insert your microSD card into the tablet, boot to TWRP and flash your modified ZIP as usual - but disable signature checking because we didn't sign the modified ZIP.
Recovery
The recovery doesn't know about the external ROM, so you can't use the recovery to backup or restore its system or data. I prefer using the PC for that anyway.
Booting
To boot from internal storage, make sure the microSD card is not inserted when you start the tablet (you can insert it as soon as the boot animation appears). To boot from the microSD card, make sure it is inserted before you turn the tablet on.
That's all. Add more microSD cards for triple-boot, quad-boot, etc.
Click to expand...
Click to collapse
It is a nice detail instruction for new users like me. I really like it a lot and I can use some information from your post for my system2sd... However, maybe I misread your post. I don't see any information about repack the blob when you are done modifying the fstab.cardhu. I know a little bit of ramdisk and can get around it but that information will help the first time users... Just my opinion and thanks for sharing a valuable information to us...
LetMeKnow said:
However, maybe I misread your post. I don't see any information about repack the blob when you are done modifying the fstab.cardhu.
Click to expand...
Click to collapse
That's because you don't need to repack the blob or reflash the kernel - I wanted to simplify the procedure, so I added preinit support to the kernel's ramdisk a few months ago. You just put some files in /system/boot and the kernel will run your preinit script that modifies the ramdisk at boot time.
Just remember that if you reflash your internal ROM, you have to recreate the /system/boot stuff.
_that said:
That's because you don't need to repack the blob or reflash the kernel - I wanted to simplify the procedure, so I added preinit support to the kernel's ramdisk a few months ago. You just put some files in /system/boot and the kernel will run your preinit script that modifies the ramdisk at boot time.
Just remember that if you reflash your internal ROM, you have to recreate the /system/boot stuff.
Click to expand...
Click to collapse
Oop, I forgot that you use it in your boot folder... It is my bad.. I will give it a try when I am done with my system2sd testing and will ask more questions on the way.. Thanks for the information...
Cheers,
LMK
_that said:
Notes
My kernel currently has not enabled SELINUX in the config, but CM appears to work anyway.
(reserved for additions)
Click to expand...
Click to collapse
You should be fine until I enforce SELINUX. But I haven't finished the policies yet. Still have some issues to iron out with that. Have about 90% of them done, I think.. lol
Just out of curiosity, will this only work with primary partitions?
johnlgalt said:
Just out of curiosity, will this only work with primary partitions?
Click to expand...
Click to collapse
It should also work with logical partitions if you modify the partition numbers accordingly. And please remove the full quote of my guide from your post, we should not emulate an Outlook-style mess in the forum.
Sent from my ASUS Transformer Pad TF700T using Tapatalk 4
_that said:
It should also work with logical partitions if you modify the partition numbers accordingly. And please remove the full quote of my guide from your post, we should not emulate an Outlook-style mess in the forum.
Sent from my ASUS Transformer Pad TF700T using Tapatalk 4
Click to expand...
Click to collapse
Yeah, I quoted it that way b/c I was asking specifically about that part - but it that part works I suppose the rest would too, huh? :silly:
Wow
Thx for this, easy cheesey, Great work, Love the dual boot!!!!
_that said:
Tired of backup, wipe, flash, backup, wipe, restore, ... just to try a different ROM?
Today we will cook a nice tasty dual-boot for the TF700T. You will have two separate environments with different ROMs, apps and data that share only the common Linux kernel binary.
Click to expand...
Click to collapse
Is there any chance *someone with the required skills* could port bootmanager to our device?
BootManager
it would be the best, considering that your method uses the same load-from-sdcard thing.
Just curious thats all.
kali113 said:
Is there any chance *someone with the required skills* could port bootmanager to our device?
BootManager
it would be the best, considering that your method uses the same load-from-sdcard thing.
Just curious thats all.
Click to expand...
Click to collapse
Looks like commercial software, so ask the devs of that app.
Here is an experimental flashable zip file that redirects the TWRP recovery to the ROM2SD environment. It doesn't really install anything to storage, it just reconfigures the device nodes so that the recovery is tricked into accessing the system and data partitions on the microSD card instead of internal storage.
It works so well that after "installing" this, a following ROM install that unmounts and formats /system and installs itself to /system on mmcblk0p1 will actually be installed on the microSD card, so you don't need to replace the partition names in the updater-script any longer (but you still need to comment out the blob flashing line for now or reflash my kernel after the ROM).
It also works so well that after "installing" this, you don't see your internal /sdcard any longer, so put whatever you want to flash on the first partition of the external microSD card.
"Installing" the script again will undo its actions, so you can toggle back and forth between external and internal storage.
Warning: I tested this only once, and the script does not have any error handling - if the inserted microSD is not prepared for ROM2SD, behavior is undefined - most likely the recovery will complain that it can't mount system or data. Use this at your own risk and make sure you have backed up all valuable data and your ROM, just in case.
View attachment dev-rom2sd.zip
The script also contains a nice example how to output text from a shell script to the recovery console. It shows a list of device nodes so you can see what the script did (the device numbers of mmcblk0p1 and mmcblk1p3 are identical).
Can I follow this guide to have paranoid rom on internal and cromi-x rom on microsd?
vnphatbuddha said:
Can I follow this guide to have paranoid rom on internal and cromi-x rom on microsd?
Click to expand...
Click to collapse
I've never tried PA but it may work if you use my kernel and modify the preinit script accordingly (my kernel contains a stock-compatible ramdisk, so you need to copy the PA ramdisk to / if the microSD is *not* inserted).
_that said:
I've never tried PA but it may work if you use my kernel and modify the preinit script accordingly (my kernel contains a stock-compatible ramdisk, so you need to copy the PA ramdisk to / if the microSD is *not* inserted).
Click to expand...
Click to collapse
sorry for such a noob question but how do you compile the zips from the git links to an executable? Or does the bloobtool and unpackbootimg able to run from its extracted zips? slightly new to this...
vnphatbuddha said:
sorry for such a noob question but how do you compile the zips from the git links to an executable? Or does the bloobtool and unpackbootimg able to run from its extracted zips? slightly new to this...
Click to expand...
Click to collapse
You need to compile the blobtools on git. extract the .zip and run blobunpack on the .blob then abootimg -x on the boot.img.to repack: abootimg --create *new-bootimg* - k *zImage* -r *ramdisk*, then repack the .blob
and/or
follow this tutorial from the blob master himself http://forum.xda-developers.com/showpost.php?p=36925180
JoinTheRealms said:
You need to compile the blobtools on git. extract the .zip and run blobunpack on the .blob then abootimg -x on the boot.img.to repack: abootimg --create *new-bootimg* - k *zImage* -r *ramdisk*, then repack the .blob
and/or
follow this tutorial from the blob master himself http://forum.xda-developers.com/showpost.php?p=36925180
Click to expand...
Click to collapse
The problem I'm having is that I do not know how to use git to compile. What are the commands and do I input it in the top search bar of the site?
vnphatbuddha said:
The problem I'm having is that I do not know how to use git to compile. What are the commands and do I input it in the top search bar of the site?
Click to expand...
Click to collapse
You don't use git to compile, you use it to manage the source code.
To compile the source code, you need the appropriate development tools installed (I think it's called "build-essential" on Debian-like distributions) and run "make" in the directory with the extracted source code.
_that said:
You don't use git to compile, you use it to manage the source code.
To compile the source code, you need the appropriate development tools installed (I think it's called "build-essential" on Debian-like distributions) and run "make" in the directory with the extracted source code.
Click to expand...
Click to collapse
Wow this is too complicated to compile, having to setup and run debian on usb. Guess I can't try out rom2sd

[DUAL_BOOT]Dual booting an android phone with an extrrnal SD card

So here you come. To read and perform this tutorial, you obviously need a first hand experience on flashing a ROM and/or kernels. Otherwise this tutorial and my efforts to get you a device with two OSes running might end up giving you a bricked device. So, if you're hearing the terms "flashing" or 'kernels' for the first time and thinking it's kinda good food, then bro, just go and taste those first.
Something's to remind before we gonna dig deep into this tutorial->
1> Noone but you will be responsible for what you end up with.
2> The warranty of your device will be voided after this if it isn't already after rooting. For MI users, the good news is that you can reclaim it by just flashing the fastboot ROM for your device.
Enough lectures. Bro let's get to work.
This you'll be needing =>
1> One working Windows PC(because I doesn't know any replacement of bootimg.exe on any other OS. If you know, then let me).
2> A class 10 memory card ( I recommend 32GB for the spaces)
3> A custom ROM and kernel for your phone(the second os)
4> Any custom CWM based recovery installed.(since TWRP is most popular, I will demonstrate using it. You can use any other you want overall process will be the same)
5> ADB, fastboot and the device drivers (easily found in XDA)
PART 1: MODIFYING THE BOOT
At first, how does your device boots up? What are the partitions called /data and /system? The answer is quite simple. It's your kernel that points out the location from where the OS should be picked up. So for booting into the second OS we need some modifications to it at first.
Search and download bootimg.exe on XDA, I'll post a link later. Create two folders. Name them "Internal OS" and "External OS" respectively. Put the zip file of the OS you're currently using to the first one and the OS you're gonna use on the external storage to the second one. Rename the second OS to originalExternalOS.zip. Extract originalExternalOS.zip. Pick the boot.img file from the root of the extracted folder and move it to a new folder named "boot2". Extract the IMG using bootimg.exe. Navigate to the initrd folder and you will get a file named 'fstab".
Basically it's the file that tells the kernel which partition does the OS resides in.
Open the file in your favourite text editor.
Replace every instance of the first line with the second one:
/dev/block/bootdevice/by-name/system => /dev/block/mmcblk1p2
/dev/block/bootdevice/by-name/userdata => /dev/block/mmcblk1p3
/dev/block/bootdevice/by-name/cache => /dev/block/mmcblk1p4
Save the file without giving any extension to it. Repack it using the same tool. You'll have boot-new.img and boot-old.img. Rename boot-new.img to boot.img and replace the one in the root folder with this. Basically what we're doing here is replacing the old boot.img with the modified one.
For your knowledge, blocks are the partitions of any storage you have on your device. For example, your internal storage is partitioned to near about 30 different blocks each starting with prefix "mmcblk0p". We here just told the kernel to load the OS from the blocks mentioned. We'll be creating these blocks in the external SD card next.
PART 2: PARTITIONING THE SD CARD
Connect your device with the memory card inserted to your PC. If you haven't installed fastboot, ADB, and the drivers, do it now.
READ THE FOLLOWING CAREFULLY
Reboot the device to recovery mode. Type the commands in cmd:
Code:
adb shell
parted
unit MB
print
quit
umount external_sd
Read and store the minimum and maximum capacity of your card. Since different cards will have different capacities I will point it as variable MIN_SIZE and MAX_SIZE. You'll need to calculate and put the values in the commands. Now type the following commands on cmd:
Code:
parted /dev/block/mmcblk1
rm 1
//START_BLOCK = MAX_SIZE - 5000
mkpartfs primary fat32 MIN_SIZE START_BLOCK
//SYS_START = START_BLOCK+1
//SYS_END = SYS_START + 1200
mkpartfs primary ext2 SYS_START SYS_END
//DATA_START = SYS_END+1
//DATA_END = DATA_START + 3500
mkpartfs primary ext2 DATA_START DATA_END
//CACHE_START = DATA_END + 1
mkpartfs primary ext2 CACHE_START MAX_SIZE
//We have partitioned the memory card. Let's format them. Ignore all "Do you wish to continue" question in the next commands as we're already mentioning yes.
mkfs yes 1 fat32
mkfs yes 2 ext2
mkfs yes 3 ext2
mkfs yes 4 ext2
quit
//Now they are almost ready. Just make the newly created blocks readable by the OS.
make_ext4fs /dev/block/mmcblk1p2
make_ext4fs /dev/block/mmcblk1p3
make_ext4fs /dev/block/mmcblk1p4
//Now you get where does the blocks come in the kernel right?
exit
//You've covered up the hardest part. Let's get some coffee and cheeerssss.
PART 3: MODIFYING THE NEW OS
You've left the OS extracted in the "External OS" folder right? It's time to do some magic in it. We're gonna tell the OS to be installed in the blocks we created just like the kernel. But wait, where does the OS know before installing where it should get installed? Well, the answer hides in the updater-script in the folder META-INF > com > google > android. Navigate yourself in it. Open the updater-script file in your favourite editor ( I use notepad++ ) and modify it in the same way as the kernel.
Replace every instance of the first line with the second one:
/dev/block/bootdevice/by-name/system => /dev/block/mmcblk1p2
/dev/block/bootdevice/by-name/userdata => /dev/block/mmcblk1p3
Leave the /dev/block/bootdevice/by-name/boot as it's the fundamental block and we can't replicate it. Don't think for the /cache partition as we've already done that in the boot.img file. Now navigate to the root of the folder where you extracted the External OS. Select all files, add them to a zip file using WinRAR. Name the file to newOS.zip. Open newOs.zip and originalExternalOS.zip with WinRAR and compare them if you find any change in the folder tree. They must and they should be exactly the same. You're 80% done.
PART 4: MODIFYING THE RECOVERY
We often flash many zips including very popular Xposed and other mods to our OS right? They also look for the /system partition. So what are we gonna do? Modifying each of them? Nah. Let's modify where they get which one the /system is. The recovery. Extract the img of the recovery you're using with the same bootimg.exe. Modify exactly the same things. I.e.
Replace every instance of the first line with the second one:
/dev/block/bootdevice/by-name/system => /dev/block/mmcblk1p2
/dev/block/bootdevice/by-name/userdata => /dev/block/mmcblk1p3
/dev/block/bootdevice/by-name/cache => /dev/block/mmcblk1p4
in the following files : initrd/fstab.qcom
initrd/etc/recovery.fstab
initrd/etc/twrp.fstab(For TWRP only)
Save them. Repack. And you got your recovery-new.img and recovery-old.img. Put recovery-new.img and newOS.zip in the same folder. Now wake up, it's time for some action.
PART 5 : INSTALLING THE OS
Open cmd in the folder where newOS.zip resides. Reboot the devixe in fastboot mode. Type the following commands:
Code:
adb push newOS.zip external_sd
fastboot flash recovery recovery-new.img
fastboot boot recovery
Now your device should boot up in recovery mode. To check if everything has gone fine mount system using TWRP. Use twrp's built in file manager and navigate to system folder. It's empty? Yup. You've done a great job. Now flash the newOS.zip using TWRP and your device should boot up in the new OS. To cross check again remove the SD card and try to boot. If you're headed towards recovery or bootloop after that then it's a win. Put the SD card back again and watch the new OS to boot.
PART 6: SWITCHING BETWEEN THE TWO
Extract the boot.img from the "Internal OS" zip file and put it together with recovery-old.img. To check if your old system is untouched type the following commands in fastboot mode:
Code:
fastboot flash recovery recovery-old.img
fastboot flash boot boot.img
fastboot boot system
Your device should take you back to the old one. Surprised? Now let's make a switch between the two. There are two methods.
METHOD 1: USING FLASHIFY
Create two folders in your SD card. Put boot.img and recovery-old.img to one and boot-new.img and recovery-new.img to the other. To switch to the external OS, just flash boot-new.img as boot and recovery-new.img using flashify. Ignore reboot now dialog and reboot directly to the system. To go back, first install flashify in the new OS and flash boot.img and recovery-old.img. Easy right?
METHOD 2: USING ZIPS
I'm gonna tell you that tomorrow as I can write no more today.
More to come....
CREDITS:
justzzshadz from MIUI forum for this revolutionary concept. @iamsubhranil for adding TWRP, Flashify support and completely rewriting the tutorial.

[testers needed]Help]dualboot lg aristo 2 and cv1 Native ubuntu on sdcard plus kali-linux kernel [Help[testers needed]

howdy folks im currently in development of bringing Ubuntu touch and Native Ubuntu to the lge cv1 devices including the Aristo 2, Aristo 2 plus and K8 plus.
Oreo roms only!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
i have had a really hard time trying to bring this too and to be honest most of the work ive done has been Kernel related as Ubuntu touch and Ubuntu need systemd/upstart kernels to boot into the rootfs and beyond.
oreo roms only !!!!!!!!!!!!!!!!!!!!!!
ive also added kali-linux-nethunter support to the kernels as well for all of you ethical hackers that want to use it for protecting yourself from the blackhat hackers out there or a lil bit of both. Duhjoker doesnt judge just compiles the kernels for you.
DUALBOOT
one added benifit is that one kernel dual boots to android and a native Ubuntu rootfs of your choice. both kernels will boot ubuntu touch or ubuntu natively but the second kernel has ubuntu security requirements like apparmor enabled that break android.
Ubuntu Touch
is still in development as im needing a solid system.img. Right now i have been working on an armhf GSI thats also non trebler. the GSI is complete and has vendor built into it but im having trouble getting the lxc container inside the rootfs to start android.
that means no GUI but it will boot into the ubuntu touch rootfs. it will also boot into any ubuntu armhf root file system from ubuntu 14 to 18.
this is where i need help. the system is quite capable of booting to the rootfs and beyond but i cant figure out how to go beyond on the non-UT rootfs.
im including some downloads
a boot.img that has commandline arguments built in to allow you to boot ubuntu from your external sdcard.
dualboota2p.zip that flashes the Kali_NeHunter dualbooting kernel to your boot image
fullubuntukernel.zip which flashes the full ubuntu non-dualboot kernel to the cli modified boot images described above
arm-ramdisk-installer zip that flashes a generic ubuntu ramdisk to your boot image.
a /lib/modules and /boot folder to add to your rootfs that has all the modules needed by the rootfs and boot folder requirements needed like a config and vmlinuz
you will need:::::
cv1 device = aristo 2, aristo 2 plus or k8 plus
32gb or higher (im using a 128gb) external sdcard split into two partition vfat for partition 1 and ext4 for partition 2
an armhf ubuntu root file system of your choice between 14 and 18 or choose a kali rootfs
basic knowledge of linux comnands and setting up a rootfs for ssh and internet
patience and know how
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
I AM IN NO WAY RESPONSIBLE FOR ANY
DAMAGE CAUSED TO YOUR DEVICE BY ATTEMPTING THE PRICEDURES BELOW YOUR WARRANTY IS NOW VOID
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
now it seems like a lot of flashing but its to make it easier to get started with dual booting from your external sdcard. And i know some people like to make sure thier boot image matches thier device so the comnandline arguments are
root=/dev/mmcblk1p2 rootwait rw rootfstype=ext4
now to make it easier for you to chroot into the native ubuntu envirinment on your device so you do configuring offline and set things up you will need to add these lines to init.rc under mkdir /mnt/appfuse 0711 root root.
mkdir /linux 0755 root root
mount ext4 /dev/block/mmcblk1p2 /inux rw
that will automatically mount the second partition of your ext4 formatted external sdcard to a folder called /linux in the root of your device as well as make it rewritable.
note: after much experimentation i chose to use init.rc as on oreo any other place i put the commands had no effect.
if you want to try an initd command the kernel and rom support it just add an init.d folder to /system/etc from TWRP RECOVERY and place your script in init.
the following procedure is to build up rootfs
download and copy an ubuntu or kali armhf rootfs.tar.gz to the /linux folder
type these commands into your terminal on your cv1 device
su
cd /linux
tar xvzf your-rootfs.tar.gz
cd /
chroot /linux /bin/bash
export PATH="$PATH:/usr/sbin:/sbin:/bin"
apt-get update
apt-get install build-essential lightdm openssh-server
once thats done setup ssh for your device so when it boots into the rootfs you can use ssh to problem solve and get the GUI working
now you should reference this for how i got the idea and how i got this far.
https://www.reddit.com/r/lgv20/comments/bqp7f3
you will need to compile install and make a service for msm-framebuffer-refresher
add the /lib/modules and /boot zip to your rootfs and grab all your firmware from etc vendor and root and copy them to /lib/firmware of your rootfs
go ahead and grab that kali firmware from the magiskk repo too.
you should already be testing out the dualboot kernel i hope and now you that you have set up lets move to flashing
boot to twrp and flash the provided boot.img or your own modified boot.img then flash the full ubuntu kernel if you like or leave it on the dualboot kernel. now flash the ramdisk installer and reboot
it will go to first lge bootsplash then then bootloader unkock warning then boot to first android lge bootsplash.
you have now booted into the ubuntu rootfs.
But wait theres no GUI
i have mentioned that already.
heres where i need help and testing. i have not been able to go any further as my expertise is lacking. its all there and should work but im not knowledgable enough to solve the problems of getting it up and running.
for some the refresher might do the trick if you get it figured out. for others it might just need ssh into it to startx
im still working on getting the UT rom going and ill post what i have of that too for any of you that want to try and get it going
you can find me ubports porting and @duhjokersinhell on telegram if you need
here is the link to the ubuntu touch images i have compiled. they are a halium-9 ubuntu touch rootfs.img and a hal9 android-rootfs.img. to play around with them just go to twrp and format data making sure its formatted to ext4. then move the images from your external sdcard storage to data. then flash the full ubuntu kernel zip and the ramdisk installer
ssh [email protected]
password = phablet
try to get the lxc container loaded with
sudo mount -o remount,rw /
sudo lxc-start -n android
to get init logs
sudo lxc-start -n android -F -l DEBUG -- /init
ubuntu touch - Google Drive
drive.google.com
need to redo op but look i got it working

Categories

Resources