Booting sparc64 systems ======================= This text describes how to install and boot the sparc64 port. Only net-booting of the kernel is covered right now. Warning: -------- The kernel and userland binaries mentioned below are highly experimental (for example, the kernel contains some ATA changes and eeprom handling code). Unless you know what you are doing and are willing to cope with any damage that might arise, you should probably not be trying this! So, use at your own risk, etc, pp. Booting a kernel ---------------- A sparc64 kernel is booted by having the firmware retrieve and execute a loader program, which in turn fetches and executes the actual kernel. For this boot process you need to set up rarpd and tftp (for the firmware) and bootp (for the loader). The loader can fetch a kernel using tftp or NFS. All this is covered in detail below. rarpd ----- You need to add an for the ethernet address of your sparc box to /etc/ethers if you do not already have done so. An entry looks like: 0:3:ba:b:92:d4 your.host.name Make sure your.host.name is in /etc/hosts or dns (or use an IP). Then, just start rarpd on a network interface that is on the same segment like the sparc machine, like: rarpd xl0 Getting a loader ---------------- You can download the loader at http://people.freebsd.org/~tmm/loader.gz (for loading the kernel over tftp) or http://people.freebsd.org/~tmm/loader-nfs.gz (for loading the kernel via nfs). tftpd ----- Activate tftp in your inetd, using a line like: tftp dgram udp wait nobody /usr/libexec/tftpd tftpd /tftpboot (this is the default, so just uncomment it). Copy the unpacked loader to /tftpboot, and name it like the host IP in upper-case hexadecimal notation (or use symlinks). My setup looks like: lrwx------ 1 tmm users 9 Jul 24 17:05 /tftpboot/C0A80033 -> boot/loader -rw-r--r-- 1 tmm users 1643021 Oct 20 18:04 /tftpboot/boot/loader Setting up bootpd ----------------- Create entries for you sparc box in /etc/bootptab, like in the following exapmle: .default:\ :bf="kernel":dn=local:ds=:\ :gw=:ht=ether:hd="/tftpboot/boot/kernel":hn:\ :rp=":":\ :sm= luthien:\ ha=:ip=:tc=.default The ethernet address must be the same like the one in the tftp example above, but it is specified differently: also in hex, but without colons (mine looks like '0003ba0b92d4' in that notation). If you aren't using NFS for booting, just use a bogus value (like just '/') for the NFS root directory (this will be fixed later, when 'ts' will become the property to use). The strings given in the 'bf' and 'hd' properties are assembled to the boot file name (if you are booting using tftp). If your kernel is named differently or you use another directory, change these values as required. If you are booting using nfs, remove the 'bf' and 'hd' settings (or change them to specify the directory and file inside the NFS root hierarchy in which the kernel will reside). Note that bootpd conflicts with dhcpd. dhcpd can also be set up accordingly. Loading the kernel over tftp ---------------------------- Place the kernel in the directory specified using 'bf' and 'hd' in the bootp setup as above. That should be all that's needed. Loading the kernel over NFS --------------------------- Export the root directory that was specified in bootp over NFS, and place the kernel as 'boot/kernel/kernel' inside it (or, if you use 'bf' and 'hd', the file name you have specified this way). Booting ------- If all goes well, you can now boot the kernel from the sparc by dropping into OpenFirmware (if your box boots another OS automatically, press L1-A or Stop-A to get there, or send a break over the serial console). Now, just do boot net and The Right Thing should happen. Specifically, the loader is retrieved via tftp, it does then do a bootp request and will proceed to load the kernel. Then, it should wait 10 seconds and proceed to execute the kernel. If something does not work in between, and you suspect tftp/nfs/bootp problems, ethereal is usually a good help. The most common problems are bad file permissions. Also note that rarpd will not answer to packets under some circumstances, refer to the man page for details. Userland -------- A tarball with many static userland binaries is at http://people.FreeBSD.org/~jake/bin.tar.gz This does not contain init, which you can get at http://people.FreeBSD.org/~tmm/init.gz You also need a half-way filled etc and /usr/share; it's probably best to take them from a working box. Boot in single user first, and use pwd_mkdb and 'cap_mkdb /usr/share/misc/termcap' to make sure the db files are correct. Don't forget to adapt rc.conf; I use this minimal one for my Blade 100: --- hostname="" defaultrouter="" ifconfig_gem0="inet netmask " network_interfaces="gem0" --- You also need to adapt /etc/ttys: remove all the ttyv* entries, and add enable the one for the serial console you use, e.g. on a Blade 100 using sio: ttyd0 "/usr/libexec/getty std.9600" vt100 on secure (vt100 is there because I'm lazy ;), or if you need to use the ofw console (on Ultra machines right now): ofw_console "/usr/libexec/getty std.9600" vt100 on secure That should get the machine to multi user mode if I haven't forgotten anything. There are some binaries missing in the tarball (awk for example), so some things might be broken. Root file systems ----------------- You can use an empty partition (or one where the files in the archive do not collide with existing ones). The kernel mentioned above contains support for Sun disklabels, so you can use a Solaris partititon, which may even be newfs'ed from Solaris (I do that on my box), or a NetBSD one, of course. DO NOT fsck file systems modified by FreeBSD on Solaris, it damages the file permissions! Specify this partition on the mountroot prompt (use a format like ufs:, i.e. leave the slice specification out). If you are using a kernel with NFS_ROOT support, the above bootp entries should suffice to have the kernel find and mount the root file system via NFS. Building bits of the sparc64 world ================================== Getting the source ------------------ Right now, not all code has been committed to CVS, so it's best to get a checkout of the sparc64 p4 branch. A client specification looks like: //depot/projects/sparc64/... //your_client/your/directories/... Right now, syncing will give you sys/, and parts of lib/ and libexec/. Cross toolchain --------------- You can grab a cross toolchain at http://people.FreeBSD.org/~tmm/s64-toolchain.tar.gz It needs to be unpacked into /usr/local, or you need to set symlinks accordingly. This is a just a dropin version right now, and by no means comes close to a optimal toolchain for FreeBSD. Expect quirks. Building a kernel ----------------- I usually use a make wrapper script to build kernels. If you do, you need to comment out the following lines from the kernel Makefile generated by config (or even better sys/conf/Makefile.sparc64): AR= sparc64-ar CC= sparc64-unknown-elf-gcc -D__sparc64__ LD= sparc64-ld NM= sparc64-nm OBJCOPY= sparc64-objcopy OBJDUMP= sparc64-objdump RANLIB= sparc64-ranlib SIZE= sparc64-size Then, use a script like this one (the names should be correct if you use the toolchain from above): --- #!/bin/sh # Target for the cross environment TP=sparc64-elf # Special CFLAGS CC="$TP-gcc -D__sparc64__ -D__FreeBSD__=5 -U__svr4__" COPTFLAGS="-O -pipe" # Architecture settings MACHINE_ARCH=sparc64 make -DNO_CPU_COPTFLAGS AR=$TP-ar AS=$TP-as CC="$CC" LD=$TP-ld NM=$TP-nm \ OBJCOPY=$TP-objcopy OBJDUMP=$TP-objdump RANLIB=$TP-ranlib SIZE=$TP-size \ STRIP=$TP-strip MACHINE_ARCH=$MACHINE_ARCH COPTFLAGS="$COPTFLAGS" \ $* --- Use this for the build just like you would use 'make' normally. Building userland binaries and libraries ---------------------------------------- Use a slightly different make wrapper script for this: --- #!/bin/sh DESTDIR= # Target for the cross environment TP=sparc64-elf # Special CFLAGS CC="$TP-gcc -D__sparc64__ -D__FreeBSD__=5 -U__svr4__" COPTFLAGS="-O -pipe" # Architecture settings MACHINE_ARCH=sparc64 make -DNO_CPU_COPTFLAGS -DRELEASE_CRUNCH AR=$TP-ar AS=$TP-as CC="$CC" LD=$TP-ld \ NM=$TP-nm \ OBJCOPY=$TP-objcopy OBJDUMP=$TP-objdump RANLIB=$TP-ranlib SIZE=$TP-size \ STRIP="" MACHINE_ARCH=$MACHINE_ARCH COPTFLAGS="$COPTFLAGS" \ DESTDIR=$DESTDIR $* --- You should be able to build most of userland. Dynamic linking does not work yet, you'll need -DNOSHARED if it isn't in the respective Makefile.