Current oav website

This commit is contained in:
Charlie Root
2023-03-20 12:18:38 +01:00
commit a096ce07cf
3270 changed files with 261778 additions and 0 deletions

View File

@ -0,0 +1,144 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0055)http://ezine.daemonnews.org/200301/sparc64-nfsroot.html -->
<HTML><HEAD><TITLE>Daemon News : Booting FreeBSD 5.0 on a Sun machine over the network</TITLE><LINK
href="dn.css"
type=text/css rel=stylesheet><LINK href="daemon.ico" rel="shortcut icon">
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1106" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff>
<H2>Booting FreeBSD 5.0 on a Sun machine over the network</H2>
<H3>Anthony Volodkin &lt;<A
href="mailto:anthonyv@brainlink.com">anthonyv@brainlink.com</A>&gt;</H3>
<H2>Introduction</H2>
<P class=Normal>In recent years, the FreeBSD-sparc64 port gathered significant
attention among developers. A large amount of work has been done over the years;
however, there is still a lot that must be accomplished in terms of device
support and stability. One of the shortcomings of the FreeBSD-sparc64 port is
the lack of support for some onboard SCSI devices that are used in Sun Ultra
1's, Ultra 2's, and possibly other models. This prevents FreeBSD from
recognizing attached disk drives and thus booting from a disk. </P>
<P class=Normal>To allow developers to test their code, especially disk drivers,
it is necessary to boot the machine without using a disk. The FreeBSD Handbook
describes the procedure for booting a diskless workstation, but that does not
entirely apply to booting a FreeBSD-sparc64 system on a machine such as an Ultra
2. The solution below involves using TFTP and the kernel support for a
NFS-mounted root partition to boot FreeBSD from the network. </P>
<P class=Normal>Our example setup involves a fast i386 machine running FreeBSD
4.7-RELEASE and a Sun Ultra 2 with FreeBSD 5.0-DP2. This procedure is applicable
to a wide range of Sun hardware and will work with later releases of the FreeBSD
5.0. </P>
<H2>Setting up DHCPd</H2>
<P class=Normal>First, we need to download and install isc-dhcpd 3.x onto the
machine that will also act as the TFTP/NFS server. You can find it in
<TT>/usr/ports/net/isc-dhcp3/</TT>. After completeing the basic dhcpd
configuration such as the subnet definitions, IP addressess ranges, etc., we can
proceed with adding a host section for the netbooted machine. </P>
<P class=Normal>Here is an example: </P><PRE> host divine {
hardware ethernet 08:00:20:89:cf:f3;
option host-name "divine.local.non-standard.net";
fixed-address 192.168.1.5;
always-reply-rfc1048 on;
filename "loader.nfs";
next-server 192.168.1.3;
option root-path "192.168.1.3:/storage3/sparc64-nfsroot";
}
</PRE>
<P class=Normal>The <TT>filename</TT> field refers to the name of the file that
should be originally sent to the machine after its first DHCP/BOOTP request. The
<TT>next-server</TT> field specifies which server should be used for downloading
the kernel using TFTP or NFS. The <TT>root-path</TT> option describes where the
kernel is located on the NFS server. </P>
<H2>Setting up TFTPd</H2>
<P class=Normal>In the next step we use the default TFTP daemon that comes with
FreeBSD. However, the default configuration in <TT>/etc/inetd.conf</TT> does not
work properly in this case. Access Violations (even while proper permissions are
set) and other errors appear when a client requests "/loader.nfs" instead of
"loader.nfs" or vice-versa. In order to make it work we have to modify
<TT>inetd.conf</TT> to look like the following: </P><PRE> tftp dgram udp wait root /usr/libexec/tftpd tftpd -l -s /tftpboot
</PRE>
<P class=Normal>This does the trick, and a request for "/loader.nfs" gets
treated identically to "loader.nfs" Now all we need to do is to obtain
loader.nfs and place it in the /tftpboot directory. You can download it from <A
href="http://non-standard.net/freebsd/loader.nfs">http://non-standard.net/freebsd/loader.nfs</A>
To avoid any permission problems just execute the following: </P><PRE> chown -R nobody:nobody /tftpboot
chmod -R 755 /tftpboot
</PRE>
<H2>Setting up NFS</H2>
<P class=Normal>Now we have to download the live-filesystem ISO from <A
href="ftp://ftp.freebsd.org/pub/FreeBSD/ISO-IMAGES-sparc64/5.0-DP2-disc2.iso">ftp://ftp.freebsd.org/pub/FreeBSD/ISO-IMAGES-sparc64/5.0-DP2-disc2.iso</A>
(use a <A
href="http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/mirrors-ftp.html">mirror</A>),
and mount it using vnconfig. Note that <TT>vnconfig</TT> for FreeBSD 4.7 is
known as <TT>mdconfig</TT> in FreeBSD 5.0-CURRENT. </P>
<PRE> vnconfig vn0 5.0-DP2-disc2.iso # associate vn0 with the cd image
mount -t cd9660 /dev/vn0c /mnt # mount the image
</PRE>
<P class=Normal>Copy the contents of /mnt directory somewhere on your machine.
A simple <TT>cp</TT> will work; however, the live-filesystem contains symlinks
so it is better to use <TT>rsync</TT>. </P>
<PRE> cd /storage3/sparc64-nfsroot # go into the future nfsroot directory
rsync --progress -avr /mnt/ . # extract contents
umount /mnt
vnconfig -u vn0
</PRE>
<P class=Normal>Create a /etc/fstab in the nfsroot directory (in this case it is
/storage3/sparc64-nfsroot) and add the following information to it: </P><PRE> # Device Mountpoint FStype Options Dump Pass#
192.168.1.3:/storage3/sparc64-nfsroot / nfs rw 0 0
</PRE>
<P class=Normal>Add the following to /etc/exports to enable the netbooted
machine to mount its root filesystem from /storage3/sparc64-nfsroot: </P><PRE> /storage3/sparc64-nfsroot -maproot=root 192.168.1.5
</PRE>
<P class=Normal>Start the NFS daemons (If you are using a 5.0-CURRENT machine as
a server, use the <TT>rpcbind</TT> command instead of <TT>portmap</TT>): </P><PRE> portmap
nfsd -u -t -n 4
mountd -r
rpc.statd
rpc.lockd
</PRE>
<P class=Normal>If you also want NFS to run upon bootup add the following to
/etc/rc.conf </P><PRE> portmap_enable="YES"
nfs_server_enable="YES"
mountd_flags="-r"
rpc_statd_enable="YES"
rpc_lockd_enable="YES"
</PRE>
<P class=Normal>Now we are ready to build a custom sparc64 kernel. The GENERIC
one on the CD image does not include the options necessary for a successful
diskless boot. We have to get the 5.0-CURRENT sources using cvsup (refer to the
FreeBSD handbook for detailed instructions) and edit
"/usr/src/sys/sparc64/conf/DIVINE" (DIVINE will be our sample kernel) and add
the following: </P><PRE> options BOOTP # Use BOOTP to obtain IP address/hostname
options BOOTP_NFSROOT # NFS mount root filesystem using BOOTP info
options BOOTP_NFSV3 # Use NFS v3 to NFS mount root
options BOOTP_COMPAT # Workaround for broken bootp daemons.
options BOOTP_WIRED_TO=hme0 # Use interface fxp0 for BOOTP
</PRE>
<P class=Normal>Then we build the kernel. It is possible to cross-compile a
sparc64 kernel/world on a i386 machine: </P><PRE> cd /usr/src/
make TARGET_ARCH=sparc64 buildworld # buildworld for the sparc64 port
make TARGET_ARCH=sparc64 buildkernel # build the sparc64 kernel
</PRE>
<P class=Normal>When this is completed, we will move the files: </P><PRE> mv /storage3/sparc64-nfsroot/boot/kernel /storage3/sparc64-nfsroot/boot/kernel.GENERIC # move the default kernel tree in the nfsroot to another location
mkdir /storage3/sparc64-nfsroot/boot/kernel # make new kernel directory
cp /usr/obj/sparc64/usr/src/sys/DIVINE/* /storage3/sparc64-nfsroot/boot/kernel/ # copy the kernel as well as the modules into the new kernel directory
</PRE>
<P class=Normal>Note that it's important not to do a <TT>cp -r</TT>, because
then a whole bunch of unnecessary parts of the source will be copied into the
kernel directory. </P>
<H2>Booting the Sun machine</H2>
<P class=Normal>Finally, at the OpenBoot prompt enter the following: </P><PRE> ok (0) boot net:dhcp,192.168.1.3,loader.nfs
</PRE>
<P class=Normal>This will use DHCP to get an IP address and then download and
execute loader.nfs from 192.168.1.3 via TFTP. After this, you will see a normal
login prompt. If your Ultra 2 does not support these boot options, you might
have to upgrade the firmware (<A
href="http://sunsolve.sun.com/">http://sunsolve.sun.com/</A>. </P>
<P class=Normal>Comments or corrections are welcome at <A
href="mailto:anthonyv@brainlink.com">anthonyv@brainlink.com</A>. Special thanks
to Jake Burkholder for his input. </P>
<P class=Normal>
<HR color=#dadada noShade>
<BR>
<FONT class=Small>Author maintains all copyrights on this article.</FONT>
</BODY></HTML>