2012年9月1日 星期六

Grub / Grub2 Rebuild


進入linux中(ubuntu12.04), 用grub2的重建方式:
1. mount /dev/sda1 /mnt
  (假設要修復的硬碟的/boot是在/dev/sda1的位置上)
2. grub-install --boot-directory=/mnt /dev/sda

此時會將GRUB2放入 MBR中

重新開機後, 若是原本的系統不是Grub2的, 則會進入grub命令列

1. ls
  (列出目前的硬碟)
2. set root=(hd0,msdos1)
  (可以用tab來取得一些msdosX的資料)
3. linux /boot/vmlinuz root=/dev/sda1
  (vmlinuz可能有多個, 要自己選一下)
4. initrd /boot/initrd
  (initrd的位置可用tab補全)
5. boot
  (開機)

開機進去之後, 將grub2復原為原本的grub

1. find /boot/grub/stage1
  (找尋grub的位置)
2. root (hd0,0)
  (上一個指令讀回的位置)
3. setup (hd0)
4. quit
5. 重新開機, 做確認

GLib Compile Parameter

- If you don't want to use DEPRECATE widget, can add define G_DISABLE_DEPRECATED
 (ex. -DG_DISABLE_DEPRECATED=1)

 - If you can't accept one include file, can add define G_DISABLE_SINGLE_INCLUDES
 (ex. -DG_DISABLE_SINGLE_INCLUDES)

 - Header File List
    - glib.h
    - glib-object.h
    - gio.h
    - gmodule.h
    - glib/gi18n-lib.h or glib/gi18n.h
    - glib/gprintf.h
    - glib/gstdio.h

 - pkg-config --cflags glib-2.0 means:
   -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include

 - pkg-config --libs glib-2.0 measn:
    -L/usr/lib -lm -lglib-2.0

 - GLib Compile parameter
    pkg-config --cflags --libs glib-2.0

 - GThread compile parameter
    pkg-config --cflags --libs gthread-2.0

 - GObject compile parameter
    pkg-config --cflags --libs gobject-2.0

 - Gmodules compile parameter
    pkg-config --cflags --libs gmodule-no-export-2.0
    OR
    pkg-config --cflags --libs gmodule-2.0
    Difference:gmodule-2.0 has "--export-dynamic" (link flag)