[DEV] Kexec-hardboot - Xperia Z Original Android Development

PREAMBLE
Just to clear things up - I'm definitely not responsible for anything. This patch will not work on devices with locked bootloaders.
Tasssadar said:
This patch was made by Mike Kasick for Samsung Epic 4G. Since that, it was ported to several devices, one of them is Asus Transformer TF201 - I used patch from TF201 and modified it a bit (basically just changed few SoC specific constants). People at #ubuntu-arm helped me out with that, thanks.
For flo, I've improved the patch a bit - only the host needs to be patched now and I also fixed a bug with /proc/atags not reading all tags.
Click to expand...
Click to collapse
Thanks to omnirom - I used their kernel as a base.
Special thanks to Tasssadar for his kexec-hardboot patch for the Nexus 4. Also thanks to alvinhochun and krabappel2548. I borrowed some of their code.
WHAT'S KEXEC?
Tasssadar said:
It is syscall of Linux kernel, which allows you to boot another Linux kernel without restarting the device - "Linux boots itself". The functionality is equivalent to fastboot -c *cmdline* boot zImage initrd.img, but without PC and fastboot. It is fairly known thing, so more info at wikipedia and man kexec.
Standard kexec call unfortunatelly does not work on Nexus 4. It freezes somewhere, and it is very difficult to find out where - probably some of the drivers are not shut down/re-initialized properly, it is a commong thing among Android devices, which is why kexec-hardboot was made.
Click to expand...
Click to collapse
What is the difference between normal and hardboot kexec?
Tasssadar said:
Kexec-hardboot patch adds a real device restart to that process, so that all the drivers can be properly reinitialized. It stores new kernel to RAM, reboots the device as usual, and kernel from boot partition immediately jumps to the one which was stored to RAM before reboot.
Unlike grouper's kexec-hardboot patch, this one only requires the host kernel to be patched. This is one of the improvements I made, and I think it is pretty significant.
To sumarize the process:
kexec --load-hardboot.... is called and kernel it loaded into RAM.
kexec -e is called. Special info is written to memory (to area which is not overwritten on reboot) and the device is rebooted.
After reboot, very early in the boot process, kernel checks if that special info is present in RAM and if so, it loads new kernel from RAM and jumps to it.
Kexecd' kernel starts and boots.
For more info, read the original thread.
Click to expand...
Click to collapse
INSTRUCTIONs
Download kexec-hardboot-yuga.zip and unzip it
Flash my patched host kernel (kexec-kernel-20140808-yuga.zip)
Push initrd.img, kexec, kexec.sh and zImage to /cache
Use a terminal to do the following:
Code:
adb shell
su
cd cache
chmod 0755 kexec
sh ./kexec.sh
SOURCEs
Kexec-hardboot patch
Kernel
XDA:DevDB Information
Kexec-hardboot patch for Sony Xperia Z, Tool/Utility for the Sony Xperia Z
Contributors
Olivier
Version Information
Status: Testing
Created 2014-08-08
Last Updated 2014-08-08

I'm sorry I would like to ask a question. If I kexec boot my phone with yuga kernel and cwm, flashes the yuga ROM would it be possible to get dual booting the Yuga ROM?
Source: http://forum.xda-developers.com/showpost.php?p=19460677&postcount=25
Pretty old source but would it be possible?

xarive said:
I'm sorry I would like to ask a question. If I kexec boot my phone with yuga kernel and cwm, flashes the yuga ROM would it be possible to get dual booting the Yuga ROM?
Source: http://forum.xda-developers.com/showpost.php?p=19460677&postcount=25
Pretty old source but would it be possible?
Click to expand...
Click to collapse
Sure thing
Gesendet von meinem Xperia Z mit Tapatalk

Nice to see you got a Z now.
Will try this one out definitly

Sweet! Trying this out straight after work!
Beans

I am still not quite clear about dual booting with kexec. Did OP done it before?
Sent from my C6603 using Tapatalk 2

Can we load some other kernal on our devices using kexec without unlocking bootloader??
I had a Motorola atrix 2 which used to do this..:fingers-crossed:

siddhesh1609 said:
Can we load some other kernal on our devices using kexec without unlocking bootloader??
I had a Motorola atrix 2 which used to do this..:fingers-crossed:
Click to expand...
Click to collapse
No, LB Yuga's are missing kexec, even compiling a external kernel module is not possible as the zimage is missing some required symbols for kexec to work.

Hi. I want to split two kernels. cyanogenmod and multirom (not for xperia z.)
i have kexec, and it working under multirom kernel.
i have edited one kernel, to load init file from another.
I am trayed zimage from multirom kernel.
Now i cannot run both. i can run cm12 kernel, and rut multirom from there, but cm12 wont boot.
when i used zimage from cm12 kernel, i can boot into cm12, but not in multirom.
is there any command to kexec to load another zimage only, and run another init file?
i have init (cm12) and from there i can use sh commands. i want load initmr (multirecovery) with another zimage file.
is it possible?

gouster3 said:
Hi. I want to split two kernels. cyanogenmod and multirom (not for xperia z.)
i have kexec, and it working under multirom kernel.
i have edited one kernel, to load init file from another.
I am trayed zimage from multirom kernel.
Now i cannot run both. i can run cm12 kernel, and rut multirom from there, but cm12 wont boot.
when i used zimage from cm12 kernel, i can boot into cm12, but not in multirom.
is there any command to kexec to load another zimage only, and run another init file?
i have init (cm12) and from there i can use sh commands. i want load initmr (multirecovery) with another zimage file.
is it possible?
Click to expand...
Click to collapse
Ok... What?

vishal_android freak said:
Ok... What?
Click to expand...
Click to collapse
Is there any arguments for kexec to reboot with another zimage, and exec? i want to run initmr (init file)?
but without ramdisk wipe. (or load ramdisk from kernel partition)?? init file with zimage are there.
when i use "exec /initmr", it will boot, but touch not working, and i have screen-shift bug.

