Commit graph

2079 commits

Author SHA1 Message Date
Andrei Borzenkov
d5cc487d39 grub-probe: fix memory leak
Found by: Coverity scan.
CID: 73783
2016-01-09 13:55:28 +03:00
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
57e7f1b775 setup: fix memory leak
Found by: Coverity scan.
CID: 73680, 73715
2016-01-09 13:10:10 +03:00
Andrei Borzenkov
efc04d65c7 grub-module-verifier: fix unintended sign extension
Found by: Coverity scan.
CID: 156533, 156532
2016-01-09 11:36:42 +03:00
Vladimir Serbinenko
3f430a0126 Move file loading functions to grub-emu.
So that we can use it in grub-emu as well as utils.
2016-01-05 21:10:27 +01:00
Vladimir Serbinenko
dcc499aaf0 module-verifier: allow limited-range relocations on sparc64.
clang as incomplete mcmodel=large support. As we don't currently need full
mcmodel=large support for sparc64, relax those checks.
2015-12-31 18:30:39 +01:00
Vladimir Serbinenko
e1b2b9bf1d module-verifier: Check range-limited relative relocations.
Check that they point to the same module, so will end up in the same
chunk of memory.
2015-12-31 15:29:28 +01:00
Vladimir Serbinenko
a7cf8b1e23 Verify modules on build-time rather than failing in runtime. 2015-12-31 13:09:15 +01:00
Andrey Borzenkov
2333a83baa 30_os-prober: derive --class from os-prober generated label
Currently only Windows gets distinguished icons, everything else is displayed
using the same generic one. Add additional --class based on os-prober returned
label, which usually is expected to match primary distribution name.

Also use it for Windows as well - chainloader prober may actually return
different strings (Windows, MS-DOS, Windows9xME).
2015-12-30 22:30:16 +03:00
Vladimir Serbinenko
dbab354157 grub-mkrescue: Delete temporary file
Reported by: Thomas Schmitt
2015-12-29 17:48:34 +01:00
Vladimir Serbinenko
4111882828 grub-mount: Fix oath parsing.
Brackets detection was copied from somewhere else and makes no sense in case
of grub-mount and prevents user from accessing and files with ) in them.
2015-12-29 17:43:05 +01:00
Andrei Borzenkov
1018e91dce mkimage: zero fill alignment space
This did not cause real problem but is good for reproducible builds. I hit
it with recent bootinfoscript that displays embedded config; I was puzzled
by random garbage at the end.

Prezero memory buffer used to assemble core.img. This makes individual
memset redundant. Also ensure buffer is filled with zeroes in several other
places.

Also remove redundant zeroing code where we fill in the whole memory block
anyway.
2015-11-06 21:33:28 +03:00
Eric Snowberg
8cb4c4edbe sparc64 - use correct drive name within grub_util_sparc_setup
Incorrect drive name was being passed into grub_util_sparc_setup,
causing the grub-install to fail.

Signed-off-by: Eric Snowberg <eric.snowberg@oracle.com>
2015-10-07 19:51:57 +03:00
Vladimir Serbinenko
a2721778e5 grub-install: Use a+ in fopen rather than r+.
r+ does not create a file if none exists.
2015-07-27 12:42:47 +02:00
Andrei Borzenkov
4358e0c81e grub-probe: fix memory leak in probe (ofpath)
Found by: Coverity scan.
CID: 73772
2015-06-19 20:47:44 +03:00
Andrei Borzenkov
03f1f24e37 grub-probe: restructure code to make static analysis easier
Current code in probe() could not be verified to not contain memory leaks.
Restructure code and ensure grub_device_close is always called at the end of
loop.

Calms down Coverity scan.
CID: 73739
2015-06-19 20:47:43 +03:00
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
Vladimir Serbinenko
2dcf260d89 util/grub-mkrescue: Fix compilation 2015-05-07 19:45:06 +02:00
Vladimir Serbinenko
9916ed6f82 grub-install-common: Increase buf size to 8192 as modinfo.sh is bigger. 2015-05-07 17:09:58 +02:00
Vladimir Serbinenko
5fd1cb980a grub-mkrescue: Recognize -output as an alias of --output.
This helps us to be in line with xorriso -as mkisofs.

