Commit Graph

81 Commits

Author SHA1 Message Date
Andrei Borzenkov 0e075ac385 util/setup: fix grub_util_path_list leak
Add helper grub_util_free_path_list and use it where appropriate.

Found by: Coverity scan.
CID: 73727
2016-01-09 13:55:18 +03:00
Andrei Borzenkov 76197d9be6 install: --compress argument is not optional
Fixes crash if argument is not specified. Also use `|' to separate choices
in list of compression methods to align it with --core-compress.
2015-10-11 21:17:37 +03:00
Vladimir Serbinenko 27d1a67f8a Fix canonicalize_file_name clash.
canonicalize_file_name clashed with gnulib function. Additionally
it was declared in 2 places: emu/misc.h and util/misc.h. Added
grub_ prefix and removed second declaration.
2015-03-04 01:00:19 +01:00
Vladimir Serbinenko 95cd131ea0 * util/grub-install.c: List available targets. 2014-01-24 18:09:25 +01:00
Vladimir Serbinenko 57a691b7e7 Decrease number of strings to translate. 2013-12-18 07:26:13 +01:00
Vladimir Serbinenko a24725cc6e Change grub_install_register_efi interface to pass GRUB device.
This allows grub_install_register_efi to request partition info
	directly.
2013-12-14 23:31:56 +01:00
Vladimir Serbinenko 4bad23a15f Workaround windows bug when querying EFI system partition parameters. 2013-12-14 23:23:11 +01:00
Jon McCune dd73313cba Add --no-rs-codes flag to optionally disable reed-solomon codes in grub-install and grub-bios-setup for x86 BIOS targets. 2013-12-09 16:52:12 -08:00
Vladimir Serbinenko f23bc65103 Transform -C option to grub-mkstandalone to --core-compress available
in all grub-install flavours.
2013-12-07 16:18:22 +01:00
Andrey Borzenkov 3100cdc7f9 add grub_qsort_strcmp to use when sorting array of strings
Compare function used in qsort gets arguments by reference, so strcmp
cannot be used directly - it expects pointer to char, but gets pointer
to pointer to char.

Introduce new helper grub_qsort_strcmp and use it in grub-install.
This helper is going to be used in a couple more places as well so
add it to global file, not in grub-install.c.
2013-12-07 14:29:00 +04:00
Colin Watson 3a82f8bb48 Fix grub-shell to avoid breaking "make distcheck"
Copying the themes directory in grub-shell isn't
parallel-test-friendly and breaks on the second test when the source
directory is read-only (as in "make distcheck").  Instead, add a
hidden --themes-directory option to grub-mkrescue et al, and use it
in grub-shell.
2013-12-04 13:36:34 +00:00
Leif Lindholm b29b77fee2 New port arm64-efi 2013-11-30 16:50:31 +01:00
Colin Watson 07e3b04742 Add a --locale-directory option to grub-install and related tools.
* include/grub/util/install.h (GRUB_INSTALL_OPTIONS): Add
--locale-directory option.
(enum grub_install_options): Add
GRUB_INSTALL_OPTIONS_LOCALE_DIRECTORY.
* util/grub-install-common.c (grub_install_help_filter): Handle
GRUB_INSTALL_OPTIONS_LOCALE_DIRECTORY.
(grub_install_parse): Likewise.
(get_localedir): New function to check for a user-provided option
before trying grub_util_get_localedir.
(copy_locales): Use get_localedir rather than
grub_util_get_localedir.  Handle differing locale directory layouts.
(grub_install_copy_files): Likewise.
2013-11-25 18:04:50 +00:00
Vladimir Serbinenko d6c92cdc34 Merge branch 'master' into leiflindholm/arm64
Conflicts:
	include/grub/util/install.h
2013-11-25 13:02:27 +01:00
Vladimir Serbinenko 4a23e2fe29 Add *-xen to the list of grub-install-common platforms. 2013-11-22 14:21:16 +01:00
Leif Lindholm 15a463d742 ARM 64 port by Leif Lindholm 2013-11-16 20:52:55 +01:00
Vladimir Serbinenko cd46aa6cef Rewrite grub-install, grub-mkrescue, grub-mkstandalone and grub-mknetdir
the function of these files exceeds what can be sanely handled in shell
	in posix-comaptible way. Also writing it in C extends the functionality
	to non-UNIX-like OS and minimal environments.
2013-11-16 20:21:16 +01:00
Vladimir 'phcoder' Serbinenko 6f65237374 * util/grub-render-label.c: Move backend part to ...
* util/render-label.c: ... here.
2013-10-19 02:37:01 +02:00
Vladimir 'phcoder' Serbinenko 44d1c20a13 * util/grub-render-label.c: Move backend part to ...
* util/render-label.c: ... here.
2013-10-19 02:34:18 +02:00
Vladimir 'phcoder' Serbinenko bacfefbb0e * util/grub-editenv.c (create_envblk_file): More from here ...
* util/editenv.c (grub_util_create_envblk_file): ... to here.
2013-10-15 21:23:54 +02:00
Vladimir 'phcoder' Serbinenko ec16e02639 * util/grub-mkimage.c: Move backend part to ...
* util/mkimage.c: ... here.
2013-10-15 19:14:55 +02:00
Vladimir 'phcoder' Serbinenko 5a869940de Split out blocklist retrieving from setup.c to
grub-core/osdep/blocklist.c and add windows implementation since
	generic version doesn't work on NTFS on Windows due to aggressive
	unflushable cache.
2013-10-15 17:02:26 +02:00
Vladimir 'phcoder' Serbinenko c06c75201c Split grub-setup.c into frontend (grub-setup.c) and backend (setup.c)
files.
2013-10-15 16:16:04 +02:00
Vladimir 'phcoder' Serbinenko 27f9d02eb9 * configure.ac: Check for nvlist_lookup_string in nvpair since we
use nvlist_lookup_string and don't use nvlist_print.
2013-10-15 15:01:01 +02:00
Vladimir 'phcoder' Serbinenko ae5540d3d4 Move set_program_name and init_nls to host_init. On windows
fix in this fuction console and argument charset as well.
2013-10-13 20:03:42 +02:00
Vladimir 'phcoder' Serbinenko 71c1d67a34 Avoid including hostfile.h when not necessarry as it pulls
in OS-specific headers which may redefine generic names
	like "far".
2013-10-10 09:18:06 +02:00
Vladimir 'phcoder' Serbinenko 761c718b52 Move OS-dependent file definitions to include/grub/osdep/hostfile*.h. 2013-10-09 08:20:20 +02:00
Vladimir 'phcoder' Serbinenko acbbe5cbad * include/grub/util/lvm.h: Removed. 2013-10-08 21:01:09 +02:00
Vladimir 'phcoder' Serbinenko 7e518ca84f Use Winapi on both cygwin and mingw32 to share more code between both. 2013-09-23 11:21:09 +02:00
Vladimir 'phcoder' Serbinenko 3ff4063dd3 * grub-core/kern/emu/hostdisk.c: Disentagle into a series of OS-specific
files rather than one file with loads of #if's.
	* util/getroot.c: Likewise.
2013-09-22 07:36:17 +02:00
Vladimir 'phcoder' Serbinenko 90379808b6 * util/lvm.c: Remove since unused. Remove remaining references. 2013-09-19 09:05:56 +02:00
Vladimir 'phcoder' Serbinenko 984cfd8a79 * grub-core/kern/emu/hostdisk.c (grub_util_get_fd_size): Adapt for
mingw32 as well based on grub_util_get_disk_size.
	* util/misc.c (grub_util_get_disk_size): Removed. all users switched to
	grub_util_get_fd_size.
	(sync): Removed.
	(fsync): Moved to ...
	* grub-core/kern/emu/misc.c (fsync): ... here.
2013-08-22 16:50:12 +02:00
Vladimir 'phcoder' Serbinenko 0ae70393ba Improve and unify messages.
* grub-core/kern/emu/hostdisk.c (grub_util_get_fd_sectors): Add argument
	name. All users updated.
	Print filename in error.
	(read_device_map): Print filename in error.
	* util/getroot.c (grub_guess_root_devices): Print filename in error.
	(grub_util_get_os_disk): Likewise.
	(grub_util_biosdisk_get_grub_dev): Likewise.
	(grub_util_check_block_device): Likewise.
	(grub_util_check_char_device): Likewise.
	(grub_make_system_path_relative_to_its_root): Likewise.
	* util/grub-editenv.c (create_envblk_file): Likewise.
	(open_envblk_file): Likewise.
	(write_envblk): Likewise.
	* util/grub-fstest.c (cmd_cp): Likewise.
	(cmd_cat): Likewise.
	(cmd_cmp): Likewise.
	* util/grub-menulst2cfg.c (main): Likewise.
	* util/grub-mkfont.c (write_font_ascii_bitmap): Likewise.
	(write_font_width_spec): Likewise.
	(write_font_pf2): Likewise.
	* util/grub-mkimage.c (generate_image): New argument outname.
	All users updated.
	Remove unreacheable message.
	(options): Unify messages.
	(help_filter): Likewise.
	* util/grub-mklayout.c (usage): Removed (unused).
	(main): Print filename in error.
	* util/grub-mkrescue.in: Fix wrong quoting.
	* util/grub-setup.c (setup): Print filename in error.
	* util/ieee1275/ofpath.c (vendor_is_ATA): Likewise.
	(check_sas): Likewise.
	* util/misc.c (grub_util_get_fp_size): Removed.
	(grub_util_get_image_size): Print filename in error.
	(grub_util_read_at): Removed.
	(grub_util_read_image): Print filename in error.
	(grub_util_load_image): Likewise.
	(grub_util_write_image_at): New argument filename. All users updated.
	Print filename in error.
	(grub_util_write_image): New argument filename. All users updated.
	Print filename in error.
	* util/raid.c (grub_util_raid_getmembers): Print filename in error.
	* util/resolve.c (grub_util_resolve_dependencies): Likewise.
2012-02-05 11:07:33 +01:00
Vladimir 'phcoder' Serbinenko 8be63f2ef6 * Makefile.util.def (grub-mkdevicemap): Removed.
* include/grub/emu/hostdisk.h (grub_util_get_os_disk): New proto.
	* include/grub/util/deviceiter.h: Removed.
	* util/deviceiter.c: Likewise.
	* util/getroot.c (grub_util_get_os_disk): New function.
	* util/grub-install.in: Remove grub-mkdevicemap. Use -t disk as
	replacement for EFI.
	* util/grub-mkdevicemap.c: Removed.
	* util/grub-probe.c (probe): Handle PRINT_DISK.
	(argp_parser): Handle -t disk.
2012-02-03 22:36:51 +01:00
Robert Millan a98f4a0808 2011-10-09 Robert Millan <rmh@gnu.org>
LVM support for FreeBSD and GNU/kFreeBSD.

        * util/lvm.c (grub_util_lvm_isvolume): Enable on FreeBSD and
        GNU/kFreeBSD.
        (LVM_DEV_MAPPER_STRING): Move from here ...
        * include/grub/util/lvm.h (LVM_DEV_MAPPER_STRING): ... to here.
        * util/getroot.c: Include `<grub/util/lvm.h>'.
        (grub_util_get_dev_abstraction): Enable
        grub_util_biosdisk_is_present() on FreeBSD and GNU/kFreeBSD.
        Check for LVM abstraction on FreeBSD and GNU/kFreeBSD.
        (grub_util_get_grub_dev): Replace "/dev/mapper/" with
        `LVM_DEV_MAPPER_STRING'.  Enable LVM and mdRAID only on platforms that
        support it.
        * util/grub-setup.c (main): Check for LVM also on FreeBSD and
        GNU/kFreeBSD.
        * util/grub.d/10_kfreebsd.in: Load `geom_linux_lvm' kernel module
        when LVM abstraction is required for ${GRUB_DEVICE}.
2011-10-09 21:13:00 +02:00
Mario Limonciello cca7ccd8ff Remove extra declaration of sleep for mingw32.
* util/misc.c (sleep) [__MINGW32__]: Removed.
	* include/grub/util/misc.h (sleep) [__MINGW32__]: Likewise.
2011-09-29 10:32:24 +02:00
Vladimir 'phcoder' Serbinenko 4defebbec8 automatic raid members addition 2011-04-22 13:55:30 +02:00
Vladimir 'phcoder' Serbinenko 4ed4ce5820 correct Changelog spelling 2011-04-08 13:59:07 +02:00
Vladimir 'phcoder' Serbinenko 4a1a0153c3 * include/grub/emu/misc.h: Don't include grub/util/libzfs.h.
* include/grub/emu/misc.h (grub_get_libzfs_handle): Move from here ...
	* include/grub/util/libzfs.h (grub_get_libzfs_handle): ... here.
2010-11-06 23:52:56 +01:00
Robert Millan 9dd6fd50b4 2010-08-03 Robert Millan <rmh@gnu.org>
Fix grub-emu build.
	
	* include/grub/util/misc.h: Move `<grub/util/libzfs.h>' to ...
	* include/grub/emu/misc.h: ... here.
	
	* include/grub/util/misc.h (grub_get_libzfs_handle): Move function ...
	* include/grub/emu/misc.h (grub_get_libzfs_handle): ... here.
	
	* util/misc.c: Remove `<grub/util/libzfs.h>'.
	[HAVE_LIBZFS] (libzfs_handle, fini_libzfs)
	(grub_get_libzfs_handle): Move to ...
	* kern/emu/misc.c [HAVE_LIBZFS] (__libzfs_handle, fini_libzfs)
	(grub_get_libzfs_handle): ... here.
