Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
kernel: find vmlinuz kernels in modules path (RHBZ#1394699)
Newer kernel packages e.g. in Fedora place the kernel image named
"vmlinuz" directly within the modules path of that kernel.
Find these images first, not looking for kernels in /boot if any is
found under modules paths.
  • Loading branch information
ptoscano committed Nov 21, 2016
1 parent 1fa9b49 commit d402920
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/kernel.ml
Expand Up @@ -22,6 +22,7 @@ open Printf
open Utils
open Ext2fs
open Fnmatch
open Glob

let patt_of_cpu host_cpu =
let models =
Expand Down Expand Up @@ -60,7 +61,28 @@ let rec build_kernel debug host_cpu dtb_wildcard copy_kernel kernel dtb =
let modpath = find_modpath debug kernel_version in
kernel_env, kernel_name, kernel_version, modpath
with Not_found ->
find_kernel debug host_cpu kernel in
let kernels =
let files = glob "/lib/modules/*/vmlinuz" [GLOB_NOSORT; GLOB_NOESCAPE] in
let files = Array.to_list files in
let kernels =
List.map (
fun f ->
let modpath = Filename.dirname f in
f, Filename.basename f, Filename.basename modpath, modpath
) files in
List.sort (
fun (_, _, a, _) (_, _, b, _) -> compare_version b a
) kernels in

if kernels <> [] then (
let kernel = List.hd kernels in
if debug >= 1 then (
let kernel_file, _, _, _ = kernel in
printf "supermin: kernel: picked vmlinuz %s\n%!" kernel_file;
);
kernel
) else
find_kernel debug host_cpu kernel in

(* If the user passed --dtb option, locate dtb. *)
(match dtb_wildcard with
Expand Down

0 comments on commit d402920

Please sign in to comment.