Jump to content

Google Pixel 3 (google-blueline): Difference between revisions

From postmarketOS Wiki
Rom4nik (talk | contribs)
m See also: Add current draft MR
Rom4nik (talk | contribs)
Add UART section
Line 137: Line 137:
== Status ==
== Status ==
Work is ongoing, flashing works and telnet can be accessed during boot.
Work is ongoing, flashing works and telnet can be accessed during boot.
== UART ==
=== USB ===
See also: https://github.com/Peter-Easton/android-debug-cable-howto, [[ Serial_debugging:Cable_schematics#Google_Pixel_.22Android_Debug_Cable.22 ]]
Baud rate is 115200. I am not 100% sure if the voltage is 1.8V or 3.3V - in my case (described below) RX and TX worked at 1.8V, but a cheap multimeter plugged into phone's TX and GND measured constant 2.93V while no logs were sent.
# Obtain a USB-C breakout board and UART adapter capable of 1.8V (e.g. [https://www.waveshare.com/wiki/CH343_USB_UART_Board Waveshare CH343] + mini360 step-down converter to take 5V pin on Waveshare and get 1.8V to plug into VCC on Waveshare)
# Connect pins <code>board pin (USB-C pinout) - UART adapter pin</code> as following:
## A1 (GND) - GND
## A8 (SBU1) - RXD
## B8 (SBU2) - TXD
# Connect breakout board and phone using a USB-C cable that has working SBU1/2 (I had to use a thicker TB3/USB 3.0 capable cable). Make sure the cable is in "top" orientation (in my case Thunderbolt logos were facing same side as phone's screen and the <code>A</code> side of breakout board), it won't work if the plug is reversed on one side.
# Boot phone into fastboot, then execute <code>fastboot oem uart enable</code> and poweroff.
I've noticed issues cold booting with cable inserted, as long as RX (phone) - TX (adapter) was connected. It would get me early bootloader logs (as soon as power button is pressed), but then it'd constantly bootloop, even despite kernel having been flashed to mentioned slot (A or B):
<pre>
Format: Log Type - Time(microsec) - Message - Optional Info
Log Type: B - Since Boot(Power On Reset),  D - Delta,  S - Statistic
S - QC_IMAGE_VERSION_STRING=BOOT.XF.2.0-00411-SDM845LZB-5
S - IMAGE_VARIANT_STRING=SDM845LA
[...]
D -    861472 - SBL1, Delta
S - Flash Throughput, 34000 KB/s  (6269862 Bytes,  183353 us)
S - DDR Frequency, 1353 MHz
UEFI Start    [ 1337] SEC
ASLR        : On
DEP        : On
Timer Delta : +1 mS
RAM Entry 0 : Base 0x0000000080000000  Size 0x00000000FE0A0000
UEFI Ver    : 5.0.210806.BOOT.XF.2.0-00411-SDM845LZB-5
Build Info  : 64b Aug  6 2021 08:25:26
Boot Device : UFS
PROD Mode  : TRUE
Retail      : TRUE
ffu failed: -1,6
PM0: 20, PM1: 21, PM2: 24,
DisplayDxe: Panel found <sw43408_dsc_fhd_cmd>
DisplayDxe: Resolution 1080x2160 (1 intf)
-----------------------------
Platform Init  [ 1832] BDS
Platform  : OEM
[...]
PmicDxe:: info (maxfg/pmic): SOC (83/79) V(4037/4036) I2C:0
PmicDxe:: info (maxfg/pmic): SOC (83/79) V(4037/4036) I2C:0
PmicDxe:: info (maxfg/pmic): SOC (83/79) V(4037/4036) I2C:0
UEFI Total : 512 ms
POST Time      [ 1712] OS Loader
Error: liblpc: unable to open partition
PinCtrl:11 type 1 val 0
PinCtrl:135 type 3 val 0
Error to locate NfcWakeControl protocol Not Found
ABL version: b1c1-0.4-7617406
ABL build time: Aug  6 2021 08:23:56
Reset REASON 0
Booting from slot (b)
Partition Not Found
DSI read: address: 0x0A, readback: 0x1C, uRetryCount: 0
avb_slot_verify.c:691: DEBUG: Loading vbmeta struct from partition 'vbmeta_b'.
avb_slot_verify.c:856: ERROR: vbmeta_b: Public key used to sign data rejected.
avb_slot_verify.c:923: DEBUG: vbmeta_b: VERIFICATION_DISABLED bit is set.
avb_slot_verify.c:517: DEBUG: boot_b: Loading entire partition.
avb_slot_verify.c:517: DEBUG: dtbo_b: Loading entire partition.
AvbLoadAndVerifyBootImages: pre boot state orange
AvbLoadAndVerifyBootImages: aftl result ERROR_INVALID_ARGUMENT
AvbLoadAndVerifyBootImages: post boot state orange
CheckPowerDebounce: pwrkey not pressed!
CheckPowerDebounce: shutdown device!
BDS: LogFs sync skipped, Unsupported
App Log Flush : 0 ms
Exit
[reboot]
Format: Log Type - Time(microsec) - Message - Optional Info
Log Type: B - Since Boot(Power On Reset),  D - Delta,  S - Statistic
S - QC_IMAGE_VERSION_STRING=BOOT.XF.2.0-00411-SDM845LZB-5
S - IMAGE_VARIANT_STRING=SDM845LA
[...]
</pre>
Without TX (adapter) connected, the phone goes through cold boot, but the earliest logs are these:
<pre>
UEFI Start    [ 1030] SEC
ASLR        : On
DEP        : On
Timer Delta : +1 mS
RAM Entry 0 : Base 0x0000000080000000  Size 0x00000000FE0A0000
UEFI Ver    : 5.0.210806.BOOT.XF.2.0-00411-SDM845LZB-5
Build Info  : 64b Aug  6 2021 08:25:26
Boot Device : UFS
PROD Mode  : TRUE
Retail      : TRUE
ffu failed: -1,6
PM0: 20, PM1: 21, PM2: 24,
DisplayDxe: Panel found <sw43408_dsc_fhd_cmd>
DisplayDxe: Resolution 1080x2160 (1 intf)
-----------------------------
Platform Init  [ 1524] BDS
Platform  : OEM
[...]
</pre>
I think this might be different if adapter runs at 3.3V instead of 1.8V. TODO: check.


