Vendor.img size too large

We are trying to flash Android 5.0 on 820uSoM, but we get the following error:

error: no devices/emulators found
< waiting for any device >
fastboot: error: Couldn't parse partition size '0x'.
Sending 'cache' (128 KB)                           OKAY [  0.031s]
Writing 'cache'                                    OKAY [  0.030s]
Finished. Total time: 0.119s
Sending 'persist' (32768 KB)                       OKAY [  0.801s]
Writing 'persist'                                  OKAY [  0.343s]
Finished. Total time: 1.201s
Sending 'recovery' (62337 KB)                      OKAY [  1.533s]
Writing 'recovery'                                 OKAY [  0.632s]
Finished. Total time: 2.222s
Sending sparse 'system' 1/3 (524284 KB)            OKAY [ 12.750s]
Writing 'system'                                   OKAY [  5.153s]
Sending sparse 'system' 2/3 (524284 KB)            OKAY [ 12.751s]
Writing 'system'                                   OKAY [  5.142s]
Sending sparse 'system' 3/3 (300532 KB)            OKAY [  7.233s]
Writing 'system'                                   OKAY [  2.963s]
Finished. Total time: 46.047s
Sending 'userdata' (5368 KB)                       OKAY [  0.150s]
Writing 'userdata'                                 OKAY [  0.084s]
Finished. Total time: 0.291s
Sending 'vendor' (406536 KB)                       OKAY [ 10.026s]
Writing 'vendor'                                   FAILED (remote: 'size too large')
fastboot: error: Command failed
Rebooting                                          OKAY [  0.014s]
Finished. Total time: 0.064s

and on the uSoM UART debug port:

[13:54:46:491] [119320] fastboot: getvar:has-slot:boot␍␊
[13:54:46:507] [119340] fastboot: getvar:max-download-size␍␊
[13:54:46:523] [119360] fastboot: getvar:is-logical:boot␍␊
[13:54:46:539] [119380] fastboot: getvar:partition-size:boot␍␊
[13:54:46:635] [119470] fastboot: getvar:has-slot:cache␍␊
[13:54:46:651] [119490] fastboot: getvar:max-download-size␍␊
[13:54:46:667] [119510] fastboot: getvar:is-logical:cache␍␊
[13:54:46:699] [119530] fastboot: download:00020094␍␊
[13:54:46:731] [119570] fastboot: flash:cache␍␊
[13:54:46:747] [119570] Wrote 65536 blocks, expected to write 65536 blocks␍␊
[13:54:46:827] [119660] fastboot: getvar:has-slot:persist␍␊
[13:54:46:842] [119680] fastboot: getvar:max-download-size␍␊
[13:54:46:858] [119700] fastboot: getvar:is-logical:persist␍␊
[13:54:46:891] [119720] fastboot: download:02000000␍␊
[13:54:47:689] [120530] fastboot: flash:persist␍␊
[13:54:48:120] [120950] fastboot: getvar:has-slot:recovery␍␊
[13:54:48:136] [120970] fastboot: getvar:max-download-size␍␊
[13:54:48:152] [120990] fastboot: getvar:is-logical:recovery␍␊
[13:54:48:168] [121010] fastboot: download:03ce052c␍␊
[13:54:49:702] [122530] fastboot: flash:recovery␍␊
[13:54:50:389] [123220] fastboot: getvar:has-slot:system␍␊
[13:54:50:405] [123240] fastboot: getvar:max-download-size␍␊
[13:54:50:421] [123260] fastboot: getvar:is-logical:system␍␊
[13:54:50:453] [123280] fastboot: download:1ffff0ac␍␊
[13:55:03:054] [135880] fastboot: flash:system␍␊
[13:55:08:188] [141000] Wrote 786432 blocks, expected to write 786432 blocks␍␊
[13:55:08:204] [141030] fastboot: download:1ffff070␍␊
[13:55:21:046] [153880] fastboot: flash:system␍␊
[13:55:26:185] [158990] Wrote 786432 blocks, expected to write 786432 blocks␍␊
[13:55:26:201] [159020] fastboot: download:1257d094␍␊
[13:55:33:484] [166310] fastboot: flash:system␍␊
[13:55:36:439] [169250] Wrote 786432 blocks, expected to write 786432 blocks␍␊
[13:55:36:503] [169330] fastboot: getvar:has-slot:userdata␍␊
[13:55:36:519] [169350] fastboot: getvar:max-download-size␍␊
[13:55:36:551] [169370] fastboot: getvar:is-logical:userdata␍␊
[13:55:36:567] [169390] fastboot: download:0053e274␍␊
[13:55:36:727] [169550] fastboot: flash:userdata␍␊
[13:55:36:804] [169610] Wrote 4980736 blocks, expected to write 4980736 blocks␍␊
[13:55:36:868] [169700] fastboot: getvar:has-slot:vendor␍␊
[13:55:36:900] [169720] fastboot: getvar:max-download-size␍␊
[13:55:36:915] [169740] fastboot: getvar:is-logical:vendor␍␊
[13:55:36:931] [169760] fastboot: download:18d020e8␍␊
[13:55:46:819] [179650] fastboot: flash:vendor␍␊
[13:55:46:911] [179730] fastboot: reboot␍␊
[13:55:46:911] [179730] rebooting the device␍␊
[13:55:46:911] <break>

Images sizes are:

54M     boot.img
132K    cache.img
32M     persist.img
61M     recovery.img
1,3G    system.img
5,3M    userdata.img
398M    vendor.img

Running fastboot getvar all we get:

(bootloader) version:0.5
(bootloader) battery-soc-ok:yes
(bootloader) battery-voltage:3898323
(bootloader) variant:Dragon eMMC
(bootloader) secure:no
(bootloader) version-baseband:
(bootloader) version-bootloader:
(bootloader) display-panel:jd9161_wvga_video
(bootloader) off-mode-charge:0
(bootloader) charger-screen-enabled:0
(bootloader) max-download-size: 0x20000000
(bootloader) partition-type:cache:ext4
(bootloader) partition-size:cache:       0x10000000
(bootloader) partition-type:userdata:ext4
(bootloader) partition-size:userdata:    0x5f89b3000
(bootloader) partition-type:system:ext4
(bootloader) partition-size:system:      0xc0000000
(bootloader) serialno:906f4ac7
(bootloader) kernel:lk
(bootloader) product:MSM8996_O

We tried to use the -S option for vendor image, so fastboot flash vendor vendor.img -S 128M as per suggestions on some forums, but we got the same error.

When switching the order of image flashing (e.g vendor before system), we got the same error, so it looks like the problem is solely with vendor image/partition.

We also tried few versions of fastboot with no luck: fastboot version 1:8.1.0+r23-5~18.04 (from apt), fastboot version 28.0.0-4797878 (included in BSP) and fastboot version 30.0.4-6686687 (downloaded from developer.android.com).

You really need to talk with your uSOM vendor about this. But looking at the output it seems like that the partition table doesn’t have a “vendor” partition, or the partition is zero size.

Android 5.0? On a Snapdragon 820? You can’t possibly be serious… That soc shouldnt be running anything under 7.1. And I don’t think the vendor partition was introduced until android 8.

You could use the trick used for the dragonboard 410c, which is to use the cache partition as the vendor partition. This requires changes to the fstab and possibly kernel device tree.