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

119 Commits

Author SHA1 Message Date
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 6f43ba411d [cmdline] Add "ping" command
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-10-21 15:21:37 +01:00
Michael Brown 7405685df2 [cmdline] Add "nstat" command
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-09-25 14:36:36 +01:00
Michael Brown 430c3fb900 [cmdline] Add "params" and "param" commands to manage form parameter lists
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-08-19 17:22:58 +01:00
Michael Brown b76885165e [cmdline] Add "pciscan" command to allow iteration over PCI devices
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-08-05 13:51:21 +01:00
Michael Brown 2b869786c5 [cmdline] Add "inc" command
The "inc" command allows the numeric value of a setting to be
incremented, allowing for the construction of simple loops within an
iPXE script.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-08-01 14:42:28 +01:00
Michael Brown 652abb6706 [settings] Eliminate calls to {fetch,store}f_named_setting() in NVO commands
A deliberate side effect of this commit is that the "read" command
will now preserve the type of the setting, if the setting name
contains no type information.  For example:

  iPXE> set foo:ipv4 192.168.0.1
  iPXE> read foo
  192.168.0.100
  iPXE> show foo
  foo:ipv4 = 192.168.0.100

rather than the arguably unexpected behaviour of resetting the type to
"string".

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-07-22 16:39:26 +01:00
Michael Brown 7010b10491 [settings] Eliminate call to storef_named_setting() in choose_exec()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-07-22 16:39:20 +01:00
Michael Brown 46433f9b5e [parseopt] Move parse_settings() to parseopt.c
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-07-22 16:16:44 +01:00
Michael Brown b87020a090 [parseopt] Allow parsed option to be modified
Parsing a setting name requires the ability to modify the text being
parsed.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-07-22 16:16:11 +01:00
Michael Brown ed28c8304c [ifmgmt] Avoid relying on global variable within ifcommon_exec()
The getopt API defines optind as a global variable.  When used by the
"autoboot" command, the payload function passed to ifcommon_exec() may
result in a new iPXE script being executed; the commands therein would
then overwrite the value of optind.  On returning, ifcommon_exec()
would continue processing the list of interfaces from an undefined
point.

Fix by using a local variable to hold the index within the list of
interfaces.

Reported-by: Robin Smidsrød <robin@smidsrod.no>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-07-15 17:35:48 +02:00
Marin Hannache c0af8c0433 [cmdline] Add "poweroff" command
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Marin Hannache <git@mareo.fr>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-07-15 13:49:48 +02:00
Michael Brown e68a6ca225 [cmdline] Add ability to perform a warm reboot
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-22 13:54:44 +00:00
Michael Brown 71cd508838 [efi] Add "reboot" command for EFI
Abstract out the ability to reboot the system to a separate reboot()
function (with platform-specific implementations), add an EFI
implementation, and make the existing "reboot" command available under
EFI.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-22 13:44:02 +00:00
Michael Brown 2c011d77ae [readline] Allow readline_history() to return a meaningful status
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-10-24 23:24:43 -07:00
Michael Brown 34863a51c2 [settings] Prefill existing setting value in "read" command
When prompting the user to enter a setting value via the "read"
command, prefill the input buffer with the setting's current value.

Requested-by: Ján Ondrej (SAL) <ondrejj@salstar.ks>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-10-24 20:47:39 -07:00
Patrick Plenefisch 8e4faa0948 [cmdline] Add standalone "nslookup" command
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-09-10 15:31:14 +01:00
Michael Brown 25ec56e0ec [settings] Use a generic setting's own type as its default type
When fetching a named setting using a name that does not explicitly
specify a type, default to using the type stored when the setting was
created, rather than always defaulting to "string".  This allows the
behaviour of user-defined settings to match the behaviour of
predefined settings (which have a sensible default type).

For example:

  set server:ipv4 192.168.0.1
  echo ${server}

will now print "192.168.0.1", rather than trying to print out the raw
IPv4 address bytes as a string.

