Author: stuge Date: 2009-01-22 23:53:59 +0100 (Thu, 22 Jan 2009) New Revision: 3889
Modified: trunk/util/flashrom/flashrom.c Log: flashrom: Provide some hints for the user in case /dev/mem mmap fails.
resolves #121
Signed-off-by: Peter Stuge peter@stuge.se Acked-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Modified: trunk/util/flashrom/flashrom.c =================================================================== --- trunk/util/flashrom/flashrom.c 2009-01-21 01:56:53 UTC (rev 3888) +++ trunk/util/flashrom/flashrom.c 2009-01-22 22:53:59 UTC (rev 3889) @@ -139,6 +139,13 @@ fd_mem, (off_t) base); if (bios == MAP_FAILED) { perror("Can't mmap memory using " MEM_DEV); + if (EINVAL == errno) { + fprintf(stderr, "In Linux this error can be caused by the CONFIG_NONPROMISC_DEVMEM (<2.6.27),\n"); + fprintf(stderr, "CONFIG_STRICT_DEVMEM (>=2.6.27) and CONFIG_X86_PAT kernel options.\n"); + fprintf(stderr, "Please check if either is enabled in your kernel before reporting a failure.\n"); + fprintf(stderr, "You can override CONFIG_X86_PAT at boot with the nopat kernel parameter but\n"); + fprintf(stderr, "disabling the other option unfortunately requires a kernel recompile. Sorry!\n"); + } exit(1); } flash->virtual_memory = bios;