pavement

User:Hxp/Sparc Netboot

From FreeBSDwiki
(Difference between revisions)
Jump to: navigation, search
(Created page with " ** 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 settin...")
 
Line 4: Line 4:
 
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.  
 
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.  
  
== The Boot Process ==  
+
=== The Boot Process ===  
  
1. Openboot will send out RARP requests for an IP address.
+
# 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.
+
# 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.   
+
# 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
+
# 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.
+
# 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.
+
# 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:
 
So, that's pretty complicated.  What's necessary on the server side is the following:
  
* rarpd to give the firmware its initial IP address.
+
# rarpd to give the firmware its initial IP address.
* tftpd to transfer the bootloader.
+
# tftpd to transfer the bootloader.
* dhcpd to give the bootloader the location of the kernel and root file system.
+
# dhcpd to give the bootloader the location of the kernel and root file system.
* NFS to serve up the FS and kernel.  
+
# NFS to serve up the FS and kernel.  
  
I used FreeBSD 9.0 for amd64 in a VM, 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.
+
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 and will enable crossover automatically.  
+
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 /etc/hosts ===
+
=== Setup
  
 +
==== Edit /etc/hosts ====
  
The first thing you should do is assign an IP for your sparc box in /etc/hosts  
+
The first thing you should do is assign an IP on your network for your sparc box in /etc/hosts:
 +
 
 +
<pre>
 +
::1                    localhost localhost.my.domain
 +
127.0.0.1              localhost localhost.my.domain
 +
192.168.2.2            sparky
 +
</pre>
 +
 
 +
==== Have a copy of FreeBSD for sparc64 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.
  
 
=== Setting up rarpd ===  
 
=== 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.
 +
 +
<pre>
 +
ff:ee:00:57:9d:8a    sparky
 +
</pre>
 +
 +
Add <pre>rarpd_enable="YES"</pre> to /etc/rc.conf and start it with <pre>/etc/rc.d/rarpd start</pre>
 +
 +
=== Setting up TFTP ===
 +
 +
On FreeBSD tftpd is part of inetd.  Edit /etc/inet.d so that the tftp line is uncommented. <pre>tftp  dgram  udp    wait    root    /usr/libexec/tftpd      tftpd -l -s /tftpboot</pre>
 +
 +
Make sure <pre>inetd_enable="YES"</pre> 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.
 +
<pre>
 +
# mkdir /tftpboot
 +
# cp /cdrom/boot/loader /tftpboot
 +
</pre>
 +
 +
The Sun box will request a file equivalent to the assigned IP address from rarpd *in hexadecimal*.  Use sipcalc (available in ports) or a similar tool:
 +
 +
<pre>
 +
# 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
 +
 +
-
 +
</pre>
 +
 +
The hexadecimal IP for the Sun machine in this example is **C0A80202**.  Link the firmware to that filename.
  
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>.
+
<pre>
 +
# ln -s /tftpboot/loader /tftpboot/C0A80202
 +
</pre>

Revision as of 21:52, 16 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

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.

=== Setup

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

Have a copy of FreeBSD for sparc64 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.

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

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*. 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
Personal tools