Skip to content
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
Merged

Motorola Droid 4 (maserati) #1039

merged 8 commits into from Mar 16, 2018

Conversation

@NotKit
Copy link
Collaborator

@NotKit 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

@NotKit NotKit force-pushed the device/motorola-maserati branch from 1ba44c0 to 927cd62 Dec 25, 2017
Copy link
Member

@ollieparanoid ollieparanoid left a comment

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.

This comment has been minimized.

@NotKit

NotKit Dec 26, 2017
Author 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.

}

hybris() {
depends="droid-hal-maserati libhybris-4.4"

This comment has been minimized.

@ollieparanoid

ollieparanoid Dec 26, 2017
Member

We don't have the depends in this branch, so I would remove this subpackage to keep master consistent.

deviceinfo_msm_refresher="true"

# Bootloader related
deviceinfo_flash_method="none"

This comment has been minimized.

@ollieparanoid

ollieparanoid Dec 26, 2017
Member

Could you explain that?

This comment has been minimized.

@NotKit

NotKit Dec 26, 2017
Author Collaborator

deviceinfo_msm_refresher - need to remove that, it doesn't actually have any effect on device (I thought it could help at some point).

deviceinfo_flash_method - due to need to use SafeStrap, no existing flash method would work. I installed it manually when testing, but Ideally a zip needs to be generated, containing at least the kernel and kexec scripts to be installed onto slot's virtual /system partition.

@ollieparanoid
Copy link
Member

@ollieparanoid 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
Copy link

@jja2000 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
Copy link
Collaborator Author

@NotKit 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
Copy link

@tmlind 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
Copy link
Collaborator Author

@NotKit NotKit commented Jan 9, 2018

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

@tmlind
Copy link

@tmlind 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

@NotKit NotKit force-pushed the device/motorola-maserati branch 2 times, most recently from 0025377 to bdc16bc Jan 13, 2018
@tmlind
Copy link

@tmlind 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..

@MartijnBraam MartijnBraam force-pushed the device/motorola-maserati branch from bdc16bc to 043ff57 Feb 21, 2018
Copy link
Member

@ollieparanoid ollieparanoid left a comment

@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! 👍

deviceinfo_data_partition="/dev/mmcblk1p24"
deviceinfo_system_partition="/dev/mmcblk1p20"
deviceinfo_preinstall_partition="/dev/mmcblk1p22"
deviceinfo_webtop_partition="/dev/mmcblk1p23"

This comment has been minimized.

@ollieparanoid

ollieparanoid Feb 21, 2018
Member

webtop_partition and preinstall_partition are not used yet, are they necessary?
If it's just for information purpose, I would recommend to write that into the device's article in the wiki.

options="!check"
depends="linux-motorola-maserati"
source="deviceinfo 10-safestrap-maserati.sh"
subpackages="$pkgname-hybris"

This comment has been minimized.

@MartijnBraam
Copy link
Member

@MartijnBraam 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
Copy link
Member

@ollieparanoid 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
Copy link
Member

@MartijnBraam 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.

@MartijnBraam MartijnBraam force-pushed the device/motorola-maserati branch from 043ff57 to 1d03134 Feb 27, 2018
@NotKit
Copy link
Collaborator Author

@NotKit 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
Copy link
Collaborator Author

@NotKit 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 NotKit force-pushed the device/motorola-maserati branch from 7d20553 to 28cca22 Mar 5, 2018
@NotKit NotKit force-pushed the device/motorola-maserati branch from 28cca22 to f6f49c2 Mar 14, 2018
@NotKit
Copy link
Collaborator Author

@NotKit 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
Copy link
Member

@drebrez 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
Copy link
Collaborator Author

@NotKit 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
@NotKit NotKit force-pushed the device/motorola-maserati branch 2 times, most recently from e6e4bf4 to b658b40 Mar 14, 2018
@drebrez
Copy link
Member

@drebrez 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?

Copy link
Member

@ollieparanoid ollieparanoid left a comment

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
Copy link
Member

@ollieparanoid 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 and others added 7 commits Dec 11, 2017
…aserati

[motorola-maserati] Rename deviceinfo variable flash_methods to flash_method
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.
Oliver Smith
Oliver Smith
Looks like these aren't needed anymore with the sed that removes
calling the git command in the Makefile.
Oliver Smith
Okay, the .git/HEAD file is actually needed, because a Makefile
depends on it.
Oliver Smith
@ollieparanoid ollieparanoid force-pushed the device/motorola-maserati branch from 5bdbc34 to 20cfea7 Mar 14, 2018
Oliver Smith
@ollieparanoid
Copy link
Member

@ollieparanoid 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
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 mentioned this pull request Apr 7, 2018
ollieparanoid pushed a commit that referenced this pull request Apr 10, 2018
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.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

6 participants
You can’t perform that action at this time.