Leaderboard (728 x 90)

Saturday, November 19, 2011

How to enable NTFS filesystem on linux kernel

Introduction

kernel version m.n.x-y
m = major version number
n = minor version number (revision number and development status (odd number = development version and even number = stable version))
x = patch level
y = extra version number

{arch} = architecture

Required Package:
kernel-source
dev86
glibc-devel
make
gcc
binutils
ncurses-devel
cpp

Begin:
# cd /usr/src/linux-m.n

create default config from old kernel
# cp config/kernel-m.n.x-{arch}.config .config

modify kernel config
# make config - interactive
# make menuconfig - text mode
# make xconfig - gui mode

Edit extra version number
# vi /usr/src/linux-m.n/makefile

EXTRAVERSION=-yntfs

Check dependencies
# make dep

Remove certain files from previous compile operation
# make clean

Compile kernel source and build to file "bzImage"
# make bzImage

Compile dependencied modules
# make modules

Install compiled modules to /lib/modules/m.n.x-yntfs
# make modules_install

Install new compiled kernel to boot loader

Make initial ramdisk
# mkinitrd /boot/initrd-m.n.x-yntfs.img m.n.x-yntfs

Copy symbol table of the compiled kernel source to /boot
# cp /usr/src/linux-m.n/System.map /boot/system.map-m.n.x-yntfs

Copy new compiled kernel to /boot
# cp /usr/src/linux-m.n/arch/{arch}/boot/bzImage /boot/vmlinuz-m.n.x-yntfs

Backup config file of the compiled kernel source
# cp /usr/src/linux-m.n/.config /boot/config-m.n.x-yntfs

Add boot menu to grub boot loader
# vi /etc/grub.conf

# append these lines to grub.conf
# (hd0,0) = first partition of first hard drive
# /dev/VolGroup00/LogVol00 = volume or partition for / mountpoint

title Linux with NTFS support (m.n.x-yntfs)
root (hd0,0)
kernel /vmlinuz-m.n.x-yntfs ro root=/dev/VolGroup00/LogVol00 rhgb quiet
initrd /initrd-m.n.x-yntfs.img

Restart machine and select new compiled kernel in boot menu then check known file systems
# cat /proc/filesystems

Friday, November 4, 2011

for loop example in bash

Example 1
for i in 1 2 3 4 5
do
echo $i
done

Example 2
for i in {1..5}
do
echo $i
done

Example 3
for ((i=0; i<=5; i++))
do
echo $i
done

Example 4
Bash v4.0+ has inbuilt support for setting up a step value using {START..END..INCREMENT} syntax:
for i in {1..10..2}
do
echo $i
done