Linux on a SONY VAIO PGC-707c

written by Ed Falk

General comments about the laptop

The Vaio 707c is a P166 laptop with 32M of memory and an XGA TFT screen. It is very lightweight (~5 lbs without floppy or cdrom installed). Floppy & cdrom are interchangeable. This is a nuisance (I would rather have them both installed simultaneously) but this is the price you pay for light weight.

The 707c comes with the usual I/O ports on a laptop including one USB port and a built-in 33k modem. Pointing device is a touch pad.

External mouse plugs right in and works; no configuration needs to be done. Mouse and touchpad work simultaneously. External keyboard is probably the same, but I haven't tried it.

The laptop is good-looking, lightweight and quite powerful, even though not state-of-the art. I purchased it for ~$1100 refurbished.

Battery life is good enough that I leave the power brick home most times I take the machine out of the house. This saves even more weight.

My only complaints:


OS

I installed Redhat 5.2 on my system.

My first attempt to install Linux was with Redhat 4.2. Unfortunately, this version of linux does not understand the new Windows 95 (type 0B) partitions. I could probably have down-loaded new sources from kernel.org, but I elected to move up to Redhat 5.2 instead.


Initial disk layout

I wish to have a dual-boot system, keeping the pre-installed Windows 95 and adding Linux to another partition.

The first thing I did was to boot from the Linux install disk and examine the existing disk layout:

	type	id	start			size (512-byte blocks)
	fat32	0b	63 (0,1,1)		3,951,359
	save	a0	3,951,359 (490,0,1)	  274,176
	free		4,225,536		    8,064

I have no idea why there was 4M of free space at the end of the disk or why the suspend partition was so large. I may try moving and resizing these someday to recover disk space, but for now I've left it alone.

NOTE: Whenever you play with a suspend partition, it's a good idea to copy at least the first few sectors of it to a backup location. On at least one other laptop (Sharp 9030), I have seen that the suspend-to-disk functionality does not work unless the system finds some sort of standard header in the suspend partition.

You can copy the suspend partition header with a command such as

dd if=/dev/hda4 of=/dev/fd

Installation Instructions

Turn off power management

Hold down F2 while booting to get to the BIOS setup screen. Examine settings, learn what they mean. Turn off power management. Note the sound chip I/O address, DMA and interrupt.

Boot Windows and disable power management there for good measure.

Repartition Disk

In my case, I used Partition magic to reduce the Win95 partition to less than one Gig. I left the suspend partition alone.

Create Floppy Disks

This step is optional; the 707c will boot directly from CD, but I like to have the floppies around for emergencies.

Boot Win95, insert Redhat CD into drive, create boot and supplemental floppy disks. Utilities for doing this are in the \DosUtils directory of the Redhat CD

Boot from Redhat boot floppy

Boot from CD will also work.

At the LILO boot prompt, just hit return. This takes you to the standard installation.

Proceed with install procedure

The Redhat 5.2 install procedure is easy to follow and walks you through the procedure.

