Skip to content

Commit

Permalink
Don't fail if /proc/cpuinfo doesn't exist
Browse files Browse the repository at this point in the history
In `setup_kernel_arches()`, we try to determine whether the architecture
should be `ia32e`, based on some heuristics involving /proc/cpuinfo.

This change allows the code to continue if `/proc/cpuinfo` doesn't exist,
e.g. because we're in a chroot and `/proc` isn't mounted.

In chroot situations where this heuristic architecture detection is expected
to work (which I assume to be rare), a faux `/proc/cpuinfo` file should be
created before calling `dkms`, e.g.  by copying it from the host's real
`/proc`.

Since `dkms` would have just failed in such chroot environments before, this
change still results in an improvement; the code can be refined later if
necessary.
  • Loading branch information
akorn committed Jan 31, 2025
1 parent 6801dc1 commit 7098abf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion dkms.in
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ setup_kernels_arches()
grep -v "not owned by any package" | grep kernel | head -n 1)
if ! arch[0]=$(rpm -q --queryformat "%{ARCH}" "$kernelver_rpm" 2>/dev/null); then
arch[0]=$(uname -m)
if [[ $arch = x86_64 ]] && grep -q Intel /proc/cpuinfo && ls $install_tree/$kernelver/build/configs 2>/dev/null | grep -q "ia32e"; then
if [[ $arch = x86_64 ]] && [[ -r /proc/cpuinfo ]] && grep -q Intel /proc/cpuinfo && ls $install_tree/$kernelver/build/configs 2>/dev/null | grep -q "ia32e"; then
arch[0]="ia32e"
fi
fi
Expand Down

0 comments on commit 7098abf

Please sign in to comment.