LinkShare rotating banner
Showing posts with label tutorial. Show all posts
Showing posts with label tutorial. Show all posts

Tuesday, October 16, 2012

Setting Up XDM on Debian/Ubuntu Linux

XDM, short for X Display Manager, is my favorite login manager for its simplicity. Sure, gdm and kdm are visually pleasant, but why do I have to install all the dependencies if xdm provides the same functionality as them? After all, xdm can launch GNOME and KDE for you — you just need to fix your ~/.xsession file. This post will serve as my notes on installation, configuration and customization of xdm.



All configuration of xdm, except for distribution-specific settings, is done by modifying the files in the /etc/X11/xdm directory. For now, I'll just go over what I have in my xdm files.



/etc/X11/xdm/Xaccess



This file is used to tell xdm who can use xdm. Therefore, if you are happy to let anyone access the X-Windows desktop locally or remotely, then you would just put an asterisk (*) in Xaccess as I did.



*


If you are very keen on security, you would put only the following in Xaccess. This only allows local users to have access to xdm.



localhost
127.0.0.1


However, even if Xaccess is set up as above, remote xdm login may still be possible with SSH X11 forwarding.



/etc/X11/xdm/Xresources



Xresources file is used to fine-tune the behavior and appearance of XDM. Here is what I put in my Xresources file:



Xcursor.theme: redglass

xlogin*login.translations: #override \
Ctrl<Key>R: abort-display()\n\
<Key>F1: set-session-argument(failsafe) finish-field()\n\
<Key>Delete: delete-character()\n\
<Key>Left: move-backward-character()\n\
<Key>Right: move-forward-character()\n\
<Key>Home: move-to-begining()\n\
<Key>End: move-to-end()\n\
Ctrl<Key>KP_Enter: set-session-argument(failsafe) finish-field()\n\
<Key>KP_Enter: set-session-argument() finish-field()\n\
Ctrl<Key>Return: set-session-argument(failsafe) finish-field()\n\
<Key>Return: set-session-argument() finish-field()

xlogin*greeting: Welcome to CLIENTHOST
xlogin*namePrompt: Login:\040
xlogin*passwdPrompt: Password:\040
xlogin*fail: Login incorrect

xlogin*greetFace: Serif-21:bold:italic
xlogin*face: Sans-15
xlogin*promptFace: Sans-15:bold
xlogin*failFace: Sans-16:bold

xlogin*geometry: 600x400
xlogin*borderWidth: 1
xlogin*frameWidth: 5
xlogin*innerFramesWidth: 2
xlogin*shdColor: grey30
xlogin*hiColor: grey90
xlogin*background: grey
xlogin*greetColor: Blue3
xlogin*failColor: red
*Foreground: black
*Background: #fffff0

xlogin*logoFileName: /usr/share/X11/xdm/pixmaps/penguin_doll_200x300.xpm
xlogin*useShape: true
xlogin*logoPadding: 10


I think the settings are self-explanatory. This is how xdm would look with the above settings. The penguin image was taken from here.



xdm-screenshot

/etc/X11/xdm/Xresources



The Xresources file allows you to specify how many X servers to run and their command arguments. In my case, I run Xorg and Xvfb. Xorg is the standard X server, and Xvfb is a server that runs totally in memory without depending on the video hardware. To see what's going on with Xvfb, I use x11vnc and gvncviewer.



# Default X.org server
:0 local /usr/bin/Xorg :0 vt7 -br -dpi 96 -nolisten TCP

:1 local /usr/local/bin/Xvfb :1 -dpi 96 -screen 0 1024x768x16


/etc/X11/xdm/Xsetup



Xsetup allows you to write any command to run when xdm displays the login screen. In my case, I run gm to set up the background image and run x11vnc to remotely access Xvfb via VNC.



#!/bin/sh
#
# This script is run as root before showing login widget.

gm display -window root /usr/share/wallpapers/Board_Tile_Gray.jpg
xkbcomp -dflts -I/usr/share/X11/xkb /etc/X11/xkb/server-0.xkm $DISPLAY

PID_XVFB=$(pidof Xvfb)
PID_X11VNC=$(pidof x11vnc)
if [ -n "$PID_XVFB" -a -z "$PID_X11VNC" ]; then
x11vnc -display :1 -bg -xkb -nopw -nc_cr -forever -listen localhost -auth $(find /var/lib/xdm/authdir/authfiles -name \*:1\*) > /var/log/x11vnc.log 2>&1
fi


/etc/X11/xdm/xdm-config



In xdm-config, there is only one line that I bother to change. This line enables remote xdm logins.



! SECURITY: do not listen for XDMCP or Chooser requests
! Comment out this line if you want to manage X terminals with xdm
DisplayManager.requestPort: 177


/etc/X11/xdm/xdm-options



I think xdm-options is Debian specific. I don't think I made any change in this file.



# configuration options for xdm
# See xdm.options(5) for an explanation of the available options.

no-ignore-nologin
no-restart-on-upgrade
no-start-on-install
use-sessreg


Resetting XDM



There are other files in /etc/X11/xdm directory that you can safely leave as is. After you make any change with the files, have xdm reread the config files.



kill -1 $(pidof xdm)


If you want to force xdm to kill all running sessions and restart, enter the following command.



/etc/init.d/xdm restart


That's all I have to write about xdm for now. In summary, xdm is a simple, yet functional login manager that is easy to set up.

Monday, October 15, 2012

Linux: Transmitting a Bunch of Files using socat

computer

socat is a nifty, versatile tool for establishing a secure data channel between two computers. To install socat on Debian, use apt-get:



apt-get install socat


I was trying to use socat and tar to duplicate the contents of an entire filesystem securely between two computers. In this case, I copied all files in partition /dev/sda5 on box A to partition /dev/sdb6 on box B (IP 192.168.200.83).



Using the SCTP protocol



This method does not involve encryption, so it is relatively simple to follow.




  1. First, I opened a terminal at box B (192.168.200.83) and changed the current directory to /mnt/sdb6 where I will unpack the incoming stream of files.


    cd /mnt/sdb6

    Then, I typed the following command to have socat establish a SCTP connection listening on port 7749. tar would be expecting to receive incoming files.


    socat EXEC:"tar xzf -" SCTP4-LISTEN:7749

  2. Then, I opened a terminal at box A. Here I would transmit a bunch of files to box B (192.168.200.83). I changed directory to /mnt/sda5 containing files to send.


    cd /mnt/sda5

    Then, I typed the following command to transmit all the files in the current directory.


    socat EXEC:"tar czf - ." SCTP4-CONNECT:192.168.200.83:7749



Using the SSL connection



This method involves encrypted connection and requires SSL certicates on both sides of the link. Read this post to learn how to create self-signed SSL certificates if you don't already have one.




  1. Debian and Ubuntu automatically create a local SSL certificate at /etc/ssl/certs/ssl-cert-snakeoil.pem. Both parties of an SSL connection — box A and box B — should exchange each other's ssl-cert-snakeoil.pem in order to have SSL connections between them.



  2. On box B, I typed the following command to run socat in SSL listening mode at port 7749.

    cd /mnt/sdb6
    socat EXEC:"tar xzf -" OPENSSL-LISTEN:7749,reuseaddr,cert=/etc/ssl/certs/ssl-cert-snakeoil.pem,key=/etc/ssl/private/ssl-cert-snakeoil.key,cafile=box-A.pem


  3. On box A, I typed the following command to run socat in SSL mode while running tar to pack all the files and send them through the pipeline.

    cd /mnt/sda5
    socat EXEC:"tar czf - ." OPENSSL:192.168.200.83:7749,cert=/etc/ssl/certs/ssl-cert-snakeoil.pem,key=/etc/ssl/private/ssl-cert-snakeoil.key,cafile=box-B.pem




Thus I have duplicated the whole directory tree from Box A to Box B. Using socat and tar, I was able to mirror a filesystem over the network. As shown above, socat alone can be a good substitute in situations where ssh, scp and/or netcat are needed. socat has many other features I have yet to explore.

Monday, October 8, 2012

Linux: Building X.org Kdrive Server Xfbdev on Debian Wheezy

Kdrive is a minimal X11 server that runs as a single executable with little dependencies. I use Kdrive for my Web-only/Rescue Linux systems. Before compiling Kdrive, I installed the following packages on my box running Debian Sid — which will be eventually rolled into Wheezy release:



  • bison

  • g++-4.7

  • libexpat1-dev

  • libpciaccess-dev

  • libpixman-1-dev

  • libssl-dev

  • libudev-dev
  • libxdamage-dev

  • libxfont-dev

  • libxi-dev

  • libxkbfile-dev

  • libxmu-dev

  • libxxf86vm-dev

  • make

  • pkg-config

  • x11proto-bigreqs-dev

  • x11proto-composite-dev

  • x11proto-randr-dev

  • x11proto-render-dev

  • x11proto-resource-dev

  • x11proto-scrnsaver-dev

  • x11proto-video-dev

  • x11proto-xcmisc-dev

  • x11proto-xf86dga-dev

  • x11proto-xinerama-dev

  • xkb-data



Installing X Protocol Headers



The current RandR protocol headers from Debian didn't meet the required version, so I had to download the latest one from freedesktop.org. I installed randrproto like this.



tar xjvf randrproto-1.4.0.tar.bz2
cd randrproto-1.4.0
./configure --prefix=/usr
make install


Compiling Xfbdev



I got the latest X.org release from freedesktop.org. The following commands will build Xfbdev:



tar xjf xorg-server_1.13.0.tar.bz2

cd xorg-server-1.13.0/

./configure --prefix=/usr --disable-xorg --enable-kdrive --enable-kdrive-evdev --enable-config-udev --disable-aiglx --disable-glx --disable-dri --disable-dri2 --disable-drm --disable-record --with-xkb-path=/usr/share/X11/xkb --with-xkb-output=/var/lib/xkb --with-xkb-bin-directory=/usr/bin --with-default-xkb-rules=xorg --with-default-xkb-model=pc105 --with-default-xkb-layout=us

make

make install


Installed Files



The following files are installed after successfully building a Kdrive server.


/usr/bin/Xfbdev

/usr/bin/Xnest

/usr/bin/Xvfb

/usr/lib/xorg/protocol.txt

/usr/share/man/man1/Xnest.1

/usr/share/man/man1/Xserver.1

/usr/share/man/man1/Xvfb.1

/var/lib/xkb/README.compiled


To Use Xfbdev



An executable file Xfbdev will be created in /usr/bin. To be able to use the Xfbdev server, framebuffer video must be enabled either in the kernel or as a module. If CONFIG_FB_VESA option was enabled in the kernel, you can use the syslinux bootloader in the following way to boot Linux into a framebuffer video mode:



LABEL minimal
KERNEL vmlinuz-2.6.31.5
INITRD initramfs.lzma
APPEND vga=0x314 video=vesafb:mtrr


Once the framebuffer video has been activated, Xfbdev can be started in the following way:



Xfbdev :0 vt7 dpms -ac -br +bs -dpi 96 -mouse evdev,5,device=/dev/input/event2 -2button -keybd evdev,,device=/dev/input/event3 -fp /usr/local/share/fonts,/usr/share/fonts/X11/Type1,/usr/share/fonts/truetype/ttf-dejavu -nolisten TCP


Download my X.org build 1.13.0



Download

Here you can obtain my compiled binaries Xfbdev, Xnest and Xvfb:





Also Read:



Friday, October 5, 2012

Using GraphicsMagick to Set the Background

GraphicsMagick is a powerful graphics tool that can be used to set the background on Linux. I've been using xsetbg from the xloadimage package to set X-Windows background. However, I realized that GraphicsMagick can replace xloadimage and netpbm that I've used for setting background and converting images.



So far I just learned a few tricks for setting background with GraphicsMagick. To tile an image on the background, type a command like this:



gm display -window root background.jpg


To fill the background with an image smaller than the screen size, use the -geometry option:



gm display -window root -geometry 1440x960 Background.jpg


You can also use the percentage (%) sign to zoom in or out the image and place it on the background.



gm display -window root -geometry 300x200% background.jpg


You can add the -gamma option to darken or brighten the image. If gamma is less than 1, the output image will be darker. If gamma is greater than 1, the image will be brighter.



gm display -window root -gamma 0.5 BG_pix.jpg


There are many more options that you can use with GraphicsMagick, for example, -crop, -dither, -trim etc. Read the manual page of GraphicsMagick and documentation for further information.

Thursday, September 20, 2012

Compile Aria2 1.15.2 with MinGW

Aria2 is a command-line download utility. It can be used to download files quickly from http(s), ftp, bittorrent, magnet and metalink locations. I prefer this handy tool over other programs, such as Free Download Manager and Frostwire because it's lean, fast and full of features. It took me a couple of days to compile Aria2 with all the features available. The following step-by-step guide will help you build your own aria2 program (aria2c.exe) the way I did.







  1. Install MinGW

    Follow one of the following guides to install MingW:




  2. POSIX Threads

    Download the source for Pthreads library (pthreads-w32-2-9-1-release.tar.gz) and compile it like this:


    make clean GC-static
    cp pthread.h semaphore.h sched.h /mingw/include/
    cp libpthreadGC2.a /mingw/lib/libpthread.a


  3. zlib

    Zlib is needed by the OpenSSL library below. Download the zlib source and compile it like this:


    make -f win32/Makefile.gcc
    make -f win32/Makefile.gcc install BINARY_PATH=/mingw/bin INCLUDE_PATH=/mingw/include LIBRARY_PATH=/mingw/lib


  4. OpenSSL

    Aria2 requires either GnuTLS or OpenSSL for secure transfers. In this guide, OpenSSL is chosen over GnuTLS. Use 7-zip to unpack the tarball because it contains symbolic links.


    ./Configure -DHAVE_STRUCT_TIMESPEC -DPTW32_STATIC_LIB -L/mingw/lib -lz -lpthread -lws2_32 --prefix=/mingw threads zlib mingw
    make
    make install


  5. Expat


    Aria2 can use either LibXML2 or Expat for XML parsing. In this guide, Expat will be used. Download the expat source and compile expat like this:


    ./configure --build=i686-w64-mingw32 --prefix=/mingw --disable-shared --enable-static
    make
    make install


  6. C-Ares


    C-Ares is a C library that performs DNS requests and resolves DNS names asynchronously. Download the C-ares source from c-ares.haxx.se and unpack it. Then, compile C-Ares as follows:


    ./configure --build=i686-w64-mingw32 --prefix=/mingw --disable-shared CPPFLAGS='-I/mingw/include -DCARES_STATICLIB'
    make
    make install


  7. SQLite 3


    Download the SQLite source (sqlite-amalgamation-3071300.zip) and build SQLite 3:


    gcc -O2 -DNDEBUG=1 -DTHREADSAFE=1 -c *.c
    ar ru /mingw/lib/libsqlite3.a sqlite3.o
    cp -iv *.h /mingw/include

    Create sqlite3.pc and put it in /mingw/lib/pkgconfig.


    prefix=/mingw
    exec_prefix=${prefix}
    libdir=${exec_prefix}/lib
    includedir=${prefix}/include

    Name: SQLite
    Description: SQL database engine
    Version: 3.5

    Libs: -L${libdir} -lsqlite3
    Cflags: -I${includedir}


  8. aria2c


    Finally, we are ready to compile Aria2. Download the Aria2 source from aria2.sf.net and unpack the source. Then, configure aria2 as follows:


    ./configure --build=i686-w64-mingw32 --prefix=/mingw --enable-threads=posix --with-ca-bundle=ca-bundle.crt --disable-nls LIBS='-lpthread -lws2_32 -lcares -lz' CPPFLAGS='-DPTW32_STATIC_LIB -DCARES_STATICLIB'


    aria2_config

    Then, issue the following commands to compile Aria2:


    make
    make install


  9. Optionally, strip and compress the executable aria2c.exe.

    strip aria2c.exe
    upx --best --strip-relocs=0 aria2c.exe



To download my Windows builds of aria2, go here.



Aria2c Usage


aria2c --file-allocation=prealloc ftp://192.168.1.64/pardus.iso

If aria2 aborts a download due to a connection error, you can resume the download any time using aria2c like this:


aria2c -c ftp://192.168.1.64/pardus.iso

To download files from URL's written in a file urls.txt to a folder Downloads, run aria2 as follows. The urls.txt should contain one download per line with URL's seperated by a tab:


aria2c -i urls.txt -d Downloads

Wednesday, September 5, 2012

To Compile ffmpeg with MinGW

ffmpeg is an important component of many open-source projects, such as MPlayer and VLC. I am compiling ffmpeg so that I can use it to transcode multimedia files. This guide shows how to use MinGW to compile ffmpeg either statically or dynamically. Installation of MinGW is explained in this post. The example commands below are meant to be entered into an MSYS window (not Command Prompt). I downloaded the FFmpeg source and unpacked it.



Preparing External Libraries for FFMpeg


FFMpeg can be linked with external libraries to add features to FFmpeg. I am adding most features to FFMpeg by compiling additional libraries. Most of these libraries are also covered in my posts on compiling MPlayer and Mencoder.




  1. Compression Libraries: Zlib and bzLib

    Get the zlib source (zlib127.zip), unzip and compile it:

    unzip zlib127.zip
    cd zlib-1.2.7/
    make -f win32/Makefile.gcc
    cp -iv zlib1.dll /mingw/bin
    cp -iv zconf.h zlib.h /mingw/include
    cp -iv libz.a /mingw/lib
    cp -iv libz.dll.a /mingw/lib


    Optionally, get bzip2 source from bzip.org and compile it like this:


    tar xzvf bzip2-1.0.6.tar.gz
    cd bzip2-1.0.6
    make
    cp bzlib.h /mingw/include/
    cp libbz2.a /mingw/lib


  2. libgsm

    Download gsm-1.0.13.tar.bz2, unpack and compile it as follows:

    tar xzvf gsm-1.0.13.tar.bz2
    cd gsm-1.0-pl13/
    make

    Just ignore the compile errors with fchmod and fchown when trying to build applications. Copy the header and static library to /mingw:


    mkdir /mingw/include/gsm
    cp inc/gsm.h /mingw/include/gsm
    cp lib/libgsm.a /mingw/lib


  3. LAME is an excellent MP3 encoder. LAME makes use of the nasm assembler if available. So download yasm and save it as /mingw/bin/nasm.exe. Then, download the LAME source from lame.sf.net and compile it like this.

    ./configure --prefix=/mingw --enable-expopt=full

    make

    make install


  4. OGG, Vorbis, Speex and Theora

    The source code for these libraries can be obtained from xiph.org. Compile them each like this:


    ./configure --prefix=/mingw
    make
    make install

    As for speex, use the version 1.2rc1 or later.



  5. FAAC

    FAAC is an MPEG-4 AAC audio encoder. Get the source (faac-1.28.tar.gz) and unpack the package. Then, edit Makefile.am:

    SUBDIRS = include libfaac

    Also, edit the line beginning with AC_OUTPUT in the file configure.in:

    AC_OUTPUT(libfaac/Makefile include/Makefile Makefile)

    Then, compile FAAC like this

    sh bootstrap
    ./configure --prefix=/mingw
    make
    make install


  6. XviD is a popular video encoder used to create movie files distributed in p2p networks. Xvid can use yasm assembler to build optimized binaries if found (/mingw/bin/yasm.exe). Get the XviD source from xvid.org and compile as follows:

    tar xzvf xvidcore-1.3.2.tar.gz
    cd xvidcore/build/generic
    ./configure --prefix=/mingw
    make
    make install


    If you encounter "unrecognized command-line option -mno-cygwin" errors, open the file platform.inc in a text editor and delete "-mno-cygwin". Then, run make and make install again.



    Copy the import library for xvidcore.dll:


    cp -iv \=build/xvidcore.dll.a /mingw/lib/libxvidcore.a


  7. x264 is yet another good video encoder. x264 requires YASM to build an optimized executable. So get yasm and save it as /mingw/bin/yasm.exe. Then, compile x264 like this:

    configure --prefix=/mingw --enable-win32thread --extra-cflags="-DX264_VERSION=20100422"

    make

    make install

    cp -iv x264.h x264_config.h /mingw/include

    cp -iv libx264.a /mingw/lib

    cp -iv x264.pc /mingw/lib/pkgconfig


  8. Compile librtmp as shown in this post.