The downside of this change is that existing tricks for printing
special characters within scripts may require (backwards-compatible)
modification.  For example, the "clear screen" sequence:

  set esc:hex 1b
  set cls ${esc}[2J
  echo ${cls}

will now have to become

  set esc:hex 1b
  set cls ${esc:string}[2J  # Must now explicitly specify ":string"
  echo ${cls}

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-09-10 14:25:04 +01: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 5d3c368efb [image] Add "--replace" option
Expose image tail-recursion to iPXE scripts via the "--replace"
option.  This functions similarly to exec() under Unix: the
currently-executing script is replaced with the new image (as opposed
to running the new image as a subroutine).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-20 12:45:15 +01:00
Michael Brown d3c660b671 [image] Add "--autofree" option
Allow images to be automatically freed after execution completes
(successfully or otherwise).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-20 12:44:40 +01:00
Michael Brown ba480730dc [cmdline] Increase resolution of "time" command
A reasonably large (512MB) file transferred via HTTP over Gigabit
Ethernet should complete in around 4.6 seconds.  Increase the
resolution of the "time" command to tenths of a second, to allow such
transfers to be meaningfully measured.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-27 19:15:16 +01:00
Michael Brown addf699c86 [cmdline] Add "sync" command
Add "sync" command (loosely based on the Unix "sync"), which will wait
for any pending operations to complete.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-09 19:00:04 +01:00
Michael Brown 838a76a042 [menu] Add "--default" option to "choose" command
Suggested-by: Robin Smidsrød <robin@smidsrod.no>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-04-28 23:42:15 +01:00
Michael Brown 3425726cf3 [menu] Add menu commands
Allow iPXE scripts to create menus.  For example:

    #!ipxe

    menu iSCSI boot demonstration
    item install         Install Fedora to ${root-path}
    item --default boot  Boot from ${root-path}
    item shell           Enter iPXE shell
    item exit            Exit to BIOS
    choose label && goto ${label}

    :boot
    sanboot ${root-path}

    :install
    sanhook ${root-path}
    chain http://${next-server}/fedora.ipxe

    :shell
    shell

    :exit

Inspired-by: Robin Smidsrød <robin@smidsrod.no>
Tested-by: Robin Smidsrød <robin@smidsrod.no>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-29 14:02:02 +01:00
Michael Brown d1465f7b0b [image] Add the "imgtrust" and "imgverify" commands
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-25 00:11:43 +00:00
Michael Brown 1c127a6962 [image] Simplify image management commands and internal API
Remove the name, cmdline, and action parameters from imgdownload() and
imgdownload_string().  These functions now simply download and return
an image.

Add the function imgacquire(), which will interpret a "name or URI
string" parameter and return either an existing image or a newly
downloaded image.

Use imgacquire() to merge similar image-management commands that
currently differ only by whether they take the name of an existing
image or the URI of a new image to download.  For example, "chain" and
"imgexec" can now be merged.

Extend imgstat and imgfree commands to take an optional list of
images.

Remove the arbitrary restriction on the length of image names.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-24 23:12:04 +00:00
Michael Brown 790035f78d [image] Eliminate the register_and_xxx_image() functions
All users of imgdownload() require registration of the image, so make
registration an integral part of imgdownload() itself and simplify the
"action" parameter to be one of image_select(), image_exec() et al.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-10-25 01:41:41 +01:00
Michael Brown bf2da3122b [cmdline] Make "sleep" command available by default
The "sleep" command is generally useful to have.  For example:

  :dhcp_retry
  dhcp && goto dhcp_done
  sleep 5
  goto dhcp_retry
  :dhcp_done

Make the "sleep" command available by default, leaving TIME_CMD
controlling only the (fairly specialist) "time" command.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-10-24 15:39:05 +01:00
Michael Brown 5d2802e403 [sanboot] Add "sanhook" and "sanunhook" commands
Expose the multiple-SAN-drive capability of the iPXE core via the iPXE
command line by adding commands to hook and unhook additional drives.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-04-24 16:44:34 +01:00
Michael Brown 3c1bdfd5d9 [image] Remove redundant call to basename()
There is no need to explicitly call basename() to construct an image
name in imgfetch_core_exec(), since image_set_uri() will do so
automatically anyway (and will do so without getting confused by URIs
with query strings).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-03-27 19:37:42 +01:00
Michael Brown 1cc991e132 [settings] Add "read" command
The "read" command allows a script to prompt a user to enter a
setting.  For example:

  echo -n Static IP address:
  read net0/ip

Total cost: 17 bytes.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-03-27 13:24:21 +01:00
Michael Brown 5fbd0207b2 [settings] Display canonical setting name in output of "show" command
Enable the "show" command to display the full, canonicalised name of
the fetched setting.  For example:

  iPXE> show mac
  net0/mac:hex = 52:54:00:12:34:56

  iPXE> dhcp && show ip
  DHCP (net0 52:54:00:12:34:56)... ok
  net0.dhcp/ip:ipv4 = 10.0.0.168

  iPXE> show net0/6
  net0.dhcp/dns:ipv4 = 10.0.0.6

Inspired-by: Glenn Brown <glenn@myri.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-03-22 20:13:50 +00:00
Michael Brown aebba8f6eb [settings] Use concat_args() in "set" command
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-03-22 19:55:05 +00:00
Michael Brown 9fa4ac2e9a [image] Simplify use of imgdownload()
Allow imgdownload() to be called without first having to allocate (and
so keep track of) an image.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-03-09 16:57:34 +00:00
Michael Brown a281c4080b [cmdline] Add generic concat_args() function
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-03-07 19:21:43 +00:00
Michael Brown 2dd23e1ee9 [image] Clear the command line rather than setting an empty command line
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-03-07 02:44:24 +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 e088892a81 [autoboot] Connect SAN disk during a filename boot, if applicable
For performing installations direct to a SAN target, it can be very
useful to hook a SAN disk and then proceed to perform a filename boot.
For example, the user may wish to hook the (empty) SAN installation
disk and then boot into the OS installer via TFTP.  This provides an
alternative mechanism to using "keep-san" and relying on the BIOS to
fall through to boot from the installation media, which is unreliable
on many BIOSes.

When a root-path is specified in addition to a boot filename, attempt
to hook the root-path as a SAN disk before booting from the specified
filename.  Since the root-path may be used for non-SAN purposes
(e.g. an NFS root mount point), ignore the root-path if it contains a
URI scheme that we do not support.

Originally-implemented-by: Jarrod Johnson <jarrod.b.johnson@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-01-27 20:41:27 +00:00
Michael Brown a180c7526c [settings] Allow "set" command to take an empty value
Allow "set <variable>" to be used to set the variable to an empty
value, if permitted by the setting type.  Note that some settings
backends do not differentiate between an empty value and a
non-existent value, so this may or may not be equivalent to "clear
<variable>".

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-22 21:14:11 +00:00
Michael Brown debbea1123 [autoboot] Merge "netboot" command into "autoboot"
Allow "autoboot" to accept an optional list of network devices, and
remove the "netboot" command.  This saves around 130 bytes.

The "netboot" command has existed for approximately 48 hours, so its
removal should not cause backwards compatibility issues for anyone.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-22 21:04:30 +00:00
Michael Brown fdd42fa950 [legal] Add some missing FILE_LICENCE declarations
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-22 00:34:48 +00:00
Michael Brown 0cd6f2c709 [image] Use generic option-parsing library
Total saving: 548 bytes.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-22 00:34:48 +00:00
Michael Brown 6832f0688f [login] Use generic option-parsing library
Total cost: 7 bytes.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-22 00:34:48 +00:00
Michael Brown 46116d8d03 [route] Use generic option-parsing library
Total saving: 71 bytes.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-22 00:34:48 +00:00
Michael Brown 72b4464c89 [san] Use generic option-parsing library
Total saving: 73 bytes.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-22 00:34:47 +00:00
Michael Brown 817c544697 [time] Use generic option-parsing library
Total saving: 88 bytes.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-22 00:34:47 +00:00
Michael Brown ec42ba366f [lotest] Use generic option-parsing library
Total saving: 145 bytes.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-22 00:34:47 +00:00
Michael Brown 1e2a8aa9c1 [gdb] Use generic option-parsing library
Total saving: 42 bytes.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-22 00:34:47 +00:00