Suggested by: Thomas Schmitt
2015-05-07 16:34:34 +02:00
Andrei Borzenkov
104dff36ea grub-mkconfig: use $pkgdatadir in scripts
Otherwise scripts will source wrong grub-mkconfig_lib.
2015-04-29 19:18:54 +03:00
Vladimir Serbinenko
70b002de55 Remove -V in grub-mkrescue.c
It clashhes with -V which is alias to -volid.
2015-04-24 17:52:30 +02:00
Andrei Borzenkov
12bf557039 do not emit cryptomount without crypto UUID 2015-03-28 22:13:35 +03:00
Daniel Kahn Gillmor
85a7be2414 util/mkimage: Use stable timestamp when generating binaries. 2015-03-27 13:26:48 +01:00
Vladimir Serbinenko
cf47a2fba5 grub-mkrescue: pass all unrecognized options unchanged to xorriso. 2015-03-20 12:55:27 +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
018f79da6f grub-probe: free temporary variable 2015-02-28 20:19:57 +03:00
Vladimir Serbinenko
afd6b6bbae grub-probe: Mark a "[default=]" for translation. 2015-02-28 16:22:46 +01:00
Jiri Slaby
32cd33bd19 util: mkimage, fix gcc5 build failure
gcc5 reports:
../util/mkimage.c: In function 'grub_install_get_image_target':
../util/mkimage.c:954:5: error: loop exit may only be reached after undefined behavior [-Werror=aggressive-loop-optimizations]
     && j < ARRAY_SIZE (image_targets[i].names); j++)
     ^
../util/mkimage.c:953:39: note: possible undefined statement is here
      for (j = 0; image_targets[i].names[j]
                                        ^

Well, let's move the index 'j' test before accesing the array to:
1) make the loop obvious
2) make gcc happy

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
2015-02-12 22:18:01 +03:00
Andrei Borzenkov
016875dd52 setup: fix blocklist size calculation
Found by: Coverity scan.
2015-01-30 22:57:39 +03:00
Andrei Borzenkov
151c19a42a grub-fstest: fix descriptor leak
Found by: Coverity scan.
2015-01-30 22:45:58 +03:00
Andrei Borzenkov
7aaed66455 grub-mkimage: fix potential NULL pointer dereference
Move fatal check whether symtab_section is NULL before first reference.

Found by: Coverity scan.
2015-01-30 22:26:05 +03:00
Andrei Borzenkov
11aae26cc3 util/grub-probe: fix memory leaks.
Found by: Coverity scan.
2015-01-27 22:11:52 +03:00
Vladimir Serbinenko
9ee5ae1fae Document intentional fallthroughs.
Found by: Coverity scan.
2015-01-27 17:17:58 +01:00
Andrei Borzenkov
bd196014ec util/setup: fix memory leak.
Found by: Coverity scan.
2015-01-26 23:04:09 +03:00
Andrei Borzenkov
fe4efe0d50 util/mkimage: fix memory leaks.
Found by: Coverity scan.
2015-01-26 23:04:09 +03:00
Andrei Borzenkov
1a87156e01 util/grub-mount: fix descriptor leak.
Found by: Coverity scan.
2015-01-26 23:04:09 +03:00
Andrei Borzenkov
bd4e20eedf util/grub-mkstandalone: fix memory leak.
Found by: Coverity scan.
2015-01-26 23:04:09 +03:00
Andrei Borzenkov
be0743b052 util/grub-install: rearrange code to avoid memory leak.
Found by: Coverity scan.
2015-01-26 23:04:09 +03:00
Andrei Borzenkov
5e27fb06f2 util/install: fix memory leak.
Found by: Coverity scan.
2015-01-26 23:04:09 +03:00
Andrei Borzenkov
64440daa21 util/setup: fix memory leak.
Found by: Coverity scan.
2015-01-26 23:04:09 +03:00
Vladimir Serbinenko
11eed6abce util/misc.c: Check ftello return value.
Found by: Coverity scan.
2015-01-26 09:56:24 +01:00
Vladimir Serbinenko
5d61a6a612 grub-macbless: Fix resource leak.
Found by: Coverity scan.
2015-01-26 09:55:58 +01:00
Vladimir Serbinenko
3c6384832b grub-install: Fix memory leak.
Found by: Coverity scan.
2015-01-26 09:55:30 +01:00
Vladimir Serbinenko
c3f5230597 grub-install-common: Fix sizeof usage.
Found by: Coverity scan.
2015-01-26 09:54:50 +01:00
Vladimir Serbinenko
866f469683 util/getroot: Add missing grub_disk_close.
Found by: Coverity scan.
2015-01-26 09:54:14 +01:00
Vladimir Serbinenko
eeea31b220 util/grub-mkrescue.c: Always include part_msdos and part_gpt on EFI.
When booted from stick, EFI would use GPT partition and our root
device detection algortihm depends on GRUB's ability to see the same
partitions. Hence include msdos and gpt partmap modules on EFI even when
they're not needed to access root filesystem.
2015-01-24 17:45:16 +01:00
Andrei Borzenkov
cdae5bf208 Avoid use of non-portable echo -n in grub-mkconfig
util/grub-mkconfig_lib.in(version_test_gt): "echo -n" is not really needed,
final newline is stripped by command substitution.

