iPXE
|
Linux bzImage image format. More...
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <assert.h>
#include <realmode.h>
#include <bzimage.h>
#include <initrd.h>
#include <ipxe/uaccess.h>
#include <ipxe/image.h>
#include <ipxe/segment.h>
#include <ipxe/init.h>
#include <ipxe/cpio.h>
#include <ipxe/features.h>
Go to the source code of this file.
Data Structures | |
struct | bzimage_context |
bzImage context More... | |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
FEATURE (FEATURE_IMAGE, "bzImage", DHCP_EB_FEATURE_BZIMAGE, 1) | |
static int | bzimage_parse_header (struct image *image, struct bzimage_context *bzimg, userptr_t src) |
Parse bzImage header. More... | |
static void | bzimage_update_header (struct image *image, struct bzimage_context *bzimg, userptr_t dst) |
Update bzImage header in loaded kernel. More... | |
static int | bzimage_parse_cmdline (struct image *image, struct bzimage_context *bzimg) |
Parse kernel command line for bootloader parameters. More... | |
static void | bzimage_set_cmdline (struct image *image, struct bzimage_context *bzimg) |
Set command line. More... | |
static size_t | bzimage_align (size_t len) |
Align initrd length. More... | |
static size_t | bzimage_load_initrd (struct image *image, struct image *initrd, userptr_t address) |
Load initrd. More... | |
static int | bzimage_check_initrds (struct image *image, struct bzimage_context *bzimg) |
Check that initrds can be loaded. More... | |
static void | bzimage_load_initrds (struct image *image, struct bzimage_context *bzimg) |
Load initrds, if any. More... | |
static int | bzimage_exec (struct image *image) |
Execute bzImage image. More... | |
int | bzimage_probe (struct image *image) |
Probe bzImage image. More... | |
struct image_type bzimage_image_type | __image_type (PROBE_NORMAL) |
Linux bzImage image type. More... | |
Linux bzImage image format.
Definition in file bzimage.c.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
FEATURE | ( | FEATURE_IMAGE | , |
"bzImage" | , | ||
DHCP_EB_FEATURE_BZIMAGE | , | ||
1 | |||
) |
|
static |
Parse bzImage header.
image | bzImage file |
bzimg | bzImage context |
src | bzImage to parse |
rc | Return status code |
Definition at line 97 of file bzimage.c.
References bzimage_header::boot_flag, bzimage_context::bzhdr, BZI_ASSUMED_RM_SIZE, BZI_BOOT_FLAG, BZI_CMDLINE_OFFSET, BZI_CMDLINE_SIZE, BZI_HDR_OFFSET, BZI_INITRD_MAX, BZI_LOAD_HIGH, BZI_LOAD_HIGH_ADDR, BZI_LOAD_LOW_ADDR, BZI_SIGNATURE, BZI_STACK_SIZE, bzimage_context::cmdline_magic, bzimage_context::cmdline_size, bzimage_header::cmdline_size, copy_from_user(), DBGC, ENOEXEC, bzimage_header::header, bzimage_header::initrd_addr_max, image::len, bzimage_header::loadflags, bzimage_context::mem_limit, memset(), phys_to_user(), bzimage_context::pm_kernel, bzimage_context::pm_sz, real_to_user(), bzimage_context::rm_cmdline, bzimage_context::rm_filesz, bzimage_context::rm_heap, bzimage_context::rm_kernel, bzimage_context::rm_kernel_seg, bzimage_context::rm_memsz, bzimage_header::setup_sects, src, syssize, bzimage_header::syssize, user_to_phys(), bzimage_header::version, bzimage_context::version, bzimage_header::vid_mode, and bzimage_context::vid_mode.
Referenced by bzimage_exec(), and bzimage_probe().
|
static |
Update bzImage header in loaded kernel.
image | bzImage file |
bzimg | bzImage context |
dst | bzImage to update |
Definition at line 202 of file bzimage.c.
References bzimage_context::bzhdr, BZI_CAN_USE_HEAP, BZI_CMDLINE_MAGIC, BZI_CMDLINE_OFFSET, BZI_HDR_OFFSET, BZI_LOADER_TYPE_IPXE, bzimage_header::cmd_line_ptr, bzimage_context::cmdline_magic, copy_to_user(), DBGC, bzimage_header::heap_end_ptr, bzimage_header::loadflags, bzimage_cmdline::magic, bzimage_cmdline::offset, bzimage_header::ramdisk_image, bzimage_context::ramdisk_image, bzimage_header::ramdisk_size, bzimage_context::ramdisk_size, bzimage_context::rm_cmdline, bzimage_context::rm_heap, bzimage_context::rm_kernel, bzimage_context::rm_memsz, bzimage_header::setup_move_size, bzimage_header::type_of_loader, user_to_phys(), bzimage_context::version, bzimage_header::vid_mode, and bzimage_context::vid_mode.
Referenced by bzimage_exec().
|
static |
Parse kernel command line for bootloader parameters.
image | bzImage file |
bzimg | bzImage context |
rc | Return status code |
Definition at line 252 of file bzimage.c.
References BZI_VID_MODE_ASK, BZI_VID_MODE_EXT, BZI_VID_MODE_NORMAL, DBGC, end, image_argument(), bzimage_context::mem_limit, strchr(), strcmp(), strtoul(), and bzimage_context::vid_mode.
Referenced by bzimage_exec().
|
static |
Set command line.
image | bzImage image |
bzimg | bzImage context |
Definition at line 317 of file bzimage.c.
References cmdline, image::cmdline, bzimage_context::cmdline_size, copy_to_user(), DBGC, bzimage_context::rm_cmdline, bzimage_context::rm_kernel, and strlen().
Referenced by bzimage_exec().
Align initrd length.
len | Length |
len | Length rounded up to INITRD_ALIGN |
Definition at line 337 of file bzimage.c.
References INITRD_ALIGN, and len.
Referenced by bzimage_check_initrds(), and bzimage_load_initrds().
|
static |
Load initrd.
image | bzImage image |
initrd | initrd image |
address | Address at which to load, or UNULL |
len | Length of loaded image, excluding zero-padding |
Definition at line 350 of file bzimage.c.
References address, assert(), copy_to_user(), cpio_header(), cpio_name(), cpio_pad_len(), image::data, DBGC, DBGC2_MD5A, image::flags, IMAGE_HIDDEN, INITRD_ALIGN, len, image::len, memmove_user(), memset_user(), offset, pad_len, user_to_phys(), and user_to_virt().
Referenced by bzimage_check_initrds(), and bzimage_load_initrds().
|
static |
Check that initrds can be loaded.
image | bzImage image |
bzimg | bzImage context |
rc | Return status code |
Definition at line 410 of file bzimage.c.
References bottom, bzimage_align(), bzimage_load_initrd(), image::cmdline, image::data, DBGC, DBGC2_MD5A, ENOBUFS, for_each_image, initrd_reshuffle_check(), len, image::len, bzimage_context::mem_limit, bzimage_context::pm_kernel, bzimage_context::pm_sz, rc, strerror(), UNULL, user_to_phys(), user_to_virt(), and userptr_add().
Referenced by bzimage_exec().
|
static |
Load initrds, if any.
image | bzImage image |
bzimg | bzImage context |
Definition at line 463 of file bzimage.c.
References bzimage_align(), bzimage_load_initrd(), image::data, DBGC, dest, for_each_image, INITRD_ALIGN, initrd_reshuffle(), len, image::len, bzimage_context::mem_limit, NULL, offset, phys_to_user(), bzimage_context::pm_kernel, bzimage_context::pm_sz, bzimage_context::ramdisk_image, bzimage_context::ramdisk_size, top, UNULL, user_to_phys(), userptr_add(), and userptr_sub().
Referenced by bzimage_exec().
|
static |
Execute bzImage image.
image | bzImage image |
rc | Return status code |
Definition at line 532 of file bzimage.c.
References __asm__(), __volatile__(), assert(), bzimage_check_initrds(), bzimage_load_initrds(), bzimage_parse_cmdline(), bzimage_parse_header(), bzimage_set_cmdline(), bzimage_update_header(), image::data, DBGC, ECANCELED, image_get(), memcpy_user(), bzimage_context::pm_kernel, bzimage_context::pm_sz, prep_segment(), rc, REAL_CODE, bzimage_context::rm_filesz, bzimage_context::rm_heap, bzimage_context::rm_kernel, bzimage_context::rm_kernel_seg, bzimage_context::rm_memsz, shutdown_boot(), strerror(), and unregister_image().
int bzimage_probe | ( | struct image * | image | ) |
Probe bzImage image.
image | bzImage file |
rc | Return status code |
Definition at line 618 of file bzimage.c.
References bzimage_parse_header(), image::data, and rc.
struct image_type bzimage_image_type __image_type | ( | PROBE_NORMAL | ) |
Linux bzImage image type.