This repository has been archived by the owner. It is now read-only.

Motorola Droid 4 (maserati) #1039

Merged
merged 8 commits into from Mar 16, 2018

Conversation

Projects
None yet
6 participants
@NotKit
Collaborator

NotKit commented Dec 25, 2017

This adds basic support for Motorola Droid 4 (maserati). postmarketOS boots and can be accessed through SSH via USB.

osk-sdk would require this hack for framebuffer to display: https://github.com/TeamWin/Team-Win-Recovery-Project/blob/twrp2.7/minuitwrp/graphics.c#L165. droid-hal-maserati and xf86-video-hwcomposer from libhybris branch can be used for accelerated Xorg server and starting hildon-desktop.

LuneOS UI can be launched with qt5-qpa-hwcomposer and changes to init scripts mentioned in #629

@ollieparanoid

Thanks for making the PR! I've added a few comments.

@@ -0,0 +1,22 @@
#!/bin/sh

This comment has been minimized.

@ollieparanoid

ollieparanoid Dec 26, 2017

Member

What does this script do, is this for booting postmarketOS off an image file?

If that was the case, I would recommend to integrate this in a way that it can easily be used by all devices (changing the initramfs instead of providing a hook), and I would do it in its own PR.

@ollieparanoid

ollieparanoid Dec 26, 2017

Member

What does this script do, is this for booting postmarketOS off an image file?

If that was the case, I would recommend to integrate this in a way that it can easily be used by all devices (changing the initramfs instead of providing a hook), and I would do it in its own PR.

This comment has been minimized.

@NotKit

NotKit Dec 26, 2017

Collaborator

The device doesn't have unlocked bootloader, so SafeStrap recovery and kexec is used to boot custom kernels/OSes. SafeStrap supports 4 ROM slots on sd-card, +stock (can be used for LineageOS, but installing pmOS there would brick the device) and safe (installs to unused partitions). That script tries to read active SafeStrap slot and boot off correct image file. So it's not done in exactly generic way to be integrated for all devices.

@NotKit

NotKit Dec 26, 2017

Collaborator

The device doesn't have unlocked bootloader, so SafeStrap recovery and kexec is used to boot custom kernels/OSes. SafeStrap supports 4 ROM slots on sd-card, +stock (can be used for LineageOS, but installing pmOS there would brick the device) and safe (installs to unused partitions). That script tries to read active SafeStrap slot and boot off correct image file. So it's not done in exactly generic way to be integrated for all devices.

Show outdated Hide outdated aports/device/device-motorola-maserati/APKBUILD
Show outdated Hide outdated aports/device/device-motorola-maserati/deviceinfo
@ollieparanoid

This comment has been minimized.

Show comment
Hide comment
@ollieparanoid

ollieparanoid Dec 26, 2017

Member

Thanks for the explanation! I think these points should be addressed before merging:

  • remove the droid/libhybris depends, since this is the master branch
  • write a wiki page for the device, that explains how to perform the installation
Member

ollieparanoid commented Dec 26, 2017

Thanks for the explanation! I think these points should be addressed before merging:

  • remove the droid/libhybris depends, since this is the master branch
  • write a wiki page for the device, that explains how to perform the installation
@jja2000

This comment has been minimized.

Show comment
Hide comment
@jja2000

jja2000 Dec 29, 2017

Have you tried using the Mainline kernel instead of the one that ships with the device?
SRE still seems to be working on it and the current hw compatibility seems to be nearing completion.

http://elektranox.org/droid4/

jja2000 commented Dec 29, 2017

Have you tried using the Mainline kernel instead of the one that ships with the device?
SRE still seems to be working on it and the current hw compatibility seems to be nearing completion.

http://elektranox.org/droid4/

@NotKit

This comment has been minimized.

Show comment
Hide comment
@NotKit

NotKit Dec 29, 2017

Collaborator

@jja2000 yes, I did. Ideally I would package both, since mainline support and running newer kernel is cool, but it lacks 3D acceleration, cameras and voice calls, which is possible with Android one with libhybris and proper middleware.

