david/ipxe
david
/
ipxe
Archived
1
0
Fork 0
Commit Graph

36 Commits

Author SHA1 Message Date
Michael Brown b6ee89ffb5 [legal] Relicense files under GPL2_OR_LATER_OR_UBDL
Relicense files for which I am the sole author (as identified by
util/relicense.pl).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-02 14:17:31 +00:00
Michael Brown 43eba2f555 [cmdline] Generate command option help text automatically
Generate the command option help text automatically from the list of
defined options.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-11-07 17:00:51 +00:00
Michael Brown 5e1fa5cd40 [parseopt] Add parse_timeout()
Parsing a timeout value (specified in milliseconds) into an internal
timeout value measured in timer ticks is a common operation.  Provide
a parse_timeout() value to carry out this conversion automatically.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-11-01 02:26:19 +00:00
Michael Brown 31f5211035 [script] Allow commands following a script label
Allow commands to be placed on the same line as a label.  This allows
for improved legibility of loop constructions by incorporating the
loop check condition into the same line as the loop label.  For
example, to iterate over network devices using the forthcoming "inc"
command:

  set idx:int16 0
  :loop isset ${net${idx}/mac} || goto loop_done
    echo net${idx} is a ${net${idx}/chip} with MAC ${net${idx}/mac}
    inc idx && goto loop
  :loop_done

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-07-25 13:22:43 +01:00
Michael Brown 7fc18ea8ab [script] Allow initial whitespace on lines containing labels
Initial whitespace is already accepted on lines containing commands,
since it gets ignored by the system() call.  Minimise surprise and
allow for neater indentation of scripts by also allowing whitespace on
lines containing labels.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-07-25 13:03:42 +01:00
Michael Brown e52c24492a [script] Avoid trying to read final character of a zero-length string
Detected using Valgrind.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-07-15 18:06:41 +02:00
Michael Brown bba5a39026 [script] Allow for backslash continuation of script lines
Allow long script lines to be broken up using backslash continuation.
For example:

   choose --default linux --timeout 3000 os \
   	  && goto boot_${os} || goto cancelled

Requested-by: Robin Smidsrød <robin@smidsrod.no>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-07-15 11:20:04 +02:00
Michael Brown c3b4860ce3 [legal] Update FSF mailing address in GPL licence texts
Suggested-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-20 19:55:45 +01:00
Michael Brown a026a27f04 [script] Avoid using stack-allocated memory in process_line()
Script lines can be arbitrarily long; allocate on the heap rather than
on the stack.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-04-23 22:42:10 +01:00
Michael Brown 0b1fe005b3 [parseopt] Allow "prompt" command to accept character literals for --key
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-29 00:21:19 +01:00
Michael Brown 174df77359 [script] Accept labels on lines terminated with CRLF
CRLF line terminators are allowed in scripts; the carriage return is
simply interpreted as trailing whitespace and so is ignored.  This
fails on lines containing script labels, since the label-finding code
checks for a line containing only the ":" marker and the label itself
(without any trailing whitespace).

Fix by allowing a label to be terminated by either a NUL or a
whitespace character.

Reported-by: Bovey Christian <Christian.Bovey@chuv.ch>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-08-08 16:35:30 +01:00
Michael Brown e934447a60 [script] Allow scripts to be replaced
A script that downloads a new image using imgdownload() with the
action register_and_replace_image() can now be freed immediately
before the replacement image is executed.  This functionality is not
yet exposed via an iPXE command.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-03-09 17:32:32 +00:00
Michael Brown ae92700fd4 [image] Generalise "currently-running script" to "currently-running image"
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-03-09 13:38:56 +00:00
Michael Brown b2332d5118 [prefix] Allow iPXE's own command line to be executed as a script
Some prefixes (e.g. .lkrn) allow a command line to be passed in to
iPXE.  At present, this command line is ignored.

If a command line is provided, treat it as an embedded script (without
an explicit "#!ipxe" magic marker).  This allows for patterns of
invocation such as

  title  iPXE
  kernel /boot/ipxe.lkrn dhcp && \
         sanboot iscsi:10.0.4.1::::iqn.2010-04.org.ipxe.dolphin:storage

Here GRUB is instructed to load ipxe.lkrn with an embedded script
equivalent to

  #!ipxe
  dhcp
  sanboot iscsi:10.0.4.1::::iqn.2010-04.org.ipxe.dolphin:storage

This can be used to effectively vary the embedded script without
having to rebuild ipxe.lkrn.

