Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Oct 2004 23:30:17 -0600 (MDT)
From:      "Brad Waite" <freebsd@wcubed.net>
To:        "Giorgos Keramidas" <keramida@ceid.upatras.gr>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Building part of world
Message-ID:  <3019.67.165.234.240.1099114217.squirrel@webmail.wcubed.net>
In-Reply-To: <20041029202605.GC1046@gothmog.gr>
References:  <2614.67.165.234.240.1099073745.squirrel@webmail.wcubed.net>  <20041029183742.GB76157@dan.emsphone.com>  <20041029202605.GC1046@gothmog.gr>

next in thread | previous in thread | raw e-mail | index | archive | help
> On 2004-10-29 13:37, Dan Nelson <dnelson@allantgroup.com> wrote:
>> In the last episode (Oct 29), Brad Waite said:
>> > I'm trying to update my sys/pci/if_sk.c and would like to be able to
>> > build several versions without having to build the entire world.
>>
>> Since that's a kernel driver, you only have to build a new kernel.
>
> An even better approach in the case of a single kernel driver is to leave
> it
> commented out in the kernel config file.  Then it will be built as a
> module by
> default.  After at least one buildworld/buildkernel cycle has finished
> correctly with this configuration, you can use the already populated
> /usr/obj
> tree to build just this module:
>
> 	# cd /usr/src/sys/i386/conf
> 	# config -g -d /usr/obj/usr/src/sys/MYKERNEL MYKERNEL
> 	# cd /usr/obj/usr/src/sys/MYKERNEL
> 	# make depend && make && make install
>
> If you have only touched a single .c file, the 'make depend' step is AFAIK
> optional.  The rest should finish pretty fast.
>
> Brave people might even get away by building the sk module only, by
> emulating the specific part of the kernel build:
>
> 	# cd /usr/src/sys/modules/sk
> 	# env MAKEOBJDIRPREFIX=/tmp/sk \
> 	  KMODDIR=/boot/kernel DEBUG_FLAGS="-g" MACHINE=i386 \
> 	  KERNBUILDDIR="/usr/obj/usr/src/sys/MYKERNEL" make obj
> 	# env MAKEOBJDIRPREFIX=/tmp/sk \
> 	  KMODDIR=/boot/kernel DEBUG_FLAGS="-g" MACHINE=i386 \
> 	  KERNBUILDDIR="/usr/obj/usr/src/sys/MYKERNEL" make all
>
> If all this works, you can just kldload the new if_sk.ko from
> `/tmp/sk/usr/src/sys/modules/sk' to test your changes.
>
> HTH,
> Giorgos

Wow, Giorgos, this really *does* help.  It never dawned on me that FBSD
even supported loadable kernel modules.  Feel kinda sheepish now, but hey,
I guess you learn something new every day.

In my stumbling around since you've enlightened me, I noticed a sk/ dir in
/usr/src/sys/modules, and in there a Makefile.  'make install' apparently
builds the .ko and installs it into /modules.

Am I missing something here, or is this the way to go?

Brad



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3019.67.165.234.240.1099114217.squirrel>