Linux on the Mocha P4

by Ry4an Brase (ry4an<at>ry4an.org)

Update: My box had the bad capacitors found in a great many systems manufacturered in 2001. The good folks at badcaps.net were able to fix it right up. Great work at a reasonable price. If you have the same issue with your Mocha (or any other hardware) I highly recommend them.

Update: Karsen M. Self has gone further than I in getting the P4 Mocha working under Linux. His notes can be found on his site.

The Long-Winded Story

Here's a narrative covering my eventual installation of Linux on the Mocha P4. If you just want raw configuration steps they're in the next section.

I checked around bit to make sure I'd be able to get Linux booting on the Mocha before I bought it, and all the component made it look like I could, but nowhere did I see anyone say conclusively that they had done it. So I'm typing up the notes from my sucessfull installation just in case anyone else is wondering.

I bought the Mocha P4 from CappuccinoPC.com, and it arrived without hassle. I went w/ the 2GHz model with 512 MB RAM and a DVD drive. I decided to install RedHat 9 because, political posturing aside, all distros are pretty much the same, and because I don't trust x.0 releases after what RedHat 4.0 and 5.0 did to my machines.

I booted from the CD and everything was going great. I selected my install options and accepted defaults for the X server config because I knew I was going to have to redo that later anyway. Everything seemed to go fine until the final reboot. The system sorta came up, worked a little, and then died. I tried a few more times and always made it through the install but booted to a mostly corrupt system.

On each of the install attepts I tried different LBA setting and BIOS drive options, all to no avail. I looked into the IDE controller and saw it was a SiS5513 which google searches and lkml reading indicated was supported with varying levels of confidence. Eventually I discovered that the timing problems I was seeing in logs from the IDE driver were the sort one could expect to see if one was running in a DMA mode that one's harddrive couldn't support.

This confused me as the drives in the Mocha are certainly capable of running in ATA100 mode and the kernel's auto-detect stuff agreed on that fact. The problem turned out to be that the cable used in the Mocha is only a 40 pin cable, not the 80 pin (40 ground pins!) cabled required by the high end DMA settings. For some reason the SiS5513 driver was failing to detect insufficient cabling as it should. Now the solution was a simple matter of booting the machine with DMA disabled.

