2002-08-02 10:37:22 +00:00
|
|
|
#!/bin/sh
|
1997-02-02 07:19:30 +00:00
|
|
|
# This writes a skeleton driver and puts it into the kernel tree for you
|
2006-08-09 21:23:42 +00:00
|
|
|
#
|
|
|
|
# arg1 is lowercase "foo"
|
|
|
|
# arg2 path to the kernel sources, "/sys" if omitted
|
1997-02-02 07:19:30 +00:00
|
|
|
#
|
|
|
|
# Trust me, RUN THIS SCRIPT :)
|
|
|
|
#
|
2002-08-02 10:37:22 +00:00
|
|
|
# $FreeBSD$
|
|
|
|
#
|
1997-02-02 07:19:30 +00:00
|
|
|
#-------cut here------------------
|
|
|
|
|
2002-08-02 10:37:22 +00:00
|
|
|
if [ "${1}X" = "X" ]
|
1997-02-02 07:19:30 +00:00
|
|
|
then
|
|
|
|
echo "Hey , how about some help here.. give me a device name!"
|
|
|
|
exit 1
|
|
|
|
fi
|
2006-08-09 21:23:42 +00:00
|
|
|
if [ "X${2}" = "X" ]; then
|
|
|
|
TOP=`cd /sys; pwd -P`
|
|
|
|
echo "Using ${TOP} as the path to the kernel sources!"
|
|
|
|
else
|
|
|
|
TOP=${2}
|
|
|
|
fi
|
|
|
|
|
|
|
|
for i in "" "conf" "i386" "i386/conf" "dev" "sys" "modules"
|
|
|
|
do
|
|
|
|
if [ -d ${TOP}/${i} ]
|
|
|
|
then
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
echo "${TOP}/${i}: no such directory."
|
|
|
|
echo "Please, correct the error and try again."
|
|
|
|
exit 1
|
|
|
|
done
|
1997-02-02 07:19:30 +00:00
|
|
|
|
2002-08-02 10:37:22 +00:00
|
|
|
UPPER=`echo ${1} |tr "[:lower:]" "[:upper:]"`
|
2006-08-09 21:23:42 +00:00
|
|
|
|
|
|
|
if [ -d ${TOP}/modules/${1} ]; then
|
|
|
|
echo "There appears to already be a module called ${1}"
|
|
|
|
echo -n "Should it be overwritten? [Y]"
|
|
|
|
read VAL
|
|
|
|
if [ "-z" "$VAL" ]; then
|
|
|
|
VAL=YES
|
|
|
|
fi
|
|
|
|
case ${VAL} in
|
|
|
|
[yY]*)
|
|
|
|
echo "Cleaning up from prior runs"
|
|
|
|
rm -rf ${TOP}/dev/${1}
|
|
|
|
rm -rf ${TOP}/modules/${1}
|
|
|
|
rm ${TOP}/conf/files.${UPPER}
|
|
|
|
rm ${TOP}/i386/conf/${UPPER}
|
|
|
|
rm ${TOP}/sys/${1}io.h
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "The following files will be created:"
|
|
|
|
echo ${TOP}/modules/${1}
|
|
|
|
echo ${TOP}/conf/files.${UPPER}
|
|
|
|
echo ${TOP}/i386/conf/${UPPER}
|
|
|
|
echo ${TOP}/dev/${1}
|
|
|
|
echo ${TOP}/dev/${1}/${1}.c
|
|
|
|
echo ${TOP}/sys/${1}io.h
|
|
|
|
echo ${TOP}/modules/${1}
|
|
|
|
echo ${TOP}/modules/${1}/Makefile
|
|
|
|
|
|
|
|
mkdir ${TOP}/modules/${1}
|
|
|
|
|
|
|
|
cat >${TOP}/conf/files.${UPPER} <<DONE
|
2006-08-23 23:51:29 +00:00
|
|
|
dev/${1}/${1}.c optional ${1}
|
1997-02-02 07:19:30 +00:00
|
|
|
DONE
|
|
|
|
|
2006-08-09 21:23:42 +00:00
|
|
|
cat >${TOP}/i386/conf/${UPPER} <<DONE
|
1997-02-02 07:19:30 +00:00
|
|
|
# Configuration file for kernel type: ${UPPER}
|
2002-08-02 10:37:22 +00:00
|
|
|
# \$FreeBSD\$
|
1997-02-02 07:19:30 +00:00
|
|
|
|
2006-08-09 21:23:42 +00:00
|
|
|
files "${TOP}/conf/files.${UPPER}"
|
|
|
|
|
|
|
|
include GENERIC
|
|
|
|
|
|
|
|
ident ${UPPER}
|
1997-02-02 07:19:30 +00:00
|
|
|
|
|
|
|
# trust me, you'll need this
|
2006-08-09 21:23:42 +00:00
|
|
|
options KDB
|
|
|
|
options DDB
|
|
|
|
device ${1}
|
1997-02-02 07:19:30 +00:00
|
|
|
DONE
|
|
|
|
|
2006-08-09 21:23:42 +00:00
|
|
|
if [ ! -d ${TOP}/dev/${1} ]; then
|
|
|
|
mkdir -p ${TOP}/dev/${1}
|
|
|
|
fi
|
|
|
|
|
|
|
|
cat >${TOP}/dev/${1}/${1}.c <<DONE
|
1997-02-02 07:19:30 +00:00
|
|
|
/*
|
2006-08-09 20:57:24 +00:00
|
|
|
* Copyright (c) [year] [your name]
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
1997-02-02 07:19:30 +00:00
|
|
|
*
|
|
|
|
* ${1} driver
|
|
|
|
*/
|
|
|
|
|
2002-08-02 10:37:22 +00:00
|
|
|
#include <sys/cdefs.h>
|
|
|
|
__FBSDID("\$FreeBSD\$");
|
1997-02-02 07:19:30 +00:00
|
|
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
|
|
|
#include <sys/kernel.h> /* SYSINIT stuff */
|
2006-08-09 20:57:24 +00:00
|
|
|
#include <sys/uio.h> /* SYSINIT stuff */
|
1997-02-02 07:19:30 +00:00
|
|
|
#include <sys/conf.h> /* cdevsw stuff */
|
|
|
|
#include <sys/malloc.h> /* malloc region definitions */
|
2001-11-13 17:58:14 +00:00
|
|
|
#include <sys/proc.h>
|
1997-02-02 07:19:30 +00:00
|
|
|
#include <sys/${1}io.h> /* ${1} IOCTL definitions */
|
|
|
|
|
2002-08-02 10:37:22 +00:00
|
|
|
#include <machine/clock.h> /* DELAY() */
|
1997-02-02 07:19:30 +00:00
|
|
|
|
2006-08-09 20:57:24 +00:00
|
|
|
#define N${UPPER} 3 /* defines number of instances */
|
|
|
|
|
|
|
|
/* XXX These should be defined in terms of bus-space ops. */
|
|
|
|
#define ${UPPER}_INB(port) inb(port)
|
|
|
|
#define ${UPPER}_OUTB(port, val) (port, (val))
|
1997-02-02 07:19:30 +00:00
|
|
|
|
1998-10-22 16:12:16 +00:00
|
|
|
/* Function prototypes (these should all be static) */
|
1997-02-02 07:19:30 +00:00
|
|
|
static d_open_t ${1}open;
|
|
|
|
static d_close_t ${1}close;
|
|
|
|
static d_read_t ${1}read;
|
|
|
|
static d_write_t ${1}write;
|
|
|
|
static d_ioctl_t ${1}ioctl;
|
|
|
|
static d_mmap_t ${1}mmap;
|
1997-12-30 03:23:13 +00:00
|
|
|
static d_poll_t ${1}poll;
|
2002-08-02 10:37:22 +00:00
|
|
|
|
1997-02-02 07:19:30 +00:00
|
|
|
#define CDEV_MAJOR 20
|
|
|
|
static struct cdevsw ${1}_cdevsw = {
|
2006-08-09 20:57:24 +00:00
|
|
|
.d_version = D_VERSION,
|
|
|
|
.d_open = ${1}open,
|
|
|
|
.d_close = ${1}close,
|
|
|
|
.d_read = ${1}read,
|
|
|
|
.d_write = ${1}write,
|
|
|
|
.d_ioctl = ${1}ioctl,
|
|
|
|
.d_poll = ${1}poll,
|
|
|
|
.d_mmap = ${1}mmap,
|
|
|
|
.d_name = "${1}",
|
2002-08-02 10:37:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* device specific Misc defines
|
1997-02-02 07:19:30 +00:00
|
|
|
*/
|
|
|
|
#define BUFFERSIZE 1024
|
2008-09-27 16:52:57 +00:00
|
|
|
#define UNIT(dev) dev2unit(dev) /* assume one minor number per unit */
|
1997-02-02 07:19:30 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* One of these per allocated device
|
|
|
|
*/
|
|
|
|
struct ${1}_softc {
|
2006-08-09 20:57:24 +00:00
|
|
|
u_long iobase;
|
1997-02-02 07:19:30 +00:00
|
|
|
char buffer[BUFFERSIZE];
|
2006-08-09 20:57:24 +00:00
|
|
|
struct cdev *dev;
|
2002-08-02 10:37:22 +00:00
|
|
|
};
|
1997-02-02 07:19:30 +00:00
|
|
|
|
|
|
|
typedef struct ${1}_softc *sc_p;
|
|
|
|
|
|
|
|
static sc_p sca[N${UPPER}];
|
|
|
|
|
2002-08-02 10:37:22 +00:00
|
|
|
/*
|
1997-02-02 07:19:30 +00:00
|
|
|
* Macro to check that the unit number is valid
|
|
|
|
* Often this isn't needed as once the open() is performed,
|
|
|
|
* the unit number is pretty much safe.. The exception would be if we
|
|
|
|
* implemented devices that could "go away". in which case all these routines
|
|
|
|
* would be wise to check the number, DIAGNOSTIC or not.
|
|
|
|
*/
|
2002-08-02 10:37:22 +00:00
|
|
|
#define CHECKUNIT(RETVAL) \
|
|
|
|
do { /* the do-while is a safe way to do this grouping */ \
|
|
|
|
if (unit > N${UPPER}) { \
|
2005-03-09 11:28:46 +00:00
|
|
|
printf("%s: bad unit %d\n", __func__, unit); \
|
2002-08-02 10:37:22 +00:00
|
|
|
return (RETVAL); \
|
|
|
|
} \
|
|
|
|
if (scp == NULL) { \
|
2005-03-09 11:28:46 +00:00
|
|
|
printf("%s: unit %d not attached\n", __func__, unit); \
|
2002-08-02 10:37:22 +00:00
|
|
|
return (RETVAL); \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
1997-02-02 07:19:30 +00:00
|
|
|
#ifdef DIAGNOSTIC
|
|
|
|
#define CHECKUNIT_DIAG(RETVAL) CHECKUNIT(RETVAL)
|
|
|
|
#else /* DIAGNOSTIC */
|
|
|
|
#define CHECKUNIT_DIAG(RETVAL)
|
|
|
|
#endif /* DIAGNOSTIC */
|
|
|
|
|
2002-08-02 10:37:22 +00:00
|
|
|
static int
|
2006-08-09 20:57:24 +00:00
|
|
|
${1}ioctl (struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td)
|
1997-02-02 07:19:30 +00:00
|
|
|
{
|
2002-08-02 10:37:22 +00:00
|
|
|
int unit = UNIT(dev);
|
1997-02-02 07:19:30 +00:00
|
|
|
sc_p scp = sca[unit];
|
2002-08-02 10:37:22 +00:00
|
|
|
|
1997-02-02 07:19:30 +00:00
|
|
|
CHECKUNIT_DIAG(ENXIO);
|
2002-08-02 10:37:22 +00:00
|
|
|
|
1997-02-02 07:19:30 +00:00
|
|
|
switch (cmd) {
|
|
|
|
case DHIOCRESET:
|
|
|
|
/* whatever resets it */
|
2006-08-09 20:57:24 +00:00
|
|
|
(void)scp; /* Delete this line after using scp. */
|
|
|
|
#if 0
|
|
|
|
${UPPER}_OUTB(scp->iobase, 0xff);
|
|
|
|
#endif
|
1997-02-02 07:19:30 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return ENXIO;
|
|
|
|
}
|
|
|
|
return (0);
|
2002-08-02 10:37:22 +00:00
|
|
|
}
|
|
|
|
|
1997-02-02 07:19:30 +00:00
|
|
|
/*
|
|
|
|
* You also need read, write, open, close routines.
|
|
|
|
* This should get you started
|
|
|
|
*/
|
2002-08-02 10:37:22 +00:00
|
|
|
static int
|
2006-08-09 20:57:24 +00:00
|
|
|
${1}open(struct cdev *dev, int oflags, int devtype, struct thread *td)
|
1997-02-02 07:19:30 +00:00
|
|
|
{
|
2002-08-02 10:37:22 +00:00
|
|
|
int unit = UNIT(dev);
|
1997-02-02 07:19:30 +00:00
|
|
|
sc_p scp = sca[unit];
|
2002-08-02 10:37:22 +00:00
|
|
|
|
1997-02-02 07:19:30 +00:00
|
|
|
CHECKUNIT(ENXIO);
|
|
|
|
|
2006-08-09 20:57:24 +00:00
|
|
|
(void)scp; /* Delete this line after using scp. */
|
2002-08-02 10:37:22 +00:00
|
|
|
/*
|
1997-02-02 07:19:30 +00:00
|
|
|
* Do processing
|
|
|
|
*/
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
2002-08-02 10:37:22 +00:00
|
|
|
static int
|
2006-08-09 20:57:24 +00:00
|
|
|
${1}close(struct cdev *dev, int fflag, int devtype, struct thread *td)
|
1997-02-02 07:19:30 +00:00
|
|
|
{
|
2002-08-02 10:37:22 +00:00
|
|
|
int unit = UNIT(dev);
|
1997-02-02 07:19:30 +00:00
|
|
|
sc_p scp = sca[unit];
|
2002-08-02 10:37:22 +00:00
|
|
|
|
1997-02-02 07:19:30 +00:00
|
|
|
CHECKUNIT_DIAG(ENXIO);
|
|
|
|
|
2006-08-09 20:57:24 +00:00
|
|
|
(void)scp; /* Delete this line after using scp. */
|
2002-08-02 10:37:22 +00:00
|
|
|
/*
|
1997-02-02 07:19:30 +00:00
|
|
|
* Do processing
|
|
|
|
*/
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
2002-08-02 10:37:22 +00:00
|
|
|
static int
|
2006-08-09 20:57:24 +00:00
|
|
|
${1}read(struct cdev *dev, struct uio *uio, int ioflag)
|
1997-02-02 07:19:30 +00:00
|
|
|
{
|
2002-08-02 10:37:22 +00:00
|
|
|
int unit = UNIT(dev);
|
1997-02-02 07:19:30 +00:00
|
|
|
sc_p scp = sca[unit];
|
|
|
|
int toread;
|
2002-08-02 10:37:22 +00:00
|
|
|
|
|
|
|
|
1997-02-02 07:19:30 +00:00
|
|
|
CHECKUNIT_DIAG(ENXIO);
|
|
|
|
|
2002-08-02 10:37:22 +00:00
|
|
|
/*
|
1997-02-02 07:19:30 +00:00
|
|
|
* Do processing
|
|
|
|
* read from buffer
|
|
|
|
*/
|
|
|
|
toread = (min(uio->uio_resid, sizeof(scp->buffer)));
|
|
|
|
return(uiomove(scp->buffer, toread, uio));
|
|
|
|
}
|
|
|
|
|
2002-08-02 10:37:22 +00:00
|
|
|
static int
|
2006-08-09 20:57:24 +00:00
|
|
|
${1}write(struct cdev *dev, struct uio *uio, int ioflag)
|
1997-02-02 07:19:30 +00:00
|
|
|
{
|
2002-08-02 10:37:22 +00:00
|
|
|
int unit = UNIT(dev);
|
1997-02-02 07:19:30 +00:00
|
|
|
sc_p scp = sca[unit];
|
|
|
|
int towrite;
|
2002-08-02 10:37:22 +00:00
|
|
|
|
1997-02-02 07:19:30 +00:00
|
|
|
CHECKUNIT_DIAG(ENXIO);
|
|
|
|
|
2002-08-02 10:37:22 +00:00
|
|
|
/*
|
1997-02-02 07:19:30 +00:00
|
|
|
* Do processing
|
|
|
|
* write to buffer
|
|
|
|
*/
|
|
|
|
towrite = (min(uio->uio_resid, sizeof(scp->buffer)));
|
|
|
|
return(uiomove(scp->buffer, towrite, uio));
|
|
|
|
}
|
|
|
|
|
2002-08-02 10:37:22 +00:00
|
|
|
static int
|
2006-08-09 20:57:24 +00:00
|
|
|
${1}mmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot)
|
1997-02-02 07:19:30 +00:00
|
|
|
{
|
2002-08-02 10:37:22 +00:00
|
|
|
int unit = UNIT(dev);
|
1997-02-02 07:19:30 +00:00
|
|
|
sc_p scp = sca[unit];
|
2002-08-02 10:37:22 +00:00
|
|
|
|
1997-02-02 07:19:30 +00:00
|
|
|
CHECKUNIT_DIAG(-1);
|
|
|
|
|
2006-08-09 20:57:24 +00:00
|
|
|
(void)scp; /* Delete this line after using scp. */
|
2002-08-02 10:37:22 +00:00
|
|
|
/*
|
1997-02-02 07:19:30 +00:00
|
|
|
* Do processing
|
|
|
|
*/
|
|
|
|
#if 0 /* if we had a frame buffer or whatever.. do this */
|
|
|
|
if (offset > FRAMEBUFFERSIZE - PAGE_SIZE) {
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
return i386_btop((FRAMEBASE + offset));
|
|
|
|
#else
|
|
|
|
return (-1);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2002-08-02 10:37:22 +00:00
|
|
|
static int
|
2006-08-09 20:57:24 +00:00
|
|
|
${1}poll(struct cdev *dev, int which, struct thread *td)
|
1997-02-02 07:19:30 +00:00
|
|
|
{
|
2002-08-02 10:37:22 +00:00
|
|
|
int unit = UNIT(dev);
|
1997-02-02 07:19:30 +00:00
|
|
|
sc_p scp = sca[unit];
|
2002-08-02 10:37:22 +00:00
|
|
|
|
1997-02-02 07:19:30 +00:00
|
|
|
CHECKUNIT_DIAG(ENXIO);
|
|
|
|
|
2006-08-09 20:57:24 +00:00
|
|
|
(void)scp; /* Delete this line after using scp. */
|
2002-08-02 10:37:22 +00:00
|
|
|
/*
|
1997-02-02 07:19:30 +00:00
|
|
|
* Do processing
|
|
|
|
*/
|
|
|
|
return (0); /* this is the wrong value I'm sure */
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Now for some driver initialisation.
|
|
|
|
* Occurs ONCE during boot (very early).
|
|
|
|
*/
|
2002-08-02 10:37:22 +00:00
|
|
|
static void
|
1997-02-02 07:19:30 +00:00
|
|
|
${1}_drvinit(void *unused)
|
|
|
|
{
|
|
|
|
int unit;
|
2008-09-22 16:10:12 +00:00
|
|
|
sc_p scp;
|
1997-02-02 07:19:30 +00:00
|
|
|
|
|
|
|
for (unit = 0; unit < N${UPPER}; unit++) {
|
2002-08-02 10:37:22 +00:00
|
|
|
/*
|
1997-02-02 07:19:30 +00:00
|
|
|
* Allocate storage for this instance .
|
|
|
|
*/
|
2001-11-13 17:58:14 +00:00
|
|
|
scp = malloc(sizeof(*scp), M_DEVBUF, M_NOWAIT | M_ZERO);
|
1997-02-02 07:19:30 +00:00
|
|
|
if( scp == NULL) {
|
|
|
|
printf("${1}%d failed to allocate strorage\n", unit);
|
2002-08-02 10:37:22 +00:00
|
|
|
return;
|
1997-02-02 07:19:30 +00:00
|
|
|
}
|
|
|
|
sca[unit] = scp;
|
2006-08-09 20:57:24 +00:00
|
|
|
scp->dev = make_dev(&${1}_cdevsw, unit,
|
|
|
|
UID_ROOT, GID_KMEM, 0640, "${1}%d", unit);
|
1997-02-02 07:19:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SYSINIT(${1}dev, SI_SUB_DRIVERS, SI_ORDER_MIDDLE+CDEV_MAJOR,
|
2008-09-22 16:10:12 +00:00
|
|
|
${1}_drvinit, NULL);
|
1997-02-02 07:19:30 +00:00
|
|
|
DONE
|
|
|
|
|
2006-08-09 21:23:42 +00:00
|
|
|
cat >${TOP}/sys/${1}io.h <<DONE
|
1997-02-02 07:19:30 +00:00
|
|
|
/*
|
|
|
|
* Definitions needed to access the ${1} device (ioctls etc)
|
|
|
|
* see mtio.h , ioctl.h as examples
|
|
|
|
*/
|
|
|
|
#ifndef SYS_DHIO_H
|
|
|
|
#define SYS_DHIO_H
|
|
|
|
|
|
|
|
#ifndef KERNEL
|
|
|
|
#include <sys/types.h>
|
|
|
|
#endif
|
|
|
|
#include <sys/ioccom.h>
|
|
|
|
|
|
|
|
/*
|
|
|
|
* define an ioctl here
|
|
|
|
*/
|
|
|
|
#define DHIOCRESET _IO('D', 0) /* reset the ${1} device */
|
|
|
|
#endif
|
|
|
|
DONE
|
|
|
|
|
2006-08-09 21:23:42 +00:00
|
|
|
if [ ! -d ${TOP}/modules/${1} ]; then
|
|
|
|
mkdir -p ${TOP}/modules/${1}
|
|
|
|
fi
|
1997-02-02 07:19:30 +00:00
|
|
|
|
2006-08-09 21:23:42 +00:00
|
|
|
cat >${TOP}/modules/${1}/Makefile <<DONE
|
|
|
|
# ${UPPER} Loadable Kernel Module
|
1997-02-02 07:19:30 +00:00
|
|
|
#
|
2006-08-09 21:23:42 +00:00
|
|
|
# \$FreeBSD\$
|
|
|
|
|
|
|
|
.PATH: \${.CURDIR}/../../dev/${1}
|
|
|
|
KMOD = ${1}
|
|
|
|
SRCS = ${1}.c
|
|
|
|
|
|
|
|
.include <bsd.kmod.mk>
|
|
|
|
DONE
|
|
|
|
|
|
|
|
echo -n "Do you want to build the '${1}' module? [Y]"
|
|
|
|
read VAL
|
|
|
|
if [ "-z" "$VAL" ]; then
|
|
|
|
VAL=YES
|
|
|
|
fi
|
|
|
|
case ${VAL} in
|
|
|
|
[yY]*)
|
|
|
|
(cd ${TOP}/modules/${1}; make depend; make )
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
# exit
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
echo -n "Do you want to build the '${UPPER}' kernel? [Y]"
|
|
|
|
read VAL
|
|
|
|
if [ "-z" "$VAL" ]; then
|
|
|
|
VAL=YES
|
|
|
|
fi
|
|
|
|
case ${VAL} in
|
|
|
|
[yY]*)
|
|
|
|
(
|
|
|
|
cd ${TOP}/i386/conf; \
|
|
|
|
config ${UPPER}; \
|
|
|
|
cd ${TOP}/i386/compile/${UPPER}; \
|
|
|
|
make depend; \
|
|
|
|
make; \
|
|
|
|
)
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
# exit
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
#--------------end of script---------------
|
1997-02-02 07:19:30 +00:00
|
|
|
#
|
|
|
|
#edit to your taste..
|
|
|
|
#
|
2002-08-02 10:37:22 +00:00
|
|
|
#
|