1: Check This Fire- # less /usr/src/UPDATING
- 在本文档最下面 COMMON ITEMS 清楚的写明了各种方法! (本文最后便是节选)
2: Build the World (下面均在 Single User Mode 进行操作!)
- # shutdown now (进入 single user mode 或:init 1)
- # cd /usr/src
-
# make buildworld (The buildworld places its output under /usr/obj)
3: Build, Install, and Test a Kernel (下面均在 Single User Mode 进行操作!)
- # cd /usr/src
- # make buildkernel KERNCONF=MYKERNEL
- # make installkernel KERNCONF=MYKERNEL
- or
- # make KERNCONF=MYKERNEL kernel
- # reboot
4: Prepare to Install the New World (下面均在 Single User Mode 进行操作!)
- 新内核测试过后,进入 single user mode:
- # shutdown now (进入 single user mode 或:init 1)
- # adjkerntz -i (确保时间的正确性)
- # fsck -p
-
# mount -u /
-
# mount -a -t ufs
-
# swapon -a
-
-
# mergemaster -p (比对配置文件)
- ...
- ...
5: Installing the World (下面均在 Single User Mode 进行操作!)
- # cd /usr/src
-
# make installworld
-
Some programs and files are no longer in the base system. To see what’s
-
obsoleted, run make check-old.
-
-
# make check-old
-
>>> Checking for old libraries
-
/lib/libcrypto.so.4
-
/usr/lib/libssl.so.4
-
/usr/lib/libroken.so.8
-
/lib/libatm.so.3
-
/lib/libc.so.6
-
...
-
-
If you’re not specifically using any of the old programs or directories,
-
delete them with make delete-old.
-
-
# make delete-old
-
You can also store old
-
libraries in /usr/lib/compat, so that your programs will continue to run but
-
the old libraries will be safely out of the way.
6: 搞定后 需要处理的
- # chflags -R noschg /usr/obj/ (build过程中 文件被设置为:immutable,改回来)
-
# rm -rf /usr/obj/
-
# cd /usr/src
-
# make cleandir (传说一定要清理 2 次)
-
# make cleandir (传说一定要清理 2 次)
- <如果没有成功创造新世界,也请清理一下;便于继续创造世界!>
- # shutdown -r now (或:reboot 或:init 6)
7: Recording What Happened
- # script ~/buildworld.out
-
Script started, output file is ~/buildworld.out
-
# make TARGET
-
... compile, compile, compile ...
-
# exit (或者:Ctrl-D)
-
Script done, ...
-
(
- script(1) is one of those rarely mentioned but quite useful tools every
- sysadmin should know. It logs everything you type and everything that
- appears on the screen.
- # less ~/buildworld.out
mergemaster 原理很简单, 它只比较 文件那一行 $ FreeBSD $ 如下
# $FreeBSD: stable/9/etc/apmd.conf 124003 2003-12-30 17:40:28Z njl $
若果当中的号码不同, 便知道有版本分別, 使用者只要看日子便知道新旧之分別, 两者有分別时, 便可以选择
d 删除新版本, 保留旧版本
i 更新新版本, 覆盖留版本
m 用 diff 比较新版旧版文, 引导使用者合并相异之处
v 再用 diff 看看两者分別之处
使用者可以不选以上四个选项, 直接按 Enter 即表示什么也不做
有些文件, 一定是选 i 例如 /etc/default/* , /etc/rc.d/*
有些文件, 你知道一定不能由 mergemaster 更改, 要选 d 例如 /etc/master.passwd, /etc/group
有些文件, 你可能更动一, 两个项选, 你要选 m 来合并之, 例如 /etc/login.conf
用 m 来合并的时候, 我喜欢运用 ed 编辑器来处理, 流程如下:
1. 当 mergemaster 发现有不同之处时
2. 选 m 来合并
3. 选 m 之后, mergemaster 便会跳到第一个相异位, 等候你指示
4. 此时你可以使用任何文字编辑器处理, 我推介用 ed
5. 输入 ed 命令
6. 进入了 ed 画面, 萤幕先列印旧版本, 然后新版本 的内容
7. 在 ed 画面按你的意愿删除某个版本内容, 即按 dd (注 ed 即是 vi 的简化版)
8. 修改完成, 输入 :wq 命令 ( 又是另一个 vi 命令 )
9. 回到 mergemaster 画面后, 有三个选择: i 是安装你刚修改合并版, r 是重做一次合并程序, v 是预览你刚修改的合并版内容
10. 如果选 v 后满意合并版内容, 便可以选 i 安装合并版, 覆盖旧版本了
FROM:
- COMMON ITEMS:
-
-
General Notes
-
-------------
-
Avoid using make -j when upgrading. From time to time in the
-
past there have been problems using -j with buildworld and/or
-
installworld. This is especially true when upgrading between
-
"distant" versions (eg one that cross a major release boundary
-
or several minor releases, or when several months have passed
-
on the -current branch).
-
To build a kernel
-
-----------------
-
If you are updating from a prior version of FreeBSD (even one just
-
a few days old), you should follow this procedure. It is the most
-
failsafe as it uses a /usr/obj tree with a fresh mini-buildworld,
-
-
make kernel-toolchain
-
make -DALWAYS_CHECK_MAKE buildkernel KERNCONF=YOUR_KERNEL_HERE
-
make -DALWAYS_CHECK_MAKE installkernel KERNCONF=YOUR_KERNEL_HERE
-
-
To test a kernel once
-
---------------------
-
If you just want to boot a kernel once (because you are not sure
-
if it works, or if you want to boot a known bad kernel to provide
-
debugging information) run
-
make installkernel KERNCONF=YOUR_KERNEL_HERE KODIR=/boot/testkernel
-
nextboot -k testkernel
-
-
To just build a kernel when you know that it won't mess you up
-
--------------------------------------------------------------
-
This assumes you are already running a 5.X system. Replace
-
${arch} with the architecture of your machine (e.g. "i386",
-
"alpha", "amd64", "ia64", "pc98", "sparc64", etc).
-
-
cd src/sys/${arch}/conf
-
config KERNEL_NAME_HERE
-
cd ../compile/KERNEL_NAME_HERE
-
make depend
-
make
-
make install
-
-
If this fails, go to the "To build a kernel" section.
-
-
To rebuild everything and install it on the current system.
-
-----------------------------------------------------------
-
# Note: sometimes if you are running current you gotta do more than
-
# is listed here if you are upgrading from a really old current.
-
-
-
make buildworld
-
make kernel KERNCONF=YOUR_KERNEL_HERE
-
[1]
-
[3]
-
mergemaster -p [5]
-
make installworld
-
make delete-old
-
mergemaster [4]
-
-
-
-
To cross-install current onto a separate partition
-
--------------------------------------------------
-
# In this approach we use a separate partition to hold
-
# current's root, 'usr', and 'var' directories. A partition
-
# holding "/", "/usr" and "/var" should be about 2GB in
-
# size.
-
-
-
-
make buildworld
-
make buildkernel KERNCONF=YOUR_KERNEL_HERE
-
-
-
make installworld DESTDIR=${CURRENT_ROOT}
-
make distribution DESTDIR=${CURRENT_ROOT} # if newfs'd
-
make installkernel KERNCONF=YOUR_KERNEL_HERE DESTDIR=${CURRENT_ROOT}
-
cp /etc/fstab ${CURRENT_ROOT}/etc/fstab # if newfs'd
-
-
-
-
-
-
-
-
To upgrade in-place from 5.x-stable to current
-
----------------------------------------------
-
-
make buildworld [9]
-
make kernel KERNCONF=YOUR_KERNEL_HERE [8]
-
[1]
-
[3]
-
mergemaster -p [5]
-
make installworld
-
make delete-old
-
mergemaster -i [4]
-
-
-
Make sure that you've read the UPDATING file to understand the
-
tweaks to various things you need. At this point in the life
-
cycle of current, things change often and you are on your own
-
to cope. The defaults can also change, so please read ALL of
-
the UPDATING entries.
-
-
Also, if you are tracking -current, you must be subscribed to
-
freebsd-current@freebsd.org. Make sure that before you update
-
your sources that you have read and understood all the recent
-
messages there. If in doubt, please track -stable which has
-
much fewer pitfalls.
-
-
[1] If you have third party modules, such as vmware, you
-
should disable them at this point so they don't crash your
-
system on reboot.
-
-
[3] From the bootblocks, boot -s, and then do
-
fsck -p
-
mount -u /
-
mount -a
-
cd src
-
adjkerntz -i # if CMOS is wall time
-
Also, when doing a major release upgrade, it is required that
-
you boot into single user mode to do the installworld.
-
-
[4] Note: This step is non-optional. Failure to do this step
-
can result in a significant reduction in the functionality of the
-
system. Attempting to do it by hand is not recommended and those
-
that pursue this avenue should read this file carefully, as well
-
as the archives of freebsd-current and freebsd-hackers mailing lists
-
for potential gotchas.
-
-
[5] Usually this step is a noop. However, from time to time
-
you may need to do this if you get unknown user in the following
-
step. It never hurts to do it all the time. You may need to
-
install a new mergemaster (cd src/usr.sbin/mergemaster && make
-
install) after the buildworld before this step if you last updated
-
from current before 20020224 or from -stable before 20020408.
-
-
[8] In order to have a kernel that can run the 4.x binaries
-
needed to do an installworld, you must include the COMPAT_FREEBSD4
-
option in your kernel. Failure to do so may leave you with a system
-
that is hard to boot to recover. A similar kernel option COMPAT_FREEBSD5
-
is required to run the 5.x binaries on more recent kernels.
-
-
Make sure that you merge any new devices from GENERIC since the
-
last time you updated your kernel config file.
-
-
[9] When checking out sources, you must include the -P flag to have
-
cvs prune empty directories.
-
-
If CPUTYPE is defined in your /etc/make.conf, make sure to use the
-
"?=" instead of the "=" assignment operator, so that buildworld can
-
override the CPUTYPE if it needs to.
-
-
MAKEOBJDIRPREFIX must be defined in an environment variable, and
-
not on the command line, or in /etc/make.conf. buildworld will
-
warn if it is improperly defined.
-
FORMAT:
-
-
This file contains a list, in reverse chronological order, of major
-
breakages in tracking -current. Not all things will be listed here,
-
and it only starts on October 16, 2004. Updating files can found in
-
previous releases if your system is older than this.
-
-
Copyright information:
-
-
Copyright 1998-2005 M. Warner Losh. All Rights Reserved.
-
-
Redistribution, publication, translation and use, with or without
-
modification, in full or in part, in any form or format of this
-
document are permitted without further permission from the author.
-
-
THIS DOCUMENT IS PROVIDED BY WARNER LOSH ``AS IS'' AND ANY EXPRESS OR
-
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-
DISCLAIMED. IN NO EVENT SHALL WARNER LOSH BE LIABLE FOR ANY DIRECT,
-
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-
POSSIBILITY OF SUCH DAMAGE.
-
-
If you find this document useful, and you want to, you may buy the
-
author a beer.
-
-
Contact Warner Losh if you have any questions about your use of
-
this document.
-
-
$FreeBSD: src/UPDATING,v 1.632.2.19.2.2 2011/02/16 14:28:04 kensmith Exp $
阅读(1736) | 评论(0) | 转发(0) |