2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 2013 Free Software Foundation, Inc.
5 * GRUB is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * GRUB is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef GRUB_UTIL_INSTALL_HEADER
20 #define GRUB_UTIL_INSTALL_HEADER 1
22 #include <sys/types.h>
25 #include <grub/device.h>
26 #include <grub/disk.h>
27 #include <grub/emu/hostfile.h>
29 #define GRUB_INSTALL_OPTIONS \
30 { "modules", GRUB_INSTALL_OPTIONS_MODULES, N_("MODULES"), \
31 0, N_("pre-load specified modules MODULES"), 1 }, \
32 { "dtb", GRUB_INSTALL_OPTIONS_DTB, N_("FILE"), \
33 0, N_("embed a specific DTB"), 1 }, \
34 { "install-modules", GRUB_INSTALL_OPTIONS_INSTALL_MODULES, \
36 N_("install only MODULES and their dependencies [default=all]"), 1 }, \
37 { "themes", GRUB_INSTALL_OPTIONS_INSTALL_THEMES, N_("THEMES"), \
38 0, N_("install THEMES [default=%s]"), 1 }, \
39 { "fonts", GRUB_INSTALL_OPTIONS_INSTALL_FONTS, N_("FONTS"), \
40 0, N_("install FONTS [default=%s]"), 1 }, \
41 { "locales", GRUB_INSTALL_OPTIONS_INSTALL_LOCALES, N_("LOCALES"),\
42 0, N_("install only LOCALES [default=all]"), 1 }, \
43 { "compress", GRUB_INSTALL_OPTIONS_INSTALL_COMPRESS, \
45 N_("compress GRUB files [optional]"), 1 }, \
46 {"core-compress", GRUB_INSTALL_OPTIONS_INSTALL_CORE_COMPRESS, \
48 0, N_("choose the compression to use for core image"), 2}, \
49 /* TRANSLATORS: platform here isn't identifier. It can be translated. */ \
50 { "directory", 'd', N_("DIR"), 0, \
51 N_("use images and modules under DIR [default=%s/<platform>]"), 1 }, \
52 { "override-directory", GRUB_INSTALL_OPTIONS_DIRECTORY2, \
53 N_("DIR"), OPTION_HIDDEN, \
54 N_("use images and modules under DIR [default=%s/<platform>]"), 1 }, \
55 { "locale-directory", GRUB_INSTALL_OPTIONS_LOCALE_DIRECTORY, \
57 N_("use translations under DIR [default=%s]"), 1 }, \
58 { "themes-directory", GRUB_INSTALL_OPTIONS_THEMES_DIRECTORY, \
59 N_("DIR"), OPTION_HIDDEN, \
60 N_("use themes under DIR [default=%s]"), 1 }, \
61 { "grub-mkimage", GRUB_INSTALL_OPTIONS_GRUB_MKIMAGE, \
62 "FILE", OPTION_HIDDEN, 0, 1 }, \
63 /* TRANSLATORS: "embed" is a verb (command description). "*/ \
64 { "pubkey", 'k', N_("FILE"), 0, \
65 N_("embed FILE as public key for signature checking"), 0}, \
66 { "verbose", 'v', 0, 0, \
67 N_("print verbose messages."), 1 }
70 grub_install_parse (int key
, char *arg
);
73 grub_install_push_module (const char *val
);
76 grub_install_pop_module (void);
79 grub_install_help_filter (int key
, const char *text
,
80 void *input
__attribute__ ((unused
)));
82 enum grub_install_plat
84 GRUB_INSTALL_PLATFORM_I386_PC
,
85 GRUB_INSTALL_PLATFORM_I386_EFI
,
86 GRUB_INSTALL_PLATFORM_I386_QEMU
,
87 GRUB_INSTALL_PLATFORM_I386_COREBOOT
,
88 GRUB_INSTALL_PLATFORM_I386_MULTIBOOT
,
89 GRUB_INSTALL_PLATFORM_I386_IEEE1275
,
90 GRUB_INSTALL_PLATFORM_X86_64_EFI
,
91 GRUB_INSTALL_PLATFORM_MIPSEL_LOONGSON
,
92 GRUB_INSTALL_PLATFORM_SPARC64_IEEE1275
,
93 GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275
,
94 GRUB_INSTALL_PLATFORM_MIPSEL_ARC
,
95 GRUB_INSTALL_PLATFORM_MIPS_ARC
,
96 GRUB_INSTALL_PLATFORM_IA64_EFI
,
97 GRUB_INSTALL_PLATFORM_ARM_UBOOT
,
98 GRUB_INSTALL_PLATFORM_ARM_EFI
,
99 GRUB_INSTALL_PLATFORM_MIPSEL_QEMU_MIPS
,
100 GRUB_INSTALL_PLATFORM_MIPS_QEMU_MIPS
,
101 GRUB_INSTALL_PLATFORM_I386_XEN
,
102 GRUB_INSTALL_PLATFORM_X86_64_XEN
,
103 GRUB_INSTALL_PLATFORM_I386_XEN_PVH
,
104 GRUB_INSTALL_PLATFORM_ARM64_EFI
,
105 GRUB_INSTALL_PLATFORM_MIPS64EL_EFI
,
106 GRUB_INSTALL_PLATFORM_ARM_COREBOOT
,
107 GRUB_INSTALL_PLATFORM_RISCV32_EFI
,
108 GRUB_INSTALL_PLATFORM_RISCV64_EFI
,
109 GRUB_INSTALL_PLATFORM_MAX
112 enum grub_install_options
{
113 GRUB_INSTALL_OPTIONS_DIRECTORY
= 'd',
114 GRUB_INSTALL_OPTIONS_VERBOSITY
= 'v',
115 GRUB_INSTALL_OPTIONS_MODULES
= 0x201,
116 GRUB_INSTALL_OPTIONS_INSTALL_MODULES
,
117 GRUB_INSTALL_OPTIONS_INSTALL_THEMES
,
118 GRUB_INSTALL_OPTIONS_INSTALL_FONTS
,
119 GRUB_INSTALL_OPTIONS_INSTALL_LOCALES
,
120 GRUB_INSTALL_OPTIONS_INSTALL_COMPRESS
,
121 GRUB_INSTALL_OPTIONS_DIRECTORY2
,
122 GRUB_INSTALL_OPTIONS_LOCALE_DIRECTORY
,
123 GRUB_INSTALL_OPTIONS_THEMES_DIRECTORY
,
124 GRUB_INSTALL_OPTIONS_GRUB_MKIMAGE
,
125 GRUB_INSTALL_OPTIONS_INSTALL_CORE_COMPRESS
,
126 GRUB_INSTALL_OPTIONS_DTB
129 extern char *grub_install_source_directory
;
131 enum grub_install_plat
132 grub_install_get_target (const char *src
);
134 grub_install_mkdir_p (const char *dst
);
137 grub_install_copy_files (const char *src
,
139 enum grub_install_plat platid
);
141 grub_install_get_platform_name (enum grub_install_plat platid
);
144 grub_install_get_platform_cpu (enum grub_install_plat platid
);
147 grub_install_get_platform_platform (enum grub_install_plat platid
);
150 grub_install_get_platforms_string (void);
153 GRUB_COMPRESSION_AUTO
,
154 GRUB_COMPRESSION_NONE
,
156 GRUB_COMPRESSION_LZMA
157 } grub_compression_t
;
160 grub_install_make_image_wrap (const char *dir
, const char *prefix
,
161 const char *outname
, char *memdisk_path
,
163 const char *format
, int note
);
165 grub_install_make_image_wrap_file (const char *dir
, const char *prefix
,
166 FILE *fp
, const char *outname
,
169 const char *mkimage_target
, int note
);
172 grub_install_copy_file (const char *src
,
176 struct grub_install_image_target_desc
;
179 grub_install_generate_image (const char *dir
, const char *prefix
,
181 const char *outname
, char *mods
[],
182 char *memdisk_path
, char **pubkey_paths
,
185 const struct grub_install_image_target_desc
*image_target
,
187 grub_compression_t comp
, const char *dtb_file
);
189 const struct grub_install_image_target_desc
*
190 grub_install_get_image_target (const char *arg
);
193 grub_util_bios_setup (const char *dir
,
194 const char *boot_file
, const char *core_file
,
195 const char *dest
, int force
,
196 int fs_probe
, int allow_floppy
,
199 grub_util_sparc_setup (const char *dir
,
200 const char *boot_file
, const char *core_file
,
201 const char *dest
, int force
,
202 int fs_probe
, int allow_floppy
,
206 grub_install_get_image_targets_string (void);
209 grub_util_get_target_dirname (const struct grub_install_image_target_desc
*t
);
212 grub_install_create_envblk_file (const char *name
);
215 grub_install_get_default_arm_platform (void);
218 grub_install_get_default_x86_platform (void);
221 grub_install_register_efi (grub_device_t efidir_grub_dev
,
222 const char *efifile_path
,
223 const char *efi_distributor
);
226 grub_install_register_ieee1275 (int is_prep
, const char *install_device
,
227 int partno
, const char *relpath
);
230 grub_install_sgi_setup (const char *install_device
,
231 const char *imgfile
, const char *destname
);
234 grub_install_compress_gzip (const char *src
, const char *dest
);
236 grub_install_compress_lzop (const char *src
, const char *dest
);
238 grub_install_compress_xz (const char *src
, const char *dest
);
241 grub_install_get_blocklist (grub_device_t root_dev
,
242 const char *core_path
, const char *core_img
,
244 void (*callback
) (grub_disk_addr_t sector
,
251 grub_util_create_envblk_file (const char *name
);
254 grub_util_glue_efi (const char *file32
, const char *file64
, const char *out
);
257 grub_util_render_label (const char *label_font
,
258 const char *label_bgcolor
,
259 const char *label_color
,
260 const char *label_string
,
264 grub_util_get_target_name (const struct grub_install_image_target_desc
*t
);
266 extern char *grub_install_copy_buffer
;
267 #define GRUB_INSTALL_COPY_BUFFER_SIZE 1048576