2013-05-18

Procedures to upgrade FreeBSD kernel and base system

Step 1. Excute (3)+(4) <--- optional;

Step 2. Excute ((1)+(2) or (5)+(6))


(1) Update Security Patches
        freebsd-update fetch
        freebsd-update install

(2) Upgrade Major and Minor Version --- kernel and base
        freebsd-update -r 9.1-RELEASE upgrade
        freebsd-update install
        shutdown -r now
        freebsd-update install
        portmaster -f
        freebsd-update install

(3) Update ports collection
        # CVSUP and CSUP were phased out, now use portsnap instead
        rm –rf /usr/ports  
        portsnap fetch update
        # equivalent to “portsnap fetch”+”portsnap extract”+”portsnap update”

(4) Update the documentation sources
        rm -rf /usr/doc
        svn checkout https://svn0.us-west.FreeBSD.org/doc/head /usr/doc
        svn update /usr/doc

(5) Update source tree
        rm -rf /usr/src
        svn checkout svn://svn0.us-east.FreeBSD.org/base/releng/9.1 /usr/src
        svn update /usr/src

(6) Build "world" --- kernel and base [ ref : /usr/src/Makefile ]
        cd /usr/obj
        chflags -R noschg *
        rm -rf *
        cd /usr/src
        make cleandir
        make cleandir
        # Read /usr/src/UPDATING for update procedure
        # Check /etc/make.conf
        # Check /etc/src.conf
        make buildworld
        make buildkernel
        make installkernel
        Reboot into single user mode
        fsck -p
        mount -u /
        mount -a -t ufs
        swapon -a
        adjkerntz -I  # <--- ensure Time-zone setting correctly
        mergemaster -p
        cd /usr/src
        make installworld
        make check-old
        yes | make delete-old
        mergemaster # <---- ( or mergemaaster -i -U )
        # –i –U added to automatically install files that don’t exist and upgrade those that haven’t changed
        Reboot
        cd /usr/src
        make delete-old-libs <--- in case no 3rd party program uses them anymore
        ? portmaster -f
        # There were some changes to the configuration files left in /var/tmp/temproot.
        # Examine these and merge them into your config files.

2013-05-14

ghost tutorial


這個討論文裡面要講 Ghost 視窗裡的設定.......還有一些問題.....


...執行Ghost然後選"Options"......
我要講那裡的設定......

第一頁 Span/CRC ........

Spanning 起動影像分割功能.啟動這功能在遇到空間容量不夠.他會自動啟動分割.不會再出現訊息.問你要不要分割影像檔......
Autoname 起動替分割影像檔自動命名......
CRC Ignore 啟動這功能會呼略CRC的錯誤.會自動略過錯誤.也可以用語法.如:-CRCignore
(啟動這功能將不會檢查資料的正確性)
Create CRC32啟動這功能.會在製作影像檔時建立CRC32檔
檔名為Ghost.crc 語法為:-Fcr

第二頁 FAT32/64

FAT32 Conversion : 啟動這功能.會將FAT16格式的來源分割區在複製和還原到目地分割區時.轉換成 FAT32 格式......O_O 語法: -F32
FAT64 Conversion : 啟動這功能.會允許使用64K叢集.這樣FAT16 格式的分割就可以加大到4GB.語法: -F64
(只有Win2000和NT可以支援哦..O_O)
FAT Limit 啟動這功能.會限制NT FAT16分割區不超過 2GB.(2047MB)...語法: -Fatlimit

第三頁 Misc

Sure 這個不能選...要企業版的才能選..
Force Cloning 啟動這功能.會強制執行複製工作.會連壞軌一起複製 語法為: -Fro
Reboot 啟動這功能.會在作業完畢後.自動重開機. 語法是: -Rb <--Rb.房車.可樂那.連射
Exit to DOS 啟動這功能會在作業完畢後回到DOS下面.. 語法是: -FX

第四頁 Image/Tape
這頁是和影像檔和外接磁帶有關係..O_O

Default 這個是 Ghost 的預設值. 指來源的檔案格式有支援那就照正常複製. 如果不支援. 那就會以磁區複製方法... 
Image All 這選項是.可以複製出完全相同的分割區..Ghost會以磁區複製方式來複製任何資料..而且不能改變目地的分割區大小.... 語法是: -Ia
Image Boot 這選項是.會在複製時會連開機磁軌和MBR.一起複製..這是有多重開機硬碟在使用的. 語法是: -Ib
Image Disk 這選項是.有Image All和Image Boot所有的功能..而且還能夠複製未分割的磁區~~
(請仔細看那兩個功能..O_O..)

Tape Buffered 這選項是預設質.指送資料到磁帶機的緩衝區時就顯示完成訊習... 語法是: -Tapesafe
Tape Safe 這選項是.資料要存入磁帶機後.才會顯示完成的訊習.. 語法是: -Tapesafe
Tape Unbuffered 這選項是.資料送到磁帶機.但沒儲存時就先顯示完成的訊習.. 語法是:-tapeunbuffered
Tape Eject 這選項是.磁帶機完成儲存作業後.就把磁帶給退出來..語法是: -Tapeeject

第五頁 Hdd access
這頁是設定硬碟儲存設定.這是不太需要設定的.

Use Extended Interrupt 13h disk access 使用延伸中斷13h的功能來讀硬碟 語法為:-Ffx
Disable ExtendedINT13 access support 不使用延伸中斷13h的功能來讀硬碟.語法為: -Fnx
Use direct IDE disk access 使用直接IDE讀取模式來讀寫IDE的硬碟..... 語法為: -Ffi
Disable direct IDE access Support 不用直接IDE讀取模式來讀寫IDE硬碟.語法為: -Fni
Use direct ASPI/SCSI disk access 使用ASPI/SCSI模式來讀寫SCSI硬碟 語法為: -Ffs
Disable direct ASPI/SCSI access support 不用ASPI/SCSI模式來讀寫SCSI硬碟 語法為: -Fns

第六頁 Security

Password protect image : 這功能.是代表影像檔要用密碼保護.在建立影像檔會出現要你輸入設定密碼的訊息
Locktype Setting : 這裡面的設定是來設定.影像檔只能還原到相同的機型的系統上面..有很多設定來讓Ghost 判斷是否為相同機型的選項....
None 不限任何機型...
Manufacturer 依照製造商來判斷
Product Name 依照系統的名稱和型號來判斷
BIOS Version 依照BIOS的版本來判斷...
Serial Number 依照系統的序號來判斷..
UUID 依照系統到的UUID碼來判斷..(網路卡號)
Manufacturer + Product Name : 依照系統的製作商和產品型號來判斷 PⅢ ID 依CPU的型號來判斷 (只有P3能用)

第七頁 Save Settings
這一頁會顯示你句選使用哪些功能和選項..這一頁也相當的重要............. 如果你設定好前面六頁的東西.卻沒在這頁上的 "Save Settings" 按個鈕. 儲存之前的設定.. 那在 Ghost 關閉後...你所設定的也會全部不見.~~ (要小心呦....^_^)

補充解說:在 Ghost 認光碟機或燒錄器時候, 如果電腦上有SCSI和IDE的光碟機或燒錄器, 它會把SCSI的配備設定為第一個.... 如果電腦上有兩臺燒錄機, 而你又用影像檔對燒錄機的功能. Ghost 只會顯示第一臺 (如有SCSI和IDE.它就只認SCSI... 用可驅動光碟機的開機片.就不限在此)

Ghost 可以在 win95/98/Me/2000 裡直接執行, 可是WinXP和NT就不行...

不管多舊版的 Ghost 做出的影像檔都可以用 Ghost 2002 來使用還原..
可是 Ghost2002 做的影像檔.就不相容在舊版

以下是 Ghost 可支援的所有檔案格式....
FAT12 Windows31/95/98/Me/XP..DOS
FAT16 Windows95.SR1/98/Me/XP
FAT32 Windows95.SR2/98/Me/XP/2000
NTFS Windows2000/XP/NT
Ext2 Linux , UNIX

我從頭到尾說的Ghost都是2002版本, 聽說2003已經出來了, 在網路上到處漂流. 不過有許多語法參數和教學都適用之前的版本....

2013-03-12

Something about dd-wrt v24sp2 build 19154 in WHR-HP-G300N

1. How to keep pppoe connection alive?

=> Reconnect function is already implemented in dd-wrt v24sp2. pppd is configured to automatically rebuild the connection should it fail.

from /tmp/ppp/options.pppoe:

persist
lcp-echo-interval 3
lcp-echo-failure 20


lcp-echo-interval <n> : 如果有給這個選項, pppd 每 <n> 秒將會送出一個 LCP 回應要求(echo-request)封包(frame)給彼端. 在 Linux 系統下, 回應要求在 n 秒內沒有從彼端接收到封包時會被送出. 一般彼端應該以傳送一個回應回覆(echo-reply)來反應該回應要求. 這個選項可以與 lcp-echo-failure 選項一起使用來偵測不再連線的彼端。

lcp-echo-failure <n> : 如果有給這個選項, 那麼如果傳送 n 個 LCP 回應要求沒有接收到有效的 LCP 回應回覆的話 pppd 將會推測彼端是死掉的. 如果發生這種情形, pppd 將會終結該連線. 這個選項的使用要求一個非零的 lcp-echo-interval 參數值. 這個選項可以用在硬體數據機控制線路無法使用的情況下當實際連線被中斷之後 ( e.g., 數據機已經掛斷)終結 pppd 的執行。

persist : 使用此指令代表如果 lcp-echo-interval 3 和 lcp-echo-failure 20 (也就是 60 秒) 判斷 ppp 斷線以後, 不是退出 ppp, 而是重新撥號.

若還不放心, 或網路不穩, 可以打開 WHR-HP-G300N connection watchdog 再作一層確保. ( Administration -> Keep Alive -> WDS/Connection Watchdog.)

2. WAN, LAN and Wireless interface same MAC address?

Recently I replaced WHR-HP-G300N’s firmware to DD-WRT v24sp2 build 19154. And I noticed that this particular router has same MAC addresses on all 3 network interfaces! That is, be it WAN, LAN or wireless, it has the exact same MAC address!

How is this possible, and why does it work? Isn't that at least WAN side & LAN side should have different MAC addresses for a router?


