projects
/
debian
/
elilo
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
restore patches lost when merging NMU diff
[debian/elilo]
/
initrd.c
diff --git
a/initrd.c
b/initrd.c
index 92b6f44008afe0692cb6a50dd03fa624ecc4fc91..581abda225eeb66b2fb382892e26dfe402f84127 100644
(file)
--- a/
initrd.c
+++ b/
initrd.c
@@
-29,7
+29,7
@@
#include "elilo.h"
/*
#include "elilo.h"
/*
- * This function allocates memory for
the initial ramdisk (initrd)
and loads it to memory
+ * This function allocates memory for
file image
and loads it to memory
* OUTPUTS:
* - ELILO_LOAD_SUCCESS: if everything works
* - ELILO_LOAD_ABORTED: in case the user decided to abort loading
* OUTPUTS:
* - ELILO_LOAD_SUCCESS: if everything works
* - ELILO_LOAD_ABORTED: in case the user decided to abort loading
@@
-38,12
+38,12
@@
* Adapted from Bill Nottingham <notting@redhat.com> patch for ELI.
*/
INTN
* Adapted from Bill Nottingham <notting@redhat.com> patch for ELI.
*/
INTN
-load_
initrd(CHAR16 *filename, memdesc_t *initrd
)
+load_
file(CHAR16 *filename, memdesc_t *image
)
{
EFI_STATUS status;
{
EFI_STATUS status;
- VOID *start_addr = initrd->start_addr;
- UINT64 size = 0;
+ VOID *start_addr = NULL;
UINTN pgcnt;
UINTN pgcnt;
+ UINT64 size = 0;
fops_fd_t fd;
INTN ret = ELILO_LOAD_ERROR;
fops_fd_t fd;
INTN ret = ELILO_LOAD_ERROR;
@@
-53,46
+53,48
@@
load_initrd(CHAR16 *filename, memdesc_t *initrd)
/* Open the file */
status = fops_open(filename, &fd);
if (EFI_ERROR(status)) {
/* Open the file */
status = fops_open(filename, &fd);
if (EFI_ERROR(status)) {
- ERR_PRT((L"Open
initrd
file %s failed: %r", filename, status));
+ ERR_PRT((L"Open file %s failed: %r", filename, status));
return -1;
}
return -1;
}
- DBG_PRT((L"
initrd_
open %s worked", filename));
+ DBG_PRT((L"open %s worked", filename));
/* warning: this function allocates memory */
status = fops_infosize(fd, &size);
if (EFI_ERROR(status)) {
/* warning: this function allocates memory */
status = fops_infosize(fd, &size);
if (EFI_ERROR(status)) {
- ERR_PRT((L"Couldn't read
initrd file %s info %r",
filename, status));
+ ERR_PRT((L"Couldn't read
file %s info %r",
filename, status));
goto error;
}
goto error;
}
- /* round up to get required number of pages (4KB) */
- initrd->pgcnt = pgcnt = EFI_SIZE_TO_PAGES(size);
-
+ image->size = size;
+ /* round up to get required number of pages (4KB) */
+ image->pgcnt = pgcnt = EFI_SIZE_TO_PAGES(image->size);
- start_addr = alloc_pages(pgcnt, EfiLoaderData, start_addr ? AllocateAddress : AllocateAnyPages,
start_addr
);
+ start_addr = alloc_pages(pgcnt, EfiLoaderData, start_addr ? AllocateAddress : AllocateAnyPages,
0
);
if (start_addr == NULL) {
if (start_addr == NULL) {
- ERR_PRT((L"Failed to allocate %d pages for initrd", pgcnt));
+ ERR_PRT((L"Failed to allocate %d pages for %s image", pgcnt,
+ filename));
goto error;
}
goto error;
}
- VERB_PRT(2, Print(L"initrd: total_size: %ld bytes base: 0x%lx pages %d\n",
- size, (UINT64)start_addr, pgcnt));
+ VERB_PRT(2, Print(L"%s image: total_size: %d bytes base: " PTR_FMT " "
+ "pages %d\n", filename, image->size,
+ start_addr, pgcnt));
- Print(L"Loading
initrd
%s...", filename);
+ Print(L"Loading
file
%s...", filename);
- ret = read_file(fd,
size, start_addr);
+ ret = read_file(fd,
image->size, start_addr);
fops_close(fd);
if (ret != ELILO_LOAD_SUCCESS) {
fops_close(fd);
if (ret != ELILO_LOAD_SUCCESS) {
- ERR_PRT((L"read i
nitrd
(%s) failed: %d", filename, ret));
+ ERR_PRT((L"read i
mage
(%s) failed: %d", filename, ret));
goto error;
}
Print(L"done\n");
goto error;
}
Print(L"done\n");
- i
nitrd
->start_addr = start_addr;
+ i
mage
->start_addr = start_addr;
return ELILO_LOAD_SUCCESS;
return ELILO_LOAD_SUCCESS;
@@
-103,8
+105,9
@@
error:
* make sure nothing is passed to kernel
* in case of error.
*/
* make sure nothing is passed to kernel
* in case of error.
*/
- initrd->start_addr = 0;
- initrd->pgcnt = 0;
+ image->start_addr = 0;
+ image->pgcnt = 0;
+ image->size = 0;
return ret;
}
return ret;
}