99 memset ( bzimg, 0,
sizeof ( *bzimg ) );
103 DBGC (
image,
"bzImage %s too short for kernel header\n",
113 DBGC (
image,
"bzImage %s too short for %zd byte of setup\n",
125 DBGC (
image,
"bzImage %s missing 55AA signature\n",
142 DBGC (
image,
"bzImage %s bad syssize %x (expected " 150 is_bzimage = ( ( bzimg->
version >= 0x0200 ) ?
180 DBGC (
image,
"bzImage %s version %04x RM %#lx+%#zx PM %#lx+%#zx " 201 if ( bzimg->
version >= 0x0200 )
205 if ( bzimg->
version >= 0x0201 ) {
211 if ( bzimg->
version >= 0x0202 ) {
218 if ( bzimg->
version >= 0x0200 )
228 if ( bzimg->
version >= 0x0200 ) {
250 sep =
strchr ( vga,
' ' );
253 if (
strcmp ( vga,
"normal" ) == 0 ) {
255 }
else if (
strcmp ( vga,
"ext" ) == 0 ) {
257 }
else if (
strcmp ( vga,
"ask" ) == 0 ) {
262 DBGC (
image,
"bzImage %s strange \"vga=\" " 291 DBGC (
image,
"bzImage %s strange \"mem=\" " 315 DBGC (
image,
"bzImage %s command line \"%s\"\n",
343 DBGC (
image,
"bzImage %s no region for initrds: %s\n",
360 DBGC (
image,
"bzImage %s not enough space for initrds\n",
366 DBGC (
image,
"bzImage %s not enough space for initrds\n",
372 DBGC (
image,
"bzImage %s loading initrds from %#08lx downwards\n",
395 DBGC (
image,
"bzImage %s initrds at [%#08lx,%#08lx)\n",
419 DBGC (
image,
"bzImage %s could not prepare RM segment: %s\n",
424 bzimg.
pm_sz ) ) != 0 ) {
425 DBGC (
image,
"bzImage %s could not prepare PM segment: %s\n",
460 DBGC (
image,
"bzImage %s jumping to RM kernel at %04x:0000 (stack " static void bzimage_load_initrds(struct image *image, struct bzimage_context *bzimg)
Load initrds, if any.
static int bzimage_exec(struct image *image)
Execute bzImage image.
#define BZI_CMDLINE_MAGIC
bzImage command line present magic marker value
FEATURE(FEATURE_IMAGE, "bzImage", DHCP_EB_FEATURE_BZIMAGE, 1)
struct arbelprm_rc_send_wqe rc
size_t rm_heap
Real-mode heap top (offset from rm_kernel)
unsigned long strtoul(const char *string, char **endp, int base)
Convert string to numeric value.
#define BZI_CMDLINE_SIZE
Maximum size of command line.
uint64_t max
Maximum address in region.
const void * data
Read-only data.
#define ENOEXEC
Exec format error.
size_t rm_cmdline
Command line (offset from rm_kernel)
static struct image * image_get(struct image *image)
Increment reference count on an image.
size_t rm_filesz
Real-mode kernel portion file size.
An executable image type.
size_t rm_memsz
Real-mode kernel portion total memory size.
#define PROBE_NORMAL
Normal image probe priority.
unsigned long long uint64_t
int initrd_region(size_t len, struct memmap_region *region)
Calculate post-reshuffle initrd load region.
#define FEATURE_IMAGE
Image formats.
#define BZI_CMDLINE_OFFSET
Offset of bzImage command-line structure within kernel image.
int bzimage_probe(struct image *image)
Probe bzImage image.
void * rm_kernel
Real-mode kernel portion load address.
void initrd_reshuffle(void)
Reshuffle initrds into desired order at top of memory.
#define ECANCELED
Operation canceled.
char * name
Name of this image type.
char * cmdline
Command line to pass to image.
static __always_inline void * real_to_virt(unsigned int segment, unsigned int offset)
Convert segment:offset address to virtual address.
#define INITRD_ALIGN
Initial ramdisk chunk alignment.
#define BZI_VID_MODE_ASK
bzImage special video mode "ask"
#define DHCP_EB_FEATURE_BZIMAGE
bzImage format
Executable image segments.
#define BZI_SIGNATURE
bzImage magic signature value
#define BZI_LOAD_HIGH_ADDR
Load address for high-loaded kernels.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
#define BZI_CAN_USE_HEAP
bzImage "kernel can use heap" flag
#define BZI_LOAD_LOW_ADDR
Load address for low-loaded kernels.
void * initrd
Initrd address.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
Access to external ("user") memory.
static int bzimage_parse_header(struct image *image, struct bzimage_context *bzimg)
Parse bzImage header.
unsigned int rm_kernel_seg
Real-mode kernel portion load segment address.
size_t initrd_load_all(void *address)
Load all initrds.
static int bzimage_parse_cmdline(struct image *image, struct bzimage_context *bzimg)
Parse kernel command line for bootloader parameters.
#define BZI_STACK_SIZE
Amount of stack space to provide.
static void bzimage_set_cmdline(struct image *image, struct bzimage_context *bzimg)
Set command line.
#define BZI_LOADER_TYPE_IPXE
bzImage boot loader identifier for iPXE
size_t cmdline_size
Command line maximum length.
#define BZI_HDR_OFFSET
Offset of bzImage header within kernel image.
static int bzimage_check_initrds(struct image *image, struct bzimage_context *bzimg)
Check that initrds can be loaded.
#define BZI_BOOT_FLAG
bzImage boot flag value
struct image_type bzimage_image_type __image_type(PROBE_NORMAL)
Linux bzImage image type.
char * strerror(int errno)
Retrieve string representation of error number.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
size_t len
Length of raw file image.
char * strchr(const char *src, int character)
Find character within a string.
void * pm_kernel
Non-real-mode kernel portion load address.
__asm__ __volatile__("call *%9" :"=a"(result), "=c"(discard_ecx), "=d"(discard_edx) :"d"(0), "a"(code), "b"(0), "c"(in_phys), "D"(0), "S"(out_phys), "m"(hypercall))
#define BZI_VID_MODE_EXT
bzImage special video mode "ext"
#define BZI_INITRD_MAX
bzImage maximum initrd address for versions < 2.03
void unregister_image(struct image *image)
Unregister executable image.
Initial ramdisk (initrd) reshuffling.
physaddr_t initrd_size
Initrd size.
__asm__(".section \".rodata\", \"a\", " PROGBITS "\n\t" "\nprivate_key_data:\n\t" ".size private_key_data, ( . - private_key_data )\n\t" ".equ private_key_len, ( . - private_key_data )\n\t" ".previous\n\t")
#define ENOBUFS
No buffer space available.
int strcmp(const char *first, const char *second)
Compare strings.
unsigned int vid_mode
Video mode.
const char * image_argument(struct image *image, const char *key)
Find argument within image command line.
static void bzimage_update_header(struct image *image, struct bzimage_context *bzimg)
Update bzImage header in loaded kernel.
if(len >=6 *4) __asm__ __volatile__("movsl" if(len >=5 *4) __asm__ __volatile__("movsl" if(len >=4 *4) __asm__ __volatile__("movsl" if(len >=3 *4) __asm__ __volatile__("movsl" if(len >=2 *4) __asm__ __volatile__("movsl" if(len >=1 *4) __asm__ __volatile__("movsl" if((len % 4) >=2) __asm__ __volatile__("movsw" if((len % 2) >=1) __asm__ __volatile__("movsb" return dest
uint32_t end
Ending offset.
uint16_t syssize
DO NOT USE - for bootsect.S use only.
size_t pm_sz
Non-real-mode kernel portion file and memory size.
#define BZI_ASSUMED_RM_SIZE
Assumed size of real-mode portion (including .bss)
uint64_t min
Minimum address in region.
int snprintf(char *buf, size_t size, const char *fmt,...)
Write a formatted string to a buffer.
#define BZI_LOAD_HIGH
bzImage "load high" flag
int prep_segment(void *segment, size_t filesz, size_t memsz)
Prepare segment for loading.
#define BZI_VID_MODE_NORMAL
bzImage special video mode "normal"
A memory region descriptor.
bzImage command-line structure used by older kernels
unsigned int version
Boot protocol version.
static void shutdown_boot(void)
Shut down system for OS boot.
#define REAL_CODE(asm_code_str)
uint64_t mem_limit
Memory limit.
void * memset(void *dest, int character, size_t len) __nonnull