Notes on Installing and Using NetBSD

  1. Notes on the Apple Partition Map (APM) with other architectures
  2. Startup config
  3. Network config
  4. Users
    1. 2.4 Generating the pkgsrc file tree:
  5. Building the kernel
    1. Driver specific notes on Kernel building
  6. Random Notes
    1. Deleting a disklabel

Notes on the Apple Partition Map (APM) with other architectures

In order to mount Apple_UFS and FFS partitions on an APM you need to compile a kernel with the FFS_EI and APPLE_UFS options. You will also need to compile apmlabel in order to convert the Apple Partition Map to disklabel. It is only included with NetBSD >= 5 or it can be acquired as such (You need to have the sources deflated to compile this):

cvs -d anoncvs@anoncvs.netbsd.org:/cvsroot checkout -P /usr/src/sbin/disklabel /usr/src/sbin/apmlabel
cd /usr/src/sbin/apmlabel
make NETBSDSRCDIR=$PWD/../.. apmlabel

Startup config

  • First off you need to mount the main HD
    # mount -u /dev/wd0a /
    
  • Now configure rc.conf (See /etc/defaults/rc.conf)
  • Create the fstab file (See /usr/share/examples/fstab/)

Network config

Configure dhcp (See http://netbsd.org/Documentation/network/dhcp.html - don't forget to do /dev/MAKEDEV all) Or manual config :

$ cat ifconfig.ex0 inet 192.168.1.20 netmask 255.255.255.0 up
$ cat /etc/mygate 192.168.1.1
$ cat /etc/myname fripouille
$ cat /etc/resolv.conf nameserver 192.168.1.168

In /etc/rc.conf add

net_interfaces="lo0 ex0 gem0"

Users

$ groupadd USERNAME
$ useradd -G wheel -g USERNAME -m -s /bin/sh USERNAME
$ passwd USERNAME

2.4 Generating the pkgsrc file tree:

Get the pkgsrc tarball archive
ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-current/tar_files/pkgsrc.tar.gz And then

$ (cd /usr/pkgsrc ; tar -zxpf - ) < pkgsrc.tar.gz

Or

export CVSROOT="anoncvs@anoncvs2.us.NetBSD.org:/cvsroot"
export CVS_RSH="ssh"
cd /usr

# The first time (or use the above tarball)
cvs login
cvs checkout -P pkgsrc
# Later use this to update
cvs -d $CVSROOT update -PAd pkgsrc

Or

cd /usr; CVSROOT=anoncvs@anoncvs.NetBSD.org:/cvsroot; CVS_RSH=ssh; cvs -d $CVSROOT update -PAd pkgsrc

(As of this update I recommend using the netbsd.se mirror. See this page for more details.)

Building the kernel

See http://netbsd.org/Documentation/kernel/#how_to_build_a_kernel but install all sets (except X).
You also need to :

$ mkdir /usr/obj # unsure about this
$ echo MKOBJDIR=yes >> /etc/mk.conf

Driver specific notes on Kernel building

  • Most NICs using the ex (man 4 ex) do *not* use the exphy but the bmtphy. Make sure you have it compiled in the kernel.

Random Notes

Deleting a disklabel

  # dd if=/dev/zero of=/dev/rwd0c bs=8k count=1

The previous command deletes the disklabel (not the MBR partition table). To completely delete the disk, the whole device rwd0d must be used.

For example:

  # dd if=/dev/zero of=/dev/rwd0d bs=8k

The commands above will only work as expected on the i386 and amd64 ports of NetBSD. On other ports, the whole device will end in c, not d (e.g. rwd0c). http://www.netbsd.org/docs/guide/en/chap-misc.html