Difference between revisions of "Google Nexus 4 (lg-mako)"

From postmarketOS
Jump to navigation Jump to search
(quickly add the installation steps and describe power off/charging after flashing the kernel, other minor changes)
(Mark the screen as broken ad update architecture)
 
(20 intermediate revisions by 8 users not shown)
Line 1: Line 1:
[[Category:Supported Devices]]
+
{{note|Currently the device is booting into a black screen, see {{issue|209|pmaports}}. Help with resolving this is welcome. Please remove this note when the issue has been fixed.}}
[[Category:Devices]]
 
 
{{Infobox device
 
{{Infobox device
 
| manufacturer = Google (LG)
 
| manufacturer = Google (LG)
 
| name = Nexus 4
 
| name = Nexus 4
| codename = mako
+
| codename = lg-mako
 
| image = File:LG Nexus 4 Weston.png
 
| image = File:LG Nexus 4 Weston.png
 
| imagecaption = LG Nexus 4 running Weston
 
| imagecaption = LG Nexus 4 running Weston
Line 15: Line 14:
 
| display = 768x1280 IPS
 
| display = 768x1280 IPS
 
| memory = 2 GB
 
| memory = 2 GB
 +
| architecture = armv7
 +
| status_usbnet = Y
 +
| status_flashing = Y
 +
| status_touch = Y
 +
| status_screen = N
 +
| status_wifi =
 +
| status_xwayland =
 +
| status_fde = Y
 +
| status_mainline =
 +
| status_battery = Y
 +
| status_3d =
 +
| status_accel =
 +
| status_audio =
 +
| status_bluetooth =
 +
| status_camera =
 +
| status_gps =
 +
| status_mobiledata =
 +
| status_sms =
 +
| status_calls =
 +
| status_otg = Y
 +
| booting = yes
 
}}
 
}}
 +
 
== Contributors ==
 
== Contributors ==
  
 
* ollieparanoid
 
* ollieparanoid
 
* PabloCastellano and robb4 on IRC: Workaround for red screen bug ({{github|54}})
 
* PabloCastellano and robb4 on IRC: Workaround for red screen bug ({{github|54}})
 +
 +
== Users owning this device ==
 +
{{Device owners}}
  
 
== Installation ==
 
== Installation ==
 +
{{note|FDE (full disk encryption) seems to be broken for lg-mako currently, see {{issue|209|pmaports}}}}
 
<pre>
 
<pre>
 
pmbootstrap init
 
pmbootstrap init
 
pmbootstrap install
 
pmbootstrap install
 
(enter fastboot, see below)
 
(enter fastboot, see below)
pmbootstrap flasher flash_system
+
pmbootstrap flasher flash_rootfs
 
pmbootstrap flasher boot
 
pmbootstrap flasher boot
 
</pre>
 
</pre>
Line 36: Line 61:
 
Hold <code>Volume Down</code> + <code>Power</code>, let go of <code>Power</code> once the device display does something (e.g. turns from battery icon to black screen).
 
Hold <code>Volume Down</code> + <code>Power</code>, let go of <code>Power</code> once the device display does something (e.g. turns from battery icon to black screen).
  
== After flashing the postmarketOS kernel: charging and power off ==
+
== Charging and power off (after flashing the postmarketOS kernel) ==
 
