android10 (Q) go版本刷GSI時(shí)候,提示如下錯(cuò)誤:
$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
從提示的錯(cuò)誤可以看出是空間不足,需要調(diào)整分區(qū)。
Android Q 開始有了super分區(qū)端圈,想要解決以上的問題焦读,需要增加super分區(qū)的大小,增大分區(qū)后重新刷GSI舱权,結(jié)果如下:
$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并正常開機(jī)矗晃,但是仍有提示Invalid sparse file format at header magic
?
這是由于fastboot支持的最大download size小于system.img的大小,需要分批下載來完成宴倍,
所以fastboot會(huì)將system.img轉(zhuǎn)成sparse file张症,出現(xiàn)該提示,目前沒有發(fā)現(xiàn)實(shí)質(zhì)性的影響鸵贬。
可以通過 -S 來隱藏該提示
fastboot flash -S 800M system system.img
-S 的參數(shù)要大于system.img的大小即可
對(duì)于空間不足俗他,還看到了另外一種方法,可以參考下:
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.