util/grub-mkimagexx.c is included in a special way into mkimage.c.
Interoperation between defines makes this very tricky. Instead
just have a clean interface and compile util/grub-mkimage*.c separately
from mkimage.c
all_video module does not have any code or data and exists solely for
.moddeps section to pull in dependencies. This makes all symbols unneeded.
While in current binutils (last released version as of this commit is 2.26)
``strip --strip-unneeded'' unintentionally adds section symbols for each
existing section, this behavior was considered a bug and changed in commit
14f2c699ddca1e2f706342dffc59a6c7e23e844c to completely strip symbol table
in this case.
Older binutils (verified with 2.17) and some other toolchains (at least
elftoolchain r3223M), both used in FreeBSD, remove symbol table in all_video
as well.
Relax run-time check and do not return error for modules without symbol table.
Add additional checks to module verifier to make sure such modules
a) have non-empty .moddeps section. Without either externally visible symbols
or .moddeps modules are completely useless and should not be built.
b) do not have any relocations.
Closes: 46986
v2: add run-time check for empty symbol table if relocations are present as
suggested by Vladimir.
If root filesystem is multidev btrfs, do not attempt to pass all devices as
kernel root= argument. This results in splitting command line in GRUB due to
embedded newline and even if we managed to quote it, kernel does not know how
to interpret it anyway. Multidev btrfs requires user space device scanning,
so passing single device would not work too.
This still respects user settings GRUB_DISABLE_LINUX_UUID. Not sure what we
should do in this case.
Closes: 45709
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).
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.
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>
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
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.
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>