Keno Fischer has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/68442 )
Change subject: flashrom: Add some helpful hints about missing Linux kernel configs ......................................................................
flashrom: Add some helpful hints about missing Linux kernel configs
I was watching a colleague run into trouble trying to use flashrom on a minimally-configured Linux (used as a coreboot payload) that was missing some CONFIGs that flashrom needs. Of course, these are pretty easy to find for the experienced user, but might as well give the hint about which CONFIG is missing right in the error message.
Signed-off-by: Keno Fischer keno@juliacomputing.com Change-Id: I05cc3d170e59d5bcaf731df5152db5a47746cc0c --- M hwaccess_physmap.c M hwaccess_x86_io.c 2 files changed, 28 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/42/68442/1
diff --git a/hwaccess_physmap.c b/hwaccess_physmap.c index 81adf18..adc28e7 100644 --- a/hwaccess_physmap.c +++ b/hwaccess_physmap.c @@ -286,6 +286,9 @@ msg_perr("Please check if either is enabled in your kernel before reporting a failure.\n"); msg_perr("You can override CONFIG_X86_PAT at boot with the nopat kernel parameter but\n"); msg_perr("disabling the other option unfortunately requires a kernel recompile. Sorry!\n"); + } else if (ENOENT == errno) { + msg_perr("On Linux, this error can be caused by a missing CONFIG_DEVMEM option\n"); + msg_perr("or a missing /dev/mem device in your filesystem image\n"); } #elif defined (__OpenBSD__) msg_perr("Please set securelevel=-1 in /etc/rc.securelevel " diff --git a/hwaccess_x86_io.c b/hwaccess_x86_io.c index c3ad313..c3a4402 100644 --- a/hwaccess_x86_io.c +++ b/hwaccess_x86_io.c @@ -264,10 +264,18 @@ msg_perr("ERROR: Could not get I/O privileges (%s).\n", strerror(errno)); msg_perr("Make sure you are root. If you are root, your kernel may still\n" "prevent access based on security policies.\n"); +#if defined(__linux__) + if (errno == ENOSYS) { + msg_perr("On Linux, make sure your kernel is built with\n", + "CONFIG_X86_IOPL_IOPERM\n"); + } +#elif defined(__OpenBSD__) msg_perr("On OpenBSD set securelevel=-1 in /etc/rc.securelevel and\n" "reboot, or reboot into single user mode.\n"); +#elif defined(__NetBSD__) msg_perr("On NetBSD reboot into single user mode or make sure\n" "that your kernel configuration has the option INSECURE enabled.\n"); +#endif return 1; }