]> glassweightruler.freedombox.rocks Git - Ventoy.git/blob - GRUB2/MOD_SRC/grub-2.04/include/grub/util/install.h
1.1.07 release
[Ventoy.git] / GRUB2 / MOD_SRC / grub-2.04 / include / grub / util / install.h
1 /*
2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 2013 Free Software Foundation, Inc.
4 *
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.
9 *
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.
14 *
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/>.
17 */
18
19 #ifndef GRUB_UTIL_INSTALL_HEADER
20 #define GRUB_UTIL_INSTALL_HEADER 1
21
22 #include <sys/types.h>
23 #include <stdio.h>
24
25 #include <grub/device.h>
26 #include <grub/disk.h>
27 #include <grub/emu/hostfile.h>
28
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, \
35 N_("MODULES"), 0, \
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, \
44 "no|xz|gz|lzo", 0, \
45 N_("compress GRUB files [optional]"), 1 }, \
46 {"core-compress", GRUB_INSTALL_OPTIONS_INSTALL_CORE_COMPRESS, \
47 "xz|none|auto", \
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, \
56 N_("DIR"), 0, \
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 }
68
69 int
70 grub_install_parse (int key, char *arg);
71
72 void
73 grub_install_push_module (const char *val);
74
75 void
76 grub_install_pop_module (void);
77
78 char *
79 grub_install_help_filter (int key, const char *text,
80 void *input __attribute__ ((unused)));
81
82 enum grub_install_plat
83 {
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
110 };
111
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
127 };
128
129 extern char *grub_install_source_directory;
130
131 enum grub_install_plat
132 grub_install_get_target (const char *src);
133 void
134 grub_install_mkdir_p (const char *dst);
135
136 void
137 grub_install_copy_files (const char *src,
138 const char *dst,
139 enum grub_install_plat platid);
140 char *
141 grub_install_get_platform_name (enum grub_install_plat platid);
142
143 const char *
144 grub_install_get_platform_cpu (enum grub_install_plat platid);
145
146 const char *
147 grub_install_get_platform_platform (enum grub_install_plat platid);
148
149 char *
150 grub_install_get_platforms_string (void);
151
152 typedef enum {
153 GRUB_COMPRESSION_AUTO,
154 GRUB_COMPRESSION_NONE,
155 GRUB_COMPRESSION_XZ,
156 GRUB_COMPRESSION_LZMA
157 } grub_compression_t;
158
159 void
160 grub_install_make_image_wrap (const char *dir, const char *prefix,
161 const char *outname, char *memdisk_path,
162 char *config_path,
163 const char *format, int note);
164 void
165 grub_install_make_image_wrap_file (const char *dir, const char *prefix,
166 FILE *fp, const char *outname,
167 char *memdisk_path,
168 char *config_path,
169 const char *mkimage_target, int note);
170
171 int
172 grub_install_copy_file (const char *src,
173 const char *dst,
174 int is_critical);
175
176 struct grub_install_image_target_desc;
177
178 void
179 grub_install_generate_image (const char *dir, const char *prefix,
180 FILE *out,
181 const char *outname, char *mods[],
182 char *memdisk_path, char **pubkey_paths,
183 size_t npubkeys,
184 char *config_path,
185 const struct grub_install_image_target_desc *image_target,
186 int note,
187 grub_compression_t comp, const char *dtb_file);
188
189 const struct grub_install_image_target_desc *
190 grub_install_get_image_target (const char *arg);
191
192 void
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,
197 int add_rs_codes);
198 void
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,
203 int add_rs_codes);
204
205 char *
206 grub_install_get_image_targets_string (void);
207
208 const char *
209 grub_util_get_target_dirname (const struct grub_install_image_target_desc *t);
210
211 void
212 grub_install_create_envblk_file (const char *name);
213
214 const char *
215 grub_install_get_default_arm_platform (void);
216
217 const char *
218 grub_install_get_default_x86_platform (void);
219
220 int
221 grub_install_register_efi (grub_device_t efidir_grub_dev,
222 const char *efifile_path,
223 const char *efi_distributor);
224
225 void
226 grub_install_register_ieee1275 (int is_prep, const char *install_device,
227 int partno, const char *relpath);
228
229 void
230 grub_install_sgi_setup (const char *install_device,
231 const char *imgfile, const char *destname);
232
233 int
234 grub_install_compress_gzip (const char *src, const char *dest);
235 int
236 grub_install_compress_lzop (const char *src, const char *dest);
237 int
238 grub_install_compress_xz (const char *src, const char *dest);
239
240 void
241 grub_install_get_blocklist (grub_device_t root_dev,
242 const char *core_path, const char *core_img,
243 size_t core_size,
244 void (*callback) (grub_disk_addr_t sector,
245 unsigned offset,
246 unsigned length,
247 void *data),
248 void *hook_data);
249
250 void
251 grub_util_create_envblk_file (const char *name);
252
253 void
254 grub_util_glue_efi (const char *file32, const char *file64, const char *out);
255
256 void
257 grub_util_render_label (const char *label_font,
258 const char *label_bgcolor,
259 const char *label_color,
260 const char *label_string,
261 const char *label);
262
263 const char *
264 grub_util_get_target_name (const struct grub_install_image_target_desc *t);
265
266 extern char *grub_install_copy_buffer;
267 #define GRUB_INSTALL_COPY_BUFFER_SIZE 1048576
268
269 #endif