Armed with this knowledge I typed 'ide=nodma' at the lilo prompt (I still don't trust grub). The machine booted and the timing error messages were gone, but it still crashed after a few seconds. It took way too long for me to figure out that I needed to disable DMA during installation too -- I was laying corrupt data down throughout the full install. I booted from the installation CD, passed 'ide=nodma' as a parameter to the install image and re-installed for the final time. After reboot it was running great, and I added the line: append="ide=nodma" to my lilo.conf to spare me from having to remember typing it on every boot to avoid disk corruption.

With DMA the IO was running more slowly that I wanted and I started tweaking hdparm with tips from this article. I eventually worked out that hdparm -c3 -m16 -X34 -d1 -u1 /dev/hda was a fast as I dared go, and the transfer rates were plenty fast for me compared to the AMD K6-233 I was retiring.

To get X working at a better resolution I went to Thomas Winischhofer's SIS VGA page and downloaded the binary sis_drv.o driver. Overwriting the RedHat installed ones and re-starting X had things working great. My XF86Config is included below, but it should be largely the default with Thomas's recommended additions.

There are still a few things that annoy me about the setup which I've not yet worked out.

  1. ctrl-alt-backspace powers the machine off immediately neither apm=no as a kernal parameter nor any bios setting has sucessfully disabled this. Just think of it as a way to really kill the X server.
  2. The RedHat sound auto-detect code seems to drive the sound system at wrong frequency some time. Fortunately I don't use sound so I don't care if everyone sounds like a chipmonk.

Just the Config Steps

This stuff is all contained above, this section is just a distillation of only the important material.

  1. When booting from installation CDs pass the ide=nodma parameter on the lilo prompt to prevent disk corruption during installation.
  2. When booting the installed system for the first time you must pass the kernel parameter ide=nodma using grub or lilo to avoid disk corruption.
  3. On your first run edit your lilo or grub config to pass that parameter automatically on boot.
  4. Use hdparm(8) with this command line hdparm -c3 -m16 -X34 -d1 -u1 /dev/hda to speed up disk access.
  5. Get the binary X driver, sis_drv.o, from Thomas Winischhofer, and install per his instructions.
  6. Edit /etc/X11/XF86Config-4 to mirror the one below.

XF86Config-4

Section "ServerLayout"
        Identifier     "Anaconda Configured"
        Screen      0  "Screen0" 0 0
        InputDevice    "Mouse0" "CorePointer"
        InputDevice    "Keyboard0" "CoreKeyboard"
EndSection

Section "Files"

# The location of the RGB database.  Note, this is the name of the
# file minus the extension (like ".txt" or ".db").  There is normally
# no need to change the default.

    RgbPath	"/usr/X11R6/lib/X11/rgb"

# Multiple FontPath entries are allowed (they are concatenated together)
# By default, Red Hat 6.0 and later now use a font server independent of
# the X server to render fonts.

    FontPath   "unix/:7100"

EndSection

Section "Module"
        Load  "GLcore"
        Load  "dbe"
        Load  "extmod"
	Load "fbdevhw"
        Load  "glx"
        Load  "record"
        Load  "freetype"
        Load  "type1"
EndSection

Section "InputDevice"
        Identifier  "Keyboard0"
        Driver      "keyboard"

#	Option	"AutoRepeat"	"500 5"

# when using XQUEUE, comment out the above line, and uncomment the
# following line
#	Option	"Protocol"	"Xqueue"

# Specify which keyboard LEDs can be user-controlled (eg, with xset(1))
#	Option	"Xleds"		"1 2 3"

# To disable the XKEYBOARD extension, uncomment XkbDisable.
#	Option	"XkbDisable"

# To customise the XKB settings to suit your keyboard, modify the
# lines below (which are the defaults).  For example, for a non-U.S.
# keyboard, you will probably want to use:
#	Option	"XkbModel"	"pc102"
# If you have a US Microsoft Natural keyboard, you can use:
#	Option	"XkbModel"	"microsoft"
#
# Then to change the language, change the Layout setting.
# For example, a german layout can be obtained with:
#	Option	"XkbLayout"	"de"
# or:
#	Option	"XkbLayout"	"de"
#	Option	"XkbVariant"	"nodeadkeys"
#
# If you'd like to switch the positions of your capslock and
# control keys, use:
#	Option	"XkbOptions"	"ctrl:nocaps"
	Option	"XkbRules"	"xfree86"
	Option	"XkbModel"	"pc105"
	Option	"XkbLayout"	"us"
	#Option	"XkbVariant"	""
	#Option	"XkbOptions"	""
EndSection

Section "InputDevice"
	Identifier	"Mouse0"
	# Modified by mouseconfig
	Driver		"mouse"
	Option		"Device"		"/dev/mouse"
	Option		"Protocol"		"IMPS/2"
	Option		"Emulate3Buttons"	"no"
	Option		"ZAxisMapping"		"4 5"
EndSection

Section "Monitor"
        Identifier   "Monitor0"
        VendorName   "Monitor Vendor"
        ModelName    "Monitor Model"
        HorizSync   30-90
        VertRefresh 50-75
        Option "dpms"

        # -- 1400x1050 --
        # 1400x1050 @ 60Hz, 65.8 kHz hsync
        #Modeline "1400x1050"  129   1400 1464 1656 1960 1050 1051 1054 1100 +HSync +VSync

        # 1400x1050 @ 70Hz, 76.8 kHz hsync
        #Modeline "1400x1050"  151   1400 1464 1656 1960 1050 1051 1054 1100 +HSync +VSync

        # 1400x1050 @ 75Hz, 82.3 kHz hsync
        # Modeline "1400x1050"  162   1400 1464 1656 1960 1050 1051 1054 1100 +HSync +VSync

        # 1400x1050 @ 85Hz, 93.2 kHz hsync
        # Modeline "1400x1050"  184   1400 1464 1656 1960 1050 1051 1054 1100 +HSync +VSync

EndSection

Section "Device"
	Identifier   "SiS 650"
        Driver       "sis"
        VendorName   "SiS"
        BoardName    "650"
	Option	     "HWcursor"
	Option      "MaxXFBMem" "12288"
        
        #BusID
EndSection

Section "Screen"
	Identifier   "Screen0"
        Device       "SiS 650"
        Monitor      "Monitor0"
	DefaultDepth	24

	Subsection "Display"
        	Depth       16
                Modes       "1024x768" "800x600" "640x480" 
	EndSubsection
	Subsection "Display"
        	Depth       24
                Modes       "1024x768" "800x600" "640x480" 
	EndSubsection
	Subsection "Display"
        	Depth       8
                Modes       "1024x768" "800x600" "640x480" 
	EndSubsection

EndSection

Section "DRI"
	Mode 0666
EndSection
  

(c)2003 Ry4an Brase - Last Edited: Wed Oct 8 12:33:45 CDT 2003