2009年8月31日 星期一

solaris ssh

/etc/ssh/sshd_config
permitRootLogin yes

svcadm restart ssh

2009年7月8日 星期三

multipath at boot

  • For Red Hat Enterprise Linux 4 or later, issue one of the following commands:
    • chkconfig multipathd on
    • chkconfig --level 345 multipathd on
      Note: This command enables multipathd service startup at boot.
  • For SUSE Linux Enterprise Server 9 or later, issue one of the following commands:
    • chkconfig boot.multipath on
    • chkconfig --level 345 boot.multipath on
      Note: This command enables boot.multipath service startup at boot.
    After running one of these commands, issue one of these commands:
    • chkconfig multipathd on
    • chkconfig --level 345 multipathd on
      Note: This command enables multipathd service startup at boot.

2009年7月1日 星期三

mkinitrd

1. mkinitrd -c -k 2.6.27.7-smp -m reiserfs:jbd

create an initrd with module reiserfs & jbd

2. load initrd at boot time
ex: add in lilo.conf

# Linux bootable partition config begins

image = /boot/vmlinuz-generic-2.6.27.7-smp

initrd = /boot/initrd.gz

root = /dev/hda6

label = Lnx26277smp

read-only

# Linux bootable partition config ends



/etc/modprobe.conf  
Specifies SCSI modules to be loaded  and  module options to be used.
install modulename command... This is the most powerful primitive in modprobe.conf: it tells modprobe to run your command instead of inserting the module in the kernel as normal. The command can be any shell command: this allows you to do any kind of complex processing you might wish. For example, if the module "fred" worked better with the module "barney" already installed (but it didn't depend on it, so modprobe won't automatically load it), you could say "install fred /sbin/modprobe barney; /sbin/modprobe --ignore-install fred", which would do what you wanted. Note the --ignore-install, which stops the second modprobe from re-running the same install command. See also remove below. You can also use install to make up modules which don't otherwise exist. For example: "install probe-ethernet /sbin/modprobe e100 || /sbin/modprobe eepro100", which will try first the e100 driver, then the eepro100 driver, when you do "modprobe probe-ethernet". If you use the string "$CMDLINE_OPTS" in the command, it will be replaced by any options specified on the modprobe command line. This can be useful because users expect "modprobe fred opt=1" to pass the "opt=1" arg to the module, even if there's an install command in the configuration file. So our above example becomes "install fred /sbin/modprobe barney; /sbin/modprobe --ignore-install fred $CMDLINE_OPTS"

2009年6月1日 星期一

iometer & dynamo

problem:
Getting host name for "test" failed

solution:
In /ect/hosts
add one line:
hostIp test


run:
./dynamo -i windonsIp -m linuxIp

2009年5月6日 星期三

2009年4月15日 星期三

objdump

objdump -l -D test.o

show assembly code and line number of source code

2009年1月13日 星期二

2009年1月10日 星期六

kernel 重置

Kernel 重製:

流程:

  1. 設定 kernel 選項
  2. 編譯 kernel
  3. 編譯 modules, 安裝 modules
  4. 安裝 kernel
  5. 設定 boot loader
  6. 重新開機

步驟:

  1. cd 您解壓後的目錄下的 linux 目錄中
  2. make mrproper
  3. make xconfig (menuconfig 或 config), 它會存成 .config
  4. make dep
  5. make bzImage
  6. make modules
  7. make modules_install
  8. cp arch/boot/i386/bzImage /boot
  9. 編輯 /etc/lilo.conf 或 /boot/grub/grub.conf
  10. 執行 lilo -v -v; 若是使用 grub, 則不必.
  11. reboot

scheduler

schedule_timeout
ex:
schedule_timeout(30*HZ);
// sleep for 30 seconds.

linux question website

http://www.linuxquestions.org/questions/programming-9/

linux question website

http://www.linuxquestions.org/questions/programming-9/

2009年1月8日 星期四

kthread

find current kernel threads in the system:
ps -ef
the process with [ ] is kernel thread

is kernel thread preemptive?
1. if CONFIG_PREEMPT is defined, kernel thread is preemptive
2. if CONFIG_PREEMPT is not defined, kernel thread is not preemptive. It will freeze the system if it doesn’t go to sleep.

kthread_create


2009年1月7日 星期三

interrupt

in_interrupt():
 to find out whether it's executing in interrupt context.

2008年12月29日 星期一

linux type

linux/types.h
sector_t 

block device driver header

linux/fs.h
struct block_device:

scsi/scsi_device.h
struct scsi_device

2008年12月27日 星期六

linux list

defined in /include/linux/list.h

struct list_head {
struct list_head *next, *prev;
};

#define LIST_HEAD_INIT(name) { &(name), &(name) }

#define LIST_HEAD(name) \
struct list_head name = LIST_HEAD_INIT(name)

INIT_LIST_HEAD: when list_head is first created, its next & prev point to itself
static inline void INIT_LIST_HEAD(struct list_head *list)
{
list->next = list;
list->prev = list;
}

list_add: add new element A to B, if B's next is C, then final sequence is B, A, C
static inline void list_add(struct list_head *new, struct list_head *head)
{
__list_add(new, head, head->next);
}

static inline void __list_add(struct list_head *new,
struct list_head *prev,
struct list_head *next)
{
next->prev = new;
new->next = next;
new->prev = prev;
prev->next = new;
}


#define list_for_each(pos, head) \
for (pos = (head)->next; prefetch(pos->next), pos != (head); \
pos = pos->next)

/* list_entry - get the struct for this entry
@ptr: the &struct list_head pointer.

@type: the type of the struct this is embedded in.
@member: the name of the list_struct within the struct.
*/
#define
list_entry(ptr, type, member) \
container_of(ptr, type, member)

/* container_of - cast a member of a structure out to the containing structure
@ptr: the pointer to the member.
@type: the type of the container struct this is embedded in.
@member: the name of the member within the struct.
*/
#define
container_of(ptr, type, member) ({ \
const
typeof( ((type *)0)->member ) *__mptr = (ptr); \
(
type *)( (char *)__mptr - offsetof(type,member) );})

2008年12月25日 星期四

multipath-tools

get source:
http://christophe.varoqui.free.fr/



compile:
(1) install device-mapper-devel-1.02.13-6.14.x86_64.rpm
(2) install readline-devel-5.1-24.19.x86_64.rpm.rpm
(3) cd multipathd
(4) make