Skip to content
Snippets Groups Projects
Verified Commit e759307e authored by Jens Reidel's avatar Jens Reidel
Browse files

edge: add post for generic sm7150 migration


Signed-off-by: default avatarJens Reidel <adrian@travitia.xyz>
parent 29490e3e
No related branches found
No related tags found
No related merge requests found
Pipeline #216914 passed
title: "Existing SM7150 device packages removed in favour of generic package"
date: 2025-03-09
---
## Summary
The device packages for the Xiaomi SM7150 devices in the community category
(xiaomi-davinci and xiaomi-surya) have been removed in favor of a generic device
package. Migration requires manual intervention and, in most cases, a reinstall
from scratch. This is due to the switch to U-Boot as a second stage bootloader
and a new partition scheme.
## Details
In the past, these devices had device-specific packages that defined which
devicetree blob would be appended to the kernel and included firmware specific
to the device, necessitating the packaging of firmware and device package for
every supported device.
Support for Qualcomm chipsets and devices in U-Boot has been
[rapidly improving](https://www.linaro.org/blog/initial-u-boot-release-for-qualcomm-platforms/),
to the point where it is now possible to build and boot U-Boot for SM7150
devices with very few patches.
The switch to U-Boot as the bootloader for postmarketOS comes with several
advantages. Most importantly, U-Boot comes with an EFI implementation that lets
us boot the Linux kernel with systemd-boot and have U-Boot pick the correct
devicetree blob instead of appending it to the kernel.
This means that as long as a device is supported by the SM7150 Linux kernel fork
and U-Boot, it can boot postmarketOS with _no changes_ needed in postmarketOS!
Thanks to
[recent changes in msm-firmware-loader](https://gitlab.postmarketos.org/postmarketOS/msm-firmware-loader/-/tags/1.6.0),
these devices can now load their firmware from the Android partitions and don't
require it to be packaged anymore.
This requires some major changes to the partition layout. A default install of
postmarketOS as found in the prebuilt edge images for these devices currently
looks something like this:
- The `boot` partition contains an Android boot image with the kernel and
devicetree
- `userdata` or `system` contain the rootfs partition and the boot partition as
subpartitions
Going forward, it will look as follows:
- `boot` contains an Android boot image with U-Boot disguised as a Linux kernel
- `cache` (or any other partition >256MB in size that does not contain firmware)
contains the boot partition with the EFI system partition containing U-Boot,
the Linux kernel and devicetree blobs for supported devices
- `userdata` serves as the rootfs partition
These two partition setups are entirely incompatible with each other and there
is no way to migrate from one to the other without taking a backup and
performing a fresh install.
Since the SM7150 devices never made it to a stable release, this was deemed
acceptable and worth the upsides of this migration.
## Performing a fresh install
The steps for performing a new install of a supported SM7150 device are as
follows (they can also be found
[in the Wiki](https://wiki.postmarketos.org/wiki/Generic_SM7150_(qcom-sm7150)#Installation)):
1. Reboot the device into fastboot by holding the `Volume Down` and `Power`
buttons
2. If you're coming from Android, run `fastboot erase dtbo`. If you were on
postmarketOS before, you don't need to run this again.
3. Download the U-Boot image for your device from
[the latest release](https://github.com/sm7150-mainline/u-boot/releases/tag/2025-03-09).
If your device has multiple options available, consult the postmarketOS Wiki
for the steps to determine your panel variant.
4. Flash the U-Boot image:
`fastboot flash boot u-boot-sm7150-[vendor]-[device].img`
5. Download a
[postmarketOS edge build](https://images.postmarketos.org/bpo/edge/qcom-sm7150/)
for the generic SM7150 target and decompress the images with `unxz`.
6. Flash the boot partition to `cache`:
`fastboot flash cache <decompressed boot.img>` (this partition may not exist
on A/B-partitioned devices, in which case we need to flash to a different
partition, check your device's Wiki page for details)
7. Flash the rootfs to `userdata`:
`fastboot flash userdata <decompressed qcom-sm7150.img>`
8. Reboot the device: `fastboot reboot`
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment