Commit graph

118 commits

Author SHA1 Message Date
Andrei Borzenkov
5082ea6184 remove extra newlines in grub_util_* strings
grub_util_{info,warn,error} already add trailing newlines, so remove
them from format strings. Also trailing full stops are already added.
2015-05-13 09:47:17 +03:00
Toomas Soome
677dcaa92b getroot: include sys/mkdev.h for makedev
Solaris (like) systems need to include sys/mkdev.h for makedev() function.
2015-04-13 19:52:28 +03:00
Steve McIntyre
1a33de8b56 Recognize EFI platform even in case of mismatch between Linux and EFI.
Some x86 systems might be capable of running a 64-bit Linux kernel but
only use a 32-bit EFI (e.g. Intel Bay Trail systems). It's useful for
grub-install to be able to recognise such systems, to set the default
x86 platform correctly.

To allow grub-install to know the size of the firmware rather than
just the size of the kernel, there is now an extra EFI sysfs file to
describe the underlying firmware. Read that if possible, otherwise
fall back to the kernel type as before.

Signed-off-by: Steve McIntyre <steve@einval.com>
2015-03-27 14:51:51 +01: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
Andrei Borzenkov
637fc62699 linux/ofpath: fix descriptor leak
Found by: Coverity scan
2015-01-27 20:29:00 +03:00
Andrei Borzenkov
7ba137f628 linux/hostdisk: use strncpy instead of strlcpy
strlcpy is not available on Linux as part of standard libraries.
It probably is not worth extra configure checks espicially as we
need to handle missing function anyway.
2015-01-27 20:00:23 +03:00
Vladimir Serbinenko
8f95eae423 linux/ofpath: Fix error handling.
Found by: Coverity Scan.
2015-01-27 16:49:49 +01:00
Vladimir Serbinenko
c2fc41990a linux/hostdisk: Limit strcpy size to buffer size.
Found by: Coverity scan.
2015-01-27 16:48:53 +01:00
Andrei Borzenkov
e61f4eba18 linux/getroot: fix memory leak.
Found by: Coverity scan.
2015-01-26 23:04:09 +03:00
Andrei Borzenkov
e2a21238da linux/ofpath: fix various memory leaks.
Found by: Coverity scan.
2015-01-26 23:04:00 +03:00
Andrei Borzenkov
6704abade6 linux/getroot: fix descriptor leak.
Found by: Coverity scan.
2015-01-26 23:02:55 +03:00
Vladimir Serbinenko
8102540939 unix/password: Fix file descriptor leak.
Found by: Coverity scan.
2015-01-26 09:53:03 +01:00
Vladimir Serbinenko
cba5a85a67 linux/getroot: Fix error handling.
Found by: Coverity scan.
2015-01-26 09:51:48 +01:00
Vladimir Serbinenko
5adc6d76d3 linux/blocklist: Fix memory leak.
Found by: Coverity scan.
2015-01-26 09:50:58 +01:00
Vladimir Serbinenko
c14dff3ca7 devmapper/getroot: Fix memory leak.
Found by: Coverity scan.
2015-01-26 09:50:27 +01:00
Felix Janda
3bac4caa2b Remove direct _llseek code and require long filesystem libc. 2015-01-22 19:54:36 +01:00
Vladimir Serbinenko
68581b009f unix/cputime.c: Cache sc_clk_tck and check it for sanity. 2015-01-21 17:42:15 +01:00
Vladimir Serbinenko
ac8bac2496 haiku/getroot.c (grub_util_find_partition_start_os): Avoid division by zero. 2015-01-21 17:42:15 +01:00
Vladimir Serbinenko
111ab3b9cc osdep/linux/blocklist.c (grub_install_get_blocklist): Check blocksize validity. 2015-01-21 17:42:12 +01:00
Michael Chang
0aece00c54 * grub-core/osdep/unix/config.c: Remove extraneous comma. 2014-09-21 17:49:13 +02:00
Vladimir Serbinenko
9706066791 * grub-core/osdep/linux/getroot.c (grub_util_part_to_disk): Support NVMe device names. 2014-04-03 21:31:12 +02:00
Mike Gilbert
35f2d96c0d grub-install: support for partitioned partx loop devices.
* grub-core/osdep/linux/getroot.c (grub_util_part_to_disk): Detect
	/dev/loopX as being the parent of /dev/loopXpY.
2014-01-26 02:56:04 +01:00
Colin Watson
049f63824c Ignore EPERM when modifying kern.geom.debugflags
Many tests fail when run as a non-root user on FreeBSD.  The failures
all amount to an inability to open files using grub_util_fd_open,
because we cannot set the kern.geom.debugflags sysctl.  This sysctl is
indeed important to allow us to do such things as installing GRUB to the
MBR, but if we need to do that and can't then we will get an error
later.  Enforcing it here is unnecessary and prevents otherwise
perfectly reasonable operations.
2014-01-19 14:38:07 +00:00
Colin Watson
09a836e59c freebsd/hostdisk.c is only ever compiled on FreeBSD
* grub-core/osdep/freebsd/hostdisk.c (grub_util_fd_open): Remove
redundant preprocessor conditional.
2014-01-17 02:30:52 +00:00
Andrey Borzenkov
a6e7719bbe fix EFI detection on Windows
We are on legacy BIOS if GetFirmwareEnvironmentVariable fails (returns
zero) *and* extended error information is ERROR_INVALID_FUNCTION.

