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_ARM64_EFI,
104 GRUB_INSTALL_PLATFORM_ARM_COREBOOT,
105 GRUB_INSTALL_PLATFORM_MAX
108 enum grub_install_options {
109 GRUB_INSTALL_OPTIONS_DIRECTORY = 'd',
110 GRUB_INSTALL_OPTIONS_VERBOSITY = 'v',
111 GRUB_INSTALL_OPTIONS_MODULES = 0x201,
112 GRUB_INSTALL_OPTIONS_INSTALL_MODULES,
113 GRUB_INSTALL_OPTIONS_INSTALL_THEMES,
114 GRUB_INSTALL_OPTIONS_INSTALL_FONTS,
115 GRUB_INSTALL_OPTIONS_INSTALL_LOCALES,
116 GRUB_INSTALL_OPTIONS_INSTALL_COMPRESS,
117 GRUB_INSTALL_OPTIONS_DIRECTORY2,
118 GRUB_INSTALL_OPTIONS_LOCALE_DIRECTORY,
119 GRUB_INSTALL_OPTIONS_THEMES_DIRECTORY,
120 GRUB_INSTALL_OPTIONS_GRUB_MKIMAGE,
121 GRUB_INSTALL_OPTIONS_INSTALL_CORE_COMPRESS,
122 GRUB_INSTALL_OPTIONS_DTB
125 extern char *grub_install_source_directory;
127 enum grub_install_plat
128 grub_install_get_target (const char *src);
130 grub_install_mkdir_p (const char *dst);
133 grub_install_copy_files (const char *src,
135 enum grub_install_plat platid);
137 grub_install_get_platform_name (enum grub_install_plat platid);
140 grub_install_get_platform_cpu (enum grub_install_plat platid);
143 grub_install_get_platform_platform (enum grub_install_plat platid);
146 grub_install_get_platforms_string (void);
149 GRUB_COMPRESSION_AUTO,
150 GRUB_COMPRESSION_NONE,
152 GRUB_COMPRESSION_LZMA
153 } grub_compression_t;
156 grub_install_make_image_wrap (const char *dir, const char *prefix,
157 const char *outname, char *memdisk_path,
159 const char *format, int note);
161 grub_install_make_image_wrap_file (const char *dir, const char *prefix,
162 FILE *fp, const char *outname,
165 const char *mkimage_target, int note);
168 grub_install_copy_file (const char *src,
172 struct grub_install_image_target_desc;
175 grub_install_generate_image (const char *dir, const char *prefix,
177 const char *outname, char *mods[],
178 char *memdisk_path, char **pubkey_paths,
181 const struct grub_install_image_target_desc *image_target,
183 grub_compression_t comp, const char *dtb_file);
185 const struct grub_install_image_target_desc *
186 grub_install_get_image_target (const char *arg);
189 grub_util_bios_setup (const char *dir,
190 const char *boot_file, const char *core_file,
191 const char *dest, int force,
192 int fs_probe, int allow_floppy,
195 grub_util_sparc_setup (const char *dir,
196 const char *boot_file, const char *core_file,
197 const char *dest, int force,
198 int fs_probe, int allow_floppy,
202 grub_install_get_image_targets_string (void);
205 grub_util_get_target_dirname (const struct grub_install_image_target_desc *t);
208 grub_install_create_envblk_file (const char *name);
211 grub_install_get_default_x86_platform (void);
214 grub_install_register_efi (grub_device_t efidir_grub_dev,
215 const char *efifile_path,
216 const char *efi_distributor);
219 grub_install_register_ieee1275 (int is_prep, const char *install_device,
220 int partno, const char *relpath);
223 grub_install_sgi_setup (const char *install_device,
224 const char *imgfile, const char *destname);
227 grub_install_compress_gzip (const char *src, const char *dest);
229 grub_install_compress_lzop (const char *src, const char *dest);
231 grub_install_compress_xz (const char *src, const char *dest);
234 grub_install_get_blocklist (grub_device_t root_dev,
235 const char *core_path, const char *core_img,
237 void (*callback) (grub_disk_addr_t sector,
244 grub_util_create_envblk_file (const char *name);
247 grub_util_glue_efi (const char *file32, const char *file64, const char *out);
250 grub_util_render_label (const char *label_font,
251 const char *label_bgcolor,
252 const char *label_color,
253 const char *label_string,
257 grub_util_get_target_name (const struct grub_install_image_target_desc *t);
259 extern char *grub_install_copy_buffer;
260 #define GRUB_INSTALL_COPY_BUFFER_SIZE 1048576