momo zone

调核人的blog

Category Archives: linux

Linux Graphics Driver Stack

很早之前我贴过 关于现代 X window 渲染流程图,现在再贴一张 显卡驱动的架构图 ,当然是非常大概的那种 。

xyz_drv.so 在 /usr/lib/xorg/modules/drivers/ 很明显他是唯一和X window有联系的库。

xyz_dri.so 在 /usr/lib/dri  看起来实际是Mesa/DRI 的一个接口库

libdrmxyz 在 /usr/lib/ 用以实现libdrm 的函数库

最后的xyz.ko 都是在/lib/modules 对应于内核版本的内核模块目录中

 

 

 

 

 

 

 

Advertisements

dd 速度慢?

前几天要用dd全零化整个磁盘,发现直接dd 非常慢。其实加一个参数就ok:

dd if=/dev/zero of=/dev/sda bs=2MB oflag=nonblock

速度能提高10倍多

nonblock: use non-blocking I/O  。非阻塞I/O 哦 ,dd不会等当前i/o块读写完成就返回(异步i/o),进行下一次i/o。

 

注意只有在dd 设备文件时才起作用,如果已经挂载文件系统到/mnt那么无论加不加flag 都一样很快。估计是挂载以后有文件系统的支持,将默认为异步i/o

initrd 启动流程解析

1. init : 其实内核会优先查找initrd 根目录下的init ,如果没有再依次尝试sbin/init,/etc/init,/bin/init,/bin/sh/。这段代码在内核源码树 init/main.c 中:

static int __init kernel_init(void * unused)
{
	......

	if (!ramdisk_execute_command)
		ramdisk_execute_command = "/init";

	if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) {
		ramdisk_execute_command = NULL;
		prepare_namespace();
	}

	/*
	 * Ok, we have completed the initial bootup, and
	 * we're essentially up and running. Get rid of the
	 * initmem segments and start the user-mode stuff..
	 */

	init_post();
        return 0;
}
static noinline int init_post(void)
{
       ......
        if (ramdisk_execute_command) {
                run_init_process(ramdisk_execute_command);
                printk(KERN_WARNING "Failed to execute %s\n",
                                ramdisk_execute_command);
        }

        /*
         * We try each of these until one succeeds.
         *
         * The Bourne shell can be used instead of init if we are
         * trying to recover a really broken machine.
         */
        if (execute_command) {
 run_init_process(execute_command);
 printk(KERN_WARNING "Failed to execute %s. Attempting "
 "defaults...\n", execute_command);
 }
 run_init_process("/sbin/init");
 run_init_process("/etc/init");
 run_init_process("/bin/init");
 run_init_process("/bin/sh");

        panic("No init found.  Try passing init= option to kernel. "
              "See Linux Documentation/init.txt for guidance.");
}

init 脚本首先判断slow_boot 变量是否为空,如果是则执行fast boot 。 所谓的fast boot即init 脚本不执行boot目录下各脚本所明示的依赖关系和执行条件,以及模块挂载请求 ,而是直接 执行无特别检查机制的run-all.sh 脚本,由它再 调用boot目录下的各脚本。过程中每个boot脚本开头的验证机制将不再起作用。下面 仅介绍fast boot的流程 。

2. run-all.sh : 很简单的脚本,依次调用boot目录下的初始化脚本

