分类: BSD
2011-03-29 17:52:44
Based on an e-mail by Shaun Reitan on the SYSLINUX mailing list in October 2005.
e.g.
# ls -al *.iso
-rw-r--r-- 1 root wheel 25444352 Apr 16 15:44 6.2-RELEASE-i386-bootonly.iso
# dd if=/dev/zero of=6.2-RELEASE-i386-bootonly.img bs=1k count=26000
26000+0 records in
26000+0 records out
26624000 bytes transferred in 1.404435 secs (18957091 bytes/sec)
# ls -al *.iso *.img
-rw-r--r-- 1 root wheel 26624000 Apr 27 03:28 6.2-RELEASE-i386-bootonly.img
-rw-r--r-- 1 root wheel 25444352 Apr 16 15:44 6.2-RELEASE-i386-bootonly.iso
# mdconfig -a -t vnode -f 6.2-RELEASE-i386-bootonly.img -u 0
# bsdlabel -w -B md0 auto
# newfs -m 0 md0a
Warning: changing optimization to space because minfree is less than 8%
/dev/md0a: 25.4MB (51984 sectors) block size 16384, fragment size 2048
using 4 cylinder groups of 6.36MB, 407 blks, 832 inodes.
super-block backups (for fsck -b #) at:
160, 13184, 26208, 39232
# mkdir /tmp/img
# mount /dev/md0a /tmp/img
# df /tmp/img
Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/md0a 24950 4 24946 0% /tmp/img
# mkdir /tmp/iso
# mdconfig -a -t vnode -f 6.2-RELEASE-i386-bootonly.iso -u 1
# mount_cd9660 /dev/md1 /tmp/iso
# df /tmp/iso
Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/md1 24848 24848 0 100% /tmp/iso
# cd /tmp/img/
# cp -r /tmp/iso/* .
# ls -al
total 12
drwxr-xr-x 4 root wheel 512 Apr 27 03:40 .
drwxrwxrwt 8 root wheel 512 Apr 27 03:36 ..
drwxrwxr-x 2 root operator 512 Apr 27 03:35 .snap
dr-xr-xr-x 5 root wheel 512 Apr 27 03:40 boot
-r--r--r-- 1 root wheel 2048 Apr 27 03:40 boot.catalog
-r--r--r-- 1 root wheel 25 Apr 27 03:40 cdrom.inf
# cd
# umount /tmp/img /tmp/iso
# mdconfig -d -u 0
# mdconfig -d -u 1
# ls -al *.img *.iso
-rw-r--r-- 1 root wheel 26624000 Apr 27 03:41 6.2-RELEASE-i386-bootonly.img
-rw-r--r-- 1 root wheel 25444352 Apr 16 15:44 6.2-RELEASE-i386-bootonly.iso
label freebsd62
kernel memdisk
append initrd=images/freebsd/6.2-RELEASE-i386-bootonly.img harddisk