From 83dd0fc853882b4b5654bd779189d2b6431073a4 Mon Sep 17 00:00:00 2001 From: rik Date: Sun, 6 Aug 2006 11:06:35 +0000 Subject: [PATCH] - 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@ --- share/examples/drivers/make_device_driver.sh | 49 +++++++++++++------- 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/share/examples/drivers/make_device_driver.sh b/share/examples/drivers/make_device_driver.sh index cae5d06632df..b917b4c4cac3 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} <${TOP}/conf/files.${UPPER} <${TOP}/i386/conf/${UPPER} <>${TOP}/i386/conf/${UPPER} +include GENERIC + +ident ${UPPER} + +DONE cat >>${TOP}/i386/conf/${UPPER} < DONE -(cd ${TOP}/modules/${1}; make depend; 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 -config ${UPPER} -cd ../../compile/${UPPER} -make depend -make ${1}.o -make -exit +echo "" +echo "To build the kernel you should merge ${TOP}/conf/files.${UPPER} " \ + "into one of the ${TOP}/conf/files*" #--------------end of script--------------- #