* grub-core/loader/arm/linux.c: Use common initrd functions.

This commit is contained in:
Vladimir Serbinenko 2013-12-18 07:34:28 +01:00
parent 57a691b7e7
commit bc8dd11952
2 changed files with 12 additions and 11 deletions

View file

@ -1,3 +1,7 @@
2013-12-18 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/loader/arm/linux.c: Use common initd functions.
2013-12-18 Vladimir Serbinenko <phcoder@gmail.com> 2013-12-18 Vladimir Serbinenko <phcoder@gmail.com>
Decrease number of strings to translate. Decrease number of strings to translate.

View file

@ -27,6 +27,7 @@
#include <grub/cache.h> #include <grub/cache.h>
#include <grub/cpu/linux.h> #include <grub/cpu/linux.h>
#include <grub/lib/cmdline.h> #include <grub/lib/cmdline.h>
#include <grub/linux.h>
GRUB_MOD_LICENSE ("GPLv3+"); GRUB_MOD_LICENSE ("GPLv3+");
@ -265,7 +266,8 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
int argc, char *argv[]) int argc, char *argv[])
{ {
grub_file_t file; grub_file_t file;
int size; grub_size_t size = 0;
struct grub_linux_initrd_context initrd_ctx;
if (argc == 0) if (argc == 0)
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected")); return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
@ -274,10 +276,11 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
if (!file) if (!file)
return grub_errno; return grub_errno;
size = grub_file_size (file); if (grub_initrd_init (argc, argv, &initrd_ctx))
if (size == 0)
goto fail; goto fail;
size = grub_get_initrd_size (&initrd_ctx);
if (initrd_start) if (initrd_start)
grub_free ((void *) initrd_start); grub_free ((void *) initrd_start);
#ifdef GRUB_MACHINE_EFI #ifdef GRUB_MACHINE_EFI
@ -295,14 +298,8 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
grub_dprintf ("loader", "Loading initrd to 0x%08x\n", grub_dprintf ("loader", "Loading initrd to 0x%08x\n",
(grub_addr_t) initrd_start); (grub_addr_t) initrd_start);
if (grub_file_read (file, (void *) initrd_start, size) != size) if (grub_initrd_load (&initrd_ctx, argv, (void *) initrd_start))
{ goto fail;
initrd_start = 0;
if (!grub_errno)
grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
argv[0]);
goto fail;
}
initrd_end = initrd_start + size; initrd_end = initrd_start + size;