2010-08-03 23:51:48 +02:00
Robert Millan f7abdefbdd 2010-08-01 Robert Millan <rmh@gnu.org>
Make it even harder to use uninitialized `libzfs_handle' (and
	make the interface a bit simpler).
	
	* include/grub/util/misc.h (grub_util_init_libzfs)
	(libzfs_handle): Remove.
	(grub_get_libzfs_handle): New prototype.
	
	* util/misc.c [HAVE_LIBZFS] (libzfs_handle): Add `static'
	attribute.
	(grub_util_init_libzfs): Remove.
	(grub_get_libzfs_handle): New function.
	
	* kern/emu/getroot.c (find_root_device_from_libzfs): Use
	grub_get_libzfs_handle() to obtain a libzfs handle instead of
	accessing `libzfs_handle' directly.
2010-08-01 23:12:24 +02:00
Colin Watson 8bfe31d82b * include/grub/util/libzfs.h (libzfs_init): Set argument list to
(void) rather than () so that this is a proper prototype.
2010-08-01 16:41:46 -05:00
Robert Millan 3169f4c76a 2010-07-31 Robert Millan <rmh@gnu.org>
* configure.ac: Check for `libzfs.h' and `libnvpair.h'.
	
	* include/grub/util/libnvpair.h: Include `<config.h>'.
	[HAVE_LIBNVPAIR_H]: Include `<libnvpair.h>' instead of
	declaring libnvpair prototypes ourselves.
	* include/grub/util/libzfs.h: Include `<config.h>'.
	[HAVE_LIBZFS_H]: Include `<libzfs.h>' instead of
	declaring libzfs prototypes ourselves.
	
	(libzfs_handle): Moved to ...
	* include/grub/util/misc.h (libzfs_handle): ... here.
	Include `<grub/util/libzfs.h>'.
2010-07-31 12:22:01 +02:00
Robert Millan a184f9c801 2010-07-30 Robert Millan <rmh@gnu.org>
Enable `grub-probe -t device' resolution on ZFS.
	
	* configure.ac: Check for getfsstat(), libzfs and libnvpair.
	* include/grub/util/libnvpair.h: New file.
	* include/grub/util/libzfs.h: New file.
	
	* kern/emu/getroot.c: Include `<assert.h>' and `<error.h>'.
	[HAVE_LIBZFS && HAVE_LIBNVPAIR]: Include `<grub/util/libzfs.h>' and
	`<grub/util/libnvpair.h>'.
	[HAVE_GETFSSTAT]: Include `<sys/mount.h>'.
	
	(find_mount_point_from_dir): New static function.
	[HAVE_LIBZFS && HAVE_LIBNVPAIR] (find_root_device_from_libzfs): New
	function.
	[HAVE_LIBZFS && HAVE_LIBNVPAIR] (grub_guess_root_device): Use
	find_root_device_from_libzfs() before ressorting to find_root_device().
	
	* include/grub/util/misc.h (grub_util_init_libzfs): New function
	prototype.
	* util/misc.c: Include `<grub/util/libzfs.h>'.
	(grub_util_init_libzfs): New function.
	[HAVE_LIBZFS] (libzfs_handle): New global variable.
	[HAVE_LIBZFS] (fini_libzfs): New static function.
	(grub_util_init_libzfs): New function.
	* util/grub-probe.c (main): Call grub_util_init_libzfs().
2010-07-30 21:43:12 +02:00
BVK Chaitanya f07ccea799 removed some duplicate code 2010-04-27 20:55:12 +05:30
BVK Chaitanya 840b61d8f0 reorganized grub-emu sources to suite upcoming automake build system 2010-04-27 10:50:28 +05:30
BVK Chaitanya bc4a2d832b Fix emu build with grub-emu-pci and grub-emu-modules.
* include/grub/util/misc.h: Export grub_util_{info,error,warn}
	functions.
	* include/grub/libpciaccess.h: New file.
	* conf/any-emu.rmk: Update kernel headers for emu build.
2010-04-19 16:04:56 +05:30
BVK Chaitanya 454c3001f2 fix emu build with grub-emu-pci and grub-emu-modules 2010-04-19 15:15:59 +05:30
Vladimir 'phcoder' Serbinenko 6e86896ed8 Use ofpathname in grub-setup on sparc 2010-04-18 14:02:13 +02:00
Vladimir 'phcoder' Serbinenko 6734334a53 * include/grub/util/misc.h (canonicalise_file_name): Add missing
prototype.
	Reported by: Seth Goldberg.
2010-04-10 12:46:12 +02:00