This guide was originally written here and is likely written by Ivan-HC.
At the time when the contents of this article was written, custom recovery was very new to KaiOS.... but as of now (2021) only a few devices has a Custom Recovery (Nokia 8110 4G and a few JioPhone Models). This is likely because Jailbreaking and Rooting(Temporary) no longer needed to modify system partitions because of new discoveries(aka Wallace Toolbox is now invented and does not need to modify partitions other than userdata and cache).... Though, with new restrictions in newer KaiOS versions we might see a comeback to custom recoveries to root our devices in the mere future.
If you actually broke everything and you need to repair your phone, a custom recovery may not be available. Instead please use your CPU/Chipset's Flash tool(edl for Qualcomm, SPD Tools for Spreadtrum, SPF Tools for Mediatek and etc.) or use fastboot(if the device has it of course).
An error that often occurs when you don't have a "pure" KaiOS device with clean and untouched partitions is the OTA update that returns an error in the form of a log.
Most of the time the error concerns a faulty partition like this in the picture. This is because the update package detects the integrity of the system, and often the error corresponds to a detection that does not meet expectations.
As it's written on the internal licenses:
"THIS SOFTWARE IS PROVIDED AS IS".
Modifying the system to your liking interrupts the warranty, therefore the update interrupts its action in order not to further compromise the stability of the system and damages that may require user compensation.
This is why it's so important to keep a copy of your clean partitions, and since there are some "backup partitions" in the structure (which generally contain the word "
bak" in the name) it becomes even more difficult to make the device comply with the integrity standards dictated by the OTA update.
For example, if the damaged partition is
/aboot and we replace it, there may be a difference on the checksum when we try to update again, because in the meantime the
/abootbak will replace again
/aboot with its own regenerated copy, just as it does
NOTE: using these commands we must be careful to distinguish the directory structure in a KaiOS system installed on one chipset compared to another chipset:
• Qualcomm and Mediatek are quite similar, their structure should be always
• Spreadtrum-based models have are structured like this,
Our clean dumps, combined with the tools that massively restore the partitions, are enhanced by our ability to read the logs, which are stored in the cache.
You can read the logs in three ways:
1.) From adb shell, as root, we can read the logs list with the following command:
Usually the errors are listed in the last_log file, you can read it in this way:
2.) From Recovery Mode select "
view recovery logs";
3.) Copy the cache partition with this command, as root:
dd if=/dev/block/bootdevice/by-name/cache of=/sdcard/cache.img bs=2048
dd if=/dev/block/platform/soc/by-name/cache of=/sdcard/cache.img bs=2048
The use of a Custom Recovery is important to speed up the backup and restore operations, wherever and whenever you want, so before you read about our tools you must know:
1.) how to get a copy of the recovery;
2.) how to made a custom recovery for your device (because they can be different);
3.) how to replace it temporarily;
4.) above all you need to know why it is necessary to replace it only temporarily!
NOTE: the use of a Recovery with ADB root is recommended!
With the two attached files you can restore the partition.