summaryrefslogtreecommitdiffstats
path: root/src/image
Commit message (Collapse)AuthorAgeFilesLines
...
* [cmdline] Match user expectations for &&, ||, goto, and exitMichael Brown2010-11-291-7/+6Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* [script] Allow "exit" to exit a scriptMichael Brown2010-11-221-14/+21
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [script] Implement "goto" in iPXE scriptsMichael Brown2010-11-221-25/+189
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* [ioapi] Move get_memmap() to the I/O API groupPiotr Jaroszyński2010-08-161-1/+1
| | | | | | | | | pcbios specific get_memmap() is used by the b44 driver making all-drivers builds fail on other platforms. Move it to the I/O API group and provide a dummy implementation on EFI. Signed-off-by: Piotr Jaroszyński <p.jaroszynski@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [refcnt] Add ref_no_free handlerJoshua Oreman2010-06-231-11/+1Star
| | | | | | | Since more reference-counted structures than embedded images might want to mark themselves unfreeable, expose a dummy ref_no_free(). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [refcnt] Add ref_init() wrapper functionMichael Brown2010-06-221-1/+1
| | | | | | | Standardise on using ref_init() to initialise an embedded reference count, to match the coding style used by other embedded objects. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Add the "snpnet" driverGeoff Lywood2010-06-021-3/+34
| | | | | | | | | Add a new network driver that consumes the EFI Simple Network Protocol. Also add a bus driver that can find the Simple Network Protocol that iPXE was loaded from; the resulting behavior is similar to the "undionly" driver for BIOS systems. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Enable automated extraction of error usage reportsMichael Brown2010-05-311-11/+14
| | | | | | | Add preprocessor magic to the error definitions to enable every error usage to be tracked. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [script] Accept "#!gpxe" as well as "#!ipxe" as a script magic markerMichael Brown2010-05-221-4/+9
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Rename gPXE to iPXEMichael Brown2010-04-205-18/+18
| | | | | | | | | | | 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>
* [script] Allow for DOS-style line endings in scriptsMichael Brown2009-06-031-3/+5
| | | | | | | | | | | | | | | 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>
* [legal] Add a selection of FILE_LICENCE declarationsMichael Brown2009-05-185-0/+10
| | | | | Add FILE_LICENCE declarations to almost all files that make up the various standard builds of gPXE.
* [elf] Work around entry point bug in NetBSD kernelsMichael Brown2009-04-241-14/+41
| | | | | | | | | | | | | | NetBSD kernels are multiboot ELF kernels with an entry point incorrectly specified as a virtual address rather than a physical address. Work around this by looking for the segment that could plausibly contain the entry point address (interpreted as either a physical or virtual address), and using that to determine the eventual physical entry point. In the event of any ambiguity, precedence is given to interpretation of the entry point as a physical address.
* [segment] Add "Requested memory not available" error messageMichael Brown2009-03-311-0/+11
| | | | | | | | | | | prep_segment() can sometimes fail because an image requests memory that is already in use by gPXE. This will happen if e.g. undionly.kpxe is used to boot memtest86; the memtest86 image is an old-format kernel that needs to be loaded at 9000:0000, but this area of memory may well already be in use by the underlying PXE stack. Add a human-friendly error message, so that the cause is more immediately visible.
* [image] Allow for zero embedded imagesMichael Brown2009-02-242-6/+9
| | | | | | | | | | | | | | | | | | Having a default script containing #!gpxe autoboot can cause problems when entering commands to load and start a kernel manually; the default script image will still be present when the kernel is started and so will be treated as an initrd. It is possible to work around this by typing "imgfree" before any other commands, but this is counter-intuitive. Fix by allowing the embedded image list to be empty (in which case we just call autoboot()), and making this the default. Reported by alkisg@gmail.com.
* [comboot] Allow for tail recursion of COMBOOT imagesMichael Brown2009-02-171-4/+1Star
| | | | | | | | | | | | 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.
* [image] Avoid claiming zero-length images as validMichael Brown2009-02-161-0/+6
| | | | | Both the script and PXE images types will claim a zero-length image. Inhibit this to avoid end-user surprises.
* [image] Allow multiple embedded imagesMichael Brown2009-02-163-39/+79
| | | | | | | | | | This patch extends the embedded image feature to allow multiple embedded images instead of just one. gPXE now always boots the first embedded image on startup instead of doing the hardcoded DHCP boot (aka autoboot). Based heavily upon a patch by Stefan Hajnoczi <stefanha@gmail.com>.
* [i386] Add explicit flags and type on all .section declarationsMichael Brown2009-02-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Try to avoid future problems caused by implicit section flags and/or type information by instituting a policy that all .section declarations must explicitly state the flags and type. Most of this change was achieved using perl -pi \ -e 's/".text"$/".text", "ax", \@progbits/ ; ' \ -e 's/".text16"$/".text16", "ax", \@progbits/ ; ' \ -e 's/".text16.null"$/".text16.null", "ax", \@progbits/ ; ' \ -e 's/".text16.data"$/".text16.data", "aw", \@progbits/ ; ' \ -e 's/".data"$/".data", "aw", \@progbits/ ; ' \ -e 's/".data16"$/".data16", "aw", \@progbits/ ; ' \ -e 's/".bss"$/".bss", "aw", \@nobits/ ; ' \ -e 's/".bss16"$/".bss16", "aw", \@nobits/ ; ' \ -e 's/".prefix"$/".prefix", "ax", \@progbits/ ; ' \ -e 's/".prefix.lib"$/".prefix.lib", "awx", \@progbits/ ; ' \ -e 's/".prefix.data"$/".prefix.data", "aw", \@progbits/ ; ' \ -e 's/".weak"$/".weak", "a", \@nobits/ ; ' \ `git grep -l '\.section'`
* [efi] Add efi_strerror()Michael Brown2008-11-191-6/+6
| | | | | | | | | EFI_STATUS is defined as an INTN, which maps to UINT32 (i.e. unsigned int) on i386 and UINT64 (i.e. unsigned long) on x86_64. This would require a cast each time the error status is printed. Add efi_strerror() to avoid this ickiness and simultaneously enable prettier reporting of EFI status codes.
* [i386] Change [u]int32_t to [unsigned] int, rather than [unsigned] longMichael Brown2008-11-192-4/+4
| | | | | | This brings us in to line with Linux definitions, and also simplifies adding x86_64 support since both platforms have 2-byte shorts, 4-byte ints and 8-byte long longs.
* [efi] Add EFI image format and basic runtime environmentMichael Brown2008-10-131-0/+106
| | | | | | | | | We have EFI APIs for CPU I/O, PCI I/O, timers, console I/O, user access and user memory allocation. EFI executables are created using the vanilla GNU toolchain, with the EXE header handcrafted in assembly and relocations generated by a custom efilink utility.
* [pcbios] Add extra debugging messages relating to the system memory mapMichael Brown2008-09-071-0/+2
|
* [bzimage] Kill off the initrd image typeMichael Brown2008-07-081-37/+0Star
| | | | | | | We can just treat all non-kernel images as initrds, which matches our behaviour for multiboot kernels. This allows us to eliminate initrd as an image type, and treat the "initrd" command as just another synonym for "imgfetch".
* [misc] Fix building on OpenBSDMichael Brown2008-06-271-3/+2Star
| | | | | | | OpenBSD throws compiler warnings that we can't reproduce on Linux, for some reason. Original patch from Dewey Hylton <dewey@hyltown.com>.
* [script] Remove arbitrary limit on script line lengthsMichael Brown2008-06-181-28/+19Star
|
* [ELF] Add ability to boot ELF images generated by wraplinux and mkelfImageMichael Brown2008-06-091-23/+6Star
| | | | | | | | | | | | | | | | | | | Delete ELF as a generic image type. The method for invoking an ELF-based image (as well as any tables that must be set up to allow it to boot) will always depend on the specific architecture. core/elf.c now only provides the elf_load() function, to avoid duplicating functionality between ELF-based image types. Add arch/i386/image/elfboot.c, to handle the generic case of 32-bit x86 ELF images. We don't currently set up any multiboot tables, ELF notes, etc. This seems to be sufficient for loading kernels generated using both wraplinux and coreboot's mkelfImage. Note that while Etherboot 5.4 allowed ELF images to return, we don't. There is no callback mechanism for the loaded image to shut down gPXE, which means that we have to shut down before invoking the image. This means that we lose device state, protection against being trampled on, etc. It is not safe to continue afterwards.
* [embed] Add missing register_image() to image/embedded.cMichael Brown2008-06-041-0/+1
| | | | | | | | When the embedded image is a script, the unregister_image() performed by image/script.c corrupts memory, since image/embedded.c omitted the call to register_image(). This is the first bug fixed using Stefan Hajnoczi's gdb stub for gPXE.
* Added the embedded pxelinux payload patch from hpa.Michael Brown2008-01-082-0/+56
|
* Various warnings fixups for OpenBSD with gcc-3.3.5.Michael Brown2007-12-071-1/+1
|
* Set current working URI to be that of the executable image whenMichael Brown2007-08-071-9/+1Star
| | | | | executing any image, not just a script. (This will enable pxelinux to use relative URIs, should it wish to.)
* Set current working URI equal to script URI during script execution.Michael Brown2007-08-021-1/+9
|
* Cope with non-newline-terminated scripts.Michael Brown2007-08-021-2/+3
| | | | Print error status using strerror().
* Scripts temporarily deregister themselves while executing. ThisMichael Brown2007-06-091-3/+16
| | | | | allows us to avoid execution loops without having to hack around the image registration order.
* Actually, the initrd image should be architecture-independent.Michael Brown2007-01-141-0/+37
|
* Replace image->entry with image->priv.Michael Brown2007-01-141-2/+2
|
* Make DEBUG=script echo the commands as they are executedMichael Brown2007-01-121-0/+1
|
* Use systematic names for XXX_IMAGE.Michael Brown2007-01-121-0/+113
| | | | Add scripts as an image format (since it's trivial to do).
* Force probing of multiboot before ELF.Michael Brown2007-01-121-2/+2
|
* Rename copy_user() to memcpy_user(). Add memmove_user() andMichael Brown2007-01-121-1/+1
| | | | userptr_add().
* Provide registration mechanism for loaded images, so that we can e.g.Michael Brown2007-01-121-5/+11
| | | | | | | | refer to them by name from the command line, or build them into a multiboot module list. Use setting image->type to disambiguate between "not my image" and "bad image"; this avoids relying on specific values of the error code.
* Add placeholder elf_execute()Michael Brown2007-01-111-0/+11
|
* Limit -ENOEXEC to mean "this is not in my format".Michael Brown2007-01-111-3/+3
|
* Use generic "struct image" rather than "struct elf".Michael Brown2007-01-111-11/+18
|
* Create include/gpxe/elf.h for the ELF bits that aren't part of the ELFMichael Brown2007-01-111-8/+4Star
| | | | standard and so don't belong in include/elf.h
* Removed the Etherboot-specific ELF-image code and replaced it with aMichael Brown2007-01-111-0/+130
| | | | generic ELF loader, to be used by the multiboot code.
* Remove osloader.c and replace with a prep_segment() that uses userptr_tMichael Brown2007-01-111-0/+72
and get_memmap() in image/segment.c