iPXE
|
NBI image format. More...
#include <errno.h>
#include <assert.h>
#include <realmode.h>
#include <memsizes.h>
#include <basemem_packet.h>
#include <ipxe/uaccess.h>
#include <ipxe/segment.h>
#include <ipxe/init.h>
#include <ipxe/netdevice.h>
#include <ipxe/fakedhcp.h>
#include <ipxe/image.h>
#include <ipxe/features.h>
#include <ipxe/version.h>
Go to the source code of this file.
Data Structures | |
struct | imgheader |
An NBI image header. More... | |
struct | segheader |
An NBI segment header. More... | |
struct | ebinfo |
Macros | |
#define | NBI_MAGIC 0x1B031336UL |
NBI magic number. More... | |
#define | NBI_NONVENDOR_LENGTH(len) ( ( (len) & 0x0f ) << 2 ) |
#define | NBI_VENDOR_LENGTH(len) ( ( (len) & 0xf0 ) >> 2 ) |
#define | NBI_LENGTH(len) ( NBI_NONVENDOR_LENGTH(len) + NBI_VENDOR_LENGTH(len) ) |
#define | NBI_PROGRAM_RETURNS(flags) ( (flags) & ( 1 << 8 ) ) |
#define | NBI_LINEAR_EXEC_ADDR(flags) ( (flags) & ( 1 << 31 ) ) |
#define | NBI_HEADER_LENGTH 512 |
NBI header length. More... | |
#define | NBI_LOADADDR_FLAGS(flags) ( (flags) & 0x03 ) |
#define | NBI_LOADADDR_ABS 0x00 |
#define | NBI_LOADADDR_AFTER 0x01 |
#define | NBI_LOADADDR_END 0x02 |
#define | NBI_LOADADDR_BEFORE 0x03 |
#define | NBI_LAST_SEGHEADER(flags) ( (flags) & ( 1 << 2 ) ) |
Functions | |
FEATURE (FEATURE_IMAGE, "NBI", DHCP_EB_FEATURE_NBI, 1) | |
static int | nbi_prepare_segment (struct image *image, size_t offset __unused, userptr_t dest, size_t filesz, size_t memsz) |
Prepare a segment for an NBI image. More... | |
static int | nbi_load_segment (struct image *image, size_t offset, userptr_t dest, size_t filesz, size_t memsz __unused) |
Load a segment for an NBI image. More... | |
static int | nbi_process_segments (struct image *image, struct imgheader *imgheader, int(*process)(struct image *image, size_t offset, userptr_t dest, size_t filesz, size_t memsz)) |
Process segments of an NBI image. More... | |
static int | nbi_boot16 (struct image *image, struct imgheader *imgheader) |
Boot a 16-bit NBI image. More... | |
static int | nbi_boot32 (struct image *image, struct imgheader *imgheader) |
Boot a 32-bit NBI image. More... | |
static int | nbi_prepare_dhcp (struct image *image) |
Prepare DHCP parameter block for NBI image. More... | |
static int | nbi_exec (struct image *image) |
Execute a loaded NBI image. More... | |
static int | nbi_probe (struct image *image) |
Probe NBI image. More... | |
struct image_type nbi_image_type | __image_type (PROBE_NORMAL) |
NBI image type. More... | |
NBI image format.
The Net Boot Image format is defined by the "Draft Net Boot Image Proposal 0.3" by Jamie Honan, Gero Kuhlmann and Ken Yap. It is now considered to be a legacy format, but it still included because a large amount of software (e.g. nymph, LTSP) makes use of NBI files.
Etherboot does not implement the INT 78 callback interface described by the NBI specification. For a callback interface on x86 architecture, use PXE.
Definition in file nbi.c.
#define NBI_LENGTH | ( | len | ) | ( NBI_NONVENDOR_LENGTH(len) + NBI_VENDOR_LENGTH(len) ) |
FEATURE | ( | FEATURE_IMAGE | , |
"NBI" | , | ||
DHCP_EB_FEATURE_NBI | , | ||
1 | |||
) |
|
static |
Prepare a segment for an NBI image.
image | NBI image |
offset | Offset within NBI image |
filesz | Length of initialised-data portion of the segment |
memsz | Total length of the segment |
src | Source for initialised data |
rc | Return status code |
Definition at line 108 of file nbi.c.
References DBGC, dest, prep_segment(), rc, and strerror().
Referenced by nbi_exec().
|
static |
Load a segment for an NBI image.
image | NBI image |
offset | Offset within NBI image |
filesz | Length of initialised-data portion of the segment |
memsz | Total length of the segment |
src | Source for initialised data |
rc | Return status code |
Definition at line 131 of file nbi.c.
References image::data, dest, memcpy_user(), and offset.
Referenced by nbi_exec().
|
static |
Process segments of an NBI image.
image | NBI image |
imgheader | Image header information |
process | Function to call for each segment |
rc | Return status code |
Definition at line 146 of file nbi.c.
References assert(), copy_from_user(), image::data, DBGC, dest, ENOEXEC, extmemsize(), segheader::flags, segheader::imglength, image::len, imgheader::length, segheader::length, segheader::loadaddr, imgheader::location, segheader::memlength, NBI_HEADER_LENGTH, NBI_LAST_SEGHEADER, NBI_LENGTH, NBI_LOADADDR_ABS, NBI_LOADADDR_AFTER, NBI_LOADADDR_BEFORE, NBI_LOADADDR_END, NBI_LOADADDR_FLAGS, offset, segoff::offset, phys_to_user(), rc, real_to_user(), segoff::segment, and userptr_add().
Referenced by nbi_exec().
Boot a 16-bit NBI image.
imgheader | Image header information |
rc | Return status code, if image returns |
Definition at line 242 of file nbi.c.
References __asm__(), __from_data16, __volatile__(), basemem_packet, DBGC, discard_D, discard_S, imgheader::execaddr, imgheader::location, segoff::offset, rc, REAL_CODE, segoff::segment, and imgheader::segoff.
Referenced by nbi_exec().
Boot a 32-bit NBI image.
imgheader | Image header information |
rc | Return status code, if image returns |
Definition at line 280 of file nbi.c.
References __asm__(), __volatile__(), basemem_packet, DBGC, discard_D, discard_S, imgheader::execaddr, imgheader::linear, imgheader::location, segoff::offset, PHYS_CODE, product_major_version, product_minor_version, rc, segoff::segment, and virt_to_phys().
Referenced by nbi_exec().
|
static |
Prepare DHCP parameter block for NBI image.
image | NBI image |
rc | Return status code |
Definition at line 318 of file nbi.c.
References basemem_packet, create_fakedhcpack(), DBGC, ENODEV, last_opened_netdev(), and rc.
Referenced by nbi_exec().
|
static |
Execute a loaded NBI image.
image | NBI image |
rc | Return status code |
Definition at line 344 of file nbi.c.
References copy_from_user(), image::data, DBGC, imgheader::flags, imgheader::location, nbi_boot16(), nbi_boot32(), NBI_LINEAR_EXEC_ADDR, nbi_load_segment(), nbi_prepare_dhcp(), nbi_prepare_segment(), nbi_process_segments(), NBI_PROGRAM_RETURNS, segoff::offset, rc, segoff::segment, and shutdown_boot().
|
static |
Probe NBI image.
image | NBI image |
rc | Return status code |
Definition at line 403 of file nbi.c.
References copy_from_user(), image::data, DBGC, ENOEXEC, image::len, imgheader::magic, NBI_HEADER_LENGTH, and NBI_MAGIC.
struct image_type nbi_image_type __image_type | ( | PROBE_NORMAL | ) |
NBI image type.