@@ -2083,16 +2083,23 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
cpu_has_nx ? XENLOG_INFO : XENLOG_WARNING "Warning: ",
cpu_has_nx ? "" : "not ");
- initrdidx = find_first_bit(module_map, bi->nr_modules);
- if ( initrdidx < bi->nr_modules )
+ /*
+ * At this point all capabilities that consume boot modules should have
+ * claimed their boot modules. Find the first unclaimed boot module and
+ * claim it as the initrd ramdisk. Do a second search to see if there are
+ * any remaining unclaimed boot modules, and report them as unusued initrd
+ * candidates.
+ */
+ initrdidx = first_boot_module_index(bi, BOOTMOD_UNKNOWN);
+ if ( initrdidx < MAX_NR_BOOTMODS )
{
bi->mods[initrdidx].type = BOOTMOD_RAMDISK;
bi->mods[initrdidx].flags |= BOOTMOD_FLAG_X86_CONSUMED;
+ if ( first_boot_module_index(bi, BOOTMOD_UNKNOWN) < MAX_NR_BOOTMODS )
+ printk(XENLOG_WARNING
+ "Multiple initrd candidates, picking module #%u\n",
+ initrdidx);
}
- if ( bitmap_weight(module_map, bi->nr_modules) > 1 )
- printk(XENLOG_WARNING
- "Multiple initrd candidates, picking module #%u\n",
- initrdidx);
/*
* We're going to setup domain0 using the module(s) that we stashed safely