3.boot/*  : 一个个介绍篇幅会很大,所以这里挑选几个重要的讲大致流程 ,以及特别注意的地方。

01-devfunctions.sh: 里面全是函数,用来处理磁盘设备文件,major,minor 等等。 还有一个就是check_for_device() 他会在83-mount.sh 被调用。检查是否真正的 根目录所在的磁盘设备文件已经就绪。

02-start.sh: 完成shell环境变量初始化,部分虚拟目录的挂载比如/dev /proc /sys 等,创建基本的设备文件。格式化传过来的命令行参数。里面有一句比较特殊 exec < /dev/console > /dev/console 2>&1 他的作用是把/dev/console 的标准输出和标准错误输出 重新 定位给他自己 。意思就是所有输出都要显示在真实终端上。这里有个很有用的参数,linuxrc=trace 将启用追踪,再配合shell=1 ,和blogd 方便进行调试。

03-dm.sh: 很简单,就两行代码,直接贴出来明白 mkdir /dev/mapper mknod /dev/mapper/control c 10 63

03-rtc.sh: 好像这个无关紧要,等待实时时钟(即cmos时钟)在/sys/class/rtc/rtc0 出现。即使最后没出现也没有关系 ?

03-storage.sh:很重要: 用来设定真正的根目录在那个设备上 很简单: 就几行

. /config/mount.sh

if [ "$root" ]; then
    rootdev="$root"
fi

if [ "$nfsroot" ]; then
    rootdev=$nfsroot
fi

[ "$resume" ] && resumedev="$resume"

04-udev.sh:轮到udev出场了,其实也就两句 :

/sbin/udevd --daemon
/sbin/udevadm trigger

另外还有一个wait_for_events() 后面很多被call 到的情况。这个函数也就一句:

/sbin/udevadm settle --timeout=$udev_timeout

含义是udev 处理事件队列的时间 最长为udev_timeout 秒(阻塞)。

05-clock.sh:调整系统时钟? bin/warpclock 不知道何用

05-kms.sh: 设定是否启用kms

06-blogd.sh: 启用日志服务。日志文件记录在/var/log/boot.msg,同时链接到了/var/log/boot.msg。不过前者在upstart之后就看不到了。

11-block.sh: 设置块设备模块参数

21-dmraid.sh: 启用fake raid

22-kpartx.sh: 根据分区表生成对应分区的设备文件。不过这个脚本是空的,kpartx 交由udev的rule ,当有新磁盘被发现时会被自动调用。/etc/udev/rules.d/70-kpartx.rules:

# Create persistent links for dmraid tables
ENV{DM_UUID}=="DMRAID-*", \
        SYMLINK+="disk/by-id/$env{DM_TYPE}-$env{DM_NAME}"
ENV{DM_STATE}=="ACTIVE", ENV{DM_UUID}=="DMRAID-*", \
        RUN+="/sbin/kpartx -u -p _part /dev/$kernel"

81-resume.userspace.sh: 假如之前有s2disc那么这个脚本将调用用户空间程序来将把 resume device 中的镜像导入内存。

82-resume.kernelspace.sh: 好像没有什么实际作用,只是把81-resume.userspace.sh 中的resume device的major ,minor 放入/sys/power/resume 而已。

83-mount.sh: 非常重要的脚本,真正的根目录在这里被挂载。首先检查指定的根目录所在的设备是否真的在/dev下存在。然后利用udevadm info来获得文件系统类型。再后用fsck 检查文件系统。最后用mount 把它挂载到initrd 根目录下的root目录。文件系统的驱动模块什么时候加载的?

84-remount.sh: 依次在initrd  中的/root目录下检测并执行sbin/init , etc/init, bin/init ,bin/sh 。然后格式化/root/etc/fstab ,根据其中的参数重新挂载根目录到/root

91-createfb.sh: 创建帧缓冲

91-killblogd.sh  91-killudev.sh : 杀掉blogd和udevd

91-shell.sh : 如果内核参数有加 shell=1 那么run-all.sh 执行到这里就截止了,打开一个bash 取代后面流程的执行。

92-killblogd2.sh:杀掉blogd进程。

93-boot.sh: 移动并卸载一些虚拟目录比如dev,sys 等。 然后开始执行bin/run-init。

4.bin/run-init :在boot/93-boot.sh 中被执行(内核执行的第一个基于C库的程序):

exec /bin/run-init -c ./dev/console /root $init ${kernel_cmdline[@]}
echo could not exec run-init!
die 0

它的主要作用是remount 真正的根目录,并切换到真正根目录,打开/dev/console ,执行upstart程序,即真正根目录下的/sbin/init。也可以添加内核参数init=/bin/sh 来改变$init 变量。 这里一旦exec 执行成功,后续代码将不会再执行,因为/sbin/init 永不返回 。

5. /sbin/init : upstart 的起点。挂载真正的根目录后首先要执行的二进制程序,pid=1。

搞定 ICH8R ISW RAID

先搞清楚从硬件软件角度理解的raid 目前raid实现主要有3中类型:

软件RAID 软件RAID(简称sw raid)是由OS来提供的RAID功能,此举会耗用较多的CPU运算资源来作动。此种raid一般之被建立软raid的os所识别,所以它和硬raid在外在表现上有很大不同。 温馨提示:上的Linux软件RAID技术已是相当成熟,使用装置/ dev/md0的,/ dev/md1 ,/ dev/md2上依此类推,md是multiple device的意思。

硬件RAID 硬件RAID由专属的RAID运算芯片,位于raid卡或直接嵌入在主板上,这时候OS只需要驱动的RAID芯片即可,如此一来把RAID的任务分工给的RAID卡,CPU的也较为轻松,管理上会比较简便。由raid管理的磁盘在所有操作系统中均可以访问(前提是raid卡被驱动)。 温馨提示:硬件RAID厂商通常会提供监控RAID的状态工具,若是遇到磁碟有故障情形时,主机会闪烁故障灯号或是发出哔哔声。

ATARAID (BIOS RAID,FAKE RAID) 这类型的RAID介于软RAID与硬RAID之间,算是半个硬件RAID(但大部分时候仍称为sw raid),通常由主板南桥来“帮忙”的RAID运算,因此有假的RAID(FAKE RAID)的之称。 要启动这个RAID的功能,要先在BIOS的磁盘模式中更改为RAID,然后在开机POST后按ctrl+i 进入RAID设置界面(搞的和硬RAID很像)。再使OS能够正确辨识装置即可。因为这款RAID的要在BIOS的内开启,所以亦有人称之为BIOS中的RAID。 ####################################################################################################

拿到WDRE4 X2 自然想到的一件事就是组raid。raid5,raid10,raid01 都可以排除了,因为首先我手里没有多余的磁盘,其次我要的是性能。所以毫无疑问我选择了raid0。在bios里面设置raid0很简单,但需要注意的是stripe size设置。默认128KB,也就是说小于128KB的底层读写请求将不会分别放入两块磁盘。可以想到这个值大些对于大文件来说是件好事,而这个值小些对于小文件更有利。但如果设置过小将会导致读写稍大文件时候增加raid负担(对于fake raid而言也就是CPU负担了)。我取中庸的设置32K。 fake raid非常接近硬raid ,对于linux而言无需任何驱动和设置即可在安装界面看到分区表。但在安装完毕后 ls /dev/ 下不会有raid块设备。原因是内核取代了bios来管理磁盘,如果内核无法理解fake raid的标记及结构,那么内核根本就不知道fake raid的存在,而仅仅能看到单块的磁盘。 研究总结了一下linux下支持fake raid的 条件:

1.内核raid子系统编译:

device driver -> Multiple devices driver support(RAID and LVM) 。 其中的raid support 指的应该是软raid:

This is called “Software RAID” since the combining of
the partitions is done by the kernel. “Hardware RAID” means that the
combining is done by a dedicated controller; if you have such a
controller, you do not need to say Y here.
所以不用选中。
另外一个是Device mapper support :
Device-mapper is a low level volume manager. It works by allowing
people to specify mappings for ranges of logical sectors. Various
mapping types are available, in addition people may write their own
modules containing custom mappings if they wish.
Higher level volume managers such as LVM2 use this driver.
To compile this as a module, choose M here: the module will be
called dm-mod.

Device Mapper(DM)是Linux 2.6全面引入的块设备新构架,通过DM可以灵活地管理系统中所有的真实或虚拟的块设备。

DM以块设备的形式注册到Linux内核中,凡是挂载(或者说“映射”)于DM结构下的块设备,不管他们是如何组织,如何通讯,在Linux看来都是一个完整的DM块设备。因此DM让不同组织形式的块设备或者块设备集群在Linux内核面前有一个完整统一的DM表示。

dm targets 也就是指device mapper 所能支持的映射种类 :

 linear – maps continuous range of another block device
 striped (~RAID0) – striping across devices
 mirror (~RAID1) – mirroring devices
 crypt – encrypt data using CryptoAPI
 snapshot – online snapshots of block device
 multipath – access to multipath devices (misc. hw handlers)
 zero,error,delay – test and special targets
 truecrypt
...
 raid45 (~RAID4,5) – raid (with dedicated) parity
 loop – stack device over another or over file
 throttle, rwsplit, flakey – test targets

由此可见,DM是不了解磁盘文件机制的(比如LVM,分区表,文件系统,挂载机制)。他只能进行磁盘的底层IO ,比如访问某个扇区,某个柱面。而且每个IO都是经过重新映射过的。

dm-mod这个模块一定要有,或者直接编译到内核。成功启用后可以看到这个设备文件 :/dev/mapper/control

2.device-mapper 用户空间程序

配合dm-mod 内核模块来做磁盘映射管理。

具体提供:

/sbin/dmeventd , /sbin/dmsetup

用户接口

/lib/libdevmapper-event.so.1.02 /lib/libdevmapper.so.1.02

库文件

/lib/udev/rules.d/10-dm.rules

/lib/udev/rules.d/13-dm-disk.rules

/lib/udev/rules.d/95-dm-notify.rules

udev规则

/etc/init.d/boot.device-mapper

init 初始化脚本

/lib/mkinitrd/scripts/boot-dm.sh /lib/mkinitrd/scripts/setup-dm.sh

initrd rom盘脚本 这个很重要稍后会说明

这里举个例子,比如需要从现有物理磁盘映射出来一个虚拟磁盘,并将第9个扇区设置为坏块。最后用dd去访问,来模拟磁盘故障。

(1)

dmsetup create bad_disk
0 8 linear /dev/sdb1 0
8 1 error
9 204791 linear /dev/sdb1 9
蓝色部分的即为map table ,结束map table的输入可以按 ctrl+D 。
(2)

blockdev –setra 0 /dev/mapper/bad_disk # 设置预读扇区数为0

blockdev –getsz /dev/mapper/bad_disk # 获得磁盘扇区总数

(3)

linux:~ # dd if=/dev/mapper/bad_disk of=/dev/null bs=1k count=4
4+0 records in
4+0 records out
4096 bytes (4.1 kB) copied, 0.309579 s, 13.2 kB/s
linux:~ # dd if=/dev/mapper/bad_disk of=/dev/null bs=1k count=5
dd: reading `/dev/mapper/bad_disk’: Input/output error
4+0 records in
4+0 records out
4096 bytes (4.1 kB) copied, 0.00184017 s, 2.2 MB/s
count=4 时访问0-7扇区没有问题,当访问8 扇区是由于映射的扇区是error ,所以无法访问。

3.dmraid

基于DM的一个fake raid专用设置工具。它实际的作用是一个用户空间的驱动程序。它读取isw的metadata然后依据metadata 调用libdevmapper 建立 map table,实际对磁盘的操作也是由libdevmapper 和 dm-mod 完成的。

具体提供:

/sbin/dmevent_tool /sbin/dmraid

用户接口程序

/lib/libdmraid-events-isw.so /lib/libdmraid.so.1.0.0.rc16-3

库文件

/etc/init.d/boot.dmraid

init初始化脚本

/lib/mkinitrd/scripts/boot-dmraid.sh /lib/mkinitrd/scripts/setup-dmraid.sh

initrd rom 盘脚本

dmraid 的基本用法:

(1) #dmraid -l

asr     : Adaptec HostRAID ASR (0,1,10)
ddf1    : SNIA DDF1 (0,1,4,5,linear)
hpt37x  : Highpoint HPT37X (S,0,1,10,01)
hpt45x  : Highpoint HPT45X (S,0,1,10)
isw     : Intel Software RAID (0,1,5,01)
jmicron : JMicron ATARAID (S,0,1)
lsi     : LSI Logic MegaRAID (0,1,10)
nvidia  : NVidia RAID (S,0,1,10,5)
pdc     : Promise FastTrack (S,0,1,10)
sil     : Silicon Image(tm) Medley(tm) (0,1,10)
via     : VIA Software RAID (S,0,1,10)
dos     : DOS partitions on SW RAIDs
显示支持的fake raid的种类,也就是列出可以识别的metadata类型。
(2) #dmraid -a[y/n]
激活已建立的fake raid
(3) #dmraid -s
*** Group superset isw_cffghdacdg
–> Active Subset
name   : isw_cffghdacdg_WDRE4-400
size   : 1743812480
stride : 64
type   : stripe
status : ok
subsets: 0
devs   : 2
spares : 0
–> Active Subset
name   : isw_cffghdacdg_WDRE4-500
size   : 209715072
stride : 64
type   : stripe
status : ok
subsets: 0
devs   : 2
spares : 0
显示已存在的raid 组及属性。
(4)#dmraid -r
/dev/sdd: isw, “isw_cffghdacdg”, GROUP, ok, 976773165 sectors, data@ 0
/dev/sdc: isw, “isw_cffghdacdg”, GROUP, ok, 976773165 sectors, data@ 0
显示每个raid组 成员的属性

4.kpartx

根据块设备的分区表映射出分区对应的块设备。

比如/dev/sda 中的分区分别映射出/dev/sda1, /dev/sda2 等等。

#################################################################

前面都已经铺垫完了,下面切入正题

简单地说在各发行版中,想使用fake raid 很简单只要dmraid -ay 即可,然后mount /dev/mapper/isw_XXXX /mnt。 但如果想从一个fake raid 挂载根目录来启动 似乎大家的支持程度不一 。比如opensuse就不行。简单修改一下grub :

title Desktop -- openSUSE 11.1 - 2.6.38.4-1-desktop
    root (hd3,0)
    kernel /vmlinuz-2.6.38.4-1-desktop root=/dev/mapper/isw-ddhhicaebf_WDRE4-500_part2 resume=/dev/mapper/isw-ddhhicaebf_WDRE4-500_part3 showopts vga=0x31b
    initrd /initrd-2.6.38.4-1-desktop

启动时会提示:

Waiting for device /dev/mapper/isw_cffghdacdg_WDRE4-500_part2 to appear     然后等待超时后会hold

我看了一些说法好像是opensuse 支持mdadm而不支持redhat主导的dmraid 所以无法挂载。我认同这种说法,但我想肯定有办法自行解决这个问题。

加入kernel 参数 shell=1 可以在initrd 的 /bin/linuxrc 执行完之后开启一个shell 。

l /dev/mapper 发现是空目录,说明initrd /boot里面所有脚本执行完毕后也没有对raid 进行映射,无映射的设备文件。那么问题应该是initrd 没有包含dm-mod ,dmsetup 和 dmraid?

使用mkinitrd 中的 lsinitrd 可以列出目录,发现确实没有。看来要重新制作initrd 。通过man mkinitrd 得知-f 选项可以添加额外特性。其实mkinitrd是个脚本,他会根据当前系统环境生成合适的initrd, 不过我感觉这里存在bug, 他没有将系统中的raid放在眼里,所以生成的initrd 缺少模块支持。 根据前面的铺垫,要把dm,dmraid,kpartx 都加上:
mkinitrd -f  “dm dmraid kpartx” -k vmlinuz-2.6.37-desktop -i initrd-2.6.37-desktop -b /boot    
(-k 后面的一系列参数可以通过<initrd_root>/mkinitrd.conf 查看

展开 initrd的方法 :

mkdir /boot/initrd_dir

cd /boot/initrd_dir

cp ../initrd .

cpio -i -d < initrd

手动打包initrd的方法

find . | cpio -H newc -o > ../initrd.cpio

cd ..

cat initramfs.cpio | gzip > initrd.gz ) 

这样重新启动后然后会提示 Waiting for device /dev/mapper/isw_cffghdacdg_WDRE4-500_part2 to appear
看来要分析一下initrd 中/boot 目录下的脚本了
依照执行顺序找到 /boot/initrd_dir_3/boot/21-dmraid.sh
#!/bin/bash
#%stage: block
#%depends: dm
#%provides: dmroot
#%programs: /sbin/dmraid
#%if: -n “$root_dmraid”
#
##### Device Mapper Raid
##
## If the root device uses a software raid based on device mapper,
## this initializes and waits for the device to appear.
##
## Command line parameters
## ———————–
##
## root_dmraid=1        use device mapper raid
##
/sbin/dmraid -a y -p
wait_for_events

发现好像应该设置root_dmraid=1 内核启动参数才能执行 /sbin/dmraid -a y -p  ,最终修改grub 如下。

title Desktop -- openSUSE 11.1 - 2.6.38.4-1-desktop
    root (hd3,0)
    kernel /vmlinuz-2.6.38.4-1-desktop root=/dev/mapper/isw-ddhhicaebf_WDRE4-500_part2 resume=/dev/mapper/isw-ddhhicaebf_WDRE4-500_part3 root_dm=1 root_dmraid=1 showopts vga=0x31b
    initrd /initrd-2.6.38.4-1-desktop
最后终于搞定了 。这里还有一个小问题,boot log 会看到:
RAID set "isw_cffghdacdg_WDRE4-400" was activated
RAID set "isw_cffghdacdg_WDRE4-500" was activated
The dynamic shared library "libdmraid-events-isw.so" could not be loaded:
    libdmraid-events-isw.so: cannot open shared object file: No such file or directory
The dynamic shared library "libdmraid-events-isw.so" could not be loaded:
    libdmraid-events-isw.so: cannot open shared object file: No such file or directory
Trying manual resume from /dev/mapper/isw_cffghdacdg_WDRE4-500_part3
Invoking userspace resume from /dev/mapper/isw_cffghdacdg_WDRE4-500_part3
resume: libgcrypt version: 1.4.4
Trying manual resume from /dev/mapper/isw_cffghdacdg_WDRE4-500_part3
Invoking in-kernel resume from /dev/mapper/isw_cffghdacdg_WDRE4-500_part3
Waiting for device /dev/mapper/isw_cffghdacdg_WDRE4-500_part2 to appear:  ok
RAID set “isw_cffghdacdg_WDRE4-400” was activated
RAID set “isw_cffghdacdg_WDRE4-500” was activated
ERROR:  Unable to register a device mapper event handler for device “isw_cffghdacdg_WDRE4-400”
ERROR:  Unable to register a device mapper event handler for device “isw_cffghdacdg_WDRE4-500”
Trying manual resume from /dev/mapper/isw_cffghdacdg_WDRE4-500_part3
Invoking userspace resume from /dev/mapper/isw_cffghdacdg_WDRE4-500_part3
resume: libgcrypt version: 1.4.4
Trying manual resume from /dev/mapper/isw_cffghdacdg_WDRE4-500_part3
Invoking in-kernel resume from /dev/mapper/isw_cffghdacdg_WDRE4-500_part3
Waiting for device /dev/mapper/isw_cffghdacdg_WDRE4-500_part2 to appear:  ok
不过未发现什么影响。
晒win2008R2-SP1 下 HDT 成绩:

 

2015/1/2 update:

发现dmraid已经渐渐合并到mdadm了 <http://www.phoronix.com/scan.php?page=news_item&px=MTUxOTk&gt; :

Besides wanting to enable SSD TRIM support for Ubuntu Linux, developers are also looking at moving from DMRAID to MDADM for fake/software RAID configurations on the desktop operating system.

MDADM has now the ability to manage external meta-data RAID devices and for some devices such as Intel Matrix RAID it’s now preferred over using the common DMRAID package. With the broader move towards MDADM for Linux RAID administrator, Ubuntu developers are looking to follow this movement and transition to MDADM by default.

MDADM supports all the standard RAID configurations (RAID 0/1/4/5/6/10) and works with both partitions and entire disks. MDADM also supports container, multi-path, faulty, and linear disk configurations as well.

For those exploring RAID on Linux or want to catch up on MDADM, see the developer blog or the Git repository. What’s new today is that Ubuntu developers are hoping to switch to MDADM by default over DMRAID.

There’s changes needed by the Ubuntu installer, initramfs changes, dmraid/imsm migration items to work through, and other issues to work through, but it’s now on the agenda for Ubuntu and potentially to be changed in 14.04 LTS. More details on the MDADM Ubuntu plans can be found via this Ubuntu vUDS page.

新的发行版默认使用mdadm管理fake raid,但貌似还有点问题,不支持一个磁盘组中的多个卷。解决办法是停掉mdadm -S /dev/md0。然后再dmraid -ay。

strtol()详解

今天读代码时看到了这个函数,感觉非常有用,试了几下把解释记录下来:

string to long

long int strtol(const char *nptr, char **endptr, int base)


strtol()会将nptr指向的字符串,根据参数base,按权转化为long int, 然后返回这个值。
参数base的范围为2~36,和0;它决定了字符串以被转换为整数的权值。


可以被转换的合法字符依据base而定,举例来说,当base为2时,合法字符为‘0’,‘1’;base为8时,合法字符为‘0’,‘1’,……‘7’;base为10时,合
法字符为‘0’,‘1’,……‘9’;base 为16时,合法字符为‘0’,‘1’,……‘9’,‘a’,……‘f’;base为24时,合法字符为‘0’,……‘9’,‘a’,……‘n’,base为36时,合法字符为‘0’,……‘9’,‘a’,……‘z’;等等。其中,不区分大小写,比如,‘A’和‘a’会都会被转化为10。
当字符合法时,‘0’,……‘9’依次被转换为十进制的0~9,‘a’,……‘z’一次北转换为十进制的10~35。


strtol()函数检测到第一个非法字符时,立即停止检测,其后的所有字符都会被当作非法字符处理。合法字符串会被转换为long int, 作为函数的返
回值。非法字符串,即从第一个非法字符的地址,被赋给*endptr。**endptr是个双重指针,即指针的指针。strtol()函数就是通过它改变*endptr的值,即把第一个非法字符的地址传给endptr。

多数情况下,endptr设置为NULL, 即不返回非法字符串。
下面看几个例子:
——————————————————
char buffer[20]=”10379cend$3″;
char *stop;
printf(“%d\n”,strtol(buffer, &stop, 2));
printf(“%s\n”, stop);
输出结果:
2
379cend$3
——————————————————-
char buffer[20]=”10379cend$3″;
char *stop;
printf(“%d\n”,strtol(buffer, &stop, 8));
printf(“%s\n”, stop);
输出结果:
543
9cend$3
——————————————————–
char buffer[20]=”10379cend$3″;
char *stop;
printf(“%d\n”,strtol(buffer, &stop, 10));
printf(“%s\n”, stop);
输出结果:
10379
cend$3
——————————————————-
char buffer[20]=”10379cend$3″;
char *stop;
printf(“%d\n”,strtol(buffer, &stop, 16));
printf(“%s\n”, stop);
输出结果:
17005006
nd$3
另外,如果base为0,且字符串不是以0x(或者0X)开头,则按十进制进行转化。如果base为0或者16,并且字符串以0x(或者0X)开头,那么,x(
或者X)被忽略,字符串按16进制转化。如果base不等于0和16,并且字符串以0x(或者0X)开头,那么x被视为非法字符。
例如:
——————————————————-
char buffer[20]=”0x31da6c”;
char *stop;
printf(“%d\n”,strtol(buffer, &stop, 0));
printf(“%s\n”, stop);
输出结果(stop为空):
3267180

——————————————————-
char buffer[20]=”0x31da6c”;
char *stop;
printf(“%d\n”,strtol(buffer, &stop, 13));
printf(“%s\n”, stop);
输出结果:
0
0x31da6c
——————————————————-

最后,需要说明的是,对于nptr指向的字符串,其开头和结尾处的空格被忽视,字符串中间的空格被视为非法字符。
例如:
——————————————————-
char buffer_1[20]=”10379c”;
char buffer_2[20]=”      10379c        “;
char buffer_3[20]=”      10      379c        “;
printf(“%d\n”,strtol(buffer_1,NULL,0));
printf(“%d\n”,strtol(buffer_2,NULL,0));
printf(“%d\n”,strtol(buffer_3,NULL,0));
输出结果为:
10379
10379
10

ps3 DS3 手柄驱动

也许是当年ps3 可以安装yellow dog 的原因,现在kernel包直接包含了ds3(sixaxis)的驱动。

如果要让ds3 在linux 下工作需要两个部分:

1. HID    –人体工程学接口设备, 鼠标,键盘及其他控制器都需要它。它遵循HID驱动构架。仅处理模块初始化和设备的探测(probe)

具体位置在: drivers/hid/hid-sony.c / *  HID driver for some sony “special” devices

*
*  Copyright (c) 1999 Andreas Gal
*  Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz>
*  Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc
*  Copyright (c) 2007 Paul Walmsley
*  Copyright (c) 2008 Jiri Slaby
*  Copyright (c) 2006-2008 Jiri Kosina
*/
/*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*/
#include <linux/device.h>
#include <linux/hid.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/usb.h>
#include “hid-ids.h”
static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
{
int ret;
unsigned long quirks = id->driver_data;
struct sony_sc *sc;
switch (hdev->bus) {
case BUS_USB:
ret = sony_set_operational_usb(hdev);
break;
case BUS_BLUETOOTH:
ret = sony_set_operational_bt(hdev);
break;
default:
ret = 0;

hid-ids.h 包含ds3 的vid ,pid

#define USB_VENDOR_ID_SONY                      0x054c
#define USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE       0x024b
#define USB_DEVICE_ID_SONY_PS3_CONTROLLER       0x0268

kernel 默认把这个hid-sony 包含进内核,而不是模块形式。 CONFIG_HID_SONY=y

2. input –这个是kernel 2.6以后抽象出来的,专门处理具体输入输出外设事件。input作为设备作业流的最后一个环节他将I/O外设分为这几类:

obj-$(CONFIG_INPUT_KEYBOARD)    += keyboard/
obj-$(CONFIG_INPUT_MOUSE)       += mouse/
obj-$(CONFIG_INPUT_JOYSTICK)    += joystick/
obj-$(CONFIG_INPUT_TABLET)      += tablet/
obj-$(CONFIG_INPUT_TOUCHSCREEN) += touchscreen/
obj-$(CONFIG_INPUT_MISC)        += misc/

手柄控制器就属于 joystick 。然后在joystick 有专门处理一种手柄/摇杆的驱动。对应DS3的就是gamecon.c

/*
* NES, SNES, N64, MultiSystem, PSX gamepad driver for Linux
*
*  Copyright (c) 1999-2004     Vojtech Pavlik <vojtech@suse.cz>
*  Copyright (c) 2004          Peter Nelson <rufus-kernel@hackish.org>
*
*  Based on the work of:
*      Andree Borrmann         John Dahlstrom
*      David Kuder             Nathan Hand
*      Raphael Assenat
*/

看注释不知道像NES这样的古老非usb手柄怎么在linux上面用~ 作者还有文档呢:

/*
* PSX support
*
* See documentation at:
*      http://www.geocities.co.jp/Playtown/2004/psx/ps_eng.txt
*      http://www.gamesx.com/controldata/psxcont/psxcont.htm
*
*/
关于如何让DS3/sixaxsi 的BT工作可以参照这个:http://www.pabr.org/sixlinux/sixlinux.en.html
另外还有一个关于ps系主机的资料站点:http://wiki.ps2dev.org/

内核代码中关于线程的一些简单认识

这里所谓的线程是指的内核线程,并不是用户线程。后者由上层的线程库调用系统调用clone创建的。

内核线程一般并不被用户程序直接使用,而是在内核空间中并发执行某些代码而由内核自己设置的一个“进程”。(比如驱动程序中同步设备与缓存) 在linux中线程和进程都用thread_info数据结构(具体和体系结构相关)进行描述,都参与调度,其实对内核而言根本就不区分所谓进程和线程,它们都是可调度的执行流,比如在设备驱动中可以通过与nice相关的函数设置新创建的内核线程的优先级。 在用户态执行fork时如果指定了CLONE_VM标志,那么父子进程共享父进程的上下文,即mm_struct,此时就把它们都称作线程。

内核提供一个方便创建内核线程的函数叫kernel_thread ,原型: int kernel_thread(int (*fn)(void *),void *arg ,unsigned long flag) 他会先进行一些其他数据或结构的维护,然后最终还要调用do_fork:

int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags)
{
struct pt_regs regs;
memset(&regs, 0, sizeof(regs));
regs.si = (unsigned long) fn;
regs.di = (unsigned long) arg;
#ifdef CONFIG_X86_32
regs.ds = __USER_DS;
regs.es = __USER_DS;
regs.fs = __KERNEL_PERCPU;
regs.gs = __KERNEL_STACK_CANARY;
#else
regs.ss = __KERNEL_DS;
#endif
regs.orig_ax = -1;
regs.ip = (unsigned long) kernel_thread_helper;
regs.cs = __KERNEL_CS | get_kernel_rpl();
regs.flags = X86_EFLAGS_IF | 0x2;
/* Ok, create the new process.. */
return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, &regs, 0, NULL, NULL);
}
struct pt_regs {
long ebx;
long ecx;
long edx;
long esi;
long edi;
long ebp;
long eax;
int  xds;
int  xes;
int  xfs;
int  xgs;
long orig_eax;
long eip;
int  xcs;
long eflags;
long esp;
int  xss;
};

