/* * Copyright 2010-2011 Calxeda, Inc. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program. If not, see . */ The pxecfg commands provide a near subset of the functionality provided by the PXELINUX boot loader. This allows U-boot based systems to be controlled remotely using the same PXE based techniques that many non U-boot based servers use. To avoid identity confusion with PXELINUX, and because not all behavior is identical, we call this feature 'pxecfg'. Commands ======== pxecfg get ---------- syntax: pxecfg get follows PXELINUX's rules for retrieving configuration files from a tftp server, and supports a subset of PXELINUX's config file syntax. Environment ----------- get_pxecfg requires two environment variables to be set: pxecfg_ram - should be set to a location in RAM large enough to hold pxecfg files while they're being processed. Up to 16 config files may be held in memory at once. The exact number and size of the files varies with how the system is being used. A typical config file is a few hundred bytes long. bootfile,serverip - these two are typically set in the DHCP response handler, and correspond to fields in the DHCP response. get_pxecfg optionally supports these two environment variables being set: ethaddr - this is the standard MAC address for the ethernet adapter in use. getpxe_cfg uses it to look for a configuration file specific to a system's MAC address. pxeuuid - this is a UUID in standard form using lower case hexadecimal digits, for example, 550e8400-e29b-41d4-a716-446655440000. get_pxecfg uses it to look for a configuration file based on the system's UUID. File Paths ---------- get_pxecfg repeatedly tries to download config files until it either successfully downloads one or runs out of paths to try. The order and contents of paths it tries mirrors exactly that of PXELINUX - you can read in more detail about it at: http://syslinux.zytor.com/wiki/index.php/Doc/pxelinux pxecfg boot ----------- syntax: pxecfg boot [pxecfg_addr] Interprets a pxecfg file stored in memory. pxecfg_addr is an optional argument giving the location of the pxecfg file Environment ----------- There are some environment variables that may need to be set, depending on conditions. pxecfg_ram - if the optional argument pxecfg_addr is not supplied, an environment variable named pxecfg_ram must be supplied. This is typically the same value as is used for the get_pxecfg command. bootfile - typically set in the DHCP response handler based on the same field in the DHCP respone, this path is used to generate the base directory that all other paths to files retrieved by boot_pxecfg will use. serverip - typically set in the DHCP response handler, this is the IP address of the tftp server from which other files will be retrieved. kernel_ram,initrd_ram - locations in RAM at which boot_pxecfg will store the kernel and initrd it retrieves from tftp. These locations will be passed to the bootm command to boot the kernel. These environment variables are required to be set. fdtaddr - the location of a fdt blob. If this is set, it will be passed to bootm when booting a kernel. pxecfg file format ================== The pxecfg file format is more or less a subset of the PXELINUX file format, see http://syslinux.zytor.com/wiki/index.php/PXELINUX. It's composed of one line commands - global commands, and commands specific to labels. Lines begining with # are treated as comments. White space between and at the beginning of lines is ignored. The size of pxecfg files and the number of labels is only limited by the amount of RAM available to U-boot. Memory for labels is dynamically allocated as they're parsed, and memory for pxecfg files is statically allocated, and its location is given by the pxecfg_ram environment variable. the pxecfg code is not aware of the size of the pxecfg memory and will outgrow it if pxecfg files are too large. Supported global commands ------------------------- Unrecognized commands are ignored. default