[U-Boot] distro bootcmd: auto write GPT table in scan_dev_for_boot_part

Tom Rini trini at konsulko.com
Tue Mar 7 13:29:52 UTC 2017


On Mon, Mar 06, 2017 at 02:38:54PM +0800, Eddie Cai wrote:
> scan_dev_for_boot_part will fail when there is no GPT table. So add auto write
> GPT table if fail to get it.
> 
> Signed-off-by: Eddie Cai <eddie.cai.linux at gmail.com>
> ---
>  include/config_distro_bootcmd.h | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h
> index 0e01e82..3be8ffa 100644
> --- a/include/config_distro_bootcmd.h
> +++ b/include/config_distro_bootcmd.h
> @@ -368,6 +368,14 @@
>  		"\0"                                                      \
>  	\
>  	"scan_dev_for_boot_part="                                         \
> +		"part list ${devtype} ${devnum} -bootable test; "		\
> +		"if env exists test; then "		\
> +			"echo Found valid partition table; "		\
> +		"else "		\
> +			"echo No valid partition table, write the original partition table; "		\
> +			"gpt write ${devtype} ${devnum} ${partitions}; "		\
> +			"mmc rescan;"		\
> +		"fi;"		\
>  		"part list ${devtype} ${devnum} -bootable devplist; "     \
>  		"env exists devplist || setenv devplist 1; "              \
>  		"for distro_bootpart in ${devplist}; do "                 \

Er, this feels rather risky to me.  Why are we writing a table?  How do
we know it exists?

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170307/aa300201/attachment.sig>


More information about the U-Boot mailing list