Add a Makefile for building the cloudabi32 kernel module.

Where the cloudabi64 kernel can be used to execute 64-bit CloudABI
binaries, this one should be used for 32-bit binaries. Right now it
works on i386 and amd64.
This commit is contained in:
Ed Schouten 2016-08-24 11:35:49 +00:00
parent 22f2f875ad
commit e4df2955d3
2 changed files with 41 additions and 0 deletions

View File

@ -75,6 +75,7 @@ SUBDIR= \
${_cfi} \
${_ciss} \
cloudabi \
${_cloudabi32} \
${_cloudabi64} \
${_cm} \
${_cmx} \
@ -765,6 +766,9 @@ _epic= epic
_igb= igb
.endif
.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
_cloudabi32= cloudabi32
.endif
.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64"
_cloudabi64= cloudabi64
.endif

View File

@ -0,0 +1,37 @@
# $FreeBSD$
SYSDIR?=${.CURDIR}/../..
.PATH: ${SYSDIR}/compat/cloudabi32
.PATH: ${SYSDIR}/${MACHINE}/cloudabi32
KMOD= cloudabi32
SRCS= cloudabi32_fd.c cloudabi32_module.c cloudabi32_poll.c \
cloudabi32_sock.c cloudabi32_syscalls.c cloudabi32_sysent.c \
cloudabi32_sysvec.c cloudabi32_thread.c
OBJS= cloudabi32_vdso_blob.o
CLEANFILES=cloudabi32_vdso.o
.if ${MACHINE_CPUARCH} == "i386"
VDSO_SRCS=${SYSDIR}/contrib/cloudabi/cloudabi_vdso_i686.S
OUTPUT_TARGET=elf32-i386-freebsd
BINARY_ARCHITECTURE=aarch32
.elif ${MACHINE_CPUARCH} == "amd64"
VDSO_SRCS=${SYSDIR}/contrib/cloudabi/cloudabi_vdso_i686_on_64bit.S
OUTPUT_TARGET=elf64-x86-64-freebsd
BINARY_ARCHITECTURE=i386
.endif
cloudabi32_vdso.o: ${VDSO_SRCS}
${CC} -x assembler-with-cpp -m32 -shared -nostdinc -nostdlib \
-Wl,-T${SYSDIR}/compat/cloudabi/cloudabi_vdso.lds \
${VDSO_SRCS} -o ${.TARGET}
cloudabi32_vdso_blob.o: cloudabi32_vdso.o
${OBJCOPY} --input-target binary \
--output-target ${OUTPUT_TARGET} \
--binary-architecture ${BINARY_ARCHITECTURE} \
cloudabi32_vdso.o ${.TARGET}
.include <bsd.kmod.mk>