diff options
author | Michael Brown <mcb30@ipxe.org> | 2021-02-28 13:45:58 +0000 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2021-02-28 23:28:23 +0000 |
commit | f309d7a7b78eec10621bc71f9401d5b9257f9f39 (patch) | |
tree | 118bfa718065739e8f21e776b515c6457a68d221 /src/hci | |
parent | 040cdd0c658a49694b17a1c0b5439d0bd7805242 (diff) | |
download | ipxe-f309d7a7b78eec10621bc71f9401d5b9257f9f39.tar.gz |
[linux] Use host glibc system call wrappers
When building as a Linux userspace application, iPXE currently
implements its own system calls to the host kernel rather than relying
on the host's C library. The output binary is statically linked and
has no external dependencies.
This matches the general philosophy of other platforms on which iPXE
runs, since there are no external libraries available on either BIOS
or UEFI bare metal. However, it would be useful for the Linux
userspace application to be able to link against host libraries such
as libslirp.
Modify the build process to perform a two-stage link: first picking
out the requested objects in the usual way from blib.a but with
relocations left present, then linking again with a helper object to
create a standard hosted application. The helper object provides the
standard main() entry point and wrappers for the Linux system calls
required by the iPXE Linux drivers and interface code.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/hci')
-rw-r--r-- | src/hci/linux_args.c | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/src/hci/linux_args.c b/src/hci/linux_args.c index 5f903e3b6..12020bd0b 100644 --- a/src/hci/linux_args.c +++ b/src/hci/linux_args.c @@ -18,7 +18,6 @@ FILE_LICENCE(GPL2_OR_LATER); -#include <hci/linux_args.h> #include <getopt.h> #include <string.h> #include <stdio.h> @@ -27,21 +26,8 @@ FILE_LICENCE(GPL2_OR_LATER); #include <ipxe/malloc.h> #include <ipxe/init.h> -/** Saved argc */ -static int saved_argc = 0; -/** Saved argv */ -static char ** saved_argv; - -/** - * Save argc and argv for later access. - * - * To be called by linuxprefix - */ -__asmcall void save_args(int argc, char **argv) -{ - saved_argc = argc; - saved_argv = argv; -} +int linux_argc; +char **linux_argv; /** Supported command-line options */ static struct option options[] = { @@ -138,7 +124,7 @@ void linux_args_parse() while (1) { int option_index = 0; - c = getopt_long(saved_argc, saved_argv, "", options, &option_index); + c = getopt_long(linux_argc, linux_argv, "", options, &option_index); if (c == -1) break; |