Building FFMpeg Statically


You need pr.exe from MYS coreutils package (coreutils-5.97-3-msys-1.0.13-ext.tar.lzma). I configured ffmpeg with the following command:


CPPFLAGS='-DHAVE_INT32_T' ./configure --prefix=/mingw --enable-gpl --enable-nonfree --enable-postproc --enable-avfilter --enable-w32threads --enable-runtime-cpudetect --enable-memalign-hack --enable-bzlib --enable-libfaac --enable-libgsm --enable-libmp3lame --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-zlib --disable-debug

-DHAVE_INT32_T is used to allow static FAAC to be linked. Then, I began compilation and installation:


make
make install


Compiling FFmpeg Dynamically


Some Windows applications, such as Audacity, uses FFmpeg libraries when available. If you want to compile FFmpeg dynamically, append --enable-shared --disable-static to the ./configure command for FFmpeg.


./configure --prefix=/mingw --enable-gpl --enable-nonfree --enable-postproc --enable-avfilter --enable-w32threads --enable-runtime-cpudetect --enable-memalign-hack --enable-bzlib --enable-libfaac --enable-libgsm --enable-libmp3lame --enable-librtmp --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-zlib --enable-shared --disable-static --disable-debug


If you get "int32_t" error when compiling libfaac.o, open /mingw/include/faac.h and insert the following line:


#include <stdint.h>


When I built mplayer with --enable-static and --disable-ffmpeg_a options to force linking with shared ffmpeg libraries, I had to rename ffmpeg libraries so their names end in *.a.


cd /mingw/lib
cp -iv libavcodec.dll.a libavcodec.a
cp -iv libavformat.dll.a libavformat.a
cp -iv libavutil.dll.a libavutil.a
cp -iv libpostproc.dll.a libpostproc.a
cp -iv libswscale.dll.a libswscale.a

Tuesday, August 28, 2012

Manually Creating initrd / initramfs to Boot Linux

Initrd and initramfs files are used together with a Linux kernel and a bootloader (such as GRUB and syslinux) to start up Linux and boot it in many different ways. Many Linux distributions provide prepackaged kernels and convenient tools for creating initramfs, but I like to build my own kernel and initramfs because it allows me to customize the boot process. For instance, one can choose to boot from the local disk or network-mounted disk with the help of initramfs and some user-defined boot parameters. Here's a list of things that I'd like to achieve with my custom initramfs.




  1. Boot from a live CD
  2. Boot from a read-only filesystem image, compressed with SquashFS
  3. Copy the filesystem image to a RAM disk and run Linux entirely on memory
  4. Boot Linux from a USB flash drive or a Firewire disk
  5. Boot Linux from a local disk partition
  6. Boot Linux from a network drive
  7. Run a rescue shell without booting Linux
  8. Start a kdrive X-server and run gparted, partclone or partimage


In this post, I show how I normally create initrd / initramfs files. For this tutorial, the following Debian/Ubuntu packages are needed:




  • busybox

    provides small essential utilities for booting and rescue shell.
  • cpio

    is used to create the actual initramfs format.
  • dash

    provides a minimalist shell for running the init script and the rescue shell.
  • e2fsprogs, jfsutils, etc.

    provides fsck to check Linux filesystems and replay any stale journal
  • lzma or xz-utils

    compresses the initramfs
  • module-init-tools

    is used to load kernel modules necessary to activate hardware and mount the filesystem
  • pciutils

    is used to detect PCI hardware
  • unionfs-fuse

    makes it possible to use read-only Linux systems, such as live CD and filesystem images
  • unzip

    is used to apply customized settings and changes to the unionfs boot mode
  • v86d

    is used to set the screen resolution for the framebuffer screen


First, create a text file with a list of files to put in initramfs. The following is an example of such file:



bin/busybox
bin/dash
bin/mount
etc/filesystems
etc/fuse.conf
etc/group
etc/modprobe.d
lib/ld-linux.so.2
lib/libacl.so.1
lib/libattr.so.1
lib/libblkid.so.1
lib/libbz2.so.1.0
lib/libcom_err.so.2
lib/libc.so.6
lib/libdl.so.2
lib/libe2p.so.2
lib/libext2fs.so.2
lib/libfuse.so.2
lib/libkmod.so.2
lib/libmount.so.1
lib/libm.so.6
lib/libpci.so.3
lib/libpthread.so.0
lib/libresolv.so.2
lib/librt.so.1
lib/libselinux.so.1
lib/libsepol.so.1
lib/libuuid.so.1
lib/libx86.so.1
lib/libz.so.1
lib/modules/3.5.3/kernel/drivers/ata
lib/modules/3.5.3/kernel/drivers/block/loop.ko
lib/modules/3.5.3/kernel/drivers/cdrom/cdrom.ko
lib/modules/3.5.3/kernel/drivers/connector/cn.ko
lib/modules/3.5.3/kernel/drivers/firewire/firewire-core.ko
lib/modules/3.5.3/kernel/drivers/firewire/firewire-ohci.ko
lib/modules/3.5.3/kernel/drivers/firewire/firewire-sbp2.ko
lib/modules/3.5.3/kernel/drivers/i2c/algos/i2c-algo-bit.ko
lib/modules/3.5.3/kernel/drivers/scsi/sd_mod.ko
lib/modules/3.5.3/kernel/drivers/scsi/sr_mod.ko
lib/modules/3.5.3/kernel/drivers/usb/host/ehci-hcd.ko
lib/modules/3.5.3/kernel/drivers/usb/host/ohci-hcd.ko
lib/modules/3.5.3/kernel/drivers/usb/host/uhci-hcd.ko
lib/modules/3.5.3/kernel/drivers/usb/storage/usb-storage.ko
lib/modules/3.5.3/kernel/drivers/video
lib/modules/3.5.3/kernel/fs/ext3/ext3.ko
lib/modules/3.5.3/kernel/fs/ext4/ext4.ko
lib/modules/3.5.3/kernel/fs/fat/fat.ko
lib/modules/3.5.3/kernel/fs/fat/vfat.ko
lib/modules/3.5.3/kernel/fs/fuse/fuse.ko
lib/modules/3.5.3/kernel/fs/isofs/isofs.ko
lib/modules/3.5.3/kernel/fs/jbd2/jbd2.ko
lib/modules/3.5.3/kernel/fs/jbd/jbd.ko
lib/modules/3.5.3/kernel/fs/jfs/jfs.ko
lib/modules/3.5.3/kernel/fs/nls/nls_cp437.ko
lib/modules/3.5.3/kernel/fs/nls/nls_iso8859-1.ko
lib/modules/3.5.3/kernel/fs/nls/nls_utf8.ko
lib/modules/3.5.3/kernel/fs/reiserfs/reiserfs.ko
lib/modules/3.5.3/kernel/fs/squashfs/squashfs.ko
lib/modules/3.5.3/kernel/fs/xfs/xfs.ko
lib/modules/3.5.3/kernel/lib/crc16.ko
lib/modules/3.5.3/kernel/lib/crc-t10dif.ko
lib/modules/3.5.3/modules.dep
lib/modules/3.5.3/modules.dep.bin
lib/modules/3.5.3/modules.pcimap
sbin/blkid
sbin/e2fsck
sbin/jfs_fsck
sbin/modprobe
sbin/v86d
usr/bin/pcimodules
usr/bin/unionfs-fuse
usr/bin/unzip


Then, create an empty directory, for example, /tmp/initrd and copy the files listed in the above-mentioned text file (called rd354.txt) to the new directory.



mkdir /tmp/initrd
cd /
tar cvhf - -T rd354.txt | (cd /tmp/initrd; tar xf -)


Then, create the necessary directory structure under /tmp/initrd:



cd /tmp/initrd
mkdir -p dev media mnt proc root sys tmp


Since I chose to use busybox, I need to create symbolic links to busybox in /bin. Busybox provides incomplete functionality for modprobe, mount, sh and unzip, so I removed their symbolic links.



cd /tmp/initrd/bin
for f in $(./busybox --list); do [ -e $f ] || ln -s busybox $f ; done
rm modprobe unzip


Then, create essential device nodes in /tmp/initrd/dev:



cd /tmp/initrd/dev
MAKEDEV std fb0 fd0 sda sdb scd
mknod console c 5 1
mknod fuse c 10 229
chmod 666 fuse


Now, create an init script. The contents of this init script is crucial for customization of the boot process. The following is the script I use. This script is capable of booting a live CD and running Linux within memory in addition to booting Linux from hard drives and USB flash.



#!/bin/dash

# Define a function to parse kernel command line options.
get_opt() {
echo $@ | cut -d "=" -f 2
}

# Define a function to load drivers.
loadmod() {
for i in $@ ; do
for j in $(grep $i /tmp/pcimodules.txt); do
modprobe $j
done
done
}

# Define a function to guess the partition type.
gpart() {
for i in $(blkid | grep $1); do
case $i in
*\=*)
eval $i
;;
*)
true
;;
esac
done
}

