[OpenAFS-port-netbsd] Building I3d1aa0b22bb8533718f48bd4424743299d5de019

Jonathan A. Kollasch jakllsch@kollasch.net
Mon, 16 May 2011 15:09:02 +0000


--XsQoSWH+UP9D9v3l
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hi,

To build I3d1aa0b22bb8533718f48bd4424743299d5de019 on NetBSD-5 or
NetBSD-current:

 - have NetBSD src tree matching your kernel and userland
 - pull openafs master
 - grab I3d1aa0b2
 - apply the attached patches
 - build OpenAFS userland in it's own directory
    export LD_RUN_PATH=/usr/local/lib
    ../openafs/configure --with-bsd-kernel-headers=/usr/src/sys --prefix=/usr/local
    make
 - copy attached Makefile to a directory to be used for building the
   kernel module
 - adjust TOP_SRCDIR TOP_OBJDIR and NETBSDSRCDIR as appropriate
 - `make` libafs.kmod

This produces a new-style 'kmod' kernel module. The default netbsd-5 userland
ships with utilities for old-style LKM modules.  You'll need to manually build
the appropriate module utilities on netbsd-5.

Hope that's enough to get going.

	Jonathan Kollasch

--XsQoSWH+UP9D9v3l
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=diff

diff --git a/src/afs/afs.h b/src/afs/afs.h
index dcd80f4..4f899e2 100644
--- a/src/afs/afs.h
+++ b/src/afs/afs.h
@@ -30,7 +30,7 @@
 #define AFS_MIN_FRAGSIZE 1023
 
 /* Upper bound on number of iovecs our uio routines will deal with. */
-#define	AFS_MAXIOVCNT	    16
+#define	AFS_MAXIOVCNT	    64
 
 
 extern int afs_shuttingdown;
diff --git a/src/crypto/hcrypto/kernel/config.h b/src/crypto/hcrypto/kernel/config.h
index 29e9947..7affe16 100644
--- a/src/crypto/hcrypto/kernel/config.h
+++ b/src/crypto/hcrypto/kernel/config.h
@@ -30,7 +30,9 @@
 
 /* Asserting is a mess - we need the RX headers in order to get a definition
  * for osi_Assert */
+#ifndef _KERNEL
 #define assert osi_Assert
+#endif
 #include <rx/rx.h>
 
 /* hcrypto uses "static inline", which isn't supported by some of our
diff --git a/src/external/heimdal/hcrypto/md5.h b/src/external/heimdal/hcrypto/md5.h
index b2df6e5..2f9be93 100644
--- a/src/external/heimdal/hcrypto/md5.h
+++ b/src/external/heimdal/hcrypto/md5.h
@@ -37,9 +37,15 @@
 #define HEIM_MD5_H 1
 
 /* symbol renaming */
+#ifdef __NetBSD__
+#define MD5_Init MD5Init
+#define MD5_Update MD5Update
+#define MD5_Final MD5Final
+#else
 #define MD5_Init hc_MD5_Init
 #define MD5_Update hc_MD5_Update
 #define MD5_Final hc_MD5_Final
