Compare commits

..

No commits in common. "201810-compile" and "master" have entirely different histories.

3 changed files with 37 additions and 5 deletions

View file

@ -57,14 +57,14 @@ CONFIG_machspec_netconfig=y
EFIINC = /usr/include/efi
GNUEFILIB = /usr/lib
EFILIB = /usr/lib
EFICRT0 = $(EFILIB)/gnuefi
EFICRT0 = /usr/lib
CDIR := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
TOPDIR =
ALLSUBDIRS = ia32 ia64 x86_64 fs choosers devschemes tools
HOSTARCH = $(shell uname -m | sed s,i[3456789]86,ia32, | sed s,amd64,x86_64, )
ARCH := $(shell uname -m | sed s,i[3456789]86,ia32, | sed s,amd64,x86_64, )
HOSTARCH = $(shell dpkg-architecture -qDEB_BUILD_ARCH | sed s,i[3456789]86,ia32, | sed s,amd64,x86_64, )
ARCH := $(shell dpkg-architecture -qDEB_BUILD_ARCH | sed s,i[3456789]86,ia32, | sed s,amd64,x86_64, )
INCDIR = -I. -I$(TOPDIR) -I$(EFIINC) -I$(EFIINC)/$(ARCH) -I$(EFIINC)/protocol -I$(TOPDIR)/efi110
CPPFLAGS = -DCONFIG_$(ARCH)
@ -111,12 +111,14 @@ OBJCOPY = $(prefix)objcopy
# Use Modified binutils that supports x86_64 using UEFI ABI
ifeq ($(ARCH), x86_64)
ifeq ($(HOSTARCH), ia32)
ARCH3264 = -m64
LD3264 = -melf_x86_64
GNUEFILIB := $(GNUEFILIB)64
EFILIB := $(EFILIB)64
EFICRT0 := $(EFILIB)/gnuefi
EFICRT0 := $(EFICRT0)64
endif
CFLAGS += -DEFI_FUNCTION_WRAPPER
OBJCOPY = /usr/bin/objcopy
@ -129,7 +131,7 @@ ifeq ($(ARCH), ia32)
GNUEFILIB := /usr/lib32
EFILIB := /usr/lib32
EFICRT0 := /usr/lib32/gnuefi
EFICRT0 := /usr/lib32
endif
endif

View file

@ -36,6 +36,34 @@ StrChr(IN const CHAR16 *s, IN const CHAR16 c)
return (CHAR16 *)s;
}
CHAR16 *
StrnCpy(OUT CHAR16 *dst, IN const CHAR16 *src, IN UINTN size)
{
CHAR16 *res = dst;
while (size && size-- && (*dst++ = *src++) != CHAR_NULL);
/*
* does the null padding
*/
while (size && size-- > 0) *dst++ = CHAR_NULL;
return res;
}
CHAR8 *
StrnXCpy(OUT CHAR8 *dst, IN const CHAR16 *src, IN UINTN size)
{
CHAR8 *res = dst;
while (size && size-- && (*dst++ = (CHAR8)*src++) != '\0');
/*
* does the null padding
*/
while (size && size-- > 0) *dst++ = '\0';
return res;
}
VOID
U2ascii(CHAR16 *in, CHAR8 *out, UINTN maxlen)
{

View file

@ -27,6 +27,8 @@
#define __STROPS_H__
extern CHAR16 *StrChr(IN const CHAR16 *s, const CHAR16 c);
extern CHAR16 *StrnCpy(OUT CHAR16 *dst, IN const CHAR16 *src, UINTN count);
extern CHAR8 *StrnXCpy(OUT CHAR8 *dst, IN const CHAR16 *src, UINTN count);
extern CHAR8 *strtok_simple(CHAR8 *in, CHAR8 c);
extern CHAR8 *strrchra(IN const CHAR8 *s, const INTN c);