Ans from F430 : No. They may have the same MAC address. A MAC address must be unique on a single broadcast domain. A LAN is a broadcast domain. The WAN is a different broadcast domain (although in some types of WAN interfaces it really isn't a "broadcast domain"). In practical terms only hosts on the LAN side of the router see the router's LAN MAC address. They do not see the MAC address on the WAN side so it doesn't matter if it is different from the LAN MAC address or not. Same for devices on the WAN side. They do not see the LAN side.…….. Note however that some bridges are designed to use a single MAC address for all interfaces. Depends on the firmware running on the bridge.
Via the router. The router acts at layer 3 and forwards based on IP address, not MAC address. A device on the LAN uses layer 3 (IP address) to determine that the destination is not on the LAN. Then it sends the packet to the default IP address (default gateway) for that LAN. Layer 2 takes over and determines what MAC address on the WAN to send the packet to. Neither layer 3 nor layer 2 care what is on the other side of the router since they never see it. Same for a packet on the WAN - it never sees layer 2 MAC addresses or layer 3 IP addresses on the LAN.
It causes no trouble at all. It doesn't violate any specifications or network "rules". The vendor is doing nothing wrong.
Vendors have to buy MAC addresses from IEEE (something like $500 for 65536 addresses.) If they can use 1 instead of 3, they will save a few cents.
Will not cause problems on a router.

2013-03-03

How to rip a video cd to a avi file

1. Copy the AVSEQ01.DAT file from the MPEGAV directory of the VCD to a location on the computer. This file contains the main audio and video of the VCD.

2. Rename the AVSEQ01.DAT file on the computer to AVSEQ01.MPG. Since DAT files are MPEG-1 format, there is no conversion necessary.

3. Open the AVSEQ01.MPG file with the video conversion software. The software should display relevant file information including frame size, frame rate and data rate for the video.

4. Choose an output option to convert the AVSEQ01.MPG file to an AVI file. Use an output frame size that is the same as the source file frame size.

5. Encode the video to AVI format. Depending on the length of the video, encoding may take significant time to complete. Once completed, delete the AVSEQ01.MPG file from the computer.

2013-02-04

Windows7 怎麼將系統磁區轉移到新硬碟?

問題 : 要怎樣透過 ghost partition to partition 的方式備份到另一顆硬碟上, 而又可以正常開機呢?!
我想把原本硬碟上的win7 ghost 到新硬碟上, 但又不想用disk to disk的方式因為我只要系統磁區的部分!!
windows7 有隱藏磁區大約100MB, 我也有都備份過去, 但始終無法開機, 會有錯誤.
但是使用disk to disk是可以開機的!! ( 利用 ghost 加 -lB 參數; ex : c:\>ghost –lB ; 含 MBR 一起 Copy )

============================================================
方法 1: 使用 Ghost <--- 僅新硬碟會動到
100M 的系統保留分區 就不必了
先格式化新硬碟, 然後用 Ghost 把 W7 還原到 Primary Partition 1 並對該分區 active

<<分區代號請自行修改>> 
在PE或救援光碟下執行以下步驟:
bcdboot C:\windows /s C: /l zh-TW
bootsect /nt60 Sys     <--- 會更新硬碟磁碟分割的主開機程式碼,以便在BOOTMGR 與 NTLDR 之間切換
REG LOAD HKLM\Sys C:\Windows\System32\config\System
REG DELETE HKLM\Sys\MountedDevices /v "\DosDevices\C:" /F    <--- 避免系統認錯分區
REG UNLOAD HKLM\Sys
重啟 進入W7

============================================================
方法 2: 使用 W7 內建的備份還原功能 <--- 新舊硬碟都會動到
首先必須對調新舊兩顆硬碟的數位簽章. 怎麼說呢?
Windows 7 的備份, 有綁定硬碟數位簽章. 也就是備份時,給硬碟一個號碼
告訴還原軟體,每個還原檔,只能還原到一開始備份來源的硬碟
把舊硬碟的數位簽章號碼和新硬碟的數位簽章號碼對換. 以用來騙過還原軟體, 達成還原到新硬碟的目標!
以"磁碟 0 是新硬碟, 磁碟 1 是舊硬碟" 為例. 步驟如下:
0. 先以救援光碟格式化新硬碟
1. 啟動救援光碟->"命令提示字元"
2. DISKPART
3. LIST
4. SELECT DISK 1
5. DETAIL DISK
6. 抄下磁碟 1 磁碟識別碼 xxxxxxxx
7. LIST DISK
8. SELECT DISK 0
9. DETAIL DISK
10. 抄下磁碟 0 磁碟識別碼 yyyyyyyy
11. UNIQUE DISK ID xxxxxxxx
12. SELECT DISK 1
13. UNIQUE DISK ID yyyyyyyy
14. Reboot
15. 再次執行救援光碟的備份還原功能
============================================================

2013-02-02

記錄 ThinakPad X61 7673-DF1 安裝 Windows 7 的過程

內容主要是參考 "如何自行在ThinkPad X61安裝Windows XP Professional SP3?", 再加以修改. 強烈建議先看一遍.
ThinkPad X61 出廠時預先安裝了Windows Vista,2008/9 改安裝Windows XP, 並且升上SP3, 2013/1 再升級至Windows 7, 本文是我的安裝心得。
Introduction
使用環境:ThinkPad X61 7673DF1 + 4G記憶體 + USB FlashKey + Unetbootin +Windows 7 Enterprise ISO 檔
預備動作 :
1. 升級 BIOS 2.16 至 2.22 : 在原本的 XP 中使用 ThinkVantage System Update. 必須安裝電池, 否則 BIOS 無法升級.
2. 確認 BIOS SATA mode 為 AHCI. power on -> press F1 -> Config –> Serial ATA(SATA) -> SATA Controller Mode Option : AHCI
3. BIOS 中 Disable : Intel AMT, Security Chip, Wireless WAN, Ultrabay
4. 使用 Unetbootin, 將 Windows 7 ISO 裝入 USB.
5. Download X61 driver from Lenovo support express home

開始
Step 1: 使用 USB Flashkey 開機. power on -> press F12 -> 選由 USB Flashkey 開機
Step 2: Install Windows 7
Step 3: Install Intel Chipset Driver
Step 4: Install Intel Matrix Storage Manager Driver. 更新 Intel(R) ICH8M SATA AHCI Controller 驅動程式. 裝置管理員->IDE ATA/ATAPI->Intel(R) ICH8M SATA AHCI Control->內容->更新驅動程式
Step 5: Intel Turbo Memory driver
Step 6: ThinkVantage Power Manager. 這是ThinkPad招牌工具程式,一定要安裝!!除了在工具列顯示目前電池電力資訊外,主要還能控制如何對電池充電,減少充電次數,增加電池壽命。
Step 7: Power Management Driver

==== 至此安裝過程就完成了, 很多 Drivers Windows 7 都已自動安裝好了 ====

Step 8: Hotkey features Integration
Step 9: ThinkVantage Access Connection
Step 10: 安裝 ThinkVantage System Update, then 執行 ThinkVantage System Update 安裝你所需要的驅動程式或更新

PS :
1. 按 F1 進 BIOS; 按 F12 選擇開機媒體; 按 F11 進入 Rescure/Recovery 功能
(重新 Format HD 後就沒用了)
2. Lenovo ThinkPad driver website : http://download.lenovo.com/express/ddfm.html

Reference:
1. ThinkPad T61/R61/X61介紹特集
2. 驅動程式下載 : Lenovo > Support Express Home > Device Drivers File Matrices

2012-09-23

IME: Intel Management Engine

vPro 必備的5個硬體組件
個人電腦的硬體要有5個條件才能稱為 vPro 平臺,第一是處理器要支援虛擬技術,第二則是要具備 Intel ME 的北橋晶片,第三是南橋晶片要支援 Intel AMT(主動管理技術),第四是能透過 AMT 寫入的 Flash ROM,最後網路晶片要支援 OOB(Out Of Band),能載入2祖 IP Address。上述條件缺一不可.

vPro 平臺會應用到處理器的 Intel VT (Virtualization Technology,虛擬技術),AMT 可控制利用 VT 安裝的嵌入式作業系統。

vPro 平臺中,最重要的就是 Intel ME (Management Engine),這類似另一個 BIOS,北橋晶片要具備 Intel ME 才能應用 vPro 平臺,只要支援 AMT 技術的軟體,就能控制 Intel ME,而達成遠端管理。

vPro平臺中另外一重要的技術是 Intel AMT (Active Management Technology,主動管理技術),只要軟體支援 AMT,就能透過網晚路管理 vPro 個人電腦。

AMT 執行後的資料,需要儲存在 Flash 中,而 Flash 還要儲存 BIOS、Intel ME 及網路晶片韌體及資料、和軟體開發商提供 API 程式,這也讓原本只需要8MB的 Flash ROM,擴充到 16MB。特別的是,記憶體中增加能儲存 NVRAM,可寫入軟體開發商的程式,應用程式可利用 AMT 技術存取 Flash 中的資料,不需要儲存在電腦中。

vPro 電腦需要具備 2組 IP Address 及支援 OOB (Out of Band),Intel 82566DN GbE 則同時具備上述功能。它會專門提供 IP Address 給 AMT 使用,管理系統就是透過此 IP Address 與 vPro 電腦溝通,不影響使用操作,而且就算關機下,也能取得 IP Address

1. Intel ME 類似主機板上另一個 BIOS


2. ME 設定主要提供管理員調整電源管理、遠端韌體更新權限等,變更 ME 設定完成後,系統需重新開機後才會套用新設定。


3. ME 目前掌管了系統開機大權,包含開機時部份的 power sequence / clock / HW-STRAP 而 ME 基本上就是一個內含在 PCH內的 Controller

當你按下 Power button 時,剛開始 ME 會先使用一 PCH 內含的 ROM 來啟動(這組 ROM 是外界無法 touch 的),接著套用一個  HW Default 去驅動 CLOCK 來讓系統開機,CLOCK 出來後,ME 會先去讀取存放在 SPI Flash 裡的 Descriptor,也就是 SPI Flash 的前 4KB, 先驗証 Descriptor 裡的 signature 是否等於 0FF0A55Ah,若不同的話,則不會執行 ME Firmware! 若值正確,會接著套用 Descriptor 裡的 hw strap 值並執行 ME Firmware,然後才開始 LOAD SPI Flash 裡的 BIOS Area,當 BIOS 開機到 MRC,時會分配 memory 給 ME UMA 使用…


ME上還有不同的AP,Intel AMT就算是ME AP的一種

4.
4.1 CALPELLA 的 clock 有 2 種模式,一種是採用舊的 clock gen 來給 platform 供給 clock,另一種是完全由 PCH 來提供 platform 上的 clock


4.2 我說的 hw strap 可能有點不妥,但有不少的 hw config 是存放在 descriptor 裡,開機時由 ME 來取用,比方說 PCH 上的 PCI Express lane 的設定,是否做 lane reversal,lane的組態設定/ PCIE lane 是否為借道給 on board LAN 的PHY來使用…等


4.3 原本不少需要透過 HW 機制來完成的動作,現階段改由 ME 來完成

Source : IME