summaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorrik <rik@FreeBSD.org>2006-08-06 11:06:35 +0000
committerrik <rik@FreeBSD.org>2006-08-06 11:06:35 +0000
commit83dd0fc853882b4b5654bd779189d2b6431073a4 (patch)
tree5dc5b3f6415de1b0dfea80563b5edb257d72c298 /share
parent8f0d63493612f758f98d10101d9197a3f3152542 (diff)
downloadFreeBSD-src-83dd0fc853882b4b5654bd779189d2b6431073a4.zip
FreeBSD-src-83dd0fc853882b4b5654bd779189d2b6431073a4.tar.gz
- Added ability to provide (optional) path to the kernel sources
- Fixed path for ${s}/conf/files.FOO and a note that it should be merged into corresponding file to be able to compile the kernel - Changed kernel configuration example with the driver: it is not produced by copying Generic but by including it - Changed from automatic module building to asking an user if it whants to Reviewed by: julian@
Diffstat (limited to 'share')
-rwxr-xr-xshare/examples/drivers/make_device_driver.sh51
1 files changed, 32 insertions, 19 deletions
diff --git a/share/examples/drivers/make_device_driver.sh b/share/examples/drivers/make_device_driver.sh
index cae5d06..b917b4c 100755
--- a/share/examples/drivers/make_device_driver.sh
+++ b/share/examples/drivers/make_device_driver.sh
@@ -12,6 +12,7 @@
# cd /sys/modules/foo; make depend; make; make install; kldload foo
#
# arg1 to this script is expected to be lowercase "foo"
+# arg2 path to the kernel sources, "/sys" if omitted
#
# Trust me, RUN THIS SCRIPT :)
#
@@ -26,12 +27,14 @@ if [ "X${1}" = "X" ]; then
echo "Hey, how about some help here... give me a device name!"
exit 1
fi
+if [ "X${2}" = "X" ]; then
+ TOP=`cd /sys; pwd -P`
+ echo "Using ${TOP} as the path to the kernel sources!"
+else
+ TOP=${2}
+fi
UPPER=`echo ${1} |tr "[:lower:]" "[:upper:]"`
-HERE=`pwd`
-cd /sys
-TOP=`pwd`
-
RCS_KEYWORD=FreeBSD
if [ -d ${TOP}/modules/${1} ]; then
@@ -46,7 +49,7 @@ if [ -d ${TOP}/modules/${1} ]; then
echo "Cleaning up from prior runs"
rm -rf ${TOP}/dev/${1}
rm -rf ${TOP}/modules/${1}
- rm ${TOP}/i386/conf/files.${UPPER}
+ rm ${TOP}/conf/files.${UPPER}
rm ${TOP}/i386/conf/${UPPER}
rm ${TOP}/sys/${1}io.h
;;
@@ -58,7 +61,7 @@ fi
echo "The following files will be created:"
echo ${TOP}/modules/${1}
-echo ${TOP}/i386/conf/files.${UPPER}
+echo ${TOP}/conf/files.${UPPER}
echo ${TOP}/i386/conf/${UPPER}
echo ${TOP}/dev/${1}
echo ${TOP}/dev/${1}/${1}.c
@@ -79,7 +82,7 @@ echo ${TOP}/modules/${1}/Makefile
# First add the file to a local file list.
#######################################################################
-cat >${TOP}/i386/conf/files.${UPPER} <<DONE
+cat >${TOP}/conf/files.${UPPER} <<DONE
dev/${1}/${1}.c optional ${1}
DONE
@@ -88,11 +91,13 @@ DONE
#######################################################################
cat >${TOP}/i386/conf/${UPPER} <<DONE
# Configuration file for kernel type: ${UPPER}
-ident ${UPPER}
# \$${RCS_KEYWORD}$
-DONE
-grep -v GENERIC < /sys/i386/conf/GENERIC >>${TOP}/i386/conf/${UPPER}
+include GENERIC
+
+ident ${UPPER}
+
+DONE
cat >>${TOP}/i386/conf/${UPPER} <<DONE
options DDB # trust me, you'll need this
@@ -964,15 +969,23 @@ opt_inet.h:
.include <bsd.kmod.mk>
DONE
-(cd ${TOP}/modules/${1}; make depend; make )
-exit
-
-config ${UPPER}
-cd ../../compile/${UPPER}
-make depend
-make ${1}.o
-make
-exit
+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 "To build the kernel you should merge ${TOP}/conf/files.${UPPER} " \
+ "into one of the ${TOP}/conf/files*"
#--------------end of script---------------
#
OpenPOWER on IntegriCloud