
Hi Sam, hi Igor,
On Thu, Jun 13, 2019 at 12:14:11AM +0300, Sam Protsenko wrote:
From: Igor Opaniuk igor.opaniuk@toradex.com
Currently getvar_has_slot() invocation for "boot" and "system" partitions always returns affirmative response regardless the fact of existence of these partitions, which leads to impossibility to flash them on old non-A/B AOSP setups, where _a/_b suffixes aren't used:
$ fastboot flash boot boot.img Sending 'boot__a' (11301 KB) OKAY [ 0.451s] Writing 'boot__a' FAILED (remote: 'cannot find partition') fastboot: error: Command failed
Although partition layout is: -> part list mmc 0 Partition Map for MMC device 0 -- Partition Type: EFI
Part Start LBA End LBA Name Attributes Type GUID Partition GUID 1 0x00000800 0x000107ff "boot" attrs: 0x0000000000000000 type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7 guid: ea2e2470-db4a-d646-b828-10167f736d63 2 0x00010800 0x000127ff "environment" attrs: 0x0000000000000000 type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7 guid: 10a819d2-6004-3d48-bd87-114e2a796db9 3 0x00012800 0x0001a7ff "recovery" attrs: 0x0000000000000000 type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7 guid: 9ea116e4-8a34-0c48-8cf5-2fe9480f56cd 4 0x0001a800 0x0031a7ff "system" attrs: 0x0000000000000000 ......
This patch adds checks of existence for requested partitions on eMMC/NAND.
Signed-off-by: Igor Opaniuk igor.opaniuk@toradex.com Signed-off-by: Sam Protsenko semen.protsenko@linaro.org
drivers/fastboot/fb_getvar.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-)
With the https://patchwork.ozlabs.org/cover/1114844/ ("[U-Boot,v2,0/3] fastboot: Fix getvar "has-slot" and cleanup") series applied on top of v2019.07-rc4-136-gc2ea87883ef3, I get below build failure on sandbox:
drivers/fastboot/fb_getvar.c: In function ‘getvar_has_slot’: drivers/fastboot/fb_getvar.c:198:6: warning: implicit declaration of function ‘getvar_get_part_info’; did you mean ‘getvar_serialno’? [-Wimplicit-function-declaration] r = getvar_get_part_info(part_name_wslot, response, NULL); ^~~~~~~~~~~~~~~~~~~~ getvar_serialno [..] LD u-boot drivers/built-in.o: In function `getvar_has_slot': /home/erosca/R/u-boot-master/drivers/fastboot/fb_getvar.c:198: undefined reference to `getvar_get_part_info' collect2: error: ld returned 1 exit status Makefile:1570: recipe for target 'u-boot' failed make[1]: *** [u-boot] Error 1 Makefile:498: recipe for target '__build_one_by_one' failed make: *** [__build_one_by_one] Error 2