At the beginning of the process, you will be asked if you need pcmcia or scsi drivers. The answers to both questions are no. (You may want to add them later, but you don't need them to install.)

Next, choose "Local CDROM".

Create Disk Partitions

When asked what drive to use during the install process, select "edit" to run fdisk.

Fdisk shows this table:

	dev	begin	start	end	blocks		id
	hda1 *	  1	  1	255	1028128+	b
	hda4	491	491	524	 137088		a0
Create swap & extended partitions:

Linux needs (at the very least) a swap partition and a file system partition. If you elect to go with a single file system partition, this is very straightforward. If you want to have multiple filesystem partitions, you will have to create an "extended" partition which may then be further subdivided. I prefer to give the swap partition a main partition rather than one from the extended partition. I don't know if linux requires this or not.

In my own case, I create separate root and /usr partitions.

I like to have more than one root partition so that I can use one for emergency backup and another for experimenting. This isn't for most people, so your own partition table is likely to be much simpler.

Here's what I used:

	dev	begin	start	end	blocks		id
	hda1 *	  1	  1	255	1028128+	b (win95)
	hda2	256	256	268	  52416		82 (swap)
	hda3	269	269	490	 895104		5 (extended)
	hda4	491	491	524	 137088		a0 (suspend)
	hda5	269	269	294	 104800+	83 (linux) /
	hda6	295	295	307	  52384+	83 (linux) /linux2
	hda7	308	308	314	  28192+	83 (linux) /linux3
	hda8	315	315	490	 709600+	83 (linux) /usr

Continue with setup; everything works beautifully.

Configure XFree86

The install procedure will probe the hardware to determine the on-board video capabilities. It then writes the config file for you.

Log in; run startx. Works perfectly


Post-Install tuning

Note: the things discussed here are common to all Linux installs, but I thought the information would be helpful.

This information is specific to Redhat 5.2, but should be pretty close to correct for other variants.

Name your laptop

Every computer should have a name. You can pretty much choose any name you like, within constraints set by your network administrator. Names are lower-case. Dashes are ok. Dots are not.

Edit /etc/sysconfig/network and set:

	HOSTNAME=myhostname

Redhat's netcfg has an interface for setting the hostname, but I just edit the file.

If your machine is going to be connected to any networks, you also need a name for each interface. This is discussed below under networking.

Create cdrom symlink to enable multimedia software

(4.2 only; 5.2 already figured it out.)
/dev/cdrom -> /dev/hdc

Create modem symlink

/dev/modem -> /dev/cua1
Note: if you should later plug in a PCMCIA modem, the pcmcia services would change this symlink to the new modem. When you remove the card, pcmcia services will restore the symlink. Very clever.

Update /etc/fstab

Here are the items I added to my fstab. What you add to yours will depend on your disk layout. /dev/hda1 /dos vfat user,noauto,unhide 0 0 /dev/cdrom /mnt/cdrom iso9660 ro,user,noauto,unhide 0 0 /dev/fd0 /mnt/floppy ext2 user,noauto,unhide 0 0 /dev/fd0 /mnt/dosfloppy msdos user,noauto,unhide 0 0 /dev/sda1 /usr2 ext2 user,noauto 0 0 /dev/sdb1 /usr3 ext2 user,noauto 0 0 Explanations:

I have windows installed on the first partition of my drive (/dev/hda1). I mount it as "/dos"; it's a vfat file system; any user may mount it; it's not mounted automatically at boot time; it doesn't get dumped automatically and it doesn't get processed by fsck. I don't know what "unhide" means.

Hopefully the cdrom, floppy and dosfloppy entries are self-obvious.

The last entries are for my external scsi disks (/dev/sda1, /dev/sdb1). These are connected via a pcmcia scsi card. Plug the card in, wait while the system probes the drives (takes a while) and then go ahead and mount them.

Note that I do not have fsck run automatically on the scsi drives (that final '0' on the line.) This is because fsck will fail if the drives are not connected, and boot-up will fail. This means that it's a good idea to run fsck manually on the drives after mounting them.

Finally, don't forget to mkdir the /dos, /mnt/cdrom, /mnt/floppy, /mnt/dosfloppy directories and so on.

Customize console keyboard

The 707c shares the same brain-damaged keyboard layout with the rest of the PC industry. The first thing you want to do is swap the control and caps-lock keys to where they belong.
    4.2:
	Edit /etc/sysconfig/keyboard and change
		KEYTABLE="/usr/lib/kbd/keytables/us.map"
	to
		KEYTABLE="/usr/lib/kbd/keytables/falk.map"

	Copy defkeymap.map to falk.map and make these changes:

    5.2:
	Edit /etc/sysconfig/keyboard and change
		KEYTABLE=us.map
	to
		KEYTABLE=falk.map
[obviously, you make up your own name rather than calling it "falk.map"]

Copy /usr/lib/kbd/keymaps/i386/qwerty/defkeymap.map.gz to falk.map.gz

Uncompress (gunzip) falk.map.gz; edit it.

My changes:

	  44,45c48,49
	  < keycode  14 = Delete	Delete          
	  < 	control	keycode  14 = BackSpace       
	  ---
	  > keycode  14 = BackSpace	Delete
	  > 	control	keycode  14 = Delete
	  69c73
	  < keycode  29 = Control         
	  ---
	  > keycode  29 = Caps_Lock       
	  116c120
	  < keycode  58 = Caps_Lock       
	  ---
	  > keycode  58 = Control         
	  238c242
	  < keycode 111 = Remove          
	  ---
	  > keycode 111 = Delete
Recompress (gzip)

Customize X windows keyboard

Create .Xmodmap file in your home directory or in /usr/X11R6/lib/X11/xinit/.Xmodmap and add these lines:

! Swap control and caps lock remove Lock = Caps_Lock remove Control = Control_L keycode 0x42 = Control_L keycode 0x25 = Caps_Lock add Lock = Caps_Lock add Control = Control_L ! Enable use of stupid windoze keys at bottom of keyboard ! Choose two unused keycodes at random to assign to the keys. keycode 115 = F13 keycode 117 = F14 The
XKeyCaps program is very handy here.

What you do with the two windoze keys is entirely up to you. The one on the right has a menu icon on it, so you might assign it to pop up window menus. The .fvwmrc code to do this might look like:

Key F14 R A Popup "Utilities" Key F14 R S Popup "Window Ops" Key F14 R M Module "winlist" FvwmWinList

Create man page indices

Most people forget this step, but it's part of every Unix install:
	/usr/sbin/makewhatis /usr/man:/usr/X11R6/man

Configure pcmcia

(4.2 only; 5.2 already figured it out)

Edit /etc/sysconfig/pcmcia

	PCMCIA=yes
	PCIC=i82365
	PCIC_OPTS=
	CORE_OPTS=
	CARDMGR_OPTS=

Configure networking

Redhat's netcfg program comes in very handy here, but there are a few caveats:

host name

Your laptop needs a host name (see
above). In addition, every network interface should have one or more names. I don't think this is a strict requirement, but it's a good idea.

You can determine your current host name by using the hostname command.

loopback

Every system has a loopback interface. The loopback inteface is usually named localhost.

If you don't have any networking on your laptop, just put this one line in /etc/hosts:

127.0.0.1 myhostname localhost

If you want to set your machine's domain name, enter this:

127.0.0.1 myhostname.domain.name.com myhostname localhost See
domain name, below for an explanation.

PPP

This is easiest to do with netcfg, but here's how to do it manually anyway.

Edit /etc/sysconfig/network-scripts/ifcfg-ppp0

PHONENUM=555-1212 PERSIST=yes DEFROUTE=yes ONBOOT=no DIALCMD=ATDT INITSTRING=ATZ MODEMPORT=/dev/modem LINESPEED=115200 ESCAPECHARS=no DEFABORT=no HARDFLOWCTL=yes DEVICE=ppp0 REMIP= IPADDR=321.654.987.11 MRU= BOOTPROTO=none PPPOPTIONS= PAPNAME= DISCONNECTTIMEOUT= RETRYTIMEOUT= USERCTL=yes MTU= Edit /etc/sysconfig/network-scripts/chat-ppp0 (netcfg can do this for you.) '' 'ATZ' 'OK' 'ATDT555-1234' 'CONNECT' '' 'ogin:' 'falconer' 'ord:' 'xxxxxxx' set permissions on this file to rw------- (600)

Edit /etc/hosts and add an entry for your ppp interface.

127.0.0.1 localhost # Home, via ppp. I'm lucky enough to have static IP. # This first line isn't actually necessary whether or not # I have static IP, as the PPP module will establish the IP # address. 321.654.987.11 foo.my.isp.com foo 321.654.987.1 dns.my.isp.com # get the rest from DNS

Install ppp-2.2.0f-3 rpm package if not already installed.

Ethernet

This is easiest to do with netcfg, but here's how to do it manually anyway. Edit /etc/sysconfig/network-scripts/ifcfg-eth0: # ethernet at work DEVICE=eth0 USERCTL=yes ONBOOT=yes BOOTPROTO=none NETMASK=255.255.255.0 IPADDR=123.456.789.63 BROADCAST=123.456.789.255 NETWORK=123.456.789.0

You should also add a line to your /etc/hosts file for the interface.

123.456.789.10 bar.mycompany.com bar

If you use the DHCP protocol, it is not necessary to specify an IP address, network address or broadcast address. It is not necessary to add an entry to /etc/hosts. This is all handled by DHCP.

The ethernet cards I have used are

Both cards worked straight out of the box; no need to even touch the floppy disk that's packed with them. Other borrowed ethernet cards have also worked just fine. There's a list of supported cards at Sourceforge.

Domain Name

If your computer is going to be connected to the network, it should probably have a domain name. netcfg does not seem to set this correctly. By tracing programs, I was able to determine that Redhat 5.2 gets the dns domain name by searching /etc/hosts.

You should have a line somewhere in /etc/hosts that has the fully qualified domain name as the first name on the line, followed by the short hostname. Something like this:

127.0.0.1 foo.domain.name.com foo localhost or 123.456.789.10 bar.eng.mycompany.com bar

You can determine your current dns domain by using the dnsdomainname command.

Routing

Your computer will need to know how to reach remote networks. If you use PPP or DHCP protocol, this is all handled automatically.

You can manually add gateways to your configuration with netcfg, but this is not really the way to do it. The right way to do this is the routed routing daemon.

If the ethernet card is plugged in when you boot your system, routed starts automatically. Otherwise, it needs to be started manually after the ethernet card is inserted. There's probably a way to automate this, but I haven't figured it out yet. I'll update this webpage if I find out.

To start routed manually, simply become superuser and execute the routed command.

Domain Name Service

DNS allows your system to find the IP address of any other system on the internet. It really beats adding entries to /etc/hosts. To enable DNS, set the dns domain name as described above and edit /etc/resolv.conf: search my.isp.com eng.mycompany.com nameserver 321.654.987.1 nameserver 321.654.987.2

In this example, I'm configured for both my PPP connection and my ethernet connection at work. The nameserver entries are the IP addresses of your DNS servers (your network admin will give these to you.) It may be possible to specify these by name if the names occur in /etc/hosts.

Network Information Service

NIS, aka The Protocol Formally Known as YP is a somewhat more powerful, but less popular way than DNS for computers to get hostname (and other) information.

To use NIS, your system needs to have an NIS domain name. (Some systems, e.g. Solaris, use the same domain name for DNS or NIS, but Redhat Linux has seperate domains. I don't know why.)

1) Install ypbind package. It's also a good idea to have yp-tools.

2) Set the NIS domain name of your system. Edit /etc/sysconfig/network and add a line like this:

