[ Installing Debian | Patching the kernel | Setting up X | Setting up Sound | Power Management | Network, combo drive, and USB configuration | The Application Panel and LED | What doesn't work | Tips and Tricks | How I almost toasted my Linux install | Hard Drive Upgrade | How I set up my removable USB drive | Likes and Dislikes | Thanks and Links | How I set up my removable USB drive ] P2110 Specs (borrowed from Fujitsu's site):
|
P2120 InformationFirst, I should tell you that I don't have a P2120 personally, so all of the information I will give regarding the P2120 is second-hand at best. I have not personally tested it or confirmed that it works, but I will try my best to confirm that the P2120-specific information I detail here has some sort of consensus regarding its accuracy and appropriateness. That having been said, whenever there is some important configuration information that differs between the P2110 and P2120, I plan to add a differently-colored box like you see here, with instructions specificially for the P2120. As I do this, please feel free to send me any corrections/improvements you might have. Let's start with the P2120 hardware specs: P2120 Specs:
|
Installing DebianOkay, now that that is out of the way, how do we install Linux on this thing? First thing I did was to search around the net for other people who might have installed Linux successfully on this machine. The most useful site was definitely this one for the P-2046. I also got some help from this site. The laptop came configured with ~18Gb set aside for Windows XP Home, with a 2Gb partition used for their DiskImage SE backup image. I backed up that image onto a spare hard drive, and then used the DiskImage program to resize that partition to 5Gb. I was planning on keeping some form of Windows on the drive, so I figured I would keep any videos or mp3s stored on that larger partition so both OSs could use them. After resizing the drive, I used my Debian (well of course Debian) 3.0 XFS-enabled netinst CD. The most important thing is to pass the Update 11-26-2002: I have changed my partitioning scheme to allow for a suspend-to-disk partition. Here is the new partitioning scheme:
Device Boot Start End Blocks Id System /dev/hda1 * 1 1747 14032746 c Win95 FAT32 (LBA) /dev/hda2 1748 1811 514080 a0 IBM Thinkpad hibernation /dev/hda3 1812 1873 498015 82 Linux swap /dev/hda4 1874 2432 4490167+ 83 Linux I put XFS on /dev/hda4 and set it as my root partition, and created a partition of type "a0" for suspend-to-disk. You can read more on that in the Power Management section. I went through and made sure that my network card module was loaded (8139too module), I also had it load the trident module for my sound card. Then I went through the Debian install setting things up to my liking. I'll spare you the details. This particular install set up my combo drive as a generic scsi device for me, so that was one step I didn't have to worry about. Otherwise you would want to make sure the ide-scsi module is loaded and possibly append |
Patching the kernelSpeaking of patching the kernel, I found the ALI15X3 IDE patch for 2.4.18 to work with the 2.4.19 kernel I was building. This patch will fix the problems that require the extra ide options to be added at the boot prompt, and will also let you use DMA on your drives. The Trident Patch for 2.4.18 which apparently fixes problems with sound after suspending the machine, also works for 2.4.19. I also, of course, installed the XFS patch from SGI. You can see a copy of my .config here (which I borrowed heavily from here along with borrowing tons of other settings and advice). Note I enabled CONFIG_X86_CPUID and CONFIG_X86_MSR in the kernel so that I can use longrun. More on that later. Update 12-29-2002: More detail on my patching procedure. I decided to go into a bit more detail on how I set up patches for my kernel. The first thing I do is to create a directory in /usr/src called "patches-kernel-version" For the last kernel, for instance, it would be /usr/src/patches-2.4.20 Then I copy whatever patches I plan on applying to that kernel into that directory. This way I can keep track of the patches I applied to each kernel so I can be sure to find the appropriate patches for the next kernel I decide to build. At this point, after copying all the relevant patches to /usr/src/patches-2.4.20, and unpacking the current kernel, and linking /usr/src/linux to it, I cd into /usr/src/linux, and for each patch do the following: greenfly@clover:/usr/src/linux$ patch -p1 < /usr/src/patches-2.4.20/alim15x3.patch_2.4.18.txt If you want to test a patch out before actually applying it, add the --dry-run argument, which will test but not apply the patch. Note that the previous patch said 2.4.18 in its name. That is because I found that the patch applied just as well to 2.4.20, so I didn't go out and find any updated patch, but I still copied it to my patches-2.4.20 directory so I would know that I applied that particular patch to the kernel. Update 11-11-2002: I found a patch to allow cpuid and msr in the 2.4.19 kernel. I ended up enabling devfs in my kernel, but by default it won't create the /dev/cpu/0/cpuid and msr devices. I found a patch for 2.4.19 originally posted to the Linux Kernel Mailing List. I applied this and the devices showed up properly. I did, however need to modify my device permissions for longrun to work. I did this by editing the /etc/devfs/perms file and made sure these lines were present: REGISTER ^cpu/[0-9]+$ PERMISSIONS root.crusoe 0775 REGISTER ^cpu/[0-9]+/[a-z][^/]*$ PERMISSIONS root.crusoe 0775 REGISTER ^cpu/[a-z][^/]*$ PERMISSIONS root.crusoe 0660The middle line is one I created so that the cpuid and msr devices would get proper permissions. I then ran /etc/init.d/devfsd restart to accept the changes. Now longrun works fine under devfs!
Update 12-03-2002: Upgraded to 2.4.20 I went a slightly different route with this kernel and used Debian's make-kpkg program to build everything. I accumulated the debian lm-sensors, alsa, and hostap sources and extracted them, which puts them in /usr/src/modules. At that point I applied the xfs, ali15x3, and devfs_cpuid patches that I mention further up, and then ran |
P2120 Specific Information Okay, since the P2120 doesn't support APM, but only APCI, and since APCI on the 2.4 kernel series is somewhat iffy, there are some different steps you must take. First step is to get the latest ACPI patch for the 2.4 kernel from acpi.sourceforge.net. The latest patch for 2.4.20 can be found here. If you are feeling adventurous, you can try the latest 2.4 prepatch, with right now is at 2.4.21-pre5 and can be found here and patch the resulting kernel tree with the latest pre-5 ACPI patch. If you are feeling even more adventurous, you can try the latest 2.5 development kernel release. ACPI is under very active development there. The 2.5 version numbers increment so often, I'm not about to try to keep up with it. Just check http://www.kernel.org/ to get the very latest 2.5 kernel release. Once your kernel is extracted and patched check your kernel config and make sure that in addition to configuration I have outlined above, that your ACPI support is enabled along with USB2 support. "Spoon" from the leog.net forum has offered his kernel config for his P2120.
|
Setting up XNext up is to set up X. The main thing you need to know is to add the following modeline so you can acheive the 1280x768 resolution: Update 12-27-2002: More detail on building DRI-XV packages from retinalburn.net To get DRI, XV, and GL working under X, I ended up grabbing the patched drivers from http://www.retinalburn.net/linux/. Follow his directions for details, but the following is what I did. First, I downloaded two files, mach64-20020920-linux.i386.tar.bz2, and mach64-dri-xv-20020916.tar.bz2 from his site. Go here for updated files. I then untarred the first file, which unpacks into a directory called "dripkg". Then I went into that directory and ran the install.sh script inside. Note that you will need to have the source for whatever kernel you happen to be using. This script will build and install the mach64 dri modules for your kernel. After I did this, I unpacked the second mach64-dri-xv file, which unpacks into a X11R6-DRI directory. I then made a backup copy of my /usr/X11R6 directory, just in case, and then went into the X11R6-DRI directory and typed as root: greenfly@clover:~/X11R6-DRI$ cp lib/modules/drivers/* /usr/X11R6/lib/modules/drivers/and greenfly@clover:~/X11R6-DRI$ cp lib/modules/multimedia/* /usr/X11R6/lib/modules/multimedia/At this point I restarted X, and xvinfo worked, and xine and mplayer both worked with xv acceleration. For GL to work, you will want to make sure that the only GL libs that exist on your system are under /usr/X11R6. Also, I've noticed that DRI won't work above 16bit color depth. The /var/log/XFree86.0.log complains about needing 9Mb+ of video memory to run at 24bit color depth. I would rather have more colors than GL acceleration at the moment, so I'm running at 24bit, with plans to set up an additional screen section in my XF86Config-4 so I can start a new 16bit X session for games. Without GL acceleration, glxgears pulls between 100 and 120fps, with GL it gets around 220 to 240fps. I got tvout working to some degree by using atitvout which happens to have a package for Debian Sid. It isn't perfect, but it will work as long as you specify to display on the TV only. I haven't been able to get a simultaneous view yet, so I use |
P2120 Specific Information Because the P2120 uses the Radeon Mobility instead of the Rage Mobility, the accelerated drivers from retinalburn.net will not work for the radeon. However, it appears that X 4.3 has support for PCI Radeon cards. Simply specify "radeon" as your driver instead of "ati". An additional note for debian woody users (Added 04-09-2003): I received a tip from Aaron Enright, a P2120 user, on getting a working version of X for the P2120 with Debian Woody "the Debian way." Simply add
A experimental source for X 4.3 for sid users (Added 2003-11-04): That above source doesn't help you much if you are a sid user, so here's the experimental X source for debian:
Then run |
Power ManagementFor power management, I installed the apmd Debian packages. There is one caveat though. I noticed that after a suspend, X would be fine but any consoles wouldn't come back up. Some people offered modifying the /etc/apm/apmd_proxy script so that it says "return 0" instead of "exit 0" at the end. That seems to work, although I am still losing console sometimes. I also installed the longrun Debian package, which was nice enough to create the devices under /dev for me. I haven't been able to get the gkrellm longrun plugin to work, but longrun itself works fine. I set up a "longrun" group and gave it write access to those devices. I modified a hdparm apm script to set up my economy mode under longrun. You can check that out here. I have it currently set up to allow speeds between 300Mhz and 667Mhz when on the battery, and the full 867Mhz when plugged in. I also downloaded a nifty dockapp to monitor longrun status called wmlongrun.
Update 05-11-2003: Enabling LongRun Thermal Extensions (LTX): Another Crusoe user, WildBill, gave me a tip on how to enable Longrun Thermal Extensions in Linux. It's very straightforward. Basically, to enable it you run clover:/home/greenfly# longrun -p LongRun: enabled LongRun Thermal Extensions (LTX): active LTX setting: reserved Current performance window: 100 to 100 Current performance level: 100 LongRun flags: performanceYou might be wondering, what is LTX in the first place? Here's the description from Transmeta's site on Longrun:
Well, that was a nice bit of PR-speech. Anyway, I added the enable and disable commands to my longrun apm script. Update 05-13-2003: Well, that didn't exactly work as planned. I figured that the laptop would get warmest during performance mode, so I enabled thermal extensions during that time, but it really slowed things down. I got an email from dirk, complaining about poor video performance, so I ended up swapping the thermal extensions to only be enabled when on battery power. I actually decided to just leave those commented out, and those of you that wish to use it can simply comment the lines back in. Update 11-26-2002: I have gotten suspend-to-disk working. Here's how: First you need to make sure that you have created a partition of type a0 (IBM Thinkpad Hibernation) on your disk. The partition size should be equal to physical RAM + video memory + 2MB, or 266MB in my case. I set it higher, because I wanted to allow room to grow up to 512MB RAM. Next I downloaded lphdisk using My plan is to try turning off automatic suspend when the panel is closed in the BIOS, and try to set up APM to recognize that event and run apm -S instead of apm -s. Otherwise, if you suspend to RAM and then close the panel, it will go ahead and automatically suspend to disk, which isn't what I would like it to do.
Update 02-22-2003: I have gotten combo drive/modular battery swapping working! Here's how: Yooden from the Leog.net P-2000 Linux forum pointed out in a thread that you can hotswap out the combo drive with the modular battery by simply doing a warm swap instead (swapping out while your machine is suspended). I just tried it out and it works great. The only question I might have now is whether it'll work if the combo drive isn't in the laptop when it originally boots. I will try that out at some point and update this. Even so, it doesn't matter much since I won't be rebooting this machine much at all! Thanks Yooden!
|
P2120 Specific Information Todo: Add ACPI configuration information. In the meantime there are multiple documents, including ACPI's own internal documentation, for instructions on how to use the system. Note that APM no longer works for the P2120 series.
|
Network, combo drive, and USB configurationThe RealTek 8139 network card on the laptop uses the 8139too kernel module, and accepts MII commands, so I was able to get it to work with the laptop-net package with some tweaking. Here is my /usr/share/laptop-net/link-change file that I modified (Updated 11-14-2002). Basically it didn't maintain an eth0 device when you unplugged the cable so I had to tweak it to keep something running so it could pick up the MII cable connect event properly. Now, it detects when I have unplugged the network cable and disabled the eth0 device accordingly. This package also detects what network you are connected to and can configure your machine accordingly. The CDR, configured as a scsi device, works well using cdrecord and gcombust. I added some lines to my sources.list and downloaded mplayer, xine, and dvdread, dvdcss, and other related packages and DVD playback works great, especially since the screen has a 16:9 aspect ratio, which works great for widescreen movies. I haven't tested USB much or IEEE 1394 yet, but from other sites they apparently works fine. The USB floppy works by loading the usb-storage module. You will also need scsi_mod, sg, sr_mod, and usb-ohci (you need that last one for USB in general). It shows up as a NEC Model: USB UF000x Rev: 1.21 under /dev/sda. The very first floppy I used, however, got stuck in there! I managed to remove it, but now it doesn't seem to be able to read any other floppies correctly. I might have to contact Fujitsu about this one. Update 11-19-2002 I got my replacement floppy 3 days after I called in an RMA. Fujitsu was really responsive and helpful, and the new one seems to work fine. All that is left is for me to ship back the defective drive. So, so far, I've had good results with Fujitsu support, which makes me feel pretty good.
|
The Application Panel and LEDUpdate 11-14-2002 With some help, and patched code from Javier on the Fujitsu P-Series Forum, I have been able to get all three application panel buttons working, as well as the mail indicator LED (which, wasn't as impressive as I was expecting, I thought the whole blue side panel would glow, oh well). So anyway, here's what I did: Installing lm-sensors: First I installed lm-sensors. I'm not going to get into this a whole lot, because there are other sites that go into how to install this package, and it differs across distros anyway. For my system I did # I2C adapter drivers i2c-ali1535 # I2C chip drivers adm1021It also instructed me to put the following in my /etc/modutils/local file, and run /etc/init.d/modutils restart: # I2C module options alias char-major-89 i2c-dev options adm1021 ignore=0,0x19 Installing apanel: Next is to install the apanel software. First you extract the file and go into the extracted directory and run There is an included init.d script called rc.fjkeyd that I copied into /etc/init.d/fjkeyd and then I ran Debian's xterm -display :0.0 rxvt -display :0.0 xterm -display :0.0 mailtermNote that it doesn't really matter what you put in the third line, since the P-Series doesn't have an internet button, but you do need something in there as a placeholder. Because of the fact that modprobe didn't work, I had to modify /etc/init.d/fjkeyd so that it ran insmod -f instead. Also, you need to create a /dev/fujitsu/apanel device with Major number 10 and Minor number 216. I use devfs, so I added the following information to my /etc/devfsd/devices file: fujitsu d "" "" root root 0755 fujitsu/apanel c 10 216 root root 0666and restarted devfsd. Now at this point it complained that /dev/fujitsu/apanel did not exist, even though ls told otherwise. The reason, apparently, is that you don't want the adm1021 driver loaded along with fjkeyinf. So comment out (or remove) that line in your /etc/modules file, unload that module, and then run /etc/modutils restart. With all the appropriate modules loaded, including fjkeyinf, I ran Updated 02-16-2003 Special instructions for P2040 users: A helpful post appeared in this thread in the leog.net Linux forum regarding getting fjkeyinf to work on the P2040. I'll just repost tnhh's post here: tnhh: Here is an email from Javier describing some extra features of the fjkeyinf module: Just a few comments (from your web page). The daemon defines several enviroment variables that may be useful: KD_SHIFT has a number with the shift state when the button is pressed (so you can do a ctrl+alt+A, for example). KD_MODE is a text string. Either "TEXT" or "GRAPHICS" depending of the status of the current console when the button is pressed. KD_UID and KD_USER have the numeric and text user that has the ownership of the current console. This is an example of one script: -------------------------------------------------------------------- #!/bin/sh if [ "$KD_SHIFT" == "12" ] ; then exec init 6 elif [ "$KD_SHIFT" == "1" ] ; then exec init 4 fi if [ "$KD_MODE" == "GRAPHICS" ] ; then if [ ! -z "$KD_USER" ] ; then echo 'exec /opt/kde/bin/kcalc -display :0' | exec su $KD_USER fi else echo Key B fi -------------------------------------------------------------------- Javier Achirica |
What doesn't workThe internal software modem is the only device that doesn't yet work as far as I know. So far there haven't been any drivers yet for the internal software modem although this page gives me hope. I'd also like to get the screen to automatically dim on battery power so I don't have to hit the Fn keys.
Updated 02-22-2003 Status of IDE hotswap: I have gotten IDE hotswap working by warm swapping it. Check out that section under Power Management.
|
Tips and TricksNew 02-04-2003 In this section, I will go over a few extra tips and tricks I have done to finish up setting up my P-2110. apanel tweaks: I have gotten the apanel set up just about the way that I want it, so I decided to post my configuration here. The first thing I did was to change the /etc/fjkeyd.conf file so that instead of specific utlities, it would run some shell scripts I wrote that decide what the appropriate action will be. That way, instead of having to modify /etc/fjkeyd.conf and restart /etc/init.d/fjkeyd whenever I wanted to change something, I would have specific scripts set up for each button and change those instead. As a result, my /etc/fjkeyd.conf script looks like this now: apanel_a apanel_b xterm -display :0.0 apanel_mail Note again that the third entry doesn't matter, this program is also designed for other Fujitsu models that have an extra button there. All the apanel entries correspond to shell scripts that I put in /usr/local/bin, named after the Application button pressed. Here are the links to each script, as well as a quick description of what each does: apanel_a
apanel_b
apanel_mail
Note that with each of these I am first echoing a string to "osd_cat" which is a program that displays whatever text you send it, on the screen (OSD=On Screen Display). That way, when I press the mail button, for instance, the mail LED lights, and "mail" appears at the bottom of my screen in bright green. Blinking the LED for new mail This sort of setup really is dependant upon your own system configuration, but I will post what I have done, and leave it up to each user to change it to fit their environment. First, a bit about my local mail setup. I use offlineimap, which syncs a remote IMAP server with your local system. As a result, I have a local copy of my mail set up in maildir format. Instead of posting my scripts I will just describe what they do, since they are pretty specific to my setup. I have one script that checks my remote mailserver every minute for new mail. If new mail exists, the script runs "offlineimap" which then syncs up my laptop with the mail server. I have another script running that checks my local "new" mail directory for any files, and if files exist in there it runs If you don't have a similar setup, but do have mail located on a remote system, I would recommend setting up fetchmail for your mailserver configuration (doing this is a bit beyond the scope of this document, but there are tons of docs out there, as well as a few GUI configuration tools for this), and then write a script that runs #!/usr/bin/perl # This script will check for new mail using fetchmail -c # and set the apanel led to blink if new mail exists # otherwise it will turn the led off. # After that it sleeps for $seconds seconds and starts again $seconds = 60; #seconds before repeating while(1) { $total_messages = 0; $seen_messages = 0; open FETCHMAIL, "fetchmail -c 2>/dev/null |"; while(<FETCHMAIL>) { if(/(\d+) messages \((\d+) seen\)/) { $total_messages = $1; $seen_messages = $2; if($total_messags > $seen_messages) { system("apanelc led blink 100"); } else { system("apanelc led off"); } } } close FETCHMAIL; sleep $seconds; } Note that this script will just continue running forever until you kill it. On my version I also check to see if offlineimap is running, and if so I sleep for $seconds.
Changing wireless networks easily (Added 03-12-2003) I recently got an orinoco gold pcmcia wireless card for my P, and took the opportunity to streamline my wireless configuration. To ease configuration, Debian has now made it possible to do all of your wireless configuration from withing /etc/network/interfaces. That, coupled with the "mapping" feature of ifupdown, lets you create multiple wireless schemes that you can control by setting your cardctl scheme. Here's what I did: First, I copied the pcmcia-compat.sh script from /usr/share/doc/ifupdown/examples/ to /usr/local/bin and made it executable by running mapping eth1 script /usr/local/bin/pcmcia-compat.sh map home,*,*,* home map work,*,*,* work map ssu,*,*,* ssu map linksys,*,*,* linksys map any,*,*,* any map adhoc,*,*,* adhocNote that since I'm using an orinoco card, the device name is eth1. If you are using a prism2 based card (such as the internal wireless card in the P) you might be using wlan0 instead. Each map line here tells the script which cardctl scheme maps to which entry further down the file. For instance, if the cardctl scheme is "home" it will match the "home,*,*,*" line, which points down to my "home" configuration: # home wireless iface home inet dhcp up /usr/share/laptop-net/profile-change eth1 down /usr/share/laptop-net/profile-change eth1 down wireless_mode managed wireless_nick clover wireless_essid my_home_ssid wireless_key "00:00:00:00:00:00:00:00:00:00:00:00:00" wireless_rate auto(The essids and keys have been changed to protect the innocent). Note that I say "iface home" instead of "iface eth1" here. The rest of the lines are just regular interfaces configuration, with the up and down lines telling ifupdown to run that script when the connection is brought up or down, respectively (By the way, that script tells laptop-net to refresh its settings based on the network it finds itself in. laptop-net itself is an apt-gettable debian package that allows you to automatically configure settings on your computer based on what network you have connected to -- very useful for a laptop). The rest of the settings simply configure various aspects of my home WEP wireless network. I then add entries like the above for each different network that I might need to connect to. Now, when I go home, I just run You can see an example of my full /etc/network/interfaces file here.
Enabling Pointer Tapping (Added 04-08-2003) For quite a while I had heard from other P users about "pointer tapping" on their P. Pointer tapping basically senses pressure from pushing down on the pointing stick, and translates it into a mouse click. I had never experienced this working on the Windows side, so I never looked into it much on Linux. I figured that maybe the P2110 didn't have pointer tapping ability. Well, I finally looked into "Trackpoint Utilities" on the Windows side and noticed that pointer tapping wasn't enabled by default. I enabled it, and saw what the fuss was about -- it's quite a handy feature to be able to generate mouse clicks just by pressing that button down. I decided now that I knew what it "felt like" on the Windows side that I should test it on the Linux side. Here's how: First, get the latest version of Linux Trackpoint Utilities from http://www-hft.ee.tu-berlin.de/~strauman/tp4utils/. Follow the step-by-step instructions in the README which are pretty straightforward. Now once you have installed this, you might notice that your user doesn't seem to be able to run it. That is because by default (at least on my system) the user doesn't have read and write permissions to /dev/psaux (well under devfs /dev/misc/psaux). I fixed that by adding a group "mouse" by running Then I added tp4d to my ~/.xinitrc so that it would start up along with X. After this you can run xtp4 to get a graphical program that lets you tweak tp4d settings. So far it all seems to work fine. Yet another piece of P hardware that works under Linux! |
How I set up my removable USB driveNew 01-19-2004For my birthday this last year, I received a USB laptop drive enclosure. Once I upgraded my hard drive in my P2110, I had its 20Gb hard drive to use in it. I decided to set up a FAT32 partition on it, spanning the full 20Gb, and now have set up hotplug and autofs to automatically mount the usb drive when I insert and access it (and umount it when it's idle). So, first thing, is for hotplug to be installed. In Debian it was as simple as running Jan 19 15:46:27 clover kernel: hub.c: new USB device 00:02.0-1, assigned address 4 Jan 19 15:46:27 clover kernel: WARNING: USB Mass Storage data integrity not assured Jan 19 15:46:27 clover kernel: USB Mass Storage device found at 4 Jan 19 15:46:31 clover usb.agent[10819]: kernel driver usb-storage already loaded USB drives work as regular scsi hard drives as far as we are concerned (and requires sd_mod to be loaded). And we could just mount the device that is created (/dev/sda1 for me) and be done with it. I wanted it to automatically mount when I plugged it in, and umount when I unplugged it. To do this, first we need some information from /proc: /proc/bus/usb/devices will show information about the various usb devices on the system. For instance, here is a snip from the file when my usb drive is plugged in: T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 4 Spd=12 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=05e3 ProdID=0702 Rev= 0.02 S: Product=USB TO IDE C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr= 96mA I: If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage E: Ad=81(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms Yeah, it's a lot of gibberish, but there's useful information in there for setting up hotplug. You can configure hotplug to do certain things when certain devices are plugged in. It already has its own scripts set to run when it detects generic usb-storage devices, but I wanted something specific. To do this, you need to edit the /etc/hotplug/usb.usermap file: # usb.usermap file # This is autogenerated by update-usb.usermap program # Note: you may use /etc/hotplug/usb/*.usermap # usb module match_flags idVendor idProduct bcdDevice_lo bcdDevice_hi bDeviceClass bDeviceSubClass #bDeviceProtocol bInterfaceClass bInterfaceSubClass bInterfaceProtocol driver_info usb-storage 0x00f 0x05e3 0x0702 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 In the line I added above, there are only 3 fields of interest, the match_flags, idVendor, and idProduct. I noticed from the usb.distmap file that the match_flags field for usb-storage was 0x00f. Now, the idVendor value I got from that /proc file I listed above. It says "Vendor=05e3" so I put in 0x05e3 in the second field. Likewise I took the "ProdID=0702" and put in 0x0702 in the idProduct field. The rest doesn't matter (the first three fields are enough to match this device) so I just put in 0x00 for those. This line in usb.usermap tells hotplug to run the /etc/hotplug/usb/usb-storage script whenever it sees that this device is plugged in. That script can then load modules, or run other programs (including setting up programs to run when the drive is removed). I found some examples on the net and created my own that would automount the drive: #!/bin/sh case "$PRODUCT" in 5e3/702/2) # FireXpress usb hard drive /bin/mount /mnt/usbdrive # set up what to do when you remove the drive echo -e '#!/bin/sh\n/bin/umount /mnt/usbdrive' > $REMOVER chmod a+x $REMOVER ;; esac If you want to see what kind of enviroment variables are present when this script is run, you can insert a "set >> /tmp/settings" line above the case statement. Reading through that file, you can see what $PRODUCT is set to for your product. In my case it was set to "5e3/702/2". I then set up the case statement to mount this usbdrive when that device is actually plugged in (my fstab entry established the mounting of a /dev/sda1 vfat partition on /mnt/usbdrive). There is another environment variable, $REMOVER, that specifies the name of a script that is run after the device is removed. This script is empty by default, so I echoed in the umount command I wanted to use when I removed the drive. I then ran Now, there are some problems for this. Namely, the drive isn't being umounted until it is already removed. This could result in filesystem corruption over time. The solution is to use autofs to mount the device on demand, and then umount when idle. First, I installed autofs with # $Id: auto.master,v 1.2 1997/10/06 21:52:03 hpa Exp $ # Sample auto.master file # Format of this file: # mountpoint map options # For details of the format look at autofs(5). /var/autofs/misc /etc/auto.misc /var/autofs/net /etc/auto.net /var/autofs/removable /etc/auto.removable --timeout=2 That last line tells autofs to mount any of the removable devices I will specify in /etc/auto.removable under /var/autofs/removable, and to umount them after 2 seconds of idling. I then created the /etc/auto.removable file: usbdrive -fstype=vfat,uid=1002,gid=1002,umask=002 :/dev/sda1 This file sets up a mount point which will end up being /var/autofs/removable/usbdrive, the mounting options to use, and which device to mount. Now, all of this happens outside of /etc/fstab, so I removed my entry for my usbdrive from /etc/fstab, and also removed the /mnt/usbdrive directory. I decided what I would do instead is have my hotplug script create a symlink to the autofs mountpoint when the drive is inserted, and remove the symlink when the drive is removed. That way, I will only deal with /mnt/usbdrive and not worry about any /var/autofs directories. The new and improved /etc/hotplug/usb/usb-storage is the following: #!/bin/sh case "$PRODUCT" in 5e3/702/2) # FireXpress usb hard drive ln -s /var/autofs/removable/usbdrive /mnt/usbdrive # set up what to do when you remove the drive echo -e '#!/bin/sh\nrm /mnt/usbdrive' > $REMOVER chmod a+x $REMOVER ;; esac Now, I can plug in my drive, and see that /mnt/usbdrive is created. After 2 seconds, autofs will umount the drive. You can monitor /var/log/syslog to watch this happening: Jan 19 16:24:35 clover automount[14059]: mount(generic): calling mkdir_path /var/autofs/removable/usbdrive Jan 19 16:24:35 clover automount[14059]: mount(generic): calling mount -t vfat -s -o uid=1002,gid=1002,umask=002 /dev/sda1 /var/autofs/removable/usbdrive Jan 19 16:24:36 clover automount[14059]: mount(generic): mounted /dev/sda1 type vfat on /var/autofs/removable/usbdrive Jan 19 16:24:39 clover automount[14066]: running expiration on path /var/autofs/removable/usbdrive Jan 19 16:24:39 clover automount[14066]: expired /var/autofs/removable/usbdrive As you can see, the drive unmounted seconds after the command finished, since it had been idling. It would now be safe to remove. For the future, I am planning on setting up a similar system for my digital camera (which appears as a normal usb storage device as well) to not only automatically mount the camera, but also sync up any photos on it. |
Hard Drive UpgradeNew 01-02-2004So, after owning the P2110 for a year, I decided it was time for a hard drive upgrade. I not only wanted to increase the hard drive capacity, but I also wanted to move from a 4200rpm drive to a 5400rpm drive. After shopping around, I decided on the Toshiba MK4019GAX. Here are some specs:
First, I followed the instructions on this site to remove my old hard drive. Having changed out hard drives in other laptops, it was rather straightforward. Then I hooked up my old hard drive to my desktop computer with a 2.5" laptop adapter (you can get them either online or at a decently-stocked electronics/computer store). I then created a temporary mount point for the two partitions I was interested in transferring (my Windows and Linux partitions) and mounted them at /mnt/hdc1 and /mnt/hdc2 respectively. I then cleared up some free space on my desktop and ran the same command I use to transfer any root system, once for each partition:
Then I halted the machine, hooked up my new hard drive, and booted back up. At this point I had to recreate the partitions one by one using fdisk. I created each filesystem one by one how I wanted them, and then, after I had written to the partition table, I created the appropriate filesystems on the Windows and the Linux drives using mkfs. I then mounted the Windows and Linux partitions where I had mounted them previously and did the following for each partition to copy the data back to the new drive:
Once all the data had been copied, I powered down my desktop and installed the new hard drive into the P2110. I then booted off of a KNOPPIX cd so that I could run grub-install to place grub back on the MBR of this new hard drive. I booted the KNOPPIX disc, mounted the Linux root read/write with Once I had booted, I ran a few diagnostics to test the differences in speed. Here are the hdparm benchmarks:
|