如何在 FreeBSD 上使用 CD 刻录机

目前只在 Phillips CDD 521/522/2000/2600、HP 4020i 及相容机型上测试过 , 笔者使用 CD522 还没有烧坏过任何一片 , 还可以边跑 X Window 上网路、看 Netscape 。(附注∶笔者使用 FreeBSD 2.2-CURRENT , 没试过 2.1.5R)

你可以看看 /usr/share/example/worm/ 目录下的说明 , 内有制造 ISO Image 的方法 , 以及烧 CD 的 script 。

步骤∶
1. add "device worm0" into kernel config file
2. install mkisofs and team from freebsd packages
3. use "makecdfs.sh" to make an ISO image from a Directory source , or "dd if=/dev/rcd0c of=/tmp/cd.iso bs=2048" if making image from CDROM
4. use "burncd.sh" shell script to burn CD ISO Image

*新的烧录软体*
这个新的 cdrecord 程式号称支援大多数的 CDR , 有兴趣的可以试试看 。
ftp://freebsd.csIE.nctu.edu.tw/pub/jdli/collect/cd-recorder/

---------------------

SUPPORT DRIVE
=============

HP∶HP4020, HP6020
PHILIPS∶CDD522, CDD2000, CDD2600
PLASMON∶RF4100

FreeBSD Version 2.2 or newer

CONFIG DEVICE
=============

1. kernel config

在 kernel config 里加上下面几行∶

controller ncr0 ; depend on which SCSI card you use
controller scbus0 ; MUST HAVE
device worm0 at scbus? ; MUST HAVE

後重新 compile kernel 。

2. device node

到 /dev 下执行 ./MAKEDEV worm0


USAGE
=====

1. 烧 raw image

/usr/share/examples/worm/burncd.sh

这是个用来将 raw image 烧入 CD-R 里的 shell script 。使用前需先安装team 这个 package , 如果用的是 Philips CDD2000 or CDD2600 , 还要修改 35 行 , 把 HP 4020i 改为 PHILIPS CDD2000 。然後直接用∶

burncd.sh [raw image file name]

来烧录 。raw image 的来源可以是用 mkisofs 做出来的 , 也可以是用 Easy CDPro、WinOnCD 等软体制作出来之 image 。

2. 制作 ISO9660 / Rock Ridge 之 raw image

/usr/share/examples/worm/makecdfs.sh

使用这个 shell script 来将一个目录结构转成 ISO9660 或 Rock Ridge 格式的 raw image 。使用前需安装 mkisofs 这个 package 。使用方法为∶

makecdfs.sh [-b] {cd-title} {input-tree} {output-file} {ID}

-b∶加上这个参数可以做出可开机光碟 。内定的 boot image 是 floppies/boot.flp (相对於 input-tree) boot.flp 可以直接拿 FreeBSD 的安装片来用 。

cd-title∶这片 CD 的 volume name 。

input-tree∶要制作 raw image 的目录顶点 。

output-file∶做出来的 raw image 之档名 。

ID∶这片 CD 是谁做的 。

这样子做出来的光碟片在 Dos 上面还是 8.3 档名档式 , 不能有长档名 。使用 Rock Ridge 格式 , 在 Unix 下面有长档名 , 但不支援中文长档名 。如果不喜欢这样做出来的光碟每个目录都有个 TRANS.TBL , 把 script 里 mkisofs 的 -T 参数去掉 。如果不需要 Rock Ridge 格式 , 把 -R 参数去掉 。

3. On the Fly

by Kaede.bbs@sob.m7.ntu.edu.tw∶

#!/bin/sh
if [ $# -lt 3 ]; then
echo "usage: $0 input-tree "cd-title" "copyright" [dummy]"
elif [ ! -d $1 ]; then
echo "$0: $1 is not a directory tree."
elif [ "`id -u`" != "0" ]; then
echo "Sorry, this must be done as root."
else
tree=$1; shift
title="$1"; shift
copyright="$1"; shift
echo -n "Place CD in the worm drive now and press return: "
read junk
scsi -f /dev/rworm0.ctl -c "0 0 0 0 0 0" >/dev/null 2>&1
wormcontrol select HP 4020i
wormcontrol prepdisk double $*
wormcontrol track data
# 若需使用 Rock Ridge 再加上 -R 参数
mkisofs -a -d -N -D -V "$title" -P "$copyright" $tree
| rtprio 5 team -v 1m 5 | rtprio 5 dd of=/dev/rworm0 obs=20k
wormcontrol fixate 1 onp

4. CD Copy

by Dinosaur.bbs@bbs.ee.nthu.edu.tw

#!/bin/sh
if [ "`id -u`" != "0" ]; then
echo "Sorry, this must be done as root."
else
echo -n "Place CD in the worm drive now and press return: "

推荐阅读