Getting started

There are four basic steps in bootstrapping a Linux/sun3 system, getting a m68k-linux crosscompiler, setting up netbooting and compiling the latest development kernel. compiling userland binaries.


How to get a crosscompiler

gcc-2.95.3 and binutils-2.9.1.0.20 are versions that have been succesfully tested with Linux/sun3. Configuring and compiling binutils:
./configure --target=m68k-linux
make
make install
This will place the cross-binutils in /usr/local/m68k-linux. You will probably need to make a symlink from /usr/local/m68k-linux/include to /usr/include in order for gcc to compile successfully. Configuring and compiling gcc:
./configure --target=m68k-linux
make 
make install

How to netboot

The easiest way to try Linux/sun3 is to netboot it. To do this you need to have rpc.bootparamd, in.tftpd, rarp and nfsd running. All of these come with recent Red Hat distributions (and others most likely as well). You also need to have rarp support in the kernel (CONFIG_INET_RARP). The commands needed for rarp to work are:
/sbin/rarp -s nameofsun3 AA:BB:CC:DD:EE:FF 
/sbin/arp -s nameofsun3 AA:BB:CC:DD:EE:FF 

For rpc.bootparamd you need /etc/bootparams. The format of the file is as follows:

nameofsun3 root=server:/usr/export/root swap=server:/usr/export/root/swap
(the swap= isn't needed with Linux, but it's required by diskless NetBSD and OpenBSD boots)

For tftpd you need to have the following line in your inetd.conf:

tftp    dgram   udp     wait    nobody  /usr/sbin/tcpd  in.tftpd
You need to have a bootloader in your /tftpboot. You can use one from SunOS, NetBSD or OpenBSD. Then symlink a file that has the ip-address of the sun3 in hex (e.g. C39CEB33 == 195.156.235.51) to it.

For nfsd just add something like

/usr/export/root nameofsun3(rw,no_root_squash)
to your /etc/exports. You can now place kernels in this directory, and also boot other operating systems from it.

How to get a bootable kernel

Sun3 support is included with the Linux/m68k CVS tree. ftp.netppl.fi:/pub/linux/sun3 ftp.redhat.com:/pub/mirrors/sun3/netppl

Use the sun3patch (zcat ../sun3patch-2.2.1pre2-99xxxxxx.gz | patch -p1) on the linux/m68k source tree.

Now run make config or menuconfig and configure your kernel (you should probably disable support for anything else but sun3 and 68020 in "Platform dependant setup"), then compile the kernel normally. After the kernel is compiled, you should run it through elftoaout. . Now your kernel should be ready.


How to compile userland binaries

To compile userland binaries you first need a set of linux/m68k libraries. I have made a set available in m68k-libs.tar.gz, which contains the static libraries from glibc-2.0.7/m68k + some ldscripts modified for the current linux/sun3. The easiest way I'vefound to use them is to change the specs file in your cross-gcc to have something like:

*link:
-m m68kelf -static -T/usr/local/m68k-linux/lib/ldscripts/m68kelf.x
%{shared}   %{!shared:     %{!static:       %{rdynamic:-export-dynamic}
%{!dynamic-linker*:-dynamic-linker /lib/ld.so.1}}     %{static}}
(m68kelf.x should be the one in the m68k-libs tarball, which changes the 0x80000000 into 0x4000). After this m68k-linux-gcc foo.c -o foo creates the right kind of binaries.

You might want to join the sun3 mailing-list. To subscribe send a mail with "subscribe" to sun3-list-request@redhat.com


Pekka Pietikäinen, pp@netppl.fi