Collaborator

NotKit commented Dec 29, 2017

@jja2000 yes, I did. Ideally I would package both, since mainline support and running newer kernel is cool, but it lacks 3D acceleration, cameras and voice calls, which is possible with Android one with libhybris and proper middleware.

@tmlind

This comment has been minimized.

Show comment
Hide comment
@tmlind

tmlind Jan 9, 2018

Cool to see this :) I sure hope you get things booting with droid4-kexecboot as SafeStrap has quite a few non-standard dependencies we can completely avoid that way. So the comments above about not having and unlocked bootloader above are no longer really true :p

tmlind commented Jan 9, 2018

Cool to see this :) I sure hope you get things booting with droid4-kexecboot as SafeStrap has quite a few non-standard dependencies we can completely avoid that way. So the comments above about not having and unlocked bootloader above are no longer really true :p

@NotKit

This comment has been minimized.

Show comment
Hide comment
@NotKit

NotKit Jan 9, 2018

Collaborator

@tmlind after droid4-kexecboot is installed, can system/data/userdata (? - mmcblk1p25) partitions be safely overwritten?

Collaborator

NotKit commented Jan 9, 2018

@tmlind after droid4-kexecboot is installed, can system/data/userdata (? - mmcblk1p25) partitions be safely overwritten?

@tmlind

This comment has been minimized.

Show comment
Hide comment
@tmlind

tmlind Jan 9, 2018

@NotKit you should first check if mmcblk1p25 is vfat and has SafeStrap config files and ask for confirmation before reformatting and installing to it naturally.

But yeah I've been using mmcblk1p25 as my ext4 rootfs with mainline kernel and alpine for past three or four months, so that's 8GB right there on the faster eMMC so worth the extra effort for sure :) For reference, the logic for mounting partitions was discussed a bit few days ago also the SailfishOS support I guess with the same Kit :)

https://talk.maemo.org/showpost.php?s=2769ccef9c9bf887a6d85749576f6d6b&p=1539649&postcount=113

tmlind commented Jan 9, 2018

@NotKit you should first check if mmcblk1p25 is vfat and has SafeStrap config files and ask for confirmation before reformatting and installing to it naturally.

But yeah I've been using mmcblk1p25 as my ext4 rootfs with mainline kernel and alpine for past three or four months, so that's 8GB right there on the faster eMMC so worth the extra effort for sure :) For reference, the logic for mounting partitions was discussed a bit few days ago also the SailfishOS support I guess with the same Kit :)

https://talk.maemo.org/showpost.php?s=2769ccef9c9bf887a6d85749576f6d6b&p=1539649&postcount=113

@tmlind

This comment has been minimized.

Show comment
Hide comment
@tmlind

tmlind Jan 15, 2018

Looks like the legacy /usr/sbin/kexec-droid4 has some bug and does not properly load the dtb the same way as kexec in SafeStrap. So to kexecboot v3.0.8 based kernels with droid4-kexecboot, please use the SafeStrap /system/etc/kexec/kexec binary. Or just update /usr/sbin/kexec wrapper script to use kexecboot mounted location for the SafeStrap kexec binary as the 4MB droid4-kexecboot image is out of disk space. Or just do it manually for now until I have fixed droid4-kexecboot legacy kexec.

Then for the v3.0.8 booted kernel, you should disable CONFIG_CMDLINE_FORCE=y I think so the passed kernel command line is used instead of the one in atags. If that does not help, then I think we need to generate the legacy atags dynamically in the legacy kexec binary.

Update: I just pushed out 2018-01-15 droid4-kexecboot image that now can kexec boot SafeStrap installed images, it was the kexec-tools uncompress ratio assumptions again..

tmlind commented Jan 15, 2018

Looks like the legacy /usr/sbin/kexec-droid4 has some bug and does not properly load the dtb the same way as kexec in SafeStrap. So to kexecboot v3.0.8 based kernels with droid4-kexecboot, please use the SafeStrap /system/etc/kexec/kexec binary. Or just update /usr/sbin/kexec wrapper script to use kexecboot mounted location for the SafeStrap kexec binary as the 4MB droid4-kexecboot image is out of disk space. Or just do it manually for now until I have fixed droid4-kexecboot legacy kexec.

