From bc8dd119520f44a11271aecf6d0dcf2a02324da1 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Wed, 18 Dec 2013 07:34:28 +0100 Subject: [PATCH] * grub-core/loader/arm/linux.c: Use common initrd functions. --- ChangeLog | 4 ++++ grub-core/loader/arm/linux.c | 19 ++++++++----------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index fdf8c7fb2..f6e3800a5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-12-18 Vladimir Serbinenko + + * grub-core/loader/arm/linux.c: Use common initd functions. + 2013-12-18 Vladimir Serbinenko Decrease number of strings to translate. diff --git a/grub-core/loader/arm/linux.c b/grub-core/loader/arm/linux.c index 7041743aa..14a34bfbf 100644 --- a/grub-core/loader/arm/linux.c +++ b/grub-core/loader/arm/linux.c @@ -27,6 +27,7 @@ #include #include #include +#include GRUB_MOD_LICENSE ("GPLv3+"); @@ -265,7 +266,8 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), int argc, char *argv[]) { grub_file_t file; - int size; + grub_size_t size = 0; + struct grub_linux_initrd_context initrd_ctx; if (argc == 0) 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) return grub_errno; - size = grub_file_size (file); - if (size == 0) + if (grub_initrd_init (argc, argv, &initrd_ctx)) goto fail; + size = grub_get_initrd_size (&initrd_ctx); + if (initrd_start) grub_free ((void *) initrd_start); #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_addr_t) initrd_start); - if (grub_file_read (file, (void *) initrd_start, size) != size) - { - initrd_start = 0; - if (!grub_errno) - grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), - argv[0]); - goto fail; - } + if (grub_initrd_load (&initrd_ctx, argv, (void *) initrd_start)) + goto fail; initrd_end = initrd_start + size;