如果没有这个标志而只有CLONE_FS或者CLONE_FILES标志,那么创建的子进程只共享父进程的fs_struct和files_struct结构,此时还把它们叫做进程。所以在linux上线程本质是一个共享资源的手段,对内核而言根本不区分它们。 mm_struct用于描述用户态进程上下文,所以内核线程都没有这个数据结构(其实并不是没有,而是将它指向另一个用户进程的mm_struct)。当调度内核线程时,它将借用上一个用户进程的mm_struct(内核线程的active_mm指向上一个用户进程的mm_struct),而所有用户进程页表的高端都是内核页表,描述内核空间,由此内核线程就可以在内核空间内运行了。 总结一下 :

内核线程

内核线程只运行在内核态,不受用户态上下文的拖累。

Ø         处理器竞争:可以在全系统范围内竞争处理器资源;

Ø         使用资源:唯一使用的资源是内核栈和上下文切换时保持寄存器的空间(看一下struct pt_regs的设置)

Ø         调度:调度的开销可能和进程自身差不多昂贵

Ø         同步效率:资源的同步和数据共享比整个进程的数据同步和共享要低一些。

—————————————————————————————————-

顺便再说一下用户线程,这类线程首先由应用程序调用线程库为出发点。线程库调用系统调用clone。也就是说一个用户线程会对应内核的一个进程(当然资源是共享的),创建流程和内核进程类似。 LinuxThreads是用户空间的线程库,所采用的是线程-进程1对1模型(即一个用户线程(注意这里的用户线程也不是教科书上的用户线程)对应一个轻量级进程,而一个轻量级进程对应一个特定的内核线程),将线程的调度等同于进程的调度,调度交由内核完成,而线程的创建、同步、销毁由核外线程库完成(LinuxThreads已绑定到GLIBC中发行)。在LinuxThreads中,由专门的一个管理线程处理所有的线程管理工作。 最后,不要将教科书上的线程模型和linux中线程的实现搞混,这两者名字差不多,但概念相差较远(原因是理论的那套太复杂,linux没有实现)。貌似windows实现的进程比较接近教科书… 没研究了

再总结一下:

轻量级进程

轻量级进程(LWP)是建立在内核之上并由内核支持的用户线程,它是内核线程的高度抽象,每一个轻量级进程都与一个特定的内核线程关联。内核线程只能由内核管理并像普通进程一样被调度。

轻量级进程由clone()系统调用创建,参数是CLONE_VM,即与父进程是共享进程地址空间和系统资源。

与普通进程区别:LWP只有一个最小的执行上下文和调度程序所需的统计信息。

Ø         处理器竞争:因与特定内核线程关联,因此可以在全系统范围内竞争处理器资源

Ø         使用资源:与父进程共享进程地址空间

Ø         调度:像普通进程一样调度

关于linux线程实现一个更具体的介绍可以看看这个 http://www.ibm.com/developerworks/cn/linux/kernel/l-thread/

如果搞不清哪些所谓的XX线程就看看这个吧,应该是权威的说明:http://linas.org/linux/threads-faq.html

WARNING: “__moddi3” undefined!

[杯具,餐具,都在茶几上]

今天编译内核遇到这个warning: WARNING: “__moddi3” undefined!

尽管是个warning,但插入内核时会提示 -1 符号找不到。

[追根溯源]

冷静一下分析一下原因吧 ,首先去内核里面去找任何关于moddi3 的东西:

分别在frv_ksyms.c ,ia64_ksyms.c ,h8300_ksyms.c ,parisc_ksyms.c定义了原型:

extern void __moddi3(void);

以上c文件(在arch/XXX/kernel)都是定义和体系结构的有关的符号,并导出。(只知道Ia64,其他的是啥子CPU啊)

以及exports.c (在arch/tile/lib/)定义原型:

int64_t __moddi3(int64_t dividend, int64_t divisor);

可见这个__moddi3 是体系相关,而且都是64位。 mod 应该是求商/求余相关,难道是这个符号是用来做64位除法?

我有用64位除法吗? 翻了翻代码找到了这句:

int omg_data_size=0;

……….

omg_data_size=*(OMG_SIZE_INFO_OFFSET+user_buffer+0)<<24;
omg_data_size+=*(OMG_SIZE_INFO_OFFSET+user_buffer+1)<<16;
omg_data_size+=*(OMG_SIZE_INFO_OFFSET+user_buffer+2)<<8;

………..

omg_size=(omg_data_size/0x3f18)*8+omg_data_size+8;

………..

__distance_to_header=(*ppos-0x5a)%0x3f10;

哦,我明白了,omg_data_size 是有通过移位运算的,int 是32位,左移之后gcc将变量转换为64位。然后做了一次求商。另外ppos应该也是一个超长的值用来寻址大缓存(查了一下资料说“在32位体系中也至少是64位宽” )。所以gcc应该会去找__moddi3 这个符号。可惜的是我的体系结构是X86没有定义这个符号,于是乎就发生了杯具的一幕。

[柳暗花明]

内核提供一个正确处理这种情况的函数:do_div(n,base)。此处do_div得到的结果是余数而真正的a/b的结果,是用a来保存的。 do_div(n,base)的具体定义,和当前体系结构有关(这是毫无疑问的,不然就不是内核态了,用glibc就可以摆平),对于arm平台,在 arch/arm/include/asm/div64.h,对于x86在arch/x86/include/asm/div64.h。  其实现很复杂,先不深究了。

