Peter Jones
64e26162eb
calloc: Make sure we always have an overflow-checking calloc() available
...
This tries to make sure that everywhere in this source tree, we always have
an appropriate version of calloc() (i.e. grub_calloc(), xcalloc(), etc.)
available, and that they all safely check for overflow and return NULL when
it would occur.
Signed-off-by: Peter Jones <pjones@redhat.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2020-07-29 16:55:47 +02:00
Vladimir 'phcoder' Serbinenko
5610734770
hostfs: #undef open and close.
...
Unlike in case of disks in this case it's just a single place, so it's easier
to just #undef
Signed-off-by: Vladimir Serbinenko <phcoder@google.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2019-06-07 15:36:28 +02:00
Vladimir Serbinenko
ad4bfeec5c
Change fs functions to add fs_ prefix
...
This avoid conflict with gnulib
Signed-off-by: Vladimir Serbinenko <phcoder@google.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2019-04-09 10:03:29 +10:00
Vladimir Serbinenko
384091967d
Rename grub_disk members
...
Otherwise it horribly clashes with gnulib when it's
replacing open/write/read/close
Signed-off-by: Vladimir Serbinenko <phcoder@google.com>
2019-03-25 15:14:52 +01:00
Vladimir Serbinenko
d900dfa985
kern/emu/misc.c: Don't include config-util.h when running as GRUB_BUILD
...
Signed-off-by: Vladimir Serbinenko <phcoder@google.com>
2019-03-25 15:10:15 +01:00
Alexander Graf
f1957dc8a3
RISC-V: Add to build system
...
This patch adds support for RISC-V to the grub build system. With this
patch, I can successfully build grub on RISC-V as a UEFI application.
Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2019-02-25 14:02:05 +01:00
Vladimir Serbinenko
43dbf83aa2
Ensure that grub_reboot doesn't return on emu.
...
Use grub_fatal if longjmp fails.
grub_reboot is marked as noreturn so return would cause
a crash.
2017-01-27 20:10:23 +00:00
Pete Batard
4e0f8f66e3
Add missing va_end() to xasprintf() in grub-emu.
2016-08-13 16:36:01 +03:00
Vladimir Serbinenko
281baeecd3
Fix emu compilation error on arm.
2016-02-12 09:10:08 +01:00
Michael Chang
64e2d139fe
Restore terminal settings on grub-emu exit.
2016-01-22 11:05:32 +01:00
Andrei Borzenkov
269a522c7d
hostdisk: fix device detection
...
Condition was apparently reversed so GRUB assumed all devices were
files. This later made it skip BLKFLSBUF ioctl on Linux which caused
various page cache coherency issues. Observed were
- failure to validate blocklist install (read content did not match
just written)
- failure to detect Linux MD on disk after online hot addition
(GRUB got stale superblock)
Closes: 46691
2016-01-10 10:41:04 +03:00
Vladimir Serbinenko
f86fd54cf0
Add memdisk support to grub-emu.
...
Use it to add custom files, so that tests which need them work.
2016-01-05 21:10:27 +01: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
Andrei Borzenkov
2498dc7a3a
hostdisk: fix crash with NULL device.map
...
grub-macbless calls grub_util_biosdisk_init with NULL device.map.
2015-05-17 14:16:36 +03:00
Colin Watson
5974d4ba65
hostfs: Drop unnecessary feature test macros
...
_BSD_SOURCE was added to allow the use of DT_DIR, but that was removed
in e768b77068
. While adding
_DEFAULT_SOURCE as well works around problems with current glibc,
neither is in fact needed nowadays.
2015-03-23 14:32:30 +00: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
66b0e6649b
emu/cache: Change declaration of __clear_cache to match builtin declaration.
...
Fixes compile of arm64-emu.
2015-02-26 22:20:59 +01:00
Vladimir Serbinenko
59d4036594
Replace explicit sizeof divisions by ARRAY_SIZE.
2015-01-21 17:37:31 +01:00
Khem Raj
a276b84046
Fix build with glibc 2.20
...
* grub-core/kern/emu/hostfs.c: squahes below warning
warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Upstream-Status: Submitted
2014-09-15 19:59:27 +04:00
Andrey Borzenkov
989af02582
remove unused error.h from kern/emu/misc.c
...
Fixes compilation on mingw32, where include is apparently missing.
2013-12-28 09:04:10 +04:00
Vladimir Serbinenko
96650a82ec
* grub-core/kern/emu/main.c: Build fix for emu.
2013-12-21 18:09:19 +01:00
Vladimir Serbinenko
ca3e20886e
Build fixes for argp.h with older gcc.
2013-12-21 18:08:25 +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
7a148da6dd
Implement sparc64 trampolines (needed for sparc64-emu).
2013-12-10 00:01:27 +01:00
Vladimir Serbinenko
9a945e2a24
* grub-core/kern/emu/cache.c [__ia64__]: Use our cache cleaning routine
...
on ia64 as __clear_cache is a dummy on ia64.
2013-12-09 14:24:56 +01:00
Vladimir Serbinenko
d14772c455
* grub-core/kern/emu/main.c: Silence missing prototypes to allow emu
...
compilation with GCC <= 4.2.
* grub-core/kern/emu/argp_common.c: Likewise.
2013-12-08 18:21:10 +01:00
Vladimir Serbinenko
fa7eb63dec
* grub-core/kern/emu/lite.c: Add missing include of ../ia64/dl_helper.c.
2013-12-08 18:14:32 +01:00
Vladimir Serbinenko
50b3a68db9
Remove grub_memalign on emu.
2013-12-08 18:12:20 +01:00
Vladimir Serbinenko
d5c14e1e26
Fix mips-emu compilation.
2013-12-08 17:49:02 +01:00
Vladimir Serbinenko
c311ced5d7
Make arm-emu work.
2013-12-08 02:59:21 +01: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
8a3f0a24b5
* grub-core/kern/emu/main.c: Ignore missing prototype for main.
2013-12-04 10:28:23 +01:00
Vladimir Serbinenko
eec893ae49
* grub-core/kern/emu/hostfs.c (is_dir): Remove variable length arrays.
2013-11-29 05:52:20 +01:00
Vladimir Serbinenko
4906052019
Unify GOT/trampoline handling between PPC, MIPS and IA64 as they
...
do essentially the same thing, do it in similar way.
2013-11-21 21:54:33 +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 Serbinenko
33690255c5
Fix grub_machine_fini bitrot.
...
Reported by: Glenn Washburn.
2013-11-10 13:33:26 +01:00
Vladimir Serbinenko
9612ebc00e
Add new ports: i386-xen and x86_64-xen. This allows running GRUB in
...
XEN PV environment and load kernels.
2013-11-09 21:29:11 +01:00
Vladimir Serbinenko
cb72aa1809
Rewrite blocklist functions in order to get progress when
...
reading large extents and decrease amount of blocklist hook calls.
2013-11-01 23:28:03 +01:00
Vladimir Serbinenko
5177391ebe
* include/grub/emu/hostdisk.h: Add proper declaration for grub_host_init
...
and grub_hostfs_init.
2013-10-28 13:33:12 +01:00
Vladimir Serbinenko
64db14b0cb
* grub-core/kern/emu/hostdisk.c (grub_util_check_file_presence): Use
...
windows method on other platforms without good stat as well.
2013-10-28 02:17:56 +01:00
Vladimir 'phcoder' Serbinenko
887c0bb61a
* grub-core/kern/emu/hostdisk.c: Remove few leftover includes.
2013-10-19 16:32:28 +02:00
Vladimir 'phcoder' Serbinenko
df1e64c98e
Define grub_util_is_directory/regular/special_file and
...
use OS-dependent versions rather than to rely on stat().
2013-10-15 20:27:58 +02:00
Vladimir 'phcoder' Serbinenko
f4e0adc0f9
Remove leftover references to some of the system headers.
2013-10-15 17:59:54 +02:00
Vladimir 'phcoder' Serbinenko
f6a81f0aaf
Add wrappers around rename, unlink, mkdir, opendir, readdir and
...
closedir to handle filename charset translation.
2013-10-15 14:11:34 +02:00
Vladimir 'phcoder' Serbinenko
23934da26e
* grub-core/kern/emu/error.c: Removed.
...
* grub-core/Makefile.core.def (kernel): Don't add error.c and progname.c
explicitly as it's already in libgnu.a.
2013-10-15 12:46:06 +02:00
Vladimir 'phcoder' Serbinenko
b73249d260
Make grub_util_fd_seek match behaviour of other grub_util_fd_* and
...
fseeko.
2013-10-14 12:47:09 +02:00
Vladimir 'phcoder' Serbinenko
6de292cb9b
Define GRUB_UTIL_FD_O_* and always use them with grub_util_fd_open.
2013-10-14 02:11:59 +02:00
Vladimir 'phcoder' Serbinenko
21d85db12f
* grub-core/Makefile.core.def: Add osdep/init.c on emu.
...
* grub-core/kern/emu/main.c: Add missing include.
* grub-core/osdep/basic/init.c (grub_util_host_init) [!GRUB_UTIL]:
Don't call grub_util_init_nls.
* grub-core/osdep/windows/init.c (grub_util_host_init) [!GRUB_UTIL]:
Likewise.
2013-10-14 02:06:43 +02:00
Vladimir 'phcoder' Serbinenko
bb338aaf24
Add a wrapper for fopen. On unix-like systems just pass-through. On
...
windows use unicode version.
2013-10-13 20:36:28 +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