Or. another way. how i can get "hot boot" into some boot.img using kexec on my build-in kernel?

Related

CM9 boot.img source

Hi,
Could anybody tell me which are the bare minimum sources needed to compile a working cyoanogenmod 9 kernel boot.img?
I'm currently trying to compile one on my own but I can't afford to download the whole CM9 source due to the internet contract i have.
Thanks
Nobody? Ok then... May someone please copy and paste their makefile inside the root directory of his Android tree? (the one from wich they issue the command "make -j4 out/target/product/galaxysmtd/boot.img").
Maybe you could try cloning the android_build project and the teamhacksung buildscript project as well. Then adjust the buildscripts to point to the correct toolchain directory...
Boot.img contains the kernel. Therefore you need the kernel sources since at cm9 the kernel is build while compiling cm. You can find that sources at github (in project kernel_samsung_aries or something). You need to put this directory to your root directory of your android build system (there you have the device dir, frameworks, vendor etc). Rename it into kernel/samsung/aries. Then you should be able to build. It has worked like this for i9001, and it should also for i9000
You could also look at the kernel source of semaphore/devil. They use their own build script which does not require the full cm9 source, but only the kernel source. I made an adapted version of their scripts to build my own kernel...
Verstuurd van mijn GT-I9000
I think he already has:
__Pol__ said:
Nobody? "make -j4 out/target/product/galaxysmtd/boot.img"
Click to expand...
Click to collapse
Thanks everybody!
Sorry if the first two posts misled you.
I already have the kernel source. What I need are some instructions in order to build the boot.img from them. I can't download the whole source branch because I'm on a data diet .
Also a copy paste of the main make file is accepted.
I think this could help you:
http://forum.xda-developers.com/showthread.php?p=28096022
It's again for i9001 (sorry, but I own one ), but should also work
I think this could help you:
http://forum.xda-developers.com/show...php?p=28096022
It's again for i9001 (sorry, but I own one ), but should also work
Click to expand...
Click to collapse
Thanks. I've already tried the split_bootimg.pl but it did not work. According to sbuild.sh from semaphore kernel what i need to do is just "cp bzImage boot.img". I had already done it before but my phone did not boot up. It showed the bootloader logo but then nothing so something is wrong with the initramfs. Is the one included with the kernel sources correct or am I missing something?
So you can build the kernel? And just copying the kernel image to boot.img won't work. As you can see in the splitted boot.img from arco or anyone else, there are some other things needed.
I think you need to split it, replace the kernel image (zImage I thinl) and put all files again together (including the other files from the working boot.img).
No warranty on that, but that's what I understood
hahnjo said:
So you can build the kernel? And just copying the kernel image to boot.img won't work. As you can see in the splitted boot.img from arco or anyone else, there are some other things needed.
I think you need to split it, replace the kernel image (zImage I thinl) and put all files again together (including the other files from the working boot.img).
No warranty on that, but that's what I understood
Click to expand...
Click to collapse
Actually I can't split the boot.img because split_bootimg.pl does not work. The problem is in the initramfs and that is why I was asking for some advice about the sources needed. The auto-generated initramfs does not work.
__Pol__ said:
Actually I can't split the boot.img because split_bootimg.pl does not work. The problem is in the initramfs and that is why I was asking for some advice about the sources needed. The auto-generated initramfs does not work.
Click to expand...
Click to collapse
When I tried it, it worked... Are you sure that you have Pearl installed. Which OS do you use?
How do you generate initramfs?
I'm running Debian wheezy, pearl is installed. The script says it has not found android magic. The initramfs is automatically generated by the kernel source. I fear some files are missing here: https://github.com/CyanogenMod/android_kernel_samsung_aries
Do I need to get *bootimg from here?
https://github.com/CyanogenMod/android_device_samsung_aries-common
If yes how do I use these 2 scripts?
Sorry they're not two scripts but a script and a make file. From where does that makefile obtain the variables?
For splitting, did you use a running boot.img, e.g. from CM9 for your device?
You have two possibilities for building a running boot.img:
1) It is builded if you compile CM or AOSP or another ROM from Source (therefore you would need the complete sources)
2) You only build the Kernel and put it in an existing boot.img (for your phone of course) by just replacing the kernel.
For second you need to split an existing boot.img
Hi
Sent from my GT-S5830 using xda app-developers app
hahnjo said:
For splitting, did you use a running boot.img, e.g. from CM9 for your device?
You have two possibilities for building a running boot.img:
1) It is builded if you compile CM or AOSP or another ROM from Source (therefore you would need the complete sources)
2) You only build the Kernel and put it in an existing boot.img (for your phone of course) by just replacing the kernel.
For second you need to split an existing boot.img
Click to expand...
Click to collapse
Well, actually there's a third method. I need the initramfs source, the kernel source and the recovery source. After building I need to pack them together. Until yesterday I had only the sources for kernel and initramfs (?). Now I'll head for some sources for the recovery but I still need the main makefile (inside the Android directory) to know what commands I have to issue.
Sorry guys if I stil can't explain my problem to you. I really appreciate your patience and your helpful tips though.
You could look at devil/semaphore, as they use a complete initramfs, including recovery (both have a slightly different implementation).
Verstuurd van mijn GT-I9000
kasper_h said:
You could look at devil/semaphore, as they use a complete initramfs, including recovery (both have a slightly different implementation).
Verstuurd van mijn GT-I9000
Click to expand...
Click to collapse
Yep! I had a look there and I understood I was missing the recovery. Semaphore uses a custom amde initramfs and recovery whith load of scripts I don't need. I downloaded the CWM source from cyanogenmod git. There is only an Android.mk that obviously won't work. The question still remains: has anybody here downloaded the whole cyanogenmod source? If yes, may they post the makefile here please?
I have the whole CM sources, CM7 and CM9. Atm I can't access them because I'm on travel. I will return next week, maybe then.
Though, I think that it is impossible to extract the needed Makefiles. The Main-Makefile includes another makefile, but from then on several files are included which include again files. I stopped trying to understand it after the first 3 files...

