Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Last revisionBoth sides next revision
netbsd_sun_pci [2013/06/10 21:14] kdevnetbsd_sun_pci [2015/03/11 11:22] – external edit 127.0.0.1
Line 1: Line 1:
 +===== NetBSD on SunPCi-II HOWTO =====
 +//Emmanuel Kasper//
 +//June 4, 2011//
 +
 +{{http://www.subsole.org/static/sunpci/sunpci_iipro.jpg|sunPci II pro}}
 +
 +This Mini-Howto was written in order to help people who want to run NetBSD on their [[http://en.wikipedia.org/wiki/SunPCi|SunPCi-II Coprocessor Card]]. The SunPCi-II card is a pci card containing a kind of embedded PC, which was designed to run an OS of the Windows Family on a Sun UltraSparc machine, along Solaris. Here is the [[http://www.subsole.org/static/sunpci/dmesg.txt|dmesg]] of the SunPCi-II booting.
 +
 +
 +
 +
 +====== 1. Copyright ======
 +
 +(c) 2007 Emmanuel Kasper ( emmanuel at libera dot cc )\\
 +(c) 2001-2003 Richard van den Berg(<[[mailto:richard@vdberg.org|richard@vdberg.org]]>)
 +
 +This howto may be reproduced and distributed in whole or in part, in any medium physical or electronic, as long as this copyright notice is retained on all copies.\\
 +All translations, derivative works, or aggregate works incorporating documents from this HOWTO must be covered under this copyright notice. That is, you may not produce a derivative work from this HOWTO and impose additional restrictions on its distribution. \\
 +
 +If you have anything to add to this Mini-Howto, please mail the author Emmanuel Kasper (emmanuel at libera removethis dot cc ) with the information. Any new relevant information would be appreciated.
 +
 +===== 1.1. Thanks =====
 +
 + This howto is heavily based on the [[http://www.vdberg.org/~richard/Linux-on-SunPCi-mini-Howto/|Linux on Sun PCI-II Howto]] from Richard van den Berg.
 +
 +===== 1.2 Screenshot =====
 +
 +{{http://www.subsole.org/static/sunpci/sunpci_boot.png|screenshot of netbsd booting}}
 +
 +
 +====== 2. Preface ======
 +
 +
 +
 +
 +===== 2.1. General Overview =====
 +
 +The SunPCi card was meant to be used with either DOS (Caldera OpenDOS is shipped with it) or an OS from the Microsoft Windows family. However, since it has an Intel ship on it, NetBSD will run on it. Be aware that certain things will not work!\\
 +
 +  * **Hard drive**: the Sun disks are presented to the PC card through special DOS and windows drivers drivers. Since NetBSD does not have this drivers, it was impossible to make NetBSD use the "C.diskimage" file or the like. The SunPCi card does have its own IDE controller, but there is no connector on the board. Short of wanting to solder one on, NetBSD will have to boot diskless. \\
 +  * **Floppy drive**: access to the floppy drive is emulated by the SunPCi software running on Solaris. NetBSD recognizes the internal Floppy Disk Controller (FDC) on the SunPCi card, but no connector on the board.\\
 +  * **CDROM drive**: access to the cdrom drive is emulated. In fact, Solaris gives access to the cdrom by creating a block-type special file in "/vol/dev/dsk/c0t1d0" and giving Windows access to it. This will not work with NetBSD. Unless you solder in that IDE plug and connect a cdrom drive to it, you will not have access to one. Luckely we don't need it.
 +  * **Graphics**: the SunPCi window you see when starting up the PC card displays the graphics generated by the PC. The screen is comparable with the normal VGA mode of a real monitor. In order to display better quality graphics, drivers are needed. Sun does not include drivers for NetBSD, so VGA is all you're going to get inside the Solaris "sunpci" window.\\  The onboard graphics chip can be used by NetBSD however.
 +
 +Before I scare everyone away from reading further, let me quickly state what does work.
 +
 +  * **Console: **the sunpci proices a kind of vga emulation, drom which you can use DOS or NetBSD. I don't know type of emulation it exactly provides, but as a vt100 console it works very well with NetBSD. //(pc)//
 +
 +  * **Ethernet**: the SunPCi card has an onboard SiS 900 PCI Fast Ethernet (10/100 Mbit/s) adapter. This is fully support by the NetBSD and will be our one and only communication device with (file)systems. //(sip)//
 +
 +  * **COM1**: or tty00 if you wish. You'll have to connect the optional add-on backplate which gives you access to the serial port through a standard 9 pins male DSUB connector. This backplate is a standard one, so you can get one from an off-the-shell PC. //(com)//
 +  * **Parallel port**: just in case you want to attach a printer or so. The optional Sun add-on backplate comes with a with a parallel connector. This port supports standards upto ECP/EPP. //(lpt)//
 +
 +  * **Sound**: the onboad SiS 7018 Audio chip is also supported by the NetBSD kernel, in case you want to use it //(autri)//
 +
 +  * **USB**: the Universal Serial Bus controller is fully functional. Attach things like camera's, harddrive's, keyboards, mice all you like. //(ohci)//
 +  * **Graphics**: By starting the PC card with "sunpci -vga" and connecting an external monitor to the video plug of the card, NetBSD can take advantage of the onboard graphics chip. Using XFree86 you can get graphics on the external monitor.
 +
 +This Howto is based on setting up [[http://www.subsole.org/static/sunpci/www.netbsd.org|NetBSD]] 3.0 on a SunPCi-IIpro card (with Intel Celeron 733MHz processor). It deals with version 2.3.x of the SUNWspci2 Solaris package only. In the rest of this howto I will use the word sunpci to mean the SunPCI-IIpro card as a mean of convenience.\\
 +
 +Sun released afterwards the SunPCi-III (based on a Mobile 1.4-GHz AMD Athlon XP 1600+ processor) with SUNWspci3 software, and GNU/Linux support for Redhat.\\
 +You can download the latest version of the SunPCI-II and III software [[http://www.sun.com/desktop/products/sunpci/downloads.html|here]].
 +
 +
 +
 +====== 3. Creating the SunPCi root directory ======
 +
 +
 +
 +
 +
 +==== 3.1 NFS and DHCP server ====
 +
 +Since we cannot access any local disks, we need to boot over the network. This requires our root ("/") filesystem to be on the network as well. This means we will have to set up a directory on an NFS server that can be mounted by NetBSD. This does not have to be a NetBSD machine. In fact, the Sun machine that hosts the SunPCi card will do fine.\\  Basically we will use the following procedrue : from Caldera DOS installed on the SunPCI we load the kernel from the FAT parition with the "dosboot(8) "command , then get a network configuration through DHCP, and use the information provided by the dhcp server to mount a nfs root file system. Caldera DOS comes for free with the SunPCI drivers. In theory it sould be possible to netboot direcly from the SunPCI, there is an option for doing so in the BIOS, however I had no success with it, maybe it needs a netboot rom not present.\\
 +
 +For the server part, there is a very detailed [[http://www.netbsd.org/Documentation/network/netboot/|NetBSD Diskless howto]] to that covers the setting of the dhcp and nfs server. I used two different machines to act as dhcp server and NFS server. For the DHCP I used server a Suse Linux box, with the following entry in dhcp.conf ( ISC dhcp )
 +
 +
 +<code>
 +host sunpci { hardware ethernet 00:03:BA:0B:5E:D1; fixed-address192.9.200.230;\
 +next-server bluetooth; option root-path "/export/sunpci/racine"; }
 +</code>
 +
 +Note the use of the next-server option, which indicates the dhcp client where to find the NFS server. For the NFS server, I used the Sun Sparc Box with the following configuration in /etc/dfs/dfstab:
 +
 +<code>
 +share -F nfs -o rw=@192.9.200.230/32,root=@192.9.200.230/32/export/home/manu/linux  
 +share -F nfs -o rw=@192.9.200.230/32,root=@192.9.200.230/32 /export/sunpci/racine
 +share -F nfs -o rw=@192.9.200.230/32,root=@192.9.200.230/32 /export/sunpci/home
 +</code>
 +
 +Contrary to what the NetBSD Diskless howto says, it is possible to use numerical IP adresses in /etc/dfs/dfstab, as of Solaris 9, even if the syntax is a bit obscure.
 +
 +==== 3.2 Kernel settings for the SunPCi-II  ====
 +
 + NetBSD proposes a default DISKLESS kernel configuration file, however it does not include the network driver of the sunpci card. So you need to add the line
 +<code>
 +sip* at pci? dev ? function ? # SiS 900/DP83815 Ethernet
 +</code>
 +
 +in the DISKLESS configuration file. You should also add
 +
 +<code>
 +pseudo-device rnd # /dev/random and in-kernel generator
 +</code>
 +
 +to make ssh and sshd work. To get usb and sound working you need to add
 +
 +<code>
 +audio* at audiobus?  
 +midi* at midibus? 
 +autri* at pci? dev ? function ? # Trident 4DWAVE based AC'97 Audio
 +</code>
 +
 +<code>
 +ohci* at pci? dev ? function ? # Open Host Controller
 +usb* at ehci?
 +usb* at ohci?
 +usb* at uhci?
 +uhub* at usb?
 +</code>
 +
 +plus all the usb devices that you want. Remember that if you want to use usb storages devices you also have to add some hard disk device support.
 +
 +
 +====== 4. Booting the SunPCi card with an NFS-Root ======
 +
 +===== 4.1. Using "dosboot" or "netboot" to load the kernel  =====
 +
 +[[http://netbsd.gw.com/cgi-bin/man-cgi?dosboot++NetBSD-current|Dosboot(8)]] is a small utility which allows to boot a netbsd kernel from a msdos file system. Simply copy from Solaris your netbsd DISKLESS kernel and dosboot.com to some place accessible by OpenDOS, for instance from Solaris /opt/SUNWspci2/bsd will correspond to F:\BSD\ for opendos.\\  Netboot should be able to boot a kernel over the network from DOS. I didn't experiment with it, since the dosboot solution works great.\\  How to build dosboot and netboot are described in http://www.netbsd.org/Documentation/network/netboot/intro.i386.html\\
 +
 +
 +
 +===== 4.2. First boot  =====
 +
 + Dosboot does not work when the dos memory manager is enabled. To disable it, you have to delete the line "device=c:\dos\himem.sys" in the file "C:\config.sys"\\  Booting the kernel is then only a matter of typing
 +<code>
 +F:\BSD\dosboot netbsd
 +</code>
 +provided you have dosboot and a kernel called netbsd in the same location.
 +
 +As the boot procedure goes, you should see the kernel trying to ask the dhcp server whereis your nfs server.
 +
 +<code>
 +boot device: <unknown>
 +root on sip0
 +nfs_boot: trying DHCP/BOOTP
 +nfs_boot: DHCP next-server: 192.9.200.138
 +nfs_boot: my_domain=cocoontecs.priv
 +nfs_boot: my_addr=192.9.200.230
 +nfs_boot: my_mask=255.255.255.0 
 +nfs_boot: gateway=192.9.200.1
 +root on 192.9.200.138:/export/sunpci/racine
 +</code>
 +
 +If you get to there, bingo ! If not, check the look of your DHCP and NFS server ( use dmesg to get nfs logs in Solaris ) \\
 +
 +
 +===== 4.3. Automating the boot process =====
 +
 +Eventually you will want to boot NetBSD in a bit more automated way than running a batch file from DOS . A very fast way is to put the line "F:\BSD\dosboot F:\BSD\netbsd"  on the last line of the "autoexec.bat" of an OpenDOS diskimage.
 +
 +<code>
 +# /opt/SUNWspci2/bin/makedisk -o netbsd.diskimage \ 
 +-i /opt/SUNWspci2/defaults/C.7.01.template \
 +-s 512 -l -r 2 -b -d /opt/SUNWspci2/defaults/7.01/ -c
 +</code>
 +
 +
 +This will create a 512MB netbsd.diskimage //sparse// file. This means that the file will only use as much real diskspace as actual data is inside it. \\  There is still a 512MB minimun size restriction, but the size of the diskimage will only be the actual size used by the files in it. If you add the "-f" flag to the "makedisk" command, the diskimage is filled up (and an X status bar is shown).You will then be able to boot NetBSD by typing:
 +
 +<code>sunpci -C netbsd.diskimage</code>
 +
 +Another option is to use the menu options of Windows 95/98 (and Millennium if you have resurrected the DOS mode for it). Since NetBSD does not see the diskimage, it is not possible to install NetBSD's boot loader.\\
 +
 +
 +===== 4.4. Booting SunPCi from remote =====
 +
 +The SunPCi card can only be booted by the X application named "sunpcbinary". Now that you have a NetBSD system running somewhat independent of the Sun host, it seems silly to have it only available within a Sun X session To be able to use an X app from a non-X terminal you need an //X virtual frame buffer//. The standard X11 release from X.org comes with "Xvfb" to accomplish this. Unfortunately, Sun did not include it with Solaris.
 +
 +
 +
 +==== 4.4.1. SunVNC connection ====
 +
 +The SunPCi drivers 2.3 and above come bundled with a modified version of [[http://www.realvnc.com/|VNC]]. VNC is a client-server based virtual X server. "Xvnc" is the daemon to run on the server, and "vncviewer" is the client, which can run either on the server itself or on a remote machine. Sun has [[http://www.trust-factory.com/TF20020601.html|weakened]] the authentication mechanism of the standard VNC, and you must use the "vncviewer" supplied by Sun. However it is quite possible to use the vncserver only locallly as a virtual framebuffer, without connecting to the server over the network.
 +
 +The Solaris package you need to install to make use of VNC for the SunPCi card is called "SUNWspvnc". The easiest way to start "Xvnc" is by using the "sunpcid" daemon that comes with the SunPCi drivers. The configuration file for this daemon is "/etc/Master.ini" At the bottom of this file, there should be a section to configure vnc. If not, you can add default settings like this:
 +
 +<code>
 +[vnc]
 +CmdLineArgs=-geometry "1152x900" -depth 24
 +DisplayNum=10
 +StartupScript=/opt/SUNWspci2/bin/VNCStartup
 +UID=root ;User ID
 +GID=root ;Group ID
 +HomeDir=/root ;Home directory
 +AutoStart=Enabled
 +</code>
 +
 + Now whenever "sunpcid" is started (either by hand or by using "/etc/init.d/sunpci.server", "Xvnc" will be started as well. \\  To use the Xvnc server locally then you just have to to do from the shell : \\ \\
 +
 +<code>
 +$ export DISPLAY=localhost:10
 +$ sunpci -C /path/to_your_netbsd.image
 +</code>
 +
 +You lose the access to the sunpci console, but if your netbsd system is properly setup, you don't need this console anymore, and you do not need to send a password over the network with a weakened VNC client.
 +
 +A quick try with a standard VNC gives no hope. Starting the sunpci from a VNC session miserably fails with the message:
 +<code>
 +"Opening a SunPCi window...
 +SunPC Assert: pData->num_lock_mask != 0 in file Keyboard.c at line 916.
 +*** SunPC Exit ***
 +2347 Abort - core dumped
 +</code>
 +
 +Note that the sunpci source code[[http://www.opensolaris.org/jive/thread.jspa?messageID=15724&#15724| is not included]] in opensolaris, and probably [[http://www.opensolaris.org/os/downloads/|won't be]]. 
 +
 +
 +==== 4.4.2. X over ssh ====
 +
 +Tunneling a X connection into SSH is both relatively secure and easy to use. See this excellent [[http://gentoo-wiki.com/HOWTO_X-forwarding|Gentoo GNU/Linux wiki]] article for the general info. To connect to the Sun box i use the command :
 +<code>
 +ssh -X -C -c blowfish
 +</code>
 +( -X to enable X forwarding, -C to enable gzip compression, -c blowfish to use the faster blowfish algorithm for encryption )
 +
 +However on your first connection to the sun box , launching the sunpci might failed with the error:
 +<code>
 +bombadil2:manu> sunpci -C /opt/pc/netbsd.diskimage
 +Opening a SunPCi window...
 +Warning: Missing charsets in String to FontSet conversion
 +Warning: Cannot convert string "-dt-interface user-medium-r-normal-m*-*-*-*-*-*-*-*-*" to type FontSet
 +bombadil2:manu> Warning: Missing charsets in String to FontSet conversion
 +Warning: Cannot convert string "-dt-interface system-medium-r-normal-m*-*-*-*-*-*-*-*-*" to type FontSet
 +</code>
 +
 +This message indicates that your local X server does not include the sun specific fonts required to run the sunpci program. To use this fonts from your local X server, you have to uncomment "fs stream tcp wait nobody /usr/openwin/lib/fs.auto fs"in /etc/inetd.conf. After restarting the inetd daemon, you can add the fonts from the solaris font server\\
 +
 +<code> # pkill -s 1 inetd </code>
 +<code> $ xset fp+ tcp/bluetooth:7100 </code>
 +
 +This works correctly with a debian sarge XFree86 X server, and with a suse X.org. On a NetBSD 3.0 X server, the xset commands fails with the following message :\\ 
 +<code>
 +xset: bad font path element (#96), possible causes are:
 +Directory does not exist or has wrong permissions
 +Directory missing fonts.dir
 +Incorrect font server address or syntax
 +</code>
 +
 +X guru advice welcome ! \\
 +
 +After shutting down your NetBSD system (using "halt" ) you will have to manually shut down "sunpcbinary"
 +
 +<code>$ pkill -1 -f sunpcbinary</code>
 +
 +
 +
 +====== 5. Where to go now ? ======
 +
 +===== 5.1. Make XFree86 work =====
 +
 +A quick Xfree86 -configure left me with the following message :
 +<code>
 +Fatal server error
 +xf86OpenConsole: No console driver found
 +Supported drivers: pccons (with X support), pcvt, wscons
 +Check your kernel's console driver configuration and /dev entries
 +</code>
 +I guess it would not be too much to add the missing lines to the DISKLESS kernel.
 +
 +
 +
 +
 +===== 5.2. Port Sunpci drivers on others OS / architecture  =====
 +
 + Brave linux hacker Chris Lalancette already started to investigate this in a quite interesting [[http://www.ussg.iu.edu/hypermail/linux/kernel/0403.0/0202.html|mail]] he sent to the linux kernel mailing list. Didn't hear any success. Documentation for the transparent PCI bridge used by the solaris guest to talk with the board is [[http://alpha1.dyns.net/files/Bridges/27809101.pdf|available]], if anyone feels to pick up the (hum) heavy task. Thanks to Alexander Voropay we have also some extra documentations for the chips used in the SunPCI board:\\
 +[[http://www.subsole.org/static/sunpci/ITE8705.pdf|IT8705F/IT8705AF]] \\
 +[[http://www.subsole.org/static/sunpci/SiS630.pdf|Sis630 Chipset]] \\ 
 +[[http://www.subsole.org/static/sunpci/SiS960.pdf|Sis960 South Bridge]] (the SiS960 is part of the SiS630 "single-chip" chipset ) \\
 +
 +\\  That's it! Have fun with your netbsd-on-a-board and remember :
 +
 +// Three dirs for the X11-build under usr/src, \\  Seven for the GPL in their halls of gnu, \\  Ninety-Nine for the usr-src, doomed to (s)bin. \\  One for the superuser in his root dir \\  in the land of usr where the sources lie. \\  One script to rule them all, one to compile them, \\  One script to bring them all and in slash obj bind them. \\  in the land of usr where the sources lie.//
 +
 +Hubert Feyrer & Ignatios Souvatzis
 +----