FreeBSD Customized CD(Make your own release)

1 make buildworld
1.1 請先做cvsup 更新src(記得先裝cvsup-with-gui 等等會用到)
[sourcecode language=’bash’]
# cd /usr/ports/net/cvsup-without-gui; make install clean
[/sourcecode]
1.2
[sourcecode language=’bash’]
# cd /usr/src; make buildworld
[/sourcecode]
2 make release
2.1
[sourcecode language=’bash’]
# cp /usr/share/examples/cvsup/cvs-supfile /etc
[/sourcecode]
2.2
[sourcecode language=’bash’]
# mkdir /home/ncvs /home/releng
[/sourcecode]
2.3
[sourcecode language=’bash’]
# vi /etc/cvs-supfile
*default host=cvsup.tw.FreeBSD.org
*default prefix=/home/ncvs
[/sourcecode]
2.4 csup 只能check,所以要裝cvsup
[sourcecode language=’bash’]
# cvsup /etc/cvs-supfile
[/sourcecode]
2.5
[sourcecode language=’bash’]
# cd /usr/src/release;
[/sourcecode]
2.6 開始做release
[sourcecode language=’bash’]
# make release RELEASETAG=RELENG_7_1 PORTSRELEASETAG=HEAD
BUILDNAME=7.1-RELEASE-p3 CHROOTDIR=/home/releng
CVSROOT=/home/ncvs NODOC=yes
[/sourcecode]
指令說明:
RELEASETAG:
The CVS tag corresponding to the release that is to be built. If undefined, the release will be built from the HEAD of the CVS tree (a “-CURRENT snapshot”).,
PORTSRELEASETAG:
The CVS tag to use when checking out the ports tree. Usually, the head of the ports tree is used by default. If RELEASETAG specifies a release tag, then the associated release version is used as the default instead.

BUILDNAME:
The name of the release to be built. This is used to set the RELEASE value in sys/conf/newvers.sh, which affects the output of uname(1). If not set, a name with the timestamp and the “-SNAP” suffix will be generated.

CHROOTDIR:
The directory to be used as the chroot(8) environment for the entire release build. This file system should have at least 3.2 gigabytes of free space on the i386 architecture.

CVSROOT:
The location of the FreeBSD CVS repository. This path name is in reference to the real system root, not the root of the chroot(8) directory tree.

NODOC:
If defined, the SGML-based documentation from the FreeBSD Documentation Project will not be built. However, the “doc” distribution will still be created with the minimal documentation set providedin src/share/doc.

2.7 放入你想要額外用的檔案
[sourcecode language=’bash’]
# cp xxx.tgz /home/ releng/R/cdrom/dvd1/7.1-RELEASE-p3
[/sourcecode]
3 加入install.cfg 至 mfsroot
3.1
[sourcecode language=’bash’]
# cd /home/releng/R/cdrom/dvd1/boot
[/sourcecode]
3.2
[sourcecode language=’bash’]
# gunzip /home/releng/R/cdrom/dvd1/boot/mfsroot.gz
[/sourcecode]
3.3
[sourcecode language=’bash’]
# mdconfig -a -t vnode -f /home/ releng/R/cdrom/dvd1/boot/mfsroot -u 0
[/sourcecode]
3.4
[sourcecode language=’bash’]
# mount /dev/md0 /mnt
[/sourcecode]
3.5
[sourcecode language=’bash’]
# cp /usr/src/usr.sbin/sysinstall/install.cfg /mnt
[/sourcecode]
3.6
[sourcecode language=’bash’]
# vi /mnt/install.cfg (依照每台機器修改)
[/sourcecode]
加入or修改以下資訊

[sourcecode language=’bash’]
# This is a sample installation configuration file for my test machine,
# crate.cdrom.com.
# It is included here merely as a sort-of-documented example.
#
# $FreeBSD: src/usr.sbin/sysinstall/install.cfg,v 1.12.6.1 2008/11/25 02:59:29 kensmith Exp $
# Turn on extra debugging.
debug=yes

##partition 互動調整硬碟
diskInteractive=yes
diskPartitionEditor

##label互動式調整硬碟
diskInteractive=yes
diskLabelEditor

###############################
# Select which distributions we want. 設定為最小安裝
##dists=base doc manpages info src sbase ssys kernels GENERIC
distSetMinimum

# media 從CD-ROM安裝
mediaSetCDROM

# OK, everything is set. Do it!
installCommit

#解壓 xxx.tgz
command=touch /tmp/ok
system
[/sourcecode]

指令說明:
command 不能斷行,不然在跑指令的時後會有error
command在安裝時的debug輸出訊息會是這樣
setting variable ‘command=我們打的command的內容’
所以在command 須要用到引號的部份最好都用雙引號

3.7 製作ISO檔
[sourcecode language=’bash’]
sh /usr/src/release/i386/mkisoimages.sh -b FreeBSD7 /home/7.1-RELEASE-p3.iso
/home/releng/R/cdrom/dvd1
[/sourcecode]
3.8 參考資料
# man release
# man sysinstall
http://romana.now.ie/writing/customfreebsdiso.html
http://www.sfc.wide.ad.jp/~watari/FreeBSD/boot.html
http://www.bsdunix.ch/public/docu/freebsd_sysinstall.html

這個是寫滿久了….忙一直忘了放上來….

發佈留言

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料