If we fail to do so, we'll end up creating a bogus initramfs file. So look inside /lib/modules for directories that match that particular kernel version before we proceed to create the initramfs file. Also, in RHEL/Fedora systems, use dracut if available.
Signed-off-by: Lucas Meneghel Rodrigues <[email protected]> --- client/bin/kernel.py | 22 +++++++++++++++++++++- 1 files changed, 21 insertions(+), 1 deletions(-) diff --git a/client/bin/kernel.py b/client/bin/kernel.py index fd272b9..1b5f79c 100644 --- a/client/bin/kernel.py +++ b/client/bin/kernel.py @@ -429,8 +429,28 @@ class kernel(BootableKernel): if not args: args = '' + # It is important to match the version with a real directory inside + # /lib/modules + real_version_list = glob.glob('/lib/modules/%s*' % version) + rl = len(real_version_list) + if rl == 0: + logging.error("No directory %s found under /lib/modules. Initramfs" + "creation will most likely fail and your new kernel" + "will fail to build", version) + else: + if rl > 1: + logging.warning("Found more than one possible match for " + "kernel version %s under /lib/modules", version) + version = os.path.basename(real_version_list[0]) + if vendor in ['Red Hat', 'Fedora Core']: - utils.system('mkinitrd %s %s %s' % (args, initrd, version)) + try: + cmd = os_dep.command('dracut') + full_cmd = '%s -f %s %s' % (cmd, initrd, version) + except ValueError: + cmd = os_dep.command('mkinitrd') + full_cmd = '%s %s %s %s' % (cmd, args, initrd, version) + utils.system(full_cmd) elif vendor in ['SUSE']: utils.system('mkinitrd %s -k %s -i %s -M %s' % (args, image, initrd, system_map)) -- 1.7.2.3 _______________________________________________ Autotest mailing list [email protected] http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
