android10 (Q) go版本刷GSI时候,提示如下错误:

$fastboot flash system system.img

Invalid sparse file format at header magic

Resizing 'system' FAILED (remote: 'Not enough space to resize partition')

fastboot: error: Command failed

从提示的错误可以看出是空间不足,需要调整分区。

Android Q 开始有了super分区,想要解决以上的问题,需要增加super分区的大小,增大分区后重新刷GSI,结果如下:

$fastboot flash system system.img

Invalid sparse file format at header magic

Resizing 'system' OKAY [ 0.007s]

Sending sparse 'system' 1/4 (261900 KB) OKAY [ 23.725s]

Writing 'system' OKAY [ 4.112s]

Sending sparse 'system' 2/4 (261828 KB) OKAY [ 23.732s]

Writing 'system' OKAY [ 4.986s]

Sending sparse 'system' 3/4 (262032 KB) OKAY [ 23.334s]

Writing 'system' OKAY [ 5.008s]

Sending sparse 'system' 4/4 (49388 KB) OKAY [ 4.487s]

Writing 'system' OKAY [ 2.496s]

Finished. Total time: 100.740s

虽然可以刷GSI并正常开机,但是仍有提示Invalid sparse file format at header magic?

这是由于fastboot支持的最大download size小于system.img的大小,需要分批下载来完成,

所以fastboot会将system.img转成sparse file,出现该提示,目前没有发现实质性的影响。

可以通过 -S 来隐藏该提示

fastboot flash -S 800M system system.img

-S 的参数要大于system.img的大小即可

对于空间不足,还看到了另外一种方法,可以参考下:

Use the following command to delete the product partition and free up space for the system

partition. This provides extra space to flash the GSI:

$ fastboot delete-logical-partition product_a

The postfix “_a” should match the slot id of the system partition, such as “system_a” in this

example.

更多推荐