NISDOMAIN=eng.mycompany.com

3) Edit /etc/yp.conf, and add a line like this:

domain eng.mycompany.com broadcast 4) On my system, I had to create the symlink: /etc/rc.d/rc3.d/S90ypbind => ../init.d/ypbind I know someone else whose system already had the symlink /etc/rc.d/rc3.d/S13ypbind. However, this caused trouble, as it meant that ypbind was trying to start up before the pcmcia card was recognized. By using the name S90ypbind, the problem was (at least partially) eliminated.

You can determine your current NIS domain by using the domainname command.

/etc/hosts

/etc/hosts holds a list of hostnames and IP addresses. It is used along with DNS and/or NIS to obtain hostname information.

If you don't have DNS or NIS, then this file can get pretty large, as it must contain the name of every computer you communicate with. Otherwise, it usually just holds the names of your own computer, and the few systems it needs to communicate with before DNS or NIS starts up.

Here's an example, assuming a ppp connection from home and an ethernet connection at work. My machine is named foo, and has two distinct domains. If I were to connect to my ISP and my ethernet at work simultaneously, chaos would probably result -- or at least a pretty serious firewall breach.

127.0.0.1 localhost # Work via the pcmcia ethernet card 123.456.789.10 foo.eng.mycompany.com # Home, via ppp. I'm lucky enough to have static IP. # This first line isn't actually necessary whether or not # I have static IP, as the PPP module will establish the IP # address. 321.654.987.11 foo.my.isp.com foo 321.654.987.1 dns.my.isp.com

NFS

NFS is the Network File System. It allows you to mount directories on other hosts directly onto your own file system. Your machine may be either an NFS client (mounts filesystems from other hosts) or an NFS host (exports filesystems for other hosts to mount.)

If you've configured your kernel for NFS client support and enabled networking, then nothing more needs to be done to be an NFS client. You simply add entries to /etc/fstab as needed. However, you may want to enable the automounter to make life easier.

To export NFS file systems for other hosts to mount, edit /etc/exports and add a line like this:

/usr *.mycompany.com This example makes my /usr directory available to all systems in the mycompany.com domain.

The automounter is a very convenient feature to have. You can refer to any system on your network simply as /net/remotehost/...

To enable NFS automounter: Install the am-utils RPM if it's not already installed. Automounter works automatically.

Sound

Learning how to get the sound chip to work was tricky, but once I got it working it was just fine.

There were two problems with the sound chip. First, the chip would sometimes wake up screaming after a suspend-to-disk/resume cycle. Rebuilding the kernel seems to have fixed the problem. I also used xmixer to set the microphone volume to zero to eliminate feedback.

Second, attempts to record from /dev/dsp failed. There was a console error message to the effect that there was an I/O error, possibly related to a misconfigured interrupt. Playback worked just fine.

To fix the recording problem, I went to the setup screen and changed the sound chip IRQ from 5 to 7. I then reconfigured the kernel (below) for the new address. No problems since.

