Chinaunix首页 | 论坛 | 博客
  • 博客访问: 185524
  • 博文数量: 40
  • 博客积分: 2576
  • 博客等级: 少校
  • 技术积分: 494
  • 用 户 组: 普通用户
  • 注册时间: 2010-11-14 17:19
文章分类

全部博文(40)

文章存档

2011年(21)

2010年(19)

我的朋友

分类: BSD

2011-03-29 17:52:44

How to create a PXE-bootable disk image of the FreeBSD "bootonly" install ISO

Based on an e-mail by Shaun Reitan on the SYSLINUX mailing list in October 2005.


The general idea:

  • transform the small "bootonly" ISO (which is intended to fetch all OS files over the network) into a PXE-bootable harddisk image
  • make the first installation CD available on the network e.g. through NFS

This howto only explains how to create the PXE-bootable image.

  • Download the "bootonly" installation ISO (about 25MB for FreeBSD 6.2)

e.g.

  • If case you haven't got a FreeBSD system running already, install BSD somewhere temporarily using the first installation ISO (e.g. in VMWare).
  • Copy the "bootonly" ISO to your BSD system, e.g. using scp or WinSCP.
  • Find out how large you need to create your disk image:
   # ls -al *.iso
-rw-r--r-- 1 root wheel 25444352 Apr 16 15:44 6.2-RELEASE-i386-bootonly.iso
  • Create a file of the appropriate size (make it a little larger to account for differences in block size, file system overhead etc.):
   # 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
  • Attach this image file as a memory disk:
   # mdconfig -a -t vnode -f 6.2-RELEASE-i386-bootonly.img -u 0
  • Write a BSD label with boot code to it:
   # bsdlabel -w -B md0 auto
  • And create a filesystem on it (BSD uses ufs):
   # 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
  • Create a mount point and mount this "memory disk" device (attached to the image file):
   # 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
  • Create another mount point and mount the ISO file on it through another md device:
   # 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
  • Copy the ISO contents to the new disk image file:
   # 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
  • Unmount and detach all md devices:
   # cd
# umount /tmp/img /tmp/iso
# mdconfig -d -u 0
# mdconfig -d -u 1
  • We're done. Copy the .img file to your tftp server.
   # 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
  • And add something similar to this to your pxelinux.cfg/default file:
   label freebsd62
kernel memdisk
append initrd=images/freebsd/6.2-RELEASE-i386-bootonly.img harddisk
阅读(1778) | 评论(0) | 转发(0) |
0

上一篇:txtsetup.sif语法解析

下一篇:linux ip命令

给主人留下些什么吧!~~