User:ChriChri
| This user has a blog. |
| This user's pmOS GitLab profile is @ChriChri. |
| This user has a SourceHut profile. |
| This user is @chrichri on ween.de. |
My name is Chris Vogel. I'm a member of Phosh.mobi e.V. and use a Librem5 as my only mobile phone since 2022. Recently started using a Pixel 3a and learning about the Shift6mq.
Devices
| Device | Notes |
|---|---|
| Google Pixel 3a (google-sargo) | pmOS, next everyday phone? |
| PINE64 PinePhone (pine64-pinephone) | 2GB RAM, kids phone, pmOS |
| PINE64 PinePhone (pine64-pinephone) | 3GB RAM, demo, pmOS |
| Purism Librem5 (purism-librem5) | daily driver, PureOS |
| Purism Librem5 (purism-librem5) | testing & kids phone, Mobian |
| Samsung Galaxy Tab 2 10.1 (3G and Wifi) (samsung-espresso10) | unused, no software installed atm |
| Samsung Galaxy Tab S5e Wi-Fi (samsung-gts4lvwifi) | but SM-T725 with LTE - LineageOS |
| SHIFT SHIFT6mq (shift-axolotl) | edl/u-boot/dual-boot |
| Sony Xperia Z3C (sony-aries) | stock for WhatsApp-Matrix-Bridge |
| Sony Xperia Z3C (sony-aries) | unused |
Dynamic Partitions on Shift6mq
On Shift6mq partition 7 of lun0 is the super partition containing dynamic partitions which can be mounted from Linux using dmsetup and parse-android-dynparts or make-dynpart-mappings.
If this fails (which happened during testing) the dynamic partitions can be examined from Android: on a rooted phone use dmctl to show the dynamic partitions on super:
$ adb shell axolotl:/ $ su - axolotl:/ # dmctl list devices -v | grep -EA1 '^odm_|^product_|^system_|^vendor_' system_ext_b : 253:8 target#1: 0-1108568: linear, 8:7 19685376 system_ext_a : 253:3 target#1: 0-1107816: linear, 8:7 7084032 -- odm_b : 253:5 target#1: 0-6960: linear, 8:7 12584448 system_b : 253:7 target#1: 0-2158200: linear, 8:7 17525760 -- vendor_b : 253:9 target#1: 0-883544: linear, 8:7 20794368 odm_a : 253:0 target#1: 0-6960: linear, 8:7 2048 -- system_a : 253:2 target#1: 0-2156376: linear, 8:7 4927488 -- vendor_a : 253:4 target#1: 0-883296: linear, 8:7 8192000 -- system_ext-verity : 253:11 target#1: 0-1090912: verity, 1 253:8 253:8 4096 4096 136364 136364 sha256 386fe223300f4e2901684c1a5e1a91c3fc31a9d322ecfb06c3b1437df5c5c081 9eb7f9ec4c9ddcb4f9426ad58d481309063a3fa9a4cc0592eeef120ff1984fb8 10 restart_on_corruption ignore_zero_blocks use_fec_from_device 253:8 fec_blocks 137440 fec_start 137440 fec_roots 2 -- product_b : 253:6 target#1: 0-4932376: linear, 8:7 12592128 -- product_a : 253:1 target#1: 0-4915488: linear, 8:7 10240
TODO: it would be nice to be able to obtain this information from a saved image in Linux. → https://gitlab.com/flamingradian/make-dynpart-mappings/ (this didn't work as expected, maybe this issue)
Mount any of the partitions from a backup of super.img (we'll call super.img):
$ sudo losetup -f super.img $ sudo losetup -l | grep super.img /dev/loop14 0 0 0 1 super.img 0 512 $ sudo dmsetup create --concise 'super_system_b,,,ro,<tbl entry>'
The <tbl entry> consist of <logical_start_sector> <num_sectors> <target type> <loop-device> <start_sector>. The values to fill the tbl entry can be found in the output of dmctl in Android (see above):
target#1: 0-2158200: linear, 8:7 17525760
¹ ² ³ ⁴
¹⁾ <logical_start_sector>
²⁾ <num_sectors>
³⁾ <target_type>
⁴⁾ <start_sector>
For our example the command would look like this: sudo dmsetup create --concise 'super_system_b,,,ro,0 2158200 linear /dev/loop14 17525760
The <tbl entry> can exist multiple times seperated by a comma to describe multiple blocks of data on the image that make up one dynamic partition.
Shift6mq u-boot dual-boot installation
I'd like to install pmOS to one slot of my Shift6mq and be able to switch between ShiftOS-L and pmOS by setting the active slot in fastboot. pmOS should be started by u-boot - preferably configured with a menu to choose between different kernels.
planned layout:
- boot_X: u-boot-axolotl
- recovery_X: boot (unencrypted)
- system_X (dynamic partition in partition super): root (fde)
TODO: describe alternative being used atm with userdata shrinked and pmOS_boot and pmOS_root as new partitions behind userdata.
boot process:
X either is a or b depending on which slot is unused by Android.
- u-boot is started from rescue_X
- u-boot looks for a boot partition and finds it on recovery_X
- linux boots:
- initramfs finds root as system_X in the dynamic partitions of super
- initfamfs asks for the full-disc-encryption password
state
postmarketOS boots as described when pmOS is installed in slot_a (didn't test slot_b, yet)
no sound device
solved: it seems to be a problem related to u-boot where the path that alsa uses trying to find its configuration doesn't fit.
u-boot / dtb:
=> printenv fdtfile fdtfile=qcom/sdm845-shift-axolotl.dtb => bootefi bootmgr Cannot persist EFI variables without system partition Loading Boot0000 'scsi 0' failed Loading Boot0001 'scsi 1' failed Loading Boot0002 'scsi 2' failed Loading Boot0003 'scsi 3' failed Booting: scsi 4 Fdt /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,0000000000000000)/VenHw(e61d73b9-a384-4acc-aeab-82e828f362 8b,6d00000000000000)/VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,7c00000000000000)/VenHw(e61d73b9-a384-4acc -aeab-82e828f3628b,6b00000000000000)/Scsi(0,4)/HD(20,GPT,9160ddaf-68d5-7186-7cc7-9f2e5ddd3a8e,0x10be6,0x60 00)/\dtbs\qcom\sdm845-shift-axolotl.dtb loaded EFI stub: Decompressing Linux Kernel... EFI stub: Loaded initrd from LINUX_EFI_INITRD_MEDIA_GUID device path EFI stub: Using DTB from configuration table EFI stub: Exiting boot services...
linux:
shift6mq:~# dmesg | head -n6 [ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x517f803c] [ 0.000000] Linux version 6.16.7-sdm845 (pmos@build) (Alpine clang version 21.1.8, LLD 21.1.8) #5-postmarketos-qcom-sdm845 SMP PREEMPT Thu Feb 12 22:04:40 UTC [ 0.000000] KASLR enabled [ 0.000000] Machine model: SHIFT SHIFT6mq [ 0.000000] efi: EFI v2.11 by Das U-Boot [ 0.000000] efi: ESRT=0x26b456040 RTPROP=0x26b458040 SMBIOS 3.0=0x26c5c6000 INITRD=0x26b43f040 RNG=0x26b43e040 MEMRESERVE=0x26b43d040 shift6mq:~# dmesg | grep -iA2 alsa [ 4.616712] ALSA device list: [ 4.619732] No soundcards found. [ 4.625776] Freeing unused kernel memory: 2112K -- [ 44.204812] MultiMedia1: ASoC: no backend DAIs enabled for MultiMedia1, possibly missing ALSA mixer-based routing or UCM profile [ 44.421836] Bluetooth: RFCOMM TTY layer initialized [ 44.427682] Bluetooth: RFCOMM socket layer initialized shift6mq:~# ls -l /boot/ total 68840 drwx------ 3 root root 4096 Feb 17 12:42 EFI -rwx------ 1 root root 27779072 Feb 17 12:45 boot.img drwx------ 3 root root 4096 Feb 17 12:40 dtbs -rwx------ 1 root root 12904665 Feb 17 12:45 initramfs -rwx------ 1 root root 14922240 Feb 12 22:11 linux.efi drwx------ 3 root root 4096 Feb 17 12:42 loader -rwx------ 1 root root 14865133 Feb 12 22:11 vmlinuz shift6mq:~# ls -l /boot/dtbs/qcom/sdm845-shift-axolotl.dtb -rwx------ 1 root root 111125 Feb 12 22:11 /boot/dtbs/qcom/sdm845-shift-axolotl.dtb shift6mq:~# ps ax | grep -i 'pulse\|pipe' 10004 chris 0:00 /usr/bin/pipewire 10143 chris 0:00 /usr/bin/pulseaudio --start --log-target=syslog 10146 chris 0:00 /usr/libexec/pulse/gsettings-helper 17473 root 0:00 grep -i pulse\|pipe
Tried: https://postmarketos.org/edge/2025/06/16/OnePlus-6-and-6T:-main-speaker-not-working/ - didn't help
alsactl shows:
shift6mq:~# alsactl info
#
# Sound card
#
- card: 0
id: SHIFT6mq
name: SHIFT6mq
longname: shift-SHIFTSHIFT6mq-
driver_name: sdm845
mixer_name:
components:
controls_count: 1605
pcm:
- stream: PLAYBACK
devices:
- device: 0
id: MultiMedia1 (*)
name:
subdevices:
- subdevice: 0
name: subdevice #0
- device: 1
id: MultiMedia2 (*)
name:
subdevices:
- subdevice: 0
name: subdevice #0
- device: 2
id: MultiMedia3 (*)
name:
subdevices:
- subdevice: 0
name: subdevice #0
- device: 3
id: MultiMedia4 (*)
name:
subdevices:
- subdevice: 0
name: subdevice #0
- device: 4
id: MultiMedia5 (*)
name:
subdevices:
- subdevice: 0
name: subdevice #0
- device: 5
id: MultiMedia6 (*)
name:
subdevices:
- subdevice: 0
name: subdevice #0
- device: 12
id: VoiceMMode1 (*)
name:
subdevices:
- subdevice: 0
name: subdevice #0
- stream: CAPTURE
devices:
- device: 0
id: MultiMedia1 (*)
name:
subdevices:
- subdevice: 0
name: subdevice #0
- device: 1
id: MultiMedia2 (*)
name:
subdevices:
- subdevice: 0
name: subdevice #0
- device: 2
id: MultiMedia3 (*)
name:
subdevices:
- subdevice: 0
name: subdevice #0
- device: 3
id: MultiMedia4 (*)
name:
subdevices:
- subdevice: 0
name: subdevice #0
- device: 4
id: MultiMedia5 (*)
name:
subdevices:
- subdevice: 0
name: subdevice #0
- device: 5
id: MultiMedia6 (*)
name:
subdevices:
- subdevice: 0
name: subdevice #0
- device: 12
id: VoiceMMode1 (*)
name:
subdevices:
- subdevice: 0
name: subdevice #0
alsactl: rawmidi_device_list:109: snd_ctl_rawmidi_next_device: Not a tty
listing devices shows a SHIFT6mq device, but can't be used by aplay:
shift6mq:~$ aplay -L
null
Discard all samples (playback) or generate zero samples (capture)
pulse
PulseAudio Sound Server
default
Default ALSA Output (currently PulseAudio Sound Server)
sysdefault:CARD=SHIFT6mq
SHIFT6mq,
Default Audio Device
shift6mq:~$ aplay -v -D sysdefault /usr/share/sounds/alsa/Front_Center.wav
aplay: main:850: audio open error: Invalid argument
There have been problems with axolotl at some point of development: https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7451 .
solution
@mat:allpurposem.at on matrix helped me to solve the issue. The problem seems to be related to u-boot which I'm using as the bootloader of my Shift6mq.
- find out which configuration files in /usr/share are not found by alsa:
strace -f alsaucm reload 2>&1 | grep '^facce.*/usr/share.*No such' - find configurations that might fit your device:
# find /usr/share/alsa -type f -iname 'shift*' -or -iname 'axolotl*' /usr/share/alsa/ucm2/SHIFT/axolotl /usr/share/alsa/ucm2/SHIFT/axolotl/axolotl.conf
- symlink the file alsa searched for to the file found that is fitting your device - in case of Shift6mq atm:
shift6mq:~# ln -s ../../SHIFT/axolotl/axolotl.conf /usr/share/alsa/ucm2/conf.d/sdm845/shift-SHIFTSHIFT6mq-.conf shift6mq:~# ls -l /usr/share/alsa/ucm2/conf.d/sdm845/shift-SHIFTSHIFT6mq-.conf lrwxrwxrwx 1 root root 32 Mar 3 13:03 /usr/share/alsa/ucm2/conf.d/sdm845/shift-SHIFTSHIFT6mq-.conf -> ../../SHIFT/axolotl/axolotl.conf
- reboot
references:
- issue: https://gitlab.postmarketos.org/postmarketOS/pmaports/-/issues/4386
- MR: https://gitlab.com/sdm845-mainline/alsa-ucm-conf/-/merge_requests/30
resizing userdata
| WARNING: This will delete your Android userdata and factory reset Android. |
To make more room for postmarketOS it is possible to resize the userdata partition to a few gigabyte and use the free space to create a new partition for use in pmOS:
- boot the phone to u-boot
- export mass storage over usb and connect to your host
- on the host look for the userdata partition
blkid | grep userdata - use parted to resize the partition
# parted /dev/sdb GNU Parted 3.5 Using /dev/sdb (parted) resizepart 9 End? [122GB]? 32GB Warning: Shrinking a partition can cause data loss, are you sure you want to continue? Yes/No? yes (parted) print Model: Linux UMS disk 0 (scsi) Disk /dev/sdb: 122GB Sector size (logical/physical): 4096B/4096B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 24,6kB 32,8kB 8192B ssd 2 32,8kB 33,6MB 33,6MB ext4 persist 3 33,6MB 34,6MB 1049kB misc 4 34,6MB 35,2MB 524kB keystore 5 35,2MB 35,7MB 524kB oem 6 35,7MB 36,2MB 524kB frp 7 36,2MB 12,9GB 12,9GB super 8 12,9GB 12,9GB 16,8MB ext4 metadata 9 12,9GB 32,0GB 19,1GB userdata (parted) mkpart Partition name? []? pmOS_space File system type? [ext2]? Start? Start? 32,0GB End? End? 122GB (parted) p Model: Linux UMS disk 0 (scsi) Disk /dev/sdb: 122GB Sector size (logical/physical): 4096B/4096B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 24,6kB 32,8kB 8192B ssd 2 32,8kB 33,6MB 33,6MB ext4 persist 3 33,6MB 34,6MB 1049kB misc 4 34,6MB 35,2MB 524kB keystore 5 35,2MB 35,7MB 524kB oem 6 35,7MB 36,2MB 524kB frp 7 36,2MB 12,9GB 12,9GB super 8 12,9GB 12,9GB 16,8MB ext4 metadata 9 12,9GB 32,0GB 19,1GB userdata 10 32,0GB 122GB 89,9GB ext2 pmOS_space (parted) quit Information: You may need to update /etc/fstab. # sync #
- restart the phone to the bootloader
- activate the Android slot
- boot into recovery
- select Factory reset
- select Format data/factory reset
Afterwards there should be 32GB storage for Android (14GB used with ShiftOS-L, fdroid and magisk installed) and there is a partition that can be used for postmarketOS:
shift6mq:~# fdisk -l /dev/sda 2>/dev/null | grep sda10 /dev/sda10 7812608 29765375 21952768 83.7G Linux filesystem shift6mq:~# mkfs.ext4 /dev/sda10 mke2fs 1.47.3 (8-Jul-2025) /dev/sda10 alignment is offset by 262144 bytes. This may result in very poor performance, (re)-partitioning suggested. Discarding device blocks: done Creating filesystem with 21952768 4k blocks and 5488640 inodes Filesystem UUID: 2b6d8a63-de7e-4a36-9c79-9300c0e2eae0 Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424, 20480000 Allocating group tables: done Writing inode tables: done Creating journal (131072 blocks): done Writing superblocks and filesystem accounting information: done shift6mq:~# mount /dev/sda10 /mnt/ shift6mq:~# df -h /mnt Filesystem Size Used Available Use% Mounted on /dev/sda10 81.9G 2.0M 77.7G 0% /mnt shift6mq:~#
Update: Since pmOS_boot on recovery_X is too small to update the kernel using apk I created two partitions instead:
- boot as partition 10, 1GB
- use
gdiskon the usb mass storage device exported by u-boot to set the partition up like this:
- use
Partition number (1-11): 10 Partition GUID code: D504D6DB-FA92-4853-B59E-C7F292E2EA19 (Unknown) Partition unique GUID: A9B65AC3-A063-48B2-95D5-8B7F776B2040 First sector: 7812501 (at 29.8 GiB) Last sector: 8074751 (at 30.8 GiB) Partition size: 262251 sectors (1024.4 MiB) Attribute flags: 003F000000000000 Partition name: 'pmOS_boot'
- make a filesystem
mkfs.fat -n "pmOS_boot " -F 32 -g 2/32 -h 0 /dev/<device> - copy the files from the boot-image there
- edit loader/entries/pmos.conf to contain the correct UUID for the new pmOS_boot
- TODO: build new boot and root to fit the size of the new boot partition for installation via fastboot or dd without manual work
- make a filesystem
- pmOS_root (rest of free space)
- flashed as created by pmbootstrap
building the image
Changes to pmaports/device/community/device-shift-axolotl/ are necessary to enable the use of dynamic partitions, to include systemd-boot, to change the filesystem of boot to fat32 and generate a systemd-boot configuration.
I put the changed axolotl files into a branch here.
General instruction for changing stuff in pmaports
$ pmbootstrap config build_pkgs_on_install True
pmbootstrap init- change into directory containing pmaports/device/community/device-some
- change files
- increment pkgrel in APKBUILD
pmbootstrap checksum device-somepmbootstrap install --fde --split
To force building a package: pmbootstrap build --force <package>
flashing
In one slot there should be a working Shift-OS-L installation including a rescue that contains a fastbootd. (Remark: in one test flashing pmOS to slot_b as described below didn't work (somehow broken super partition afterwards). In another attempt flashing to slot_a worked fine.)
Make sure you're not overwriting the active and working slot. Look at the configuration (e.g. from fastboot using fastboot getvar current-slot) to find out which slot is actively used for your Android installation.
For flashing pmOS use the other (inactive) slot.
To flash to the system_X dynamic partition contained in partition super I need to start into fastboot mode and then restart using fastboot reboot fastboot (like described here).
Below I'll use X in place of a or b for the slot to be used.
On the Shift6mq page is stated: To install on super partition, a valid recovery with proper fastbootd implementation needs to be installed into the slot, which you want to install postmarketOS on.
TODO: I do not understand, yet, why this should be necessary.
To have the above condition satisfied it is necessary to first flash the system partition before overwriting the recovery partition with pmOS boot.
root
My initial attempt to flash root to a system_X partition failed.
For my second attempt I started from ShiftOS flashed via edl (ended up in slot_a). Then I updated using the Android system updater (over-the-air, OTA) to SHIFT6MQ.SOS.7.0.L-RELEASE-LIGHT-20260127 which got installed into slot_b.
The phone has been in a state where I could dual-boot the two versions by switching slots in the bootloader (Power+Vol-Up). For _'downgrading'_ from slot_b to slot_a a reset of userdata has been necessary.
To be able to look at the dynamic partitions inside the super partition I rooted slot_b using magisk. From Android in slot_b active I started:
- restarted to fastbootd by
adb reboot fastboot fastboot getvar current-slotreturnscurrent-slot: b- this is the slot my Android is running (updated from Android system in slot_a)- flash:
$ fastboot flash system_a ~/.local/var/pmbootstrap/chroot_native/home/pmos/rootfs/shift-axolotl-root.img Invalid sparse file format at header magic Resizing 'system_a' OKAY [ 0.006s] Sending sparse 'system_a' 1/9 (262140 KB) OKAY [ 7.308s] Writing 'system_a' OKAY [ 1.429s] Sending sparse 'system_a' 2/9 (246157 KB) OKAY [ 6.745s] Writing 'system_a' OKAY [ 1.552s] Sending sparse 'system_a' 3/9 (241600 KB) OKAY [ 6.519s] Writing 'system_a' OKAY [ 1.364s] Sending sparse 'system_a' 4/9 (262140 KB) OKAY [ 7.130s] Writing 'system_a' OKAY [ 1.466s] Sending sparse 'system_a' 5/9 (262140 KB) OKAY [ 7.246s] Writing 'system_a' OKAY [ 1.431s] Sending sparse 'system_a' 6/9 (262140 KB) OKAY [ 7.074s] Writing 'system_a' OKAY [ 1.410s] Sending sparse 'system_a' 7/9 (262140 KB) OKAY [ 6.950s] Writing 'system_a' OKAY [ 1.420s] Sending sparse 'system_a' 8/9 (262140 KB) OKAY [ 7.138s] Writing 'system_a' OKAY [ 1.452s] Sending sparse 'system_a' 9/9 (229796 KB) OKAY [ 6.503s] Writing 'system_a' OKAY [ 4.141s] Finished. Total time: 80.700s
After flashing Android should still start from the other slot (for me slot_b). This is how the newly flashed system_a root looked in my installation (adb shell as root):
axolotl:/ # dmctl list devices -v | grep -A5 ^system_a system_a : 253:2 target#1: 0-2156544: linear, 8:7 4927488 target#2: 2156544-2157568: linear, 8:7 9216 target#3: 2157568-2159104: linear, 8:7 4925952 target#4: 2159104-5449728: linear, 8:7 9076224 vendor-verity : 253:14 axolotl:/ # ls -l /dev/block/mapper/system_a lrwxrwxrwx 1 root root 15 1970-01-02 18:15 /dev/block/mapper/system_a -> /dev/block/dm-2 axolotl:/ # ls -l /dev/block/dm-2 brw------- 1 root root 253, 2 1970-01-02 18:15 /dev/block/dm-2 axolotl:/ # file /dev/block/dm-2 /dev/block/dm-2: block special (253/2) axolotl:/ # file -s /dev/block/dm-2 /dev/block/dm-2: unknown
If everything went well and the super partition is still intact you now could download the partition using edl, use a tool to find the dynamic partitions, setup device mapper to show the system_X partition, decrypt it and mount it. To avoid the download it is possible to check the partition directly on the phone after installing u-boot if u-boot offers to export the mass storage via usb (see below).
u-boot
slot_X: slot to flash pmOS to slot_Z: slot Android is running from
flash axolotl u-boot to boot_X (the wiki recommends installing the Tauchgang u-boot which doesn't offer functionality like usb mass storage export and serial console like the linaro u-boot):
- start into bootloader Fastboot mode (
Power+Vol-Upor in fastbootdfastboot reboot bootloaderor with Android runningadb reboot bootloader) - check active slot
fastboot getvar current-slot(in test case slot_Z) - flash using
fastboot erase dtbo_X flash boot_X u-boot-axolotl-boot.img
Check result by
- slot_Z active: boot into the other slot with Android to check whether the Android installation still is working
- slot_Z active: booting into fastbootd (still needed for flashing dynamic partitions on super):
fastboot reboot fastboot - slot_X active: booting u-boot by a normal startup (e.g.
fastboot reboot)
Depending on the features of your u-boot version you could:
- (if you do not have
parse-android-dynpartsormake-dynpart-mappingsget layout of dynamic partitions from your Android shell) - in u-boot export mass storage over usb
- on your host setup device mapper to create a device for the dynamic system_X partition
cryptsetupthe device- mount the device
- check if your pmOS is intact
boot
$ fastboot flash recovery_X ~/.local/var/pmbootstrap/chroot_native/home/pmos/rootfs/shift-axolotl-boot.img Sending 'recovery_a' (94208 KB) OKAY [ 2.603s] Writing 'recovery_a' OKAY [ 1.818s] Finished. Total time: 4.426s
- extlinux menu for u-boot start
- boot android by selecting slot_b
random notes
- when phone was in fastbootd on slot_a
fastboot erase dtbo_bfailed- maybe flashing u-boot didn't show an error, but didn't work, neither.
- flashing from bootloader fastboot while slot_b active worked
fastboot erase dtbo_b flash boot_b u-boot.img - but: flashing system_b (root) and rescue_b (boot) worked fine from fastbootd in slot_a
Shift6mq recovery by edl
TODO: recover partition table(s)
Didn't (haven't been forced to) try this, yet - notes:
partition contents
get a complete backup of all partitions including an xml to recover each drive:
edl rl dumps --memory=ufs --genxml
should be possible to restore the above by
edl wl dumps --memory=ufs
question: Does this create partition if need be?
partition table
edl gpt . --genxml --memory=ufs
Creates .xml-files for each lun/disk found on the device. The resulting rawprogram?.xml files are the same as the ones created by the dump of the whole partition. Just the data (.bin-files) is missing.
question: how would the partition tables be create from this information?
recover ShiftOS
- make sure the phone is in edl mode:
lsusb | grep 05c6:9008should show one line of output on the computer the phone is connected to via usb - get SHIFT6MQ.SOS.7.0.L-RELEASE-LIGHT-*-FASTBOOT.tar.gz
- unpack the files
- flash recovery.img to get a working fastboot mode:
- flash
recovery.imgusingedl w recovery_a recovery.img --memory=ufs --lun=4 - flash the same to
recovery_b
- flash
- reboot into fastboot by powering up using
Volume Up+Poweras long as it needs to restart the phone - flash Shift-OS: run
fastboot_flash.shfrom the archive to flash the rest of the partitions - boot to recovery and factory reset (to get the welcome assistant and be able to user ShiftOS normally)
This will restore ShiftOS to slot_a. slot_b will be used for the first update of ShiftOS.
TODO: this seems to recover a bootable Shift-OS-L in slot_a, but
- fastboot mode (
power+vol-up) still shows a pmOS logo
sdm845 mainline testing
install kernel
on a workstation
- clone https://codeberg.org/sdm845/linux
- change into the kernel source directory
- change to the actual target
git checkout sdm845-next-<date>(usually announced in matrix #sdm845:ixit.cz)
- install pmboostrap from git (envkernel.sh is not contained when installed via pip)
- run
pmbootstrap init- select Shift / axolotl
$ pmbootstrap status
Channel: systemd-edge (pmaports: master)
Device: shift-axolotl (aarch64)
UI: phosh
systemd: yes ('always' selected in 'pmbootstrap init')
- from inside your kernel source directory enter build environment
. ~/postmarketOS/pmbootstrap/helpers/envkernel.sh - in the same directory run
make defconfig sdm845.config - build the kernel by running
make -j10(adopt-j10to match the amount of jobs to run in parallel - max. number of your cpu cores) - still inside the linux source code directory build an apk for the kernel by running
pmbootstrap build --envkernel linux-postmarketos-qcom-sdm845 - find the packages kernel+firmware at
~/.local/var/pmbootstrap/packages/edge/aarch64/
- backup the known-to-work kernel and files:
tar -cvzf backup-kernel-and-boot-`date -I`.tar.gz /lib/modules/6.16.7-sdm845 /boot /usr/share/kernel/postmarketos-qcom-sdm845(can be restored in u-boot usb mass storage mode) - TODO copied the apk file to the phone via scp and tried to install using
apk add ./linux-postmarketos-qcom-sdm845-<version>.apk. This failed due to /boot not having enough space.- there doesn't seem to be a supported/official way for postmarketOS to offer different kernels for booting
- Delete old kernel files from /boot:
rm -rf /boot/dtbs /boot/linux.efi /boot/vmlinuz /boot/initramfs /usr/share/kernel/postmarketos-qcom-sdm845/kernel.release /lib/modules/_leftover-modules-from-piror-attempt_ - Extracted the package using
cd /; apk extract <apk file> - Created a new initramfs
mkinitfs
on the phone
install kernel
- backup the known-to-work kernel and files:
tar -cvzf /root/backup-kernel-and-boot-`date -I`.tar.gz /lib/modules/6.16.7-sdm845 /boot /usr/share/kernel/postmarketos-qcom-sdm845(can be restored in u-boot usb mass storage mode) - copied the apk files to the phone via scp and tried to install using
apk add ./linux-postmarketos-qcom-sdm845-<version>.apk. This failed due to /boot not having enough space.- there doesn't seem to be a supported/official way for postmarketOS to offer different kernels for booting
- Delete old kernel files from /boot:
rm -rf /boot/dtbs /boot/linux.efi /boot/vmlinuz /boot/initramfs /usr/share/kernel/postmarketos-qcom-sdm845/kernel.release /lib/modules/_leftover-modules-from-piror-attempt_ - Extracted the package using
cd /; apk extract <apk file> - Created a new initramfs
mkinitfs
firmware path
The new kernel uses a different location for firmware:
shift6mq:~# mkdir /lib/firmware/qcom/sdm845/SHIFT; ln -s /lib/firmware/qcom/sdm845/axolotl /lib/firmware/qcom/sdm845/SHIFT/ shift6mq:~# ls -l /lib/firmware/qcom/sdm845/SHIFT/ total 0 lrwxrwxrwx 1 root root 33 Feb 25 20:03 axolotl -> /lib/firmware/qcom/sdm845/axolotl
The correct path for the firmware can be looked up in the kernels dts for axolotl by looking at the kernel source or at the running kernel:
- Looking inside the kernel source tree (example from Pixel3a):
$ grep firmware ./arch/arm64/boot/dts/qcom/sdm845-shift-axolotl.dts firmware-name = "qcom/sdm845/SHIFT/axolotl/adsp.mbn"; firmware-name = "qcom/sdm845/SHIFT/axolotl/cdsp.mbn"; firmware-name = "qcom/sdm845/SHIFT/axolotl/a630_zap.mbn"; firmware-name = "qcom/sdm845/SHIFT/axolotl/ipa_fws.mbn"; firmware-name = "qcom/sdm845/SHIFT/axolotl/mba.mbn", "qcom/sdm845/SHIFT/axolotl/modem.mbn"; firmware-name = "qcom/sdm845/SHIFT/axolotl/slpi.mbn"; * subdir under lib/firmware. firmware-name = "SHIFT/axolotl/crnv21.bin"; firmware-name = "qcom/sdm845/SHIFT/axolotl/venus.mbn";
- Getting the path from a running kernel:
# apk add dtc The following NEW packages will be installed: dtc libfdt Need to download 111 KiB of packages. After this operation, 531 KiB of additional disk space will be used. Do you want to continue [Y/n]? y Downloading 2 packages... (1/2) Downloading libfdt-1.7.2-r0 (2/2) Downloading dtc-1.7.2-r0 Proceeding with upgrade... (1/2) Installing libfdt (1.7.2-r0) (2/2) Installing dtc (1.7.2-r0) Executing busybox-1.37.0-r30.trigger OK: 2663.7 MiB in 1240 packages # dtc -I fs -O dts /sys/firmware/devicetree/base 2>/dev/null | grep firmware-name firmware-name = "qcom/sdm670/sargo/adsp.mbn"; firmware-name = "qcom/sdm670/sargo/cdsp.mbn"; firmware-name = "qcom/sdm670/sargo/a615_zap.mbn"; firmware-name = "qcom/sdm670/sargo/ipa_fws.mbn"; firmware-name = "qcom/sdm670/sargo/mba.mbn", "qcom/sdm670/sargo/modem.mbn"; firmware-name = "qcom/sdm670/sargo/venus.mbn";
If you think it doesn't work remove the redirection of std-err to /dev/null 2>/dev/null from the command to get error messages.
Also the above shows that e.g. mba.mbn is being looked for. On my system there has only been a compressed version mba.mbn.zstd. I had to extract it using apk add zstd; zstdcat mba.mbn.zst > mba.mbn.
Test on the running system if firmware listed in the dts is found: cd /lib/firmware; ls -l `dtc -I fs -O dts /sys/firmware/devicetree/base 2>/dev/null | grep firmware-name | cut -d'"' -f2 | tr '\n' ' '`
restore working kernel
If the new kernel doesn't work and the phone doesn't boot, it can be restored by exporting the mass storage of the phone via usb and then re-install the old kernel.
I tried to make this work using pmbootstrap chroot -r on x86_64 and mount the phones storage into the chroot filesystem of pmbootstrap, but couldn't get apt to run properly on it (failing on hooks). Using apk.static for x86_64 failed also, because hooks couldn't run. craftyguy suggested to use qemu and binfmt to set up a virtual machine for aarch64, but I didn't try this.
My solution atm is to use a Librem5 as the host computer to connect the usb mass storage of the Shift6mq to. This should probably work with any aarch64 architecture computer that offers a usb port.
- start phone into u-boot menu
- select usb mass storage
- connect the phone to a aarch64 linux computer (tried Librem5)
- mount from the Shift6mq exported usb storage
- pmOS_root on `mountpoint`: (only with disk encryption:
cryptsetup open /dev/<device> pmOS_root)mkdir pmOS_root; mount LABEL=pmOS_root pmOS_root - pmOS_boot pm `mountpoint`/boot:
mount LABEL=pmOS_boot pmOS_root/boot - /proc, /sys, /dev:
for F in sys dev proc; do mount --bind /$F pmOS_root/$F; done
- pmOS_root on `mountpoint`: (only with disk encryption:
- chroot into the system
- set nameserver
- restore the kernel by installing linux-postmarketos-qcom-sdm845
apk add ./linux-postmarketos-qcom-sdm845-6.16.7-r4.apk