MultiROM - PAC and SlimB - order, kernel, others...

Hello There.
First of all, is it possible to install both PAC-man 4.3 ROM and SlimBeam 4.3 using MultROM?
If Yes, how to do this correctly/what am I doing wrong?
I have TWRP 2.6.0.0 and MultROM installed. Tried different combinations and nothing work.
I'm not much into this stuff, so as far as I could go I have investigate the issue of kernels and kexec, but as I said, my knowledge stopped on knowing that there is such thing, and secondary ROM can be installed with different, separated kernel.
Thanks for interest.
I thought that it would be helpful if I write what combination/order of instalation gives what result, so here it goes:
1. Installing SlimBeam, and then PAC: E: Error executing update binary in zip 'tmp/mr_update.zip'
2. Installing PAC, and then SlimBeam: Installation complited correctly, secondary system(SlimB) loading forever with PAC boot animation - probbably because of kernel?
3. Installing PAC and then SlimBeam with seperated cernel: (In Multiroom when booting SlimB) Error Kexec-hardboot support required to boot this ROM...
In this case I'm guessing that patching this kernel could help, but it's superadvanced for me
noone1101 said:
Hello There.
First of all, is it possible to install both PAC-man 4.3 ROM and SlimBeam 4.3 using MultROM?
If Yes, how to do this correctly/what am I doing wrong?
I have TWRP 2.6.0.0 and MultROM installed. Tried different combinations and nothing work.
I'm not much into this stuff, so as far as I could go I have investigate the issue of kernels and kexec, but as I said, my knowledge stopped on knowing that there is such thing, and secondary ROM can be installed with different, separated kernel.
Thanks for interest.
I thought that it would be helpful if I write what combination/order of instalation gives what result, so here it goes:
1. Installing SlimBeam, and then PAC: E: Error executing update binary in zip 'tmp/mr_update.zip'
2. Installing PAC, and then SlimBeam: Installation complited correctly, secondary system(SlimB) loading forever with PAC boot animation - probbably because of kernel?
3. Installing PAC and then SlimBeam with seperated cernel: (In Multiroom when booting SlimB) Error Kexec-hardboot support required to boot this ROM...
In this case I'm guessing that patching this kernel could help, but it's superadvanced for me
Click to expand...
Click to collapse
The kernel of your primary ROM needs to support kexec. I don't think this is true for the pac nor the slim kernel. You will have to flash a custom kernel on your primary ROM.
Dexxon said:
The kernel of your primary ROM needs to support kexec. I don't think this is true for the pac nor the slim kernel. You will have to flash a custom kernel on your primary ROM.
Click to expand...
Click to collapse
Exactly.
Idk either how it looks like with pac as secondary, because of such mentioned problems.
I am on a good way to finding right kernel for that and trying to flash it, and test if it works.
Ty for reply.
noone1101 said:
Exactly.
Idk either how it looks like with pac as secondary, because of such mentioned problems.
I am on a good way to finding right kernel for that and trying to flash it, and test if it works.
Ty for reply.
Click to expand...
Click to collapse
Your Problems consists of 3 things:
1. U need a kernel with Kexec-Support for the primary Rom to be able to boot secondary rom with other kernel. If u use same kernel for both rom, u dont need a kernel with Kexec-Support
2. To flash the kernel for secondary rom, u need a repacked kernel with ramdisk from destination rom, anykernel wont work, cause u cant flash it on secondary. It writes with "dd" direct to partition and this is wrong way for secondary Rom. So u have to choose a repacked kernel for secondary...
3. The script in most install.zips for 4.3 roms contains symlinks written over more than one line. These scripts wont work with multirom installer (TWRP MultiRom), so u have to modify script, extract from zip, write all symlinks and all other commands (which are broken into more than 1 line) in 1 line and copy back into zip. Install will work now (modification is for "Error executing update binary in zip 'tmp/mr_update.zip').
Bogeyof said:
Your Problems consists of 3 things:
1. U need a kernel with Kexec-Support for the primary Rom to be able to boot secondary rom with other kernel. If u use same kernel for both rom, u dont need a kernel with Kexec-Support
2. To flash the kernel for secondary rom, u need a repacked kernel with ramdisk from destination rom, anykernel wont work, cause u cant flash it on secondary. It writes with "dd" direct to partition and this is wrong way for secondary Rom. So u have to choose a repacked kernel for secondary...
3. The script in most install.zips for 4.3 roms contains symlinks written over more than one line. These scripts wont work with multirom installer (TWRP MultiRom), so u have to modify script, extract from zip, write all symlinks and all other commands (which are broken into more than 1 line) in 1 line and copy back into zip. Install will work now (modification is for "Error executing update binary in zip 'tmp/mr_update.zip').
Click to expand...
Click to collapse
the alternative to problem 3 is to install a rom, do a backup, install the rom you want and restore a backup as second rom. thats how i did it, noob-way

[MOD][KK+]MultiRom v22a && TWRP 2.6.3.x (20.02.14)

Okay i only started looking at multirom around 4hours before releasing this, so i am aware we already have a multiROM thread, however i do believe it's outdated, and perhaps unsupported now, so i am merging a supported multirom with my TWRP thread where i will be keeping both updated, thanks to @Tasssadar for bringing multiROM to the android community. I failed hard with outdated sources from adam so i have written my own stuff, but i think iodak is using his .diff​
Taken and modified from official thread at Flo
Introduction
MultiROM is one-of-a-kind multi-boot mod for Nexus 7. It can boot any Android ROM as well as other systems like Ubuntu Touch, once they are ported to that device. Besides booting from device's internal memory, MultiROM can boot from USB drive connected to the device via OTG cable. The main part of MultiROM is a boot manager, which appears every time your device starts and lets you choose ROM to boot. You can see how it looks on the left image below and in gallery. ROMs are installed and managed via modified TWRP recovery. You can use standard ZIP files to install secondary Android ROMs and MultiROM even has its own installer system, which can be used to ship other Linux-based systems.
Features:
* Multiboot any number of Android ROMs
* Restore nandroid backup as secondary ROM
* Boot from USB drive attached via OTG cable
You can also watch a video which shows it in action.​
Warning!
It _is_ dangerous. This whole thing is basically one giant hack - none of these systems are made with multibooting in mind. It is no longer messing with data partition or boot sector, but it is possible that something goes wrong and you will have to flash factory images again. Make backups. Always.​
Installation
Manual installation
Find all needed files here: MOD Edit: Links removed
I think Iodak has the kexec patch so use his Rom, i'm not too sure on how to add a kexec so i'll look into it, this does support KK roms as i tried it, and so has dan.
MultiROM has 3 parts you need to install:
MultiROM multirom.zip - download the ZIP file from second post and flash it in recovery.
Modified recovery (TWRP_Mrom.zip) - download and flash in recovery.
Patched kernel - Iodaks kernel i believe is kexec patched, worked for me, have a play, i use share kernel for KK roms of the same type. I suggest this.
You current rom will not be erased by the installation.
Download links are somewhere below
​
Adding ROMs
Android
Go to recovery, select Advanced -> MultiROM -> Add ROM. Select the ROM's zip file and confirm.​
Updating/changing ROMs
Primary ROM (Internal)
Flash ROM's ZIP file as usual, do factory reset if needed (it won't erase secondary ROMs)
Go to Advanced -> MultiROM in recovery and do Inject curr. boot sector.
Secondary Android ROMs
If you want to change the ROM, delete it and add new one. To update ROM, follow these steps:
Go to Advanced -> MultiROM -> List ROMs and select the ROM you want to update.
Select "Flash ZIP" and flash ROM's ZIP file.
Source code
MultiROM - https://github.com/Tasssadar/multirom/tree/master (branch master)
Modified TWRP - https://github.com/Tasssadar/Team-Win-Recovery-Project (branch master)
Device Tree for building Mrom and TWRPhttps://github.com/Fluoxetine/android_device_lge_p880 (branch TWRP)​
Thanks and Links
Official thread with screenshots, donate link, and changelogs
Original Thread for 4xHD by @Adam77Root
FAQ and other notes
About security
In order to make multi-booting possible, MultiROM has to sacrifice some security measures. Firstly, on secondary Android ROMs, /system is not mounted read-only. While there are other things preventing malicious software from messing with /system, this might potentialy make it easier for such software to attack that system.
Next, MultiROM doesn't work with /data encryption. Not many people who use custom ROMs also use encryption anyway, so that isn't much of a concern.​
What do the ROMs share?
All ROMs are separate, except /sdcard, which is shared between all Android ROMs.​
How many ROMs can I have?/Where are the ROMs stored?
You can have as many ROMs as you can fit in your /sdcard. All the ROMs are stored in /sdcard/multirom/roms or on an USB drive. This folder is unaccessible in Android, to prevent mediascanner from scanning it. You can either in recovery, or obtain root and go to /data/media/0/multirom/roms.​
Can I have different versions of Android working alongside
Yes. As long as you select "Don't shere kernel" when installing the secondary ROM, the systems are separated.​
MultiROM recovery says it's 2.6.3.0. Why isn't it updated to 2.6.3.*highernumber*?
It is, it just shows wrong version.​
The menu with all the ROMs won't show up during boot, how to fix it?
Either re-flash the MultiROM zip or go to recovery, Advanced -> MultiROM -> Inject curr. boot sector.
The reason for this is that something rewrote your boot.img, which happens for example when you flash a kernel. MultiROM's boot menu is part of the boot image, so it has to be added into it again.​
Will you port MultiROM to device X?
No, probably. I won't port MultiROM to any device I don't own, because it is very difficult to provide the level of support I want to provide if I can't test things myself, as proven by the Nexus 4 port. I'll probably keep buying Nexus devices and keep porting MultiROM to those myself, but I can't buy every single device - I'm still a student, all my existing devices were bought using some kind of money grant or donations from users.
But, you can port it yourself, the wiki should give you at least some idea how to do that: https://github.com/Tasssadar/multirom/wiki/Porting-MultiROM​
Message from Fluoxetine
I spend a lot of time trying to bring new roms/mods to this and many other devices, this doesn't really cost me anything so i will not ask for money, however i am open to other donations, if you can supply me with a donated spot on a build server that would be great! Otherwise, you can supply me with Drink and Food to snack on whilst i work away, just PM me with an amount and i'll choose a product from amazon and send you my address and info for it to be shipped directly to me Thanks for your time guys.
Click to expand...
Click to collapse
-
-
-
-
-
-
Changelog from my end and not multiROM (Ascending Order)
Code:
- [I] Release within 4 hours of solid working on it [/I]
- Fix Recovery
- Fix touch input
- Build Multirom.zip
- Remove weird vibration
- Fix MultiRom button
- Fix Layout
- Build Modified TWRP
- Create TWRP.fstab
- Build MultiRom.zip
- Fix Sizing
- Build Initial MultiRom.zip
- Create mr_init_devices.c
- Create a modified BoardConfig.mk
- Sync Modified TWRP
- Sync MultiRom
- Sync Omni
Reserved
Great work
Sent from my LG-P880 using Tapatalk
Ha, it's working... Somtimes it's a bit tricky to install secondary ROMs. To get Zaiben RC8 booting I installed it from a backup.
Pure CM11 (20140220 nightly) without gapps is booting, after flashing gapps in MultiROM it dosn't boot. Only using a backup to create it as secondary works for me...
But no way to install AnyKernels like Iodak9.95 om secondary. For CM/ASOP you can try sharing option, for stock-based the only way is using backup with installed custom kernel...
Since AnyKernel there are no boot images for different roms, so there is nothing to inject...
One downer for me is missing ADB in recovery. I've tried mounting USB-Device first, no way. Device manager in Windows shows nothing.
In bootmenue ADB is working, but it's useless without mounted system, data etc. When I use "adb shell mount -o remount,rw system" I got "mount: can't find system in /proc/mounts"
And I noticed after booting any secondary ROM, primary needs wiping cach/dalvikcache to prevent a bootloop...
EDIT: Got system access from ADB...
Code:
adb shell mount /dev/block/platform/sdhci-tegra.3/by-name/APP /system
Nice work man! Does ADB work in MultiROM? Did you check new hardboot patches? It doesn't need target kernel to be patched anymore.
Sent from my OmniROM-powered LG Optimus 4X HD
Adam77Root said:
Nice work man! Does ADB work in MultiROM? Did you check new hardboot patches? It doesn't need target kernel to be patched anymore.
Sent from my OmniROM-powered LG Optimus 4X HD
Click to expand...
Click to collapse
I've got ADB only working from boot menu. With correct mounts from ADB shell I'm able to modfy anthing I need...
But ADB working in TWRP would be nice
Adam77Root said:
Nice work man! Does ADB work in MultiROM? Did you check new hardboot patches? It doesn't need target kernel to be patched anymore.
Sent from my OmniROM-powered LG Optimus 4X HD
Click to expand...
Click to collapse
I don't think ADB works in multiROM, i saw in your patch a few ADB related stuff but in all honesty i think i left them and am still using all the same ones as grouper :') But i will be looking into this.
Also i haven't checked out any of the new hardboot patches, because in all honesty i have no clue what they are :highfive: but i can learn, i'll look into it now I just threw myself at multirom and looked at whatever the other devices had, and then just made it for p880 :3 Touch was an asshole Till i realized all i had to do was change b to an a.
Edit 1: This was the device specific mrom stuff i needed to add https://github.com/Fluoxetine/android_device_lge_p880/blob/TWRP/mr_init_devices.c
Edit 2: Added https://github.com/Tasssadar/androi...mmit/005cf387c1404eac862cc35153d7641d18faef4c this commit manualy, well for the files we had i added, we didn't have lge_devices or reboot.c and reset.c was different :s
Compiling stock CM11 kernel with this patch and see if i can dual boot stock with stock kernel that isnt patched, or cm10.1 with stock cm10.1 selecting "don't share"
Edit 3: Getting Errors with the changes i made, so gonna need some more time to amend them for the p880, i think i might have to call on some other devs to help out with this, i have no idea what i'm doing..
Nice work, could I ask you to prepare multirom uninstaller also?
It is working very well, thanks for this. All I do was I installed a CM-based Kitkat rom (Mokee) in the internal, and for the secondary, I installed stock rom (Zaiben) with kernel sharing enabled. Both roms are working flawlessly.
Thanks man I love your work!!
We can install FirefoxOS and Ubuntu too? MultiRom Manager working?
Sent from my LG-P880 using XDA Premium 4 mobile app
Can't seem to get anything to boot as secondary, I've tried zaiben and nameless. From backup and from zip, with and without kernel sharing.
Most times device just shuts down, once I got to boot animation and then it froze.
All backups normally boot as primary.
Primary uses latest iodak.
Probably I'm doing something wrong since others report it working.
Sent from my LG-P880 using Tapatalk
dcos said:
Can't seem to get anything to boot as secondary, I've tried zaiben and nameless. From backup and from zip, with and without kernel sharing.
Most times device just shuts down, once I got to boot animation and then it froze.
All backups normally boot as primary.
Primary uses latest iodak.
Probably I'm doing something wrong since others report it working.
Sent from my LG-P880 using Tapatalk
Click to expand...
Click to collapse
Try having your device connected to ac power while rebooting to secondary. If that works, then its the same problem as with adams multiboot, but it has two workarounds
Will you keep the non-dualboot twrp ?
I'm really not into this dual boot gimmicks and really like, and am still using your "clean" twrp version that works flawless BTW
Tapatalked from my CM11-LG4XHD-P880
remorema said:
Will you keep the non-dualboot twrp ?
I'm really not into this dual boot gimmicks and really like, and am still using your "clean" twrp version that works flawless BTW
Tapatalked from my CM11-LG4XHD-P880
Click to expand...
Click to collapse
You can use this recovery witout flashing the multiboot binarys... And the N7 multirom uninstaller works after editing the updater-script.
dcos said:
Can't seem to get anything to boot as secondary, I've tried zaiben and nameless. From backup and from zip, with and without kernel sharing.
Most times device just shuts down, once I got to boot animation and then it froze.
All backups normally boot as primary.
Primary uses latest iodak.
Probably I'm doing something wrong since others report it working.
Sent from my LG-P880 using Tapatalk
Click to expand...
Click to collapse
When you see in listeted roms with shared boot "remove boot.img" ,you can do this.
When I klicked "share boot" on ROM installation and after flashing it have its own boot.img. Don't know why, those ROMs will not boot on my device...
I lose signal on Miui 4.2.2 and CM10.1.3 dosen't boot.
I use Omnirom 4.4 and Iodak 9.95 as default.
Dual boot would be intresting if Android/data/ of secondary rom was on the external sdcard. I'm not very confident of using a secondary rom sharing that same folder as the primary rom. IMO that could cause some issues. Example: if I uninstall a game I'm secondary ROM the obb file of that ROM will be deleted on primary ROM and vice versa.
Tapatalked from my CM11-LG4XHD-P880
love you guy! i like the idea of having multiple roms, but I never got this stuff running not on my Lg 4X either on my nexus 7 - hope to get it working now with this release
Kexec for stock Cm11 kernel?
Can someone patch stock Cm11 kernel with kexec-hardboot ?
Okay so, i have uploaded CM11 stock kernel with a kexec patch, although this is not the same patch as used in iodak or stock patched kernel, i have taken the commits from groupers kernel with kexec and have implemented them into our stock cm11 kernel (took ages, had to do it manually).
This should mean that the target kernels do not need to be patched, only the host kernel needs the patch, i tried this with carbon-kk with my kernel flashed and added Carbon-KK WITHOUT SHARING kernel, then when i selected it to boot, as soon as the screen goes black HOLD THE POWER BUTTON, and then it will boot into the secondary Rom with the stock kernel that comes with it!
Well i think so anyway, Danny is testing for me now, maybe some of you could test it too? I'm not sure what will happen, i only tried it with carbon and my kexec as host, and stock carbon as target.
Link is here for the kernel http://d-h.st/j9Z or just check my folder in OP for the MultiROM stuff
For those who are having signal problems or no mobile internet connection from secondary ROM(s) with kernel sharing, you have to copy the kernel modules (baseband_usb_chr.ko, raw_ip_net.ko, scsi_wait_scan.ko) from internal ROM module folder (/system/lib/modules) to your secondary ROM. Make sure to change the permissions as well.
Just my 20 cents .
not able to flash kernel in secondary roms
hi, i have Enox rom as default rom and i installed omni 4.4.2 kk rom as secondary, and no kernel sharing.
now it boots my Enox rom but doesn't boot omni with error to have kernel with patch
so i go in advance > multirom > select omni > flash zip > and flash iodak kernel 9.95, but it fails every time, i tried iodak 9.5 too, but same,
am i doing something wrong or its not possible to flash kernels in secondary roms?
then what am i supposed to do now?
i really don't wanna change kernel of my default rom, it's working perfect with amazing battery life that i want, but i want secondary roms with different kernels ?