Then for the v3.0.8 booted kernel, you should disable CONFIG_CMDLINE_FORCE=y I think so the passed kernel command line is used instead of the one in atags. If that does not help, then I think we need to generate the legacy atags dynamically in the legacy kexec binary.

Update: I just pushed out 2018-01-15 droid4-kexecboot image that now can kexec boot SafeStrap installed images, it was the kexec-tools uncompress ratio assumptions again..

@ollieparanoid

ollieparanoid suggested changes Feb 21, 2018 edited

@tmlind: Thanks for telling us about droid4-kexecboot, and cool that you're already using Alpine on your Droid 4. If you're interested and have the time, you could help us with streamlining pmOS (installation and running) on the Droid 4 once this initial work is integrated.

@MartijnBraam: thanks for rebasing and creating the wiki page

@NotKit: In the chat you asked yesterday whether we could merge your Droid 4 work now, since #1122 was fixed, which blocked merging the feature/hybris branch from getting merged into master.

Let me summarize what we have so far:

  • branch device/motorola-maserati (this PR):
    • doesn't have libhybris code
    • has PMOS_NO_SAFESTRAP check
  • branch feature/hybris:
    • adds libhybris
    • modifies postmarketos-mkinitfs
      • from what I can tell this seems to be incompatible with the initramfs hook from the maserati branch?
    • changes the user's UID in the pmbootstrap installation, so libhybris works properly
      • in other places, there are checks involving the username "user" which can be freely chosen, I think this needs to be fixed and we should only go with setting another UID in Python code
    • building multiple versions of kwin (and other packages) for various libhybris versions (which was the most practical solution)

So actually #1122 is not relevant for this PR. But this PR has been open long enough, and I'd be happy if we could merge it soon. After this PR is through, I would recommend making small PRs for the libhybris changes as these are easier to test and review (starting with the libhybris package itself).

