[ipxe-devel] memtest as a PXE NBP

Sven Ulland sveniu at opera.com
Tue Oct 29 08:24:21 UTC 2013


> Incidentally, it is possible to differentiate between "test
> incomplete" (i.e. test aborted via ESC before one full cycle
> completed) and "memory bad" returns, by using the newly-added
> ${errno} variable:

Just a note about reporting memtest.0 status based on errno, where
I've been having problems due to 'chain' (really anything run through
src/core/exec.c:execv()) not modifying errno on success. The http urls
in the script are not yet operational (thus returning 404); I just use
them to check status in access.log.

Example showing 'chain' not modifying errno on success:

#!ipxe
chain http://inv/state?state=memtest_start ||
chain memtest.0 passes=1 ||
set memtest_errno:int8 ${errno}
echo errno is currently ${errno}
echo memtest.0 return value is ${memtest_errno}
chain http://inv/memtest?result=${memtest_errno}&uuid=${uuid} ||
chain http://inv/state?state=memtest_done ||
prompt Press any key to exit
exit

Result when completing (expected 0):
errno is currently 0x3e11613b  # 404 from earlier http failure
memtest.0 return value is 59   # == 0x3b

Result when cancelling (expected 2):
Could not boot: Error 0x7f8d8102 (http://ipxe.org/7f8d8102)
errno is currently 0x7f8d8102
memtest.0 return value is 2


Example where I initialize errno=0, but then 'chain' seems either
unable to change it, or it changes the "wrong" errno instance:

#!ipxe
chain http://inv/state?state=memtest_start ||
set errno 0 # reset errno after http failure
chain memtest.0 passes=1 ||
set memtest_errno:int8 ${errno}
echo errno is currently ${errno}
echo memtest.0 return value is ${memtest_errno}
chain http://inv/memtest?result=${memtest_errno}&uuid=${uuid} ||
chain http://inv/state?state=memtest_done ||
prompt Press any key to exit
exit

Result when completing (expected 0):
errno is currently 0x0
memtest.0 return value is 0

Result when cancelling (expected 2):
errno is currently 0x0
memtest.0 return value is 0


This can be worked around with:

chain memtest.0 passes=1 && set memtest_errno 0 || set
memtest_errno:int8 ${errno}

..which gives appropriate results for memtest_errno in either case.

sven



More information about the ipxe-devel mailing list