# Define a function for mounting the root partition.
mountr() {
if [ $uuid ]; then
if [ $# = 2 ]; then
mount -r -U $uuid $2
elif [ $# = 1 ]; then
mount -r -U $uuid $1
else mount -r -U $uuid /mnt
fi
elif [ $label ]; then
if [ $# = 2 ]; then
mount -r -L $label $2
elif [ $# = 1 ]; then
mount -r -L $label $1
else mount -r -L $label /mnt
fi
else
gpart $1
case $TYPE in
ext*)
e2fsck -p $1
[ $# = 2 ] && mount $1 $2 || mount $1 /mnt
;;
jfs)
jfs_fsck $1
if [ $# = 2 ]; then
mount -t jfs -o ro,iocharset=utf8 $1 $2
else mount -t jfs -o ro,iocharset=utf8 $1 /mnt
fi
;;
vfat)
if [ $# = 2 ]; then
mount -t vfat -o ro,gid=100,dmask=2,fmask=113 $1 $2
else mount -t vfat -o ro,gid=100,dmask=2,fmask=113 $1 /mnt
fi
;;
*)
[ $# = 2 ] && mount -r $1 $2 || mount -r $1 /mnt
;;
esac
fi
}

# Create a union filesystem
union() {
mount -t tmpfs none /opt/tmp
modinfo unionfs > /dev/null 2>&1 &&
mount -t unionfs -o dirs=/opt/tmp=rw:/opt=ro none /mnt ||
( mkdir /opt/tmp/.change
modprobe fuse
unionfs-fuse -o allow_other,use_ino,suid,dev,nonempty,kernel_cache \
-o cow,chroot=/opt,max_files=32768 /tmp/.change=RW:/=RO /mnt )
}

# Mount proc and sysfs.
mount -t proc none /proc
mount -t sysfs none /sys

# Find the available PCI hardware
mount -t tmpfs none /tmp
pcimodules > /tmp/pcimodules.txt

# Populate /dev (Needs kernel >= 2.6.32)
mount -t devtmpfs none /dev
mkdir -m 755 /dev/pts
mount -t devpts -o gid=5,mode=620 none /dev/pts

# Set default values
boot=ata
root=/dev/sda6

# Find the root=, label=, uuid= and boot= values on kernel command line.
for i in $(cat /proc/cmdline); do
case $i in
root\=*)
root=$(get_opt $i)
case $root in
/dev/cdr* | /dev/dvd* | /dev/sr* | /dev/scd*)
boot=cdrom
;;
0x200)
root=/dev/fd0
;;
esac
;;
label\=* | uuid\=* | boot\=* | vmode\=* )
eval $i
;;
single)
RUNLEVEL=single
;;
nox)
RUNLEVEL=2
;;
esac
done

# Activate framebuffer display devices.
if [ $vmode ]; then
if [ $boot = cdrom ]; then
modprobe uvesafb scroll=ywrap mode_option=$vmode-16
else for i in $(grep fb /tmp/pcimodules.txt); do
case $i in
atyfb)
modprobe $i mode=$vmode-16
;;
nvidiafb | rivafb)
modprobe nvidiafb mode_option=$vmode bpp=16 hwcur=1
;;
radeonfb | savagefb)
modprobe $i mode_option=$vmode-16
;;
sisfb)
modprobe $i mode=$vmodex16 mem=12288 font=SUN12x22
;;
viafb | vt8623fb)
modprobe viafb viafb_mode=$vmode viafb_bpp=16
;;
*)
modprobe $i
;;
esac
done
if grep -q i915 /tmp/pcimodules.txt; then true
else [ -c /dev/fb0 ] || modprobe uvesafb scroll=ywrap mode_option=$vmode-16
fi
fi
fi