[SOLVED] Help building a custom kernel...

Whatever I do, my custom build kernels fail to boot. There's the ZUK logo very briefly, then device drops to bootloader screen. I'm out of ideas what I'm doing wrong, maybe someone here can give me a hint. :good:
I've tried with current AEX kernel git snapshot and also stock kernel sources. Building using the AEX_defconfig goes ok, I have Image.gz, replace it in previously extracted "stock" boot image and use mkbootimg.py to rebuild the new image. Offsets etc. are all correct (I think), like this: (from AEX)
Code:
kernel=kernel
ramdisk=ramdisk
page_size=4096
kernel_size=9101281
ramdisk_size=2671109
base_addr=0x80000000
kernel_offset=0x00008000
ramdisk_offset=0x01000000
tags_offset=0x00000100
cmd_line='androidboot.hardware=qcom ehci-hcd.park=3 lpm_levels.sleep_disabled=1 [email protected] buildvariant=userdebug'
board=""
format=gzip
But the damn new image won't boot, like described above. There has to be something (probably very stupid) I'm missing...
If I replace my own Image.gz with the originally extracted one and mkboot and so on, it's ok. So I guess it has something to do with my kernel build and/or environment. Are there any subsequent steps needed to do with the compiled kernel Image.gz? Or is it just my kernel config which is wrong? But I'm using the AEX defconfig (n7x-caf_z2_row_defconfig, to be exactly) so this should be fine, no?
Ok, I've got it. I had forgottten (=didn't know about at all) to append the device tree blob (arch\arm64\boot\dts\qcom\msm8996-v3-pmi8996-mtp.dtb) to kernel zImage... Simply cat'ing these together works!
Goodluck bro.
void23 said:
Ok, I've got it. I had forgottten (=didn't know about at all) to append the device tree blob (arch\arm64\boot\dts\qcom\msm8996-v3-pmi8996-mtp.dtb) to kernel zImage... Simply cat'ing these together works!
Click to expand...
Click to collapse
please explain .. what exactly i need to do with that file..

