68 DBGC (
image,
"LKRN %s bad magic value %#08x\n",
75 if (
ctx->offset & (
ctx->offset - 1 ) ) {
76 DBGC (
image,
"LKRN %s offset %#zx is not a power of two\n",
84 if (
ctx->filesz >
ctx->memsz ) {
85 DBGC (
image,
"LKRN %s invalid image size %#zx/%#zx\n",
109 DBGC (
image,
"LKRN %s RAM starts at %#08lx\n",
125 static struct image fdtimg = {
148 DBGC (
image,
"LKRN %s loading to [%#08lx,%#08lx,%#08lx)\n",
150 (
ctx.entry +
ctx.memsz ) );
154 ctx.initrd = ( (
ctx.initrd +
ctx.offset - 1 ) & ~(
ctx.offset - 1 ) );
157 DBGC (
image,
"LKRN %s initrd at [%#08lx,%#08lx)\n",
166 initrdsz ) ) != 0 ) {
172 DBGC (
image,
"LKRN %s FDT at [%08lx,%08lx)\n",
177 DBGC (
image,
"LKRN %s no available region: %s\n",
183 totalsz = (
ctx.fdt + fdtimg.
len -
ctx.ram );
184 if ( (
ctx.entry >= region.
min ) &&
187 DBGC (
image,
"LKRN %s fits within reshuffle region\n",
192 totalsz, totalsz ) ) != 0 ) {
193 DBGC (
image,
"LKRN %s could not prepare segment: " 213 dest = phys_to_virt (
ctx.entry );
218 dest = phys_to_virt (
ctx.initrd );
222 DBGC (
image,
"LKRN %s jumping to kernel at %#08lx\n",
279 memset ( zctx, 0,
sizeof ( *zctx ) );
282 if (
image->
len < sizeof ( *zhdr ) ) {
283 DBGC (
image,
"ZIMG %s too short for header\n",
291 DBGC (
image,
"ZIMG %s bad magic value %#08x\n",
301 DBGC (
image,
"ZIMG %s bad range [+%#zx,+%#zx)/%#zx\n",
328 DBGC (
image,
"ZIMG %s has %s-compressed payload at [+%#zx,+%#zx)\n",
335 DBGC (
image,
"ZIMG %s could not extract: %s\n",
357 DBGC (
image,
"ZIMG %s is a %s-compressed Linux kernel\n",
size_t offset
Offset to compressed data.
struct arbelprm_rc_send_wqe rc
#define le32_to_cpu(value)
#define list_add(new, head)
Add a new entry to the head of a list.
const void * data
Read-only data.
struct golan_inbox_hdr hdr
Message header.
#define ENOEXEC
Exec format error.
An executable image type.
#define PROBE_NORMAL
Normal image probe priority.
int initrd_region(size_t len, struct memmap_region *region)
Calculate post-reshuffle initrd load region.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
Compressed kernel image context.
static int lkrn_probe(struct image *image)
Probe kernel image.
struct golan_eq_context ctx
static size_t initrd_align(size_t len)
Align initrd length.
void initrd_reshuffle(void)
Reshuffle initrds into desired order at top of memory.
#define ECANCELED
Operation canceled.
char * name
Name of this image type.
#define ENOTSUP
Operation not supported.
char * cmdline
Command line to pass to image.
#define list_del(list)
Delete an entry from a list.
Executable image segments.
void free_image(struct refcnt *refcnt)
Free executable image.
static int zimg_probe(struct image *image)
Probe compressed kernel image.
static int lkrn_ram(struct image *image, struct lkrn_context *ctx)
Locate start of RAM.
#define IMAGE_STATIC
Image is statically allocated.
#define be32_to_cpu(value)
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
Access to external ("user") memory.
struct image_type lkrn_image_type __image_type(PROBE_NORMAL)
Linux kernel image type.
#define for_each_memmap(region, hide)
Iterate over memory regions.
#define list_add_tail(new, head)
Add a new entry to the tail of a list.
size_t initrd_load_all(void *address)
Load all initrds.
void fdt_remove(struct fdt_header *hdr)
Remove device tree.
#define cpu_to_le32(value)
char * strerror(int errno)
Retrieve string representation of error number.
void lkrn_jump(physaddr_t entry, physaddr_t fdt)
Jump to kernel entry point.
union zimg_context::@637 type
Compression type.
unsigned int flags
Region flags.
size_t len
Length of raw file image.
struct list_head images
List of registered images.
#define ZIMG_MAGIC
Compressed kernel image magic value.
static int lkrn_exec(struct image *image)
Execute kernel image.
size_t len
Length of compressed data.
void * memmove(void *dest, const void *src, size_t len) __nonnull
int image_set_data(struct image *image, const void *data, size_t len)
Set image data.
Initial ramdisk (initrd) reshuffling.
static int zimg_extract(struct image *image, struct image *extracted)
Extract compresed kernel image.
static int lkrn_parse(struct image *image, struct lkrn_context *ctx)
Parse kernel image.
static uint64_t memmap_size(const struct memmap_region *region)
Get remaining size of memory region (from the described address upwards)
#define MEMMAP_FL_MEMORY
Contains memory.
#define IMAGE_STATIC_NAME
Image name is statically allocated.
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
#define REF_INIT(free_fn)
Initialise a static reference counter.
uint64_t min
Minimum address in region.
int prep_segment(void *segment, size_t filesz, size_t memsz)
Prepare segment for loading.
A memory region descriptor.
struct list_head list
List of registered images.
#define le64_to_cpu(value)
static void shutdown_boot(void)
Shut down system for OS boot.
int fdt_create(struct fdt_header **hdr, const char *cmdline, physaddr_t initrd, size_t initrd_len)
Create device tree.
char string[5]
Printable string.
static int zimg_parse(struct image *image, struct zimg_context *zctx)
Parse compressed kernel image.
int image_extract_exec(struct image *image)
Extract and execute image.
void * memset(void *dest, int character, size_t len) __nonnull
struct refcnt refcnt
Reference count.