== See also ==
== See also ==

Revision as of 22:54, 16 June 2023

Google Pixel 3
Google Pixel 3
Google Pixel 3
Manufacturer Google
Name Pixel 3
Codename google-blueline
Released 2018
Hardware
Chipset Qualcomm Snapdragon 845 (SDM845)
CPU Octa-core (4x2.5 GHz Kryo 385 Gold & 4x1.6 GHz Kryo 385 Silver)
GPU Adreno 630
Display 1080 x 2160 P-OLED, HDR
Storage 64GB/128GB
Memory 4GB
Architecture aarch64
Software
Original software Android
Original version 9.0
postmarketOS
Category testing
Pre-built images no
Mainline partial
Features
Flashing
Works
USB Networking
No data
Internal storage
No data
SD card
No data
Battery
No data
Screen
No data
Touchscreen
No data
Multimedia
3D Acceleration
No data
Audio
No data
Camera
No data
Camera Flash
No data
Connectivity
WiFi
No data
Bluetooth
No data
GPS
No data
NFC
No data
Modem
Calls
No data
SMS
No data
Mobile data
No data
Miscellaneous
FDE
No data
USB OTG
No data
HDMI/DP
No data
Sensors
Accelerometer
No data
Magnetometer
No data
Ambient Light
No data
Proximity
No data
Hall Effect
No data
Haptics
No data
Barometer
No data


Contributors

  • hreikin

Users owning this device


How to enter flash mode

The Pixel 3, like all Google Pixel/Nexus devices, uses Fastboot as the flashing protocol.

To enter Fastboot mode, hold Volume Down while powering on the device. Let go of Volume Down when "Fastboot mode" displays on the screen.

Alternatively, if connected to a pc then you can also use adb reboot bootloader.

Installation

The steps below should allow you to flash postmarketOS to a Pixel 3 and boot to a point that telnet can be accessed.

  • Run pmbootstrap init and then delete the generated linux-google-blueline folder
  • Edit the APKBUILD in the device-google-blueline folder to remove the linux-google-blueline and mesa-dri-gallium dependencies and insert the linux-postmarketos-qcom-sdm845 and soc-qcom-sdm845 dependencies
  • Clone the sdm845 mainline kernel and create a new branch for your changes, copy the DTS file available in the Linaro kernel to the sdm845 mainline kernel and edit the Makefile to include it, comment out the following nodes to ensure the kernel compiles successfully: &sde_te_active, &sde_te_suspend, &dsi0 and &dsi0_phy
  • Add the following kernel configuration options to the sdm845.config file:
