diff --git a/android.c b/android.c index 5dd3923..11741c2 100644 --- a/android.c +++ b/android.c @@ -18,7 +18,7 @@ EFI_STATUS android_open_image(struct android_image *image) { return EFI_SUCCESS; } -EFI_STATUS android_copy_cmdline(struct android_image *image, CHAR8* cmdline, UINTN max_length) { +EFI_STATUS android_copy_cmdline(const struct android_image *image, CHAR8* cmdline, UINTN max_length) { if (max_length <= ANDROID_BOOT_ARGS_SIZE + ANDROID_BOOT_EXTRA_ARGS_SIZE) { return EFI_BUFFER_TOO_SMALL; } diff --git a/android.h b/android.h index 49bcf2b..690d7ab 100644 --- a/android.h +++ b/android.h @@ -38,27 +38,27 @@ struct android_image { EFI_STATUS android_open_image(struct android_image *image); -static inline EFI_STATUS android_read_kernel(struct android_image *image, UINT64 offset, VOID *kernel, UINTN size) { +static inline EFI_STATUS android_read_kernel(const struct android_image *image, UINT64 offset, VOID *kernel, UINTN size) { return image_read(&image->image, image->header.page_size + offset, kernel, size); } -static inline EFI_STATUS android_load_kernel(struct android_image *image, UINT64 offset, VOID *kernel) { +static inline EFI_STATUS android_load_kernel(const struct android_image *image, UINT64 offset, VOID *kernel) { return android_read_kernel(image, offset, kernel, image->header.kernel_size - offset); } -static inline UINT64 android_ramdisk_offset(struct android_image *image) { +static inline UINT64 android_ramdisk_offset(const struct android_image *image) { UINTN mask = image->header.page_size - 1; return image->header.page_size + ((image->header.kernel_size + mask) & ~mask); } -static inline UINT32 android_ramdisk_size(struct android_image *image) { +static inline UINT32 android_ramdisk_size(const struct android_image *image) { return image->header.ramdisk_size; } -static inline EFI_STATUS android_load_ramdisk(struct android_image *image, VOID *ramdisk) { +static inline EFI_STATUS android_load_ramdisk(const struct android_image *image, VOID *ramdisk) { return image_read(&image->image, android_ramdisk_offset(image), ramdisk, android_ramdisk_size(image)); } -EFI_STATUS android_copy_cmdline(struct android_image *image, CHAR8* cmdline, UINTN max_length); +EFI_STATUS android_copy_cmdline(const struct android_image *image, CHAR8* cmdline, UINTN max_length); #endif //ANDROID_EFI_ANDROID_H diff --git a/graphics.c b/graphics.c index fbc8f32..c3967bd 100644 --- a/graphics.c +++ b/graphics.c @@ -8,7 +8,7 @@ static inline UINTN center(UINTN i, UINTN max) { return i < max ? (max - i) / 2 : 0; } -EFI_STATUS graphics_display_image(struct graphics_image *image) { +EFI_STATUS graphics_display_image(const struct graphics_image *image) { EFI_GRAPHICS_OUTPUT_PROTOCOL *graphics_output; EFI_STATUS err = LibLocateProtocol(&GraphicsOutputProtocol, (VOID**) &graphics_output); if (err) { diff --git a/graphics.h b/graphics.h index 431a4e4..692ed8c 100644 --- a/graphics.h +++ b/graphics.h @@ -12,6 +12,6 @@ struct graphics_image { EFI_GRAPHICS_OUTPUT_BLT_PIXEL *blt; }; -EFI_STATUS graphics_display_image(struct graphics_image *image); +EFI_STATUS graphics_display_image(const struct graphics_image *image); #endif //ANDROID_EFI_GRAPHICS_H diff --git a/main.c b/main.c index 7df323e..c2c7c8c 100644 --- a/main.c +++ b/main.c @@ -200,8 +200,8 @@ static EFI_STATUS parse_command_line(EFI_LOADED_IMAGE_PROTOCOL *loaded_image, st return err; } -static EFI_STATUS prepare_cmdline(struct linux_setup_header *kernel_header, struct android_image *android_image, - struct android_efi_options *options) { +static EFI_STATUS prepare_cmdline(struct linux_setup_header *kernel_header, const struct android_image *android_image, + const struct android_efi_options *options) { EFI_STATUS err = linux_allocate_cmdline(kernel_header); if (err) { return err; @@ -243,7 +243,7 @@ static const CHAR8 *find_initrd_option(const CHAR8 *cmdline) { } static EFI_STATUS load_ramdisk_cmdline(EFI_HANDLE loader_device, const CHAR8 *cmdline, - struct linux_setup_header *kernel_header, struct android_image *android_image) { + struct linux_setup_header *kernel_header, const struct android_image *android_image) { EFI_FILE_HANDLE dir = LibOpenRoot(loader_device); if (!dir) { Print(L"Failed to open root directory\n"); @@ -335,7 +335,7 @@ static EFI_STATUS load_ramdisk_cmdline(EFI_HANDLE loader_device, const CHAR8 *cm } static EFI_STATUS load_ramdisk(EFI_HANDLE loader_device, - struct linux_setup_header *kernel_header, struct android_image *android_image) { + struct linux_setup_header *kernel_header, const struct android_image *android_image) { const CHAR8 *initrd = find_initrd_option(linux_cmdline_pointer(kernel_header)); if (initrd) { return load_ramdisk_cmdline(loader_device, initrd, kernel_header, android_image); @@ -350,7 +350,7 @@ static EFI_STATUS load_ramdisk(EFI_HANDLE loader_device, } static EFI_STATUS load_kernel(EFI_HANDLE loader, EFI_HANDLE loader_device, - struct android_efi_options *options, VOID **boot_params) { + const struct android_efi_options *options, VOID **boot_params) { struct android_image android_image; EFI_STATUS err = image_open(&android_image.image, loader, loader_device, options->partition_guid, options->path); if (options->path) { @@ -412,7 +412,7 @@ static EFI_STATUS load_kernel(EFI_HANDLE loader, EFI_HANDLE loader_device, return err; } -extern struct graphics_image splash_image; +extern const struct graphics_image splash_image; EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *system_table) { InitializeLib(image, system_table); diff --git a/png2efi/png2efi.c b/png2efi/png2efi.c index 20588fa..c2a0758 100644 --- a/png2efi/png2efi.c +++ b/png2efi/png2efi.c @@ -20,7 +20,7 @@ static int write_image(const char *identifier, const char *filename, png_image * } fprintf(file, "};\n"); - fprintf(file, "struct graphics_image %s_image = {%u, %u, %s_blt};\n", + fprintf(file, "const struct graphics_image %s_image = {%u, %u, %s_blt};\n", identifier, image->width, image->height, identifier); return fclose(file);