util/grub.d/10_kfreebsd.in, util/grub.d/10_linux.in,
util/grub.d/20_linux_xen.in: change how list is built, to avoid echo -n
completely.

util/grub.d/30_os-prober.in: add spaces to printed line directly

Closes 43668.
2014-12-07 14:56:17 +03:00
Andrei Borzenkov
740c08ed2f Use ssize_t for grub_util_fd_read result
Fixes commit 0415dbe28f.
2014-11-28 21:43:07 +03:00
Andrei Borzenkov
0415dbe28f grub-install-common: avoid out of bound access when read failed
Check that modinfo.sh could be read successfully; abort on error. Avoids
potential out-of-bound array access.

CID: 73819
2014-11-28 20:45:27 +03:00
Andrei Borzenkov
478b567520 grub-mkstandalone: out of bound access to tar header magic
Magic size is 6 bytes and we copied 7 bytes in it.

CID: 73587, 73888
Closes bug 43690
2014-11-28 20:39:22 +03:00
Andrey Borzenkov
954fe77163 cleanup: grub_cpu_to_XXX_compile_time for constants
This tries to catch all cases where grub_cpu_to_XXX was used for constant
expressions (including sizeof).
2014-09-22 20:47:10 +04:00
Andrey Borzenkov
c291f47b2c Fix typo (gettext_print instead of gettext_printf) 2014-08-14 21:02:31 +04:00
Colin Watson
0901e7855f Fix an infinite loop in grub-mkconfig
* util/grub.d/10_hurd.in: Make kernel list progression not fail on
kernels whose paths contain regex metacharacters.
* util/grub.d/10_kfreebsd.in: Likewise.
* util/grub.d/10_linux.in: Likewise.
* util/grub.d/20_linux_xen.in: Likewise.

Reported by: Heimo Stranner.
2014-07-08 23:54:30 +01:00
Glenn Washburn
fa33530870 * util/grub-install.c: Fix handling of --disk-module. 2014-06-22 01:45:11 +02:00
Trevor Woerner
87de66d9d8 * util/grub-gen-asciih.c (add_glyph): Fix uninitialised variable. 2014-06-21 20:26:47 +02:00
Colin Watson
3a310e842f Tolerate devices with no filesystem UUID returned by os-prober
* util/grub.d/30_os-prober.in: Tolerate devices with no filesystem
UUID.  Other parts of grub-mkconfig tolerate these, they were
previously allowed here up to commit
55e706c918, and they can arise in
practice when the system has active LVM snapshots.
Fixes Ubuntu bug #1287436.
2014-04-10 16:54:33 +01:00
Colin Watson
24024dac7f Fix partmap, cryptodisk, and abstraction handling in grub-mkconfig.
Commit 588744d0dc caused grub-mkconfig
no longer to be forgiving of trailing spaces on grub-probe output
lines, which among other things means that util/grub.d/10_linux.in
no longer detects LVM.  To fix this, make grub-probe's output
delimiting more consistent.  As a bonus, this improves the coverage
of the -0 option.

Fixes Debian bug #735935.

