Pixel 3 (google-blueline) porting: progress and questions
PLEASE NOTE
As suggested, i have started work on mainlining instead of porting to downstream, please follow this link to be taken to the post further down this thread where the mainlining work begins.
I am currently trying to port the Google Pixel 3 (google-blueline) following the Porting Guide available on the wiki. So far i have managed to successfully get it to pmbootstrap install
but no matter which flashing methods i have tried i have not been able to successfully flash/boot postmarketOS. So far i think i have tried all methods apart from the netcat and NFS methods. I have created a basic device page to accompany this issue.
My Thoughts & Ideas
I don't really know why it wont flash to my phone but my current train of thought is maybe it has something to do with the boot.img i used during the init sequence, i am thinking of zapping everything and starting over from pmbootstrap init
using another one. Another possibility which just occurred to me is that TWRP only works with Android 9 on my Pixel 3, something changed in Android 10/11 and they haven't been able to fix it yet, maybe the branch/commit i am using for the downstream kernel from LineageOS are to new and interfering with the flashing process ? I am new to this so please forgive me if any of that sounds ridiculously stupid.
I will try and outline the steps i took during the whole process below and would really appreciate some help trying to figure it all out. Please note i have never ported anything before so my experience is lacking in this area but i am very willing to learn, i am familiar with linux so i am not totally inept but please keep this in mind when explaining things to me.
pmbootstrap init
I started a new port for the Pixel 3 answering the questions and chose the Fastboot flash method. When asked for a known working boot image i provided it with lineage-18.1-20210831-recovery-blueline.img. I chose weston for the interface and kept the defaults for the remaining questions.
Downstream Kernel
I used the following LineageOS kernel for my linux-google-blueline APKBUILD source, i used the latest commit on the 18.1 branch. For the defconfig file i used the b1c1_defconfig from the same repository.
Kernel Configuration
The first time i ran pmbootstrap kconfig edit
i had to remove 4 patches which were named as follows:
- gcc7-give-up-on-ilog2-const-optimizations.patch,
- gcc8-fix-put-user.patch,
- gcc10-extern_YYLOC_global_declaration.patch,
- kernel-use-the-gnu89-standard-explicitly.patch
I then had to change these options to pass the pmbootstrap kconfig check
:
CONFIG_ANDROID_PARANOID_NETWORK = OFF
CONFIG_DEVTMPFS = ON
CONFIG_SYSVIPC = ON
CONFIG_USER_NS = ON
CONFIG_COMPAT_VDSO = OFF
CONFIG_LTO_CLANG = OFF
CONFIG_CC_STACKPROTECTOR_STRONG = OFF
CONFIG_SHADOW_CALL_STACK = OFF
I also had to apply the following patch arm64-boot-disable-building-DTBO-images.patch
which i have provided under "Additional Information" below. I got this patch from @zhuowei's previous google-crosshatch work for the Pixel 3 XL.
Device Specific Package
In the deviceinfo file i altered the height and width values and added deviceinfo_rootfs_image_sector_size="4096"
after confirming the sector size. Everything builds ok and i move on to the installation step.
Installation & Flashing
I have tried many different ways to try and install/flash postmarketOS to my Pixel 3 as suggested by the wiki. With each one i have tried, the install commands work perfectly with no errors. I have had varied results with the flash commands with some seeming to work and others failing. I have saved the logs, the commands used and corresponding result for each attempt i have made and will provide them below.
Attempt 1 - Click To View/Hide
Commands
pmbootstrap zap
pmbootstrap log -c (Second window, clear previous log with CTRL+C before running)
pmbootstrap install
adb reboot bootloader
pmbootstrap flasher flash_rootfs
pmbootstrap flasher boot
Results
Hangs at
Sending 'boot.img' (36396 KB) OKAY [ 0.237s]
Booting
Phone doesn't boot or enter recovery
Log
https://gist.github.com/hreikin/1e43d1fcc201227f5676d80304c52a78
Attempt 2 - Click To View/Hide
Commands
pmbootstrap zap
pmbootstrap log -c (Second window, clear previous log with CTRL+C before running)
pmbootstrap install
adb reboot bootloader
pmbootstrap flasher flash_rootfs
pmbootstrap flasher flash_kernel
Results
Appears to complete but nothing happens, when trying to boot it myself i get an "error booting boot.img" and then "no vaild slot to boot", cannot connect by ssh
Log
https://gist.github.com/hreikin/97f1d6e59738cc75dc25e4e247e91278
Attempt 3 - Click To View/Hide
Commands
pmbootstrap zap
pmbootstrap log -c (Second window, clear previous log with CTRL+C before running)
pmbootstrap install
adb reboot bootloader
pmbootstrap flasher flash_rootfs --partition userdata
pmbootstrap flasher boot
Results
Hangs at
Sending 'boot.img' (36400 KB) OKAY [ 0.227s]
Booting
Phone doesn't boot or enter recovery
Log
https://gist.github.com/hreikin/1b534684e127ed8c76bd70b85f380ba4
Attempt 4 - Click To View/Hide
Commands
pmbootstrap zap
pmbootstrap log -c (Second window, clear previous log with CTRL+C before running)
pmbootstrap install
adb reboot bootloader
pmbootstrap flasher flash_rootfs --partition userdata
pmbootstrap flasher flash_kernel
Results
Appears to complete but nothing happens, when trying to boot it myself i get an "error booting boot.img" and then "no vaild slot to boot", cannot connect by ssh, cannot enter recovery
Log
https://gist.github.com/hreikin/67a59b51c6e93a5e142a32070436555a
Attempt 5 - Click To View/Hide
Commands
pmbootstrap zap
pmbootstrap log -c (Second window, clear previous log with CTRL+C before running)
pmbootstrap install --android-recovery-zip
Boot the recovery system via button press or adb reboot bootloader
Unmount the partitions (Click on "Mount, then deselect all checkboxes)
Click on "Advanced / ADB Sideload", then "Swipe to start sideload"
Reconnect phone to PC
pmbootstrap flasher --method=adb sideload
Results
Recovery zip starts but exits straight away, can still boot android/twrp
Log
Attempt 6 - Click To View/Hide
Commands
pmbootstrap zap
pmbootstrap log -c (Second window, clear previous log with CTRL+C before running)
pmbootstrap install --android-recovery-zip --recovery-install-partition=userdata
Boot the recovery system via button press or adb reboot bootloader
Unmount the partitions (Click on "Mount, then deselect all checkboxes)
Click on "Advanced / ADB Sideload", then "Swipe to start sideload"
Connect phone to PC
pmbootstrap flasher --method=adb sideload
Results
Hangs at
< wait for any device >
* daemon not running; starting now at tcp:5038
* daemon started successfully
Can still boot android/twrp
Log
https://gist.github.com/hreikin/e81ab7927730236875efb0352940f0ba
Attempt 7 - Click To View/Hide
Commands
pmbootstrap zap
pmbootstrap log -c (Second window, clear previous log with CTRL+C before running)
pmbootstrap install --android-recovery-zip
Boot the recovery system via button press or adb reboot bootloader
Unmount the partitions (Click on "Mount, then deselect all checkboxes)
Click on "Advanced / ADB Sideload", then "Swipe to start sideload"
Connect phone to PC
pmbootstrap export
cd $(dirname $(readlink /tmp/postmarketOS-export/pmos-*.zip))
adb sideload pmos-google-blueline.zip
Results
Recovery zip starts but exits straight away, can still boot android/twrp
Log
Attempt 8 - Click To View/Hide
Commands
pmbootstrap zap
pmbootstrap log -c (Second window, clear previous log with CTRL+C before running)
pmbootstrap install --android-recovery-zip --recovery-install-partition=userdata
Boot the recovery system via button press or adb reboot bootloader
Unmount the partitions (Click on "Mount, then deselect all checkboxes)
Click on "Advanced / ADB Sideload", then "Swipe to start sideload"
Connect phone to PC
pmbootstrap export
cd $(dirname $(readlink /tmp/postmarketOS-export/pmos-*.zip))
adb sideload pmos-google-blueline.zip
Results
Recovery zip starts but exits straight away, can still boot android/twrp
Log
Attempt 9 - Click To View/Hide
Commands
pmbootstrap zap
pmbootstrap log -c (Second window, clear previous log with CTRL+C before running)
pmbootstrap install --android-recovery-zip
pmbootstrap export
Transfer zip file to Downloads folder on phone
Boot the recovery system via button press or adb reboot bootloader
Select install and navigate to zip file
Results
Recovery zip starts but exits straight away, can still boot android/twrp
Log
Attempt 10 - Click To View/Hide
Commands
pmbootstrap zap
pmbootstrap log -c (Second window, clear previous log with CTRL+C before running)
pmbootstrap install --android-recovery-zip --recovery-install-partition=userdata
pmbootstrap export
Transfer zip file to Downloads folder on phone
Boot the recovery system via button press or adb reboot bootloader
Select install and navigate to zip file
Results
Recovery zip starts but exits straight away, can still boot android/twrp
Log
Additional information
Here are my device-google-blueline files:
- https://gist.github.com/hreikin/f6c49e3f81a49ffc1c51eefa93326e0d
- https://gist.github.com/hreikin/72e3ce1b641052860837ecfe244515f3
Here are my linux-google-blueline files: