SPONSORED LINKS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Linux-on-the-IBM-ThinkPad-750 (fwd)



Forwarded message:
>From chan4@husc Sat Jul 16 01:58:17 1994
Message-Id: <9407160558.AA14973@husc.harvard.edu>
Date: Sat, 16 Jul 94 01:58:12 -0400
From: chan4@husc
X-Within-Url: http://peipa.essex.ac.uk/html/linux-thinkpad.html
To: chan4@husc
Subject: Linux-on-the-IBM-ThinkPad-750


                         LINUX ON THE IBM THINKPAD 750
                                       
Introduction

   You wil be pleased to know that Linux is quite happy on the IBM
   ThinkPad 750 series of notebook computers, though installation `from
   the box' is not possible, with the Slackware distribution at least.
   This short note summarizes what changes to the vanilla Linux 1.0
   sources are necessary for the ThinkPad and outlines some of the
   configuration files' contents.
   
   Various people have reported more or less the same modifications for
   different ThinkPad models: my own ThinkPad is the 750C (active matrix
   colour) with 12 Mbyte RAM (i.e., the 8 Mbyte expansion) and 340 Mbyte
   hard disk, but the same modifications to get Linux running have been
   reported on monochrome (750M, I think) and dual-scan passive-matrix
   colour machines (the 750Cs) and with the 170 Mbyte hard disk. You can
   get a Linux 1.0 kernel with these modifications.
   
    * Some modifications are required to the floppy driver: you cannot
      install linux using a kernel without these modifications. 
    * The standard hard disk driver does not determine the disk
      configuration from the bios: there is a one-line fix to the hard
      disk driver to fix this. Alternately, you can simply specify your
      hard disk configuration via lilo. 
    * Versions of the kernel that pre-date v1.1 require a patch to avoid
      memory trashing by the power management routines. 
    * LILO works on the ThinkPad when these mods are in place. 
    * The X window system is certainly happy on the 750C but people have
      reported problems on the 750Cs. 
    * The good news is that there is no problem with the cute little red
      button that replaces a conventional mouse: it just appears as a
      PS/2-style mouse. 
    * There is also some information on using power management
      fuctionality, and on PCMCIA cards. 
      
   You are advised to read all this note before fiddling with your
   ThinkPad's disk! 
   
Modifications to the floppy disk driver

   The floppy disk drive on the ThinkPad 750 supports 2.88 Mbyte disks in
   addition to 1.44 Mbyte disks. Because of this, IBM have sensibly
   allocated a new drive type to the device, namely device type 6.
   Unfortunately, Linux as distributed does not have support for device
   types 5 or 6; hence, it is necessary to make some (fortunately, fairly
   simple) modifications to the floppy disk driver. What makes this
   problem particularly pesky is that, for most people at least, the
   floppy disk drive is the device from which they load Linux.
   
   What needs to be done is to replicate the entries for floppy drive
   type 4 for types 5 and 6. (This is a sub-optimum solution: if anyone
   makes a better job of it, please let me know!) Additionally, the sense
   of the `diskette changed' bit is reversed, so that occurrences of 
   

  inb(FD_DIR) & 0x80

   need to be changed. Modified drivers have been announced by Keith
   Moore <moore@cs.utk.edu> for Linux 0.99pl14 and by Daniel R Grayson
   <dan@symcom.math,uiuc.edu> for Linux 1.0. You can get a copy of the
   patched Linux 1.0 driver, floppy.c here: this was patched by the
   author based on Moore's modifications and should replace the file in 
   

  /usr/src/linux/drivers/block/floppy.c

   (This will be available as a set of patches after my next system
   upgrade.) 
   