case $boot in
cdrom)
# Boot Linux from a live CD.
loadmod ata_ ahci pdc_adma ^.hci-hcd
modprobe usb-storage &&
modprobe sr_mod &&
sleep 7
modprobe isofs
mount -t iso9660 /dev/sr0 /media
[ -d /media/isolinux -o -d /media/boot/isolinux ] ||
mount -t iso9660 /dev/sr1 /media
if [ -f /media/*.[Ss][Qq]* ]; then
SQF=$(ls -t /media/*.[Ss][Qq]* | head -n 1)
if [ $root = /dev/ram ]; then
echo "Please wait until the RAM disk is ready."
dd if=$SQF of=/dev/ram1 bs=2048 &&
mount -t squashfs /dev/ram1 /opt
else modprobe loop
mount -t squashfs -o loop $SQF /opt
fi
else
mount --move /media /opt
fi
union
;;
loop)
# Boot Linux from an image file.
loadmod ata_ ahci pdc_adma ^.hci-hcd
modprobe usb-storage &&
modprobe sd_mod &&
sleep 7
mountr $root /media
modprobe loop
if [ -f /media/*.[Ss][Qq]* ]; then
SQF=$(ls -t /media/*.[Ss][Qq]* | head -n 1)
mount -t squashfs -o loop $SQF /opt
elif [ -f /media/*.[Ii][Ss][Oo] ]; then
ISO=$(ls -t /media/*.[Ii][Ss][Oo] | head -n 1)
modprobe isofs
mount -t iso9660 -o loop $ISO /opt
fi
union
;;
ram)
# Boot Linux from ramdisk.
loadmod ata_ ahci pdc_adma ^.hci-hcd
modprobe usb-storage &&
modprobe sd_mod &&
sleep 7
mountr $root /media
echo "Please wait until the RAM disk is ready."
if [ -f /media/*.[Ss][Qq]* ]; then
SQF=$(ls -t /media/*.[Ss][Qq]* | head -n 1)
dd if=$SQF of=/dev/ram1 &&
mount -t squashfs /dev/ram1 /opt
elif [ -f /media/*.[Ii][Ss][Oo] ]; then
ISO=$(ls -t /media/*.[Ii][Ss][Oo] | head -n 1)
dd if=$ISO of=/dev/ram1 bs=2048 &&
modprobe isofs
mount -t iso9660 /dev/ram1 /opt
fi
union
;;
usb*)
# Boot Linux from a USB drive.
loadmod ^.hci-hcd
modprobe usb-storage &&
modprobe sd_mod &&
sleep 7
mountr $root
;;
ata*)
loadmod ata_ ahci pdc_adma &&
modprobe sd_mod &&
mountr $root
;;
esac

# Make sure that init exists and is executable.
if [ -x /mnt/sbin/init ]; then
mount --move /dev /mnt/dev
mount --move /proc /mnt/proc
mount --move /sys /mnt/sys
umount /tmp

# Start init from the root filesystem.
cd /mnt
[ -f /media/updates.zip ] && unzip -o /media/updates.zip
case $boot in
cdrom)
[ $root = /dev/ram ] && umount /media
[ $RUNLEVEL ] || RUNLEVEL=3
;;
loop | ram)
umount /media
[ $RUNLEVEL ] || RUNLEVEL=3
;;
*)
[ $RUNLEVEL ] || RUNLEVEL=5
;;
esac
[ -d initrd ] && pivot_root . initrd
exec chroot . /sbin/init $RUNLEVEL
fi

# Start a shell as a last resort.
echo "Error booting from the root filesystem. Starting a shell."
exec /bin/dash


Copy the init script to the initrd folder (Assuming its filename is init.sh).



cp init.sh /tmp/initrd/init
cp init.sh /tmp/initrd/etc
chmod 775 /tmp/initrd/init


Now, use cpio and lzma to create an initramfs file. This assumes that the kernel was compiled with CONFIG_RD_LZMA option enabled.



cd /tmp/initrd
find . | cpio -H newc -o | lzma -c > ../initram.lzm


A file named initram.lzm will be created. If you want to create an old-style initrd file instead, use the mkcramfs command. This assumes your kernel has built-in cramfs support (CONFIG_CRAMFS):



mkcramfs /tmp/initrd /boot/initrd.bin


Copy the kernel and the initramfs file to your boot directory (whereever it is). I use SYSLINUX which I installed at /dev/sda1 partition. Finally, edit the boot configuration file. The following is the contents of a sample syslinux.cfg:



LABEL debian
KERNEL 314.lnx
INITRD /initrd/initram.lzm
APPEND root=/dev/sda7

LABEL sid
KERNEL 314.lnx
INITRD /initrd/initram.lzm
APPEND boot=usb label=SID edd=off vmode=800x600

LABEL bfile
KERNEL 314.lnx
INITRD /initrd/initram.lzm
APPEND boot=loop root=/dev/sda1

LABEL ram
KERNEL 314.lnx
INITRD /initrd/initram.lzm
APPEND boot=ram ramdisk_size=524288 root=/dev/sda1

Monday, May 31, 2010

Compiling GTK+ for Windows with MinGW

GTK+ is a set of open-source widget libraries that are mature, functional and portable. GTK+ library is mainly used by many Linux programs. I am building a complete stack of GTK+ 2.x library before beginning my programming projects. This tutorial makes use of the free MinGW compiler to build GTK+.



If you haven't installed MinGW yet, read this tutorial on installing MinGW in Windows. Alternatively, you can also install MinGW Portable on your USB flash drive so you can enjoy compiling anywhere. GTK+ depends on many basic libraries that provide image, localization, font and other functions. These prerequisite libraries have be compiled first. Once you've installed MinGW and MSYS, launch MSYS. The following steps require you to type commands into MSYS console.




  1. Zlib 1.2.7


    Zlib is an essential compression library required by png, tiff and cairo. Get the zlib source and unpack it:

    tar xzvf zlib-1.2.7.tar.gz
    cd zlib-1.2.7/

    Compile zlib like this:


    make -f win32/Makefile.gcc

    Then, manually copy the files as follows:


    cp -iv zlib1.dll /mingw/bin
    cp -iv zconf.h zlib.h /mingw/include
    cp -iv libz.a /mingw/lib
    cp -iv libz.dll.a /mingw/lib


  2. libiconv 1.14


    libiconv is a character-set conversion library, and is needed by gettext. Download the libiconv source and compile libiconv:


    ./configure --prefix=/mingw
    make
    make install


  3. gettext 0.18.1.1


    GNU gettext is a tool for localizing and translating programs. Build gettext like this:


    ./configure --prefix=/mingw --enable-threads=win32 --enable-relocatable
    cd gettext-runtime/
    make
    make install


  4. glib 2.32.4


    glib's configure script requires pkg-config.exe and msgfmt.exe in the PATH. Download the executables and save them in /mingw/bin. Remember to set the system-wide environment variable PKG_CONFIG_PATH:


    export PKG_CONFIG_PATH=/mingw/lib/pkgconfig

    glib 2.30 and later depends on libffi. Compile libffi like this:


    ./configure --prefix=/mingw && make && make install

    Then, get the glib source from ftp.gnome.org and compile glib as follows:


    ./configure --prefix=/mingw --with-threads=win32 --with-pcre=internal --disable-debug
    make
    make install


  5. ATK 2.4.0


    Download ATK from here. Compile it like this:


    ./configure --prefix=/mingw
    make
    make install


  6. libpng 1.5.12


    PNG can be compiled like this:


    ./configure --prefix=/mingw
    make
    make install


  7. Optional libraries


    The following libraries are optional, but many GTK+ packages include them. It's up to you to decide whether to compile them or not.



    As usual, compile any of them like this:


    ./configure --prefix=/mingw && make && make install


  8. Pixman 0.26.2 and Cairo 1.12.2


    Get Pixman and Cairo from cairographics.org. Compile Pixman as follows:


    ./configure --prefix=/mingw

    make

    make install

    Then, compile cairo:


    ./configure --prefix=/mingw --enable-pthread
    make
    make install


  9. Pango Library 1.30.1


    Compile Pango like this:


    ./configure --prefix=/mingw --with-included-modules=yes

    make

    make install


  10. gdk-pixbuf 2.26.2


    Download and compile gdk-pixbuf:


    ./configure --prefix=/mingw --without-libjasper --with-included-loaders=yes --disable-modules --disable-debug
    make
    make install


  11. GTK+ 2.24.11 and GTK+ 3.4.2


    At last, we are ready to compile GTK+ for Windows. I compiled GTK+ like this:


    ./configure --prefix=/mingw --with-included-immodules=ime --disable-modules --disable-debug

    make

    make install


    To test your newly compiled GTK+ library, run gtk-demo.exe or testgtk.exe.



Saturday, April 24, 2010

MinGW: To Compile Vorbis Tools

Vorbis tools include oggenc and vorbiscomment that can be used to produce Ogg-Vorbis music files. Ogg Vorbis provides people with free, open-source audio format and encoding algorithm. Because the MP3 algorithm is patented and creating MP3 exposes people to legal risks, use of the Ogg Vorbis format is a reasonable choice for legally conscious people. Besides its openness and patent-free characteristics, Ogg Vorbis offers good compression and sound quality, comparable to MP3 and AAC. Therefore, everyone is recommended to create, use and spread Ogg Vorbis music files, instead of MP3 and AAC.



To learn how to prepare a MinGW environment, read this post. Then, download the source for libogg, libvorbis and vorbis-tools from xiph.org.





To build Vorbis tools, libogg and libvorbis should be compiled first. Start the MinGW rxvt console from the Start menu. Unpack the libogg source and compile it as follows:



tar xzvf libogg-1.2.0.tar.gz
cd libogg-1.2.0/
./configure --prefix=/mingw
make
make install


libvorbis can be compiled likewise:



tar xzvf libvorbis-1.3.1.tar.gz
cd libvorbis-1.3.1/
./configure --prefix=/mingw
make
make install


Then, build vorbis-tools as follows:



tar xzvf vorbis-tools-1.4.0.tar.gz
cd vorbis-tools-1.4.0/
./configure --prefix=/mingw --disable-nls --enable-threads=win32
make
make install


When done, the following files are created in /mingw/bin:



libogg-0.dll
libvorbis-0.dll
libvorbisenc-2.dll
libvorbisfile-3.dll
oggdec.exe
oggenc.exe
ogginfo.exe
vorbiscomment.exe


Copy these files whereever you want. To create an Ogg Vorbis file from a .WAV file, use a command like this:



oggenc -q5 audio.wav


Related Posts


Sunday, April 4, 2010

윈도용 MPlayer / Mencoder 사용 및 설정

MinGW로 컴파일한 MPlayer를 시험해 보고 최적으로 설정해 보자. 다음은 내가 컴파일한 MPlayer와 Mencoder이다. bzip2.exe로 압축을 풀어야 한다(bzip2 -d mplayer.exe.bz2).





  1. DirectX 8.1 설치(Windows 95/98/ME Only)


    업데이트: Windows 98/ME 사용자도 아래의 DirectX 9.0c를 설치할 수 있다. 만일 DirectX 9을 설치할 경우, DirectX 8.1을 설치할 필요가 없게 된다.


    Windows 98/ME 사용자는 DirectX 8.0a, DirectX 8.1b 혹은 DirectX 8.2를 받아서 설치해야 MPlayer가 제대로 작동한다. 다음은 다운로드 링크를 여러 군데 모은 것이다.



    DirectX 8.1는 Windows XP에 포함되어 있다.



  2. DirectX 9.0c 설치


    MPlayer의 최신 개발 코드는 기본적으로 DirectX 9와 링크되도록 되어 있다. 그러므로 이렇게 만든 mplayer.exe 실행 파일을 Windows 98/ME/XP에서 실행하면 DirectX 9를 못 찾고 오류가 발생할 수가 있다. 이러한 오류를 방지하기 위해 MPlayer를 configure 할 때 --disable-direct3d 옵션을 주어서 DX9 링크 못하게 할 수 있다. 그렇지 않으면 filehippo.com에서 DirectX 9.0c 2006년 12월 릴리스를 받아서 설치해야 한다.



  3. MPlayer의 간단한 명령행 도움말


    mplayer.exe를 처음 실행하면 검은 콘솔 창이 나타나 아래처럼 짧은 도움말이 나온다.


    MPlayer SVN-r29464-snapshot-3.4.5 (C) 2000-2009 MPlayer Team
    Usage: mplayer [options] [url|path/]filename

    Basic options: (complete list in the man page)
    -vo select video output driver ('-vo help' for a list)
    -ao select audio output driver ('-ao help' for a list)
    vcd:// play (S)VCD (Super Video CD) track (raw device, no mount)
    dvd:// play DVD title from device instead of plain file
    -alang/-slang select DVD audio/subtitle language (by 2-char country code)
    -ss seek to given (seconds or hh:mm:ss) position
    -nosound do not play sound
    -fs fullscreen playback (or -vm, -zoom, details in the man page)
    -x -y set display resolution (for use with -vm or -zoom)
    -sub specify subtitle file to use (also see -subfps, -subdelay)
    -playlist specify playlist file
    -vid x -aid y select video (x) and audio (y) stream to play
    -fps x -srate y change video (x fps) and audio (y Hz) rate
    -pp enable postprocessing filter (details in the man page)
    -framedrop enable frame dropping (for slow machines)

    Basic keys: (complete list in the man page, also check input.conf)
    <- or -> seek backward/forward 10 seconds
    down or up seek backward/forward 1 minute
    pgdown or pgup seek backward/forward 10 minutes
    < or > step backward/forward in playlist
    p or SPACE pause movie (press any key to continue)
    q or ESC stop playing and quit program
    + or - adjust audio delay by +/- 0.1 second
    o cycle OSD mode: none / seekbar / seekbar + timer
    * or / increase or decrease PCM volume
    x or z adjust subtitle delay by +/- 0.1 second
    r or t adjust subtitle position up/down, also see -vf expand

    * * * SEE THE MAN PAGE FOR DETAILS, FURTHER (ADVANCED) OPTIONS AND KEYS * * *


    mplayer -vo help 명령은 다음과 같이 어떤 화면 출력 장치가 사용 가능한지 보여 준다.


    MPlayer SVN-r29464-snapshot-3.4.5 (C) 2000-2009 MPlayer Team
    Available video output drivers:
    directx Directx DDraw YUV/RGB/BGR renderer
    direct3d Direct3D 9 Renderer
    gl X11 (OpenGL)
    gl2 X11 (OpenGL) - multiple textures version
    winvidix WIN32 (VIDIX)
    cvidix console VIDIX
    null Null video output
    mpegpes MPEG-PES file
    yuv4mpeg yuv4mpeg output for mjpegtools
    png PNG file
    jpeg JPEG file
    gif89a animated GIF output
    tga Targa output
    pnm PPM/PGM/PGMYUV file
    md5sum md5sum of each frame

    mplayer -ao help 명령은 어떤 음향 출력 장치가 사용 가능한지 보여 준다.


    MPlayer SVN-r29464-snapshot-3.4.5 (C) 2000-2009 MPlayer Team
    Available audio output drivers:
    dsound Windows DirectSound audio output
    win32 Windows waveOut audio output
    mpegpes MPEG-PES audio output
    null Null audio output
    pcm RAW PCM/WAVE file writer audio output


  4. MPlayer 시험


    일단 명령 프롬프트(cmd.exe)나 실행 대화창(Run...)에서 다음과 같은 명령을 입력하여 MPlayer를 테스트해 보자. 위에 보이는 -vo 도움말과 -ao 도움말을 참고하여 자신의 시스템에 가장 알맞은 옵션을 찾아 보자.


    mplayer -vo direct3d -ao dsound -font C:\WINDOWS\FONTS\Tahoma.ttf -framedrop mymoviefile.avi

    또는 좀 느리지만 기본적인 출력 장치로 GL과 win32를 사용해 볼 수 있다.


    mplayer -vo gl -ao win32 Bear.wmv

    샘플 동영상 파일은 인터넷에서 검색하여 받도록 한다. Vista와 Windows 7 사용자는 C:\Users\Public\Videos\Sample Videos 폴더에 있는 샘플 동영상 파일로 MPlayer를 테스트해 볼 수 있다.



  5. MPlayer 설정


    처음으로 MPlayer를 실행하기 전에 HOME 환경변수를 정하여 자신의 폴더를 정해 준다. 그리고 MPlayer를 처음으로 더블클릭하면 사용자의 %HOME% 디렉토리에 “mplayer”라는 폴더가 생기고 그 안에 "config"라는 파일이 있다. "config" 파일에 다음과 같이 설정 사항을 적는다:



    # Write your default config options here!
    cdrom-device=D:
    dvd-device=D:
    ao=dsound
    vo=direct3d
    font=C:\WINDOWS\FONTS\MALGUN.TTF
    framedrop=yes
    subcp=cp949

    Windows 98/ME 사용자는 화면 출력 장치 설정으로 vo=direct3d 대신에 vo=directx 또는 vo=directx:noaccel 라고 적어야 한다. directx:noaccel은 가속 기능이 없는 DirectDraw 출력 장치인데 화면 출력에 문제가 있을 경우에 사용한다.



  6. MPlayer 코덱


    MPlayer 코덱을 받는 게 좋다. 파일 이름은 windows-essential-20071007.zip이다. 압축을 풀면 "windows-essential-20071007" 폴더가 나오는데 "codecs"으로 이름을 바꾸어 mplayer.exe가 있는 폴더로 옮기도록 한다.


    또한, MPlayer 소스의 etc 디렉토리에 codecs.conf 파일이 있을 것이다. 이것을 사용자의 mplayer 폴더에 복사해 놓는다. 그리고 mplayer를 실행하면 메시지 첫머리에 다음과 같이 코덱 숫자가 표시된다.


    MPlayer SVN-r29464-snapshot-3.4.5 (C) 2000-2009 MPlayer Team
    138 audio & 299 video codecs
    Usage: mplayer [options] [url|path/]filename

    이제 다음 명령어를 실행하면 mplayer 코덱에 관한 정보가 나올 것이다.


    mplayer -vc help
    mplayer -ac help


  7. 다음처럼 동영상을 볼 수 있다:

    mplayer mymoviefile.avi > C:\Windows\Temp\error.txt

    이제 남은 일은 SMPlayer를 받아서 MPlayer 인터페이스로 설정하는 것이다.


Thursday, April 1, 2010

윈도용 MPlayer와 Mencoder 정적 컴파일

Windows에서 MPlayer/Mencoder를 컴파일하려면 MinGW 컴파일러가 필요하다. 이 글을 읽고 MinGW를 설치하도록 한다. 이 글은 정적 실행 파일(특별한 DLL에 의존하지 않는 단일 프로그램)을 생성하기 위해 쓰여졌다. 동적 실행 파일을 만들려면 이 글을 읽기 바란다.



시작 메뉴에서 MSYS (rxvt)를 오른쪽 클릭하여 관리자로 실행한다. Windows Vista와 Windows 7에서 문제 없이 컴파일하기 위함이다.




  1. LZO 라이브러리는 빠른 압축 기능으로 순수 비디오를 압축하는 데 쓰인다.

    tar xzvf lzo-2.03.tar.gz
    cd lzo-2.03
    ./configure --prefix=/mingw
    make
    make install

  2. Zlib는 압축 헤더가 붙은 몇몇 mov 파일을 보기 위해 필요하다. zlib.net에서 소스를 받아 컴파일한다:

    cd ~

    tar xjvf zlib-1.2.4.tar.bz2

    cd zlib-1.2.4

    ./configure --prefix=/mingw

    make

    make install


  3. PNG 이미지 라이브러리


    영화 보는 데 PNG 라이브러리가 왜 필요한지 궁금할 것이다. 가끔 영화의 인상적인 부분을 한 장면 한 장면 사진으로 저장하고 싶을 때 쓸 수 있다. PNG 라이브러리 소스를 받아 컴파일하자:


    cd ~
    tar xzvf libpng-1.4.1.tar.gz
    cd libpng-1.4.1/
    ./configure --prefix=/mingw --disable-shared
    make
    make install


  4. Freetype 및 Iconv 라이브러리


    Freetype은 자막 표시에 필요하다. iconv 라이브러리에 의존하므로 먼저 iconv 소스를 받아 컴파일하자:


    cd ~

    tar xvzf libiconv-1.13.1.tar.gz

    cd libiconv-1.13.1

    ./configure --prefix=/mingw --disable-shared

    make

    make install

    그런 다음, Freetype2를 받아 컴파일한다:


    cd ~

    tar xzvf freetype-2.3.12.tar.gz

    cd freetype-2.3.12

    ./configure --prefix=/mingw --disable-shared

    make

    make install


  5. Fontconfig 라이브러리는 SSA 자막 표시에 필요하다. expat 라이브러리에 의존하므로 먼저 expat 라이브러리를 컴파일하자.

    cd ~
    tar xzvf expat-2.0.1.tar.gz
    cd expat-2.0.1/
    ./configure --prefix=/mingw --disable-shared
    make install

    그리고 fontconfig 라이브러리를 컴파일한다.

    cd
    tar xzvf fontconfig-2.8.0.tar.gz
    cd fontconfig-2.8.0/
    ./configure --prefix=/mingw --disable-shared
    make install


  6. Libcdio 소스를 여기서 받아 컴파일하고 설치하자.

    tar xzvf libcdio-0.81.tar.gz

    cd libcdio-0.81

    ./configure --prefix=/mingw --disable-shared

    make

    make install


  7. Libogg, Libvorbis, speex, Theora 컴파일


    libogg, libvorbis, speex 그리고 theora 라이브러리 모두 xiph.org에서 받아 다음과 같이 컴파일하자:


    ./configure --prefix=/mingw --disable-shared

    make

    make install


  8. DirectX 헤더를 아래의 위치에서 받아서:


    MinGW의 include 폴더(예를 들어, C:\MinGW\include)에 압축을 푼다.



  9. MPlayer 정적 컴파일을 위한 configure 명령


    pkg-config.exe와 yasm.exe를 받아서 /mingw/bin에 저장한다. MPlayer 소스를 받아서 풀자:


    tar xjvf mplayer-export-snapshot.tar.bz2
    cd mplayer-export-2009-08-02/

    다음과 같이 configure 명령어를 입력한다.


    ./configure --prefix=/mingw --enable-runtime-cpudetection --enable-static --enable-theora --disable-vidix --yasm=/mingw/bin/yasm


  10. configure가 끝나면 config.mak를 열어서 손보자. MPlayer.exe를 실행할 때 검은 로그 창이 나타나는 현상을 원하지 않는다면 EXTRALIBS_MPLAYER= 행에 -mwindows 추가하도록 한다:

    EXTRALIBS_MPLAYER =  -mwindows -lopengl32 -lgdi32 -lwinmm -ld3d9 -lfaac -lx264 -lmp3lame


  11. MPlayer/Mencoder 컴파일


    드디어 MPlayer 컴파일을 시작한다.


    make

    컴파일이 성공적으로 끝나면 mplayer.exe 그리고 mencoder.exe 두 개의 파일이 생긴다. strip 명령을 쓰면 실행 파일의 크기를 약간 줄일 수 있다.


    strip m*.exe

    UPX로 압축한다.


    upx --best --strip-relocs=0 mplayer.exe
    upx --best --strip-relocs=0 mencder.exe

    가령, C:\Program Files로 복사하도록 한다.


    cp -iv m*.exe /c/Program\ Files



mplayer.exe와 mencoder.exe 두 개의 실행 파일이 성공적으로 만들어졌으니, 이제 MPlayer를 테스트하고 설정하는 일이 남았다.

Monday, June 8, 2009

Compiling Mencoder for Windows

Mencoder is a command-line tool for creating multimedia files. It allows you to convert video from one format to another. When used together with OGMRip, mencoder helps you to rip DVD into a video file that's convenient to watch on computers. Note that the instruction herein explains how to compile Mencoder for the Windows platform, not Linux.



MinGW must be installed first (Look here for how). Once you have MinGW, launch MSYS (rxvt) from the Start menu and type the following commands.




  1. PNG and JPEG


    PNG depends on zlib compression library. Download the zlib source from zlib.net and compile as follows:

    tar xzvf zlib-1.2.3.tar.gz
    cd zlib-1.2.3
    ./configure --prefix=/mingw
    make
    make install

    Now get the PNG library here and compile it as follows:

    tar xzvf libpng-1.2.34.tar.gz
    cd libpng-1.2.34/
    ./configure --prefix=/mingw --disable-shared
    make
    make install

    Download the source for JPEG library, compile and install JPEG as follows:

    tar xzvf jpegsrc.v7.tar.gz
    cd jpeg-7
    ./configure --prefix=/mingw
    make
    make install


  2. libdca Library


    Download the libdca source from videolan.org and compile it like this:


    tar xjvf libdca-0.0.5.tar.bz2
    cd libdca-0.0.5
    ./configure --prefix=/mingw
    make
    make install


  3. OGG, Vorbis and Theora


    The source for these libraries can be obtained from xiph.org. Compile them like this:

    ./configure --prefix=/mingw --disable-shared
    make
    make install


  4. Libcdio Library


    Download the libcdio source from here. Compile and install libcdio as follows:

    tar xzvf libcdio-0.81.tar.gz
    cd libcdio-0.81
    ./configure --prefix=/mingw --disable-shared
    make
    make install


  5. Live555 library


    The Live555 library is used to decode streaming media. Get the live555 source from here and compile it as follows:

    cd /mingw/lib
    tar xzvf live.2009.07.28.tar.gz
    cd live
    ./genMakefiles mingw
    make


  6. LAME


    LAME is an MP3 encoder. This library allows Mencoder to encode DVD sound into MP3 audio. Download LAME from lame.sf.net and compile it as follows.


    ./configure --prefix=/mingw --enable-expopt=full

    make

    make install


  7. TwoLame


    TwoLAME is an MP2 audio encoder. Get the source from twolame.org and compile it:

    ./configure --prefix=/mingw CPPFLAGS='-DLIBTWOLAME_STATIC'
    make
    make install


  8. XviD


    In case you didn't know, XviD is the most popular video encoder used in creating movie files found on the P2P networks. With this library, mencoder can rip a DVD into XviD video. Get the XviD source from xvid.org and compile as follows:


    tar xzvf xvidcore-1.2.2.tar.gz

    cd xvidcore/build/generic

    ./configure --prefix=/mingw

    make

    make install

    In addition, change to the /mingw/bin directory and copy xvidcore.a to libxvidcore.a.


    cd /mingw/lib

    cp xvidcore.a libxvidcore.a


  9. FAAC


    FAAC is an MPEG-4 AAC audio encoder. Get the source (faac-1.28.tar.gz) and unpack the package. Then, edit Makefile.am:

    SUBDIRS = include libfaac

    Also, edit the line beginning with AC_OUTPUT in the file configure.in:

    AC_OUTPUT(libfaac/Makefile include/Makefile Makefile)

    Then, compile FAAC like this

    sh bootstrap
    ./configure --prefix=/mingw --enable-static --disable-shared
    make
    make install


  10. x264


    x264 is yet another good video encoder. x264 requires YASM to build an optimized executable. So get yasm and save it as /mingw/bin/yasm.exe. Then, compile x264 like this:


    sh configure --prefix=/mingw --extra-cflags="-DX264_VERSION=20090608"

    make

    make install


  11. Compiling Mencoder


    Now you're ready to compile mencoder. Download the MPlayer source snapshot from mplayerhq.hu and unpack it. Then, type the following commands into the MSYS window to produce the executable mencoder.exe.


    CPPFLAGS='-DHAVE_INT32_T -DLIBTWOLAME_STATIC'./configure --prefix=/mingw --enable-runtime-cpudetection --enable-static --enable-theora --yasm=/mingw/bin/yasm

    make mencoder

    strip *.exe

    mv -iv mencoder.exe /c/Windows

    This produces a static executable mencoder.exe and copies it into the C:\WINDOWS folder.




If you'd like to try my mencoder build, download it from here. Its filename is MPlayer-svn-r30521-snapshot-3.4.5.zip.

Thursday, April 23, 2009

Linux: Connecting to Wireless Networks with wpa_supplicant

Connecting to a wireless network in Linux is easy with wpa_supplicant. If you haven't, install the wpasupplicant package first. Also, install wireless-tools.



Of course, the driver for the wireless adapter has to be installed and loaded too. You can either use Linux native driver or Windows NDIS driver for your wireless device. The Linux kernel itself provides native driver modules for popular wireless chips. Alternatively, you can use a Windows driver in Linux with the help of ndiswrapper. I prefer using ndiswrapper to enable my wireless adapters. Once ndiswrapper is configured correctly, the following command will load the driver for the wireless network adapter.



modprobe ndiswrapper


In order to be able to control wpasupplicant with wpa_cli and wpagui, you should add useself to the netdev group.


adduser username netdev

To automatically have wpasupplicant take care of wireless connections, you should edit two files, /etc/network/interfaces and /etc/wpa_supplicant/wpa_supplicant.conf. The following is a sample /etc/network/interfaces file.



auto lo wlan1

iface lo inet loopback

iface default inet dhcp

iface WPA_hidden inet static
address 192.168.1.250
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1

iface wlan1 inet manual
wpa-driver wext
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf


Then, you need to create a configuration file /etc/wpa_supplicant/wpa_supplicant.conf. Its contents typically looks like this:



ap_scan=1
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev

network={
ssid="MyWifiNet"
scan_ssid=1
key_mgmt=WPA-PSK
proto=WPA
pairwise=TKIP
group=TKIP
psk="WPA password"
id_str="WPA_hidden"
}

network={
ssid="linksys"
key_mgmt=NONE
wep_key0=e2c45314910abf72e871beda87
wep_tx_keyidx=0
}


In the example above, the ssid= and psk= lines should to be adjusted for each wireless network. The second nework linksys is an example of WEP networks. Next, run the following command to start a WPA connection to your wireless network.



wpa_supplicant -c /etc/wpa_supplicant.conf -i wlan1 -B


The steps below finalize wirless network setup.



ifconfig wlan0 192.168.1.201 up

route add default gw 192.168.1.1


Additionally, check the contents of /etc/resolv.conf which set up DNS servers.



To Kill WPA_supplicant


To terminate wpa_supplicant, execute wpa_cli and type the following commands:


terminate
quit

Sunday, April 5, 2009

Multiple Windows Installation

When the Vista Loader — also known as SoftMod or OEM BIOS emulation — is installed in a system with multiple Windows installations, Windows probably won't boot except the one in the first NTFS partition because the Grub4Dos code in the grldr file installed by the Vista Loader by default boots the first NTFS partition. In this case, you should uninstall Vista Loader from every Windows partition and then reinstall Vista Loader into a separate FAT logical partition. GRUB4DOS or pure GRUB will be used to load OEM BIOS emulation code into memory and then execute instructions in the menu.lst file to boot Windows in NTFS primary partitions.



To use multiple Windows installation, Grub4Dos and Vista Loader should be used together. This duo can be installed on a floppy or a bootable USB flash. The following is the contents of a menu.lst file used with Vista Loader.


timeout 0
default 0
fallback 1

title Vista Loader
map --mem (hd0,0)/vstaldr.img (fd0)
map --hook
chainloader (fd0)+1
rootverify (fd0)

title Windows Vista
find --set-root /bootmgr
chainloader /bootmgr


Related Posts


Saturday, March 28, 2009

Using GParted To Create Dual-Boot Vista Partitions

Have you ever wished to have multiple Windows installed on your computer? Having a multi-boot system has many applications, such as:



  • Set up one Windows system for your work or school, and set up another Windows system for your family and kids, all in one single computer
  • Use one Windows installation for your sensitive data, and use another installation for gaming and the Internet
  • Set up multiple Windows for different languages, for example one for English and another for Spanish
  • Try different Windows versions, one for Vista, one for XP and another for Windows ME.

In order to set up multiple installations of Windows in a single computer, you need to slice your hard drive into several partitions using a partitioning tool such as GParted. Get a GParted live CD and boot your computer with it.



Partitioning Advices


Here's what you need to know about multiple Windows installation:



  • One primary partition must be set up with Windows Vista or XP and set active. This partition will be used to boot itself and optionally other Windows partitions, primary or logical.
  • If multiple primary partitions have Windows installed, then only one of them should be active and the others should be hidden.


GParted in Action


Once you booted GParted live CD, launch GParted.


GParted first look

In most case, you'll see a Windows partion (type ntfs) as the first primary partition. If you need to resize it to make space available for the second Windows partition, you can use GParted, but I recommend you to use ntfsresize.


Now hide your existing Windows partition by right-clicking it and choosing Manage Flags.


GParted Manage Flags

Clear the boot flag and set the hidden flag. Then click Close.


GParted hide partition

Click the unallocated area and click New on the toolbar. Create new Partition dialog appears on screen. Set the size in the New Size box, create it as a Primary Partition and make it ntfs. Click Add.


GParted Create new Partition dialog

Look at the GParted window and make sure the new hard disk layout is okay. Click Apply on the toolbar.


GParted changed new layout

A confirmation dialog appears. Click Apply.
GParted Apply operations to device

If everything goes well, a dialog appears saying All operations successfully completed. Click Close.


GParted All operations successfully completed.

Right-click the newly created NTFS partition and select Manage Flags from the right-click menu. In the Manage flags window, only set the boot flag and click Close.


GParted Manage Flags

Quit GParted. Put your Windows installation DVD into your CD-ROM and reboot.

Friday, March 27, 2009

Resizing a Windows Vista partition with ntfsresize

Well, it's ironic that we need to use a Linux program to resize a Windows partition, but we don't want to spend money on buggy Windows programs. There are many tutorials on the Web that show you how to use the venerable GParted program. But in this tutorial, I'll talk about ntfsresize. Be warned that improperly following this tutorial may result in your computer totally unusable. Before proceeding, be sure to back up your computer. Once you've done that, place a Linux CD into your CD-ROM and reboot. I recommend you to try one of the following:




GParted vs ntfsresize


The problem with the user-friendly GParted is that after using it, your Vista is unbootable and you need to get the Vista installation DVD to fix it. In most cases, people don't have Windows installation DVD's because they bought PC's preinstalled with Vista. In such a case, ntfsresize is a better alternative although ntfsresize is not as intuitive as GParted. If you use ntfsresize properly, you can just reboot your PC, let Windows self-check the filesystem, and your Vista is fine after the second reboot. Anyway, both GParted and ntfsresize can wreck havoc to your PC if used improperly.


Windows Boot Manager
Windows failed to start. A recent hardware or software change might be the cause. To fix the problem:
1. Install your Windows installation disk and reboot.
2. Choose your language settings, click Next
3. Choose "Repair your computer"

If you do not have this disc, contact your system administrator or computer manufacturer for assistance.
File: \Windows\system32\winload.exe
Status: 0xc0000225
Info: The selected entry could not be loaded because the application is missing or corrupted

The error above commonly appears when you manipulate you partitions with GParted. To fix the error, read this post: Fixing a Vista Boot Problem.



Why you can't just reboot after using GParted


Every NTFS has a unique serial number (UUID) associated with it. When you resize or move an NTFS filesystem, it is possible that the UUID of the NTFS partition changes. To fix a problem caused by the UUID change, you have to correct the UUID in C:\Boot\BCD.


Displaying the Partition Table


Once you're in Linux, open a console or xterm and type the following command to display the partition table. You may have to replace /dev/sda with /dev/hda or /dev/hdc depending on your hardware configuraton. In general, IDE/ATA hard drives have /dev/hd* names and SATA hard drives have /dev/sd* names.


fdisk -l -u /dev/sda

fdisk -l -u /dev/sda

The fdisk -l command shows you which partition has the Windows. In this example, Windows is in the partition /dev/sda1 which starts at sector 2,048 and ends at sector 78,151,679. Since 1 sector is 512 bytes, /dev/sda1 is 39,074,816 kilobytes (about 40 GB).


Shrinking a Windows Partition


Roughly speaking, to shrink a Windows partition, first use ntfsresize to resize the Windows filesystem, then use fdisk to delete the Windows partition and create a new one that fits the smaller NTFS. Type the following command to find out how small you can resize your partition to:


ntfsresize --info /dev/sda1

ntfsresize --info /dev/sda1

The output above says that the NTFS partition can be resized as small as 16,728 MB. For example, to resize from 40GB to 20GB, type the following command.


ntfsresize --size 20G /dev/sda1

ntfsresize --size 20GB /dev/sda1

A question appears asking your confirmation to proceed. If you type y, ntfsresize will resize your Windows filesystem showing the progress. When ntfsresize finishes resizing the NTFS, the screen looks like this.


ntfsresize completed

Type fdisk -u /dev/sda to change your partition table to accommodate the resized Windows filesystem.


fdisk -u /dev/sda

First, delete the existing Windows partition by typing d and then the partition number 1. Now type n to create a new partition, then type p to set it primary, then type 1 to make it the first partition. When you are asked for the starting sector, type the same starting sector as the old deleted partition, in this case 2048. When you're asked for the ending sector, give the approriate number that's slightly larger than the filesystem. Here are my calculations:


20,000,000,000/512=39,062,500

39,062,500/255/63=2,431.528

2,432*255*63=39,070,080

39,070,080-1=39,070,079

Since I resized my Windows partition to 20GB, my new Windows filesystem is 39,062,500 sectors and 2,431.53 cylinders — my hard disk is 255 heads * 63 sectors/track * 9729 cylinders. Round the number up to 2,432 cylinders and convert it to 39,070,080 sectors. Finally, subtract 1 from it and I got 39,070,079. Give it as the ending sector.


create a new NTFS

Type t, 1, 7 to change the type of the new first partition as NTFS. Type a to make it active. Type p to display the changed partition table to make sure it's correct. Finally, type w to write the new partition table and exit fdisk.


Now, all that's left to do is reboot and see if everything works. Hopefully, you'll see a black-and-white screen for checking filesystem integrity. After that and another reboot, you'll get back to Windows. Hooray!



Enlarging a Windows Partition


Enlarging a Windows partition takes the opposite steps. First delete the Windows partition and create a larger partition beginning at the same sector as the deleted partition. Then use ntfsresize to enlarge the NTFS.


Related Posts


Tuesday, January 6, 2009

Disabling the Sleep Mode in Vista



With the default Vista power settings, pressing the Start menu power button will put the computer into a sleep mode. After newly installing Windows Vista, opening the Start menu will show the power button in amber yellow. This means clicking the power button will put the PC into the power-saving sleep mode instead of turning it off completely. The sleep mode saves the current state of the computer in memory, turns down the fans and keeps the PC quiet until you press a key or move a mouse.


But don't you find it annoying? I do. I want the PC turned off completely when I click the Power button. The following steps show you how to change Vista power settings so that clicking the Power button will turn off the PC:


  1. Click or press the Windows Logo button to open the Start menu.

  2. Click the Control Panel.

  3. Click System and Maintenance.

  4. Click Power Options.

  5. Click Change plan settings under the current preferred plan (by default, Balanced).

  6. Click Change advanced power settings.

  7. When the Power Options window appears, click the plus sign + next to Power buttons and lid to expand the section.

  8. Click the plus sign + next to Start menu power button.

  9. Change the Setting from Sleep to Shut down.

  10. Click OK to change the power options and close the window.

Monday, December 29, 2008

Backing up Hard Disk Partitions in Linux

To guard against disasterous hard disk failure or data loss, regular backup is very important. For Windows users, there's Norton Ghost which helps back up valuable data and settings in your hard disk. But for thrifty and savvy users, there's a nifty Linux tool called partimage. It's a simple console program but does its job great.

This tutorial guides you in backing up hard disk partitions in Linux. Let's assume you want to back up your Windows partition to a USB drive using partimage. If you are a Linux user, install partimage.

Otherwise, you can download and burn a System Rescue CD and boot with it. Connect your USB hard drive to your computer and mount it. If your USB drive has a FAT32 partition on /dev/sdb1, then the following command will mount it on /mnt:


mount -t vfat -o gid=100,dmask=2,fmask=113,shortname=winnt /dev/sdb1 /mnt

Make a folder called Backup and change to it:


cd /mnt

mkdir Backup

cd Backup

Save the partition table of your hard drive to a text file, assuming your hard drive is /dev/sda:


fdisk -l -u /dev/sda > hdptbl01.txt


Backing up with partclone


partclone is a new Linux tool for backing up and restoring hard disk partitions. The following command illustrates a situation where I back up the second partition, compress it on the fly and save the backup in 695M chunks.


partclone.ntfs -c -s /dev/sda2 | bzip2 -c | (cd /mnt/sdb1/Backup; split -d -b 695M - Backup-$(date +%F).partclone.bz2.)

Alternatively, you can use lzma to compress the backup.


partclone.ntfs -c -s /dev/sda2 | lzma -9c > Backup-$(date +%F).partclone.lzma

For quick backup, use lzop:


partclone.ntfs -c -s /dev/sda2 | lzop -c > backup-$(date +%F).partclone.lzo


Restoring Backups with Partclone


Here's a sample command:


cat Backup-2012-05-27.partclone.bz2.* | bzip2 -dc - | partclone.ntfs -r -o /dev/sda2


Backing up with Partimage


Assuming the partition to back up is /dev/sda1, the following command will back up /dev/sda1 in chunks of 695 MB so you can burn each piece on CD conveniently.


partimage -V 695 save /dev/sda1 backup01.pim

You'll be shown a number of options as seen below so you can tweak some settings. For example, if you want your computer to automatically power off after partimage finishes backup, check the Halt option. Press F5 to continue.


partimage save partition to image file options

Next, you will be given an option to enter description of the backup.


Partition Description

If the partition you're backing up is an NTFS partition (as most Windows partitions are), you'll be given the warning "The current NTFS support is experimental !". You can safely ignore it for now.


NTFS support is experimental

Next, you'll be shown NTFS information about the backup partition.


partimage NTFS information

After that, partimage will start backing up as per instruction. A handful progress window will appear with the time remaining and progress in percentage.


partimage save partition to image file backup progress

Restoring Partitions with Partimage


When something goes wrong with your computer, you can restore your hard disk partitions with the backup you've made with Partimage. First, make sure that you have a partition whose size is exactly the same as the partition the backup is made from. You can compare the current partition table with the contents of hdptbl01.txt file we've made earlier.

To restore the partition /dev/sda1 from a series of backup files starting with backup01.pim.000, open a console and type the following command:


partimage restore /dev/sda1 backup01.pim.000

Partimage restore partition from image file

Checking the Integrity of Partimage Backups


If you want to check partimage backups for integrity, specify the simulate option either on the command line or in the dialog, for example:


partimage --simulate restore /dev/sda1 backup01.pim.000


Related Posts


Monday, December 22, 2008

Fix Fonts in Vista Lite

Arial, Tahoma and Times New Roman are not displayed correctly when a CD edition of Windows Vista Home Premium is installed on your computer. To fix this problem, follow the following steps:



  1. Click the Start button to open the Start menu.
  2. Type regedit and press Enter. Registry Editor will appear on your screen.
  3. In the left pane, expand the registry tree to navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes.
  4. In the right pane, remove Arial, Microsoft Sans Serif, MS Sans Serif 8,10,12,14,18,24, MS Serif 8,10,12,14,18,24, Small Fonts, Tahoma and Times New Roman by selecting each one and pressing the Delete key. A dialog will pop up and ask you "Deleting certain registry values could cause system instability. Are you sure you want to permanently delete this value?" Answer Yes.
  5. Double-click Helv and replace its value with Arial.
  6. Double-click MS Sans Serif and replace its value with Microsoft Sans Serif.
  7. Replace the value of MS Serif, Times and Tms Rmn with Times New Roman.


Related Posts


Monday, December 15, 2008

How to install ndiswrapper on Linux

Question


Can someone break it down step by step and tell me how to install ndiswrapper on Linux?

I just can't focus enough to understand what they're telling me to do. Can someone tell me how to do it step by step?



My Answer


1. The Linux kernel must have ndiswrapper support.
You can type "/sbin/modinfo ndiswrapper" to check whether kernel has
ndiswrapper module. If not, install a new kernel with ndiswrapper
support. Most decent Linux distros come with ndiswrapper support.
Otherwise, you have to compile a kernel yourself.

If you're going to compile ndiswrapper yourself, download the latest 2.6 kernel from http://www.kernel.org and ndiswrapper from ndiswrapper sourceforge site. Instruction for compiling and installing kernel and ndiswrapper is included in the tarballs.

2. If you have the ndiswrapper module, chances are you also have the
ndiswrapper tools. If running "ndiswrapper -l" displays "command not
found", install ndiswrapper-utils package in Debian or something
similar in other distros. If you compiled ndiswrapper yourself,
ndiswrapper support binaries are built at the same time.

3. Check if your wireless card or USB dongle is supported by ndiswrapper at http://ndiswrapper.sourceforge.net/jooml...
It's helpful to know your wireless device ID. If it's PCI, type "lspci
-nn" and look for numbers like 14E4:4312. If it's USB, lsusb will show
your device ID. Look for your device matching your device ID in the
Wiki. The wiki may also have helpful hints and links to download driver
files. Searching for "14E4:4312 ndiswrapper" at Yahoo! Search for example may give you helpful results.

4. Download and extract Windows driver for your Wireless gadget. If
you're lucky, ndiswrapper Wiki above has links to download Windows
driver. If not, get your driver CD that came with your gadget. If not,
mount your Windows partition and copy the files from
/Windows/System32/Drivers, /Windows/Inf, or
/Windows/System32/DriverStore/FileReposi... You typically need one .INF
file, one or more .SYS files for your device. You can use unzip,
cabextract or unshield to extract drivers from .EXE or .CAB files.

5. Once you extracted and have .INF, .SYS files ready, run "ndiswrapper
-i *.inf" against the INF file. This will copy the driver under
/etc/ndiswrapper folder.

6. Type "ndiswrapper -l" to make sure the driver is correctly installed.

zd1211u : driver installed

device (0ACE:1211) present (alternate driver: zd1211rw)


7. Now it's almost done. Run "modprobe ndiswrapper". iwconfig will
hopefully show your device as wlan0 or similar. Use iwconfig and
ifconfig to manually set up your device for wireless connection. There
may be GUI tools to automatically set up wireless networking for you.
For example:



iwconfig wlan0 key c9f8747de2f73d16816b3f828b restricted

iwconfig wlan0 essid linksys

ifconfig wlan0 192.168.1.253 up

route add default gw 192.168.1.1



8. This is optional. In Debian, you can add ndiswrapper into
/etc/modules file to have ndiswrapper automatically loaded at boot time.


Source(s):


http://ndiswrapper.sourceforge.net/jooml...

About This Blog

KBlog logo This blog seeks to share useful information on freely available fonts on the Internet. Thanks for visiting the blog and posting your comments.

© Contents by KBlog

© Blogger template by Emporium Digital 2008

Followers

Total Pageviews

CyberChimps Professional WordPress Themes
Powered By Blogger