Skip to content

Instantly share code, notes, and snippets.

@psolyca
Created August 31, 2025 13:07
Show Gist options
  • Save psolyca/0545ee97c79a7c22bdfd2f7c845f187f to your computer and use it in GitHub Desktop.
Save psolyca/0545ee97c79a7c22bdfd2f7c845f187f to your computer and use it in GitHub Desktop.

Day One

  • Resetting the Pixel 4a with last firmware sunfish-tq3a.230805.001.s2-factory-aafe4e24
$ sh flash-all.sh 
Warning: skip copying bootloader_b image avb footer (bootloader_b partition size: 0, bootloader_b image size: 8574568).
Sending 'bootloader_b' (8373 KB)                   OKAY [  0.320s]
Writing 'bootloader_b'                             (bootloader) Flashing Pack version s5-0.5-10252351
(bootloader) Flashing partition table for Lun = 0
(bootloader) Flashing partition table for Lun = 1
(bootloader) Flashing partition table for Lun = 2
(bootloader) Flashing partition table for Lun = 4
(bootloader) Flashing partition table for Lun = 5
(bootloader) Flashing partition xbl_b
(bootloader) Flashing partition xbl_config_b
(bootloader) Flashing partition aop_b
(bootloader) Flashing partition tz_b
(bootloader) Flashing partition hyp_b
(bootloader) Flashing partition abl_b
(bootloader) Flashing partition keymaster_b
(bootloader) Flashing partition cmnlib_b
(bootloader) Flashing partition cmnlib64_b
(bootloader) Flashing partition devcfg_b
(bootloader) Flashing partition qupfw_b
(bootloader) Flashing partition uefisecapp_b
(bootloader) Flashing partition logfs
OKAY [  0.310s]
Finished. Total time: 1.065s
Rebooting into bootloader                          OKAY [  0.056s]
Finished. Total time: 0.106s
Warning: skip copying radio_b image avb footer (radio_b partition size: 0, radio_b image size: 74125452).
Sending 'radio_b' (72388 KB)                       OKAY [  1.850s]
Writing 'radio_b'                                  (bootloader) Flashing Pack version SSD:g7150-00112-230505-B-10075601
(bootloader) Flashing partition modem_b
OKAY [  0.358s]
Finished. Total time: 2.643s
Rebooting into bootloader                          OKAY [  0.015s]
Finished. Total time: 0.065s
--------------------------------------------
Bootloader Version...: s5-0.5-10252351
Baseband Version.....: g7150-00112-230505-B-10075601
Serial Number........: 09151JEC209574
--------------------------------------------
extracting android-info.txt (0 MB) to RAM...
Checking 'product'                                 OKAY [  0.070s]
Checking 'version-bootloader'                      OKAY [  0.070s]
Checking 'version-baseband'                        OKAY [  0.070s]
Setting current slot to 'b'                        OKAY [  0.086s]
archive does not contain 'fastboot-info.txt'
extracting boot.img (64 MB) to disk... took 0.621s
archive does not contain 'init_boot.img'
extracting dtbo.img (8 MB) to disk... took 0.025s
archive does not contain 'dt.img'
archive does not contain 'pvmfw.img'
archive does not contain 'recovery.img'
extracting vbmeta.img (0 MB) to disk... took 0.000s
extracting vbmeta_system.img (0 MB) to disk... took 0.000s
archive does not contain 'vbmeta_vendor.img'
archive does not contain 'vendor_boot.img'
archive does not contain 'vendor_kernel_boot.img'
archive does not contain 'boot_other.img'
archive does not contain 'odm.img'
archive does not contain 'odm_dlkm.img'
extracting product.img (2478 MB) to disk... took 19.535s
extracting system.img (825 MB) to disk... took 7.196s
archive does not contain 'system_dlkm.img'
extracting system_ext.img (310 MB) to disk... took 2.358s
extracting system_other.img (25 MB) to disk... took 0.177s
extracting vendor.img (608 MB) to disk... took 3.534s
archive does not contain 'vendor_dlkm.img'
archive does not contain 'vendor_other.img'
extracting super_empty.img (0 MB) to RAM...
extracting super_empty.img (0 MB) to RAM...
extracting super_empty.img (0 MB) to RAM...
extracting super_empty.img (0 MB) to RAM...
extracting super_empty.img (0 MB) to RAM...
extracting super_empty.img (0 MB) to RAM...
extracting super_empty.img (0 MB) to RAM...
extracting super_empty.img (0 MB) to RAM...
extracting super_empty.img (0 MB) to RAM...
extracting super_empty.img (0 MB) to RAM...
extracting super_empty.img (0 MB) to RAM...
extracting boot.img (64 MB) to disk... took 0.222s
archive does not contain 'boot.sig'
extracting super_empty.img (0 MB) to RAM...
Sending 'boot_b' (65536 KB)                        OKAY [  1.670s]
Writing 'boot_b'                                   OKAY [  0.308s]
extracting super_empty.img (0 MB) to RAM...
extracting dtbo.img (8 MB) to disk... took 0.052s
archive does not contain 'dtbo.sig'
extracting super_empty.img (0 MB) to RAM...
Sending 'dtbo_b' (8192 KB)                         OKAY [  0.310s]
Writing 'dtbo_b'                                   OKAY [  0.095s]
extracting super_empty.img (0 MB) to RAM...
extracting vbmeta.img (0 MB) to disk... took 0.000s
archive does not contain 'vbmeta.sig'
extracting super_empty.img (0 MB) to RAM...
Sending 'vbmeta_b' (8 KB)                          OKAY [  0.140s]
Writing 'vbmeta_b'                                 OKAY [  0.079s]
extracting super_empty.img (0 MB) to RAM...
extracting vbmeta_system.img (0 MB) to disk... took 0.000s
archive does not contain 'vbmeta_system.sig'
extracting super_empty.img (0 MB) to RAM...
Sending 'vbmeta_system_b' (4 KB)                   OKAY [  0.140s]
Writing 'vbmeta_system_b'                          OKAY [  0.078s]
extracting super_empty.img (0 MB) to disk... took 0.000s
Rebooting into fastboot                            OKAY [  0.070s]
< waiting for any device >
Sending 'super' (4 KB)                             OKAY [  0.000s]
Updating super partition                           OKAY [  0.029s]
Resizing 'product_b'                               OKAY [  0.006s]
Resizing 'system_b'                                OKAY [  0.006s]
Resizing 'system_ext_b'                            OKAY [  0.006s]
Resizing 'system_b'                                OKAY [  0.006s]
Resizing 'vendor_b'                                OKAY [  0.006s]
extracting super_empty.img (0 MB) to RAM...
extracting product.img (2478 MB) to disk... took 9.048s
archive does not contain 'product.sig'
Resizing 'product_b'                               OKAY [  0.006s]
Sending sparse 'product_b' 1/10 (262116 KB)        OKAY [  6.216s]
Writing 'product_b'                                OKAY [  0.803s]
Sending sparse 'product_b' 2/10 (262124 KB)        OKAY [  6.197s]
Writing 'product_b'                                OKAY [  0.803s]
Sending sparse 'product_b' 3/10 (262128 KB)        OKAY [  6.192s]
Writing 'product_b'                                OKAY [  0.830s]
Sending sparse 'product_b' 4/10 (262116 KB)        OKAY [  6.189s]
Writing 'product_b'                                OKAY [  0.854s]
Sending sparse 'product_b' 5/10 (262124 KB)        OKAY [  6.200s]
Writing 'product_b'                                OKAY [  0.876s]
Sending sparse 'product_b' 6/10 (262124 KB)        OKAY [  6.217s]
Writing 'product_b'                                OKAY [  0.876s]
Sending sparse 'product_b' 7/10 (262124 KB)        OKAY [  6.238s]
Writing 'product_b'                                OKAY [  0.819s]
Sending sparse 'product_b' 8/10 (262128 KB)        OKAY [  6.266s]
Writing 'product_b'                                OKAY [  0.820s]
Sending sparse 'product_b' 9/10 (262132 KB)        OKAY [  6.252s]
Writing 'product_b'                                OKAY [  0.818s]
Sending sparse 'product_b' 10/10 (170508 KB)       OKAY [  4.096s]
Writing 'product_b'                                OKAY [  0.590s]
extracting super_empty.img (0 MB) to RAM...
extracting system.img (825 MB) to disk... took 3.050s
archive does not contain 'system.sig'
Resizing 'system_b'                                OKAY [  0.007s]
Sending sparse 'system_b' 1/4 (262112 KB)          OKAY [  6.196s]
Writing 'system_b'                                 OKAY [  0.864s]
Sending sparse 'system_b' 2/4 (262120 KB)          OKAY [  6.239s]
Writing 'system_b'                                 OKAY [  0.831s]
Sending sparse 'system_b' 3/4 (262140 KB)          OKAY [  6.263s]
Writing 'system_b'                                 OKAY [  0.856s]
Sending sparse 'system_b' 4/4 (56016 KB)           OKAY [  1.370s]
Writing 'system_b'                                 OKAY [  0.207s]
extracting super_empty.img (0 MB) to RAM...
extracting system_ext.img (310 MB) to disk... took 1.114s
archive does not contain 'system_ext.sig'
Resizing 'system_ext_b'                            OKAY [  0.006s]
Sending sparse 'system_ext_b' 1/2 (262140 KB)      OKAY [  6.244s]
Writing 'system_ext_b'                             OKAY [  0.869s]
Sending sparse 'system_ext_b' 2/2 (55192 KB)       OKAY [  1.318s]
Writing 'system_ext_b'                             OKAY [  0.212s]
extracting super_empty.img (0 MB) to RAM...
extracting system_other.img (25 MB) to disk... took 0.110s
archive does not contain 'system_other.sig'
Resizing 'system_a'                                OKAY [  0.006s]
Sending 'system_a' (26476 KB)                      OKAY [  0.628s]
Writing 'system_a'                                 OKAY [  0.150s]
extracting super_empty.img (0 MB) to RAM...
extracting vendor.img (608 MB) to disk... took 2.312s
archive does not contain 'vendor.sig'
Resizing 'vendor_b'                                OKAY [  0.006s]
Sending sparse 'vendor_b' 1/3 (262092 KB)          OKAY [  6.204s]
Writing 'vendor_b'                                 OKAY [  0.853s]
Sending sparse 'vendor_b' 2/3 (262140 KB)          OKAY [  6.568s]
Writing 'vendor_b'                                 OKAY [  0.834s]
Sending sparse 'vendor_b' 3/3 (97108 KB)           OKAY [  2.319s]
Writing 'vendor_b'                                 OKAY [  0.330s]
Erasing 'userdata'                                 OKAY [  8.924s]
Erase successful, but not automatically formatting.
File system type raw not supported.
wipe task partition not found: cache
Erasing 'metadata'                                 OKAY [  0.013s]
Erase successful, but not automatically formatting.
File system type raw not supported.
Rebooting                                          OKAY [  0.000s]
Finished. Total time: 201.476s
  • Following Google Pixel 4a wiki to begin

    • Zapping all previous chroot folders to clean everything and start on a new base
      $ pmbootstrap zap -a

    • Pulling pmbootstrap to update the repo
      $ pmbootstrap pull

    • Updating indexes
      $ pmbootstrap update

    • Checking config
      $ pmbootstrap config

    • Generating rootfs with v25.06
      $ pmbootstrap install

    • dtbo is already backed up and I can reset the Pixel with a firmware so next
      $ fastboot erase dtbo_a then fastboot erase dtbo_b

    • My chroot and all pmbootstrap stuff are on my server so I need to export my images
      $ pmbootstrap export
      I get 4 files, initramfs, qcom-sm7150-boot.img, qcom-sm7150-root.img and vmlinuz

    • Flashing the root fs image
      $ fastboot flash userdata postmarketOS-export/qcom-sm7150-root.img

    • Flashing the boot image
      $ fastboot flash boot_a postmarketOS-export/qcom-sm7150-boot.img

    • FORGET to flash u-boot... so going back to https://wiki.postmarketos.org/wiki/Generic_SM7150_(qcom-sm7150)

      ° Downloading image u-boot-sm7150-google-sunfish-usb-peripheral.img release 2025-04-14

      ° Flashing u-boot on boot_b (active slot)
      $ fastboot flash boot u-boot-sm7150-google-sunfish-usb-peripheral.img

      ° Flash pre-built v25.06 posh images just to be sure...
      $ fastboot flash userdata 20250829-1040-postmarketOS-v25.06-phosh-25-qcom-sm7150.img
      $ fastboot flash boot_a 20250829-1040-postmarketOS-v25.06-phosh-25-qcom-sm7150-bootpart.img
      but the last one failed : "FAILED (remote: 'Failed to write to partition Bad Buffer Size')"
      bootpart file is 256 Mo but boot_[a|b] is 64 Mo so I need to shrink it
      $ dd if=20250829-1040-postmarketOS-v25.06-phosh-25-qcom-sm7150-bootpart.img of=20250829-1040-postmarketOS-v25.06-phosh-25-qcom-sm7150-bootpart_shrink.img bs=1M count=64
      and flash it

      ° Reboot to test
      $ fastboot reboot
      1rst boot to "Starting..." screen...
      reboot to screen with only the postmarketOS logo...
      reboot to same screen...
      reboot to fastboot mode for reason "no valid slot to boot"
      force reboot to bootloader and start... "no valid slot to boot"

