FORUMS
Remove All Ads from XDA

[kexec] droid4-kexecboot and booting raw partitions

20 posts
Thanks Meter: 48
 
By tmlind, Junior Member on 21st January 2018, 06:02 PM
Post Reply Email Thread
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
The Following 5 Users Say Thank You to tmlind For This Useful Post: [ View ] Gift tmlind Ad-Free
 
 
21st January 2018, 10:04 PM |#2  
Junior Member
Thanks Meter: 27
 
More
Nice, this works with lineage os on slot 1 now. Im currently building postmarketos and a mainline kernel to test
The Following User Says Thank You to IM_back! For This Useful Post: [ View ] Gift IM_back! Ad-Free
21st January 2018, 11:42 PM |#3  
Junior Member
Thanks Meter: 27
 
More
The bootloader refuses to boot with mmcblk1p20 erased. But a empty ext3 partiton is apperently enough to make it happy
27th January 2018, 04:50 PM |#4  
tmlind's Avatar
OP Junior Member
Thanks Meter: 48
 
More
Quote:
Originally Posted by IM_back!

The bootloader refuses to boot with mmcblk1p20 erased. But a empty ext3 partiton is apperently enough to make it happy

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.
28th January 2018, 01:40 PM |#5  
Junior Member
Thanks Meter: 27
 
More
Quote:
Originally Posted by tmlind

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.

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?
28th January 2018, 05:16 PM |#6  
tmlind's Avatar
OP Junior Member
Thanks Meter: 48
 
More
Quote:
Originally Posted by IM_back!

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.

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.

Quote:
Originally Posted by IM_back!

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?

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.
24th March 2018, 03:35 PM |#7  
tmlind's Avatar
OP Junior Member
Thanks Meter: 48
 
More
Quote:
Originally Posted by tmlind

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

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.
The Following User Says Thank You to tmlind For This Useful Post: [ View ] Gift tmlind Ad-Free
24th March 2018, 09:03 PM |#8  
Member
Flag karachi
Thanks Meter: 7
 
More
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 .
27th March 2018, 09:07 PM |#9  
Junior Member
Thanks Meter: 3
 
More
mmcblk1p16 partition is usable as alternative ISO storage
Quote:
Originally Posted by tmlind

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.

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!
29th March 2018, 11:07 PM |#10  
tmlind's Avatar
OP Junior Member
Thanks Meter: 48
 
More
Quote:
Originally Posted by dinosaur99

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"

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..
The Following User Says Thank You to tmlind For This Useful Post: [ View ] Gift tmlind Ad-Free
16th April 2018, 10:24 PM |#11  
Junior Member
Thanks Meter: 27
 
More
Quote:
Originally Posted by tmlind

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.

Thank you for your excellent work!
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes