chainloader: Only unmount if trying to update

This will speed up boot times for some sd cards up to 500ms when running update.bin is not needed (old or same version).
This commit is contained in:
Kostas Missos 2019-12-07 02:40:56 +02:00
parent 0b45a5a11a
commit edc2b12f0f

View file

@ -270,8 +270,6 @@ int launch_payload(char *path, bool update)
if (!update)
gfx_clear_grey(0x1B);
gfx_con_setpos(0, 0);
if (!path)
return 1;
if (sd_mount())
{
@ -279,9 +277,8 @@ int launch_payload(char *path, bool update)
if (f_open(&fp, path, FA_READ))
{
EPRINTFARGS("Payload file is missing!\n(%s)", path);
sd_unmount();
return 1;
goto out;
}
// Read and copy the payload to our chosen address
@ -296,15 +293,14 @@ int launch_payload(char *path, bool update)
if (f_read(&fp, buf, size, NULL))
{
f_close(&fp);
sd_unmount();
return 1;
goto out;
}
f_close(&fp);
if (update && is_ipl_updated(buf))
return 1;
goto out;
sd_unmount();
@ -339,6 +335,10 @@ int launch_payload(char *path, bool update)
}
}
out:
if (!update)
sd_unmount();
return 1;
}