Day Two

  • Checking partition layout (forget it earlier) so reinstalling factory firmware
$ adb shell ls /dev/block/by-name/ 
ALIGN_TO_128K_1
ALIGN_TO_128K_2
abl_a
abl_b
aop_a
aop_b
apdp_a
apdp_b
boot_a
boot_b
cdt
cdt_backup
cmnlib64_a
cmnlib64_b
cmnlib_a
cmnlib_b
ddr
devcfg_a
devcfg_b
devinfo
dtbo_a
dtbo_b
frp
fsc
fsg
hyp_a
hyp_b
imagefv_a
imagefv_b
keymaster_a
keymaster_b
keystore
klog
limits
logfs
metadata
misc
modem_a
modem_b
modemst1
modemst2
msadp_a
msadp_b
persist
qupfw_a
qupfw_b
sda
sdb
sdc
sdd
sde
sdf
secdata
splash
spunvm
ssd
storsec
super
toolsfv
tz_a
tz_b
uefisecapp_a
uefisecapp_b
uefivarstore
userdata
vbmeta_a
vbmeta_b
vbmeta_system_a
vbmeta_system_b
xbl_a
xbl_b
xbl_config_a
xbl_config_b
  • Checking Pixel 4a S/N for the battery drain problem (https://www.reddit.com/r/Pixel4a/comments/1idpgnn/determine_if_your_battery_is_impacted_by_battery)
    $ adb shell cat /sys/class/power_supply/battery/serial_number
    13G8230015901AA0836D46H�S5M93ZY <<= Good one

  • Reflash u-boot, pre-built boot and root
    ... fastboot "error boot prepare"
    forgot to erase dtbo
    boot to posh but unusable, no touchscreen
    reboot to debug shell (VolDown on pmOS logo), no touchscreen available but console on USB port
    $ minicom -D /dev/ttyACM0
    $ pmos_logdump
    log dump 250830_1537
    rebooting but "error boot prepare" caused by boot_a activated
    fastboot set_active b, reboot and bootloop...
    got to go to debug shell and pmos_boot_continue
    and... stuck
    new log dump 250830_1612

  • Building my own images, config no ui, no console, systemd
    Reboot... black screen... bootloader "no valid slot to boot"
    Reboot... reinit slot... black screen... VolDown?... ssh seems enable
    Reboot to see... bootloop, reinit slot, bad day

  • Building new kernel
    $ git clone https://github.com/sm7150-mainline/linux.git sm7150-mainline-kernel
    $ cd sm7150-mainline-kernel
    $ source ../pmbootstrap/helpers/envkernel.sh --config ../pixel4a/pixel4a.cfg (Modified version of envkernel to take config file)
    $ make defconfig sm7150.cfg
    $ make -j$(nproc)
    ... very long on an old computer

Day three

$ pmbootstrap build linux-postmarketos-qcom-sm7150 --force --envkernel
$ pmbootstrap chroot -r
$ apk upgrade -a

changing some values in /etc/deviceconfig
deviceinfo_kernel_cmdline_append=" PMOS_NOSPLASH" <== If i can see something on boot
deviceinfo_flash_fastboot_partition_kernel="boot_a" <== I'm not using pmboostrap flas method but to be sure

$ mkinitfs
$ fastboot flash boot_a postmarketOS-export/qcom-sm7150-boot.img
$ fastboot flash userdata postmarketOS-export/qcom-sm7150-root.img

not working... 😢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment