/
githubmirror
/
ipxe
Обзор
Документация
Войти
/
githubmirror
/
ipxe
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v0.9.3
src/image/embedded.c
48 строк
1 KB
Michael Brown
Added the embedded pxelinux payload patch from hpa.
08 янв 2008, 18:51
08 янв 2008, 18:51
74fd544
Код
Авторство
О чём код?
/** @file * * Take a possible embedded image and put it in a struct image * data structure. */ #include <stdio.h> #include <gpxe/image.h> #include <gpxe/malloc.h> #include <gpxe/uaccess.h> #include <gpxe/umalloc.h> #include <gpxe/embedded.h> extern char _embedded_image_start[], _embedded_image_end[]; struct image *embedded_image(void) { static int reclaimed = 0; struct image *image; size_t eisize = _embedded_image_end - _embedded_image_start; if ( !eisize ) return NULL; /* No embedded image */ if ( reclaimed ) return NULL; /* Already reclaimed */ printf("Embedded image: %d bytes at %p\n", eisize, _embedded_image_start); image = alloc_image(); if (!image) return NULL; image->len = eisize; image->data = umalloc(eisize); if (image->data == UNULL) { image_put(image); return image = NULL; } copy_to_user(image->data, 0, _embedded_image_start, eisize); /* Reclaim embedded image memory */ reclaimed = 1; mpopulate(_embedded_image_start, eisize); return image; }