summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>2011-03-05 08:08:47 +0000
committerjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>2011-03-05 08:08:47 +0000
commit692477d411ec4e489caa04308ab6ed12edb3646d (patch)
treea3650c669a7e91f9dbb07c0e7fe8edc7b9b00ce9
parent2dcef689963d9f975b0d792e677c2d43cf3cc995 (diff)
downloadedk2-692477d411ec4e489caa04308ab6ed12edb3646d.tar.gz
edk2-692477d411ec4e489caa04308ab6ed12edb3646d.tar.bz2
edk2-692477d411ec4e489caa04308ab6ed12edb3646d.zip
UnixPkg: Fix build for Linux
UnixPkg/UnixSnpDxe is currently BSD/OS X specific. Therefore we only build it if "-D NETWORK_SUPPORT" is used on the build command line. UnixPkg/build.sh and UnixPkg/build64.sh are updated to automatically define NETWORK_SUPPORT if building on OS X. <net/if_dl.h> and <net/bpf.h> are also only included in UnixPkg/Include/Common/UnixInclude.h if __APPLE__ is defined. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11346 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--UnixPkg/Include/Common/UnixInclude.h4
-rw-r--r--UnixPkg/Sec/X64/MangleGasket.S10
-rw-r--r--UnixPkg/UnixPkg.dsc2
-rw-r--r--UnixPkg/UnixPkg.fdf4
-rw-r--r--UnixPkg/UnixPkgX64.dsc2
-rw-r--r--UnixPkg/UnixPkgX64.fdf2
-rwxr-xr-xUnixPkg/build.sh4
-rwxr-xr-xUnixPkg/build64.sh4
8 files changed, 20 insertions, 12 deletions
diff --git a/UnixPkg/Include/Common/UnixInclude.h b/UnixPkg/Include/Common/UnixInclude.h
index e37fc4265a..3dbe09d8a2 100644
--- a/UnixPkg/Include/Common/UnixInclude.h
+++ b/UnixPkg/Include/Common/UnixInclude.h
@@ -62,11 +62,11 @@ Abstract:
#include <netdb.h>
#include <netinet/in.h>
#include <net/if.h>
-#include <net/if_dl.h>
#include <ifaddrs.h>
-#include <net/bpf.h>
#ifdef __APPLE__
+#include <net/if_dl.h>
+#include <net/bpf.h>
#include <sys/param.h>
#include <sys/mount.h>
#define _XOPEN_SOURCE
diff --git a/UnixPkg/Sec/X64/MangleGasket.S b/UnixPkg/Sec/X64/MangleGasket.S
index d457f6be12..ea1e6aa2eb 100644
--- a/UnixPkg/Sec/X64/MangleGasket.S
+++ b/UnixPkg/Sec/X64/MangleGasket.S
@@ -889,9 +889,8 @@ ASM_PFX(Gasketgetifaddrs):
ret
-
-ASM_GLOBAL _Gasketfreeifaddrs
-_Gasketfreeifaddrs:
+ASM_GLOBAL ASM_PFX(Gasketfreeifaddrs)
+ASM_PFX(Gasketfreeifaddrs):
pushq %rbp // stack frame is for the debugger
movq %rsp, %rbp
@@ -900,7 +899,7 @@ _Gasketfreeifaddrs:
movq %rcx, %rdi // Swizzle args
- call _freeifaddrs
+ call ASM_PFX(freeifaddrs)
popq %rdi // restore state
@@ -909,9 +908,6 @@ _Gasketfreeifaddrs:
ret
-
-
-
ASM_GLOBAL ASM_PFX(GasketUgaClose)
ASM_PFX(GasketUgaClose):
pushq %rbp // stack frame is for the debugger
diff --git a/UnixPkg/UnixPkg.dsc b/UnixPkg/UnixPkg.dsc
index 76e0e9898a..c9fd223e35 100644
--- a/UnixPkg/UnixPkg.dsc
+++ b/UnixPkg/UnixPkg.dsc
@@ -306,7 +306,9 @@
#
# Network stack drivers
#
+!if $(NETWORK_SUPPORT)
UnixPkg/UnixSnpDxe/UnixSnpDxe.inf
+!endif
MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
diff --git a/UnixPkg/UnixPkg.fdf b/UnixPkg/UnixPkg.fdf
index 9548541442..2a6ee25f6c 100644
--- a/UnixPkg/UnixPkg.fdf
+++ b/UnixPkg/UnixPkg.fdf
@@ -232,6 +232,9 @@ INF MdeModulePkg/Application/HelloWorld/HelloWorld.inf
#
# Network stack drivers
#
+!if $(NETWORK_SUPPORT)
+INF UnixPkg/UnixSnpDxe/UnixSnpDxe.inf
+!endif
INF MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
INF MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
INF MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
@@ -242,7 +245,6 @@ INF MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
INF MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
INF MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf
INF MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
-INF UnixPkg/UnixSnpDxe/UnixSnpDxe.inf
#
# Build from source or use checked in binary
diff --git a/UnixPkg/UnixPkgX64.dsc b/UnixPkg/UnixPkgX64.dsc
index 2ff5b9d534..1eae7f9ecb 100644
--- a/UnixPkg/UnixPkgX64.dsc
+++ b/UnixPkg/UnixPkgX64.dsc
@@ -307,7 +307,9 @@
#
# Network stack drivers
#
+!if $(NETWORK_SUPPORT)
UnixPkg/UnixSnpDxe/UnixSnpDxe.inf
+!endif
MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
diff --git a/UnixPkg/UnixPkgX64.fdf b/UnixPkg/UnixPkgX64.fdf
index 224c5330d9..6ac1cdc8a6 100644
--- a/UnixPkg/UnixPkgX64.fdf
+++ b/UnixPkg/UnixPkgX64.fdf
@@ -232,7 +232,9 @@ INF MdeModulePkg/Application/HelloWorld/HelloWorld.inf
#
# Network stack drivers
#
+!if $(NETWORK_SUPPORT)
INF UnixPkg/UnixSnpDxe/UnixSnpDxe.inf
+!endif
INF MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
INF MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
INF MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
diff --git a/UnixPkg/build.sh b/UnixPkg/build.sh
index a77a5973a0..2498914e1c 100755
--- a/UnixPkg/build.sh
+++ b/UnixPkg/build.sh
@@ -41,6 +41,7 @@ fi
# Pick a default tool type for a given OS
#
TARGET_TOOLS=MYTOOLS
+NETWORK_SUPPORT=
case `uname` in
CYGWIN*) echo Cygwin not fully supported yet. ;;
Darwin*)
@@ -52,6 +53,7 @@ case `uname` in
else
TARGET_TOOLS=XCODE32
fi
+ NETWORK_SUPPORT="-D NETWORK_SUPPORT"
;;
Linux*) TARGET_TOOLS=ELFGCC ;;
@@ -115,6 +117,6 @@ done
#
echo $PATH
echo `which build`
-build -p $WORKSPACE/UnixPkg/UnixPkg.dsc -a IA32 -t $TARGET_TOOLS -n 3 $1 $2 $3 $4 $5 $6 $7 $8
+build -p $WORKSPACE/UnixPkg/UnixPkg.dsc -a IA32 -t $TARGET_TOOLS $NETWORK_SUPPORT -n 3 $1 $2 $3 $4 $5 $6 $7 $8
exit $?
diff --git a/UnixPkg/build64.sh b/UnixPkg/build64.sh
index 24a7fe2a6e..22e9c08ead 100755
--- a/UnixPkg/build64.sh
+++ b/UnixPkg/build64.sh
@@ -42,6 +42,7 @@ fi
#
TARGET_TOOLS=MYTOOLS
UNIXPKG_TOOLS=GCC44
+NETWORK_SUPPORT=
case `uname` in
CYGWIN*) echo Cygwin not fully supported yet. ;;
Darwin*)
@@ -54,6 +55,7 @@ case `uname` in
TARGET_TOOLS=XCODE32
UNIXPKG_TOOLS=UNIXPKG
fi
+ NETWORK_SUPPORT="-D NETWORK_SUPPORT"
;;
Linux*) TARGET_TOOLS=ELFGCC ;;
@@ -120,7 +122,7 @@ done
echo $PATH
echo `which build`
build -p $WORKSPACE/UnixPkg/UnixPkgX64.dsc -a X64 -t $TARGET_TOOLS -D SEC_ONLY -n 3 $1 $2 $3 $4 $5 $6 $7 $8 modules
-build -p $WORKSPACE/UnixPkg/UnixPkgX64.dsc -a X64 -t $UNIXPKG_TOOLS -n 3 $1 $2 $3 $4 $5 $6 $7 $8
+build -p $WORKSPACE/UnixPkg/UnixPkgX64.dsc -a X64 -t $UNIXPKG_TOOLS $NETWORK_SUPPORT -n 3 $1 $2 $3 $4 $5 $6 $7 $8
cp $WORKSPACE/Build/UnixX64/DEBUG_"$TARGET_TOOLS"/X64/SecMain $WORKSPACE/Build/UnixX64/DEBUG_"$UNIXPKG_TOOLS"/X64
exit $?