fastboot: properly handle unknown partition type
PATCH 1/1 fastboot: properly handle unknown partition type
In getvar_partition_type() we attempt to find a filesystem driver for the partition (of the list of driver enabled in U-Boot), on failure we return the error to fastboot and completely bail out of the operation.
However, this should not be a failure, instead we should just default to "raw". This allows commands like "fastboot format:ext4 userdata" to work if userdata didn't already have an ext4 partition table (or if FS_EXT4 is disabled in U-Boot), as failing to determine the current partition type is not an error in this case.
--- drivers/fastboot/fb_getvar.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/fastboot/fb_getvar.c +2 -1
@@ -229,9 +229,10 @@ static void __maybe_unused getvar_partition_type(char *part_name, char *response response);if (r >=0 ) { r =fs_set_blk_dev_with_part (dev_desc, r);if (r <0 ) -fastboot_fail ("failed to set partition" , response); +/* If we don't know then just default to raw */ +fastboot_okay ("raw" , response);else fastboot_okay (fs_get_type_name (), response); } }
Signature · 1 line
2.47.0
Hi Caleb,
Thank you for the patch.
Quoted 11 lines · Caleb Connolly
In
getvar_partition_type()we attempt to find a filesystem driver for the partition (of the list of driver enabled in U-Boot), on failure we return the error to fastboot and completely bail out of the operation.However, this should not be a failure, instead we should just default to "raw". This allows commands like "fastboot format:ext4 userdata" to work if userdata didn't already have an ext4 partition table (or if
FS_EXT4is disabled in U-Boot), as failing to determine the current partition type is not an error in this case.Signed-off-by Caleb Connolly <[email protected]>
Quoted 22 lines
--- drivers/fastboot/fb_getvar.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/fastboot/fb_getvar.c +2
-1@@ -229,9 +229,10 @@ static void __maybe_unused getvar_partition_type(char *part_name, char *response response);if (r >=0 ) { r =fs_set_blk_dev_with_part (dev_desc, r);if (r <0 ) -fastboot_fail ("failed to set partition" , response); +/* If we don't know then just default to raw */ +fastboot_okay ("raw" , response);else fastboot_okay (fs_get_type_name (), response); } }Signature · 1 line
2.47.0
Hi,
Quoted 11 lines · Caleb Connolly
In
getvar_partition_type()we attempt to find a filesystem driver for the partition (of the list of driver enabled in U-Boot), on failure we return the error to fastboot and completely bail out of the operation.However, this should not be a failure, instead we should just default to "raw". This allows commands like "fastboot format:ext4 userdata" to work if userdata didn't already have an ext4 partition table (or if
FS_EXT4is disabled in U-Boot), as failing to determine the current partition type is not an error in this case.[...]
Thanks, Applied to https://source.denx.de/u-boot/custodians/u-boot-dfu (u-boot-dfu)
[1/1] fastboot: properly handle unknown partition type
https://source.denx.de/u-boot/custodians/u-boot-dfu/-/commit/06b8aafd6810d86f37d5b1cd9c1966f1e42403ed
--
Mattijs