* grub-core/disk/cryptodisk.c
(grub_util_cryptodisk_get_abstraction): Add a user-data argument.
* grub-core/disk/diskfilter.c (grub_diskfilter_get_partmap):
Likewise.
* include/grub/cryptodisk.h (grub_util_cryptodisk_get_abstraction):
Update prototype.
* include/grub/diskfilter.h (grub_diskfilter_get_partmap): Likewise.
* util/grub-install.c (push_partmap_module, push_cryptodisk_module,
probe_mods): Adjust for extra user-data arguments.
* util/grub-probe.c (do_print, probe_partmap, probe_cryptodisk_uuid,
probe_abstraction): Use configured delimiter.  Update callers.
2014-03-31 14:48:46 +01:00
Colin Watson
9b35fe819f Fix grub-probe -0 option
* util/grub-probe,c (options): Make -0 work again (broken by
conversion to argp).
(main): Simplify logic.
2014-03-31 13:51:17 +01:00
Vladimir Serbinenko
006c78f378 * util/grub-mkrescue.c: Build fix for argp.h with older gcc. 2014-02-03 14:35:51 +01:00
Vladimir Serbinenko
511ece7ceb * util/grub-mkfont.c: Build fix for argp.h with older gcc. 2014-02-03 14:34:27 +01:00
Vladimir Serbinenko
ba424f37a9 * util/grub-mkfont.c: Downgrade warnings about unhandled features
to debug.
2014-01-29 23:41:48 +01:00
Andrey Borzenkov
5ae584c0b0 fix Mingw W64-32 cross compile failure due to printf redefinition in libintl.h
In file included from util/misc.c:36:0:
./include/grub/emu/misc.h:56:1: error: 'libintl_printf' is an unrecognized format function type [-Werror=format=]
 char * EXPORT_FUNC(xasprintf) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2))) WARN_UNUSED_RESULT;
 ^
./include/grub/emu/misc.h:58:1: error: 'libintl_printf' is an unrecognized format function type [-Werror=format=]