It would be awesome if you could do the following, so we can ship it:

  • address the open points in the review
  • verify on your device that it still boots
  • update documentation
    • installation instructions in the device specific wiki page (especially the safestrap stuff, at least a link to where it's explained)
    • adding the device to the overview as booting device

Thanks again for all the work you've put into this @NotKit! 👍

@MartijnBraam

This comment has been minimized.

Show comment
Hide comment
@MartijnBraam

MartijnBraam Feb 27, 2018

Member

@NotKit I can't seem to figure out how to make safestrap boot postmarketos since I can only find how to make it switch /system and /data and nothing about the kernel/initfs. How do you boot it?

Member

MartijnBraam commented Feb 27, 2018

@NotKit I can't seem to figure out how to make safestrap boot postmarketos since I can only find how to make it switch /system and /data and nothing about the kernel/initfs. How do you boot it?

@ollieparanoid

This comment has been minimized.

Show comment
Hide comment
@ollieparanoid

ollieparanoid Feb 27, 2018

Member

@MartijnBraam: From reading the initramfs hook (which you guys probably need to boot pmOS off it with safestrap), I would guess that you put the boot.img file next to the system.img file on the partition.

Member

ollieparanoid commented Feb 27, 2018

@MartijnBraam: From reading the initramfs hook (which you guys probably need to boot pmOS off it with safestrap), I would guess that you put the boot.img file next to the system.img file on the partition.

@MartijnBraam

This comment has been minimized.

Show comment
Hide comment
@MartijnBraam

MartijnBraam Feb 27, 2018

Member

What I found so far by looking at the sailfish port for maserati is that I need to put the kernel and the initfs in /system/etc/kexec/ inside the system.img file and then put a system.img and data.img in a zip to get it on the phone. Which is kinda messy and makes it impossible to update the kernel from inside pmos.

Member

MartijnBraam commented Feb 27, 2018

What I found so far by looking at the sailfish port for maserati is that I need to put the kernel and the initfs in /system/etc/kexec/ inside the system.img file and then put a system.img and data.img in a zip to get it on the phone. Which is kinda messy and makes it impossible to update the kernel from inside pmos.

@NotKit

This comment has been minimized.

Show comment
Hide comment
@NotKit

NotKit Feb 28, 2018

Collaborator

If SafeStrap is used, there is no boot.img, but kernel/initramfs in system partition. Sorry, I'm currently in another country, so can't look into this properly till I return on Friday.

Collaborator

NotKit commented Feb 28, 2018

If SafeStrap is used, there is no boot.img, but kernel/initramfs in system partition. Sorry, I'm currently in another country, so can't look into this properly till I return on Friday.

@NotKit

This comment has been minimized.

Show comment
Hide comment
@NotKit

NotKit Mar 5, 2018

Collaborator

To go with the direction proposed in #1275, I addressed @ollieparanoid open points in review and rebased it to master to start with.

This reminded me, without libhybris, we need a small program like msm-fb-refresher in initramfs (is it replaced by kernel fix now?) to init display.

Collaborator

NotKit commented Mar 5, 2018

To go with the direction proposed in #1275, I addressed @ollieparanoid open points in review and rebased it to master to start with.

This reminded me, without libhybris, we need a small program like msm-fb-refresher in initramfs (is it replaced by kernel fix now?) to init display.

@NotKit

This comment has been minimized.

Show comment
Hide comment
@NotKit

NotKit Mar 14, 2018

Collaborator

Can confirm it's still booting after rebase. Any idea if I should somehow package https://gist.github.com/NotKit/7d233dd21ff1c4f34947d6a56ace3ce0? This allows it to activate framebuffer output on Android kernel.

Collaborator

NotKit commented Mar 14, 2018

Can confirm it's still booting after rebase. Any idea if I should somehow package https://gist.github.com/NotKit/7d233dd21ff1c4f34947d6a56ace3ce0? This allows it to activate framebuffer output on Android kernel.

@drebrez

This comment has been minimized.

Show comment
Hide comment
@drebrez

drebrez Mar 14, 2018

Member

@NotKit nice small tool, maybe we should add that activate flag also in the fbdebug tool is case some other device has a similar situation.
Or if it will be packaged as a tool itself (maybe something like fbactivator), then we should include it to the debug-shell hook.

Member

drebrez commented Mar 14, 2018

@NotKit nice small tool, maybe we should add that activate flag also in the fbdebug tool is case some other device has a similar situation.
Or if it will be packaged as a tool itself (maybe something like fbactivator), then we should include it to the debug-shell hook.

@NotKit

This comment has been minimized.

Show comment
Hide comment
@NotKit

NotKit Mar 14, 2018

Collaborator

@drebrez Checked fbdebug, yes, that would be nice to have. Can we add fbdebug to initramfs to call it from device-specific hook?

Initial attempt at documenting installation: https://wiki.postmarketos.org/wiki/Motorola_Droid_4_(motorola-maserati)#Installation. Feels way more complicated than it needs to be.

Collaborator

NotKit commented Mar 14, 2018

@drebrez Checked fbdebug, yes, that would be nice to have. Can we add fbdebug to initramfs to call it from device-specific hook?

Initial attempt at documenting installation: https://wiki.postmarketos.org/wiki/Motorola_Droid_4_(motorola-maserati)#Installation. Feels way more complicated than it needs to be.

@NotKit NotKit requested a review from MartijnBraam Mar 14, 2018

@drebrez

This comment has been minimized.

Show comment
Hide comment
@drebrez

drebrez Mar 14, 2018

Member

@NotKit the fbdebug is added to the initramfs if it's present during the creation of the boot.img, this means that adding fbdebug to the depends of the device-aaa-bbb package it will be automatically included, and should work calling it from a device hook.
Maybe we can rename the fbdebug to fbtools or something, and change it's purpose, also adding the pan-loop operation and replace the msm-fb-refresher.
We will have our own tool to fix all kind of stuff related to the framebuffer. @ollieparanoid what you think?

Member

drebrez commented Mar 14, 2018

@NotKit the fbdebug is added to the initramfs if it's present during the creation of the boot.img, this means that adding fbdebug to the depends of the device-aaa-bbb package it will be automatically included, and should work calling it from a device hook.
Maybe we can rename the fbdebug to fbtools or something, and change it's purpose, also adding the pan-loop operation and replace the msm-fb-refresher.
We will have our own tool to fix all kind of stuff related to the framebuffer. @ollieparanoid what you think?

@ollieparanoid

ollieparanoid approved these changes Mar 14, 2018 edited

LGTM.

@NotKit: Thanks for updating it, testing again and for writing install instructions! 🎉

@MartijnBraam: @NotKit requested a review from you, when you think it is ready and Travis runs through as well, please merge it (with a good commit message).

@ollieparanoid

This comment has been minimized.

Show comment
Hide comment
@ollieparanoid

ollieparanoid Mar 14, 2018

Member

We will have our own tool to fix all kind of stuff related to the framebuffer. @ollieparanoid what you think?

Sounds good to me (see #1336), but I would try to get this initial booting version merged first, even if the screen does not show anything yet (because it has been open for such a long time, and then we have a good base to do further PRs from).

Member

ollieparanoid commented Mar 14, 2018

We will have our own tool to fix all kind of stuff related to the framebuffer. @ollieparanoid what you think?

Sounds good to me (see #1336), but I would try to get this initial booting version merged first, even if the screen does not show anything yet (because it has been open for such a long time, and then we have a good base to do further PRs from).

NotKit added some commits Dec 11, 2017

[motorola-maserati] Add device-motorola-maserati and linux-motorola-m…
…aserati

[motorola-maserati] Rename deviceinfo variable flash_methods to flash_method
[motorola-maserati] Add PMOS_NO_SAFESTRAP kernel cmdline
This can be used to forcefully skip SafeStrap partition mount in device
initramfs hook, for example when booting with droid4-kexecboot on device with
SafeStrap configured as well.

ollieparanoid added some commits Mar 14, 2018

Remove git left overs
Looks like these aren't needed anymore with the sed that removes
calling the git command in the Makefile.
Revert "Remove git left overs"
Okay, the .git/HEAD file is actually needed, because a Makefile
depends on it.
@ollieparanoid

This comment has been minimized.

Show comment
Hide comment
@ollieparanoid

ollieparanoid Mar 16, 2018

Member

me:

NotKit: so @V13Axel confirmed that your PR works. Do you want to get it merged now, or should we wait some more for an additional review?

@NotKit:

ollieparanoid[m], let's get it merged then

Member

ollieparanoid commented Mar 16, 2018

me:

NotKit: so @V13Axel confirmed that your PR works. Do you want to get it merged now, or should we wait some more for an additional review?

@NotKit:

ollieparanoid[m], let's get it merged then

@ollieparanoid ollieparanoid merged commit 960ae07 into master Mar 16, 2018

3 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
coverage/coveralls Coverage decreased (-0.6%) to 78.886%
Details

@ollieparanoid ollieparanoid deleted the device/motorola-maserati branch Mar 16, 2018

@NotKit NotKit referenced this pull request Apr 7, 2018

Merged

Package libhybris #1402

ollieparanoid added a commit that referenced this pull request Apr 10, 2018

Package libhybris (#1402)
As discussed in #1039, I want to split feature/hybris branch into
smaller sensible pull requests.

This is the first one that simply adds android-headers and libhybris
packaging. libhybris allows apps compiled with glibc (musl in our case)
to load Android libraries that utilize bionic libc, which is used to
load proprietary userspace drivers.

The package isn't very useful on its own and requires core (non-UI/Java)
Android services to be running in some way - either in Halium-style LXC
container or in same root as main OS with modified init (Mer/Sailfish do
it this way). Both ways are tested to work in postmarketOS.

libhybris also includes some tests, not all of them are known to be
representative, but test_vibrator and test_egl_configs are usually good
indicators if system is set up correctly.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.