# Pixel 3
CONFIG_EXT4_FS=y
CONFIG_KERNEL_GZIP=y
CONFIG_CGROUPS=y
CONFIG_ANDROID_PARANOID_NETWORK=n
CONFIG_PFT=n
CONFIG_USE_VFB=n
CONFIG_KINETO_GAN=n
CONFIG_SAMSUNG_TUI=n
CONFIG_SEC_RESTRICT_ROOTING=n
CONFIG_TZDEV=n
  • Source envkernel.sh and run make defconfig sdm845.config and make -j`nproc` to compile the kernel, run pmbootstrap build --envkernel linux-postmarketos-qcom-sdm845, pmbootstrap checksum device-google-blueline and pmbootstrap build device-google-blueline
  • Run pmbootstrap install --split, pmbootstrap initfs hook_add debug-shell and pmbootstrap export
  • Clone this DTBO repository from the crosshatch port
  • Edit the dtboimg.cfg file with the following changes:
sdm845-c1-dvt1.1.dtbo
	id=0x215
	rev=0x2
  • Edit the sdm845-c1-dvt1.1.dts file with the following changes before running build.sh to create the dtbo.img:
/dts-v1/;

/ {
	model = "Google Inc. MSM sdm845 C1 DVT1.1";
	compatible = "google,b1c1-sdm845", "qcom,sdm845";
	qcom,board-id = <0x00021505 0>;
};
  • Run the following commands to flash everything to the phone, You have to flash the dtbo.img and then the kernel normally for the telnet shell and then use fastboot to flash the boot and root images created with pmbootstrap install --split otherwise nothing shows up in telnet when running blkid:
fastboot set_active b
fastboot flash dtbo_b /path/to/dtbo.img
pmbootstrap flasher flash_kernel
fastboot flash vendor /path/to/exported/google-blueline-boot.img
fastboot flash userdata /path/to/exported/google-blueline-root.img
  • The phone boots and you should get the white screen with Google logo, sometimes it has a graphical glitch and others it doesn't. The SSH isn't working, it should have an IP and you can ping it but you can't connect by SSH. You can however connect to a shell with the telnet command; $ telnet 172.16.42.1
  • Run blkid, the vendor and userdata partitions should show up with the pmOS_boot and pmOS_root labels
  • Source /etc/deviceinfo and init_functions.sh before running mount_subpartitions which seems to complete with no errors reported in the shell or via dmesg but could be unsuccessful as nothing new is mounted when looking with mount or blkid
  • Running mount_boot_partition shows an error in telnet but not in dmesg however if you run mount -o ro -t ext2 /dev/sda10 /boot you should get the following errors output to the shell and dmesg:
/ # mount_subpartitions
/ # mount_boot_partition
Mount boot partition (/dev/sda10) to  (read-only)
mount: mounting /dev/sda10 on  failed: No such file or directory
/ # mount -o ro -t ext2 /dev/sda10 /boot
mount: mounting /dev/sda10 on /boot failed: Invalid argument
[  118.355939] EXT4-fs (sda10): mounting ext2 file system using the ext4 subsystem
[  118.363336] EXT4-fs (sda10): bad block size 1024
  • You can successfully mount the root partition with mount_root_partition and it is viewable in /sysroot.

Here are some links to the config files and logs, scroll down for multiple files:

Status

Work is ongoing, flashing works and telnet can be accessed during boot.

UART

USB

See also: https://github.com/Peter-Easton/android-debug-cable-howto, Serial_debugging:Cable_schematics#Google_Pixel_.22Android_Debug_Cable.22