SCSI

I use an Adaptec SCSI pcmcia card. Model 1401 (double-check this.) It works perfectly with external SCSI disks, 8mm SCSI tape and SCSI zip drive. I'll be trying a SCSI CD-writer soon; watch this spot for more.

The SCSI card came with a mail-in card for a free DB-25 cable. If you plan to connect really cheap hardware (e.g. zip drive) with non-standard connectors, you want to get this.

Earlier, I had tried a model called the New Media Basics SCSI. It did not work Linux (Redhat 4.2) so I sent it back. It may be supported with newer kernels.

ZIP Drive

I obtained a refurbished SCSI zip drive and connected it up. The ZIP drive came with an envelope stuffed with documentation and software. Ignore it. Don't even bother breaking the seal. There's nothing in there you need or want for Linux. Assuming that the kernel is configured properly, it should just plug and play. Since the SCSI drive was the only thing connected to my SCSI card, the drive came up as /dev/sda

I executed these commands (as root):

mkdir /mnt/zip mount /dev/sda1 /mnt/zip and it worked perfectly. The system even auto-detected the file-system type on the disk.

Reconfigure kernel

Redhat 5.2 ships with the version 2.0.36 kernel

It's important to reconfigure the kernel because the default kernel does not support Advanced Power Management (APM) or sound. Without APM enabled, the system is prone to an ugly divide-by-zero in the kernel after a suspend-to-disk sequence.

I also needed to rebuild the kernel to get the sound chip to behave properly.

Reconfiguring the kernel is easiest with the X windows config program. To run this:

Here are the settings I used when configuring my kernel.

Items which I left in the default setting, which were not applicable, or which I didn't understand are not listed here.

