2010-05-31

md5sum

md5sum is a wide-used tool for checking the integrity of files after data transfers. Especially, when you download some big files (such as image of system), you may want to ensure that the huge files have been fully correctly download to your local disk. Usually, data privider will offer a md file to let user check the integrity. See the example in http://downloads.openwrt.org/backfire/10.03/rb532/. After download all the data files,  you also need to download the md5sums file into the same directory and run
>md5sum -c md5sum

About how to create a md file is shown below:
>md5sum file > file.md5 (single file)
>find directory -type f -print0 | xargs -0 md5sum >> file.md5 (all file in a directory)

Reference:

2010-05-28

nfs-kernel-server vs. nfs-user-server

Max tried to install nfs-server on his Debian machine.
>sudo apt-get install nfs-kernel-server
Everything looks fine, except of this warning message:
 
Not starting NFS kernel daemon: no support in current kernel. (warning)
 
It seems that the current kernel doesn't support nfs kernel daemon. After googling for sometime, I found that rebuild the kernel is the solution for the problem (http://computingplugs.com/index.php/NFS_server). It is funny that my self-built kernel 2.6.34 has no the option

[*] Root file system on NFS

in 'make menuconfig'.

The other solution is to install nfs-user-server, which runs in the user-mode, not in kernel-model.

>sudo apt-get install nfs-user-server
>/etc/init.d/nfs-user-server restart

Reference:

 
 

Difference between Virtualbox and Virtualbox-ose

The full VirtualBox package is available in binary (executable) form free of charge from the Downloads page. This version is free for personal use and evaluation under the terms of the VirtualBox Personal Use and Evaluation License.

The VirtualBox Open Source Edition (OSE) is the one that has been released under the GPL and comes with complete source code. It is functionally equivalent to the full VirtualBox package, except for a few features that primarily target enterprise customers. This gives us a chance to generate revenue to fund further development of VirtualBox.


Reference:

Description of /apt/etc/sources.list

#####################
deb http://ftp.de.debian.org/debian/ lenny main non-free contrib
deb-src http://ftp.de.debian.org/debian/ lenny main non-free contrib
#####################

deb/deb-src, indicates the type of archive: whether it contains binary packages (deb) or source packages (deb-src)
http://ftp.de.debian.org/debian/: repository of packages, it can be ftp, http, file and so on.
lenny: distribution, e.g. stable, testing sid...
main non-free contri: different licence sections in the package repository.
  • main: the official Debian distribution, full free use and redistribution.
  • contri: Packages in this area are freely licensed by the copyright holder but depend on other software that is not free.
  • non-free:  Packages in this area have some onerous license condition restricting use or redistribution of the software.

A Short Summary of Debian Package Management

# apt-get update (update local database using newest sources.list)
# apt-cache search string (search all packages contain the string)
# apt-get install package (install package)
# apt-get remove package (remove package)
# apt-get --purge remove package (remove package and config files)
# apt-cache show abcde (show info of package, e.g. dependency..)
# apt-get dist-upgrade (upgrade the installed package to latest version)

Reference

2010-05-25

2010-05-24

Full Screen Mode of Virtualbox

Left-Ctrl + F is the shortcut to switch between full screen and normal screen modes for virtualbox.

Error "cannot find -lXrender" at Build of QT

Reason: missing package of libxrender-dev.
>sudo apt-get update
>sudo apt-get install libxrender-dev

2010-05-20

Data Share in Virtualbox

  1. Host: Debian
  2. Guest: WindowXP
  3. Virtual Machine Software: Virtualbox -1.6.6_OSE
  4. Share fold: ~/shared
  5. Fold name: shared
  6. AdditionGuestIso: http://www.genunix.org/dist/vbox/VBoxGuestAdditions_1.6.6.iso. Note that don't use the item "Devie->Install Guest Addition", but mount the downloaded iso directly and run the setup.exe.
  7. map to shared fold on Guest: net use x: \\vboxsvr\shared

    Reference:

    Loading and Unloading Modules

    insmod: load module to kernel
    modprobe: load module. But Modprobe loads the modules that a module depends on, "insmod" does not.
    rmmod: remove module from kernel.
    lsmod: list the modules currently loaded in kernel.

    Downgrade to Kernel 2.6.26.686 to Install Virtualbox-ose

    In order to install virtualbox-ose, Max have to downgrade from 2.6.34.4 back to 2.6.26.686. The detail installation steps see Debian Wiki Virtualbox.

    # aptitude install virtualbox-ose virtualbox-ose-modules-$(uname -r)
    # invoke-rc.d udev reload
    # modprobe vboxdrv
    # adduser yourusername vboxusers

    To load the vboxdrv module at system startup, edit /etc/default/virtualbox-ose and set LOAD_VBOXDRV_MODULE to 1.

    2010-05-19

    FVWM-Crystal Shortcuts

    Mouse buttons:
    • Right mouse button click on desktop – opens up a terminal
    • Middle mouse button click on desktop – turns on and off the feature to switch desktops by moving the mouse cursor to the edge of the screen
    Keyboard:
    • ALT+TAB
    • ALT+F1ALT+F10 – switching between virtual desktops 1-10
    • ALT+Escape – switching between the two recently used desktops (cool stuff)
    • Num-5 – change of focus between the two recent apps (even cooler stuff!)
    • ALT+` – opens and closes QuakeConsole window - a nice virtual terminal (which can be xterm, aterm or mrxvt, depending on our choice) - the terminal comes out of nowhere and shows up in the top part of the desktop
    • ALT+Shift+` – opens up a new terminal window (xterm, aterm, mrxvt, Eterm or gnome-terminal)
    • ALT+; – opens up and closes FvwmConsole - a place where we can watch FVWM logs, as well as issue commands and FVWM scripts - I usually use it for launching custom apps
    • ALT+Menu – triggers a menu show up (the Diamond menu with all the applications, etc)
    • ALT+= maximizes current window (back and forth)
    • ALT+Backspace minimizes the current window to a desktop icon
    • ALT+Shift+Backspace closes the current window
    • ALT+Shift+= – full screen (and back to normal size)
    • ALT+z/b – previous/next track in the music player
    • ALT+x/c/v – start/pause/stop playing
    • ALT+./, – mixer volume up/down
    Reference:

    Kernel Compression Mode

    KERNEL_GZIP
    The old and tried gzip compression. Its compression ratio is
    the poorest among the 3 choices; however its speed (both
    compression and decompression) is the fastest.
    KERNEL_BZIP2
    Its compression ratio and speed is intermediate.
    Decompression speed is slowest among the three. The kernel
    size is about 10% smaller with bzip2, in comparison to gzip.
    Bzip2 uses a large amount of memory. For modern kernels you
    will need at least 8MB RAM or more for booting.
     KERNEL_LZMA
    The most recent compression algorithm.
    Its ratio is best, decompression speed is between the other
    two. Compression is slowest. The kernel size is about 33%
    smaller with LZMA in comparison to gzip.

    Reference:

    2010-05-17

    Walkthought of QML Calculator Example

    CalcButton.qml
    import Qt 4.7
    import Qt 4.7
    
    Rectangle {
        /*  The property button.operation, exposed ouside, is connect to the property of inner item label.text. See 'Property aliases' (http://doc.qt.nokia.com/4.7-snapshot/qml-extending-types.html#property-aliases) */
        property alias operation: label.text
        /*  Toggle behavior of button, default is not toggable. The property of button 'Advanced Mode' is set true. */
        property bool toggable: false
        /*  Porperty to tracking the toggle state of button. */
        property bool toggled: false
    
        /*  We want the button has a signal called clicked. */
        signal clicked
    
        id: button; width: 50; height: 30
        /*  border.color is a item among grouped property border. See 'Grouped property'(http://doc.qt.nokia.com/4.7-snapshot/qdeclarativeintroduction.html#grouped-properties) palette gives access to the system Qt color. e.g dark, light mid and so forth. See 'QML SystemPalette Element Reference'(http://doc.qt.nokia.com/4.7-snapshot/qml-systempalette.html#mid-prop) */
        border.color: palette.mid
        /*  This property holds the corner radius used to draw a rounded rectangle. See 'Rectangle.radius' (http://doc.qt.nokia.com/4.7-snapshot/qml-rectangle.html#radius-prop) */
        radius: 6
        /*  1) The gradient to use to fill the rectangle. Here gradientStop1 is the start color from upper boundary, while gradientStop2 is the end color at the bottom. See 'Gradient' (http://doc.qt.nokia.com/4.7-snapshot/qml-rectangle.html#gradient-prop)
            2) Qt.lighter is a global function return a color lighter than given color. See 'Global Function' (http://doc.qt.nokia.com/4.7-snapshot/qdeclarativeglobalobject.html)
            */
        gradient: Gradient {
            GradientStop { id: gradientStop1; position: 0.0; color: Qt.lighter(palette.button) }
            GradientStop { id: gradientStop2; position: 1.0; color: palette.button }
        }
    
        /*  Button text is located at enter of button and use system default buttonText*/
        Text { id: label; anchors.centerIn: parent; color: palette.buttonText }
    
        /*  The MouseArea item enables simple mouse handling.*/
        MouseArea {
            id: clickRegion
            /*  Area covers entire button.*/
            anchors.fill: parent
            /*  Signal Handlers for click on MouseArea. */
            onClicked: {
                /*???*/
                doOp(operation);
                /*  A 'clicked' signal of parent is emitted.*/
                button.clicked();
                /*  For toggle behavior of button.*/
                if (!button.toggable) return;
                button.toggled ? button.toggled = false : button.toggled = true
            }
        }
    
        /*  Beside of default state, the button has the other action states: Pressed and Toggled. Notice they have own condition to enter the state. In these two actions states, the starting gredient changes to palette.dark to distinguish from default appearance. */
        states: [
    
            State {
                name: "Pressed"; when: clickRegion.pressed == true
                PropertyChanges { target: gradientStop1; color: palette.dark }
                PropertyChanges { target: gradientStop2; color: palette.button }
            },
            State {
                name: "Toggled"; when: button.toggled == true
                PropertyChanges { target: gradientStop1; color: palette.dark }
                PropertyChanges { target: gradientStop2; color: palette.button }
            }
        ]
    }
    


    calculator.qml
    import Qt 4.7
    
    import Qt 4.7
    
    Rectangle {
        /*  The property button.operation, exposed ouside, is connect to the property of inner item label.text. See 'Property aliases' (http://doc.qt.nokia.com/4.7-snapshot/qml-extending-types.html#property-aliases) */
        property alias operation: label.text
        /*  Toggle behavior of button, default is not toggable. The property of button 'Advanced Mode' is set true. */
        property bool toggable: false
        /*  Porperty to tracking the toggle state of button. */
        property bool toggled: false
    
        /*  We want the button has a signal called clicked. */
        signal clicked
    
        id: button; width: 50; height: 30
        /*  border.color is a item among grouped property border. See 'Grouped property'(http://doc.qt.nokia.com/4.7-snapshot/qdeclarativeintroduction.html#grouped-properties) palette gives access to the system Qt color. e.g dark, light mid and so forth. See 'QML SystemPalette Element Reference'(http://doc.qt.nokia.com/4.7-snapshot/qml-systempalette.html#mid-prop) */
        border.color: palette.mid
        /*  This property holds the corner radius used to draw a rounded rectangle. See 'Rectangle.radius' (http://doc.qt.nokia.com/4.7-snapshot/qml-rectangle.html#radius-prop) */
        radius: 6
        /*  1) The gradient to use to fill the rectangle. Here gradientStop1 is the start color from upper boundary, while gradientStop2 is the end color at the bottom. See 'Gradient' (http://doc.qt.nokia.com/4.7-snapshot/qml-rectangle.html#gradient-prop)
            2) Qt.lighter is a global function return a color lighter than given color. See 'Global Function' (http://doc.qt.nokia.com/4.7-snapshot/qdeclarativeglobalobject.html)
            */
        gradient: Gradient {
            GradientStop { id: gradientStop1; position: 0.0; color: Qt.lighter(palette.button) }
            GradientStop { id: gradientStop2; position: 1.0; color: palette.button }
        }
    
        /*  Button text is located at enter of button and use system default buttonText*/
        Text { id: label; anchors.centerIn: parent; color: palette.buttonText }
    
        /*  The MouseArea item enables simple mouse handling.*/
        MouseArea {
            id: clickRegion
            /*  Area covers entire button.*/
            anchors.fill: parent
            /*  Signal Handlers for click on MouseArea. */
            onClicked: {
                /*???*/
                doOp(operation);
                /*  A 'clicked' signal of parent is emitted.*/
                button.clicked();
                /*  For toggle behavior of button.*/
                if (!button.toggable) return;
                button.toggled ? button.toggled = false : button.toggled = true
            }
        }
    
        /*  Beside of default state, the button has the other action states: Pressed and Toggled. Notice they have own condition to enter the state. In these two actions states, the starting gredient changes to palette.dark to distinguish from default appearance. */
        states: [
    
            State {
                name: "Pressed"; when: clickRegion.pressed == true
                PropertyChanges { target: gradientStop1; color: palette.dark }
                PropertyChanges { target: gradientStop2; color: palette.button }
            },
            State {
                name: "Toggled"; when: button.toggled == true
                PropertyChanges { target: gradientStop1; color: palette.dark }
                PropertyChanges { target: gradientStop2; color: palette.button }
            }
        ]
    }
    

    2010-05-16

    How To Compile A Kernel

    Max updated the kernel from 2.6.32-bpo.3-686 to 2.6.33,
    Download the kernel source from www.kernel.org and
    following the tutorial [1] and [2].

    make CONFIG_DEBUG_SECTION_MISMATCH=y???
    Reference:

    2010-05-15

    Start a Program as FVWM-Crystal Startup

    > cp /usr/share/fvwm-crystal/fvwm/preferences/Startup ~/.fvwm/preferences/Startup

    and edit as needed.

    Reference:
    How do i make things run at fvwm-crystal startup?

    Setup Wireless of ThinkPad SL510 in Debian

    Thinkpad sl510 has a intel wireless card:
    ==============
    Intel(R) WiFi Link 1000 BGN
    ==============

    Unfortunately, Debian Lenny with kernel  2.6.26 cannot support this card. You could install a 2.6.32 kernel image from backport. Follow the ref [1].
    Or, you could directly compile a 2.6.33 kernel from source code. According to [3], the Intel Wireless WiFi Link 1000 is supported since 2.6.33. Follow the tutorial in [4]

    Afterwards, Max installed a gui-based network manager software wicd-client.
    Follow the ref [2].

    Reference:

    2010-05-14

    QWidget vs QML

    "QWidgets are a better choice if your UI is comprised of a small number of complex and static elements, and QML is a better choice if your UI is comprised of a large number of simple and dynamic elements."
    Reference:

    2010-05-13

    Configure Sound for Debian

    See the artical in Germany

    Konfigurieren der Soundkarte mit alsaconf und amixer

    Show Hareware in Linux

    There are three commands are very useful to show hardware in Linux
    > lspci (pci device)
    > lsusb (usb device)
    > lshw (general hardware)
    > dsmeg (prints the message buffer of the kernel)

    Chinese Debian

    A good explained doc on setting update mini chinese Debian.


    http://isis.poly.edu/~qiming/chinese-debian-mini-howto.html

    2010-05-11

    Use Intel Graphic Driver for Debian Lenny onThinkpad SL510

    Thinkpad SL510 has a display adapter "mobile intel 4 series express chipset family".  Debian Lenny with kernel 2.6.26-2-686 is installed. In order to use inter driver, you need to following steps



    1)Modifiy /boot/grub/menu.lst, to set vga=871.

    2) Reconfigure /etc/X11/xorg.conf to use the intel driver:
    ==============
    Section "Device"
    Identifier "Configured Video Device"

    # Add this line to force the driver
    Driver "intel"
    EndSection
    ==============
    3) Reboot

    Reference:

    FVWM-Crystal upon Debian — speed and transparency

    Under Debian Lenny you need to install the following packages:

    >apt-get install fvwm
    >apt-get install fvwm-crystal
    >apt-get install x-window-system

    Add configuration file
    >vim ~/.xinitrc
    type in "exec fvwm-crystal"
    >reboot


    Reference:

     

    2010-05-08

    A Blue-screen Problem during Installation of WindowsXP at ThinkPad

    When Max tried to install WindowsXp on a fresh now ThnikPad, he encountered a blue-screen problem as the system boot from WindowsXP CD. More specifically speaking, after the scanning of hardware and before loading the windows setup program. From the inform on the blue-screen, it seems that something related with hard drive is wrong.

    After some googling, it is found out that XP CD cannot recognize Serial ATA in ACHI. The solution is change the configuration in BIOS.
    Config -> Serial ATA (SATA) > Set AHCI to Compatibility


    Reference:

    2010-05-06

    QML Tutorials (Qt 4.7 snapshot)

    QML is a declarative language designed to describe the user interface of a program: both what it looks like, and how it behaves. QML is an extension to JavaScript, that provides a mechanism to declaratively build an object tree of QML elements. 

    QML improves the integration between JavaScript and Qt's existing QObject based type system, adds support for automatic property bindings and provides network transparency at the language level.


    Reference:



      Qt 4.7 and Qt Creator 2.0

      The first try of Qt Creator 2.0 + Qt 4.7, both of them are in beta phase.
      1. Download them from http://qt.nokia.com/developer/qt-qtcreator-prerelease#download.
      2. Installation
      3. Configuration. Tools->Options->Qt4->Manual.Give correct path of qmake and mingw. e.g. qmake location: c:\qt\4.7.0-beta1\bin\qmake.exe; MinGW directory: c:\Qt\qtcreator-1.3.83\mingw\
      4. Import qml demo. See the video

      2010-05-05

      What is BSP?

      "I think you're referring to the 'Board Support Package'. This usually refers to the OS, and the board-specific drivers in the OS. The BSP is the first thing that must be built in order for an embedded system to work."

      PsTools

      "PsExec is a light-weight telnet-replacement that lets you execute processes on other systems, complete with full interactivity for console applications, without having to manually install client software. PsExec's most powerful uses include launching interactive command-prompts on remote systems and remote-enabling tools like IpConfig that otherwise do not have the ability to show information about remote systems. "
       Reference
      http://technet.microsoft.com/en-gb/sysinternals/bb897553.aspx

      2010-05-04

      Patch on Wrong Version Kernel

      Reversed (or previously applied) patch detected!  Assume -R? [n]

      Above is a common error message when people tried to patch the kernel source. The reason is that you applied the patch on a kernel of wrong version.
      Here is a patched version of linux kernel published by www.kernel.org. For instance, you are going to download 2.6.33.3 kernel source. You have two choices,
      1. Download Full Source. No extra patching is required.
      2. Download Patch und patch on your 2.6.33

      For the second choice, if you try to run patch on the other version. for example 2.6.33.3.  The error shown above will appear. Correct commands are below.

      >tar xzfv linux-2.6.33.tar.gz
      >bunzip2 patch-2.6.33.3.bz2
      >cd linux-2.6.33
      >patch -p1<../patch-2.6.33.3

      Reference:

      2010-05-03

      Window Manager

      Tiling window manager is a window manager with an organization of the screen into mutually non-overlapping frames.
       awesome



      Stacking window manager is a window manager that draws all windows in a specific order, allowing them to overlap, using a technique called painter's algorithm.
      FVWM

      Compositing window manager differentiate from other window managers is that instead of outputting to a common screen, programs each output first to a separate and independent buffer, or temporary location inside the computer, where they can be manipulated before they are shown.
       Compiz

      Reference

      2010-05-02

      Link error during build Qt 4.6.2

      Max encounter the following link error, as he tried to build Qt 4.6.2 with a angstrom toolchain for mini2440 ARM9 board:

      /usr/bin/ld: .obj/release-shared/harfbuzz-buffer.o: Relocations in generic ELF (EM: 40)
      .obj/release-shared/harfbuzz-buffer.o: could not read symbols: File in wrong format
      collect2: ld returned 1 exit status

      After a short analysis, he found out that it supports to be the problem of crossing compiler toolchain.

      >ls -al /usr/bin/gcc
      lrwxrwxrwx 1 root root 63 2009-10-27 20:35 /usr/bin/gcc -> /usr/bin/gcc-4.1
      Here is quick solution, but there may exists better solution.
      >rm /usr/bin/gcc
      >ln -s /opt/toolchains/arm920t-eabi/arm-angstrom-linux-gnueabi/bin/gcc /usr/bin/gcc
      The reconfigure and build everything
      >make confclean
      >./configure -embedded arm -xplatform qws/linux-arm-g++ -depths 16 -qt-mouse-tslib
      >make
      >make install