The reason is libintl.h which redefines printf as libintl_printf. The problem
is not present in native MinGW build which avoids redefinition.  Use
(format (__printf__) instead which is valid replacement in GCC.

v2: add grub-core/lib/libgcrypt/src/g10lib.h
v3: modify g10lib.h during import
2014-01-25 21:49:41 +04:00
Andrey Borzenkov
1440b7ebae do not set default prefix in grub-mkimage
Default prefix is likely wrong on Unix and completely wrong on Windows.
Let caller set it explicitly to avoid any ambiguity.
2014-01-25 19:54:51 +04:00
Vladimir Serbinenko
61c8482b20 Fix several translatable strings.
Suggested by: D. Prévot.
2014-01-24 18:20:27 +01:00
Vladimir Serbinenko
95cd131ea0 * util/grub-install.c: List available targets. 2014-01-24 18:09:25 +01:00
Colin Watson
d08059309f * util/grub-install.c (write_to_disk): Add an info message. 2014-01-23 12:05:36 +00:00
Vladimir Serbinenko
b204b718cc * util/grub-install.c: Fix a typo. 2014-01-18 20:02:51 +01:00
Vladimir Serbinenko
ae80f31270 * util/grub-mount.c: Extend GCC warning workaround to grub-mount. 2014-01-18 16:43:29 +01:00
Colin Watson
ff66b8e7d8 Prefer more portable test(1) constructs
* util/grub.d/00_header.in (make_timeout): Use && rather than test
-a.
* util/grub.d/10_windows.in: Likewise.
* util/grub.d/10_netbsd.in (netbsd_load_fs_module): Use || rather
than test -o.
* util/grub.d/30_os-prober.in: Use && rather than test -a, and ||
rather than test -o.
2014-01-17 15:29:43 +00:00
Andrey Borzenkov
0776112c53 add part_apple to EFI rescue image to fix missing prefix
On Mac rescue image is booted from HFS+ partition, so bootpath looks like
/ACPI(a0341d0,0)/PCI(1,1f)/ATAPI(0,0,0)/HD(3,5d1,ca3,0000000000000000,20,0)/EndEntire

grub fails to find device for this path because it cannot scan partition
table. The simplest fix is to add part_apple by default.
2014-01-12 15:29:21 +04:00
Andrey Borzenkov
e7cfa8d5e1 Change grub-mkrescue to use bootaa64.efi too
Also add ChangeLog entry for previous change.
2014-01-07 20:34:25 +04:00
Andrey Borzenkov
c9e839e2ca use {grub,boot}aa64.efi for boot images on AArch64
According to UEFI 2.4 specification, default boot file name on AArch64
is BOOTAA64.EFI (3.4.1.1 Removable Media Boot Behavior). Also set default
GRUB image name to grubaa64.efi to match it.
2014-01-07 10:38:54 +04:00
Andrey Borzenkov
46f8d358ef * util/grub-probe.c: Improve help message and simplify list handling. 2013-12-24 20:30:16 +01:00
Vladimir Serbinenko
faf4a65e1e Revert grub-file usage in grub-mkconfig. 2013-12-24 17:47:27 +01:00
Andrey Borzenkov
569766e49b * util/grub.d/00_header.in: Improve compatibility with old config. 2013-12-24 17:26:05 +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
808e97c4e7 ARM64 support for grub-mkrescue. 2013-12-23 18:17:09 +01:00
Vladimir Serbinenko
e388db904c Install modinfo.sh to keep build information around. 2013-12-23 18:17:09 +01:00
Vladimir Serbinenko
a4d610026f ARM64 grub-file and grub-mkconfig support. 2013-12-23 18:17:09 +01:00
Andrey Borzenkov
77ec462a56 grub-mkconfig: fix Xen platform conditions 2013-12-22 23:47:26 +04:00
Andrey Borzenkov
3bf2db8959 split grub-mkresecue help text to facilitate translations
Split single string in help message into several strings used before in shell
grub-mkrescue to minimize changes to existing translations.

Reported by Benno Schulenberg
2013-12-22 22:51:54 +04:00
Lars Wendler
3deedfc033 * util/grub-mkconfig.in: Skip non-executable files. 2013-12-22 16:38:28 +01:00
Vladimir Serbinenko
ca3e20886e Build fixes for argp.h with older gcc. 2013-12-21 18:08:25 +01:00
Vladimir Serbinenko
27db1a9b64 * util/grub-glue-efi.c: Use "universal binary" rather "fat binary"
in strings.

	Suggested by: David Prévot.
2013-12-21 16:12:24 +01:00
Vladimir Serbinenko
ae558c2ccf Enable -Wformat=2 if it's supported. 2013-12-21 15:28:28 +01:00
Vladimir Serbinenko
74763e9615 * util/misc.c (grub_util_get_image_size): Check for overflow. 2013-12-21 14:28:14 +01:00
Vladimir Serbinenko
62ce03cf40 * util/import_gcry.py: Skip sample keys. 2013-12-21 14:07:42 +01:00
Vladimir Serbinenko
f4d70fd02b * util/misc.c (grub_qsort_strcmp): Don't discard const attribute. 2013-12-21 14:04:50 +01:00
Vladimir Serbinenko
579ee114b1 Add missing static qualifiers. 2013-12-21 13:50:13 +01:00
Vladimir Serbinenko
ee5283d66b Add missing includes. 2013-12-21 13:47:27 +01:00
David Prévot
496a6b3024 Correct some translatable strings. 2013-12-21 03:03:31 +01:00
Colin Watson
971038be55 * util/grub-mkrescue.c: Rephrase mkrescue description. 2013-12-21 02:37:14 +01:00
Vladimir Serbinenko
bfdfeb2508 Clarify several translatable messages. 2013-12-21 01:41:16 +01:00
Vladimir Serbinenko
c00c34efe1 Merge branch 'master' of git.sv.gnu.org:/srv/git/grub 2013-12-20 17:13:24 +01:00
Vladimir Serbinenko
871aa709af * util/grub-install.c: Inform user about install platform. 2013-12-20 16:57:48 +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
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
ee4450eb6f * util/grub-file.c (main): Fix sizeof usage. 2013-12-18 06:20:20 +01:00
Vladimir Serbinenko
8f5add13ff Implement syslinux parser. 2013-12-18 05:28:05 +01:00
Vladimir Serbinenko
f4dab3d1ac Use grub_xasprintf to format translated error messages containing
64-bit quantity.
2013-12-17 16:41:09 +01:00
Vladimir Serbinenko
d6c2782a90 Unify message for unsupported relocation. 2013-12-17 16:17:46 +01:00
Vladimir Serbinenko
50d2e9596f Mark miscompile error for translation. 2013-12-17 16:05:39 +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
Vladimir Serbinenko
d218ec9738 Update Mac code to match new register_efi prototype. 2013-12-17 16:02:36 +01:00
Vladimir Serbinenko
b8765fa082 Implement better integration with Mac firmware. 2013-12-17 15:21:02 +01:00
Vladimir Serbinenko
ec824e0f2a Implement grub_file tool and use it to implement generating of config
in separate root.
2013-12-17 14:39:48 +01:00
Vladimir Serbinenko
a82010503e Update exclude.pot and mark few strings for translation. 2013-12-17 01:18:09 +01:00
Vladimir Serbinenko
6cc8959712 * util/grub-mkrescue.c: Fix incorrect file usage in fallback code.
Reported by: Jon McCune
2013-12-17 00:33:55 +01:00
Vladimir Serbinenko
6f1f6a0c82 Add support for converting PE+ to Elf64. 2013-12-16 15:30:50 +01:00
Vladimir Serbinenko
f4171ebd34 Handle X86_64_PC64 relocation.
Those are generated by some cygwin compilers.
2013-12-16 14:24:19 +01:00
Vladimir Serbinenko
e7c418c58f * util/grub-mkimagexx.c (relocate_addresses): Display offset rather
than almost useless pointer.
2013-12-15 14:18:30 +01:00
Vladimir Serbinenko
7e47e27bd8 Add gcc_struct to all packed structures when compiling with mingw.
Just "packed" doesn't always pack the way we expect.
2013-12-15 14:14:30 +01:00
Vladimir Serbinenko
74e7ad6604 * util/grub-pe2elf.c: Fix handling of .bss. 2013-12-15 00:55:17 +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
60b967be7e Make i386-* other than i386-pc compileable under cygwin. 2013-12-14 23:12:53 +01:00
Vladimir Serbinenko
954c723acc * util/config.c: Remove trailing newline from distributor in simple
parsing.
2013-12-14 21:50:36 +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
Colin Watson
fe4ae21331 * util/grub-mkconfig.in: Add missing newline to output. 2013-12-09 00:14:59 +00:00
Vladimir Serbinenko
c8fd2ddf6d * util/grub-mkfont.c: Replace stpcpy with grub_stpcpy. 2013-12-07 23:28:20 +01: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
Vladimir Serbinenko
4c4ea9c7b5 Merge GRUBFS and GRUB_FS variables. 2013-12-07 16:09:39 +01:00
Andrey Borzenkov
92e9352ded second attempt to fix using grub device name as install device
grub-install already resolved passed install device to grub device. So do the
same as grub-setup and strip parenthesis if we get legacy (hdX).

I accidentally commited revert of 69ca97c820 and
this patch as part of f585c90505. So this commit
just adds ChangeLog entry and cosmetic whitespace fix.
2013-12-07 18:58:19 +04:00
Andrey Borzenkov
f585c90505 fix partition module names when /boot is on diskfilter
/usr/local/grub2/sbin/grub-install: info: grub-mkimage --directory '/usr/local/grub2/lib/grub/i386-pc' --prefix '(mduuid/e6d1dcf06cea72140bafae74a8677f36)/grub' --output '/boot/grub/i386-pc/core.img' --format 'i386-pc' --compression 'auto'  'ext2' 'msdos' 'msdos' 'diskfilter' 'mdraid1x' 'biosdisk'
.
/usr/local/grub2/sbin/grub-install: error: cannot open `/usr/local/grub2/lib/grub/i386-pc/msdos.mod': No such file or directory.

Introduce common helper for both diskfilter and non-diskfilter case that
converts partition map names into module names.
2013-12-07 15:00:37 +04: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
Andrey Borzenkov
ad73cc3312 fix use of grub-probe instead of ${grub_probe} 2013-12-07 14:24:25 +04:00
Vladimir Serbinenko
8c534b85f1 Revamp relocation handling.
Move more code to common dl.c. Add missing veneers for arm and arm64.
	Decreases kernel size by 70 bytes on i386-pc (40-50 compressed)
2013-12-06 09:18:55 +01:00
Vladimir Serbinenko
a846dd4b3a * util/grub-mkimagexx.c: Fix reloc section generation for ia64. 2013-12-05 23:07:10 +01:00
Vladimir Serbinenko
b0f311f412 * util/grub-install.c: Mention Boot* variable. 2013-12-05 17:05:21 +01:00
Vladimir Serbinenko
e5ed2f6947 Handle unaligned .bss on sparc64.
Current code improperly assumes that both __bss_start and _end are
	aligned to 8-bytes. Eliminating this assumption and explicitly align
	modules.
2013-12-05 06:35:19 +01: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
Colin Watson
44d4884779 Merge branch 'cjwatson/timeout-style' 2013-12-03 16:15:45 +00:00
Vladimir Serbinenko
9e4e6ddfbf * util/config.c: Add missing pointer adjustment.
Reported by: qwertial
2013-12-02 06:51:13 +01:00
Leif Lindholm
b29b77fee2 New port arm64-efi 2013-11-30 16:50:31 +01:00
Colin Watson
9b70860ecc Consolidate timeout generation code a bit. 2013-11-29 16:11:53 +00:00
Colin Watson
095588ef34 Consistently ignore GRUB_TIMEOUT if GRUB_HIDDEN_TIMEOUT is set
Pointed out by Vladimir Serbinenko.
2013-11-29 15:30:44 +00:00
Colin Watson
53cc63bf85 Add GRUB_TIMEOUT_STYLE_BUTTON support
Suggested by Vladimir Serbinenko.
2013-11-29 15:18:05 +00:00
Colin Watson
fd0df6d098 Fix build with FreeType 2.5.1
* util/grub-gen-asciih.c: Include FT_SYNTHESIS_H rather than
<freetype/ftsynth.h>, fixing build with FreeType 2.5.1.
* util/grub-gen-widthspec.c: Likewise.
* util/grub-mkfont.c: Likewise.
2013-11-29 12:19:36 +00:00
Andrey Borzenkov
69ca97c820 fix using grub device name as install device
Shell version of grub-install called grub-setup which resolved
install device name and called main setup routine. C version of
grub-install calls main setup routine directly, which leads
to the error:

grub2-install: info: grub-bios-setup  --verbose  --force  --skip-fs-probe --directory='/boot/grub2/i386-pc' --device-map='/boot/grub2/device.map' '(hd2)'.
grub2-install: info: reading /boot/grub2/i386-pc/boot.img.
grub2-install: info: reading /boot/grub2/i386-pc/core.img.
grub2-install: info: root is `(null)', dest is `(hd2)'.
grub2-install: info: Opening dest.
grub2-install: info: drive = -1.
grub2-install: error: disk `(hd2)' not found.

Move resolving of destination device name into main setup routine
so it is done consistently in both cases.
2013-11-29 11:32:34 +04:00
Vladimir Serbinenko
621e167fd6 * util/grub-fstest.c: Remove variable length arrays. 2013-11-29 05:50:32 +01:00
Vladimir Serbinenko
c8a0f1b229 * util/mkimage.c (grub_install_generate_image): Use grub_crypto_hash for
computing crc32 rather than handling with md fundtions directly.
2013-11-29 04:14:26 +01:00
Vladimir Serbinenko
726409a513 * util/mkimage.c (grub_install_generate_image): Use grub_crypto_hash for
checking fwstart.img rather than md fundtions directly.
2013-11-29 04:05:44 +01:00
Vladimir Serbinenko
422e6e886c * util/grub-mkrescue.c (main): Check that fread succeeded. 2013-11-29 03:54:21 +01:00
Colin Watson
8f236c1419 Revamp hidden timeout handling
Add a new timeout_style environment variable and a corresponding
GRUB_TIMEOUT_STYLE configuration key for grub-mkconfig.  This
controls hidden-timeout handling more simply than the previous
arrangements, and pressing any hotkeys associated with menu entries
during the hidden timeout will now boot the corresponding menu entry
immediately.

GRUB_HIDDEN_TIMEOUT=<non-empty> + GRUB_TIMEOUT=<non-zero> now
generates a warning, and if it shows the menu it will do so as if
the second timeout were not present.  Other combinations are
translated into reasonable equivalents.
2013-11-28 02:29:15 +00:00
Vladimir Serbinenko
4f9541226c Introduce grub_util_file_sync and use it instead of fsync(fileno(f)).
Fixes build for windows.
2013-11-27 14:13:50 +01:00
Colin Watson
5c7206e45e Speed up test suite by avoiding fsync
Add grub_util_disable_fd_syncs call to turn grub_util_fd_sync calls into
no-ops, and use it in programs that copy files but do not need to take
special care to sync writes (grub-mknetdir, grub-rescue,
grub-mkstandalone).

On my laptop, this reduces partmap_test's runtime from 1236 seconds to
204 seconds.
2013-11-27 10:10:22 +00:00
Vladimir Serbinenko
bee1b5ce3f * util/grub-mknetdir.c: Look for platform directories under pkglibdir
and not pkgdatadir.
2013-11-25 19:16:05 +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