pavement

User:Hxp/Sparc Netboot

From FreeBSDwiki
(Difference between revisions)
Jump to: navigation, search
 
Line 34: Line 34:
 
</pre>
 
</pre>
  
==== Have a copy of FreeBSD for sparc64 handy ====
+
==== Have a copy of FreeBSD/sparc64 and appropriate tools handy ====
  
 
Mount FreeBSD-9.0-RELEASE-sparc64-disc1.iso at /cdrom or some similarly convenient location.  Extracting the contents to a directory will also work.
 
Mount FreeBSD-9.0-RELEASE-sparc64-disc1.iso at /cdrom or some similarly convenient location.  Extracting the contents to a directory will also work.
 +
 +
In case you will be disconnecting from the main network for this, make sure to install net-mgmt/sipcalc and net/isc-dhcp42-server for later.
  
 
=== Setting up rarpd ===  
 
=== Setting up rarpd ===  
Line 90: Line 92:
  
 
=== DHCP ===
 
=== DHCP ===
 +
 +
Once the FreeBSD bootloader is running on the Sparc machine, it will make DHCP requests.  Unfortunately a dhcpd server is not part of the base FreeBSD installation.  Install the port net/isc-dhcp42-server.
 +
 +
<pre>
 +
 +
subnet 192.168.2.0 netmask 255.255.255.0 {
 +
}
 +
 +
host sparky {
 +
hardware ethernet 08:00:20:c2:6a:08;
 +
option host-name "sparky";
 +
fixed-address 192.168.2.2;
 +
always-reply-rfc1048 on;
 +
filename "loader";
 +
next-server 192.168.2.1;
 +
option root-path "192.168.2.1:/cdrom";
 +
}
 +
</pre>

Latest revision as of 04:03, 17 April 2012

Work in progress

This is a guide on how to boot a sparc64 machine from the network for the purpose of installing FreeBSD. Much of this would also be useful in setting up a diskless workstation, or for booting pretty much any other OS for sparc64.

Contents

[edit] The Boot Process

  1. Openboot will send out RARP requests for an IP address.
  2. When a rarpd server responds to the request, Openboot will then use TFTP to request a loader from the same machine that answered the RARP request.
  3. The tftpd server provides the loader, which Openboot then executes.
  4. In the case of the FreeBSD bootloader, it will then perform a DHCP request.
  5. The DHCP server responds with the IP address of the Sun box, and the location of the root file system on NFS.
  6. The loader loads the kernel from NFS and boots it.

So, that's pretty complicated. What's necessary on the server side is the following:

  1. rarpd to give the firmware its initial IP address.
  2. tftpd to transfer the bootloader.
  3. dhcpd to give the bootloader the location of the kernel and root file system.
  4. NFS to serve up the FS and kernel.

I used FreeBSD 9.0 for amd64 in a VM with bridged networking to install FreeBSD 9.0 for sparc64, but other combinations should work. In theory, any OS which can provide those four services can be the netboot server, including other BSDs, Linux, Mac OS X and even Windows but the configuration of those is beyond the scope of this article.

It's important for the machine to be on the same physical network -- rarpd in particular will not pass through routers. Modern PCs with Gigabit ethernet can be connected directly port-to-port with the Sun box and will enable crossover automatically.

[edit] Edit /etc/hosts

The first thing you should do is assign an IP on your network for your sparc box in /etc/hosts:

::1                     localhost localhost.my.domain
127.0.0.1               localhost localhost.my.domain
192.168.2.2             sparky

[edit] Have a copy of FreeBSD/sparc64 and appropriate tools handy

Mount FreeBSD-9.0-RELEASE-sparc64-disc1.iso at /cdrom or some similarly convenient location. Extracting the contents to a directory will also work.

In case you will be disconnecting from the main network for this, make sure to install net-mgmt/sipcalc and net/isc-dhcp42-server for later.

[edit] Setting up rarpd

Rarpd listens for requests on an interface for IPs then responds based on what is in the file /etc/ethers. /etc/ethers has a very simple format of <ethernet address> <ip>. You can get the ethernet address of your device from Openboot on startup or by running the command .enet-addr at the Ok prompt. Create /etc/ethers with the ethernet address of your Sun box.

ff:ee:00:57:9d:8a     sparky
Add
rarpd_enable="YES"
to /etc/rc.conf and start it with
/etc/rc.d/rarpd start

[edit] Setting up TFTP

On FreeBSD tftpd is part of inetd. Edit /etc/inet.d so that the tftp line is uncommented.
tftp   dgram   udp     wait    root    /usr/libexec/tftpd      tftpd -l -s /tftpboot
Make sure
inetd_enable="YES"
is in /etc/rc.conf and make sure to start or restart inetd so that the configuration change registers.

Make the directory /tftpboot and copy the FreeBSD bootloader there.

# mkdir /tftpboot
# cp /cdrom/boot/loader /tftpboot

The Sun box will request a file equivalent to the assigned IP address from rarpd in hexadecimal. Some sun4c and sun4m machines require HEXIP.SUN4C or HEXIP.SUN4M, respectively. Check what the machine requests using Wireshark if you're not certain. Use sipcalc (available in ports) or a similar tool:

# sipcalc 192.168.2.2 

-[ipv4 : 192.168.2.2] - 0

[CIDR]
Host address		- 192.168.2.2
Host address (decimal)	- 3232236034
Host address (hex)	- C0A80202
Network address		- 192.168.2.2
Network mask		- 255.255.255.255
Network mask (bits)	- 32
Network mask (hex)	- FFFFFFFF
Broadcast address	- 192.168.2.2
Cisco wildcard		- 0.0.0.0
Addresses in network	- 1
Network range		- 192.168.2.2 - 192.168.2.2

-

The hexadecimal IP for the Sun machine in this example is C0A80202. Link the firmware to that filename.

# ln -s /tftpboot/loader /tftpboot/C0A80202

[edit] DHCP

Once the FreeBSD bootloader is running on the Sparc machine, it will make DHCP requests. Unfortunately a dhcpd server is not part of the base FreeBSD installation. Install the port net/isc-dhcp42-server.


subnet 192.168.2.0 netmask 255.255.255.0 {
}

host sparky {
	hardware ethernet 08:00:20:c2:6a:08;
	option host-name "sparky";
	fixed-address 192.168.2.2;
	always-reply-rfc1048 on;
	filename "loader";
	next-server 192.168.2.1;
	option root-path "192.168.2.1:/cdrom";
}
Personal tools