Originally-implemented-by: Dave Hansen <dave@sr71.net>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-03-07 22:28:31 +00:00
Michael Brown e87fc5e743 [script] Add "prompt" command
The "prompt" command exposes the prompt() function, allowing a script
to prompt the user for a keypress and take action depending on the
result.  For example

  #!ipxe

  prompt -k 0x197e -t 2000 Press F12 to boot from network... || exit
  autoboot

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-03-07 19:53:58 +00:00
Michael Brown 9e162121b1 [script] Add an iPXE error URI to the "not in a script" message
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-03-07 03:11:14 +00:00
Michael Brown 34b6ecb2f1 [image] Simplify image management
Refactor the {load,exec} image operations as {probe,exec}.  This makes
the probe mechanism cleaner, eliminates some forward declarations,
avoids holding magic state in image->priv, eliminates the possibility
of screwing up between the "load" and "exec" stages, and makes the
documentation simpler since the concept of "loading" (as distinct from
"executing") no longer needs to be explained.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-03-07 00:37:50 +00:00
Michael Brown 7d5dcc9299 [parseopt] Refer to online documentation for command help
The online documentation (e.g. http://ipxe.org/cmd/ifopen), though not
yet complete, is far more comprehensive than could be provided within
the iPXE binary.  Save around 200 bytes (compressed) by removing the
command descriptions from the interactive help, and instead referring
users directly to the web page describing the relevant command.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-03-04 12:18:51 +00:00
Michael Brown 930f009bfa [script] Remove "Aborting on <line>" message
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-29 14:38:03 +00:00
Michael Brown 7bebe9579e [cmdline] Match user expectations for &&, ||, goto, and exit
The && and || operators should be left-associative, since that is how
they are treated in most other languages (including C and Unix
shell).  For example, in the command:

  dhcp net0 && goto dhcp_ok || echo No DHCP on net0

if the "dhcp net0" fails then the "echo" should be executed.

After an "exit" or a successful "goto", further commands on the same
line should never be executed.  For example:

  goto somewhere && echo This should never be printed
  exit 0 && echo This should never be printed
  exit 1 && echo This should never be printed

An "exit" should cause the current shell or script to terminate and
return the specified exit status to its caller.  For example:

  chain test.ipxe && echo Success || echo Failure
    [in test.ipxe]
    #!ipxe
    exit 0

should echo "Success".

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-29 14:19:59 +00:00
Michael Brown 84aa702ff8 [script] Allow "exit" to exit a script
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-22 20:29:01 +00:00
Michael Brown 6d68ffee39 [script] Implement "goto" in iPXE scripts
Allow script labels to be defined using the syntax

  :<labelname>

(nothing else allowed on the line, including whitespace).  Labels are
ignored during script execution, but can be used as the target of the
"goto" command.  For example:

  #!ipxe

  goto machine_${net0/ip} || goto machine_default

  # Linux kernel boot
  :machine_10.0.0.101
  :machine_10.0.0.102
  set filename http://my.boot.server/vmlinuz
  goto done

  # Default configuration
  :machine_default
  set filename pxelinux.0
  goto done

  # Boot selected configuration
  :done
  chain ${filename}

Originally-implemented-by: Shao Miller <shao.miller@yrdsb.edu.on.ca>
Originally-implemented-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-22 04:27:26 +00:00
Michael Brown 13dfe2cf51 [script] Accept "#!gpxe" as well as "#!ipxe" as a script magic marker
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-05-22 00:27:10 +01:00
Michael Brown 8406115834 [build] Rename gPXE to iPXE
Access to the gpxe.org and etherboot.org domains and associated
resources has been revoked by the registrant of the domain.  Work
around this problem by renaming project from gPXE to iPXE, and
updating URLs to match.

Also update README, LOG and COPYRIGHTS to remove obsolete information.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-04-19 23:43:39 +01:00
Michael Brown 4c5f00f879 [script] Allow for DOS-style line endings in scripts
Windows text editors such as Notepad tend to use CRLF line endings,
which breaks gPXE's signature detection for script images.  Since
scripts are usually very small, they end up falling back to being
detected as valid PXE executable images (since there are no signature
checks for PXE executables).  Executing text files as x86 machine code
tends not to work well.

Fix by allowing for any isspace() character to terminate the "#!gpxe"
signature, and by ensuring that CR characters get stripped during
command line parsing.

Suggested-by: Shao Miller <Shao.Miller@yrdsb.edu.on.ca>
2009-06-03 10:13:29 +01:00
Michael Brown c44a193d0d [legal] Add a selection of FILE_LICENCE declarations
Add FILE_LICENCE declarations to almost all files that make up the
various standard builds of gPXE.
2009-05-18 08:33:25 +01:00
Michael Brown 8904cd55f1 [comboot] Allow for tail recursion of COMBOOT images
Multi-level menus via COMBOOT rely on the COMBOOT program being able
to exit and invoke a new COMBOOT program (the next menu).  This works,
but rapidly (within about five iterations) runs out of space in gPXE's
internal stack, since each new image is executed in a new function
context.

Fix by allowing tail recursion between images; an image can now
specify a replacement image for itself, and image_exec() will perform
the necessary tail recursion.
2009-02-17 00:47:35 +00:00
Michael Brown 24e948f030 [image] Avoid claiming zero-length images as valid
Both the script and PXE images types will claim a zero-length image.
Inhibit this to avoid end-user surprises.
2009-02-16 00:30:48 +00:00
Michael Brown 0ea821c7b7 [script] Remove arbitrary limit on script line lengths 2008-06-18 00:43:58 +01:00
Michael Brown df868476e7 Various warnings fixups for OpenBSD with gcc-3.3.5. 2007-12-07 00:11:43 +00:00
Michael Brown cfcc41d407 Set current working URI to be that of the executable image when
executing any image, not just a script.  (This will enable pxelinux to
use relative URIs, should it wish to.)
2007-08-07 06:50:12 -07:00
Michael Brown 1ae40765a6 Set current working URI equal to script URI during script execution. 2007-08-02 20:27:19 +01:00
Michael Brown 02de18eb3e Cope with non-newline-terminated scripts.
Print error status using strerror().
2007-08-02 01:12:42 +01:00
Michael Brown b256900d4f Scripts temporarily deregister themselves while executing. This
allows us to avoid execution loops without having to hack around the
image registration order.
2007-06-09 19:00:34 +01:00
Michael Brown a6afbe762c Make DEBUG=script echo the commands as they are executed 2007-01-12 10:06:59 +00:00
Michael Brown 67aedf34fa Use systematic names for XXX_IMAGE.
Add scripts as an image format (since it's trivial to do).
2007-01-12 09:00:48 +00:00