util: Improve robustness of sfdisk parsing in util/gem5img.py
The format of the output of sfdisk can change between versions, and
can also change depending on the details of the disk image being
analysed. For example, extra attributes like grain size in the
preamble have been observed.
The current output parsing is quite brittle, expecting a specific
number of lines of preamble. This change switches to a regular
expression based method which searches the output for the line of
interest. The parsing will still be sensitive to changes in the output
of sfdisk, but hopefully less so than the current method.
Change-Id: If03fe999a4986049ae20709895ec1d1b42166023
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/39896
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>