Naturally, you may choose different settings, depending on the options you want, and the accessories you have.

	Loadable modules; accept defaults:
	  Y Enable loadable module support
	  Y Set version information on all symbols for modules
	  Y Kernel daemon support
	General setup:
	  N Kernel math emulation
	  Y Networking support
	    Processor type: Pentium
	Floppy, IDE and other block devices
	  Y Normal floppy disk support
	  Y Enhanced IDE/MFM/RLL disk/cdrom/tape/floppy support
	  Y support removable IDE interfaces (PCMCIA)
	  N RAM disk support
	Networking options
	    (Generally accept defaults; disable some features I know
	    I'll never use)
	SCSI Support
	  Y SCSI support [because I have a PCMCIA SCSI adapter]
	    (Generally accept defaults)
	SCSI low-level drivers
	    (Accepted defaults; I didn't understand them anyway.  My
	    scsi card is pcmcia so I probably don't need any of these.)
	Network device support
	  Y Network device support
	    (Accepted defaults.)
	ISDN subsystems
	  N ISDN support
	CD-ROM drivers (not for SCSI or IDE/ATAPI drives)
	  N Support non-SCSI/IDE/ATAPI CDROM drives
	Filesystems
	  Y Second extended fs support
	  M ISO9660 cdrom filesystem support
	  Y DOS FAT fs support
	  Y MSDOS fs support
	  Y VFAT (Windows-95) fs support
	  Y /proc filesystem support
	  M NFS filesystem support
	Character devices
	  Y Mouse Support (not serial mice)
	  N ATIXL busmouse support
	  N Logitech busmouse support
	  N Microsoft busmouse support
	  Y PS/2 mouse (aka "auxiliary device") support
	  N C&T 82C710 mouse support
	  Y Advanced Power Management BIOS support
	  Y Enable PM at boot time
	  Y Make CPU idle calls when idle
	  Y Enable console blanking using APM
	  Y Power off on shutdown
	Sound
	  Y Sound card support
	  Y OSS sound modules
	  Y 100% Sound Blaster compatibles
	    I/O base for SB	220
	    Sound Blaster IRQ	7
	    Sound Blaster DMA	1
	    (note: settings are BIOS configurable; see above)
	Additional low level sound drivers
	    (accept defaults)


The Battery Powered Linux Mini-HOWTO says that the pcmcia drivers should also be re-compiled to take advantage of power management.


Nits and Picks

"xmkmf" complains that it can't find /lib/cpp. Making a symlink from
	/usr/lib/gcc-lib/i386-Redhat-linux/2.7.2.3/cpp  =>  /lib/cpp
fixed the problem. Probably a bug in RH 5.2

Create an account for yourself with adduser

Add yourself to the "floppy" group in /etc/group so you can write floppy disks.


Final Problems

Sound chip wakes up screaming after a suspend-resume cycle. Reconfiguring the kernel (above) seems to have fixed the problem.

New libc.so.6 libraries do not work with older executables. E.g. if you have a /usr/local/bin directory which you migrate from Redhat 4.2, some executables will not work because of changes.

fvwm seems to delete my LD_LIBRARY_PATH variable, causing various problems.

Appendices


XF86Config

Here are the relevant portions of my /etc/XF86Config file. The auto-probe function in the 5.2 install process produced this file automatically, but here are the important parts for your records: Section "Pointer" Protocol "PS/2" Device "/dev/mouse" Emulate3Buttons Emulate3Timeout 50 EndSection # ********************************************************************** # Monitor section # ********************************************************************** Section "Monitor" Identifier "LCD Panel 1024x768" VendorName "Unknown" ModelName "Unknown" HorizSync 31.5-48.5 VertRefresh 60 # 800x600 @ 60 Hz, 37.8 kHz hsync Modeline "800x600" 40 800 840 968 1056 600 601 605 628 +hsync +vsync # 800x600 @ 72 Hz, 48.0 kHz hsync Modeline "800x600" 50 800 856 976 1040 600 637 643 666 +hsync +vsync # 1024x768 @ 60 Hz, 48.4 kHz hsync Modeline "1024x768" 65 1024 1032 1176 1344 768 771 777 806 -hsync -vsync # 1024x768 @ 70 Hz, 56.5 kHz hsync Modeline "1024x768" 75 1024 1048 1184 1328 768 771 777 806 -hsync -vsync # 1024x768 @ 76 Hz, 62.5 kHz hsync Modeline "1024x768" 85 1024 1032 1152 1360 768 784 787 823 EndSection # ********************************************************************** # Graphics device section # ********************************************************************** # Any number of graphics device sections may be present Section "Device" Identifier "Generic VGA" VendorName "Unknown" BoardName "Unknown" Chipset "generic" # VideoRam 256 # Clocks 25.2 28.3 EndSection # Device configured by Xconfigurator: Section "Device" Identifier "My Video Card" VendorName "Unknown" BoardName "Unknown" #VideoRam 2048 # Chipset "NM2160" # IOBase 0xfea00000 # MemBase 0xfd000000 # VideoRam 2048 # DacSpeed 90 # Option "linear" # Option "nolinear" # Option "sw_cursor" # Option "hw_cursor" # Option "no_accel" # Option "intern_disp" # Option "extern_disp" # Option "mmio" # Option "no_mmio" # Option "lcd_center" # Option "no_stretch" # Insert Clocks lines here if appropriate EndSection # ********************************************************************** # Screen sections # ********************************************************************** # The Colour SVGA server Section "Screen" Driver "svga" # Use Device "Generic VGA" for Standard VGA 320x200x256 #Device "Generic VGA" Device "My Video Card" Monitor "LCD Panel 1024x768" Subsection "Display" Depth 16 Modes "1024x768" ViewPort 0 0 Virtual 1024 768 EndSubsection EndSection

Lilo.conf

TBD