Chinaunix首页 | 论坛 | 博客
  • 博客访问: 734584
  • 博文数量: 235
  • 博客积分: 4309
  • 博客等级: 中校
  • 技术积分: 2325
  • 用 户 组: 普通用户
  • 注册时间: 2011-01-17 11:25
个人简介

If you don\\\\\\\\\\\\\\\'t wanna do it, you find an EXCUSE; if you do, you\\\\\\\\\\\\\\\'ll find a WAY :-)

文章分类

全部博文(235)

文章存档

2014年(3)

2013年(2)

2012年(31)

2011年(199)

分类: BSD

2011-10-11 19:07:32

1: Check This Fire
  1. # less /usr/src/UPDATING
  2. 在本文档最下面 COMMON ITEMS 清楚的写明了各种方法! (本文最后便是节选)

2: Build the World (下面均在 Single User Mode 进行操作!)
  1. # shutdown now (进入 single user mode 或:init 1)

  2. # cd /usr/src
  3. # make buildworld (The buildworld places its output under /usr/obj)
3: Build, Install, and Test a Kernel (下面均在 Single User Mode 进行操作!)
  1. # cd /usr/src
  2. # make buildkernel KERNCONF=MYKERNEL
  3. # make installkernel KERNCONF=MYKERNEL
  4. or
  5. # make KERNCONF=MYKERNEL kernel
  6. # reboot


4: Prepare to Install the New World (下面均在 Single User Mode 进行操作!)
  1. 新内核测试过后,进入 single user mode:

  2. # shutdown now (进入 single user mode 或:init 1)

  3. # adjkerntz -i (确保时间的正确性)

  4. # fsck -p
  5. # mount -u /
  6. # mount -a -t ufs
  7. # swapon -a
  8. # mergemaster -p (比对配置文件)
  9. ...
  10. ...

5: Installing the World (下面均在 Single User Mode 进行操作!)
  1. # cd /usr/src
  2. # make installworld

  3. Some programs and files are no longer in the base system. To see what’s
  4. obsoleted, run make check-old.
  5. # make check-old
  6. >>> Checking for old libraries
  7. /lib/libcrypto.so.4
  8. /usr/lib/libssl.so.4
  9. /usr/lib/libroken.so.8
  10. /lib/libatm.so.3
  11. /lib/libc.so.6
  12. ...
  13. If you’re not specifically using any of the old programs or directories,
  14. delete them with make delete-old.
  15. # make delete-old

  16. You can also store old
  17. libraries in /usr/lib/compat, so that your programs will continue to run but
  18. the old libraries will be safely out of the way.
6: 搞定后 需要处理的
  1. # chflags -R noschg /usr/obj/ (build过程中 文件被设置为:immutable,改回来)
  2. # rm -rf /usr/obj/
  3. # cd /usr/src
  4. # make cleandir (传说一定要清理 2 次)
  5. # make cleandir (传说一定要清理 2 次)
  6. <如果没有成功创造新世界,也请清理一下;便于继续创造世界!>

  7. # shutdown -r now (或:reboot 或:init 6)

