fastboot: check for alias when looking up partition by name
PATCH 1/1 fastboot: check for alias when looking up partition by name
Implement an alias name check for devices where GPT limitations prevent user-friendly partition names such as "boot", "system" and "cache". Or, where the actual partition name doesn't match a standard partition name used commonly with fastboot.
To set an alias, add an environment setting as follows:
fastboot_partition_alias_<alias partition name>=<actual partition name>
Example: fastboot_partition_alias_boot=LNX
--- common/fb_mmc.c | 26 ++++++++++++++++++++++++-- doc/README.android-fastboot | 9 +++++++++ 2 files changed, 33 insertions(+), 2 deletions(-)
common/fb_mmc.c +24 -2
@@ -33,6 +33,28 @@ void fastboot_okay(const char *s)strncat (response_str, s,RESPONSE_LEN -4 -1 ); } +static int get_partition_info_efi_by_name_or_alias (block_dev_desc_t *dev_desc, +const char *name,disk_partition_t *info) +{ +int ret; + + ret =get_partition_info_efi_by_name (dev_desc, name, info); +if (ret) { +/* strlen("fastboot_partition_alias_") + 32(part_name) + 1 */ +char env_alias_name[25 +32 +1 ]; +char *aliased_part_name; + +/* check for alias */ +strcpy (env_alias_name,"fastboot_partition_alias_" ); +strncat (env_alias_name, name,32 ); + aliased_part_name =getenv (env_alias_name); +if (aliased_part_name !=NULL ) + ret =get_partition_info_efi_by_name (dev_desc, + aliased_part_name, info); + } +return ret; +} +static void write_raw_image (block_dev_desc_t *dev_desc,disk_partition_t *info,const char *part_name,void *buffer,unsigned int download_bytes)
@@ -98,7 +120,7 @@ void fb_mmc_flash_write(const char *cmd, void *download_buffer,printf ("........ success\n" );fastboot_okay ("" );return ; - }else if (get_partition_info_efi_by_name (dev_desc, cmd, &info)) { + }else if (get_partition_info_efi_by_name_or_alias (dev_desc, cmd, &info)) {error ("cannot find partition: '%s'\n" , cmd);fastboot_fail ("cannot find partition" );return ;
@@ -136,7 +158,7 @@ void fb_mmc_erase(const char *cmd, char *response)return ; } - ret =get_partition_info_efi_by_name (dev_desc, cmd, &info); + ret =get_partition_info_efi_by_name_or_alias (dev_desc, cmd, &info);if (ret) {error ("cannot find partition: '%s'" , cmd);fastboot_fail ("cannot find partition" );
doc/README.android-fastboot +9 -0
@@ -50,6 +50,15 @@ buffer should be as large as possible for a platform. The location of the buffer and size are set with CONFIG_USB_FASTBOOT_BUF_ADDR and CONFIG_USB_FASTBOOT_BUF_SIZE. +Fastboot partition aliases can also be defined for devices where GPT +limitations prevent user-friendly partition names such as "boot", "system" +and "cache". Or, where the actual partition name doesn't match a standard +partition name used commonly with fastboot. Current implentation checks +aliases when accessing partitions by name (flash_write and erase functions). +To define a partition alias add an environment variable similar to: +fastboot_partition_alias_<alias partition name>=<actual partition name> +Example: fastboot_partition_alias_boot=LNX + In Action ========= Enter into fastboot by executing the fastboot command in u-boot and you
Signature · 1 line
2.1.4
PATCH 1/1 fastboot: check for alias when looking up partition by name
Quoted 74 lines · Michael Scott
Implement an alias name check for devices where GPT limitations prevent user-friendly partition names such as "boot", "system" and "cache". Or, where the actual partition name doesn't match a standard partition name used commonly with fastboot.
To set an alias, add an environment setting as follows:
fastboot_partition_alias_<alias partition name>=<actual partition name>Example: fastboot_partition_alias_boot=LNX
Signed-off-by Michael Scott <[email protected]>Cc Steve Rae <[email protected]>Cc Lukasz Majewski <[email protected]>--- common/fb_mmc.c | 26 ++++++++++++++++++++++++-- doc/README.android-fastboot | 9 +++++++++ 2 files changed, 33 insertions(+), 2 deletions(-)common/fb_mmc.c +24
-2@@ -33,6 +33,28 @@ void fastboot_okay(const char *s)strncat (response_str, s,RESPONSE_LEN -4 -1 ); } +static int get_partition_info_efi_by_name_or_alias (block_dev_desc_t *dev_desc, +const char *name,disk_partition_t *info) +{ +int ret; + + ret =get_partition_info_efi_by_name (dev_desc, name, info); +if (ret) { +/* strlen("fastboot_partition_alias_") + 32(part_name) + 1 */ +char env_alias_name[25 +32 +1 ]; +char *aliased_part_name; + +/* check for alias */ +strcpy (env_alias_name,"fastboot_partition_alias_" ); +strncat (env_alias_name, name,32 ); + aliased_part_name =getenv (env_alias_name); +if (aliased_part_name !=NULL ) + ret =get_partition_info_efi_by_name (dev_desc, + aliased_part_name, info); + } +return ret; +} +static void write_raw_image (block_dev_desc_t *dev_desc,disk_partition_t *info,const char *part_name,void *buffer,unsigned int download_bytes)@@ -98,7 +120,7 @@ void fb_mmc_flash_write(const char *cmd, void *download_buffer,printf ("........ success\n" );fastboot_okay ("" );return ; - }else if (get_partition_info_efi_by_name (dev_desc, cmd, &info)) { + }else if (get_partition_info_efi_by_name_or_alias (dev_desc, cmd, &info)) {error ("cannot find partition: '%s'\n" , cmd);fastboot_fail ("cannot find partition" );return ;@@ -136,7 +158,7 @@ void fb_mmc_erase(const char *cmd, char *response)return ; } - ret =get_partition_info_efi_by_name (dev_desc, cmd, &info); + ret =get_partition_info_efi_by_name_or_alias (dev_desc, cmd, &info);if (ret) {error ("cannot find partition: '%s'" , cmd);fastboot_fail ("cannot find partition" );doc/README.android-fastboot +0
-0
doc/README.android-fastboot buffer should be as large as possible for a platform. The location of the · line 57
Quoted 8 lines
doc/README.android-fastboot +5
-0@@ -50,6 +50,15 @@ buffer should be as large as possible for a platform. The location of the buffer and size are set with CONFIG_USB_FASTBOOT_BUF_ADDR and CONFIG_USB_FASTBOOT_BUF_SIZE. +Fastboot partition aliases can also be defined for devices where GPT +limitations prevent user-friendly partition names such as "boot", "system" +and "cache". Or, where the actual partition name doesn't match a standard +partition name used commonly with fastboot. Current implentation checks +aliases when accessing partitions by name (flash_write andThere's already a driver
for DWC2 in drivers/usb/gadget/s3c_udc_otg.c . This driver should really be properly renamed though ;-/ erase functions).
doc/README.android-fastboot buffer should be as large as possible for a platform. The location of the · line 64
Quoted 8 lines
doc/README.android-fastboot +4
-0+To define a partition alias add an environment variable similar to: +fastboot_partition_alias_<alias partition name>=<actual partition name> +Example: fastboot_partition_alias_boot=LNX + In Action ========= Enter into fastboot by executing the fastboot command in u-boot and you
An interesting feature (which seems unnecessary to me...) However,
PATCH 1/1 fastboot: check for alias when looking up partition by name
Quoted 86 lines · Steve Rae
Quoted 83 lines · Michael Scott
Implement an alias name check for devices where GPT limitations prevent user-friendly partition names such as "boot", "system" and "cache". Or, where the actual partition name doesn't match a standard partition name used commonly with fastboot.
To set an alias, add an environment setting as follows:
fastboot_partition_alias_<alias partition name>=<actual partition name>Example: fastboot_partition_alias_boot=LNX
Signed-off-by Michael Scott <[email protected]>Cc Steve Rae <[email protected]>Cc Lukasz Majewski <[email protected]>--- common/fb_mmc.c | 26 ++++++++++++++++++++++++-- doc/README.android-fastboot | 9 +++++++++ 2 files changed, 33 insertions(+), 2 deletions(-)common/fb_mmc.c +22
-0@@ -33,6 +33,28 @@ void fastboot_okay(const char *s)strncat (response_str, s,RESPONSE_LEN -4 -1 ); } +static int get_partition_info_efi_by_name_or_alias (block_dev_desc_t *dev_desc, +const char *name,disk_partition_t *info) +{ +int ret; + + ret =get_partition_info_efi_by_name (dev_desc, name, info); +if (ret) { +/* strlen("fastboot_partition_alias_") + 32(part_name) + 1 */ +char env_alias_name[25 +32 +1 ]; +char *aliased_part_name; + +/* check for alias */ +strcpy (env_alias_name,"fastboot_partition_alias_" ); +strncat (env_alias_name, name,32 ); + aliased_part_name =getenv (env_alias_name); +if (aliased_part_name !=NULL ) + ret =get_partition_info_efi_by_name (dev_desc, + aliased_part_name, info); + } +return ret; +} + static void write_raw_image(block_dev_desc_t *dev_desc, disk_partition_t *info,const char
*part_name, void *buffer,
unsigned intdownload_bytes)common/fb_mmc.c +1
-1@@ -98,7 +120,7 @@ void fb_mmc_flash_write(const char *cmd, void *download_buffer,printf ("........ success\n" );fastboot_okay ("" );return ; - }else if (get_partition_info_efi_by_name (dev_desc, cmd, &info)) { + }else if (get_partition_info_efi_by_name_or_alias (dev_desc, cmd, &info)) {error ("cannot find partition: '%s'\n" , cmd);fastboot_fail("cannot find partition"); return;common/fb_mmc.c +1
-1@@ -136,7 +158,7 @@ void fb_mmc_erase(const char *cmd, char *response)return ; } - ret =get_partition_info_efi_by_name (dev_desc, cmd, &info); + ret =get_partition_info_efi_by_name_or_alias (dev_desc, cmd, &info);if (ret) {error ("cannot find partition: '%s'" , cmd);fastboot_fail("cannot find partition");doc/README.android-fastboot +0
-0@@ -50,6 +50,15 @@ buffer should be as large as possible for aplatform. The location of the
buffer and size are set withCONFIG_USB_FASTBOOT_BUF_ADDRandCONFIG_USB_FASTBOOT_BUF_SIZE.
Quoted 11 lines
Quoted 9 lines
doc/README.android-fastboot +2
-0+Fastboot partition aliases can also be defined for devices where GPT +limitations prevent user-friendly partition names such as "boot","system"
+and "cache". Or, where the actual partition name doesn't match a standard
+partition name used commonly with fastboot. Current implentation checks
+aliases when accessing partitions by name (flash_writeandThere's already a driverfor DWC2 in
drivers/usb/gadget/s3c_udc_otg.c. This driver should really be properly renamed though ;-/ erase functions).
Hi Steve,
I'm a bit confused with the mention of drivers/usb/gadget/s3c_udc_otg.c and how it relates back this patch. I'm willing to make any corrections you would
like, but may need some clarification.
Quoted 11 lines
Quoted 9 lines
doc/README.android-fastboot +4
-0+To define a partition alias add an environment variable similar to: +fastboot_partition_alias_<alias partition name>=<actual partition name> +Example: fastboot_partition_alias_boot=LNX + In Action ========= Enter into fastboot by executing the fastboot command in u-boot andyou
An interesting feature (which seems unnecessary to me...) However,
A bit of background:
We are using fastboot support on Nvidia Jetson-TK1 platform where a GPT limitation sets partition names to 3 letters.
IE: LNX = boot, APP = system and UDA = userdata.
To present a "normal" fastboot experience to users, we use this patch.
Quoted 1 line
Acked-by Steve Rae <[email protected]>
Thank you for the Ack!
PATCH 1/1 fastboot: check for alias when looking up partition by name
Quoted 99 lines · Michael Scott
Quoted 86 lines · Steve Rae
Quoted 83 lines · Michael Scott
Implement an alias name check for devices where GPT limitations prevent user-friendly partition names such as "boot", "system" and "cache". Or, where the actual partition name doesn't match a standard partition name used commonly with fastboot.
To set an alias, add an environment setting as follows:
fastboot_partition_alias_<alias partition name>=<actual partition name>Example: fastboot_partition_alias_boot=LNX
Signed-off-by Michael Scott <[email protected]>Cc Steve Rae <[email protected]>Cc Lukasz Majewski <[email protected]>--- common/fb_mmc.c | 26 ++++++++++++++++++++++++-- doc/README.android-fastboot | 9 +++++++++ 2 files changed, 33 insertions(+), 2 deletions(-)common/fb_mmc.c +22
-0@@ -33,6 +33,28 @@ void fastboot_okay(const char *s)strncat (response_str, s,RESPONSE_LEN -4 -1 ); } +static int get_partition_info_efi_by_name_or_alias (block_dev_desc_t *dev_desc, +const char *name,disk_partition_t *info) +{ +int ret; + + ret =get_partition_info_efi_by_name (dev_desc, name, info); +if (ret) { +/* strlen("fastboot_partition_alias_") + 32(part_name) + 1 */ +char env_alias_name[25 +32 +1 ]; +char *aliased_part_name; + +/* check for alias */ +strcpy (env_alias_name,"fastboot_partition_alias_" ); +strncat (env_alias_name, name,32 ); + aliased_part_name =getenv (env_alias_name); +if (aliased_part_name !=NULL ) + ret =get_partition_info_efi_by_name (dev_desc, + aliased_part_name, info); + } +return ret; +} + static void write_raw_image(block_dev_desc_t *dev_desc, disk_partition_t *info,const char
*part_name, void *buffer,
unsigned intdownload_bytes)common/fb_mmc.c +1
-1@@ -98,7 +120,7 @@ void fb_mmc_flash_write(const char *cmd, void *download_buffer,printf ("........ success\n" );fastboot_okay ("" );return ; - }else if (get_partition_info_efi_by_name (dev_desc, cmd, &info)) { + }else if (get_partition_info_efi_by_name_or_alias (dev_desc, cmd, &info)) {error ("cannot find partition: '%s'\n" , cmd);fastboot_fail("cannot find partition"); return;common/fb_mmc.c +1
-1@@ -136,7 +158,7 @@ void fb_mmc_erase(const char *cmd, char *response)return ; } - ret =get_partition_info_efi_by_name (dev_desc, cmd, &info); + ret =get_partition_info_efi_by_name_or_alias (dev_desc, cmd, &info);if (ret) {error ("cannot find partition: '%s'" , cmd);fastboot_fail("cannot find partition");doc/README.android-fastboot +0
-0@@ -50,6 +50,15 @@ buffer should be as large as possible for aplatform. The location of the
buffer and size are set withCONFIG_USB_FASTBOOT_BUF_ADDRandCONFIG_USB_FASTBOOT_BUF_SIZE.Quoted 11 lines
Quoted 9 lines
doc/README.android-fastboot +2
-0+Fastboot partition aliases can also be defined for devices where GPT +limitations prevent user-friendly partition names such as "boot","system"
+and "cache". Or, where the actual partition name doesn't match a standard
+partition name used commonly with fastboot. Current implentation checks
+aliases when accessing partitions by name (flash_writeandThere's already a driverfor DWC2 in
drivers/usb/gadget/s3c_udc_otg.c. This driver should really be properly renamed though ;-/ erase functions).
Quoted 6 lines
Hi Steve,
I'm a bit confused with the mention of
drivers/usb/gadget/s3c_udc_otg.cand how it relates back this patch. I'm willing to make any corrections you would
like, but may need some clarification.
Sorry -- I corrupted this (finger trouble!) - please ignore
Quoted 12 lines
Quoted 12 lines
Quoted 10 lines
doc/README.android-fastboot +4
-0+To define a partition alias add an environment variable similar to: +fastboot_partition_alias_<alias partition name>=<actual partition name> +Example: fastboot_partition_alias_boot=LNX + In Action ========= Enter into fastboot by executing the fastboot command in u-boot andyou
An interesting feature (which seems unnecessary to me...) However,
Quoted 6 lines
A bit of background:
We are using fastboot support on Nvidia Jetson-TK1 platform where a GPT limitation sets partition names to 3 letters.
IE: LNX = boot, APP = system and UDA = userdata.
OK -- then this patch makes much more sense!
- so when the user performs "mmc part", (I'm assuming it will list the "3 letter names"), then they perform "fastboot flash LNX boot.bin" (which makes sense to me....)
- or they can setup these aliases and perform "fastboot flash boot boot.bin" (I would probably stick with the former myself...)
Thanks, Steve
Quoted 6 lines
To present a "normal" fastboot experience to users, we use this patch.
Quoted 1 line
Acked-by Steve Rae <[email protected]>Thank you for the Ack!
PATCH 1/1 fastboot: check for alias when looking up partition by name
Hi Steve,
Quoted 130 lines · Michael Scott
Quoted 103 lines · Steve Rae
Quoted 90 lines · Michael Scott
Quoted 87 lines
Implement an alias name check for devices where GPT limitations prevent user-friendly partition names such as "boot", "system" and "cache". Or, where the actual partition name doesn't match a standard partition name used commonly with fastboot.
To set an alias, add an environment setting as follows:
fastboot_partition_alias_<alias partition name>=<actual partition name>Example: fastboot_partition_alias_boot=LNX
Signed-off-by Michael Scott <[email protected]>Cc Steve Rae <[email protected]>Cc Lukasz Majewski <[email protected]>--- common/fb_mmc.c | 26 ++++++++++++++++++++++++-- doc/README.android-fastboot | 9 +++++++++ 2 files changed, 33 insertions(+), 2 deletions(-)common/fb_mmc.c +1
-0@@ -33,6 +33,28 @@ void fastboot_okay(const char *s)strncat (response_str, s,RESPONSE_LEN -4 -1 ); } +static intget_partition_info_efi_by_name_or_alias(block_dev_desc_t
*dev_desc,common/fb_mmc.c +7
-0+ const char *name, disk_partition_t *info) +{ + int ret; + + ret =get_partition_info_efi_by_name (dev_desc, name, info); +if (ret) { +/* strlen("fastboot_partition_alias_") + 32(part_name) + 1 */
common/fb_mmc.c +14
-0+char env_alias_name[25 +32 +1 ]; +char *aliased_part_name; + +/* check for alias */ +strcpy (env_alias_name,"fastboot_partition_alias_" ); +strncat (env_alias_name, name,32 ); + aliased_part_name =getenv (env_alias_name); +if (aliased_part_name !=NULL ) + ret =get_partition_info_efi_by_name (dev_desc, + aliased_part_name, info); + } +return ret; +} + static void write_raw_image(block_dev_desc_t *dev_desc,
disk_partition_t*info,
const char*part_name, void *buffer,
unsigned intdownload_bytes)common/fb_mmc.c +1
-1@@ -98,7 +120,7 @@ void fb_mmc_flash_write(const char *cmd, void *download_buffer,printf ("........ success\n" );fastboot_okay ("" );return ; - }else if (get_partition_info_efi_by_name (dev_desc, cmd, &info)) { + } else if (get_partition_info_efi_by_name_or_alias(dev_desc, cmd, &info)) {error("cannot find partition: '%s'\n", cmd); fastboot_fail("cannot find partition"); return;common/fb_mmc.c +1
-1@@ -136,7 +158,7 @@ void fb_mmc_erase(const char *cmd, char *response) return; } - ret =get_partition_info_efi_by_name (dev_desc, cmd, &info); + ret =get_partition_info_efi_by_name_or_alias (dev_desc, cmd, &info);if (ret) {error ("cannot find partition: '%s'" , cmd);fastboot_fail("cannot find partition");(quoted diff) +0
-0b/doc/README.android-fastboot index 5526a43..04411e9 100644
doc/README.android-fastboot +0
-0@@ -50,6 +50,15 @@ buffer should be as large as possible for aplatform. The location of the
buffer and size are set withCONFIG_USB_FASTBOOT_BUF_ADDRandCONFIG_USB_FASTBOOT_BUF_SIZE.Quoted 11 lines
Quoted 9 lines
+Fastboot partition aliases can also be defined for devices where GPT +limitations prevent user-friendly partition names such as "boot", "system"
+and "cache". Or, where the actual partition name doesn't match a standard
+partition name used commonly with fastboot. Current implentation checks
+aliases when accessing partitions by name (flash_writeandThere's already a driverfor DWC2 in
drivers/usb/gadget/s3c_udc_otg.c. This driver should really be properly renamed though ;-/ erase functions).Quoted 6 lines
Hi Steve,
I'm a bit confused with the mention of
drivers/usb/gadget/s3c_udc_otg.cand how it relates back this patch. I'm willing to make any corrections you would like, but may need some clarification.Sorry -- I corrupted this (finger trouble!) - please ignore
Quoted 17 lines
Quoted 12 lines
Quoted 10 lines
+To define a partition alias add an environment variable similar
to: +fastboot_partition_alias_<alias partition name>=<actual partition name> +Example: fastboot_partition_alias_boot=LNX +
In Action
=========
Enter into fastboot by executing the fastboot command in u-boot
and youAn interesting feature (which seems unnecessary to me...) However,
A bit of background:
We are using fastboot support on Nvidia Jetson-TK1 platform where a GPT limitation sets partition names to 3 letters.
Quoted 15 lines
Quoted 1 line
IE: LNX = boot, APP = system and UDA = userdata.
OK -- then this patch makes much more sense!
- so when the user performs "mmc part", (I'm assuming it will list the "3 letter names"), then they perform "fastboot flash LNX boot.bin" (which makes sense to me....)
- or they can setup these aliases and perform "fastboot flash boot boot.bin" (I would probably stick with the former myself...) Thanks, SteveQuoted 7 lines
To present a "normal" fastboot experience to users, we use this patch.
Quoted 1 line
Acked-by Steve Rae <[email protected]>Thank you for the Ack!
Are there more comments for this patch?
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH 1/1 fastboot: check for alias when looking up partition by name
Hi Lukasz,
Quoted 7 lines · Lukasz Majewski
Hi Steve,
Quoted 5 lines · Michael Scott
Quoted 2 lines · Steve Rae
[... snip ...]
Quoted 15 lines
Quoted 15 lines
Quoted 7 lines
Quoted 1 line
An interesting feature (which seems unnecessary to me...) However,
A bit of background:
We are using fastboot support on Nvidia Jetson-TK1 platform where a GPT limitation sets partition names to 3 letters.
IE: LNX = boot, APP = system and UDA = userdata.
OK -- then this patch makes much more sense!
- so when the user performs "mmc part", (I'm assuming it will list the "3 letter names"), then they perform "fastboot flash LNX boot.bin" (which makes sense to me....)
- or they can setup these aliases and perform "fastboot flash boot boot.bin" (I would probably stick with the former myself...) Thanks, SteveQuoted 1 line
Quoted 9 lines
Quoted 6 lines
Quoted 6 lines
To present a "normal" fastboot experience to users, we use this patch.
Quoted 1 line
Acked-by Steve Rae <[email protected]>Thank you for the Ack!
Are there more comments for this patch?
No - the feature is OK
(personally - I would use the names that match what "mmc part" displays; so I don't think that I would create any aliases....)
PATCH 1/1 fastboot: check for alias when looking up partition by name
Hi Steve,
Quoted 36 lines
Hi Lukasz,
Quoted 7 lines · Lukasz Majewski
Hi Steve,
Quoted 5 lines · Michael Scott
Quoted 2 lines · Steve Rae
[... snip ...]
Quoted 23 lines
Quoted 22 lines
Quoted 8 lines
Quoted 2 lines
An interesting feature (which seems unnecessary to me...) However,
A bit of background:
We are using fastboot support on Nvidia Jetson-TK1 platform where a GPT limitation sets partition names to 3 letters.
IE: LNX = boot, APP = system and UDA = userdata.
OK -- then this patch makes much more sense!
- so when the user performs "mmc part", (I'm assuming it will list the "3 letter names"), then they perform "fastboot flash LNX boot.bin" (which makes sense to me....)
- or they can setup these aliases and perform "fastboot flash boot boot.bin" (I would probably stick with the former myself...) Thanks, SteveQuoted 7 lines
To present a "normal" fastboot experience to users, we use this patch.
Quoted 1 line
Acked-by Steve Rae <[email protected]>Thank you for the Ack!
Quoted 8 lines
Quoted 2 lines
Are there more comments for this patch?
No - the feature is OK
(personally - I would use the names that match what "mmc part" displays; so I don't think that I would create any aliases....)Acked-by Steve Rae <[email protected]>
Applied to u-boot-dfu tree. Thanks!
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group