- struct boot_task *task = ctx;
- int result = -1;
-
- if (task->state == BOOT_STATE_INITIAL) {
- update_status(task->status_fn, task->status_arg,
- BOOT_STATUS_INFO, "loading kernel");
- task->local_image = load_url_async(task, task->image,
- &task->clean_image, boot_process);
- if (!task->local_image) {
- update_status(task->status_fn, task->status_arg,
- BOOT_STATUS_ERROR,
- "Couldn't load kernel image");
- goto no_load;
- }
- task->state = BOOT_STATE_IMAGE_LOADING;
- return;
- }
-
- 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");
- task->local_initrd = load_url_async(task, task->initrd,
- &task->clean_initrd, boot_process);
- if (!task->local_initrd) {
- update_status(task->status_fn, task->status_arg,
- BOOT_STATUS_ERROR,
- "Couldn't load initrd image");
- goto no_load;
- }
- return;
- }
- }
-
- 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;