+#endif
 
 /*
  *

--XsQoSWH+UP9D9v3l
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=Makefile

#

NOMAN=
WARNS=2

#TOP_OBJDIR= ../../..
#TOP_SRCDIR= ../../../src
#TOP_INCDIR= ../../../include
TOP_SRCDIR= /local/jakllsch/openafs-lkm-mk2/src
TOP_OBJDIR= /local/jakllsch/openafs-build
TOP_INCDIR= ${TOP_OBJDIR}/include
MKAFS_OSTYPE= NBSD

NETBSDSRCDIR=/local/nb/src

CPPFLAGS+= -DAFS_NBSD60_ENV
#CPPFLAGS+= -DRUMP
CPPFLAGS+= -I. -I${TOP_OBJDIR}/src/config
CPPFLAGS+= -I. -I.. -I../nfs \
	-I$(TOP_SRCDIR)/crypto/hcrypto/kernel \
	-I${TOP_SRCDIR} \
	-I${TOP_SRCDIR}/afs \
	-I${TOP_SRCDIR}/afs/${MKAFS_OSTYPE} \
	-I${TOP_SRCDIR}/config \
	-I${TOP_SRCDIR}/rx/${MKAFS_OSTYPE} \
	-I${TOP_SRCDIR}/external/heimdal \
	-I${TOP_OBJDIR}/src \
	-I${TOP_OBJDIR}/src/afs \
	-I${TOP_OBJDIR}/src/afs/${MKAFS_OSTYPE} \
	-I${TOP_OBJDIR}/src/config \
	-I${TOP_OBJDIR}/src/fsint \
	-I${TOP_OBJDIR}/src/vlserver \
	-I${TOP_OBJDIR}/src/auth \
	-I${TOP_INCDIR} \
	-I${TOP_INCDIR}/afs \
	-I${TOP_INCDIR}/rx \

#CPPFLAGS+= -DDIAGNOSTIC -DDEBUG -DLOCKDEBUG
CFLAGS+= -g -fno-omit-frame-pointer -fno-inline -O2
CPUFLAGS+= -march=k8

CPPFLAGS+= -DAFSDEBUG -DKERNEL -DAFS -DVICE -DNFS -DUFS -DINET -DQUOTA -DGETMOUNT -DAFS_NONFSTRANS

.PATH: ${.CURDIR} ${TOP_SRCDIR}/afs ${TOP_SRCDIR}/afs/NBSD ${TOP_SRCDIR}/afs/VNOPS ${TOP_SRCDIR}/util ${TOP_OBJDIR}/src/util ${TOP_SRCDIR}/dir ${TOP_SRCDIR}/fsint ${TOP_OBJDIR}/src/fsint ${TOP_SRCDIR}/rx ${TOP_SRCDIR}/rx/NBSD ${TOP_SRCDIR}/rxkad ${TOP_SRCDIR}/rxstat ${TOP_OBJDIR}/src/rxstat ${TOP_SRCDIR}/sys ${TOP_OBJDIR}/src/sys ${TOP_SRCDIR}/src/auth ${TOP_OBJDIR}/src/auth ${TOP_SRCDIR}/vlserver ${TOP_OBJDIR}/src/vlserver ${TOP_SRCDIR}/crypto/hcrypto/kernel ${TOP_SRCDIR}/crypto/rfc3961/kernel ${TOP_SRCDIR}/crypto/rfc3961 ${TOP_SRCDIR}/external/heimdal/roken ${TOP_SRCDIR}/external/heimdal/krb5 ${TOP_SRCDIR}/external/heimdal/hcrypto ${TOP_OBJDIR}/src/config
 
KMOD=libafs
SRCS= osi_crypto.c osi_gcpags.c osi_groups.c osi_file.c osi_inode.c osi_misc.c osi_sleep.c osi_vcache.c osi_vm.c osi_vnodeops.c osi_vfsops.c
SRCS+= osi_kmod.c
SRCS+= afs_call.c afs_pioctl.c

SRCS+= afs_atomlist.c afs_lhash.c afs_analyze.c afs_axscache.c afs_buffer.c afs_bypasscache.c afs_callback.c afs_cbqueue.c afs_cell.c afs_chunk.c afs_conn.c afs_daemons.c afs_dcache.c afs_disconnected.c afs_dynroot.c afs_error.c afs_icl.c afs_init.c afs_lock.c afs_mariner.c afs_memcache.c afs_fetchstore.c
SRCS+= afs_osi.c afs_osidnlc.c afs_osi_alloc.c afs_osi_pag.c afs_osi_uio.c afs_osi_vget.c afs_osi_vm.c
SRCS+= afs_segments.c afs_server.c afs_stat.c afs_syscall.c afs_tokens.c afs_user.c afs_util.c afs_vcache.c
SRCS+= afs_vnop_access.c afs_vnop_attrs.c afs_vnop_create.c afs_vnop_dirops.c afs_vnop_fid.c afs_vnop_flock.c afs_vnop_link.c afs_vnop_lookup.c afs_vnop_open.c afs_vnop_read.c afs_vnop_readdir.c afs_vnop_remove.c afs_vnop_rename.c afs_vnop_strategy.c afs_vnop_symlink.c afs_vnop_write.c
SRCS+= afs_volume.c afs_warn.c 
SRCS+= afsaux.c
SRCS+= Kvice.xdr.c
SRCS+= xdr_arrayn.c xdr_array.c xdr_int32.c xdr_int64.c
SRCS+= Kvice.cs.c
SRCS+= fcrypt.c
SRCS+= rx.c rx_rdwr.c rx_clock.c rx_event.c rx_globals.c rx_identity.c rx_kmutex.c rx_knet.c rx_kcommon.c rx_misc.c rx_null.c rx_opaque.c rx_getaddr.c rx_packet.c rx_multi.c rx_stats.c
SRCS+= xdr_rx.c xdr_mem.c xdr_len.c
SRCS+= Kvldbint.cs.c Kvldbint.xdr.c Kcallback.ss.c
CPPFLAGS-Kvldbint.xdr.c+= -DAFS_UUID_XG
SRCS+= Krxstat.ss.c Krxstat.xdr.c Krmtsys.cs.c Krmtsys.xdr.c
SRCS+= rxstat.c crypt_conn.c
SRCS+= AFS_component_version_number.c
SRCS+= afs_exporter.c rxkad_client.c rxkad_common.c xdr_afsuuid.c xdr.c Ktoken.xdr.c
SRCS+= dir.c
#SRCS+= md5.c
#SRCS+= evp.c evp-algs.c rand.c alloc.c aes.c
#SRCS+=#rijndael-alg-fst.c
#SRCS+= sha.c n-fold.c
#SRCS+= crypto.c algs.c crypto-aes.c context.c copy.c ct.c crypto-evp.c data.c keyblock.c store-int.c random.c
RFC3961_INCLUDES = -I${TOP_SRCDIR}/crypto/rfc3961 -I${TOP_SRCDIR}/external/heimdal/krb5
CPPFLAGS.crypto.c += ${RFC3961_INCLUDES}
CPPFLAGS.crypto-aes.c += ${RFC3961_INCLUDES}
CPPFLAGS.crypto-evp.c += ${RFC3961_INCLUDES}
CPPFLAGS.algs.c += ${RFC3961_INCLUDES}
CPPFLAGS.context.c += ${RFC3961_INCLUDES}
CPPFLAGS.copy.c += ${RFC3961_INCLUDES}
CPPFLAGS.ct.c += ${RFC3961_INCLUDES}
CPPFLAGS.data.c += ${RFC3961_INCLUDES}
CPPFLAGS.keyblock.c += ${RFC3961_INCLUDES}
CPPFLAGS.store-int.c += ${RFC3961_INCLUDES}
CPPFLAGS.random.c += ${RFC3961_INCLUDES}
CPPFLAGS.n-fold.c += ${RFC3961_INCLUDES}
CPPFLAGS.evp.c += -I$(TOP_INCDIR)/hcrypto -DHAVE_CONFIG_H
CPPFLAGS.evp-algs.c += -I$(TOP_INCDIR)/hcrypto
CPPFLAGS.rand.c += -I${TOP_INCDIR}/hcrypto -I${TOP_SRCDIR}/external/heimdal/hcrypto
SRCS+= uuid.c

.include "${TOP_OBJDIR}/src/config/Makefile.version"

AFS_component_version_number.c: .NOPATH

AFS_component_version_number.o: .NOPATH

uuid.o: .NOPATH

afsaux.o: .NOPATH

rxstat.o: .NOPATH

afs_atomlist.o: .NOPATH

afs_lhash.o: .NOPATH

Kvice.xdr.o: .NOPATH

Kvice.cs.o: .NOPATH

Kcallback.ss.o: .NOPATH

Krxstat.ss.o: .NOPATH

Krxstat.xdr.o: .NOPATH

CLEANFILES+=AFS_component_version_number.c

CLEANFILES+= h netconfig.h rpc rpcsrv stdarg.h

oafsincludelinks:
	@rm -f h && \
	    ln -s $S/sys h
	@rm -f rpc && \
	    ln -s ${NETBSDSRCDIR}/include/rpc rpc
	@rm -f rpcsrv && \
	    ln -s ${NETBSDSRCDIR}/include/rpcsrv rpcsrv
	@rm -f netconfig.h && \
	    ln -s ${NETBSDSRCDIR}/include/netconfig.h netconfig.h
	@rm -f stdarg.h && \
	    ln -s machine/stdarg.h stdarg.h

.BEGIN: oafsincludelinks

.include <bsd.kmodule.mk>

#CPPFLAGS+= -I/usr/include
CPPFLAGS+= -Wno-cast-qual -Wno-missing-prototypes -Wno-shadow

--XsQoSWH+UP9D9v3l--