Cf. http://msdn.microsoft.com/en-us/library/windows/desktop/ms724325%28v=vs.85%29.aspx
2013-12-25 22:36:28 +04:00
Vladimir Serbinenko
e5fa26e573 Make newly-created files other than grub.cfg world-readable. 2013-12-24 17:36:10 +01:00
Vladimir Serbinenko
f7c7c4d4ad Make grub_util_device_is_mapped_stat available in grub-emu core. 2013-12-24 16:56:14 +01:00
Vladimir Serbinenko
e88f0420b9 Make grub_util_devmapper_part_to_disk and grub_util_find_partition_start
follow the same algorithm to avoid method mismatch. Don't assume
	DMRAID- UUID to mean full disk but instead check that mapping is linear.
2013-12-24 14:16:57 +01:00
Vladimir Serbinenko
0b602bf9ad * grub-core/osdep/unix/getroot.c: Non-unix build fix. 2013-12-21 18:10:05 +01:00
Vladimir Serbinenko
ae558c2ccf Enable -Wformat=2 if it's supported. 2013-12-21 15:28:28 +01:00
Vladimir Serbinenko
579ee114b1 Add missing static qualifiers. 2013-12-21 13:50:13 +01:00
Vladimir Serbinenko
5dbde526a8 Inline printf templates when possible to enable format checking. 2013-12-21 13:40:18 +01:00
David Prévot
496a6b3024 Correct some translatable strings. 2013-12-21 03:03:31 +01:00
Vladimir Serbinenko
bfdfeb2508 Clarify several translatable messages. 2013-12-21 01:41:16 +01:00
Colin Watson
3bc1b2daab Fix various build problems on GNU/Hurd.
* grub-core/osdep/unix/getroot.c (strip_extra_slashes): Move inside
!defined (__GNU__).
(xgetcwd): Likewise.
* include/grub/emu/hostdisk.h (grub_util_hurd_get_disk_info)
[__GNU__]: Add prototype.
* util/getroot.c (grub_util_biosdisk_get_grub_dev) [__GNU__]: Format
long int using %ld rather than %d.
2013-12-20 14:02:27 +00:00
Vladimir Serbinenko
7a7f52388b Make grub_util_get_windows_path_real static. 2013-12-18 07:45:15 +01:00
Vladimir Serbinenko
57a691b7e7 Decrease number of strings to translate. 2013-12-18 07:26:13 +01:00
Vladimir Serbinenko
636977b089 Mark strings for translation and add remaining ones to exclude list. 2013-12-18 06:50:24 +01:00
Vladimir Serbinenko
18e76955be Use %I64 and not %ll when using OS printf if compiling for windows. 2013-12-17 16:04:47 +01:00
Andrey Borzenkov
840a2c0592 add verbose information to linux platform check
As suggested by Vladimir Serbienko, add additional verbose output to inform
why we selected this specific platform.
2013-12-16 23:17:40 +04:00
Andrey Borzenkov
d770e63557 use grub_util_exec_redirect_all to silence "moprobe efivars"
modprobe -q still prints error on non-EFI. Redirect stderr instead.

Reported by Javier Vasquez.
2013-12-16 22:41:16 +04:00
Andrey Borzenkov
396311f0f6 consolidate grub_util_exec code
We need to hide "modprobe efivars" error output to avoid confusion. So
consolidate grub_util_exec_* into single function that can optionally redirect
all three standard descriptors and make all other functions compatibility
wrappers.

Also remove include/grub/osdep/exec_unix.h which does not appear to be used
anywhere.
2013-12-16 22:41:15 +04:00
Vladimir Serbinenko
fadddc260a Merge branch 'master' of git.sv.gnu.org:/srv/git/grub
Conflicts:
	ChangeLog
2013-12-16 14:15:37 +01:00
Vladimir Serbinenko
4f979ccbf1 Use unix functions for temporary files and special files on cygwin. 2013-12-16 13:16:37 +01:00
Andrey Borzenkov
e477187bf4 small fixes for Windows EFI install code
Fix potential crash caused by signed vs. unsigned comparison. Negative
length compares as very large unsigned number causing subsequent NULL access.

Make exhaustive search for all BootNNNN variables to find one matching
requested efi_distributor.
2013-12-15 22:00:15 +04:00
Vladimir Serbinenko
814442ba69 Implement windows flavour of EFI install routines. 2013-12-14 23:35:58 +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
38933cee85 Workaround cygwin bug when using \\?\Volume{GUID} syntax. 2013-12-14 23:28:34 +01:00
Vladimir Serbinenko
6d3cfe5063 Do not use TCHAR string functions as they are not available on cygwin. 2013-12-14 23:25:30 +01:00
Vladimir Serbinenko
4bad23a15f Workaround windows bug when querying EFI system partition parameters. 2013-12-14 23:23:11 +01:00