Modification to the hard disk driver

   Brad Pepers <pepers@cuug.ab.ca> has discovered that the oft-mentioned
   problem in locating the disk geometry of ThinkPad -- and, come to
   that, ValuePoint -- machines is not, as had previously been thought,
   due to a problem in the BIOS: what is actually failing is the code
   that determines the number of drives from the CMOS.
   
   A one-line patch to routine of the hard disk driver corrects the
   problem. The hard disk driver is in the file 
   

  /usr/src/linux/drivers/block/hd.c

   and the modification simply increments the number of hard disks if the
   number of cylinders of a particular drive is non-zero. The region of
   code concerned is 
   

  if (!NR_HD) {      
    for (drive=0 ; drive

The additional line is clearly indicated by a comment.  



An alternative approach is to specify the disk geometry via lilo. For example, 
on the author's machine, which has the 340Mbyte hard disk, the line to add to t
he LILO configuration file would be: 
  APPEND = "HD=914,15,49"

Modification to the memory manager

Michael Steiner <sti@zurich.ibm.com> tells me that there is a problem in kernel
s before the official v1.1 release regarding BIOS power management functions. I
f you need to run an old kernel for some reason, the appropriate patch is given
 below. 
diff -r -c linux-1.0.DIST/mm/memory.c linux/mm/memory.c
*** linux-1.0.DIST/mm/memory.c  Wed Feb 23 17:36:51 1994
--- linux/mm/memory.c   Tue Mar  8 02:29:59 1994
***************
*** 1069,1075 ****
                *--p = MAP_PAGE_RESERVED;
        start_low_mem = PAGE_ALIGN(start_low_mem);
        start_mem = PAGE_ALIGN(start_mem);
!       while (start_low_mem 


Support for Advanced Power Management (APM)

Michael Steiner <sti@zurich.ibm.com> also reports that the APM package (availab
le from tsx-11.mit.edu as packages/laptops/apm/apmd.tgz at the time of writing)
 works "if you just ignore the reply". He also reports that the built-in suspen
d/hibernate stuff works anyway (if you created one under DOS or OS/2). 

Inevitably, the APM driver needs patching. 
*** ../apmd.c   Wed Apr 13 17:52:17 1994
--- ../old/apmd.c       Tue Dec  7 18:37:54 1993
***************
*** 8,30 ****
  #include 
  #include "asmi.h"

- void apm_dettach() {
-   int retval;
-
-   retval = asmi(APM_INTERFACE_DISCONNECT, 0, 0, 0, 0, 0);
-   if (retval) {
-     printf("interface disconnect: %s\n", apm_error(retval));
-     exit(1);
-   }
- }
-
-
- /* !! inserted by sti */
  void signal_exit_handler()
  {
! /* !! moved to newly created function apm_dettach() by sti */
!       apm_dettach();

        exit(0);
  }

--- 8,22 ----
  #include 
  #include "asmi.h"

  void signal_exit_handler()
  {
!       int     retval;

+       retval = asmi(APM_INTERFACE_DISCONNECT, 0, 0, 0, 0, 0);
+       if (retval) {
+               printf("interface disconnect: %s\n", apm_error(retval));
+               exit(1);
+       }
        exit(0);
  }

***************
*** 42,48 ****
        int     retval;
        unsigned int    vers, check, flags;
        unsigned int    event;
!
        if (iopl (3) 



Using PCMCIA devices

Bernardo Lam <blam@panix.com>/CODE>; reported on 4-Jul-1994: "I have had good e
xperience with the MHz 14.4 PCMCIA modem and the Dlink DE650 ENET PCMCIA, they 
work flawlessly". Bernardo apparently uses the generic PCMCIAD kernel driver fr
om tsx-11.mit.edu and is currently running Linux 1.08. 

Additional goodies

Keith Moore <moore@cs.utk.edu> has also written a driver for IBM's PCMCIA Ether
net card. He says of it in his README:

"This is a device driver I wrote for Linux (pl13) and IBM's Credit Card Adapter
 for Ethernet. It assumes that your system uses the Intel 82365 PCMCIA controll
er, or a compatible chip, to interface between the system bus and the PCMCIA ca
rds.

"The IBM documentation for this card is thoroughly brain-damaged. It leaves out
 a number of important details and gets some things wrong. For instance, it say
s that all of the registers that deal with the Remote DMA mode are reserved, bu
t inside it just uses an ordinary NS83902 chip (ST-NIC) (this according to an u
nnamed source at IBM). Anyway, remote dma mode worked just fine for me. Your mi
leage may vary.

"Other things that you might need to know about this card if you are writing yo
ur own driver for it or for a different system: 

    * The 16K shared-memory buffer is at offset 0x4000 on the card's
      address space. That means that, to the ST-NIC chip, the first page
      of memory is 0x40, not 0x00. 
    * The PCMCIA Configuration Index needs to be set to any nonzero
      value, and it appears that you need to enable level interrupts
      rather than edge triggered interrupts. So the Configuration and
      Option Register needs to be set to 0x41. 
    * The Ethernet address of the card is stored in attribute memory at
      offset 0xff0, and every other byte thereafter. 
      
"This driver would probably work on the Linksys card also, except that its conf
iguration registers are at offset 0x8 in attribute memory, and the IBM card's r
egisters are at offset 0x20000. This information could be obtained by parsing t
he card information structure's tuples. It might be that this technique would w
ork for any Ethernet PCMCIA card."

I am on the point of trying the driver myself -- you can get a copy of it in a 
tar-file from here. 

Using LILO

Perhaps the best way to show a possible LILO configuration for the ThinkPad is 
to describe my own. I have configured my machine to have three partitions: 

          /dev/hda1 
          
  This is an 80 Mbyte DOS partition which I never seem to use these days.
          :-) 
          /dev/hda2 
          
  This is a 16-Mbyte swap partition for Linux. (I do image processing on
          my ThinkPad, so I need lots of swap.) 
          /dev/hda3 
          
  The main Linux partition, about 250 Mbytes. My fairly _de luxe_ system
          with TeX, X, gcc, etc occupies about 90 Mbytes. 
          
The LILO configuration file, /etc/lilo.conf is as follows: 
boot=/dev/hda
image = /zImage
  label = lin-hd
  ramdisk = 0
  root=/dev/hda3
  vga = normal
other = /dev/hda1
  label = dos
  table=/dev/hda
Linux is booted from the hard disk by default but, by holding the shift key dow
n while booting, one can elect to boot DOS by typing `dos' at the resulting pro
mpt. 

It is also possible to tell LILO the geometry of the hard disk, which avoids ha
ving to patch the hard disk driver. 

Configuring X for the ThinkPad

Unfortunately, things do not seem to be identical on all ThinkPad screen types.
 

  X CONFIGURATION FOR THE 750C
  
The following X configuration file works fine on the LCD screen of my 750C: I h
aven't tried it on an external monitor. It is said that, to be able to drive an
 external monitor via the VGA port on the back of the ThinkPad, you must switch
 to it from DOS before booting Linux. 
RGBPath         "/usr/X386/lib/X11/rgb"
FontPath        "/usr/X386/lib/fonts/misc/"
# FontPath      "/usr/X386/lib/fonts/Speedo/"
FontPath        "/usr/X386/lib/fonts/75dpi/"
# FontPath      "/usr/X386/lib/fonts/Type1/"
# FontPath      "/usr/X386/lib/fonts/100dpi/"
Keyboard
  AutoRepeat 500 5
ps/2    "/dev/mouse"
  Emulate3Buttons

VGA256
 Virtual       1024 768
 ViewPort      0 0
 Modes           "1024x768"
 Modes         "640x480"
 Chipset        "wd90c30"
# Clocks 28.30
# wd90c00, wd90c10, wd90c30, wd90c31 wd90c20

# vga256
#  Clocks       25 28 32 36 40 45 50 60 65
#  ChipSet      "WD90C30"
#  Modes        "640x480-25"

VGA16
 Virtual       800 600
 Viewport      0 0 
 Modes         "640x480"
 Chipset       "generic"
# Clocks       30 30 0 30

VGA2
 Virtual       1024 768
 ViewPort      0 0
 Modes         "640x480"
# Modes                "1024x768"
 Chipset       "wd90c20"
 Clocks 28.30 0 0 0 0 0 0 0 36

ModeDB
# name        clock   horizontal timing     vertical timing      flags
"640x480-25"    25      640 680 720 864       480 488 491 521
#"640x480"      28      640 680 720 864       480 488 491 521
"640x480"       28.3    640  672  768  800    480 490 492 525
"1024x768"      65      1024 1032 1176 1344   768 771 777 806   -hsync -vsync

  X CONFIGURATION FOR THE 750CS
  
Michael Steiner <sti@zurich.ibm.com> has also done some work on getting X to wo
rk on the 750cs, with some success. The standard X86_SVGA X server does not wor
k on the 750Cs: everything comes out double! He has found some of the reasons a
nd fixed them; here are the patches. 
*** lib/Server/drivers/vga256/pvga1/driver.c    Wed Jun 22 15:49:40 1994
--- lib/Server/drivers/vga256/pvga1/driver.c.orig       Tue Jun  7 23:03:36 199
4
***************
*** 134,142 ****

  #define IS_WD90C3X(x) (((x) == WD90C30) || ((x) == WD90C31))

! /*!! commented by sti */
! /* #undef DO_WD90C20 */
! #define DO_WD90C20

  static unsigned PVGA1_ExtPorts[] = {            /* extra ports for WD90C31 */
               0x23C0, 0x23C1, 0x23C2, 0x23C3, 0x23C4, 0x23C5 };
--- 134,140 ----

  #define IS_WD90C3X(x) (((x) == WD90C30) || ((x) == WD90C31))

! #undef DO_WD90C20

  static unsigned PVGA1_ExtPorts[] = {            /* extra ports for WD90C31 */
               0x23C0, 0x23C1, 0x23C2, 0x23C3, 0x23C4, 0x23C5 };
***************
*** 383,400 ****
      if (!vga256InfoRec.videoRam) {
          unsigned char config;

! #ifdef DUAL_SCAN
!       /* check if we have a dual-scan LCD */
!       outb(vgaIOBase + 4, 0x31);
!       if ((inb(vgaIOBase + 5) & 0x3) == 0) {
!           /*  clear bit 6 to disable upper 512k The remaining 512Kbytes
!               of video memory are not disabled by clearing the bit, but it
!               is actually used as a shadow of first 512Kbyte */
!           outb(0x3CE, 0x0B); config = inb(0x3CF);
!           outb(0x3CE, 0x0B); outb(0x3CF, config & 0xAF);
!           outb(0x3CE, 0x0B); config = inb(0x3CF);
!       }
! #endif
          switch(config & 0xC0) {
          case 0x00:
          case 0x40:
--- 381,388 ----
      if (!vga256InfoRec.videoRam) {
          unsigned char config;

!         outb(0x3CE, 0x0B); config = inb(0x3CF);
!
          switch(config & 0xC0) {
          case 0x00:
          case 0x40:
However, some problems still remain: for example, when switching to or from oth
er virtual terminals, the screen is occasionally messed up. Putting the machine
 into suspend mode for a short while cures this, but Michael is working on a so
lution. The vanilla XF86_VGA16 driver apparently suffers from the same problem.
 

In Conclusion

Although Linux itself works fine on the ThinkPad and X is happy on at least som
e of the machines, there are things that are still not supported: these include
 sound support, utilization of the power management facilities, and drivers for
 the other PCMCIA cards. If you come up with solutions to these problems -- exp
ecially a driver for IBM's Ethernet PCMCIA card or support for sound -- please 
let the author know and he will incorporate details of them into this note.

Oh: if anyone figures out a way of using xmodmap (or anything else) to intercha
nge the Ctrl and Caps lock keys, please let me know too!

        Adrian F. Clark 
        alien@essex.ac.uk 
        8-Jul-1994