7: Recording What Happened
  1. # script ~/buildworld.out
  2. Script started, output file is ~/buildworld.out
  3. # make TARGET
  4. ... compile, compile, compile ...
  5. # exit (或者:Ctrl-D)
  6. Script done, ...
  7. (
    1. script(1) is one of those rarely mentioned but quite useful tools every
  8. sysadmin should know. It logs everything you type and everything that
  9. appears on the screen.
    1. )
  10. # 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: 

  1. COMMON ITEMS:
  2. General Notes
  3. -------------
  4. Avoid using make -j when upgrading. From time to time in the
  5. past there have been problems using -j with buildworld and/or
  6. installworld. This is especially true when upgrading between
  7. "distant" versions (eg one that cross a major release boundary
  8. or several minor releases, or when several months have passed
  9. on the -current branch).

  10. To build a kernel
  11. -----------------
  12. If you are updating from a prior version of FreeBSD (even one just
  13. a few days old), you should follow this procedure. It is the most
  14. failsafe as it uses a /usr/obj tree with a fresh mini-buildworld,
  15. make kernel-toolchain
  16. make -DALWAYS_CHECK_MAKE buildkernel KERNCONF=YOUR_KERNEL_HERE
  17. make -DALWAYS_CHECK_MAKE installkernel KERNCONF=YOUR_KERNEL_HERE
  18. To test a kernel once
  19. ---------------------
  20. If you just want to boot a kernel once (because you are not sure
  21. if it works, or if you want to boot a known bad kernel to provide
  22. debugging information) run
  23. make installkernel KERNCONF=YOUR_KERNEL_HERE KODIR=/boot/testkernel
  24. nextboot -k testkernel
  25. To just build a kernel when you know that it won't mess you up
  26. --------------------------------------------------------------
  27. This assumes you are already running a 5.X system. Replace
  28. ${arch} with the architecture of your machine (e.g. "i386",
  29. "alpha", "amd64", "ia64", "pc98", "sparc64", etc).
  30. cd src/sys/${arch}/conf
  31. config KERNEL_NAME_HERE
  32. cd ../compile/KERNEL_NAME_HERE
  33. make depend
  34. make
  35. make install
  36. If this fails, go to the "To build a kernel" section.
  37. To rebuild everything and install it on the current system.
  38. -----------------------------------------------------------
  39. # Note: sometimes if you are running current you gotta do more than
  40. # is listed here if you are upgrading from a really old current.
  41. make buildworld
  42. make kernel KERNCONF=YOUR_KERNEL_HERE
  43. [1]
  44. [3]
  45. mergemaster -p [5]
  46. make installworld
  47. make delete-old
  48. mergemaster [4]
  49. To cross-install current onto a separate partition
  50. --------------------------------------------------
  51. # In this approach we use a separate partition to hold
  52. # current's root, 'usr', and 'var' directories. A partition
  53. # holding "/", "/usr" and "/var" should be about 2GB in
  54. # size.
  55. make buildworld
  56. make buildkernel KERNCONF=YOUR_KERNEL_HERE
  57. make installworld DESTDIR=${CURRENT_ROOT}
  58. make distribution DESTDIR=${CURRENT_ROOT} # if newfs'd
  59. make installkernel KERNCONF=YOUR_KERNEL_HERE DESTDIR=${CURRENT_ROOT}
  60. cp /etc/fstab ${CURRENT_ROOT}/etc/fstab # if newfs'd
  61. To upgrade in-place from 5.x-stable to current
  62. ----------------------------------------------
  63. make buildworld [9]
  64. make kernel KERNCONF=YOUR_KERNEL_HERE [8]
  65. [1]
  66. [3]
  67. mergemaster -p [5]
  68. make installworld
  69. make delete-old
  70. mergemaster -i [4]
  71. Make sure that you've read the UPDATING file to understand the
  72. tweaks to various things you need. At this point in the life
  73. cycle of current, things change often and you are on your own
  74. to cope. The defaults can also change, so please read ALL of
  75. the UPDATING entries.
  76. Also, if you are tracking -current, you must be subscribed to
  77. freebsd-current@freebsd.org. Make sure that before you update
  78. your sources that you have read and understood all the recent
  79. messages there. If in doubt, please track -stable which has
  80. much fewer pitfalls.
  81. [1] If you have third party modules, such as vmware, you
  82. should disable them at this point so they don't crash your
  83. system on reboot.
  84. [3] From the bootblocks, boot -s, and then do
  85. fsck -p
  86. mount -u /
  87. mount -a
  88. cd src
  89. adjkerntz -i # if CMOS is wall time
  90. Also, when doing a major release upgrade, it is required that
  91. you boot into single user mode to do the installworld.
  92. [4] Note: This step is non-optional. Failure to do this step
  93. can result in a significant reduction in the functionality of the
  94. system. Attempting to do it by hand is not recommended and those
  95. that pursue this avenue should read this file carefully, as well
  96. as the archives of freebsd-current and freebsd-hackers mailing lists
  97. for potential gotchas.
  98. [5] Usually this step is a noop. However, from time to time
  99. you may need to do this if you get unknown user in the following
  100. step. It never hurts to do it all the time. You may need to
  101. install a new mergemaster (cd src/usr.sbin/mergemaster && make
  102. install) after the buildworld before this step if you last updated
  103. from current before 20020224 or from -stable before 20020408.
  104. [8] In order to have a kernel that can run the 4.x binaries
  105. needed to do an installworld, you must include the COMPAT_FREEBSD4
  106. option in your kernel. Failure to do so may leave you with a system
  107. that is hard to boot to recover. A similar kernel option COMPAT_FREEBSD5
  108. is required to run the 5.x binaries on more recent kernels.
  109. Make sure that you merge any new devices from GENERIC since the
  110. last time you updated your kernel config file.
  111. [9] When checking out sources, you must include the -P flag to have
  112. cvs prune empty directories.
  113. If CPUTYPE is defined in your /etc/make.conf, make sure to use the
  114. "?=" instead of the "=" assignment operator, so that buildworld can
  115. override the CPUTYPE if it needs to.
  116. MAKEOBJDIRPREFIX must be defined in an environment variable, and
  117. not on the command line, or in /etc/make.conf. buildworld will
  118. warn if it is improperly defined.
  119. FORMAT:
  120. This file contains a list, in reverse chronological order, of major
  121. breakages in tracking -current. Not all things will be listed here,
  122. and it only starts on October 16, 2004. Updating files can found in
  123. previous releases if your system is older than this.
  124. Copyright information:
  125. Copyright 1998-2005 M. Warner Losh. All Rights Reserved.
  126. Redistribution, publication, translation and use, with or without
  127. modification, in full or in part, in any form or format of this
  128. document are permitted without further permission from the author.
  129. THIS DOCUMENT IS PROVIDED BY WARNER LOSH ``AS IS'' AND ANY EXPRESS OR
  130. IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  131. WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  132. DISCLAIMED. IN NO EVENT SHALL WARNER LOSH BE LIABLE FOR ANY DIRECT,
  133. INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  134. (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  135. SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  136. HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  137. STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  138. IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  139. POSSIBILITY OF SUCH DAMAGE.
  140. If you find this document useful, and you want to, you may buy the
  141. author a beer.
  142. Contact Warner Losh if you have any questions about your use of
  143. this document.
  144. $FreeBSD: src/UPDATING,v 1.632.2.19.2.2 2011/02/16 14:28:04 kensmith Exp $
阅读(1737) | 评论(0) | 转发(0) |
0

上一篇:FreeBSD Kernel Games

下一篇:PF (Packet Filtering)

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