Some tips on FreeBSD

LAST UPDATE: $Date: 2005/04/30 14:49:55 $

nForce3 Ethernet on FreeBSD 5.3-amd64 and -CURRENT-amd64.

Original source is made by Quinton Dolan.
I've tested latest version at 4/3/2005, and it is working on 6-CURRENT at that time.
Nve driver has been commited in March, but It is not working on my box. Quinton told me that nve driver was based on a little bit older version. So maybe nve will be corrected soon.

FreeBSD 5.3 can use kernel modules even on amd64. Thus we can compile nvnet as kernel module.
  1. Obtain nvnet-src-20040813.tar.gz and NVIDIA_nforce-1.0-0275.tar.gz (for amd 64).
  2. Extract both tar.gz and apply a patch to nvnet/src/if_nv.c
    *** if_nv.c.orig        Mon Oct 11 12:04:44 2004
    --- if_nv.c     Mon Oct 11 11:57:07 2004
    *** 86,91 ****
    --- 86,92 ----
      #include <sys/socket.h>
      #include <sys/sysctl.h>
      #include <sys/queue.h>
    + #include <sys/module.h>
      #include <net/if.h>
      #include <net/if_arp.h>
  3. Run make in nvnet/, then you can get if_nv.ko.
  4. Copy if_nv.ko into appropriate directory and 'kldload if_nv.c'.
  5. nForce3 ethernet will be recognized like as follows.
    nv0: <NVIDIA nForce MCP3 Networking Adapter> port 0xb400-0xb407 mem 0xe8000000-0xe8000fff irq 10 at device 5.0 on pci0
    nv0: Ethernet address 00:30:1b:b3:b8:1d
    nv0: Ethernet address: 00:30:1b:b3:b8:1d
    nv0: [GIANT-LOCKED]
    miibus1: <MII bus> on nv0
    rlphy0: <RTL8201L 10/100 media interface> on miibus1
    rlphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto

nForce3 Ethernet on FreeBSD 5.2-AMD64

This way is only for FreeBSD 5.2-RELEASE. This is not appliable to FreeBSD-CURRENT.



Obtain two files:
nvnet-src-20040108.tar.gz and Official nForce Drivers for Linux AMD64(1.0.0269) . Then, extract them in your temporary directory.


Make dir /usr/src/sys/dev/nvnet and collect the following files into the directory.

nvnet/src/{if_nv.c, if_nvreg.h}
nforce/nvnet/{basetype.h, os.h, adapter.h, nvnetlib.o, phy.h}

And, touch /usr/src/sys/dev/nvnet/nvnetlib.c.
At this point, you can see eight files under /usr/src/sys/dev/nvnet.

# cd /usr/src/sys/dev/nvnet/
# ls
adapter.h       if_nv.c         nvnetlib.c      os.h
basetype.h      if_nvreg.h      nvnetlib.o      phy.h
Apply the patch in the directory.
# patch -p1 < nvnet-amd64-patch.diff
Append the following lines to /usr/src/sys/conf/files.amd64.
dev/nvnet/if_nv.c               optional nv pci
dev/nvnet/nvnetlib.c            optional nv pci


Append a line to your kernel CONFIGFILE.
device   nv
Then, execute 'config CONFIGFILE', move into compilation directory, copy /usr/src/sys/dev/nvnet/nvnetlib.o into the directory (make sure that nvnetlib.o is newer than /usr/src/sys/dev/nvnet/nvnetlib.c). And make depend and make. You can build new kernel with nvnet driver.
dmesg is like this.
Copyright (c) 1992-2004 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights reserved.
FreeBSD 5.2-CURRENT #15: Mon May  3 20:28:10 JST 2004
Preloaded elf kernel "/boot/kernel/kernel" at 0xffffffff80788000.
Timecounter "i8254" frequency 1193182 Hz quality 0
CPU: AMD Athlon(tm) 64 Processor 3200+ (1994.86-MHz K8-class CPU)
  Origin = "AuthenticAMD"  Id = 0xf48  Stepping = 8
  AMD Features=0xe0500800<SYSCALL,NX,MMX+,LM,3DNow!+,3DNow!>
real memory  = 536805376 (511 MB)
avail memory = 508452864 (484 MB)


nv0: <NVIDIA nForce MCP3 Networking Adapter> port 0xb400-0xb407 mem 0xe8000000-0xe8000fff irq 10 at device 5.0 on pci0
nv0: Reserved 0x1000 bytes for rid 0x10 type 3 at 0xe8000000
nv0: Ethernet address 00:30:1b:b3:b8:1d
miibus1: <MII bus> on nv0
rlphy0: <RTL8201L 10/100 media interface> on miibus1
rlphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
nv0: Ethernet address: 00:30:1b:b3:b8:1d

Uvisor on FreeBSD 4.9-RELEASE / FreeBSD-CURRENT

My Palm Tungsten T doesn't work via uvisor on FreeBSD 4.9-RELEASE. So, I've modified uvisor.c so that it can attach Tungsten T (and other Palm device) properly.
I'll send-pr again after I send same send-pr on NetBSD.

RealProducer on FreeBSD (linux emulation)

Real Producer doesn't work on linux emulation on FreeBSD (3.x/4.x). Please apply the following patch corresponding to you version. This patch has been commited into -CURRENT tree in Nov. 17th, 2001. And rebuild linux.ko. The patch is as shown below (for FreeBSD 4.1):
*** sys/i386/linux/linux_ioctl.c.orig	Mon Nov 20 20:22:07 2000
--- sys/i386/linux/linux_ioctl.c	Mon Nov 20 20:23:11 2000
*** 1044,1049 ****
--- 1044,1053 ----
  		return (ioctl(p, (struct ioctl_args *)args));
+ 	        args->cmd = SETDIR(SOUND_MIXER_WRITE_RECSRC);
+ 	        return ioctl(p, (struct ioctl_args *)args);
  		int version = linux_get_oss_version(p);
  		return (copyout(&version, (caddr_t)args->arg, sizeof(int)));
*** sys/i386/linux/linux_ioctl.h.orig	Mon Nov 20 20:23:43 2000
--- sys/i386/linux/linux_ioctl.h	Mon Nov 20 20:24:08 2000
*** 163,168 ****
--- 163,169 ----
  #define	LINUX_OSS_GETVERSION		0x4d76
  #define	LINUX_SNDCTL_DSP_RESET		0x5000

Flash plug-in on Netscape

Newer version than /usr/ports/www/flash-plugin/ is here (0.4.10). Put it into /usr/local/lib/netscape/plugins/.

Plugger on Netscape

Plugger is the front end of plugin for netscape to play multimedia contents.
To compile it by ports, c++rt0.c of FreeBSD 2.2.x is needed.
Compiled binary of plugger is here. Put it into /usr/local/lib/netscape/plugins/, and put pluggerrc into /usr/local/etc/. Ofcourse you should prepare many multimedia players, such as mtvp, xanim, timidity and so on.

Masahiko KIMOTO, Ph.D. <>
Last modified: Sat Apr 30 23:49:01 JST 2005