[ROM Development] Device Tree / System Image EXT2 instead of EXT4? - Android Software/Hacking General [Developers Only]

Hello Everyone!
I'm trying to develop for the Microsoft Surface Duo. I feel this device has the potential to run other operating systems (like Ubuntu, different versions of Android, Windows, etc.) as the kernel source was released. I've ran into two problems: creating a device tree for the Surface Duo and unzipping the system image. First, the device tree for OS builds was not released. Second, the system image is formatted as an EXT2 file, NOT an EXT4 file, and not as an Android system file that sim2img desires.
I found the system image through two methods:
Finding the payload.bin OTA file and extracting the images there.
Rooting the phone, copying the super.img, and extracting the images.
In both situations running file system.img gives me
Code:
Linux rev 1.0 ext2 filesystem data, UUID=3dc9e73d-c9c2-5764-89e7-0426672bbdb9 (extents) (64bit) (large files) (huge files)
This is for both A and B Partitions. I can't mount ext2 images onto my linux OS (I'm on Kali OS) via mount loop.
Code:
wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error.
If anyone can give me some insight on what the problem could be, that would be great!

Related

[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

[Q] Using a partition in DriveDroid app

Hi,
I'm using Linux Deploy app to have a minimalistic ubuntu system on my android (just to have linux with me all time to test some commands or to build small C programms). I tried DriveDroid app yesterday and I really like it: I can use my linux deploy system on PCs too. The question is DriveDroid lets you add images (img) only to boot them from your PC, but I'm using an SDcard partition on my android phone for Linux Deploy not an img; so can we add a partition to DriveDroid too?! some linux tricks to do that I mean... I tried making a symlink of /dev/block/mmcblk1p4 (my linux deploy partition) and /sdcard1/ubuntu.img but this fails (action not permitted) I think it's because the first is ext4 partition and the sdcard1 uses fat32. Any help please?
Thanks XDA.

[TUTORIAL] How To Extract Files From an Nvidia Stock ROM (Factory Restore)

I recently purchased a Nvidia Shield tablet and was happy to discover that some of the development aspects are pretty similar to Samsung devices. I wrote tutorials for several Samsung devices that detail this same process and thought it would be good to post one for the Nvidia Shield Tablet.
Now to start off, this does not automatically make you a Super Duper Developer, this does not show you how to make your own ROMs. What it does do is show you how to pull files from those stock leaked/official ROMs so that you can proceed to make yourself into a Super Duper Developer!
In essence if the Developer knows what they are doing they could use this method to extract all the files from the build and could then add them to a ZIP and have a stock odexed ROM within minutes and do it all through Windows!
So let's begin!
We've all seen the stock restore images Nvidia provides. How often have you wanted to look inside them and see what is inside before flashing? There are several ways to do it and the most common answer requires Linux and other utilities. This tutorial gives you the ability to do that through Windows and without having to extract the full ROM. These instructions are specific to the Nvidia Shield Tablet but with some tweaking can be used on several devices.
Each stock restore release contains multiple files. Each of these files corresponds to a specific partition on your device. These files are formatted to be mounted by your device but not by a computer. We will be converting them from a .img partition type to an ext4.img type partition so we can mount them and read them through Windows. For this tutorial we will be opening up the system.img (the system files partition).
Before you dive in there are a few things you'll need.
- A PC running Windows.
- A stock Nvidia restore.
- DiskInternals Linux Reader (must be installed on the Windows PC). You can download DiskInternals Linux Reader here.
- SGS2toEXT4 Utility available here. *Be sure to extract the JAR file from the ZIP archive.
- 7-Zip available here.
For the rest of the tutorial please visit my site: www.rwilco12.com
Enjoy!
The original tutorial is still available here, anyhow starting with 7-zip 15.08 you don't really need other programs to access ext4 images.
The only other step you need is to convert to that the sparse images nvidia provides.
Python script to convert sparse ext4 Android images (like cache.img[.ext4], hidden.img[.ext4] to openable ext4 images (like with 7zip)
Python script to convert sparse ext4 Android images (like cache.img[.ext4], hidden.img[.ext4] to openable ext4 images (like with 7zip) - sparse_img_to_ext4.py
gist.github.com
[DEV][Tools] simg2img for Windows
Hello, although I'm working in Linux (VM too) I rewrote the SIMG2IMG so far for Windows (PE32, x86) Usage: simg2img.exe -i -o Optional: -d for debugging messages, listing all chunks of the image...
forum.xda-developers.com

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

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.

[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