summaryrefslogtreecommitdiffstats
path: root/common/cmd_pxe.c
Commit message (Collapse)AuthorAgeFilesLines
* pxe: Ensure we don't overflow bootargsIan Campbell2014-10-101-0/+9
| | | | | | | | | | | | | | | | On a couple of platforms I've tripped over long PXE append lines overflowing this array, due to having CONFIG_SYS_CBSIZE == 256. When doing preseeded Debian installs it's pretty trivial to exceed that. Since the symptom can be a silent hang or a crash add a check. Of course the affected boards would also need an increased CBSIZE to actually work. Note that due to the printing of the final bootargs string CONFIG_SYS_PBSIZE also needs to be sufficiently large. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> [trini: Use %zd not %d in printf for all args] Signed-off-by: Tom Rini <trini@ti.com>
* pxe: Allow use of environment variables in append stringHans de Goede2014-08-211-16/+13
| | | | | | | Use cli_simple_process_macros, so that environment variables (e.g. ${console}) can be used in append strings. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* pxe: detect image format before calling bootm/bootzBryan Wu2014-08-091-4/+11
| | | | | | | | | | Trying bootm for zImage will print out several error message which is not necessary for this case. So detect image format firstly, only try bootm for legacy and FIT format image then try bootz for others. This patch needs new function genimg_get_kernel_addr(). Signed-off-by: Bryan Wu <pengw@nvidia.com>
* pxe: clear Bootfile before returningStephen Warren2014-08-091-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When "pxe boot" downloads the initrd/kernel/DTB, netboot_common() saves the downloaded filename to global variable BootFile. If the boot operation is aborted, this global state is not cleared. If "dhcp" is executed later without any arguments, BootFile is not cleared, and when the DHCP response is received, BootpCopyNetParams() writes the value into environment variable bootfile. This causes the following scenario: * Boot script executes dhcp; pxe get; pxe boot * User CTRL-C's the PXE menu, which causes the first menu item to be booted, which causes some file to be downloaded. (This boot-on-CTRL-C behaviour is arguably a bug too, but it's a separate bug and the bug this patch fixes would still exist if the user simply waited to press CTRL-C until "pxe boot" started downloading files) * User CTRL-C's the file downloads, but the filename is still written to the bootfile environment variable. * User re-runs the boot command, which in my case executes "dhcp; pxe get; pxe boot" again, and "dhcp" picks up the saved bootfile environment variable and proceeds to download a file that it shouldn't. To solve this, modify the implementation of "pxe get" to clear BootFile if the whole boot operation fails, which avoids this whole mess. An alternative would be to modify netboot_common() such that the no- arguments case explicitly clears the global variable BootFile. However, that would prevent the following command sequences from working: $ dhcp filename # downloads "filename" $ dhcp # downloads $bootfile, i.e. "filename" or: $ setenv bootfile filename $ dhcp # downloads $bootfile, i.e. "filename" ... and I assume someone relies on U-Boot working that way. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* common: commands: make commands staticJeroen Hofstee2014-07-181-2/+2
| | | | | | | Since most commands are not public, make them static. This prevents warnings that no common prototype is available. Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
* Merge branch 'master' of git://git.denx.de/u-boot-armTom Rini2014-02-261-0/+11
|\ | | | | | | | | | | | | | | | | Conflicts: arch/arm/cpu/armv7/config.mk board/ti/am43xx/mux.c include/configs/am43xx_evm.h Signed-off-by: Tom Rini <trini@ti.com>
| * pxe: allow compilation when !defined(CONFIG_CMD_NET)Stephen Warren2014-02-211-0/+11
| | | | | | | | | | | | | | | | | | pxe.c provides both the "pxe" command which relies on a network, and the "sysboot" command which doesn't. Fix the file to compile when network support isn't enabled. This is useful e.g. on the Raspberry Pi which has no network support yet, but will soon support the sysboot command. Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
* | pxe: prepend fdtdir to DTB name irrespective of sourceStephen Warren2014-02-211-37/+40
|/ | | | | | | | | | | | | | The directory name from an fdtdir directive in a PXE config file should always be pre-pended to the DTB filename; it shouldn't matter whether the DTB filename came from the $fdtfile environment variable, or whether it was constructed dynamically from ${soc}-${board}.dtb. Fix the code to always prepend the directory name. Reported-by: Dennis Gilmore <dennis@ausil.us> Fixes: c61d94d86035 ("pxe: implement fdtdir extlinux.conf tag") Signed-off-by: Stephen Warren <swarren@nvidia.com> Reviewed-by: Dennis Gilmore <dennis@ausil.us> Tested-by: Dennis Gilmore <dennis@ausil.us>
* cmd_pxe.c add any option for filesystem with sysboot uses generic loadDennis Gilmore2014-02-041-3/+19
| | | | Signed-off-by: Dennis Gilmore <dennis@ausil.us>
* pxe: implement fdtdir extlinux.conf tagStephen Warren2014-02-041-6/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | People who write (or scripts that auto-generate) extlinux.conf don't want to know about HW-specific information such as FDT filenames. Create a new extlinux.conf tag "fdtdir" that specifies only the directory where FDT files are located, and defer all knowledge of the filename to U-Boot. The algorithm implemented is: ========== if $fdt_addr_r is set: if "fdt" tag was specified in extlinux.conf: load the FDT from the filename in the tag else if "fdtdir" tag was specified in extlinux.conf: if "fdtfile" is set in the environment: load the FDT from filename in "$fdtfile" else: load the FDT from some automatically generated filename if no FDT file was loaded, and $fdtaddr is set: # This indicates an FDT packaged with firmware use the FDT at $fdtaddr ========== A small part of an example /boot/extlinux.conf might be: ========== LABEL primary LINUX zImage FDTDIR ./ LABEL failsafe LINUX bkp/zImage FDTDIR bkp/ ========== ... with /boot/tegra20-seaboard.dtb or /boot/bkp/tegra20-seaboard.dtb being loaded by the sysboot/pxe code. Signed-off-by: Stephen Warren <swarren@nvidia.com>
* pxe: support "devicetree" tagStephen Warren2014-02-041-0/+1
| | | | | | | | | The specification for extlinux.conf[1] states that "fdt" is an alias for "devicetree". To date, U-Boot only implements "fdt". Rectify that. [1] http://freedesktop.org/wiki/Specifications/BootLoaderSpec/ Signed-off-by: Stephen Warren <swarren@nvidia.com>
* cmd_pxe: remove compiling warningsDavid Feng2014-01-091-2/+2
| | | | Signed-off-by: David Feng <fenghua@phytium.com.cn>
* pxe: fix handling of absolute pathsRob Herring2013-11-041-1/+8
| | | | | | | | | | | pxelinux and syslinux differ in their handling of absolute paths in menu files. A pxelinux path is aways prepended with the bootfile path while syslinux allows for absolute paths. u-boot was always treating a leading / as an absolute path breaking some pxelinux setups. Fix this by adding a flag to distinguish pxelinux vs. syslinux behavior. Reported-by: Ian Campbell <Ian.Campbell@citrix.com> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
* Prevent null pointer dereference originating in cmd_pxe.cSteven Falco2013-10-141-42/+42
| | | | | | | | | | | | | | | | | | | | Pass a valid cmdtp into do_tftpb(), do_ext2load(), and do_get_fat(), to avoid possible crashes due to null pointer dereferencing. Commit d7884e047d08447dfd1374e9fa2fdf7ab36e56f5 does not go far enough. There is still at least one call chain that can result in a crash. The do_tftpb(), do_ext2load(), and do_get_fat() functions expect a valid cmdtp. Passing in NULL is particularly bad in the do_tftpb() case, because eventually boot_get_kernel() will be called with a NULL cmdtp: do_tftpb() -> netboot_common() -> bootm_maybe_autostart() -> do_bootm() -> do_bootm_states() -> bootm_find_os() -> boot_get_kernel() Around line 991 in cmd_bootm.c, boot_get_kernel() will dereference the null pointer, and the board will crash. Signed-off-by: Steven A. Falco <stevenfalco@gmail.com>
* cmd_pxe.c: Pass along 'cmdtp' to do_bootm()/do_bootz()Tom Rini2013-09-241-10/+10
| | | | | | | | | | When we call do_bootm() with a vmlinuz, this would lead to a NULL pointer dereference, and after talking with Wolfgang the right thing to do here for now is to make sure that we pass cmdtp to these functions rather than NULL. Reported-by: Steven A. Falco <stevenfalco@gmail.com> Signed-off-by: Tom Rini <trini@ti.com>
* Add GPL-2.0+ SPDX-License-Identifier to source filesWolfgang Denk2013-07-241-12/+2
| | | | | | Signed-off-by: Wolfgang Denk <wd@denx.de> [trini: Fixup common/cmd_io.c] Signed-off-by: Tom Rini <trini@ti.com>
* pxe: add ipappend supportRob Herring2013-06-241-3/+44
| | | | | | Add ipappend support to pass network device information to the kernel. Signed-off-by: Rob Herring <rob.herring@calxeda.com>
* net: Fix build regression in cmd_pxe.cJoe Hershberger2013-06-241-0/+2
| | | | | | | | Not all boards define an SOC. As a result, we can't depend on that. This was introduced in 39f985536d3f0df5dba32c15b64ba2b5d32dd296 Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* pxe: add support for per arch and SoC default pathsRob Herring2013-06-241-6/+20
| | | | | | | | | A pxelinux server setup for "default" menu is typically an x86 binary. This does not work well with a mixed architecture setup. Extend the default search to look for default-<arch>-<soc> and then default-<arch> before falling back to just "default". Signed-off-by: Rob Herring <rob.herring@calxeda.com>
* pxe: add support for ontimeout tokenRob Herring2013-06-241-5/+6
| | | | | | | | | ontimeout is similar to default, but is the selection on menu timeout. This is how cobbler sets a default. The label default is supposed to be the default selection when <enter> is pressed. If both default and ontimeout are set, last one parsed wins. Signed-off-by: Rob Herring <rob.herring@calxeda.com>
* pxe: simplify menu display and selectionRob Herring2013-06-241-18/+16
| | | | | | | | Menus with lots of entries and long append lines are hard to read. Just show a numbered list using the label or name and make the choice by entering the number. Signed-off-by: Rob Herring <rob.herring@calxeda.com>
* pxe: always display a menu when presentRob Herring2013-06-241-1/+2
| | | | | | | | | The prompt flag is for displaying a "boot:" prompt in pxelinux. This doesn't make sense for u-boot as we don't support the pxelinux command interface. So we should just ignore prompt statements and always show the menu if a menu is present. Signed-off-by: Rob Herring <rob.herring@calxeda.com>
* pxe: try bootz if bootm fails to find a valid imageRob Herring2013-06-241-1/+10
| | | | | | | Standard pxelinux servers will typically use a zImage rather than u-boot image format, so fallback to bootz if bootm fails. Signed-off-by: Rob Herring <rob.herring@calxeda.com>
* pxe: fix handling of different localboot valuesRob Herring2013-06-241-18/+19
| | | | | | | | | | | | | Add support for value of -1 For localboot. A value of -1 means return to u-boot prompt. The localboot value is often 0, so we need to distinguish the value from localboot being selected. A value of greater than or equal to 0 means attempt local boot command. If localboot is selected, we don't want to try other entries. Signed-off-by: Rob Herring <rob.herring@calxeda.com>
* pxe: make string parameters constRob Herring2013-06-241-12/+12
| | | | | | Convert a bunch of string parameters to be const. Signed-off-by: Rob Herring <rob.herring@calxeda.com>
* pxe: Use ethact setting for pxeRob Herring2013-06-241-25/+9
| | | | | | | | Get the MAC address using eth_getenv_enetaddr_by_index so that the MAC address of ethact is used. This enables using the a NIC other than the first one for PXE boot. Signed-off-by: Rob Herring <rob.herring@calxeda.com>
* menu: Add support for user defined item choice functionPali Rohár2013-03-291-1/+2
| | | | | | | | | | | | Selecting menu items is currently done in menu_interactive_choice() by reading the user input strings from standard input. Extend menu_interactive_choice() to support user defined function for selecting menu items. This function and its argument can be specified when creating the menu. Signed-off-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Anatolij Gustschin <agust@denx.de>
* PXE: FDT: Add support for fdt in PXEChander Kashyap2012-09-271-3/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | Now DT support is becoming common for all new SoC's. Hence it is better to have option for getting specific FDT from the remote server. This patch adds support for new label i.e. 'fdt'. This will allow to retrieve 'fdt blob' from the remote server. This patch take care for the following scenarios. The usage of fdt is optional. The 'fdt blob' can be retrieved from tftp or can be available locally or can be absent. If 'fdt_addr_r' environment variable is set and 'fdt' label is defined retrieve 'fdt blob' from tftp. 'fdt_addr_r' is then passed along bootm command. If 'fdt_addr' is set and 'fdt blob' is not retrieved from the tftp pass 'fdt_addr' to bootm command. In this case 'fdt blob' will be available at 'fdt_addr'. If 'fdt_addr' is not set and 'fdt blob' is not retrieve from tftp pass NULL to boot command. In this case 'fdt blob' is not required and absent. Signed-off-by: Chander Kashyap <chander.kashyap@linaro.org> Acked-by: Jason Hobbs <jason.hobbs@calxeda.com>
* Add run_command_list() to run a list of commandsSimon Glass2012-08-091-17/+3
| | | | | | | | | This new function runs a list of commands separated by semicolon or newline. We move this out of cmd_source so that it can be used by other code. The PXE code also uses the new function. Suggested-by: Michael Walle <michael@walle.cc> Signed-off-by: Simon Glass <sjg@chromium.org>
* Minor Coding Style cleanupWolfgang Denk2012-07-101-4/+0
| | | | Signed-off-by: Wolfgang Denk <wd@denx.de>
* pxe: add support for parsing local syslinux filesRob Herring2012-06-211-8/+133
| | | | | | | | Add a new command "sysboot" which parses syslinux menu files and boots using kernel and initrd specified by menu files. The operation is similar to "pxe boot" except local files on ext2 or fat filesystem are parsed. Signed-off-by: Rob Herring <rob.herring@calxeda.com>
* pxe: parse initrd file from append stringRob Herring2012-06-211-1/+14
| | | | | | | | For syslinux, the initrd can be set in the append string as "initrd=<file>", so try to find it there if we haven't already set the initrd. Signed-off-by: Rob Herring <rob.herring@calxeda.com>
* pxe: support absolute pathsRob Herring2012-06-211-11/+12
| | | | | | | | If the file path starts with a '/', then don't pre-pend the bootfile path. This fixes a problem with running 'pxe boot' multiple times where the bootfile path gets pre-pended to itself each time. Signed-off-by: Rob Herring <rob.herring@calxeda.com>
* pxe: support linux entries for labelsRob Herring2012-06-211-0/+3
| | | | | | | | Kernels can be specified using "linux" or "kernel" entry. The difference is kernel is supposed to detect the type of file, but for u-boot both are treated the same. Signed-off-by: Rob Herring <rob.herring@calxeda.com>
* pxe: add support for label menu textRob Herring2012-06-211-4/+9
| | | | | | Use a menu string if present, otherwise use the kernel string. Signed-off-by: Rob Herring <rob.herring@calxeda.com>
* pxe: support include files at top-levelRob Herring2012-06-211-0/+5
| | | | | | Include files outside of a menu were not getting included and parsed. Signed-off-by: Rob Herring <rob.herring@calxeda.com>
* cmd_pxe.c: fix strict-aliasing warningsJason Hobbs2012-03-271-8/+8
| | | | | | | | | | | Without this patch, some versions of gcc (at least ELDK 4.2) complain about dereferencing type-punned pointers. Reported-by: Marek Vasut <marex@denx.de> Signed-off-by: Jason Hobbs <jason.hobbs@calxeda.com> Cc: Heiko Schocher <hs@denx.de> Cc: Marek Vasut <marex@denx.de> Acked-by: Heiko Schocher <hs@denx.de>
* Convert cmd_usage() calls in common to use a return valueSimon Glass2012-03-061-4/+4
| | | | | | | | | Change all files in common/ to use CMD_RET_USAGE instead of calling cmd_usage() directly. I'm not completely sure about this patch since the code since impact is small (100 byte or so on ARM) and it might need splitting into smaller patches. But for now here it is. Signed-off-by: Simon Glass <sjg@chromium.org>
* Rename run_command2() to run_command()Simon Glass2012-03-061-1/+1
| | | | | | | This is a more sensible name, so rename it. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Mike Frysinger <vapier@gentoo.org>
* common/cmd_pxe.c: Fix GCC 4.6 build warningsHeiko Schocher2011-12-201-1/+1
| | | | | | | | | | | | Fix: cmd_pxe.c: In function 'parse_pxefile_top': cmd_pxe.c:941:5: warning: 'err' may be used uninitialized in this function [-Wuninitialized] cmd_pxe.c:921:6: note: 'err' was declared here Signed-off-by: Heiko Schocher <hs@denx.de> Cc: Jason Hobbs <jason.hobbs@calxeda.com> Acked-by: Jason Hobbs <jason.hobbs@calxeda.com>
* pxe: make the first label the implicit defaultJason Hobbs2011-12-061-3/+14
| | | | | | | | | | If no default label is specified, but a situation arises where the default label should be used, treat the first label specified as the default label. Signed-off-by: Jason Hobbs <jason.hobbs@calxeda.com> Cc: Ricardo Salveti de Araujo <ricardo.salveti@linaro.org> Cc: Wolfgang Denk <wd@denx.de>
* Add pxe commandJason Hobbs2011-10-171-0/+1355
Add pxe command, which is intended to mimic PXELINUX functionality. 'pxe get' uses tftp to retrieve a file based on UUID, MAC address or IP address. 'pxe boot' interprets the contents of PXELINUX config like file to boot using a specific initrd, kernel and kernel command line. This patch also adds a README.pxe file - see it for more details on the pxe command. Signed-off-by: Jason Hobbs <jason.hobbs@calxeda.com>
OpenPOWER on IntegriCloud