Use the status argument to the URL load callback to check for load
failures.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
BOOT_STATE_INITIAL,
BOOT_STATE_IMAGE_LOADING,
BOOT_STATE_INITRD_LOADING,
BOOT_STATE_INITIAL,
BOOT_STATE_IMAGE_LOADING,
BOOT_STATE_INITRD_LOADING,
+ BOOT_STATE_DTB_LOADING,
BOOT_STATE_FINISH,
BOOT_STATE_UNKNOWN,
};
BOOT_STATE_FINISH,
BOOT_STATE_UNKNOWN,
};
-static void boot_process(void *ctx, int status __attribute__((unused)))
+static void boot_process(void *ctx, int status)
{
struct boot_task *task = ctx;
unsigned int clean_image = 0;
{
struct boot_task *task = ctx;
unsigned int clean_image = 0;
BOOT_STATUS_ERROR,
"Couldn't load kernel image");
goto no_load;
BOOT_STATUS_ERROR,
"Couldn't load kernel image");
goto no_load;
- } else {
- task->state = BOOT_STATE_IMAGE_LOADING;
- return;
+ task->state = BOOT_STATE_IMAGE_LOADING;
+ return;
}
if (task->state == BOOT_STATE_IMAGE_LOADING) {
}
if (task->state == BOOT_STATE_IMAGE_LOADING) {
+ if (status) {
+ update_status(task->status_fn, task->status_arg,
+ BOOT_STATUS_ERROR,
+ "Error loading kernel image");
+ goto no_load;
+ }
+ task->state = BOOT_STATE_INITRD_LOADING;
+
if (task->initrd) {
update_status(task->status_fn, task->status_arg,
BOOT_STATUS_INFO, "loading initrd");
if (task->initrd) {
update_status(task->status_fn, task->status_arg,
BOOT_STATUS_INFO, "loading initrd");
BOOT_STATUS_ERROR,
"Couldn't load initrd image");
goto no_load;
BOOT_STATUS_ERROR,
"Couldn't load initrd image");
goto no_load;
- } else {
- task->state = BOOT_STATE_INITRD_LOADING;
- return;
- } else {
- task->state = BOOT_STATE_INITRD_LOADING;
}
}
if (task->state == BOOT_STATE_INITRD_LOADING) {
}
}
if (task->state == BOOT_STATE_INITRD_LOADING) {
+ if (status) {
+ update_status(task->status_fn, task->status_arg,
+ BOOT_STATUS_ERROR,
+ "Error loading initrd");
+ goto no_load;
+ }
+ task->state = BOOT_STATE_DTB_LOADING;
+
if (task->dtb) {
update_status(task->status_fn, task->status_arg,
BOOT_STATUS_INFO,
if (task->dtb) {
update_status(task->status_fn, task->status_arg,
BOOT_STATUS_INFO,
BOOT_STATUS_ERROR,
"Couldn't load device tree");
goto no_load;
BOOT_STATUS_ERROR,
"Couldn't load device tree");
goto no_load;
- } else {
- task->state = BOOT_STATE_FINISH;
- return;
- } else {
- task->state = BOOT_STATE_FINISH;
+ return;
+ }
+ }
+
+ if (task->state == BOOT_STATE_DTB_LOADING) {
+ if (status) {
+ update_status(task->status_fn, task->status_arg,
+ BOOT_STATUS_ERROR,
+ "Error loading dtb");
+ goto no_load;
+ task->state = BOOT_STATE_FINISH;
if (task->state != BOOT_STATE_FINISH) {
task->state = BOOT_STATE_UNKNOWN;
return;
if (task->state != BOOT_STATE_FINISH) {
task->state = BOOT_STATE_UNKNOWN;
return;