8/2002

dgi productions presents

MY LINUX TRICKS





I have subscribed to the linux-il mailing list for soem time, and I got together some tricks and hacks I read there. Most of them are not mine, and I give the original email if I can as well, so I will not take the credit to myself.
  1. Speeding Hard disk accsess:
    Alon Altman <alon@vipe.technion.ac.il> once wrote:

    Speaking of hdparm, I just recently found out that in Linux, HDs have DMA
    off by default. By using hdparm you can speed up your HD up to 10 times the
    original speed, by issuing the following command each bootup(replace
    /dev/hda with your UDMA HD)...

      hdparm -c1 -d1 -m16 -k1 /dev/hda

    Try it by first issuing:

      hdparm -Tt /dev/hda

    for a benchmark and then repeat the benchamrk after turning DMA on.

      Alon
    So, most linux boxes, come with DMA off, and most of our new hard diskare UDMA, so this could make our box run faster. I made an init script (for/etc/init.d) and put it [here].

  2. Making X consume less memory
    Hetz Ben Hamo <hetz@kde.org>, wrote:

    Could it be the XFS font server?

    I disabled it and added those lines to my XF86Config-4 file:

    #    FontPath   "unix/:7100" <- this one eliminates the use of XFS
            FontPath        "/usr/X11R6/lib/X11/fonts/misc:unscaled"
            FontPath        "/usr/X11R6/lib/X11/fonts/75dpi:unscaled"
            FontPath        "/usr/X11R6/lib/X11/fonts/100dpi:unscaled"
            FontPath        "/usr/X11R6/lib/X11/fonts/Speedo"
            FontPath        "/usr/share/fonts/default/winfonts"

    I also added In the section "Module":

            Load "freetype"
            Load "type1"

    Now - I used mkfontdir inside my winfonts (copied from win XP), and then
    modified all the ISO8859-7 to ISO8859-8 and ISO8859-9 to ISO10646-1 (I know,
    a butt ugly hack, but mkfontdir, nor XFS supports ISO8859-8 or ISO10646-1
    very well)

    From this hack I've seen that the memory usage went down very much (no more
    XFS) and I got lot more fonts.

    Hope this helps,
    Hetz
    Then he said

    Actually - you CAN use hebrew fonts with Anti Alias - and in a very simple
    way..

    Add this line to the dir lines in /etc/X11/XftConfig:

    dir "/usr/share/fonts/default/winfonts"

    (thats from my last example)...

    But this is not very easy since you need to disable some sizes from anti
    aliasing (anything less then 8 point size letter anti aliased is unreadable
    even on very high quality EIZO screens)...

    Hetz
    So X uses an external  program for handeling fonts, while it can handle them it self. Good idea.

  3. Installing Hebrew fonts on X
    As root 
    cd /usr/lib/X11/fonts
    mkdir TTF
    copy /mnt/windows/windows/fonts/*.ttf TTF
    (or whatever your windows mount shall be)
    ttmkfdir > fonts.dir
    perl -i -pe 's/iso8859-9/iso10646-1/' fonts.dir

    The last line, makes makes unicode available. You will not be able to use turkish fonts, but if you want unicode fonts then it is for KDE2 or mozilla, which will handle turkish as unicode if available. If you use trick number 2 (about X memory usage) dont forget to add the dir to the font path.

  4. Enabling UTF8 on konsole

     Here is the script from a debian woody system:

    #!/bin/bash --
    #
    # Switch utf-8 mode
    #
    #-------------------------------------------------------------------------

     case $1 in
       on) echo $'\033%G'"UTF-8 on";;
       off) echo $'\033%@'"UTF-8 off";;
       *) echo "usage: $0 [on|off]";;
     esac
  5. Intel/HaM LinLodem
    7Those who have this modem and have installed the driver, can download a reviced verion of the init script supplied here . It work better then the origianl, and does not delete the devices needed by the driver, and also supports "status".

  6. Compilling a kernel
    Use this table, if you are compiling a kernel.


    What do you need?
    Where to set up?
    Remarks
    CDR/W, cd burners


    1. scsi -> scsi support <m>
    2. scsi -> scsi CD-ROM support <*>
    3. ATA/IDE/MFM/RLL support -> IDE, ATA and ATAPI Block devices ->  scsi emulation support <m>
    The cdrw should be a scsi device, if it is The cdrw should be a scsi device, if it is not then install a module which will emulate it. it. In lilo.conf,  add "hdX=ide-scsi". Where X represent your device
    Parallel Printers
    1. parallel port support -> parallel port support <m>
    2. parallel port support -> pc style hardware <m>
    3. parallel port support -> multi-io cards (parallel and serial) (optional?)
    4. parallel port support -> IEEE 1284 modes <m> 
    5. character devices -> parallel printer support <m>
    in /etc/modules.conf add:


    3D video cards

    1. character devices -> /dev/agpgart (agp support) <m>
    2. character devices -> /dev/agpgart (agp support) (all the sub-components bellow this) <*>
    3. character devices -> /dev/agpgart (agp support) -> Direct Rendering Manager <*>
    4. character devices -> /dev/agpgart (agp support) -> Direct Rendering Manager -> all devices as modules, or just yours. <m>
    3D effects on games Not the display driver for X but for DRI. OpenGL uses it, in games like Quake III. You need XFree86 >= 4.1 for this.
    Shut down you PC
    1. General Setup -> Advanced Power Managment Support <built in>

    or if you want:

    1. code maturity level options -> prompt for  development and/or incomplete code/drivers.
    2. general Setup -> ACPI support <built in>
    3. general Setup -> ACPI support -> ACPI bus manager -> system <built in>




    If you select General Setup -> ACPI support -> ACPI if you select General Setup -> ACPI support -> ACPI bus manager, do not select "button" as well. If you do, when you press the power button the machine, it will write to /proc/acpi/event, that the power button as been pressed, a daemon who should run, will then shut down the system. Most systems do not have that daemon by default

    It is important that you compile those It is important that you compile those modules built in, because when the kernel is shutting down it unloads all loaded modules, even the ones you need to shut down phisically the PC
    Frame buffer
    1. code maturity level options -> prompt for  development and/or incomplete code/drivers.
    2. console drivers -> frame-buffer support -> support for frame buffer devices [built in]
    3. console drivers -> frame-buffer support -> VESA VGA graphics console

    You can select your video card if you want, VESA is safe for all (ATI Rage and ATI Radeon did not work for me).
    ou can use this kernel for booting into frame buffer or You can use this kernel for booting into frame buffer or normal text. To boot into frame buffer, in /etc/lilo put: vga=788. You dont not have to use it. You can use two entries on lilo.conf: one for text mode, and one for frame buffer.
    TV cards
    1. i2o device support -> i2o device support [m]
    2. character devices -> i2c support -> i2c support [m]
    3. character devices -> i2c support -> i2c bit banging interface [m]
    4. multimedia devices -> video for linux -> bt848 video for linux [m]
    5. sound -> tv card support [m]
    6. opional: sound -> bt 878 audio dma
    Visit [here] for a ful explain.
    PPP dial up
    1. networking options -> tcp/ip networking <*>
    2. network device support -> dummy net driver <m>
    3. network device support -> ppp (point-to-point protocol) <m>
    4. network device support -> ppp (point-to-point protocol) ->  ppp support for async serial ports <m>
    5. network device support -> ppp (point-to-point protocol) -> ppp deflate compression <m>
    6. network device support -> ppp (point-to-point protocol) -> ppp bsd-compress compression
    add this lines into /etc/modules.conf

    alias /dev/ppp ppp_generic
    alias char-major-108 ppp_generic
    alias tty-ldisc-3 ppp_async
    alias tty-ldisc-14 ppp_synctty
    alias ppp-compress-21 bsd_comp
    alias ppp-compress-24 ppp_deflate
    alias ppp-compress-26 ppp_deflate





  7. XFree86 Configuration
    Apparently XFdrake is not that smart with configuring XFree86, and when you se this program, some thing else is messed up. Like your screll wheel of the new mouse does not work, Quake 3 does not load...

    Here is my "InputDevice" section. XFDrake forgets to add the ZAxisMapping

    Section "InputDevice"
        Identifier  "Mouse1"
        Driver      "mouse"
        Option      "Protocol"      "IMPS/2"
        Option      "Device"        "/dev/psaux"
        Option      "ZAxisMapping"  "4 5"
    EndSection

    For QuakeIII, I had another problem: Quake did not load the GLX module, I mean X did not load it...

    Section "Module"
        Load        "GLCore"
        Load        "dbe"
        Load        "dri"
        Load        "glx"
        Load        "type1"
        Load        "freetype"
    EndSection

    Note that I adeded "glx" "dri" and "GLCore". The latest is not needed since it will be loaded by the program at runtime, but I found that it makes a lot of programs load faster, for example each QT program will load this module, unless it was loaded first, WINE and of course Quake III do the same....

    If you don't want to run thease programs as root, and do not want to change the default permissions of /dev/dri/* you may add this lines as well to the config file:

    Section "DRI"
        Mode 0666
    EndSection


[back ]