Baud rate is 115200. I am not 100% sure if the voltage is 1.8V or 3.3V - in my case (described below) RX and TX worked at 1.8V, but a cheap multimeter plugged into phone's TX and GND measured constant 2.93V while no logs were sent.

  1. Obtain a USB-C breakout board and UART adapter capable of 1.8V (e.g. Waveshare CH343 + mini360 step-down converter to take 5V pin on Waveshare and get 1.8V to plug into VCC on Waveshare)
  2. Connect pins board pin (USB-C pinout) - UART adapter pin as following:
    1. A1 (GND) - GND
    2. A8 (SBU1) - RXD
    3. B8 (SBU2) - TXD
  3. Connect breakout board and phone using a USB-C cable that has working SBU1/2 (I had to use a thicker TB3/USB 3.0 capable cable). Make sure the cable is in "top" orientation (in my case Thunderbolt logos were facing same side as phone's screen and the A side of breakout board), it won't work if the plug is reversed on one side.
  4. Boot phone into fastboot, then execute fastboot oem uart enable and poweroff.


I've noticed issues cold booting with cable inserted, as long as RX (phone) - TX (adapter) was connected. It would get me early bootloader logs (as soon as power button is pressed), but then it'd constantly bootloop, even despite kernel having been flashed to mentioned slot (A or B):

Format: Log Type - Time(microsec) - Message - Optional Info
Log Type: B - Since Boot(Power On Reset),  D - Delta,  S - Statistic
S - QC_IMAGE_VERSION_STRING=BOOT.XF.2.0-00411-SDM845LZB-5
S - IMAGE_VARIANT_STRING=SDM845LA
[...]
D -    861472 - SBL1, Delta
S - Flash Throughput, 34000 KB/s  (6269862 Bytes,  183353 us)
S - DDR Frequency, 1353 MHz


UEFI Start     [ 1337] SEC
ASLR        : On
DEP         : On
Timer Delta : +1 mS
RAM Entry 0 : Base 0x0000000080000000  Size 0x00000000FE0A0000
UEFI Ver    : 5.0.210806.BOOT.XF.2.0-00411-SDM845LZB-5
Build Info  : 64b Aug  6 2021 08:25:26
Boot Device : UFS
PROD Mode   : TRUE
Retail      : TRUE
ffu failed: -1,6
PM0: 20, PM1: 21, PM2: 24,
DisplayDxe: Panel found <sw43408_dsc_fhd_cmd>
DisplayDxe: Resolution 1080x2160 (1 intf)
-----------------------------
Platform Init  [ 1832] BDS
Platform   : OEM
[...]
PmicDxe:: info (maxfg/pmic): SOC (83/79) V(4037/4036) I2C:0
PmicDxe:: info (maxfg/pmic): SOC (83/79) V(4037/4036) I2C:0
PmicDxe:: info (maxfg/pmic): SOC (83/79) V(4037/4036) I2C:0
UEFI Total : 512 ms
POST Time      [ 1712] OS Loader
Error: liblpc: unable to open partition
PinCtrl:11 type 1 val 0
PinCtrl:135 type 3 val 0
Error to locate NfcWakeControl protocol Not Found
ABL version: b1c1-0.4-7617406
ABL build time: Aug  6 2021 08:23:56
Reset REASON 0
Booting from slot (b)
Partition Not Found
DSI read: address: 0x0A, readback: 0x1C, uRetryCount: 0
avb_slot_verify.c:691: DEBUG: Loading vbmeta struct from partition 'vbmeta_b'.
avb_slot_verify.c:856: ERROR: vbmeta_b: Public key used to sign data rejected.
avb_slot_verify.c:923: DEBUG: vbmeta_b: VERIFICATION_DISABLED bit is set.
avb_slot_verify.c:517: DEBUG: boot_b: Loading entire partition.
avb_slot_verify.c:517: DEBUG: dtbo_b: Loading entire partition.
AvbLoadAndVerifyBootImages: pre boot state orange
AvbLoadAndVerifyBootImages: aftl result ERROR_INVALID_ARGUMENT
AvbLoadAndVerifyBootImages: post boot state orange
CheckPowerDebounce: pwrkey not pressed!
CheckPowerDebounce: shutdown device!
BDS: LogFs sync skipped, Unsupported
App Log Flush : 0 ms
Exit

[reboot]

Format: Log Type - Time(microsec) - Message - Optional Info
Log Type: B - Since Boot(Power On Reset),  D - Delta,  S - Statistic
S - QC_IMAGE_VERSION_STRING=BOOT.XF.2.0-00411-SDM845LZB-5
S - IMAGE_VARIANT_STRING=SDM845LA
[...]

Without TX (adapter) connected, the phone goes through cold boot, but the earliest logs are these:

UEFI Start     [ 1030] SEC
ASLR        : On
DEP         : On
Timer Delta : +1 mS
RAM Entry 0 : Base 0x0000000080000000  Size 0x00000000FE0A0000
UEFI Ver    : 5.0.210806.BOOT.XF.2.0-00411-SDM845LZB-5
Build Info  : 64b Aug  6 2021 08:25:26
Boot Device : UFS
PROD Mode   : TRUE
Retail      : TRUE
ffu failed: -1,6
PM0: 20, PM1: 21, PM2: 24,
DisplayDxe: Panel found <sw43408_dsc_fhd_cmd>
DisplayDxe: Resolution 1080x2160 (1 intf)
-----------------------------
Platform Init  [ 1524] BDS
Platform   : OEM
[...]

I think this might be different if adapter runs at 3.3V instead of 1.8V. TODO: check.

See also