heyjoe
02/10/2008, 12h56
I have modified memtest+-2.0 to allow it to be used in an automatic testing environment.
The changes cause memtest to exit after a fixed number of passes, with an error flag (pass or fail) written to CMOS, and the number of failures written to another byte in CMOS.
I've configured GRUB to boot memtest once and then to boot into Linux to check the error flag.
The memtest changes are quite minor.
I propose adding 3 #defines to config.h, like this
/* NUMBER_OF_PASSES – number of passes before exit */
/* 0 means loop forever (the original memtest behaviour) */
#define NUMBER_OF_PASSES 0
/* CMOS_MEMTEST_ERROR_FLAG_ADDR – CMOS byte address for the error flag */
/* valid only if NUMBER_OF_PASSES not 0 */
/* May be left undefined */
#define CMOS_MEMTEST_ERROR_ FLAG_ADDR 1
/* CMOS_MEMTEST_ERROR_COUNT_ADDR – CMOS byte address for the error count */
/* valid only if NUMBER_OF_PASSES not 0 */
/* May be left undefined */
#define CMOS_MEMTEST_ERROR_ COUNT_ADDR 3
The code changes are in main.c
In function parse_command_line, (if NUMBER_OF_PASSES not 0), set the error flag, and zero the error count.
In function do_test, at the end of a pass, if we've completed NUMBER_OF_PASSES set/clear the error flag, copy the number of errors to CMOS, and do a warm start.
The CMOS bytes I've used are the bytes for RTC Alarm seconds and minutes.
Note that the error flag is set initially - this is so that if the user aborts memtest by hitting ESC, it'll be flagged as an error, but with an error count of zero.
For my automated testing, I actually set the error flag from Linux before rebooting into memtest. This is so that if memtest fails to boot or exits immediately, the error flag will still be set at the next Linux boot.
The default value for NUMBER_OF_PASSES is 0. With this value, memtest compiles as before (ie runs forever).
I hope this meets with your approval.
Regards
Joe Chestnutt
The changes cause memtest to exit after a fixed number of passes, with an error flag (pass or fail) written to CMOS, and the number of failures written to another byte in CMOS.
I've configured GRUB to boot memtest once and then to boot into Linux to check the error flag.
The memtest changes are quite minor.
I propose adding 3 #defines to config.h, like this
/* NUMBER_OF_PASSES – number of passes before exit */
/* 0 means loop forever (the original memtest behaviour) */
#define NUMBER_OF_PASSES 0
/* CMOS_MEMTEST_ERROR_FLAG_ADDR – CMOS byte address for the error flag */
/* valid only if NUMBER_OF_PASSES not 0 */
/* May be left undefined */
#define CMOS_MEMTEST_ERROR_ FLAG_ADDR 1
/* CMOS_MEMTEST_ERROR_COUNT_ADDR – CMOS byte address for the error count */
/* valid only if NUMBER_OF_PASSES not 0 */
/* May be left undefined */
#define CMOS_MEMTEST_ERROR_ COUNT_ADDR 3
The code changes are in main.c
In function parse_command_line, (if NUMBER_OF_PASSES not 0), set the error flag, and zero the error count.
In function do_test, at the end of a pass, if we've completed NUMBER_OF_PASSES set/clear the error flag, copy the number of errors to CMOS, and do a warm start.
The CMOS bytes I've used are the bytes for RTC Alarm seconds and minutes.
Note that the error flag is set initially - this is so that if the user aborts memtest by hitting ESC, it'll be flagged as an error, but with an error count of zero.
For my automated testing, I actually set the error flag from Linux before rebooting into memtest. This is so that if memtest fails to boot or exits immediately, the error flag will still be set at the next Linux boot.
The default value for NUMBER_OF_PASSES is 0. With this value, memtest compiles as before (ie runs forever).
I hope this meets with your approval.
Regards
Joe Chestnutt