因为do_div将商保存在被除数中,把原值覆盖了,所以实际运用时要用临时变量保存被除数。

使用do_div(),需要先 #include <linux/math64.h> 这个不能少。

另外内核还提供一些其他处理64位除法的函数:

static inline u64 div_u64(u64 dividend, u32 divisor); //对应无符号64位被除数

static inline s64 div_s64(s64 dividend, s32 divisor);//对应有符号64位被除数

static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder);//对应无符号64位被除数,remainder为余数

static inline s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder);//对应有符号64位被除数,remainder为余数

其实前两个就是通过内联调用后面两个。此外后面两个函数和do_div()没有调用关系,而且看注释好像它比do_div效率高,而且容易看懂: This is the most common 64bit divide and should be used if possible, * as many 32bit archs can optimize this variant better than a full 64bit * divide.

*******************************

当我把代码重新修改编译完毕后,我想到: 根据实际情况,omg_data_size不可能超过32位,因为*(OMG_SIZE_INFO_OFFSET+user_buffer+0) 的结果肯定是8位,最大左移24位也就是32位。那么强制转换一下吧,给gcc一个明确的指示:

omg_size=((long)omg_data_size/0x3f18)*8+(long)omg_data_size+8;

………………

__distance_to_header=((long)*ppos-0x5a)%0x3f10;

SONY HiMD RH1 驱动分析

简单测试了一下RH1 的usb 属性,可以知道:

usb_dev:

product:Net MD/Hi-MD,

manufacturer:Sony,
serial:0200012672F9
number of configuration:1
number of endpoint:2     两个usb端点
endpoint type:2,index:1,direction:80   端点1 ,批量处理模式,方向device -> host ,输入
endpoint type:2,index:2,direction:0     端点2, 批量处理模式,方向host->device ,输出
Dec 23 23:43:33 Dekernel kernel: [   81.213933] NetMD 3-2:1.0: usb_probe_interface
Dec 23 23:43:33 Dekernel kernel: [   81.213936] NetMD 3-2:1.0: usb_probe_interface – got id
Dec 23 23:43:33 Dekernel kernel: [   81.213940] NetMD 3-2:1.0: buffer size:64
Dec 23 23:43:33 Dekernel kernel: [   81.213954] NetMD 3-2:1.0: looking for a minor, starting at 192
Dec 23 23:43:33 Dekernel kernel: [   81.214024] NetMD 3-2:1.0: USB device NETMD attached to USB minor :192
Dec 23 23:43:33 Dekernel kernel: [   81.214048] usbcore: registered new interface driver NetMD
进入最后的攻坚阶段,但写盘有问题  … 坚持啊
./netmd write /media/disk/01-Philosophyz.oma
Found a NetMD device!
Net MD/Hi-MD
Raw title: 1;         ?//2-3;Last regrets / Place of wind which arrives//4;          DISC1//5;     /TORCH//6; Pacific Moon III//7;Dream Port//8;     featured in FINAL FANTASY X//9;colorless wind//
Disc Title: <Untitled>
Size of data: 7471145
Size of data w/ headers: 7474849
Waiting for Sync:
Sending command:
00 18 00 08 00 46 f0 03 01 03 28 ff 00 01 00 10                 …..F�…(�….
01 ff ff 00 94 02 00 00 00 06 00 72 0e a1                       .��.�……r.�
Recieving response:
a1 0e 72 00                                                     �.r.
0f 18 00 08 00 46 f0 03 01 03 28 00 00 01 00 10                 …..F�…(…..
01 00 01 00 94 02 00 00 00 06 00 72 0e a1 00 00                 ….�……r.�..
00 00 00 00 00 00 00 00 ff ff ff ff 00 00 00 00                 ……..����….
00 00 00 00 f8 7f 06 08 02 00 00 00 f4 01 00 00                 ….�……�…
02 00 00 00 0c 00 00 00 00 00 00 00 50 8f 5a b7                 …………P�Z�
2c fa a0 bf 68 3d 06 08 00 00 00 00 00 00 00 00                 ,���h=……….
02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00                                                           ..
Success for record like commandDiffer: 6
Waiting for Sync:
pos: 90/7471235; remain data: 7471145
Chunksize: 4096
distance_to_header: 0
Bytes left: 7471145
Inserting header
bytes left in chunk: 16128
Sending 4096 bytes to md
00 00 00 00 00 00 3f 00 d4 4b dc aa ef 68 22 e2                 ……?.�Kܪ�h”�
00 00 02 00 52 00 65 00 77 00 72 00 69 00 74 00                 ….R.e.w.r.i.t.
65 00 20 00 4f 00 70 00 65 00 6e 00 69 00 6e 00                 e. .O.p.e.n.i.n.
67 00 20 00 54 00 68 00 65 00 6d 00 65 00 20 00                 g. .T.h.e.m.e. .
73 00 6f 00 6e 00 67 00 20 00 50 00 68 00 69 00                 s.o.n.g. .P.h.i.
6c 00 6f 00 73 00 6f 00 70 00 68 00 79 00 7a 54                 l.o.s.o.p.h.y.zT
43 4f 4e 00 00 00 11 00 00 02 30 dd 30 c3 30 d7                 CON…….0�0�0�
00 20 00 28 4e 00 82 2c 00 29 54 58 58 58 00 00                 . .(N.�,.)TXXX..
00 3b 00 00 02 00 4f 00 4d 00 47 00 5f 00 54 00                 .;….O.M.G._.T.
50 00 45 00 31 00 53 00 00 ff 1f ff 1f ff 1f ff                 P.E.1.S..����
1f ff 1f 30 00 ff 08 ff 2e ff 41 ff 4e ff 4f ff                 �0.�.�.�A�N�O�
53 ff 49 ff 5a ff 45 ff 2d ff 49 ff 52 ff 09 54                 S�I�Z�E�-�I�R�.T
58 58 58 00 00 00 17 00 00 02 00 4f 00 4d 00 47                 XXX……..O.M.G
00 5f 00 54 00 52 00 41 00 43 00 4b 00 00 00 31                 ._.T.R.A.C.K…1
54 58 58 58 00 00 00 61 00 00 02 00 4f 00 4d 00                 TXXX…a….O.M.
47 00 5f 00 41 00 4c 00 42 00 4d 00 53 00 00 ff                 G._.A.L.B.M.S..�
32 ff 45 ff 57 ff 52 ff 49 ff 54 ff 45 30 00 ff                 2�E�W�R�I�T�E0.�
2f ff 50 ff 45 ff 4e ff 49 ff 4e ff 47 30 00 ff                 /�P�E�N�I�N�G0.�
34 ff 48 ff 45 ff 4d ff 45 30 00 ff 53 ff 4f ff                 4�H�E�M�E0.�S�O�
4e ff 47 30 00 ff 30 ff 48 ff 49 ff 4c ff 4f ff                 N�G0.�0�H�I�L�O�
53 ff 4f ff 50 ff 48 ff 59 ff 5a 54 58 58 58 00                 S�O�P�H�Y�ZTXXX.
00 00 23 00 00 02 00 4f 00 4d 00 47 00 5f 00 41                 ..#….O.M.G._.A
00 53 00 47 00 54 00 4d 00 00 00 31 00 35 00 39                 .S.G.T.M…1.5.9
00 38 00 30 00 30 00 30 54 58 58 58 00 00 00 3b                 .8.0.0.0TXXX…;
00 00 02 00 4f 00 4d 00 47 00 5f 00 41 00 54 00                 ….O.M.G._.A.T.
50 00 31 00 53 00 00 ff 1f ff 1f ff 1f ff 1f ff                 P.1.S..�����
1f 30 00 ff 08 ff 2e ff 41 ff 4e ff 4f ff 53 ff                 0.�.�.�A�N�O�S�
49 ff 5a ff 45 ff 2d ff 49 ff 52 ff 09 54 58 58                 I�Z�E�-�I�R�.TXX
58 00 00 00 39 00 00 02 00 4f 00 4d 00 47 00 5f                 X…9….O.M.G._
00 41 00 54 00 50 00 45 00 31 00 00 6c 34 8c 37                 .A.T.P.E.1..l4�7
00 20 74 60 59 48 00 28 00 4e 00 61 00 6e 00 6f                 . t`YH.(.N.a.n.o
00 73 00 69 00 7a 00 65 00 4d 00 69 00 72 00 29                 .s.i.z.e.M.i.r.)
54 58 58 58 00 00 00 2b 00 00 02 00 4f 00 4d 00                 TXXX…+….O.M.
47 00 5f 00 54 00 49 00 54 00 32 00 53 00 00 ff                 G._.T.I.T.2.S..�
30 ff 48 ff 49 ff 4c ff 4f ff 53 ff 4f ff 50 ff                 0�H�I�L�O�S�O�P�
48 ff 59 ff 5a 54 58 58 58 00 00 00 3b 00 00 02                 H�Y�ZTXXX…;…
00 4f 00 4d 00 47 00 5f 00 54 00 52 00 4c 00 44                 .O.M.G._.T.R.L.D
00 41 00 00 00 32 00 30 00 31 00 31 00 2f 00 30                 .A…2.0.1.1./.0
00 31 00 2f 00 30 00 31 00 20 00 30 00 30 00 3a                 .1./.0.1. .0.0.:
00 30 00 30 00 3a 00 30 00 30 54 43 4f 4d 00 00                 .0.0.:.0.0TCOM..
00 09 00 00 02 62 98 62 38 4f 38 53 f8 54 4c 45                 …..b�b8O8S�TLE
4e 00 00 00 0d 00 00 02 00 32 00 39 00 31 00 37                 N……..2.9.1.7
00 31 00 32 54 58 58 58 00 00 00 3f 00 00 02 00                 .1.2TXXX…?….
55 00 53 00 52 00 5f 00 4c 00 32 00 54 00 4d 00                 U.S.R._.L.2.T.M.
44 00 44 00 41 00 00 00 32 00 30 00 31 00 31 00                 D.D.A…2.0.1.1.
2f 00 30 00 31 00 2f 00 33 00 31 00 20 00 32 00                 /.0.1./.3.1. .2.
33 00 3a 00 32 00 32 00 3a 00 31 00 36 47 45 4f                 3.:.2.2.:.1.6GEO
42 00 00 01 ca 00 00 02 62 69 6e 61 72 79 00 00                 B…�…binary..
00 00 4f 00 4d 00 47 00 5f 00 42 00 4b 00 4c 00                 ..O.M.G._.B.K.L.
53 00 49 00 00 00 01 00 40 00 dc 00 70 00 08 00                 S.I…..@.�.p…
00 00 00 00 00 4b 45 59 52 49 4e 47 20 20 20 20                 …..KEYRING
20 00 10 00 03 00 28 00 01 00 03 00 00 00 00 00                  …..(………
00 00 01 00 1d ab 30 9d f0 ce 7d c8 05 3e d9 97                 …..�0���}�.>ٗ
27 4f 85 48 b6 a9 9c 81 f2 ae 66 18 ff 00 00 00                 ‘O�H������f.�…
00 00 00 00 00 45 4b 42 20 00 00 00 00 00 00 00                 …..EKB …….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 01 00 1d 00 00 00 00 39 47 f4                 ………….9G�
0a 33 65 2f 98 71 73 c3 98 68 c5 23 5b 84 20 c8                 .3e/�qsØh�#[� �
cf fb 0e 7f 4e 00 00 00 0c 00 00 00 50 00 00 00                 ��.N…….P…
34 85 14 51 45 04 02 ff fe 00 00 00 00 36 d2 00                 4�.QE..��….6�.
38 74 91 51 9d a7 75 94 70 a0 17 69 da 69 55 ae                 8t�Q��u�p�.i�iU�
a6 9f 6a 3e 69 18 c7 c6 bb d7 cc fb 1b 81 8d a9                 ��j>i.�ƻ���.���
97 90 67 29 5c b7 55 5a ec 21 1b 9e bd d4 7e d9                 ��g)\�UZ�!.���~�
09 79 e0 39 a1 e0 76 68 0d b8 bf ed b0 d3 24 26                 .y�9��vh.�����$&
b8 f7 79 22 bd 46 c9 44 9f df 01 74 c0 00 00 00                 ��y”�F�D��.t�…
08 01 00 00 00 01 00 00 28 db 54 6a c5 e0 4d 4f                 ……..(�Tj��MO
cb f2 46 3b 01 de 2c d0 fb af 7a a7 1e ef 44 29                 ��F;.�,���z��D)
05 97 9d be e7 28 4e a4 53 3a 2f 71 c7 cb 86 58                 .����(N�S:/q�ˆX
39 21 43 49 44 20 20 20 20 20 20 20 20 00 10 00                 9!CID        …
02 00 00 00 00 01 0f 50 00 00 04 00 00 00 a4 d5                 …….P……��
db e3 cf 11 9f db 1c b5 2d 00 00 00 00 00 00 00                 ���.��.�-…….
00 53 48 41 52 45 5f 50 5f 53 49 44 20 00 10 00                 .SHARE_P_SID …
01 01 02 00 00 00 00 00 00 a7 13 c0 94 80 9d 3b                 ………�.���;
d6 21 52 45 46 49 44 20 20 20 20 20 20 00 10 00                 �!REFID      …
01 01 01 00 00 03 01 02 00 00 00 00 00 00 00 00                 …………….
00 a7 0f f6 0b 9e 94 1f 45 00 00 00 00 00 00 00                 .�.�.��E…….
00 47 45 4f 42 00 00 00 5e 00 00 02 62 69 6e 61                 .GEOB…^…bina
72 79 00 00 00 00 4f 00 4d 00 47 00 5f 00 47 00                 ry….O.M.G._.G.
4e 00 4d 00 49 00 44 00 00 33 43 44 33 4e 35 33                 N.M.I.D..3CD3N53
51 32 33 31 36 36 37 37 34 34 56 38 38 42 44 43                 Q231667744V88BDC
37 41 38 30 39 37 42 36 43 46 38 30 43 42 32 38                 7A8097B6CF80CB28
30 32 42 41 39 45 31 31 45 31 31 30 46 50 33 00                 02BA9E11E110FP3.
00 00 00 00 00 00 00 00 00 47 45 4f 42 00 00 00                 ………GEOB…
7a 00 00 02 62 69 6e 61 72 79 00 00 00 00 4f 00                 z…binary….O.
4d 00 47 00 5f 00 4f 00 4c 00 49 00 4e 00 46 00                 M.G._.O.L.I.N.F.
00 30 80 04 4c 30 80 04 10 08 ca 88 c1 38 4d 19                 .0�.L0�…ʈ�8M.
07 e7 da 49 f9 8d 30 d3 52 04 10 01 0f 50 00 00                 .��I��0�R….P..
04 00 00 00 00 00 db e3 cf 11 9f 04 00 04 00 04                 ……���.�…..
00 04 1c 01 00 00 00 00 00 00 00 00 00 55 7b 00                 ………….U{.
00 b1 ff 00 00 e6 02 00 01 22 a4 00 01 78 0e 00                 .��..�…”�..x..
00 04 08 7b 2d 55 c4 3d e0 be 6f 00 00 00 00 00                 …{-U�=��o…..
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 45 41                 …………..EA
33 01 00 60 ff ff 00 00 00 00 01 0f 50 00 00 04                 3..`��……P…
00 00 00 a4 d5 db e3 cf 11 9f db 1c b5 2d 00 00                 …�����.��.�-..
20 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00                  0…………..
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 a0 02                 …………..�.
4e 9f 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 N�…………..
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 a0 02                 …………..�.
4e 9f 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 N�…………..
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 a0 02                 …………..�.
4e 9f 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 N�…………..
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 a0 02                 …………..�.
4e 9f 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 N�…………..
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 a0 02                 …………..�.
4e 9f 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 N�…………..
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 a0 02                 …………..�.
4e 9f 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 N�…………..
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
pos: 4178/7471235; remain data: 7467057
Chunksize: 4096
distance_to_header: 12056
Bytes left: 7467057
Sending 4096 bytes to md
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 a0 02                 …………..�.
4e 9f 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 N�…………..
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 a0 02                 …………..�.
4e 9f 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 N�…………..
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 a0 02                 …………..�.
4e 9f 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 N�…………..
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 a0 02                 …………..�.
4e 9f 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 N�…………..
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 a0 02                 …………..�.
4e 9f 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 N�…………..
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 a0 02                 …………..�.
4e 9f 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 N�…………..
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 a0 02                 …………..�.
4e 9f 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 N�…………..
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 a0 02                 …………..�.
4e 9f 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 N�…………..
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 a0 02                 …………..�.
4e 9f 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 N�…………..
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 a0 02                 …………..�.
4e 9f 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 N�…………..
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 a0 02                 …………..�.
4e 9f 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 N�…………..
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 a0 02                 …………..�.
4e 9f 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 N�…………..
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 a0 02                 …………..�.
4e 9f 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 N�…………..
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 a0 02                 …………..�.
4e 9f 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 N�…………..
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 a0 02                 …………..�.
4e 9f 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 N�…………..
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 a0 02                 …………..�.
4e 9f 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 N�…………..
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 a0 02                 …………..�.
4e 9f 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 N�…………..
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 a0 02                 …………..�.
4e 9f 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 N�…………..
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 a0 02                 …………..�.
4e 9f 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 N�…………..
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 a0 02                 …………..�.
4e 9f 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 N�…………..
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 a0 02                 …………..�.
4e 9f 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 N�…………..
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                 …………….
Error writing track 110
2/25 更新 :
好像是oma/omg 文件的问题 ,这些文件的格式 好像和AA3 的不一样了,有空我再试试从netmd导出文件 ,在导入进去 ,看是否ok

linux 下安全证书管理

linux 下使用安全证书相对比较麻烦,不同的安全套件,没有gui配置界面……

其实使用安全证书对我而言也就是网上银行而已。 firefox 和chrome是我用过的两款浏览器,就在这两个平台上搞吧。

首先要安装这些包:

mozilla-nss                         | Network Security Services
mozilla-nss-certs              | CA certificates for NSS
mozilla-nss-devel              | Network (Netscape) Security Services development files
mozilla-nss-tools              | Tools for developing, debugging, and managing applications that use NSS

没错,都是mozilla基金的东西,但不用担心,chrome也使用他们而没有重新发明轮子。

1.首先创建一个nss数据库:

certutil -N -d ~/.pki/nssdb     #之所以是这个路径是因为firefox和chrome都默认从这里找证书

-N表示新建安全数据库,-d指定数据文件目录,执行完毕后出现3个数据库文件:

cert8.db ,key3.db, secmod.db

2.导入CA 证书:

curl -k -o "cacert-root.crt"   "http://www.cacert.org/certs/root.crt"
curl -k -o "cacert-class3.crt" "http://www.cacert.org/certs/class3.crt"
certutil -d sql:$HOME/.pki/nssdb -A -t TC -n "CAcert.org" -i cacert-root.crt
certutil -d sql:$HOME/.pki/nssdb -A -t TC -n "CAcert.org Class 3" -i cacert-class3.crt

-A表示新增,-t 表示导入证书的类型,后面详解。-n 表示证书别名(在-L 选项中显示和在浏览器看到),-i表示证书文件的路径。

certutil -d sql:$HOME/.pki/nssdb -A -t TC -n “CA-Name” -i /path/to/file

3.显示所有已导入证书:

certutil -L -d sql:/root/.pki/nssdb/
Certificate Nickname                                         Trust Attributes
SSL,S/MIME,JAR/XPI
le-e70c91a0-461d-45e9-b3e2-1b038274c136                      u,u,u
CAcert.org                                                   CT,,
CAcert.org Class 3                                           CT,,
ABC                                                          CT,C,C
http://www.95599.cn                                                 CT,,
alibaba_ca                                                   CT,C,C
alibaba_user_ca                                              CT,C,C
alibaba_mechine_ca                                           CT,C,C
{D7EC8906-1E2A-425F-A3F8-C0E55FF8DFAF}                       u,u,u

左列是别名,右边是信任属性:

p    Valid peer
P    Trusted peer (implies p)
c    Valid CA
T    Trusted CA to issue client certs (implies c)
C    Trusted CA to issue server certs(for ssl only) (implies c)
u    User cert
w    Send warning

4. 查看某个证书详细信息:

certutil -L -d sql:/root/.pki/nssdb/ -n ABC  #用-n指定别名就行

Certificate:
Data:
Version: 3 (0x2)
Serial Number:
7b:97:ca:10:27:5a:00:00:00:01
Signature Algorithm: PKCS #1 SHA-1 With RSA Encryption
Issuer: “O=ABC,CN=ABC”
Validity:
Not Before: Mon Aug 11 05:38:49 2003
Not After : Fri Aug 11 05:38:49 2023
Subject: “O=ABC,CN=ABC”
Subject Public Key Info:
Public Key Algorithm: PKCS #1 RSA Encryption
RSA Public Key:
Modulus:
ff:fd:2e:56:6d:e2:d4:4c:48:2e:23:c7:e2:10:b2:96:
54:5e:a0:3e:cf:97:cc:0e:b1:fd:81:8b:98:33:93:5a:
96:20:e9:0e:b1:5d:31:0c:5a:68:a2:5e:a8:6d:77:39:
9c:59:77:d5:56:a9:20:f6:d1:0a:19:89:68:d4:7f:4d:
7b:74:20:ca:0f:0c:c7:d7:31:6a:18:27:32:97:6a:92:
0a:30:63:96:68:c0:5b:00:c2:79:58:a6:f7:1b:b9:06:
5a:a7:df:09:24:5e:a5:2d:45:90:85:5f:e8:e8:c9:a5:
c4:dc:04:74:2c:ea:5f:9a:36:4e:60:f1:3e:bd:45:d5
Exponent: 65537 (0x10001)
Signed Extensions:
5.删除指定证书:
certutil -D -n <the name> -d sql:$HOME/.pki/nssdb
6.导入个人证书和私钥:
这类证书主要是实名认证和网银的个人证书:
pk12util -d sql:$HOME/.pki/nssdb -i PrivateKey.pfx

PS: 获得证书的方法除了通过chrome export 外,也可以用以下的脚本做到:
#!/bin/sh
#
# usage:  import-cert.sh remote.host.name [port]
#
REMHOST=$1
REMPORT=${2:-443}
exec 6>&1
exec > $REMHOST
echo | openssl s_client -connect ${REMHOST}:${REMPORT} 2>&1 |sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p'
certutil -d sql:$HOME/.pki/nssdb -A -t TC -n "$REMHOST" -i $REMHOST 
exec 1>&6 6>&-

了解了上述内容是不是要准备把CNNIC的根证书和其他流氓机构颁发的证书全都清理掉呢?
别急,其实上述certutil工具是完全无法移除这些流氓证书的。不信,你用certutil是查看不到这些流氓的。原因是certutil只能对用户自己导入的证书做管理(e.g 就是$HOME/.pki/nssdb这里),而无法管理系统自带的证书。在chrome等浏览器里面可以看到这些系统自带证书,但也无法管理。那么系统自带的证书在哪里?

其实系统自带的证书就是mozilla-nss-certs这个包里的证书:
#rpm -ql mozilla-nss-certs
/usr/lib64/libnssckbi.so
不过这里无法这接去对它做删除,因为他是打包成了动态连接库的形式,只能去下载mozilla-nss的源码包修改后再编译。具体方法如下:

去http://www.mozilla.org/projects/security/pki/nss/下载源码或去下载发行版的SRPM

解压并编辑文件:

nss/lib/ckfw/builtins/certdata.txt

将下面的内容完全删除然后在编译即可(过程很漫长~~);

#
# Certificate "CNNIC ROOT"
#
CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
CKA_TOKEN CK_BBOOL CK_TRUE
CKA_PRIVATE CK_BBOOL CK_FALSE
CKA_MODIFIABLE CK_BBOOL CK_FALSE
CKA_LABEL UTF8 "CNNIC ROOT"
CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
CKA_SUBJECT MULTILINE_OCTAL
6062611360110603\12504062302\103\11661
1660140603\12504122305\103\116\116\111\10361
2360210603\12504032312\103\116\116\111\10340
\122\117\117\124
END
CKA_ID UTF8 "0"
CKA_ISSUER MULTILINE_OCTAL
6062611360110603\12504062302\103\11661
1660140603\12504122305\103\116\116\111\10361
2360210603\12504032312\103\116\116\111\10340
\122\117\117\124
END
CKA_SERIAL_NUMBER MULTILINE_OCTAL
0204\111630001
END
CKA_VALUE MULTILINE_OCTAL
60\20203\12560\2020275\240030201020204\111
6300016015061152\206\110\206\36715010105
05006062611360110603\12504062302\103
\116611660140603\12504122305\103\116\116\111
\103612360210603\12504032312\103\116\116\111
\10340\122\117\117\12460362715606760646166
606760716164\132271562676064616660
6760716164\1326062611360110603\12504
062302\103\116611660140603\12504122305
\103\116\116\111\103612360210603\12504032312
\103\116\116\111\10340\122\117\117\12460\20201426015
061152\206\110\206\36715010101050003\20201
170060\202011202\202010100\32365\36777\163
\167\255\350\133\16327\302\321\157\355\125\274\156\352\350\244
\171\262\154\303\243\357\341\237\26173\110\205\365\232\13441
422054\305\202\316\332\343\232\15667\341\20754\334\271
14\132\272\210\125\337\375\252\3333761\35201\361\33771
01\30123\375\110\12241\304\125\337\332\330\263\124\166\272
\164\261\267\175\327\300\350\366\131\305\115\310\275\2553724
\332\337\130\10445623152\307\176\176\216\25670\26060
\173\107\1621161\36060\333\30333\16651\273\151\166\116
\127\37133\144\242\223\126\267\157\231\156\3331204\23421
\343\20037\313\143\2242012\251\341\144\20261\371\21447
\355\246\23100\366\160\22330\370\24164\206\243\335\172\302
30\171\366\172\14565\317\220\353\27563\223\237\123\253\163
73\346\23364405735\357\25135\14332\240\200\33303
57\3714632\206\322\215\273\251\276\12272\207\147\11015
\277\264\240\33046\27643\137\16367\17746\346\22204\243
\177\31740\247\267\36372\312\313\231\3130203010001
\243\16360\16160210611\140\206\11001\206\370\10201
0104040302000760370603\12535430430
6026\20024\145\36261\25552\367\367\335\122\22612\307
02\30116\357\246\325732160170603\125352301
01\377040560030101\37760130603\1253517
0404030201\37660350603\1253516042604
24\145\36261\25552\367\367\335\122\22612\30702\30116
\357\246\32573216015061152\206\110\206\3671501
0105050003\202010100\11365\356\314\344\256\277
\303\156\255\237\22573\11377\13336\337\12751\242\131\312
70\342\27132\377\236\346\15662\33536\256\35265\267\365
\223\221\116\332\102\341\30327\140\120\362\321\13446\271\202
\267\352\155\344\234\204\34703\17127\257\23075\224\333\307
\27200\347\270\27701\127\301\167\105621473\361\26434
10\260\375\121\240\241\335\232352366\232\155\267\30774
\271\341\305\33127\372\203\3257525\24074\2733613\342
\310\22077\250\20614\374\371\213\136\205\313\117\133\113\142
21\107\305\105\1740557\101\261\23620\15133\231\226\340
\125\171\373\116\206\231\270\224\332\20670\152\223\243\347\313
\156\345\337\35241\125\211\234\175\175\177\230\36500\211\356
\343\204\300\134\226\265\305\106\352\106\340\205\125\26633\311
22\326\301\315\315\200\363020174\310\151\313\105\110\143
\330\224\320\354\2051673\11621\145\364\202\214\24675\256
5642\22411\310\134\35274\201\135265203\22726\125
11\333\212\101\202\236\146\23321
END

# Trust for Certificate "CNNIC ROOT"
CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
CKA_TOKEN CK_BBOOL CK_TRUE
CKA_PRIVATE CK_BBOOL CK_FALSE
CKA_MODIFIABLE CK_BBOOL CK_FALSE
CKA_LABEL UTF8 "CNNIC ROOT"
CKA_CERT_SHA1_HASH MULTILINE_OCTAL
\213\257\114\23335\36052\222\367\33222\216\27133\254\364
\230\140\113\157
END
CKA_CERT_MD5_HASH MULTILINE_OCTAL
41\274\202\253\111\3042373\113\26253\134\153\220\23431
END
CKA_ISSUER MULTILINE_OCTAL
6062611360110603\12504062302\103\11661
1660140603\12504122305\103\116\116\111\10361
2360210603\12504032312\103\116\116\111\10340
\122\117\117\124
END
CKA_SERIAL_NUMBER MULTILINE_OCTAL
0204\111630001
END
CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE

#
# Certificate "China Internet Network Information Center EV Certificates Root"
#
# Issuer: CN=China Internet Network Information Center EV Certificates Root,O=China Internet Network Information Center,C=CN
# Serial Number: 1218379777 (0x489f0001)
# Subject: CN=China Internet Network Information Center EV Certificates Root,O=China Internet Network Information Center,C=CN
# Not Valid Before: Tue Aug 31 07:11:25 2010
# Not Valid After : Sat Aug 31 07:11:25 2030
# Fingerprint (MD5): 55:5D:63:00:97:BD:6A:97:F5:67:AB:4B:FB:6E:63:15
# Fingerprint (SHA1): 4F:99:AA:93:FB:2B:D1:37:26:A1:99:4A:CE:7F:F0:05:F2:93:5D:1E
CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
CKA_TOKEN CK_BBOOL CK_TRUE
CKA_PRIVATE CK_BBOOL CK_FALSE
CKA_MODIFIABLE CK_BBOOL CK_FALSE
CKA_LABEL UTF8 "China Internet Network Information Center EV Certificates Root"
CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
CKA_SUBJECT MULTILINE_OCTAL
60\201\212611360110603\12504062302\103\116
616260600603\12504121451\103\150\151\156\141
40\111\156\164\145\162\156\145\16440\116\145\164\167\157\162
\15340\111\156\146\157\162\155\141\164\151\157\15640\103\145
\156\164\145\16261\10760\1050603\12504031476\103
\150\151\156\14140\111\156\164\145\162\156\145\16440\116\145
\164\167\157\162\15340\111\156\146\157\162\155\141\164\151\157
\15640\103\145\156\164\145\16240\105\12640\103\145\162\164
\151\146\151\143\141\164\145\16340\122\157\157\164
END
CKA_ID UTF8 "0"
CKA_ISSUER MULTILINE_OCTAL
60\201\212611360110603\12504062302\103\116
616260600603\12504121451\103\150\151\156\141
40\111\156\164\145\162\156\145\16440\116\145\164\167\157\162
\15340\111\156\146\157\162\155\141\164\151\157\15640\103\145
\156\164\145\16261\10760\1050603\12504031476\103
\150\151\156\14140\111\156\164\145\162\156\145\16440\116\145
\164\167\157\162\15340\111\156\146\157\162\155\141\164\151\157
\15640\103\145\156\164\145\16240\105\12640\103\145\162\164
\151\146\151\143\141\164\145\16340\122\157\157\164
END
CKA_SERIAL_NUMBER MULTILINE_OCTAL
0204\110\2370001
END
CKA_VALUE MULTILINE_OCTAL
60\20203\36760\20202\337\240030201020204\110
\23700016015061152\206\110\206\36715010105
050060\201\212611360110603\12504062302
\103\116616260600603\12504121451\103\150\151
\156\14140\111\156\164\145\162\156\145\16440\116\145\164\167
\157\162\15340\111\156\146\157\162\155\141\164\151\157\15640
\103\145\156\164\145\16261\10760\1050603\125040314
76\103\150\151\156\14140\111\156\164\145\162\156\145\16440
\116\145\164\167\157\162\15340\111\156\146\157\162\155\141\164
\151\157\15640\103\145\156\164\145\16240\105\12640\103\145
\162\164\151\146\151\143\141\164\145\16340\122\157\157\16460
362715616060706361606761616265\132
2715636060706361606761616265\13260
\201\212611360110603\12504062302\103\11661
6260600603\12504121451\103\150\151\156\14140
\111\156\164\145\162\156\145\16440\116\145\164\167\157\162\153
40\111\156\146\157\162\155\141\164\151\157\15640\103\145\156
\164\145\16261\10760\1050603\12504031476\103\150
\151\156\14140\111\156\164\145\162\156\145\16440\116\145\164
\167\157\162\15340\111\156\146\157\162\155\141\164\151\157\156
40\103\145\156\164\145\16240\105\12640\103\145\162\164\151
\146\151\143\141\164\145\16340\122\157\157\16460\2020142
6015061152\206\110\206\36715010101050003
\20201170060\202011202\202010100\233\176\163
\356\27573\170\252\144\103\101\365\120\337\224\36256\262\215
\112\216\106\124\3224122\3107162\10206\351\203\325\237
\122\355\345\1470373\124\301\214\231\231\314\351\30017\377
15\331\20421\262\270\321\313\133\33436\371\15061\144\341
\233\372\164\353\150\27140\225\367\30617\215\107\254\13206
\335\141\253\342\354\330\2372755\234\3127465\227\125\161
\315\103\205\261\10726\36554\123\200\166\317\32300\144\275
\100\231\335\314\330\333\304\237\32623\137\101\203\213\37115
\207\222\12664\15432201327\325\13234\227\130\20474
\2043256\134\22164\15631\137\17727\151\305\145\357\153
41\306\325\12072\277\141\27105\215\357\1576472\262\157
24\143\2772673\233\25152\375\2675370\14606\30554
\342\252\14736\105\247\21504\146\102\366\21753\357\21040
\151\21762\21424\163\33253\206\221\14342\232\362\247\333
\316\211\213\253\135\30724\301\13360\15237\261\267\23656
\2010102\355\317\226\136\143\333\250\34670\267020301
0001\243\14360\14160370603\1253543043060
26\20024\174\162\11371\307\300\333\142\245\117\233\25230
64\222\242\312\203\202\13160170603\12535230101
\377040560030101\37760160603\125351701
01\37704040302010660350603\125351604
260424\174\162\11371\307\300\333\142\245\117\233\25230
64\222\242\312\203\202\1316015061152\206\110\206\367
15010105050003\20201010052\303\307\10367
\217\335\255\244\26214\356\33424\155\21750\244\230\111\313
14\200\352\363\35543\146\165\175\305\32341\147\171\321\163
\305\26503\267\130\25414\12457\306\126231761\33206
\347\1457335\15766\333\31035\371\375\20006\312\24375
\14626\250\235\11426\175\300\225\106\265\121\344\34237\327
\35206\115\143\215\226\214\357\34763\127\10272\353\214\301
\171\310\115\166\175\336\366\261\267\201\340\240\371\241\170\106
2732\126\230\360\11675\25334\355\35471\33407\110\367
\143\37606\256\302\244\134\152\13362\210\305\30763\205\254
\146\102\107\302\13044\231\341\34576\345\16554\216\103\326
\13574\17036\250\225\20251\120\321\32126\272\357\301\276
\172\331\264\330\31436\114\106\341\167\26161\253\27552\310
\316\217\156\241\135\17703\16564\344\255\211\105\124\136\276
\25650\245\27377\170\171\353\163\2631215\375\276\311\367
\126\254\366\267\35557\2334151\30770\266\225\30404\362
\30355\3752452\220\231\27107\314\237
END

# Trust for "China Internet Network Information Center EV Certificates Root"
# Issuer: CN=China Internet Network Information Center EV Certificates Root,O=China Internet Network Information Center,C=CN
# Serial Number: 1218379777 (0x489f0001)
# Subject: CN=China Internet Network Information Center EV Certificates Root,O=China Internet Network Information Center,C=CN
# Not Valid Before: Tue Aug 31 07:11:25 2010
# Not Valid After : Sat Aug 31 07:11:25 2030
# Fingerprint (MD5): 55:5D:63:00:97:BD:6A:97:F5:67:AB:4B:FB:6E:63:15
# Fingerprint (SHA1): 4F:99:AA:93:FB:2B:D1:37:26:A1:99:4A:CE:7F:F0:05:F2:93:5D:1E
CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
CKA_TOKEN CK_BBOOL CK_TRUE
CKA_PRIVATE CK_BBOOL CK_FALSE
CKA_MODIFIABLE CK_BBOOL CK_FALSE
CKA_LABEL UTF8 "China Internet Network Information Center EV Certificates Root"
CKA_CERT_SHA1_HASH MULTILINE_OCTAL
\117\231\252\223\37353\3216746\241\231\112\316\177\36005
\362\223\13536
END
CKA_CERT_MD5_HASH MULTILINE_OCTAL
\125\135\14300\227\275\152\227\365\147\253\113\373\156\14325
END
CKA_ISSUER MULTILINE_OCTAL
60\201\212611360110603\12504062302\103\116
616260600603\12504121451\103\150\151\156\141
40\111\156\164\145\162\156\145\16440\116\145\164\167\157\162
\15340\111\156\146\157\162\155\141\164\151\157\15640\103\145
\156\164\145\16261\10760\1050603\12504031476\103
\150\151\156\14140\111\156\164\145\162\156\145\16440\116\145
\164\167\157\162\15340\111\156\146\157\162\155\141\164\151\157
\15640\103\145\156\164\145\16240\105\12640\103\145\162\164
\151\146\151\143\141\164\145\16340\122\157\157\164
END
CKA_SERIAL_NUMBER MULTILINE_OCTAL
0204\110\2370001
END
CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE

另外还有个包ca-certificates-mozilla ,他主要是安装一些.pem证书文件供/etc/ssl/certs作软链接。也就是为一些命令行程序如wget,curl使用。对浏览器没有影响。

另外一个问题我曾经有个疑问,为什么mozilla会把一些过期或已吊销的证书打包进去? 后来才明白这是避免你再次将过期或吊销的证书再次安装,干脆直接把无效证书放进去占个位子,免得有其他伪造的证书来钻空子。所以过期或已吊销证书还是不要删掉吧。

update 2015/1/4:

升级opensuse13.2之后又多了一个wosign china,估计也不是什么好鸟,同样也去掉吧。另外编译srpm的时候需要mozilla-nspr-devel rpm。