Creating recovery partition

I am working on Debian image provided by https://snapshots.linaro.org/96boards/dragonboard820c/linaro/rescue/latest/
I’m using
dragonboard-820c-bootloader-ufs-linux-40.zip
I need to create partition for recovery & as per my understanding it should be mentioned in rawprogram.xml. But I need support on how to configure a whole new partition which updates board by putting it in recovery mode & flashing recovery.img by command fastboot flash recovery recovery.img

1 Like

You can follow this guide: Customizing eMMC partition in Linux - 96Boards, simply use 820c subdir instead of 410c. Let me know if something unclear.

Hi,

I have the same query as asked above…
On cloning the git files as suggested:
DB820c dir doesn’t have partitions.txt file as in
dragonboard410c/linux/partitions.txt
So should we modify partition.xml?

Thanks in advance.

the tools we use for DB410c, unfortunately, don’t work for DB820c. the reason is that they don’t work when target disk as 4K sector size such as with UFS disk.

partition.xml file is used a the ‘main’ source to create the GPT, and from that file, gpt_*.bin and rawprogram.xml are generated. i don’t think the tools used for the generation are public though. there is a branch “4k-sector” in db-boot-tools where I started to fix the tools for 4k sector size, but it’s not functional… and I never got back to it.

so , right now , you really can’t update the GPT easily. let me have a look at this old branch… i am not even sure what the status was back then…

Thanks for the support.
Please let me know if at all enabling recovery partition is supported.

I found that partition.xml file isn’t given away to all users in case of DB820c. In lk/aboot/aboot.c ; there are instances where partitions are declared as *critical_flash_allowed_ptn[] ,so working on it.
Thanks for the quick response…

Hello , I am also looking to create a recovery partition and firmware partition . I read that dragonboard releases different partition schemes based on use cases. How can i access these different partition schemes or is there a possibility to help generate a custom partition binaries for my use?

hey, finally some updates…

a new version of ptool.py was released for DB845c which now works for UFS disk. The same tool can now be used for DB820c as well.

This tool can be found here:
https://git.linaro.org/landing-teams/working/qualcomm/partioning_tool.git/

To use this tool:

python2 ptool.py -x <partition.xml>

Where partition.xml has all information about the partitions to be created. we’ve released the xml file for the Linux and AOSP ptable that we used so far for DB820c, they are here:

https://git.linaro.org/landing-teams/working/qualcomm/db-boot-tools.git/tree/dragonboard820c/linux/partition.xml

https://git.linaro.org/landing-teams/working/qualcomm/db-boot-tools.git/tree/dragonboard820c/aosp/partition.xml

You should be able to start from either of these 2 files and customize as needed. The XML file lists all partitions that need to be created and their properties.

ptool.py will generate a bunch of files, including rawprogram*.xml, patch*.xml, gpt_*.bin which you will need to reflash your device.

Please note that we do not support updating the LUNs configuration on the UFS. so do no attempt to change the LUN config in partition.xml

1 Like

Brilliant , this works great thanks !

Hey @Chetan
What value did you enter in type=… section after giving an entry for recovery or any other partition ??

Here you go
<partition label = “recovery” size_in_kb = “65536” type = “9D72D4E4-9958-42DA-AC26-BEA7A90B0434” bootable = “false” readonly = “true” filename = “recovery.img” />

@ymj you can use Linux uuidgen command to generate random UUIDs for your requirements, there is no need for a specific UUID to be used for embedded devices , however you would have to use the same UUIDs across a product line obviously .

Ya thanks for the info @Chetan… the partition is created.
Is there any recovery.img from Linaro to know how to perform SD-card based recovery…
I found an SD-card rescue image for DB820c(size too large for my recovery partition :frowning: ).
Any manuals/reading suggestions for the same??

What’s the size of your recovery partition ? I use 64 MB the easiest way is to take the initramfs image extract it and create a script under local-premounts .

@anon91830841 This is a minor one - But taking a look at ufs-provision_toshiba.xml « dragonboard820c - working/qualcomm/db-boot-tools.git - [no description]
LUN 4 and 5 have comments mentioning they are 512 MB and 2.5GB where as the actual space is 4GB and 1.5 GB respectively .

desc="LU 4 - Protected Read-only LUN-512MB
desc="LU 5 - Protected Read-write LUN-2.5GB

Reason why i bought this up was i referred to the comments and planned the partition and realised i could use a little more space on the device after realising where the missing space was.

@ymj you could use more space in recovery if you need to , 64MB is just an example.

I created recovery partition as equal size of the boot partition.(13mb)
And stored same boot.img in it for a quick check of the newly created partition…
Thanks for the help…

thanks, I fixed it now.

On flashing SDcard rescue image dragonboard-820c-sdcard-rescue-54.img into recovery partition:
I got the error: (dragonboard-820c-sdcard-rescue-54.img not a boot image).

I also flashed recovery.img which was obtained from mkbootimg procedures. In this case board boots normally through image in recovery partition.

mkbootimg --kernel BUILD_DEB/Image.gz+dtb --ramdisk BUILD_DEB/initrd.img-4.14.0-qcomlt-arm64 --output recovery.img --pagesize 4096 --base 0x80000000 --cmdline "root=/dev/disk/by-partlabel/rootfs rw rootwait console=ttyMSM0,115200n8"

How to obtain recovery image with equivalent capabilities of Andriod recovery image?

You would have to use two different initrd for boot and recovery.
At a high level take the existing intrd and decompress it.
Then take a look at /scripts/local-premount folder , place a script here lets call it sdcard_recovery
then edit scripts/local-premount/ORDER file and add the sdcard_recovery there, like below at the end of the file.

/scripts/local-premount/sdcard_recovery
[ -e /conf/param.conf ] && . /conf/param.conf

Then compress the ramdisk back and use this ramdisk to compile make the boot image as you indicate above . Now the system will boot kernel and execute the script.

2 Likes

Hi, Chetan, ymj,
What you have done looks very interesting to us.
My question is, how do you boot from the recovery partition? Does it automatically happen if the main partition got corrupted? Or is there any way forcing to boot from the recovery partition?
Thanks,
tamo2