/* * VAS_EBOOT -- GRand Unified Bootloader * Copyright (C) 2013 Free Software Foundation, Inc. * * VAS_EBOOT is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * VAS_EBOOT is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with VAS_EBOOT. If not, see . */ #ifndef VAS_EBOOT_UTIL_INSTALL_HEADER #define VAS_EBOOT_UTIL_INSTALL_HEADER 1 #include #include #include #include #include #define VAS_EBOOT_INSTALL_OPTIONS \ { "modules", VAS_EBOOT_INSTALL_OPTIONS_MODULES, N_("MODULES"), \ 0, N_("pre-load specified modules MODULES"), 1 }, \ { "dtb", VAS_EBOOT_INSTALL_OPTIONS_DTB, N_("FILE"), \ 0, N_("embed a specific DTB"), 1 }, \ { "install-modules", VAS_EBOOT_INSTALL_OPTIONS_INSTALL_MODULES, \ N_("MODULES"), 0, \ N_("install only MODULES and their dependencies [default=all]"), 1 }, \ { "themes", VAS_EBOOT_INSTALL_OPTIONS_INSTALL_THEMES, N_("THEMES"), \ 0, N_("install THEMES [default=%s]"), 1 }, \ { "fonts", VAS_EBOOT_INSTALL_OPTIONS_INSTALL_FONTS, N_("FONTS"), \ 0, N_("install FONTS [default=%s]"), 1 }, \ { "locales", VAS_EBOOT_INSTALL_OPTIONS_INSTALL_LOCALES, N_("LOCALES"),\ 0, N_("install only LOCALES [default=all]"), 1 }, \ { "compress", VAS_EBOOT_INSTALL_OPTIONS_INSTALL_COMPRESS, \ "no|xz|gz|lzo", 0, \ N_("compress VAS_EBOOT files [optional]"), 1 }, \ {"core-compress", VAS_EBOOT_INSTALL_OPTIONS_INSTALL_CORE_COMPRESS, \ "xz|none|auto", \ 0, N_("choose the compression to use for core image"), 2}, \ /* TRANSLATORS: platform here isn't identifier. It can be translated. */ \ { "directory", 'd', N_("DIR"), 0, \ N_("use images and modules under DIR [default=%s/]"), 1 }, \ { "override-directory", VAS_EBOOT_INSTALL_OPTIONS_DIRECTORY2, \ N_("DIR"), OPTION_HIDDEN, \ N_("use images and modules under DIR [default=%s/]"), 1 }, \ { "locale-directory", VAS_EBOOT_INSTALL_OPTIONS_LOCALE_DIRECTORY, \ N_("DIR"), 0, \ N_("use translations under DIR [default=%s]"), 1 }, \ { "themes-directory", VAS_EBOOT_INSTALL_OPTIONS_THEMES_DIRECTORY, \ N_("DIR"), OPTION_HIDDEN, \ N_("use themes under DIR [default=%s]"), 1 }, \ { "VasEBoot-mkimage", VAS_EBOOT_INSTALL_OPTIONS_VAS_EBOOT_MKIMAGE, \ "FILE", OPTION_HIDDEN, 0, 1 }, \ /* TRANSLATORS: "embed" is a verb (command description). "*/ \ { "pubkey", 'k', N_("FILE"), 0, \ N_("embed FILE as public key for signature checking"), 0}, \ { "sbat", VAS_EBOOT_INSTALL_OPTIONS_SBAT, N_("FILE"), 0, \ N_("SBAT metadata"), 0 }, \ { "disable-shim-lock", VAS_EBOOT_INSTALL_OPTIONS_DISABLE_SHIM_LOCK, 0, 0, \ N_("disable shim_lock verifier"), 0 }, \ { "disable-cli", VAS_EBOOT_INSTALL_OPTIONS_DISABLE_CLI, 0, 0, \ N_("disabled command line interface access"), 0 }, \ { "x509key", 'x', N_("FILE"), 0, \ N_("embed FILE as an x509 certificate for appended signature checking"), 0}, \ { "appended-signature-size", VAS_EBOOT_INSTALL_OPTIONS_APPENDED_SIGNATURE_SIZE, \ "SIZE", 0, N_("Add a note segment reserving SIZE bytes for an appended signature"), 1}, \ { "verbose", 'v', 0, 0, \ N_("print verbose messages."), 1 } int VasEBoot_install_parse (int key, char *arg); void VasEBoot_install_push_module (const char *val); void VasEBoot_install_pop_module (void); char * VasEBoot_install_help_filter (int key, const char *text, void *input __attribute__ ((unused))); enum VasEBoot_install_plat { VAS_EBOOT_INSTALL_PLATFORM_I386_PC, VAS_EBOOT_INSTALL_PLATFORM_I386_EFI, VAS_EBOOT_INSTALL_PLATFORM_I386_QEMU, VAS_EBOOT_INSTALL_PLATFORM_I386_COREBOOT, VAS_EBOOT_INSTALL_PLATFORM_I386_MULTIBOOT, VAS_EBOOT_INSTALL_PLATFORM_I386_IEEE1275, VAS_EBOOT_INSTALL_PLATFORM_X86_64_EFI, VAS_EBOOT_INSTALL_PLATFORM_MIPSEL_LOONGSON, VAS_EBOOT_INSTALL_PLATFORM_SPARC64_IEEE1275, VAS_EBOOT_INSTALL_PLATFORM_POWERPC_IEEE1275, VAS_EBOOT_INSTALL_PLATFORM_MIPSEL_ARC, VAS_EBOOT_INSTALL_PLATFORM_MIPS_ARC, VAS_EBOOT_INSTALL_PLATFORM_IA64_EFI, VAS_EBOOT_INSTALL_PLATFORM_ARM_UBOOT, VAS_EBOOT_INSTALL_PLATFORM_ARM_EFI, VAS_EBOOT_INSTALL_PLATFORM_MIPSEL_QEMU_MIPS, VAS_EBOOT_INSTALL_PLATFORM_MIPS_QEMU_MIPS, VAS_EBOOT_INSTALL_PLATFORM_I386_XEN, VAS_EBOOT_INSTALL_PLATFORM_X86_64_XEN, VAS_EBOOT_INSTALL_PLATFORM_I386_XEN_PVH, VAS_EBOOT_INSTALL_PLATFORM_ARM64_EFI, VAS_EBOOT_INSTALL_PLATFORM_ARM_COREBOOT, VAS_EBOOT_INSTALL_PLATFORM_LOONGARCH64_EFI, VAS_EBOOT_INSTALL_PLATFORM_RISCV32_EFI, VAS_EBOOT_INSTALL_PLATFORM_RISCV64_EFI, VAS_EBOOT_INSTALL_PLATFORM_MAX }; enum VasEBoot_install_options { VAS_EBOOT_INSTALL_OPTIONS_DIRECTORY = 'd', VAS_EBOOT_INSTALL_OPTIONS_VERBOSITY = 'v', VAS_EBOOT_INSTALL_OPTIONS_MODULES = 0x201, VAS_EBOOT_INSTALL_OPTIONS_INSTALL_MODULES, VAS_EBOOT_INSTALL_OPTIONS_INSTALL_THEMES, VAS_EBOOT_INSTALL_OPTIONS_INSTALL_FONTS, VAS_EBOOT_INSTALL_OPTIONS_INSTALL_LOCALES, VAS_EBOOT_INSTALL_OPTIONS_INSTALL_COMPRESS, VAS_EBOOT_INSTALL_OPTIONS_DIRECTORY2, VAS_EBOOT_INSTALL_OPTIONS_LOCALE_DIRECTORY, VAS_EBOOT_INSTALL_OPTIONS_THEMES_DIRECTORY, VAS_EBOOT_INSTALL_OPTIONS_VAS_EBOOT_MKIMAGE, VAS_EBOOT_INSTALL_OPTIONS_INSTALL_CORE_COMPRESS, VAS_EBOOT_INSTALL_OPTIONS_DTB, VAS_EBOOT_INSTALL_OPTIONS_SBAT, VAS_EBOOT_INSTALL_OPTIONS_DISABLE_SHIM_LOCK, VAS_EBOOT_INSTALL_OPTIONS_DISABLE_CLI, VAS_EBOOT_INSTALL_OPTIONS_APPENDED_SIGNATURE_SIZE }; extern char *VasEBoot_install_source_directory; enum VasEBoot_install_plat VasEBoot_install_get_target (const char *src); void VasEBoot_install_mkdir_p (const char *dst); void VasEBoot_install_copy_files (const char *src, const char *dst, enum VasEBoot_install_plat platid); char * VasEBoot_install_get_platform_name (enum VasEBoot_install_plat platid); const char * VasEBoot_install_get_platform_cpu (enum VasEBoot_install_plat platid); const char * VasEBoot_install_get_platform_platform (enum VasEBoot_install_plat platid); char * VasEBoot_install_get_platforms_string (void); typedef enum { VAS_EBOOT_COMPRESSION_AUTO, VAS_EBOOT_COMPRESSION_NONE, VAS_EBOOT_COMPRESSION_XZ, VAS_EBOOT_COMPRESSION_LZMA } VasEBoot_compression_t; void VasEBoot_install_make_image_wrap (const char *dir, const char *prefix, const char *outname, char *memdisk_path, char *config_path, const char *format, int note); void VasEBoot_install_make_image_wrap_file (const char *dir, const char *prefix, FILE *fp, const char *outname, char *memdisk_path, char *config_path, const char *mkimage_target, int note); int VasEBoot_install_copy_file (const char *src, const char *dst, int is_critical); struct VasEBoot_install_image_target_desc; void VasEBoot_install_generate_image (const char *dir, const char *prefix, FILE *out, const char *outname, char *mods[], char *memdisk_path, char **pubkey_paths, size_t npubkeys, char **x509key_paths, size_t nx509keys, char *config_path, const struct VasEBoot_install_image_target_desc *image_target, int note, size_t appsig_size, VasEBoot_compression_t comp, const char *dtb_file, const char *sbat_path, const int disable_shim_lock, const int disable_cli); const struct VasEBoot_install_image_target_desc * VasEBoot_install_get_image_target (const char *arg); void VasEBoot_util_bios_setup (const char *dir, const char *boot_file, const char *core_file, const char *dest, int force, int fs_probe, int allow_floppy, int add_rs_codes, int warn_short_mbr_gap); void VasEBoot_util_sparc_setup (const char *dir, const char *boot_file, const char *core_file, const char *dest, int force, int fs_probe, int allow_floppy, int add_rs_codes, int warn_short_mbr_gap); char * VasEBoot_install_get_image_targets_string (void); const char * VasEBoot_util_get_target_dirname (const struct VasEBoot_install_image_target_desc *t); void VasEBoot_install_create_envblk_file (const char *name); const char * VasEBoot_install_get_default_arm_platform (void); const char * VasEBoot_install_get_default_x86_platform (void); int VasEBoot_install_register_efi (VasEBoot_device_t efidir_VasEBoot_dev, const char *efifile_path, const char *efi_distributor); void VasEBoot_install_register_ieee1275 (int is_prep, const char *install_device, int partno, const char *relpath); void VasEBoot_install_sgi_setup (const char *install_device, const char *imgfile, const char *destname); int VasEBoot_install_compress_gzip (const char *src, const char *dest); int VasEBoot_install_compress_lzop (const char *src, const char *dest); int VasEBoot_install_compress_xz (const char *src, const char *dest); void VasEBoot_install_get_blocklist (VasEBoot_device_t root_dev, const char *core_path, const char *core_img, size_t core_size, void (*callback) (VasEBoot_disk_addr_t sector, unsigned offset, unsigned length, void *data), void *hook_data); void VasEBoot_util_create_envblk_file (const char *name); void VasEBoot_util_glue_efi (const char *file32, const char *file64, const char *out); void VasEBoot_util_render_label (const char *label_font, const char *label_bgcolor, const char *label_color, const char *label_string, const char *label); const char * VasEBoot_util_get_target_name (const struct VasEBoot_install_image_target_desc *t); extern char *VasEBoot_install_copy_buffer; #define VAS_EBOOT_INSTALL_COPY_BUFFER_SIZE 1048576 int VasEBoot_install_is_short_mbrgap_supported (void); /* * VasEBoot-install-common tries to make backups of modules & auxiliary files, * and restore the backup upon failure to install core.img. There are * platforms with additional actions after modules & core got installed * in place. It is a point of no return, as core.img cannot be reverted * from this point onwards, and new modules should be kept installed. * Before performing these additional actions call VasEBoot_set_install_backup_ponr() * to set the VasEBoot_install_backup_ponr flag. This way failure to perform * subsequent actions will not result in reverting new modules to the * old ones, e.g. in case efivars updates fails. */ #ifdef HAVE_ATEXIT extern void VasEBoot_set_install_backup_ponr (void); #else static inline void VasEBoot_set_install_backup_ponr (void) { } #endif #endif