How to implement recovery mechanism

Hi Team,

How to implement recovery as like android devices when kernel corrupted and the device fails to boot.
Any pointers to begin with?

@Loic
@anon91830841

Thanks,
Arun

1 Like

Any idea on this?

Thanks,
Arun

Recovery in Android is basically a second OS that can be switched to by a special bootloader mode controlled by a hardware key. Typically the bootloader supports normal boot, recovery boot and fastboot. I suspect if you review the LittleKernel source code you will find the code (currently unused) that implements this.

@danielt

I am able to create recovery partition and enter recovery boot from lk. How to update the corrupted boot partition with recovery partition? for DB410c, I can see DragonBoard 410c Board Recovery - 96Boards SDcard recovery image which will update the corrupted partitions. How to create a similar image for DB820c? my idea is to build a similar image for recovery boot for DB820c and that will update all the corrupted partitions if i boot into recovery mode.

Thanks,
Arun

SD card recovery is not supported on DB820C. I’m not 100% certain but IIRC this is because there is not a working SD card driver for this platform in LittleKernel.

@danielt
yes, there is no SDcard driver for DB820c. my intention is to ask how to create a recovery image and what recovery image should contain for DB820c?

I want to implement like this:
if I make a boot in recovery mode, from recovery mode it should update corrupted partitions(example: boot partition) and boot back in normal mode. Any pointers to create recovery image to do this?

Thanks,
Arun

The recovery image is simply a regular userspace that automatically starts a service to rewrite the partitions. As it happens the DB410C recovery images are customised Debian images (mostly to reduce maintenance costs by using a similar userspace for recovery and for normal running).

I have built recovery image(contains boot image+initrd.img), initrd.img has the scripts to rewrite the partitoins and flashed it in recovery partition, lets say as sde3. In script, i am using simple copy command to copy corrupted boot partition(ex: sde2) with backup boot partition(ex: sde1) (cp sde1 sde2). with this, I am able to recover the corrupted boot partition.

Is this a proper way?

@danielt
Thanks,
Arun

Personally I would have used dd but I doubt the choice of copy tool matters very much.

… although for big images such as rootfs you should use something like simg2img or bmap-tools to make the writing process quicker.