1999-08-27 21:08:13 -04:00
|
|
|
# $FreeBSD$
|
1995-06-25 13:32:43 -04:00
|
|
|
|
2010-08-23 02:13:29 -04:00
|
|
|
.if ${MACHINE_CPUARCH} == "amd64"
|
2006-08-15 09:01:36 -04:00
|
|
|
SFX= 32
|
2010-03-11 09:49:06 -05:00
|
|
|
CFLAGS+=-DCOMPAT_FREEBSD32 -DCOMPAT_LINUX32
|
2006-08-15 09:01:36 -04:00
|
|
|
.endif
|
|
|
|
|
|
2017-03-04 05:10:17 -05:00
|
|
|
.PATH: ${SRCTOP}/sys/compat/linux ${SRCTOP}/sys/${MACHINE_CPUARCH}/linux${SFX}
|
2020-11-05 14:30:31 -05:00
|
|
|
.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
|
|
|
|
|
.PATH: ${SRCTOP}/sys/x86/linux
|
|
|
|
|
.endif
|
2001-01-06 09:00:42 -05:00
|
|
|
|
1998-10-16 00:30:52 -04:00
|
|
|
KMOD= linux
|
2022-10-29 11:28:16 -04:00
|
|
|
SRCS= linux${SFX}_dummy_machdep.c \
|
2023-02-02 09:58:06 -05:00
|
|
|
linux_elf32.c \
|
2022-10-29 11:28:16 -04:00
|
|
|
linux_event.c \
|
|
|
|
|
linux_file.c \
|
|
|
|
|
linux_fork.c \
|
|
|
|
|
linux_futex.c \
|
|
|
|
|
linux_getcwd.c \
|
|
|
|
|
linux_ioctl.c \
|
|
|
|
|
linux_ipc.c \
|
|
|
|
|
linux${SFX}_machdep.c \
|
|
|
|
|
linux_misc.c \
|
|
|
|
|
linux_rseq.c \
|
|
|
|
|
linux_signal.c \
|
|
|
|
|
linux_socket.c \
|
|
|
|
|
linux_stats.c \
|
2022-10-29 11:30:32 -04:00
|
|
|
linux${SFX}_syscalls.c \
|
2022-10-29 11:28:16 -04:00
|
|
|
linux_sysctl.c \
|
|
|
|
|
linux${SFX}_sysent.c \
|
|
|
|
|
linux${SFX}_sysvec.c \
|
|
|
|
|
linux_time.c \
|
|
|
|
|
linux_timer.c \
|
|
|
|
|
linux_uid16.c \
|
|
|
|
|
linux_vdso.c \
|
|
|
|
|
opt_inet6.h \
|
2022-10-29 10:49:20 -04:00
|
|
|
opt_ktrace.h \
|
2022-10-29 11:28:16 -04:00
|
|
|
opt_posix.h \
|
|
|
|
|
bus_if.h \
|
|
|
|
|
device_if.h \
|
|
|
|
|
vnode_if.h
|
2020-11-05 14:30:31 -05:00
|
|
|
.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
|
2022-05-23 06:19:07 -04:00
|
|
|
SRCS+= linux_dummy_x86.c
|
2021-07-20 03:01:18 -04:00
|
|
|
VDSODEPS=linux_vdso_gettc_x86.inc
|
2020-11-05 14:30:31 -05:00
|
|
|
.endif
|
2018-04-24 08:50:21 -04:00
|
|
|
.if ${MACHINE_CPUARCH} == "amd64"
|
2022-07-24 19:14:20 -04:00
|
|
|
SRCS+= linux${SFX}_support.S
|
2018-04-24 08:50:21 -04:00
|
|
|
.endif
|
2018-03-20 13:58:51 -04:00
|
|
|
DPSRCS= assym.inc linux${SFX}_genassym.c
|
2007-05-23 04:33:06 -04:00
|
|
|
|
2018-03-20 13:58:51 -04:00
|
|
|
# XXX: for assym.inc
|
2018-04-06 13:35:35 -04:00
|
|
|
SRCS+= opt_kstack_pages.h opt_nfs.h opt_hwpmc_hooks.h
|
2010-08-23 02:13:29 -04:00
|
|
|
.if ${MACHINE_CPUARCH} == "i386"
|
2022-10-29 11:28:16 -04:00
|
|
|
SRCS+= opt_apic.h opt_cpu.h
|
2009-05-26 16:57:19 -04:00
|
|
|
.endif
|
2007-05-23 04:33:06 -04:00
|
|
|
|
2021-07-20 03:01:18 -04:00
|
|
|
OBJS= linux${SFX}_vdso.so
|
2015-05-24 11:28:17 -04:00
|
|
|
|
2010-08-23 02:13:29 -04:00
|
|
|
.if ${MACHINE_CPUARCH} == "i386"
|
2022-10-29 11:28:16 -04:00
|
|
|
SRCS+= imgact_linux.c \
|
|
|
|
|
linux.c \
|
|
|
|
|
linux_dummy.c \
|
|
|
|
|
linux_emul.c \
|
|
|
|
|
linux_errno.c \
|
|
|
|
|
linux_mib.c \
|
|
|
|
|
linux_mmap.c \
|
|
|
|
|
linux_ptrace_machdep.c \
|
|
|
|
|
linux_util.c \
|
|
|
|
|
linux_vdso_selector_x86.c \
|
2023-03-31 07:56:29 -04:00
|
|
|
linux_x86.c \
|
|
|
|
|
linux_copyout.c \
|
2023-03-31 07:56:59 -04:00
|
|
|
linux_netlink.c \
|
|
|
|
|
opt_netlink.h
|
2000-09-06 16:21:15 -04:00
|
|
|
.endif
|
|
|
|
|
|
2015-05-24 11:51:18 -04:00
|
|
|
.if ${MACHINE_CPUARCH} == "i386"
|
2002-02-22 13:21:20 -05:00
|
|
|
EXPORT_SYMS=
|
|
|
|
|
EXPORT_SYMS+= linux_get_osname
|
|
|
|
|
EXPORT_SYMS+= linux_get_osrelease
|
|
|
|
|
EXPORT_SYMS+= linux_ioctl_register_handler
|
|
|
|
|
EXPORT_SYMS+= linux_ioctl_unregister_handler
|
2015-05-24 11:51:18 -04:00
|
|
|
.endif
|
2002-02-22 13:21:20 -05:00
|
|
|
|
2019-05-06 14:46:42 -04:00
|
|
|
CLEANFILES= linux${SFX}_assym.h linux${SFX}_genassym.o linux${SFX}_locore.o \
|
2021-07-20 03:01:18 -04:00
|
|
|
genassym.o linux${SFX}_vdso_gtod.o linux${SFX}_vdso.so.o
|
1996-03-02 15:00:35 -05:00
|
|
|
|
2006-08-15 09:01:36 -04:00
|
|
|
linux${SFX}_assym.h: linux${SFX}_genassym.o
|
2014-11-06 11:48:37 -05:00
|
|
|
sh ${SYSDIR}/kern/genassym.sh linux${SFX}_genassym.o > ${.TARGET}
|
1996-03-02 15:00:35 -05:00
|
|
|
|
2021-07-20 03:01:18 -04:00
|
|
|
.if ${MACHINE_CPUARCH} == "amd64"
|
2021-09-22 14:54:39 -04:00
|
|
|
VDSOFLAGS=-DCOMPAT_FREEBSD32 -DCOMPAT_LINUX32 -m32
|
2021-07-26 15:28:21 -04:00
|
|
|
.else
|
|
|
|
|
VDSOFLAGS=-mregparm=0
|
2021-07-20 03:01:18 -04:00
|
|
|
.endif
|
|
|
|
|
|
2018-03-20 13:58:51 -04:00
|
|
|
linux${SFX}_locore.o: linux${SFX}_assym.h assym.inc
|
2021-07-20 03:01:18 -04:00
|
|
|
${CC} -c -x assembler-with-cpp -DLOCORE -fPIC -pipe -O2 -Werror \
|
2021-07-26 15:28:21 -04:00
|
|
|
-msoft-float \
|
2021-07-26 14:28:16 -04:00
|
|
|
-fno-common -nostdinc -fasynchronous-unwind-tables \
|
2021-07-20 03:01:18 -04:00
|
|
|
-fno-omit-frame-pointer -foptimize-sibling-calls ${VDSOFLAGS} \
|
|
|
|
|
-fno-stack-protector -I. -I${SYSDIR} -I${SRCTOP}/include \
|
2001-01-06 09:00:42 -05:00
|
|
|
${.IMPSRC} -o ${.TARGET}
|
1996-03-02 15:00:35 -05:00
|
|
|
|
2021-07-20 03:01:18 -04:00
|
|
|
linux${SFX}_vdso_gtod.o: linux_vdso_gtod.inc ${VDSODEPS}
|
2021-07-26 15:28:21 -04:00
|
|
|
${CC} -c -fPIC -pipe -O2 -Werror -msoft-float \
|
2021-07-26 14:28:16 -04:00
|
|
|
-fno-common -nostdinc -fasynchronous-unwind-tables \
|
2021-07-20 03:01:18 -04:00
|
|
|
-fno-omit-frame-pointer -foptimize-sibling-calls ${VDSOFLAGS} \
|
|
|
|
|
-fno-stack-protector -I. -I${SYSDIR} -I${SRCTOP}/include \
|
|
|
|
|
${.IMPSRC} -o ${.TARGET}
|
|
|
|
|
|
|
|
|
|
linux${SFX}_vdso.so.o: linux${SFX}_locore.o linux${SFX}_vdso_gtod.o
|
|
|
|
|
${LD} -m elf_i386 --shared --eh-frame-hdr -soname=linux-gate.so.1 \
|
|
|
|
|
--no-undefined --hash-style=both -warn-common -nostdlib \
|
|
|
|
|
--strip-debug -s --build-id=sha1 --Bsymbolic \
|
|
|
|
|
-T${SRCTOP}/sys/${MACHINE}/linux${SFX}/linux${SFX}_vdso.lds.s \
|
|
|
|
|
-o ${.TARGET} ${.ALLSRC:M*.o}
|
|
|
|
|
|
|
|
|
|
.if ${MACHINE_CPUARCH} == "amd64"
|
|
|
|
|
OBJCOPY_TARGET=--output-target elf64-x86-64-freebsd --binary-architecture i386
|
|
|
|
|
.elif ${MACHINE_CPUARCH} == "i386"
|
|
|
|
|
OBJCOPY_TARGET=--output-target elf32-i386-freebsd --binary-architecture i386
|
|
|
|
|
.else
|
|
|
|
|
.error ${MACHINE_CPUARCH} not yet supported by linux
|
|
|
|
|
.endif
|
|
|
|
|
|
|
|
|
|
linux${SFX}_vdso.so: linux${SFX}_vdso.so.o
|
|
|
|
|
${OBJCOPY} --input-target binary ${OBJCOPY_TARGET} \
|
|
|
|
|
linux${SFX}_vdso.so.o ${.TARGET}
|
|
|
|
|
${STRIPBIN} -N _binary_linux${SFX}_vdso_so_o_size ${.TARGET}
|
|
|
|
|
|
2018-04-24 08:50:21 -04:00
|
|
|
.if ${MACHINE_CPUARCH} == "amd64"
|
2022-07-19 16:42:27 -04:00
|
|
|
linux${SFX}_support.o: linux${SFX}_support.S linux${SFX}_assym.h assym.inc
|
2007-05-23 04:33:06 -04:00
|
|
|
${CC} -c -x assembler-with-cpp -DLOCORE ${CFLAGS} \
|
2022-07-19 16:42:27 -04:00
|
|
|
${.ALLSRC:M*.S:u} -o ${.TARGET}
|
2015-05-24 11:28:17 -04:00
|
|
|
.endif
|
|
|
|
|
|
2018-07-03 17:02:25 -04:00
|
|
|
linux${SFX}_genassym.o: offset.inc
|
2020-04-18 08:54:40 -04:00
|
|
|
${CC} -c ${CFLAGS:N-flto:N-fno-common} -fcommon ${.IMPSRC}
|
1996-03-02 15:00:35 -05:00
|
|
|
|
2019-05-13 14:28:40 -04:00
|
|
|
.if !defined(KERNBUILDDIR)
|
|
|
|
|
.warning Building Linuxulator outside of a kernel does not make sense
|
|
|
|
|
.endif
|
|
|
|
|
|
2021-11-07 03:42:24 -05:00
|
|
|
EXPORT_SYMS= YES
|
|
|
|
|
|
2000-05-26 21:14:33 -04:00
|
|
|
.include <bsd.kmod.mk>
|