Jump to content

Google Nexus 5 (lg-hammerhead): Difference between revisions

From postmarketOS Wiki
IdanHoro (talk | contribs)
m --no-fde removed (deprecated)
Knuxify (talk | contribs)
use note template (my guess as to why it didn't work is because of the equals signs in the url)
 
(107 intermediate revisions by 23 users not shown)
Line 1: Line 1:
<!-- NOTE at the top. For some reason, the {{note}} template does not work with links inside? -->
{{note|1=Take a look at the [https://gitlab.postmarketos.org/postmarketOS/pmaports/-/issues?scope=all&utf8=%E2%9C%93&state=opened&search=hammerhead open hammerhead issues] before starting an installation!}}
<div role="note" class="note" style="padding: 5px 15px; color: #705000; border: 1px solid #fde29b; background-color: #fdf1d1; margin-top: 5px; margin-bottom: 15px;">
 
After upgrades in mesa, ofono, kernel we have had several regressions and not all of them are fixed. It would be great if you could help out.<br>
'''In any case, take a look at the [https://gitlab.com/postmarketOS/pmaports/issues?scope=all&utf8=%E2%9C%93&state=opened&search=hammerhead open hammerhead issues] before starting an installation!'''
</div>
{{Infobox device
{{Infobox device
| name = Nexus 5
| name = Nexus 5
| manufacturer = LG
| manufacturer = Google (LG)
| codename = lg-hammerhead
| codename = lg-hammerhead
| image = File:Nexus5-pmos-home.jpg
| image = File:Nexus5-pmos-home.jpg
| imagecaption = Nexus 5 running plasma mobile
| imagecaption = Nexus 5 running plasma mobile
| releaseyear = 2013
| releaseyear = 2013
| originalsoftware = Android 4.4.4 on Linux 3.4.0
| originalsoftware = Android
| chipset = Qualcomm MSM8974 Snapdragon 800
| optionalsoftware = Ubuntu Touch
| originalversion = 4.4.4 (Linux 3.4.0)
| extendedversion = 6
| chipset = Qualcomm Snapdragon 800 (MSM8974)
| cpu = 4x 2.3 GHz Krait 400
| cpu = 4x 2.3 GHz Krait 400
| gpu = Adreno 330
| gpu = Adreno 330
Line 18: Line 18:
| storage = 16/32 GB
| storage = 16/32 GB
| memory = 2 GB
| memory = 2 GB
| architecture = armhf
| architecture = armv7
| whet_dhry = 415.0
| type = Handset
| whet_dhry = 840.9
| status_usbnet = Y
| status_usbnet = Y
| status_flashing = Y
| status_flashing = Y
Line 26: Line 27:
| status_wifi = Y
| status_wifi = Y
| status_xwayland = Y
| status_xwayland = Y
| status_fde =  
| status_fde = Y
| status_mainline = Y
| status_mainline = Y
| status_battery =
| status_battery = P
| status_3d = Y
| status_3d = P
| status_accel =  
| status_accel = P
| status_audio = N
| status_audio = N
| status_bluetooth =
| status_bluetooth = Y
| status_camera =
| status_camera =
| status_gps =  
| status_gps =  
| status_mobiledata = P
| status_mobiledata = Y
| status_sms = Y
| status_sms = Y
| status_otg = Y
| status_otg = Y
Line 41: Line 42:
| booting = yes
| booting = yes
}}
}}
{{Based on SoC|Qualcomm_Snapdragon_800/801_(MSM8974)|Snapdragon 800}}


=== Contributors ===
=== Contributors ===
Line 48: Line 50:
* bshah
* bshah
* opendata
* opendata
* JuniorJPDJ
* otto
=== Users owning this device ===
{{Device owners}}


=== Fastboot Mode ===
== Installation ==
 
=== Fastboot mode ===


First make sure to enable USB debugging in Android ([https://www.kingoapp.com/root-tutorials/how-to-enable-usb-debugging-mode-on-android-5-lollipop.htm])
First make sure to enable USB debugging in Android ([https://www.kingoapp.com/root-tutorials/how-to-enable-usb-debugging-mode-on-android-5-lollipop.htm])
Then with device powered off, hold down {{button|Volume Down}} and {{button|Power}} buttons simultaneously for a few seconds, until Fastboot Mode screen appears.
Then with device powered off, hold down {{button|Volume Down}} and {{button|Power}} buttons simultaneously for a few seconds, until Fastboot Mode screen appears.


=== OEM Unlock ===
=== OEM unlock ===


Get device into Fastboot Mode, plug in USB cable, then:
Get device into Fastboot Mode, plug in USB cable, then:


<source lang="shell-session">
<syntaxhighlight lang="shell-session">
$ sudo fastboot oem unlock
$ sudo fastboot oem unlock
</source>
</syntaxhighlight>


When prompted on device, use Volume-Up/Down buttons to highlight choice, then Power button to select it.  The Fastboot Mode screen will appear again, and a message regarding flashing will appear briefly.
When prompted on device, use Volume-Up/Down buttons to highlight choice, then Power button to select it.  The Fastboot Mode screen will appear again, and a message regarding flashing will appear briefly.


=== Installation ===
=== Flashing ===
 
For installation you need to flash [[lk2nd]] and flash the rootfs. Do not flash the <code>boot</code> partition since lk2nd uses [https://github.com/msm8916-mainline/lk2nd/issues/113 fs-boot] functionality to boot the kernel from the <code>/boot</code> partition of the rootfs.
 
<syntaxhighlight lang="shell-session">
$ pmbootstrap flasher flash_lk2nd
$ pmbootstrap flasher flash_rootfs
</syntaxhighlight>
 
If flashing fails with an error like "Unknown chunk type", you may need to update your bootloader. bootloader-hammerhead-hhZ20h.img comes with the latest firmware from [https://developers.google.com/android/images the android image page] and can be flashed with <code>fastboot flash bootloader path/to/bootloader-hammerhead-hhZ20h.img</code>.
 
== Hardware notes ==
 
=== DDR ===
There are 2 variants of hammerhead with different DDR vendors.
 
1. D820/D821(E) - Elpida
 
2. D820/D821(H) - Hynix
 
==== Stock bootloader/fastboot mode ====
<syntaxhighlight lang="shell-session">
$ fastboot getvar variant
variant: hammerhead D821(E) 16GB
...
</syntaxhighlight>
 
==== lk2nd ====
<syntaxhighlight lang="shell-session">
$ fastboot oem lk_log && fastboot get_staged /dev/stdout | grep ddr
...                         
[40] Command line from primary bootloader: lk2nd uart_console=enable gpt=enable lge.kcal=0|0|0|x lge.rev=rev_11 androidboot.laf androidboot.emmc=true androidboot.serialno=0000000000000000 androidboot.bootloader=HHZ20h androidboot.baseband=msm androidboot.hardware.sku=D821 androidboot.hardware.ddr=elpida androidboot.hardware.display=orise androidboot.revision=11
...
</syntaxhighlight>
 
=== Charge type ===
 
In case your phone is always plugged into power outlet 24/7, you can set it to be slow charge mode and
reduce the charge voltage and current to minimum (set it at your own risk):
 
<syntaxhighlight lang="shell-session">
$ cat /etc/local.d/bq24190_charger.start
echo Trickle > /sys/class/power_supply/bq24190-charger/charge_type
echo 3504000 > /sys/class/power_supply/bq24190-charger/constant_charge_voltage
echo 102400 > /sys/class/power_supply/bq24190-charger/constant_charge_current
</syntaxhighlight>
 
See this reddit [https://www.reddit.com/r/GPDPocket/comments/cfyekh/limit_battery_charge thread] for some useful information.
 
See kernel [https://www.kernel.org/doc/html/v5.9/power/power_supply_class.html documentation] for details.
 
=== Power management ===
 
At this stage the directory <code>/sys/devices/system/cpu/cpufreq</code> is empty, so it seems there is no integrated power management.
 
You can disable cpu cores, though:
 
<syntaxhighlight lang="bash">
#!/bin/bash
echo 0 | sudo tee /sys/devices/system/cpu/cpu{2..3}/online
</syntaxhighlight>
 
[[File:Nexus_5_-_sound_and_input_through_network_on_a_secondary_device_-_thumbnail.png|thumb|right|[https://youtu.be/diYgNXi3zY8 Video]: a working example of postmarketOS sharing sound and input running with a secondary device on top of [[The Mainline Kernel|mainline Linux]].]]
 
=== Audio ===
 
No one has still worked on playback and recording support on-device.
 
Neverthless you can use a bluetooth headphone/speaker or another device (like an android device) to stream your audio.
 
'''source device'''
 
<syntaxhighlight lang="bash">
# /etc/profile
export PULSE_SERVER=<sink_device_ip_address>
</syntaxhighlight>


First build the image:
'''sink Device'''
<source lang="shell-session">
$ pmbootstrap init
$ pmbootstrap install
</source>


Then in order to flash it put your device in fastboot mode, and plug it in USB. Then do:
<syntaxhighlight lang="bash">
# etc/pulse/default.pa
load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1
</syntaxhighlight>


<source lang="shell-session">
Don't forget to copy cookie (<code>~/.config/pulse/cookie</code>) to from sink to source!
$ pmbootstrap flasher flash_rootfs --partition userdata
$ sudo fastboot format system
$ pmbootstrap flasher flash_kernel
</source>


=== Issues ===
=== Bluetooth ===


==== Plasma mobile ====
Bluetooth controller works. You can start the service with <code>rc-service bluetooth start</code> and enable it with <code>rc-update add bluetooth</code>
Navigation bar is broken. See [https://gitlab.com/postmarketOS/pmaports/issues/222 this bug].


==== X.org is broken ====
To test, use the [https://wiki.alpinelinux.org/wiki/Raspberry_Pi_3_-_Setting_Up_Bluetooth instructions] on the Alpine wiki.
So, no graphical program can be started. See [https://gitlab.com/postmarketOS/pmaports/issues/221 this bug].
 
=== Cellular modem ===
 
Using instructions for [[Nokia N900 (nokia-n900)#SMS|Nokia N900]] it seems that SMS and calls likely work.
 
=== WiFi===
 
On first boot, if the wifi adapter started in airplane mode and NetworkManager did not detect that,  
a manual workaround is to disable and re-enable the wifi adapter.
 
This can easily be done in the graphic shell (Plasma Mobile has an airplane mode switch in the pull-down menu: check it and uncheck it) or through the shell:
 
<syntaxhighlight lang="shell-session">
$ nmcli radio all off
$ nmcli radio all on
</syntaxhighlight>
 
=== Sensors detail ===
 
For reference, sensor information from sensors sandbox (f-droid) on D820(H) 16GB; note: approximately 18 software-based / derived sensors omitted.
 
<div class="toccolours mw-collapsible mw-collapsed" style="width:500px; overflow:auto;">
sensor details (sensorssandbox)
<div class="mw-collapsible-content">
{| class="wikitable feature-colors"
! style="text-align:left;"| name
! style="text-align:left;"| vendor
! style="text-align:left;"| version
! style="text-align:left;"| type
|-
|MPU6515 Accelerometer
|InvenSense
|1
|1
|-
|AK8963 Magnetometer
|AKM
|1
|2
|-
|MPU6515 Gyroscope
|InvenSense
|1
|4
|-
|APDS-9930/QPDS-T930 Proximity & Light Sensor
|Avago
|2
|8
|-
|BMP280 Barometer
|BOSCH
|1
|6
|}
</div>
</div>
 
== Software notes ==
[[File:MATE on hammerhead (stear prime) video thumbnail.png|thumb|right|[https://youtu.be/IxHzamQqNk0 Video]: MATE desktop on postmarketOS on Nexus 5.]]
 
=== Mate ===
 
Mate works if started with the <code>fbdev</code> driver, otherwise it freezes.
 
==== Booting ====
 
Producing <code>MATE</code> images with <code>pmbootstrap</code> will result in a non-functional device (as of now),
so install the OS using the <code>gnome</code> environment.
 
Then from a root console, install
<code>postmarketos-ui-mate</code>,
<code>lightdm</code>,
<code>lightdm-gtk-greeter</code>,
<code>onboard</code>,
<code>brightnessctl</code>.
 
Proceed to configure LightDM (<code>/etc/lightdm/lightdm-gtk-greeter.conf</code>)
* enable touch keyboard (<code>keyboard=onboard</code>)
* enlarge lightdm fonts (<code>xft-dpi=460</code>)
 
and finally
* test the service (<code>rc-service lightdm restart</code>)
* enable it at boot (<code>rc-update add lightdm</code>)
* disable gdm (<code>rc-update del gdm</code>)
 
==== Scaling ====
 
MATE does not follow GNOME scaling settings nor does it have a scaling control panel,
so you will need to add export variables directly. Add the following lines to <code>/etc/profile</code>:
 
<syntaxhighlight lang="bash">
# /etc/profile
export GDK_SCALE=2
export QT_QPA_PLATFORM=qtc
export QT_SCALE_FACTOR=2
</syntaxhighlight>
 
'''Be aware''' that if you already setup scaling from the GNOME control center, this will probably make really really big.
 
==== Touch keyboard ====
 
To be able to further configure MATE, you will need to ability to cast right clicks:
 
the Onboard touch keyboard is easily configurable and it's able to send any mouse signal you can think of (even ''drag'' and ''double click'').
 
If you don't want to configure the device using touch input, you can always install '''barrier''' to use mouse and keyboard wirelessly from another device.


==== Bluetooth ====
==== Bluetooth ====
Bluetooth seems to be lacking some firmware.


From dmesg:
Installing <code>blueman</code> <code>gnome-bluetooth</code> should suffice.
<source lang="shell-session">
[    0.650667] bluetooth hci0: Direct firmware load for brcm/BCM4335C0.hcd failed with error -2
</source>


Using instructions at https://wiki.alpinelinux.org/wiki/Raspberry_Pi_3_-_Setting_Up_Bluetooth
==== Power button ====
<source lang="shell-session">
apk add bluez
rc-update add bluetooth
</source>


Running bluetoothctl seems to indicate that the controller is recognized:
You can emulate the power button by creating a button on the panel pointing to the following
<source lang="shell-session">
[https://github.com/tallero/misc/blob/master/pmos/power-button-off script].
https://wiki.alpinelinux.org/wiki/Raspberry_Pi_3_-_Setting_Up_Bluetooth
[bluetooth]# power off
Changing power off succeeded
[bluetooth]# power on
Changing power on succeeded
[CHG] Controller 07:16:16:94:0E:5D Powered: yes
</source>


==== WiFi workaround on boot ====
=== Phosh ===
The wifi adapter works in NetworkManager, but it boots in airplane mode and NetworkManager does not detect that. Therefore at boot you need to disable the wifi adapter first, and then re-enable it. This can easily be done in the graphic shell (Plasma Mobile has an airplane mode switch in the pull-down menu: check it and uncheck it) or through the shell:


<source lang="shell-session">
[[File:Running_phosh_on_the_Nexus_5_with_PostmarketOS_-_Youtube_thumbnail.png|thumb|right|[https://youtu.be/y8W-G0G8ajg Video]: a working example of postmarketOS running Phosh on top of [[The Mainline Kernel|mainline Linux]].]]
$ sudo nmcli radio all off
$ sudo nmcli radio all on
</source>


==== Webbrowser ====
==== Graphics ====
In plasma-mobile, Angelfish webbrowser does not run. You may want to install, configure and use qtwebbrowser, [[Firefox]] and/or [[Chromium]].


The interface randomly freeze ({{issue|424|pmaports}}) in particular when heavy loading (browsing and stuff), requiring an hard reboot.
==== Bluetooth ====
There used to be problems with Bluetooth on Phosh ({{issue|904|pmaports}} - apparently fixed).
==== Numeric passwords ====
Be sure to use a numeric password if you want to use phosh, because its lockscreen only accepts digits.
==== Power button ====
Power button turns off the screen but the touchscreen keeps working.
=== Plasma Mobile ===
[https://invent.kde.org/jbbgameich/plasma-angelfish Plasma Angelfish] does not run.
You may want to install another browser, like qtwebbrowser, [[Firefox]] and/or [[Chromium]].
=== Browsing ===
* Qutebrowser crashes;
* Firefox works very well on Xorg, somewhat slower on wayland;
* Dillo will probably work, too.
==== WebkitGTK based ====
* Epiphany;
* Vimb;
* surf;
They work well, but they are slow on both Xorg and Wayland.
== Troubleshooting ==
=== Fastboot unknown chunk type ===


=== Troubleshooting ===
==== Fastboot unknown chunk type ====
Flashing with fastboot seems to fail for some outdated firmware, it prints the message "FAILED (remote: Unknown chunk type)" when trying to flash the rootfs to userdata.
Flashing with fastboot seems to fail for some outdated firmware, it prints the message "FAILED (remote: Unknown chunk type)" when trying to flash the rootfs to userdata.
This can be solved by updating to the [https://developers.google.com/android/images#hammerhead latest baseband firmware and bootloader].
This can be solved by updating to the [https://developers.google.com/android/images#hammerhead latest baseband firmware and bootloader].


==== Remote Data Too Large ====
=== Initramfs oversized boot partition ===
Sometimes `./pmbootstrap.py flasher flash_kernel` can fail with an error message that includes "Failed (remote: data too large)".  This might be solved by updating by reflashing [https://developers.google.com/android/images#hammerhead the latest version of the stock Android image for the device].


=== Partition layout ===
In case <code>postmarketos-mkinitfs</code> oversized the device's boot partition, the device will not boot anymore by it's own.
<pre class="shell">
 
To counter this, there are a few tips to shrink the image file size:
 
'''Aggressive compression'''
 
The default compression use <code>gzip</code> under <code>default</code> compression level.<br>
To apply a more aggressive approach we can use <code>zstd</code> under <code>best</code> compression level ([https://gitlab.postmarketos.org/postmarketOS/postmarketos-mkinitfs/-/blob/master/doc/mkinitfs.1.scd?ref_type=heads#L65 reference]).
 
In order to apply it, it is needed to append both variables to <code>/etc/deviceinfo</code> configuration file:
 
<syntaxhighlight lang="text">
deviceinfo_initfs_compression=zstd:best
deviceinfo_initfs_extra_compression=zstd:best
</syntaxhighlight>
 
'''Removing unused modules'''
 
postmarketOS can come with default modules that can be unused for some users.<br>
To remove such modules, try editting configuration files found under <code>/usr/share/mkinitfs/modules</code> folder.
 
As example, partitions that cannot be found when running:
 
<syntaxhighlight lang="shell-session">
$ df -Th
</syntaxhighlight>
 
Can be removed from <code>00-default.modules</code> configuration file.
 
'''Applying the measurements'''
 
<syntaxhighlight lang="shell-session">
# apk fix
</syntaxhighlight>
 
=== Remote Data Too Large ===
 
Sometimes <code>./pmbootstrap.py flasher flash_kernel</code> can fail with an error message that includes "Failed (remote: data too large)".
This might be solved by updating by reflashing the latest version of the stock Android
[https://developers.google.com/android/images#hammerhead image] for the device.
 
=== Useful aliases ===
 
'''Force reboot'''
 
<syntaxhighlight lang="shell-session">
# echo b > /proc/sysrq-trigger
</syntaxhighlight>
 
'''Input devices'''
 
<syntaxhighlight lang="shell-session">
# cat /proc/bus/input/devices
</syntaxhighlight>
 
== Partition layout ==
 
The eMMC could be either <code>mmcblk0</code> or <code>mmcblk1</code>, and it seems to be random for each boot.
<syntaxhighlight lang="shell-session">
hammerhead:~# fdisk -l -o Device,Start,End,Sectors,Size,Name /dev/mmcblk1
hammerhead:~# fdisk -l -o Device,Start,End,Sectors,Size,Name /dev/mmcblk1


Line 173: Line 430:
/dev/mmcblk1p28  3969024 30777299 26808276 12.8G userdata
/dev/mmcblk1p28  3969024 30777299 26808276 12.8G userdata
/dev/mmcblk1p29 30777300 30777310      11  5.5K grow
/dev/mmcblk1p29 30777300 30777310      11  5.5K grow
</pre>
</syntaxhighlight>
 
== Links ==


=== Links ===
* [https://gitlab.com/unrznbl/gesture/wikis/gesture---handwriting-for-linux-touchscreens shelli-ui: framebuffer console + gesture recognition video demo]
* [https://gitlab.com/unrznbl/gesture/wikis/gesture---handwriting-for-linux-touchscreens shelli-ui: framebuffer console + gesture recognition video demo]
* [https://www.youtube.com/watch?v=u9zw_ewkBJ0 Demonstration video of a Nexus 5 with postmarketOS and plasma]
* [https://www.youtube.com/watch?v=u9zw_ewkBJ0 Demonstration video of a Nexus 5 with postmarketOS and plasma]
* [https://gitlab.com/postmarketOS/pmbootstrap/tree/b1b5acd79d25fedda99dbbbee9050993aec49405/aports/device/linux-lg-hammerhead obsolete downstream kernel packaging]
* [https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/tree/b1b5acd79d25fedda99dbbbee9050993aec49405/aports/device/linux-lg-hammerhead obsolete downstream kernel packaging]
* [https://gitlab.com/postmarketOS/pmaports/tree/master/device/device-lg-hammerhead Device package]
* [https://gitlab.postmarketos.org/postmarketOS/pmaports/-/tree/master/device/testing/device-lg-hammerhead Device package]
* [https://gist.github.com/MartijnBraam/57ec370985af341ceb17521183695a3d dmesg from mainline linux with the missing block devices]
* [https://gist.github.com/MartijnBraam/57ec370985af341ceb17521183695a3d dmesg from mainline linux with the missing block devices]
* [https://github.com/flto/linux/wiki/hammerhead-upstream flto's hammerhead-upstream status page]
* [https://github.com/flto/linux/wiki/hammerhead-upstream flto's hammerhead-upstream status page]
Line 185: Line 443:


== Photos ==
== Photos ==
<gallery>
<gallery>
File:Plasma-mobile-hammerhead.jpg|thumb|left|Plasma Mobile
File:Plasma-mobile-hammerhead.jpg|thumb|left|Plasma Mobile
Line 200: Line 459:
File:Nexus5-02-home.jpg|thumb|Nexus 5 home on desktop
File:Nexus5-02-home.jpg|thumb|Nexus 5 home on desktop
File:Nexus5-02-wiki.jpg|thumb|Nexus 5 wikipedia on desktop
File:Nexus5-02-wiki.jpg|thumb|Nexus 5 wikipedia on desktop
File:K3s_cluster_built_with_hammerhead_and_docker.jpg|thumb|K3s cluster built with Nexus 5
</gallery>
</gallery>


== Videos ==
* [https://youtu.be/y8W-G0G8ajg Running Phosh on the Nexus 5 with postmarketOS - YouTube]
* [https://youtu.be/diYgNXi3zY8 Stear Prime: input and sound sharing - YouTube]
* [https://youtu.be/IxHzamQqNk0 Stear Prime GNU half - YouTube]
== Resources ==


* [https://user-images.githubusercontent.com/6033024/26851053-3f5512fe-4af9-11e7-93da-cf9dd94b6b75.jpg Weston running (with the red screen bug)]
* [https://user-images.githubusercontent.com/6033024/26851053-3f5512fe-4af9-11e7-93da-cf9dd94b6b75.jpg Weston running (with the red screen bug)]
* [https://www.reddit.com/r/postmarketOS/comments/6fovjp/postmarketos_running_on_the_the_nexus_5/ /r/postmarketOS post]
* [https://www.reddit.com/r/postmarketOS/comments/6fovjp/postmarketos_running_on_the_the_nexus_5/ /r/postmarketOS post]

Latest revision as of 18:34, 27 November 2024

Note Take a look at the open hammerhead issues before starting an installation!
Google (LG) Nexus 5
Nexus 5 running plasma mobile
Nexus 5 running plasma mobile
Manufacturer Google (LG)
Name Nexus 5
Codename lg-hammerhead
Released 2013
Type handset
Hardware
Chipset Qualcomm Snapdragon 800 (MSM8974)
CPU 4x 2.3 GHz Krait 400
GPU Adreno 330
Display 1080x1920 IPS
Storage 16/32 GB
Memory 2 GB
Architecture armv7
Software
Original software Android
Original version 4.4.4 (Linux 3.4.0)
Extended version 6
Optional software Ubuntu Touch
postmarketOS
Category testing
Pre-built images no
Mainline yes
Unixbench Whet/Dhry score 840.9
Features
Flashing
Works
USB Networking
Works
Internal storage
No data
SD card
No data
Battery
Partial
Screen
Works
Touchscreen
Works
Multimedia
3D Acceleration
Partial
Audio
Broken
Camera
No data
Camera Flash
No data
Connectivity
WiFi
Works
Bluetooth
Works
GPS
No data
NFC
No data
Modem
Calls
Partial
SMS
Works
Mobile data
Works
Miscellaneous
FDE
Works
USB OTG
Works
HDMI/DP
No data
Sensors
Accelerometer
Partial
Magnetometer
No data
Ambient Light
No data
Proximity
No data
Hall Effect
No data
Haptics
No data
Barometer
No data

Contributors

  • MartijnBraam
  • dzervas
  • lawl
  • bshah
  • opendata
  • JuniorJPDJ
  • otto

Users owning this device


Installation

Fastboot mode

First make sure to enable USB debugging in Android ([1]) Then with device powered off, hold down Volume Down and Power buttons simultaneously for a few seconds, until Fastboot Mode screen appears.

OEM unlock

Get device into Fastboot Mode, plug in USB cable, then:

$ sudo fastboot oem unlock

When prompted on device, use Volume-Up/Down buttons to highlight choice, then Power button to select it. The Fastboot Mode screen will appear again, and a message regarding flashing will appear briefly.

Flashing

For installation you need to flash lk2nd and flash the rootfs. Do not flash the boot partition since lk2nd uses fs-boot functionality to boot the kernel from the /boot partition of the rootfs.

$ pmbootstrap flasher flash_lk2nd
$ pmbootstrap flasher flash_rootfs

If flashing fails with an error like "Unknown chunk type", you may need to update your bootloader. bootloader-hammerhead-hhZ20h.img comes with the latest firmware from the android image page and can be flashed with fastboot flash bootloader path/to/bootloader-hammerhead-hhZ20h.img.

Hardware notes

DDR

There are 2 variants of hammerhead with different DDR vendors.

1. D820/D821(E) - Elpida

2. D820/D821(H) - Hynix

Stock bootloader/fastboot mode

$ fastboot getvar variant
variant: hammerhead D821(E) 16GB
...

lk2nd

$ fastboot oem lk_log && fastboot get_staged /dev/stdout | grep ddr
...                           
[40] Command line from primary bootloader: lk2nd uart_console=enable gpt=enable lge.kcal=0|0|0|x lge.rev=rev_11 androidboot.laf androidboot.emmc=true androidboot.serialno=0000000000000000 androidboot.bootloader=HHZ20h androidboot.baseband=msm androidboot.hardware.sku=D821 androidboot.hardware.ddr=elpida androidboot.hardware.display=orise androidboot.revision=11
...

Charge type

In case your phone is always plugged into power outlet 24/7, you can set it to be slow charge mode and reduce the charge voltage and current to minimum (set it at your own risk):

$ cat /etc/local.d/bq24190_charger.start
echo Trickle > /sys/class/power_supply/bq24190-charger/charge_type
echo 3504000 > /sys/class/power_supply/bq24190-charger/constant_charge_voltage
echo 102400 > /sys/class/power_supply/bq24190-charger/constant_charge_current

See this reddit thread for some useful information.

See kernel documentation for details.

Power management

At this stage the directory /sys/devices/system/cpu/cpufreq is empty, so it seems there is no integrated power management.

You can disable cpu cores, though:

#!/bin/bash
echo 0 | sudo tee /sys/devices/system/cpu/cpu{2..3}/online
Video: a working example of postmarketOS sharing sound and input running with a secondary device on top of mainline Linux.

Audio

No one has still worked on playback and recording support on-device.

Neverthless you can use a bluetooth headphone/speaker or another device (like an android device) to stream your audio.

source device

# /etc/profile
export PULSE_SERVER=<sink_device_ip_address>

sink Device

# etc/pulse/default.pa
load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1

Don't forget to copy cookie (~/.config/pulse/cookie) to from sink to source!

Bluetooth

Bluetooth controller works. You can start the service with rc-service bluetooth start and enable it with rc-update add bluetooth

To test, use the instructions on the Alpine wiki.

Cellular modem

Using instructions for Nokia N900 it seems that SMS and calls likely work.

WiFi

On first boot, if the wifi adapter started in airplane mode and NetworkManager did not detect that, a manual workaround is to disable and re-enable the wifi adapter.

This can easily be done in the graphic shell (Plasma Mobile has an airplane mode switch in the pull-down menu: check it and uncheck it) or through the shell:

$ nmcli radio all off
$ nmcli radio all on

Sensors detail

For reference, sensor information from sensors sandbox (f-droid) on D820(H) 16GB; note: approximately 18 software-based / derived sensors omitted.

sensor details (sensorssandbox)

Software notes

Video: MATE desktop on postmarketOS on Nexus 5.

Mate

Mate works if started with the fbdev driver, otherwise it freezes.

Booting

Producing MATE images with pmbootstrap will result in a non-functional device (as of now), so install the OS using the gnome environment.

Then from a root console, install postmarketos-ui-mate, lightdm, lightdm-gtk-greeter, onboard, brightnessctl.

Proceed to configure LightDM (/etc/lightdm/lightdm-gtk-greeter.conf)

  • enable touch keyboard (keyboard=onboard)
  • enlarge lightdm fonts (xft-dpi=460)

and finally

  • test the service (rc-service lightdm restart)
  • enable it at boot (rc-update add lightdm)
  • disable gdm (rc-update del gdm)

Scaling

MATE does not follow GNOME scaling settings nor does it have a scaling control panel, so you will need to add export variables directly. Add the following lines to /etc/profile:

# /etc/profile
export GDK_SCALE=2
export QT_QPA_PLATFORM=qtc
export QT_SCALE_FACTOR=2

Be aware that if you already setup scaling from the GNOME control center, this will probably make really really big.

Touch keyboard

To be able to further configure MATE, you will need to ability to cast right clicks:

the Onboard touch keyboard is easily configurable and it's able to send any mouse signal you can think of (even drag and double click).

If you don't want to configure the device using touch input, you can always install barrier to use mouse and keyboard wirelessly from another device.

Bluetooth

Installing blueman gnome-bluetooth should suffice.

Power button

You can emulate the power button by creating a button on the panel pointing to the following script.

Phosh

Video: a working example of postmarketOS running Phosh on top of mainline Linux.

Graphics

The interface randomly freeze (pmaports#424) in particular when heavy loading (browsing and stuff), requiring an hard reboot.

Bluetooth

There used to be problems with Bluetooth on Phosh (pmaports#904 - apparently fixed).

Numeric passwords

Be sure to use a numeric password if you want to use phosh, because its lockscreen only accepts digits.

Power button

Power button turns off the screen but the touchscreen keeps working.

Plasma Mobile

Plasma Angelfish does not run. You may want to install another browser, like qtwebbrowser, Firefox and/or Chromium.

Browsing

  • Qutebrowser crashes;
  • Firefox works very well on Xorg, somewhat slower on wayland;
  • Dillo will probably work, too.

WebkitGTK based

  • Epiphany;
  • Vimb;
  • surf;

They work well, but they are slow on both Xorg and Wayland.

Troubleshooting

Fastboot unknown chunk type

Flashing with fastboot seems to fail for some outdated firmware, it prints the message "FAILED (remote: Unknown chunk type)" when trying to flash the rootfs to userdata. This can be solved by updating to the latest baseband firmware and bootloader.

Initramfs oversized boot partition

In case postmarketos-mkinitfs oversized the device's boot partition, the device will not boot anymore by it's own.

To counter this, there are a few tips to shrink the image file size:

Aggressive compression

The default compression use gzip under default compression level.
To apply a more aggressive approach we can use zstd under best compression level (reference).

In order to apply it, it is needed to append both variables to /etc/deviceinfo configuration file:

deviceinfo_initfs_compression=zstd:best
deviceinfo_initfs_extra_compression=zstd:best

Removing unused modules

postmarketOS can come with default modules that can be unused for some users.
To remove such modules, try editting configuration files found under /usr/share/mkinitfs/modules folder.

As example, partitions that cannot be found when running:

$ df -Th

Can be removed from 00-default.modules configuration file.

Applying the measurements

# apk fix

Remote Data Too Large

Sometimes ./pmbootstrap.py flasher flash_kernel can fail with an error message that includes "Failed (remote: data too large)". This might be solved by updating by reflashing the latest version of the stock Android image for the device.

Useful aliases

Force reboot

# echo b > /proc/sysrq-trigger

Input devices

# cat /proc/bus/input/devices

Partition layout

The eMMC could be either mmcblk0 or mmcblk1, and it seems to be random for each boot.

hammerhead:~# fdisk -l -o Device,Start,End,Sectors,Size,Name /dev/mmcblk1

Disk /dev/mmcblk1: 14.7 GiB, 15758000128 bytes, 30777344 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 98101B32-BBE2-4BF2-A06E-2BB33D000C20

Device             Start      End  Sectors  Size Name
/dev/mmcblk1p1      1024   132095   131072   64M modem
/dev/mmcblk1p2    132096   134143     2048    1M sbl1
/dev/mmcblk1p3    134144   135167     1024  512K rpm
/dev/mmcblk1p4    135168   136191     1024  512K tz
/dev/mmcblk1p5    136192   137215     1024  512K sdi
/dev/mmcblk1p6    137216   138239     1024  512K aboot
/dev/mmcblk1p7    138240   142335     4096    2M pad
/dev/mmcblk1p8    142336   144383     2048    1M sbl1b
/dev/mmcblk1p9    144384   145407     1024  512K tzb
/dev/mmcblk1p10   145408   146431     1024  512K rpmb
/dev/mmcblk1p11   146432   147455     1024  512K abootb
/dev/mmcblk1p12   147456   153599     6144    3M modemst1
/dev/mmcblk1p13   153600   159743     6144    3M modemst2
/dev/mmcblk1p14   159744   160767     1024  512K metadata
/dev/mmcblk1p15   160768   193535    32768   16M misc
/dev/mmcblk1p16   193536   226303    32768   16M persist
/dev/mmcblk1p17   226304   232447     6144    3M imgdata
/dev/mmcblk1p18   232448   277503    45056   22M laf
/dev/mmcblk1p19   277504   322559    45056   22M boot
/dev/mmcblk1p20   322560   367615    45056   22M recovery
/dev/mmcblk1p21   367616   373759     6144    3M fsg
/dev/mmcblk1p22   373760   374783     1024  512K fsc
/dev/mmcblk1p23   374784   375807     1024  512K ssd
/dev/mmcblk1p24   375808   376831     1024  512K DDR
/dev/mmcblk1p25   376832  2473983  2097152    1G system
/dev/mmcblk1p26  2473984  2535423    61440   30M crypto
/dev/mmcblk1p27  2535424  3969023  1433600  700M cache
/dev/mmcblk1p28  3969024 30777299 26808276 12.8G userdata
/dev/mmcblk1p29 30777300 30777310       11  5.5K grow

Links

Photos

Videos

Resources