Migrate from self-built (test-key
or dev-key
) or Official Release from https://download.lineageos.org/, to our self-signed builds, RETAINING DATA!!! and avoid the annoying error:
Can't install this package on top of incompatible data. Please try another package or run a factory reset
Apply the two patch accordingly, with command below. (Changed a little bit from 156047 and 162144
repo start nokey frameworks/base vendor/cm
cd frameworks/base
git apply ../../android-framework-base.patch
git commit -a -m "nokey"
cd vendor/cm
git apply ../../android-vendor-cm.patch
git commit -a -m "nokey"
cd ../..
Then start a build. And sign as Lineage tutorial.
mka target-files-package dist
Afterwards, look at the keys_migration.sh
below, taken unchanged from LineageOS.
Use uncert.py
to get your certificates' hexdump. (Assuming your certificates in ~/.android-certs
)
export KEYPATH=~/.android-certs
uncert.py $KEYPATH/*.pem
and fill the output into [xxx]_cert_release
and release_cert
variables of keys_migration.sh
accordingly.
Invoke command below to get certs' public keys.
ls $KEYPATH/*.pem | xargs -I% sh -c 'echo -n % && openssl x509 -pubkey -noout -in %'
and fill them into [xxx]_key_release
and release_key
. (and remove every \n
bcoz I'm too lazy to strip them...)
Then, IN RECOVERY, after decrypted and mounted /data partition, push your file to somewhere in your phone, then do it.
adb push keys_migration.sh /tmp/
adb shell /tmp/keys_migration.sh