{{note|You don't have to flash the kernel! <code>pmbootstrap flasher boot</code> is also working!}}
 
{{note|You don't have to flash the kernel! <code>pmbootstrap flasher boot</code> is also working!}}
 
You can flash the postmarketOS kernel, but instead of charging the battery, it will boot straight into postmarketOS (or the on screen keyboard to type in the password). Right now, the best way to charge it from that situation is to boot the recovery TWRP.
 
You can flash the postmarketOS kernel, but instead of charging the battery, it will boot straight into postmarketOS (or the on screen keyboard to type in the password). Right now, the best way to charge it from that situation is to boot the recovery TWRP.
Line 42: Line 67:
 
You can properly turn the device off by unplugging the usb cable, then booting into fastboot, then choosing power off.
 
You can properly turn the device off by unplugging the usb cable, then booting into fastboot, then choosing power off.
  
== What works ==
+
== Wifi ==
 +
Looks like, we need to package the [https://github.com/LineageOS/android_device_lge_mako/blob/12ac6e9aeb32d5ac9fc832f2214ede2c7690d0a6/proprietary-blobs.txt#L152-L157 wcnss.* files] for wifi. A version from 2015 can be found [https://github.com/TheMuppets/proprietary_vendor_lge/tree/cm-14.1/mako/proprietary/vendor/firmware here]. It's a Qualcomm chip.
  
* Touchscreen
+
== Mainline ==
* Weston (has the red screen bug, but we have a workaround for that now 👍 )
+
{{note|See [[The Mainline Kernel]] for a general introduction to mainlining.}}
  
== What does not work ==
+
'''power_graphic's mainlining progress is [https://gitlab.com/power_graphic/linux-postmarketos/tree/device-lg-mako here].''' Read on for generic instructions of what would need to be done.
  
* XWayland
+
Currently we only have a downstream vendor kernel packaged, not the mainline kernel. The <code>lg-mako</code> has the same [https://en.wikipedia.org/wiki/System_on_a_chip SoC] as the <code>asus-flo</code>, and on the latter it is possible to run [http://web.archive.org/web/20181008184943/https://plus.google.com/111524780435806926688/posts/fkQ1BMjNNcn Android on a kernel close to mainline].
* The rest (Wifi, bluetooth, making calls, ...)
 
* fbsplash only displays splash images very shortly, then goes to black screen
 
  
== Wifi ==
+
This means, that most peripherals of the <code>mako</code> should work with mainline as well, once they are enabled in the DTS file. In fact, @vetzki reported in {{github|1079}} that the <code>mako</code> boots when using exactly the same DTS as the one from <code>flo</code> (this is not recommended, as misconfiguring your device like that may damage it). SSH appears to be working for a short time before getting kicked out, the display does not work.
  
Looks like, we need to package the [https://github.com/LineageOS/android_device_lge_mako/blob/12ac6e9aeb32d5ac9fc832f2214ede2c7690d0a6/proprietary-blobs.txt#L152-L157 wcnss.* files] for wifi. A version from 2015 can be found [https://github.com/TheMuppets/proprietary_vendor_lge/tree/cm-14.1/mako/proprietary/vendor/firmware here]. It's a Qualcomm chip.
+
A good way forward would be using a minimal version of the <code>flo</code> DTS, where everything but USB is deleted, and fixing USB / trying to get the display working with the [https://github.com/freedreno/freedreno/wiki/DSI-Panel-Driver-Porting DSI Panel Porting Guide]. The downstream DTSI files that need to be ported to the upstream kernel are probably located [https://github.com/LineageOS/android_kernel_lge_mako/tree/lineage-15.1/arch/arm/boot/dts here], and I guess the exact panel name appears when running <code>dmesg</code> after a successful boot (I did not verify this). Please expand this when you're working on it, and report your progress in #postmarketOS. Check out the [[Mainline Guide]].
  
== Alternative kernels ==
+
=== Partition Layout ===
It *should* be possible to run [[The Mainline Kernel]] on the lg-mako, maybe we need to write a display driver, but there's a [https://github.com/freedreno/freedreno/wiki/DSI-Panel-Driver-Porting tutorial for it]. I (ollieparanoid) didn't do enough research on this yet - if you're interested in doing this, please talk to opendata26 from postmarketOS and robclark from the freedreno project. With their help it should be quite feasible.
+
<div class="toccolours mw-collapsible mw-collapsed" style="width: 620px; overflow: auto;">
 +
Partition layout:
 +
<div class="mw-collapsible-content">
 +
<pre class="shell"># fdisk /dev/block/mmcblk0
 +
Found valid GPT with protective MBR; using GPT
  
Non-mainline:
 
* [https://github.com/ollieparanoid/pmbootstrap/tree/feature/lg-mako-freedreno-3.4.0/aports/device/linux-lg-mako Freedreno backport to 3.4.0] (couldn't make it work out of the box and I suggest trying to get mainline working instead of spending time on this one)
 
* Freedreno backport to 3.0.8 ({{github|38}})
 
  
== Links ==
+
Command (m for help): p
 +
Disk /dev/block/mmcblk0: 15269888 sectors, 3360M
 +
Logical sector size: 512
 +
Disk identifier (GUID): 98101b32-bbe2-4bf2-a06e-2bb33d000c20
 +
Partition table holds up to 28 entries
 +
First usable sector is 34, last usable sector is 15269854
  
* [https://github.com/postmarketOS/pmbootstrap/tree/master/aports/device/device-lg-mako Device package]
+
Number  Start (sector)    End (sector)  Size      Code  Name
* [https://www.optiv.com/blog/building-a-nexus-4-uart-debug-cable Tutorial: UART debug cable]
+
  1            1024          132095      64.0M  0700  modem
* [https://developers.google.com/android/drivers#mako Official proprietary drivers]
+
  2          132096          133119        512K  0700  sbl1
 +
  3          133120          134143        512K  0700  sbl2
 +
  4          134144          138239      2048K  0700  sbl3
 +
  5          138240          139263        512K  0700  tz
 +
  6          139264          184319      22.0M  0700  boot
 +
  7          184320          229375      22.0M  0700  recovery
 +
  8          229376          230935        780K  0700  m9kefs1
 +
  9          230936          232495        780K  0700  m9kefs2
 +
  10          232496          234055        780K  0700  m9kefs3
 +
  11          234496          235519        512K  0700  rpm
 +
  12          235520          236543        512K  0700  aboot
 +
  13          236544          237567        512K  0700  sbl2b
 +
  14          237568          241663      2048K  0700  sbl3b
 +
  15          241664          242687        512K  0700  abootb
 +
  16          242688          243711        512K  0700  rpmb
 +
  17          243712          244735        512K  0700  tzb
 +
  18          244736          245759        512K  0700  metadata
 +
  19          245760          278527      16.0M  0700  misc
 +
  20          278528          311295      16.0M  0700  persist
 +
  21          311296        2031615        840M  0700  system
 +
  22        2031616        3178495        560M  0700  cache
 +
  23        3178496        15267839      5903M  0700  userdata
 +
  24        15267840        15268863        512K  0700  DDR
 +
  25        15268864        15269854        495K  0700  grow</pre>
 +
</div></div>
  
 
== Photos ==
 
== Photos ==
 
 
* [https://ollieparanoid.github.io/img/2017-05-26/mako/editor.jpg Weston running with framebuffer issues]
 
* [https://ollieparanoid.github.io/img/2017-05-26/mako/editor.jpg Weston running with framebuffer issues]
 
* [https://cloud.githubusercontent.com/assets/6033024/26761940/2e3273e0-4928-11e7-8800-0b4ddb14e239.jpg robb4 patched Weston to display the right colors]
 
* [https://cloud.githubusercontent.com/assets/6033024/26761940/2e3273e0-4928-11e7-8800-0b4ddb14e239.jpg robb4 patched Weston to display the right colors]
 +
 +
== See also ==
 +
* [https://github.com/freedreno/freedreno/wiki/Nexus-4 freedreno: Nexus 4]
 +
* [https://gitlab.com/postmarketOS/pmaports/-/tree/master/device/testing/device-lg-mako Device package]
 +
* [https://gitlab.com/postmarketOS/pmaports/-/tree/master/device/testing/linux-lg-mako Kernel package]
 +
* [https://www.optiv.com/blog/building-a-nexus-4-uart-debug-cable Tutorial: UART debug cable]
 +
* [https://developers.google.com/android/drivers#mako Official proprietary drivers]
 +
* {{issue|1079}} The Nexus 7 DTB is so similar, it even boots
 +
* {{issue|9|linux-postmarketos}} Attempt at writing a new DTS for the Nexus 4

Latest revision as of 21:01, 18 June 2020

Currently the device is booting into a black screen, see pmaports#209. Help with resolving this is welcome. Please remove this note when the issue has been fixed.
Google (LG) Nexus 4
LG Nexus 4 running Weston
LG Nexus 4 running Weston
Manufacturer Google (LG)
Name Nexus 4
Codename lg-mako
Released 2012
Category testing
Original software Android on Linux 3.4
Hardware
Chipset Qualcomm APQ8064 Snapdragon S4 Pro
CPU Quad-core 1.5 GHz Krait
GPU Adreno 320
Display 768x1280 IPS
Storage 8/16 GB
Memory 2 GB
Architecture armv7
Features
USB Networking
Works
Flashing
Works
Touchscreen
Works
Display
Broken
WiFi
Xwayland
FDE
Works
Mainline
Battery
Works
3D Acceleration
Accelerometer
Audio
Bluetooth
Camera
GPS
Mobile data
SMS
Calls
USB OTG
Works



Contributors

  • ollieparanoid
  • PabloCastellano and robb4 on IRC: Workaround for red screen bug (#54)

Users owning this device


Installation

FDE (full disk encryption) seems to be broken for lg-mako currently, see pmaports#209
pmbootstrap init
pmbootstrap install
(enter fastboot, see below)
pmbootstrap flasher flash_rootfs
pmbootstrap flasher boot

To flash the kernel, you can choose pmbootstrap flasher flash kernel (but charging and power off doesn't work as expected anymore, see below).

Entering "Fastboot mode"

Hold Volume Down + Power, let go of Power once the device display does something (e.g. turns from battery icon to black screen).

Charging and power off (after flashing the postmarketOS kernel)

You don't have to flash the kernel! pmbootstrap flasher boot is also working!

You can flash the postmarketOS kernel, but instead of charging the battery, it will boot straight into postmarketOS (or the on screen keyboard to type in the password). Right now, the best way to charge it from that situation is to boot the recovery TWRP.

You can properly turn the device off by unplugging the usb cable, then booting into fastboot, then choosing power off.

Wifi

Looks like, we need to package the wcnss.* files for wifi. A version from 2015 can be found here. It's a Qualcomm chip.

Mainline

See The Mainline Kernel for a general introduction to mainlining.

power_graphic's mainlining progress is here. Read on for generic instructions of what would need to be done.

Currently we only have a downstream vendor kernel packaged, not the mainline kernel. The lg-mako has the same SoC as the asus-flo, and on the latter it is possible to run Android on a kernel close to mainline.

This means, that most peripherals of the mako should work with mainline as well, once they are enabled in the DTS file. In fact, @vetzki reported in #1079 that the mako boots when using exactly the same DTS as the one from flo (this is not recommended, as misconfiguring your device like that may damage it). SSH appears to be working for a short time before getting kicked out, the display does not work.

A good way forward would be using a minimal version of the flo DTS, where everything but USB is deleted, and fixing USB / trying to get the display working with the DSI Panel Porting Guide. The downstream DTSI files that need to be ported to the upstream kernel are probably located here, and I guess the exact panel name appears when running dmesg after a successful boot (I did not verify this). Please expand this when you're working on it, and report your progress in #postmarketOS. Check out the Mainline Guide.

Partition Layout

Partition layout:

# fdisk /dev/block/mmcblk0
Found valid GPT with protective MBR; using GPT


Command (m for help): p
Disk /dev/block/mmcblk0: 15269888 sectors, 3360M
Logical sector size: 512
Disk identifier (GUID): 98101b32-bbe2-4bf2-a06e-2bb33d000c20
Partition table holds up to 28 entries
First usable sector is 34, last usable sector is 15269854

Number  Start (sector)    End (sector)  Size       Code  Name
   1            1024          132095       64.0M   0700  modem
   2          132096          133119        512K   0700  sbl1
   3          133120          134143        512K   0700  sbl2
   4          134144          138239       2048K   0700  sbl3
   5          138240          139263        512K   0700  tz
   6          139264          184319       22.0M   0700  boot
   7          184320          229375       22.0M   0700  recovery
   8          229376          230935        780K   0700  m9kefs1
   9          230936          232495        780K   0700  m9kefs2
  10          232496          234055        780K   0700  m9kefs3
  11          234496          235519        512K   0700  rpm
  12          235520          236543        512K   0700  aboot
  13          236544          237567        512K   0700  sbl2b
  14          237568          241663       2048K   0700  sbl3b
  15          241664          242687        512K   0700  abootb
  16          242688          243711        512K   0700  rpmb
  17          243712          244735        512K   0700  tzb
  18          244736          245759        512K   0700  metadata
  19          245760          278527       16.0M   0700  misc
  20          278528          311295       16.0M   0700  persist
  21          311296         2031615        840M   0700  system
  22         2031616         3178495        560M   0700  cache
  23         3178496        15267839       5903M   0700  userdata
  24        15267840        15268863        512K   0700  DDR
  25        15268864        15269854        495K   0700  grow

Photos

See also