[kexec] droid4-kexecboot and booting raw partitions

We can now boot distros with droid4-kexecboot without being locked to the stock initramfs or rootfs :
droid4-kexecboot images
droid4-kexecboot buildroot source
It works by using utagboot generated mmcblk1p8 utags partition to boot the stock kernel to a 4MB buildroot image that can be flashed to the unused mmcblk1p13 bpsw partition. Then it starts kexecboot to use kexec for booting to the selected distro.
Currently supported are recent mainline kernels with the pending LCD patches added. SafeStrap is not necessary but can be booted to. And v3.0.8 legacy kernels installed into SafeStrap rom slots are supported (but need to be manually updated if slot kernels are updated) .
UPDATED: Booting to the stock Android and SafeStrap is now supported out of the box with for pivot_root.
Changes are needed to v3.0.8 kernel config and initramfs to not use CONFIG_CMDLINE_FORCE=y and safestrap/active_slot file and instead just use kernel cmdline to mount the desired rootfs. Distros using the mainline kernel do not have these limitations, and can use the 608MB mmcblk1p22 preinstall, 1.3GB mmcblk1p23 webtop partitions. And the 8GB mmcblk1p25 can also be reformatted to ext4 and used as rootfs if you don't need it for Android. I have not dared to try to reformat mmcblk1p20 system partition, but that too might be usable unless the Motorola bootloader does some checks on it on boot.
There are some experimental patches for initramfs modifications for postmarketos:
https://github.com/postmarketOS/pmbootstrap/pull/1039
But we need also similar Android changes if somebody has time to work on patching and rebuilding LineageOS
Nice, this works with lineage os on slot 1 now. Im currently building postmarketos and a mainline kernel to test
The bootloader refuses to boot with mmcblk1p20 erased. But a empty ext3 partiton is apperently enough to make it happy
IM_back! said:
The bootloader refuses to boot with mmcblk1p20 erased. But a empty ext3 partiton is apperently enough to make it happy
Click to expand...
Click to collapse
Oh interesting I don't think I've seen that. Do you mean the Motorola bootloader refuses to start or kexecboot? Sounds like we should document this and how to fix it if it happens if you can write up something on it for droid4-kexecboot README file.
tmlind said:
Oh interesting I don't think I've seen that. Do you mean the Motorola bootloader refuses to start or kexecboot? Sounds like we should document this and how to fix it if it happens if you can write up something on it for droid4-kexecboot README file.
Click to expand...
Click to collapse
The Motorola booloader goes directly to fastboot if i:
Code:
dd if=/dev/zero of=/dev/block/mmcblk1p20
but
Code:
mkfs.ext3 /dev/block/mmcblk1p20
keeps the Motorola bootloader happy. im not shure if it needs to be ext3 i just whent with that because thats what the stock rom uses. It is extreamly annoying that we can not flash modified system.img's via fastboot. I will experiment a bit more with it and submit a patch to the README file.
I got The mainline kernel to boot, but without a rootfs it dosent do anything usefull of course.
that aside i can't seam to get postmarketos to work. I installed pmos rootfs to the webtop partiton and supplyed kernel command line with PMOS_NO_SAFESTRAP and correct root= but it just boots to a black screen , no uart output either
Do you have something that works that i could take a look at?
IM_back! said:
The Motorola booloader goes directly to fastboot if i:
Code:
dd if=/dev/zero of=/dev/block/mmcblk1p20
but
Code:
mkfs.ext3 /dev/block/mmcblk1p20
keeps the Motorola bootloader happy. im not shure if it needs to be ext3 i just whent with that because thats what the stock rom uses. It is extreamly annoying that we can not flash modified system.img's via fastboot. I will experiment a bit more with it and submit a patch to the README file.
Click to expand...
Click to collapse
Interesting so it seems that the cdt.bin mmcblk1p6 partition tells mbmloader to check some partitions for content and some partitions just for the fs. I wonder if also for example cdrom mmcblk1p16 partition can be modified too that way.
IM_back! said:
I got The mainline kernel to boot, but without a rootfs it dosent do anything usefull of course.
that aside i can't seam to get postmarketos to work. I installed pmos rootfs to the webtop partiton and supplyed kernel command line with PMOS_NO_SAFESTRAP and correct root= but it just boots to a black screen , no uart output either
Do you have something that works that i could take a look at?
Click to expand...
Click to collapse
As a test I only verified that NotKit's kernel mentioned in his postmarketos pull request boots with uart with kexecboot after I noticed he has a patch for gcc6 support and APKBUILD prepare -Werror search and replacement
I enabled CONFIG_EMU_UART_DEBUG=y, disabled CONFIG_CMDLINE_FORCE and configured kexecboot boot.cfg to use CMDLINE=console=ttyO2,115200 [email protected] vram=10300K omapfb.vram=0:8256K,1:4K,2:2040K ro rootwait root=/dev/mmcblk1p13 debug earlyprintk' to boot back to droid4-kexecboot.
tmlind said:
As a test I only verified that NotKit's kernel mentioned in his postmarketos pull request boots with uart with kexecboot after I noticed he has a patch for gcc6 support and APKBUILD prepare -Werror search and replacement
Click to expand...
Click to collapse
FYI, the postmarketos pull request mentioned above has been now merged. And I pushed out updated droid4-kexecboot images last night that now also support booting to the stock Android and SafeStrap.
I will be trying to get this thing to boot for my phone motorola electrify 2. Don't have much of knowledge but atleast trying is not going cost me alot .
mmcblk1p16 partition is usable as alternative ISO storage
tmlind said:
Interesting so it seems that the cdt.bin mmcblk1p6 partition tells mbmloader to check some partitions for content and some partitions just for the fs. I wonder if also for example cdrom mmcblk1p16 partition can be modified too that way.
Click to expand...
Click to collapse
Actually, after some trial and error I managed to turn the cdrom partition (mmcblk1p16) into something more useful. Now my maserati works as a portable "Linux booting device"
When plugged to a computer it behaves by default as a CD-ROM drive, and it's capable of booting a Linux ISO on the PC. Bear in mind that the partition size is slightly above 200 MB, so we have limited space. Apparently if mmcblk1p16 is formatted as ext3, ext4 or contains a filesystem other than ISO, the phone will NOT boot (I had to reinstall the whole Stock firmware a few times).
I could make a mini tutorial with detailed instructions.
So perhaps this partition could be useful for storing a customised read-only distro for the maserati, similar to a Live environment. Or at least capable of booting a minimum environment with essential files.
I'd like to test your kexec files as soon as I can, but still need to understand the whole process. About to receive a second maserati for tests
Cheers!
dinosaur99 said:
Actually, after some trial and error I managed to turn the cdrom partition (mmcblk1p16) into something more useful. Now my maserati works as a portable "Linux booting device"
Click to expand...
Click to collapse
Hey that's great! FYI, one more thing to consider is that I noticed allow-mbmloader-flashing-mbm.bin is more permissive compared to mbm.bin. They seem to parse some permissions table from cdt.bin. I guess it would not be too hard to figure out that format if somebody cares. And I now also wonder if using cdt.bin_patch instead of cdt.bin is even more permissive?
Anyways, do not mess with the mbmloader.bin or allow-mbmloader-flashing-mbm.bin partitions though that can brick the device..
tmlind said:
FYI, the postmarketos pull request mentioned above has been now merged. And I pushed out updated droid4-kexecboot images last night that now also support booting to the stock Android and SafeStrap.
Click to expand...
Click to collapse
Thank you for your excellent work!
Can't boot to safestrap
This is my first approach to boot something other than Android. Not very usable though, but I got this far.
I first installed droid4-kexecboot following instructions on README, and created the boot/boot.cfg on a fresh EXT4 sdcard by copying the sample rom-slot1 and rom-slot2 entries. After reboot, kexecboot shows a very nice graphical menu, and loads successfully all configurations. Unfortunately the slot entries don't work from kexecboot (phone restarts). However I can load Safestrap and boot stock and both ROM slots.
Then I built latest postmarketOS for Droid 4 using pmbootstrap, and selected Weston (one of the lightweight flavours). The result is three files: kernel, initramfs and a disk image containing two partitions. In order to install pmOS into rom-slot2, I wiped all slot2 partitions and installed CM11 as explained here https://wiki.postmarketos.org/wiki/Motorola_Droid_4_(motorola-maserati) . The next steps were done locally on my laptop instead of using ADB (i.e. replace file userdata.img in rom-slot2 directory with the pmOS disk image, and also replace /etc/kexec/ramdisk.img and /etc/kexec/kernel located inside system.img with the new initramfs/kernel). Then rebooted, jumped from kexecboot to Safestrap, and it launched postmarketOS.
USB networking connects right away and SSH works.
The wiki states that Framebuffer graphics works, but I get no screen output. LCD backlight is on. Xwayland and weston are running by default.
All LEDs work.
Touchscreen, vol buttons and keyboard seem to work.
Kernel is 3.0.8.
Finally I managed to boot pmOS with kexecboot. Directory "boot" on mmcblk0p1 contains following files:
Code:
atags # borrowed from safestrap
boot.cfg
devtree # borrowed from safestrap
initramfs-motorola-maserati
vmlinuz-motorola-maserati
Here's a few facts that I don't really understand
kexecboot boots pmOS on rom-slot only if safestrap is configured to boot on that slot, otherwise it boots into something else which responds to ping, but no SSH. Why is this happening if kexecboot overrides safestrap?
Excuse my ignorance, but what is in practice the need for a devtree file, and where am I supposed to obtain it?
The kernel cmdline is apparently overriden by atags file required to boot linux 3.0.8. It seems like boot configuration is hardcoded somehow. But why doesn't it boot regular android slots?
Is it actually possible to pass something like root=/dev/mmcblk0p1 or maybe even get screen working by using a recent kernel?
Sorry if I mixed up too many different topics... just trying to sort the whole thing out.
Thanks!
Is it possible to boot LineageOS with a Linux kernel of 3.20 or higher?
dinosaur99 said:
Here's a few facts that I don't really understand
kexecboot boots pmOS on rom-slot only if safestrap is configured to boot on that slot, otherwise it boots into something else which responds to ping, but no SSH. Why is this happening if kexecboot overrides safestrap?
Excuse my ignorance, but what is in practice the need for a devtree file, and where am I supposed to obtain it?
The kernel cmdline is apparently overriden by atags file required to boot linux 3.0.8. It seems like boot configuration is hardcoded somehow. But why doesn't it boot regular android slots?
Is it actually possible to pass something like root=/dev/mmcblk0p1 or maybe even get screen working by using a recent kernel?
Sorry if I mixed up too many different topics... just trying to sort the whole thing out.
Click to expand...
Click to collapse
Sorry for being slow to respond..
There is an issue with most droid4 images using the 3.0.8 kernel files and init scripts which is the scripts check the SafeStrap config from the mmc for things to mount etc.
This is no longer needed at and the scripts should be just modified to do that only if booted with safestrap. We should now just use standard Linux way meaning
parse the partitions to mount from kernel command line and so on NotKit posted some patches to sort out that as linked in the first post in this thread for the
PostmarketOK pull request. But I don't think those are applied and also the Android Images need to be updated too for LineageOS and then you can just boot
Android from whatever partition you like such as mmcblk0p1 or mmcblk1p25 in the standard Android way.
So omebody just please do standard LineageOS images that don't rely on SafeStrap!
The devtree file is only needed for old 3.0.8 kernels and is non-compatible with the current mainline kernel dtb file omap4-droid4-xt894.dtb. Motorola used custom
device tree properties and it's in big-endian format. The devtree file should be the same as what you have on the eMMC devtree partition mmcblk1p11.
Current mainline kernel still has the LCD patches pending, for v4.19-rc series I posted the pending patches I have to:
https://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap.git/log/?h=droid4-pending-v4.19
Those are still being worked on though because of omapdrm changing over to use generic displays.
andeaker said:
Is it possible to boot LineageOS with a Linux kernel of 3.20 or higher?
Click to expand...
Click to collapse
See the previous post about v4.19-rc5 kernel status. No idea how much work it would be to get LineageOS images working with the
mainline kernel.. Probably at least the graphics would be an issue. Using TI's Android tree with droid4 patches backported to it might
be a good starting point if somebody wants to experiment with that, TI might have SGX540 support there for other SoCs.
how would i go about getting this working n the droid bionic? im wanting to run maemo-leste, but the latest update switched from just safestrap and ddroid, to this. and apparently trying to stupidly flash this as-is didnt work out
tvall said:
how would i go about getting this working n the droid bionic? im wanting to run maemo-leste, but the latest update switched from just safestrap and ddroid, to this. and apparently trying to stupidly flash this as-is didnt work out
Click to expand...
Click to collapse
Hmm you probably need to stick with SafeStrap for bionic, I don't think bionic uses a utags partition that's needed for the kernel cmdline.
tmlind said:
So omebody just please do standard LineageOS images that don't rely on SafeStrap!
Click to expand...
Click to collapse
I finally got around finishing writing some docs for installing LineageOS to raw partitions, please test
Make back-ups as needed first though.
For instructions, see files PARTITIONS and INSTALL at:
https://github.com/tmlind/droid4-kexecboot
hope this is on-topic - is it possible to use this to boot an OS that's installed on the SD card? I don't have D4 yet, but am waiting to receive one in the next few weeks.
sicelo.m said:
hope this is on-topic - is it possible to use this to boot an OS that's installed on the SD card? I don't have D4 yet, but am waiting to receive one in the next few weeks.
Click to expand...
Click to collapse
Yeah you can boot whatever Linux distro(s) you prefer from the SD card with the current mainline kernel and few pending patches.
That's all work in progress though, certainly usable for tinkering though
I doubt that booting Android on the SD card currently works though.

Categories

Resources