2016年6月30日 星期四

dracut debug 相關參數

dracut boot parameters

The following boot parameters are also available to further assist with debugging boot issues.

rd.shell
    Drop to a shell, if the initramfs fails.
rd.debug
    set -x for the dracut shell.
rd.break=[cmdline|pre-udev|pre-trigger|initqueue|pre-mount|mount|pre-pivot|cleanup]
    drop the shell on defined breakpoint (use egrep 'rd.?break' /usr/lib/dracut/modules.d/99base/init.sh to find the breakpoints supported by your dracut version)
rdudevinfo
    set udev to loglevel info
rdudevdebug
    set udev to loglevel debug
rdnetdebug
    debug network scripts in dracut. Output is written to /tmp

mknod /dev/mem /dev/kmem

mknod /dev/mem c 1 1
chown root.mem /dev/mem

mknod /dev/kmem c 1 2
chown root.kmem /dev/kmem

udev 使用的文件

/sys/*

/dev/*

/etc/udev/udev.conf    udev主要設定檔

/etc/udev/rules.d/*    udev 事件規則

/usr/lib/tmpfiles.d/  /etc/tmpfiles.d/    static dev 規則

/usr/lib/udev/*        udev 規則

2016年6月28日 星期二

Linux RAM Disk modules

The RAM Disk is created when the "brd" module is loaded (brd=block ram disk)
modprobe brd

rd_nr:Maximum number of brd devices (int)
rd_size:Size of each RAM disk in kbytes. (int)
max_part:Maximum number of partitions per RAM disk (int)

example
modprobe brd rd_size=1024000 max_part=2 rd_nr=1

核心支援版本
 2.0.40, 2.2.26, 2.4.37, 2.6.18, 2.6.24

核心 modules 支援版本
2.6.25,2.6.28, 2.6.30.1, 2.6.39 ,3.9 ,3.10, 3.11 ,3.12 ,3.13, 3.14, 3.15 ,3.16, 3.17, 3.18 ,3.19, 4.0 ,4.1, 4.2 ,4.3 4.4

2016年6月20日 星期一

Bash 列出所有 Char Device

# Char Device
for i in /sys/bus/*/devices/*/dev /sys/class/*/*/dev;
do :;
    if [ -f "$i" ] ;then :;
      OIFS=IFS;
      IFS=:;
      t=($(cat "$i"));
      IFS=$OIFS;
      i=${i%/dev};
      i=${i##*/};
      echo name=$i  major=${t[0]} minor=${t[1]};
    fi;
done;

Bash 列出所有 Block Device

#!/bin/sh

# Block Device
for i in /sys/block/*/dev /sys/block/*/*/dev ;
do :;
    if [ -f $i ]; then :;
      OIFS=IFS;
      IFS=:;
      t=($(cat $i));
      IFS=$OIFS;
      i=${i%/dev};
      i=${i##*/};
      echo name=$i  major=${t[0]} minor=${t[1]};
    fi;
done;

Linux 取得 SMBIOS uuid

dmidecode --type system