@@ -649,12 +649,13 @@ static int omap3_mmc_raw_boot(BlockDriverState *bs,
struct omap3_boot_s *boot;
uint32_t i = 0;
int result = 0;
-
- if (bdrv_pread(bs, 0, sector, 0x200) == 0x200) {
+
+again:
+ if (bdrv_pread(bs, i * 0x200, sector, 0x200) == 0x200) {
boot = omap3_boot_init(mpu, mmc1, sector, 0x200);
if (boot->state == confighdr) { /* CH must be present for raw boot */
while (omap3_boot_block(sector, 0x200, boot)) {
- if (bdrv_pread(bs, ++i, sector, 0x200) != 0x200) {
+ if (bdrv_pread(bs, ++i * 0x200, sector, 0x200) != 0x200) {
TRACE("error trying to read sector %u on boot device", i);
break;
}
@@ -663,6 +664,12 @@ static int omap3_mmc_raw_boot(BlockDriverState *bs,
result = (boot->state == done);
free(boot);
}
+
+ if (!result && !i) {
+ /* try again at 128k */
+ i = 256;
+ goto again;
+ }
return result;
}
According to the OMAP3 spec, raw boot tries sector 0 and sector 256: In raw mode, an image can be at offset 0 or 128KB and must not be bigger than 128KB. Raw mode is detected by reading sector 0 and sector 256. Also, bdrv_pread takes byte offsets rather than sector offsets, so the loop through the sector numbers needs to offset sector sizes in. Signed-off-by: Alexander Graf <agraf@suse.de> --- hw/omap3_boot.c | 13 ++++++++++--- 1 files changed, 10 insertions(+), 3 deletions(-)