diff --git a/zh_TW.Big5/articles/Makefile b/zh_TW.Big5/articles/Makefile index 252b5a8271..d999776b7f 100644 --- a/zh_TW.Big5/articles/Makefile +++ b/zh_TW.Big5/articles/Makefile @@ -1,8 +1,12 @@ # $FreeBSD$ SUBDIR = SUBDIR+= contributing SUBDIR+= cvs-freebsd +SUBDIR+= hubs +SUBDIR+= mailing-list-faq +SUBDIR+= pr-guidelines +SUBDIR+= problem-reports DOC_PREFIX?= ${.CURDIR}/../.. .include "${DOC_PREFIX}/share/mk/doc.project.mk" diff --git a/zh_TW.Big5/articles/hubs/Makefile b/zh_TW.Big5/articles/hubs/Makefile new file mode 100644 index 0000000000..cded48ba4b --- /dev/null +++ b/zh_TW.Big5/articles/hubs/Makefile @@ -0,0 +1,17 @@ +# +# $FreeBSD$ +# +# Article: Mirroring FreeBSD + +DOC?= article + +FORMATS?= html +WITH_ARTICLE_TOC?= YES + +INSTALL_COMPRESSED?=gz +INSTALL_ONLY_COMPRESSED?= + +SRCS= article.sgml + +DOC_PREFIX?= ${.CURDIR}/../../.. +.include "${DOC_PREFIX}/share/mk/doc.project.mk" diff --git a/zh_TW.Big5/articles/hubs/article.sgml b/zh_TW.Big5/articles/hubs/article.sgml new file mode 100644 index 0000000000..a2944f2994 --- /dev/null +++ b/zh_TW.Big5/articles/hubs/article.sgml @@ -0,0 +1,1081 @@ + + + + + + + +%articles.ent; + +]> + +
+ + Mirroring FreeBSD + $FreeBSD$ + + + Jun + Kuriyama + +
kuriyama@FreeBSD.org
+
+
+ + Valentino + Vaschetto + +
logo@FreeBSD.org
+
+
+ + Daniel + Lang + +
dl@leo.org
+
+
+ + Ken + Smith + +
kensmith@FreeBSD.org
+
+
+
+ + + &tm-attrib.freebsd; + &tm-attrib.cvsup; + &tm-attrib.general; + + + + ³o¬O¥÷ÁÙ¦b¯ó½Z¤¤ªº¤å³¹¡A¥D­n¬O(¤×¨ä¬Oµ¹¦U°Ïºô¤¤¤ßºÞ²zªÌªº°Ñ¦Ò)¤¶²Ð¦p¦ó mirror FreeBSD¡C + +
+ + + Ápô¤è¦¡ + + ­Y­n§ä¾ã­Ó Mirror ¾÷¨îªº¨ó½ÕªÌ¡A¥i¥H email ¨ì mirror-admin@FreeBSD.org¡C¦¹¥~¡A³o¸Ì¤]¦³¥÷ + &a.hubs;¡C + + + + ¦¨¬° FreeBSD mirrors ªº¥²³Æ±ø¥ó + + µwºÐªÅ¶¡ + + µwºÐªÅ¶¡¬O³Ì­«­nªº¥²³Æ±ø¥ó¤§¤@¡C + Depending on the set of releases, architectures, + and degree of completeness you want to mirror, a huge + amount of disk space may be consumed. Also keep in mind + that official mirrors are probably required to be + complete. The CVS repository and the web pages should + always be mirrored completely. Also note that the + numbers stated here are reflecting the current + state (at &rel2.current;-RELEASE/&rel.current;-RELEASE). Further development and + releases will only increase the required amount. + Also make sure to keep some (ca. 10-20%) extra space + around just to be sure. + Here are some approximate figures: + + + §¹¾ã FTP Distribution: 126 GB + CVS repository: 2.7 GB + CTM deltas: 1.8 GB + Web pages: 300 MB + + + + ºô¸ôÀW¼e + + ·íµM¡A§A¤@©w­n¯à³s¤W Internet¡C + ÀW¼e»Ý¨D¦h¤Ö¡A³o­n¬Ý§A©Ò·Q­nªº mirror µ{«×¦Ó©w¡C + ­Y¥u·Q­n mirror ¤@³¡¥÷ªº FreeBSD ÀÉ®×¥H§@¬°ºô¯¸©Î intranet ªº§½³¡¥Î³~¡A + ¨º»òÀW¼e»Ý¨D·|©úÅã¤ñ¦¨¬°¤½¦@ªA°È¥Î³~ªº¤p¤@¨Ç¡C + ­Y·Q¦¨¬° official mirror ¤§¤@ªº¸Ü¡A¨º»òÀW¼e´N¶Õ¥²±o¼W¥[¤~°÷¥Î¡C¥H¤U¡A§Ú­Ì¶È¦C¥X¤@¨Ç¦ô­p­È¥H°µ¬°°Ñ¦Ò¡G + + + Local site, no public access: basically no minimum, + but < 2 Mbps could make syncing too slow. + Unofficial public site: 34 Mbps is probably a good start. + Official site: > 100 Mbps is recommended, and your host + should be connected as close as possible to your border router. + + + + ¨t²Î»Ý¨D¡BCPU¡BRAM + + One thing this depends on the expected number of clients, + which is determined by the server's policy. It is + also affected by the types of services you want to offer. + Plain FTP or HTTP services may not require a huge + amount of resources. Watch out if you provide + CVSup, rsync or even AnonCVS. This can have a huge + impact on CPU and memory requirements. Especially + rsync is considered a memory hog, and CVSup does + indeed consume some CPU. For AnonCVS it might + be a nice idea to set up a memory resident file system (MFS) of at least + 300 MB, so you need to take this into account + for your memory requirements. The following + are just examples to give you a very rough hint. + + + For a moderately visited site that offers + Rsync, you might + consider a current CPU with around 800MHz - 1 GHz, + and at least 512MB RAM. This is probably the + minimum you want for an official + site. + + + For a frequently used site you definitely need + more RAM (consider 2GB as a good start) + and possibly more CPU, which could also mean + that you need to go for a SMP system. + + + You also want to consider a fast disk subsystem. + Operations on the CVS repository require a fast + disk subsystem (RAID is highly advised). A SCSI + controller that has a cache of its own can also + speed up things since most of these services incur a + large number of small modifications to the disk. + + + + Services to offer + + Every mirror site is required to have a set of core services + available. In addition to these required services, there are + a number of optional services that + server administrators may choose to offer. This section explains + which services you can provide and how to go about implementing them. + + + FTP (required for FTP fileset) + + This is one of the most basic services, and + it is required for each mirror offering public + FTP distributions. FTP access must be + anonymous, and no upload/download ratios + are allowed (a ridiculous thing anyway). + Upload capability is not required (and must + never be allowed for the FreeBSD file space). + Also the FreeBSD archive should be available under + the path /pub/FreeBSD. + + + There is a lot of software available which + can be set up to allow anonymous FTP + (in alphabetical order). + + /usr/libexec/ftpd: FreeBSD's own ftpd + can be used. Be sure to read &man.ftpd.8;. + + + ftp/ncftpd: A commercial package, + free for educational use. + + + ftp/oftpd: An ftpd designed with + security as a main focus. + + + ftp/proftpd: A modular and very flexible ftpd. + + + ftp/pure-ftpd: Another ftpd developed with + security in mind. + + ftp/twoftpd: As above. + ftp/vsftpd: The very secure ftpd. + + ftp/wu-ftpd: The ftpd from Washington + University. It has become infamous, because of the huge + amount of security issues that have been found in it. + If you do choose to use this software be sure to + keep it up to date. + + + + FreeBSD's ftpd, proftpd, + wu-ftpd and maybe ncftpd + are among the most commonly used FTPds. + The others do not have a large userbase among mirror sites. One + thing to consider is that you may need flexibility in limiting + how many simultaneous connections are allowed, thus limiting how + much network bandwidth and system resources are consumed. + + + + Rsync (optional for FTP fileset) + + Rsync is often offered for access to the + contents of the FTP area of FreeBSD, so other mirror sites can use your system as their source. The + protocol is different from FTP in many ways. + It is much more + bandwidth friendly, as only differences between files + are transferred instead of whole files when they change. + Rsync does require a significant amount of memory for + each instance. The size depends on the size of + the synced module in terms of the number of directories and + files. Rsync can use rsh and + ssh (now default) as a transport, + or use its own protocol for stand-alone access + (this is the preferred method for public rsync servers). + Authentication, connection limits, and other restrictions + may be applied. There is just one software package + available: + + net/rsync + + + + + HTTP (required for web pages, optional for FTP fileset) + + If you want to offer the FreeBSD web pages, you will need + to install a web server. + You may optionally offer the FTP fileset via HTTP. + The choice of web server software is left up to the mirror administrator. + Some of the most popular choices are: + + + + www/apache13: + Apache is the most widely + deployed web server on the Internet. It is used + extensively by the FreeBSD Project. You may also wish to + use the next generation of the + Apache web server, available + in the ports collection as www/apache22. + + + + www/thttpd: + If you are going to be serving a large amount of static content + you may find that using an application such as thttpd is more + efficient than Apache. It is + optimized for excellent performance on FreeBSD. + + + + www/boa: + Boa is another alternative to + thttpd and + Apache. It should provide + considerably better performance than + Apache for purely static + content. It does not, at the time of this writing, + contain the same set of optimizations for FreeBSD that + are found in thttpd. + + + + + + CVSup (desired for CVS repository) + + CVSup is a very efficient way of distributing files. + It works similar to rsync, but was specially designed for + use with CVS repositories. If you want to offer the + FreeBSD CVS repository, you really want to consider + offering it via CVSup. It is possible to offer + the CVS repository via AnonCVS, FTP, + rsync or HTTP, but + people would benefit much more from CVSup access. + CVSup was developed by &a.jdp;. + It is a bit tricky to install on non-FreeBSD platforms, + since it is written in Modula-3 and therefore requires + a Modula-3 environment. John Polstra has built a + stripped down version of M3 that is sufficient to + run CVSup, and can be installed much easier. + See Ezm3 + for details. Related ports are: + + + + net/cvsup: The native CVSup port (client and server) + which requires lang/ezm3 now. + + + net/cvsup-mirror: The CVSup mirror kit, which requires + net/cvsup-without-gui, and configures it mirror-ready. Some + site administrators may want a different setup though. + + + + + There are a few more like + net/cvsup-without-gui you might want to have + a look at. If you prefer a static binary package, take a look + here. + This page still refers to the S1G bug that was present + in CVSup. Maybe + John will set up a generic download-site to get + static binaries for various platforms. + + + It is possible to use CVSup to offer + any kind of fileset, not just CVS repositories, + but configuration can be complex. + CVSup is known to eat some CPU on both the server and the + client, since it needs to compare lots of files. + + + + AnonCVS (optional for CVS repository) + + If you have the CVS repository, you may want to offer + anonymous CVS access. A short warning first: + There is not much demand for it, + it requires some experience, and you need to know + what you are doing. + + + Generally there are two ways + to access a CVS repository remotely: via + pserver or via ssh + (we do not consider rsh). + For anonymous access, pserver is + very well suited, but some still offer ssh + access as well. There is a custom crafted + wrapper + in the CVS repository, to be used as a login-shell for the + anonymous ssh account. It does a chroot, and therefore + requires the CVS repository to be available under the + anonymous user's home-directory. This may not be possible + for all sites. If you just offer pserver + this restriction does not apply, but you may run with + more security risks. You do not need to install any special + software, since &man.cvs.1; comes with + FreeBSD. You need to enable access via inetd, + so add an entry into your /etc/inetd.conf + like this: + +cvspserver stream tcp nowait root /usr/bin/cvs cvs -f -l -R -T /anoncvstmp --allow-root=/home/ncvs pserver + + See the manpage for details of the options. Also see the CVS info + page about additional ways to make sure access is read-only. + It is advised that you create an unprivileged account, + preferably called anoncvs. + Also you need to create a file passwd + in your /home/ncvs/CVSROOT and assign a + CVS password (empty or anoncvs) to that user. + The directory /anoncvstmp is a special + purpose memory based file system. It is not required but + advised since &man.cvs.1; creates a shadow directory + structure in your /tmp which is + not used after the operation but slows things + dramatically if real disk operations are required. + Here is an excerpt from /etc/fstab, + how to set up such a MFS: + +/dev/da0s1b /anoncvstmp mfs rw,-s=786432,-b=4096,-f=512,-i=560,-c=3,-m=0,nosuid,nodev 0 0 + + This is (of course) tuned a lot, and was suggested by &a.jdp;. + + + + + + How to Mirror FreeBSD + + Ok, now you know the requirements and how to offer + the services, but not how to get it. :-) + This section explains how to actually mirror + the various parts of FreeBSD, what tools to use, + and where to mirror from. + + + FTP + + The FTP area is the largest amount of data that + needs to be mirrored. It includes the distribution + sets required for network installation, the + branches which are actually snapshots + of checked-out source trees, the ISO Images + to write CD-ROMs with the installation distribution, + a live file system, lots of packages, the ports tree, + distfiles, and a huge amount of packages. All of course + for various FreeBSD versions, + and various architectures. + + + With FTP mirror + + You can use a FTP mirror + program to get the files. Some of the most commonly used are: + + ftp/mirror + ftp/ftpmirror + ftp/emirror + ftp/spegla + ftp/omi + ftp/wget + + + ftp/mirror was very popular, but seemed + to have some drawbacks, as it is written in &man.perl.1;, + and had real problems with mirroring large + directories like a FreeBSD site. There are rumors that + the current version has fixed this by allowing + a different algorithm for comparing + the directory structure to be specified. + + + In general FTP is not really good for mirroring. It transfers + the whole file if it has changed, and does + not create a single data stream which would benefit from + a large TCP congestion window. + + + + With rsync + + A better way to mirror the FTP area is rsync. + You can install the port net/rsync and then use + rsync to sync with your upstream host. + rsync is already mentioned + in . + Since rsync access is not + required, your preferred upstream site may not allow it. + You may need to hunt around a little bit to find a site + that allows rsync access. + + + Since the number of rsync + clients will have a significant impact on the server + machine, most admins impose limitations on their + server. For a mirror, you should ask the site maintainer + you are syncing from about their policy, and maybe + an exception for your host (since you are a mirror). + + + A command line to mirror FreeBSD might look like: + &prompt.user; rsync -vaz --delete ftp4.de.FreeBSD.org::FreeBSD/ /pub/FreeBSD/ + + Consult the documentation for rsync, + which is also available at + http://rsync.samba.org/, + about the various options to be used with rsync. + If you sync the whole module (unlike subdirectories), + be aware that the module-directory (here "FreeBSD") + will not be created, so you cannot omit the target directory. + Also you might + want to set up a script framework that calls such a command + via &man.cron.8;. + + + + With CVSup + + A few sites, including the one-and-only ftp-master.FreeBSD.org + even offer CVSup to mirror the contents of + the FTP space. You need to install a CVSup + client, preferably from the port net/cvsup. + (Also reread .) + A sample supfile suitable for ftp-master.FreeBSD.org + looks like this: + + # + # FreeBSD archive supfile from master server + # + *default host=ftp-master.FreeBSD.org + *default base=/usr + *default prefix=/pub + #*default release=all + *default delete use-rel-suffix + *default umask=002 + + # If your network link is a T1 or faster, comment out the following line. + #*default compress + + FreeBSD-archive release=all preserve + + + It seems CVSup would be the best + way to mirror the archive in terms of efficiency, but + it is only available from few sites. + + + Please have look at the CVSup documentation + like &man.cvsup.1; and consider using the + option. This reduces I/O operations by assuming the + recorded information about each file is correct. + + + + + + Mirroring the CVS repository + There are various ways to mirror the CVS repository. + CVSup is the most common method. + + + Using CVSup + + CVSup is described in some + detail in and . + + It is very easy to setup a + CVSup mirror. Installing + net/cvsup-mirror will + make sure all of the needed programs are installed and then + gather all the needed information to configure the mirror. + + + Please do not forget to consider the hint + mentioned in this note + above. + + + + + Using other methods + + Using other methods than CVSup is + generally not recommended. We describe them in short here + anyway. Since most sites offer the CVS repository as + part of the FTP fileset under the path + /pub/FreeBSD/development/FreeBSD-CVS, + the following methods could be used. + + FTP + Rsync + HTTP + + + + AnonCVS cannot be used to mirror the CVS repository + since CVS does not allow you to access the repository + itself, only checked out versions of the modules. + + + + + + Mirroring the WWW pages + + The best way is to check out the www + distribution from CVS. If you have a local mirror of the + CVS repository, it is as easy as: + &prompt.user; cvs -d /home/ncvs co www + and a cronjob, that calls cvs up -d -P + on a regular basis, maybe just after your repository was updated. + Of course, the files need to remain in a directory available + for public WWW access. The installation and configuration of a + web server is not discussed here. + + + + If you do not have a local repository, you can use + CVSup to maintain an up to date copy + of the www pages. A sample supfile can be found in + /usr/share/examples/cvsup/www-supfile and + could look like this: + + # + # WWW module supfile for FreeBSD + # + *default host=cvsup3.de.FreeBSD.org + *default base=/usr + *default prefix=/usr/local + *default release=cvs tag=. + *default delete use-rel-suffix + + # If your network link is a T1 or faster, comment out the following line. + *default compress + + # This collection retrieves the www/ tree of the FreeBSD repository + www + + + + Using ftp/wget or other web-mirror tools is + not recommended. + + + Mirroring the FreeBSD documentation + + Since the documentation is referenced a lot from the + web pages, it is recommended that you mirror the + FreeBSD documentation as well. However, this is not + as trivial as the www-pages alone. + + + First of all, you should get the doc sources, + again preferably via CVSup. + Here is a corresponding sample supfile: + + # + # FreeBSD documentation supfile + # + *default host=cvsup3.de.FreeBSD.org + *default base=/usr + *default prefix=/usr/share + *default release=cvs tag=. + *default delete use-rel-suffix + + # If your network link is a T1 or faster, comment out the following line. + #*default compress + + # This will retrieve the entire doc branch of the FreeBSD repository. + # This includes the handbook, FAQ, and translations thereof. + doc-all + + + + Then you need to install a couple of ports. + You are lucky, there is a meta-port: + textproc/docproj to do the work + for you. You need to set up some + environment variables, like + SGML_CATALOG_FILES. + Also have a look at your /etc/make.conf + (copy /usr/share/examples/etc/make.conf if + you do not have one), and look at the + DOC_LANG variable. + Now you are probably ready to run make + in your doc directory (/usr/share/doc + by default) and build the documentation. + Again you need to make it accessible for your web server + and make sure the links point to the right location. + + + The building of the documentation, as well as lots + of side issues, is documented itself in the + &os; Documentation + Project Primer. + Please read this piece of documentation, especially if you + have problems building the documentation. + + + + + + + How often should I mirror? + + Every mirror should be updated on a regular + basis. You will certainly need some script + framework for it that will be called by + &man.cron.8;. Since nearly every admin + does this his own way, we cannot give + specific instructions. It could work + like this: + + + + + Put the command to run your mirroring application + in a script. Use of a plain /bin/sh + script is recommended. + + + + + Add some output redirections so diagnostic + messages are logged to a file. + + + + + Test if your script works. Check the logs. + + + + + Use &man.crontab.1; to add the script to the + appropriate user's &man.crontab.5;. This should be a + different user than what your FTP daemon runs as so that + if file permissions inside your FTP area are not + world-readable those files can not be accessed by anonymous + FTP. This is used to stage releases — + making sure all of the official mirror sites have all of the + necessary release files on release day. + + + + + Here are some recommended schedules: + + FTP fileset: daily + CVS repository: hourly + WWW pages: daily + + + + + + Where to mirror from + + This is an important issue. So this section will + spend some effort to explain the backgrounds. We will say this + several times: under no circumstances should you mirror from + ftp.FreeBSD.org. + + + A few words about the organization + + Mirrors are organized by country. All + official mirrors have a DNS entry of the form + ftpN.CC.FreeBSD.org. + CC (i.e. country code) is the + top level domain (TLD) + of the country where this mirror is located. + N is a number, + telling that the host would be the Nth + mirror in that country. + (Same applies to cvsupN.CC.FreeBSD.org, + wwwN.CC.FreeBSD.org, etc.) + There are mirrors with no CC part. + These are the mirror sites that are very well connected and + allow a large number of concurrent users. + ftp.FreeBSD.org is actually two machines, one currently + located in Denmark and the other in the United States. + It is NOT a master site and should never be + used to mirror from. Lots of online documentation leads + interactiveusers to + ftp.FreeBSD.org so automated mirroring + systems should find a different machine to mirror from. + + + Additionally there exists a hierarchy of mirrors, which + is described in terms of tiers. + The master sites are not referred to but can be + described as Tier-0. Mirrors + that mirror from these sites can be considered + Tier-1, mirrors of Tier-1-mirrors, + are Tier-2, etc. + Official sites are encouraged to be of a low tier, + but the lower the tier the higher the requirements in + terms as described in . + Also access to low-tier-mirrors may be restricted, and + access to master sites is definitely restricted. + The tier-hierarchy is not reflected + by DNS and generally not documented anywhere except + for the master sites. However, official mirrors with low numbers + like 1-4, are usually Tier-1 + (this is just a rough hint, and there is no rule). + + + + Ok, but where should I get the stuff now? + + Under no circumstances should you mirror from ftp.FreeBSD.org. + The short answer is: from the + site that is closest to you in Internet terms, or gives you + the fastest access. + + + I just want to mirror from somewhere! + + If you have no special intentions or + requirements, the statement in + applies. This means: + + + + + Look at available mirrors in your country. + The FreeBSD + Mirror Database can help you with this. + + + + + Check for those which provide fastest access + (number of hops, round-trip-times) + and offer the services you intend to + use (like rsync + or CVSup). + + + + + Contact the administrators of your chosen site stating your + request, and asking about their terms and + policies. + + + + + Set up your mirror as described above. + + + + + + I am an official mirror, what is the right site for me? + + In general the description in + still applies. Of course you may want to put some + weight on the fact that your upstream should be of + a low tier. + There are some other considerations about official + mirrors that are described in . + + + + I want to access the master sites! + + If you have good reasons and good prerequisites, + you may want and get access to one of the + master sites. Access to these sites is + generally restricted, and there are special policies + for access. If you are already an official + mirror, this certainly helps you getting access. + In any other case make sure your country really needs another mirror. + If it already has three or more, ask the zone administrator (hostmaster@CC.FreeBSD.org) or &a.hubs; first. + + + Whoever helped you become, an official + should have helped you gain access to an appropriate upstream + host, either one of the master sites or a suitable Tier-1 + site. If not, you can send email to + mirror-admin@FreeBSD.org to request help with + that. + + + There are three master sites for the FTP fileset and + one for the CVS repository (the web pages and docs are + obtained from CVS, so there is no need for master). + + + ftp-master.FreeBSD.org + + This is the master site for the FTP fileset. + + + ftp-master.FreeBSD.org provides + rsync and CVSup + access, in addition to FTP. + Refer to and + how to access + via these protocols. + + + Mirrors are also encouraged to allow rsync + access for the FTP contents, since they are + Tier-1-mirrors. + + + + cvsup-master.FreeBSD.org + + This is the master site for the CVS repository. + + + cvsup-master.FreeBSD.org provides + CVSup access only. + See for details. + + + To get access, you need to contact the &a.cvsup-master;. + Make sure you read the + FreeBSD CVSup Access Policy + first! + + + Set up the required authentication by following + these + instructions. Make sure you specify the server as + freefall.FreeBSD.org on the cvpasswd + command line, as described in this document, + even when you are contacting + cvsup-master.FreeBSD.org + + + + + + + Official Mirrors + + Official mirrors are mirrors that + + + + a) have a FreeBSD.org DNS entry + (usually a CNAME). + + + + + b) are listed as an official mirror in the FreeBSD + documentation (like handbook). + + + + + So far to distinguish official mirrors. + Official mirrors are not necessarily Tier-1-mirrors. + However you probably will not find a Tier-1-mirror, + that is not also official. + + + Special Requirements for official (tier-1) mirrors + + It is not so easy to state requirements for all + official mirrors, since the project is sort of + tolerant here. It is more easy to say, + what official tier-1 mirrors + are required to. All other official mirrors + can consider this a big should. + + + The following applies mainly to the FTP fileset, + since a CVS repository should always be mirrored + completely, and the web pages are a case of + its own. + + + + + Tier-1 mirrors are required to: + + carry the complete fileset + allow access to other mirror sites + provide FTP and + rsync access + + + Furthermore, admins should be subscribed to the &a.hubs;. + See this link for details, how to subscribe. + + + It is very important for a hub administrator, especially + Tier-1 hub admins, to check the + release schedule + for the next FreeBSD release. This is important because it will tell you when the + next release is scheduled + to come out, and thus giving you time to prepare for the big spike of traffic which follows it. + + + It is also important that hub administrators try to keep their mirrors as up-to-date as + possible (again, even more crucial for Tier-1 mirrors). If Mirror1 does not update for a + while, lower tier mirrors will begin to mirror old data from Mirror1 and thus begins + a downward spiral... Keep your mirrors up to date! + + + + + How to become official then? + + An interesting question, especially, since the state + of being official comes with some benefits, like a much + higher bill from your ISP as more people will be using + your site. Also it may be a key requirement to get access + to a master site. + + + Before applying, please consider (again) if + another official mirror is really needed for + your region. Check first with your zone administrator (hostmaster@CC.FreeBSD.org) or, if that fails, ask on the &a.hubs;. + + Ok, here is how to do it: + + + + Get the mirror running in first place (maybe not + using a master site, yet). + + + + + Subscribe to the &a.hubs;. + + + + + If everything works so far, contact the DNS administrator responsible + for your region/country, and ask for a DNS entry for your + site. The admin should able to be contacted via + hostmaster@CC.FreeBSD.org, where + CC is your country code/TLD. + Your DNS entry will be as described + in . + + + If there is no subdomain set up for your + country yet, you should contact + mirror-admin@FreeBSD.org, + or you can try the &a.hubs; first. + + + + + Whoever helps you get an official name should send email + to mirror-admin@FreeBSD.org so your site will be + added to the mirror list in the + FreeBSD + Handbook. + + + + That is it. + + + + Some statistics from mirror sites + + Here are links to the stat pages of your favorite mirrors + (a.k.a. the only ones who feel like providing stats). + + + FTP site statistics + + + ftp.is.FreeBSD.org - hostmaster@is.FreeBSD.org - + + (Bandwidth) (FTP + processes) (HTTP processes) + + + + + ftp.cz.FreeBSD.org - cejkar@fit.vutbr.cz - + (Bandwidth) + (FTP processes) + (rsync processes) + + + + ftp2.ru.FreeBSD.org - mirror@macomnet.ru - + (Bandwidth) + (HTTP and FTP users) + + + + + + CVSup site stats + + + cvsup[23456].jp.FreeBSD.org - kuriyama@FreeBSD.org - (CVSup processes) + + + cvsup.cz.FreeBSD.org - cejkar@fit.vutbr.cz - + (CVSup processes) + + + + +
+ + diff --git a/zh_TW.Big5/articles/mailing-list-faq/Makefile b/zh_TW.Big5/articles/mailing-list-faq/Makefile new file mode 100644 index 0000000000..09f7ccb2f7 --- /dev/null +++ b/zh_TW.Big5/articles/mailing-list-faq/Makefile @@ -0,0 +1,26 @@ +# +# $FreeBSD$ +# +# Article: Frequently Asked Questions About The FreeBSD Mailing Lists + +DOC?= article + +FORMATS?= html + +INSTALL_COMPRESSED?=gz +INSTALL_ONLY_COMPRESSED?= + +WITH_ARTICLE_TOC?=YES + +# +# SRCS lists the individual SGML files that make up the document. Changes +# to any of these files will force a rebuild +# + +# SGML content +SRCS= article.sgml + +URL_RELPREFIX?= ../../../.. +DOC_PREFIX?= ${.CURDIR}/../../.. + +.include "${DOC_PREFIX}/share/mk/doc.project.mk" diff --git a/zh_TW.Big5/articles/mailing-list-faq/article.sgml b/zh_TW.Big5/articles/mailing-list-faq/article.sgml new file mode 100644 index 0000000000..7315385d33 --- /dev/null +++ b/zh_TW.Big5/articles/mailing-list-faq/article.sgml @@ -0,0 +1,430 @@ + + + + + + + +%articles.ent; +]> + +
+ + &os; Mailing Lists ±`¨£°Ýµª¶° + + + + The &os; Documentation Project + + + + $FreeBSD$ + + + 2004 + 2005 + 2006 + &os; ¤å¥ó­pµe + + + + ³o¬O¦³Ãö &os; mailing lists ªº FAQ¡C¦pªG±z¹ï¨ó§U¥»¤å¥ó/½Ķ­pµe + ªº¶i¦æ¦³¿³½ìªº¸Ü¡A½Ð±H e-mail ¨ì + &a.doc;¡C¦¹¥~¡AÀH®É¥i±q + FreeBSD ºô¯¸ ®³¨ì³o¥÷¤å¥óªº³Ì·sª©¥»¡C + ¤]¥i¥H§Q¥Î HTTP ¨Ó¤U¸ü HTML + ¤å¥ó¡A©Î¬O¸g¥Ñ + FreeBSD FTP ¯¸ ¤U¸ü¯Â¤å¦r¡B&postscript;¡B©Î PDF ª©¥»ªºÀɮסC + ±z¤]¥i¥H¦b³o¸Ì¨Ï¥Î + ·j´M FAQ ¸ê®Æ + ªº¥\¯à¡C + + + + + «e¨¥ + + ¦p¦P¨ä¥L FAQs ¤@¼Ë¡A¥»¤å¥D­n¥Øªº¬O§Æ±æ²[»\¦b &os; mailing + lists ¤W­±ªº±`¨£°ÝÃD(·íµM¡A¥]¬Aµª®×)¡C + ÁöµM¡A­ì¥»ºc·Q¬O§Æ±æ¯à­°§C³o¨Ç­«½Æ°ÝÃDªººô¸ô¬y¶q¡A¦ý¦p¤µ¤w³Q¤½»{ FAQs ¤]¬O¬Û·í¦n¥Îªº¸ê·½¤§¤@¡C + + ¥»¤å¥D­n¬O´y­zªÀ¸s¤§¶¡©Ò°ö¾iªº¤@¨Ç§»ö(©ÎÀq«´)¡A¦ý¥»¤å¥»¨­¨Ã«D¡y¸t¦®¡z¯ëªºÅv«Â¡C + ­Yµo²{¥»¤å¤º¦³¥ô¦ó§Þ³N·å²«¡A©ÎªÌ¬O·Q«Øij¥i¥H¼W¥[­þ¨Ç³¡¤Àªº¸Ü¡A½Ð°e PR¡A©Î¬O email ¨ì &a.doc;¡CÁÂÅo¡I + + + + + &os; mailing lists ªº¥Øªº¬°¦ó¡H + + + + &os; mailing lists ¥D­n¬O´£¨Ñ &os; ªÀ¸s¶¡ªº·¾³qºÞ¹D¡A³o¸Ì¦³¦U¦¡±MÃD»â°ìªº±´°Q¡A¥H¤Î¿³½ì¥æ¬y¡C + + + + + + &os; mailing lists ªº°Ñ»PªÌ¦³­þ¨Ç? + + + + ³o­Ó°ÝÃD¡A­n¬Ý¦U­Ó list ªº¡yª©³W(charter)¡z©w¦ì¦Ó¦³©Ò¤£¦P¡C¦³¨Ç lists ¥D­n¬O developers ¦b°Ñ»P°Q½×ªº¡F + ¦Ó¦³¨Ç«h¥D­n¬O´X¥G¾ãÅé &os; ªÀ¸s³£¥i¥HÀH·N°Ñ»P°Q½×ªº¡C½Ð¬Ý ³o¥÷²M³æ ¤W­±¦³¥Ø«e©Ò¦³ list ªººK­n»¡©ú¡C + + + + + + &os; mailing lists ¹ï¥ô¦ó¤H³£¬O¶}©ñ°Ñ»Pªº¶Ü¡H + + + + ¦A­«½Æ¤@¦¸¡A³o­n¬Ý¦U­Ó list ªº¡yª©³W(charter)¡z©w¦ì¦Ó¦³©Ò¤£¦P¡C + ½Ð¦bµo¤å«e¡A¥ýª`·N¾\Ū¸Ó list ªº¡yª©³W(charter)¡z¡A¨Ã¿í¦u¬ÛÃö­ì«h¡C + ¦p¦¹¤@¨Ó¡A¤~·|Åý¤j®a³£¯à·¾³q§óµLê¡C + + ¦pªG¬Ý¤F¤W¤@­Ó°Ýµª¤ºªº²M³æ¤§«á¡AÁÙ¬O¤£²M·¡­n¨ì­þ­Ó list ¥hµo°Ýªº¸Ü¡A + ¨º»ò¥i¥H¸ÕµÛ§â°ÝÃD¥á¨ì freebsd-questions ¬Ý¬Ý(¦ý½Ð¥ý¬Ý¤U­±Á¿ªº¸É¥R)¡C + + ½Ðª`·N¡G²ßºD¤W©Ò¦³ mailing lists ³£¬O¶}©ñµoªí°Q½×ªº¡A¤]¤£¥²±o¥ý¦¨¬°­q¾\·|­û¤~¦æ¡C + ³o¬O¬Û·í¼f·Vªº¿ï¾Ü¡A¨ÓÅý°Ñ»P &os; ªÀ¸s§ó»´ÃP®e©ö¡A¨Ã¹ªÀy¤¬¬Û¤À¨É©¼¦¹ªº·Qªk¡C + µM¦Ó¡A¥Ñ©ó¹L¥h¦³¨Ç¤HªºÀݥΡA¦³¨Ç lists ²{¦b¶}©l­­¨î°Ñ»P°Q½×ªº³¡¤À¡A¥HÁקK¤£¥²­nªº§xÂZ¡C + + + + + + ­n«ç»ò­q¾\©O¡H + + + + ¥i¥H¥Î + Mailman ºô­¶¤¶­± ¨Ó­q¾\¥ô¦ó¤½¶}ªº lists¡C + + + + + + ­n«ç»ò°h­q¡H + + + + ¤@¼Ë½Ð¥Î­è¤W­±»¡ªººô­¶¤¶­±¡A©ÎªÌ mailing list ¤W­±¨C«Ê«Hµ²§À³B³£·|¦³¬ÛÃö URL ³sµ²ªº«ü¥Ü»¡©ú¡C + + ¤d¸U½Ð¤£­nª½±µ¼g«H¨ì³o¨Ç¤½¶}ªº mailing lists »¡§A­n°h­q¡C + ­º¥ý©O..¦]¬°¥»¨Ó´N¤£¬O³o¼Ë°h­qªº¡A¨ä¦¸§A·|·S¨Ó²³«ã¦Ó©Û¨Ó³ò¶Ï¡Bµ§¾Ô¡C + ³o¬O«Ü¨å«¬ªº°h­q¿ù»~¥Ü½d¡A½Ð¤£­n³o¼Ë°µ¡C + + + + + + ¥i¥H§ä¨ì«Hªº¸ê®Æ®w¶Ü¡H + + + + ¶â¡A¦³¡I¥i¥H¦b ³oÃä + §ä¨ì¬ÛÃöªºÂ«H¸ê®Æ®w(archive)¡C + + + + + + mailing lists ¥i¦³ºK­nª©©O¡H + + + + ·íµM¤]¦³¡A½Ð¬Ý + Mailman ºô­¶¤¶­±¡C + + + + + + + Mailing List ªº°Ñ»P§»ö + + ¦b mailing lists ¤W°Ñ»P°Q½×¡A´N¹³¦b¨ä¥LªÀ¸s¤@¼Ë¡A§Ú­Ì³£»Ý­n¤@¨Ç·¾³q¤Wªº¦@ÃÑ¡C + µo¨¥½Ðª`­«Â§»ö(©ÎÀq«´)¡A¤Á¤ÅµLªº©ñ¥Ú¡C + + + + + ¦bµo¤å¤§«e¡A¦³¤°»òª`·N¨Æ¶µ©O¡H + + + + ³Ì­«­nªº¬O§A¤w¸g¬Ý¤F³o½g¤å³¹¡AµM¦Ó¡A­Y±z¹ï &os; ¤£¼ôªº¸Ü¡A + ¥i¯à»Ý­n¥ý¼sªx¾\Ū + ¬ÛÃö®ÑÄy¤Î¤å³¹ + ¨Ó¥ý¼ô±x³o®M§@·~¨t²Î©M¤@¨Ç¨å¬G¡A¤×¨ä¬O¨ä¤¤ªº + &os; ±`¨£°Ýµª¶° (FAQ) ¤å¥ó¡A + + &os; ¨Ï¥Î¤â¥U(Handbook)¡A + ¥H¤Î¬ÛÃö¤å³¹¡G + How to get best results from the FreeBSD-questions mailing list¡B + + Explaining BSD¡B¥H¤Î + &os; First Steps¡C + + ¦¹¥~¡A¹ï¤W­z¤å¥ó¤º¤w¦³¸Ñµªªº³¡¥÷¤S´£¥X¨Ó°Ýªº¸Ü¡A·|³Q»{¬°¬O¬Û·í¤£Â§»ªªº¡C + ³o¨Ã¤£¬O¦]¬°³o¸s§Ó¤u¬O¬Û·í§[©ó¦^µªªº¡A¦Ó¬O¤@¦A³Q¬Û¦Pªº°ÝÃD¤£Â_¯h³ÒÅF¬µ¤§«á¡A©Ò²£¥Íªº®À§é·P«Ü­«¡C + ¤×¨ä¬O²{¦¨µª®×©ú©ú´N¦b²´«e¡A«o¤´¦P¼Ë°ÝÃDº¡¤Ñ­¸¡A³o¹ê¦b¬O...¡C + ½Ðª`·N¡G³o¨Ç &os; ¬ÛÃö¤å¥ó´X¥G³£¬O¥Ñ¤@¸sµLÁ~§Ó¤uªº¦n¤ß¦¨ªG¡A¦Ó¥L­Ì¤]¬O¤H¡C + + + + + + + ¦p¦óÁקK¤£·íµo¤å©O¡H + + + + + + µo¤å®É¡A½Ð°È¥²¿í¦u¸Ó mailing list ªº¹CÀ¸³W«h¡C + + + + ¤£­n§@¤H¨­§ðÀ»¡C¦nªººô¸ô¤½¥Á¡AÀ³¸Ó­n¦³§ó°ªªº¨¥¦æ¼Ð·Ç¡C + + + + ½Ð¤£­n¸Õ¹Ï§@ Spam ¦æ¬°(¼s§i¡BÂà¶K¦h³Bµ¥¤£½Ð¦Û¨Ó¦æ¬°)¡C + ©Ò¦³ mailing lists ³£·|¿n·¥¸T¤î³o¨Ç¹H³WªÌ¡A¤@¥¹¦³ªº¸Ü¡A¨º»ò«áªG½Ð¦Û¦æ­t³d¡C + + + + + + + + µo¤å®É¡A¦³¤°»ò¸Óª`·Nªº¶Ü¡H + + + + + + µo¤å®É¡A½Ð«O«ù¤@¦æ¬ù 75 ­Ó¦r¤¸´N¦Û°ÊÂ_¦æ¡A¦]¬°¨Ã¤£¬O¨C­Ó¬Ýªº¤H³£¦³«Ü¬¯ªº¹Ï§Î¤¶­±(GUI)¬Ý«H³nÅé¡C + + + + ½Ðª`·N¡G¨Æ¹ê¤W¡Aºô¸ôÀW¼e¨Ã¤£¬OµL­­ªº¡C + ¨Ã«D¨C­ÓŪªÌªºÀW¼e³£«Ü¤j¡A©Ò¥H­Y·Q¶K¤@¨Ç¹³¬O config.log + ¤§Ãþªº³]©wÀɤº®e¡A©Î¬O¤j¶qªº stack trace ¬ö¿ý¡A¨º»ò½Ð§â¥¦©ñ¦b¦Û¤vºô¯¸¤W¡AµM«á¶K¥X¸Óºô§} URL ´N¦æ¤F¡C + ÁÙ¦³¤@¥ó¨Æ¡A½Ð°O¦í¡A³o¨Ç«H¥ó³£·|³Q«H¸ê®Æ®w«O¦s¤U¨Ó¡A©Ò¥H³o¼Ë§@·|³y¦¨«O¦sªº¸ê®Æ®w·|«Ü§Ö³Q¶ë¨ì«Ü¤j¡A + ¬Æ¦Ü¥i¯à¶ëÃz Server ªºµwºÐªÅ¶¡¡C + + + + ¤å³¹¬O­nÅý¤H¬Ý±oÀ´¡A©Ò¥H½Ðª`·Nª©­±½s±Æªº¥iŪ©Ê¡AÁÙ¦³.. + ¤d¡@¸U¡@¤£¡@­n¡@¤j¡@Án¡@ÄW¡@¥s!!!!! ³oÂI¥i¤£¥u &os; mailing lists ¤~»Ý¦p¦¹ª`·N¡A + ½Ð¤Å§C¦ô¤å³¹¡y°ò¥»½s±Æ¡zªº­«­n©Ê¡B³sÂê®ÄÀ³¡C + «H¤¤ªºªí¹F¤è¦¡³q±`´N¥NªíµÛ§O¤H²´¤¤ªº§A¡A­Y¤å³¹Åý¤H¬Ý¤F«Ü¦Y¤O(Ãú·Ù·Ù)¡B«÷¦r¿ù»~¦Ê¥X¡B + ¥Rº¡»y·N©ÎÅÞ¿è¿ù»~¡B©Î¬O¤å¤º¥Rº¡¤@°ïÅå¹Ä¸¹¡A³o·|Åý¤H¹ï§A¦L¶HÆ[·P·¥®t¡C + + + + ¦b¤@¨Ç¯S©wªº list ³õ¦X¡A½Ð¥Î¾A·íªº»y¨¥¨Ó·¾³q¡C³\¦h«D­^»y¨tªºmailing + lists ¥i¥H¨ì + + ³oÃä ¬d¬Ý¬Ý¡C + + ¹ï©ó³\¦h¥À»y¤£¬O­^»yªº¤H¡A§Ú­Ì³£¯à½Ì¸Ñ¥L­Ìªº­W·¡¡A¨Ã¥B¸ÕµÛ¾¨¶q¦h¦h¥]²[¡C + ­^¤å«D¥À»yªº¤H¡A§Ú­Ì·|¾¨¶q¤£´c·N§åµû«÷¦r©Î¤åªk¿ù»~¤§³B¡C + &os; ¦b³o¤è­±¡A¤@ª½¦³¬Û·íÀu¨qªº¬ö¿ý¡A½ÐÅý§Ú­ÌÄ~Äò«O«ù³o¶Ç²Î§a¡C + + + + ¼g«H®É¡A½Ð¥Î¬Û®e¼Ð·Çªº Mail User Agent (MUA)µ{¦¡¡C + ¤£¨}ªº(©Î³]©w¿ù»~ªº)±H«Hµ{¦¡ + ³o¸Ì¦C¦³³\¦h«H¥ó®æ¦¡ªº¿ù»~¥Ü½d¡C¥H¤U¬O¤@¨Ç¤wª¾ªº±H«Hµ{¦¡ªº¤£¨}¥Ü½d¡G + + + + cc:Mail + + + + (ª©ªº)&eudora; + + + + exmh + + + + µsoft; Exchange + + + + µsoft; Internet Mail + + + + µsoft; &outlook; + + + + (ª©ªº)&netscape; + + + + ¦p¦P¤W­z©Ò¨£¡AMicrosoft ¥Xªº¤@°ï±H«Hµ{¦¡³q±`³£¬O¤£¬Û®e¼Ð·Ç®æ¦¡ªº¡C + ½Ð¾¨¶q§ï¥Î &unix; ¤Wªº±H«Hµ{¦¡¡C­Y¥²¶·¦b Microsoft Àô¹Ò¤U¨Ï¥Î±H«Hµ{¦¡ªº¸Ü¡A + ½Ð°O±o½T»{³]©w¬O§_¥¿½T¡C½Ð¾¨¶q¤£­n¥Î MIME ®æ¦¡¡G + ¦]¬°¦³¤@°ï¤H³£¦bÀݥΠMIME «H¥ó®æ¦¡¡C + + + + ½Ð½T»{¡G®É¶¡»P®É°Ï³]©w¬O§_¥¿½T¡C + ³o°ÝÃD¬Ý°_¨Ó¦³ÂIÄø¡A¦]¬°§A±H¥Xªº«HÁÙ¬O·|¨ì¹F mailing list ¤W¡A + ¦ý¬O©O¡A¨C¦ì mailing lists ¤Wªº­q¤á¨C¤Ñ³£·|¬Ý¼Æ¦Ê«Êªº«H¡A + ¥L­Ì³q±`·|§â«H¥ó¥H¼ÐÃD¸ò®É¶¡§@¬°±Æ§Ç¨Ì¾Ú¡C + ­Y§Aªº«H¨S¦³¦b²Ä¤@½g¥¿¸Ñ¤§«e´N¥ý¥X²{ªº¸Ü¡A¥L­Ì´N·|°²³]¥i¯à¬Oº|¦¬§A³o«Ê«H¡A + µM«á´N¨S¦A¥h¬Ý§A¨º«Ê«H¤F¡C + + + + ½Ð´£¨Ñµ{¦¡¥X²{ªº¬ÛÃö°T®§¡A¹³¬O &man.dmesg.8; ©ÎªÌ console + messages ¤]´N¬O³q±`·|¥X²{¦b /var/log/messages ¥X²{ªº¡C + ½Ð¤£­n¥Î¤â¥´¡A¦]¬°³o¤£¶È«Ü­W¡A¦Ó¥B¤]¥i¯à¥´¿ù¦r©Î¶Ã±¼­ì¦³®æ¦¡¡C½Ðª½±µ§â¬ÛÃöªº log ÀÉ¥á¥X¨Ó¡A + ©Î¬O¥Î½s¿è¾¹¨Ó°Åµô¡B©Î¬O¥Î·Æ¹«½Æ»s/¶K¤W¨Ó§¹¦¨¡CÁ|­Ó¨Ò¤l¡A¦pªG¬O­n§â¹³¬O dmesg + ªºµ{¦¡°T®§­Ë¤J¨ì¬Y­ÓÀÉ®×¥hªº¸Ü¡A¨º»ò§@ªk¦p¤U¡G + + &prompt.user; dmesg > /tmp/dmesg.out + + ³o¼Ë¤l·|§â°T®§°e¨ì /tmp/dmesg.out Àɤº¡C + + + + ¦b¥Î·Æ¹«°Å¶K®É¡A½Ðª`·N¬O§_¦³¥Ç¤@¨Ç²Ó¸`ªº°Å¶KÃa²ßºD¡C + ¤×¨ä¬O¹³¶K Makefiles ¤§ÃþÀɮ׮ɡA¥Ñ©ó tab + Áä©Ò¥´¥X¨Óªº¤À®æ¡A¬OÄÝ©ó¯S®í¦r¤¸¡C¦]¦¹¡A¦b + GNATS PR ¸ê®Æ®w ¤W«Ü±`¬Ý¨ì³oÃþ«Ü±`¨£ªº´o¤H°ÝÃD¡G + Makefiles ¤ºªº tab ¸g¹L°Å¶K«á¡AÅܦ¨¡yªÅ¥Õ(white space)¡z + ©Î¬O§xÂZªº =3B escape sequence¡A³o¨Ç·|Åý committers ­Ì¤Q¤À¤£²n¡C + + + + + + + + ¦b mailing lists ¤W¦^¤åªº¸Ü¡A¦³¤°»ò­n¯S§Oª`·Nªº¶Ü¡H + + + + + + ½Ð¾A·í½Õ¾ã¤å³¹¤Þ¨¥ªø«×¡C¦^¤å®É¡A¤Þ¨¥³¡¥÷½Ð¤Þ¡y¦³½Í¨ìªº¡z³¡¤À¬°¥D¡A¦ý½Ð¤£­n¹L»P¤£¤Î¡C + À³¸Ó«O¯d¯A¤Î°Q½×½d³òªº­ì¤å¡A³o¼Ë¤l¤~¯àÅý¨S¬Ý¹L«e­±¤å³¹ªº¤Hª¾¹D¬O¦bÁ¿¤°»ò¡A¦Ó«D¤@ÀYÃú¤ô¡C + + ÁÙ¦³¤@ÂI¤]«Ü­«­n¡A­ì¤å­Y¬O´T«×¬Û·íªøªº¸Ü¡A°O±oµù©ú "yes, I see this too"¡C + + + + µ½¥Î§Þ¥©¨Ó½T»{­ì¤å»P¦Û¤v¼gªº³¡¥÷¡G + ³q±`·|¦b­ì¤åªº¨C¦æ«e­±¥[¤W > ¥H§@°O¸¹¡C + ½Ð°O±o«O¯d > ²Å¸¹«á­±ªºªÅ¥Õ¡A¨Ã¥B¦b­ì¤å¥H¤Î§A©Ò¼gªº¬q¸¨¤§¶¡¥[¤WªÅ¦æ¡A + ¥H«K¾\Ū¡C + + + + ½Ð¤£­nÂ_³¹¨ú¸q¡B¬ïÆwªþ·|¡G³q±`¹ï­ì©l¤å³¹¡yÂ_³¹¨ú¸q¡z¡B¡y¬ïÆwªþ·|¡z·|Åý¤j®a«Ü¤£²n¡A¦]¬°¥L­Ì­ì·N¨Ã«D¦p¦¹¡A«o³Q¦±¸Ñ¡C + + + + ¦^¤å®É¡A¤£­n¼g¦b­ì¤å¤W­±(top post)¡C + ³o­Ó·N«ä¬O¡G­Y­n¦^¤å®É¡A½Ð¼g¦b­ì¤å¤U¤è¡A¤£­n¼g¦b­ì¤å¤W­±¡A¥H§KÅý¤H¦³®ÉªÅ¿ù¸mªº¿ù¶Ã²V²c¡C + + + + µª¡G Because it reverses the logical flow of + conversation. + + + °Ý¡G Why is top posting frowned upon? + + + (·PÁ Randy Bush ´£¨Ñ¯º¸Ü) + + + + + + + + + Mailing Lists ¤Wªº­«½Æ©Ê°ÝÃD + + ¦b mailing lists ¤W°Ñ»P°Q½×¡A´N¹³¦b¨ä¥LªÀ¸s¤@¼Ë¡A§Ú­Ì³£»Ý­n¤@¨Ç·¾³q¤Wªº¦@ÃÑ¡C + ³\¦h mailing lists ³£·|°²³]°Ñ»P°Q½×ªÌ³£¤j­Pª¾¹D FreeBSD ­p¹ºªº¤@¨Ç¾ú¥v²W·½¡C + ¤×¨ä¬OªÀ¸sªº·s¤âÁ`¬O©w´Á·|¤£Â_­«½Æ°ÝÃþ¦ü°ÝÃD¡C + ¨C­Óµo¤åªº¤H¡A³£¦³³d¥ô¨ÓÁקK±¼¤J³o¼Ëªº´c©Ê´`Àô½ü°j¤º¡C + ¦]¦¹¡AÀ³¾¨¥i¯àÅý mailing list ¤W¯à¥¿±`°Q½×¡A¦ÓÁקKÅý¦Û¤v³´¤Jµ§¾Ôªdªh¡C + + ­n«ç»òÁקK©O¡H³Ì¦nªº¤èªk´N¬Oµ½¥Î³o¨Ç + mailing list «H¸ê®Æ®w(archives)¡A¨ÓÁA¸Ñ¬ÛÃö­I´º¡C + ¥¿¥Ñ©ó³o­ì¦]¡A©Ò¥H + mailing list ·j´M¤¶­± ´NÅã±o«D±`¦n¥Î¡C + (­Y³o¤èªk¤´µLªk§ä¨ì¦³¥Îªºµª®×¡A¨º»ò½Ð§ï¥Î¦Û¤v·R¥Îªº·j´M¤ÞÀº§a) + + ³z¹L³o¨Ç«H¸ê®Æ®w¡A¤£¥u¥iÁA¸Ñ¥ý«e°Q½×¹L­þ¨Ç¸ÜÃD¡A¤]¥i¥Hª¾¹D¡G¬O«ç»ò°Q½×ªº¡B + ­þ¨Ç¤H°Ñ»P°Q½×¹L¡B¥D­n¬Ýªº¤H¤S¬O­þ¨Ç¤H¡C + ¤J¹ÒÀH«U³o¨Ç­ì«h¤£¥u¬O &os; mailing list ¤W¤~³o¼Ë¡A¤@¼Ë¥i¥H¾A¦X¨ä¥L¦a¤è¡C + + archives ªº¤º®eµLºÃ¦a¬Û·í¼sªx¡A¦Ó¥B·|¦³¨Ç°ÝÃD¤£Â_¤ÏÂÐ¥X²{¡A + ¦³®É°Q½×¨ì«á­±Á`·|Â÷ÃD¡CµL½×¦p¦ó¡A¦bµo°Ý«eªº¸q°È´N¬O¥ý°µ¦n¥\½Ò¡A + ¥HÁקK³oÃþªº¤ë¸g¤å´c©Ê´`Àô¡A¤×¨ä¬O¥O¤H¤Ï·Pªº bikeshed¡]¥´¼L¯¥)¡C + + + + ¤°»ò¬O "Bikeshed" §r¡H + ³æ´N¦r­±¤W·N«ä¸ÑÄÀªº¸Ü¡Abikeshed ¬O«ü±Mªùµ¹¸}½ñ¨®¡B¾÷¨®¤§Ãþªº¨â½ü¥æ³q¤u¨ã¨Ï¥Îªº¾B«B´×¡A + µM¦Ó©O¡A¦b &os; ³oÃ䪺»¡ªk«o¦³¨ä¥L·N«ä(±a¦³¶S§í)«üªº¬O¡G + ¬Y¨Ç¯S©w¸ÜÃDªº­«½Æ°Q½×¡A¤×¨ä¬O«ü¦b &os; ªÀ¸s¤ºµ´¤£·|¦³¦@ÃÑ¡A¥B¦³ª§Ä³ªº¸ÜÃD¡C + (³o¦r·Jªº°_·½¦b + ³o¥÷¤å¥ó ¤º¦³§ó¦h»¡©ú)¡C§A¥u­n¦bµo«H¨ì¥ô¤@ &os; mailing lists ¤§«e¡Aª¾¹D³o­Ó°ò¥»·§©À´N¦æ¤F¡C + + ¤@¯ë¨ÓÁ¿¡A¡ybikeshed¡z¬O«Ü®e©ö²£¥Í³\¦hªiªºµ§¾Ô»PÃB¥~°Q½×ªºª§Ä³¸ÜÃD¡A¦pªG¨Æ¥ý¤£ª¾¹D³o¨Ç­I´ºªº¸Ü¡C + + «ô°U¡A½ÐÀ°­Ó¦£Åý°Q½×¦^Âk¥¿±`¡A¦Ó¤£­n¥u¬O¨ì³B¥´¼L¯¥¦Ó¤w¡C·P®¦¡I + + + + ­PÁ + + + + &a.grog; + + + How to get best results from the FreeBSD-questions mailing list ¤@¤åªº­ì§@ªÌ¡A + §Ú­Ì±q¥L³o¤å¤ºÀò±o³\¦h mailing list ¤WªºÂ§»ö(©ÎÀq«´)¼g§@ÃD§÷¡C + + + + + &a.linimon; + + ¥» FAQ Âú§Îªº­ì§@ + + + + + +
diff --git a/zh_TW.Big5/articles/pr-guidelines/Makefile b/zh_TW.Big5/articles/pr-guidelines/Makefile new file mode 100644 index 0000000000..9aa329f736 --- /dev/null +++ b/zh_TW.Big5/articles/pr-guidelines/Makefile @@ -0,0 +1,19 @@ +# +# $FreeBSD$ +# +# Article: Problem Report Handling Guidelines + +DOC?= article + +FORMATS?= html +WITH_ARTICLE_TOC?= YES + +INSTALL_COMPRESSED?=gz +INSTALL_ONLY_COMPRESSED?= + +SRCS= article.sgml + +URL_RELPREFIX?= ../../../.. +DOC_PREFIX?= ${.CURDIR}/../../.. + +.include "${DOC_PREFIX}/share/mk/doc.project.mk" diff --git a/zh_TW.Big5/articles/pr-guidelines/article.sgml b/zh_TW.Big5/articles/pr-guidelines/article.sgml new file mode 100644 index 0000000000..8df326229e --- /dev/null +++ b/zh_TW.Big5/articles/pr-guidelines/article.sgml @@ -0,0 +1,881 @@ + + + + + + + +%articles.ent; + + +]> + +
+ + + °ÝÃD¦^³ø(PR)ªº³B²z­ì«h + + $FreeBSD$ + + + &tm-attrib.freebsd; + &tm-attrib.opengroup; + &tm-attrib.general; + + + + ³o½g¤å³¹¥D­n¦bÁ¿¡G¥Ñ FreeBSD PR ºûÅ@¤p²Õ©Ò´£¥Xªº¤@¨Ç FreeBSD °ÝÃD¦^³ø(PR) + «Øij¡A§Æ±æ¤j®a¦b§Ë PR ®É³£¯à¿í¦u¡C + + + + + Dag-Erling + Smørgrav + + + + Hiten + Pandya + + + + + +
+ «e¨¥ + + GNATS ¬O FReeBSD ­p¹º©Ò±Ä¥Îªº¤@®M±MªùºÞ²z¿ù»~(¦^³øbug) ¨t²Î¡C + ¥Ñ©ó¹ï FreeBSD «~½è«OÃÒ¦Ó¨¥¡A¬O§_¯à·Ç½T´x´¤¦U¶µ¿ù»~¦^³ø»P¶i«×¬O¤Q¤À­«­nªº¡A + ¦]¦¹¡A¦p¦ó¥¿½T¦³®Ä¨Ï¥Î GNATS ¤]´N¥²¶·ª`·N¡C + + Access to GNATS is available to FreeBSD developers, as well as + to the wider community. ¬°¤FÅý GNATS ¸ê®Æ®w¨Ï¥Î¤W¾¨¶q¤@­P¡A©ó¬O´N²£¥Í¤F«ç»ò³B²z¹³¬O¡Gfollowup(¦^¤å)¡BÃö³¬PRµ¥ªº°Ñ¦Ò­ì«h¡C +
+ +
+ °ÝÃD¦^³ø(PR)ªº¥Í©R¶g´Á + + + + ­º¥ý¡A¦^³øªÌ(originator)¥H &man.send-pr.1; °e¥X PR¡AµM«á·|¦¬¨ì¤@«Ê½T»{«H¡C + + + + µM«á¡Acommitter ­Ì´N·|¦³¤H(°²³]¥s°µ Joe)µo±¸¦³¿³½ìªº PR ¨Ã±N¸Ó PR «ü¬£µ¹¦Û¤v¨Ó³B²z¡C + ©ÎªÌ bugbuster ·|¦³¤H(°²³]¥s°µ Jane) ´N·|¤U¨M©w¡G¦oı±o Joe ¤ñ¸û¾A¦X³B²z¡A´N±N¸Ó PR «ü¬£(assign)µ¹¥L + + + + Joe ·|¥ý»P¦³°ÝÃDªº¦^³øªÌ§@¨Ç·N¨£¥æ¬y(¥H½T©w³o°ÝÃD¦³¶i¤J audit °lÂܬyµ{¤º) + ¥H¤Î§PÂ_°ÝÃDÂI¡C + µM«á¦A½T©w°ÝÃDÂI¦³¼g¤J audit °lÂܬyµ{¤§«á¡AµM«á§â¸Ó PR ª¬ºA³]¬° + analyzed(¤w¤ÀªR)¡C + + + + Joe ¶}©l¹ý©]§ä¥X°ÝÃD¸Ñªk¡AµM«á±N patch °e¨ì follow-up(¦^¤å¥Î)¡A¨Ã½Ð¦^³øªÌ¨ó§U´ú¸Õ¬O§_¥¿±`¡C + µM«á¡A¥L´N·|±N PR ª¬ºA³]¬° feedback Åo¡C + + + + ¦p¦¹­«½Æ analyzed¡Bfeedback ´X½ë¤§«á¡Aª½¨ì Joe »P¦^³øªÌÂù¤è³£¬Û·íº¡·N patch µ²ªG¡A + ©ó¬O´N·|±N patch µ¹ commits ¶i¤J -CURRENT (©ÎªÌ­Y -CURRENT + ¤W­±¨S³o°ÝÃDªº¸Ü¡A´Nª½±µ°e¨ì -STABLE)¡A¦b commit log ¤º­n§â¬ÛÃö PR ¼g¤W¥h + (¦P®É¦^³øªÌ­Y¦³°e§¹¾ã©Î³¡¤À patch ªº¸Ü¡A´N¶¶«K°O¸ü)¡AµM«á¡A­Y¨S¤°»ò¨Æªº¸Ü¡A´N¶}©l·Ç³Æ MFC ­ù¡C + (Ķµù¡GMFC·N«ü Merged From CURRENT ¡A¤]´N¬O§â -CURRENT ¤WªºªF¦è¨Ö¤J -STABLE¡C + + + + ­Y¸Ó patch ¤£»Ý­n MFC ªº¸Ü¡AJoe ´N·|Ãö±¼(close)¸Ó PR ¤F¡C + + + + ­Y¸Ó patch »Ý­n MFC ªº¸Ü¡AJoe ·|§â PR ª¬ºA§ï¬° patched(¤w­×¥¿)¡A + ª½¨ì¤w¸g MFC §¹²¦¡A¤~·| close(Ãö±¼)¡C + + + + + «Ü¦h°e¥X¨Óªº PR ³£«Ü¤Öªþ¤W°ÝÃDªº¬ÛÃö°T®§¡A¦Ó¦³¨Ç«h¬O¬Û·í½ÆÂøÃø·d¡A + ©Î¥u¬O´£¨ì³¡¤Àªí­±°ÝÃD¦Ó¤w¡F + ¹J¨ì³oºØ±¡ªp®É¡A¬O«D±`»Ý­n±o¨ì©Ò¦³¬ÛÃö°T®§¥H«K¸Ñ¨M°ÝÃD¡C + ­Y¹J¨ì³oºØµL¸Ñªº°ÝÃD©Î¦A¦¸µo¥Íªº¸Ü¡A´N¥²¶·­n re-open(­«·s¶}±Ò) ¸Ó PR¡A¥H«Ý¸Ñ¨M¡C + + + PR ¤W©Òªþªº email address ¥i¯à¦]¬Y¨Ç­ì¦]¦ÓµLªk¦¬«H®É¡A¹J¨ì³oºØª¬ªp¡A³q±`´N¬O + followup ¸Ó PR ¡A¨Ã(¦b followup ®É)½Ð¦^³øªÌ­«·s´£¨Ñ¥i¥¿±`¦¬«Hªº email address¡C + ·í¨t²Î¤Wªº mail ¨t²ÎÃö³¬©Î¨S¸Ëªº®É­Ô¡A³o³q±`¬O¦b¨Ï¥Î &man.send-pr.1; ªº´À¥N¤è®×¡C + +
+ +
+ °ÝÃD¦^³ø(PR)ªºª¬ºA + + ­Y PR ¦³¥ô¦óÅܤƪº¸Ü¡A½Ð°È¥²°O±o§ó·s PR ªº¡yª¬ºA(state)¡z¡C + ¡yª¬ºA¡zÀ³¸Ó­n¯à¥¿½T¤Ï¬M¸Ó PR ªº¥Ø«e¶i«×¤~¬O¡C + + + ¥H¤U¬O§ó§ï PR ª¬ºAªº¤p¨Ò¤l¡G + + ·í¦³¥i¥H­×¥¿°ÝÃDªº PR ¥X²{¡A¦Ó¬ÛÃö­t³dªº developer(s) + ¤]ı±o³o¼Ëªº­×¥¿¥i¥H±µ¨ü¡A¥L­Ì·| followup ¸Ó PR¡A¨Ã±N¨äª¬ºA§ï¬° + feedback¡C¦P®É¡A¦^³øªÌÀ³­«·sµû¦ô³Ì²×ªº­×¥¿µ²ªG¡A¨Ã¦^À³¡G©Ò¦^³øªº¿ù»~¬O§_¤w¦¨¥\­×¥¿¡C + + + ¨C¥÷ PR ³q±`·|¦³¤U­±³o´XºØª¬ºA¤§¤@¡G + + + + open + + PR ³Ìªìªºª¬ºA¡G³o­Ó°ÝÃD³Q´£¥X¨Ó¡A¨Ã¦bµ¥«Ý³B²z¤¤¡C + + + + + analyzed + + ¤w¸g¶}©l³B²z³o°ÝÃD¡A¨Ã¥B¦³§ä¨ìºÃ¦ü¸Ñ¨Mªº¤èªk¡C + + + + + feedback + + »Ý­n¦^³øªÌ´£¨Ñ§ó¸Ô²Óªº¬ÛÃö¸ê®Æ¡A¥¿¦p±Ð¾Ç­n¦]§÷¬I±Ð¡Aªv¯f¤]­n¦]¤H¤UÃÄ¡A¶V¦h¬ÛÃö°T®§¡A¤~¯à¦³³Ì¨Î®ÄªG¡C + + + + + patched + + ¤w¸g°e¬ÛÃö patch ¤F¡A¦ý¤´¦]¬Y¨Ç­ì¦](MFC¡A©Î¨Ó¦Û¦^³øªÌªº½T»{µ²ªG²§±`)¦]¦¹©|¥¼§¹²¦¡C + + + + + suspended(¼È½w) + + ¦]¬°¨Sªþ¤W¬ÛÃö°T®§©Î°Ñ¦Ò¸ê®Æ¡A©Ò¥HÁÙ¨S¿ìªk³B²z³o°ÝÃD¡C + This is a prime candidate for + somebody who is looking for a project to take on. If the + problem cannot be solved at all, it will be closed, rather + than suspended. The documentation project uses + suspended for wish-list + items that entail a significant amount of work which no one + currently has time for. + + + + + closed + + A problem report is closed when any changes have been + integrated, documented, and tested, or when fixing the + problem is abandoned. + + + + + + The patched state is directly related to + feedback, so you may go directly to closed state if + the originator cannot test the patch, and it works in your own testing. + +
+ +
+ °ÝÃD¦^³ø(PR)ªººØÃþ + + While handling problem reports, either as a developer who has + direct access to the GNATS database or as a contributor who + browses the database and submits followups with patches, comments, + suggestions or change requests, you will come across several + different types of PRs. + + + + PRs not yet assigned to anyone. + + + PRs already assigned to someone. + + + ­«½Æªº PR + + + Stale PRs + + + Misfiled PRs + + + + The following sections describe what each different type of + PRs is used for, when a PR belongs to one of these types, and what + treatment each different type receives. + +
+ Unassigned PRs + + When PRs arrive, they are initially assigned to a generic + (placeholder) assignee. These are always prepended with + freebsd-. The exact value for this default + depends on the category; in most cases, it corresponds to a + specific &os; mailing list. Here is the current list, with + the most common ones listed first: + + + Default Assignees — most common + + + + Type + Categories + Default Assignee + + + + + + base system + bin, conf, gnu, kern, misc + freebsd-bugs + + + + architecture-specific + alpha, i386, ia64, powerpc, sparc64 + freebsd-arch + + + + ports collection + ports + freebsd-ports-bugs + + + + documentation shipped with the system + docs + freebsd-doc + + + + &os; web pages (not including docs) + www + freebsd-www + + +
+ + + Default Assignees — other + + + + Type + Categories + Default Assignee + + + + + + advocacy efforts + advocacy + freebsd-advocacy + + + + &java.virtual.machine; problems + java + freebsd-java + + + + standards compliance + standards + freebsd-standards + + + + threading libraries + threads + freebsd-threads + + + + &man.usb.4; subsystem + usb + freebsd-usb + + +
+ + Do not be surprised to find that the submitter of the + PR has assigned it to the wrong category. If you fix the + category, do not forget to fix the assignment as well. + (In particular, our submitters seem to have a hard time + understanding that just because their problem manifested + on an i386 system, that it might be generic to all of &os;, + and thus be more appropriate for kern. + The converse is also true, of course.) + + Certain PRs may be reassigned away from these generic + assignees by anyone. For assignees which are mailing lists, + please use the long form when making the assignment (e.g., + freebsd-foo instead of foo); + this will avoid duplicate emails sent to the mailing list. + + + Here is a sample list of such entities; it is probably + not complete. In some cases, entries that have the short form are + aliases, not mailing lists. + + + + Common Assignees — base system + + + + Type + Suggested Category + Suggested Assignee + + + + + + problem specific to the &arm; architecture + kern + freebsd-arm + + + + problem specific to the &mips; architecture + kern + freebsd-mips + + + + problem specific to the &powerpc; architecture + kern + freebsd-ppc + + + + problem with Advanced Configuration and Power + Management (&man.acpi.4;) + kern + freebsd-acpi + + + + problem with Asynchronous Transfer Mode (ATM) + drivers + kern + freebsd-atm + + + + problem with &firewire; drivers + kern + freebsd-firewire + + + + problem with the filesystem code + kern + freebsd-fs + + + + problem with the &man.geom.4; subsystem + kern + freebsd-geom + + + + problem with the &man.ipfw.4; subsystem + kern + freebsd-ipfw + + + + problem with Integrated Services Digital Network + (ISDN) drivers + kern + freebsd-isdn + + + + problem with &linux; or SVR4 emulation + kern + freebsd-emulation + + + + problem with the networking stack + kern + freebsd-net + + + + problem with PicoBSD + kern + freebsd-small + + + + problem with the &man.pf.4; subsystem + kern + freebsd-pf + + + + problem with the &man.scsi.4; subsystem + kern + freebsd-scsi + + + + problem with the &man.sound.4; subsystem + kern + freebsd-multimedia + + + + problem with &man.sysinstall.8; + bin + freebsd-qa + + + + problem with the system startup scripts + (&man.rc.8;) + kern + freebsd-rc + + +
+ + + Common Assignees — Ports Collection + + + + Type + Suggested Category + Suggested Assignee + + + + + + problem with the ports framework + (not with an individual port!) + ports + portmgr + + + + port which is maintained by apache@FreeBSD.org + ports + apache + + + + port which is maintained by eclipse@FreeBSD.org + ports + freebsd-eclipse + + + + port which is maintained by gnome@FreeBSD.org + ports + gnome + + + + port which is maintained by haskell@FreeBSD.org + ports + haskell + + + + port which is maintained by java@FreeBSD.org + ports + freebsd-java + + + + port which is maintained by kde@FreeBSD.org + ports + kde + + + + port which is maintained by + openoffice@FreeBSD.org + ports + freebsd-openoffice + + + + port which is maintained by perl@FreeBSD.org + ports + perl + + + + port which is maintained by python@FreeBSD.org + ports + freebsd-python + + + + port which is maintained by x11@FreeBSD.org + ports + freebsd-x11 + + +
+ + Ports PRs which have a maintainer who is a ports committer + may be reassigned by anyone (but note that not every &os; + committer is necessarily a ports committer, so you cannot + simply go by the email address alone.) + + + For other PRs, please do not reassign them to individuals + (other than yourself) unless you are certain that the assignee + really wants to track the PR. This will help to avoid the + case where no one looks at fixing a particular problem + because everyone assumes that the assignee is already working + on it. + +
+ +
+ Assigned PRs + + If a PR has the responsible field set + to the username of a FreeBSD developer, it means that the PR + has been handed over to that particular person for further + work. + + Assigned PRs should not be touched by anyone but the + assignee. If you have comments, submit a followup. If for + some reason you think the PR should change state or be + reassigned, send a message to the assignee. If the assignee + does not respond within two weeks, unassign the PR and do as + you please. +
+ +
+ ­«½Æªº PR + + If you find more than one PR that describe the same issue, + choose the one that contains the largest amount of useful + information and close the others, stating clearly the number + of the superseding PR. If several PRs contain non-overlapping + useful information, submit all the missing information to one + in a followup, including references to the others; then close + the other PRs (which are now completely superseded). +
+ +
+ Stale PRs + + A PR is considered stale if it has not been modified in more + than six months. Apply the following procedure to deal with + stale PRs: + + + + If the PR contains sufficient detail, try to reproduce + the problem in -CURRENT and + -STABLE. If you succeed, submit a + followup detailing your findings and try to find someone + to assign it to. Set the state to analyzed + if appropriate. + + + + If the PR describes an issue which you know is the + result of a usage error (incorrect configuration or + otherwise), submit a followup explaining what the + originator did wrong, then close the PR with the reason + User error or Configuration + error. + + + + If the PR describes an error which you know has been + corrected in both -CURRENT and + -STABLE, close it with a message + stating when it was fixed in each branch. + + + + If the PR describes an error which you know has been + corrected in -CURRENT, but not in + -STABLE, try to find out when the person + who corrected it is planning to MFC it, or try to find + someone else (maybe yourself?) to do it. Set the state to + feedback and assign it to whomever will do + the MFC. + + + + In other cases, ask the originator to confirm if + the problem still exists in newer versions. If the + originator does not reply within a month, close the PR + with the notation Feedback timeout. + + +
+ +
+ Misfiled PRs + + GNATS is picky about the format of a submitted bug report. + This is why a lot of PRs end up being misfiled if + the submitter forgets to fill in a field or puts the wrong sort of + data in some of the PR fields. This section aims to provide most + of the necessary details for FreeBSD developers that can help them to + close or refile these PRs. + + When GNATS cannot deduce what to do with a problem report + that reaches the database, it sets the responsible of the PR to + gnats-admin and files it under the + pending category. This is now a + misfiled PR and will not appear in bug report + listings, unless someone explicitly asks for a list of all the + misfiled PRs. If you have access to the FreeBSD cluster + machines, you can use query-pr to view a + listing of PRs that have been misfiled: + + &prompt.user; query-pr -x -q -r gnats-admin + 52458 gnats-ad open serious medium Re: declaration clash f + 52510 gnats-ad open serious medium Re: lots of sockets in + 52557 gnats-ad open serious medium + 52570 gnats-ad open serious medium Jigdo maintainer update + + Commonly PRs like the ones shown above are misfiled for one + of the following reasons: + + + + A followup to an existing PR, sent through email, has + the wrong format on its Subject: + header. + + + + A submitter sent a Cc: to a mailing list and someone + followed up to that post instead of the email issued by + GNATS after processing. The email to the list will not + have the category/PRnumber tracking tag. (This is why we + discourage submitters from doing this exact thing.) + + + + When completing the &man.send-pr.1; template, the submitter + forgot to set the category or class of the PR to a proper + value. + + + + When completing the &man.send-pr.1; template, the submitter + set Confidential to yes. (Since we allow + anyone to mirror GNATS via cvsup, + our PRs are public information. Security alerts should + therefore not be sent via GNATS but instead via email to + the Security Team.) + + + + It is not a real PR, but some random message sent to + bug-followup@FreeBSD.org or + freebsd-gnats-submit@FreeBSD.org. + + + +
+ Followups misfiled as new PRs + + The first category of misfiled PRs, the one with the wrong + subject header, is actually the one that requires the greatest + amount of work from developers. These are not real PRs, + describing separate problem reports. When a reply is received + for an existing PR at one of the addresses that GNATS + listens to for incoming messages, the subject + of the reply should always be of the form: + + Subject: Re: category/number: old synopsis text + + Most mailers will add the + Re:  part when you + reply to the original mail message of a PR. The + category/number:  part + is a GNATS-specific convention that you have to manually + insert to the subject of your followup reports. + + Any FreeBSD developer, who has direct access to the GNATS + database, can periodically check for PRs of this sort and move + interesting bits of the misfiled PR into the audit trail of + the original PR (by posting a proper followup to a bug report + to the address &a.bugfollowup;). Then + the misfiled PR can be closed with a message similar + to: + + Your problem report was misfiled. Please use the format +"Subject: category/number: original text" when following +up to older, existing PRs. I've added the relevant bits +from the body of this PR to kern/12345 + + Searching with query-pr for the + original PR, of which a misfiled followup is a reply, is as + easy as running: + + &prompt.user; query-pr -q -y "some text" + + After you locate the original PR and the misfiled + followups, use the option of + query-pr to save the full text of all the + relevant PRs in a &unix; mailbox file, i.e.: + + &prompt.user; query-pr -F 52458 52474 > mbox + + Now you can use any mail user agent to view all the PRs + you saved in mbox. Copy the text of all + the misfiled PRs in a followup to the original PR and make + sure you include the proper Subject: + header. Then close the misfiled PRs. When you close the misfiled + PRs remember that the submitter receives a mail notification that + his PR changed state to closed. Make sure you + provide enough details in the log about the reason of this state + change. Typically something like the following is ok: + + Followup to ports/45364 misfiled as a new PR. +This was misfiled because the subject did not have the format: + + Re: ports/45364: ... + + This way the submitter of the misfiled PR will know what to + avoid the next time a followup to an existing PR is sent. +
+ +
+ PRs misfiled because of missing fields + + The second type of misfiled PRs is usually the result of a + submitter forgetting to fill all the necessary fields when + writing the original PR. + + Missing or bogus category or + class fields can result in a misfiled report. + Developers can use &man.edit-pr.1; to change the category or + class of these misfiled PRs to a more appropriate value and + save the PR. + + Another common cause of misfiled PRs because of formatting + issues is quoting, changes or removal of the + send-pr template, either by the user who + edits the template or by mailers which do strange things to + plain text messages. This does not happen a lot of the time, + but it can be fixed with edit-pr too; it + does require a bit of work from the developer who refiles the + PR, but it is relatively easy to do most of the time. +
+ +
+ Misfiled PRs that are not really problem reports + + Sometimes a user wants to submit a report for a problem + and sends a simple email message to GNATS. The GNATS scripts + will recognize bug reports that are formatted using the + &man.send-pr.1; template. They cannot parse any sort of email + though. This is why submissions of bug reports that are sent + to freebsd-gnats-submit@FreeBSD.org have to + follow the template of send-pr, but email + reports can be sent to &a.bugs;. + + Developers that come across PRs that look like they should have + been posted to &a.bugs.name; or some other list should close the + PR, informing the submitter in their state-change log why this + is not really a PR and where the message should be posted. + + The email addresses that GNATS listens to for incoming PRs + have been published as part of the FreeBSD documentation, have + been announced and listed on the web-site. This means that + spammers found them. Spam messages + that reach GNATS are promptly filed + under the pending category until someone looks + at them. Closing one of these with &man.edit-pr.1; is very + annoying though, because GNATS replies to the submitter and + the sender's address of spam mail is never valid these days. + Bounces will come back for each PR that is closed. + + Currently, with the installation of some antispam filters + that check all submissions to the GNATS database, the amount + of spam that reaches the pending state is very + small. + + All developers who have access to the FreeBSD.org cluster + machines are encouraged to check for misfiled PRs and immediately + close those that are spam mail. Whenever you close one of + these PRs, please do the following: + + + + Set Category to junk. + + + + Set Confidential to no. + + + + Set Responsible to yourself (and not, e.g., + freebsd-bugs, which merely + sends more mail). + + + + Set State to closed. + + + + Junk PRs are not + backed up, so filing spam mail under this category makes it + obvious that we do not care to keep it around or waste disk + space for it. If you merely close them without changing the + category, they remain both in the master database and in + any copies of the database mirrored through + cvsup. +
+
+
+ +
+ ©µ¦ù¾\Ū + + ¤U­±³o¬O¦b¼g¡B³B²z PR ®É¡A¥i¥H°Ñ¦Òªº¸ê®Æ¡C·íµM«Ü©úÅã¡A³o¥÷²M³æ¤´¶·¸É¥R¡C + + + + How to + Write FreeBSD Problem Reports—µ¹ PR ¦^³øªÌ¥Îªº°Ñ¦Ò­ì«h¡C + + +
+
diff --git a/zh_TW.Big5/articles/problem-reports/Makefile b/zh_TW.Big5/articles/problem-reports/Makefile new file mode 100644 index 0000000000..081f20e0f8 --- /dev/null +++ b/zh_TW.Big5/articles/problem-reports/Makefile @@ -0,0 +1,19 @@ +# +# $FreeBSD$ +# +# Article: Writing FreeBSD Problem Reports + +DOC?= article + +FORMATS?= html +WITH_ARTICLE_TOC?= YES + +INSTALL_COMPRESSED?=gz +INSTALL_ONLY_COMPRESSED?= + +SRCS= article.sgml + +URL_RELPREFIX?= ../../../.. +DOC_PREFIX?= ${.CURDIR}/../../.. + +.include "${DOC_PREFIX}/share/mk/doc.project.mk" diff --git a/zh_TW.Big5/articles/problem-reports/article.sgml b/zh_TW.Big5/articles/problem-reports/article.sgml new file mode 100644 index 0000000000..03affef18e --- /dev/null +++ b/zh_TW.Big5/articles/problem-reports/article.sgml @@ -0,0 +1,1113 @@ + +%articles.ent; +]> + +
+ + Writing &os; Problem Reports + + $FreeBSD$ + + + &tm-attrib.freebsd; + &tm-attrib.cvsup; + &tm-attrib.ibm; + &tm-attrib.intel; + &tm-attrib.sparc; + &tm-attrib.sun; + &tm-attrib.general; + + + + This article describes how to best formulate and submit a + problem report to the &os; Project. + + + + + Dag-Erling + Smørgrav + Contributed by + + + + Mark + Linimon + + + + + problem reports + +
+ Introduction + + One of the most frustrating experiences one can have as a + software user is to submit a problem report only to have it + summarily closed with a terse and unhelpful explanation like + not a bug or bogus PR. Similarly, + one of the most frustrating experiences as a software developer + is to be flooded with problem reports that are not really + problem reports but requests for support, or that contain little + or no information about what the problem is and how to reproduce + it. + + This document attempts to describe how to write good problem + reports. What, you ask, is a good problem report? Well, to go + straight to the bottom line, a good problem report is one that + can be analyzed and dealt with swiftly, to the mutual + satisfaction of both user and developer. + + Although the primary focus of this article is on &os; + problem reports, most of it should apply quite well to other + software projects. + + Note that this article is organized thematically, not + chronologically, so you should read through the entire document + before submitting a problem report, rather than treat it as a + step-by-step tutorial. +
+ +
+ When to submit a problem report + + There are many types of problems, and not all of them should + engender a problem report. Of course, nobody is perfect, and + there will be times when you are convinced you have found a bug + in a program when in fact you have misunderstood the syntax for + a command or made a typographical error in a configuration file + (though that in + itself may sometimes be indicative of poor documentation or poor + error handling in the application). There are still many cases + where submitting a problem report is clearly + not the right + course of action, and will only serve to frustrate you and the + developers. Conversely, there are cases where it might be + appropriate to submit a problem report about something else than + a bug—an enhancement or a feature request, for + instance. + + So how do you determine what is a bug and what is not? As a + simple rule of thumb your problem is not a + bug if it can be expressed as a question (usually of the form + How do I do X? or Where can I find + Y?). It is not always quite so black and white, but the + question rule covers a large majority of cases. If you are looking + for an answer, consider posing your question to the + &a.questions;. + + Some cases where it may be appropriate to submit a problem + report about something that is not a bug are: + + + + Requests for feature enhancements. It is generally a + good idea to air these on the mailing lists before + submitting a problem report. + + + + Notification of updates to externally maintained + software (mainly ports, but also externally maintained base + system components such as BIND or various GNU + utilities). + + For unmaintained ports (MAINTAINER contains + ports@FreeBSD.org), such update notifications + might get picked up by an interested + committer, or you might be asked to provide a patch to update + the port; providing it upfront will greatly improve your chances + that the port will get updated in a timely manner. + + If the port is maintained, PRs announcing new upstream releases + are usually not very useful since they generate supplementary work + for the committers, and the maintainer likely knows already there is + a new version, they have probably worked with the developers on it, + they are probably testing to see there is no regression, etc. + + In either case, following the process described in Porter's + Handbook will yield the best results. + + + + A bug that can not be reproduced can rarely be + fixed. If the bug only occurred once and you can not reproduce + it, and it does not seem to happen to anybody else, chances are + none of the developers will be able to reproduce it or figure + out what is wrong. That does not mean it did not happen, but it + does mean that the chances of your problem report ever leading + to a bug fix are very slim. To make matters worse, often + these kinds of bugs are actually caused by failing hard drives + or overheating processors — you should always try to rule + out these causes, whenever possible, before submitting a PR. + + Next, to decide to whom you should file your problem + report, you need to understand that the software that makes + up &os; is composed of several different elements: + + + + Code in the base system that is written and maintained + by &os; contributors, such as the kernel, the C library, + and the device drivers (categorized as kern); + the binary utilities (bin); the manual + pages and documentation (docs); and + the web pages (www). All bugs in + these areas should be reported to the &os; developers. + + + + Code in the base system that is written and maintained + by others, and imported into &os; and adapted. Examples + include bind, &man.gcc.1;, and + &man.sendmail.8;. Most bugs in these areas should be reported + to the &os; developers; but in some cases they may need to be + reported to the original authors instead if the problems are + not &os;-specific. Usually these bugs will fall under either + the bin or gnu + categories. + + + + Individual applications that are not in the base system + but are instead part of the &os; Ports Collection (category + ports). Most of these applications are + not written by &os; developers; what &os; provides is merely + a framework for installing the application. Therefore, you + should only report a problem to the &os; developers when you + believe the problem is &os;-specific; otherwise, you should + report it to the authors of the software. + + + + + Then you should ascertain whether or not the problem is + timely. There are few things + that will annoy a developer more than receiving a problem report + about a bug she has already fixed. + + If the problem is in the base system, you should first read + the FAQ section on + + &os; versions, if you are not already familiar with + the topic. It is not possible for &os; to fix problems in + anything other than certain recent branches of the base system, + so filing a bug report about an older version will probably + only result in a developer advising you to upgrade to a + supported version to see if the problem still recurs. The + Security Officer team maintains the + list of supported + versions. + + If the problem is in a port, note that you must first + upgrade to the latest version of the Ports Collection and see + if the problem still applies. Due to the rapid pace of changes + in these applications, it is infeasible for &os; to support + anything other than the absolute latest versions, and problems + with older version of applications simply cannot be fixed. +
+ +
+ Preparations + + A good rule to follow is to always do a background search + before submitting a problem report. Maybe your problem has + already been reported; maybe it is being discussed on the + mailing lists, or recently was; it may even already be fixed in + a newer version than what you are running. You should therefore + check all the obvious places before submitting your problem + report. For &os;, this means: + + + + The &os; + Frequently Asked + Questions (FAQ) list. + The FAQ attempts to provide answers for a wide range of questions, + such as those concerning + hardware + compatibility, + user + applications, + and kernel + configuration. + + + + The + mailing + lists—if you are not subscribed, use + the + searchable archives on the &os; web site. If your + problem has not been discussed on the lists, you might try + posting a message about it and waiting a few days to see if + someone can spot something you have overlooked. + + + + Optionally, the entire web—use your favorite + search engine to locate any references to your problem. You + may even get hits from archived mailing lists or newsgroups + you did not know of or had not thought to search + through. + + + + Next, the searchable + + &os; PR database (GNATS). Unless your problem + is recent or obscure, there is a fair chance it has already + been reported. + + + + Most importantly, you should attempt to see if existing + documentation in the source base addresses your problem. + + For the base &os; code, you should + carefully study the contents of the + /usr/src/UPDATING file on your system + or its latest version at + . + (This is vital information + if you are upgrading from one version to + another—especially if you are upgrading to the + &os.current; branch). + + However, if the problem is in something that was installed + as a part of the &os; Ports Collection, you should refer to + /usr/ports/UPDATING (for individual ports) + or /usr/ports/CHANGES (for changes + that affect the entire Ports Collection). + + and + + are also available via CVSweb. + + +
+ +
+ Writing the problem report + + Now that you have decided that your issue merits a problem + report, and that it is a &os; problem, it is time to write + the actual problem report. Before we get into the mechanics + of the program used to generate and submit PRs, here are some + tips and tricks to help make sure that your PR will be most + effective. + +
+ Tips and tricks for writing a good problem report + + + + Do not leave the Synopsis + line empty. The PRs go both onto a mailing list + that goes all over the world (where the Synopsis + is used + for the Subject: line), but also into a + database. Anyone who comes along later and browses the + database by synopsis, and finds a PR with a blank subject + line, tends just to skip over it. Remember that PRs stay + in this database until they are closed by someone; an + anonymous one will usually just disappear in the + noise. + + + + Avoid using a weak Synopsis + line. You should not assume that anyone reading + your PR has any context for your submission, so the more + you provide, the better. For instance, what part of the + system does the problem apply to? Do you only see the + problem while installing, or while running? To + illustrate, instead of Synopsis: portupgrade is + broken, see how much more informative this + seems: Synopsis: port sysutils/portupgrade + coredumps on -current. (In the case of ports, + it is especially helpful to have both the category and + portname in the Synopsis line.) + + + + If you have a patch, say so. + A PR with a patch included is much more likely to be + looked at than one without. If you are including one, + put the string [patch] at the + beginning of the Synopsis. (Although it is + not mandatory to use that exact string, by convention, + that is the one that is used.) + + + + If you are a maintainer, say so. + If you are maintaining a part of the source code (for + instance, a port), you might consider adding the string + [maintainer update] at the beginning of + your synopsis line, and you definitely should set the + Class of + your PR to maintainer-update. This way + any committer that handles your PR will not have to check. + + + + Be specific. + The more information you supply about what problem you + are having, the better your chance of getting a response. + + + + Include the version of &os; you are running (there + is a place to put that, see below) and on which architecture. + You should include whether you are running from a release + (e.g. from a CDROM or download), or from + a system maintained by &man.cvsup.1; (and, if so, how + recently you updated). If you are tracking the + &os.current; branch, that is the very first thing someone + will ask, because fixes (especially for high-profile + problems) tend to get committed very quickly, and + &os.current; users are expected to keep up. + + + + Include which global options you have specified in + your make.conf. Note: specifying + -O2 and above to &man.gcc.1; is + known to be buggy in many situations. While the + &os; developers will accept patches, they are + generally unwilling to investigate such issues due + to simple lack of time and volunteers, and may + instead respond that this just is not supported. + + + + If this is a kernel problem, then be prepared to + supply the following information. (You do not + have to include these by default, which only tends to + fill up the database, but you should include excerpts + that you think might be relevant): + + + + your kernel configuration (including which + hardware devices you have installed) + + + whether or not you have debugging options enabled + (such as WITNESS), and if so, + whether the problem persists when you change the + sense of that option + + + a backtrace, if one was generated + + + the fact that you have read + src/UPDATING and that your problem + is not listed there (someone is guaranteed to ask) + + + whether or not you can run any other kernel as + a fallback (this is to rule out hardware-related + issues such as failing disks and overheating CPUs, + which can masquerade as kernel problems) + + + + + + If this is a ports problem, then be prepared to + supply the following information. (You do not + have to include these by default, which only tends to + fill up the database, but you should include excerpts + that you think might be relevant): + + + + which ports you have installed + + + any environment variables that override the + defaults in bsd.port.mk, such + as PORTSDIR + + + the fact that you have read + ports/UPDATING and that your problem + is not listed there (someone is guaranteed to ask) + + + + + + + + + + Avoid vague requests for features. + PRs of the form someone should really implement something + that does so-and-so are less likely to get results than + very specific requests. Remember, the source is available + to everyone, so if you want a feature, the best way to + ensure it being included is to get to work! Also consider + the fact that many things like this would make a better + topic for discussion on freebsd-questions + than an entry in the PR database, as discussed above. + + + + Make sure no one else has already submitted + a similar PR. Although this has already been + mentioned above, it bears repeating here. It only take a + minute or two to use the web-based search engine at + . + (Of course, everyone is guilty of forgetting to do this + now and then.) + + + Avoid controversial requests. + If your PR addresses an area that has been controversial + in the past, you should probably be prepared to not only + offer patches, but also justification for why the patches + are The Right Thing To Do. As noted above, + a careful search of the mailing lists using the archives + at + is always good preparation. + + + + Be polite. + Almost anyone who would potentially work on your PR is a + volunteer. No one likes to be told that they have to do + something when they are already doing it for some + motivation other than monetary gain. This is a good thing + to keep in mind at all times on Open Source + projects. + + +
+ +
+ Before you begin + + If you are using the &man.send-pr.1; program, make sure your + VISUAL (or EDITOR if + VISUAL is not set) environment variable is set + to something sensible. + + You should also make sure that mail delivery works fine. + &man.send-pr.1; uses mail messages for the submission and + tracking of problem reports. If you cannot post mail messages + from the machine you are running &man.send-pr.1; on, your + problem report will not reach the GNATS database. For details + on the setup of mail on &os;, see the Electronic + Mail chapter of the &os; Handbook at + . + + Make sure that your mailer will not mangle the message on + its way to GNATS. In particular, if your mailer automatically + breaks lines, changes tabs to spaces, or escapes newline + characters, any patch that you submit will be rendered + unusable. For the text sections, however, we request that + you insert manual linebreaks somewhere around 70 characters, + so that the web display of the PR will be readable. + + Similar considerations apply if you are using the web-based + PR submittal form instead of &man.send-pr.1;. Note that + cut-and-paste operations can have their own side-effects on + text formatting. In certain cases it may be necessary to use + &man.uuencode.1; to ensure that patches arrive unmodified. + + Finally, if your submission will be lengthy, you should + to prepare your work offline so that nothing will be lost in + case there is a problem submitting it. This can be an especial + problem with the web form. +
+ +
+ Attaching patches or files + + The following applies to submitting PRs via email: + + The &man.send-pr.1; program has provisions for attaching + files to a problem report. You can attach as many files as + you want provided that each has a unique base name (i.e. the + name of the file proper, without the path). Just use the + command-line option to specify the names + of the files you wish to attach: + +&prompt.user; send-pr -a /var/run/dmesg -a /tmp/errors + + Do not worry about binary files, they will be automatically + encoded so as not to upset your mail agent. + + If you attach a patch, make sure you use the + or option to + &man.diff.1; to create a context or unified diff (unified is + preferred), and make + sure to specify the exact CVS revision numbers of the files + you modified so the developers who read your report will be + able to apply them easily. For problems with the kernel or the + base utilities, a patch against &os.current; (the HEAD + CVS branch) is preferred since all new code should be applied + and tested there first. After appropriate or substantial testing + has been done, the code will be merged/migrated to the &os.stable; + branch. + + If you attach a patch inline, instead of as an attachment, + note that the most common problem by far is the tendency of some + email programs to render tabs as spaces, which will completely + ruin anything intended to be part of a Makefile. + + Do not send patches as attachments using + Content-Transfer-Encoding: quoted-printable. + These will perform character escaping and the entire patch + will be useless. + + Also note that while including small patches in a PR is + generally all right—particularly when they fix the problem + described in the PR—large patches and especially new code + which may require substantial review before committing should + be placed on a web or ftp server, and the URL should be + included in the PR instead of the patch. Patches in email + tend to get mangled, especially when GNATS is involved, and + the larger the patch, the harder it will be for interested + parties to unmangle it. Also, posting a patch on the web + allows you to modify it without having to resubmit the entire + patch in a followup to the original PR. Finally, large + patches simply increase the size of the database, since + closed PRs are not actually deleted but instead kept and + simply marked as closed. + + You should also take note that unless you explicitly + specify otherwise in your PR or in the patch itself, any + patches you submit will be assumed to be licensed under the + same terms as the original file you modified. +
+ +
+ Filling out the template + + The next section applies to the email method only: + + When you run &man.send-pr.1;, you are presented with a + template. The template consists of a list of fields, some of + which are pre-filled, and some of which have comments explaining + their purpose or listing acceptable values. Do not worry + about the comments; they will be removed automatically if you + do not modify them or remove them yourself. + + At the top of the template, below the + SEND-PR: lines, are the email headers. You + do not normally need to modify these, unless you are sending + the problem report from a machine or account that can send but + not receive mail, in which case you will want to set the + From: and Reply-To: to + your real email address. You may also want to send yourself + (or someone else) a carbon copy of the problem report by + adding one or more email addresses to the + Cc: header. + + In the email template you will find the following two + single-line fields: + + + + Submitter-Id: Do not change this. + The default value of current-users is + correct, even if you run &os.stable;. + + + + Confidential: This is prefilled + to no. Changing it makes no sense as + there is no such thing as a confidential &os; problem + report—the PR database is distributed worldwide by + CVSup. + + + + + The next section describes fields that are common to both + the email interface and the web interface: + + + + + Originator: + Please specify your real name, optionally followed + by your email address in angle brackets. + In the email interface, this is normally + prefilled with the gecos field of the + currently logged-in + user. + + + The email address you use will become public information + and may become available to spammers. You should either + have spam handling procedures in place, or use a temporary + email account. However, please note that if you do not + use a valid email account at all, we will not be able to + ask you questions about your PR. + + + + + + Organization: Whatever you feel + like. This field is not used for anything + significant. + + + + Synopsis: Fill this out with a + short and accurate description of the problem. The + synopsis is used as the subject of the problem report + email, and is used in problem report listings and + summaries; problem reports with obscure synopses tend to + get ignored. + + As noted above, if your problem report includes a patch, + please have the synopsis start with [patch]; + if this is a ports PR and you are the + maintainer, you may consider adding + [maintainer update] and set the + Class of your PR to + maintainer-update. + + + + Severity: One of + non-critical, + serious or + critical. Do not overreact; refrain + from labeling your problem critical + unless it really is (e.g. data corruption issues, serious + regression from previous functionality in -CURRENT) + or serious unless + it is something that will affect many users (kernel + panics or freezes; problems with + particular device drivers or system utilities). &os; + developers will not necessarily work on your problem faster + if you inflate its importance since there are so many other + people who have done exactly that — in fact, some + developers pay little attention to this field + because of this. + + + Major security problems should not + be filed in GNATS, because all GNATS information is public + knowledge. Please send such problems in private email to + &a.security-officer;. + + + + + Priority: One of + low, medium or + high. high should + be reserved for problems that will affect practically + every user of &os; and medium for + something that will affect many users. + + + This field has become so widely abused that it is + almost completely meaningless. + + + + + Category: Choose an appropriate + category. + + + There are a number of "platform" categories into which + bugs in the base system that are specific to one particular + hardware architecture should be filed. Problems that are + generic all across versions of &os; should probably be + filed as kern or bin; + see discussion of those categories below. + + Example: you have a common PC-based machine, and think + you have encountered a problem specific to a particular + chipset or a particular motherboard: i386 + is the right category. + + Example: You are having a problem with an add-in + peripheral card on a commonly seen bus, or a problem with + a particular type of hard disk drive: in this case, it + probably applies to more than one architecture, and + kern is the right category. + + + Here is the current list of categories (taken from + ): + + + + advocacy: problems relating to + &os;'s public image. Rarely used. + + + + alpha: problems specific to the + Alpha platform. + + + + amd64: problems specific to the + AMD64 platform. + + + + bin: problems with userland + programs in the base system. If running &man.whereis.1; + shows /bin, /usr/sbin, + or something similar, then this is probably the right + category. (A few contributed programs might instead + need to be in gnu; see below.) + + + + conf: problems with + configuration files, default values, and so forth. + Things that affect /usr/share + or /etc/rc* belong here. + + + + docs: problems with manual pages + or on-line documentation. + + + + gnu: problems with imported GNU software + such as &man.gcc.1; or &man.grep.1;. + + + + i386: problems specific to the + &i386; platform. + + + + ia64: problems specific to the + ia64 platform. + + + + java: problems related to the &java; + Virtual Machine. (Ports that merely depend on &java; to + run should be filed under ports.) + + + + + kern: problems with + the kernel, (non-platform-specific) device drivers, + or the base libraries. + + + + misc: anything that does not fit + in any of the other categories. (Note that there is + almost nothing that truly belongs in this category, + except for problems with the release and build + infrastructure. Temporary build failures on + HEAD do not belong here. Also note + that it is + easy for things to get lost in this category). + + + + ports: problems relating to the + ports tree. + + + + powerpc: problems specific to the + &powerpc; platform. + + + + sparc64: problems specific to the + &sparc64; platform. + + + + standards: Standards conformance + issues. + + + + threads: problems related to the + &os; threads implementation (especially on &os.current;). + + + + usb: problems related to the + &os; USB implementation. + + + + www: Changes or enhancements to + the &os; website. + Problems with code found in /usr/ports/www + do not belong here, they belong in + ports instead. + + + + + + Class: Choose one of the + following: + + + + sw-bug: software bugs. + + + + doc-bug: errors in + documentation. + + + + change-request: requests for + additional features or changes in existing + features. + + + + update: updates to ports or + other contributed software. + + + + maintainer-update: updates to + ports for which you are the maintainer. + + + + + + Release: The version of &os; + that you are running. This is filled out automatically if + you are using + &man.send-pr.1; and need only be changed if you are + sending a problem report from a different system than the + one that exhibits the problem. + + + + Finally, there is a series of multi-line fields: + + + + Environment: This should + describe, as accurately as possible, the environment in + which the problem has been observed. This includes the + operating system version, the version of the specific + program or file that contains the problem, and any other + relevant items such as system configuration, other + installed software that influences the problem, + etc.—quite simply everything a developer needs to + know to reconstruct the environment in which the problem + occurs. + + + + Description: A complete and + accurate description of the problem you are experiencing. + Try to avoid speculating about the causes of the problem + unless you are certain that you are on the right track, as + it may mislead a developer into making incorrect + assumptions about the problem. + + + + How-To-Repeat: A summary of the + actions you need to take to reproduce the problem. + + + + Fix: Preferably a patch, or at + least a workaround (which not only helps other people with + the same problem work around it, but may also help a + developer understand the cause for the problem), but if + you do not have any firm ideas for either, it is better to + leave this field blank than to speculate. + + +
+ +
+ Sending off the problem report + + If you are using &man.send-pr.1;: + + Once you are done filling out the template, have saved it, + and exit your editor, &man.send-pr.1; will prompt you with + s)end, e)dit or a)bort?. You can then hit + s to go ahead and submit the problem report, + e to restart the editor and make + further modifications, or a to abort. + If you choose the latter, your problem report will remain on + disk (&man.send-pr.1; will tell you the filename before it + terminates), so you can edit it at your leisure, or maybe + transfer it to a system with better net connectivity, before + sending it with the to + &man.send-pr.1;: + +&prompt.user; send-pr -f ~/my-problem-report + + This will read the specified file, validate the contents, + strip comments and send it off. + + If you are using the web form: + + Before you hit submit, you will need to + fill in a field containing text that is represented in image + form on the page. This unfortunate measure has had to be + adopted due to misuse by automated systems and a few misguided + individuals. It is a necessary evil that no one likes; please + do not ask us to remove it. + + Note that you are strongly advised to + save your work somewhere before hitting submit. + A common problem for users is to have their web browser displaying + a stale image from its cache. If this happens to you, your + submission will be rejected and you may lose your work. + + If you are unable to view images for any reason, and are also + unable to use &man.send-pr.1;, please accept our apologies for + the inconvenience and email your problem report to the bugbuster + team at freebsd-bugbusters@FreeBSD.org. +
+ +
+ +
+ Follow-up + + Once your problem report has been filed, you will receive a + confirmation by email which will include the tracking number + that was assigned to your problem report and a URL you can use + to check its status. With a little luck, someone will take an + interest in your problem and try to address it, or, as the case + may be, explain why it is not a problem. You will be + automatically notified of any change of status, and you will + receive copies of any comments or patches someone may attach to + your problem report's audit trail. + + If someone requests additional information from you, or you + remember or discover something you did not mention in the + initial report, please use one of two methods to submit your + followup: + + + + The easiest way is to use the followup link on + the individual PR's web page, which you can reach from the + + PR search page. Clicking on this link will bring up an + an email window with the correct To: and Subject: lines filled in + (if your browser is configured to do this). + + + + Alternatively, you can just mail it to + &a.bugfollowup;, making sure that the + tracking number is included in the subject so the bug tracking + system will know what problem report to attach it to. + + + If you do not include the tracking + number, GNATS will become confused and create an entirely + new PR which it then assigns to the GNATS administrator, + and then your followup will become lost until someone + comes in to clean up the mess, which could be days or + weeks afterwards. + + Wrong way: Subject: that PR I sent + Right way: Subject: Re: ports/12345: compilation problem with foo/bar + + + + + + If the problem report remains open after the problem has + gone away, just send a follow-up (in the manner prescribed + above) saying that the problem report can be closed, and, if + possible, explaining how or when the problem was fixed. +
+ +
+ If you are having problems + + Most PRs go through the system and are accepted quickly; + however, at times GNATS runs behind and you may not get your + email confirmation for 10 minutes or even longer. Please try to + be patient. + + In addition, because GNATS receives all its input via email, + it is absolutely vital that &os; runs all its submissions through + spam filters. If you do not get a response within an hour or + two, you may have fallen afoul of them; if so, please contact + the GNATS administrators at bugmeister@FreeBSD.org + and ask for help. + + + Among the anti-spam measures is one that weighs against + many common abuses seen HTML-based email (although not necessarily + the mere inclusion of HTML in a PR). We strongly recommend + against the use of HTML-based email when sending PRs: not + only is it more likely to fall afoul of the filters, it also + tends to merely clutter up the database. Plain old email is + strongly preferred. + + + On rare occasions you will encounter a GNATS bug where a + PR is accepted and assigned a tracking number but it does not + show up on the list of PRs on any of the web query pages. What + may have happened is that the database index has gotten out of + synchronization with the database itself. The way that you + can test whether this has happened is to pull up the + + view a single PR page and see whether the PR shows up. + If it does, please notify the GNATS administrators at + bugmeister@FreeBSD.org. Note that there is a + cron job that periodically rebuilds the database, + so unless you are in a hurry, no action needs to be taken. +
+ +
+ Further Reading + + This is a list of resources relevant to the proper writing + and processing of problem reports. It is by no means complete. + + + + + How to Report Bugs Effectively—an excellent + essay by Simon G. Tatham on composing useful (non-&os;-specific) + problem reports. + + + Problem + Report Handling Guidelines—valuable insight + into how problem reports are handled by the &os; + developers. + + +
+
diff --git a/zh_TW.Big5/books/Makefile b/zh_TW.Big5/books/Makefile index 3918e85f5f..45eb550a9a 100644 --- a/zh_TW.Big5/books/Makefile +++ b/zh_TW.Big5/books/Makefile @@ -1,12 +1,13 @@ # $FreeBSD$ -SUBDIR = faq +SUBDIR = developers-handbook +SUBDIR+= faq SUBDIR+= fdp-primer SUBDIR+= handbook SUBDIR+= porters-handbook #SUBDIR+= zh-tut -ROOT_SYMLINKS = faq +ROOT_SYMLINKS = faq fdp-primer handbook porters-handbook DOC_PREFIX?= ${.CURDIR}/../.. .include "${DOC_PREFIX}/share/mk/doc.project.mk" diff --git a/zh_TW.Big5/books/developers-handbook/Makefile b/zh_TW.Big5/books/developers-handbook/Makefile new file mode 100644 index 0000000000..38b6465e31 --- /dev/null +++ b/zh_TW.Big5/books/developers-handbook/Makefile @@ -0,0 +1,45 @@ +# +# $FreeBSD$ +# +# Build the FreeBSD Developers' Handbook. +# + +MAINTAINER=doc@FreeBSD.org + +DOC?= book + +FORMATS?= html-split + +HAS_INDEX= true + +INSTALL_COMPRESSED?= gz +INSTALL_ONLY_COMPRESSED?= + +# Images +IMAGES_EN= sockets/layers.eps sockets/sain.eps sockets/sainfill.eps sockets/sainlsb.eps sockets/sainmsb.eps sockets/sainserv.eps sockets/serv.eps sockets/serv2.eps sockets/slayers.eps + +# +# SRCS lists the individual SGML files that make up the document. Changes +# to any of these files will force a rebuild +# + +# SGML content +SRCS= book.sgml +SRCS+= dma/chapter.sgml +SRCS+= introduction/chapter.sgml +SRCS+= ipv6/chapter.sgml +SRCS+= kerneldebug/chapter.sgml +SRCS+= l10n/chapter.sgml +SRCS+= policies/chapter.sgml +SRCS+= secure/chapter.sgml +SRCS+= sockets/chapter.sgml +SRCS+= testing/chapter.sgml +SRCS+= tools/chapter.sgml +SRCS+= x86/chapter.sgml + +# Entities + +URL_RELPREFIX?= ../../../.. +DOC_PREFIX?= ${.CURDIR}/../../.. + +.include "${DOC_PREFIX}/share/mk/doc.project.mk" diff --git a/zh_TW.Big5/books/developers-handbook/book.sgml b/zh_TW.Big5/books/developers-handbook/book.sgml new file mode 100644 index 0000000000..bac45423bc --- /dev/null +++ b/zh_TW.Big5/books/developers-handbook/book.sgml @@ -0,0 +1,228 @@ + + + +%books.ent; + %chapters; + +]> + + + + FreeBSD Developers' Handbook + + The FreeBSD Documentation Project + + August 2000 + + + 2000 + 2001 + 2002 + 2003 + 2004 + 2005 + 2006 + The FreeBSD Documentation Project + + + &bookinfo.legalnotice; + + + &tm-attrib.freebsd; + &tm-attrib.apple; + &tm-attrib.ibm; + &tm-attrib.ieee; + &tm-attrib.intel; + &tm-attrib.linux; + &tm-attrib.microsoft; + &tm-attrib.opengroup; + &tm-attrib.sun; + &tm-attrib.general; + + + + Welcome to the Developers' Handbook. This manual is a + work in progress and is the work of many + individuals. Many sections do not yet exist and some of those + that do exist need to be updated. If you are interested in + helping with this project, send email to the &a.doc;. + + The latest version of this document is always available + from the FreeBSD World + Wide Web server. It may also be downloaded in a + variety of formats and compression options from the FreeBSD FTP + server or one of the numerous mirror + sites. + + + + + Basics + + &chap.introduction; + &chap.tools; + &chap.secure; + &chap.l10n; + &chap.policies; + &chap.testing; + + + + Interprocess Communication + + &chap.sockets; + &chap.ipv6; + + + + + Kernel + + &chap.dma; + &chap.kerneldebug; + + + + + Architectures + + &chap.x86; + + + + + Appendices + + + + + + + Dave + A + Patterson + + + John + L + Hennessy + + + 1998Morgan Kaufmann Publishers, + Inc. + 1-55860-428-6 + + Morgan Kaufmann Publishers, Inc. + + Computer Organization and Design + The Hardware / Software Interface + 1-2 + + + + + + W. + Richard + Stevens + + + 1993Addison Wesley Longman, + Inc. + 0-201-56317-7 + + Addison Wesley Longman, Inc. + + Advanced Programming in the Unix Environment + 1-2 + + + + + + Marshall + Kirk + McKusick + + + Keith + Bostic + + + Michael + J + Karels + + + John + S + Quarterman + + + 1996Addison-Wesley Publishing Company, + Inc. + 0-201-54979-4 + + Addison-Wesley Publishing Company, Inc. + + The Design and Implementation of the 4.4 BSD Operating System + 1-2 + + + + + + Aleph + One + + + Phrack 49; "Smashing the Stack for Fun and Profit" + + + + + + Chrispin + Cowan + + + Calton + Pu + + + Dave + Maier + + + StackGuard; Automatic Adaptive Detection and Prevention of + Buffer-Overflow Attacks + + + + + + Todd + Miller + + + Theo + de Raadt + + + strlcpy and strlcat -- consistent, safe string copy and + concatenation. + + + + + + + + diff --git a/zh_TW.Big5/books/developers-handbook/chapters.ent b/zh_TW.Big5/books/developers-handbook/chapters.ent new file mode 100644 index 0000000000..159c698d48 --- /dev/null +++ b/zh_TW.Big5/books/developers-handbook/chapters.ent @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/zh_TW.Big5/books/developers-handbook/dma/chapter.sgml b/zh_TW.Big5/books/developers-handbook/dma/chapter.sgml new file mode 100644 index 0000000000..7ac24b9838 --- /dev/null +++ b/zh_TW.Big5/books/developers-handbook/dma/chapter.sgml @@ -0,0 +1,1326 @@ + + + + DMA + + + DMA: What it is and How it Works + + Copyright © 1995,1997 &a.uhclem;, All Rights + Reserved. 10 December 1996. Last Update 8 October + 1997. + + Direct Memory Access (DMA) is a method of allowing data to be moved + from one location to another in a computer without intervention from the + central processor (CPU). + + The way that the DMA function is implemented varies between computer + architectures, so this discussion will limit itself to the + implementation and workings of the DMA subsystem on the IBM Personal + Computer (PC), the IBM PC/AT and all of its successors and + clones. + + The PC DMA subsystem is based on the &intel; 8237 DMA controller. The + 8237 contains four DMA channels that can be programmed independently and + any one of the channels may be active at any moment. These channels are + numbered 0, 1, 2 and 3. Starting with the PC/AT, IBM added a second + 8237 chip, and numbered those channels 4, 5, 6 and 7. + + The original DMA controller (0, 1, 2 and 3) moves one byte in each + transfer. The second DMA controller (4, 5, 6, and 7) moves 16-bits from + two adjacent memory locations in each transfer, with the first byte + always coming from an even-numbered address. The two controllers are + identical components and the difference in transfer size is caused by + the way the second controller is wired into the system. + + The 8237 has two electrical signals for each channel, named DRQ and + -DACK. There are additional signals with the names HRQ (Hold Request), + HLDA (Hold Acknowledge), -EOP (End of Process), and the bus control + signals -MEMR (Memory Read), -MEMW (Memory Write), -IOR (I/O Read), and + -IOW (I/O Write). + + The 8237 DMA is known as a fly-by DMA controller. + This means that the data being moved from one location to another does + not pass through the DMA chip and is not stored in the DMA chip. + Subsequently, the DMA can only transfer data between an I/O port and a + memory address, but not between two I/O ports or two memory + locations. + + + The 8237 does allow two channels to be connected together to allow + memory-to-memory DMA operations in a non-fly-by mode, + but nobody in the PC industry uses this scarce resource this way since + it is faster to move data between memory locations using the + CPU. + + + In the PC architecture, each DMA channel is normally activated only + when the hardware that uses a given DMA channel requests a transfer by + asserting the DRQ line for that channel. + + + A Sample DMA transfer + + Here is an example of the steps that occur to cause and perform a + DMA transfer. In this example, the floppy disk controller (FDC) has + just read a byte from a diskette and wants the DMA to place it in + memory at location 0x00123456. The process begins by the FDC + asserting the DRQ2 signal (the DRQ line for DMA channel 2) to alert + the DMA controller. + + The DMA controller will note that the DRQ2 signal is asserted. The + DMA controller will then make sure that DMA channel 2 has been + programmed and is unmasked (enabled). The DMA controller also makes + sure that none of the other DMA channels are active or want to be + active and have a higher priority. Once these checks are complete, + the DMA asks the CPU to release the bus so that the DMA may use the + bus. The DMA requests the bus by asserting the HRQ signal which goes + to the CPU. + + The CPU detects the HRQ signal, and will complete executing the + current instruction. Once the processor has reached a state where it + can release the bus, it will. Now all of the signals normally + generated by the CPU (-MEMR, -MEMW, -IOR, -IOW and a few others) are + placed in a tri-stated condition (neither high or low) and then the + CPU asserts the HLDA signal which tells the DMA controller that it is + now in charge of the bus. + + Depending on the processor, the CPU may be able to execute a few + additional instructions now that it no longer has the bus, but the CPU + will eventually have to wait when it reaches an instruction that must + read something from memory that is not in the internal processor cache + or pipeline. + + Now that the DMA is in charge, the DMA activates its + -MEMR, -MEMW, -IOR, -IOW output signals, and the address outputs from + the DMA are set to 0x3456, which will be used to direct the byte that + is about to transferred to a specific memory location. + + The DMA will then let the device that requested the DMA transfer + know that the transfer is commencing. This is done by asserting the + -DACK signal, or in the case of the floppy disk controller, -DACK2 is + asserted. + + The floppy disk controller is now responsible for placing the byte + to be transferred on the bus Data lines. Unless the floppy controller + needs more time to get the data byte on the bus (and if the peripheral + does need more time it alerts the DMA via the READY signal), the DMA + will wait one DMA clock, and then de-assert the -MEMW and -IOR signals + so that the memory will latch and store the byte that was on the bus, + and the FDC will know that the byte has been transferred. + + Since the DMA cycle only transfers a single byte at a time, the + FDC now drops the DRQ2 signal, so the DMA knows that it is no longer + needed. The DMA will de-assert the -DACK2 signal, so that the FDC + knows it must stop placing data on the bus. + + The DMA will now check to see if any of the other DMA channels + have any work to do. If none of the channels have their DRQ lines + asserted, the DMA controller has completed its work and will now + tri-state the -MEMR, -MEMW, -IOR, -IOW and address signals. + + Finally, the DMA will de-assert the HRQ signal. The CPU sees + this, and de-asserts the HOLDA signal. Now the CPU activates its + -MEMR, -MEMW, -IOR, -IOW and address lines, and it resumes executing + instructions and accessing main memory and the peripherals. + + For a typical floppy disk sector, the above process is repeated + 512 times, once for each byte. Each time a byte is transferred, the + address register in the DMA is incremented and the counter in the DMA + that shows how many bytes are to be transferred is decremented. + + When the counter reaches zero, the DMA asserts the EOP signal, + which indicates that the counter has reached zero and no more data + will be transferred until the DMA controller is reprogrammed by the + CPU. This event is also called the Terminal Count (TC). There is only + one EOP signal, and since only one DMA channel can be active at any + instant, the DMA channel that is currently active must be the DMA + channel that just completed its task. + + If a peripheral wants to generate an interrupt when the transfer + of a buffer is complete, it can test for its -DACKn signal and the EOP + signal both being asserted at the same time. When that happens, it + means the DMA will not transfer any more information for that + peripheral without intervention by the CPU. The peripheral can then + assert one of the interrupt signals to get the processors' attention. + In the PC architecture, the DMA chip itself is not capable of + generating an interrupt. The peripheral and its associated hardware + is responsible for generating any interrupt that occurs. + Subsequently, it is possible to have a peripheral that uses DMA but + does not use interrupts. + + It is important to understand that although the CPU always + releases the bus to the DMA when the DMA makes the request, this + action is invisible to both applications and the operating system, + except for slight changes in the amount of time the processor takes to + execute instructions when the DMA is active. Subsequently, the + processor must poll the peripheral, poll the registers in the DMA + chip, or receive an interrupt from the peripheral to know for certain + when a DMA transfer has completed. + + + + DMA Page Registers and 16Meg address space limitations + + You may have noticed earlier that instead of the DMA setting the + address lines to 0x00123456 as we said earlier, the DMA only set + 0x3456. The reason for this takes a bit of explaining. + + When the original IBM PC was designed, IBM elected to use both DMA + and interrupt controller chips that were designed for use with the + 8085, an 8-bit processor with an address space of 16 bits (64K). + Since the IBM PC supported more than 64K of memory, something had to + be done to allow the DMA to read or write memory locations above the + 64K mark. What IBM did to solve this problem was to add an external + data latch for each DMA channel that holds the upper bits of the + address to be read to or written from. Whenever a DMA channel is + active, the contents of that latch are written to the address bus and + kept there until the DMA operation for the channel ends. IBM called + these latches Page Registers. + + So for our example above, the DMA would put the 0x3456 part of the + address on the bus, and the Page Register for DMA channel 2 would put + 0x0012xxxx on the bus. Together, these two values form the complete + address in memory that is to be accessed. + + Because the Page Register latch is independent of the DMA chip, + the area of memory to be read or written must not span a 64K physical + boundary. For example, if the DMA accesses memory location 0xffff, + after that transfer the DMA will then increment the address register + and the DMA will access the next byte at location 0x0000, not 0x10000. + The results of letting this happen are probably not intended. + + + Physical 64K boundaries should not be confused + with 8086-mode 64K Segments, which are created by + mathematically adding a segment register with an offset register. + Page Registers have no address overlap and are mathematically OR-ed + together. + + + To further complicate matters, the external DMA address latches on + the PC/AT hold only eight bits, so that gives us 8+16=24 bits, which + means that the DMA can only point at memory locations between 0 and + 16Meg. For newer computers that allow more than 16Meg of memory, the + standard PC-compatible DMA cannot access memory locations above + 16Meg. + + To get around this restriction, operating systems will reserve a + RAM buffer in an area below 16Meg that also does not span a physical + 64K boundary. Then the DMA will be programmed to transfer data from + the peripheral and into that buffer. Once the DMA has moved the data + into this buffer, the operating system will then copy the data from + the buffer to the address where the data is really supposed to be + stored. + + When writing data from an address above 16Meg to a DMA-based + peripheral, the data must be first copied from where it resides into a + buffer located below 16Meg, and then the DMA can copy the data from + the buffer to the hardware. In FreeBSD, these reserved buffers are + called Bounce Buffers. In the &ms-dos; world, they are + sometimes called Smart Buffers. + + + A new implementation of the 8237, called the 82374, allows 16 + bits of page register to be specified and enables access to the entire + 32 bit address space, without the use of bounce buffers. + + + + + DMA Operational Modes and Settings + + The 8237 DMA can be operated in several modes. The main ones + are: + + + + Single + + + A single byte (or word) is transferred. The DMA must + release and re-acquire the bus for each additional byte. This is + commonly-used by devices that cannot transfer the entire block + of data immediately. The peripheral will request the DMA each + time it is ready for another transfer. + + The standard PC-compatible floppy disk controller (NEC 765) + only has a one-byte buffer, so it uses this mode. + + + + + Block/Demand + + + Once the DMA acquires the system bus, an entire block of + data is transferred, up to a maximum of 64K. If the peripheral + needs additional time, it can assert the READY signal to suspend + the transfer briefly. READY should not be used excessively, and + for slow peripheral transfers, the Single Transfer Mode should + be used instead. + + The difference between Block and Demand is that once a Block + transfer is started, it runs until the transfer count reaches + zero. DRQ only needs to be asserted until -DACK is asserted. + Demand Mode will transfer one more bytes until DRQ is + de-asserted, at which point the DMA suspends the transfer and + releases the bus back to the CPU. When DRQ is asserted later, + the transfer resumes where it was suspended. + + Older hard disk controllers used Demand Mode until CPU + speeds increased to the point that it was more efficient to + transfer the data using the CPU, particularly if the memory + locations used in the transfer were above the 16Meg mark. + + + + + Cascade + + + This mechanism allows a DMA channel to request the bus, but + then the attached peripheral device is responsible for placing + the addressing information on the bus instead of the DMA. This + is also used to implement a technique known as Bus + Mastering. + + When a DMA channel in Cascade Mode receives control of the + bus, the DMA does not place addresses and I/O control signals on + the bus like the DMA normally does when it is active. Instead, + the DMA only asserts the -DACK signal for the active DMA + channel. + + At this point it is up to the peripheral connected to that + DMA channel to provide address and bus control signals. The + peripheral has complete control over the system bus, and can do + reads and/or writes to any address below 16Meg. When the + peripheral is finished with the bus, it de-asserts the DRQ line, + and the DMA controller can then return control to the CPU or to + some other DMA channel. + + Cascade Mode can be used to chain multiple DMA controllers + together, and this is exactly what DMA Channel 4 is used for in + the PC architecture. When a peripheral requests the bus on DMA + channels 0, 1, 2 or 3, the slave DMA controller asserts HLDREQ, + but this wire is actually connected to DRQ4 on the primary DMA + controller instead of to the CPU. The primary DMA controller, + thinking it has work to do on Channel 4, requests the bus from + the CPU using HLDREQ signal. Once the CPU grants the bus to the + primary DMA controller, -DACK4 is asserted, and that wire is + actually connected to the HLDA signal on the slave DMA + controller. The slave DMA controller then transfers data for + the DMA channel that requested it (0, 1, 2 or 3), or the slave + DMA may grant the bus to a peripheral that wants to perform its + own bus-mastering, such as a SCSI controller. + + Because of this wiring arrangement, only DMA channels 0, 1, + 2, 3, 5, 6 and 7 are usable with peripherals on PC/AT + systems. + + + DMA channel 0 was reserved for refresh operations in early + IBM PC computers, but is generally available for use by + peripherals in modern systems. + + + When a peripheral is performing Bus Mastering, it is + important that the peripheral transmit data to or from memory + constantly while it holds the system bus. If the peripheral + cannot do this, it must release the bus frequently so that the + system can perform refresh operations on main memory. + + The Dynamic RAM used in all PCs for main memory must be + accessed frequently to keep the bits stored in the components + charged. Dynamic RAM essentially consists of + millions of capacitors with each one holding one bit of data. + These capacitors are charged with power to represent a + 1 or drained to represent a + 0. Because all capacitors leak, power must + be added at regular intervals to keep the 1 + values intact. The RAM chips actually handle the task of + pumping power back into all of the appropriate locations in RAM, + but they must be told when to do it by the rest of the computer + so that the refresh activity will not interfere with the computer + wanting to access RAM normally. If the computer is unable to + refresh memory, the contents of memory will become corrupted in + just a few milliseconds. + + Since memory read and write cycles count as + refresh cycles (a dynamic RAM refresh cycle is actually an + incomplete memory read cycle), as long as the peripheral + controller continues reading or writing data to sequential + memory locations, that action will refresh all of memory. + + Bus-mastering is found in some SCSI host interfaces and + other high-performance peripheral controllers. + + + + + Autoinitialize + + + This mode causes the DMA to perform Byte, Block or Demand + transfers, but when the DMA transfer counter reaches zero, the + counter and address are set back to where they were when the DMA + channel was originally programmed. This means that as long as + the peripheral requests transfers, they will be granted. It is + up to the CPU to move new data into the fixed buffer ahead of + where the DMA is about to transfer it when doing output + operations, and to read new data out of the buffer behind where the + DMA is writing when doing input operations. + + This technique is frequently used on audio devices that have + small or no hardware sample buffers. There is + additional CPU overhead to manage this circular + buffer, but in some cases this may be the only way to eliminate + the latency that occurs when the DMA counter reaches zero and + the DMA stops transfers until it is reprogrammed. + + + + + + + Programming the DMA + + The DMA channel that is to be programmed should always be + masked before loading any settings. This is because the + hardware might unexpectedly assert the DRQ for that channel, and the + DMA might respond, even though not all of the parameters have been + loaded or updated. + + Once masked, the host must specify the direction of the transfer + (memory-to-I/O or I/O-to-memory), what mode of DMA operation is to be + used for the transfer (Single, Block, Demand, Cascade, etc), and + finally the address and length of the transfer are loaded. The length + that is loaded is one less than the amount you expect the DMA to + transfer. The LSB and MSB of the address and length are written to + the same 8-bit I/O port, so another port must be written to first to + guarantee that the DMA accepts the first byte as the LSB and the + second byte as the MSB of the length and address. + + Then, be sure to update the Page Register, which is external to + the DMA and is accessed through a different set of I/O ports. + + Once all the settings are ready, the DMA channel can be un-masked. + That DMA channel is now considered to be armed, and will + respond when the DRQ line for that channel is asserted. + + Refer to a hardware data book for precise programming details for + the 8237. You will also need to refer to the I/O port map for the PC + system, which describes where the DMA and Page Register ports are + located. A complete port map table is located below. + + + + DMA Port Map + + All systems based on the IBM-PC and PC/AT have the DMA hardware + located at the same I/O ports. The complete list is provided below. + Ports assigned to DMA Controller #2 are undefined on non-AT + designs. + + + 0x00–0x1f DMA Controller #1 (Channels 0, 1, 2 and + 3) + + DMA Address and Count Registers + + + + + + 0x00 + write + Channel 0 starting address + + + + 0x00 + read + Channel 0 current address + + + + 0x01 + write + Channel 0 starting word count + + + + 0x01 + read + Channel 0 remaining word count + + + + 0x02 + write + Channel 1 starting address + + + + 0x02 + read + Channel 1 current address + + + + 0x03 + write + Channel 1 starting word count + + + + 0x03 + read + Channel 1 remaining word count + + + + 0x04 + write + Channel 2 starting address + + + + 0x04 + read + Channel 2 current address + + + + 0x05 + write + Channel 2 starting word count + + + + 0x05 + read + Channel 2 remaining word count + + + + 0x06 + write + Channel 3 starting address + + + + 0x06 + read + Channel 3 current address + + + + 0x07 + write + Channel 3 starting word count + + + + 0x07 + read + Channel 3 remaining word count + + + + + + DMA Command Registers + + + + + + 0x08 + write + Command Register + + + + 0x08 + read + Status Register + + + + 0x09 + write + Request Register + + + + 0x09 + read + - + + + + 0x0a + write + Single Mask Register Bit + + + + 0x0a + read + - + + + + 0x0b + write + Mode Register + + + + 0x0b + read + - + + + + 0x0c + write + Clear LSB/MSB Flip-Flop + + + + 0x0c + read + - + + + + 0x0d + write + Master Clear/Reset + + + + 0x0d + read + Temporary Register (not available on newer + versions) + + + 0x0e + write + Clear Mask Register + + + + 0x0e + read + - + + + + 0x0f + write + Write All Mask Register Bits + + + + 0x0f + read + Read All Mask Register Bits (only in &intel; + 82374) + + + + + + + + 0xc0–0xdf DMA Controller #2 (Channels 4, 5, 6 and + 7) + + DMA Address and Count Registers + + + + + + 0xc0 + write + Channel 4 starting address + + + + 0xc0 + read + Channel 4 current address + + + + 0xc2 + write + Channel 4 starting word count + + + + 0xc2 + read + Channel 4 remaining word count + + + + 0xc4 + write + Channel 5 starting address + + + + 0xc4 + read + Channel 5 current address + + + + 0xc6 + write + Channel 5 starting word count + + + + 0xc6 + read + Channel 5 remaining word count + + + + 0xc8 + write + Channel 6 starting address + + + + 0xc8 + read + Channel 6 current address + + + + 0xca + write + Channel 6 starting word count + + + + 0xca + read + Channel 6 remaining word count + + + + 0xcc + write + Channel 7 starting address + + + + 0xcc + read + Channel 7 current address + + + + 0xce + write + Channel 7 starting word count + + + + 0xce + read + Channel 7 remaining word count + + + + + + DMA Command Registers + + + + + + 0xd0 + write + Command Register + + + + 0xd0 + read + Status Register + + + + 0xd2 + write + Request Register + + + + 0xd2 + read + - + + + + 0xd4 + write + Single Mask Register Bit + + + + 0xd4 + read + - + + + + 0xd6 + write + Mode Register + + + + 0xd6 + read + - + + + + 0xd8 + write + Clear LSB/MSB Flip-Flop + + + + 0xd8 + read + - + + + + + + 0xda + write + Master Clear/Reset + + + + 0xda + read + Temporary Register (not present in &intel; + 82374) + + + + 0xdc + write + Clear Mask Register + + + + 0xdc + read + - + + + + 0xde + write + Write All Mask Register Bits + + + + 0xdf + read + Read All Mask Register Bits (only in &intel; + 82374) + + + + + + + + 0x80–0x9f DMA Page Registers + + + + + + 0x87 + r/w + Channel 0 Low byte (23-16) page Register + + + + 0x83 + r/w + Channel 1 Low byte (23-16) page Register + + + + 0x81 + r/w + Channel 2 Low byte (23-16) page Register + + + + 0x82 + r/w + Channel 3 Low byte (23-16) page Register + + + + 0x8b + r/w + Channel 5 Low byte (23-16) page Register + + + + 0x89 + r/w + Channel 6 Low byte (23-16) page Register + + + + 0x8a + r/w + Channel 7 Low byte (23-16) page Register + + + + 0x8f + r/w + Low byte page Refresh + + + + + + + + 0x400–0x4ff 82374 Enhanced DMA Registers + + The &intel; 82374 EISA System Component (ESC) was introduced in + early 1996 and includes a DMA controller that provides a superset of + 8237 functionality as well as other PC-compatible core peripheral + components in a single package. This chip is targeted at both EISA + and PCI platforms, and provides modern DMA features like + scatter-gather, ring buffers as well as direct access by the system + DMA to all 32 bits of address space. + + If these features are used, code should also be included to + provide similar functionality in the previous 16 years worth of + PC-compatible computers. For compatibility reasons, some of the + 82374 registers must be programmed after + programming the traditional 8237 registers for each transfer. + Writing to a traditional 8237 register forces the contents of some + of the 82374 enhanced registers to zero to provide backward software + compatibility. + + + + + + 0x401 + r/w + Channel 0 High byte (bits 23-16) word count + + + + 0x403 + r/w + Channel 1 High byte (bits 23-16) word count + + + + 0x405 + r/w + Channel 2 High byte (bits 23-16) word count + + + + 0x407 + r/w + Channel 3 High byte (bits 23-16) word count + + + + 0x4c6 + r/w + Channel 5 High byte (bits 23-16) word count + + + + 0x4ca + r/w + Channel 6 High byte (bits 23-16) word count + + + + 0x4ce + r/w + Channel 7 High byte (bits 23-16) word count + + + + 0x487 + r/w + Channel 0 High byte (bits 31-24) page Register + + + + 0x483 + r/w + Channel 1 High byte (bits 31-24) page Register + + + + 0x481 + r/w + Channel 2 High byte (bits 31-24) page Register + + + + 0x482 + r/w + Channel 3 High byte (bits 31-24) page Register + + + + 0x48b + r/w + Channel 5 High byte (bits 31-24) page Register + + + + 0x489 + r/w + Channel 6 High byte (bits 31-24) page Register + + + + 0x48a + r/w + Channel 6 High byte (bits 31-24) page Register + + + + 0x48f + r/w + High byte page Refresh + + + + 0x4e0 + r/w + Channel 0 Stop Register (bits 7-2) + + + + 0x4e1 + r/w + Channel 0 Stop Register (bits 15-8) + + + + 0x4e2 + r/w + Channel 0 Stop Register (bits 23-16) + + + + 0x4e4 + r/w + Channel 1 Stop Register (bits 7-2) + + + + 0x4e5 + r/w + Channel 1 Stop Register (bits 15-8) + + + + 0x4e6 + r/w + Channel 1 Stop Register (bits 23-16) + + + + 0x4e8 + r/w + Channel 2 Stop Register (bits 7-2) + + + + 0x4e9 + r/w + Channel 2 Stop Register (bits 15-8) + + + + 0x4ea + r/w + Channel 2 Stop Register (bits 23-16) + + + + 0x4ec + r/w + Channel 3 Stop Register (bits 7-2) + + + + 0x4ed + r/w + Channel 3 Stop Register (bits 15-8) + + + + 0x4ee + r/w + Channel 3 Stop Register (bits 23-16) + + + + 0x4f4 + r/w + Channel 5 Stop Register (bits 7-2) + + + + 0x4f5 + r/w + Channel 5 Stop Register (bits 15-8) + + + + 0x4f6 + r/w + Channel 5 Stop Register (bits 23-16) + + + + 0x4f8 + r/w + Channel 6 Stop Register (bits 7-2) + + + + 0x4f9 + r/w + Channel 6 Stop Register (bits 15-8) + + + + 0x4fa + r/w + Channel 6 Stop Register (bits 23-16) + + + + 0x4fc + r/w + Channel 7 Stop Register (bits 7-2) + + + + 0x4fd + r/w + Channel 7 Stop Register (bits 15-8) + + + + 0x4fe + r/w + Channel 7 Stop Register (bits 23-16) + + + + 0x40a + write + Channels 0-3 Chaining Mode Register + + + + 0x40a + read + Channel Interrupt Status Register + + + + 0x4d4 + write + Channels 4-7 Chaining Mode Register + + + + 0x4d4 + read + Chaining Mode Status + + + + 0x40c + read + Chain Buffer Expiration Control Register + + + + 0x410 + write + Channel 0 Scatter-Gather Command Register + + + + 0x411 + write + Channel 1 Scatter-Gather Command Register + + + + 0x412 + write + Channel 2 Scatter-Gather Command Register + + + + 0x413 + write + Channel 3 Scatter-Gather Command Register + + + + 0x415 + write + Channel 5 Scatter-Gather Command Register + + + + 0x416 + write + Channel 6 Scatter-Gather Command Register + + + + 0x417 + write + Channel 7 Scatter-Gather Command Register + + + + 0x418 + read + Channel 0 Scatter-Gather Status Register + + + + 0x419 + read + Channel 1 Scatter-Gather Status Register + + + + 0x41a + read + Channel 2 Scatter-Gather Status Register + + + + 0x41b + read + Channel 3 Scatter-Gather Status Register + + + + 0x41d + read + Channel 5 Scatter-Gather Status Register + + + + 0x41e + read + Channel 5 Scatter-Gather Status Register + + + + 0x41f + read + Channel 7 Scatter-Gather Status Register + + + + 0x420-0x423 + r/w + Channel 0 Scatter-Gather Descriptor Table Pointer + Register + + + + 0x424-0x427 + r/w + Channel 1 Scatter-Gather Descriptor Table Pointer + Register + + + + 0x428-0x42b + r/w + Channel 2 Scatter-Gather Descriptor Table Pointer + Register + + + + 0x42c-0x42f + r/w + Channel 3 Scatter-Gather Descriptor Table Pointer + Register + + + + 0x434-0x437 + r/w + Channel 5 Scatter-Gather Descriptor Table Pointer + Register + + + + 0x438-0x43b + r/w + Channel 6 Scatter-Gather Descriptor Table Pointer + Register + + + + 0x43c-0x43f + r/w + Channel 7 Scatter-Gather Descriptor Table Pointer + Register + + + + + + + + + diff --git a/zh_TW.Big5/books/developers-handbook/introduction/chapter.sgml b/zh_TW.Big5/books/developers-handbook/introduction/chapter.sgml new file mode 100644 index 0000000000..200f52c858 --- /dev/null +++ b/zh_TW.Big5/books/developers-handbook/introduction/chapter.sgml @@ -0,0 +1,225 @@ + + + + + + + Murray + Stokely + Contributed by + + + Jeroen + Ruigrok van der Werven + + + + Introduction + + + Developing on FreeBSD + + So here we are. System all installed and you are ready to + start programming. But where to start? What does FreeBSD + provide? What can it do for me, as a programmer? + + These are some questions which this chapter tries to answer. + Of course, programming has different levels of proficiency like + any other trade. For some it is a hobby, for others it is their + profession. The information in this chapter might be aimed + toward the beginning programmer; indeed, it could serve useful + for the programmer unfamiliar with the &os; platform. + + + + + The BSD Vision + + To produce the best &unix; like operating system package + possible, with due respect to the original software tools + ideology as well as usability, performance and + stability. + + + + Architectural Guidelines + + Our ideology can be described by the following + guidelines + + + + Do not add new functionality unless an + implementor cannot complete a real application without + it. + + It is as important to decide what a system is + not as to decide what it is. Do not serve all the world's + needs; rather, make the system extensible so that additional + needs can be met in an upwardly compatible + fashion. + + The only thing worse than generalizing from one + example is generalizing from no examples at + all. + + If a problem is not completely understood, it is + probably best to provide no solution at all. + + If you can get 90 percent of the desired effect + for 10 percent of the work, use the simpler + solution. + + Isolate complexity as much as + possible. + + Provide mechanism, rather than policy. In + particular, place user interface policy in the client's + hands. + + + + From Scheifler & Gettys: "X Window System" + + + + + The Layout of + <filename class="directory">/usr/src</filename> + + The complete source code to FreeBSD is available from our + public CVS repository. The source code is normally installed in + /usr/src which contains the + following subdirectories: + + + + + + + Directory + Description + + + + + + bin/ + Source for files in + /bin + + + + contrib/ + Source for files from contributed software. + + + + crypto/ + Cryptographical sources + + + + etc/ + Source for files in /etc + + + + games/ + Source for files in /usr/games + + + + gnu/ + Utilities covered by the GNU Public License + + + + include/ + Source for files in /usr/include + + + + kerberos5/ + Source for Kerberos version 5 + + + + lib/ + Source for files in /usr/lib + + + + libexec/ + Source for files in /usr/libexec + + + + release/ + Files required to produce a FreeBSD release + + + + rescue/ + Build system for the + /rescue utilities + + + + sbin/ + Source for files in /sbin + + + + secure/ + FreeSec sources + + + + share/ + Source for files in /usr/share + + + + sys/ + Kernel source files + + + + tools/ + Tools used for maintenance and testing of + FreeBSD + + + + usr.bin/ + Source for files in /usr/bin + + + + usr.sbin/ + Source for files in /usr/sbin + + + + + + + diff --git a/zh_TW.Big5/books/developers-handbook/ipv6/chapter.sgml b/zh_TW.Big5/books/developers-handbook/ipv6/chapter.sgml new file mode 100644 index 0000000000..71e76092df --- /dev/null +++ b/zh_TW.Big5/books/developers-handbook/ipv6/chapter.sgml @@ -0,0 +1,1593 @@ + + + + IPv6 Internals + + + + + + Yoshinobu + Inoue + Contributed by + + + + + + IPv6/IPsec Implementation + + This section should explain IPv6 and IPsec related implementation + internals. These functionalities are derived from KAME project + + + IPv6 + + + Conformance + + The IPv6 related functions conforms, or tries to conform to + the latest set of IPv6 specifications. For future reference we list + some of the relevant documents below (NOTE: this + is not a complete list - this is too hard to maintain...). + + For details please refer to specific chapter in the document, + RFCs, manual pages, or comments in the source code. + + Conformance tests have been performed on the KAME STABLE kit + at TAHI project. Results can be viewed at + . + We also attended Univ. of New Hampshire IOL tests + () in the + past, with our past snapshots. + + + + RFC1639: FTP Operation Over Big Address Records + (FOOBAR) + + + RFC2428 is preferred over RFC1639. FTP clients will + first try RFC2428, then RFC1639 if failed. + + + + + + RFC1886: DNS Extensions to support IPv6 + + + + RFC1933: Transition Mechanisms for IPv6 Hosts and + Routers + + + IPv4 compatible address is not supported. + + + automatic tunneling (described in 4.3 of this RFC) is not + supported. + + + &man.gif.4; interface implements IPv[46]-over-IPv[46] + tunnel in a generic way, and it covers "configured tunnel" + described in the spec. See 23.5.1.5 + in this document for details. + + + + + + RFC1981: Path MTU Discovery for IPv6 + + + + RFC2080: RIPng for IPv6 + + + usr.sbin/route6d support this. + + + + + + RFC2292: Advanced Sockets API for IPv6 + + + For supported library functions/kernel APIs, see + sys/netinet6/ADVAPI. + + + + + + RFC2362: Protocol Independent Multicast-Sparse + Mode (PIM-SM) + + + RFC2362 defines packet formats for PIM-SM. + draft-ietf-pim-ipv6-01.txt is + written based on this. + + + + + + RFC2373: IPv6 Addressing Architecture + + + supports node required addresses, and conforms to + the scope requirement. + + + + + + RFC2374: An IPv6 Aggregatable Global Unicast Address + Format + + + supports 64-bit length of Interface ID. + + + + + + RFC2375: IPv6 Multicast Address Assignments + + + Userland applications use the well-known addresses + assigned in the RFC. + + + + + + RFC2428: FTP Extensions for IPv6 and NATs + + + RFC2428 is preferred over RFC1639. FTP clients will + first try RFC2428, then RFC1639 if failed. + + + + + + RFC2460: IPv6 specification + + + + RFC2461: Neighbor discovery for IPv6 + + + See 23.5.1.2 + in this document for details. + + + + + + RFC2462: IPv6 Stateless Address Autoconfiguration + + + See 23.5.1.4 in this + document for details. + + + + + + RFC2463: ICMPv6 for IPv6 specification + + + See 23.5.1.9 in this + document for details. + + + + + + RFC2464: Transmission of IPv6 Packets over Ethernet + Networks + + + + RFC2465: MIB for IPv6: Textual Conventions and General + Group + + + Necessary statistics are gathered by the kernel. Actual + IPv6 MIB support is provided as a patchkit for ucd-snmp. + + + + + + RFC2466: MIB for IPv6: ICMPv6 group + + + Necessary statistics are gathered by the kernel. Actual + IPv6 MIB support is provided as patchkit for ucd-snmp. + + + + + + RFC2467: Transmission of IPv6 Packets over FDDI + Networks + + + + RFC2497: Transmission of IPv6 packet over ARCnet + Networks + + + + RFC2553: Basic Socket Interface Extensions for IPv6 + + + IPv4 mapped address (3.7) and special behavior of IPv6 + wildcard bind socket (3.8) are supported. See 23.5.1.12 + in this document for details. + + + + + + RFC2675: IPv6 Jumbograms + + + See 23.5.1.7 in + this document for details. + + + + + + RFC2710: Multicast Listener Discovery for IPv6 + + + + RFC2711: IPv6 router alert option + + + + draft-ietf-ipngwg-router-renum-08: Router + renumbering for IPv6 + + + + draft-ietf-ipngwg-icmp-namelookups-02: + IPv6 Name Lookups Through ICMP + + + + draft-ietf-ipngwg-icmp-name-lookups-03: + IPv6 Name Lookups Through ICMP + + + + draft-ietf-pim-ipv6-01.txt: + PIM for IPv6 + + + &man.pim6dd.8; implements dense mode. &man.pim6sd.8; + implements sparse mode. + + + + + + draft-itojun-ipv6-tcp-to-anycast-00: + Disconnecting TCP connection toward IPv6 anycast address + + + + draft-yamamoto-wideipv6-comm-model-00 + + + + See 23.5.1.6 in this + document for details. + + + + + + draft-ietf-ipngwg-scopedaddr-format-00.txt + : An Extension of Format for IPv6 Scoped + Addresses + + + + + + Neighbor Discovery + + Neighbor Discovery is fairly stable. Currently Address + Resolution, Duplicated Address Detection, and Neighbor Unreachability + Detection are supported. In the near future we will be adding Proxy + Neighbor Advertisement support in the kernel and Unsolicited Neighbor + Advertisement transmission command as admin tool. + + If DAD fails, the address will be marked "duplicated" and + message will be generated to syslog (and usually to console). The + "duplicated" mark can be checked with &man.ifconfig.8;. It is + administrators' responsibility to check for and recover from DAD + failures. The behavior should be improved in the near future. + + Some of the network driver loops multicast packets back to itself, + even if instructed not to do so (especially in promiscuous mode). + In such cases DAD may fail, because DAD engine sees inbound NS packet + (actually from the node itself) and considers it as a sign of duplicate. + You may want to look at #if condition marked "heuristics" in + sys/netinet6/nd6_nbr.c:nd6_dad_timer() as workaround (note that the code + fragment in "heuristics" section is not spec conformant). + + Neighbor Discovery specification (RFC2461) does not talk about + neighbor cache handling in the following cases: + + + + when there was no neighbor cache entry, node + received unsolicited RS/NS/NA/redirect packet without + link-layer address + + + neighbor cache handling on medium without link-layer + address (we need a neighbor cache entry for IsRouter bit) + + + + For first case, we implemented workaround based on discussions + on IETF ipngwg mailing list. For more details, see the comments in + the source code and email thread started from (IPng 7155), dated + Feb 6 1999. + + IPv6 on-link determination rule (RFC2461) is quite different + from assumptions in BSD network code. At this moment, no on-link + determination rule is supported where default router list is empty + (RFC2461, section 5.2, last sentence in 2nd paragraph - note that + the spec misuse the word "host" and "node" in several places in + the section). + + To avoid possible DoS attacks and infinite loops, only 10 + options on ND packet is accepted now. Therefore, if you have 20 + prefix options attached to RA, only the first 10 prefixes will be + recognized. If this troubles you, please ask it on FREEBSD-CURRENT + mailing list and/or modify nd6_maxndopt in + sys/netinet6/nd6.c. If there are high demands + we may provide sysctl knob for the variable. + + + + Scope Index + + IPv6 uses scoped addresses. Therefore, it is very important to + specify scope index (interface index for link-local address, or + site index for site-local address) with an IPv6 address. Without + scope index, scoped IPv6 address is ambiguous to the kernel, and + kernel will not be able to determine the outbound interface for a + packet. + + Ordinary userland applications should use advanced API + (RFC2292) to specify scope index, or interface index. For similar + purpose, sin6_scope_id member in sockaddr_in6 structure is defined + in RFC2553. However, the semantics for sin6_scope_id is rather vague. + If you care about portability of your application, we suggest you to + use advanced API rather than sin6_scope_id. + + In the kernel, an interface index for link-local scoped address is + embedded into 2nd 16bit-word (3rd and 4th byte) in IPv6 address. For + example, you may see something like: + + + fe80:1::200:f8ff:fe01:6317 + + + in the routing table and interface address structure (struct + in6_ifaddr). The address above is a link-local unicast address + which belongs to a network interface whose interface identifier is 1. + The embedded index enables us to identify IPv6 link local + addresses over multiple interfaces effectively and with only a + little code change. + + Routing daemons and configuration programs, like &man.route6d.8; + and &man.ifconfig.8;, will need to manipulate the "embedded" scope + index. These programs use routing sockets and ioctls (like + SIOCGIFADDR_IN6) and the kernel API will return IPv6 addresses with + 2nd 16bit-word filled in. The APIs are for manipulating kernel + internal structure. Programs that use these APIs have to be prepared + about differences in kernels anyway. + + When you specify scoped address to the command line, NEVER write + the embedded form (such as ff02:1::1 or fe80:2::fedc). This is not + supposed to work. Always use standard form, like ff02::1 or + fe80::fedc, with command line option for specifying interface (like + ping6 -I ne0 ff02::1). In general, if a command + does not have command line option to specify outgoing interface, that + command is not ready to accept scoped address. This may seem to be + opposite from IPv6's premise to support "dentist office" situation. + We believe that specifications need some improvements for this. + + Some of the userland tools support extended numeric IPv6 syntax, + as documented in + draft-ietf-ipngwg-scopedaddr-format-00.txt. You + can specify outgoing link, by using name of the outgoing interface + like "fe80::1%ne0". This way you will be able to specify link-local + scoped address without much trouble. + + To use this extension in your program, you will need to use + &man.getaddrinfo.3;, and &man.getnameinfo.3; with NI_WITHSCOPEID. + The implementation currently assumes 1-to-1 relationship between a + link and an interface, which is stronger than what specs say. + + + + Plug and Play + + Most of the IPv6 stateless address autoconfiguration is implemented + in the kernel. Neighbor Discovery functions are implemented in the + kernel as a whole. Router Advertisement (RA) input for hosts is + implemented in the kernel. Router Solicitation (RS) output for + endhosts, RS input for routers, and RA output for routers are + implemented in the userland. + + + Assignment of link-local, and special addresses + + IPv6 link-local address is generated from IEEE802 address + (Ethernet MAC address). Each of interface is assigned an IPv6 + link-local address automatically, when the interface becomes up + (IFF_UP). Also, direct route for the link-local address is added + to routing table. + + Here is an output of netstat command: + +Internet6: +Destination Gateway Flags Netif Expire +fe80:1::%ed0/64 link#1 UC ed0 +fe80:2::%ep0/64 link#2 UC ep0 + + Interfaces that has no IEEE802 address (pseudo interfaces + like tunnel interfaces, or ppp interfaces) will borrow IEEE802 + address from other interfaces, such as Ethernet interfaces, + whenever possible. If there is no IEEE802 hardware attached, + a last resort pseudo-random value, MD5(hostname), will + be used as source of link-local address. If it is not suitable + for your usage, you will need to configure the link-local address + manually. + + If an interface is not capable of handling IPv6 (such as + lack of multicast support), link-local address will not be + assigned to that interface. See section 2 for details. + + Each interface joins the solicited multicast address and the + link-local all-nodes multicast addresses (e.g. fe80::1:ff01:6317 + and ff02::1, respectively, on the link the interface is attached). + In addition to a link-local address, the loopback address (::1) + will be assigned to the loopback interface. Also, ::1/128 and + ff01::/32 are automatically added to routing table, and loopback + interface joins node-local multicast group ff01::1. + + + + Stateless address autoconfiguration on hosts + + In IPv6 specification, nodes are separated into two categories: + routers and hosts. Routers + forward packets addressed to others, hosts does not forward the + packets. net.inet6.ip6.forwarding defines whether this node is + router or host (router if it is 1, host if it is 0). + + When a host hears Router Advertisement from the router, a host + may autoconfigure itself by stateless address autoconfiguration. + This behavior can be controlled by net.inet6.ip6.accept_rtadv (host + autoconfigures itself if it is set to 1). By autoconfiguration, + network address prefix for the receiving interface (usually global + address prefix) is added. Default route is also configured. + Routers periodically generate Router Advertisement packets. To + request an adjacent router to generate RA packet, a host can + transmit Router Solicitation. To generate a RS packet at any time, + use the rtsol command. &man.rtsold.8; daemon is + also available. &man.rtsold.8; generates Router Solicitation whenever + necessary, and it works great for nomadic usage (notebooks/laptops). + If one wishes to ignore Router Advertisements, use sysctl to set + net.inet6.ip6.accept_rtadv to 0. + + To generate Router Advertisement from a router, use the + &man.rtadvd.8; daemon. + + Note that, IPv6 specification assumes the following items, and + nonconforming cases are left unspecified: + + + + Only hosts will listen to router advertisements + + + Hosts have single network interface (except loopback) + + + + Therefore, this is unwise to enable net.inet6.ip6.accept_rtadv + on routers, or multi-interface host. A misconfigured node can + behave strange (nonconforming configuration allowed for those who + would like to do some experiments). + + To summarize the sysctl knob: + + accept_rtadv forwarding role of the node + --- --- --- + 0 0 host (to be manually configured) + 0 1 router + 1 0 autoconfigured host + (spec assumes that host has single + interface only, autoconfigured host + with multiple interface is + out-of-scope) + 1 1 invalid, or experimental + (out-of-scope of spec) + + RFC2462 has validation rule against incoming RA prefix + information option, in 5.5.3 (e). This is to protect hosts from + malicious (or misconfigured) routers that advertise very short + prefix lifetime. There was an update from Jim Bound to ipngwg + mailing list (look for "(ipng 6712)" in the archive) and it is + implemented Jim's update. + + See 23.5.1.2 in + the document for relationship between DAD and + autoconfiguration. + + + + + Generic tunnel interface + + GIF (Generic InterFace) is a pseudo interface for configured + tunnel. Details are described in &man.gif.4;. Currently + + + + v6 in v6 + + + v6 in v4 + + + v4 in v6 + + + v4 in v4 + + + + are available. Use &man.gifconfig.8; to assign physical (outer) + source and destination address to gif interfaces. Configuration that + uses same address family for inner and outer IP header (v4 in v4, or + v6 in v6) is dangerous. It is very easy to configure interfaces and + routing tables to perform infinite level of tunneling. + Please be warned. + + gif can be configured to be ECN-friendly. See 23.5.4.5 for ECN-friendliness of + tunnels, and &man.gif.4; for how to configure. + + If you would like to configure an IPv4-in-IPv6 tunnel with gif + interface, read &man.gif.4; carefully. You will need to + remove IPv6 link-local address automatically assigned to the gif + interface. + + + + Source Address Selection + + Current source selection rule is scope oriented (there are some + exceptions - see below). For a given destination, a source IPv6 + address is selected by the following rule: + + + + If the source address is explicitly specified by + the user (e.g. via the advanced API), the specified address + is used. + + + + If there is an address assigned to the outgoing + interface (which is usually determined by looking up the + routing table) that has the same scope as the destination + address, the address is used. + + This is the most typical case. + + + + If there is no address that satisfies the above + condition, choose a global address assigned to one of + the interfaces on the sending node. + + + + If there is no address that satisfies the above condition, + and destination address is site local scope, choose a site local + address assigned to one of the interfaces on the sending node. + + + + + If there is no address that satisfies the above condition, + choose the address associated with the routing table entry for the + destination. This is the last resort, which may cause scope + violation. + + + + For instance, ::1 is selected for ff01::1, + fe80:1::200:f8ff:fe01:6317 for fe80:1::2a0:24ff:feab:839b (note + that embedded interface index - described in 23.5.1.3 - helps us + choose the right source address. Those embedded indices will not + be on the wire). If the outgoing interface has multiple address for + the scope, a source is selected longest match basis (rule 3). Suppose + 3ffe:501:808:1:200:f8ff:fe01:6317 and 3ffe:2001:9:124:200:f8ff:fe01:6317 + are given to the outgoing interface. 3ffe:501:808:1:200:f8ff:fe01:6317 + is chosen as the source for the destination 3ffe:501:800::1. + + Note that the above rule is not documented in the IPv6 spec. + It is considered "up to implementation" item. There are some cases + where we do not use the above rule. One example is connected TCP + session, and we use the address kept in tcb as the source. Another + example is source address for Neighbor Advertisement. Under the spec + (RFC2461 7.2.2) NA's source should be the target address of the + corresponding NS's target. In this case we follow the spec rather + than the above longest-match rule. + + For new connections (when rule 1 does not apply), deprecated + addresses (addresses with preferred lifetime = 0) will not be chosen + as source address if other choices are available. If no other choices + are available, deprecated address will be used as a last resort. If + there are multiple choice of deprecated addresses, the above scope + rule will be used to choose from those deprecated addresses. If you + would like to prohibit the use of deprecated address for some reason, + configure net.inet6.ip6.use_deprecated to 0. The issue related to + deprecated address is described in RFC2462 5.5.4 (NOTE: there is + some debate underway in IETF ipngwg on how to use "deprecated" + address). + + + + Jumbo Payload + + The Jumbo Payload hop-by-hop option is implemented and can + be used to send IPv6 packets with payloads longer than 65,535 octets. + But currently no physical interface whose MTU is more than 65,535 is + supported, so such payloads can be seen only on the loopback + interface (i.e. lo0). + + If you want to try jumbo payloads, you first have to reconfigure + the kernel so that the MTU of the loopback interface is more than + 65,535 bytes; add the following to the kernel configuration file: + + + options "LARGE_LOMTU" #To test jumbo payload + + + and recompile the new kernel. + + Then you can test jumbo payloads by the &man.ping6.8; command + with -b and -s options. The -b option must be specified to enlarge + the size of the socket buffer and the -s option specifies the length + of the packet, which should be more than 65,535. For example, + type as follows: + + &prompt.user; ping6 -b 70000 -s 68000 ::1 + + The IPv6 specification requires that the Jumbo Payload option + must not be used in a packet that carries a fragment header. If + this condition is broken, an ICMPv6 Parameter Problem message must + be sent to the sender. specification is followed, but you cannot + usually see an ICMPv6 error caused by this requirement. + + When an IPv6 packet is received, the frame length is checked and + compared to the length specified in the payload length field of the + IPv6 header or in the value of the Jumbo Payload option, if any. If + the former is shorter than the latter, the packet is discarded and + statistics are incremented. You can see the statistics as output of + &man.netstat.8; command with `-s -p ip6' option: + + &prompt.user; netstat -s -p ip6 + ip6: + (snip) + 1 with data size < data length + + So, kernel does not send an ICMPv6 error unless the erroneous + packet is an actual Jumbo Payload, that is, its packet size is more + than 65,535 bytes. As described above, currently no physical interface + with such a huge MTU is supported, so it rarely returns an + ICMPv6 error. + + TCP/UDP over jumbogram is not supported at this moment. This + is because we have no medium (other than loopback) to test this. + Contact us if you need this. + + IPsec does not work on jumbograms. This is due to some + specification twists in supporting AH with jumbograms (AH header + size influences payload length, and this makes it real hard to + authenticate inbound packet with jumbo payload option as well as AH). + + + There are fundamental issues in *BSD support for jumbograms. + We would like to address those, but we need more time to finalize + these. To name a few: + + + + mbuf pkthdr.len field is typed as "int" in 4.4BSD, so + it will not hold jumbogram with len > 2G on 32bit architecture + CPUs. If we would like to support jumbogram properly, the field + must be expanded to hold 4G + IPv6 header + link-layer header. + Therefore, it must be expanded to at least int64_t + (u_int32_t is NOT enough). + + + + We mistakingly use "int" to hold packet length in many + places. We need to convert them into larger integral type. + It needs a great care, as we may experience overflow during + packet length computation. + + + + We mistakingly check for ip6_plen field of IPv6 header + for packet payload length in various places. We should be + checking mbuf pkthdr.len instead. ip6_input() will perform + sanity check on jumbo payload option on input, and we can + safely use mbuf pkthdr.len afterwards. + + + + TCP code needs a careful update in bunch of places, of + course. + + + + + + Loop prevention in header processing + + IPv6 specification allows arbitrary number of extension headers + to be placed onto packets. If we implement IPv6 packet processing + code in the way BSD IPv4 code is implemented, kernel stack may + overflow due to long function call chain. sys/netinet6 code + is carefully designed to avoid kernel stack overflow. Because of + this, sys/netinet6 code defines its own protocol switch + structure, as "struct ip6protosw" (see + netinet6/ip6protosw.h). There is no such + update to IPv4 part (sys/netinet) for compatibility, but small + change is added to its pr_input() prototype. So "struct ipprotosw" + is also defined. Because of this, if you receive IPsec-over-IPv4 + packet with massive number of IPsec headers, kernel stack may blow + up. IPsec-over-IPv6 is okay. (Off-course, for those all IPsec + headers to be processed, each such IPsec header must pass each + IPsec check. So an anonymous attacker will not be able to do such an + attack.) + + + + ICMPv6 + + After RFC2463 was published, IETF ipngwg has decided to + disallow ICMPv6 error packet against ICMPv6 redirect, to prevent + ICMPv6 storm on a network medium. This is already implemented + into the kernel. + + + + Applications + + For userland programming, we support IPv6 socket API as + specified in RFC2553, RFC2292 and upcoming Internet drafts. + + TCP/UDP over IPv6 is available and quite stable. You can + enjoy &man.telnet.1;, &man.ftp.1;, &man.rlogin.1;, &man.rsh.1;, + &man.ssh.1;, etc. These applications are protocol independent. + That is, they automatically chooses IPv4 or IPv6 according to DNS. + + + + + Kernel Internals + + While ip_forward() calls ip_output(), ip6_forward() directly + calls if_output() since routers must not divide IPv6 packets into + fragments. + + ICMPv6 should contain the original packet as long as possible + up to 1280. UDP6/IP6 port unreach, for instance, should contain + all extension headers and the *unchanged* UDP6 and IP6 headers. + So, all IP6 functions except TCP never convert network byte + order into host byte order, to save the original packet. + + tcp_input(), udp6_input() and icmp6_input() can not assume that + IP6 header is preceding the transport headers due to extension + headers. So, in6_cksum() was implemented to handle packets whose IP6 + header and transport header is not continuous. TCP/IP6 nor UDP6/IP6 + header structures do not exist for checksum calculation. + + To process IP6 header, extension headers and transport headers + easily, network drivers are now required to store packets in one + internal mbuf or one or more external mbufs. A typical old driver + prepares two internal mbufs for 96 - 204 bytes data, however, now + such packet data is stored in one external mbuf. + + netstat -s -p ip6 tells you whether or not + your driver conforms such requirement. In the following example, + "cce0" violates the requirement. (For more information, refer to + Section 2.) + + Mbuf statistics: + 317 one mbuf + two or more mbuf:: + lo0 = 8 + cce0 = 10 + 3282 one ext mbuf + 0 two or more ext mbuf + + + Each input function calls IP6_EXTHDR_CHECK in the beginning to + check if the region between IP6 and its header is continuous. + IP6_EXTHDR_CHECK calls m_pullup() only if the mbuf has M_LOOP flag, + that is, the packet comes from the loopback interface. m_pullup() + is never called for packets coming from physical network interfaces. + + + Both IP and IP6 reassemble functions never call m_pullup(). + + + + IPv4 mapped address and IPv6 wildcard socket + + RFC2553 describes IPv4 mapped address (3.7) and special behavior + of IPv6 wildcard bind socket (3.8). The spec allows you to: + + + Accept IPv4 connections by AF_INET6 wildcard bind + socket. + + + Transmit IPv4 packet over AF_INET6 socket by using + special form of the address like ::ffff:10.1.1.1. + + + + but the spec itself is very complicated and does not specify + how the socket layer should behave. Here we call the former one + "listening side" and the latter one "initiating side", for + reference purposes. + + You can perform wildcard bind on both of the address families, + on the same port. + + The following table show the behavior of FreeBSD 4.x. + + listening side initiating side + (AF_INET6 wildcard (connection to ::ffff:10.1.1.1) + socket gets IPv4 conn.) + --- --- +FreeBSD 4.x configurable supported + default: enabled + + + The following sections will give you more details, and how you can + configure the behavior. + + Comments on listening side: + + It looks that RFC2553 talks too little on wildcard bind issue, + especially on the port space issue, failure mode and relationship + between AF_INET/INET6 wildcard bind. There can be several separate + interpretation for this RFC which conform to it but behaves differently. + So, to implement portable application you should assume nothing + about the behavior in the kernel. Using &man.getaddrinfo.3; is the + safest way. Port number space and wildcard bind issues were discussed + in detail on ipv6imp mailing list, in mid March 1999 and it looks + that there is no concrete consensus (means, up to implementers). + You may want to check the mailing list archives. + + If a server application would like to accept IPv4 and IPv6 + connections, there will be two alternatives. + + One is using AF_INET and AF_INET6 socket (you will need two + sockets). Use &man.getaddrinfo.3; with AI_PASSIVE into ai_flags, + and &man.socket.2; and &man.bind.2; to all the addresses returned. + By opening multiple sockets, you can accept connections onto the + socket with proper address family. IPv4 connections will be + accepted by AF_INET socket, and IPv6 connections will be accepted + by AF_INET6 socket. + + Another way is using one AF_INET6 wildcard bind socket. Use + &man.getaddrinfo.3; with AI_PASSIVE into ai_flags and with + AF_INET6 into ai_family, and set the 1st argument hostname to + NULL. And &man.socket.2; and &man.bind.2; to the address returned. + (should be IPv6 unspecified addr). You can accept either of IPv4 + and IPv6 packet via this one socket. + + To support only IPv6 traffic on AF_INET6 wildcard binded socket + portably, always check the peer address when a connection is made + toward AF_INET6 listening socket. If the address is IPv4 mapped + address, you may want to reject the connection. You can check the + condition by using IN6_IS_ADDR_V4MAPPED() macro. + + To resolve this issue more easily, there is system dependent + &man.setsockopt.2; option, IPV6_BINDV6ONLY, used like below. + + int on; + + setsockopt(s, IPPROTO_IPV6, IPV6_BINDV6ONLY, + (char *)&on, sizeof (on)) < 0)); + + + When this call succeed, then this socket only receive IPv6 + packets. + + Comments on initiating side: + + Advise to application implementers: to implement a portable + IPv6 application (which works on multiple IPv6 kernels), we believe + that the following is the key to the success: + + + + NEVER hardcode AF_INET nor AF_INET6. + + + + Use &man.getaddrinfo.3; and &man.getnameinfo.3; + throughout the system. Never use gethostby*(), getaddrby*(), + inet_*() or getipnodeby*(). (To update existing applications + to be IPv6 aware easily, sometime getipnodeby*() will be + useful. But if possible, try to rewrite the code to use + &man.getaddrinfo.3; and &man.getnameinfo.3;.) + + + + If you would like to connect to destination, use + &man.getaddrinfo.3; and try all the destination returned, + like &man.telnet.1; does. + + + + Some of the IPv6 stack is shipped with buggy + &man.getaddrinfo.3;. Ship a minimal working version with + your application and use that as last resort. + + + + If you would like to use AF_INET6 socket for both IPv4 and + IPv6 outgoing connection, you will need to use &man.getipnodebyname.3;. + When you would like to update your existing application to be IPv6 + aware with minimal effort, this approach might be chosen. But please + note that it is a temporal solution, because &man.getipnodebyname.3; + itself is not recommended as it does not handle scoped IPv6 addresses + at all. For IPv6 name resolution, &man.getaddrinfo.3; is the + preferred API. So you should rewrite your application to use + &man.getaddrinfo.3;, when you get the time to do it. + + When writing applications that make outgoing connections, + story goes much simpler if you treat AF_INET and AF_INET6 as totally + separate address family. {set,get}sockopt issue goes simpler, + DNS issue will be made simpler. We do not recommend you to rely + upon IPv4 mapped address. + + + unified tcp and inpcb code + + FreeBSD 4.x uses shared tcp code between IPv4 and IPv6 + (from sys/netinet/tcp*) and separate udp4/6 code. It uses + unified inpcb structure. + + The platform can be configured to support IPv4 mapped address. + Kernel configuration is summarized as follows: + + + + By default, AF_INET6 socket will grab IPv4 + connections in certain condition, and can initiate + connection to IPv4 destination embedded in IPv4 mapped + IPv6 address. + + + + You can disable it on entire system with sysctl like + below. + + + sysctl net.inet6.ip6.mapped_addr=0 + + + + + + + listening side + + Each socket can be configured to support special AF_INET6 + wildcard bind (enabled by default). You can disable it on + each socket basis with &man.setsockopt.2; like below. + + int on; + + setsockopt(s, IPPROTO_IPV6, IPV6_BINDV6ONLY, + (char *)&on, sizeof (on)) < 0)); + + + Wildcard AF_INET6 socket grabs IPv4 connection if and only + if the following conditions are satisfied: + + + + there is no AF_INET socket that matches the IPv4 + connection + + + + the AF_INET6 socket is configured to accept IPv4 + traffic, i.e. getsockopt(IPV6_BINDV6ONLY) returns 0. + + + + There is no problem with open/close ordering. + + + + initiating side + + FreeBSD 4.x supports outgoing connection to IPv4 mapped + address (::ffff:10.1.1.1), if the node is configured to support + IPv4 mapped address. + + + + + + sockaddr_storage + + When RFC2553 was about to be finalized, there was discussion on + how struct sockaddr_storage members are named. One proposal is to + prepend "__" to the members (like "__ss_len") as they should not be + touched. The other proposal was not to prepend it (like "ss_len") + as we need to touch those members directly. There was no clear + consensus on it. + + As a result, RFC2553 defines struct sockaddr_storage as + follows: + + struct sockaddr_storage { + u_char __ss_len; /* address length */ + u_char __ss_family; /* address family */ + /* and bunch of padding */ + }; + + + On the contrary, XNET draft defines as follows: + + struct sockaddr_storage { + u_char ss_len; /* address length */ + u_char ss_family; /* address family */ + /* and bunch of padding */ + }; + + + In December 1999, it was agreed that RFC2553bis should pick + the latter (XNET) definition. + + Current implementation conforms to XNET definition, based on + RFC2553bis discussion. + + If you look at multiple IPv6 implementations, you will be able + to see both definitions. As an userland programmer, the most + portable way of dealing with it is to: + + + + ensure ss_family and/or ss_len are available on the + platform, by using GNU autoconf, + + + + have -Dss_family=__ss_family to unify all occurrences + (including header file) into __ss_family, or + + + + never touch __ss_family. cast to sockaddr * and use sa_family + like: + + struct sockaddr_storage ss; + family = ((struct sockaddr *)&ss)->sa_family + + + + + + + + + Network Drivers + + Now following two items are required to be supported by standard + drivers: + + + + mbuf clustering requirement. In this stable release, we + changed MINCLSIZE into MHLEN+1 for all the operating systems + in order to make all the drivers behave as we expect. + + + + multicast. If &man.ifmcstat.8; yields no multicast group for + a interface, that interface has to be patched. + + + + If any of the drivers do not support the requirements, then + the drivers can not be used for IPv6 and/or IPsec communication. If + you find any problem with your card using IPv6/IPsec, then, please + report it to the &a.bugs;. + + (NOTE: In the past we required all PCMCIA drivers to have a + call to in6_ifattach(). We have no such requirement any more) + + + + Translator + + We categorize IPv4/IPv6 translator into 4 types: + + + + Translator A --- It is used in the early + stage of transition to make it possible to establish a + connection from an IPv6 host in an IPv6 island to an IPv4 host + in the IPv4 ocean. + + + + Translator B --- It is used in the early + stage of transition to make it possible to establish a connection + from an IPv4 host in the IPv4 ocean to an IPv6 host in an + IPv6 island. + + + + Translator C --- It is used in the late + stage of transition to make it possible to establish a + connection from an IPv4 host in an IPv4 island to an IPv6 host + in the IPv6 ocean. + + + + Translator D --- It is used in the late + stage of transition to make it possible to establish a + connection from an IPv6 host in the IPv6 ocean to an IPv4 host + in an IPv4 island. + + + + TCP relay translator for category A is supported. This is called + "FAITH". We also provide IP header translator for category A. + (The latter is not yet put into FreeBSD 4.x yet.) + + + FAITH TCP relay translator + + FAITH system uses TCP relay daemon called &man.faithd.8; helped + by the kernel. FAITH will reserve an IPv6 address prefix, and relay + TCP connection toward that prefix to IPv4 destination. + + For example, if the reserved IPv6 prefix is + 3ffe:0501:0200:ffff::, and the IPv6 destination for TCP connection + is 3ffe:0501:0200:ffff::163.221.202.12, the connection will be + relayed toward IPv4 destination 163.221.202.12. + + destination IPv4 node (163.221.202.12) + ^ + | IPv4 tcp toward 163.221.202.12 + FAITH-relay dual stack node + ^ + | IPv6 TCP toward 3ffe:0501:0200:ffff::163.221.202.12 + source IPv6 node + + + &man.faithd.8; must be invoked on FAITH-relay dual stack + node. + + For more details, consult + src/usr.sbin/faithd/README + + + + + IPsec + + IPsec is mainly organized by three components. + + + + Policy Management + + + + Key Management + + + + AH and ESP handling + + + + + Policy Management + + The kernel implements experimental policy management code. + There are two way to manage security policy. One is to configure + per-socket policy using &man.setsockopt.2;. In this cases, policy + configuration is described in &man.ipsec.set.policy.3;. The other + is to configure kernel packet filter-based policy using PF_KEY + interface, via &man.setkey.8;. + + The policy entry is not re-ordered with its + indexes, so the order of entry when you add is very significant. + + + + Key Management + + The key management code implemented in this kit (sys/netkey) + is a home-brew PFKEY v2 implementation. This conforms to RFC2367. + + + The home-brew IKE daemon, "racoon" is included in the + kit (kame/kame/racoon). Basically you will need to run racoon as + daemon, then set up a policy to require keys (like + ping -P 'out ipsec esp/transport//use'). + The kernel will contact racoon daemon as necessary to exchange + keys. + + + + AH and ESP handling + + IPsec module is implemented as "hooks" to the standard IPv4/IPv6 + processing. When sending a packet, ip{,6}_output() checks if ESP/AH + processing is required by checking if a matching SPD (Security + Policy Database) is found. If ESP/AH is needed, + {esp,ah}{4,6}_output() will be called and mbuf will be updated + accordingly. When a packet is received, {esp,ah}4_input() will be + called based on protocol number, i.e. (*inetsw[proto])(). + {esp,ah}4_input() will decrypt/check authenticity of the packet, + and strips off daisy-chained header and padding for ESP/AH. It is + safe to strip off the ESP/AH header on packet reception, since we + will never use the received packet in "as is" form. + + By using ESP/AH, TCP4/6 effective data segment size will be + affected by extra daisy-chained headers inserted by ESP/AH. Our + code takes care of the case. + + Basic crypto functions can be found in directory "sys/crypto". + ESP/AH transform are listed in {esp,ah}_core.c with wrapper functions. + If you wish to add some algorithm, add wrapper function in + {esp,ah}_core.c, and add your crypto algorithm code into + sys/crypto. + + Tunnel mode is partially supported in this release, with the + following restrictions: + + + + IPsec tunnel is not combined with GIF generic tunneling + interface. It needs a great care because we may create an + infinite loop between ip_output() and tunnelifp->if_output(). + Opinion varies if it is better to unify them, or not. + + + + MTU and Don't Fragment bit (IPv4) considerations need more + checking, but basically works fine. + + + + Authentication model for AH tunnel must be revisited. + We will need to improve the policy management engine, + eventually. + + + + + + Conformance to RFCs and IDs + + The IPsec code in the kernel conforms (or, tries to conform) + to the following standards: + + "old IPsec" specification documented in + rfc182[5-9].txt + + "new IPsec" specification documented in + rfc240[1-6].txt, + rfc241[01].txt, rfc2451.txt + and draft-mcdonald-simple-ipsec-api-01.txt + (draft expired, but you can take from + ftp://ftp.kame.net/pub/internet-drafts/). + (NOTE: IKE specifications, rfc241[7-9].txt are + implemented in userland, as "racoon" IKE daemon) + + Currently supported algorithms are: + + + old IPsec AH + + + null crypto checksum (no document, just for + debugging) + + + keyed MD5 with 128bit crypto checksum + (rfc1828.txt) + + + keyed SHA1 with 128bit crypto checksum + (no document) + + + HMAC MD5 with 128bit crypto checksum + (rfc2085.txt) + + + HMAC SHA1 with 128bit crypto checksum + (no document) + + + + + + old IPsec ESP + + + null encryption (no document, similar to + rfc2410.txt) + + + DES-CBC mode (rfc1829.txt) + + + + + + new IPsec AH + + + null crypto checksum (no document, + just for debugging) + + + keyed MD5 with 96bit crypto checksum + (no document) + + + keyed SHA1 with 96bit crypto checksum + (no document) + + + HMAC MD5 with 96bit crypto checksum + (rfc2403.txt) + + + HMAC SHA1 with 96bit crypto checksum + (rfc2404.txt) + + + + + + new IPsec ESP + + + null encryption + (rfc2410.txt) + + + DES-CBC with derived IV + (draft-ietf-ipsec-ciph-des-derived-01.txt, + draft expired) + + + DES-CBC with explicit IV + (rfc2405.txt) + + + 3DES-CBC with explicit IV + (rfc2451.txt) + + + BLOWFISH CBC + (rfc2451.txt) + + + CAST128 CBC + (rfc2451.txt) + + + RC5 CBC + (rfc2451.txt) + + + each of the above can be combined with: + + + ESP authentication with HMAC-MD5(96bit) + + + ESP authentication with HMAC-SHA1(96bit) + + + + + + + + The following algorithms are NOT supported: + + + + old IPsec AH + + + + HMAC MD5 with 128bit crypto checksum + 64bit + replay prevention (rfc2085.txt) + + + keyed SHA1 with 160bit crypto checksum + 32bit padding + (rfc1852.txt) + + + + + + + IPsec (in kernel) and IKE (in userland as "racoon") has been + tested at several interoperability test events, and it is known to + interoperate with many other implementations well. Also, current + IPsec implementation as quite wide coverage for IPsec crypto + algorithms documented in RFC (we cover algorithms without intellectual + property issues only). + + + + ECN consideration on IPsec tunnels + + ECN-friendly IPsec tunnel is supported as described in + draft-ipsec-ecn-00.txt. + + Normal IPsec tunnel is described in RFC2401. On encapsulation, + IPv4 TOS field (or, IPv6 traffic class field) will be copied from inner + IP header to outer IP header. On decapsulation outer IP header + will be simply dropped. The decapsulation rule is not compatible + with ECN, since ECN bit on the outer IP TOS/traffic class field will be + lost. + + To make IPsec tunnel ECN-friendly, we should modify encapsulation + and decapsulation procedure. This is described in + http://www.aciri.org/floyd/papers/draft-ipsec-ecn-00.txt, + chapter 3. + + IPsec tunnel implementation can give you three behaviors, by + setting net.inet.ipsec.ecn (or net.inet6.ipsec6.ecn) to some + value: + + + + RFC2401: no consideration for ECN (sysctl value -1) + + + ECN forbidden (sysctl value 0) + + + ECN allowed (sysctl value 1) + + + + Note that the behavior is configurable in per-node manner, + not per-SA manner (draft-ipsec-ecn-00 wants per-SA configuration, + but it looks too much for me). + + The behavior is summarized as follows (see source code for + more detail): + + + encapsulate decapsulate + --- --- +RFC2401 copy all TOS bits drop TOS bits on outer + from inner to outer. (use inner TOS bits as is) + +ECN forbidden copy TOS bits except for ECN drop TOS bits on outer + (masked with 0xfc) from inner (use inner TOS bits as is) + to outer. set ECN bits to 0. + +ECN allowed copy TOS bits except for ECN use inner TOS bits with some + CE (masked with 0xfe) from change. if outer ECN CE bit + inner to outer. is 1, enable ECN CE bit on + set ECN CE bit to 0. the inner. + + + + General strategy for configuration is as follows: + + + if both IPsec tunnel endpoint are capable of ECN-friendly + behavior, you should better configure both end to ECN allowed + (sysctl value 1). + + + if the other end is very strict about TOS bit, use "RFC2401" + (sysctl value -1). + + + in other cases, use "ECN forbidden" (sysctl value 0). + + + + The default behavior is "ECN forbidden" (sysctl value 0). + + For more information, please refer to: + + + http://www.aciri.org/floyd/papers/draft-ipsec-ecn-00.txt, + RFC2481 (Explicit Congestion Notification), + src/sys/netinet6/{ah,esp}_input.c + + (Thanks goes to Kenjiro Cho kjc@csl.sony.co.jp + for detailed analysis) + + + + Interoperability + + Here are (some of) platforms that KAME code have tested + IPsec/IKE interoperability in the past. Note that both ends may + have modified their implementation, so use the following list just + for reference purposes. + + Altiga, Ashley-laurent (vpcom.com), Data Fellows (F-Secure), + Ericsson ACC, FreeS/WAN, HITACHI, IBM &aix;, IIJ, Intel, + µsoft; &windowsnt;, NIST (linux IPsec + plutoplus), Netscreen, OpenBSD, + RedCreek, Routerware, SSH, Secure Computing, Soliton, Toshiba, + VPNet, Yamaha RT100i + + + + + + diff --git a/zh_TW.Big5/books/developers-handbook/kerneldebug/Makefile b/zh_TW.Big5/books/developers-handbook/kerneldebug/Makefile new file mode 100644 index 0000000000..a6d190e942 --- /dev/null +++ b/zh_TW.Big5/books/developers-handbook/kerneldebug/Makefile @@ -0,0 +1,15 @@ +# +# Build the Handbook with just the content from this chapter. +# +# $FreeBSD$ +# + +CHAPTERS= kerneldebug/chapter.sgml + +VPATH= .. + +MASTERDOC= ${.CURDIR}/../${DOC}.${DOCBOOKSUFFIX} + +DOC_PREFIX?= ${.CURDIR}/../../../.. + +.include "../Makefile" diff --git a/zh_TW.Big5/books/developers-handbook/kerneldebug/chapter.sgml b/zh_TW.Big5/books/developers-handbook/kerneldebug/chapter.sgml new file mode 100644 index 0000000000..80699108bd --- /dev/null +++ b/zh_TW.Big5/books/developers-handbook/kerneldebug/chapter.sgml @@ -0,0 +1,868 @@ + + + + + + + Paul + Richards + Contributed by + + + Jörg + Wunsch + + + + + Kernel Debugging + + + Obtaining a Kernel Crash Dump + + When running a development kernel (eg: &os.current;), such as a + kernel under extreme conditions (eg: very high load averages, + tens of thousands of connections, exceedingly high number of + concurrent users, hundreds of &man.jail.8;s, etc.), or using a + new feature or device driver on &os.stable; (eg: + PAE), sometimes a kernel will panic. In the + event that it does, this chapter will demonstrate how to extract + useful information out of a crash. + + A system reboot is inevitable once a kernel panics. Once a + system is rebooted, the contents of a system's physical memory + (RAM) is lost, as well as any bits that are + on the swap device before the panic. To preserve the bits in + physical memory, the kernel makes use of the swap device as a + temporary place to store the bits that are in RAM across a + reboot after a crash. In doing this, when &os; boots after a + crash, a kernel image can now be extracted and debugging can + take place. + + A swap device that has been configured as a dump + device still acts as a swap device. Dumps to non-swap devices + (such as tapes or CDRWs, for example) are not supported at this time. A + swap device is synonymous with a swap + partition. + + To be able to extract a usable core, it is required that at + least one swap partition be large enough to hold all of the bits + in physical memory. When a kernel panics, before the system + reboots, the kernel is smart enough to check to see if a swap + device has been configured as a dump device. If there is a + valid dump device, the kernel dumps the contents of what is in + physical memory to the swap device. + + + Configuring the Dump Device + + Before the kernel will dump the contents of its physical + memory to a dump device, a dump device must be configured. A + dump device is specified by using the &man.dumpon.8; command + to tell the kernel where to save kernel crash dumps. The + &man.dumpon.8; program must be called after the swap partition + has been configured with &man.swapon.8;. This is normally + handled by setting the dumpdev variable in + &man.rc.conf.5; to the path of the swap device (the + recommended way to extract a kernel dump). + + Alternatively, the dump device can be hard-coded via the + dump clause in the &man.config.5; line of + a kernel configuration file. This approach is deprecated and should + be used only if a kernel is crashing before &man.dumpon.8; can be executed. + + Check /etc/fstab or + &man.swapinfo.8; for a list of swap devices. + + Make sure the dumpdir + specified in &man.rc.conf.5; exists before a kernel + crash! + + &prompt.root; mkdir /var/crash +&prompt.root; chmod 700 /var/crash + + Also, remember that the contents of + /var/crash is sensitive and very likely + contains confidential information such as passwords. + + + + + Extracting a Kernel Dump + + Once a dump has been written to a dump device, the dump + must be extracted before the swap device is mounted. + To extract a dump + from a dump device, use the &man.savecore.8; program. If + dumpdev has been set in &man.rc.conf.5;, + &man.savecore.8; will be called automatically on the first + multi-user boot after the crash and before the swap device + is mounted. The location of the extracted core is placed in + the &man.rc.conf.5; value dumpdir, by + default /var/crash and will be named + vmcore.0. + + In the event that there is already a file called + vmcore.0 in + /var/crash (or whatever + dumpdir is set to), the kernel will + increment the trailing number for every crash to avoid + overwriting an existing vmcore (eg: + vmcore.1). While debugging, it is + highly likely that you will want to use the highest version + vmcore in + /var/crash when searching for the right + vmcore. + + + If you are testing a new kernel but need to boot a different one in + order to get your system up and running again, boot it only into single + user mode using the flag at the boot prompt, and + then perform the following steps: + + &prompt.root; fsck -p +&prompt.root; mount -a -t ufs # make sure /var/crash is writable +&prompt.root; savecore /var/crash /dev/ad0s1b +&prompt.root; exit # exit to multi-user + + This instructs &man.savecore.8; to extract a kernel dump + from /dev/ad0s1b and place the contents in + /var/crash. Do not forget to make sure the + destination directory /var/crash has enough + space for the dump. Also, do not forget to specify the correct path to your swap + device as it is likely different than + /dev/ad0s1b! + + The recommended, and certainly the easiest way to automate + obtaining crash dumps is to use the dumpdev + variable in &man.rc.conf.5;. + + + + + Debugging a Kernel Crash Dump with <command>kgdb</command> + + + This section covers &man.kgdb.1; as found in &os; 5.3 + and later. In previous versions, one must use + gdb -k to read a core dump file. + + + Once a dump has been obtained, getting useful information + out of the dump is relatively easy for simple problems. Before + launching into the internals of &man.kgdb.1; to debug + the crash dump, locate the debug version of your kernel + (normally called kernel.debug) and the path + to the source files used to build your kernel (normally + /usr/obj/usr/src/sys/KERNCONF, + where KERNCONF + is the ident specified in a kernel + &man.config.5;). With those two pieces of info, let the + debugging commence! + + To enter into the debugger and begin getting information + from the dump, the following steps are required at a minimum: + + &prompt.root; cd /usr/obj/usr/src/sys/KERNCONF +&prompt.root; kgdb kernel.debug /var/crash/vmcore.0 + + You can debug the crash dump using the kernel sources just like + you can for any other program. + + This first dump is from a 5.2-BETA kernel and the crash + comes from deep within the kernel. The output below has been + modified to include line numbers on the left. This first trace + inspects the instruction pointer and obtains a back trace. The + address that is used on line 41 for the list + command is the instruction pointer and can be found on line + 17. Most developers will request having at least this + information sent to them if you are unable to debug the problem + yourself. If, however, you do solve the problem, make sure that + your patch winds its way into the source tree via a problem + report, mailing lists, or by being able to commit it! + + 1:&prompt.root; cd /usr/obj/usr/src/sys/KERNCONF + 2:&prompt.root; kgdb kernel.debug /var/crash/vmcore.0 + 3:GNU gdb 5.2.1 (FreeBSD) + 4:Copyright 2002 Free Software Foundation, Inc. + 5:GDB is free software, covered by the GNU General Public License, and you are + 6:welcome to change it and/or distribute copies of it under certain conditions. + 7:Type "show copying" to see the conditions. + 8:There is absolutely no warranty for GDB. Type "show warranty" for details. + 9:This GDB was configured as "i386-undermydesk-freebsd"... +10:panic: page fault +11:panic messages: +12:--- +13:Fatal trap 12: page fault while in kernel mode +14:cpuid = 0; apic id = 00 +15:fault virtual address = 0x300 +16:fault code: = supervisor read, page not present +17:instruction pointer = 0x8:0xc0713860 +18:stack pointer = 0x10:0xdc1d0b70 +19:frame pointer = 0x10:0xdc1d0b7c +20:code segment = base 0x0, limit 0xfffff, type 0x1b +21: = DPL 0, pres 1, def32 1, gran 1 +22:processor eflags = resume, IOPL = 0 +23:current process = 14394 (uname) +24:trap number = 12 +25:panic: page fault +26 cpuid = 0; +27:Stack backtrace: +28 +29:syncing disks, buffers remaining... 2199 2199 panic: mi_switch: switch in a critical section +30:cpuid = 0; +31:Uptime: 2h43m19s +32:Dumping 255 MB +33: 16 32 48 64 80 96 112 128 144 160 176 192 208 224 240 +34:--- +35:Reading symbols from /boot/kernel/snd_maestro3.ko...done. +36:Loaded symbols for /boot/kernel/snd_maestro3.ko +37:Reading symbols from /boot/kernel/snd_pcm.ko...done. +38:Loaded symbols for /boot/kernel/snd_pcm.ko +39:#0 doadump () at /usr/src/sys/kern/kern_shutdown.c:240 +40:240 dumping++; +41:(kgdb) list *0xc0713860 +42:0xc0713860 is in lapic_ipi_wait (/usr/src/sys/i386/i386/local_apic.c:663). +43:658 incr = 0; +44:659 delay = 1; +45:660 } else +46:661 incr = 1; +47:662 for (x = 0; x < delay; x += incr) { +48:663 if ((lapic->icr_lo & APIC_DELSTAT_MASK) == APIC_DELSTAT_IDLE) +49:664 return (1); +50:665 ia32_pause(); +51:666 } +52:667 return (0); +53:(kgdb) backtrace +54:#0 doadump () at /usr/src/sys/kern/kern_shutdown.c:240 +55:#1 0xc055fd9b in boot (howto=260) at /usr/src/sys/kern/kern_shutdown.c:372 +56:#2 0xc056019d in panic () at /usr/src/sys/kern/kern_shutdown.c:550 +57:#3 0xc0567ef5 in mi_switch () at /usr/src/sys/kern/kern_synch.c:470 +58:#4 0xc055fa87 in boot (howto=256) at /usr/src/sys/kern/kern_shutdown.c:312 +59:#5 0xc056019d in panic () at /usr/src/sys/kern/kern_shutdown.c:550 +60:#6 0xc0720c66 in trap_fatal (frame=0xdc1d0b30, eva=0) +61: at /usr/src/sys/i386/i386/trap.c:821 +62:#7 0xc07202b3 in trap (frame= +63: {tf_fs = -1065484264, tf_es = -1065484272, tf_ds = -1065484272, tf_edi = 1, tf_esi = 0, tf_ebp = -602076292, tf_isp = -602076324, tf_ebx = 0, tf_edx = 0, tf_ecx = 1000000, tf_eax = 243, tf_trapno = 12, tf_err = 0, tf_eip = -1066321824, tf_cs = 8, tf_eflags = 65671, tf_esp = 243, tf_ss = 0}) +64: at /usr/src/sys/i386/i386/trap.c:250 +65:#8 0xc070c9f8 in calltrap () at {standard input}:94 +66:#9 0xc07139f3 in lapic_ipi_vectored (vector=0, dest=0) +67: at /usr/src/sys/i386/i386/local_apic.c:733 +68:#10 0xc0718b23 in ipi_selected (cpus=1, ipi=1) +69: at /usr/src/sys/i386/i386/mp_machdep.c:1115 +70:#11 0xc057473e in kseq_notify (ke=0xcc05e360, cpu=0) +71: at /usr/src/sys/kern/sched_ule.c:520 +72:#12 0xc0575cad in sched_add (td=0xcbcf5c80) +73: at /usr/src/sys/kern/sched_ule.c:1366 +74:#13 0xc05666c6 in setrunqueue (td=0xcc05e360) +75: at /usr/src/sys/kern/kern_switch.c:422 +76:#14 0xc05752f4 in sched_wakeup (td=0xcbcf5c80) +77: at /usr/src/sys/kern/sched_ule.c:999 +78:#15 0xc056816c in setrunnable (td=0xcbcf5c80) +79: at /usr/src/sys/kern/kern_synch.c:570 +80:#16 0xc0567d53 in wakeup (ident=0xcbcf5c80) +81: at /usr/src/sys/kern/kern_synch.c:411 +82:#17 0xc05490a8 in exit1 (td=0xcbcf5b40, rv=0) +83: at /usr/src/sys/kern/kern_exit.c:509 +84:#18 0xc0548011 in sys_exit () at /usr/src/sys/kern/kern_exit.c:102 +85:#19 0xc0720fd0 in syscall (frame= +86: {tf_fs = 47, tf_es = 47, tf_ds = 47, tf_edi = 0, tf_esi = -1, tf_ebp = -1077940712, tf_isp = -602075788, tf_ebx = 672411944, tf_edx = 10, tf_ecx = 672411600, tf_eax = 1, tf_trapno = 12, tf_err = 2, tf_eip = 671899563, tf_cs = 31, tf_eflags = 642, tf_esp = -1077940740, tf_ss = 47}) +87: at /usr/src/sys/i386/i386/trap.c:1010 +88:#20 0xc070ca4d in Xint0x80_syscall () at {standard input}:136 +89:---Can't read userspace from dump, or kernel process--- +90:(kgdb) quit + + + This next trace is an older dump from the FreeBSD 2 time + frame, but is more involved and demonstrates more of the + features of gdb. Long lines have been folded + to improve readability, and the lines are numbered for + reference. Despite this, it is a real-world error trace taken + during the development of the pcvt console driver. + + 1:Script started on Fri Dec 30 23:15:22 1994 + 2:&prompt.root; cd /sys/compile/URIAH + 3:&prompt.root; gdb -k kernel /var/crash/vmcore.1 + 4:Reading symbol data from /usr/src/sys/compile/URIAH/kernel +...done. + 5:IdlePTD 1f3000 + 6:panic: because you said to! + 7:current pcb at 1e3f70 + 8:Reading in symbols for ../../i386/i386/machdep.c...done. + 9:(kgdb) backtrace +10:#0 boot (arghowto=256) (../../i386/i386/machdep.c line 767) +11:#1 0xf0115159 in panic () +12:#2 0xf01955bd in diediedie () (../../i386/i386/machdep.c line 698) +13:#3 0xf010185e in db_fncall () +14:#4 0xf0101586 in db_command (-266509132, -266509516, -267381073) +15:#5 0xf0101711 in db_command_loop () +16:#6 0xf01040a0 in db_trap () +17:#7 0xf0192976 in kdb_trap (12, 0, -272630436, -266743723) +18:#8 0xf019d2eb in trap_fatal (...) +19:#9 0xf019ce60 in trap_pfault (...) +20:#10 0xf019cb2f in trap (...) +21:#11 0xf01932a1 in exception:calltrap () +22:#12 0xf0191503 in cnopen (...) +23:#13 0xf0132c34 in spec_open () +24:#14 0xf012d014 in vn_open () +25:#15 0xf012a183 in open () +26:#16 0xf019d4eb in syscall (...) +27:(kgdb) up 10 +28:Reading in symbols for ../../i386/i386/trap.c...done. +29:#10 0xf019cb2f in trap (frame={tf_es = -260440048, tf_ds = 16, tf_\ +30:edi = 3072, tf_esi = -266445372, tf_ebp = -272630356, tf_isp = -27\ +31:2630396, tf_ebx = -266427884, tf_edx = 12, tf_ecx = -266427884, tf\ +32:_eax = 64772224, tf_trapno = 12, tf_err = -272695296, tf_eip = -26\ +33:6672343, tf_cs = -266469368, tf_eflags = 66066, tf_esp = 3072, tf_\ +34:ss = -266427884}) (../../i386/i386/trap.c line 283) +35:283 (void) trap_pfault(&frame, FALSE); +36:(kgdb) frame frame->tf_ebp frame->tf_eip +37:Reading in symbols for ../../i386/isa/pcvt/pcvt_drv.c...done. +38:#0 0xf01ae729 in pcopen (dev=3072, flag=3, mode=8192, p=(struct p\ +39:roc *) 0xf07c0c00) (../../i386/isa/pcvt/pcvt_drv.c line 403) +40:403 return ((*linesw[tp->t_line].l_open)(dev, tp)); +41:(kgdb) list +42:398 +43:399 tp->t_state |= TS_CARR_ON; +44:400 tp->t_cflag |= CLOCAL; /* cannot be a modem (:-) */ +45:401 +46:402 #if PCVT_NETBSD || (PCVT_FREEBSD >= 200) +47:403 return ((*linesw[tp->t_line].l_open)(dev, tp)); +48:404 #else +49:405 return ((*linesw[tp->t_line].l_open)(dev, tp, flag)); +50:406 #endif /* PCVT_NETBSD || (PCVT_FREEBSD >= 200) */ +51:407 } +52:(kgdb) print tp +53:Reading in symbols for ../../i386/i386/cons.c...done. +54:$1 = (struct tty *) 0x1bae +55:(kgdb) print tp->t_line +56:$2 = 1767990816 +57:(kgdb) up +58:#1 0xf0191503 in cnopen (dev=0x00000000, flag=3, mode=8192, p=(st\ +59:ruct proc *) 0xf07c0c00) (../../i386/i386/cons.c line 126) +60: return ((*cdevsw[major(dev)].d_open)(dev, flag, mode, p)); +61:(kgdb) up +62:#2 0xf0132c34 in spec_open () +63:(kgdb) up +64:#3 0xf012d014 in vn_open () +65:(kgdb) up +66:#4 0xf012a183 in open () +67:(kgdb) up +68:#5 0xf019d4eb in syscall (frame={tf_es = 39, tf_ds = 39, tf_edi =\ +69: 2158592, tf_esi = 0, tf_ebp = -272638436, tf_isp = -272629788, tf\ +70:_ebx = 7086, tf_edx = 1, tf_ecx = 0, tf_eax = 5, tf_trapno = 582, \ +71:tf_err = 582, tf_eip = 75749, tf_cs = 31, tf_eflags = 582, tf_esp \ +72:= -272638456, tf_ss = 39}) (../../i386/i386/trap.c line 673) +73:673 error = (*callp->sy_call)(p, args, rval); +74:(kgdb) up +75:Initial frame selected; you cannot go up. +76:(kgdb) quit + Comments to the above script: + + + + line 6: + + + This is a dump taken from within DDB (see below), hence the + panic comment because you said to!, and a rather + long stack trace; the initial reason for going into DDB has been a + page fault trap though. + + + + + line 20: + + + This is the location of function trap() + in the stack trace. + + + + + line 36: + + + Force usage of a new stack frame; this is no longer necessary. + The stack frames are supposed to point to the right + locations now, even in case of a trap. + From looking at the code in source line 403, there is a + high probability that either the pointer access for + tp was messed up, or the array access was out of + bounds. + + + + + line 52: + + + The pointer looks suspicious, but happens to be a valid + address. + + + + + line 56: + + + However, it obviously points to garbage, so we have found our + error! (For those unfamiliar with that particular piece of code: + tp->t_line refers to the line discipline of + the console device here, which must be a rather small integer + number.) + + + + + If your system is crashing regularly and you are running + out of disk space, deleting old vmcore + files in /var/crash could save a + considerable amount of disk space! + + + + Debugging a Crash Dump with DDD + + Examining a kernel crash dump with a graphical debugger like + ddd is also possible (you will need to install + the devel/ddd port in order to use the + ddd debugger). Add the + option to the ddd command line you would use + normally. For example; + + &prompt.root; ddd -k /var/crash/kernel.0 /var/crash/vmcore.0 + + You should then be able to go about looking at the crash dump using + ddd's graphical interface. + + + + Post-Mortem Analysis of a Dump + + What do you do if a kernel dumped core but you did not expect it, + and it is therefore not compiled using config -g? Not + everything is lost here. Do not panic! + + Of course, you still need to enable crash dumps. See above for the + options you have to specify in order to do this. + + Go to your kernel config directory + (/usr/src/sys/arch/conf) + and edit your configuration file. Uncomment (or add, if it does not + exist) the following line: + + makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols + + Rebuild the kernel. Due to the time stamp change on the Makefile, + some other object files will be rebuilt, for example + trap.o. With a bit of luck, the added + option will not change anything for the generated + code, so you will finally get a new kernel with similar code to the + faulting one but with some debugging symbols. You should at least verify the + old and new sizes with the &man.size.1; command. If there is a + mismatch, you probably need to give up here. + + Go and examine the dump as described above. The debugging symbols + might be incomplete for some places, as can be seen in the stack trace + in the example above where some functions are displayed without line + numbers and argument lists. If you need more debugging symbols, remove + the appropriate object files, recompile the kernel again and repeat the + gdb + session until you know enough. + + All this is not guaranteed to work, but it will do it fine in most + cases. + + + + On-Line Kernel Debugging Using DDB + + While gdb as an off-line debugger provides a very + high level of user interface, there are some things it cannot do. The + most important ones being breakpointing and single-stepping kernel + code. + + If you need to do low-level debugging on your kernel, there is an + on-line debugger available called DDB. It allows setting of + breakpoints, single-stepping kernel functions, examining and changing + kernel variables, etc. However, it cannot access kernel source files, + and only has access to the global and static symbols, not to the full + debug information like gdb does. + + To configure your kernel to include DDB, add the option line + + options DDB + + to your config file, and rebuild. (See The FreeBSD Handbook for details on + configuring the FreeBSD kernel). + + + If you have an older version of the boot blocks, your + debugger symbols might not be loaded at all. Update the boot blocks; + the recent ones load the DDB symbols automatically. + + + Once your DDB kernel is running, there are several ways to enter + DDB. The first, and earliest way is to type the boot flag + right at the boot prompt. The kernel will start up + in debug mode and enter DDB prior to any device probing. Hence you can + even debug the device probe/attach functions. + + The second scenario is to drop to the debugger once the + system has booted. There are two simple ways to accomplish + this. If you would like to break to the debugger from the + command prompt, simply type the command: + + &prompt.root; sysctl debug.enter_debugger=ddb + + Alternatively, if you are at the system console, you may use + a hot-key on the keyboard. The default break-to-debugger + sequence is Ctrl + AltESC. For + syscons, this sequence can be remapped and some of the + distributed maps out there do this, so check to make sure you + know the right sequence to use. There is an option available + for serial consoles that allows the use of a serial line BREAK on the + console line to enter DDB (options BREAK_TO_DEBUGGER + in the kernel config file). It is not the default since there are a lot + of serial adapters around that gratuitously generate a BREAK + condition, for example when pulling the cable. + + The third way is that any panic condition will branch to DDB if the + kernel is configured to use it. For this reason, it is not wise to + configure a kernel with DDB for a machine running unattended. + + The DDB commands roughly resemble some gdb + commands. The first thing you probably need to do is to set a + breakpoint: + + b function-name +b address + + Numbers are taken hexadecimal by default, but to make them distinct + from symbol names; hexadecimal numbers starting with the letters + a-f need to be preceded with 0x + (this is optional for other numbers). Simple expressions are allowed, + for example: function-name + 0x103. + + To continue the operation of an interrupted kernel, simply + type: + + c + + To get a stack trace, use: + + trace + + + Note that when entering DDB via a hot-key, the kernel is currently + servicing an interrupt, so the stack trace might be not of much use + to you. + + + If you want to remove a breakpoint, use + + + del +del address-expression + + The first form will be accepted immediately after a breakpoint hit, + and deletes the current breakpoint. The second form can remove any + breakpoint, but you need to specify the exact address; this can be + obtained from: + + show b + + To single-step the kernel, try: + + s + + This will step into functions, but you can make DDB trace them until + the matching return statement is reached by: + + n + + + This is different from gdb's + next statement; it is like gdb's + finish. + + + To examine data from memory, use (for example): + + x/wx 0xf0133fe0,40 +x/hd db_symtab_space +x/bc termbuf,10 +x/s stringbuf + + for word/halfword/byte access, and hexadecimal/decimal/character/ string + display. The number after the comma is the object count. To display + the next 0x10 items, simply use: + + x ,10 + + Similarly, use + + x/ia foofunc,10 + + to disassemble the first 0x10 instructions of + foofunc, and display them along with their offset + from the beginning of foofunc. + + To modify memory, use the write command: + + w/b termbuf 0xa 0xb 0 +w/w 0xf0010030 0 0 + + The command modifier + (b/h/w) + specifies the size of the data to be written, the first following + expression is the address to write to and the remainder is interpreted + as data to write to successive memory locations. + + If you need to know the current registers, use: + + show reg + + Alternatively, you can display a single register value by e.g. + + p $eax + + and modify it by: + + set $eax new-value + + Should you need to call some kernel functions from DDB, simply + say: + + call func(arg1, arg2, ...) + + The return value will be printed. + + For a &man.ps.1; style summary of all running processes, use: + + ps + + Now you have examined why your kernel failed, and you wish to + reboot. Remember that, depending on the severity of previous + malfunctioning, not all parts of the kernel might still be working as + expected. Perform one of the following actions to shut down and reboot + your system: + + panic + + This will cause your kernel to dump core and reboot, so you can + later analyze the core on a higher level with gdb. This command + usually must be followed by another continue + statement. + + call boot(0) + + Which might be a good way to cleanly shut down the running system, + sync() all disks, and finally reboot. As long as + the disk and filesystem interfaces of the kernel are not damaged, this + might be a good way for an almost clean shutdown. + + call cpu_reset() + + This is the final way out of disaster and almost the same as hitting the + Big Red Button. + + If you need a short command summary, simply type: + + help + + However, it is highly recommended to have a printed copy of the + &man.ddb.4; manual page ready for a debugging + session. Remember that it is hard to read the on-line manual while + single-stepping the kernel. + + + + On-Line Kernel Debugging Using Remote GDB + + This feature has been supported since FreeBSD 2.2, and it is + actually a very neat one. + + GDB has already supported remote debugging for + a long time. This is done using a very simple protocol along a serial + line. Unlike the other methods described above, you will need two + machines for doing this. One is the host providing the debugging + environment, including all the sources, and a copy of the kernel binary + with all the symbols in it, and the other one is the target machine that + simply runs a similar copy of the very same kernel (but stripped of the + debugging information). + + You should configure the kernel in question with config + -g, include into the configuration, and + compile it as usual. This gives a large binary, due to the + debugging information. Copy this kernel to the target machine, strip + the debugging symbols off with strip -x, and boot it + using the boot option. Connect the serial line + of the target machine that has "flags 080" set on its sio device + to any serial line of the debugging host. + Now, on the debugging machine, go to the compile directory of the target + kernel, and start gdb: + + &prompt.user; gdb -k kernel +GDB is free software and you are welcome to distribute copies of it + under certain conditions; type "show copying" to see the conditions. +There is absolutely no warranty for GDB; type "show warranty" for details. +GDB 4.16 (i386-unknown-freebsd), +Copyright 1996 Free Software Foundation, Inc... +(kgdb) + + Initialize the remote debugging session (assuming the first serial + port is being used) by: + + (kgdb) target remote /dev/cuaa0 + + Now, on the target host (the one that entered DDB right before even + starting the device probe), type: + + Debugger("Boot flags requested debugger") +Stopped at Debugger+0x35: movb $0, edata+0x51bc +db> gdb + + DDB will respond with: + + Next trap will enter GDB remote protocol mode + + Every time you type gdb, the mode will be toggled + between remote GDB and local DDB. In order to force a next trap + immediately, simply type s (step). Your hosting GDB + will now gain control over the target kernel: + + Remote debugging using /dev/cuaa0 +Debugger (msg=0xf01b0383 "Boot flags requested debugger") + at ../../i386/i386/db_interface.c:257 +(kgdb) + + You can use this session almost as any other GDB session, including + full access to the source, running it in gud-mode inside an Emacs window + (which gives you an automatic source code display in another Emacs + window), etc. + + + + Debugging Loadable Modules Using GDB + + When debugging a panic that occurred within a module, or + using remote GDB against a machine that uses dynamic modules, + you need to tell GDB how to obtain symbol information for those + modules. + + First, you need to build the module(s) with debugging + information: + + &prompt.root; cd /sys/modules/linux +&prompt.root; make clean; make COPTS=-g + + If you are using remote GDB, you can run + kldstat on the target machine to find out + where the module was loaded: + + &prompt.root; kldstat +Id Refs Address Size Name + 1 4 0xc0100000 1c1678 kernel + 2 1 0xc0a9e000 6000 linprocfs.ko + 3 1 0xc0ad7000 2000 warp_saver.ko + 4 1 0xc0adc000 11000 linux.ko + + If you are debugging a crash dump, you will need to walk the + linker_files list, starting at + linker_files->tqh_first and following the + link.tqe_next pointers until you find the + entry with the filename you are looking for. + The address member of that entry is the load + address of the module. + + Next, you need to find out the offset of the text section + within the module: + + &prompt.root; objdump --section-headers /sys/modules/linux/linux.ko | grep text + 3 .rel.text 000016e0 000038e0 000038e0 000038e0 2**2 + 10 .text 00007f34 000062d0 000062d0 000062d0 2**2 + + The one you want is the .text section, + section 10 in the above example. The fourth hexadecimal field + (sixth field overall) is the offset of the text section within + the file. Add this offset to the load address of the module to + obtain the relocation address for the module's code. In our + example, we get 0xc0adc000 + 0x62d0 = 0xc0ae22d0. Use the + add-symbol-file command in GDB to tell the + debugger about the module: + + (kgdb) add-symbol-file /sys/modules/linux/linux.ko 0xc0ae22d0 +add symbol table from file "/sys/modules/linux/linux.ko" at text_addr = 0xc0ae22d0? +(y or n) y +Reading symbols from /sys/modules/linux/linux.ko...done. +(kgdb) + + You should now have access to all the symbols in the + module. + + + + Debugging a Console Driver + + Since you need a console driver to run DDB on, things are more + complicated if the console driver itself is failing. You might remember + the use of a serial console (either with modified boot blocks, or by + specifying at the Boot: prompt), + and hook up a standard terminal onto your first serial port. DDB works + on any configured console driver, including a serial + console. + + + + Debugging the Deadlocks + + You may experience so called deadlocks, the situation where + system stops doing useful work. To provide the helpful bug report + in this situation, you shall use ddb as described above. Please, + include the output of ps and + trace for suspected processes in the + report. + + If possible, consider doing further investigation. Receipt + below is especially useful if you suspect deadlock occurs in the + VFS layer. Add the options + makeoptions DEBUG=-g + options INVARIANTS + options INVARIANT_SUPPORT + options WITNESS + options DEBUG_LOCKS + options DEBUG_VFS_LOCKS + options DIAGNOSTIC + + to the kernel config. When deadlock occurs, in addition to the + output of the ps command, provide information + from the show allpcpu, show + alllocks, show lockedvnods and + show alltrace. + + For threaded processes, to obtain meaningful backtraces, use + thread thread-id to switch to the thread + stack, and do backtrace with where. + + + + + diff --git a/zh_TW.Big5/books/developers-handbook/l10n/chapter.sgml b/zh_TW.Big5/books/developers-handbook/l10n/chapter.sgml new file mode 100644 index 0000000000..d9f2b323ec --- /dev/null +++ b/zh_TW.Big5/books/developers-handbook/l10n/chapter.sgml @@ -0,0 +1,81 @@ + + + + Localization and Internationalization - L10N and I18N + + + Programming I18N Compliant Applications + Qt + GTK + To make your application more useful for speakers of other + languages, we hope that you will program I18N compliant. The GNU + gcc compiler and GUI libraries like QT and GTK support I18N through + special handling of strings. Making a program I18N compliant is + very easy. It allows contributors to port your application to + other languages quickly. Refer to the library specific I18N + documentation for more details. + + In contrast with common perception, I18N compliant code is + easy to write. Usually, it only involves wrapping your strings + with library specific functions. In addition, please be sure to + allow for wide or multibyte character support. + + + A Call to Unify the I18N Effort + + It has come to our attention that the individual I18N/L10N + efforts for each country has been repeating each others' + efforts. Many of us have been reinventing the wheel repeatedly + and inefficiently. We hope that the various major groups in + I18N could congregate into a group effort similar to the Core + Team's responsibility. + + Currently, we hope that, when you write or port I18N + programs, you would send it out to each country's related + FreeBSD mailing list for testing. In the future, we hope to + create applications that work in all the languages + out-of-the-box without dirty hacks. + + The &a.i18n; has been established. If you are an I18N/L10N + developer, please send your comments, ideas, questions, and + anything you deem related to it. + + Michael C. Wu will be maintaining an I18N works in progress + homepage at . + Please also read the BSDCon2000 I18N paper and presentations + by Clive Lin, Chia-Liang Kao, and Michael C. Wu at + + + + Perl and Python + + Perl + + + Python + + + Perl and Python have I18N and wide character handling + libraries. Please use them for I18N compliance. + + In older FreeBSD versions, + Perl may give warnings about not having a wide character locale + installed on your system. You can set the + environment variable LD_PRELOAD to + /usr/lib/libxpg4.so in your shell. + + In sh-based shells: + + LD_PRELOAD=/usr/lib/libxpg4.so + + In C-based shells: + + setenv LD_PRELOAD /usr/lib/libxpg4.so + + + diff --git a/zh_TW.Big5/books/developers-handbook/policies/Makefile b/zh_TW.Big5/books/developers-handbook/policies/Makefile new file mode 100644 index 0000000000..0dd403f15f --- /dev/null +++ b/zh_TW.Big5/books/developers-handbook/policies/Makefile @@ -0,0 +1,15 @@ +# +# Build the Handbook with just the content from this chapter. +# +# $FreeBSD$ +# + +CHAPTERS= policies/chapter.sgml + +VPATH= .. + +MASTERDOC= ${.CURDIR}/../${DOC}.${DOCBOOKSUFFIX} + +DOC_PREFIX?= ${.CURDIR}/../../../.. + +.include "../Makefile" diff --git a/zh_TW.Big5/books/developers-handbook/policies/chapter.sgml b/zh_TW.Big5/books/developers-handbook/policies/chapter.sgml new file mode 100644 index 0000000000..aec9e1649d --- /dev/null +++ b/zh_TW.Big5/books/developers-handbook/policies/chapter.sgml @@ -0,0 +1,434 @@ + + + + + + + Poul-Henning + Kamp + Contributed by + + + + + + Source Tree Guidelines and Policies + + This chapter documents various guidelines and policies in force for + the FreeBSD source tree. + + + <makevar>MAINTAINER</makevar> on Makefiles + ports maintainer + + If a particular portion of the FreeBSD distribution is being + maintained by a person or group of persons, they can communicate this + fact to the world by adding a + + MAINTAINER= email-addresses + + line to the Makefiles covering this portion of the + source tree. + + The semantics of this are as follows: + + The maintainer owns and is responsible for that code. This means + that he is responsible for fixing bugs and answering problem reports + pertaining to that piece of the code, and in the case of contributed + software, for tracking new versions, as appropriate. + + Changes to directories which have a maintainer defined shall be sent + to the maintainer for review before being committed. Only if the + maintainer does not respond for an unacceptable period of time, to + several emails, will it be acceptable to commit changes without review + by the maintainer. However, it is suggested that you try to have the + changes reviewed by someone else if at all possible. + + It is of course not acceptable to add a person or group as + maintainer unless they agree to assume this duty. On the other hand it + does not have to be a committer and it can easily be a group of + people. + + + + + + + Poul-Henning + Kamp + Contributed by + + + David + O'Brien + + + + + + Contributed Software + + contributed software + + Some parts of the FreeBSD distribution consist of software that is + actively being maintained outside the FreeBSD project. For historical + reasons, we call this contributed software. Some + examples are sendmail, gcc and patch. + + Over the last couple of years, various methods have been used in + dealing with this type of software and all have some number of + advantages and drawbacks. No clear winner has emerged. + + Since this is the case, after some debate one of these methods has + been selected as the official method and will be required + for future imports of software of this kind. Furthermore, it is + strongly suggested that existing contributed software converge on this + model over time, as it has significant advantages over the old method, + including the ability to easily obtain diffs relative to the + official versions of the source by everyone (even without + cvs access). This will make it significantly easier to return changes + to the primary developers of the contributed software. + + Ultimately, however, it comes down to the people actually doing the + work. If using this model is particularly unsuited to the package being + dealt with, exceptions to these rules may be granted only with the + approval of the core team and with the general consensus of the other + developers. The ability to maintain the package in the future will be a + key issue in the decisions. + + + Because of some unfortunate design limitations with the RCS file + format and CVS's use of vendor branches, minor, trivial and/or + cosmetic changes are strongly discouraged on + files that are still tracking the vendor branch. Spelling + fixes are explicitly included here under the + cosmetic category and are to be avoided for files with + revision 1.1.x.x. The repository bloat impact from a single character + change can be rather dramatic. + + + The Tcl embedded programming + language will be used as example of how this model works: + + src/contrib/tcl contains the source as + distributed by the maintainers of this package. Parts that are entirely + not applicable for FreeBSD can be removed. In the case of Tcl, the + mac, win and + compat subdirectories were eliminated before the + import. + + src/lib/libtcl contains only a bmake style + Makefile that uses the standard + bsd.lib.mk makefile rules to produce the library + and install the documentation. + + src/usr.bin/tclsh contains only a bmake style + Makefile which will produce and install the + tclsh program and its associated man-pages using the + standard bsd.prog.mk rules. + + src/tools/tools/tcl_bmake contains a couple of + shell-scripts that can be of help when the tcl software needs updating. + These are not part of the built or installed software. + + The important thing here is that the + src/contrib/tcl directory is created according to + the rules: it is supposed to contain the sources as distributed (on a + proper CVS vendor-branch and without RCS keyword expansion) with as few + FreeBSD-specific changes as possible. The 'easy-import' tool on + freefall will assist in doing the import, but if there are any doubts on + how to go about it, it is imperative that you ask first and not blunder + ahead and hope it works out. CVS is not forgiving of + import accidents and a fair amount of effort is required to back out + major mistakes. + + Because of the previously mentioned design limitations with CVS's + vendor branches, it is required that official patches from + the vendor be applied to the original distributed sources and the result + re-imported onto the vendor branch again. Official patches should never + be patched into the FreeBSD checked out version and committed, as this + destroys the vendor branch coherency and makes importing future versions + rather difficult as there will be conflicts. + + Since many packages contain files that are meant for compatibility + with other architectures and environments that FreeBSD, it is + permissible to remove parts of the distribution tree that are of no + interest to FreeBSD in order to save space. Files containing copyright + notices and release-note kind of information applicable to the remaining + files shall not be removed. + + If it seems easier, the bmake + Makefiles can be produced from the dist tree + automatically by some utility, something which would hopefully make it + even easier to upgrade to a new version. If this is done, be sure to + check in such utilities (as necessary) in the + src/tools directory along with the port itself so + that it is available to future maintainers. + + In the src/contrib/tcl level directory, a file + called FREEBSD-upgrade should be added and it + should state things like: + + + + Which files have been left out. + + + + Where the original distribution was obtained from and/or the + official master site. + + + + Where to send patches back to the original authors. + + + + Perhaps an overview of the FreeBSD-specific changes that have + been made. + + + + However, please do not import FREEBSD-upgrade + with the contributed source. Rather you should cvs add + FREEBSD-upgrade ; cvs ci after the initial import. Example + wording from src/contrib/cpio is below: + + This directory contains virgin sources of the original distribution files +on a "vendor" branch. Do not, under any circumstances, attempt to upgrade +the files in this directory via patches and a cvs commit. New versions or +official-patch versions must be imported. Please remember to import with +"-ko" to prevent CVS from corrupting any vendor RCS Ids. + +For the import of GNU cpio 2.4.2, the following files were removed: + + INSTALL cpio.info mkdir.c + Makefile.in cpio.texi mkinstalldirs + +To upgrade to a newer version of cpio, when it is available: + 1. Unpack the new version into an empty directory. + [Do not make ANY changes to the files.] + + 2. Remove the files listed above and any others that don't apply to + FreeBSD. + + 3. Use the command: + cvs import -ko -m 'Virgin import of GNU cpio v<version>' \ + src/contrib/cpio GNU cpio_<version> + + For example, to do the import of version 2.4.2, I typed: + cvs import -ko -m 'Virgin import of GNU v2.4.2' \ + src/contrib/cpio GNU cpio_2_4_2 + + 4. Follow the instructions printed out in step 3 to resolve any + conflicts between local FreeBSD changes and the newer version. + +Do not, under any circumstances, deviate from this procedure. + +To make local changes to cpio, simply patch and commit to the main +branch (aka HEAD). Never make local changes on the GNU branch. + +All local changes should be submitted to "cpio@gnu.ai.mit.edu" for +inclusion in the next vendor release. + +obrien@FreeBSD.org - 30 March 1997 + + + + Encumbered Files + + It might occasionally be necessary to include an encumbered file in + the FreeBSD source tree. For example, if a device requires a small + piece of binary code to be loaded to it before the device will operate, + and we do not have the source to that code, then the binary file is said + to be encumbered. The following policies apply to including encumbered + files in the FreeBSD source tree. + + + + Any file which is interpreted or executed by the system CPU(s) + and not in source format is encumbered. + + + + Any file with a license more restrictive than BSD or GNU is + encumbered. + + + + A file which contains downloadable binary data for use by the + hardware is not encumbered, unless (1) or (2) apply to it. It must + be stored in an architecture neutral ASCII format (file2c or + uuencoding is recommended). + + + + Any encumbered file requires specific approval from the + Core team before it is added to the + CVS repository. + + + + Encumbered files go in src/contrib or + src/sys/contrib. + + + + The entire module should be kept together. There is no point in + splitting it, unless there is code-sharing with non-encumbered + code. + + + + Object files are named + arch/filename.o.uu>. + + + + Kernel files: + + + + Should always be referenced in + conf/files.* (for build simplicity). + + + + Should always be in LINT, but the + Core team decides per case if it + should be commented out or not. The + Core team can, of course, change + their minds later on. + + + + The Release Engineer + decides whether or not it goes into the release. + + + + + + User-land files: + + + + core team + The Core team decides if + the code should be part of make world. + + + + release engineer + The Release Engineer + decides if it goes into the release. + + + + + + + + + + + Satoshi + Asami + Contributed by + + + Peter + Wemm + + + David + O'Brien + + + + + + Shared Libraries + + If you are adding shared library support to a port or other piece of + software that does not have one, the version numbers should follow these + rules. Generally, the resulting numbers will have nothing to do with + the release version of the software. + + The three principles of shared library building are: + + + + Start from 1.0 + + + + If there is a change that is backwards compatible, bump minor + number (note that ELF systems ignore the minor number) + + + + If there is an incompatible change, bump major number + + + + For instance, added functions and bugfixes result in the minor + version number being bumped, while deleted functions, changed function + call syntax, etc. will force the major version number to change. + + Stick to version numbers of the form major.minor + (x.y). Our a.out + dynamic linker does not handle version numbers of the form + x.y.z + well. Any version number after the y + (i.e. the third digit) is totally ignored when comparing shared lib + version numbers to decide which library to link with. Given two shared + libraries that differ only in the micro revision, + ld.so will link with the higher one. That is, if you link + with libfoo.so.3.3.3, the linker only records + 3.3 in the headers, and will link with anything + starting with + libfoo.so.3.(anything >= + 3).(highest + available). + + + ld.so will always use the highest + minor revision. For instance, it will use + libc.so.2.2 in preference to + libc.so.2.0, even if the program was initially + linked with libc.so.2.0. + + + In addition, our ELF dynamic linker does not handle minor version + numbers at all. However, one should still specify a major and minor + version number as our Makefiles do the right thing + based on the type of system. + + For non-port libraries, it is also our policy to change the shared + library version number only once between releases. In addition, it is + our policy to change the major shared library version number only once + between major OS releases (i.e. from 3.0 to 4.0). When you make a + change to a system library that requires the version number to be + bumped, check the Makefile's commit logs. It is the + responsibility of the committer to ensure that the first such change + since the release will result in the shared library version number in + the Makefile to be updated, and any subsequent + changes will not. + + + + diff --git a/zh_TW.Big5/books/developers-handbook/secure/chapter.sgml b/zh_TW.Big5/books/developers-handbook/secure/chapter.sgml new file mode 100644 index 0000000000..2a6fddb297 --- /dev/null +++ b/zh_TW.Big5/books/developers-handbook/secure/chapter.sgml @@ -0,0 +1,525 @@ + + + + + + + Murray + Stokely + Contributed by + + + + + Secure Programming + + Synopsis + + This chapter describes some of the security issues that + have plagued &unix; programmers for decades and some of the new + tools available to help programmers avoid writing exploitable + code. + + + Secure Design + Methodology + + Writing secure applications takes a very scrutinous and + pessimistic outlook on life. Applications should be run with + the principle of least privilege so that no + process is ever running with more than the bare minimum access + that it needs to accomplish its function. Previously tested + code should be reused whenever possible to avoid common + mistakes that others may have already fixed. + + One of the pitfalls of the &unix; environment is how easy it + is to make assumptions about the sanity of the environment. + Applications should never trust user input (in all its forms), + system resources, inter-process communication, or the timing of + events. &unix; processes do not execute synchronously so logical + operations are rarely atomic. + + + Buffer Overflows + + Buffer Overflows have been around since the very + beginnings of the Von-Neuman architecture. + + buffer overflow + Von-Neuman + + They first gained widespread notoriety in 1988 with the Morris + Internet worm. Unfortunately, the same basic attack remains + + Morris Internet worm + + effective today. Of the 17 CERT security advisories of 1999, 10 + + + CERTsecurity advisories + + + of them were directly caused by buffer-overflow software bugs. + By far the most common type of buffer overflow attack is based + on corrupting the stack. + + stack + arguments + + Most modern computer systems use a stack to pass arguments + to procedures and to store local variables. A stack is a last + in first out (LIFO) buffer in the high memory area of a process + image. When a program invokes a function a new "stack frame" is + + LIFO + + process image + stack pointer + + + created. This stack frame consists of the arguments passed to + the function as well as a dynamic amount of local variable + space. The "stack pointer" is a register that holds the current + + stack frame + stack pointer + + location of the top of the stack. Since this value is + constantly changing as new values are pushed onto the top of the + stack, many implementations also provide a "frame pointer" that + is located near the beginning of a stack frame so that local + variables can more easily be addressed relative to this + value. The return address for function + + frame pointer + + process image + frame pointer + + return address + stack-overflow + + calls is also stored on the stack, and this is the cause of + stack-overflow exploits since overflowing a local variable in a + function can overwrite the return address of that function, + potentially allowing a malicious user to execute any code he or + she wants. + + Although stack-based attacks are by far the most common, + it would also be possible to overrun the stack with a heap-based + (malloc/free) attack. + + The C programming language does not perform automatic + bounds checking on arrays or pointers as many other languages + do. In addition, the standard C library is filled with a + handful of very dangerous functions. + + + + + strcpy(char *dest, const char + *src) + May overflow the dest buffer + + + strcat(char *dest, const char + *src) + May overflow the dest buffer + + + getwd(char *buf) + May overflow the buf buffer + + + gets(char *s) + May overflow the s buffer + + + [vf]scanf(const char *format, + ...) + May overflow its arguments. + + + realpath(char *path, char + resolved_path[]) + May overflow the path buffer + + + [v]sprintf(char *str, const char + *format, ...) + May overflow the str buffer. + + + + + + Example Buffer Overflow + + The following example code contains a buffer overflow + designed to overwrite the return address and skip the + instruction immediately following the function call. (Inspired + by ) + +#include stdio.h + +void manipulate(char *buffer) { + char newbuffer[80]; + strcpy(newbuffer,buffer); +} + +int main() { + char ch,buffer[4096]; + int i=0; + + while ((buffer[i++] = getchar()) != '\n') {}; + + i=1; + manipulate(buffer); + i=2; + printf("The value of i is : %d\n",i); + return 0; +} + + Let us examine what the memory image of this process would + look like if we were to input 160 spaces into our little program + before hitting return. + + [XXX figure here!] + + Obviously more malicious input can be devised to execute + actual compiled instructions (such as exec(/bin/sh)). + + + Avoiding Buffer Overflows + + The most straightforward solution to the problem of + stack-overflows is to always use length restricted memory and + string copy functions. strncpy and + strncat are part of the standard C library. + + + string copy functions + strncpy + + + string copy functions + strncat + + + These functions accept a length value as a parameter which + should be no larger than the size of the destination buffer. + These functions will then copy up to `length' bytes from the + source to the destination. However there are a number of + problems with these functions. Neither function guarantees NUL + termination if the size of the input buffer is as large as the + + NUL termination + + destination. The length parameter is also used inconsistently + between strncpy and strncat so it is easy for programmers to get + confused as to their proper usage. There is also a significant + performance loss compared to strcpy when + copying a short string into a large buffer since + strncpy NUL fills up the size + specified. + + In OpenBSD, another memory copy implementation has been + + OpenBSD + + created to get around these problem. The + strlcpy and strlcat + functions guarantee that they will always null terminate the + destination string when given a non-zero length argument. For + more information about these functions see . The OpenBSD strlcpy and + strlcat instructions have been in FreeBSD + since 3.3. + + + string copy functions + strlcpy + + + + string copy functions + strlcat + + + Compiler based run-time bounds checking + + bounds checking + compiler-based + + Unfortunately there is still a very large assortment of + code in public use which blindly copies memory around without + using any of the bounded copy routines we just discussed. + Fortunately, there is another solution. Several compiler + add-ons and libraries exist to do Run-time bounds checking in + C/C++. + + StackGuard + gcc + + StackGuard is one such add-on that is implemented as a + small patch to the gcc code generator. From the StackGuard + website: + +
"StackGuard detects and defeats stack + smashing attacks by protecting the return address on the stack + from being altered. StackGuard places a "canary" word next to + the return address when a function is called. If the canary + word has been altered when the function returns, then a stack + smashing attack has been attempted, and the program responds + by emitting an intruder alert into syslog, and then + halts."
+ +
"StackGuard is implemented as a small patch + to the gcc code generator, specifically the function_prolog() + and function_epilog() routines. function_prolog() has been + enhanced to lay down canaries on the stack when functions + start, and function_epilog() checks canary integrity when the + function exits. Any attempt at corrupting the return address + is thus detected before the function + returns."
+
+ + buffer overflow + + Recompiling your application with StackGuard is an + effective means of stopping most buffer-overflow attacks, but + it can still be compromised. + +
+ + Library based run-time bounds checking + + + bounds checking + library-based + + + Compiler-based mechanisms are completely useless for + binary-only software for which you cannot recompile. For + these situations there are a number of libraries which + re-implement the unsafe functions of the C-library + (strcpy, fscanf, + getwd, etc..) and ensure that these + functions can never write past the stack pointer. + + + libsafe + libverify + libparanoia + + + Unfortunately these library-based defenses have a number + of shortcomings. These libraries only protect against a very + small set of security related issues and they neglect to fix + the actual problem. These defenses may fail if the + application was compiled with -fomit-frame-pointer. Also, the + LD_PRELOAD and LD_LIBRARY_PATH environment variables can be + overwritten/unset by the user. + + +
+
+ + SetUID issues + + seteuid + + There are at least 6 different IDs associated with any + given process. Because of this you have to be very careful with + the access that your process has at any given time. In + particular, all seteuid applications should give up their + privileges as soon as it is no longer required. + + + user IDs + real user ID + + + user IDs + effective user ID + + + The real user ID can only be changed by a superuser + process. The login program sets this + when a user initially logs in and it is seldom changed. + + The effective user ID is set by the + exec() functions if a program has its + seteuid bit set. An application can call + seteuid() at any time to set the effective + user ID to either the real user ID or the saved set-user-ID. + When the effective user ID is set by exec() + functions, the previous value is saved in the saved set-user-ID. + + + + Limiting your program's environment + + chroot() + + The traditional method of restricting a process + is with the chroot() system call. This + system call changes the root directory from which all other + paths are referenced for a process and any child processes. For + this call to succeed the process must have execute (search) + permission on the directory being referenced. The new + environment does not actually take effect until you + chdir() into your new environment. It + should also be noted that a process can easily break out of a + chroot environment if it has root privilege. This could be + accomplished by creating device nodes to read kernel memory, + attaching a debugger to a process outside of the jail, or in + many other creative ways. + + The behavior of the chroot() system + call can be controlled somewhat with the + kern.chroot_allow_open_directories sysctl + variable. When this value is set to 0, + chroot() will fail with EPERM if there are + any directories open. If set to the default value of 1, then + chroot() will fail with EPERM if there are + any directories open and the process is already subject to a + chroot() call. For any other value, the + check for open directories will be bypassed completely. + + FreeBSD's jail functionality + + jail + + The concept of a Jail extends upon the + chroot() by limiting the powers of the + superuser to create a true `virtual server'. Once a prison is + set up all network communication must take place through the + specified IP address, and the power of "root privilege" in this + jail is severely constrained. + + While in a prison, any tests of superuser power within the + kernel using the suser() call will fail. + However, some calls to suser() have been + changed to a new interface suser_xxx(). + This function is responsible for recognizing or denying access + to superuser power for imprisoned processes. + + A superuser process within a jailed environment has the + power to: + + + Manipulate credential with + setuid, seteuid, + setgid, setegid, + setgroups, setreuid, + setregid, setlogin + Set resource limits with setrlimit + Modify some sysctl nodes + (kern.hostname) + chroot() + Set flags on a vnode: + chflags, + fchflags + Set attributes of a vnode such as file + permission, owner, group, size, access time, and modification + time. + Bind to privileged ports in the Internet + domain (ports < 1024) + + + Jail is a very useful tool for + running applications in a secure environment but it does have + some shortcomings. Currently, the IPC mechanisms have not been + converted to the suser_xxx so applications + such as MySQL cannot be run within a jail. Superuser access + may have a very limited meaning within a jail, but there is + no way to specify exactly what "very limited" means. + + + &posix;.1e Process Capabilities + + POSIX.1e Process Capabilities + TrustedBSD + + &posix; has released a working draft that adds event + auditing, access control lists, fine grained privileges, + information labeling, and mandatory access control. + This is a work in progress and is the focus of the TrustedBSD project. Some + of the initial work has been committed to &os.current; + (cap_set_proc(3)). + + + + + + Trust + + An application should never assume that anything about the + users environment is sane. This includes (but is certainly not + limited to): user input, signals, environment variables, + resources, IPC, mmaps, the filesystem working directory, file + descriptors, the # of open files, etc. + + positive filtering + data validation + + You should never assume that you can catch all forms of + invalid input that a user might supply. Instead, your + application should use positive filtering to only allow a + specific subset of inputs that you deem safe. Improper data + validation has been the cause of many exploits, especially with + CGI scripts on the world wide web. For filenames you need to be + extra careful about paths ("../", "/"), symbolic links, and + shell escape characters. + + Perl Taint mode + + Perl has a really cool feature called "Taint" mode which + can be used to prevent scripts from using data derived outside + the program in an unsafe way. This mode will check command line + arguments, environment variables, locale information, the + results of certain syscalls (readdir(), + readlink(), + getpwxxx(), and all file input. + + + + + Race Conditions + + A race condition is anomalous behavior caused by the + unexpected dependence on the relative timing of events. In + other words, a programmer incorrectly assumed that a particular + event would always happen before another. + + race conditions + signals + + race conditions + access checks + + race conditions + file opens + + Some of the common causes of race conditions are signals, + access checks, and file opens. Signals are asynchronous events + by nature so special care must be taken in dealing with them. + Checking access with access(2) then + open(2) is clearly non-atomic. Users can + move files in between the two calls. Instead, privileged + applications should seteuid() and then call + open() directly. Along the same lines, an + application should always set a proper umask before + open() to obviate the need for spurious + chmod() calls. + + + +
diff --git a/zh_TW.Big5/books/developers-handbook/sockets/chapter.sgml b/zh_TW.Big5/books/developers-handbook/sockets/chapter.sgml new file mode 100644 index 0000000000..d4d4d6556d --- /dev/null +++ b/zh_TW.Big5/books/developers-handbook/sockets/chapter.sgml @@ -0,0 +1,1790 @@ + + + + + + + G. Adam + Stanislav + Contributed by + + + + + Sockets + + + Synopsis + + BSD sockets take interprocess + communications to a new level. It is no longer necessary for the + communicating processes to run on the same machine. They still + can, but they do not have to. + + Not only do these processes not have to run on the same + machine, they do not have to run under the same operating + system. Thanks to BSD sockets, your FreeBSD + software can smoothly cooperate with a program running on a + &macintosh;, another one running on a &sun; workstation, yet another + one running under &windows; 2000, all connected with an + Ethernet-based local area network. + + But your software can equally well cooperate with processes + running in another building, or on another continent, inside a + submarine, or a space shuttle. + + It can also cooperate with processes that are not part of a + computer (at least not in the strict sense of the word), but of + such devices as printers, digital cameras, medical equipment. + Just about anything capable of digital communications. + + + + + Networking and Diversity + + We have already hinted on the diversity + of networking. Many different systems have to talk to each + other. And they have to speak the same language. They also have + to understand the same language the same + way. + + People often think that body language + is universal. But it is not. Back in my early teens, my father + took me to Bulgaria. We were sitting at a table in a park in + Sofia, when a vendor approached us trying to sell us some + roasted almonds. + + I had not learned much Bulgarian by then, so, instead of + saying no, I shook my head from side to side, the + universal body language for + no. The vendor quickly started serving us + some almonds. + + I then remembered I had been told that in Bulgaria shaking + your head sideways meant yes. Quickly, I + started nodding my head up and down. The vendor noticed, took + his almonds, and walked away. To an uninformed observer, I did + not change the body language: I continued using the language of + shaking and nodding my head. What changed was the + meaning of the body language. At first, the + vendor and I interpreted the same language as having completely + different meaning. I had to adjust my own interpretation of that + language so the vendor would understand. + + It is the same with computers: The same symbols may have + different, even outright opposite meaning. Therefore, for + two computers to understand each other, they must not only + agree on the same language, but on the + same interpretation of the language. + + + + + Protocols + + While various programming languages tend to have complex + syntax and use a number of multi-letter reserved words (which + makes them easy for the human programmer to understand), the + languages of data communications tend to be very terse. Instead + of multi-byte words, they often use individual + bits. There is a very convincing reason + for it: While data travels inside your + computer at speeds approaching the speed of light, it often + travels considerably slower between two computers. + + Because the languages used in data communications are so + terse, we usually refer to them as + protocols rather than languages. + + As data travels from one computer to another, it always uses + more than one protocol. These protocols are + layered. The data can be compared to the + inside of an onion: You have to peel off several layers of + skin to get to the data. This is best + illustrated with a picture: + + + + + + + + +----------------+ +| Ethernet | +|+--------------+| +|| IP || +||+------------+|| +||| TCP ||| +|||+----------+||| +|||| HTTP |||| +||||+--------+|||| +||||| PNG ||||| +|||||+------+||||| +|||||| Data |||||| +|||||+------+||||| +||||+--------+|||| +|||+----------+||| +||+------------+|| +|+--------------+| ++----------------+ + + + + Protocol Layers + + + + In this example, we are trying to get an image from a web + page we are connected to via an Ethernet. + + The image consists of raw data, which is simply a sequence + of RGB values that our software can process, + i.e., convert into an image and display on our monitor. + + Alas, our software has no way of knowing how the raw data is + organized: Is it a sequence of RGB values, or + a sequence of grayscale intensities, or perhaps of + CMYK encoded colors? Is the data represented + by 8-bit quanta, or are they 16 bits in size, or perhaps 4 bits? + How many rows and columns does the image consist of? Should + certain pixels be transparent? + + I think you get the picture... + + To inform our software how to handle the raw data, it is + encoded as a PNG file. It could be a + GIF, or a JPEG, but it is + a PNG. + + And PNG is a protocol. + + At this point, I can hear some of you yelling, + No, it is not! It is a file + format! + + Well, of course it is a file format. But from the + perspective of data communications, a file format is a protocol: + The file structure is a language, a terse + one at that, communicating to our process + how the data is organized. Ergo, it is a + protocol. + + Alas, if all we received was the PNG + file, our software would be facing a serious problem: How is it + supposed to know the data is representing an image, as opposed + to some text, or perhaps a sound, or what not? Secondly, how is + it supposed to know the image is in the PNG + format as opposed to GIF, or + JPEG, or some other image format? + + To obtain that information, we are using another protocol: + HTTP. This protocol can tell us exactly that + the data represents an image, and that it uses the + PNG protocol. It can also tell us some other + things, but let us stay focused on protocol layers here. + + + So, now we have some data wrapped in the PNG + protocol, wrapped in the HTTP protocol. + How did we get it from the server? + + By using TCP/IP over Ethernet, that is + how. Indeed, that is three more protocols. Instead of + continuing inside out, I am now going to talk about Ethernet, + simply because it is easier to explain the rest that way. + + Ethernet is an interesting system of connecting computers in + a local area network + (LAN). Each computer has a network + interface card (NIC), which has a + unique 48-bit ID called its + address. No two Ethernet + NICs in the world have the same address. + + + These NICs are all connected with each + other. Whenever one computer wants to communicate with another + in the same Ethernet LAN, it sends a message + over the network. Every NIC sees the + message. But as part of the Ethernet + protocol, the data contains the address of + the destination NIC (among other things). So, + only one of all the network interface cards will pay attention + to it, the rest will ignore it. + + But not all computers are connected to the same + network. Just because we have received the data over our + Ethernet does not mean it originated in our own local area + network. It could have come to us from some other network (which + may not even be Ethernet based) connected with our own network + via the Internet. + + All data is transferred over the Internet using + IP, which stands for Internet + Protocol. Its basic role is to let us know where in + the world the data has arrived from, and where it is supposed to + go to. It does not guarantee we will + receive the data, only that we will know where it came from + if we do receive it. + + Even if we do receive the data, IP does + not guarantee we will receive various chunks of data in the same + order the other computer has sent it to us. So, we can receive + the center of our image before we receive the upper left corner + and after the lower right, for example. + + It is TCP (Transmission Control + Protocol) that asks the sender to resend any lost + data and that places it all into the proper order. + + All in all, it took five different + protocols for one computer to communicate to another what an + image looks like. We received the data wrapped into the + PNG protocol, which was wrapped into the + HTTP protocol, which was wrapped into the + TCP protocol, which was wrapped into the + IP protocol, which was wrapped into the + Ethernet protocol. + + Oh, and by the way, there probably were several other + protocols involved somewhere on the way. For example, if our + LAN was connected to the Internet through a + dial-up call, it used the PPP protocol over + the modem which used one (or several) of the various modem + protocols, et cetera, et cetera, et cetera... + + As a developer you should be asking by now, + How am I supposed to handle it + all? + + Luckily for you, you are not supposed + to handle it all. You are supposed to + handle some of it, but not all of it. Specifically, you need not + worry about the physical connection (in our case Ethernet and + possibly PPP, etc). Nor do you need to handle + the Internet Protocol, or the Transmission Control + Protocol. + + In other words, you do not have to do anything to receive + the data from the other computer. Well, you do have to + ask for it, but that is almost as simple as + opening a file. + + Once you have received the data, it is up to you to figure + out what to do with it. In our case, you would need to + understand the HTTP protocol and the + PNG file structure. + + To use an analogy, all the internetworking protocols become + a gray area: Not so much because we do not understand how it + works, but because we are no longer concerned about it. The + sockets interface takes care of this gray area for us: + + + + + + + + +----------------+ +|xxxxEthernetxxxx| +|+--------------+| +||xxxxxxIPxxxxxx|| +||+------------+|| +|||xxxxxTCPxxxx||| +|||+----------+||| +|||| HTTP |||| +||||+--------+|||| +||||| PNG ||||| +|||||+------+||||| +|||||| Data |||||| +|||||+------+||||| +||||+--------+|||| +|||+----------+||| +||+------------+|| +|+--------------+| ++----------------+ + + + + Sockets Covered Protocol Layers + + + + We only need to understand any protocols that tell us how to + interpret the data, not how to + receive it from another process, nor how to + send it to another process. + + + + + The Sockets Model + + BSD sockets are built on the basic &unix; + model: Everything is a file. In our + example, then, sockets would let us receive an HTTP + file, so to speak. It would then be up to us to + extract the PNG file + from it. + + + Because of the complexity of internetworking, we cannot just + use the open system call, or + the open() C function. Instead, we need to + take several steps to opening a socket. + + Once we do, however, we can start treating the + socket the same way we treat any + file descriptor: We can + read from it, write to + it, pipe it, and, eventually, + close it. + + + + + Essential Socket Functions + + While FreeBSD offers different functions to work with + sockets, we only need four to + open a socket. And in some cases we only need + two. + + + The Client-Server Difference + + Typically, one of the ends of a socket-based data + communication is a server, the other is a + client. + + + The Common Elements + + + <function>socket</function> + + The one function used by both, clients and servers, is + &man.socket.2;. It is declared this way: + + +int socket(int domain, int type, int protocol); + + + The return value is of the same type as that of + open, an integer. FreeBSD allocates + its value from the same pool as that of file handles. + That is what allows sockets to be treated the same way as + files. + + The domain argument tells the + system what protocol family you want + it to use. Many of them exist, some are vendor specific, + others are very common. They are declared in + sys/socket.h. + + Use PF_INET for + UDP, TCP and other + Internet protocols (IPv4). + + Five values are defined for the + type argument, again, in + sys/socket.h. All of them start with + SOCK_. The most + common one is SOCK_STREAM, which + tells the system you are asking for a reliable + stream delivery service (which is + TCP when used with + PF_INET). + + If you asked for SOCK_DGRAM, you + would be requesting a connectionless datagram + delivery service (in our case, + UDP). + + If you wanted to be in charge of the low-level + protocols (such as IP), or even network + interfaces (e.g., the Ethernet), you would need to specify + SOCK_RAW. + + Finally, the protocol argument + depends on the previous two arguments, and is not always + meaningful. In that case, use 0 for + its value. + + + The Unconnected Socket + + Nowhere, in the socket function + have we specified to what other system we should be + connected. Our newly created socket remains + unconnected. + + This is on purpose: To use a telephone analogy, we + have just attached a modem to the phone line. We have + neither told the modem to make a call, nor to answer if + the phone rings. + + + + + + <varname>sockaddr</varname> + + Various functions of the sockets family expect the + address of (or pointer to, to use C terminology) a small + area of the memory. The various C declarations in the + sys/socket.h refer to it as + struct sockaddr. This structure is + declared in the same file: + + +/* + * Structure used by kernel to store most + * addresses. + */ +struct sockaddr { + unsigned char sa_len; /* total length */ + sa_family_t sa_family; /* address family */ + char sa_data[14]; /* actually longer; address value */ +}; +#define SOCK_MAXADDRLEN 255 /* longest possible addresses */ + + + Please note the vagueness with + which the sa_data field is declared, + just as an array of 14 bytes, with + the comment hinting there can be more than + 14 of them. + + This vagueness is quite deliberate. Sockets is a very + powerful interface. While most people perhaps think of it + as nothing more than the Internet interface—and most + applications probably use it for that + nowadays—sockets can be used for just about + any kind of interprocess + communications, of which the Internet (or, more precisely, + IP) is only one. + + The sys/socket.h refers to the + various types of protocols sockets will handle as + address families, and lists them + right before the definition of + sockaddr: + + +/* + * Address families. + */ +#define AF_UNSPEC 0 /* unspecified */ +#define AF_LOCAL 1 /* local to host (pipes, portals) */ +#define AF_UNIX AF_LOCAL /* backward compatibility */ +#define AF_INET 2 /* internetwork: UDP, TCP, etc. */ +#define AF_IMPLINK 3 /* arpanet imp addresses */ +#define AF_PUP 4 /* pup protocols: e.g. BSP */ +#define AF_CHAOS 5 /* mit CHAOS protocols */ +#define AF_NS 6 /* XEROX NS protocols */ +#define AF_ISO 7 /* ISO protocols */ +#define AF_OSI AF_ISO +#define AF_ECMA 8 /* European computer manufacturers */ +#define AF_DATAKIT 9 /* datakit protocols */ +#define AF_CCITT 10 /* CCITT protocols, X.25 etc */ +#define AF_SNA 11 /* IBM SNA */ +#define AF_DECnet 12 /* DECnet */ +#define AF_DLI 13 /* DEC Direct data link interface */ +#define AF_LAT 14 /* LAT */ +#define AF_HYLINK 15 /* NSC Hyperchannel */ +#define AF_APPLETALK 16 /* Apple Talk */ +#define AF_ROUTE 17 /* Internal Routing Protocol */ +#define AF_LINK 18 /* Link layer interface */ +#define pseudo_AF_XTP 19 /* eXpress Transfer Protocol (no AF) */ +#define AF_COIP 20 /* connection-oriented IP, aka ST II */ +#define AF_CNT 21 /* Computer Network Technology */ +#define pseudo_AF_RTIP 22 /* Help Identify RTIP packets */ +#define AF_IPX 23 /* Novell Internet Protocol */ +#define AF_SIP 24 /* Simple Internet Protocol */ +#define pseudo_AF_PIP 25 /* Help Identify PIP packets */ +#define AF_ISDN 26 /* Integrated Services Digital Network*/ +#define AF_E164 AF_ISDN /* CCITT E.164 recommendation */ +#define pseudo_AF_KEY 27 /* Internal key-management function */ +#define AF_INET6 28 /* IPv6 */ +#define AF_NATM 29 /* native ATM access */ +#define AF_ATM 30 /* ATM */ +#define pseudo_AF_HDRCMPLT 31 /* Used by BPF to not rewrite headers + * in interface output routine + */ +#define AF_NETGRAPH 32 /* Netgraph sockets */ +#define AF_SLOW 33 /* 802.3ad slow protocol */ +#define AF_SCLUSTER 34 /* Sitara cluster protocol */ +#define AF_ARP 35 +#define AF_BLUETOOTH 36 /* Bluetooth sockets */ +#define AF_MAX 37 + + + + The one used for IP is + AF_INET. It is a symbol for the constant + 2. + + It is the address family listed + in the sa_family field of + sockaddr that decides how exactly the + vaguely named bytes of sa_data will be + used. + + Specifically, whenever the address + family is AF_INET, we can use + struct sockaddr_in found in + netinet/in.h, wherever + sockaddr is expected: + + +/* + * Socket address, internet style. + */ +struct sockaddr_in { + uint8_t sin_len; + sa_family_t sin_family; + in_port_t sin_port; + struct in_addr sin_addr; + char sin_zero[8]; +}; + + + We can visualize its organization this way: + + + + + + + + 0 1 2 3 + +--------+--------+-----------------+ + 0 | 0 | Family | Port | + +--------+--------+-----------------+ + 4 | IP Address | + +-----------------------------------+ + 8 | 0 | + +-----------------------------------+ +12 | 0 | + +-----------------------------------+ + + + + sockaddr_in + + + + The three important fields are + sin_family, which is byte 1 of the + structure, sin_port, a 16-bit value + found in bytes 2 and 3, and sin_addr, a + 32-bit integer representation of the IP + address, stored in bytes 4-7. + + Now, let us try to fill it out. Let us assume we are + trying to write a client for the + daytime protocol, which simply states + that its server will write a text string representing the + current date and time to port 13. We want to use + TCP/IP, so we need to specify + AF_INET in the address family + field. AF_INET is defined as + 2. Let us use the + IP address of 192.43.244.18, which is the time + server of US federal government (time.nist.gov). + + + + + + + + 0 1 2 3 + +--------+--------+-----------------+ + 0 | 0 | 2 | 13 | + +-----------------+-----------------+ + 4 | 192.43.244.18 | + +-----------------------------------+ + 8 | 0 | + +-----------------------------------+ +12 | 0 | + +-----------------------------------+ + + + + Specific example of sockaddr_in + + + + By the way the sin_addr field is + declared as being of the struct in_addr + type, which is defined in + netinet/in.h: + + +/* + * Internet address (a structure for historical reasons) + */ +struct in_addr { + in_addr_t s_addr; +}; + + + In addition, in_addr_t is a 32-bit + integer. + + The 192.43.244.18 is + just a convenient notation of expressing a 32-bit integer + by listing all of its 8-bit bytes, starting with the + most significant one. + + So far, we have viewed sockaddr as + an abstraction. Our computer does not store + short integers as a single 16-bit + entity, but as a sequence of 2 bytes. Similarly, it stores + 32-bit integers as a sequence of 4 bytes. + + Suppose we coded something like this: + + + sa.sin_family = AF_INET; + sa.sin_port = 13; + sa.sin_addr.s_addr = (((((192 << 8) | 43) << 8) | 244) << 8) | 18; + + + What would the result look like? + + Well, that depends, of course. On a &pentium;, or other + x86, based computer, it would look like this: + + + + + + + + 0 1 2 3 + +--------+--------+--------+--------+ + 0 | 0 | 2 | 13 | 0 | + +--------+--------+--------+--------+ + 4 | 18 | 244 | 43 | 192 | + +-----------------------------------+ + 8 | 0 | + +-----------------------------------+ +12 | 0 | + +-----------------------------------+ + + + + sockaddr_in on an Intel system + + + + On a different system, it might look like this: + + + + + + + + + 0 1 2 3 + +--------+--------+--------+--------+ + 0 | 0 | 2 | 0 | 13 | + +--------+--------+--------+--------+ + 4 | 192 | 43 | 244 | 18 | + +-----------------------------------+ + 8 | 0 | + +-----------------------------------+ +12 | 0 | + +-----------------------------------+ + + + + sockaddr_in on an MSB system + + + + And on a PDP it might look different yet. But the + above two are the most common ways in use today. + + Ordinarily, wanting to write portable code, + programmers pretend that these differences do not + exist. And they get away with it (except when they code in + assembly language). Alas, you cannot get away with it that + easily when coding for sockets. + + Why? + + Because when communicating with another computer, you + usually do not know whether it stores data most + significant byte (MSB) or + least significant byte + (LSB) first. + + You might be wondering, So, will + sockets not handle it for me? + + It will not. + + While that answer may surprise you at first, remember + that the general sockets interface only understands the + sa_len and sa_family + fields of the sockaddr structure. You + do not have to worry about the byte order there (of + course, on FreeBSD sa_family is only 1 + byte anyway, but many other &unix; systems do not have + sa_len and use 2 bytes for + sa_family, and expect the data in + whatever order is native to the computer). + + But the rest of the data is just + sa_data[14] as far as sockets + goes. Depending on the address + family, sockets just forwards that data to its + destination. + + Indeed, when we enter a port number, it is because we + want the other computer to know what service we are asking + for. And, when we are the server, we read the port number + so we know what service the other computer is expecting + from us. Either way, sockets only has to forward the port + number as data. It does not interpret it in any way. + + Similarly, we enter the IP address + to tell everyone on the way where to send our data + to. Sockets, again, only forwards it as data. + + That is why, we (the programmers, + not the sockets) have to distinguish + between the byte order used by our computer and a + conventional byte order to send the data in to the other + computer. + + We will call the byte order our computer uses the + host byte order, or just the + host order. + + There is a convention of sending the multi-byte data + over IP + MSB first. This, + we will refer to as the network byte + order, or simply the network + order. + + Now, if we compiled the above code for an Intel based + computer, our host byte order would + produce: + + + + + + + + 0 1 2 3 + +--------+--------+--------+--------+ + 0 | 0 | 2 | 13 | 0 | + +--------+--------+--------+--------+ + 4 | 18 | 244 | 43 | 192 | + +-----------------------------------+ + 8 | 0 | + +-----------------------------------+ +12 | 0 | + +-----------------------------------+ + + + + Host byte order on an Intel system + + + + But the network byte order + requires that we store the data MSB + first: + + + + + + + + 0 1 2 3 + +--------+--------+--------+--------+ + 0 | 0 | 2 | 0 | 13 | + +--------+--------+--------+--------+ + 4 | 192 | 43 | 244 | 18 | + +-----------------------------------+ + 8 | 0 | + +-----------------------------------+ +12 | 0 | + +-----------------------------------+ + + + + Network byte order + + + + Unfortunately, our host order is + the exact opposite of the network + order. + + We have several ways of dealing with it. One would be + to reverse the values in our code: + + + + sa.sin_family = AF_INET; + sa.sin_port = 13 << 8; + sa.sin_addr.s_addr = (((((18 << 8) | 244) << 8) | 43) << 8) | 192; + + + This will trick our compiler + into storing the data in the network byte + order. In some cases, this is exactly the way + to do it (e.g., when programming in assembly + language). In most cases, however, it can cause a + problem. + + Suppose, you wrote a sockets-based program in C. You + know it is going to run on a &pentium;, so you enter all + your constants in reverse and force them to the + network byte order. It works + well. + + Then, some day, your trusted old &pentium; becomes a + rusty old &pentium;. You replace it with a system whose + host order is the same as the + network order. You need to recompile + all your software. All of your software continues to + perform well, except the one program you wrote. + + You have since forgotten that you had forced all of + your constants to the opposite of the host + order. You spend some quality time tearing out + your hair, calling the names of all gods you ever heard + of (and some you made up), hitting your monitor with a + nerf bat, and performing all the other traditional + ceremonies of trying to figure out why something that has + worked so well is suddenly not working at all. + + Eventually, you figure it out, say a couple of swear + words, and start rewriting your code. + + Luckily, you are not the first one to face the + problem. Someone else has created the &man.htons.3; and + &man.htonl.3; C functions to convert a + short and long + respectively from the host byte + order to the network byte + order, and the &man.ntohs.3; and &man.ntohl.3; + C functions to go the other way. + + On MSB-first + systems these functions do nothing. On + LSB-first systems + they convert values to the proper order. + + So, regardless of what system your software is + compiled on, your data will end up in the correct order + if you use these functions. + + + + + + + Client Functions + + Typically, the client initiates the connection to the + server. The client knows which server it is about to call: + It knows its IP address, and it knows the + port the server resides at. It is akin + to you picking up the phone and dialing the number (the + address), then, after someone answers, + asking for the person in charge of wingdings (the + port). + + + <function>connect</function> + + Once a client has created a socket, it needs to + connect it to a specific port on a remote system. It uses + &man.connect.2;: + + +int connect(int s, const struct sockaddr *name, socklen_t namelen); + + + The s argument is the socket, i.e., + the value returned by the socket + function. The name is a pointer to + sockaddr, the structure we have talked + about extensively. Finally, namelen + informs the system how many bytes are in our + sockaddr structure. + + If connect is successful, it + returns 0. Otherwise it returns + -1 and stores the error code in + errno. + + There are many reasons why + connect may fail. For example, with + an attempt to an Internet connection, the + IP address may not exist, or it may be + down, or just too busy, or it may not have a server + listening at the specified port. Or it may outright + refuse any request for specific + code. + + + + + Our First Client + + We now know enough to write a very simple client, one + that will get current time from 192.43.244.18 and print it to + stdout. + + +/* + * daytime.c + * + * Programmed by G. Adam Stanislav + */ +#include <stdio.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/in.h> + +int main() { + register int s; + register int bytes; + struct sockaddr_in sa; + char buffer[BUFSIZ+1]; + + if ((s = socket(PF_INET, SOCK_STREAM, 0)) < 0) { + perror("socket"); + return 1; + } + + bzero(&sa, sizeof sa); + + sa.sin_family = AF_INET; + sa.sin_port = htons(13); + sa.sin_addr.s_addr = htonl((((((192 << 8) | 43) << 8) | 244) << 8) | 18); + if (connect(s, (struct sockaddr *)&sa, sizeof sa) < 0) { + perror("connect"); + close(s); + return 2; + } + + while ((bytes = read(s, buffer, BUFSIZ)) > 0) + write(1, buffer, bytes); + + close(s); + return 0; +} + + + Go ahead, enter it in your editor, save it as + daytime.c, then compile and run + it: + +&prompt.user; cc -O3 -o daytime daytime.c +&prompt.user; ./daytime + +52079 01-06-19 02:29:25 50 0 1 543.9 UTC(NIST) * +&prompt.user; + + In this case, the date was June 19, 2001, the time was + 02:29:25 UTC. Naturally, your results + will vary. + + + + + + + Server Functions + + The typical server does not initiate the + connection. Instead, it waits for a client to call it and + request services. It does not know when the client will + call, nor how many clients will call. It may be just sitting + there, waiting patiently, one moment, The next moment, it + can find itself swamped with requests from a number of + clients, all calling in at the same time. + + The sockets interface offers three basic functions to + handle this. + + + <function>bind</function> + + Ports are like extensions to a phone line: After you + dial a number, you dial the extension to get to a specific + person or department. + + There are 65535 IP ports, but a + server usually processes requests that come in on only one + of them. It is like telling the phone room operator that + we are now at work and available to answer the phone at a + specific extension. We use &man.bind.2; to tell sockets + which port we want to serve. + + +int bind(int s, const struct sockaddr *addr, socklen_t addrlen); + + + Beside specifying the port in addr, + the server may include its IP + address. However, it can just use the symbolic constant + INADDR_ANY to indicate it will serve all + requests to the specified port regardless of what its + IP address is. This symbol, along with + several similar ones, is declared in + netinet/in.h + + +#define INADDR_ANY (u_int32_t)0x00000000 + + + Suppose we were writing a server for the + daytime protocol over + TCP/IP. Recall that + it uses port 13. Our sockaddr_in + structure would look like this: + + + + + + + + 0 1 2 3 + +--------+--------+--------+--------+ + 0 | 0 | 2 | 0 | 13 | + +--------+--------+--------+--------+ + 4 | 0 | + +-----------------------------------+ + 8 | 0 | + +-----------------------------------+ +12 | 0 | + +-----------------------------------+ + + + + Example Server sockaddr_in + + + + + + <function>listen</function> + + To continue our office phone analogy, after you have + told the phone central operator what extension you will be + at, you now walk into your office, and make sure your own + phone is plugged in and the ringer is turned on. Plus, you + make sure your call waiting is activated, so you can hear + the phone ring even while you are talking to someone. + + The server ensures all of that with the &man.listen.2; + function. + + +int listen(int s, int backlog); + + + In here, the backlog variable tells + sockets how many incoming requests to accept while you are + busy processing the last request. In other words, it + determines the maximum size of the queue of pending + connections. + + + + + <function>accept</function> + + After you hear the phone ringing, you accept the call + by answering the call. You have now established a + connection with your client. This connection remains + active until either you or your client hang up. + + The server accepts the connection by using the + &man.accept.2; function. + + +int accept(int s, struct sockaddr *addr, socklen_t *addrlen); + + + Note that this time addrlen is a + pointer. This is necessary because in this case it is the + socket that fills out addr, the + sockaddr_in structure. + + The return value is an integer. Indeed, the + accept returns a new + socket. You will use this new socket to + communicate with the client. + + What happens to the old socket? It continues to listen + for more requests (remember the backlog + variable we passed to listen?) until + we close it. + + Now, the new socket is meant only for + communications. It is fully connected. We cannot pass it + to listen again, trying to accept + additional connections. + + + + + Our First Server + + Our first server will be somewhat more complex than + our first client was: Not only do we have more sockets + functions to use, but we need to write it as a + daemon. + + This is best achieved by creating a child + process after binding the port. The main + process then exits and returns control to the + shell (or whatever program + invoked it). + + The child calls listen, then + starts an endless loop, which accepts a connection, serves + it, and eventually closes its socket. + + +/* + * daytimed - a port 13 server + * + * Programmed by G. Adam Stanislav + * June 19, 2001 + */ +#include <stdio.h> +#include <time.h> +#include <unistd.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/in.h> + +#define BACKLOG 4 + +int main() { + register int s, c; + int b; + struct sockaddr_in sa; + time_t t; + struct tm *tm; + FILE *client; + + if ((s = socket(PF_INET, SOCK_STREAM, 0)) < 0) { + perror("socket"); + return 1; + } + + bzero(&sa, sizeof sa); + + sa.sin_family = AF_INET; + sa.sin_port = htons(13); + + if (INADDR_ANY) + sa.sin_addr.s_addr = htonl(INADDR_ANY); + + if (bind(s, (struct sockaddr *)&sa, sizeof sa) < 0) { + perror("bind"); + return 2; + } + + switch (fork()) { + case -1: + perror("fork"); + return 3; + break; + default: + close(s); + return 0; + break; + case 0: + break; + } + + listen(s, BACKLOG); + + for (;;) { + b = sizeof sa; + + if ((c = accept(s, (struct sockaddr *)&sa, &b)) < 0) { + perror("daytimed accept"); + return 4; + } + + if ((client = fdopen(c, "w")) == NULL) { + perror("daytimed fdopen"); + return 5; + } + + if ((t = time(NULL)) < 0) { + perror("daytimed time"); + + return 6; + } + + tm = gmtime(&t); + fprintf(client, "%.4i-%.2i-%.2iT%.2i:%.2i:%.2iZ\n", + tm->tm_year + 1900, + tm->tm_mon + 1, + tm->tm_mday, + tm->tm_hour, + tm->tm_min, + tm->tm_sec); + + fclose(client); + } +} + + + We start by creating a socket. Then we fill out the + sockaddr_in structure in + sa. Note the conditional use of + INADDR_ANY: + + + if (INADDR_ANY) + sa.sin_addr.s_addr = htonl(INADDR_ANY); + + + Its value is 0. Since we have + just used bzero on the entire + structure, it would be redundant to set it to + 0 again. But if we port our code to + some other system where INADDR_ANY is + perhaps not a zero, we need to assign it to + sa.sin_addr.s_addr. Most modern C + compilers are clever enough to notice that + INADDR_ANY is a constant. As long as it + is a zero, they will optimize the entire conditional + statement out of the code. + + After we have called bind + successfully, we are ready to become a + daemon: We use + fork to create a child process. In + both, the parent and the child, the s + variable is our socket. The parent process will not need + it, so it calls close, then it + returns 0 to inform its own parent it + had terminated successfully. + + Meanwhile, the child process continues working in the + background. It calls listen and sets + its backlog to 4. It does not need a + large value here because daytime is + not a protocol many clients request all the time, and + because it can process each request instantly anyway. + + Finally, the daemon starts an endless loop, which + performs the following steps: + + + Call accept. It waits + here until a client contacts it. At that point, it + receives a new socket, c, which it + can use to communicate with this particular client. + + + It uses the C function + fdopen to turn the socket from a + low-level file descriptor to a + C-style FILE pointer. This will allow + the use of fprintf later on. + + + It checks the time, and prints it in the + ISO 8601 format + to the client file. It + then uses fclose to close the + file. That will automatically close the socket as well. + + + + + We can generalize this, and use + it as a model for many other servers: + + + + + + + + +-----------------+ +| Create Socket | ++-----------------+ + | ++-----------------+ +| Bind Port | Daemon Process ++-----------------+ + | +--------+ + +-------------+-->| Init | + | | +--------+ ++-----------------+ | | +| Exit | | +--------+ ++-----------------+ | | Listen | + | +--------+ + | | + | +--------+ + | | Accept | + | +--------+ + | | + | +--------+ + | | Serve | + | +--------+ + | | + | +--------+ + | | Close | + |<--------+ + + + + Sequential Server + + + + This flowchart is good for sequential + servers, i.e., servers that can serve one + client at a time, just as we were able to with our + daytime server. This is only possible + whenever there is no real conversation + going on between the client and the server: As soon as the + server detects a connection to the client, it sends out + some data and closes the connection. The entire operation + may take nanoseconds, and it is finished. + + The advantage of this flowchart is that, except for + the brief moment after the parent + forks and before it exits, there is + always only one process active: Our + server does not take up much memory and other system + resources. + + Note that we have added initialize + daemon in our flowchart. We did not need to + initialize our own daemon, but this is a good place in the + flow of the program to set up any + signal handlers, open any files we + may need, etc. + + Just about everything in the flow chart can be used + literally on many different servers. The + serve entry is the exception. We + think of it as a black + box, i.e., something you design + specifically for your own server, and just plug it + into the rest. + + Not all protocols are that simple. Many receive a + request from the client, reply to it, then receive another + request from the same client. Because of that, they do not + know in advance how long they will be serving the + client. Such servers usually start a new process for each + client. While the new process is serving its client, the + daemon can continue listening for more connections. + + Now, go ahead, save the above source code as + daytimed.c (it is customary to end + the names of daemons with the letter + d). After you have compiled it, try + running it: + +&prompt.user; ./daytimed +bind: Permission denied +&prompt.user; + + What happened here? As you will recall, the + daytime protocol uses port 13. But + all ports below 1024 are reserved to the superuser + (otherwise, anyone could start a daemon pretending to + serve a commonly used port, while causing a security + breach). + + Try again, this time as the superuser: + +&prompt.root; ./daytimed +&prompt.root; + + What... Nothing? Let us try again: + +&prompt.root; ./daytimed + +bind: Address already in use +&prompt.root; + + Every port can only be bound by one program at a + time. Our first attempt was indeed successful: It started + the child daemon and returned quietly. It is still running + and will continue to run until you either kill it, or any + of its system calls fail, or you reboot the system. + + Fine, we know it is running in the background. But is + it working? How do we know it is a proper + daytime server? Simple: + +&prompt.user; telnet localhost 13 + +Trying ::1... +telnet: connect to address ::1: Connection refused +Trying 127.0.0.1... +Connected to localhost. +Escape character is '^]'. +2001-06-19T21:04:42Z +Connection closed by foreign host. +&prompt.user; + + telnet tried the new + IPv6, and failed. It retried with + IPv4 and succeeded. The daemon + works. + + If you have access to another &unix; system via + telnet, you can use it to test + accessing the server remotely. My computer does not have a + static IP address, so this is what I + did: + +&prompt.user; who + +whizkid ttyp0 Jun 19 16:59 (216.127.220.143) +xxx ttyp1 Jun 19 16:06 (xx.xx.xx.xx) +&prompt.user; telnet 216.127.220.143 13 + +Trying 216.127.220.143... +Connected to r47.bfm.org. +Escape character is '^]'. +2001-06-19T21:31:11Z +Connection closed by foreign host. +&prompt.user; + + Again, it worked. Will it work using the domain name? + + +&prompt.user; telnet r47.bfm.org 13 + +Trying 216.127.220.143... +Connected to r47.bfm.org. +Escape character is '^]'. +2001-06-19T21:31:40Z +Connection closed by foreign host. +&prompt.user; + + By the way, telnet prints + the Connection closed by foreign host + message after our daemon has closed the socket. This shows + us that, indeed, using + fclose(client); in our code works as + advertised. + + + + + + + + + + + Helper Functions + + FreeBSD C library contains many helper functions for sockets + programming. For example, in our sample client we hard coded + the time.nist.gov + IP address. But we do not always know the + IP address. Even if we do, our software is + more flexible if it allows the user to enter the + IP address, or even the domain name. + + + + <function>gethostbyname</function> + + While there is no way to pass the domain name directly to + any of the sockets functions, the FreeBSD C library comes with + the &man.gethostbyname.3; and &man.gethostbyname2.3; functions, + declared in netdb.h. + + +struct hostent * gethostbyname(const char *name); +struct hostent * gethostbyname2(const char *name, int af); + + + Both return a pointer to the hostent + structure, with much information about the domain. For our + purposes, the h_addr_list[0] field of the + structure points at h_length bytes of the + correct address, already stored in the network byte + order. + + This allows us to create a much more flexible—and + much more useful—version of our + daytime program: + + +/* + * daytime.c + * + * Programmed by G. Adam Stanislav + * 19 June 2001 + */ +#include <stdio.h> +#include <string.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <netdb.h> + +int main(int argc, char *argv[]) { + register int s; + register int bytes; + struct sockaddr_in sa; + struct hostent *he; + char buf[BUFSIZ+1]; + char *host; + + if ((s = socket(PF_INET, SOCK_STREAM, 0)) < 0) { + perror("socket"); + return 1; + } + + bzero(&sa, sizeof sa); + + sa.sin_family = AF_INET; + sa.sin_port = htons(13); + + host = (argc > 1) ? (char *)argv[1] : "time.nist.gov"; + + if ((he = gethostbyname(host)) == NULL) { + perror(host); + return 2; + } + + bcopy(he->h_addr_list[0],&sa.sin_addr, he->h_length); + + if (connect(s, (struct sockaddr *)&sa, sizeof sa) < 0) { + perror("connect"); + return 3; + } + + while ((bytes = read(s, buf, BUFSIZ)) > 0) + write(1, buf, bytes); + + close(s); + return 0; +} + + + We now can type a domain name (or an IP + address, it works both ways) on the command line, and the + program will try to connect to its + daytime server. Otherwise, it will still + default to time.nist.gov. However, even in + this case we will use gethostbyname + rather than hard coding 192.43.244.18. That way, even if its + IP address changes in the future, we will + still find it. + + Since it takes virtually no time to get the time from your + local server, you could run daytime + twice in a row: First to get the time from time.nist.gov, the second time from + your own system. You can then compare the results and see how + exact your system clock is: + +&prompt.user; daytime ; daytime localhost + + +52080 01-06-20 04:02:33 50 0 0 390.2 UTC(NIST) * +2001-06-20T04:02:35Z +&prompt.user; + + As you can see, my system was two seconds ahead of the + NIST time. + + + + + <function>getservbyname</function> + + Sometimes you may not be sure what port a certain service + uses. The &man.getservbyname.3; function, also declared in + netdb.h comes in very handy in those + cases: + + +struct servent * getservbyname(const char *name, const char *proto); + + + The servent structure contains the + s_port, which contains the proper port, + already in network byte order. + + Had we not known the correct port for the + daytime service, we could have found it + this way: + + + struct servent *se; + ... + if ((se = getservbyname("daytime", "tcp")) == NULL { + fprintf(stderr, "Cannot determine which port to use.\n"); + return 7; + } + sa.sin_port = se->s_port; + + + You usually do know the port. But if you are developing a + new protocol, you may be testing it on an unofficial + port. Some day, you will register the protocol and its port + (if nowhere else, at least in your + /etc/services, which is where + getservbyname looks). Instead of + returning an error in the above code, you just use the + temporary port number. Once you have listed the protocol in + /etc/services, your software will find + its port without you having to rewrite the code. + + + + + + + Concurrent Servers + + Unlike a sequential server, a concurrent + server has to be able to serve more than one client + at a time. For example, a chat server may + be serving a specific client for hours—it cannot wait till + it stops serving a client before it serves the next one. + + This requires a significant change in our flowchart: + + + + + + + + +-----------------+ +| Create Socket | ++-----------------+ + | ++-----------------+ +| Bind Port | Daemon Process ++-----------------+ + | +--------+ + +-------------+-->| Init | + | | +--------+ ++-----------------+ | | +| Exit | | +--------+ ++-----------------+ | | Listen | + | +--------+ + | | + | +--------+ + | | Accept | + | +--------+ + | | +------------------+ + | +------>| Close Top Socket | + | | +------------------+ + | +--------+ | + | | Close | +------------------+ + | +--------+ | Serve | + | | +------------------+ + |<--------+ | + +------------------+ + | Close Acc Socket | + +--------+ +------------------+ + | Signal | | + +--------+ +------------------+ + | Exit | + +------------------+ + + + + Concurrent Server + + + + We moved the serve from the + daemon process to its own server + process. However, because each child process inherits + all open files (and a socket is treated just like a file), the + new process inherits not only the accepted + handle, i.e., the socket returned by the + accept call, but also the top + socket, i.e., the one opened by the top process right + at the beginning. + + However, the server process does not + need this socket and should close it + immediately. Similarly, the daemon process + no longer needs the accepted socket, and + not only should, but must + close it—otherwise, it will run out + of available file descriptors sooner or + later. + + After the server process is done + serving, it should close the accepted + socket. Instead of returning to + accept, it now exits. + + + Under &unix;, a process does not really + exit. Instead, it + returns to its parent. Typically, a parent + process waits for its child process, and + obtains a return value. However, our daemon + process cannot simply stop and wait. That would + defeat the whole purpose of creating additional processes. But + if it never does wait, its children will + become zombies—no longer functional + but still roaming around. + + For that reason, the daemon process + needs to set signal handlers in its + initialize daemon phase. At least a + SIGCHLD signal has to be processed, so the + daemon can remove the zombie return values from the system and + release the system resources they are taking up. + + That is why our flowchart now contains a process + signals box, which is not connected to any other box. + By the way, many servers also process SIGHUP, + and typically interpret as the signal from the superuser that + they should reread their configuration files. This allows us to + change settings without having to kill and restart these + servers. + + + + diff --git a/zh_TW.Big5/books/developers-handbook/testing/chapter.sgml b/zh_TW.Big5/books/developers-handbook/testing/chapter.sgml new file mode 100644 index 0000000000..fe2420dad9 --- /dev/null +++ b/zh_TW.Big5/books/developers-handbook/testing/chapter.sgml @@ -0,0 +1,226 @@ + + + + Regression and Performance Testing + + Regression tests are used to exercise a particular bit of the + system to check that it works as expected, and to make sure that + old bugs are not reintroduced. + + The &os; regression testing tools can be found in the &os; + source tree in the directory src/tools/regression. + +
+ Micro Benchmark Checklist + + This section contains hints for doing proper + micro-benchmarking on &os; or of &os; itself. + + It is not possible to use all of the suggestions below every + single time, but the more used, the better the benchmark's + ability to test small differences will be. + + + + Disable APM and any other kind of + clock fiddling (ACPI ?). + + + + Run in single user mode. E.g. &man.cron.8;, and and + other daemons only add noise. The &man.sshd.8; daemon can + also cause problems. If ssh access is required during test + either disable the SSHv1 key regeneration, or kill the + parent sshd daemon during the tests. + + + + Do not run &man.ntpd.8;. + + + + If &man.syslog.3; events are generated, run + &man.syslogd.8; with an empty + /etc/syslogd.conf, otherwise, do not + run it. + + + + Minimize disk-I/O, avoid it entirely if possible. + + + + Do not mount file systems that are not needed. + + + + Mount /, + /usr, and any other + file system as read-only if possible. This removes atime + updates to disk (etc.) from the I/O picture. + + + + Reinitialize the read/write test file system with + &man.newfs.8; and populate it from a &man.tar.1; or + &man.dump.8; file before every run. Unmount and mount it + before starting the test. This results in a consistent file + system layout. For a worldstone test this would apply to + /usr/obj (just + reinitialize with newfs and mount). To + get 100% reproducibility, populate the file system from a + &man.dd.1; file (i.e.: dd + if=myimage of=/dev/ad0s1h + bs=1m) + + + + Use malloc backed or preloaded &man.md.4; + partitions. + + + + Reboot between individual iterations of the test, this + gives a more consistent state. + + + + Remove all non-essential device drivers from the kernel. + For instance if USB is not needed for the test, do not put + USB in the kernel. Drivers which attach often have timeouts + ticking away. + + + + Unconfigure hardware that are not in use. Detach disks + with &man.atacontrol.8; and &man.camcontrol.8; if the disks + are not used for the test. + + + + Do not configure the network unless it is being tested, + or wait until after the test has been performed to ship the + results off to another computer. + + If the system must be connected to a public network, + watch out for spikes of broadcast traffic. Even though it + is hardly noticeable, it will take up CPU cycles. Multicast + has similar caveats. + + + + Put each file system on its own disk. This minimizes + jitter from head-seek optimizations. + + + + Minimize output to serial or VGA consoles. Running + output into files gives less jitter. (Serial consoles + easily become a bottleneck.) Do not touch keyboard while + the test is running, even space or + back-space shows up in the numbers. + + + + Make sure the test is long enough, but not too long. If + the test is too short, timestamping is a problem. If it is + too long temperature changes and drift will affect the + frequency of the quartz crystals in the computer. Rule of + thumb: more than a minute, less than an hour. + + + + Try to keep the temperature as stable as possible around + the machine. This affects both quartz crystals and disk + drive algorithms. To get real stable clock, consider + stabilized clock injection. E.g. get a OCXO + PLL, inject + output into clock circuits instead of motherboard xtal. + Contact &a.phk; for more information about this. + + + + Run the test at least 3 times but it is better to run + more than 20 times both for before and + after code. Try to interleave if possible + (i.e.: do not run 20 times before then 20 times after), this + makes it possible to spot environmental effects. Do not + interleave 1:1, but 3:3, this makes it possible to spot + interaction effects. + + A good pattern is: bababa{bbbaaa}*. + This gives hint after the first 1+1 runs (so it is possible + to stop the test if it goes entirely the wrong way), a + standard deviation after the first 3+3 (gives a good + indication if it is going to be worth a long run) and + trending and interaction numbers later on. + + + + Use usr/src/tools/tools/ministat + to see if the numbers are significant. Consider buying + Cartoon guide to statistics ISBN: + 0062731025, highly recommended, if you have forgotten or + never learned about standard deviation and Student's + T. + + + + Do not use background &man.fsck.8; unless the test is a + benchmark of background fsck. Also, + disable background_fsck in + /etc/rc.conf unless the benchmark is + not started at least 60+fsck + runtime seconds after the boot, as &man.rc.8; wakes + up and checks if fsck needs to run on any + file systems when background fsck is + enabled. Likewise, make sure there are no snapshots lying + around unless the benchmark is a test with snapshots. + + + + If the benchmark show unexpected bad performance, check + for things like high interrupt volume from an unexpected + source. Some versions of ACPI have been + reported to misbehave and generate excess + interrupts. To help diagnose odd test results, take a few + snapshots of vmstat -i and look for + anything unusual. + + + + Make sure to be careful about optimization parameters + for kernel and userspace, likewise debugging. It is easy to + let something slip through and realize later the test was + not comparing the same thing. + + + + Do not ever benchmark with the + WITNESS and INVARIANTS + kernel options enabled unless the test is interested to + benchmarking those features. WITNESS can + cause 400%+ drops in performance. Likewise, userspace + &man.malloc.3; parameters default differently in -CURRENT + from the way they ship in production releases. + + +
+
+ + diff --git a/zh_TW.Big5/books/developers-handbook/tools/chapter.sgml b/zh_TW.Big5/books/developers-handbook/tools/chapter.sgml new file mode 100644 index 0000000000..7508065173 --- /dev/null +++ b/zh_TW.Big5/books/developers-handbook/tools/chapter.sgml @@ -0,0 +1,2366 @@ + + + + + + + James + Raynard + Contributed by + + + Murray + Stokely + + + + + Programming Tools + Synopsis + + This chapter is an introduction to using some of the + programming tools supplied with FreeBSD, although much of it + will be applicable to many other versions of &unix;. It does + not attempt to describe coding in any + detail. Most of the chapter assumes little or no previous + programming knowledge, although it is hoped that most + programmers will find something of value in it. + + + + Introduction + + FreeBSD offers an excellent development environment. + Compilers for C, C++, and Fortran and an assembler come with the + basic system, not to mention a Perl interpreter and classic &unix; + tools such as sed and awk. + If that is not enough, there are many more compilers and + interpreters in the Ports collection. FreeBSD is very + compatible with standards such as &posix; and + ANSI C, as well with its own BSD heritage, so + it is possible to write applications that will compile and run + with little or no modification on a wide range of + platforms. + + However, all this power can be rather overwhelming at first + if you have never written programs on a &unix; platform before. + This document aims to help you get up and running, without + getting too deeply into more advanced topics. The intention is + that this document should give you enough of the basics to be + able to make some sense of the documentation. + + Most of the document requires little or no knowledge of + programming, although it does assume a basic competence with + using &unix; and a willingness to learn! + + + + + Introduction to Programming + + A program is a set of instructions that tell the computer to + do various things; sometimes the instruction it has to perform + depends on what happened when it performed a previous + instruction. This section gives an overview of the two main + ways in which you can give these instructions, or + commands as they are usually called. One way + uses an interpreter, the other a + compiler. As human languages are too + difficult for a computer to understand in an unambiguous way, + commands are usually written in one or other languages specially + designed for the purpose. + + + Interpreters + + With an interpreter, the language comes as an environment, + where you type in commands at a prompt and the environment + executes them for you. For more complicated programs, you can + type the commands into a file and get the interpreter to load + the file and execute the commands in it. If anything goes + wrong, many interpreters will drop you into a debugger to help + you track down the problem. + + The advantage of this is that you can see the results of + your commands immediately, and mistakes can be corrected + readily. The biggest disadvantage comes when you want to + share your programs with someone. They must have the same + interpreter, or you must have some way of giving it to them, + and they need to understand how to use it. Also users may not + appreciate being thrown into a debugger if they press the + wrong key! From a performance point of view, interpreters can + use up a lot of memory, and generally do not generate code as + efficiently as compilers. + + In my opinion, interpreted languages are the best way to + start if you have not done any programming before. This kind + of environment is typically found with languages like Lisp, + Smalltalk, Perl and Basic. It could also be argued that the + &unix; shell (sh, csh) is itself an + interpreter, and many people do in fact write shell + scripts to help with various + housekeeping tasks on their machine. Indeed, part + of the original &unix; philosophy was to provide lots of small + utility programs that could be linked together in shell + scripts to perform useful tasks. + + + + Interpreters available with FreeBSD + + Here is a list of interpreters that are available from + the &os; Ports Collection, with a brief discussion of + some of the more popular interpreted languages. + + Instructions on how to get and install applications + from the Ports Collection can be found in the + + Ports section of the handbook. + + + + BASIC + + + Short for Beginner's All-purpose Symbolic + Instruction Code. Developed in the 1950s for teaching + University students to program and provided with every + self-respecting personal computer in the 1980s, + BASIC has been the first programming + language for many programmers. It is also the foundation + for Visual Basic. + + The Bywater Basic Interpreter can be found in the + Ports Collection as + lang/bwbasic + and the Phil Cockroft's Basic Interpreter + (formerly Rabbit Basic) is available as + lang/pbasic. + + + + + Lisp + + + A language that was developed in the late 1950s as + an alternative to the number-crunching + languages that were popular at the time. Instead of + being based on numbers, Lisp is based on lists; in fact + the name is short for List Processing. + Very popular in AI (Artificial Intelligence) + circles. + + Lisp is an extremely powerful and sophisticated + language, but can be rather large and unwieldy. + + Various implementations of Lisp that can run on &unix; + systems are available in the Ports Collection for &os;. + GNU Common Lisp can be found as + lang/gcl. CLISP + by Bruno Haible and Michael Stoll is available as + lang/clisp. + For CMUCL, which includes a highly-optimizing compiler too, or + simpler Lisp implementations like SLisp, which implements most + of the Common Lisp constructs in a few hundred lines of C code, + lang/cmucl and + lang/slisp are available + respectively. + + + + + Perl + + + Very popular with system administrators for writing + scripts; also often used on World Wide Web servers for + writing CGI scripts. + + Perl is available in the Ports Collection as + lang/perl5 for all + &os; releases, and is installed as /usr/bin/perl + in the base system 4.X releases. + + + + + Scheme + + + A dialect of Lisp that is rather more compact and + cleaner than Common Lisp. Popular in Universities as it + is simple enough to teach to undergraduates as a first + language, while it has a high enough level of + abstraction to be used in research work. + + Scheme is available from the Ports Collection as + lang/elk for the + Elk Scheme Interpreter. The MIT Scheme Interpreter + can be found in + lang/mit-scheme + and the SCM Scheme Interpreter in + lang/scm. + + + + + Icon + + + Icon is a high-level language with extensive + facilities for processing strings and structures. + The version of Icon for &os; can be found in the + Ports Collection as + lang/icon. + + + + + Logo + + + Logo is a language that is easy to learn, and has + been used as an introductory programming language in + various courses. It is an excellent tool to work with + when teaching programming in small ages, as it makes the + creation of elaborate geometric shapes an easy task even + for very small children. + + The lastest version of Logo for &os; is available from + the Ports Collection in + lang/logo. + + + + + Python + + + Python is an Object-Oriented, interpreted language. + Its advocates argue that it is one of the best languages + to start programming with, since it is relatively easy + to start with, but is not limited in comparison to other + popular interpreted languages that are used for the + development of large, complex applications (Perl and + Tcl are two other languages that are popular for such tasks). + + The latest version of Python is available from the + Ports Collection in + lang/python. + + + + + Ruby + + + Ruby is an interpreter, pure object-oriented programming + language. It has become widely popular because of its easy + to understand syntax, flexibility when writing code, and the + ability to easily develop and maintain large, complex + programs. + + Ruby is available from the Ports Collection as + lang/ruby18. + + + + + Tcl and Tk + + + Tcl is an embeddable, interpreted language, that has + become widely used and became popular mostly because of its portability to many + platforms. It can be used both for quickly writing + small, prototype applications, or (when combined with + Tk, a GUI toolkit) fully-fledged, featureful + programs. + + Various versions of Tcl are available as ports + for &os;. The latest version, Tcl 8.4, can be found in + lang/tcl84. + + + + + + + Compilers + + Compilers are rather different. First of all, you write + your code in a file (or files) using an editor. You then run + the compiler and see if it accepts your program. If it did + not compile, grit your teeth and go back to the editor; if it + did compile and gave you a program, you can run it either at a + shell command prompt or in a debugger to see if it works + properly. + + + If you run it in the shell, you may get a core + dump. + + + Obviously, this is not quite as direct as using an + interpreter. However it allows you to do a lot of things + which are very difficult or even impossible with an + interpreter, such as writing code which interacts closely with + the operating system—or even writing your own operating + system! It is also useful if you need to write very efficient + code, as the compiler can take its time and optimize the code, + which would not be acceptable in an interpreter. Moreover, + distributing a program written for a compiler is usually more + straightforward than one written for an interpreter—you + can just give them a copy of the executable, assuming they + have the same operating system as you. + + Compiled languages include Pascal, C and C++. C and C++ + are rather unforgiving languages, and best suited to more + experienced programmers; Pascal, on the other hand, was + designed as an educational language, and is quite a good + language to start with. FreeBSD does not include Pascal + support in the base system, but both GNU Pascal Compiler (GPC) + and the Free Pascal Compiler + are available in the ports collection as + lang/gpc and + lang/fpc. + + As the edit-compile-run-debug cycle is rather tedious when + using separate programs, many commercial compiler makers have + produced Integrated Development Environments + (IDEs for short). FreeBSD does not include + an IDE in the base system, but devel/kdevelop is + available in the ports tree and many use + Emacs for this purpose. Using + Emacs as an IDE is discussed in + . + + + + + + + + Compiling with <command>cc</command> + + This section deals only with the GNU compiler for C and C++, + since that comes with the base FreeBSD system. It can be + invoked by either cc or gcc. The + details of producing a program with an interpreter vary + considerably between interpreters, and are usually well covered + in the documentation and on-line help for the + interpreter. + + Once you have written your masterpiece, the next step is to + convert it into something that will (hopefully!) run on FreeBSD. + This usually involves several steps, each of which is done by a + separate program. + + + + Pre-process your source code to remove comments and do + other tricks like expanding macros in C. + + + + Check the syntax of your code to see if you have obeyed + the rules of the language. If you have not, it will + complain! + + + + Convert the source code into assembly + language—this is very close to machine code, but still + understandable by humans. Allegedly. + + + To be strictly accurate, cc converts the + source code into its own, machine-independent + p-code instead of assembly language at + this stage. + + + + + Convert the assembly language into machine + code—yep, we are talking bits and bytes, ones and + zeros here. + + + + Check that you have used things like functions and + global variables in a consistent way. For example, if you + have called a non-existent function, it will + complain. + + + + If you are trying to produce an executable from several + source code files, work out how to fit them all + together. + + + + Work out how to produce something that the system's + run-time loader will be able to load into memory and + run. + + + + Finally, write the executable on the filesystem. + + + + The word compiling is often used to refer to + just steps 1 to 4—the others are referred to as + linking. Sometimes step 1 is referred to as + pre-processing and steps 3-4 as + assembling. + + Fortunately, almost all this detail is hidden from you, as + cc is a front end that manages calling all these + programs with the right arguments for you; simply typing + + &prompt.user; cc foobar.c + + will cause foobar.c to be compiled by all the + steps above. If you have more than one file to compile, just do + something like + + &prompt.user; cc foo.c bar.c + + Note that the syntax checking is just that—checking + the syntax. It will not check for any logical mistakes you may + have made, like putting the program into an infinite loop, or + using a bubble sort when you meant to use a binary + sort. + + + In case you did not know, a binary sort is an efficient + way of sorting things into order and a bubble sort + is not. + + + There are lots and lots of options for cc, which + are all in the manual page. Here are a few of the most important + ones, with examples of how to use them. + + + + + + + The output name of the file. If you do not use this + option, cc will produce an executable called + a.out. + + + The reasons for this are buried in the mists of + history. + + + + &prompt.user; cc foobar.c executable is a.out +&prompt.user; cc -o foobar foobar.c executable is foobar + + + + + + + + + + Just compile the file, do not link it. Useful for toy + programs where you just want to check the syntax, or if + you are using a Makefile. + + + &prompt.user; cc -c foobar.c + + + + This will produce an object file (not an + executable) called foobar.o. This + can be linked together with other object files into an + executable. + + + + + + + + Create a debug version of the executable. This makes + the compiler put information into the executable about + which line of which source file corresponds to which + function call. A debugger can use this information to show + the source code as you step through the program, which is + very useful; the disadvantage is that + all this extra information makes the program much bigger. + Normally, you compile with while you + are developing a program and then compile a release + version without when you are + satisfied it works properly. + + + &prompt.user; cc -g foobar.c + + + + This will produce a debug version of the + program. + + + Note, we did not use the flag + to specify the executable name, so we will get an + executable called a.out. + Producing a debug version called + foobar is left as an exercise for + the reader! + + + + + + + + + Create an optimized version of the executable. The + compiler performs various clever tricks to try to produce + an executable that runs faster than normal. You can add a + number after the to specify a higher + level of optimization, but this often exposes bugs in the + compiler's optimizer. For instance, the version of + cc that comes with the 2.1.0 release of + FreeBSD is known to produce bad code with the + option in some circumstances. + + Optimization is usually only turned on when compiling + a release version. + + + &prompt.user; cc -O -o foobar foobar.c + + + + This will produce an optimized version of + foobar. + + + + + The following three flags will force cc + to check that your code complies to the relevant international + standard, often referred to as the ANSI + standard, though strictly speaking it is an + ISO standard. + + + + + + + Enable all the warnings which the authors of + cc believe are worthwhile. Despite the + name, it will not enable all the warnings + cc is capable of. + + + + + + + + Turn off most, but not all, of the + non-ANSI C features provided by + cc. Despite the name, it does not + guarantee strictly that your code will comply to the + standard. + + + + + + + + Turn off all + cc's non-ANSI C + features. + + + + + Without these flags, cc will allow you to + use some of its non-standard extensions to the standard. Some + of these are very useful, but will not work with other + compilers—in fact, one of the main aims of the standard is + to allow people to write code that will work with any compiler + on any system. This is known as portable + code. + + Generally, you should try to make your code as portable as + possible, as otherwise you may have to completely rewrite the + program later to get it to work somewhere else—and who + knows what you may be using in a few years time? + + + &prompt.user; cc -Wall -ansi -pedantic -o foobar foobar.c + + + This will produce an executable foobar + after checking foobar.c for standard + compliance. + + + + + + + Specify a function library to be used at link time. + + The most common example of this is when compiling a + program that uses some of the mathematical functions in C. + Unlike most other platforms, these are in a separate + library from the standard C one and you have to tell the + compiler to add it. + + The rule is that if the library is called + libsomething.a, + you give cc the argument + . + For example, the math library is + libm.a, so you give + cc the argument . + A common gotcha with the math library is + that it has to be the last library on the command + line. + + + &prompt.user; cc -o foobar foobar.c -lm + + + + This will link the math library functions into + foobar. + + If you are compiling C++ code, you need to add + , or if + you are using FreeBSD 2.2 or later, to the command line + argument to link the C++ library functions. + Alternatively, you can run c++ instead + of cc, which does this for you. + c++ can also be invoked as + g++ on FreeBSD. + + + &prompt.user; cc -o foobar foobar.cc -lg++ For FreeBSD 2.1.6 and earlier +&prompt.user; cc -o foobar foobar.cc -lstdc++ For FreeBSD 2.2 and later +&prompt.user; c++ -o foobar foobar.cc + + + + Each of these will both produce an executable + foobar from the C++ source file + foobar.cc. Note that, on &unix; + systems, C++ source files traditionally end in + .C, .cxx or + .cc, rather than the + &ms-dos; style + .cpp (which was already used for + something else). gcc used to rely on + this to work out what kind of compiler to use on the + source file; however, this restriction no longer applies, + so you may now call your C++ files + .cpp with impunity! + + + + + + Common <command>cc</command> Queries and Problems + + + + + I am trying to write a program which uses the + sin() function and I get an error + like this. What does it mean? + + + /var/tmp/cc0143941.o: Undefined symbol `_sin' referenced from text segment + + + + + + When using mathematical functions like + sin(), you have to tell + cc to link in the math library, like + so: + + + &prompt.user; cc -o foobar foobar.c -lm + + + + + + + + All right, I wrote this simple program to practice + using . All it does is raise 2.1 to + the power of 6. + + + #include <stdio.h> + +int main() { + float f; + + f = pow(2.1, 6); + printf("2.1 ^ 6 = %f\n", f); + return 0; +} + + + + and I compiled it as: + + + &prompt.user; cc temp.c -lm + + + + like you said I should, but I get this when I run + it: + + + &prompt.user; ./a.out +2.1 ^ 6 = 1023.000000 + + + + This is not the right answer! + What is going on? + + + + When the compiler sees you call a function, it + checks if it has already seen a prototype for it. If it + has not, it assumes the function returns an + int, which is definitely not what you want + here. + + + + + + So how do I fix this? + + + + The prototypes for the mathematical functions are in + math.h. If you include this file, + the compiler will be able to find the prototype and it + will stop doing strange things to your + calculation! + + + #include <math.h> +#include <stdio.h> + +int main() { +... + + + + After recompiling it as you did before, run + it: + + + &prompt.user; ./a.out +2.1 ^ 6 = 85.766121 + + + + If you are using any of the mathematical functions, + always include + math.h and remember to link in the + math library. + + + + + + I compiled a file called + foobar.c and I cannot find an + executable called foobar. Where has + it gone? + + + + Remember, cc will call the + executable a.out unless you tell it + differently. Use the + + option: + + + &prompt.user; cc -o foobar foobar.c + + + + + + + + OK, I have an executable called + foobar, I can see it when I run + ls, but when I type in + foobar at the command prompt it tells + me there is no such file. Why can it not find + it? + + + + Unlike &ms-dos;, &unix; does not + look in the current directory when it is trying to find + out which executable you want it to run, unless you tell + it to. Either type ./foobar, which + means run the file called + foobar in the current + directory, or change your PATH + environment + variable so that it looks something like + + + bin:/usr/bin:/usr/local/bin:. + + + + The dot at the end means look in the current + directory if it is not in any of the + others. + + + + + + I called my executable test, + but nothing happens when I run it. What is going + on? + + + + Most &unix; systems have a program called + test in /usr/bin + and the shell is picking that one up before it gets to + checking the current directory. Either type: + + + &prompt.user; ./test + + + + or choose a better name for your program! + + + + + + I compiled my program and it seemed to run all right + at first, then there was an error and it said something + about core dumped. What does that + mean? + + + + The name core dump dates back + to the very early days of &unix;, when the machines used + core memory for storing data. Basically, if the program + failed under certain conditions, the system would write + the contents of core memory to disk in a file called + core, which the programmer could + then pore over to find out what went wrong. + + + + + + Fascinating stuff, but what I am supposed to do + now? + + + + Use gdb to analyze the core (see + ). + + + + + + When my program dumped core, it said something about + a segmentation fault. What is + that? + + + + This basically means that your program tried to + perform some sort of illegal operation on memory; &unix; + is designed to protect the operating system and other + programs from rogue programs. + + Common causes for this are: + + + + Trying to write to a NULL + pointer, eg + + char *foo = NULL; +strcpy(foo, "bang!"); + + + + + Using a pointer that has not been initialized, + eg + + char *foo; +strcpy(foo, "bang!"); + + + The pointer will have some random value that, + with luck, will point into an area of memory that + is not available to your program and the kernel will + kill your program before it can do any damage. If + you are unlucky, it will point somewhere inside your + own program and corrupt one of your data structures, + causing the program to fail mysteriously. + + + + Trying to access past the end of an array, + eg + + int bar[20]; +bar[27] = 6; + + + + + Trying to store something in read-only memory, + eg + + char *foo = "My string"; +strcpy(foo, "bang!"); + + + &unix; compilers often put string literals like + "My string" into read-only areas + of memory. + + + + Doing naughty things with + malloc() and + free(), eg + + char bar[80]; +free(bar); + + + or + + char *foo = malloc(27); +free(foo); +free(foo); + + + + + Making one of these mistakes will not always lead to + an error, but they are always bad practice. Some + systems and compilers are more tolerant than others, + which is why programs that ran well on one system can + crash when you try them on an another. + + + + + + Sometimes when I get a core dump it says + bus error. It says in my &unix; + book that this means a hardware problem, but the + computer still seems to be working. Is this + true? + + + + No, fortunately not (unless of course you really do + have a hardware problem…). This is usually + another way of saying that you accessed memory in a way + you should not have. + + + + + + This dumping core business sounds as though it could + be quite useful, if I can make it happen when I want to. + Can I do this, or do I have to wait until there is an + error? + + + + Yes, just go to another console or xterm, do + + &prompt.user; ps + + + to find out the process ID of your program, and + do + + &prompt.user; kill -ABRT pid + + + where + pid is + the process ID you looked up. + + This is useful if your program has got stuck in an + infinite loop, for instance. If your program happens to + trap SIGABRT, there are several other + signals which have a similar effect. + + Alternatively, you can create a core dump from + inside your program, by calling the + abort() function. See the manual page + of &man.abort.3; to learn more. + + If you want to create a core dump from outside your + program, but do not want the process to terminate, you + can use the gcore program. See the + manual page of &man.gcore.1; for more information. + + + + + + + + + Make + + + What is <command>make</command>? + + When you are working on a simple program with only one or + two source files, typing in + + &prompt.user; cc file1.c file2.c + + is not too bad, but it quickly becomes very tedious when + there are several files—and it can take a while to + compile, too. + + One way to get around this is to use object files and only + recompile the source file if the source code has changed. So + we could have something like: + + &prompt.user; cc file1.o file2.ofile37.c + + if we had changed file37.c, but not any + of the others, since the last time we compiled. This may + speed up the compilation quite a bit, but does not solve the + typing problem. + + Or we could write a shell script to solve the typing + problem, but it would have to re-compile everything, making it + very inefficient on a large project. + + What happens if we have hundreds of source files lying + about? What if we are working in a team with other people who + forget to tell us when they have changed one of their source + files that we use? + + Perhaps we could put the two solutions together and write + something like a shell script that would contain some kind of + magic rule saying when a source file needs compiling. Now all + we need now is a program that can understand these rules, as + it is a bit too complicated for the shell. + + This program is called make. It reads + in a file, called a makefile, that + tells it how different files depend on each other, and works + out which files need to be re-compiled and which ones do not. + For example, a rule could say something like if + fromboz.o is older than + fromboz.c, that means someone must have + changed fromboz.c, so it needs to be + re-compiled. The makefile also has rules telling + make how to re-compile the source file, + making it a much more powerful tool. + + Makefiles are typically kept in the same directory as the + source they apply to, and can be called + makefile, Makefile + or MAKEFILE. Most programmers use the + name Makefile, as this puts it near the + top of a directory listing, where it can easily be + seen. + + + They do not use the MAKEFILE form + as block capitals are often used for documentation files + like README. + + + + + Example of using <command>make</command> + + Here is a very simple make file: + + foo: foo.c + cc -o foo foo.c + + It consists of two lines, a dependency line and a creation + line. + + The dependency line here consists of the name of the + program (known as the target), followed + by a colon, then whitespace, then the name of the source file. + When make reads this line, it looks to see + if foo exists; if it exists, it compares + the time foo was last modified to the + time foo.c was last modified. If + foo does not exist, or is older than + foo.c, it then looks at the creation line + to find out what to do. In other words, this is the rule for + working out when foo.c needs to be + re-compiled. + + The creation line starts with a tab (press + the tab key) and then the command you would + type to create foo if you were doing it + at a command prompt. If foo is out of + date, or does not exist, make then executes + this command to create it. In other words, this is the rule + which tells make how to re-compile + foo.c. + + So, when you type make, it will + make sure that foo is up to date with + respect to your latest changes to foo.c. + This principle can be extended to + Makefiles with hundreds of + targets—in fact, on FreeBSD, it is possible to compile + the entire operating system just by typing make + world in the appropriate directory! + + Another useful property of makefiles is that the targets + do not have to be programs. For instance, we could have a make + file that looks like this: + + foo: foo.c + cc -o foo foo.c + +install: + cp foo /home/me + + We can tell make which target we want to make by + typing: + + &prompt.user; make target + + make will then only look at that target + and ignore any others. For example, if we type + make foo with the makefile above, make + will ignore the install target. + + If we just type make on its own, + make will always look at the first target and then stop + without looking at any others. So if we typed + make here, it will just go to the + foo target, re-compile + foo if necessary, and then stop without + going on to the install target. + + Notice that the install target does not + actually depend on anything! This means that the command on + the following line is always executed when we try to make that + target by typing make install. In this + case, it will copy foo into the user's + home directory. This is often used by application makefiles, + so that the application can be installed in the correct + directory when it has been correctly compiled. + + This is a slightly confusing subject to try to explain. + If you do not quite understand how make + works, the best thing to do is to write a simple program like + hello world and a make file like the one above + and experiment. Then progress to using more than one source + file, or having the source file include a header file. The + touch command is very useful here—it + changes the date on a file without you having to edit + it. + + + + Make and include-files + + C code often starts with a list of files to include, for + example stdio.h. Some of these files are system-include + files, some of them are from the project you are now working + on: + + + #include <stdio.h> +#include "foo.h" + +int main(.... + + To make sure that this file is recompiled the moment + foo.h is changed, you have to add it in + your Makefile: + + foo: foo.c foo.h + + The moment your project is getting bigger and you have + more and more own include-files to maintain, it will be a + pain to keep track of all include files and the files which + are depending on it. If you change an include-file but + forget to recompile all the files which are depending on + it, the results will be devastating. gcc + has an option to analyze your files and to produce a list + of include-files and their dependencies: . + + + If you add this to your Makefile: + + depend: + gcc -E -MM *.c > .depend + + and run make depend, the file + .depend will appear with a list of + object-files, C-files and the include-files: + + foo.o: foo.c foo.h + + If you change foo.h, next time + you run make all files depending on + foo.h will be recompiled. + + Do not forget to run make depend each + time you add an include-file to one of your files. + + + + FreeBSD Makefiles + + Makefiles can be rather complicated to write. Fortunately, + BSD-based systems like FreeBSD come with some very powerful + ones as part of the system. One very good example of this is + the FreeBSD ports system. Here is the essential part of a + typical ports Makefile: + + MASTER_SITES= ftp://freefall.cdrom.com/pub/FreeBSD/LOCAL_PORTS/ +DISTFILES= scheme-microcode+dist-7.3-freebsd.tgz + +.include <bsd.port.mk> + + Now, if we go to the directory for this port and type + make, the following happens: + + + + A check is made to see if the source code for this + port is already on the system. + + + + If it is not, an FTP connection to the URL in + MASTER_SITES is set up to download the + source. + + + + The checksum for the source is calculated and compared + it with one for a known, good, copy of the source. This + is to make sure that the source was not corrupted while in + transit. + + + + Any changes required to make the source work on + FreeBSD are applied—this is known as + patching. + + + + Any special configuration needed for the source is + done. (Many &unix; program distributions try to work out + which version of &unix; they are being compiled on and which + optional &unix; features are present—this is where + they are given the information in the FreeBSD ports + scenario). + + + + The source code for the program is compiled. In + effect, we change to the directory where the source was + unpacked and do make—the + program's own make file has the necessary information to + build the program. + + + + We now have a compiled version of the program. If we + wish, we can test it now; when we feel confident about the + program, we can type make install. + This will cause the program and any supporting files it + needs to be copied into the correct location; an entry is + also made into a package database, so + that the port can easily be uninstalled later if we change + our mind about it. + + + + Now I think you will agree that is rather impressive for a + four line script! + + The secret lies in the last line, which tells + make to look in the system makefile called + bsd.port.mk. It is easy to overlook this + line, but this is where all the clever stuff comes + from—someone has written a makefile that tells + make to do all the things above (plus a + couple of other things I did not mention, including handling + any errors that may occur) and anyone can get access to that + just by putting a single line in their own make file! + + If you want to have a look at these system makefiles, + they are in /usr/share/mk, but it is + probably best to wait until you have had a bit of practice with + makefiles, as they are very complicated (and if you do look at + them, make sure you have a flask of strong coffee + handy!) + + + + More advanced uses of <command>make</command> + + Make is a very powerful tool, and can + do much more than the simple example above shows. + Unfortunately, there are several different versions of + make, and they all differ considerably. + The best way to learn what they can do is probably to read the + documentation—hopefully this introduction will have + given you a base from which you can do this. + + The version of make that comes with FreeBSD is the + Berkeley make; there is a tutorial + for it in /usr/share/doc/psd/12.make. To + view it, do + + &prompt.user; zmore paper.ascii.gz + + in that directory. + + Many applications in the ports use GNU + make, which has a very good set of + info pages. If you have installed any of these + ports, GNU make will automatically + have been installed as gmake. It is also + available as a port and package in its own right. + + To view the info pages for GNU + make, you will have to edit the + dir file in the + /usr/local/info directory to add an entry + for it. This involves adding a line like + + * Make: (make). The GNU Make utility. + + to the file. Once you have done this, you can type + info and then select + make from the menu (or in + Emacs, do C-h + i). + + + + + Debugging + + + The Debugger + + The debugger that comes with FreeBSD is called + gdb (GNU + debugger). You start it up by typing + + &prompt.user; gdb progname + + although most people prefer to run it inside + Emacs. You can do this by: + + M-x gdb RET progname RET + + Using a debugger allows you to run the program under more + controlled circumstances. Typically, you can step through the + program a line at a time, inspect the value of variables, + change them, tell the debugger to run up to a certain point + and then stop, and so on. You can even attach to a program + that is already running, or load a core file to investigate why + the program crashed. It is even possible to debug the kernel, + though that is a little trickier than the user applications + we will be discussing in this section. + + gdb has quite good on-line help, as + well as a set of info pages, so this section will concentrate + on a few of the basic commands. + + Finally, if you find its text-based command-prompt style + off-putting, there is a graphical front-end for it (xxgdb) in the ports + collection. + + This section is intended to be an introduction to using + gdb and does not cover specialized topics + such as debugging the kernel. + + + + Running a program in the debugger + + You will need to have compiled the program with the + option to get the most out of using + gdb. It will work without, but you will only + see the name of the function you are in, instead of the source + code. If you see a line like: + + … (no debugging symbols found) … + + when gdb starts up, you will know that + the program was not compiled with the + option. + + At the gdb prompt, type + break main. This will tell the + debugger to skip over the preliminary set-up code in the + program and start at the beginning of your code. Now type + run to start the program—it will + start at the beginning of the set-up code and then get stopped + by the debugger when it calls main(). + (If you have ever wondered where main() + gets called from, now you know!). + + You can now step through the program, a line at a time, by + pressing n. If you get to a function call, + you can step into it by pressing s. Once + you are in a function call, you can return from stepping into a + function call by pressing f. You can also + use up and down to take + a quick look at the caller. + + Here is a simple example of how to spot a mistake in a + program with gdb. This is our program + (with a deliberate mistake): + + #include <stdio.h> + +int bazz(int anint); + +main() { + int i; + + printf("This is my program\n"); + bazz(i); + return 0; +} + +int bazz(int anint) { + printf("You gave me %d\n", anint); + return anint; +} + + This program sets i to be + 5 and passes it to a function + bazz() which prints out the number we + gave it. + + When we compile and run the program we get + + &prompt.user; cc -g -o temp temp.c +&prompt.user; ./temp +This is my program +anint = 4231 + + That was not what we expected! Time to see what is going + on! + + &prompt.user; gdb temp +GDB is free software and you are welcome to distribute copies of it + under certain conditions; type "show copying" to see the conditions. +There is absolutely no warranty for GDB; type "show warranty" for details. +GDB 4.13 (i386-unknown-freebsd), Copyright 1994 Free Software Foundation, Inc. +(gdb) break main Skip the set-up code +Breakpoint 1 at 0x160f: file temp.c, line 9. gdb puts breakpoint at main() +(gdb) run Run as far as main() +Starting program: /home/james/tmp/temp Program starts running + +Breakpoint 1, main () at temp.c:9 gdb stops at main() +(gdb) n Go to next line +This is my program Program prints out +(gdb) s step into bazz() +bazz (anint=4231) at temp.c:17 gdb displays stack frame +(gdb) + + Hang on a minute! How did anint get to be + 4231? Did we not we set it to be + 5 in main()? Let's + move up to main() and have a look. + + (gdb) up Move up call stack +#1 0x1625 in main () at temp.c:11 gdb displays stack frame +(gdb) p i Show us the value of i +$1 = 4231 gdb displays 4231 + + Oh dear! Looking at the code, we forgot to initialize + i. We meant to put + + +main() { + int i; + + i = 5; + printf("This is my program\n"); + + + but we left the i=5; line out. As we + did not initialize i, it had whatever number + happened to be in that area of memory when the program ran, + which in this case happened to be + 4231. + + + gdb displays the stack frame every + time we go into or out of a function, even if we are using + up and down to move + around the call stack. This shows the name of the function + and the values of its arguments, which helps us keep track + of where we are and what is going on. (The stack is a + storage area where the program stores information about the + arguments passed to functions and where to go when it + returns from a function call). + + + + + Examining a core file + + A core file is basically a file which contains the + complete state of the process when it crashed. In the + good old days, programmers had to print out hex + listings of core files and sweat over machine code manuals, + but now life is a bit easier. Incidentally, under FreeBSD and + other 4.4BSD systems, a core file is called + progname.core instead of just + core, to make it clearer which program a + core file belongs to. + + To examine a core file, start up gdb in + the usual way. Instead of typing break or + run, type + + (gdb) core progname.core + + If you are not in the same directory as the core file, + you will have to do dir + /path/to/core/file first. + + You should see something like this: + + &prompt.user; gdb a.out +GDB is free software and you are welcome to distribute copies of it + under certain conditions; type "show copying" to see the conditions. +There is absolutely no warranty for GDB; type "show warranty" for details. +GDB 4.13 (i386-unknown-freebsd), Copyright 1994 Free Software Foundation, Inc. +(gdb) core a.out.core +Core was generated by `a.out'. +Program terminated with signal 11, Segmentation fault. +Cannot access memory at address 0x7020796d. +#0 0x164a in bazz (anint=0x5) at temp.c:17 +(gdb) + + In this case, the program was called + a.out, so the core file is called + a.out.core. We can see that the program + crashed due to trying to access an area in memory that was not + available to it in a function called + bazz. + + Sometimes it is useful to be able to see how a function was + called, as the problem could have occurred a long way up the + call stack in a complex program. The bt + command causes gdb to print out a + back-trace of the call stack: + + (gdb) bt +#0 0x164a in bazz (anint=0x5) at temp.c:17 +#1 0xefbfd888 in end () +#2 0x162c in main () at temp.c:11 +(gdb) + + The end() function is called when a + program crashes; in this case, the bazz() + function was called from main(). + + + + Attaching to a running program + + One of the neatest features about gdb + is that it can attach to a program that is already running. Of + course, that assumes you have sufficient permissions to do so. + A common problem is when you are stepping through a program + that forks, and you want to trace the child, but the debugger + will only let you trace the parent. + + What you do is start up another gdb, + use ps to find the process ID for the + child, and do + + (gdb) attach pid + + in gdb, and then debug as usual. + + That is all very well, you are probably + thinking, but by the time I have done that, the child + process will be over the hill and far away. Fear + not, gentle reader, here is how to do it (courtesy of the + gdb info pages): + + +if ((pid = fork()) < 0) /* _Always_ check this */ + error(); +else if (pid == 0) { /* child */ + int PauseMode = 1; + + while (PauseMode) + sleep(10); /* Wait until someone attaches to us */ + +} else { /* parent */ + + + Now all you have to do is attach to the child, set + PauseMode to 0, and wait + for the sleep() call to return! + + + + + Using Emacs as a Development Environment + + + Emacs + + Unfortunately, &unix; systems do not come with the kind of + everything-you-ever-wanted-and-lots-more-you-did-not-in-one-gigantic-package + integrated development environments that other systems + have. + + + Some powerful, free IDEs now exist, such as KDevelop + in the ports collection. + + + However, it is possible to set up your own environment. It + may not be as pretty, and it may not be quite as integrated, + but you can set it up the way you want it. And it is free. + And you have the source to it. + + The key to it all is Emacs. Now there are some people who + loathe it, but many who love it. If you are one of the former, + I am afraid this section will hold little of interest to you. + Also, you will need a fair amount of memory to run it—I would + recommend 8MB in text mode and 16MB in X as the bare minimum + to get reasonable performance. + + Emacs is basically a highly customizable + editor—indeed, it has been customized to the point where + it is more like an operating system than an editor! Many + developers and sysadmins do in fact spend practically all + their time working inside Emacs, leaving it only to log + out. + + It is impossible even to summarize everything Emacs can do + here, but here are some of the features of interest to + developers: + + + + Very powerful editor, allowing search-and-replace on + both strings and regular expressions (patterns), jumping + to start/end of block expression, etc, etc. + + + + Pull-down menus and online help. + + + + Language-dependent syntax highlighting and + indentation. + + + + Completely customizable. + + + + You can compile and debug programs within + Emacs. + + + + On a compilation error, you can jump to the offending + line of source code. + + + + Friendly-ish front-end to the info + program used for reading GNU hypertext documentation, + including the documentation on Emacs itself. + + + + Friendly front-end to gdb, allowing + you to look at the source code as you step through your + program. + + + + You can read Usenet news and mail while your program + is compiling. + + + + And doubtless many more that I have overlooked. + + Emacs can be installed on FreeBSD using the Emacs + port. + + Once it is installed, start it up and do C-h + t to read an Emacs tutorial—that means + hold down the control key, press + h, let go of the control + key, and then press t. (Alternatively, you + can you use the mouse to select Emacs + Tutorial from the Help + menu). + + Although Emacs does have menus, it is well worth learning + the key bindings, as it is much quicker when you are editing + something to press a couple of keys than to try to find the + mouse and then click on the right place. And, when you are + talking to seasoned Emacs users, you will find they often + casually throw around expressions like M-x + replace-s RET foo RET bar RET so it is + useful to know what they mean. And in any case, Emacs has far + too many useful functions for them to all fit on the menu + bars. + + Fortunately, it is quite easy to pick up the key-bindings, + as they are displayed next to the menu item. My advice is to + use the menu item for, say, opening a file until you + understand how it works and feel confident with it, then try + doing C-x C-f. When you are happy with that, move on to + another menu command. + + If you can not remember what a particular combination of + keys does, select Describe Key from + the Help menu and type it in—Emacs + will tell you what it does. You can also use the + Command Apropos menu item to find + out all the commands which contain a particular word in them, + with the key binding next to it. + + By the way, the expression above means hold down the + Meta key, press x, release + the Meta key, type + replace-s (short for + replace-string—another feature of + Emacs is that you can abbreviate commands), press the + return key, type foo + (the string you want replaced), press the + return key, type bar (the string you want to + replace foo with) and press + return again. Emacs will then do the + search-and-replace operation you have just requested. + + If you are wondering what on earth the + Meta key is, it is a special key that many + &unix; workstations have. Unfortunately, PC's do not have one, + so it is usually the alt key (or if you are + unlucky, the escape key). + + Oh, and to get out of Emacs, do C-x C-c + (that means hold down the control key, press + x, press c and release the + control key). If you have any unsaved files + open, Emacs will ask you if you want to save them. (Ignore + the bit in the documentation where it says + C-z is the usual way to leave + Emacs—that leaves Emacs hanging around in the + background, and is only really useful if you are on a system + which does not have virtual terminals). + + + + Configuring Emacs + + Emacs does many wonderful things; some of them are built + in, some of them need to be configured. + + Instead of using a proprietary macro language for + configuration, Emacs uses a version of Lisp specially adapted + for editors, known as Emacs Lisp. Working with Emacs Lisp can + be quite helpful if you want to go on and learn something like + Common Lisp. Emacs Lisp has many features of Common Lisp, + although it is considerably smaller (and thus easier to + master). + + The best way to learn Emacs Lisp is to download the Emacs + Tutorial + + However, there is no need to actually know any Lisp to get + started with configuring Emacs, as I have included a sample + .emacs file, which should be enough to + get you started. Just copy it into your home directory and + restart Emacs if it is already running; it will read the + commands from the file and (hopefully) give you a useful basic + setup. + + + + A sample <filename>.emacs</filename> file + + Unfortunately, there is far too much here to explain it in + detail; however there are one or two points worth + mentioning. + + + + Everything beginning with a ; is a comment + and is ignored by Emacs. + + + + In the first line, the + -*- Emacs-Lisp -*- is so that + we can edit the .emacs file itself + within Emacs and get all the fancy features for editing + Emacs Lisp. Emacs usually tries to guess this based on + the filename, and may not get it right for + .emacs. + + + + The tab key is bound to an + indentation function in some modes, so when you press the + tab key, it will indent the current line of code. If you + want to put a tab character in whatever + you are writing, hold the control key down + while you are pressing the tab key. + + + + This file supports syntax highlighting for C, C++, + Perl, Lisp and Scheme, by guessing the language from the + filename. + + + + Emacs already has a pre-defined function called + next-error. In a compilation output + window, this allows you to move from one compilation error + to the next by doing M-n; we define a + complementary function, + previous-error, that allows you to go + to a previous error by doing M-p. The + nicest feature of all is that C-c C-c + will open up the source file in which the error occurred + and jump to the appropriate line. + + + + We enable Emacs's ability to act as a server, so that + if you are doing something outside Emacs and you want to + edit a file, you can just type in + + &prompt.user; emacsclient filename + + + and then you can edit the file in your + Emacs! + + + Many Emacs users set their EDITOR + environment to + emacsclient so this happens every + time they need to edit a file. + + + + + + A sample <filename>.emacs</filename> file + + ;; -*-Emacs-Lisp-*- + +;; This file is designed to be re-evaled; use the variable first-time +;; to avoid any problems with this. +(defvar first-time t + "Flag signifying this is the first time that .emacs has been evaled") + +;; Meta +(global-set-key "\M- " 'set-mark-command) +(global-set-key "\M-\C-h" 'backward-kill-word) +(global-set-key "\M-\C-r" 'query-replace) +(global-set-key "\M-r" 'replace-string) +(global-set-key "\M-g" 'goto-line) +(global-set-key "\M-h" 'help-command) + +;; Function keys +(global-set-key [f1] 'manual-entry) +(global-set-key [f2] 'info) +(global-set-key [f3] 'repeat-complex-command) +(global-set-key [f4] 'advertised-undo) +(global-set-key [f5] 'eval-current-buffer) +(global-set-key [f6] 'buffer-menu) +(global-set-key [f7] 'other-window) +(global-set-key [f8] 'find-file) +(global-set-key [f9] 'save-buffer) +(global-set-key [f10] 'next-error) +(global-set-key [f11] 'compile) +(global-set-key [f12] 'grep) +(global-set-key [C-f1] 'compile) +(global-set-key [C-f2] 'grep) +(global-set-key [C-f3] 'next-error) +(global-set-key [C-f4] 'previous-error) +(global-set-key [C-f5] 'display-faces) +(global-set-key [C-f8] 'dired) +(global-set-key [C-f10] 'kill-compilation) + +;; Keypad bindings +(global-set-key [up] "\C-p") +(global-set-key [down] "\C-n") +(global-set-key [left] "\C-b") +(global-set-key [right] "\C-f") +(global-set-key [home] "\C-a") +(global-set-key [end] "\C-e") +(global-set-key [prior] "\M-v") +(global-set-key [next] "\C-v") +(global-set-key [C-up] "\M-\C-b") +(global-set-key [C-down] "\M-\C-f") +(global-set-key [C-left] "\M-b") +(global-set-key [C-right] "\M-f") +(global-set-key [C-home] "\M-<") +(global-set-key [C-end] "\M->") +(global-set-key [C-prior] "\M-<") +(global-set-key [C-next] "\M->") + +;; Mouse +(global-set-key [mouse-3] 'imenu) + +;; Misc +(global-set-key [C-tab] "\C-q\t") ; Control tab quotes a tab. +(setq backup-by-copying-when-mismatch t) + +;; Treat 'y' or <CR> as yes, 'n' as no. +(fset 'yes-or-no-p 'y-or-n-p) +(define-key query-replace-map [return] 'act) +(define-key query-replace-map [?\C-m] 'act) + +;; Load packages +(require 'desktop) +(require 'tar-mode) + +;; Pretty diff mode +(autoload 'ediff-buffers "ediff" "Intelligent Emacs interface to diff" t) +(autoload 'ediff-files "ediff" "Intelligent Emacs interface to diff" t) +(autoload 'ediff-files-remote "ediff" + "Intelligent Emacs interface to diff") + +(if first-time + (setq auto-mode-alist + (append '(("\\.cpp$" . c++-mode) + ("\\.hpp$" . c++-mode) + ("\\.lsp$" . lisp-mode) + ("\\.scm$" . scheme-mode) + ("\\.pl$" . perl-mode) + ) auto-mode-alist))) + +;; Auto font lock mode +(defvar font-lock-auto-mode-list + (list 'c-mode 'c++-mode 'c++-c-mode 'emacs-lisp-mode 'lisp-mode 'perl-mode 'scheme-mode) + "List of modes to always start in font-lock-mode") + +(defvar font-lock-mode-keyword-alist + '((c++-c-mode . c-font-lock-keywords) + (perl-mode . perl-font-lock-keywords)) + "Associations between modes and keywords") + +(defun font-lock-auto-mode-select () + "Automatically select font-lock-mode if the current major mode is in font-lock-auto-mode-list" + (if (memq major-mode font-lock-auto-mode-list) + (progn + (font-lock-mode t)) + ) + ) + +(global-set-key [M-f1] 'font-lock-fontify-buffer) + +;; New dabbrev stuff +;(require 'new-dabbrev) +(setq dabbrev-always-check-other-buffers t) +(setq dabbrev-abbrev-char-regexp "\\sw\\|\\s_") +(add-hook 'emacs-lisp-mode-hook + '(lambda () + (set (make-local-variable 'dabbrev-case-fold-search) nil) + (set (make-local-variable 'dabbrev-case-replace) nil))) +(add-hook 'c-mode-hook + '(lambda () + (set (make-local-variable 'dabbrev-case-fold-search) nil) + (set (make-local-variable 'dabbrev-case-replace) nil))) +(add-hook 'text-mode-hook + '(lambda () + (set (make-local-variable 'dabbrev-case-fold-search) t) + (set (make-local-variable 'dabbrev-case-replace) t))) + +;; C++ and C mode... +(defun my-c++-mode-hook () + (setq tab-width 4) + (define-key c++-mode-map "\C-m" 'reindent-then-newline-and-indent) + (define-key c++-mode-map "\C-ce" 'c-comment-edit) + (setq c++-auto-hungry-initial-state 'none) + (setq c++-delete-function 'backward-delete-char) + (setq c++-tab-always-indent t) + (setq c-indent-level 4) + (setq c-continued-statement-offset 4) + (setq c++-empty-arglist-indent 4)) + +(defun my-c-mode-hook () + (setq tab-width 4) + (define-key c-mode-map "\C-m" 'reindent-then-newline-and-indent) + (define-key c-mode-map "\C-ce" 'c-comment-edit) + (setq c-auto-hungry-initial-state 'none) + (setq c-delete-function 'backward-delete-char) + (setq c-tab-always-indent t) +;; BSD-ish indentation style + (setq c-indent-level 4) + (setq c-continued-statement-offset 4) + (setq c-brace-offset -4) + (setq c-argdecl-indent 0) + (setq c-label-offset -4)) + +;; Perl mode +(defun my-perl-mode-hook () + (setq tab-width 4) + (define-key c++-mode-map "\C-m" 'reindent-then-newline-and-indent) + (setq perl-indent-level 4) + (setq perl-continued-statement-offset 4)) + +;; Scheme mode... +(defun my-scheme-mode-hook () + (define-key scheme-mode-map "\C-m" 'reindent-then-newline-and-indent)) + +;; Emacs-Lisp mode... +(defun my-lisp-mode-hook () + (define-key lisp-mode-map "\C-m" 'reindent-then-newline-and-indent) + (define-key lisp-mode-map "\C-i" 'lisp-indent-line) + (define-key lisp-mode-map "\C-j" 'eval-print-last-sexp)) + +;; Add all of the hooks... +(add-hook 'c++-mode-hook 'my-c++-mode-hook) +(add-hook 'c-mode-hook 'my-c-mode-hook) +(add-hook 'scheme-mode-hook 'my-scheme-mode-hook) +(add-hook 'emacs-lisp-mode-hook 'my-lisp-mode-hook) +(add-hook 'lisp-mode-hook 'my-lisp-mode-hook) +(add-hook 'perl-mode-hook 'my-perl-mode-hook) + +;; Complement to next-error +(defun previous-error (n) + "Visit previous compilation error message and corresponding source code." + (interactive "p") + (next-error (- n))) + +;; Misc... +(transient-mark-mode 1) +(setq mark-even-if-inactive t) +(setq visible-bell nil) +(setq next-line-add-newlines nil) +(setq compile-command "make") +(setq suggest-key-bindings nil) +(put 'eval-expression 'disabled nil) +(put 'narrow-to-region 'disabled nil) +(put 'set-goal-column 'disabled nil) +(if (>= emacs-major-version 21) + (setq show-trailing-whitespace t)) + +;; Elisp archive searching +(autoload 'format-lisp-code-directory "lispdir" nil t) +(autoload 'lisp-dir-apropos "lispdir" nil t) +(autoload 'lisp-dir-retrieve "lispdir" nil t) +(autoload 'lisp-dir-verify "lispdir" nil t) + +;; Font lock mode +(defun my-make-face (face color &optional bold) + "Create a face from a color and optionally make it bold" + (make-face face) + (copy-face 'default face) + (set-face-foreground face color) + (if bold (make-face-bold face)) + ) + +(if (eq window-system 'x) + (progn + (my-make-face 'blue "blue") + (my-make-face 'red "red") + (my-make-face 'green "dark green") + (setq font-lock-comment-face 'blue) + (setq font-lock-string-face 'bold) + (setq font-lock-type-face 'bold) + (setq font-lock-keyword-face 'bold) + (setq font-lock-function-name-face 'red) + (setq font-lock-doc-string-face 'green) + (add-hook 'find-file-hooks 'font-lock-auto-mode-select) + + (setq baud-rate 1000000) + (global-set-key "\C-cmm" 'menu-bar-mode) + (global-set-key "\C-cms" 'scroll-bar-mode) + (global-set-key [backspace] 'backward-delete-char) + ; (global-set-key [delete] 'delete-char) + (standard-display-european t) + (load-library "iso-transl"))) + +;; X11 or PC using direct screen writes +(if window-system + (progn + ;; (global-set-key [M-f1] 'hilit-repaint-command) + ;; (global-set-key [M-f2] [?\C-u M-f1]) + (setq hilit-mode-enable-list + '(not text-mode c-mode c++-mode emacs-lisp-mode lisp-mode + scheme-mode) + hilit-auto-highlight nil + hilit-auto-rehighlight 'visible + hilit-inhibit-hooks nil + hilit-inhibit-rebinding t) + (require 'hilit19) + (require 'paren)) + (setq baud-rate 2400) ; For slow serial connections + ) + +;; TTY type terminal +(if (and (not window-system) + (not (equal system-type 'ms-dos))) + (progn + (if first-time + (progn + (keyboard-translate ?\C-h ?\C-?) + (keyboard-translate ?\C-? ?\C-h))))) + +;; Under UNIX +(if (not (equal system-type 'ms-dos)) + (progn + (if first-time + (server-start)))) + +;; Add any face changes here +(add-hook 'term-setup-hook 'my-term-setup-hook) +(defun my-term-setup-hook () + (if (eq window-system 'pc) + (progn +;; (set-face-background 'default "red") + ))) + +;; Restore the "desktop" - do this as late as possible +(if first-time + (progn + (desktop-load-default) + (desktop-read))) + +;; Indicate that this file has been read at least once +(setq first-time nil) + +;; No need to debug anything now + +(setq debug-on-error nil) + +;; All done +(message "All done, %s%s" (user-login-name) ".") + + + + + + Extending the Range of Languages Emacs Understands + + Now, this is all very well if you only want to program in + the languages already catered for in the + .emacs file (C, C++, Perl, Lisp and + Scheme), but what happens if a new language called + whizbang comes out, full of exciting + features? + + The first thing to do is find out if whizbang comes with + any files that tell Emacs about the language. These usually + end in .el, short for Emacs + Lisp. For example, if whizbang is a FreeBSD port, we + can locate these files by doing + + &prompt.user; find /usr/ports/lang/whizbang -name "*.el" -print + + and install them by copying them into the Emacs site Lisp + directory. On FreeBSD 2.1.0-RELEASE, this is + /usr/local/share/emacs/site-lisp. + + So for example, if the output from the find command + was + + /usr/ports/lang/whizbang/work/misc/whizbang.el + + we would do + + &prompt.root; cp /usr/ports/lang/whizbang/work/misc/whizbang.el /usr/local/share/emacs/site-lisp + + Next, we need to decide what extension whizbang source + files have. Let's say for the sake of argument that they all + end in .wiz. We need to add an entry to + our .emacs file to make sure Emacs will + be able to use the information in + whizbang.el. + + Find the auto-mode-alist entry in + .emacs and add a line for whizbang, such + as: + + +("\\.lsp$" . lisp-mode) +("\\.wiz$" . whizbang-mode) +("\\.scm$" . scheme-mode) + + + This means that Emacs will automatically go into + whizbang-mode when you edit a file ending + in .wiz. + + Just below this, you will find the + font-lock-auto-mode-list entry. Add + whizbang-mode to it like so: + + ;; Auto font lock mode +(defvar font-lock-auto-mode-list + (list 'c-mode 'c++-mode 'c++-c-mode 'emacs-lisp-mode 'whizbang-mode 'lisp-mode 'perl-mode 'scheme-mode) + "List of modes to always start in font-lock-mode") + + This means that Emacs will always enable + font-lock-mode (ie syntax highlighting) + when editing a .wiz file. + + And that is all that is needed. If there is anything else + you want done automatically when you open up a + .wiz file, you can add a + whizbang-mode hook (see + my-scheme-mode-hook for a simple example + that adds auto-indent). + + + + + Further Reading + + For information about setting up a development environment + for contributing fixes to FreeBSD itself, please see + &man.development.7;. + + + + Brian Harvey and Matthew Wright + Simply Scheme + MIT 1994. + ISBN 0-262-08226-8 + + + + Randall Schwartz + Learning Perl + O'Reilly 1993 + ISBN 1-56592-042-2 + + + + Patrick Henry Winston and Berthold Klaus Paul Horn + Lisp (3rd Edition) + Addison-Wesley 1989 + ISBN 0-201-08319-1 + + + + Brian W. Kernighan and Rob Pike + The Unix Programming Environment + Prentice-Hall 1984 + ISBN 0-13-937681-X + + + + Brian W. Kernighan and Dennis M. Ritchie + The C Programming Language (2nd Edition) + Prentice-Hall 1988 + ISBN 0-13-110362-8 + + + + Bjarne Stroustrup + The C++ Programming Language + Addison-Wesley 1991 + ISBN 0-201-53992-6 + + + + W. Richard Stevens + Advanced Programming in the Unix Environment + Addison-Wesley 1992 + ISBN 0-201-56317-7 + + + + W. Richard Stevens + Unix Network Programming + Prentice-Hall 1990 + ISBN 0-13-949876-1 + + + + + + diff --git a/zh_TW.Big5/books/developers-handbook/x86/chapter.sgml b/zh_TW.Big5/books/developers-handbook/x86/chapter.sgml new file mode 100644 index 0000000000..b4102f9fe4 --- /dev/null +++ b/zh_TW.Big5/books/developers-handbook/x86/chapter.sgml @@ -0,0 +1,6486 @@ + + + + +x86 Assembly Language Programming + + +This chapter was written by &a.stanislav;. + + + + + +Synopsis + + +Assembly language programming under &unix; is highly undocumented. It +is generally assumed that no one would ever want to use it because +various &unix; systems run on different microprocessors, so everything +should be written in C for portability. + + + +In reality, C portability is quite a myth. Even C programs need +to be modified when ported from one &unix; to another, regardless of +what processor each runs on. Typically, such a program is full +of conditional statements depending on the system it is +compiled for. + + + +Even if we believe that all of &unix; software should be written in C, +or some other high-level language, we still need assembly language +programmers: Who else would write the section of C library +that accesses the kernel? + + + +In this chapter I will attempt to show you +how you can use assembly language writing +&unix; programs, specifically under FreeBSD. + + + +This chapter does not explain the basics of assembly language. +There are enough resources about that (for a complete +online course in assembly language, see Randall Hyde's +Art +of Assembly Language; or if you prefer +a printed book, take a look at Jeff Duntemann's +Assembly +Language Step-by-Step). However, +once the chapter is finished, any assembly language programmer +will be able to write programs for FreeBSD +quickly and efficiently. + + + +Copyright © 2000-2001 G. Adam Stanislav. All rights reserved. + + + + + +The Tools + + +The Assembler + + +The most important tool for assembly language programming is the +assembler, the software that converts assembly language code +into machine language. + + + +Two very different assemblers are available for FreeBSD. One is +as1, +which uses the traditional &unix; assembly language syntax. It +comes with the system. + + + +The other is /usr/ports/devel/nasm. +It uses the Intel syntax. Its main advantage is that it +can assemble code for many operating systems. It needs +to be installed separately, but is completely free. + + + +This chapter uses nasm +syntax because most assembly language programmers +coming to FreeBSD from other operating systems +will find it easier to understand. And, because, +quite frankly, that is what I am used to. + + + + + +The Linker + + +The output of the assembler, like that of any +compiler, needs to be linked to form an executable file. + + + +The standard +ld1 +linker comes with FreeBSD. It works with the +code assembled with either assembler. + + + + + + +System Calls + + +Default Calling Convention + + +By default, the FreeBSD kernel uses the C calling +convention. Further, although the kernel is accessed +using int 80h, +it is assumed the program will call a function that +issues int 80h, rather than +issuing int 80h directly. + + + +This convention is very convenient, and quite superior to the +µsoft; convention used by &ms-dos;. +Why? Because the &unix; convention allows any program written in +any language to access the kernel. + + + +An assembly language program can do that as well. +For example, we could open a file: + + + +kernel: + int 80h ; Call kernel + ret + +open: + push dword mode + push dword flags + push dword path + mov eax, 5 + call kernel + add esp, byte 12 + ret + + + +This is a very clean and portable way of coding. If you need to +port the code to a &unix; system which uses a different interrupt, +or a different way of passing parameters, all you need to change +is the kernel procedure. + + + +But assembly language programmers like to shave off cycles. The above example +requires a call/ret combination. +We can eliminate it by +pushing an extra dword: + + + +open: + push dword mode + push dword flags + push dword path + mov eax, 5 + push eax ; Or any other dword + int 80h + add esp, byte 16 + + + +The 5 that we have placed in +EAX identifies +the kernel function, in this case open. + + + + +Alternate Calling Convention + +FreeBSD is an extremely flexible system. It offers other ways of +calling the kernel. For it to work, however, the system must +have Linux emulation installed. + + + +Linux is a &unix; like system. However, its kernel uses the same +system-call convention of passing parameters in registers +&ms-dos; does. As with the &unix; convention, +the function number is placed in EAX. +The parameters, however, are not passed on the stack but in +EBX, ECX, EDX, ESI, EDI, EBP: + + + +open: + mov eax, 5 + mov ebx, path + mov ecx, flags + mov edx, mode + int 80h + + + +This convention has a great disadvantage over +the &unix; way, at least as far as assembly language programming +is concerned: Every time you make a kernel call +you must push the registers, then +pop them later. This makes your code +bulkier and slower. Nevertheless, FreeBSD gives +you a choice. + + + +If you do choose the Linux convention, you must let +the system know about it. After your program is assembled and +linked, you need to brand the executable: + + +&prompt.user; brandelf -f Linux filename + + + + +Which Convention Should You Use? + + +If you are coding specifically for FreeBSD, you should always +use the &unix; convention: It is faster, you can store global +variables in registers, you do not have to brand +the executable, and you do not impose the installation of +the Linux emulation package on the target system. + + + +If you want to create portable code that can also run +on Linux, you will probably still want to give the FreeBSD +users as efficient a code as possible. I will show you +how you can accomplish that after I have explained the basics. + + + + + +Call Numbers + + +To tell the kernel which system service you are calling, +place its number in EAX. Of course, you need +to know what the number is. + + + +The <filename>syscalls</filename> File + + +The numbers are listed in syscalls. +locate syscalls finds this file +in several different formats, all produced automatically +from syscalls.master. + + + +You can find the master file for the default &unix; calling +convention in +/usr/src/sys/kern/syscalls.master. +If you need to use the other convention implemented +in the Linux emulation mode, read +/usr/src/sys/i386/linux/syscalls.master. + + + + +Not only do FreeBSD and Linux use different calling +conventions, they sometimes use different numbers for +the same functions. + + + + +syscalls.master describes how +the call is to be made: + + + +0 STD NOHIDE { int nosys(void); } syscall nosys_args int +1 STD NOHIDE { void exit(int rval); } exit rexit_args void +2 STD POSIX { int fork(void); } +3 STD POSIX { ssize_t read(int fd, void *buf, size_t nbyte); } +4 STD POSIX { ssize_t write(int fd, const void *buf, size_t nbyte); } +5 STD POSIX { int open(char *path, int flags, int mode); } +6 STD POSIX { int close(int fd); } +etc... + + +It is the leftmost column that tells us the number to place in +EAX. + + + +The rightmost column tells us what parameters to +push. They are pushed +from right to left. + + + + +For example, to open a file, we need +to push the mode first, +then flags, then the address at which +the path is stored. + + + + + + + + + + +Return Values + + +A system call would not be useful most of the time +if it did not return some kind of a value: The file +descriptor of an open file, the number of bytes read +to a buffer, the system time, etc. + + + +Additionally, the system needs to inform us if an error +occurs: A file does not exist, system resources are exhausted, +we passed an invalid parameter, etc. + + + +Man Pages + + +The traditional place to look for information about various +system calls under &unix; systems are the manual pages. +FreeBSD describes its system calls in section 2, sometimes +in section 3. + + + +For example, open2 says: + + +
+ +If successful, open() returns a non-negative +integer, termed a file descriptor. It returns -1 on failure, +and sets errno to indicate the error. + + +
+ +The assembly language programmer new to &unix; and FreeBSD will +immediately ask the puzzling question: Where is +errno and how do I get to it? + + + + +The information presented in the manual pages applies +to C programs. The assembly language programmer needs additional +information. + + + +
+ + +Where Are the Return Values? + + +Unfortunately, it depends... For most system calls it is +in EAX, but not for all. +A good rule of thumb, +when working with a system call for +the first time, is to look for +the return value in EAX. +If it is not there, you +need further research. + + + + +I am aware of one system call that returns the value in +EDX: SYS_fork. All others +I have worked with use EAX. +But I have not worked with them all yet. + + + + + +If you cannot find the answer here or anywhere else, +study libc source code and see how it +interfaces with the kernel. + + + + + +Where Is <varname>errno</varname>? + + +Actually, nowhere... + + + +errno is part of the C language, not the +&unix; kernel. When accessing kernel services directly, the +error code is returned in EAX, +the same register the proper +return value generally ends up in. + + + +This makes perfect sense. If there is no error, there is +no error code. If there is an error, there is no return +value. One register can contain either. + + + + + +Determining an Error Occurred + + +When using the standard FreeBSD calling convention, +the carry flag is cleared upon success, +set upon failure. + + + +When using the Linux emulation mode, the signed +value in EAX is non-negative upon success, +and contains the return value. In case of an error, the value +is negative, i.e., -errno. + + + + +
+ + +Creating Portable Code + + +Portability is generally not one of the strengths of assembly language. +Yet, writing assembly language programs for different platforms is +possible, especially with nasm. I have written +assembly language libraries that can be assembled for such different +operating systems as &windows; and FreeBSD. + + + +It is all the more possible when you want your code to run +on two platforms which, while different, are based on +similar architectures. + + + +For example, FreeBSD is &unix;, Linux is &unix; like. I only +mentioned three differences between them (from an assembly language +programmer's perspective): The calling convention, the +function numbers, and the way of returning values. + + +Dealing with Function Numbers + + +In many cases the function numbers are the same. However, +even when they are not, the problem is easy to deal with: +Instead of using numbers in your code, use constants which +you have declared differently depending on the target +architecture: + + + +%ifdef LINUX +%define SYS_execve 11 +%else +%define SYS_execve 59 +%endif + + +Dealing with Conventions + +Both, the calling convention, and the return value (the +errno problem) can be resolved with macros: + + + +%ifdef LINUX + +%macro system 0 + call kernel +%endmacro + +align 4 +kernel: + push ebx + push ecx + push edx + push esi + push edi + push ebp + + mov ebx, [esp+32] + mov ecx, [esp+36] + mov edx, [esp+40] + mov esi, [esp+44] + mov ebp, [esp+48] + int 80h + + pop ebp + pop edi + pop esi + pop edx + pop ecx + pop ebx + + or eax, eax + js .errno + clc + ret + +.errno: + neg eax + stc + ret + +%else + +%macro system 0 + int 80h +%endmacro + +%endif + + + + +Dealing with Other Portability Issues + + +The above solutions can handle most cases of writing code +portable between FreeBSD and Linux. Nevertheless, with some +kernel services the differences are deeper. + + + +In that case, you need to write two different handlers +for those particular system calls, and use conditional +assembly. Luckily, most of your code does something other +than calling the kernel, so usually you will only need +a few such conditional sections in your code. + + + + +Using a Library + + +You can avoid portability issues in your main code altogether +by writing a library of system calls. Create a separate library +for FreeBSD, a different one for Linux, and yet other libraries +for more operating systems. + + + +In your library, write a separate function (or procedure, if +you prefer the traditional assembly language terminology) for each system +call. Use the C calling convention of passing parameters. +But still use EAX to pass the call number in. +In that case, your FreeBSD library can be very simple, as +many seemingly different functions can be just labels to +the same code: + + + +sys.open: +sys.close: +[etc...] + int 80h + ret + + + +Your Linux library will require more different functions. +But even here you can group system calls using the same +number of parameters: + + + +sys.exit: +sys.close: +[etc... one-parameter functions] + push ebx + mov ebx, [esp+12] + int 80h + pop ebx + jmp sys.return + +... + +sys.return: + or eax, eax + js sys.err + clc + ret + +sys.err: + neg eax + stc + ret + + + +The library approach may seem inconvenient at first because +it requires you to produce a separate file your code depends +on. But it has many advantages: For one, you only need to +write it once and can use it for all your programs. You can +even let other assembly language programmers use it, or perhaps use +one written by someone else. But perhaps the greatest +advantage of the library is that your code can be ported +to other systems, even by other programmers, by simply +writing a new library without any changes to your code. + + + +If you do not like the idea of having a library, you can +at least place all your system calls in a separate assembly language file +and link it with your main program. Here, again, all porters +have to do is create a new object file to link with your +main program. + + + + + +Using an Include File + + +If you are releasing your software as (or with) +source code, you can use macros and place them +in a separate file, which you include in your +code. + + + +Porters of your software will simply write a new +include file. No library or external object file +is necessary, yet your code is portable without any +need to edit the code. + + + + +This is the approach we will use throughout this chapter. +We will name our include file system.inc, and +add to it whenever we deal with a new system call. + + + + +We can start our system.inc by declaring the +standard file descriptors: + + + +%define stdin 0 +%define stdout 1 +%define stderr 2 + + + +Next, we create a symbolic name for each system call: + + + +%define SYS_nosys 0 +%define SYS_exit 1 +%define SYS_fork 2 +%define SYS_read 3 +%define SYS_write 4 +; [etc...] + + + +We add a short, non-global procedure with a long name, +so we do not accidentally reuse the name in our code: + + + +section .text +align 4 +access.the.bsd.kernel: + int 80h + ret + + + +We create a macro which takes one argument, the syscall number: + + + +%macro system 1 + mov eax, %1 + call access.the.bsd.kernel +%endmacro + + + +Finally, we create macros for each syscall. These macros take +no arguments. + + + +%macro sys.exit 0 + system SYS_exit +%endmacro + +%macro sys.fork 0 + system SYS_fork +%endmacro + +%macro sys.read 0 + system SYS_read +%endmacro + +%macro sys.write 0 + system SYS_write +%endmacro + +; [etc...] + + + +Go ahead, enter it into your editor and save it as +system.inc. We will add more to it as we +discuss more syscalls. + + + + + + + +Our First Program + + +We are now ready for our first program, the mandatory +Hello, World! + + + + 1: %include 'system.inc' + 2: + 3: section .data + 4: hello db 'Hello, World!', 0Ah + 5: hbytes equ $-hello + 6: + 7: section .text + 8: global _start + 9: _start: +10: push dword hbytes +11: push dword hello +12: push dword stdout +13: sys.write +14: +15: push dword 0 +16: sys.exit + + + +Here is what it does: Line 1 includes the defines, the macros, +and the code from system.inc. + + + +Lines 3-5 are the data: Line 3 starts the data section/segment. +Line 4 contains the string "Hello, World!" followed by a new +line (0Ah). Line 5 creates a constant that contains +the length of the string from line 4 in bytes. + + + +Lines 7-16 contain the code. Note that FreeBSD uses the elf +file format for its executables, which requires every +program to start at the point labeled _start (or, more +precisely, the linker expects that). This label has to be +global. + + + +Lines 10-13 ask the system to write hbytes bytes +of the hello string to stdout. + + + +Lines 15-16 ask the system to end the program with the return +value of 0. The SYS_exit syscall never +returns, so the code ends there. + + + + +If you have come to &unix; from &ms-dos; +assembly language background, you may be used to writing directly +to the video hardware. You will never have to worry about +this in FreeBSD, or any other flavor of &unix;. As far as +you are concerned, you are writing to a file known as +stdout. This can be the video screen, or +a telnet terminal, or an actual file, +or even the input of another program. Which one it is, +is for the system to figure out. + + + +Assembling the Code + + +Type the code (except the line numbers) in an editor, and save +it in a file named hello.asm. You need +nasm to assemble it. + + +Installing <application>nasm</application> + + +If you do not have nasm, type: + + +&prompt.user; su +Password:your root password +&prompt.root; cd /usr/ports/devel/nasm +&prompt.root; make install +&prompt.root; exit +&prompt.user; + + +You may type make install clean instead of just +make install if you do not want to keep +nasm source code. + + + +Either way, FreeBSD will automatically download +nasm from the Internet, +compile it, and install it on your system. + + + + +If your system is not FreeBSD, you need to get +nasm from its +home +page. You can still use it to assemble FreeBSD code. + + + + +Now you can assemble, link, and run the code: + + +&prompt.user; nasm -f elf hello.asm +&prompt.user; ld -s -o hello hello.o +&prompt.user; ./hello +Hello, World! +&prompt.user; + + + + + + + + +Writing &unix; Filters + + +A common type of &unix; application is a filter—a program +that reads data from the stdin, processes it +somehow, then writes the result to stdout. + + + +In this chapter, we shall develop a simple filter, and +learn how to read from stdin and write to +stdout. This filter will convert each byte +of its input into a hexadecimal number followed by a +blank space. + + + +%include 'system.inc' + +section .data +hex db '0123456789ABCDEF' +buffer db 0, 0, ' ' + +section .text +global _start +_start: + ; read a byte from stdin + push dword 1 + push dword buffer + push dword stdin + sys.read + add esp, byte 12 + or eax, eax + je .done + + ; convert it to hex + movzx eax, byte [buffer] + mov edx, eax + shr dl, 4 + mov dl, [hex+edx] + mov [buffer], dl + and al, 0Fh + mov al, [hex+eax] + mov [buffer+1], al + + ; print it + push dword 3 + push dword buffer + push dword stdout + sys.write + add esp, byte 12 + jmp short _start + +.done: + push dword 0 + sys.exit + + +In the data section we create an array called hex. +It contains the 16 hexadecimal digits in ascending order. +The array is followed by a buffer which we will use for +both input and output. The first two bytes of the buffer +are initially set to 0. This is where we will write +the two hexadecimal digits (the first byte also is +where we will read the input). The third byte is a +space. + + + +The code section consists of four parts: Reading the byte, +converting it to a hexadecimal number, writing the result, +and eventually exiting the program. + + + +To read the byte, we ask the system to read one byte +from stdin, and store it in the first byte +of the buffer. The system returns the number +of bytes read in EAX. This will be 1 +while data is coming, or 0, when no more input +data is available. Therefore, we check the value of +EAX. If it is 0, +we jump to .done, otherwise we continue. + + + + +For simplicity sake, we are ignoring the possibility +of an error condition at this time. + + + + +The hexadecimal conversion reads the byte from the +buffer into EAX, or actually just +AL, while clearing the remaining bits of +EAX to zeros. We also copy the byte to +EDX because we need to convert the upper +four bits (nibble) separately from the lower +four bits. We store the result in the first two +bytes of the buffer. + + + +Next, we ask the system to write the three bytes +of the buffer, i.e., the two hexadecimal digits and +the blank space, to stdout. We then +jump back to the beginning of the program and +process the next byte. + + + +Once there is no more input left, we ask the system +to exit our program, returning a zero, which is +the traditional value meaning the program was +successful. + + + +Go ahead, and save the code in a file named hex.asm, +then type the following (the ^D means press the +control key and type D while holding the +control key down): + + +&prompt.user; nasm -f elf hex.asm +&prompt.user; ld -s -o hex hex.o +&prompt.user; ./hex +Hello, World! +48 65 6C 6C 6F 2C 20 57 6F 72 6C 64 21 0A Here I come! +48 65 72 65 20 49 20 63 6F 6D 65 21 0A ^D &prompt.user; + + + +If you are migrating to &unix; from &ms-dos;, +you may be wondering why each line ends with 0A +instead of 0D 0A. +This is because &unix; does not use the cr/lf convention, but +a "new line" convention, which is 0A in hexadecimal. + + + + +Can we improve this? Well, for one, it is a bit confusing because +once we have converted a line of text, our input no longer +starts at the beginning of the line. We can modify it to print +a new line instead of a space after each 0A: + + + +%include 'system.inc' + +section .data +hex db '0123456789ABCDEF' +buffer db 0, 0, ' ' + +section .text +global _start +_start: + mov cl, ' ' + +.loop: + ; read a byte from stdin + push dword 1 + push dword buffer + push dword stdin + sys.read + add esp, byte 12 + or eax, eax + je .done + + ; convert it to hex + movzx eax, byte [buffer] + mov [buffer+2], cl + cmp al, 0Ah + jne .hex + mov [buffer+2], al + +.hex: + mov edx, eax + shr dl, 4 + mov dl, [hex+edx] + mov [buffer], dl + and al, 0Fh + mov al, [hex+eax] + mov [buffer+1], al + + ; print it + push dword 3 + push dword buffer + push dword stdout + sys.write + add esp, byte 12 + jmp short .loop + +.done: + push dword 0 + sys.exit + + +We have stored the space in the CL register. We can +do this safely because, unlike µsoft.windows;, &unix; system +calls do not modify the value of any register they do not use +to return a value in. + + + +That means we only need to set CL once. We have, therefore, +added a new label .loop and jump to it for the next byte +instead of jumping at _start. We have also added the +.hex label so we can either have a blank space or a +new line as the third byte of the buffer. + + + +Once you have changed hex.asm to reflect +these changes, type: + + +&prompt.user; nasm -f elf hex.asm +&prompt.user; ld -s -o hex hex.o +&prompt.user; ./hex +Hello, World! +48 65 6C 6C 6F 2C 20 57 6F 72 6C 64 21 0A +Here I come! +48 65 72 65 20 49 20 63 6F 6D 65 21 0A +^D &prompt.user; + + +That looks better. But this code is quite inefficient! We +are making a system call for every single byte twice (once +to read it, another time to write the output). + + + + + +Buffered Input and Output + + +We can improve the efficiency of our code by buffering our +input and output. We create an input buffer and read a whole +sequence of bytes at one time. Then we fetch them one by one +from the buffer. + + + +We also create an output buffer. We store our output in it until +it is full. At that time we ask the kernel to write the contents +of the buffer to stdout. + + + +The program ends when there is no more input. But we still need +to ask the kernel to write the contents of our output buffer +to stdout one last time, otherwise some of our output +would make it to the output buffer, but never be sent out. +Do not forget that, or you will be wondering why some of your +output is missing. + + + +%include 'system.inc' + +%define BUFSIZE 2048 + +section .data +hex db '0123456789ABCDEF' + +section .bss +ibuffer resb BUFSIZE +obuffer resb BUFSIZE + +section .text +global _start +_start: + sub eax, eax + sub ebx, ebx + sub ecx, ecx + mov edi, obuffer + +.loop: + ; read a byte from stdin + call getchar + + ; convert it to hex + mov dl, al + shr al, 4 + mov al, [hex+eax] + call putchar + + mov al, dl + and al, 0Fh + mov al, [hex+eax] + call putchar + + mov al, ' ' + cmp dl, 0Ah + jne .put + mov al, dl + +.put: + call putchar + jmp short .loop + +align 4 +getchar: + or ebx, ebx + jne .fetch + + call read + +.fetch: + lodsb + dec ebx + ret + +read: + push dword BUFSIZE + mov esi, ibuffer + push esi + push dword stdin + sys.read + add esp, byte 12 + mov ebx, eax + or eax, eax + je .done + sub eax, eax + ret + +align 4 +.done: + call write ; flush output buffer + push dword 0 + sys.exit + +align 4 +putchar: + stosb + inc ecx + cmp ecx, BUFSIZE + je write + ret + +align 4 +write: + sub edi, ecx ; start of buffer + push ecx + push edi + push dword stdout + sys.write + add esp, byte 12 + sub eax, eax + sub ecx, ecx ; buffer is empty now + ret + + +We now have a third section in the source code, named +.bss. This section is not included in our +executable file, and, therefore, cannot be initialized. We use +resb instead of db. +It simply reserves the requested size of uninitialized memory +for our use. + + + +We take advantage of the fact that the system does not modify the +registers: We use registers for what, otherwise, would have to be +global variables stored in the .data section. This is +also why the &unix; convention of passing parameters to system calls +on the stack is superior to the Microsoft convention of passing +them in the registers: We can keep the registers for our own use. + + + +We use EDI and ESI as pointers to the next byte +to be read from or written to. We use EBX and +ECX to keep count of the number of bytes in the +two buffers, so we know when to dump the output to, or read more +input from, the system. + + + +Let us see how it works now: + + +&prompt.user; nasm -f elf hex.asm +&prompt.user; ld -s -o hex hex.o +&prompt.user; ./hex +Hello, World! +Here I come! +48 65 6C 6C 6F 2C 20 57 6F 72 6C 64 21 0A +48 65 72 65 20 49 20 63 6F 6D 65 21 0A +^D &prompt.user; + + +Not what you expected? The program did not print the output +until we pressed ^D. That is easy to fix by +inserting three lines of code to write the output every time +we have converted a new line to 0A. I have marked +the three lines with > (do not copy the > in your +hex.asm). + + + +%include 'system.inc' + +%define BUFSIZE 2048 + +section .data +hex db '0123456789ABCDEF' + +section .bss +ibuffer resb BUFSIZE +obuffer resb BUFSIZE + +section .text +global _start +_start: + sub eax, eax + sub ebx, ebx + sub ecx, ecx + mov edi, obuffer + +.loop: + ; read a byte from stdin + call getchar + + ; convert it to hex + mov dl, al + shr al, 4 + mov al, [hex+eax] + call putchar + + mov al, dl + and al, 0Fh + mov al, [hex+eax] + call putchar + + mov al, ' ' + cmp dl, 0Ah + jne .put + mov al, dl + +.put: + call putchar +> cmp al, 0Ah +> jne .loop +> call write + jmp short .loop + +align 4 +getchar: + or ebx, ebx + jne .fetch + + call read + +.fetch: + lodsb + dec ebx + ret + +read: + push dword BUFSIZE + mov esi, ibuffer + push esi + push dword stdin + sys.read + add esp, byte 12 + mov ebx, eax + or eax, eax + je .done + sub eax, eax + ret + +align 4 +.done: + call write ; flush output buffer + push dword 0 + sys.exit + +align 4 +putchar: + stosb + inc ecx + cmp ecx, BUFSIZE + je write + ret + +align 4 +write: + sub edi, ecx ; start of buffer + push ecx + push edi + push dword stdout + sys.write + add esp, byte 12 + sub eax, eax + sub ecx, ecx ; buffer is empty now + ret + + + +Now, let us see how it works: + + +&prompt.user; nasm -f elf hex.asm +&prompt.user; ld -s -o hex hex.o +&prompt.user; ./hex +Hello, World! +48 65 6C 6C 6F 2C 20 57 6F 72 6C 64 21 0A +Here I come! +48 65 72 65 20 49 20 63 6F 6D 65 21 0A +^D &prompt.user; + + +Not bad for a 644-byte executable, is it! + + + + +This approach to buffered input/output still +contains a hidden danger. I will discuss—and +fix—it later, when I talk about the +dark +side of buffering. + + + +How to Unread a Character + + +This may be a somewhat advanced topic, mostly of interest to +programmers familiar with the theory of compilers. If you wish, +you may skip to the next +section, and perhaps read this later. + + + +While our sample program does not require it, more sophisticated +filters often need to look ahead. In other words, they may need +to see what the next character is (or even several characters). +If the next character is of a certain value, it is part of the +token currently being processed. Otherwise, it is not. + + + +For example, you may be parsing the input stream for a textual +string (e.g., when implementing a language compiler): If a +character is followed by another character, or perhaps a digit, +it is part of the token you are processing. If it is followed by +white space, or some other value, then it is not part of the +current token. + + + +This presents an interesting problem: How to return the next +character back to the input stream, so it can be read again +later? + + + +One possible solution is to store it in a character variable, +then set a flag. We can modify getchar to check the flag, +and if it is set, fetch the byte from that variable instead of the +input buffer, and reset the flag. But, of course, that slows us +down. + + + +The C language has an ungetc() function, just for that +purpose. Is there a quick way to implement it in our code? +I would like you to scroll back up and take a look at the +getchar procedure and see if you can find a nice and +fast solution before reading the next paragraph. Then come back +here and see my own solution. + + + +The key to returning a character back to the stream is in how +we are getting the characters to start with: + + + +First we check if the buffer is empty by testing the value +of EBX. If it is zero, we call the +read procedure. + + + +If we do have a character available, we use lodsb, then +decrease the value of EBX. The lodsb +instruction is effectively identical to: + + + + mov al, [esi] + inc esi + + + +The byte we have fetched remains in the buffer until the next +time read is called. We do not know when that happens, +but we do know it will not happen until the next call to +getchar. Hence, to "return" the last-read byte back +to the stream, all we have to do is decrease the value of +ESI and increase the value of EBX: + + + +ungetc: + dec esi + inc ebx + ret + + + +But, be careful! We are perfectly safe doing this if our look-ahead +is at most one character at a time. If we are examining more than +one upcoming character and call ungetc several times +in a row, it will work most of the time, but not all the time +(and will be tough to debug). Why? + + + +Because as long as getchar does not have to call +read, all of the pre-read bytes are still in the buffer, +and our ungetc works without a glitch. But the moment +getchar calls read, +the contents of the buffer change. + + + +We can always rely on ungetc working properly on the last +character we have read with getchar, but not on anything +we have read before that. + + + +If your program reads more than one byte ahead, you have at least +two choices: + + + +If possible, modify the program so it only reads one byte ahead. +This is the simplest solution. + + + +If that option is not available, first of all determine the maximum +number of characters your program needs to return to the input +stream at one time. Increase that number slightly, just to be +sure, preferably to a multiple of 16—so it aligns nicely. +Then modify the .bss section of your code, and create +a small "spare" buffer right before your input buffer, +something like this: + + + +section .bss + resb 16 ; or whatever the value you came up with +ibuffer resb BUFSIZE +obuffer resb BUFSIZE + + + +You also need to modify your ungetc to pass the value +of the byte to unget in AL: + + + +ungetc: + dec esi + inc ebx + mov [esi], al + ret + + + +With this modification, you can call ungetc +up to 17 times in a row safely (the first call will still +be within the buffer, the remaining 16 may be either within +the buffer or within the "spare"). + + + + + + +Command Line Arguments + + +Our hex program will be more useful if it can +read the names of an input and output file from its command +line, i.e., if it can process the command line arguments. +But... Where are they? + + + +Before a &unix; system starts a program, it pushes some +data on the stack, then jumps at the _start +label of the program. Yes, I said jumps, not calls. That means the +data can be accessed by reading [esp+offset], +or by simply popping it. + + + +The value at the top of the stack contains the number of +command line arguments. It is traditionally called +argc, for "argument count." + + + +Command line arguments follow next, all argc of them. +These are typically referred to as argv, for +"argument value(s)." That is, we get argv[0], +argv[1], ..., +argv[argc-1]. These are not the actual +arguments, but pointers to arguments, i.e., memory addresses of +the actual arguments. The arguments themselves are +NUL-terminated character strings. + + + +The argv list is followed by a NULL pointer, +which is simply a 0. There is more, but this is +enough for our purposes right now. + + + + +If you have come from the &ms-dos; programming +environment, the main difference is that each argument is in +a separate string. The second difference is that there is no +practical limit on how many arguments there can be. + + + + +Armed with this knowledge, we are almost ready for the next +version of hex.asm. First, however, we need to +add a few lines to system.inc: + + + +First, we need to add two new entries to our list of system +call numbers: + + + +%define SYS_open 5 +%define SYS_close 6 + + + +Then we add two new macros at the end of the file: + + + +%macro sys.open 0 + system SYS_open +%endmacro + +%macro sys.close 0 + system SYS_close +%endmacro + + + +Here, then, is our modified source code: + + + +%include 'system.inc' + +%define BUFSIZE 2048 + +section .data +fd.in dd stdin +fd.out dd stdout +hex db '0123456789ABCDEF' + +section .bss +ibuffer resb BUFSIZE +obuffer resb BUFSIZE + +section .text +align 4 +err: + push dword 1 ; return failure + sys.exit + +align 4 +global _start +_start: + add esp, byte 8 ; discard argc and argv[0] + + pop ecx + jecxz .init ; no more arguments + + ; ECX contains the path to input file + push dword 0 ; O_RDONLY + push ecx + sys.open + jc err ; open failed + + add esp, byte 8 + mov [fd.in], eax + + pop ecx + jecxz .init ; no more arguments + + ; ECX contains the path to output file + push dword 420 ; file mode (644 octal) + push dword 0200h | 0400h | 01h + ; O_CREAT | O_TRUNC | O_WRONLY + push ecx + sys.open + jc err + + add esp, byte 12 + mov [fd.out], eax + +.init: + sub eax, eax + sub ebx, ebx + sub ecx, ecx + mov edi, obuffer + +.loop: + ; read a byte from input file or stdin + call getchar + + ; convert it to hex + mov dl, al + shr al, 4 + mov al, [hex+eax] + call putchar + + mov al, dl + and al, 0Fh + mov al, [hex+eax] + call putchar + + mov al, ' ' + cmp dl, 0Ah + jne .put + mov al, dl + +.put: + call putchar + cmp al, dl + jne .loop + call write + jmp short .loop + +align 4 +getchar: + or ebx, ebx + jne .fetch + + call read + +.fetch: + lodsb + dec ebx + ret + +read: + push dword BUFSIZE + mov esi, ibuffer + push esi + push dword [fd.in] + sys.read + add esp, byte 12 + mov ebx, eax + or eax, eax + je .done + sub eax, eax + ret + +align 4 +.done: + call write ; flush output buffer + + ; close files + push dword [fd.in] + sys.close + + push dword [fd.out] + sys.close + + ; return success + push dword 0 + sys.exit + +align 4 +putchar: + stosb + inc ecx + cmp ecx, BUFSIZE + je write + ret + +align 4 +write: + sub edi, ecx ; start of buffer + push ecx + push edi + push dword [fd.out] + sys.write + add esp, byte 12 + sub eax, eax + sub ecx, ecx ; buffer is empty now + ret + + + +In our .data section we now have two new variables, +fd.in and fd.out. We store the input and +output file descriptors here. + + + +In the .text section we have replaced the references +to stdin and stdout with +[fd.in] and [fd.out]. + + + +The .text section now starts with a simple error +handler, which does nothing but exit the program with a return +value of 1. +The error handler is before _start so we are +within a short distance from where the errors occur. + + + +Naturally, the program execution still begins at _start. +First, we remove argc and argv[0] from the +stack: They are of no interest to us (in this program, that is). + + + +We pop argv[1] to ECX. This +register is particularly suited for pointers, as we can handle +NULL pointers with jecxz. If argv[1] +is not NULL, we try to open the file named in the first +argument. Otherwise, we continue the program as before: Reading +from stdin, writing to stdout. +If we fail to open the input file (e.g., it does not exist), +we jump to the error handler and quit. + + + +If all went well, we now check for the second argument. If +it is there, we open the output file. Otherwise, we send +the output to stdout. If we fail to open the output +file (e.g., it exists and we do not have the write permission), +we, again, jump to the error handler. + + + +The rest of the code is the same as before, except we close +the input and output files before exiting, and, as mentioned, +we use [fd.in] and [fd.out]. + + + +Our executable is now a whopping 768 bytes long. + + + +Can we still improve it? Of course! Every program can be improved. +Here are a few ideas of what we could do: + + + + + +Have our error handler print a message to +stderr. + + + + + +Add error handlers to the read +and write functions. + + + + + +Close stdin when we open an input file, +stdout when we open an output file. + + + + + +Add command line switches, such as -i +and -o, so we can list the input and +output files in any order, or perhaps read from +stdin and write to a file. + + + + + +Print a usage message if command line arguments are incorrect. + + + + + +I shall leave these enhancements as an exercise to the reader: +You already know everything you need to know to implement them. + + + + + +&unix; Environment + + +An important &unix; concept is the environment, which is defined by +environment variables. Some are set by the system, others +by you, yet others by the shell, or any program +that loads another program. + + + +How to Find Environment Variables + + +I said earlier that when a program starts executing, the stack +contains argc followed by the NULL-terminated +argv array, followed by something else. The +"something else" is the environment, or, +to be more precise, a NULL-terminated array of pointers to +environment variables. This is often referred +to as env. + + + +The structure of env is the same as that of +argv, a list of memory addresses followed by a +NULL (0). In this case, there is no +"envc"—we figure out where the array ends +by searching for the final NULL. + + + +The variables usually come in the name=value +format, but sometimes the =value part +may be missing. We need to account for that possibility. + + + + + +webvars + + +I could just show you some code that prints the environment +the same way the &unix; env command does. But +I thought it would be more interesting to write a simple +assembly language CGI utility. + + + +CGI: A Quick Overview + + +I have a +detailed +CGI tutorial on my web site, +but here is a very quick overview of CGI: + + + + + +The web server communicates with the CGI +program by setting environment variables. + + + + + +The CGI program +sends its output to stdout. +The web server reads it from there. + + + + + +It must start with an HTTP +header followed by two blank lines. + + + + + +It then prints the HTML +code, or whatever other type of data it is producing. + + + + + + +While certain environment variables use +standard names, others vary, depending on the web server. That +makes webvars +quite a useful diagnostic tool. + + + + + + +The Code + + +Our webvars program, then, must send out +the HTTP header followed by some +HTML mark-up. It then must read +the environment variables one by one +and send them out as part of the +HTML page. + + + +The code follows. I placed comments and explanations +right inside the code: + + + +;;;;;;; webvars.asm ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; +; Copyright (c) 2000 G. Adam Stanislav +; All rights reserved. +; +; Redistribution and use in source and binary forms, with or without +; modification, are permitted provided that the following conditions +; are met: +; 1. Redistributions of source code must retain the above copyright +; notice, this list of conditions and the following disclaimer. +; 2. Redistributions in binary form must reproduce the above copyright +; notice, this list of conditions and the following disclaimer in the +; documentation and/or other materials provided with the distribution. +; +; THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 THE AUTHOR OR CONTRIBUTORS 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. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; +; Version 1.0 +; +; Started: 8-Dec-2000 +; Updated: 8-Dec-2000 +; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +%include 'system.inc' + +section .data +http db 'Content-type: text/html', 0Ah, 0Ah + db '<?xml version="1.0" encoding="UTF-8"?>', 0Ah + db '<!DOCTYPE html PUBLIC "-//W3C/DTD XHTML Strict//EN" ' + db '"DTD/xhtml1-strict.dtd">', 0Ah + db '<html xmlns="http://www.w3.org/1999/xhtml" ' + db 'xml.lang="en" lang="en">', 0Ah + db '<head>', 0Ah + db '<title>Web Environment</title>', 0Ah + db '<meta name="author" content="G. Adam Stanislav" />', 0Ah + db '</head>', 0Ah, 0Ah + db '<body bgcolor="#ffffff" text="#000000" link="#0000ff" ' + db 'vlink="#840084" alink="#0000ff">', 0Ah + db '<div class="webvars">', 0Ah + db '<h1>Web Environment</h1>', 0Ah + db '<p>The following <b>environment variables</b> are defined ' + db 'on this web server:</p>', 0Ah, 0Ah + db '<table align="center" width="80" border="0" cellpadding="10" ' + db 'cellspacing="0" class="webvars">', 0Ah +httplen equ $-http +left db '<tr>', 0Ah + db '<td class="name"><tt>' +leftlen equ $-left +middle db '</tt></td>', 0Ah + db '<td class="value"><tt><b>' +midlen equ $-middle +undef db '<i>(undefined)</i>' +undeflen equ $-undef +right db '</b></tt></td>', 0Ah + db '</tr>', 0Ah +rightlen equ $-right +wrap db '</table>', 0Ah + db '</div>', 0Ah + db '</body>', 0Ah + db '</html>', 0Ah, 0Ah +wraplen equ $-wrap + +section .text +global _start +_start: + ; First, send out all the http and xhtml stuff that is + ; needed before we start showing the environment + push dword httplen + push dword http + push dword stdout + sys.write + + ; Now find how far on the stack the environment pointers + ; are. We have 12 bytes we have pushed before "argc" + mov eax, [esp+12] + + ; We need to remove the following from the stack: + ; + ; The 12 bytes we pushed for sys.write + ; The 4 bytes of argc + ; The EAX*4 bytes of argv + ; The 4 bytes of the NULL after argv + ; + ; Total: + ; 20 + eax * 4 + ; + ; Because stack grows down, we need to ADD that many bytes + ; to ESP. + lea esp, [esp+20+eax*4] + cld ; This should already be the case, but let's be sure. + + ; Loop through the environment, printing it out +.loop: + pop edi + or edi, edi ; Done yet? + je near .wrap + + ; Print the left part of HTML + push dword leftlen + push dword left + push dword stdout + sys.write + + ; It may be tempting to search for the '=' in the env string next. + ; But it is possible there is no '=', so we search for the + ; terminating NUL first. + mov esi, edi ; Save start of string + sub ecx, ecx + not ecx ; ECX = FFFFFFFF + sub eax, eax +repne scasb + not ecx ; ECX = string length + 1 + mov ebx, ecx ; Save it in EBX + + ; Now is the time to find '=' + mov edi, esi ; Start of string + mov al, '=' +repne scasb + not ecx + add ecx, ebx ; Length of name + + push ecx + push esi + push dword stdout + sys.write + + ; Print the middle part of HTML table code + push dword midlen + push dword middle + push dword stdout + sys.write + + ; Find the length of the value + not ecx + lea ebx, [ebx+ecx-1] + + ; Print "undefined" if 0 + or ebx, ebx + jne .value + + mov ebx, undeflen + mov edi, undef + +.value: + push ebx + push edi + push dword stdout + sys.write + + ; Print the right part of the table row + push dword rightlen + push dword right + push dword stdout + sys.write + + ; Get rid of the 60 bytes we have pushed + add esp, byte 60 + + ; Get the next variable + jmp .loop + +.wrap: + ; Print the rest of HTML + push dword wraplen + push dword wrap + push dword stdout + sys.write + + ; Return success + push dword 0 + sys.exit + + + +This code produces a 1,396-byte executable. Most of it is data, +i.e., the HTML mark-up we need to send out. + + + +Assemble and link it as usual: + + +&prompt.user; nasm -f elf webvars.asm +&prompt.user; ld -s -o webvars webvars.o + + +To use it, you need to upload webvars to your +web server. Depending on how your web server is set up, you +may have to store it in a special cgi-bin directory, +or perhaps rename it with a .cgi extension. + + + +Then you need to use your browser to view its output. +To see its output on my web server, please go to +http://www.int80h.org/webvars/. +If curious about the additional environment variables +present in a password protected web directory, go to +http://www.int80h.org/private/, +using the name asm and password +programmer. + + + + + + + + + +Working with Files + + +We have already done some basic file work: We know how +to open and close them, how to read and write them using +buffers. But &unix; offers much more functionality when it +comes to files. We will examine some of it in this section, +and end up with a nice file conversion utility. + + + +Indeed, let us start at the end, that is, with the file +conversion utility. It always makes programming easier +when we know from the start what the end product is +supposed to do. + + + +One of the first programs I wrote for &unix; was +tuc, +a text-to-&unix; file converter. It converts a text +file from other operating systems to a &unix; text file. +In other words, it changes from different kind of line endings +to the newline convention of &unix;. It saves the output +in a different file. Optionally, it converts a &unix; text +file to a DOS text file. + + + +I have used tuc extensively, but always +only to convert from some other OS +to &unix;, never the other way. I have always wished +it would just overwrite the file instead of me having +to send the output to a different file. Most of the time, +I end up using it like this: + + +&prompt.user; tuc myfile tempfile +&prompt.user; mv tempfile myfile + + +It would be nice to have a ftuc, +i.e., fast tuc, and use it like this: + + +&prompt.user; ftuc myfile + + +In this chapter, then, we will write +ftuc in assembly language +(the original tuc +is in C), and study various +file-oriented kernel services in the process. + + + +At first sight, such a file conversion is very +simple: All you have to do is strip the carriage +returns, right? + + + +If you answered yes, think again: That approach will +work most of the time (at least with MS +DOS text files), but will fail occasionally. + + + +The problem is that not all non &unix; text files end their +line with the carriage return / line feed sequence. Some +use carriage returns without line feeds. Others combine several +blank lines into a single carriage return followed by several +line feeds. And so on. + + + +A text file converter, then, must be able to handle +any possible line endings: + + + + + +carriage return / line feed + + + + + +carriage return + + + + + +line feed / carriage return + + + + + +line feed + + + + + +It should also handle files that use some kind of a +combination of the above (e.g., carriage return followed +by several line feeds). + + + +Finite State Machine + + +The problem is easily solved by the use of a technique +called finite state machine, originally developed +by the designers of digital electronic circuits. A +finite state machine is a digital circuit +whose output is dependent not only on its input but on +its previous input, i.e., on its state. The microprocessor +is an example of a finite state machine: Our +assembly language code is assembled to machine language in which +some assembly language code produces a single byte +of machine language, while others produce several bytes. +As the microprocessor fetches the bytes from the memory +one by one, some of them simply change its state rather than +produce some output. When all the bytes of the op code are +fetched, the microprocessor produces some output, or changes +the value of a register, etc. + + + +Because of that, all software is essentially a sequence of state +instructions for the microprocessor. Nevertheless, the concept +of finite state machine is useful in software design as well. + + + +Our text file converter can be designed as a finite state machine with three +possible states. We could call them states 0-2, +but it will make our life easier if we give them symbolic names: + + + + + +ordinary + + + + + +cr + + + + + +lf + + + + + +Our program will start in the ordinary +state. During this state, the program action depends on +its input as follows: + + + + + +If the input is anything other than a carriage return +or line feed, the input is simply passed on to the output. The +state remains unchanged. + + + + + +If the input is a carriage return, the state is changed +to cr. The input is then discarded, i.e., +no output is made. + + + + + +If the input is a line feed, the state is changed to +lf. The input is then discarded. + + + + + +Whenever we are in the cr state, it is +because the last input was a carriage return, which was +unprocessed. What our software does in this state again +depends on the current input: + + + + + +If the input is anything other than a carriage return +or line feed, output a line feed, then output the input, then +change the state to ordinary. + + + + + +If the input is a carriage return, we have received +two (or more) carriage returns in a row. We discard the +input, we output a line feed, and leave the state unchanged. + + + + + +If the input is a line feed, we output the line feed +and change the state to ordinary. Note that +this is not the same as the first case above – if we tried +to combine them, we would be outputting two line feeds +instead of one. + + + + + +Finally, we are in the lf state after +we have received a line feed that was not preceded by a +carriage return. This will happen when our file already is +in &unix; format, or whenever several lines in a row are +expressed by a single carriage return followed by several +line feeds, or when line ends with a line feed / +carriage return sequence. Here is how we need to handle +our input in this state: + + + + + +If the input is anything other than a carriage return or +line feed, we output a line feed, then output the input, then +change the state to ordinary. This is exactly +the same action as in the cr state upon +receiving the same kind of input. + + + + + +If the input is a carriage return, we discard the input, +we output a line feed, then change the state to ordinary. + + + + + +If the input is a line feed, we output the line feed, +and leave the state unchanged. + + + + + +The Final State + + +The above finite state machine works for the entire file, but leaves +the possibility that the final line end will be ignored. That will +happen whenever the file ends with a single carriage return or +a single line feed. I did not think of it when I wrote +tuc, just to discover that +occasionally it strips the last line ending. + + + +This problem is easily fixed by checking the state after the +entire file was processed. If the state is not +ordinary, we simply +need to output one last line feed. + + + + +Now that we have expressed our algorithm as a finite state machine, +we could easily design a dedicated digital electronic +circuit (a "chip") to do the conversion for us. Of course, +doing so would be considerably more expensive than writing +an assembly language program. + + + + + + +The Output Counter + + +Because our file conversion program may be combining two +characters into one, we need to use an output counter. We +initialize it to 0, and increase it +every time we send a character to the output. At the end of +the program, the counter will tell us what size we need +to set the file to. + + + + + + + +Implementing FSM in Software + + +The hardest part of working with a finite state machine +is analyzing the problem and expressing it as a +finite state machine. That accomplished, +the software almost writes itself. + + + +In a high-level language, such as C, there are several main +approaches. One is to use a switch statement +which chooses what function should be run. For example, + + + + switch (state) { + default: + case REGULAR: + regular(inputchar); + break; + case CR: + cr(inputchar); + break; + case LF: + lf(inputchar); + break; + } + + + +Another approach is by using an array of function pointers, +something like this: + + + + (output[state])(inputchar); + + + +Yet another is to have state be a +function pointer, set to point at the appropriate function: + + + + (*state)(inputchar); + + +This is the approach we will use in our program because it is very easy to do in assembly language, and very fast, too. We will simply keep the address of the right procedure in EBX, and then just issue: + + + call ebx + + + +This is possibly faster than hardcoding the address in the code +because the microprocessor does not have to fetch the address from +the memory—it is already stored in one of its registers. I said +possibly because with the caching modern +microprocessors do, either way may be equally fast. + + + + + +Memory Mapped Files + + +Because our program works on a single file, we cannot use the +approach that worked for us before, i.e., to read from an input +file and to write to an output file. + + + +&unix; allows us to map a file, or a section of a file, +into memory. To do that, we first need to open the file with the +appropriate read/write flags. Then we use the mmap +system call to map it into the memory. One nice thing about +mmap is that it automatically works with +virtual memory: We can map more of the file into the memory than +we have physical memory available, yet still access it through +regular memory op codes, such as mov, +lods, and stos. +Whatever changes we make to the memory image of the file will be +written to the file by the system. We do not even have to keep +the file open: As long as it stays mapped, we can +read from it and write to it. + + + +The 32-bit Intel microprocessors can access up to four +gigabytes of memory – physical or virtual. The FreeBSD system +allows us to use up to a half of it for file mapping. + + + +For simplicity sake, in this tutorial we will only convert files +that can be mapped into the memory in their entirety. There are +probably not too many text files that exceed two gigabytes in size. +If our program encounters one, it will simply display a message +suggesting we use the original +tuc instead. + + + +If you examine your copy of syscalls.master, +you will find two separate syscalls named mmap. +This is because of evolution of &unix;: There was the traditional +BSD mmap, +syscall 71. That one was superseded by the &posix; mmap, +syscall 197. The FreeBSD system supports both because +older programs were written by using the original BSD +version. But new software uses the &posix; version, +which is what we will use. + + + +The syscalls.master file lists +the &posix; version like this: + + + +197 STD BSD { caddr_t mmap(caddr_t addr, size_t len, int prot, \ + int flags, int fd, long pad, off_t pos); } + + + +This differs slightly from what +mmap2 +says. That is because +mmap2 +describes the C version. + + + +The difference is in the long pad argument, which is not present in the C version. However, the FreeBSD syscalls add a 32-bit pad after pushing a 64-bit argument. In this case, off_t is a 64-bit value. + + +When we are finished working with a memory-mapped file, +we unmap it with the munmap syscall: + + + + +For an in-depth treatment of mmap, see +W. Richard Stevens' +Unix +Network Programming, Volume 2, Chapter 12. + + + + + + +Determining File Size + + +Because we need to tell mmap how many bytes +of the file to map into the memory, and because we want to map +the entire file, we need to determine the size of the file. + + + +We can use the fstat syscall to get all +the information about an open file that the system can give us. +That includes the file size. + + + +Again, syscalls.master lists two versions +of fstat, a traditional one +(syscall 62), and a &posix; one +(syscall 189). Naturally, we will use the +&posix; version: + + + +189 STD POSIX { int fstat(int fd, struct stat *sb); } + + + +This is a very straightforward call: We pass to it the address +of a stat structure and the descriptor +of an open file. It will fill out the contents of the +stat structure. + + + +I do, however, have to say that I tried to declare the +stat structure in the +.bss section, and +fstat did not like it: It set the carry +flag indicating an error. After I changed the code to allocate +the structure on the stack, everything was working fine. + + + + + +Changing the File Size + + +Because our program may combine carriage return / line feed +sequences into straight line feeds, our output may be smaller +than our input. However, since we are placing our output into +the same file we read the input from, we may have to change the +size of the file. + + + +The ftruncate system call allows us to do +just that. Despite its somewhat misleading name, the +ftruncate system call can be used to both +truncate the file (make it smaller) and to grow it. + + + +And yes, we will find two versions of ftruncate +in syscalls.master, an older one +(130), and a newer one (201). We will use +the newer one: + + + +201 STD BSD { int ftruncate(int fd, int pad, off_t length); } + + + +Please note that this one contains a int pad again. + + + + + +ftuc + + +We now know everything we need to write ftuc. +We start by adding some new lines in system.inc. +First, we define some constants and structures, somewhere at +or near the beginning of the file: + + + +;;;;;;; open flags +%define O_RDONLY 0 +%define O_WRONLY 1 +%define O_RDWR 2 + +;;;;;;; mmap flags +%define PROT_NONE 0 +%define PROT_READ 1 +%define PROT_WRITE 2 +%define PROT_EXEC 4 +;; +%define MAP_SHARED 0001h +%define MAP_PRIVATE 0002h + +;;;;;;; stat structure +struc stat +st_dev resd 1 ; = 0 +st_ino resd 1 ; = 4 +st_mode resw 1 ; = 8, size is 16 bits +st_nlink resw 1 ; = 10, ditto +st_uid resd 1 ; = 12 +st_gid resd 1 ; = 16 +st_rdev resd 1 ; = 20 +st_atime resd 1 ; = 24 +st_atimensec resd 1 ; = 28 +st_mtime resd 1 ; = 32 +st_mtimensec resd 1 ; = 36 +st_ctime resd 1 ; = 40 +st_ctimensec resd 1 ; = 44 +st_size resd 2 ; = 48, size is 64 bits +st_blocks resd 2 ; = 56, ditto +st_blksize resd 1 ; = 64 +st_flags resd 1 ; = 68 +st_gen resd 1 ; = 72 +st_lspare resd 1 ; = 76 +st_qspare resd 4 ; = 80 +endstruc + + + +We define the new syscalls: + + + +%define SYS_mmap 197 +%define SYS_munmap 73 +%define SYS_fstat 189 +%define SYS_ftruncate 201 + + + +We add the macros for their use: + + + +%macro sys.mmap 0 + system SYS_mmap +%endmacro + +%macro sys.munmap 0 + system SYS_munmap +%endmacro + +%macro sys.ftruncate 0 + system SYS_ftruncate +%endmacro + +%macro sys.fstat 0 + system SYS_fstat +%endmacro + + + +And here is our code: + + + +;;;;;;; Fast Text-to-Unix Conversion (ftuc.asm) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;; Started: 21-Dec-2000 +;; Updated: 22-Dec-2000 +;; +;; Copyright 2000 G. Adam Stanislav. +;; All rights reserved. +;; +;;;;;;; v.1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +%include 'system.inc' + +section .data + db 'Copyright 2000 G. Adam Stanislav.', 0Ah + db 'All rights reserved.', 0Ah +usg db 'Usage: ftuc filename', 0Ah +usglen equ $-usg +co db "ftuc: Can't open file.", 0Ah +colen equ $-co +fae db 'ftuc: File access error.', 0Ah +faelen equ $-fae +ftl db 'ftuc: File too long, use regular tuc instead.', 0Ah +ftllen equ $-ftl +mae db 'ftuc: Memory allocation error.', 0Ah +maelen equ $-mae + +section .text + +align 4 +memerr: + push dword maelen + push dword mae + jmp short error + +align 4 +toolong: + push dword ftllen + push dword ftl + jmp short error + +align 4 +facerr: + push dword faelen + push dword fae + jmp short error + +align 4 +cantopen: + push dword colen + push dword co + jmp short error + +align 4 +usage: + push dword usglen + push dword usg + +error: + push dword stderr + sys.write + + push dword 1 + sys.exit + +align 4 +global _start +_start: + pop eax ; argc + pop eax ; program name + pop ecx ; file to convert + jecxz usage + + pop eax + or eax, eax ; Too many arguments? + jne usage + + ; Open the file + push dword O_RDWR + push ecx + sys.open + jc cantopen + + mov ebp, eax ; Save fd + + sub esp, byte stat_size + mov ebx, esp + + ; Find file size + push ebx + push ebp ; fd + sys.fstat + jc facerr + + mov edx, [ebx + st_size + 4] + + ; File is too long if EDX != 0 ... + or edx, edx + jne near toolong + mov ecx, [ebx + st_size] + ; ... or if it is above 2 GB + or ecx, ecx + js near toolong + + ; Do nothing if the file is 0 bytes in size + jecxz .quit + + ; Map the entire file in memory + push edx + push edx ; starting at offset 0 + push edx ; pad + push ebp ; fd + push dword MAP_SHARED + push dword PROT_READ | PROT_WRITE + push ecx ; entire file size + push edx ; let system decide on the address + sys.mmap + jc near memerr + + mov edi, eax + mov esi, eax + push ecx ; for SYS_munmap + push edi + + ; Use EBX for state machine + mov ebx, ordinary + mov ah, 0Ah + cld + +.loop: + lodsb + call ebx + loop .loop + + cmp ebx, ordinary + je .filesize + + ; Output final lf + mov al, ah + stosb + inc edx + +.filesize: + ; truncate file to new size + push dword 0 ; high dword + push edx ; low dword + push eax ; pad + push ebp + sys.ftruncate + + ; close it (ebp still pushed) + sys.close + + add esp, byte 16 + sys.munmap + +.quit: + push dword 0 + sys.exit + +align 4 +ordinary: + cmp al, 0Dh + je .cr + + cmp al, ah + je .lf + + stosb + inc edx + ret + +align 4 +.cr: + mov ebx, cr + ret + +align 4 +.lf: + mov ebx, lf + ret + +align 4 +cr: + cmp al, 0Dh + je .cr + + cmp al, ah + je .lf + + xchg al, ah + stosb + inc edx + + xchg al, ah + ; fall through + +.lf: + stosb + inc edx + mov ebx, ordinary + ret + +align 4 +.cr: + mov al, ah + stosb + inc edx + ret + +align 4 +lf: + cmp al, ah + je .lf + + cmp al, 0Dh + je .cr + + xchg al, ah + stosb + inc edx + + xchg al, ah + stosb + inc edx + mov ebx, ordinary + ret + +align 4 +.cr: + mov ebx, ordinary + mov al, ah + ; fall through + +.lf: + stosb + inc edx + ret + + + +Do not use this program on files stored on a disk formated +by &ms-dos; or &windows;. There seems to be a +subtle bug in the FreeBSD code when using mmap +on these drives mounted under FreeBSD: If the file is over +a certain size, mmap will just fill the memory +with zeros, and then copy them to the file overwriting +its contents. + + + + + + + +One-Pointed Mind + + +As a student of Zen, I like the idea of a one-pointed mind: +Do one thing at a time, and do it well. + + + +This, indeed, is very much how &unix; works as well. While +a typical &windows; application is attempting to do everything +imaginable (and is, therefore, riddled with bugs), a +typical &unix; program does only one thing, and it does it +well. + + + +The typical &unix; user then essentially assembles his own +applications by writing a shell script which combines the +various existing programs by piping the output of one +program to the input of another. + + + +When writing your own &unix; software, it is generally a +good idea to see what parts of the problem you need to +solve can be handled by existing programs, and only +write your own programs for that part of the problem +that you do not have an existing solution for. + + +CSV + + +I will illustrate this principle with a specific real-life +example I was faced with recently: + + + +I needed to extract the 11th field of each record from a +database I downloaded from a web site. The database was a +CSV file, i.e., a list of +comma-separated values. That is quite +a standard format for sharing data among people who may be +using different database software. + + + +The first line of the file contains the list of various fields +separated by commas. The rest of the file contains the data +listed line by line, with values separated by commas. + + + +I tried awk, using the comma as a separator. +But because several lines contained a quoted comma, +awk was extracting the wrong field +from those lines. + + + +Therefore, I needed to write my own software to extract the 11th +field from the CSV file. However, going with the &unix; +spirit, I only needed to write a simple filter that would do the +following: + + + + + +Remove the first line from the file; + + + + + +Change all unquoted commas to a different character; + + + + + +Remove all quotation marks. + + + + + +Strictly speaking, I could use sed to remove +the first line from the file, but doing so in my own program +was very easy, so I decided to do it and reduce the size of +the pipeline. + + + +At any rate, writing a program like this took me about +20 minutes. Writing a program that extracts the 11th field +from the CSV file would take a lot longer, +and I could not reuse it to extract some other field from some +other database. + + + +This time I decided to let it do a little more work than +a typical tutorial program would: + + + + + +It parses its command line for options; + + + + + +It displays proper usage if it finds wrong arguments; + + + + + +It produces meaningful error messages. + + + + + +Here is its usage message: + + +Usage: csv [-t<delim>] [-c<comma>] [-p] [-o <outfile>] [-i <infile>] + + +All parameters are optional, and can appear in any order. + + + +The -t parameter declares what to replace +the commas with. The tab is the default here. +For example, -t; will replace all unquoted +commas with semicolons. + + + +I did not need the -c option, but it may +come in handy in the future. It lets me declare that I want a +character other than a comma replaced with something else. +For example, -c@ will replace all at signs +(useful if you want to split a list of email addresses +to their user names and domains). + + + +The -p option preserves the first line, i.e., +it does not delete it. By default, we delete the first +line because in a CSV file it contains the field +names rather than data. + + + +The -i and -o +options let me specify the input and the output files. Defaults +are stdin and stdout, +so this is a regular &unix; filter. + + + +I made sure that both -i filename and +-ifilename are accepted. I also made +sure that only one input and one output files may be +specified. + + + +To get the 11th field of each record, I can now do: + + +&prompt.user; csv '-t;' data.csv | awk '-F;' '{print $11}' + + +The code stores the options (except for the file descriptors) +in EDX: The comma in DH, the new +separator in DL, and the flag for +the -p option in the highest bit of +EDX, so a check for its sign will give us a +quick decision what to do. + + + +Here is the code: + + + +;;;;;;; csv.asm ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; +; Convert a comma-separated file to a something-else separated file. +; +; Started: 31-May-2001 +; Updated: 1-Jun-2001 +; +; Copyright (c) 2001 G. Adam Stanislav +; All rights reserved. +; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +%include 'system.inc' + +%define BUFSIZE 2048 + +section .data +fd.in dd stdin +fd.out dd stdout +usg db 'Usage: csv [-t<delim>] [-c<comma>] [-p] [-o <outfile>] [-i <infile>]', 0Ah +usglen equ $-usg +iemsg db "csv: Can't open input file", 0Ah +iemlen equ $-iemsg +oemsg db "csv: Can't create output file", 0Ah +oemlen equ $-oemsg + +section .bss +ibuffer resb BUFSIZE +obuffer resb BUFSIZE + +section .text +align 4 +ierr: + push dword iemlen + push dword iemsg + push dword stderr + sys.write + push dword 1 ; return failure + sys.exit + +align 4 +oerr: + push dword oemlen + push dword oemsg + push dword stderr + sys.write + push dword 2 + sys.exit + +align 4 +usage: + push dword usglen + push dword usg + push dword stderr + sys.write + push dword 3 + sys.exit + +align 4 +global _start +_start: + add esp, byte 8 ; discard argc and argv[0] + mov edx, (',' << 8) | 9 + +.arg: + pop ecx + or ecx, ecx + je near .init ; no more arguments + + ; ECX contains the pointer to an argument + cmp byte [ecx], '-' + jne usage + + inc ecx + mov ax, [ecx] + +.o: + cmp al, 'o' + jne .i + + ; Make sure we are not asked for the output file twice + cmp dword [fd.out], stdout + jne usage + + ; Find the path to output file - it is either at [ECX+1], + ; i.e., -ofile -- + ; or in the next argument, + ; i.e., -o file + + inc ecx + or ah, ah + jne .openoutput + pop ecx + jecxz usage + +.openoutput: + push dword 420 ; file mode (644 octal) + push dword 0200h | 0400h | 01h + ; O_CREAT | O_TRUNC | O_WRONLY + push ecx + sys.open + jc near oerr + + add esp, byte 12 + mov [fd.out], eax + jmp short .arg + +.i: + cmp al, 'i' + jne .p + + ; Make sure we are not asked twice + cmp dword [fd.in], stdin + jne near usage + + ; Find the path to the input file + inc ecx + or ah, ah + jne .openinput + pop ecx + or ecx, ecx + je near usage + +.openinput: + push dword 0 ; O_RDONLY + push ecx + sys.open + jc near ierr ; open failed + + add esp, byte 8 + mov [fd.in], eax + jmp .arg + +.p: + cmp al, 'p' + jne .t + or ah, ah + jne near usage + or edx, 1 << 31 + jmp .arg + +.t: + cmp al, 't' ; redefine output delimiter + jne .c + or ah, ah + je near usage + mov dl, ah + jmp .arg + +.c: + cmp al, 'c' + jne near usage + or ah, ah + je near usage + mov dh, ah + jmp .arg + +align 4 +.init: + sub eax, eax + sub ebx, ebx + sub ecx, ecx + mov edi, obuffer + + ; See if we are to preserve the first line + or edx, edx + js .loop + +.firstline: + ; get rid of the first line + call getchar + cmp al, 0Ah + jne .firstline + +.loop: + ; read a byte from stdin + call getchar + + ; is it a comma (or whatever the user asked for)? + cmp al, dh + jne .quote + + ; Replace the comma with a tab (or whatever the user wants) + mov al, dl + +.put: + call putchar + jmp short .loop + +.quote: + cmp al, '"' + jne .put + + ; Print everything until you get another quote or EOL. If it + ; is a quote, skip it. If it is EOL, print it. +.qloop: + call getchar + cmp al, '"' + je .loop + + cmp al, 0Ah + je .put + + call putchar + jmp short .qloop + +align 4 +getchar: + or ebx, ebx + jne .fetch + + call read + +.fetch: + lodsb + dec ebx + ret + +read: + jecxz .read + call write + +.read: + push dword BUFSIZE + mov esi, ibuffer + push esi + push dword [fd.in] + sys.read + add esp, byte 12 + mov ebx, eax + or eax, eax + je .done + sub eax, eax + ret + +align 4 +.done: + call write ; flush output buffer + + ; close files + push dword [fd.in] + sys.close + + push dword [fd.out] + sys.close + + ; return success + push dword 0 + sys.exit + +align 4 +putchar: + stosb + inc ecx + cmp ecx, BUFSIZE + je write + ret + +align 4 +write: + jecxz .ret ; nothing to write + sub edi, ecx ; start of buffer + push ecx + push edi + push dword [fd.out] + sys.write + add esp, byte 12 + sub eax, eax + sub ecx, ecx ; buffer is empty now +.ret: + ret + + + +Much of it is taken from hex.asm above. But there +is one important difference: I no longer call write +whenever I am outputting a line feed. Yet, the code can be +used interactively. + + + +I have found a better solution for the interactive problem +since I first started writing this chapter. I wanted to +make sure each line is printed out separately only when needed. +After all, there is no need to flush out every line when used +non-interactively. + + + +The new solution I use now is to call write every +time I find the input buffer empty. That way, when running in +the interactive mode, the program reads one line from the user's +keyboard, processes it, and sees its input buffer is empty. It +flushes its output and reads the next line. + + + +The Dark Side of Buffering + +This change prevents a mysterious lockup +in a very specific case. I refer to it as the +dark side of buffering, mostly +because it presents a danger that is not +quite obvious. + + + +It is unlikely to happen with a program like the +csv above, so let us consider yet +another filter: In this case we expect our input +to be raw data representing color values, such as +the red, green, and +blue intensities of a pixel. Our +output will be the negative of our input. + + + +Such a filter would be very simple to write. +Most of it would look just like all the other +filters we have written so far, so I am only +going to show you its inner loop: + + + +.loop: + call getchar + not al ; Create a negative + call putchar + jmp short .loop + + +Because this filter works with raw data, +it is unlikely to be used interactively. + + + +But it could be called by image manipulation software. +And, unless it calls write before each call +to read, chances are it will lock up. + + + +Here is what might happen: + + + +The image editor will load our filter using the +C function popen(). + + + +It will read the first row of pixels from +a bitmap or pixmap. + + + +It will write the first row of pixels to +the pipe leading to +the fd.in of our filter. + + + +Our filter will read each pixel +from its input, turn it to a negative, +and write it to its output buffer. + + + +Our filter will call getchar +to fetch the next pixel. + + + +getchar will find an empty +input buffer, so it will call +read. + + + +read will call the +SYS_read system call. + + + +The kernel will suspend +our filter until the image editor +sends more data to the pipe. + + + +The image editor will read from the +other pipe, connected to the +fd.out of our filter so it can set the first row of the +output image before +it sends us the second row of the input. + + + +The kernel suspends +the image editor until it receives +some output from our filter, so it +can pass it on to the image editor. + + + + +At this point our filter waits for the image +editor to send it more data to process, while +the image editor is waiting for our filter +to send it the result of the processing +of the first row. But the result sits in +our output buffer. + + + +The filter and the image editor will continue +waiting for each other forever (or, at least, +until they are killed). Our software has just +entered a +race condition. + + + +This problem does not exist if our filter flushes +its output buffer before asking the +kernel for more input data. + + + + + + + + + +Using the <acronym>FPU</acronym> + +Strangely enough, most of assembly language literature does not +even mention the existence of the FPU, +or floating point unit, let alone discuss +programming it. + + + +Yet, never does assembly language shine more than when +we create highly optimized FPU +code by doing things that can be done only in assembly language. + +Organization of the <acronym>FPU</acronym> + +The FPU consists of 8 80–bit floating–point registers. +These are organized in a stack fashion—you can +push a value on TOS +(top of stack) and you can +pop it. + + + +That said, the assembly language op codes are not push +and pop because those are already taken. + + +You can push a value on TOS +by using fld, fild, +and fbld. Several other op codes +let you push many common +constants—such as pi—on +the TOS. + + + +Similarly, you can pop a value by +using fst, fstp, +fist, fistp, and +fbstp. Actually, only the op +codes that end with a p will +literally pop the value, +the rest will store it +somewhere else without removing it from +the TOS. + + + +We can transfer the data between the +TOS and the computer memory either as +a 32–bit, 64–bit, or 80–bit real, +a 16–bit, 32–bit, or 64–bit integer, +or an 80–bit packed decimal. + + + +The 80–bit packed decimal is +a special case of binary coded +decimal which is very convenient when +converting between the ASCII +representation of data and the internal +data of the FPU. It allows us to use +18 significant digits. + + + +No matter how we represent data in the memory, +the FPU always stores it in the 80–bit +real format in its registers. + + + +Its internal precision is at least 19 decimal +digits, so even if we choose to display results +as ASCII in the full +18–digit precision, we are still showing +correct results. + + + +We can perform mathematical operations on the +TOS: We can calculate its +sine, we can scale it +(i.e., we can multiply or divide it by a power +of 2), we can calculate its base–2 +logarithm, and many other things. + + + +We can also multiply or +divide it by, add +it to, or subtract it from, +any of the FPU registers (including +itself). + + + +The official Intel op code for the +TOS is st, and +for the registers +st(0)st(7). +st and st(0), then, +refer to the same register. + + + +For whatever reasons, the original author of +nasm has decided to use +different op codes, namely +st0st7. +In other words, there are no parentheses, +and the TOS is always +st0, never just st. + + + +The Packed Decimal Format + +The packed decimal format +uses 10 bytes (80 bits) of +memory to represent 18 digits. The +number represented there is always an +integer. + + + + +You can use it to get decimal places +by multiplying the TOS +by a power of 10 first. + + + + +The highest bit of the highest byte +(byte 9) is the sign bit: +If it is set, the number is negative, +otherwise, it is positive. +The rest of the bits of this byte are unused/ignored. + + + +The remaining 9 bytes store the 18 digits +of the number: 2 digits per byte. + + +The more significant digit is +stored in the high nibble +(4 bits), the less significant +digit in the low nibble. + + + +That said, you might think that -1234567 +would be stored in the memory like this (using +hexadecimal notation): + + + +80 00 00 00 00 00 01 23 45 67 + + +Alas it is not! As with everything else of Intel make, +even the packed decimal is +little–endian. + + +That means our -1234567 +is stored like this: + + + +67 45 23 01 00 00 00 00 00 80 + + +Remember that, or you will be pulling your hair out +in desperation! + + + + +The book to read—if you can find it—is Richard Startz' +8087/80287/80387 +for the IBM PC & Compatibles. +Though it does seem to take the fact about the +little–endian storage of the packed +decimal for granted. I kid you not about the +desperation of trying to figure out what was wrong +with the filter I show below before +it occurred to me I should try the +little–endian order even for this type of data. + + + + + + + + +Excursion to Pinhole Photography + +To write meaningful software, we must not only +understand our programming tools, but also the +field we are creating software for. + + + +Our next filter will help us whenever we want +to build a pinhole camera, +so, we need some background in pinhole +photography before we can continue. + + + +The Camera + +The easiest way to describe any camera ever built +is as some empty space enclosed in some +lightproof material, with a small hole in the +enclosure. + + + +The enclosure is usually sturdy (e.g., a box), +though sometimes it is flexible (the bellows). +It is quite dark inside the camera. However, the +hole lets light rays in through a single point +(though in some cases there may be several). +These light rays form an image, a representation +of whatever is outside the camera, in front of the +hole. + + + +If some light sensitive material (such as film) +is placed inside the camera, it can capture the +image. + + +The hole often contains a lens, or +a lens assembly, often called the objective. + + + + + +The Pinhole + +But, strictly speaking, the lens is not necessary: +The original cameras did not use a lens but a +pinhole. Even today, pinholes +are used, both as a tool to study how cameras +work, and to achieve a special kind of image. + + + +The image produced by the pinhole +is all equally sharp. Or blurred. +There is an ideal size for a pinhole: If it is +either larger or smaller, the image loses its +sharpness. + + + + +Focal Length + +This ideal pinhole diameter is a function +of the square root of focal +length, which is the distance of the +pinhole from the film. + + + + D = PC * sqrt(FL) + + +In here, D is the +ideal diameter of the pinhole, +FL is the focal length, +and PC is a pinhole +constant. According to Jay Bender, +its value is 0.04, while +Kenneth Connors has determined it to +be 0.037. Others have +proposed other values. Plus, this +value is for the daylight only: Other types +of light will require a different constant, +whose value can only be determined by +experimentation. + + + + + +The F–Number + +The f–number is a very useful measure of +how much light reaches the film. A light +meter can determine that, for example, +to expose a film of specific sensitivity +with f5.6 may require the exposure to last +1/1000 sec. + + +It does not matter whether it is a 35–mm +camera, or a 6x9cm camera, etc. +As long as we know the f–number, we can determine +the proper exposure. + + + +The f–number is easy to calculate: + + + + F = FL / D + + +In other words, the f–number equals the focal +length divided by the diameter of the pinhole. +It also means a higher f–number either implies +a smaller pinhole or a larger focal distance, +or both. That, in turn, implies, the higher +the f–number, the longer the exposure has to be. + + + +Furthermore, while pinhole diameter and focal +distance are one–dimensional measurements, +both, the film and the pinhole, are two–dimensional. +That means that +if you have measured the exposure at f–number +A as t, then the exposure +at f–number B is: + + + t * (B / A)² + + + + +Normalized F–Number + +While many modern cameras can change the diameter +of their pinhole, and thus their f–number, quite +smoothly and gradually, such was not always the case. + + + +To allow for different f–numbers, cameras typically +contained a metal plate with several holes of +different sizes drilled to them. + + + +Their sizes were chosen according to the above +formula in such a way that the resultant f–number +was one of standard f–numbers used on all cameras +everywhere. For example, a very old Kodak Duaflex IV +camera in my possession has three such holes for +f–numbers 8, 11, and 16. + + + +A more recently made camera may offer f–numbers of +2.8, 4, 5.6, 8, 11, +16, 22, and 32 (as well as others). +These numbers were not chosen arbitrarily: They all are +powers of the square root of 2, though they may +be rounded somewhat. + + + + + +The F–Stop + +A typical camera is designed in such a way that setting +any of the normalized f–numbers changes the feel of the +dial. It will naturally stop in that +position. Because of that, these positions of the dial +are called f–stops. + + +Since the f–numbers at each stop are powers of the +square root of 2, moving the dial by 1 +stop will double the amount of light required for +proper exposure. Moving it by 2 stops will +quadruple the required exposure. Moving the dial by +3 stops will require the increase in exposure +8 times, etc. + + + + + + + +Designing the Pinhole Software + +We are now ready to decide what exactly we want our +pinhole software to do. + + + +Processing Program Input + +Since its main purpose is to help us design a working +pinhole camera, we will use the focal +length as the input to the program. This is something +we can determine without software: Proper focal length +is determined by the size of the film and by the need +to shoot "regular" pictures, wide angle pictures, or +telephoto pictures. + + + +Most of the programs we have written so far worked with +individual characters, or bytes, as their input: The +hex program converted individual bytes +into a hexadecimal number, the csv +program either let a character through, or deleted it, +or changed it to a different character, etc. + + + +One program, ftuc used the state machine +to consider at most two input bytes at a time. + + + +But our pinhole program cannot just +work with individual characters, it has to deal with +larger syntactic units. + + + +For example, if we want the program to calculate the +pinhole diameter (and other values we will discuss +later) at the focal lengths of 100 mm, +150 mm, and 210 mm, we may want +to enter something like this: + +100, 150, 210 + +Our program needs to consider more than a single byte of +input at a time. When it sees the first 1, +it must understand it is seeing the first digit of a +decimal number. When it sees the 0 and +the other 0, it must know it is seeing +more digits of the same number. + + + +When it encounters the first comma, it must know it is +no longer receiving the digits of the first number. +It must be able to convert the digits of the first number +into the value of 100. And the digits of the +second number into the value of 150. And, +of course, the digits of the third number into the +numeric value of 210. + + + +We need to decide what delimiters to accept: Do the +input numbers have to be separated by a comma? If so, +how do we treat two numbers separated by something else? + + + +Personally, I like to keep it simple. Something either +is a number, so I process it. Or it is not a number, +so I discard it. I do not like the computer complaining +about me typing in an extra character when it is +obvious that it is an extra character. Duh! + + + +Plus, it allows me to break up the monotony of computing +and type in a query instead of just a number: + + +What is the best pinhole diameter for the focal length of 150? + +There is no reason for the computer to spit out +a number of complaints: + + +Syntax error: What +Syntax error: is +Syntax error: the +Syntax error: best + +Et cetera, et cetera, et cetera. + + +Secondly, I like the # character to denote +the start of a comment which extends to the end of the +line. This does not take too much effort to code, and +lets me treat input files for my software as executable +scripts. + + + +In our case, we also need to decide what units the +input should come in: We choose millimeters +because that is how most photographers measure +the focus length. + + + +Finally, we need to decide whether to allow the use +of the decimal point (in which case we must also +consider the fact that much of the world uses a +decimal comma). + + +In our case allowing for the decimal point/comma +would offer a false sense of precision: There is +little if any noticeable difference between the +focus lengths of 50 and 51, +so allowing the user to input something like +50.5 is not a good idea. This is +my opinion, mind you, but I am the one writing +this program. You can make other choices in yours, +of course. + + + + + +Offering Options + +The most important thing we need to know when building +a pinhole camera is the diameter of the pinhole. Since +we want to shoot sharp images, we will use the above +formula to calculate the pinhole diameter from focal length. +As experts are offering several different values for the +PC constant, we will need to have the choice. + + + +It is traditional in &unix; programming to have two main ways +of choosing program parameters, plus to have a default for +the time the user does not make a choice. + + + +Why have two ways of choosing? + + +One is to allow a (relatively) permanent +choice that applies automatically each time the +software is run without us having to tell it over and +over what we want it to do. + + + +The permanent choices may be stored in a configuration +file, typically found in the user's home directory. +The file usually has the same name as the application +but is started with a dot. Often "rc" +is added to the file name. So, ours could be +~/.pinhole or ~/.pinholerc. +(The ~/ means current user's +home directory.) + + + +The configuration file is used mostly by programs +that have many configurable parameters. Those +that have only one (or a few) often use a different +method: They expect to find the parameter in an +environment variable. In our case, +we might look at an environment variable named +PINHOLE. + + + +Usually, a program uses one or the other of the +above methods. Otherwise, if a configuration +file said one thing, but an environment variable +another, the program might get confused (or just +too complicated). + + + +Because we only need to choose one +such parameter, we will go with the second method +and search the environment for a variable named +PINHOLE. + + +The other way allows us to make ad hoc +decisions: "Though I usually want +you to use 0.039, this time I want 0.03872." +In other words, it allows us to override +the permanent choice. + + + +This type of choice is usually done with command +line parameters. + + + +Finally, a program always needs a +default. The user may not make +any choices. Perhaps he does not know what +to choose. Perhaps he is "just browsing." +Preferably, the default will be the value +most users would choose anyway. That way +they do not need to choose. Or, rather, they +can choose the default without an additional +effort. + + + +Given this system, the program may find conflicting +options, and handle them this way: + + + +If it finds an ad hoc choice +(e.g., command line parameter), it should +accept that choice. It must ignore any permanent +choice and any default. + + + +Otherwise, if it finds +a permanent option (e.g., an environment +variable), it should accept it, and ignore +the default. + + +Otherwise, it should use +the default. + + + + +We also need to decide what format +our PC option should have. + + + +At first site, it seems obvious to use the +PINHOLE=0.04 format for the +environment variable, and -p0.04 +for the command line. + + + +Allowing that is actually a security risk. +The PC constant is a very small +number. Naturally, we will test our software +using various small values of PC. +But what will happen if someone runs the program +choosing a huge value? + + + +It may crash the program because we have not +designed it to handle huge numbers. + + + +Or, we may spend more time on the program so +it can handle huge numbers. We might do that +if we were writing commercial software for +computer illiterate audience. + + + +Or, we might say, "Tough! +The user should know better."" + + + +Or, we just may make it impossible for the user +to enter a huge number. This is the approach we +will take: We will use an implied 0. +prefix. + + + +In other words, if the user wants 0.04, +we will expect him to type -p04, +or set PINHOLE=04 in his environment. +So, if he says -p9999999, we will +interpret it as 0.9999999—still +ridiculous but at least safer. + + + +Secondly, many users will just want to go with either +Bender's constant or Connors' constant. +To make it easier on them, we will interpret +-b as identical to -p04, +and -c as identical to -p037. + + + + + +The Output + +We need to decide what we want our software to +send to the output, and in what format. + + + +Since our input allows for an unspecified number +of focal length entries, it makes sense to use +a traditional database–style output of showing +the result of the calculation for each +focal length on a separate line, while +separating all values on one line by a +tab character. + + + +Optionally, we should also allow the user +to specify the use of the CSV +format we have studied earlier. In this case, +we will print out a line of comma–separated +names describing each field of every line, +then show our results as before, but substituting +a comma for the tab. + + +We need a command line option for the CSV +format. We cannot use -c because +that already means use Connors' constant. +For some strange reason, many web sites refer to +CSV files as "Excel +spreadsheet" (though the CSV +format predates Excel). We will, therefore, use +the -e switch to inform our software +we want the output in the CSV format. + + + +We will start each line of the output with the +focal length. This may sound repetitious at first, +especially in the interactive mode: The user +types in the focal length, and we are repeating it. + + + +But the user can type several focal lengths on one +line. The input can also come in from a file or +from the output of another program. In that case +the user does not see the input at all. + + + +By the same token, the output can go to a file +which we will want to examine later, or it could +go to the printer, or become the input of another +program. + + + +So, it makes perfect sense to start each line with +the focal length as entered by the user. + + + +No, wait! Not as entered by the user. What if the user +types in something like this: + +00000000150 + +Clearly, we need to strip those leading zeros. + + +So, we might consider reading the user input as is, +converting it to binary inside the FPU, +and printing it out from there. + + + +But... + + +What if the user types something like this: + + +17459765723452353453534535353530530534563507309676764423 + +Ha! The packed decimal FPU format +lets us input 18–digit numbers. But the +user has entered more than 18 digits. How +do we handle that? + + + +Well, we could modify our code to read +the first 18 digits, enter it to the FPU, +then read more, multiply what we already have on the +TOS by 10 raised to the number +of additional digits, then add to it. + + + +Yes, we could do that. But in this +program it would be ridiculous (in a different one it may be just the thing to do): Even the circumference of the Earth expressed in +millimeters only takes 11 digits. Clearly, +we cannot build a camera that large (not yet, +anyway). + + + +So, if the user enters such a huge number, he is +either bored, or testing us, or trying to break +into the system, or playing games—doing +anything but designing a pinhole camera. + + + +What will we do? + + +We will slap him in the face, in a manner of speaking: + +17459765723452353453534535353530530534563507309676764423 ??? ??? ??? ??? ??? + +To achieve that, we will simply ignore any leading zeros. +Once we find a non–zero digit, we will initialize a +counter to 0 and start taking three steps: + + + + +Send the digit to the output. + + + +Append the digit to a buffer we will use later to +produce the packed decimal we can send to the +FPU. + + + +Increase the counter. + + + + +Now, while we are taking these three steps, +we also need to watch out for one of two +conditions: + + + + +If the counter grows above 18, +we stop appending to the buffer. We +continue reading the digits and sending +them to the output. + + + + + +If, or rather when, +the next input character is not +a digit, we are done inputting +for now. + + + +Incidentally, we can simply +discard the non–digit, unless it +is a #, which we must +return to the input stream. It +starts a comment, so we must see it +after we are done producing output +and start looking for more input. + + + + + +That still leaves one possibility +uncovered: If all the user enters +is a zero (or several zeros), we +will never find a non–zero to +display. + + +We can determine this has happened +whenever our counter stays at 0. +In that case we need to send 0 +to the output, and perform another +"slap in the face": + + +0 ??? ??? ??? ??? ??? + +Once we have displayed the focal +length and determined it is valid +(greater than 0 +but not exceeding 18 digits), +we can calculate the pinhole diameter. + + + +It is not by coincidence that pinhole +contains the word pin. Indeed, +many a pinhole literally is a pin +hole, a hole carefully punched with the +tip of a pin. + + + +That is because a typical pinhole is very +small. Our formula gets the result in +millimeters. We will multiply it by 1000, +so we can output the result in microns. + + + +At this point we have yet another trap to face: +Too much precision. + + + +Yes, the FPU was designed +for high precision mathematics. But we +are not dealing with high precision +mathematics. We are dealing with physics +(optics, specifically). + + + +Suppose we want to convert a truck into +a pinhole camera (we would not be the +first ones to do that!). Suppose its box is +12 +meters long, so we have the focal length +of 12000. Well, using Bender's constant, it gives us square root of +12000 multiplied by 0.04, +which is 4.381780460 millimeters, +or 4381.780460 microns. + + + +Put either way, the result is absurdly precise. +Our truck is not exactly 12000 +millimeters long. We did not measure its length +with such a precision, so stating we need a pinhole +with the diameter of 4.381780460 +millimeters is, well, deceiving. 4.4 +millimeters would do just fine. + + + + +I "only" used ten digits in the above example. +Imagine the absurdity of going for all 18! + + + + +We need to limit the number of significant +digits of our result. One way of doing it +is by using an integer representing microns. +So, our truck would need a pinhole with the diameter +of 4382 microns. Looking at that number, we still decide that 4400 microns, +or 4.4 millimeters is close enough. + + + +Additionally, we can decide that no matter how +big a result we get, we only want to display four +significant digits (or any other number +of them, of course). Alas, the FPU +does not offer rounding to a specific number +of digits (after all, it does not view the +numbers as decimal but as binary). + + + +We, therefore, must devise an algorithm to reduce +the number of significant digits. + + + +Here is mine (I think it is awkward—if +you know a better one, please, let me know): + + + +Initialize a counter to 0. + + + +While the number is greater than or equal to +10000, divide it by +10 and increase the counter. + + + +Output the result. + + +While the counter is greater than 0, +output 0 and decrease the counter. + + + + + +The 10000 is only good if you want +four significant digits. For any other +number of significant digits, replace +10000 with 10 +raised to the number of significant digits. + + + + +We will, then, output the pinhole diameter +in microns, rounded off to four significant +digits. + + + +At this point, we know the focal +length and the pinhole +diameter. That means we have enough +information to also calculate the +f–number. + + + +We will display the f–number, rounded to +four significant digits. Chances are the +f–number will tell us very little. To make +it more meaningful, we can find the nearest +normalized f–number, i.e., +the nearest power of the square root +of 2. + + + +We do that by multiplying the actual f–number +by itself, which, of course, will give us +its square. We will then calculate +its base–2 logarithm, which is much +easier to do than calculating the +base–square–root–of–2 logarithm! +We will round the result to the nearest integer. +Next, we will raise 2 to the result. Actually, +the FPU gives us a good shortcut +to do that: We can use the fscale +op code to "scale" 1, which is +analogous to shifting an +integer left. Finally, we calculate the square +root of it all, and we have the nearest +normalized f–number. + + + +If all that sounds overwhelming—or too much +work, perhaps—it may become much clearer +if you see the code. It takes 9 op +codes altogether: + + + fmul st0, st0 + fld1 + fld st1 + fyl2x + frndint + fld1 + fscale + fsqrt + fstp st1 + + +The first line, fmul st0, st0, squares +the contents of the TOS +(top of the stack, same as st, +called st0 by nasm). +The fld1 pushes 1 +on the TOS. + + +The next line, fld st1, pushes +the square back to the TOS. +At this point the square is both in st +and st(2) (it will become +clear why we leave a second copy on the stack +in a moment). st(1) contains +1. + + + +Next, fyl2x calculates base–2 +logarithm of st multiplied by +st(1). That is why we placed 1 on st(1) before. + + +At this point, st contains +the logarithm we have just calculated, +st(1) contains the square +of the actual f–number we saved for later. + + + +frndint rounds the TOS +to the nearest integer. fld1 pushes +a 1. fscale shifts the +1 we have on the TOS +by the value in st(1), +effectively raising 2 to st(1). + + + +Finally, fsqrt calculates +the square root of the result, i.e., +the nearest normalized f–number. + + + +We now have the nearest normalized +f–number on the TOS, +the base–2 logarithm rounded to the +nearest integer in st(1), +and the square of the actual f–number +in st(2). We are saving +the value in st(2) for later. + + + +But we do not need the contents of +st(1) anymore. The last +line, fstp st1, places the +contents of st to +st(1), and pops. As a +result, what was st(1) +is now st, what was st(2) +is now st(1), etc. +The new st contains the +normalized f–number. The new +st(1) contains the square +of the actual f–number we have +stored there for posterity. + + + +At this point, we are ready to output +the normalized f–number. Because it is +normalized, we will not round it off to +four significant digits, but will +send it out in its full precision. + + + +The normalized f-number is useful as long +as it is reasonably small and can be found +on our light meter. Otherwise we need a +different method of determining proper +exposure. + + + +Earlier we have figured out the formula +of calculating proper exposure at an arbitrary +f–number from that measured at a different +f–number. + + + +Every light meter I have ever seen can determine +proper exposure at f5.6. We will, therefore, +calculate an "f5.6 multiplier," +i.e., by how much we need to multiply the exposure measured +at f5.6 to determine the proper exposure +for our pinhole camera. + + + +From the above formula we know this factor can be +calculated by dividing our f–number (the +actual one, not the normalized one) by +5.6, and squaring the result. + + + +Mathematically, dividing the square of our +f–number by the square of 5.6 +will give us the same result. + + + +Computationally, we do not want to square +two numbers when we can only square one. +So, the first solution seems better at first. + + + +But... + + +5.6 is a constant. +We do not have to have our FPU +waste precious cycles. We can just tell it +to divide the square of the f–number by +whatever 5.6² equals to. +Or we can divide the f–number by 5.6, +and then square the result. The two ways +now seem equal. + + + +But, they are not! + + +Having studied the principles of photography +above, we remember that the 5.6 +is actually square root of 2 raised to +the fifth power. An irrational +number. The square of this number is +exactly 32. + + + +Not only is 32 an integer, +it is a power of 2. We do not need +to divide the square of the f–number by +32. We only need to use +fscale to shift it right by +five positions. In the FPU +lingo it means we will fscale it +with st(1) equal to +-5. That is much +faster than a division. + + + +So, now it has become clear why we have +saved the square of the f–number on the +top of the FPU stack. +The calculation of the f5.6 multiplier +is the easiest calculation of this +entire program! We will output it rounded +to four significant digits. + + + +There is one more useful number we can calculate: +The number of stops our f–number is from f5.6. +This may help us if our f–number is just outside +the range of our light meter, but we have +a shutter which lets us set various speeds, +and this shutter uses stops. + + + +Say, our f–number is 5 stops from +f5.6, and the light meter says +we should use 1/1000 sec. +Then we can set our shutter speed to 1/1000 +first, then move the dial by 5 stops. + + + +This calculation is quite easy as well. All +we have to do is to calculate the base-2 +logarithm of the f5.6 multiplier +we had just calculated (though we need its +value from before we rounded it off). We then +output the result rounded to the nearest integer. +We do not need to worry about having more than +four significant digits in this one: The result +is most likely to have only one or two digits +anyway. + + + + + + +FPU Optimizations + +In assembly language we can optimize the FPU +code in ways impossible in high languages, +including C. + + + +Whenever a C function needs to calculate +a floating–point value, it loads all necessary +variables and constants into FPU +registers. It then does whatever calculation is +required to get the correct result. Good C +compilers can optimize that part of the code really +well. + + + +It "returns" the value by leaving +the result on the TOS. +However, before it returns, it cleans up. +Any variables and constants it used in its +calculation are now gone from the FPU. + + + +It cannot do what we just did above: We calculated +the square of the f–number and kept it on the +stack for later use by another function. + + + +We knew we would need that value +later on. We also knew we had enough room on the +stack (which only has room for 8 numbers) +to store it there. + + + +A C compiler has no way of knowing +that a value it has on the stack will be +required again in the very near future. + + + +Of course, the C programmer may know it. +But the only recourse he has is to store the +value in a memory variable. + + + +That means, for one, the value will be changed +from the 80-bit precision used internally +by the FPU to a C double +(64 bits) or even single (32 +bits). + + + +That also means that the value must be moved +from the TOS into the memory, +and then back again. Alas, of all FPU +operations, the ones that access the computer +memory are the slowest. + + + +So, whenever programming the FPU +in assembly language, look for the ways of keeping +intermediate results on the FPU +stack. + + + +We can take that idea even further! In our +program we are using a constant +(the one we named PC). + + + +It does not matter how many pinhole diameters +we are calculating: 1, 10, 20, +1000, we are always using the same constant. +Therefore, we can optimize our program by keeping +the constant on the stack all the time. + + + +Early on in our program, we are calculating the +value of the above constant. We need to divide +our input by 10 for every digit in the +constant. + + + +It is much faster to multiply than to divide. +So, at the start of our program, we divide 10 +into 1 to obtain 0.1, which we +then keep on the stack: Instead of dividing the +input by 10 for every digit, +we multiply it by 0.1. + + + +By the way, we do not input 0.1 directly, +even though we could. We have a reason for that: +While 0.1 can be expressed with just one +decimal place, we do not know how many binary +places it takes. We, therefore, let the FPU +calculate its binary value to its own high precision. + + + +We are using other constants: We multiply the pinhole +diameter by 1000 to convert it from +millimeters to microns. We compare numbers to +10000 when we are rounding them off to +four significant digits. So, we keep both, 1000 +and 10000, on the stack. And, of course, +we reuse the 0.1 when rounding off numbers +to four digits. + + + +Last but not least, we keep -5 on the stack. +We need it to scale the square of the f–number, +instead of dividing it by 32. It is not +by coincidence we load this constant last. That makes +it the top of the stack when only the constants +are on it. So, when the square of the f–number is +being scaled, the -5 is at st(1), +precisely where fscale expects it to be. + + + +It is common to create certain constants from +scratch instead of loading them from the memory. +That is what we are doing with -5: + + + + fld1 ; TOS = 1 + fadd st0, st0 ; TOS = 2 + fadd st0, st0 ; TOS = 4 + fld1 ; TOS = 1 + faddp st1, st0 ; TOS = 5 + fchs ; TOS = -5 + + +We can generalize all these optimizations into one rule: +Keep repeat values on the stack! + + + + +&postscript; is a stack–oriented +programming language. There are many more books +available about &postscript; than about the +FPU assembly language: Mastering +&postscript; will help you master the FPU. + + + + + + +<application>pinhole</application>—The Code + +;;;;;;; pinhole.asm ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; +; Find various parameters of a pinhole camera construction and use +; +; Started: 9-Jun-2001 +; Updated: 10-Jun-2001 +; +; Copyright (c) 2001 G. Adam Stanislav +; All rights reserved. +; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +%include 'system.inc' + +%define BUFSIZE 2048 + +section .data +align 4 +ten dd 10 +thousand dd 1000 +tthou dd 10000 +fd.in dd stdin +fd.out dd stdout +envar db 'PINHOLE=' ; Exactly 8 bytes, or 2 dwords long +pinhole db '04,', ; Bender's constant (0.04) +connors db '037', 0Ah ; Connors' constant +usg db 'Usage: pinhole [-b] [-c] [-e] [-p <value>] [-o <outfile>] [-i <infile>]', 0Ah +usglen equ $-usg +iemsg db "pinhole: Can't open input file", 0Ah +iemlen equ $-iemsg +oemsg db "pinhole: Can't create output file", 0Ah +oemlen equ $-oemsg +pinmsg db "pinhole: The PINHOLE constant must not be 0", 0Ah +pinlen equ $-pinmsg +toobig db "pinhole: The PINHOLE constant may not exceed 18 decimal places", 0Ah +biglen equ $-toobig +huhmsg db 9, '???' +separ db 9, '???' +sep2 db 9, '???' +sep3 db 9, '???' +sep4 db 9, '???', 0Ah +huhlen equ $-huhmsg +header db 'focal length in millimeters,pinhole diameter in microns,' + db 'F-number,normalized F-number,F-5.6 multiplier,stops ' + db 'from F-5.6', 0Ah +headlen equ $-header + +section .bss +ibuffer resb BUFSIZE +obuffer resb BUFSIZE +dbuffer resb 20 ; decimal input buffer +bbuffer resb 10 ; BCD buffer + +section .text +align 4 +huh: + call write + push dword huhlen + push dword huhmsg + push dword [fd.out] + sys.write + add esp, byte 12 + ret + +align 4 +perr: + push dword pinlen + push dword pinmsg + push dword stderr + sys.write + push dword 4 ; return failure + sys.exit + +align 4 +consttoobig: + push dword biglen + push dword toobig + push dword stderr + sys.write + push dword 5 ; return failure + sys.exit + +align 4 +ierr: + push dword iemlen + push dword iemsg + push dword stderr + sys.write + push dword 1 ; return failure + sys.exit + +align 4 +oerr: + push dword oemlen + push dword oemsg + push dword stderr + sys.write + push dword 2 + sys.exit + +align 4 +usage: + push dword usglen + push dword usg + push dword stderr + sys.write + push dword 3 + sys.exit + +align 4 +global _start +_start: + add esp, byte 8 ; discard argc and argv[0] + sub esi, esi + +.arg: + pop ecx + or ecx, ecx + je near .getenv ; no more arguments + + ; ECX contains the pointer to an argument + cmp byte [ecx], '-' + jne usage + + inc ecx + mov ax, [ecx] + inc ecx + +.o: + cmp al, 'o' + jne .i + + ; Make sure we are not asked for the output file twice + cmp dword [fd.out], stdout + jne usage + + ; Find the path to output file - it is either at [ECX+1], + ; i.e., -ofile -- + ; or in the next argument, + ; i.e., -o file + + or ah, ah + jne .openoutput + pop ecx + jecxz usage + +.openoutput: + push dword 420 ; file mode (644 octal) + push dword 0200h | 0400h | 01h + ; O_CREAT | O_TRUNC | O_WRONLY + push ecx + sys.open + jc near oerr + + add esp, byte 12 + mov [fd.out], eax + jmp short .arg + +.i: + cmp al, 'i' + jne .p + + ; Make sure we are not asked twice + cmp dword [fd.in], stdin + jne near usage + + ; Find the path to the input file + or ah, ah + jne .openinput + pop ecx + or ecx, ecx + je near usage + +.openinput: + push dword 0 ; O_RDONLY + push ecx + sys.open + jc near ierr ; open failed + + add esp, byte 8 + mov [fd.in], eax + jmp .arg + +.p: + cmp al, 'p' + jne .c + or ah, ah + jne .pcheck + + pop ecx + or ecx, ecx + je near usage + + mov ah, [ecx] + +.pcheck: + cmp ah, '0' + jl near usage + cmp ah, '9' + ja near usage + mov esi, ecx + jmp .arg + +.c: + cmp al, 'c' + jne .b + or ah, ah + jne near usage + mov esi, connors + jmp .arg + +.b: + cmp al, 'b' + jne .e + or ah, ah + jne near usage + mov esi, pinhole + jmp .arg + +.e: + cmp al, 'e' + jne near usage + or ah, ah + jne near usage + mov al, ',' + mov [huhmsg], al + mov [separ], al + mov [sep2], al + mov [sep3], al + mov [sep4], al + jmp .arg + +align 4 +.getenv: + ; If ESI = 0, we did not have a -p argument, + ; and need to check the environment for "PINHOLE=" + or esi, esi + jne .init + + sub ecx, ecx + +.nextenv: + pop esi + or esi, esi + je .default ; no PINHOLE envar found + + ; check if this envar starts with 'PINHOLE=' + mov edi, envar + mov cl, 2 ; 'PINHOLE=' is 2 dwords long +rep cmpsd + jne .nextenv + + ; Check if it is followed by a digit + mov al, [esi] + cmp al, '0' + jl .default + cmp al, '9' + jbe .init + ; fall through + +align 4 +.default: + ; We got here because we had no -p argument, + ; and did not find the PINHOLE envar. + mov esi, pinhole + ; fall through + +align 4 +.init: + sub eax, eax + sub ebx, ebx + sub ecx, ecx + sub edx, edx + mov edi, dbuffer+1 + mov byte [dbuffer], '0' + + ; Convert the pinhole constant to real +.constloop: + lodsb + cmp al, '9' + ja .setconst + cmp al, '0' + je .processconst + jb .setconst + + inc dl + +.processconst: + inc cl + cmp cl, 18 + ja near consttoobig + stosb + jmp short .constloop + +align 4 +.setconst: + or dl, dl + je near perr + + finit + fild dword [tthou] + + fld1 + fild dword [ten] + fdivp st1, st0 + + fild dword [thousand] + mov edi, obuffer + + mov ebp, ecx + call bcdload + +.constdiv: + fmul st0, st2 + loop .constdiv + + fld1 + fadd st0, st0 + fadd st0, st0 + fld1 + faddp st1, st0 + fchs + + ; If we are creating a CSV file, + ; print header + cmp byte [separ], ',' + jne .bigloop + + push dword headlen + push dword header + push dword [fd.out] + sys.write + +.bigloop: + call getchar + jc near done + + ; Skip to the end of the line if you got '#' + cmp al, '#' + jne .num + call skiptoeol + jmp short .bigloop + +.num: + ; See if you got a number + cmp al, '0' + jl .bigloop + cmp al, '9' + ja .bigloop + + ; Yes, we have a number + sub ebp, ebp + sub edx, edx + +.number: + cmp al, '0' + je .number0 + mov dl, 1 + +.number0: + or dl, dl ; Skip leading 0's + je .nextnumber + push eax + call putchar + pop eax + inc ebp + cmp ebp, 19 + jae .nextnumber + mov [dbuffer+ebp], al + +.nextnumber: + call getchar + jc .work + cmp al, '#' + je .ungetc + cmp al, '0' + jl .work + cmp al, '9' + ja .work + jmp short .number + +.ungetc: + dec esi + inc ebx + +.work: + ; Now, do all the work + or dl, dl + je near .work0 + + cmp ebp, 19 + jae near .toobig + + call bcdload + + ; Calculate pinhole diameter + + fld st0 ; save it + fsqrt + fmul st0, st3 + fld st0 + fmul st5 + sub ebp, ebp + + ; Round off to 4 significant digits +.diameter: + fcom st0, st7 + fstsw ax + sahf + jb .printdiameter + fmul st0, st6 + inc ebp + jmp short .diameter + +.printdiameter: + call printnumber ; pinhole diameter + + ; Calculate F-number + + fdivp st1, st0 + fld st0 + + sub ebp, ebp + +.fnumber: + fcom st0, st6 + fstsw ax + sahf + jb .printfnumber + fmul st0, st5 + inc ebp + jmp short .fnumber + +.printfnumber: + call printnumber ; F number + + ; Calculate normalized F-number + fmul st0, st0 + fld1 + fld st1 + fyl2x + frndint + fld1 + fscale + fsqrt + fstp st1 + + sub ebp, ebp + call printnumber + + ; Calculate time multiplier from F-5.6 + + fscale + fld st0 + + ; Round off to 4 significant digits +.fmul: + fcom st0, st6 + fstsw ax + sahf + + jb .printfmul + inc ebp + fmul st0, st5 + jmp short .fmul + +.printfmul: + call printnumber ; F multiplier + + ; Calculate F-stops from 5.6 + + fld1 + fxch st1 + fyl2x + + sub ebp, ebp + call printnumber + + mov al, 0Ah + call putchar + jmp .bigloop + +.work0: + mov al, '0' + call putchar + +align 4 +.toobig: + call huh + jmp .bigloop + +align 4 +done: + call write ; flush output buffer + + ; close files + push dword [fd.in] + sys.close + + push dword [fd.out] + sys.close + + finit + + ; return success + push dword 0 + sys.exit + +align 4 +skiptoeol: + ; Keep reading until you come to cr, lf, or eof + call getchar + jc done + cmp al, 0Ah + jne .cr + ret + +.cr: + cmp al, 0Dh + jne skiptoeol + ret + +align 4 +getchar: + or ebx, ebx + jne .fetch + + call read + +.fetch: + lodsb + dec ebx + clc + ret + +read: + jecxz .read + call write + +.read: + push dword BUFSIZE + mov esi, ibuffer + push esi + push dword [fd.in] + sys.read + add esp, byte 12 + mov ebx, eax + or eax, eax + je .empty + sub eax, eax + ret + +align 4 +.empty: + add esp, byte 4 + stc + ret + +align 4 +putchar: + stosb + inc ecx + cmp ecx, BUFSIZE + je write + ret + +align 4 +write: + jecxz .ret ; nothing to write + sub edi, ecx ; start of buffer + push ecx + push edi + push dword [fd.out] + sys.write + add esp, byte 12 + sub eax, eax + sub ecx, ecx ; buffer is empty now +.ret: + ret + +align 4 +bcdload: + ; EBP contains the number of chars in dbuffer + push ecx + push esi + push edi + + lea ecx, [ebp+1] + lea esi, [dbuffer+ebp-1] + shr ecx, 1 + + std + + mov edi, bbuffer + sub eax, eax + mov [edi], eax + mov [edi+4], eax + mov [edi+2], ax + +.loop: + lodsw + sub ax, 3030h + shl al, 4 + or al, ah + mov [edi], al + inc edi + loop .loop + + fbld [bbuffer] + + cld + pop edi + pop esi + pop ecx + sub eax, eax + ret + +align 4 +printnumber: + push ebp + mov al, [separ] + call putchar + + ; Print the integer at the TOS + mov ebp, bbuffer+9 + fbstp [bbuffer] + + ; Check the sign + mov al, [ebp] + dec ebp + or al, al + jns .leading + + ; We got a negative number (should never happen) + mov al, '-' + call putchar + +.leading: + ; Skip leading zeros + mov al, [ebp] + dec ebp + or al, al + jne .first + cmp ebp, bbuffer + jae .leading + + ; We are here because the result was 0. + ; Print '0' and return + mov al, '0' + jmp putchar + +.first: + ; We have found the first non-zero. + ; But it is still packed + test al, 0F0h + jz .second + push eax + shr al, 4 + add al, '0' + call putchar + pop eax + and al, 0Fh + +.second: + add al, '0' + call putchar + +.next: + cmp ebp, bbuffer + jb .done + + mov al, [ebp] + push eax + shr al, 4 + add al, '0' + call putchar + pop eax + and al, 0Fh + add al, '0' + call putchar + + dec ebp + jmp short .next + +.done: + pop ebp + or ebp, ebp + je .ret + +.zeros: + mov al, '0' + call putchar + dec ebp + jne .zeros + +.ret: + ret + + +The code follows the same format as all the other +filters we have seen before, with one subtle +exception: + + +
+ +We are no longer assuming that the end of input +implies the end of things to do, something we +took for granted in the character–oriented +filters. + + + +This filter does not process characters. It +processes a language +(albeit a very simple +one, consisting only of numbers). + + + +When we have no more input, it can mean one +of two things: + + + +We are done and can quit. This is the +same as before. + + + + + +The last character we have read was a digit. +We have stored it at the end of our +ASCII–to–float conversion +buffer. We now need to convert +the contents of that buffer into a +number and write the last line of our +output. + + + + + +For that reason, we have modified our getchar +and our read routines to return with +the carry flag clear whenever we are +fetching another character from the input, or the +carry flag set whenever there is no more +input. + + + +Of course, we are still using assembly language magic +to do that! Take a good look at getchar. +It always returns with the +carry flag clear. + + + +Yet, our main code relies on the carry +flag to tell it when to quit—and it works. + + + +The magic is in read. Whenever it +receives more input from the system, it just +returns to getchar, which +fetches a character from the input buffer, +clears the carry flag +and returns. + + + +But when read receives no more +input from the system, it does not +return to getchar at all. +Instead, the add esp, byte 4 +op code adds 4 to ESP, +sets the carry +flag, and returns. + + + +So, where does it return to? Whenever a +program uses the call op code, +the microprocessor pushes the +return address, i.e., it stores it on +the top of the stack (not the FPU +stack, the system stack, which is in the memory). +When a program uses the ret +op code, the microprocessor pops +the return value from the stack, and jumps +to the address that was stored there. + + + +But since we added 4 to +ESP (which is the stack +pointer register), we have effectively +given the microprocessor a minor case +of amnesia: It no longer +remembers it was getchar +that called read. + + + +And since getchar never +pushed anything before +calling read, +the top of the stack now contains the +return address to whatever or whoever +called getchar. +As far as that caller is concerned, +he called getchar, +which returned with the +carry flag set! + + +
+ +Other than that, the bcdload +routine is caught up in the middle of a +Lilliputian conflict between the Big–Endians +and the Little–Endians. + + + +It is converting the text representation +of a number into that number: The text +is stored in the big–endian order, but +the packed decimal is little–endian. + + + +To solve the conflict, we use the std +op code early on. We cancel it with cld +later on: It is quite important we do not +call anything that may depend on +the default setting of the direction +flag while std is active. + + + +Everything else in this code should be quite +clear, providing you have read the entire chapter +that precedes it. + + + +It is a classical example of the adage that +programming requires a lot of thought and only +a little coding. Once we have thought through every +tiny detail, the code almost writes itself. + + +
+ + +Using <application>pinhole</application> + +Because we have decided to make the program +ignore any input except for numbers +(and even those inside a comment), we can +actually perform textual queries. +We do not have to, but we can. + + + +In my humble opinion, forming a textual query, +instead of having to follow a very strict +syntax, makes software much more user friendly. + + + +Suppose we want to build a pinhole camera to use the +4x5 inch film. The standard focal +length for that film is about 150mm. We want +to fine–tune our focal length so the +pinhole diameter is as round a number as possible. +Let us also suppose we are quite comfortable with +cameras but somewhat intimidated by computers. +Rather than just have to type in a bunch of numbers, +we want to ask a couple of questions. + + + +Our session might look like this: + +&prompt.user; pinhole + +Computer, + +What size pinhole do I need for the focal length of 150? +150 490 306 362 2930 12 +Hmmm... How about 160? +160 506 316 362 3125 12 +Let's make it 155, please. +155 498 311 362 3027 12 +Ah, let's try 157... +157 501 313 362 3066 12 +156? +156 500 312 362 3047 12 +That's it! Perfect! Thank you very much! +^D + +We have found that while for the focal length +of 150, our pinhole diameter should be 490 +microns, or 0.49 mm, if we go with the almost +identical focal length of 156 mm, we can +get away with a pinhole diameter of exactly +one half of a millimeter. + + + + + +Scripting + +Because we have chosen the # +character to denote the start of a comment, +we can treat our pinhole +software as a scripting language. + + + +You have probably seen shell +scripts that start with: + + +#! /bin/sh + + +...or... + + +#!/bin/sh + +...because the blank space after the #! +is optional. + + + +Whenever &unix; is asked to run an executable +file which starts with the #!, +it assumes the file is a script. It adds the +command to the rest of the first line of the +script, and tries to execute that. + + + +Suppose now that we have installed pinhole +in /usr/local/bin/, we can now +write a script to calculate various pinhole +diameters suitable for various focal lengths +commonly used with the 120 film. + + +The script might look something like this: + + +#! /usr/local/bin/pinhole -b -i +# Find the best pinhole diameter +# for the 120 film + +### Standard +80 + +### Wide angle +30, 40, 50, 60, 70 + +### Telephoto +100, 120, 140 + + +Because 120 is a medium size film, +we may name this file medium. + + + +We can set its permissions to execute, +and run it as if it were a program: + + +&prompt.user; chmod 755 medium +&prompt.user; ./medium + +&unix; will interpret that last command as: + +&prompt.user; /usr/local/bin/pinhole -b -i ./medium + +It will run that command and display: + + +80 358 224 256 1562 11 +30 219 137 128 586 9 +40 253 158 181 781 10 +50 283 177 181 977 10 +60 310 194 181 1172 10 +70 335 209 181 1367 10 +100 400 250 256 1953 11 +120 438 274 256 2344 11 +140 473 296 256 2734 11 + + +Now, let us enter: + +&prompt.user; ./medium -c + +&unix; will treat that as: + +&prompt.user; /usr/local/bin/pinhole -b -i ./medium -c + +That gives it two conflicting options: +-b and -c +(Use Bender's constant and use Connors' +constant). We have programmed it so +later options override early ones—our +program will calculate everything +using Connors' constant: + + +80 331 242 256 1826 11 +30 203 148 128 685 9 +40 234 171 181 913 10 +50 262 191 181 1141 10 +60 287 209 181 1370 10 +70 310 226 256 1598 11 +100 370 270 256 2283 11 +120 405 296 256 2739 11 +140 438 320 362 3196 12 + +We decide we want to go with Bender's +constant after all. We want to save its +values as a comma–separated file: + + +&prompt.user; ./medium -b -e > bender +&prompt.user; cat bender +focal length in millimeters,pinhole diameter in microns,F-number,normalized F-number,F-5.6 multiplier,stops from F-5.6 +80,358,224,256,1562,11 +30,219,137,128,586,9 +40,253,158,181,781,10 +50,283,177,181,977,10 +60,310,194,181,1172,10 +70,335,209,181,1367,10 +100,400,250,256,1953,11 +120,438,274,256,2344,11 +140,473,296,256,2734,11 +&prompt.user; + + +
+ + +Caveats + + +Assembly language programmers who "grew up" under +&ms-dos; and &windows; often tend to take shortcuts. +Reading the keyboard scan codes and writing directly to video +memory are two classical examples of practices which, under +&ms-dos; are not frowned upon but considered the +right thing to do. + + + +The reason? Both the PC BIOS and +&ms-dos; are notoriously +slow when performing these operations. + + + +You may be tempted to continue similar practices in the +&unix; environment. For example, I have seen a web site which +explains how to access the keyboard scan codes on a popular &unix; clone. + + + +That is generally a very bad idea +in &unix; environment! Let me explain why. + + + +&unix; Is Protected + + +For one thing, it may simply not be possible. &unix; runs in +protected mode. Only the kernel and device drivers are allowed +to access hardware directly. Perhaps a particular &unix; clone +will let you read the keyboard scan codes, but chances are a real +&unix; operating system will not. And even if one version may let you +do it, the next one may not, so your carefully crafted software may +become a dinosaur overnight. + + + + + +&unix; Is an Abstraction + + +But there is a much more important reason not to try +accessing the hardware directly (unless, of course, +you are writing a device driver), even on the &unix; like +systems that let you do it: + + + +&unix; is an abstraction! + + + +There is a major difference in the philosophy of design +between &ms-dos; and &unix;. +&ms-dos; was designed as a single-user +system. It is run on a computer with a keyboard and a video +screen attached directly to that computer. User input is almost +guaranteed to come from that keyboard. Your program's output +virtually always ends up on that screen. + + + +This is NEVER guaranteed under &unix;. It is quite common +for a &unix; user to pipe and redirect program input and output: + + +&prompt.user; program1 | program2 | program3 > file1 + + +If you have written program2, your input +does not come from the keyboard but from the output of +program1. Similarly, your output does not +go to the screen but becomes the input for +program3 whose output, in turn, +goes to file1. + + + +But there is more! Even if you made sure that your input comes +from, and your output goes to, the terminal, there is no guarantee +the terminal is a PC: It may not have its video memory +where you expect it, nor may its keyboard be producing +PC-style scan codes. It may be a &macintosh;, +or any other computer. + + + +Now you may be shaking your head: My software is in +PC assembly language, how can +it run on a &macintosh;? But I did not say your software +would be running on a &macintosh;, only that its terminal +may be a &macintosh;. + + + +Under &unix;, the terminal does not have to be directly +attached to the computer that runs your software, it can +even be on another continent, or, for that matter, on another +planet. It is perfectly possible that a &macintosh; user in +Australia connects to a &unix; system in North America (or +anywhere else) via telnet. The +software then runs on one computer, while the terminal is +on a different computer: If you try to read the scan codes, +you will get the wrong input! + + + +Same holds true about any other hardware: A file you are reading +may be on a disk you have no direct access to. A camera you are +reading images from may be on a space shuttle, connected to you +via satellites. + + + +That is why under &unix; you must never make any assumptions about +where your data is coming from and going to. Always let the +system handle the physical access to the hardware. + + + + +These are caveats, not absolute rules. Exceptions are possible. +For example, if a text editor has determined it is running +on a local machine, it may want to read the scan codes +directly for improved control. I am not mentioning these caveats +to tell you what to do or what not to do, just to make you aware +of certain pitfalls that await you if you have just arrived to &unix; +form &ms-dos;. Of course, creative people often break +rules, and it is OK as long as they know they are breaking +them and why. + + + + + + + + + +Acknowledgements + + +This tutorial would never have been possible without the +help of many experienced FreeBSD programmers from the +&a.hackers;, many of whom have patiently +answered my questions, and pointed me in the right direction +in my attempts to explore the inner workings of &unix; +system programming in general and FreeBSD in particular. + + + +Thomas M. Sommers opened the door for me. His +How +do I write "Hello, world" in FreeBSD assembler? +web page was my first encounter with an example of +assembly language programming under FreeBSD. + + + +Jake Burkholder has kept the door open by willingly +answering all of my questions and supplying me with +example assembly language source code. + + + +Copyright © 2000-2001 G. Adam Stanislav. All rights reserved. + + + + + +
diff --git a/zh_TW.Big5/books/faq/book.sgml b/zh_TW.Big5/books/faq/book.sgml index e079c30212..807a489d56 100644 --- a/zh_TW.Big5/books/faq/book.sgml +++ b/zh_TW.Big5/books/faq/book.sgml @@ -1,11177 +1,11641 @@ %man; %freebsd; %authors; %teams; %bookinfo; %mailing-lists; %books.ent; ]> FreeBSD 4.X¡B5.X¡B6.X ±`¨£°Ýµª¶° FreeBSD ¤å¥ó­pµe $FreeBSD$ 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 FreeBSD ¤å¥ó­pµe &bookinfo.legalnotice; &tm-attrib.freebsd; &tm-attrib.3com; &tm-attrib.adobe; &tm-attrib.creative; &tm-attrib.cvsup; &tm-attrib.ibm; &tm-attrib.ieee; &tm-attrib.intel; &tm-attrib.iomega; &tm-attrib.linux; &tm-attrib.microsoft; &tm-attrib.mips; &tm-attrib.netscape; &tm-attrib.opengroup; &tm-attrib.oracle; &tm-attrib.sgi; &tm-attrib.sparc; &tm-attrib.sun; &tm-attrib.usrobotics; &tm-attrib.xfree86; &tm-attrib.general; ³o¥÷¤å¥ó¬O FreeBSD 4.X¡A5.X ¤Î 6.X ªº±`¨£°Ýµª¶°¡C °£«D¦³¯S§O¥[µù¡A§_«h³o¨Ç¶µ¥Ø³£¾A¥Î©ó FreeBSD 4.0 ¤Î¥H«áªºª©¥»¡C - (¦pªG±ø¥Ø¤º®e¤¤¦³ <XXX> «h¬O©|¥¼§¹¦¨¤¤Ä¶ªº³¡¥÷¡C) ¦pªG±z¹ï¨ó§U¥»­pµe + (¦pªG±ø¥Ø¤º®e¤¤¦³ <XXX> «h¬O©|¥¼§¹¦¨¤¤Ä¶ªº³¡¥÷¡C) ¦pªG±z¹ï¨ó§U¥»¤å¥ó/½Ķ­pµe ªº¶i¦æ¦³¿³½ìªº¸Ü¡A½Ð±H e-mail ¨ì &a.doc;¡C¦¹¥~¡AÀH®É¥i±q FreeBSD ºô¯¸ ®³¨ì³o¥÷¤å¥óªº³Ì·sª©¥»¡C ¤]¥i¥H§Q¥Î HTTP ¨Ó¤U¸ü¤@¥÷Ãe¤jªº HTML ¤å¥ó¡A©Î¬O¸g¥Ñ FreeBSD FTP ¯¸ ¤U¸ü¯Â¤å¦r¡B&postscript;¡B©Î PDF ª©¥»ªºÀɮסC ±z¤]¥i¥H¦b³o¸Ì¨Ï¥Î ·j´M¸ê®Æ ªº¥\¯à¡C Ying-Chieh Liao
ijliao@FreeBSD.org
«e¨¥¡B¤@¯ë°ÝÃD Åwªï¨Ï¥Î FreeBSD 4.X-6.X FAQ! ¸ò¨ä¥L Usenet ¤Wªº FAQ ¤@¼Ë¡A³o¥÷¤å¥ó²[»\¤F¦³Ãö FreeBSD ³o®M§@·~ ¨t²Î³Ì±`³Q°Ý¨ìªº°ÝÃD (·íµM¥]¬A¤F¦^µª¡I)¡CÁöµM»¡§Ú­Ì¥»¨Óªº¥Øªº¬O¬°¤F ´î¤Öºô¸ôÀW¼eªº®ö¶O¥H¤ÎÁקK¦P¼Ëªº°ÝÃD¤@¦A¥X²{¡A¦ý¨Æ¹ê¤W FAQ ¤w¸g³Qµø ¬°¬O¤@ºØ­È±o¾\Ūªº¤å¥ó¸ê·½¡C §Ú­Ì¤w¸g¾¨¥i¯à¦a¨Ï³o¥÷ FAQ §óÂ×´I¤F¡C¦pªG±z¹ï¦p¦ó§ïµ½¡B¶i¨B¤è­±¦³¥ô ¦ó«Øij¡A½ÐÀH®É±H¹q¤l¶l¥óµ¹ &a.doc;¡C ¤°»ò¬O FreeBSD¡H ²³æ¦a¨Ó»¡¡AFreeBSD ¬O¤@®M¥i¥H¦b Alpha/AXP, AMD64 ¤Î &intel; EM64T, &i386; IA-64, PC-98, &ultrasparc; ¤W°õ¦æªº UN*X-like §@·~¨t²Î¡A¥¦¬O®Ú¾Ú U.C. Berkeley ©Ò¶}µo¥X¨Óªº 4.4BSD-Lite¡A¨Ã¥[¤W¤F³\¦h 4.4BSD-Lite2 ªº¼W±j¥\¯à¡C¥¦¦P®É¤]¶¡±µ¨Ï¥Î¤F U.C. Berkeley ©Ò¶}µo¥X¨Ó¨Ã¥Ñ William Jolitz ²¾´Ó¨ì i386 ªº Net/2¡A¤]´N¬O 386BSD¡A¤£¹L²{¦b 386BSD ªºµ{¦¡½X¥u³Ñ¤U·¥¤Ö¼ÆÁÙ¯d ¦s¦b FreeBSD ¤¤¡C±z¥i¥H¦b FreeBSD ­º­¶§ä¨ì¦³Ãö ¤°»ò¬O FreeBSD ¥H¤Î¥¦¥i¥HÀ°±z°µ¨Ç¤°»òªº¬ÛÃö¸ê°T¡C FreeBSD ¤w³Q¼sªx¦a³Q¥@¬É¦U¦aªº¤½¥q¦æ¸¹¡BISP¡B¬ã¨s¤H­û¡B¹q¸£ ±M®a¡B¾Ç¥Í¡A¥H¤Î®a®x¥Î¤á©Ò¨Ï¥Î¡A¥Î¦b¤u§@¡B±Ð¨|¥H¤Î®T¼Ö¤W¡C ¦pªG·Q¬ÝÃö©ó FreeBSD §ó²`¤Jªº¸ê®Æ¡A½Ð¬Ý FreeBSD ¨Ï¥Î¤â¥U¡C µo®i FreeBSD ªº¥Øªº¬O¤°»ò¡H FreeBSD ­pµeªº¥Øªº¬O´£¨Ñ¥i¥H¥ô·N¨Ï¥Î¥B¨S¦³­­¨îªº³nÅé¡C§Ú­Ì¦b µ{¦¡½X (¥H¤Î­p±Þ¥»¨­) ¤W¥I¥X¤F¤j¶q¤ß¦å¡A·íµM¤£·|¤¶·N¨ÓÂIª÷¿ú¤Wªº ¦^õX¡A¤£¹L§Ú­Ìµ´¹ï¤£·|¦p¦¹°í«ù¡C§Ú­Ì¬Û«H§Ú­Ì­º­nªº ¥ô°È ´N¬O´£¨Ñµ{¦¡½Xµ¹¨C¤@­Ó¨Ï¥ÎªÌ¡A¤£ºÞ¥L­Ì¥´ºâ¥Î ¨Ó·F¹À¡F³o»ò¤@¨Ó¡A³o¨Çµ{¦¡½X¤~¯à³Q¥Î¦b³Ì¦h¦a¤è¡A¤]¤~¯àµo´§¥¦­Ì³Ì ¤jªº§Q¯q¡C§Ú­Ì¬Û«H³o´N¬O¦Û¥Ñ³nÅé³Ì°ò¥»ªº¥Ø¼Ð¤§¤@¡A¦Ó¥B§Ú­Ì·|ºÉ¥þ ¤O¥h¤ä«ù¥¦¡C ¦b§Ú­Ì source tree ¤¤¦³³¡¥÷ªºµ{¦¡½X¬O±Ä¥Î©Ò¿×ªºGPL©Î¬O LGPL ª©Åv«Å§i¡AÁöµM³o¨Çª©Åv«Å§i¬O¥Î¨Ó«O»Ù¦Ó«D­­¨î¨Ï¥ÎªÌªºÅv §Q¡A²¦³º¬O¤£¨º»ò¦Û¥Ñ¤F¨Ç¡C¥Ñ©ó³o¨Ç GPL ªº³nÅé¦b°Ó·~¨Ï¥Î¤W·|¤Þ°_ «D±`½ÆÂøªºª©Åv°ÝÃD¡A¦]¦¹¥u­n¦³¾÷·|¡A§Ú­Ì·|ºÉ¶q¥H±Ä¥Î¤ñ¸ûÃPªº FreeBSD ª©Åvªº³nÅé¨Ó¨ú¥N³o¨Ç GPL ª©Åv«Å§iªº³nÅé¡C FreeBSD ª©Åv¦³¥ô¦ó­­¨î¶Ü¡H ¦³ªº¡C¦ý¬O³o¨Ã¤£¬O­­¨î§A«ç»ò¥h¨Ï¥Î³o¨Çµ{¦¡½X¡A¦Ó¬O§A«ç»ò¬Ý«Ý FreeBSD ³o­Ó­pµe¡C¦pªG§A¦³ª©ÅvµJ¼{¯gªº¸Ü¡A½Ð¾\Ū ª©Åv¥»¤å¡C²³æ¦a¨Ó»¡¡A³o¥÷ª©Åvªº­«ÂI¥i¥H±ø¦C¦p¤U¡C ½Ð¤Å«ÅºÙ¬O±z¼g¤F³o­Óµ{¦¡¡C ¦pªG¥¦¥X°ÝÃD¤F¡A¤£­n±±§i§Ú­Ì¡C FreeBSD ¥i¥H¨ú¥N§Ú²{¦b¦b¥Îªº§@·~¨t²Î¶Ü¡H ¹ï¤j³¡¥÷ªº¤H¨Ó»¡¬O³o¼Ë¨S¿ù¡A¦ý¨Æ¹ê¤W³o°ÝÃD¨Ã¨S¦³³o»ò¦n¦^ µª¡C ¤j³¡¥÷ªº¤H¨Ã¤£¬O¯u¥¿¦b¨Ï¥Î¤@­Ó§@·~¨t²Î¡C¥L­Ì¨Ï¥Îªº¬OÀ³¥Îµ{¦¡ ¡F¦Ó¨º¨ÇÀ³¥Îµ{¦¡¤~¬O¯u¥¿¥Î¨ì§@·~¨t²ÎªºªF¦è¡CFreeBSD ¬O³]­p¥Î¨Ó´£ ¨Ñ¤@­Ó±j¶´¥B¥\¯à§¹¾ãªº§@·~Àô¹Òµ¹À³¥Îµ{¦¡¨Ó°õ¦æ¡C¥¦¤ä´©¤F¦hºØÂsÄý ¾¹¡A¿ì¤½«Ç®M¥ó³nÅé¡A¹q¤l¶l¥ó¾\Ū³nÅé¡Aø¹Ïµ{¦¡¡Aµ{¦¡³]­pÀô¹Ò¡Aºô ¸ô¦øªA¾¹³nÅé¡A¥H¤Î´X¥G©Ò¦³§A·Q­nªºªF¦è¡C¤j³¡¥÷ªºµ{¦¡³£¥i¥H¾aPorts Collection¨ÓºÞ ²z¡C ¦ý¬O¦pªG§A·Q­n¨Ï¥ÎªºÀ³¥Îµ{¦¡¥u¯à¦b¬Y­Ó¯S©wªº§@·~¨t²Î¤W­±°õ¦æ ªº¸Ü¡A§A´N¤£¯à»´©ö¦a§â¥¦´«±¼¡A©ÎªÌ«ü±æ¦b FreeBSD ¤W¦³«Ü¬Û¦üªºÀ³¥Î µ{¦¡¤~¦³¾÷·|¡C¦pªG§A·Q­nªº¬O¤@­Ó±j°·ªº¿ì¤½«Ç©Î¬Oºô¸ô¦øªA¾¹¡A©Î¬O ¤@³¡Ã­©wªº¤u§@¯¸¡A©Î¬O·Q¦b¤£³Q¤¤Â_ªºÀô¹Ò¤U¤u§@ªº¸Ü¡AFreeBSD µLºÃ ¬O±zªº³Ì¨Î¿ï¾Ü¡C¥@¬É¦U¦a¦³«Ü¦h¨Ï¥ÎªÌ¡A¥]¬Aªì¾Ç©Î¸ê²`ªº &unix; ºÞ²z ¤H­û³£¿ï¥Î FreeBSD ·í¥L­Ì°ß¤@ªº®à¤W§@·~¨t²Î¡C ¦pªG§A¬O±q¨ä¥Lªº &unix; Àô¹ÒÂà´«¨ì FreeBSD ªº¸Ü¡A°ò¥»¤W¬O¤j¦P¤p ²§ªº¡C¦ý¬O¦pªG§A¤§«e¥Îªº¬O¹Ï§Î¬É­±ªº§@·~¨t²Î¡A¨Ò¦p»¡¬O &windows; ©Î¬O ¤ñ¸û¥j¦Ñªº &macos; ªº¸Ü¡A¥i¯à´N­n¦hªá¤@ÂI®É¶¡¨Ó¾Ç²ß«ç»ò¥Î &unix; ªº ¤èªk¨Ó°µ¨Æ¡C§A¥i¥H±q³o¥÷ FAQ ©M FreeBSD ¨Ï¥Î¤â¥U ¨Ó¤Jªù¡C ¬°¤°»ò­n¥s°µ FreeBSD¡H ±z¥i¥H§K¶O¨Ï¥Î¥¦¡A§Y¨Ï¬O¥Î©ó°Ó·~¥Î³~¡C ¾ã­Ó FreeBSD §@·~¨t²Î§¹¾ãªº­ì©lµ{¦¡³£¥i¥H§K¶O¨ú±o¡A¦Ó¥B¤£ ºÞ¬O¦b¨Ï¥Î¡A´²§G©Î¬O¾ã¦X¶i¨ä¥Lµ{¦¡µ¥¦U¤è­±¤]¥u¨ü¨ì³Ì¤pªº­­ ¨î (¤£½×¬O§_¥Î©ó°Ó·~¥Î³~)¡C ¥ô¦ó¤H³£¥i¥H¦Û¥Ñ¦a§â¥L¹ï¨t²Îªº§ï¨}©Î¿ù»~­×¥¿ªºµ{¦¡½X¥[¤J source tree ¤§¤¤ (·íµM­n²Å¦X´X­Ó¥ý¨M±ø¥ó)¡C ¯S§O­È±oª`·Nªº¬O³o¸Ìªº free ¥X²{¤F¨â¦¸¡A¦Ó¥B¥¦­Ì ªº·N«ä¬O¤£¤@¼Ëªº¡G¤@ºØ¥Nªí §K¶O¡A¥t¤@ºØ¥Nªí ¦Û¥Ñ¡C±z¥i¥H®³ FreeBSD ¥h°µ¥ô¦ó±z·Q­n°µªº¨Æ¡A°£¤F¤@¨Ç ¨Ò¥~¡A¨Ò¦p±z«ÅºÙ FreeBSD ¬O±z¼gªº¡C FreeBSD ¤Î NetBSD, OpenBSD ¥H¤Î¨ä¥L open source BSD §@·~¨t²Î¤§¶¡¦³¦ó¤£¦P¤§³B©O¡H James Howard ¦b DaemonNews ¤W¼g¤F The BSD Family Tree ªº¤å¥ó¡A¸Ì­±»¡©ú¤F³o¨Ç¾ú¥v²W·½¤Î³o¨Ç *BSD ®a±Ú­pµe¤§¶¡ªº®t²§¡C ³Ì·sª©ªº FreeBSD ¬O¨º¤@ª©¡H - ´N FreeBSD ¥Ø«eªºµo®i¦Ó¨¥¡A¦³¥|­Ó¥D­nµo®i¤À¤ä(¨ä¤¤¤T­Ó¤w¦³ RELEASE)¡G - ¥Ñ 4-STABLE ©Òµo¦æ(release)ªº 4.X ¨t¦C¡B + ´N FreeBSD ¥Ø«eªºµo®i¦Ó¨¥¡A¦³¤T­Ó¥D­nµo®i¤À¤ä(¨ä¤¤¨â­Ó¤´«ùÄò¦³¦b¥X RELEASE ªº¬¡°Ê)¡G ¥Ñ 5-STABLE ©Òµo¦æ(release)ªº 5.X ¨t¦C¡B - ¥Ñ 6-STABLE ©Òµo¦æ(release)ªº 6.X ¨t¦C¡A - ¥H¤Î 7-CURRENT ¤À¤ä¡C + ¥Ñ 6-STABLE ©Òµo¦æ(release)ªº 6.X ¨t¦C³o¨â­Ó¤À¤ä¡C ¦b 5.3 release ¤§«e¡A4.X ¨t¦C¤´ÄÝ -STABLE ¤À¤ä¡C ¦Û±q 5.3 ¶}©l¡A5.X ¨t¦C¶}©l³W¹º·sªº -STABLE ¤À¤äµo®i­«ÂI¡A - ¦Ó 4.X ±N¥uµÛ­«¦b­«¤j°ÝÃD¤W(¤ñ¦p¡Gº|¬}­×¸É¡B¦w¥þºûÅ@)¥H¤Î "extended support" - ¡A¤£¦A·|¦³·sªº¬ð¯}©Êµo®i¡C + ¦Ó 4.X ±N¥uµÛ­«¦b­«¤j°ÝÃD¤W(¤ñ¦p¡Gº|¬}­×¸É¡B¦w¥þºûÅ@)¥H¤Î©Ò¿×ªº "extended support" + ¡A¤£¦A·|¦³·sªº¬ð¯}©Êµo®i¡C¥t¤@¤è­±¡A5-STABLE ¤À¤äÁöµM¤´±NÄ~Äòµo¦æ¡A¦ý¬O¥Ñ©ó¥¦¥u¬O ¡§legacy¡¨ ¹L´ç´Á¤À¤ä¡A + ©Ò¥H¤j¦h¼Æ¥D¤O³£¤wÂಾ¨ì 6-STABLE Ä~Äò¶}µo¡C ©ó &rel.current.date; ©Òµo¦æªº &rel.current; ª©¬O¥Ø«e³Ì·sªº 6-STABLE ¤À¤ä¡F ¦Ó©ó &rel2.current.date; ©Òµo¦æªº &rel2.current; ª©«h¬O¥Ø«e³Ì·sªº 5-STABLE ¤À¤ä¡C - ²³æªº»¡¡A-STABLE ªº¥D­n¶D¨D¹ï¶H¬O¹ï©ó + ²³æ¦a¨Ó»¡¡A-STABLE ªº¥D­n¶D¨D¹ï¶H¬O¹ï©ó í©w©Ê¤Î§CÅܲ§©Êªº»Ý¨D»·³Ó¹L¹ï³Ì·s -CURRENT snapshot ¤¤¯S§O·s¥\¯àªº»Ý¨D¡A¨Ò¦p ISP ©Î¤½¥q¦æ¸¹ªº¨Ï¥ÎªÌ¡C³o¨â­Ó branch ³£¦³¥i¯à·|²£¥Í release ª©¡A¦ý¥u¦³·í§A¯à±µ¨ü -CURRENT »·¤ñ -STABLE ®e©ö§ó°Ê³o¤@ÂI¡A¤~À³¸Ó¥Î -CURRENT¡C Release ª©¨C´X­Ó¤ë¤~·|µo ¦æ¤@¦¸¡CÁöµM¦p¦¹¡A¦³«Ü¦h¤H©M FreeBSD ­ì©l½X¦P¨B§ó·s¡]¸Ô¨£ - FreeBSD-CURRENT ©M FreeBSD-STABLE ªº¬ÛÃö°ÝÃD)¡A¦ý¦]¬°­ì©l½X + &os.current; ©M &os.stable; ªº¬ÛÃö°ÝÃD)¡A¦ý¦]¬°­ì©l½X ¬O¤@ª½¤£Â_¦a¦bÅܰʪº¡A©Ò¥H¦pªG­n³o»ò°µªº¸Ü±o­nªá¤W§ó¦hªººë ¤O¡C ¨ä¥L§ó¦h¬ÛÃö FreeBSD µo¦æ±¡³ø¡A¥i¥Ñ FreeBSD ºô¯¸¤Wªº Release Engineering ±oª¾ - ¤°»ò¬O FreeBSD-CURRENT¡H + ¤°»ò¬O &os.current;¡H FreeBSD-CURRENT + url="&url.books.handbook;/cutting-edge.html#CURRENT">&os.current; «üªº¬O¥¿¦bµo®i¤¤ªº§@·~¨t²Îª©¥»¡A¥¦²×±N¦b¾A·íªº®É¾÷¦¨¬° &os.stable; ¤À¤ä¡C¥¦¹ê¦b¬O¥u¾A¦Xµ¹¨t²Îµo®iªÌ¥H¤Î¦³¼Ý¤Oªº·~¾l·R¦nªÌ¨Ï¥Î ¡C¦pªG·Q­n±o¨ì¦³Ãö¦p¦ó¨Ï¥Î -CURRENT ªº²`¤J¸ê°T¡A½Ð°Ñ¦Ò ¨Ï¥Î¤â¥U ªº ¬ÛÃö³¡¥÷¡C ¦pªG±z¹ï§@·~¨t²Î¥»¨­¨Ã¤£¬O«Ü¼ô±x¡A©Î¬O±z¨S¿ìªk¤À¿ë±z¹J¨ìªº°Ý ÃD¬O¯uªºµo¥Í¤F°ÝÃD¥ç©Î¬O¼È®É©Êªº¤pª¬ªp¡A¨º»ò±z´N¤£À³¸Ó¨Ï¥Î - FreeBSD-CURRENT¡C³o­Ó¤À¤äªºµ{¦¡½X¦³®É­ÔÅܰʱo«Ü§Ö¡A¦Ó¥B¥i¯à·|¦]¦¹ + &os.current;¡C³o­Ó¤À¤äªºµ{¦¡½X¦³®É­ÔÅܰʱo«Ü§Ö¡A¦Ó¥B¥i¯à·|¦]¦¹ ¦Ó¨Ï±z¦³¦n´X¤Ñªº®É¶¡µLªk§ó·s±zªº¨t²Î¡C§Ú­Ì°²³]¨Ï¥Î - FreeBSD-CURRENT ªº¨Ï¥ÎªÌ³£¦³¯à¤O¥h¤ÀªR¥L­Ì©Ò¹J¨ìªº°ÝÃD¨Ã¥B¥u¦^³ø + &os.current; ªº¨Ï¥ÎªÌ³£¦³¯à¤O¥h¤ÀªR¥L­Ì©Ò¹J¨ìªº°ÝÃD¨Ã¥B¥u¦^³ø ¯u¥¿ªº°ÝÃD¦Ó«D¤pª¬ªp¡C¦pªG±z¦b -CURRENT mailing list ¤¤´£¨ìÃþ¦ümake world ³y¦¨¤@¨Ç¦³Ãö groups ªº¿ù »~¤§Ãþªº°ÝÃDªº¸Ü¡A¤]³\·|³Q¨ä¥L¤H»´µø¡C §Ú­Ì¨C¤Ñ³£·|®Ú¾Ú¥Ø«e -CURRENT ©M -STABLE ªºª¬ªp¹ï³o¨â­Ó¤À¤ä¦U µo¦æ¤@­Ósnapshot ª©¡C¦³ªº®É­Ô¬Æ¦ÜÁÙ·|µo¦æ¥i¨Ñ¨ú±oªºª©¥»¡Cµoªí³o¨Ç snapshot ªº¥Øªº¦b©ó¡G ´ú¸Õ³Ì·sª©ªº¦w¸Ëµ{¦¡¡C ´£¨Ñ¤@­Ó²³æªº¤èªkµ¹¨º¨Ç³ßÅw¨Ï¥Î -CURRENT ©Î¬O -STABLE ¦ý ¬O¨S¦³®É¶¡©MÀW¼e¥h¨C¤Ñª@¯Åªº¨Ï¥ÎªÌ¡C ¬°¤F´À§Ú­Ìµo®i¤¤ªºµ{¦¡«O¯d¤@­Ó©T©wªº°Ñ¦ÒÂI¡A¥H¨¾¤î§Ú­Ì¥¼ ¨Ó³y¦¨¤£©¯¡C(ÁöµM¤@¯ë¦Ó¨¥ CVS ¥i¥H¨¾¤îÃþ¦ü³oºØªº¥i©È¨Æ¥ó :) ¬°¤F½T«O©Ò¦³»Ý­n´ú¸Õªº·s¥\¯à³£¥i¥H±o¨ì³Ì¦hªº´ú¸Õ¡C §Ú­Ì¤£¹ï -CURRENT snapshot °µ¥ô¦ó§Î¦¡ªº«~½è«O ÃÒ¡C¦pªG§A·Q­nªº¬O¤@­Óí©w¥B¸g¹L¥R¤À´ú¸Õ¹Lªº¨t²Îªº¸Ü¡A ³Ì¦n¿ï¾Ü¨Ï¥Î§¹¾ã release ªºª©¥»¡A©Î¬O¨Ï¥Î -STABLE snapshots¡C ±z¥i¥Hª½±µ±q ftp://current.FreeBSD.org/pub/FreeBSD/snapshots/ ¨ú±o -CURRENT ªº snapshot release ¹ï¨C­Ó¦³¦b¬¡°Êªº¤À¤ä¦Ó¨¥¡A¥­§¡¨C¤Ñ³£·|²£¥Í¤@¦¸ snapshots¡C - ¤°»ò¬O FreeBSD-STABLE¡H + ¤°»ò¬O &os.stable;¡H ¦^·¹¨ì FreeBSD 2.0.5 ­èµoªíªº®É­Ô¡A§Ú­Ì¨M©w§â FreeBSD ªºµo®i ¤À¦¨¨â¤ä¡C¤@¤ä¥s°µ -STABLE ¡A§Ú­Ì¥u¹ï¥¦°µ¿ù»~­×¥¿¤Î¤p´T«×ªº­×§ï (³o¬Oµ¹ ISP ©M°Ó·~¤½¥qµ¥¡A¹ï¹êÅ礤¥\¯à¤£·P¿³½ìªº³æ¦ì©Ò¨Ï¥Îªº)¡C ¥t¥~¤@¤ä¥s°µ -CURRENT¡A±q 2.0 ª©µo¦æ¥H«á¡A´N¤£Â_¦a´ÂµÛ 6.0-RELEASE (§t«áÄòªºª©¥»)«e¶iµÛ¡C 6-STABLE ¤À¤ä¬O±q 6.0-RELEASE ¶}©l(5-STABLE ¤À¤äºâ¬O 5.3-RELEASE ¤§«á¤~¶}©lªº)¡A µM«á­ì¥»ªº &os.current; ´N·|¦¨¬° 7-CURRENT¡C ¤U­±´N¬Oª©¥»ºt¶iªº¥Ü·N¹Ï¡G 2.0 | | | [2.1-STABLE] *BRANCH* 2.0.5 -> 2.1 -> 2.1.5 -> 2.1.6 -> 2.1.7.1 [2.1-STABLE ends] | (Mar 1997) | | | [2.2-STABLE] *BRANCH* 2.2.1 -> 2.2.2-RELEASE -> 2.2.5 -> 2.2.6 -> 2.2.7 -> 2.2.8 [end] | (Mar 1997) (Oct 97) (Apr 98) (Jul 98) (Dec 98) | | 3.0-SNAPs (started Q1 1997) | | 3.0-RELEASE (Oct 1998) | | [3.0-STABLE] *BRANCH* 3.1-RELEASE (Feb 1999) -> 3.2 -> 3.3 -> 3.4 -> 3.5 -> 3.5.1 | (May 1999) (Sep 1999) (Dec 1999) (June 2000) (July 2000) | | [4.0-STABLE] *BRANCH* 4.0 (Mar 2000) -> 4.1 -> 4.1.1 -> 4.2 -> 4.3 -> 4.4 -> ... -> 4.11 | | (July 2000) (Sep 2000) (Nov 2000) (Jan 2005) | | [5.0-STABLE] - *BRANCH* 5.0 (2001) -> 5.1 -> 5.2 -> 5.3 -> 5.4 -> ... future 5.x releases... + *BRANCH* 5.0 (2001) -> 5.1 -> 5.2 -> 5.3 -> 5.4 -> 5.5 | - | ( 2001) (Nov 2004) (May 2005) + | (2001) (Nov 2004) (May 2005)(May 2006) | | [6.0-STABLE] - *BRANCH* 6.0 (Nov 2005) ... future 6.x releases... + *BRANCH* 6.0 (Nov 2005) -> 6.1... -> future 6.x releases... | + | (May 2006) \|/ + [7.0-CURRENT continues] 2.2-STABLE ³o­Ó¤À¤äÀHµÛ 2.2.8 ªºµoªí¦Ó¥\¦¨¨­°h¡C3-STABLE ³o­Ó ¤À¤ä«h¬Oµ²§ô¦b 3.5.1 µoªí¤§«á¡A¥¦¤]¬O 3.X ªº³Ì«á¤@¦¸µoªí¡C¤§«á°£¤F - ¦w¥þ¬ÛÃöªº­×¥¿¤§¥~¡A³o¨â­Ó¤À¤ä´N´X¥G¨S¦³¦A§ó°Ê¹L¡C4-STABLE ¤À¤äªº¤ä´© - ·|«ùÄò¨ì 2007/01/31¡A¦ý¥D­nµJÂI¦b©ó¦w¥þ¤è­±ªºº|¬}¡B¯äÂΤΨä¥LÄY­«°ÝÃDªº­×¸É¡C - - 5-STABLE ¬O¥Ø«e¥¿¦bµo®i¤¤ªº -STABLE ¤À¤ä¡C5-STABLE ªº³Ì·sªº¤@ - ¦¸µoªí¬O¦b &rel2.current.date; µo¦æªº &rel2.current;-RELEASE¡C + ¦w¥þº|¬}ªº«áÄò­×¥¿¤§¥~¡A³o¨Ç¤À¤ä´N´X¥G¨S¦³¦A§ó°Ê¹L¡C + ¦Ó 4-STABLE¡B5-STABLE ¤À¤äªº¤ä´©±N¤´«ùÄò¤@¬q®É¶¡(4-STABLE ¬O«ùÄò¨ì 2007/01/31)¡A + ¦ý¥D­nµJÂI¶È¦b©ó¦w¥þ¤è­±ªºº|¬}¡B¯äÂΤΨä¥LÄY­«°ÝÃDªº­×¸É¡C 6-STABLE ¬O¥Ø«e¥¿¦bµo®i¤¤ªº -STABLE ¤À¤ä¡C6-STABLE ªº³Ì·sªº¤@ ¦¸µoªí¬O¦b &rel.current.date; µo¦æªº &rel.current;-RELEASE¡C 7-CURRENT ³o­Ó¤À¤ä¬O &os; ªº -CURRENT ¤À¤ä¡A¤´µM¤£Â_¦a¦bµo®i·í¤¤¡C ¦pªG·Q­nª¾¹D§ó¦hÃö©ó³o­Ó¤À¤äªº¸ê°Tªº¸Ü¡A½Ð°Ñ¦Ò ¤°»ò¬O &os;-CURRENT¡H¡C FreeBSD ª©¥»©R¦W­ì«h¬O¤°»ò©O¡H ±z¥i¯à·|¬Ý¨ì¥H¤U´XºØ FreeBSD ªºª©¥»¦WºÙ¡G 1) 4.4.2-RELEASE¡B4.4-BETA¡G ³Ì«e­±ªº¼Æ¦r A.B.C ¸Ì¡AA ªí¥Ü¥D­nªº§@·~¨t²Îª©¥»(Major)¡AB ªí¥Ü ¦¸­nªº§@·~¨t²Îª©¥»(Minor)¡AC ªí¥Ü¨Ç·L­×¥¿ª©¥»(Patch)¡C«á­±ªº­^¤å ªí¥Ü¬O§_¬°¥¿¦¡ª©¡A³q±`¬O´ú¸Õª©(ALPHA¡BBETA¡BGAMMA)¡B¥¿¦¡ª©(RELEASE)¡C 2) 6.0-STABLE¡B7.0-CURRENT¡G ³q±` FreeBSD ·|¦³¤@­Ó¥Hµo®i·s¥\¯à¬°¥Dªºª©¥»¡AºÙ¬° CURRENT¡A¥Ø«eªº CURRENT ª©¥»¬O 7.0¡FFreeBSD ¤]·|¦³¤@­Ó¥HºûÅ@í©w©Ê¤Î¨t²Î¦w¥þ¬°¥D ªºª©¥»¡AºÙ¬° STABLE¡A¥Ø«e STABLE ªºª©¥»¬O 6.0¡CÁöµM¦p¦¹¡A¨Ã¤£¥Nªí STABLE ´N¨S¦³·s¥\¯à¡A¤]¤£¥Nªí CURRENT ´N¤£Ã­©w¤£¦w¥þ¡A³o¨â­Óª©¥» ¬O¬Û»²¬Û¦¨ªº¡A¦Ó¥B²×¦³¤@¤Ñ 7.0-CURRENT ·|Åܦ¨ 7.0-STABLE¡A¦Ó¶}©l 8.0-CURRENT ªºµo®i¡C¤£¹L¤@¯ë¨Ó»¡¡A¥Ñ©ó CURRENT ¨t²Î¶}µoªº³t«×¬Û·í §Ö¡A¸ò STABLE ¬Û¤ñ¸û¤£Ã­©w¡A¦Ó¥B³Ì¦n¬O¦³¬Û·í¸gÅ窺¨Ï¥ÎªÌ¤~¨Ó¨Ï¥Î¡C ¦pªG¬O°Ó·~Àô¹Ò©Î¬O¦øªA¾¹¯¸¥x¡A³Ì¦nÁÙ¬O¶] STABLE »P RELEASE ¤ñ¸û¦n¡C ¥Ñ©ó STABLE »P CURRENT ³£¬O¤@ª½¦b¶}µoºûÅ@¤¤ªºª©¥»¡A¦]¦¹¨S¦³¤@­Ó ¯S©wªº¼Æ¦rª©¥»¥i¥HºÙ©I¡A¦]¦¹³q±`§Ú­Ì·|¥H½sĶ¤é´Á¨Ó¥Nªí¬O­þ­Ó®É­Ô ªº STABLE ©Î CURRENT¡A¨Ò¦p¡u4.4-STABLE¡B½sĶ¤é´Á 2001/10/08¡v¡C 3) 5.0-011025-SNAP¡B4.2-010816-RELENG¡G SNAP »P RELENG ¨Ã¤£¬O¥¿¦¡µo¦æªºª©¥»¡A¨ä¤¤ 3.0-970625-SNAP ªí¥Ü¬O ¦b 2001 ¦~ 10 ¤ë 25 ¤éµo¦æªº 5.0 ´ú¸Õª©(SNAPshot)¡A³q±`¬O«ü CURRENT ªºª©¥»¡C¦Ó 4.2-010816-RELENG ªí¥Ü¬O¦b 2001 ¦~ 8 ¤ë 16 ¤éµo¦æªº 4.2 «D¥¿¦¡ªºÃ­©wª©¡A³q±`¬O«ü STABLE ªºª©¥»¡C ³q±` FreeBSD ®Ö¤ß¤p²Õ·|¤£©w®ÉÄÀ¥X SNAP ¥H¨Ñ´ú¸Õ¡AµM«á¦³¤@¤Ñ SNAP ·|Åܦ¨ ALPHA->BETA->GAMMA¡A¦A¨Ó¬O RELEASE¡A¦Ó«á¥i¯à·|¦³¤£©w®Éªº RELENG ¥H¨Ñ´ú¸Õ¨Ï¥Î¡A¦ý¬O RELENG ªºÃ­©w©Ê³q±`¤S¤ñ«e´Áªº RELEASE ¨Óªº¦n¡C ±z­n¬O²ßºD·L³nªº³N»y¡A³o¼Ë»¡¦n¤F¡ASNAP ¬O¶}µo´Á¶¡ªº¤º³¡¬y¥Xª©¡A ¨º­Ó¤é´Á(011025)´N¬OBuild Number¡A¦Ó ALPHA »P BETA ¬O·mÂAª©¡A RELEASE(RELENG «j±j¤]ºâ)¬O¥¿¦¡ª©¡A³o¼ËÀ³¸Ó¤F¸Ñ¤F§a¡C ¨C¦¸·sªº FreeBSD ±N©ó¤°»ò®É­Ô±À¥X¡H ¤@¯ë¦Ó¨¥¡A&a.re; ¥­§¡¨C¥|­Ó¤ëµo¦æ¤@¦¸ release¡A¨C¦¸·sª©¥»ªºµoªí®Éµ{³£·|¨Æ¥ý¤½§i¡A ¬ÛÃöªº¶}µo¤H­û´N·|ª¾¹D¡A¤°»ò®É­Ô¸Ó¥ý§â¤âÃ䪺­p¹º§¹¦¨¨Ã¥B´ú¸Õ¹L¡A ¦¹¥~¡A³o¨Ç§ó°Ê³£¤w¸g§¹¾ã¦a´ú¸Õ¹L¡A¥B¤£·|¼vÅT¨t²Îí©w«×¡C ÁöµM¡Aµ¥³o¨Ç¦nªF¦è¶i¤J -STABLE ªº®É¶¡¥O¤Hµ¥±o¦³¨Ç¤£­@·Ð¡A ¦ý¬O¤j¦h¼Æªº¨Ï¥ÎªÌ³£»{¬°³oºØÂÔ·VªººA«×¬O FreeBSD ³Ì¦nªºÀuÂI¤§¤@¡C ¦³Ãöµo¦æ±¡³øªº§ó¦h²Ó¸`³¡¤À(¥]¬A release ªº¦æµ{ªí¡B¶i«×)¡A³£¥i¦b FreeBSD ºô¯¸¤Wªº µo¦æ±¡³ø ¤W­±Àò±o¡C ¬°¤Fº¡¨¬¨º¨Ç»Ý­n (©Î·Q­n) ·sÂA¨ë¿E·Pªº¨Ï¥ÎªÌ¡A ¤W­±(-CURRENTªº³¡¤À)¤w¸g´£¨ì§Ú­Ì¨C¤Ñ³£·|µo¦æ snapshots ª©¥i¨Ñ¨Ï¥Î¡C ½Ö­t³d FreeBSD ªºµo®i¡H ¦pªG¬O¤@¨Ç¦³Ãö FreeBSD ­pµeªºÃöÁä©Ê¨M©w¡A¹³¬O¾ã­Ó­pµeªº¨«¦V ©Î¬O¨M©w½Ö¥i¥H§ï source tree ¸Ìªºµ{¦¡½X³oÃþªº¨Æ¡A¬O¥Ñ¤@­Ó¥Ñ 9 ­Ó ¤H©Ò²Õ¦¨ªº core team ¨Ó¨M©w¡C¦Ó¦³¥t¤@¸s¶W¹L 300 ­Ó¤Hªº commiters ¦³Åv§Q¥i¥Hª½±µ­×§ï FreeBSD ªº source tree¡C µL½×¦p¦ó¡A¤j¦h¼Æªº§ïÅܳ£·|¨Æ«e¦b mailing lists ¥ý°Q½×¹L¡A¦Ó¥B¤£¤À¨¤¦â¡A¨C­Ó¤H³£¥i¥H°Ñ»P°Q½×¡C §Ú­n¦p¦ó¨ú±o FreeBSD¡H ¨C­Ó FreeBSD ªº­«­nª©¥»³£¥i¥H¸g¥Ñ°Î¦W ftp ±q FreeBSD FTP ¯¸¨ú±o¡G ¦pªG»Ý­n 6-STABLE ªº³Ì·sª©¡A¤]´N¬O &rel.current;-RELEASE¡A½Ð¨ì &rel.current;-RELEASE ³o­Ó¥Ø¿ý 7-CURRENT Snapshot ³q±`¤]¬O¨C¤Ñ³£·|°µ¤@¥÷¡A³o¬O±q -CURRENT ¤À¤ä°µ¥X¨Óªº¡A ¥D­n¬O¬°¤F´£¨Ñµ¹¨º¨Ç¼ö¤ßªº´ú¸ÕªÌ©M¶}µo¤H­û¡C ¦pªG»Ý­n 5-STABLE ªº³Ì·sª©¡A¤]´N¬O &rel2.current;-RELEASE¡A½Ð¨ì &rel2.current;-RELEASE ³o­Ó¥Ø¿ý - - ¦pªG»Ý­n 4-STABLE ªº³Ì·sª©¡A¤]´N¬O 4.11-RELEASE¡A½Ð¨ì 4.11-RELEASE ³o­Ó¥Ø¿ý - - 4.X¡B5.X¡B6X snapshots + url="ftp://current.FreeBSD.org/pub/FreeBSD/snapshots/">5.X¡B6X snapshots ³q±`¨C¤Ñ³£·|°µ¤@¥÷¡C FreeBSD ªº CD¡BDVD¡AÁÙ¦³¨ä¥L¨ú±o¤è¦¡¥i¥H¦b ¨Ï¥Î¤â¥U ¤¤§ä¨ì¸Ñµª¡C §Ú­n¦p¦ó¥h¬d¸ß¡B´£¥æ°ÝÃD¦^³ø(Problem Report¡A²ºÙPR)¸ê®Æ®w©O¡H ©Ò¦³¨Ï¥ÎªÌªºÅܧó­n¨D³£¥i¥H¸g¥Ñºô­¶¤¶­±ªº PR¬d¸ß¤¶­± ¨Ó¹î¬Ý (©Î¬O¦^³ø) §Ú­Ìªº¿ù»~¦^³ø¸ê®Æ®w¡C ¤]¥i¥H¨Ï¥Î &man.send-pr.1; ³o­Ó«ü¥O³z¹L¹q¤l¶l¥ó¨Ó¦^³ø°ÝÃD¡B­n¨DÅܧó¡C ©ÎªÌ¬O¸g¥Ñ ºô­¶¤¶­±ªº PR ¨Ó°e¥X°ÝÃD¦^³ø¡C µM¦Ó¡A¦b±z¦^³ø°ÝÃD¤§«e¡A½Ð¥ý¾\Ū ¦p¦ó¼¶¼g FreeBSD ªº°ÝÃD¦^³ø³æ¡A³o¬O¤@½g§i¶D§A«ç¼Ë¤~¯à¼g¥X¤@½g¯u¥¿¦³¥Îªº °ÝÃD¦^³ø³æ¡C ÁÙ¦³¨ä¥L¦³Ãö FreeBSD ªº¸ê°T¶Ü¡H ¸Ô¨£ FreeBSD ºô¯¸¤Wªº ¤å¥ó ¦Cªí¡C
Chin-San Huang
chinsan.tw@gmail.com
¤å¥ó»P§Þ³N¤ä´© Ãö©ó FreeBSD ¦³­þ¨Ç¦n®Ñ¥i¥H±ÀÂ˾\Ūªº¶Ü¡H FreeBSD ¤å¥ó­pµe¤w³°Äòµoªí¤F¬Û·í¼sªx½d³òªº¤å¥ó¡A¥i¦b ¨ú±o¡C¥t¥~¡A FreeBSD ¥»¨­ªº manual(¤@¯ë³qºÙªºman)¡Bdoc¤]¦p¦P®M¥ó³nÅé¤@¼Ë¡A¥i¥H»´ÃP¦a¸Ë¦b±z¨t²Î¤W¡C ¦¹¥~¡A¤]«Øij°Ñ¾\¥»¥÷ FAQ ³Ì«á©Ò¦Cªº°Ñ¦Ò®Ñ¥Øªí(Bibliography)»P FreeBSD ¨Ï¥Î¤â¥U¡C ³o¨Ç¤å¥ó¦³¨ä¥L®æ¦¡ªº¶Ü¡H¹³¬O¡G¯Â¤å¦r(ASCII)©Î &postscript; ¤§Ãþªº®æ¦¡¡H ¦³ªº¡C³o¨Ç¤å¥ó³£¤À§O¥H¤£¦P®æ¦¡Àx¦s¥H¤ÎÀ£ÁY³B²z¡A©ñ¦b FTP ¤W­±¡A¥i¥H±q¦U FreeBSD FTP ¯¸ªº /pub/FreeBSD/doc/ ¥Ø¿ý¤º§ä¨ì§A­nªº¡C ¤å¥óªº¤ÀÃþ¤è­±¥D­n¬O¤@¨Ç¤£¦P©Ê½è©Ò²Õ¦¨¡G ¤å¥ó¦WºÙ¡A¤ñ¦p¡Gfaq(±`¨£°Ýµª¶°)©Î¬O handbook(FreeBSD ¨Ï¥Î¤â¥U)µ¥µ¥¡C ¦U°ê½Ķªºªº¤å¥ó¡G³o¥D­n¬O¥Ñ locale ¦WºÙ¨Ó¨M©wªº (¤£²M·¡ªº¸Ü¡A¥i°Ñ¦Ò±zªº FreeBSD §@·~¨t²Î¤Wªº /usr/share/locale) ¥Ø«e¤å¥óÁ`¦@¦³¤U¦C´XºØ»y¨¥(¤Î½s½X)¦³Â½Ä¶¡G Locale ¦WºÙ »¡©ú(©Ò¥Nªíªº»y¨t¡B½s½X) en_US.ISO8859-1 ¬ü¦¡­^¤å(US English) de_DE.ISO8859-1 ¼w¤å(German) es_ES.ISO8859-1 ¦è¯Z¤ú¤å(Spanish) fr_FR.ISO8859-1 ªk¤å(French) it_IT.ISO8859-15 ¸q¤j§Q¤å(Italian) ja_JP.eucJP ¤é¤å(Japanese¡A½s½X¤è¦¡¡GEUC) ru_RU.KOI8-R «X¤å(Russian¡A½s½X¤è¦¡¡GKOI8-R) zh_TW.Big5 ¥¿Å餤¤å(Chinese¡A½s½X¤è¦¡¡GBig5) ¤W¦Cªº¦U°ê½Ķ»y¨t¤å¥ó¤¤¡A¨Ã«D©Ò¦³¤å¥ó³£¦³Â½Ä¶¡C ¤å¥óªº®æ¦¡¡G¨C¥÷¤å¥ó³£¥H¦UºØ¤£¦P®æ¦¡Àx¦s¡A¨CºØ®æ¦¡³£¦U¦³¦nÃa¡A ¦³¨Ç®æ¦¡¾A¦X½u¤W¾\Ū¡A¦Ó¦³¨Ç«h¾A¦X¦C¦L¥X¬üÆ[ªº¤å¥ó¡C §Ú­Ì³£´£¨Ñ³o¨Ç¤£¦P®æ¦¡ªº¤å¥ó¡A¨Ó½T«OµL½×¬O¿Ã¹õ¤W¡B¦C¦L¯È¥»¡A¨C­Ó¤H³£¥i¥H¥¿±`¦a¾\Ū¤º®e¡A ¥Ø«e¥i¨Ñ¨Ï¥Îªº®æ¦¡¦p¤U: ®æ¦¡ »¡©ú html-split ³¹¸`¼Ò¦¡ html §¹¾ã¼Ò¦¡ pdb Palm Pilot ¸ê®Æ®æ¦¡¡A¨Ï¥Î iSilo µ{¦¡¨Ó¾\Ū pdf Adobe's PDF ®æ¦¡ ps &postscript; ®æ¦¡ rtf Microsoft's RTF®æ¦¡ ·í¨Ï¥Î MS Word ¨Ó¶}±Ò RTF ®æ¦¡ªº¸Ü¡A­¶¼ÆÅã¥Ü¨Ã¤£·|¦Û°Ê§ó·s¡C (¦b¶}±Ò¤å¥ó«á¡A­n«ö CTRLA, CTRLEND, F9¡A³o¼Ë¤l¤~·|§ó·s­¶¼ÆªºÅã¥Ü¡C) txt ¯Â¤å¦r(ASCII) ¤å¥óªºÀ£ÁY¡B¥´¥]¤è¦¡¡G¥Ø«e¦³¤TºØ¤è¦¡¡G ·í±Ä¥Î ³¹¸`¼Ò¦¡(html-split)¡A³¹¸`¼Ò¦¡©Ò²£¥Íªº¦UÀÉ®×·|¥ý¨Ï¥Î &man.tar.1; ¨ÓÀ£ÁY¡CÀɦWµ²§À¦³ .tar ªºÀÉ®×´N¬O tar ®æ¦¡¡C ±µµÛ¡A·|¦A¥H¤U¦C¤è¦¡¦AÀ£ÁY¡C ¨ä¥L®æ¦¡ªºÀɮ׳£·|¬O³æ¤@ÀɮסAÀɦW³q±`·|¬O¡G book.®æ¦¡ (Á|¨Ò¡G book.pdb¡A book.html µ¥µ¥..«á­±³q±`¥[¤W¡y.®æ¦¡¡z). ¦Ó³o¨ÇÀÉ®×·|¤À§O¥H¨âºØÀ£ÁY«¬ºA¶i¦æÀ£ÁY¡A¦Ó¦s¦¨¨âºØÀ£ÁY«¬ºA¡C ®æ¦¡ »¡©ú zip Zip ®æ¦¡¡A­Y­n¦b FreeBSD ¤W¸ÑÀ£ zip ÀÉ¡A«h¥²¶·¥ý¦w¸Ë chinese/unzip ©Î archivers/unzip¡C bz2 BZip2 ®æ¦¡¡AÁöµM¤£¦p zip ®æ¦¡ªº¼sªx¨Ï¥Î¡A¦ý¬O¦n³B¦b©ó¥iÀ£ÁY¦¨§ó¤pªºÀɮסC ­n¸ÑÀ£ bz2 ®æ¦¡ªº¸Ü¡A»Ý¥ý¦w¸Ë archivers/bzip2 ¡C ©Ò¥H¹³¬O Handbook ªº &postscript; ª©®æ¦¡¡A·|¥H BZip2 ®æ¦¡À£ÁY¡A ¦s©ñ¦b handbook/ ¥Ø¿ý¤º¡A ÀɦW´N¬Obook.ps.bz2¡C ¿ï¾Ü·Q­n¤U¸üªº¤å¥ó®æ¦¡»PÀ£ÁY«¬ºA¤§«á¡A«h­n¨M©w¬O§_¥H FreeBSD ®M¥ó(package) «¬ºA¨Ó¤U¸ü¡C ¤U¸ü¡B¦w¸Ë¡ypackage¡zªº¦n³B¦b©ó¡G¥i¥H³z¹L¤@¯ë FreeBSD ®M¥óºÞ²z¤è¦¡¨Ó¶i¦æºÞ²z¡A¤ñ¦p &man.pkg.add.1; ¤Î &man.pkg.delete.1;¡C ­Y¨M©w¦n­n¤U¸ü¡B¦w¸Ë¡ypackage¡zªº¸Ü¡A¥²¶·­n½T»{©Ò­n¤U¸üªºÀɦW¡C ¤å¥ó­pµeªº®M¥ó(package)³q±`¬O©ñ¦b¬O packages ªº¥Ø¿ý¤º¡A ¨C­Ó¤å¥ó­pµeªº®M¥óÀɦW³q±`¬O¡G ¤å¥ó¦WºÙ.»y¨t.½s½X.®æ¦¡.tgz ¡C Á|­Ó¨Ò¤l¡A­^¤åª©ªº FAQ (®æ¦¡¿ï¾Ü PDF)¦b package ´N¥s°µ faq.en_US.ISO8859-1.pdf.tgz¡C ¦AÁ|­Ó¨Ò¤l¡A¤¤¤åª©ªº FAQ (®æ¦¡¿ï¾Ü PDF)¦b package ´N¥s°µ faq.zh_TW.Big5.pdf.tgz¡C ª¾¹D³oÂI¤§«á¡A´N¥i¥H¥Î¤U­±«ü¥O¨Ó¦w¸Ë¤¤¤åª© FAQ ®M¥ó¡G &prompt.root; pkg_add ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/packages/faq.zh_TW.Big5.pdf.tgz §¹¦¨¤§«á¡A¥i¥H¥Î &man.pkg.info.1; ¨Ó§ä¥XÀɮ׸˦b­þÃä¡G &prompt.root; pkg_info -f faq.zh_TW.Big5.pdf Information for faq.zh_TW.Big5.pdf: Packing list: Package name: faq.zh_TW.Big5.pdf CWD to /usr/share/doc/zh_TW.Big5/books/faq File: book.pdf CWD to . File: +COMMENT (ignored) File: +DESC (ignored) ¦p¦P±z©Ò¬Ý¨ìªº book.pdf ·|³Q¦w¸Ë¨ì /usr/share/doc/zh_TW.Big5/books/faq ¤º¡C ­Y¤£·Q¥Î package ¤è¦¡¦w¸Ë¡A¨º»ò´N»Ý¤â°Ê¤U¸ü¡B¸ÑÀ£ÁY¡B½Æ»s¨ì§A·Q­nÂ\©ñªº¦ì¸m¥h¡C Á|¨Ò¡A³¹¸`¼Ò¦¡(split HTML)ª©ªº­^¤å FAQ (À£ÁY¬° &man.bzip2.1;)·|©ñ¦b doc/en_US.ISO8859-1/books/faq/book.html-split.tar.bz2 ­n¤U¸ü¡B¸ÑÀ£ªº¸Ü¡A«h­n¥´¡G &prompt.root; fetch ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/en_US.ISO8859-1/books/faq/book.html-split.tar.bz2 &prompt.root; bzip2 -d book.html-split.tar.bz2 &prompt.root; tar xvf book.html-split.tar ³o®É§A·|¬Ý¨ì¤@°ï .html ªºÀɮסA ¥D­nªº¥Ø¿ýÀɬ° index.html ¤º§t¥D¥Ø¿ý¤Î³sµ²¨ì¨ä¥L¤å¥ó¡C(­Y¦³»Ý­nªº¸Ü¡A¤]¥i¥H½Æ»s©Î·h²¾³o¨ÇÀɮרì¦P¤@¥Ø¿ý¤U) ­þ¸Ì¦³Ãö©ó FreeBSD ªº¶l»¼½×¾Â(mailing lists)©O¡H ³o­Ó°ÝÃD¡A¥i¥H±q FreeBSD ¨Ï¥Î¤â¥U¤W­±ªº ¶l»¼½×¾Â(mailing-lists) ³¡¤ÀÀò±oµª®×¡C ¦³­þ¨Ç¥i¥H¨Ï¥Îªº FreeBSD ·s»D¸s²Õ(news groups)©O? ³oµª®×¥i¥H±q FreeBSD ¨Ï¥Î¤â¥U¤W­±ªº ·s»D¸s²Õ(newsgroups) ³¡¤ÀÀò±oµª®×¡C + + + ¦b¤å¥ó¤¤±`¬Ý¨ìÃþ¦ü "pf(4)"¡B"pfctl(8)" µ¥³o¨Ç¦r¼Ë¥Nªí¤°»ò·N«ä©O¡H + + + + ³oªí¥Ü man ªº³¹¸`¡A¨t²Î¤W¤@¯ë¦³¤K­Ó³¹¸`¡G + + + 1->generl commands + + + + 2->system calls and error numbers + + + + 3->C libraries + + + + 4->devices and device drivers + + + + 5->file formats + + + + 6->games + + + + 7->miscellaneous information pages + + + + 8->system maintenance and operation commands + + + + ¤ñ¦p¡Gpf(4) ´N¬O«ü man 4 pf¡C + + ¦³­þ¨Ç FreeBSD IRC (Internet Relay Chat)ÀW¹D©O¡H ¦³ªº¡A¤j³¡¤Àªº IRC ¥D¾÷³£¦³ FreeBSD ²á¤ÑÀW¹D¡G EFNet ªº #FreeBSD ÀW¹D¬O­Ó FreeBSD ½×¾Â¡A ¦ý¥i¤£¾A¦X¨º¨Ç·Q¤£³Ò¦ÓÀò©ÎªÌ·h±Ï§L¥Îªº¡C ³o¸Ì¬O²á¤Ñ¥ÎªºÀW¹D¡A¸ÜÃD½d³ò¬Æ¦Ü¯A¤Î¡y©Ê¡B¹B°Ê¡B®ÖªZ¡zµ¥¡A ½Ðª`·N¡G§Ú­Ì¤w¸gĵ§i¹L§A¤F¡I¥»ÀW¹D¥i¸g¥Ñ irc.chat.org ¶i¤J¡C EFNet ªº #FreeBSDhelp ÀW¹D ¤D¬Oµ¹ FreeBSD ¨Ï¥ÎªÌ¤§¶¡¥æ¬yªº¡A ¨Ó³o¸Ì´£°Ý·|¤ñ #FreeBSD ¦n¤@¨Ç¡A·íµM½Ð¤£­n¤@ªÑ¸£ÀH«K¶Ã°Ý¡C DALNET ªº #FreeBSD ÀW¹D¡A¥i¥Ñ irc.dal.net(¦ì©ó¬ü°ê)¤Î irc.eu.dal.net(¦ì©ó¼Ú¬w)¶i¤J¡C DALNET ªº #FreeBSDHelp ÀW¹D¡A¥i¥Ñ irc.dal.net(¦ì©ó¬ü°ê)¤Î - irc.eu.dal.net(¦ì©ó¼Ú¬w)¶i¤J¡C - ¥»ÀW¹Dªº¥D«ùªÌ¦³«Ø¥ß¦³Ãö¸ÓÀW¹D»P &os; ªººô­¶¡A¦b - . + irc.eu.dal.net(¦ì©ó¼Ú¬w)¶i¤J¡C UNDERNET ªº #FreeBSD ÀW¹D¡A¥i¥Ñ us.undernet.org(¦ì©ó¬ü°ê)¤Î eu.undernet.org(¦ì©ó¼Ú¬w)¶i¤J¡C¥Ñ©ó³o¬O­Ó»²§U·s¤â¥ÎªºÀW¹D¡A ½Ð°O±o¾\Ū§O¤H¦V§A´£¤Îªº³sµ²©ÎÀɮסC RUSNET ªº #FreeBSD ÀW¹D¬O«X»y°ê®aªº &os; ¨Ï¥ÎªÌÀW¹D¡C ³o¸Ì¦P®É¤]¬O¤@¯ë¥æ¬yªº°Q½×¦n¥h³B¡C freebsd-gnome ªº #FreeBSD ÀW¹D¡A¥i¥Ñ irc.freenode.net ¶i¤J¡A ³o¬O Gnome ªº &os; ¨Ï¥ÎªÌÀW¹D¡C IRCNet ªº #BSDChat ÀW¹D¡A¥i¥Ñ irc.seed.net.tw ©Î irc.csie.nctu.edu.tw ©Î irc.tw.freebsd.org ¶i¤J ³o¬O¥xÆWªº &os; ¨Ï¥ÎªÌÀW¹D¡C ¤W­z¨C­ÓÀW¹D³£¤£¤@¼Ë¡A­·®æ­~²§¦Ó¦U¨ã¯S¦â¡A¥B¨Ã¨S¦³¬Û³s¡A ¦]¦¹¡A§A±o¦h¤è¹Á¸Õ¤~¯à§ä¨ì¾A¦X¦Û¤vªºÀW¹D¡C¦Ó¦³¨Ç¦a¤è»P©Ò¦³ªº IRC ¤å¤ÆÃþ¦ü¡A ´N¬O½Ðª`·N¦Û¤v¨¥¦æ¬O§_«ê·í¡A¥t¥~¥i¯à¸òÀW¹D¤º¤@¨Ç¦~»´/¦Ñ¤@½úªº¡A·|¦³¨Ç¥N·¾»Ý­n¾AÀ³¡C - ¥i¥H±q­þÃäÀò±o FreeBSD ªº°Ó·~½Òµ{°V½m¤Î§Þ³N¤ä´©©O¡H + ¥i¥H±q­þÃäÀò±o FreeBSD ªº±Ð¨|½Òµ{°V½m¤Î§Þ³N¤ä´©©O¡H - DaemonNews ¦³±Mªù´£¨Ñ FreeBSD ªº°Ó·~½Òµ{°V½m¤Î§Þ³N¤ä´©¡C + DaemonNews ¦³±Mªù´£¨Ñ FreeBSD ªº±Ð¨|½Òµ{°V½m¤Î§Þ³N¤ä´©¡C ¸Ô±¡½Ð¨ì BSD Mall ¹î¬Ý¡AÁÂÁ¡C - FreeBSD Mall ¦³´£¨Ñ°Ó·~¤Æªº BSD §Þ³N¤ä´©¡A + FreeBSD Mall ¦³´£¨Ñ BSD §Þ³N¤ä´©¥I¶OªA°È¡A ¸Ô±¡½Ð¨ì FreeBSD Mall ¹î¬Ý¡AÁÂÁ¡C - ¨ä¥L¥ô¦ó¦³´£¨Ñ½Òµ{°V½m¤Î§Þ³N¤ä´©ªº²Õ´¡B³æ¦ì¡A­Y¤]·Q¦Cªí©ó¦¹ªº¸Ü¡A + ¨ä¥L¥ô¦ó¦³´£¨Ñ±Ð¨|½Òµ{°V½m¤Î§Þ³N¤ä´©ªº²Õ´¡B³æ¦ì¡A­Y¤]·Q¦Cªí©ó¦¹ªº¸Ü¡A ½Ð»P &a.doc; Ápµ¸¡AÁÂÁ¡C
Nik Clayton
nik@FreeBSD.org
¦w¸Ë ­Y­n¥Î³nºÐ¤ù¶}¾÷¨Ó¦w¸Ë FreeBSD ªº¸Ü¡A­n¤U¸ü­þ¨ÇÀɮשO¡H &os; 4.X ªº¸Ü¡A»Ý­n¨â­Ó image ÀÉ¡G floppies/kernel.flp ¤Î floppies/mfsroot.flp¡Cimage ÀÉ¥²¶·¥Î¤u¨ã¹³¬O fdimage ©Î &man.dd.1; ¨Ó¶Ç°e¨ìºÏ¤ù¤W¡C ­Y¬O¦b &os; 5.3 (¤Î¤§«áª©¥»)¦³­«·s³W¹º¶}¾÷¤ù¬[ºc¡A©Ò¥H­n§ìªº¬O floppies/boot.flp ¥H¤Î floppies/kernX ÀÉ®×(¥Ø«e X ¬° 1 ¸ò 2 ¨â­Ó¡A¥[¤W floppies/boot.flp¡AÁ`¦@¬O 3 ­ÓÀÉ®×)¡C ­Y·Q¦Û¤v¤U¸ü distributions ªº¸Ü(¤ñ¦p¥H &ms-dos; Àɮרt²Î®æ¦¡¦w¸Ë)¡A ¥H¤U¬O«Øij­n§ìªº distributions ¡G base/ (4.X ª©¥»«h¬° bin/) manpages/ compat*/ doc/ src/ssys.* §¹¾ã¦w¸Ë¨BÆJ¥H¤Î¤j³¡¤Àªº¦w¸Ë°ÝÃD¡A½Ð°Ñ¾\ FreeBSD ¨Ï¥Î¤â¥Uªº ¦w¸Ë FreeBSD ³¹¸` ­YºÏ¤ù¸Ë¤£¤U image Àɪº¸Ü¡A¸Ó«ç»ò¿ì©O¡H ¤@±i 3.5 ­^¦T(1.44MB) ªººÏºÐ¤ù¬O¥i¥H¸Ë¤W 1474560 bytes ªº¸ê®Æ ¡A¦Ó¶}¾÷¤ùªº image Àɮפj¤p¹ê»Ú¤W¤]¬O 1474560 bytes¡C ¦b»s§@¶}¾÷¤ù®É¡A±`¨£¿ù»~¦³¡G ¨Ï¥Î FTP ¨Ó¤U¸üÀɮ׮ɡA ¥¼¿ï¾Ü binary ¶Ç¿é¼Ò¦¡¨Ó¤U¸ü¡C ¦³¨Ç FTP clientºÝµ{¦¡¡A¬O¹w³]±N¶Ç¿é¼Ò¦¡³]©w¬° ascii ¼Ò¦¡¡A¦Ó¥B·|­×§ï±µ¦¬¨ìªºÀɮצæ§À¦r¦ê¬° client ºÝªº§@·~¨t²Î¤è¦¡ ¡A¤ñ¦p newline(&unix;®æ¦¡) ¨ì¤F§@·~¨t²Î¬° &windows; ªº client ºÝ·|³Q§ï¬° CR-LF(&ms-dos;®æ¦¡)¡A ³o·|¨Ï±o image ÀÉ¥»¨­¾D¨ì­×§ï¦ÓµLªk¥¿±`¨Ï¥Î¡C¦]¦¹¡A¦pªG¤U¸üªº image Àɮפj¤p­Y»P FTP ¥D¾÷¤W­±ªºÀɮסy¤£¤@­P¡z ªº¸Ü¡A½Ð­«·s¨Ï¥Î binary ¶Ç¿é¼Ò¦¡¤U¸ü§Y¥i¡C FTP «ü¥O: ¶i¤J FTP ¤§«á¡A¥´ binary «ü¥O¡A§Y¥i¤Á´«¨ì binary ¶Ç¿é¼Ò¦¡¡AµM«á¦A¤U¸ü¬ÛÃö image ÀɮסC ª½±µ¥Î &ms-dos; ªº copy «ü¥O(©ÎÃþ¦ü ªº GUI µ{¦¡¡B©Î¬Oµøµ¡¤Wª½±µ½Æ»s)¨Ó½Æ»s¶}¾÷¥Îªº image ÀɨìºÏ¤ù¤W¡C ¤£¥i¥H¥Î¹³¬O copy ³oÃþµ{¦¡ª½±µ±N image Àɽƻs¨ìºÏ¤ù¤W¡A¦]¬° image ÀÉ¥»¨­¥]§t¤F§¹¾ãªººÏ­y¸ê®Æ¡A©Ò¥H¤£¯à³æ¯Â¥Î½Æ»s¤è¦¡¡A ¦Ó¥²¶·¨Ï¥Î§C¶¥¤u¨ãµ{¦¡(¹³¬O fdimage ©Î rawrite)¡A ¥H raw ¤è¦¡¶Ç°e¨ìºÏ¤ù¤W¡C(³o³¡¤À¥i°Ñ¾\ FreeBSD ¨Ï¥Î¤â¥U¤Wªº ¦w¸Ë FreeBSD) ¥i¥H¦b­þÃä§ä¨ì¦w¸Ë FreeBSD ªº¸Ñ»¡¨BÆJ©O¡H ¦w¸Ë¨BÆJªº¸Ñ»¡¡A½Ð°Ñ¾\ FreeBSD ¨Ï¥Î¤â¥U¤Wªº ¦w¸Ë FreeBSD ³¹¸`³¡¤À¡C ­n¶] FreeBSD »Ý­n¤°»òªº°t³Æ©O¡H &os; 4.X ¤§«eªºª©¥»¡AµwÅé»Ý¨D¬° 386 ©Î§ó°ª¯Åªº PC ¡A°O¾ÐÅé(RAM)¦Ü¤Ö­n 5 MB ©Î§ó¦h¡AµwºÐªÅ¶¡¦Ü¤Ö­n 60 MB ©Î§ó¦h¡C ¤£¹L¡A&os; ¡y¨t²Î¦w¸Ëµ{¦¡¡zªº°O¾ÐÅé(RAM)»Ý¨D¬°¦Ü¤Ö 16 MB¡C ±q &os; 5.X °_¡AµwÅé»Ý¨D¬° 486 ©Î§ó°ª¯Åªº PC ¡A°O¾ÐÅé(RAM)¦Ü¤Ö­n 24 MB ©Î§ó¦h¡AµwºÐªÅ¶¡¦Ü¤Ö­n 150 MB ©Î§ó¦h¡C &os; ªº©Ò¦³ª©¥»³£¥i¥H¥u¥Î§C¶¥ªº MDA ³W®æÅã¥Ü¥d¡A¤£¹L...­n¶] X11R6 µøµ¡ªº¸Ü¡A ÁÙ¬O¦Ü¤Ö¥Î VGA ©Î§ó¦n³W®æªºÅã¥Ü¥d¨Ó¥Î§a¡C ³o³¡¤À¤]¥i°Ñ¾\ ¡C §Ú¹q¸£ RAM ¥u¦³ 4MB ¦Ó¤w¡A¥i¥H¸Ë FreeBSD ¶Ü¡H ¦w¸Ë &os; 4.X ªº°O¾ÐÅé»Ý¨D¬°¦Ü¤Ö 5 MB ¡A¦Ó ¦w¸Ë &os; 5.X (§t¤§«áª©¥») «h¬O¦Ü¤Ö­n 8 MB ¡C ¦b 5.X ¤§«eªº©Ò¦³ &os; ª©¥»¡A³£¥i¥H¥u¥Î 4 MB ªº°O¾ÐÅé¨Ó ¡y¹B§@¡z¡A¤£¹L¡A«e­±¨º¸`§Ú­Ì»¡¹L¤F¡y¨t²Î¦w¸Ëµ{¦¡¡zªº¸Ü¡A «hµLªk¥u¥Î 4 MB ªº°O¾ÐÅé¨Ó°õ¦æ¡C¦]¦¹¡A§A¥i¥H¥ý¦b¡y¨t²Î¦w¸Ëµ{¦¡¡z³o¨BÆJ¤§«e¡A ¥ý±N°O¾ÐÅé¥[¨ì 16 MB ¥H¤W¡A¦w¸Ë§¹ FreeBSD ¤§«á¡A´N¥i¥H§â¦h¾lªº°O¾ÐÅ鮳¤U¨Ó¡C ©ÎªÌ¬O¡A¥ý§â­n¦w¸ËªºµwºÐ®³¨ì¦³¨¬°÷°O¾ÐÅ骺¾÷¾¹¤W¥ý¸Ë¦n¡A µM«á¦A§âµwºÐ©ñ¦^­ì¾÷¾¹¡C ¦¹¥~¡A¥u¥Î 4 MB ªº°O¾ÐÅé¨Ó¹B§@ªº¸Ü¡A¥²¶·­n¦Û»s kernel(®³±¼¤£¥²­nªº¥H¤ÎÄ묹¤@¨ÇªF¦è)¡C ¤]¦³¤H¦¨¥\¥u¥Î 2 MB ªº°O¾ÐÅé¥H &os; ¶}¾÷(ÁöµM³o¼Ëªº¨t²Î´X¥Gµ¥©ó¼o¤F..) ­n«ç¼Ë¤~¯à¦Û¦æ¥´³y±M¥Îªº¶}¾÷¡B¦w¸ËºÏ¤ù©O¡H ¥Ø«e¡AÁÙ¨S¦³¿ìªk¡y¥u¡z¦Û»s±M¥Îªº¶}¾÷¡B¦w¸ËºÏ¤ù¡C ¥²¶·³z¹L¦Û¦æ¥´³y§¹¾ã§@·~¨t²Îªº release(µo¦æ)¡A³o¼Ë¸Ì­±¤~·|¥]¬A¦Û¤vªº¶}¾÷¡B¦w¸ËºÏ¤ù¡C ­Y·Q¦Û¦æ¥´³y¡Bµo¦æ(release)¤@­Ó§¹¾ãªº§@·~¨t²Î¡A½Ð°Ñ¾\³o½g Release Engineering ¤å³¹¡C §Ú¹q¸£¤W¥i¥H¦³¦h­«§@·~¨t²Î¶Ü¡H ¥i¥H§r¡A½Ð°Ñ¾\ ¦h­«§@·~¨t²Î ³o½g¤å³¹¡C &windows; ¥i¥H»P FreeBSD ¦@¦s©ó¹q¸£¤W¶Ü¡H ¥ý¸Ë &windows; ¦A¸Ë FreeBSD¡C ¨º»ò FreeBSD ¦h­«¶}¾÷ºÞ²z­û(boot manager)´N·|¥X²{¿ï³æÅý§A¿ï¾Ü­n¥H &windows; ©Î FreeBSD ¨Ó¶}¾÷¡C¤£¹L¡A­Y§A¬O¥ý¸Ë FreeBSD ¦A¸Ë &windows; ªº¸Ü¡A ¨º»ò &windows; ±N·|¤£°Ý¥ý®_¡A§â FreeBSD ªº¦h­«¶}¾÷ºÞ²z­û(boot manager)»\±¼¡A ·í§A¹J¤W³oºØ±¡ªp®É¡A½Ð°Ñ¦Ò¤U¤@¸`»¡©ú¡C ¶ã.. &windows; §â§Úªº¦h­«¶}¾÷ºÞ²z­û(boot manager)®³±¼¤F¡I­n«ç»ò±Ï¦^¨Ó©O¡H ¥i¥H¥Î¥H¤U¤TºØ¤è¦¡¤§¤@¡A¨Ó±Ï¦^§Aªº FreeBSD ¦h­«¶}¾÷ºÞ²z­û(boot manager)¡G ¥i¥H±q¦U FreeBSD FTP ¯¸ªº /pub/FreeBSD/tools/ §ä¨ì bootinst.exe ¤Î boot.bin ³o¨â­ÓÀÉ¡A ¥H binary ¶Ç¿é¼Ò¦¡¤U¸ü«á¡A½Æ»s¨ìºÏ¤ù¤W¡A¦A¥Î DOS ¶}¾÷¤ù¶}¾÷¡A ±µµÛ¥´Ãþ¦ü¤U­±ªº«ü¥O¡G > bootinst.exe boot.bin ³o¼Ë¡A¦h­«¶}¾÷ºÞ²z­û(boot manager)´N·|­«¸Ë§¹²¦¤F¡C ¥Î FreeBSD ¶}¾÷¤ù¶}¾÷¡AµM«á¿ï³æ¨ºÃä¿ï Custom installation(¦Û­q¦w¸Ë)¡A ¦A¿ï Partition¡A±µµÛ¿ï¾Ü§A­n¸Ë¦h­«¶}¾÷ºÞ²z­û(boot manager)ªºµwºÐ(³q±`¬O²Ä¤@Áû)¡A µM«á·|¥X²{ partition editor ªºµe­±¡A³o®É½Ð¤£­n°µ¥ô¦ó­×§ï¡Aª½±µ«ö W Àx¦s¡A ³o®Éµ{¦¡´N·|°Ý¬O§_­n½T©w Write ¡A³Ì«á¥X²{ Boot Manager ¿ï¾Üµe­±¡A °O±o­n¿ï Boot Manager ¡A³o¼Ë´N·|­«·s±N¦h­«¶}¾÷ºÞ²z­û(boot manager) ¦w¸Ë¨ìµwºÐ¤W¡C²{¦b¡A´N¤j¥\§i¦¨¥i¥HÂ÷¶}¦w¸Ë¿ï³æ¨Ã­«¶}¾÷¤F¡C ¥Î FreeBSD ¶}¾÷¤ù©Î¬O¶}¾÷¥úºÐ¶}¾÷¡AµM«á¿ï³æ¨ºÃä¿ï Fixit ¡A©Î¬O¥H Fixit ¶}¾÷¤ù©Î¬O¥úºÐ¦w¸Ëªº²Ä¤G¤ù(¿ï¾Ü live filesystem ¿ï¶µ)µM«á´N·|¶i¤J fixit shell ¤F¡A±µµÛ¥´¤U¦C«ü¥O¡G Fixit# fdisk -B -b /boot/boot0 bootdevice ½Ð±N¤W­±ªº bootdevice ­×§ï¬°±z¹ê»Úªº¶}¾÷µwºÐ¥N¸¹ ¤ñ¦p ad0 (²Ä¤@Áû IDE µwºÐ) ¡A©Î¬Oad4 (first IDE disk on auxiliary controller), da0 (²Ä¤@Áû SCSI µwºÐ)µ¥µ¥¡C IBM Thinkpad A¨t¦C¡BT¨t¦C©Î X¨t¦Cªºµ§°O«¬¹q¸£¸Ë§¹ FreeBSD ¤§«á­«¶}¾÷¡A´N·í¤F¡A¸Ó«ç»ò¿ì©O¡H (¥»°ÝÃD¥D­n¬Oµo¥Í¦b 2000 ~ 2001 ¥|¤ë¶¡®É)³o¨Ç IBM ¾÷¾¹¤Wªº BIOS ¦­´Áª©¥»¦³­Ó¯äÂÎ(bug)·|§â FreeBSD ¤À³Î°Ï»~»{¬°¬O FAT ®æ¦¡¤À³Î°Ï¡AµM«á·í BIOS ¸ÕµÛ°»´ú FreeBSD ¤À³Î°Ï®É¡A´N·|·í¤F¡C ®Ú¾Ú IBM ¤è­±ªº»¡ªk¤@«Ê¨Ó¦Û Keith Frechette ªº e-mail kfrechet@us.ibm.com¡C ¡A¥H¤U«¬¸¹/BIOSª©¥»ªº¾÷ºØ¡A¤w¸g³£¦³­×¥¿¡G «¬¸¹ BIOS ª©¥» T20 IYET49WW(§t¤§«á) T21 KZET22WW(§t¤§«á) A20p IVET62WW(§t¤§«á) A20m IWET54WW(§t¤§«á) A21p KYET27WW(§t¤§«á) A21m KXET24WW(§t¤§«á) A21e KUET30WW ³o¨Ç«á´Áªº IBM BIOS ­×­qª©¤j¦h¤w¸g­×¥¿¦¹¤@¯äÂΡCJacques Vidrine ¼gµ¹ &a.mobile; ªº ³o«Ê«H ¤W­±»¡©ú¤F­Y§A·sªº IBM µ§°O«¬¹q¸£µLªk¶¶§Q¥H FreeBSD ¶}¾÷ªº¸Ñªk¨BÆJ (°²³]¥i¥H¤É¯Å©Î­°¯Å BIOS ª©¥»ªº¸Ü)¡C ¦pªG¾÷¾¹¥Îªº¬O¸û¥j¦­ª©¥»ªº BIOS¡A¦Ó¥B¤£¾A¦X§ó·s BIOS ªº¸Ü¡A¨º»ò¥H¤U§Ú­Ì·|¤¶²Ð¼È®É¸Ñªk¡A ±Ð§A¦p¦ó­×§ï FreeBSD ¤À³Î°Ï©Ò¨Ï¥Îªº ID ¡A¨Ã¦w¸Ë¬ÛÃö­×¸Éµ{¦¡¡C First, you will need to restore the machine to a state where it can get through its self-test screen. Doing this requires powering up the machine without letting it find a FreeBSD partition on its primary disk. One way is to remove the hard disk and temporarily move it to an older ThinkPad (such as a ThinkPad 600) or a desktop PC with an appropriate conversion cable. Once it is there, you can delete the FreeBSD partition and move the hard disk back. The ThinkPad should now be in a bootable state again. With the machine functional again, you can use the workaround procedure described here to get a working FreeBSD installation. ±q ¨Ó¤U¸ü boot1 ¤Î boot2 ³o¨â­ÓÀÉ¡C §â³o¨â­ÓÀɮשñ¦bºÏ¤ù¡B¥úºÐ©Î¨ä¥LµwºÐ¤W¡C ¥H¤@¯ë¦w¸Ë FreeBSD ¸Ë¨ì ThinkPad ¤W¡A°O±o ¡y¤£­n¥Î¡z Dangerously Dedicated ¼Ò¦¡¡C ¦¹¥~¡A¡y¤£­n¡z ¦b§¹¦¨¦w¸Ë¤§«á´N­«¶}¾÷¡C ¶i¤J shell¡G(«ö ALTF4) ¤Á´«¨ìEmergency Holographic Shell ©Î¬O¿ï³æ¤W­±¿ï¾Ü fixit shell¡C ¥Î &man.fdisk.8; §â FreeBSD ¤À³Î°Ï ID ¥Ñ 165 §ï¬° 166(OpenBSD©Ò¨Ï¥ÎªºID)¡C §â­è­è´£ªº boot1 ¸ò boot2 ³o¨â­ÓÀɮשñ¨ì¥Ø«eªºµwºÐÀɮרt²Î¤W¡C ¥H &man.disklabel.8; §â boot1 ¤Î boot2 ¦s¨ì§Aªº FreeBSD slice ¤W­±¡C &prompt.root; disklabel -B -b boot1 -s boot2 ad0sn ¡un¡v ¬O§A¸Ë FreeBSD ªº slice¡A ½Ð±N ¡un¡v §ï¬°²Å¦X§A¨t²Î²{ªpªº slice¡C ­«¶}¾÷¡A¦b boot prompt ·|¬Ý¨ì¦³ OpenBSD ªº¿ï¶µ¡A ¿ï¥¦¡A³o¼Ë´N·|¥H FreeBSD ¶}¾÷¡C ¥t¥~¡A¦Ü©ó¦p¦óÅý OpenBSD ¤Î FreeBSD ¨Ã¦s¦b¦P¤@¥x IBM ThinkPad ¤W... ³o­Ó°ÝÃD´N¥æµ¹¦U¦ì¬Ý­¾­Ì¥h¹Á¸Õ¤F :p ¦³Ãa­yªºµwºÐ¥i¥H®³¨Ó¸Ë FreeBSD ¹À¡H (¦pªG«Ü°í«ùªº¸Ü)¤]¬O¥i¥H¡A¤£¹L³o·QªkÅãµM¤£¤Ó©ú´¼¡C:( ¦pªG¦b¤@¯ë¸û·sªº IDE µwºÐ¤W¬Ý¨ì¦³Ãa­y¡A«Ü¦³¥i¯à¥Nªí¡G³oÁûµwºÐ§Y±N±¾ÂI¤F¡C (¦]¬°¥Ø«e©Ò¦³¸û·sªº IDE µwºÐ¡A¤º³¡³£¦³¦Û°Ê remapping Ãa­yªº¯à¤O¡C ¦pªG¬Ý¨ì¦³Ãa­y¡A«hªí¥Ü¥¦¤º³¡¦Û°Ê remapping ¥\¯à¥¢®Ä¡AµLªk³B²zÃa­y¡A ¤]´N¬O»¡³oÁûµwºÐ¤w¸g¬OÄY­«·lÃaµ{«×¤F¡C)§Ú­Ì«Øij¶RÁû·sµwºÐ¤ñ¸û°®¯Ü¨Ç­ò¡C ¦pªG¬O SCSI µwºÐ¦³Ãa­yªº¸Ü¡A½Ð¸ÕµÛ°Ñ¦Ò³o­Ó ¸Ñªk¡C ¥Î¦w¸ËºÏ¤ù¶}¾÷®É¡A«o¦³¨Ç©Ç²{¶Hµo¥Í¡I³o¬O¤°»ò±¡ªp©O¡H ­Y¬Ý¨ì¤@¨Ç©Ç²§²{¶H¡A¹³¬O¶}¾÷¤ù¶}¾÷¶}¨ì¤@¥b´N·í¤F¡AºÏºÐ¾÷§¹¥þ¨S¥ô¦ó°Ê§@¡B ©Î¬O¤£Â_¤ÏÂЭ«¶}¾÷¡A½Ð¥ýÀˬd¥H¤U´X­Ó½u¯Á¡G ½Ð½T©w¬O§_¬°¥þ·s¡B¨S¦³ºÏ­y¿ù»~ªººÏ¤ù¡H (³Ì¦n¨Ï¥Î·s¶Rªº¡A¦Ó«DÂø»x¡B®Ñ¥»ªþÃتº¡A¬Æ¦ÜÁÙ©ñ¦b§É©³¤U¤T¦~¤F...=_="") ½Ð½T©w¬O§_¦³¥Î binary(©Îimage)¶Ç¿é¼Ò¦¡¨Ó¤U¸ü image ÀÉ¡H (¤£¥Îı±o¤£¦n·N«ä¡A§Y¨Ï¬O§Ú­Ì¤]´¿·N¥~¥H ASCII ¶Ç¿é¼Ò¦¡¨Ó¤U¸ü binary ÀɮסI) ­Y§A¬O &windows; 95/98/ME/NT/2000/XP/2003 ¨Ó¤U¸ü¡B»s§@¶}¾÷ºÏ¤ùªº¸Ü¡A ½Ð½T©w¬O§_¦³¦b DOS ¼Ò¦¡¨Ï¥Î fdimage ©Î rawrite ³o¨â­Ó¤u¨ãµ{¦¡¡H­èÁ¿ªº³o¨Ç§@·~¨t²Î¡A ³£·|¼vÅTµ{¦¡¥hª½±µ¼g¤JµwÅé¡A¹³¬O»s§@¶}¾÷¤ù¤§Ãþªº°Ê§@¡C ¦³®É­Ô¡A¦b GUI ¤¶­±¤Wªº DOS shell ¤]¥i¯à·|µo¥Í³o¼Ëªº°ÝÃD¡C ¦¹¥~¡Aª½±µ³z¹L &netscape; ÂsÄý¾¹¤U¸ü image Àɪº¸Ü¡A¤]¦³Ãþ¦ü²{¶H¡C ©Ò¥H¡A¦pªG¥i¥Hªº¸Ü¡A½Ð§ï¥Î¨ä¥L¥i¥H½Õ¾ã³]©wªº FTP clientºÝµ{¦¡¨Ó¶i¦æ¤U¸ü¡C (·íµM¡A­n°O±o½Õ binary ¶Ç¿é¼Ò¦¡) ¥Î¥úºÐ¶}¾÷¤ù¨Ó¦w¸Ë¡A¦ý¥úºÐ¶}¾÷«á¡A¦w¸Ëµ{¦¡»¡§ä¤£¨ì¥úºÐ...³o¬O«ç»ò¤F¡H ³q±`°ÝÃD¦b©ó¥úºÐ¾÷³]©w¿ù»~¡C¥Ø«e«Ü¦h¹q¸£ªº¥X¼t¼Ð·Ç°t³Æ³£¦³¥úºÐ¾÷¡A¨Ã¥B ·|¹w¥ý³]©w¬° IDE ³q¹D¤W­± Secondary ªº Slave ³]³Æ¡A¦Ó Secondary ¤W­±ªº «o¨S¦³ Master ³]³Æ¡C¥H ATAPI ªº³W®æ¦Ó¨¥¡A³o¬O¿ù»~ªº³]©w¡AµM¦Ó &windows; ªº§@ªk ¬O¤£²z·|³o¨Ç³W®æ¤Wªº³]©w°ÝÃD¡A¦Ó¥B¶}¾÷®É BIOS °»´ú¤]·|²¤¹L³oÂI¡C ³o¤]´N¬O¬°¤°»ò BIOS ¥i¥H¬Ý¨ì¥úºÐ¡A¨Ã¥B¥i¥Î¥úºÐ¶}¾÷¡A¦ý FreeBSD µLªk¥¿±`§ì¨ì¥úºÐ¥H¶¶§Q¶i¦æ¦w¸Ë¡C ¸Ñªk¡G­«·s³]©w¨t²Î¡AÅý¥úºÐ¦¨¬°¥¦©Ò³s±µ¨º±ø IDE ³q¹Dªº Master¡A ©ÎªÌ¥u¦³¤@±ø IDE ³q¹Dªº¸Ü¡A¨º´NÅý¥úºÐ¾÷¦¨¬° Slave ¡A·íµM¸Ó IDE ³q¹D¤W¦Ü¤Ö­n¦³ Master ³]³Æ¡C §Ú¥i¥H¥Î PLIP(Parallel Line IP)¤è¦¡¨Ó¦w¸Ë FreeBSD ¨ìµ§°O«¬¹q¸£¤W¶Ü¡H ¥i¥H¡A¥Î¤@±ø´¶³qªº Laplink ½u´N¥i¥HÅo¡C­Y¦³³o¤è­±»Ý¨Dªº¸Ü¡A½Ð°Ñ¾\ FreeBSD ¨Ï¥Î¤â¥U¤¤ªº PLIP ³¹¸` ªº²Ó³¡³]©w ¸Ó¥Î­þ¤@ºØµwºÐ³]©w°Ñ¼Æ(geometry)©O¡H ³o¸Ìªº¡yµwºÐ³]©w°Ñ¼Æ(geometry)¡z¡A«üªº¬OµwºÐ¤Wªº ¡ucylinders¡v¡B¡uheads¡v¡B¡usectors/track¡v ³o¤T­Ó³]©w°Ñ¼Æ¡C ±µ¤U¨Óªº¤å³¹¤º¡A¬°¤F¤è«K¤¶²Ð¡A±N²ºÙ¬°¡yC/H/S¡z¡C ³o¨Ç³]©w°Ñ¼Æ¬OÅý PC ¤Wªº BIOS ¯à¶¶§Q¦a¥¿±`§P§OµwºÐ¡A »PµwºÐ¥»¨­Åª¼gªº­«­n¦]¯À¡C ¹ï­è±µ¤âªº¨t²ÎºÞ²zªÌ·s¤â¦Ó¨¥¡A³o¨Ç³]©w°Ñ¼Æ±`³y¦¨¤@¨Ç§xÂZ¡C ­º¥ý¡ASCSI µwºÐ¤Wªº physical geometry ¸ò FreeBSD ¤Wªº disk blocks ¬O§¹¥þµLÃöªº¡C¨Æ¹ê¤W¡A ´NµwºÐ¤WºÏ°Ï±K«×ªºÅܤƦӨ¥¡A¨Ã¨S¦³©Ò¿×¡yphysical geometry¡z³oºØªF¦è¡C µwºÐ»s³y°Ó©Ò»¡ªº¡yphysical geometry¡z³q±`¬O«ü¡G µwºÐ¤W©Ò¨Ï¥Î³Ì¤pªÅ¶¡¨Ó¦s©ñ¸ê®Æªº³]©w°Ñ¼Æ(geometry)¡C ¥H IDE µwºÐ¦Ó¨¥¡AFreeBSD ¥Î¥H¦s¨úµwºÐ³]©wªº¤è¦¡¬O C/H/S ¡A µM¦Ó¡A¥Ø«e¥«­±¤WªºµwºÐ¦­´N¦b¤º³¡¹B§@®É¡A´N¦Û°ÊÂà´«¬° block ¤è¦¡ ¤F¡C ¯u¥¿ÃöÁ䪺¦a¤è¡A¨ä¹ê¬O¦b©ó ¡ylogical geometry¡z¡X ³o¬O BIOS °»´úµwºÐ®É©Ò±o¨ìªº³]©w¡A¨Ã¥B¥Î¨Ó¨M©wµwºÐ¦s¨ú¤è¦¡¡C ¥Ñ©ó FreeBSD ¬O±Ä¥Î BIOS ªº°»´ú³]©w­È¡A©Ò¥H¦p¦ó¨ÓÅý BIOS °»´ú¨ìªº³]©w­È«O«ù¥¿½T¡A ¬O¤Q¤À­«­n¡C¤×¨ä¬O¦P¤@ÁûµwºÐ¤W¦³¦h­Ó§@·~¨t²Îªº±¡ªp¡A ¥¦­Ì³£¥²¶·±Ä¥Î¤@­PªºµwºÐ³]©w°Ñ¼Æ(geometry)¡A §_«h´N·|¦³¶}¾÷¶i¤£¥h§@·~¨t²ÎªºÄY­«°ÝÃD¤F¡C ¥H SCSI µwºÐ¦Ó¨¥¡AµwºÐ³]©w°Ñ¼Æ(geometry)¬O¥Ñ SCSI ¥d¤Wªº extended translation(³q±`«üªº¬O¦³¼Ð¥Ü support >1GB(¤ä´© 1GB ¥H¤W®e¶q¡A©ÎÃþ¦ü¦Wµü) ¤ä´©»P§_¨Ó§@¨M©w¡C ¦pªG¤£¤ä´©¡A¨º»ò´N·|±Ä¥Î N cylinders¡B 64 heads¡B 32 sectors/track §@¬°µwºÐ³]©w°Ñ¼Æ(geometry)¡A³o¸ÌÁ¿ªº¡yN¡z ¬O«üµwºÐªº®e¶q(³æ¦ì¡GMB)¡CÁ|­Ó¨Ò¤l¨Ó»¡¡A¤@Áû 2GB µwºÐÀ³¸Ó¬O 2048 cylinders¡B64 heads¡B32 sectors/track¡C ¦pªG¸Ó SCSI ¦³¤ä´©¨Ï¥Î extended translation ªº¸Ü¡A (³q±`³o­Ó¤è¦¡¦b &ms-dos; ¨Ï¥Î¤W¦³¬Y¨Ç­­¨î)¡A¨Ã¥BµwºÐ®e¶q¤j©ó 1GB¡A ¨º»òµwºÐ³]©w°Ñ¼Æ(geometry)´N·|¨Ï¥Î¹³¬O¡G M cylinders¡B255 heads¡B¨CºÏ­y 63 sectors(½Ðª`·N¡G¤£¬O¡y64¡z®@)¡A ³o¸ÌÁ¿ªº¡yM¡z¬O«üµwºÐªº®e¶q(³æ¦ì¡GMB)¦A°£¥H 7.844238 ©Ò±o¥Xªº¼Æ­È³á¡I©Ò¥H¡A³o­Ó¨Ò¤lªº¸Ü¡A¦P¼Ë¬O 2GB µwºÐÀ³¸Ó¬O 261 cylinders¡B255 heads¡B¨CºÏ­y 63 sectors¡C ­Y¹ï¤W­±Á¿ªº¤£ÁA¸Ñ¡A©Î¬O FreeBSD ¦b¦w¸Ë®É©Ò°»´ú¨ìªºµwºÐ³]©w°Ñ¼Æ(geometry) ¦³°ÝÃDªº¸Ü¡A³Ì²³æªº¸Ñªk³q±`¬O¦bµwºÐ¤W«Ø¥ß¤@¶ô¤p¤pªº DOS ¤À³Î°Ï(partition)¡C ³o¼Ë¤@¨Ó¡A´N¥i¥H°»´ú¨ì¥¿½TªºµwºÐ³]©w°Ñ¼Æ¤F¡A¦Ó¥B¡A ¦pªG¤£·QÄ~Äò¯dµÛ¨º¤p¶ô DOS ¤À³Î°Ïªº¸Ü¡A¥i¥HÀH®É¥Î partition editor ¨Ó®³±¼¥¦¡C©ÎªÌ§â¥¦¯dµÛ·í§@ºô¸ô¥dÅX°Êµ{¦¡¨Ï¥Î¡A©ÎÀH§A°ª¿³«ç»ò¥Î¥¦¡C ¦¹¥~©O¡A¦³­Ó§K¶O¦n¥Îªº¤u¨ãµ{¦¡¥s°µ¡ypfdisk.exe¡z¡A ³o­Óµ{¦¡©ñ¦b¦U FreeBSD FTP ¯¸©Î¥úºÐªº tools ¥Ø¿ý¤U¡A ¥¦¥i¥H¥Î¨Ó§ä¥XµwºÐ¤W¨ä¥L§@·~¨t²Î©Ò¨Ï¥ÎªºµwºÐ³]©w°Ñ¼Æ¡A µM«á´N¥i¥H¦b partition editor ¤º¿é¤J­è­è§ä¨ìªº¨º¨Ç³]©w°Ñ¼Æ´N¥i¥H¤F¡C ¤À³ÎºÏºÐ¾÷®É¦³¥ô¦ó­­¨î¶Ü¡S ¦³¡A§A¥²¶·½T»{§Aªº root ¤À³Î°Ï¬O¦b 1024 cylinders ¤§¤º¡AÅý BIOS ¥i¥H±q¨ä¤¤±Ò°Ê®Ö¤ß¡C(ª`·N¡G³o¬O PC ªº BIOS ¥\¯à­­¨î¡A¦Ó¤£ ¬O FreeBSD ªº) ¥H SCSI µwºÐ¦Ó¨¥¡A³q±`¬O§â root (/) ¤À³Î°Ï©ñ¨ìµwºÐ³Ì«e­±ªº 1024MB (¦pªG¦³¤ä´© extended translation ªº¸Ü¡A ¨º»ò¬O³Ì«e­±ªº 4096MB ¡X ³oÂI½Ð°Ñ¦Ò¤W¤@¤p¸`)¡C¦Ó IDE µwºÐªº¸Ü¡A¬Û¹ïÀ³ªº«h¬O 504MB¡C ¥i¥H¨Ï¥Î­þ¨ÇºÏºÐºÞ²zµ{¦¡(disk managers)©O¡H FreeBSD ¥i¥H¥Î Ontrack Disk Manager ¨Ã¥B¹B§@¥¿±`¡A ¦Ü©ó¨ä¥Lªº disk manager «h¤£¦b¥¿¦¡¤ä´©¤§¦C¡C ­Y¾ãÁûµwºÐ¥u¸Ë FreeBSD ¡A¨º»ò´N¤£¥Î¦A¸Ë disk manager ¤F¡C ¥u­n§âµwºÐ³]©w¬° BIOS ©Ò¯à§ì¨ìªº³Ì¤jªÅ¶¡¡A¨º»ò FreeBSD ´N¥iºâ¥X¹ê»Ú¤W¥i¨Ï¥ÎªºªÅ¶¡¤F¡C ¦pªG¡A¥¿¦b¨Ï¥Îªº¬O¥j¦­ MFM ±±¨î¥dªºÂ¦¡µwºÐ¡A ¨º»ò´N»Ý­n¦b FreeBSD¤º§@ cylinders ¬ÛÃö³]©w¤F¡C ¦pªG·Q¦bºÏºÐ¤W¨Ï¥Î FreeBSD ©M¥t¥~ªº§@·~¨t²Î¡A¤]¥i¥H¤£¸Ë disk manager¡A ¥u­n½T©w FreeBSD ªº±Ò°Ê¤À³Î°Ï¸ò¨ä¥L§@·~¨t²Îªº slice ³£¦ì©ó¶}©lªº 1024 cylinders ¤º´N¥i¥H¤F¡C¦pªG§A¬Û·í¦a°ª©úªº¸Ü¡A¤@­Ó 20MB ªº±Ò°Ê¤À³Î°ÏÀ³¸Ó´N°÷¥Î¤F¡C FreeBSD ¦w¸Ë§¹²¦«á­«¶}¾÷¡A¦ý¬O¹q¸£«o»¡ Missing Operating System³o¬O«ç»ò¤F¡H ³q±`­ì¦]¥X¦b FreeBSD ¤Î DOS ©Î¨ä¥L§@·~¨t²Î¦bµwºÐªº ³]©w°Ñ¼Æ(geometry)¤Wªº³W¹º¦³¬Û½Ä¡C¸Ñªk¬O­«¸Ë¡A¦ý¬O½Ð·Ó ¤W­zªº¬ÛÃö³¹¸`¨BÆJ¨Ó°µ¡C ¬°¤°»ò¾÷¾¹¤W¦h­«¶}¾÷ºÞ²z­û(boot manager)¥X²{¤F F? ³o­Ó¿ï³æµe­±¡A ¦ý«o¤£·|¦Û°Ê¸õ¹L¦ÓÄ~Äò¶}¾÷©O¡H ³o­Ó¯gª¬¬O¥»¤å¤W­±©Ò´£ªº¥t¥~¤@­Ó°ÝÃD¤F¡A­ì¦]¦b©ó BIOS ¤W¸ò FreeBSD ¤W­±¨âÃ䪺µwºÐªº ³]©w°Ñ¼Æ(geometry) ¨Ã¤£¤@­P¡C ­Y§AµwºÐ©Î BIOS ¤ä´© cylinder translation (³q±`·|³Q¼Ð¬° support >1GB(¤ä´© 1 GB¥H¤W®e¶q)ªº¸Ü¡A ¸Õ¸Õ¬Ý§ó§ï¬ÛÃö³]©w¡A¨Ã­«¸Ë FreeBSD¡C ¦w¸Ë FreeBSD ®É¡A»Ý­n¦w¸Ë§¹¾ãªº sources ¶Ü¡H ¤@¯ë¨Ó»¡¡A³o¬O¥Î¤£µÛªº¡CµM¦Ó¡A§Ú­Ì±j¯P«Øij±zªº source ¦Ü¤Ö­n¸Ë base(¥]§t¤F¥»¤å¤¤©Ò´£ªº¤@¨ÇÀÉ®×)¡B¥H¤Î sys (kernel ªº source ÀÉ)¡C ÁöµM¡A§@·~¨t²Î¥»¨­¹B¬O¤£»Ý­n¸Ë source ÀÉ¡A¦ý¬O &man.config.8; ³o­Ó kernel³]©wµ{¦¡«h»Ý­n src ¡C ­Y¨S¸Ë kernel ªº source ÀÉ¡A¤´µM¥i¥H¥Î¨ä¥L¦a¤è³z¹L NFS ±¾¸üªº°ßŪÀɮרt²Î¡A ¨Ó½sĶµ{¦¡¡C ¦ý¥Ñ©ó kernel-source ¥»¨­ªº­­¨î¡A§Ú­Ì«Øij¤£­nª½±µ mount ¦b /usr/src¡A ³Ì¦n¬O¥Î symbolic link(°Ñ¾\ &man.ln.1;) ±N±¾¸üªº¸ô®|¡A³]©w³sµ²¨ì/usr/src ¥Ø¿ý¡C ¦b¾÷¾¹¤Wª½±µ¸Ë¦³ source ¨Ã¥BÁA¸Ñ¬ÛÃö½sĶ¹Lµ{¡A³o¼Ë¤l¤é«á¤É¯Å FreeBSD ·|¨Ó±o¤è«K¦h¡C ­Y§Ñ¤F¸Ë¬ÛÃö source ªº¸Ü¡A¥i¥H¨Æ«á¥Î sysinstalll - (&os; 6.X ¤§«e¬° /stand/sysinstall) ¨Ó¸É¸Ë¡A¿ï³æ¡GConfigure ¡÷ Distributions ¡÷ src¡C + (&os; 5.2 ¤§«eª©¥»«h¬O /stand/sysinstall) ¨Ó¸É¸Ë¡A¿ï³æ¡GConfigure ¡÷ Distributions ¡÷ src¡C »Ý­n­«·s build kernel ¶Ü¡H ¦b«Ü¤[«Ü¤[¥H«e¡A­ì¥»­«·s build kernel ¦b FreeBSD ¦w¸Ë¹Lµ{¤¤¡A ¬Oµ´¹ï¥²»Ýªº¨BÆJ¤§¤@¡C¦ý¥Ø«e¦­´N¤£¥Î³o»ò³Â·Ð¤F¡A ¥Ø«e¥D­n±`¨£ªºª©¥»³£¨Ï¥Î§ó¤Íµ½ªº kernel ³]©w«ü¥O¡C &os; 4.X(§t¤§«eª©¥»)¡A¦b FreeBSD ±Ò°Ê´£¥Ü¸¹(boot:)®É¡A¨Ï¥Î flag ´N·|¶i¤J³]©wµe­±¡A¨Ó¹ï kernel §@±`¨£ªº ISA ¥d²Ó¸`³]©w¡C ¦Ó &os; 5.X(§t¤§«áª©¥»)ªº¸Ü¡A«h¬O¥H§ó¨ã¼u©Êªº "hints" ³]©w¤è¦¡¡C ¦pªG·Q§ó¸`¬Ù RAM ªº¨Ï¥Î¡BÁYµu¶}¾÷¬yµ{¡A¨º»ò«Øij¡G·sªº kernel ³]©wÀÉ¥u­n¥]§t§A»Ý­nªºÅX°Êµ{¦¡¡A µM«á­«·s½sĶ¡B¦w¸Ë kernel ¨Ã­«¶}¾÷¡CµM¦Ó©O¡A³oÂI¹ï¤j¦h¼Æªº¨t²Î¨Ó»¡¡A ³o¤£¤@©w¬O¥²­nªº¡C ±K½X½s½X¸Ó±Ä¥Î DES¡BBlowfish ©Î MD5 ªº­þ¤@ºØ¡H¸Ó«ç»ò³]©w©O¡H FreeBSD ¹w³]ªº±K½X½s½X¤è¦¡¬O±Ä MD5¡C ´N±K½X½s½X¤è¦¡¦Ó¨¥¡AMD5 ¤è¦¡¤@¯ë³Qµø¬°¤ñ¶Ç²Î &unix; ªº DES ¤è¦¡¸û¬°¦w¥þ¡C µM¦Ó¡A­Y¦³»Ý­n¦b¨Ï¥ÎÂÂÀô¹Ò(¸û¤£¦w¥þªº±K½X½s½X¤è¦¡ªº)¡ADES ±K½X½s½X¤è¦¡¤@¼Ë¥i¥H¨Ï¥Î¡C (­Y¨Ï¥Î sysinstall ®É¦³¿ï¾Ü crypto ®M¥ó¡A©Î¬O±q source ¤º½sĶ¦w¸Ë) ¦³¸Ë crypto ªº¸Ü¡Acrypto libraries ¤]¤ä´©§ó¦w¥þªº Blowfish ½s½X¤è¦¡¡C ±K½X½s½Xªº¤è¦¡¬O¥Ñ /etc/login.conf ¤ºªº passwd_format Äæ¦ì¨Ó¨M©wªº¡C¸ÓÄæ³]©w­È¡A(­Y¦³¸Ë crypto ªº¸Ü)¥i¥H¬O des ©Î blf ©Î¬O­ì¥»ªº md5¡C ¸Ô±¡½Ð°Ñ¾\ &man.login.conf.5; »¡©ú¡C ¬°¤°»ò¶}¾÷ºÏ¤ù¶}¨ì¤@¥b¡A´N¥X²{ Probing Devices... ªºµe­±°T®§¡AµM«á´N°±¦í¤F¡H ­Y¾÷¾¹¤W¦³¸Ë IDE ¤¶­±ªº Iomega &iomegazip; ©Î¬O &jaz; ªº¸Ü¡A ¦]¬°³o¨Ç³]³Æ¥i¯à¸ò¶}¾÷¤ù¦³¬Û½Ä¡A½Ð¥ý®³±¼³o¨Ç³]³Æ¦A­«¸Õ¡C ·í¾ã­Ó§@·~¨t²Î¸Ë¦n«á¡A´N¥i¥H§â³o¨Ç³]³Æ±µ¦^¥h¨Ï¥Î¤F¡C §Æ±æ³oÂI¦b¤é«á release ªº FreeBSD ¥i¥HÀò±o¹ý©³¸Ñ¨M¡C ¨t²Î¸Ë§¹¨Ã­«¶}¾÷«á¡A¬°¤°»ò«o¥X²{ panic: can't mount root¡H ³o­Ó¿ù»~¬O¦]¬°±Ò°ÊºÏ°Ï¸ò kernel ¨âªÌ¹ïºÏºÐ¸Ë¸mªº»{ª¾¤£¬Û¦P¡C ³q±`³o°ÝÃD·|µo¥Í¦b¦³¨âÁû IDE µwºÐªº¨t²Î¡A¤ñ¦p¡GµwºÐ Jumper ³]©w¬° Master¡B ©Î¬O¨â±ø IDE ±Æ½u¦U¥u³s±µ¤@ÁûµwºÐ¡A¦ý¬O¸Ë FreeBSD ¨ºÁû¶}¾÷µwºÐ¡A «o±µ¦b Secondary IDE ±Æ½u¤W¡C ¦p¦¹¤@¨Ó¡A¦b¶}¾÷®É·í kernel «ü©w²Ä¤G­Ó IDE ±±¨î¾¹ªº²Ä¤@­ÓºÏºÐ¾÷ ad2¡A ±Ò°ÊºÏ°Ï«o»{¬°¨t²Î¬O¸Ë¦b ad0(BIOS°»´úªº²Ä¤GÁûµwºÐ)¡I °»´ú§¹¸Ë¸m«á¡Akernel ¸ÕµÛ§â±Ò°ÊºÏ°Ï©Ò»{¬°ªº¶}¾÷µwºÐ(ad0) mount °_¨Ó¡A¨Æ¹ê¤WÀ³¸Ó¬O ad2 ¤~¹ï¡A©Ò¥H´N·|¥X²{¤W­±ªº¿ù»~°T®§¤F¡C ¸Ñªk¦p¤U¡A½Ð¿ï¾Ü¨ä¤¤¤@ºØ¤è¦¡´N¦n¡G ­«¶}¾÷¨Ã¦b¥X²{¡yBooting kernel in 10 seconds; hit [Enter] to interrupt¡z ´£¥Üªº®É­Ô¡A«ö¤U EnterÁä¡C ³o¼Ë¤l´N·|¶i¤J boot loader µe­±¡G ½Ð¿é¤J set root_disk_unit="disk_number" ³o¸Ìªº¡ydisk_number¡z½Ð¨Ì¾Ú±¡ªp´«¦¨¬ÛÃö¥N¸¹¡G ­Y FreeBSD µwºÐ¬O³]©w¸Ë¦b Primary IDE ±µ½uªº Master¡A´N³]¬° 0 ¡F ­Y¬O Primary IDE ±µ½uªº Slave¡A´N³]¬° 1¡F ­Y¬O Secondary IDE ±µ½uªº Master¡A´N³]¬° 2¡F ­Y¬O Secondary IDE ±µ½uªº Slave¡A´N³]¬° 3¡C ±µµÛ½Ð¦A¿é¤J boot¡AµM«á¨t²ÎÀ³¸Ó´N¥i¥H¥¿±`¶}¾÷¤F¡C ­Y­n¨C¦¸¶}¾÷³£¦Û°Ê³]©w¡A¦Ó¤£¥²¨C¦¸³£¥´¤@¦¸¡A¨º»ò´N¦b /boot/loader.conf.local Àɮפº¥[¤W root_disk_unit="disk_number" ³o¦æ (·íµM¡A¡ydisk_number¡z­n§ï¦¨¬ÛÃö¥N¸¹) §â FreeBSD µwºÐ§ï±µ¨ì Primary IDE ±µ½u¤W¡A¦p¦¹¤@¨Ó´N¥i¶¶§Q¨Ï¥Î¡C °O¾ÐÅé³Ì¤j­­¨î¬°¦h¤Ö¡H ¤@¯ë &i386; ¾÷¾¹¤W³Ì¦h¥i¤ä´©¨ì 4 GB(gigabytes)¡C ¦Ó¦Û &os; 4.9 ¤Î 5.1 ¥i¥H¶}©l¨Ï¥Î &man.pae.4; ¨Ó¤ä´©§ó¦hªº°O¾ÐÅé¡C ¦³Ãö³oÂI¡A»Ý­n¦b kernel ³]©wÀɤº¥[¤J¤U¦C¤º®e¨Ã­«·s½sĶ kernel¡A¤~¯à¨Ï¥Î PAE¡C options PAE &os; ¦b pc98 ¾÷¾¹¤W³Ì¦h«h¥u¤ä´© 4 GB ¡A¦Ó¥B¤£¯à¨Ï¥Î PAE¡C ¦b Alpha ¾÷¾¹¤W¡A°O¾ÐÅé­­¨î¤è­±­nµø©Ò¨Ï¥Îªº«¬¸¹¤ä´©µ{«×¦Ó©w¡A³oÂI½Ð°Ñ¾\ ©Ò¨Ï¥Îªº Alpha µwÅé³W®æªí¡C¦Ü©ó¨ä¥L¬[ºcªº &os; ²z½×¤W³Ì¦h¥i¨Ï¥Îªº°O¾ÐÅé¡A¦³¸û¦hªº­­¨î¡C Àɮרt²Î³Ì¤j­­¨î¬°¦h¤Ö¡H ´NÀɮרt²Î¤è­±¡A²z½×¤Wªº­­¨î¬O³Ì¦h¨ì 8TB(2G blocks)¡A ©Î¬O¨Ï¥Î¤º©w 8K block ¤j¤p®É¡A­­¨î¬O 16TB¡C ¹ê»Ú¤W¡A¥Ø«e³nÅé¨Ï¥Î¤W­­¨î¥u¯à¥Î¨ì 1 TB¡A µM¦Ó¦pªG¬O¦³¥t¦æ§ï³y¹LÀɮרt²Î¡A¨º»ò¹F¨ì 4TB ªº¥Ø¼Ð¬O¥i¦æªº (¤]¦³¤H¦¨¥\¹L)¡C ³æ¤@Àɮתº¤j¤p¤è­±¡A°²¦p block ¥H 4K §@³W¹ºªº¸Ü¡A «h³Ì¤j¬OÁͪñ 1G blocks(4TB)¡C Àɮפj¤pªº³Ì¤j­­¨î Àɮרt²Î block ¤j¤p works should work 4K 4T-1 >4T 8K >32G 32T-1 16K >128G 32T-1 32K >512G 64T-1 64K >2048G 128T-1
When the fs block size is 4K, triple indirect blocks work and everything should be limited by the maximum fs block number that can be represented using triple indirect blocks (approx. 1K^3 + 1K^2 + 1K), but everything is limited by a (wrong) limit of 1G-1 on fs block numbers. The limit on fs block numbers should be 2G-1. There are some bugs for fs block numbers near 2G-1, but such block numbers are unreachable when the fs block size is 4K. block ¤j¤p¦pªG¬O 8K ©Î§ó¤j¡AÀɮרt²Î block ¼Æ¥Ø·|³Q­­¨î¦b 2G-1 ¡A¦ý¹ê»Ú¤WÀ³¸Ó»¡­­¨î¬O 1G-1 ¤~¹ï¡A¦]¬°±Ä¥Î 2G-1 block ªºÀɮרt²Î·|¾É­P¤@¨Ç°ÝÃD¡C
¬°¦ó¦b±Ò°Ê·sªº kernel ®É¡A¬Ý¨ì archsw.readin.failed ¿ù»~°T®§¡H ­ì¦]¥X¦b§Aªº world ¥H¤Î kernel ¨Ã¤£¦P¨B¡AÁ|¨Ò¡Gkernel ¥Î 4.11¡A ¦Ó world «o¬O 4.8¡A³o¼Ë¬O·|¦³°ÝÃDªº¡C ½Ð¦A¦¸½T»{¡A¬O§_¦³¥H make buildworld ¤Î make buildkernel ¨Ó¥¿±`§ó·s kernel¡C ¦b±Ò°Ê loader ¤§«e¡A·|¬Ý¨ì "|" ³o­Ó²Å¸¹¦bÂà°Ê¡A³o®É¥i¥H«ö¥ô¦óÁ䤤Â_¡A µM«á¦A«ü©w­n¸ü¤J­þ­Ó kernel ¨Ó¶}¾÷¡C security profiles ¬O«ü¤°»ò¡H A security profile is a set of configuration options that attempts to achieve the desired ratio of security to convenience by enabling and disabling certain programs and other settings. For full details, see the Security Profile section of the Handbook's post-install chapter. ¦b¶}¾÷®É¡A¿ï¾Ü¨Ï¥Î ACPI «h¦b¦w¸Ë¹Lµ{´N±¾¤F¡A¸Ó«ç»ò¿ì¡H ¸Õ¸Õ¬ÝÃö³¬ ACPI support¡C ·í¦b¸ü¤J bootloader®É¡A«ö¤UªÅ¥ÕÁä¡C ¨t²Î·|Åã¥Ü OK ³o®É¿é¤J unset acpi_load ±µµÛ¥´ boot ¥HÄ~Äò¶}¾÷¡A³o¼Ë¤lÀ³¸Ó´N¥i¥H¤F¡C
µwÅé¤ä´©¤è­± ¤@¯ë°ÝÃD §Ú·Q²Õ¸Ë¦Û¤vªº FreeBSD ¾÷¾¹¡A¦³­þ¨Ç«¬¸¹¡B«~µP¡B³W®æ¬O¤ä´©µ{«×³Ì¦nªº©O¡H ¦³Ãö³oÂI¡A¦b FreeBSD °Q½×°Ï¤W®É±`¦³¤H°Q½×¡CÁöµMµwÅé¨O´«³t«×«Ü§Ö¡A ¥i¯àÀH®É¦³·s³W®æ¡B·s²£«~¥X²{¡AµM¦Ó³o¨Ç³£¦b§Ú­Ì·N®Æ¤§¤¤¡A §Ú­Ì ¤´µM ±j¯P«Øij¡G¦b¸ß°Ý¦³Ãö³Ì·s³W®æµwÅ骺¤ä´©°ÝÃD¤§«e¡A ½Ð¥ý°Ñ¾\ &os &rel.current; ©Î &rel2.current;ªº¤ä´©µwÅé¦Cªí¡A ©Î¬O·j´M°Q½×°ÏªºÂ¤峹¡A ¤]³\¡A¤W¶g¤~­è«ê¥©¦³¤H°Q½×¹L§A©Ò­n°ÝªºµwÅé¡C ¦pªG­n§ä¦³Ãöµ§°O«¬¹q¸£¤è­±¡A½Ð¨ì FreeBSD-mobile µ§°O«¬¹q¸£°Q½×°Ï¡C ¤£µM¡A´N¨ì FreeBSD-questions °Q½×°Ï¡A©Î¬O¯S©wµwÅé³W®æ(¤ñ¦p pc98, Alpha)ªº±MÄÝ°Q½×°Ï§a¡C µwÅé¬[ºc¤Î CPU FreeBSD ¦³¤ä´© x86 ¤§¥~ªºµwÅé¬[ºc¥­¥x¶Ü¡H ¦³ªº¡AFreeBSD ¥Ø«e¥i¥H¦b Intel x86 and DEC (²{¦bªº HP-Compaq) Alpha ¬[ºc¤W­±¹B§@¡C¦Û FreeBSD 5.0 ¤§«áªºª©¥»¡A«h ¥i¤ä´© AMD64 ¤Î Intel EM64T, IA-64 ¥H¤Î &sparc64; ¬[ºc¡C ¥¼¨Ó¥­¥x¤ä´©¤WÁÙ·|¦³ &mips; ¤Î &powerpc;¡A²Ó¸`½Ð¤À§O°Ñ¾\ &a.mips; ©Î &a.ppc;¡C ¤@¯ë¦Ó¨¥¡A·sªºµwÅé¬[ºc¥­¥x¤è­±¡A³£¬O¨ì &a.platforms; °Q½×¡C ­Y§A¾÷¾¹¤£¬O¥H¤W¬[ºc©Î¬O¤ñ¸û©_¯Sªº¡A¦Ó·Q¥ß¨è¸Õ¸Õ¬Ý BSD ªºÅ]¤O¡A §Ú­Ì«Øij§A¥i¥H¦Ò¼{¨Ï¥Î NetBSD ©Î OpenBSD¡C FreeBSD ¤ä´© CPU ¹ïºÙ¦h¤u³B²z(SMP, Symmetric Multiprocessing)¶Ü¡H ¦³ªº¡C SMP ¦b &os; 5.2 ¹w³]ªº kernel(GENERIC)¤w¦³±Ò°Ê¡C ¦b &os; 5.3 ­n release ®É¡ASMP¬ÛÃö³]©w¤]¬O¹w³]´N¦³±Ò°Ê¡C µM¦Ó¡A¦b¤@¨Ç¸û·s«¬ªº¾÷¾¹(¹³¬O emt64)¤W«o¤S¦³¨Ç°ÝÃD¡A ©Ò¥HÁÙ¬O¨M©w¦b¬ÛÃö°ÝÃD¡B¦w¥þijÃD¥¼Àò¸Ñ¨M«e¡A¥ýÃö³¬ SMP ªº¬ÛÃö±Ò°Ê¡C ³oÂI¡A¥¿¬O &os; 5.4 ©ÒÀu¥ý¦Ò¼{ªº¤è¦V¡C &os; 4.X ªº¸Ü¡A¹w³]ªº kernel ¨Ã¨S¦³±Ò°Ê SMP¡A ¦]¦¹¡A¥²¶·­n§â options SMP ¥[¤J kernel ³]©wÀɨí«·s½sĶ¤~¯à±Ò°Ê¡C ¦Ü©óÁÙ¦³­þ¨Ç¬ÛÃö³]©w­n©ñ¤J kernel ³]©wÀÉ¡A½Ð°Ñ¾\/sys/i386/conf/LINT¡C µwºÐ¡BºÏ±a¾÷¥H¤Î¥úºÐ¡BDVD¡B¿N¿ý¾÷ FreeBSD ¥i¤ä´©­þ¨ÇºØÃþªºµwºÐ©O¡H FreeBSD ³£¤ä´© EIDE ¤Î SCSI ¤¶­±ªºµwºÐ(¥H¤Î SCSI ¥d¡A½Ð¬Ý¤U¤@¸`»¡©ú) ¥H¤Î Western Digital ¤¶­±ªºµwºÐ (MFM¡B RLL¡B ESDI¡A·íµM¥]§t IDE)¡A¤£¹L¦³¤@¨Ç¤Ö¼Æªº ESDI ´¹¤ù²Õªº(«¬¸¹¡GWD1002/3/6/7) ¥i¯àµLªk¥¿±`¹B§@¡C ¤ä´©­þ¨Ç SCSI ¥d¡B³]³Æ©O¡H ½Ð°Ñ¾\ &os; ªºµwÅé¤ä´©ªí( &rel.current; ©Î &rel2.current;) ¤ä´©­þ¨ÇºÏ±a¾÷©O¡H FreeBSD ¤ä´© SCSI ¤Î QIC-36 (QIC-02 ¤¶­±) ³W®æªººÏ±a¾÷¡C ¦P®É¥]§t¤F 8-mm (¤]´N¬O Exabyte) ¤Î DAT ºÏ±a¾÷¡C ¦³¨Ç¦­´Áª©¥»ªº 8-mm ºÏ±a¾÷¨Ã¤£¬O§¹¥þ¬Û®e©ó SCSI-2 ³W®æ¡A ©Ò¥H¥i¯à¦b FreeBSD ¤Wªí²{¤£¬O«Ü¦n¡C FreeBSD ¤ä´©ºÏ±a¦Û°Ê´«±a¾÷¶Ü¡H FreeBSD ¥i¥H¥Î &man.ch.4; ¤W­±©Ò¦Cªº¾÷ºØ¡A·f°t &man.chio.1; «ü¥O¡A ¨Ó¨Ï¥Î SCSI ºØÃþªº¦Û°Ê´«±a¾÷¡A²Ó¸`³¡¤À½Ð°Ñ¾\ &man.chio.1; »¡©ú¡C If you are not using AMANDA or some other product that already understands changers, remember that they only know how to move a tape from one point to another, so you need to keep track of which slot a tape is in, and which slot the tape currently in the drive needs to go back to. FreeBSD ¥i¤ä´©­þ¨ÇºØÃþªº¥úºÐ¾÷©O¡H ¥u­n¬O¦³¤ä´©ªº SCSI ¥d¤W©Ò±µªº¥ô¤@ SCSI ¥úºÐ¾÷³£¦³¤ä´©¡C ¦¹¥~¡A¤]¤ä´©¤U¦Cªº¥úºÐ¾÷¡G Mitsumi LU002 (8bit), LU005 (16bit) ¤Î FX001D (16bit 2x Speed) Sony CDU 31/33A Sound Blaster «D SCSI ¤¶­±ªº¥úºÐ¾÷ Matsushita/Panasonic ¥úºÐ¾÷ ¬Û®e ATAPI ³W®æªº IDE CDROMs ¬Û¹ï©ó SCSI ¾÷ºØ¦Ó¨¥¡A¨ä¥L«D SCSI ªº¥úºÐ¾÷³£¬O¤ñ¸ûºC¡A ¦¹¥~¡A¦³¨Ç ATAPI ºØÃþªº¥úºÐ¾÷¥i¯àµLªk¶¶§Q¹B§@ Daemon News ¥H¤Î FreeBSD Mall ©Òµo¦æªº¥¿¦¡ FreeBSD ¥úºÐ¥H¤Î¿N¿ý¥Îªº¼v¹³ÀÉ(ISO)¡A ³£¥i¥Hª½±µ¥Î©ó¶}¾÷¥úºÐ¨Ï¥Î¡C FreeBSD ¤ä´©­þ¨Ç¥úºÐ¿N¿ý¾÷ªºÅX°Êµ{¦¡©O¡H FreeBSD ¤ä´©¥ô¦ó¬Û®e ATAPI ¼Ð·Çªº IDE CD-R ©Î CD-RW ¥úºÐ¿N¿ý¾÷¡A ²Ó¸`½Ð°Ñ¾\ &man.burncd.8; »¡©ú¡C FreeBSD ¤]¤ä´©¥ô¦ó SCSI CD-R ©Î CD-RW ¥úºÐ¿N¿ý¾÷¡C ½Ð¥Î port ©Î packag ¾÷¨î¨Ó¦w¸Ë¡B¨Ï¥Î cdrecord ¡A ¨Ã½T©w±zªº kernel ¤º¦³±N pass³]³Æ¤@¨Ö½sĶ¦b¤º¡C (¹w³]ªº kernel.GENERIC ³£·|¦³ device pass ³o¬q) FreeBSD ¤ä´© Iomega &iomegazip; ¶Ü? FreeBSD ¤ä´©¥~±µ¦¡ªº SCSI ¤Î ATAPI(IDE) ¤¶­±ªº Iomega &iomegazip;¡C ¤£¹L SCSI ZIP ¥u¯à³Q³]¬° SCSI ID 5 ©Î¬O 6 ¤~¥i¥H¹B§@¡A¦ý¦pªG SCSI ¥d¤Wªº BIOS ¤ä´©¥¦¡A§A¬Æ¦Ü¥i¥H¥Î¥¦¨Ó¶}¾÷¡C §Ú­Ì¤£¾å±o­þ¤@¶ô¥d¥i¥H§â¥dªº ID ³]¦b°£¤F 0 ©Î 1 ¥H¥~ªº¦a¤è¦Ó¶}¾÷¦¨¥\¡A ¦]¦¹¡A¦pªG·Q§ï SCSI ID ªº¸Ü¡A½Ð°È¥²°Ñ¾\¸Ó«¬¸¹ªº»¡©ú¤â¥U¡C FreeBSD ¦P®É¤]¤ä´© Parallel Port ZipºÏºÐ¾÷¡C½ÐÀˬd kernel ³]©wÀɬO§_¦³¡G scbus0¡B da0¡B ppbus0¡A¥H¤Î vp0 ³o¨ÇÅX°Êµ{¦¡ (¹w³]ªº GENERIC kernel °£¤F vp0 ¨S¥]¶i¥h¡A¨ä¥L¤TªÌ³£·|¦³)¡C ¥[¤F³o´X­ÓÅX°Êµ{¦¡¤§«á¡AParallel Port Zip ´N·|¦¨¬° /dev/da0s4¡C ³o®É¡A´N¥i¥H¥Î¹³¬O mount /dev/da0s4 /mnt ©Î (DOS Àɮרt²Î)mount_msdos /dev/da0s4 /mnt ¤§Ãþªº«ü¥O¨Ó±¾¸ü¡BŪ¼g¡C ¤]¥i¥H°Ñ¾\¤U­±¦³ÃöÀH¨­ºÏ¤ù ³¡¤À¡A¥H¤Î©â¨úºÐ¡BÀH¨­ºÐªº¡y®æ¦¡¤Æ¡z°Q½× ªº³¡¤À FreeBSD ¦³¤ä´© &jaz;¡BEZ ¤Î¨ä¥LÃþ¦üªºÀH¨­ºÏ¤ù¶Ü¡H ¥i¥H°Ú¡A°£¤F IDE ªº EZ drive ¥~¡A¨ä¥LªºÀ³¸Ó³£¬O SCSI ¤¶­±¡A ©Ò¥H¦b FreeBSD ¤W³£·|¥H SCSI µwºÐ¨Ó³B²z¡C ·íµM¡A§A¥²¶·½T©w¦b¶}¾÷®É¡A³o¨Ç³]³Æªº¹q·½¬O¥´¶}ªº¡A ¥H«KÅý FreeBSD ¥i¥H°»´ú¨ì¡C ¦pªG¦bºÏºÐ¹B¤¤ª¬ºA¤¤¡A­n§ó´«ºÏ¤ùªº¸Ü¡A °O±o¥ý¬Ý¤@¤U &man.mount.8;¡B&man.umount.8;¡B ¥H¤Î(SCSIªº¸Ü)&man.camcontrol.8; ©Î &man.atacontrol.8; ÁÙ¦³ FAQ «á­±¦³Ãö ¨Ï¥Î©â¨úºÐ¡BÀH¨­ºÐªº°Q½× ¡C Áä½L¡B·Æ¹« FreeBSD ¦³¤ä´© USB Áä½L¶Ü¡H FreeBSD (¤×¨ä¬O¦³¤ä´© USB keyboards¡C Enable USB support in /etc/rc.conf. ­Y¦³¶} USB Áä½L¤ä´©¦Ó¥B¦P®É±µ¤W AT ¸ò USB Áä½Lªº¸Ü¡A¨º»ò AT Áä½L·|Åܦ¨ /dev/kbd0¡A¦Ó USB Áä½L«h¬O /dev/kbd1¡C¦pªG¥u±µ USB Áä½L¡A¨º»ò¥¦´N¬O /dev/ukbd0 Åo¡C ¦pªG·Q¦b console ¤W¨Ï¥Î USB Áä½Lªº¸Ü¡A¨º»ò¥²¶·³]©w console «ü©w¥Î USB Áä½L¡C ¥i¥H¦b¨t²Î¶}¾÷µ{§Ç®É¡A¥[¤W¤U¦C«ü¥O¡G &prompt.root; kbdcontrol -k /dev/kbd1 < /dev/ttyv0 > /dev/null ª`·N¡G­Y¥u¦³ USB Áä½Lªº¸Ü¡A¤]´N¬O /dev/ukbd0¡A ¨º»ò½Ð§ï¥Î¤U¦C«ü¥O¡G &prompt.root; kbdcontrol -k /dev/ukbd0 < /dev/ttyv0 > /dev/null «Øij¡G¥i¥H§â¤W­z«ü¥O©ñ¤J /etc/rc.i386 ¡C ³]©w¦¨¥\¤§«á¡AUSB Áä½L¤£¥Î§@¥ô¦ó¯S§O³]©w¡A´N¥i¥H¦b X µøµ¡Àô¹Ò¤W¥¿±`¹B§@Åo¡C USB Áä½Lªº¼ö´¡©Þ(Hot-plugging and unplugging)¦b &os; ¥i¯àÁÙµLªk§¹¥þ¥¿±`¹B§@¡A «Øij¡G¦b¨t²Î¶}¾÷«e´N¥ý±µ¤WÁä½L¡Aª½¨ìÃö¾÷¬°¤î¡A¥HÁקK¤£¥²­nªº§xÂZ¡C ¬ÛÃö²Ó¸`½Ð°Ñ¾\ &man.ukbd.4; ªº»¡©ú¡C ¥j¦­ªº bus ·Æ¹«¡A­n«ç»ò³]©w©O¡H FreeBSD ¤ä´©¤@¨Ç¼t°Ó(¹³¬O¡GMicrosoft¡BLogitech¡BATI)©Ò°µªº bus ¤Î InPort bus ¤¶­±ªº·Æ¹«¡C µM¦Ó¡A¹w³]ªº kernel(GENERIC)¤w¸g¤£¤º§t¥¦­ÌªºÅX°Êµ{¦¡¡C ¦]¦¹¡A­n¥[¤J¤U¦C¨ì kernel ³]©wÀɨí«·s½sĶ¡B¦w¸Ë¡A¤~¯à±Ò¥Î¡G device mse0 at isa? port 0x23c irq5 Bus ·Æ¹«³q±`­n·f°t±M¥Îªº¤¶­±¥d¤~¯à¨Ï¥Î¡C ³o¨Ç¥d¥i¥H³]©w port address ¤Î IRQ ­È¡A³o¨Ç²Ó¸`½Ð°Ñ¾\§Aªº·Æ¹«»¡©ú¤â¥U¤Î &man.mse.4; »¡©ú¡C PS/2 (mouse port ©Î keyboard)ªº·Æ¹«­n«ç»ò³]©w¤~¦n©O¡H PS/2 ·Æ¹«³£¦³¤ä´©¡A©Ò»Ý­n¥Î¨ìªºÅX°Êµ{¦¡ psm ¦b¹w³]ªº kernel(GENERIC)¤w¦³¤º§t¤F¡C ­Y§A¦Û­qªº kernel ¤ºº|¤F psm ªº¸Ü¡A¨º»ò´N¦A§â¤U¦C¤º®e¥[¨ì kernel ³]©wÀɨí«·s½sĶ¡B¦w¸Ë¡G device psm0 at atkbdc? irq 12 ·í¶}¾÷®É kernel ¦³¥¿½T°»´ú¨ì psm0 ¡A½Ð°È¥²½T»{¦b /dev ¤º¦³ psm0 ¡C ¦pªG¨S¦³ªº¸Ü¡A¨º»ò´N¥Î root ¨Ó¥´¤U¦C«ü¥O¨Ó«Ø¥ß§a¡G &prompt.root; cd /dev; sh MAKEDEV psm0 ¦pªG¬O &os; 5.0-RELEASE(§t¤§«áª©¥»)ªº¸Ü¡A¦]¬°±Ä¥Î &man.devfs.5; ¾÷¨îªº¦]¯À¡A ©Ò¥H·|¦Û°Ê¦b /dev ¤U«Ø¥ß¬ÛÃö³]³Æªº¸`ÂI¡A¦]¦¹´N¥i¥H²¤¹L¤W­±³o¤@¨B¡C ¦pªG¤£¥Î X Window Àô¹Òªº¸Ü¡A¤]¥i¥H¥Î·Æ¹«¶Ü¡H ­Y¨Ï¥Î console ªº¹w³]ÅX°Êµ{¦¡(¤]´N¬O &man.syscons.4;)¡A ¨º»ò´N¥i¥H¦b¤å¦r¤¶­±ªº console ¤W­±¥Î·Æ¹«¨Ó°Å¶K¤å¦r¤F¡C ¨º»ò­n±Ò°Ê &man.moused.8; ¨Ã¶}±Ò´å¼ÐÅã¥Ü¡A ½Ð¥´¤U¦C«ü¥O¡G &prompt.root; moused -p /dev/xxxx -t yyyy &prompt.root; vidcontrol -m on ¨ä¤¤¡yxxxx¡z¬O·Æ¹«ªº³]³Æ¦WºÙ¡A¦Ó ¡yyyyy¡z«h¬O·Æ¹«©Ò¨Ï¥Îªº protocol ºØÃþ¡C ¥Ø«eªº moused ¥i¥H¦Û°Ê°»´ú(°£¤F¦¡ªº serial ·Æ¹«¤§¥~)¤j¦h¼Æ·Æ¹«©Ò¨Ï¥Îªº protocol ºØÃþ¡A¦Ó¤£¥Î¨è·N¥h«ü©w¡C ¡yprotocol ºØÃþ¡z³]©w¥Î auto ´N·|¦Û°Ê°»´ú¤F¡C­Y¦Û°Ê°»´ú¥¢±Ñªº¸Ü¡A½Ð°Ñ¾\ &man.moused.8; ¸Ì­±ªº type ¨º¬q»¡©ú¡C ¦pªG¥Îªº¬O PS/2 ·Æ¹«¡A¥u­n§â moused_enable="YES" ¥[¨ì /etc/rc.conf ¡A³o¼Ë¨C¦¸¶}¾÷´N·|¦Û°Ê±Ò°Ê¤F¡C ¦¹¥~¡A¦pªG­n¦b©Ò¦³ virtual terminals ¤W¤]¯à¨Ï¥Î·Æ¹«¡A ¦Ó¤£­­©w¥u¦³ console ªº¸Ü¡A¨º»ò½Ð¦A§â allscreens_flags="-m on" ¥[¨ì /etc/rc.conf ¸Ì­±§Y¥i¡C moused ¦b°õ¦æ¤¤ªº®É­Ô¡A¦pªG­n¨Ï¥Î·Æ¹«¬ÛÃö¥\¯à¡A³£¥²¶·³z¹L moused ©Î¨ä¥Lµ{¦¡¹³¬O X µøµ¡¨Ó¶i¦æ¡C½Ð°Ñ¾\ FAQ ¤¤¦³Ãö¡y¬°¤°»ò¤£¯à¦b X µøµ¡¸Ì¨Ï¥Î·Æ¹«¡H¡z¥HÁA¸Ñ¬ÛÃö²Ó¸`¡C ¦b¤å¦r¼Ò¦¡ªº console Àô¹Ò­n«ç»ò¥Î·Æ¹«¨Ó°Å¶K¤å¦r©O¡H ·í°õ¦æ moused «á¡A(°Ñ¾\«e¤@¸`) «ö¦í¥ªÁä¡A±µµÛ²¾°Ê·Æ¹«¨Ó¿ï¾Ü¤@­Ó°Ï°ì¤§«á©ñ¶}¡A³o¼Ë´N§¹¦¨¡y½Æ»s¡z¡C ­n¡y¶K¤W¡zªº¸Ü¡A«ö·Æ¹«¤¤Áä´N¥i¥H¤F¡C ­n¡y©µ¦ù¿ï¨ú°Ï¡zªº¸Ü¡A«ö·Æ¹«¥kÁä ¦pªG§Aªº·Æ¹«¨S¦³¤¤Áä¡A§A¥i¥H¥Î¼ÒÀÀªº¤è¦¡¡A©Î¬O­«·s©w¸q·Æ¹««öÁ䪺¤è¦¡¡A ¨Ó¹F¦¨¡u©µ¦ù¡vªº¥\¯à¡C¸Ô±¡½Ð°Ñ¾\ &man.moused.8; »¡©ú¡C §Ú·Æ¹«¤W­±ªººu½ü¡Bºu½ü«ö¶s¡A¥i¥H¦b console ¤W¨Ï¥Î¶Ü¡H ³o­Óµª®×¹À...¡A«Ü¤£©¯¦a¡A¦b¤j¦h¼Æªº±¡ªp¤U¤£¦æ¡C ³o¨Ç¦³ºu½üªº·Æ¹«»Ý­n¥Î¯S®íÅX°Êµ{¦¡¤~¦æ¡A °£«D¡A·Æ¹«ÅX°Êµ{¦¡©Î¨Ï¥ÎªÌ¦Û¤vªºÀ³¥Îµ{¦¡¦³¤ä´©¡A ¤£µM¡A³o¨Ç·Æ¹«¥u¯à°÷·í¦¨¬O´¶³qªº¨âÁä©Î¤TÁ䪺·Æ¹«¨Ó¥Î¦Ó¤w¡C ¦pªG­n¦b X µøµ¡Àô¹Ò¤W¨Ï¥Îºu½üªº¸Ü¡A½Ð°Ñ¾\ X µøµ¡¤Wªººu½ü¨Ï¥Î »¡©ú¡C ­n«ç»ò¦bµ§°O«¬¹q¸£¤W¨Ï¥Î·Æ¹«¡B­y¸ñ²y¡BIJ±±ªO©O¡H ½Ð°Ñ¾\«e­±ªº PS/2 ·Æ¹«ªº°Ýµª ¡C ºô¸ô¸ò serial ³]³Æ FreeBSD ¤ä´©­þ¨Çºô¸ô¥d©O¡H ½Ð°Ñ¦Ò &os; ¦Uª©¥»ªºµwÅé¤ä´©¦Cªí¡C ¬°¤°»ò FreeBSD §ä¤£¨ì PnP(ÀH´¡ÀH¥Î¡APlug & Play)³W®æªº modem? ­ì¦]¦b©ó¡G»Ý­n§â modem ªº PnP ID ¥[¨ì serial ÅX°Êµ{¦¡ªº PnP ID ªí¡A§@ªk¦p¤U¡G ­º¥ý¡A¦b kernel ³]©wÀɤº¥[¤J controller pnp0¡A ¨Ã­«·s½sĶ¡B¦w¸Ë kernel¡A³Ì«á­«¶}¾÷´N·|±Ò°Ê PnP ¤ä´©¡C µM«á¡Akernel ·|§â°»´ú¨ì©Ò¦³³]³Æ¤Wªº PnP ID ³£¦C¥X¡C ³o®É¡A­×§ï /usr/src/sys/isa/sio.c(¤j¬ù²Ä752¦æ¥ª¥kªº¦a¤è)¡A ¥i¥H·j´M SUP1310 ·íÃöÁä¦r(¦ì©ó sio_ids[] ªí¤º)¡A ½Ð±N­è¤~ kernel Åã¥Üªº modem ªº PnP ID ½Æ»s¨ì¬ÛÃö¦ì¸m¡C ³o®É¡A¦A­«·s½sĶ¡B¦w¸Ë kernel¡A³Ì«á­«¶}¾÷À³¸Ó´N·|¥¿½T°»´ú¨ì modem ¤F¡C ¦¹¥~¡A¤]¥i¥H¦b¶}¾÷®É¥H pnp «ü¥O¨Ó¤â°Ê³]©w PnP ³]³Æ¡A ¨ÓÅý kernel ±o¥H¥¿½T°»´ú¡AÁ|¨Ò¡G pnp 1 0 enable os irq0 3 drq0 0 port0 0x2f8 FreeBSD ¤ä´©¹³¬O Winmodems ¤§Ãþªº³nÅé modem ¶Ü¡H FreeBSD ¥i¥H¦w¸ËÃB¥~ªº³nÅé¨Ó¤ä´©³nÅé modem¡C ¹³¬O comms/ltmdm ¥i¤ä´©±`¨£ªº Lucent LT ´¹¤ù¡A comms/mwavem «h¥i¤ä´© IBM Thinkpad 600 ¤Î 700 µ§°O«¬¹q¸£¤W­±ªº modem¡C µM¦Ó¡A¨Ã¤£¯à¥Î³nÅé modem ¨Ó¦w¸Ë FreeBSD¡A ¦]¬°¡G³oÃþ³nÅ饲¶·¦b§@·~¨t²Î¦w¸Ë§¹²¦¤§«á¡A¤~¯à¦w¸Ë¡C ¦³ Broadcom 43xx µL½uºô¥dªº­ì¥ÍÅX°Êµ{¦¡(Native driver)¶Ü¡H ¨S¦³¡A¦Ó¥B¤]¤£¤Ó¥i¯à·|¦³¡C Broadcom ©Úµ´¤½¶}¦³ÃöµL½uºô¥d´¹¤ùªºÅX°Êµ{¦¡¬ÛÃö»¡©ú¡A ¥D¦]¤j·§¬O¥L­Ì¥Î³nÅé¨Ó±±¨îµL½u¶Ç¿é¤è¦¡¡C ¨Æ¹ê¤W¡A¦]¬°­n¯à³q¹L¬ü°êÁp¨¹¹q«H©e­û·|(FCC)À˺Ϧw³Wªº¸Ü¡A ¥²¶·½T«O²£«~¤£¯àÅý¨Ï¥ÎªÌ¤£¯àÀH·N§ó°Ê¬ÛÃö³]©w¡A¤ñ¦p¡G¹qºÏªiÀW²v¡B¬ÛÃö¼Ò²Õ°Ñ¼Æ¡B¿é¥X¹q·½µ¥¡C ¦ý¬O¡A¦pªG§Ú­Ì¤£ª¾¹D¦p¦ó¥h±±¨î´¹¤ùªº¸Ü¡A¨º»ò¼¶¼gÅX°Êµ{¦¡¤§¸ô®£©È¤£¤Ó¥i¦æ¡C FreeBSD ¤ä´©­þ¨Ç multi-port serial¥d©O¡H ½Ð°Ñ¾\¨Ï¥Î¤â¥U¤Wªº ¦w¸Ë½g¡X¨ä¥LµwÅé ¦Cªí¡C ÁöµM¦³¨Ç¥d¬O¨SµPªº(¤×¨ä¬O¦³¼Ð©ú¡G¬Û®e AST ³W®æ)¦ý¤]¥i¥H¥¿±`¨Ï¥Î¡C ¦Ü©ó¥dªº³]©w¤è­±¡A½Ð°Ñ¾\ &man.sio.4; ªº»¡©ú¡C ¦b serial console ¤W­n¦p¦ó¤~·|¥X²{ boot: ´£¥Ü©O¡H kernel ³]©wÀÉ¥[¤J options COMCONSOLE «Ø¥ß /boot.config ÀÉ¡A¨Ã¥B¸ÓÀɸ̭±¤º®e¥u¶ñ¤W §âÁä½L±q¾÷¾¹¤W©Þ±¼ ²Ó¸`½Ð¬Ý /usr/src/sys/i386/boot/biosboot/README.serial ­µ®Ä¥d FreeBSD ¤ä´©­þ¨Ç­µ®Ä¥d¡H &os; ¤ä´©¦UºØ­µ®Ä¥d¡A¥]¬A¤F &soundblaster;¡B &soundblaster; Pro¡B&soundblaster; 16¡BPro Audio Spectrum 16¡B AdLib¡B¤Î Gravis UltraSound sound cards (²Ó¸`½Ð°Ñ¾\ &os; µo¦æ±¡³ø ¥H¤Î &man.snd.4; ªº»¡©ú)¡C ¦¹¥~¡A¹ï MPU-401 ¤Î MIDI ¬Û®e³W®æªº¤]¦³¤@©wµ{«×ªº¤ä´©¡A¦Ó µsoft; Sound System ³W®æ¤]¦³¤ä´©¡C ÅX°Êµ{¦¡¶È¾A¥Î©ó¡y­µ®Ä¡z³¡¤À¡I °£¤F &soundblaster; ¤§¥~¡A ¥Ø«e­µ®ÄÅX°Êµ{¦¡¨Ã¤£¤ä´©³o¨Ç­µ®Ä¥d¤Wªº¥úºÐ¾÷, SCSI³]³Æ©Î·n±ì¡C &soundblaster; ªº SCSI ¤¶­±¤Î¬Y¨Ç«D SCSI ªº¥úºÐ¾÷¬O¦³¤ä´©¡A¦ýµLªk¥Î¨Ó¶}¾÷¡C &man.pcm.4; ©Ò¤ä´©ªº­µ®Ä¥d¨S¦³Án­µ¡A¦³¤°»ò¼È®É¸Ñ¨M¤è¦¡¶Ü¡H ¦]¬°¦³¨Ç¹³¬O es1370 ´¹¤ùªº­µ®Ä¥d·|¦b¨C¦¸¶}¾÷®É§â­µ¶q½Õ¬°¹s¡C ¼È®É¸Ñªk¬O¦b¨C¦¸¶}¾÷®É°õ¦æ¤U­±«ü¥O¡A©Î¬O¥[¨ì /etc/rc.local ¤º¡G &prompt.root; mixer pcm 100 vol 100 cd 100 - ¨ä¥LµwÅé + ¨ä¥L©Ç²§°ÝÃD(ACPI¡B­«¶}¾÷«á±¾¤F..µ¥) FreeBSD Á٤䴩¨ä¥L­þ¨ÇµwÅé©O¡H ½Ð°Ñ¾\¨Ï¥Î¤â¥U¤Wªº ¦w¸Ë½g¡X¨ä¥LµwÅé ¡C FreeBSD ¤ä´©µ§°O«¬¹q¸£ªº¬Ù¹qºÞ²z¥\¯à¶Ü¡H FreeBSD 4.X(§t¤§«áª©¥»)¦b¬Y¨Ç¾÷ºØ¤W³£¦³¤ä´© APM¡C ²Ó¸`½Ð°Ñ¾\ &man.apm.4; ªº»¡©ú¡C FreeBSD 5.X(§t¤§«áª©¥»)¤ä´©¦b¥Ø«e¤j³¡¤À¾÷ºØ¤W³£¦³ªº ACPI ¥\¯à¡C ²Ó¸`½Ð°Ñ¾\ &man.acpi.4; ªº»¡©ú¡C­Y¾÷¾¹¤W¦P®É³£¦³ APM ¤Î ACPI ¥\¯àªº¸Ü¡A§Ú­Ì«Øij§A¥i¥H¨âªÌ³£¸Õ¸Õ¬Ý¡A ¬Ý¬Ý­þ¤@ºØ¤ñ¸û²Å¦X§Aªº»Ý¨D¡C ¸Ó¦p¦óÃö³¬ ACPI¡H §â hint.acpi.0.disabled="1" ³o¬q¥[¨ì /boot/device.hints §Y¥i¡C Micron ¹q¸£Á`¬O¦b &os; ±Ò°Ê®É´N±¾±¼¡A¸Ó«ç»ò¿ì©O¡H ¦³¨Ç Micron ¥D¾÷ªO¤Wªº BIOS ¦b PCI ¤è­±·|¦³°ÝÃD¡A ³o·|¾É­P PCI ³]³Æ·|³Q BIOS °»´ú¬°¤£¥¿½T³]©w¡A¦Ó¶i¤J FreeBSD ´N±¾±¼¡C ¼È®É¸Ñ¨M¤è¦¡¡GÃö³¬ BIOS ¤º Plug and Play Operating System ªº³]©w¡C &tm.3com; PCI ¤¶­±ºô¸ô¥dµLªk¦b Micron ¹q¸£¤W¨Ï¥Î¡A¸Ó«ç»ò¿ì¡H ³o°ÝÃD¸ò«e­±ªº°ÝÃD¦]¯À¤@¼Ë¡AÁ`¤§¡A´N¬OÃö³¬ BIOS ¤¤¦³Ãö OS PnP ªº³]©w¡C ¼È®É¸Ñ¨M¤è¦¡¡GÃö³¬ BIOS ¤º Plug and Play Operating System ªº³]©w¡C ¥D¾÷ªO¬O¥ÎµØºÓ(ASUS) K7V¡A¥i¬O¥Î¶}¾÷¤ù¶}¨ì¤@¥b´N·í¤F¡A«ç»ò¿ì©O¡H ¶i¤J BIOS ³]©w¡A¨ÃÃö³¬ boot virus protection ³]©w§Y¥i¡C PCMCIA ¥dµLªk¨Ï¥Î¡A¨Ã¥X²{¿ù»~°T®§ cbb0: unsupported card type detected. ¸Ó«ç»ò¿ì¡H ¥i¥H¸Õ¸Õ¬Ý§ï¥Îªº¤è¦¡¡A½Ð¥ý­×§ï kernel ³]©wÀÉ¡A®³±¼¤U­±³o´X¦æ¡G device cbb device pccard device cardbus µM«á¥[¤W¡G device pcic device card 1 ³Ì«á½Ð°Ñ¾\ Handbook ¤¤ ½Õ¾ã FreeBSD Kernel ³¹¸`¡A¥H­«·s½sĶ¡B¦w¸Ë·sªº kernel¡C ¬°¤°»ò &dell; &poweredge; 2850 ¸Ë§¹ FreeBSD ¤§«á¡A­«¶}¾÷±µµÛÁä½L´N±¾¤F¡H (¥»ÃD¥Ñ cdsheen ´£¨Ñ)À|¸Õ¦b &dell; &poweredge; 2850 ¤W­±¦w¸Ë &os; 6.0¡A ¤£¹L¦w¸Ë§¹¦¨¡B¨Ã­«·s¶}¾÷¤§«á¡Aµo²{ console ªºÁä½L¤£¯à°Ê¤F¡A ¦P¼Ëªº±¡ªp¦ü¥G¤]¦s¦b©ó &os; 5.3 ¤Î &os; 5.4¡A ¸g¹L¤@µf·j´M¡Aµoı¬O¦]¬°³o¥x¾÷¾¹¤W­±¦³¤@­Ó Dell Remote Access Controller (DRAC)¡A ³o­Ó¸Ë¸m·|³Q¨t²Î¿ëÃѦ¨¤@­Ó USB Keyboard¡A©Ò¥H¾É­P¶}§¹¾÷¤§«á¡A¥¿±`ªº PS/2 Áä½L¤Ï¦Ó¤£¯à°Ê¤F¡I ¼È®É¸Ñ¨M¤è¦¡¦p¤U¡G ¥ý¥H Single User Mode ¶i¤J¨t²Î ¦b©R¥O¦C¼Ò¦¡¤U¡A¥ý°õ¦æ¤U¦C©R¥O¡G &prompt.root; fsck -y / &prompt.root; mount -u / µM«á½s¿è /etc/devd.conf¡A§â¹ï©ó USB Keyboard ªº¤ä´©¼È®É®³±¼¡A ¤]´N¬O§â¤U­±´X¦æ¶}ÀY¥[¤W # # When a USB keyboard arrives, attach it as the console keyboard. #attach 100 { # device-name "ukbd0"; # action "kbdcontrol -k /dev/ukbd0 < /dev/console && /etc/rc.d/syscons restart"; #}; #detach 100 { # device-name "ukbd0"; # action "kbdcontrol -k /dev/kbd0 < /dev/console"; #}; µM«á¿é¤J exitÂ÷¶} Single User Mode ¤§«á¡A ´N¥i¥H¶¶§Q¶i¤J¨t²Î¡B¦Ó¥BÁä½L¤]¥i¥H¥¿±`¹B§@¡A¤U¦¸¶}¾÷¤]¤£·|¦³°ÝÃD¡I ¥t¥~¡A&dell; ªº DRAC/BMC ¬Ý°_¨Ó¦³ÆZ¦h¤£¿ùªº»·ºÝ¦s¨ú¥\¯à¡A¦³¿³½ìªº¤H¥i¥Hª±ª±¬Ý... William Liao
chliao@tpts4.seed.net.tw
±`¨£°ÝÃD¸Ñ¨M + + + Why is &os; finding the wrong amount of memory? + + + + The reason is the difference between physical memory addresses + and virtual addresses. + + The convention for most PC hardware is to use the memory area + between 3.5G and 4G for a special purpose (usually for PCI). This + address space is used to access PCI hardware. As a result real, + physical memory can not appear in that address space. + + What happens to the memory that should appear in that location + is dependent on your hardware. Unfortunately, some hardware does + nothing and the ability to use that last 500M of RAM is entirely + lost. + + Luckily, most hardware remaps the memory to a higher location + so that it can still be used. However, this can cause some + confusion if you watch the boot messages. + + On a 32 bit version of &os;, the memory appears lost, since it + will be remapped above 4G, which a 32 bit kernel is unable to + access. In this case, the solution is to build a PAE enabled + kernel. See this FAQ entry + for more information. + + On a 64 bit version of &os;, or when running a PAE-enabled + kernel, &os; will correctly detect and remap the memory so it is + usable. During boot, however, it may seem as if &os; is detecting + more memory than the system really has. This is normal and the + available memory will be corrected as the boot process + completes. + + + µwºÐ¦³Ãa­y®É¸Ó«ç»ò¿ì? ­Y¬O SCSI µwºÐªº¸Ü¡A¨º»òºÏºÐ¾÷À³¸Ó¦³¯à¤O¦Û°Ê§@ re-mapping ªº°Ê§@¡CµM¦Ó¡A¦]¬°¤@¨Ç¥¼ª¾ªº¦]¯À¡A¦b¥X¼t®É¡A«Ü¦hµwºÐªº³o¶µ ¥\¯à¬OÃö³¬ªº... ­n±N¨ä­«·s¶}±Ò¡A±z»Ý­n½s¿è¸Ë¸mªº²Ä¤@­Ó page ¼Ò¦¡ ¡]first device page mode¡^¡A¦b FreeBSD ¤W¥i¥H¥Î¤U­±ªº«ü¥O¿ì¨ì ¡]¥H root¨­¤À°õ¦æ¡^ &prompt.root; scsi -f /dev/rsd0c -m 1 -e -P 3 µM«á±N AWRE ©M ARRE ªº¼Æ­È±q 0 Åܦ¨ 1:- AWRE¡]Auto Write Reallocation Enbld¡^¡G 1 ARRE¡]Auto Read Reallocation Enbld¡^¡G 1 ¥H¤U³o¬q¬O¥Ñ Ted Mittelstaedt tedm@toybox.placo.com©Ò´£¨Ñ¡G ­Y¬° IDE µwºÐ¡A¥ô¦óªºÃa­y³q±`³£¬O³Â·Ðªº¹w¥ü¡C¥Ø«e©Ò¦³¸û·sªº IDE µwºÐ¡A¤º³¡³£¦³¦Û°Ê remapping Ãa­yªº¯à¤O¡C¥Ø«e©Ò¦³ IDE µwºÐ »s³y°Ó¡A³£´£¨Ñ¤F§ó¤[ªº«OÃÒ¡A¦Ó¥B·|À°±z§ó´«¥X²{Ãa­yªºµwºÐ¡C ¦pªG±z¤´·Q­n­×´_²£¥ÍÃa­yªº IDE µwºÐ¡A±z¤´¥i¥H¸ÕµÛ¥h¤U¸ü IDE µwºÐ»s³y°Ó©Ò´£¨ÑªºÀË´úµ{¦¡¡A¨Ã¥Î¥¦¨ÓÀˬd±zªºµwºÐ¡C¦³®É³o¨Ç³nÅé¥i ¥H±j­¢­«·sÀˬdµwºÐªºÃa­y¡A¨Ã±N¥¦­Ì¼Ð¥Ü¥X¨Ó¡C ¹ï ESDI¡ARLL ¤Î MFM ªºµwºÐ¨Ó»¡¡A³q±`Ãa­y¬O¥¿±`²{¶H¡A¤]¤£¬O¤° »ò³Â·Ðªº«e¥ü¡C¦b PC ¤W¡AºÏºÐ±±¨î¥d©M BIOS ­t³d¼Ð¥ÜÃa­yªº¥ô°È¡C³o ¹ï¤@¨Ç¨Ï¥Î BIOS¨Ó¦s¨úºÏºÐªº§@·~Àô¹Ò¡]¦p DOS¡^¬O¨S¦³°ÝÃDªº¡CµM¦Ó¡A FreeBSD ªººÏºÐÅX°Êµ{¦¡¨Ã¤£¸g¹L BIOS ¨Ó¦s¨úºÏºÐ¡A©Ò¥H¡A¦³­Ó bad144 ªº¾÷¨î¥Î¨Ó¨ú¥N³o¶µ¥\¯à¡Cbad144 ¥u¯à¥Î¦b wd ³o­ÓºÏºÐÅX°Êµ{¦¡¤W¡]³o ­Ó¥Nªí¤F FreeBSD 4.0 ¨Ã¤£¤ä´©¥¦¡^¡A¥¦¤]µLªk¥Î¦b SCSI µwºÐ¤W¡C bad144ªº¤u§@¤èªk¬O±N©Ò¦³§ä¨ìªºÃa­y¸ê®Æ¦s¨ì¤@­Ó¯S§OªºÀÉ®×ùØ¡C ¨Ï¥Î bad144 ªºÄµ§i - ¦sµÛÃa­y¸ê®Æªº¯S§OÀɮ׬O©ñ¦bµwºÐªº³Ì«á ¤@­y¤W¡C¦]¬°³o­ÓÀÉ®×Àx¦sªºÃa­y¸ê®Æ¤¤¡A¦³¥i¯à¦³¨Ç¸ê®Æ¬O«ü¦VµwºÐ³Ì «eºÝ©Òµo¥ÍªºÃa­y±¡§Î¡A´N¬O¥i¯àÀx¦s /kernel ³o­ÓÀɪº¦a¤è¡A©Ò¥H¥¦ ¤@©w­n¯à³Q¶}¾÷µ{¦¡©ÒŪ¨ú¡A¦Ó¶}¾÷µ{¦¡¬O³z¹L BIOS ¨ÓŪ¨ú kernel ÀÉ¡C³oªí¥Ü¤F¨Ï¥Î bad144 ªºµwºÐµ´¤£¯à¾Ö¦³¶W¹L 1024 ­Ó cylinder¡A 16 ­Ó head ¤Î 63 ­Ó sector¡C¦Ó³o¨Ï±o±ý¨Ï¥Î bad144 ªºµwºÐªº¤j¤p¤£ ¯à¤j©ó 500 MB¡C ­n¨Ï¥Î bad144 «Ü²³æ¡A¥u­n¦b¶}©l¦w¸Ë®É¡A¦b FreeBSD fdisk µe­± §âBad Block ±½ºË³]¬° ON §Y¥i¡C¦b FreeBSD 2.2.7 ¥H «á³£¥i¥H¨Ï¥Î¦¹¤èªk¡C¦ý³o­ÓµwºÐªº cylinder ¤@©w­n¦b 1024 ¥H¤U¡C¨Ï ¥Î«e¡A§Ú­Ì«Øij³o­ÓµwºÐ­n¦Ü¤Ö¥ý¨Ï¥Î¥|­Ó¤p®É¡A¥H«K¼ö¿±µÈ»PºÏ­y°¾²¾ ¹F¤@¯ëª¬ºA¡C ¦pªG³o­ÓµwºÐ¾Ö¦³¶W¹L 1024 ­Ó cylinder¡]¹³¤j®e¶qªº ESDI µwºÐ¡^ ¡AESDI ±±¨î¥d§Q¥Î¤@­Ó¯S§OªºÂà´«¼Ò¦¡¨Ï¥¦¯à¦b DOS ¤U¤u§@¡C¦Ó¦pªG±z ¦b fdisk ùتº set geometry ¤¤¿é¤J Âà´«¹L ªº geometry¡Awd ³o­ÓÅX°Êµ{¦¡¯à¤F¸Ñ³o¨ÇÂà´« ¼Ò¦¡¡C±z¤]µ´¹ï¤£¯à¨Ï¥Î dangerously dedicated ¼Ò¦¡¨Ó«Ø¥ß FreeBSD ªº¤À³Î°Ï¡A¦]¬°¥¦·|©¿²¤ geometry ³o­Ó°Ñ¼Æ¡C¦¹¥~¡A´Nºâ fdisk ¨Ï¥Î ±z©Ò¿é¤Jªº geometry °Ñ¼Æ¡A¥¦¨ÌµM·|¥hŪ¨ú³oµwºÐªº¯u¥¿¸ê®Æ¡A¦Ó·|¹Á ¸Õ¥h«Ø¥ß¤@­Ó¹L¤jªº FreeBSD ¤À³Î°Ï¡C¦pªGºÏºÐªº geometry ¤w¸g³Q Âà´« ¹L¤F¡A¨º»ò ³o­Ó¤À³Î°Ï ¥²¶· ¥H¤â°Ê¿é¤J block ¼Æ¥Øªº¤èªk¨Ó«Ø¥ß¡C ¤@­Ó§Ö³tªº¤p§Þ¥©¬O§Q¥Î ESDI ±±¨î¥d¨Ó³]©w¤j®e¶qªº ESDI µwºÐ¡A ¥Î DOS ¶}¾÷¤ù¶}¾÷¡A¦A±N¥¦ format ¬° DOS ªº¤À³Î°Ï¡CµM«á­«¶}¾÷¶i¤J FreeBSD ¦w¸Ëµ{§Ç¡A¦b fdisk µe­±¡A§âDOS ¤À³Î°Ïªº blocksize ©M block number §Û¤U¨Ó¡CµM«á­«·s³]©w geometry ¨Ï¨ä¸ò DOS ¨Ï¥Îªº¤@¼Ë¡C §R°£ DOS ¤À³Î°Ï¡AµM«á¨Ï¥Î±z­è­è§Û¤Uªº blocksize ¨Ó«Ø¥ß¤@­Ó cooperative FreeBSD ¤À³Î°Ï¡CµM«á³]©w³o­Ó¤À³Î°Ï¬°¥i ¶}¾÷¡A¦A¥´¶}Ãa­y±½ºË¡C¦b¯u¥¿ªº¦w¸Ë¹Lµ{¤¤¡Abad144 ·|¦b¥ô¦óÀɮרt²Î ³Q«Ø¥ß«e¥ý³Q°õ¦æ¡C¡]±z¥i¥H«ö Alt-F2 ¨ÓºÊ¬Ý³o¤@¤Á¡^¦pªG¦b«Ø¥ßÃa­y¸ê ®ÆÀɮɵo¥Í¤F°ÝÃD¡A±z·|»Ý­n³]©w¤@­Ó¸û¤jªººÏºÐ geometry - ³oªí¥Ü±z »Ý­n­«¶}¾÷¡AµM«á¥þ³¡¦A­«·s¶}©l¡]¥]¬A­«·s¤À³Î¥H¤Î¦b DOS ¤U­«·s format¡^¡C ¦pªG remapping ªº¥\¯à¤w¸g±Ò°Ê¤F¡A¦Ó±z¨ÌµM¤@ª½¬Ý¨ìÃa­y²£¥Í¡A ¨º»ò¦Ò¼{´«¤@¥xµwºÐ§a¡CÃa­yªº±¡§Î¥u·|ÀH®É¶¡¼W¥[¦Ó§ó¬°ÄY­«¡C ¬°¤°»ò FreeBSD §ì¤£¨ì HP Netserver ªº SCSI ±±¨î¥d¡H °ò¥»¤W³o­Ó¬O¤@­Ó¤wª¾ªº°ÝÃD¡C¦b HP Netserver ¾÷¾¹¤Wªº on-board EISA ¤¶­± SCSI ±±¨î¥d¥e¾Ú¤F©w§}¬°²Ä 11 ªº EISA ¼Ñ¡A¦]¦¹©Ò¦³ªº ¯u¹ê EISA ¼Ñ³£¦b¥¦¤§«e¡C¥i¬O¡A¦b EISA ©w§}ªÅ¶¡ >= 10 ®É¡A·|»P«ü©wµ¹ PCI ¥Îªº©w§}ªÅ¶¡¬Û½Ä¬ð¡A¥B FreeBSD ªº auto-configuration µLªk¥¿½Tªº³B²z³o­Ó±¡§Î¡C ¦]¦¹¡A²{¦b§A¯à°µªº³Ì¦n¨Æ±¡´N¬O¦b kernel ùس]©w EISA_SLOTS ³o­Ó¿ï¶µ¬° 12 ¡AµM«á·í§@¨S¦³³o­Ó °ÝÃD :)¡C½Ð¨Ì·Ó Handbook ¤¤¦³Ãö kernel ªº³]©w ùØ©Ò»¡ªº¤èªk¨Ó³]©w»P½sĶ ±zªº kernel¡C ·íµM¡A¦b¦w¸Ë FreeBSD ¨ì³oºØ¾÷¾¹¤W®É¡A³o¬O¤@­ÓÂû¥Í³J³J¥ÍÂûªº °ÝÃD¡C¬°¤F¸Ñ¨M³o­Ó°ÝÃD¡A¦b UserConfig ¤¤¦³ ¤@­Ó¯S§Oªº¤èªk¡A¦w¸Ë®É¤£­n¶i¤J visual ¤¶­±¡A¬Û¤Ï ªº¡A¦b©R¥O¦C¼Ò¦¡¤¤¡AÁä¤J eisa 12 quit µM«á´N¦p¥H©¹¤@¼Ë¦w¸Ë±zªº¨t²Î¡C¤£¹L§Ú­Ì«Øij±z½sĶ»P¦w¸Ë¤@­Ó ÄÝ©ó¦Û¤vªº kernel¡A¦ý §Æ±æ¦b¥¼¨Óªºª©¥»¤¤¯à¹ï³o­Ó°ÝÃD¦³¤@­Ó¦nªº¸Ñ¨M¤èªk¡C ±zµLªk¦b HP Netserver ¤W¨Ï¥Î dangerously dedicated ºÏºÐ¼Ò¦¡¡C±z¥i¥H°Ñ¦Ò ³o¥÷µù¸Ñ ¥HÀò±o§ó¦h¸ê°T¡C ¤@ª½¬Ý¨ìÃþ¦ü ed1: timeout ªº°T®§¡C¥¦­Ì¬O¤°»ò·N«ä©O¡H - ³o­Ó³q±`¬O¥Ñ©ó¤¤Â_½Ä¬ð¡]interrupt conflict¡^©Ò³y¦¨ªº¡]¨Ò¦p¡A - ¨â¶ô¥d¨Ï¥Î¨ì¤F¬Û¦Pªº IRQ¡^¡C FreeBSD ¦b 2.0.5 ª©¥H«e³£®e³\³o­Ó - ±¡§Î¡A´Nºâ¦³ IRQ ½Ä¬ð±¡§Î¡Aºô¸ô¥d¤]À³¸Ó¤´¥i¥¿±`¹B§@¡CµM¦Ó¡A¦b - 2.0.5 ª©¤Î¨ä¥H«á¡A¤w¤£¦A®e³\¦³ IRQ ½Ä¬ðªº±¡§Î¤F¡C½Ð©ó¶}¾÷®É¨Ï - ¥Î -c ³o­Ó¿ï¶µ¡AµM«á§ó§ï ed0/de0/..¡Cµ¥ªº³]©w¡A¨Ï¨ä©M±zºô¸ô¥d - ¥»¨­ªº³]©w¤@­P¡C + ³o­Ó³q±`¬O¥Ñ©ó¤¤Â_½Ä¬ð(interrupt conflict)©Ò³y¦¨ªº + (¨Ò¦p¡G¨â¶ô¥d¨Ï¥Î¨ì¤F¬Û¦Pªº IRQ)¡C FreeBSD ¦b 2.0.5 ª©¥H«e³£®e³\³o­Ó±¡§Î¡A + ´Nºâ¦³ IRQ ½Ä¬ð±¡§Î¡Aºô¸ô¥d¤]À³¸Ó¤´¥i¥¿±`¹B§@¡CµM¦Ó¡A¦b 2.0.5 ª©¤Î¨ä¥H«á¡A + ¤w¤£¦A®e³\¦³ IRQ ½Ä¬ðªº±¡§Î¤F¡C½Ð©ó¶}¾÷®É¨Ï¥Î -c ³o­Ó¿ï¶µ¡A + µM«á§ó§ï ed0/de0/..µ¥ªº³]©w¡A¨Ï¨ä©M±zºô¸ô¥d¥»¨­ªº³]©w¤@­P¡C - ¦pªG±z¬O¨Ï¥Î±zºô¸ô¥d¤Wªº BNC ±µÀY¡A±z©Î³\¤]·|¦]¤£¨}ªº²×ºÝ¹q - ªý³]©w¡A¦Óµo¥Í¸Ë¸m (device) timeout ªº±¡§Î¡C­nÀˬd¬O§_¦³³oºØ±¡ - §Î¡A±z¥i¥H¦bºô¸ô¥d¤Wª½±µ±µ¤W²×ºÝ¹qªý¡]¤£­n±µºô¸ô½u¡^¡AµM«á¬Ý¬Ý³o - ­Ó¿ù»~°T®§¬O¤£¬O´N®ø¥¢¤F¡C + ¦pªG±z¬O¨Ï¥Î±zºô¸ô¥d¤Wªº BNC ±µÀY¡A±z©Î³\¤]·|¦]¤£¨}ªº²×ºÝ¹qªý³]©w¡A + ¦Óµo¥Í¸Ë¸m(device) timeout ªº±¡§Î¡C­nÀˬd¬O§_¦³³oºØ±¡§Î¡A + ±z¥i¥H¦bºô¸ô¥d¤Wª½±µ±µ¤W²×ºÝ¹qªý(¤£­n±µºô¸ô½u)¡A + µM«á¡A¬Ý¬Ý³o­Ó¿ù»~°T®§¬O¤£¬O´N®ø¥¢¤F¡C - ¦³¨Ç NE2000 ªº¬Û®e¥d¡A¦pªG¥¦ªº UTP °ð¨S¦³±µºô¸ô½u¡A©Î¬O¸Óºô - ¸ô½u¨Ã¨S³Q¨Ï¥Îªº¸Ü¡A¤]·|¥X²{³o­Ó¿ù»~°T®§¡C + ¦³¨Ç NE2000 ªº¬Û®e¥d¡A¦pªG¥¦ªº UTP °ð¨S¦³±µºô¸ô½u¡A + ©Î¬O¸Óºô¸ô½u¨Ã¨S³Q¨Ï¥Îªº¸Ü¡A¤]·|¥X²{³o­Ó¿ù»~°T®§¡C - &tm.3com; 3C509 ºô¸ô¥d¦b¨S¦³¥ô¦ó©úÅã­ì¦]¤U°±¤î¤u§@ - ¤F©O¡H + &tm.3com; 3C509 ºô¸ô¥d²ö¦W¨ä§®½}¤u¡H ³o¶ô¥d¦³­Ó¤£¦nªº¦a¤è¦b©ó¥¦±`±`·|¿ò¥¢¥»¨­ªº³]©w¸ê®Æ¡C½Ð¨Ï¥Î¸Ó ¥dªº DOS ¤u¨ã 3c5x9.exe ¨Ó§ó·s¥d¤W³]©w¡C - ¥­¦æ°ð¦Lªí³t«×¯}¤Ñ¯îªººC¡A§Ú¸Ó«ç»ò°µ¡H + ¥­¦æ°ð¦Lªí³t«×¯}¤Ñ¯îªººC¡A¸Ó«ç»ò¿ì¡H ¦pªG°ß¤@ªº°ÝÃD´N¬O³t«×«ÜºCªº¸Ü¡A¸ÕµÛ§ïÅܱzªº ¦Lªí¾÷³s±µ°ð³]©w ³o­Ó¦b¤â¥U¤¤ªº ¦Lªí¾÷³]©w ³o­Ó³¹¸`¦³¥[¥H°Q½×¡C - µ{¦¡¦³®É·|¦] - Signal 11 ³o­Ó¿ù»~¦Ó°±¤î¡H + µ{¦¡¦³®É·|¦] Signal 11 ¿ù»~¦Ó°±¤î¡H Signal 11 ³o­Ó¿ù»~¬O¦]¬°§Aªº process ¹Á¸Õ­n¦s¨ú¤@¶ô°O¾ÐÅé¡A ¦Ó§Aªº§@·~¨t²Î¨Ã¤£¤¹³\¥¦°µ³o­Ó°Ê§@¦Óµo¥Íªº¡C¦pªG³oºØ±¡§Î±`±`¤£ ©w®Éµo¥Í¡A¨º»ò§AÀ³¸Ó­n¶}©l¬Ý¬Ý¬O¤£¬O­þ¸Ì¥X°ÝÃD¤F¡C ³o¨Ç°ÝÃD¥i¯à¬O»P¤U¦C±¡§Î¦³Ãö¡G ¦pªG³o­Ó°ÝÃD¥u¦b¬Y¤@­Ó±z¦Û¤v¼gªº¬Y­Ó¯S©wµ{¦¡µo¥Í¡A¨º »ò«Ü¦³¥i¯à¬O±zªºµ{¦¡½X¦³°ÝÃD¡C ¦pªG³o­Ó°ÝÃD¬O¦b FreeBSD ªº¬Y¨Ç¨t²ÎÀÉ®×µo¥Í¡A¦³¥i¯à¬O ¦]¬°µ{¦¡¦³°ÝÃD¡A¦ý³q±`¦b§Ú­Ì³o¸sŪ FAQ ªº¨Ï¥ÎªÌ¥h¶]³o¨Ç¦³ °ÝÃDªºµ{¦¡½X«e¡A¥¦­Ì¦­´N´N¤w¸g³Q¸Ñ¨M¤F¡]³o¬O -current ¦b°µ ªº¨Æ¡^¡C ¤×¨ä¦pªG§A¦b½sĶ¤@­Óµ{¦¡¡A¦ý¬O¨C¦¸½sĶ¾¹¶]¥X¨Óªºµ²ªG³£¤£¤@¼Ë - ªº¸Ü¡A³o¬O¤@­ÓµL¸Ñªº°ÝÃD¡A¦Ó¤£¬O - FreeBSD ¯äÂΡC + ªº¸Ü¡A³o¬O¤@­ÓµL¸Ñªº°ÝÃD¡A¦Ó¤£¬O FreeBSD ¯äÂΡC Á|¨Ò¨Ó»¡¡A°²³]±z¥¿¦b¶] make buildworld¡A ¦Ó compiler ¦b±N ls.c ½sĶ¦¨ ls.o ®Éµo¥Í¿ù»~¡A³o®É½Ð¦A¶]¤@¦¸ make buildworld¡A¦pªG compiler ¨ÌµM¦b¦P¼Ëªº¦a¤èµo ¥Í°ÝÃD¡A¨º»ò´N¬Oµ{¦¡½X¦³°ÝÃD¡Ð¡Ð½Ð§ó·s­ì©l½XµM«á¦A¸Õ¸Õ¬Ý¡C¦Ó¦pªG compiler ¬O¦b¨ä¥Lªº¦a¤èµo¥Í¿ù»~¡A¨º»ò´X¥G¥i¥H½T©w¬OµwÅ骺°ÝÃD¤F¡C ±z³o®ÉÀ³¸Ó°µ¤°»ò¡G ¦pªG¬O²Ä¤@ºØ±¡§Î¡A¥i¥H¨Ï¥Î¤@¨Ç debugger¡A¦p¡Ggdb¡A¨Ó§ä¥Xµ{¦¡ ¬O¦b¨º¨à·|¥h¹Á¸Õ¦s¨ú¿ù»~ªº°O¾ÐÅé¦ì§}¡AµM«á¦A­×¥¿¥¦¡C ¦pªG¬O²Ä¤GºØ±¡§Î¡A´N»Ý­nÀˬd¬Ý¬Ý¬O¤£¬OµwÅ骺°ÝÃD¤F¡C ¤@¨Ç³y¦¨µwÅ餣íªº­ì¦]¥]¬A¡G ¥i¯à¬OµwºÐ¹L¼ö¡G½ÐÀˬd¾÷´ß¤ºªº­·®°¬O§_¹B§@¥¿±`¡A¦]¬°±z ªºµwºÐ¡]©ÎªÌÁÙ¦³¨ä¥LªºµwÅé¸Ë¸m¡^¹L¼ö¤F¡C ³B²z¾¹¹L¼ö¡G³o­Ó¦³¥i¯à¬O¦]¬°¶WÀW¡A©ÎªÌ¬O³B²z¾¹ªº­·®°±¾¤F¡C ¤£½×¬O­þºØ­ì¦]¡A±z³£»Ý­n±N©Ò¦³ªº¤¸¥ó¦^´_¨ì¥¦­Ì­ì¥ý³]©wªº¤u§@ª¬ ºA¡A³o¼Ë¤~¯à¸Ñ¨M³o­Ó°ÝÃD¡CÁ|­Ó¨Ò¤l¨Ó»¡¡G±N³B²z¾¹½Õ¦^­ì¥ýªº¤u§@ ÀW²v¡C ¦pªG±zÁÙ¬O°í«ù­n¶WÀWªº¸Ü¡A½ÐÂÔ°O¡A»P¨ä¿NÃa¦Ó»Ý­n´«·sªº¤@¥x ¥D¾÷¡A¤£¦p±N³t«×½ÕºC¤@ÂI¡I°£¦¹¤§¥~¡A¤£ºÞ§Aı±o¥¦¦w¤£¦w¥þ¡A¤@¯ë ¤H¹ï©ó±z¦]¬°¶WÀW¦Óµo¥Íªº°ÝÃD¡A¬O¤£·|¦³¤°»ò¦P±¡¤ßªº¡C ¤£Ã­©wªº°O¾ÐÅé¡G¦pªG¥D¾÷¤W¦³¦w¸Ë¼Æ®Ú SIMM/DIMM °O¾ÐÅé¡A ¸ÕµÛ§â¥¦­Ì¥þ©î¤U¨Ó¡AµM«á¤@®Ú¤@®Ú´¡¤W¥h°µ´ú¸Õ¡AÂǦ¹ÁY¤p½d³ò¡A ¥H«K§ä¥X¦³°ÝÃDªº¬Y®Ú°O¾ÐÅé©Î¬O¬YºØ°O¾ÐÅé²Õ¦X¡C ³Ì¨Î¤Æ¹LÀYªº¥D¾÷ªO³]©w¡G¦b BIOS ùةάO¦³¨Ç¥D¾÷ªOªº jumper ¤W¡A¦³®É¥i¥H§ó§ï¤@¨Ç timing¡A¦ý¦b¤j¦h¼Æªº±¡§ÎùØ¡A¨Ï¥Î¹w³]­È´N ¤w¸g¨¬°÷¤F¡Cªp¥B¦³®É­Ô§â RAM ªº wait states ³]¤Ó¤p¡A©Î¬O¦b BIOS ùØ¡A§â RAM Speed: Turbo ³o­Ó©Î¬O¨ä¥LÃþ¦ü ªº¿ï¶µ¥´¶}³£¦³¥i¯à·|³y¦¨¤@¨Ç¤£¥¿±`ªº²{¶H¡C¤@­Ó¸Ñ¨Mªº¤èªk¬O§â BIOS ³]¦^¹w³]­È¡A¤£¹L¦b³o¤§«e°O±o¥ý°O¤U¥Ø«eªº³]©w¡I ¨Ñµ¹¥D¾÷ªOªº¹q¤O¤£°®²b©Î¬O¤£¨¬¡C¸ÕµÛ§â¨t²Î¤º¨S¦³¥Î¨ìªº I/O ¥d¡DµwºÐ©Î¬O CDROM ¼È®É©î±¼©Î¬O©Þ±¼¹q·½½u¡A¬Ý¬Ý§Aªº¹q·½ ¨ÑÀ³¾¹¬O¤£¬O¯à°÷¦b¤p¤@ÂIªº­t²ü¤U¥¿±`¤u§@¡C¤£µM´N¬O´«¤W¥t¤@ ­Ó·sªº¹q·½¨ÑÀ³¾¹¡A³Ì¦n¬O¥Ë¼Æ°ª¤@ÂIªº¡]¥´­Ó¤ñ¤è¨Ó»¡¡A¦pªG­ì ¥ýªº¹q·½¨ÑÀ³¾¹¬O 250 ¥Ëªº¡A¨º»ò´N´«¤W 300 ¥Ëªº¸Õ¸Õ¡^¡C ½Ð¶¶«K°Ñ¾\ SIG11 FAQ¡]³sµ²¦b¤U­±¡^¡AÁöµM¥¦¬O¯¸¦b Linux ªº¨¤ «×¼gªº¡A¥i¬O¸Ì­±¹ï³o¨Ç°ÝÃD¦³³\¦h«Ü´Îªº¸Ñ»¡¡C¥¦¸Ì­±¤]¦³°Q½×¬°¤°»ò ¦³°ÝÃDªº°O¾ÐÅé¯à³q¹L³nÅé©ÎµwÅ骺´ú¸Õªº­ì¦]¡C ³Ì«á¡A¦pªG¤W­±³o¨Ç­ì¦]³£±Æ°£¤F¡A¨º»ò¦³¥i¯à¬O¹J¨ì¤F FreeBSD ùتº¤@°¦¯äÂΡA½Ð°Ñ¾\«ü¥Ü°µ¤@­Ó°ÝÃD¦^³ø¡C ³o¨à¦³¤@­Ó§ó¸Ô²Óªº FAQ ¡Ð the SIG11 problem FAQ - ·í¾÷®É¥X²{¡GFatal - trap 12: page fault in kernel mode¡A©Î¬O - panic:¦A¥[¤W¤@°ï¿ù»~°T®§¡A - ¸Ó«ç»ò¿ì¡H + ·í¾÷®É¥X²{¡GFatal trap 12: page fault in kernel mode + ¡A©Î¬O panic: ¥H¤Î¤@°ï¿ù»~°T®§¡A¸Ó«ç»ò¿ì¡H FreeBSD ªº¶}µoªÌ¹ï©ó³o¨Ç¿ù»~°T®§¬Û·íªº¦³¿³½ì¡A¦ý¬O¥L­Ì»Ý­n §ó¸Ô²Óªº¤@¨Ç²Ó¸`¡C½Ð§â±zªº·í¾÷ªº°T®§¥þ³¡½Æ»s¤U¨Ó¡A±µµÛ¬d¾\ FAQ ùØ kernel panics ³o¸`¡A¨Ì»¡©ú½sĶ¤@­Ó§t°£¿ù½Xªº kernel¡A¥H¨ú±o¨ç¦¡ ©I¥s¶¶§Ç¡]backtrace¡^¡C³o­ÓÅ¥°_¨Ó«ÜÃø¡A¦ý¹ê»Ú¤W¨Ã¤£»Ý­n¥ô¦óµ{¦¡ ³]­pªº¯à¤O¡A±z¥u»Ý­n¨Ì·Ó«ü¥Ü°µ§Y¥i¡C ¬°¤°»ò·í§Ú¶}¾÷®É¡A¿Ã¹õÅܶ¡A¥B¤£°±°{°Ê¡H ³o­Ó°ÝÃD¡A¤wª¾¬O¥Ñ ATI Mach 64 Åã¥Ü¥d©Ò¤Þ°_ªº¡C¦]¬°³o¶ô¥d ¨Ï¥Î¨ì 2e8 ³o­Ó¦ì§}¡A¦Ó³o»P²Ä¥|­Ó§Ç¦C°ð ¡]serial port¡^©Ò¨Ï¥Îªº¦ì§}¬Û¦P¡C¦Ó¦b &man.sio.4; ³o­ÓÅX°Ê µ{¦¡ùØ¡A¤£ª¾¹D¬O bug ©Î¬O¥\¯à¡]feature¡^¡A´Nºâ±z¨S¦³²Ä¥|­Ó§Ç ¦C°ð¡A©Î¬O¤w¸g±N sio3¡]²Ä¥|­Ó§Ç¦C°ð¡^¨ú®ø¤F¡A¥¦ ¨ÌµM·|¥h¹Á¸ÕÅX°Ê¥¦¡C ª½¨ì³o­Ó°ÝÃD³Q¸Ñ¨M¥H«e¡A±z¥i¥H¨Ï¥Î³o­Ó¤èªk¡G ¦b¬Ý¨ì¶}¾÷´£¥Ü®É¿é¤J ¡]³o·|Åý kernel ¶i¤J³]©w¼Ò¦¡¡^¡C ¨ú®ø sio0 ¡A sio1 ¡A sio2 ©M sio3¡]¥þ³¡¡^¡C ³o¥i¥HÅý sio ÅX°Êµ{¦¡¤£°Ê§@ -> ©ó¬O°ÝÃD¸Ñ¨M¡C ¿é¤J exit ¥HÄ~Äò±Ò°Êµ{§Ç¡C ¦pªG±z·Q­n¨Ï¥Î±zªº§Ç¦C°ð¡A±z»Ý­n­×§ï /usr/src/sys/i386/isa/sio.c¡A¦b¸ÓÀɤ¤§ä¥X 0x2e8 ³o­Ó¦r¦ê¡A²¾°£³o­Ó¦r¦ê¤Î¥¦«e­±ªº³r¸¹ ¡]«O¯d«á­±ªº¡^¡AµM«á­«·s½sĶ¤@­Ó·sªº kernel¡C ´Nºâ¨Ï¥Î¤F¤W­±³o¨Ç¤èªk¡AX Window ¤´µM¦³¥i¯àµLªk¶¶§Q°õ¦æ¡C ¦pªGµo¥Í¤F³oºØ±¡§Î¡A½Ð½T©w§A¥Îªº XFree86 ªºª©¥»¬O³Ì·sªº XFree86 3.3.3 ©Î¬O¨ä«áªºª©¥»¡C¥¦­Ì¦³¤º«Ø¤ä´© Mach 64 ³o±i¥d¡A¬Æ¦Ü¬°¤F³o ¨Ç¥dÁÙªþ¦³¤@­Ó¯S§Oªº X Server ¬°¤°»ò§Úªº¨t²Î¸Ë¦³ 128 MB ªº RAM¡A¦Ó FreeBSD ¥u¥Î¤F¨ä¤¤ªº 64MB¡H ¦]¬° FreeBSD ¬O¨Ï¥Î©I¥s BIOS ¨Ó¨ú±o°O¾ÐÅé¤j¤pªº¤èªk¡A¦]¦¹¥¦ ¥u¯à°»´ú¨ì 16 bits ¦ì¤¸ªø«×ªº KByte ¤j¤p¡]65535 KBytes = 64MB¡^ ¡]©ÎªÌ§ó¤Ö..¡C¦³¨Ç BIOS ±N³Ì°ª°O¾ÐÅé¤j¤p­­¬°¥u¦³ 16MB¡^ ¦pªG±z¾Ö¦³ 64MB ¥H¤Wªº RAM¡AFreeBSD ·|¹Á¸Õ¥h°»´ú¥X¥¦¡A¦ý¬O¦³¥i¯à ·|¥¢±Ñ¡C ­n¸Ñ¨M³o­Ó°ÝÃD¡A±z»Ý­n¨Ï¥Î¤U­±©Ò´£ªº kernel ³]©w¿ï¶µ¡CÁöµM¦³ ¤èªk¥i¥H±q BIOS ¤¤¨ú±o°O¾ÐÅ骺§¹¾ã¸ê°T¡A¦ý¬O¥Ø«e§Ú­Ì¦b¶}¾÷°Ï¤¤¨Ã ¨S¦³¦h¾lªºªÅ¶¡¨Ó°µ³o¥ó¨Æ¡C·í¬Y¤Ñ¶}¾÷°ÏªÅ¶¡¤£¨¬ªº±¡§ÎÀò±o¸Ñ¨M®É¡A §Ú­Ì±N·|¨Ï¥Î BIOS ªº©µ¦ù¥\¯à¨Ó¨ú±o°O¾ÐÅ骺§¹¾ã¸ê°T...¦ý²{¦b§Ú­Ì ±N¥¦©ñ¦b kernel ³]©w¿ï¶µ¤¤¡C options "MAXMEM=n" n ¬O«ü±zªº°O¾ÐÅé¤j¤p¡A¥H KB ¬°³æ¦ì¡C¥H¤@¥x¦³ 128MB RAM ªº¾÷¾¹¨Ó»¡¡A±z¥i¨Ï¥Î 131072³o­Ó¼Æ¦r¡C ¾÷¾¹¤Wªº RAM ¦³ 1GB ¥H¤W¡A¥i¬O¬°¦ó«o¦¬¨ì kmem_map too small ªº panic ¿ù»~°T®§¡H ³q±` FreeBSD ·|¨Ì¾Ú¾÷¾¹ª¬ªp¨Ó¦Û°Ê½Õ¾ã kernel ¬ÛÃö°Ñ¼Æ³]©w¡A¤ñ¦p¡G ®Ú¾Ú¾÷¾¹©Ò¸Ëªº RAM ¤j¤p¨Ó¨M©w¦P®É¥i¶}±ÒªºÀɮ׼ƶq¦h¹è¡C µM¦Ó¡A¦b 1GB RAM(§t¥H¤W) ªº¾÷¾¹¤W¡A³o­Ó¡y¦Û°Ê½Õ¾ã¡zªº¾÷¨î¥i¯à¦³®É·|°ª¦ô¡G ¤ñ¤è»¡..¶}¾÷®É¡Akernel ·|¥ý°t¸m¦UºØ¤£¦P¥Î³~ªºªí®æ¤Î¨ä¥L¬[ºc©ñ¨ì°O¾ÐÅé¤W¡A µM«á¡A·í¾ã­Ó§@·~¨t²Î³£¶}©l¹B§@¤§«á¡Akernel ´N·|¶}©l¤£°÷ªÅ¶¡¨Ó°µ°O¾ÐÅé°t¸mªº°ÊºA½Õ¾ã¡A ©ó¬O´N panic ±¾¤F¡C ¸Ñªk¬O¡G§â ¥[¨ì kernel ³]©wÀɤº¡A ¨Ã­«·s½sĶ kernel¡A¤ñ¦p¡G ³o¼Ë·|³]©w 400 MB ¨Óµ¹ kernel ¨Ï¥Î¡A¦Ó¥B±Ä¥Î 400 MB ªº¸Ü¡A ¥Ø«e¦b 6GB RAM ªº¾÷¾¹¤W³£¥i³Q¦³®Ä¹B¥Î¡C ¾÷¾¹¤W RAM ¤£¨ì 1GB ¡A¦ý¤´·|¥X²{ kmem_map too small! ªº panic ¿ù»~°T®§ ¤§©Ò¥H panic ªº­ì¦]¦b©ó¨t²Î¥Î¥ú¤Fµ¹ network buffer ¥Î³~ªº virtual memory (¤×¨ä¬O mbuf clusters)¡C¸Ñªk¬O¼W¥[µ¹ mbuf clusters ¥Îªº virtual memory ¼Æ¶q¡A³o¨BÆJ½Ð°Ñ¾\ FreeBSD ¨Ï¥Î¤â¥Uªº ºô¸ô­­¨î½g ¡C ¬°¤°»ò§Ú¤@ª½¬Ý¨ì /kernel: proc: table is full ³o­Ó¿ù»~°T®§¡H FreeBSD kernel ¥u¤¹³\¤@©w¼Æ¶qªº process ¦b¦P¤@®É¶¡¸Ì¦P ®É¹B§@¡C¦Ó³o­Ó¼Æ¥Ø¬O®Ú¾Ú kernel ³]©wÀɸ̭±ªº MAXUSERS ­È¨Ó¨M©wªº¡CMAXUSERS ³o­Ó­È¤]·|¼vÅT¨ä¥Lªº kernel ¤º©w­È¡A¤ñ¦p»¡ network buffer (½Ð°Ñ¾\³o­Ó¤§«e°Q ½×¹Lªº°ÝÃD)¡C¦pªG¾÷¾¹­t²ü(load)«Ü­«¡A±z¥i¯à»Ý­n¼W¥[ MAXUSERS ³o­Ó­È¡C³o»ò§@·|¤@¨Ö´£°ª¨t²Îªº¨ä¥L¤º ©w­È¡A¥]¬A³Ì¤j¥i¾Ö¦³ªº process ¼Æµ¥¡C ­Y­n½Õ¾ã MAXUSERS¡A½Ð°Ñ¾\ FreeBSD ¨Ï¥Î¤â¥U¤¤ªº ÀÉ®×/Processªº­­¨î ³¹¸`¡C (ÁöµM¸Ó³B«üªº¬O¡yÀɮתº¶}±Ò¼Æ¶q­­¨î¡z¡A¦ý¤]¾A¥Î©ó process³¡¤À¡C) ¦b FreeBSD 4.4 ¤§«á¡AMAXUSERS ¤w¸gÅܦ¨¥i ¥H¾aµÛ§ó§ï /boot/loader.conf ùتº kern.maxusers ³o­Ó­È¦Ó½Õ¾ãªºÅܼƤF¡C¦Ó¦b¤§«e ªº FreeBSD ª©¥»¤¤¡A³o­Ó­È¥u¯à¦b kernel ³]©wÀÉùؽվã¡C ¦pªG¾÷¾¹­t²ü¨Ã¤£­«¡A¦Ó±z¥u¬O»Ý­n¦P®É¶]«Ü¦h«Ü¦h process¡A ¨º»ò¤]¥i¥Hª½±µ¥Î sysctl ½Õ¾ã kern.maxproc ­È¡C °²¦p³o¨Ç process ³£¬OÄÝ©ó¬Y­Ó¨Ï¥ÎªÌªº¡A¨º»ò±zÁٻݭn¥t ¥~½Õ¾ã kern.maxprocperuid ³o­Ó­È¡A¨Ï¥¦¤ñ·s ªº kern.maxproc ³o­Ó­È¤Ö 1 (¤@©w­n¤Ö 1 ¡A ¦]¬° &man.init.8; ³o­Ó¨t²Îµ{¦¡µ´¹ï­n«O«ù¦b¹B§@ª¬ºA)¡C ¦pªG·Q¦b¨C¦¸¶}¾÷³£­n§ó§ï sysctl ªº­È¡A¦Ó¥B±zªº FreeBSD ¬O ³Ìªñªºª©¥»ªº¸Ü¡A½Ð¦b /etc/sysctl.conf ³o ­ÓÀɤ¤³]©w¡A¦Ó¦pªG¬Oªºª©¥»¡A¥i¥H¦b /etc/rc.local ¤¤§@³]©w¡C ¬°¤°»ò¥Î·s kernel ¶}¾÷®É¡A¥X²{ CMAP busy ³o­Ó¿ù»~°T®§¡H - ¥Î¨Ó°»´ú¹L®É - /var/db/kvm_*.db Àɮתº¾÷¨î°¸º¸·| - µo¥Í°ÝÃD¡A¦Ó¨Ï¥Î¨ì¤F¤@­Ó¤£¨ó½Õ¡]mismatch¡^ªºÀɮצ³®É´N·|¾É­P - panic¡C + ¥Î¨Ó°»´ú /var/db/kvm_*.db ¹L®ÉÀɮתº¾÷¨î°¸º¸·|µo¥Í°ÝÃD¡A¦Ó¨Ï¥Î¨ì¤F¤@­Ó¤£¨ó½Õ + (mismatch)ªºÀɮצ³®É´N·|¾É­P panic¡C - ¦pªGµo¥Í¤F³o­Ó°ÝÃD¡A½Ð­«·s¶}¾÷¡A¶i¤J³æ¨Ï¥ÎªÌ¼Ò¦¡¡AµM«á°õ - ¦æ¡G + ¦pªGµo¥Í¤F³o­Ó°ÝÃD¡A½Ð­«·s¶}¾÷¡A¶i¤J single ¨Ï¥ÎªÌ¼Ò¦¡¡AµM«á°õ¦æ¡G &prompt.root; rm /var/db/kvm_*.db - ½Ð°Ý³o­Ó°T®§¡Gahc0: brkadrint, - Illegal Host Access at seqaddr 0x0 + ½Ð°Ý³o­Ó°T®§¡Gahc0: brkadrint, Illegal Host Access at seqaddr 0x0 ¬O¤°»ò·N«ä¡H ³o¬O¤@­Ó©M Ultrastor SCSI ±±¨î¥d¦³Ãöªº½Ä¬ð¡]conflict¡^¡C ¦b¶}¾÷®É¡A¶i¤J kernel ³]©w¿ï³æ¨ú®ø uha0¡A¥¦¬O³y¦¨³o­Ó°ÝÃDªº­ì¦]¡C - ¦b¶}¾÷®É¡A§Ú¬Ý¨ì³o­Ó¿ù»~°T®§ - ahc0: illegal cable configuration¡C + ¶}¾÷®É¡A¬Ý¨ì³o­Ó¿ù»~°T®§ ahc0: illegal cable configuration¡C §Úªº±Æ½u½T©w¦³±µ¹ï¡C ¬O¥X¤F¤°»ò°ÝÃD©O¡H ±zªº¥D¾÷ªO¥i¯à¤£¤ä´©¦Û°Ê²×ºÝ¹qªý³]©w¡C½Ð¶i¨ì SCSI ªº BIOS - ¸Ì­±¤â°Ê«ü©w¥¿½Tªº²×ºÝ¹qªý¶¶§Ç¡A¦Ó¤£­n¨Ï¥Î¦Û°Ê³]©w¡CAIC7XXX ªº - ÅX°Êµ{¦¡¨ÃµLªkª¾¹D¦³¨S¦³³o¨Ç±Æ½u°»´ú¡]¥H¤Î¦Û°Ê²×ºÝ¹qªý³]©w¡^ªº - ¹q¸ô¡]external logic¡^¦s¦b¡C¦pªG EEPROM ¸Ì­±ªº³]©w¬O - "automatic termination" ®É¡A¥¦¥u·|³æ¯Â°²©w³o¨Ç¹q¸ô·íµM¬O¦s¦bªº¡C - ­Y¯Ê¤Ö¤F³o­Ó¹q¸ô¡AÅX°Êµ{¦¡¦b³]©w²×ºÝ¹qªý®É´N±`±`¥X°ÝÃD¡C + ¸Ì­±¤â°Ê«ü©w¥¿½Tªº²×ºÝ¹qªý¶¶§Ç¡A¦Ó¤£­n¨Ï¥Î¦Û°Ê³]©w¡C + AIC7XXX ªºÅX°Êµ{¦¡¨ÃµLªkª¾¹D¦³¨S¦³³o¨Ç±Æ½u°»´ú(¥H¤Î¦Û°Ê²×ºÝ¹qªý³]©w)ªº¹q¸ô(external logic) + ¦s¦b¡C¦pªG EEPROM ¸Ì­±ªº³]©w¬O "automatic termination" ®É¡A¥¦¥u·|³æ¯Â°²©w³o¨Ç¹q¸ô·íµM¬O¦s¦bªº¡C + ­Y¯Ê¤Ö¤F³o­Ó¹q¸ô¡AÅX°Êµ{¦¡¦b³]©w²×ºÝ¹qªý®É´N±`±`¥X°ÝÃD¡C ¦Ó³oºØ°ÝÃD±N¾É­P SCSI ¶×¬y±Æªº¥i¾a©Ê­°§C¡C ¬°¤°»ò Sendmail ¤@ª½¥X²{ mail loops back to myself ³o­Ó¿ù»~°T®§¡H ³o­Ó°ÝÃD¦b sendmail ªº FAQ ¤¤¬O³o¼Ë¦^µªªº:- * §Ú¤@ª½¦¬¨ì¦³Ãö "Local configuration error" ªº«H¥ó¡A¨Ò¦p¡G 553 relay.domain.net config error: mail loops back to myself 554 <user@domain.net>... Local configuration error §Ú­n¦p¦ó¸Ñ¨M³o­Ó°ÝÃD¡H ±z§Q¥Î MX ³]©w¡AÅý­n±H¨ì¬Y domain¡]¦p: domain.net¡^ªº«H¥ó¡A ±H¨ì±z©Ò«ü©wªº¾÷¾¹¡]¦b³o­Ó¨Ò¤l¤¤¬° relay.domain.net¡^¡A¦ý¬O³o ³¡¾÷¾¹¨Ã¥¼³Q³]©w±µ¨ü domain.net ªº«H¥ó¡C½Ð§â domain.net ¥[¨ì /etc/sendmail.cw ¤¤¡]¦pªG±z¦³¨Ï¥Î FEATURE(use_cw_file)) ©Î¬O ¦b sendmail.cf ¤¤¥[¤J "Cw domain.net" ³Ì·sª©¥»ªº sendmail FAQ ²{¦b¤w¤£¦AÀHµÛ sendmail ¥X³f¡C ¥¦¥Ø«e¬O³Q©w´Áªºµoªí¦b comp.mail.sendmail¡A comp.mail.misc¡Acomp.mail.smail¡Acomp.answers¡A©M news.answers. ±z¤]¥i¥H±H¤@«Ê Email ¨ì mail-server@rtfm.mit.edu¡AµM«á¦b«H¥ó¤º¤å ¤¤¼g¤W send usenet/news.answers/mail/sendmail-faq ¥H¨ú±o³o¥÷ FAQ ¤å¥ó¡C ¬°¤°»ò°õ¦æ»·ºÝ¾÷¾¹¡]remote machine¡^ªº¥þ¿Ã¹õªº³nÅé®É¡A ¦³¤£¥¿±`ªº±¡§Î¡H ©Î³\»·ºÝ¾÷¾¹¨Ã«D±N±zªº²×ºÝ¾÷¼Ò¦¡³]¬° FreeBSD console ©Ò¥Îªº cons25¡A¦Ó¬O³]¬°¨ä¥¦¼Ò¦¡¡C ³o¨à¦³´X­Ó¸Ñ¨M³o­Ó°ÝÃDªº¤èªk¡G ¦b logging ¶i»·ºÝ¾÷¾¹«á¡A§ó§ï±zªº shell ÅÜ¼Æ TERM ¬° ansi ©Î¬O sco ¡}¦pªG»·ºÝ¾÷¾¹¤ä´©³o¨Ç¼Ò¦¡ªº¸Ü¡^¡C ¨Ï¥Î¤ä´© VT100 ªº¼ÒÀÀ³nÅé¡A¦p FreeBSD console ¤Uªº screen ³nÅé¡C screen ´£¨Ñ±z¦b¤@­Ó terminal ùئP®É¶]¦n´X­Ó session ªº¯à¤O¡A¦Ó¥B¥¦¥»¨­¤]¬O¤@­Ó¬Û·í¦n ªº³nÅé¡C¨C­Ó screen ³£¹³¬O¤@­Ó VT100 ªº²×ºÝ¾÷¡A©Ò¥H»·ºÝ¾÷¾¹ªº TERM ÅܼÆÀ³¸Ó³]¬° vt100¡C ¦b»·ºÝ¾÷¾¹ªº²×ºÝ¾÷¸ê®Æ®w¡]terminal database¡^¤¤¥[¤J cons25 ªº¸ê®Æ¡C¥[¤Jªº¤èªkµø»·ºÝ¾÷¾¹ªº §@·~¨t²Î¤£¦P¦Ó¦³©Ò®t²§¡C½Ð°Ñ¾\»·ºÝ¾÷¾¹µ¹¨t²ÎºÞ²z­ûªº»¡©ú ®Ñ¡AÀ³¸Ó·|¦³©ÒÀ°§U¡C ±Ò°Ê FreeBSD ªº X ¦øªA¾¹¡AµM«á¨Ï¥Î¤@¨Ç X Window ¤Uªº ²×ºÝ¾÷¼ÒÀÀ¾¹¨Óµn¤J»·ºÝ¾÷¾¹¡A¨Ò¦p xterm ©Î rxvt¡C¦Ó»·ºÝ¾÷¾¹ªº TERM ÅܼÆÀ³¸Ó­n ³]¬° xterm ©Î vt100¡C ¬°¤°»ò§Úªº¾÷¾¹¤@ª½Åã¥Ü calcru: negative time...¡H ¸ò¤¤Â_¡]interrupt¡^¦³Ãöªº¤£¦PµwÅé »P/©Î ³nÅ骺·f°t³£¦³¥i¯à³y¦¨ ³o­Ó°ÝÃD¡C³o¦³¥i¯à¬O bug ©Î¬O¬Y­Ó¸Ë¸m¥»¨­ªº°ÝÃD¡C¦b¥­¦æ°ð¤W¨Ï¥Î ¤jªº MTU ¨Ó§@ TCP/IP ¶Ç¿é¥i¥H­«²{³o­Ó°ÝÃD¡C­Y¬O¹Ï§Î¥[³t¥d³y¦¨³o­Ó °ÝÃDªº¸Ü¡A±zÀ³¸Ó¥ýÀˬd¥dªº¤¤Â_³]©w¡C ³o­Ó°ÝÃDªºÃä»Ú®ÄÀ³¬O·|³y¦¨¦³¨Ç process ¥X²{ SIGXCPU exceeded cpu time limit ªº°T®§¡A¦Ó¤£¥¿±` °±¤î¡C ­Y¬O FreeBSD 3.0 ©Î¬O 1998 ¦~ 11 ¤ë 29 ¤é¥H«á¨ä¥Lª©¥»¡A¸U¤@ ³o­Ó°ÝÃD¤@ª½µLªk¥H¨ä¥L¤èªk¸Ñ¨M¡A´N¥u¯à³]©w sysctl ÅܼơG &prompt.root; sysctl -w kern.timecounter.method=1 ³o¼Ë·|¹ï®Ä¯à¦³¨Ç¼vÅT¡A¦ý¬O­Y¦Ò¼{¨ì³o­Ó°ÝÃD±a¨Óªº«áªG¡A³o¼Ë°µ ¬O­È±oªº¡C¦pªG³o­Ó°ÝÃDÁÙ¬O¦s¦bªº¸Ü¡AÅý sysctl ¨º­Ó­È¨ÌµM³]¬° 1¡A µM«á¼W¥[ kernel ³]©wÀɤ¤ NTIMECOUNTER ³o­Ó¿ï ¶µªº¼Æ­È¡C¦pªG±z±N NTIMECOUNTER ¼W¥[¨ì 20 ¨Ì µMµLªk¸Ñ¨M³o­Ó°ÝÃD¡A¨º»ò±z¾÷¾¹¤Wªº¤¤Â_¤w¸g¦h¨ìµLªkÅý­p¼Æ¾¹ºû«ù¦b ¥i¾aªºª¬ºA¤F¡C ¥X²{ pcm0 not found ³o­Ó°T®§¡A©ÎªÌ¬O §Úªº­µ®Ä¥dÅܦ¨¤F pcm1¡A¦ý¦b kernel ³]©w ÀÉùاڬO³] device pcm0 °Ú¡C³o¬O«ç»ò¦^¨Æ©O¡H ¦pªG±z¦b FreeBSD 3.x ¤W¨Ï¥Î PCI ­µ®Ä¥d´N·|µo¥Í³oºØ°ÝÃD¡C ¦]¬°pcm0 ³o­Ó device ¬O¤º©w«O¯dµ¹ ISA ªº­µ®Ä¥dªº¡A©Ò¥H¦pªG±z¦³¤@±i PCI ªº­µ®Ä¥d¡A±z´N·|¹J¨ì³o­Ó°ÝÃD¡A ¦Ó±zªº¥d·|Åܦ¨ pcm1¡C ¦pªG±z¥u§â kernel ³]©wÀɤ¤ªº³]©w§ï¦¨ device pcm1 ¬OµLªk°£¥h³o­Óĵ§i°T®§ªº¡A ³o¼Ë·|³y¦¨ pcm1 ³Q«O¯dµ¹ ISA ­µ®Ä¥d¡A ¦Ó PCI ­µ®Ä¥d«h·|Åܦ¨ pcm2 ¡]¥~¥[ pcm1 not found ªºÄµ§i°T®§¡^¡C ¦pªG±z¦³¤@±i PCI ªº­µ®Ä¥d¡A±z»Ý­n make snd1 ³o­Ó device¡A¦Ó¤£¬O snd0¡G &prompt.root; cd /dev &prompt.root; ./MAKEDEV snd1 ³o­Ó°ÝÃD¦b FreeBSD 4.x ¤W¨Ã¤£·|µo¥Í¡A¦]¬°«Ü¦h¤H§ë¤U¤F³\¦h¤ß ¤OÅý¥¦§óPnP ¾É¦V¡A¦Ó¥B pcm0 ³o­Ó device ¤]¤£¦A¬O¥u«O¯dµ¹ ISA ªº­µ®Ä¥d¤F¡C ¬°¤°»ò¦b§ó·s¨ì FreeBSD 4.X «á·|§ì¤£¨ì§Úªº PnP ¥d ¡]©ÎªÌ¬O§ì¦¨ unknown¡^¡H FreeBSD 4.X ²{¦b¤w¸g§ó PnP ¾É¦V¤F¡A ¦ÓÃä»Ú®ÄÀ³´N¬O·|µo¥Í¦³¨Ç¦b FreeBSD 3.X ¥i¥H¥Îªº PnP ¸Ë¸m ¡]¦p­µ®Ä¥d©Î¬O¤º´¡¦¡¼Æ¾Ú¾÷¡^Åܦ¨µLªk¨Ï¥Î¡C ³o­Ó­ì¦]¥i¥H¥Î¤@«Ê¥Ñ Peter Wemm µo¨ì freebsd-questions ³o­Ó mailing list ¤Wªº«H¨Ó¸ÑÄÀ¡A¥¦­ì¥»¬O¸ÑÄÀ¬°¤°»ò¦³¤@­Ó¤º ´¡¦¡¼Æ¾Ú¾÷¡A¦b¨t²Î¤É¯Å¨ì FreeBSD 4.x «á¡A´N¨Sªk³Q§ì¨ì¤F ¡]¦b [] ùتº¬O¥t¥~¥[ªºµù¸Ñ¡AÅý¤º®e§ó©öÀ´¡^¡C
The PNP bios preconfigured it [the modem] and left it laying around in port space¡Aso [in 3.x] the old-style ISA probes found it there. Under 4.0¡Athe ISA code is much more PnP-centric. It was possible [in 3.x] for an ISA probe to find a stray device and then for the PNP device id to match and then fail due to resource conflicts. So¡Ait disables the programmable cards first so this double probing cannot happen. It also means that it needs to know the PnP id's for supported PnP hardware. Making this more user tweakable is on the TODO list.
¦pªG­nÅý¸Ë¸m¯à¦A«×¹B§@¡A§Ú­Ì»Ý­n§ä¥X¥¦ªº PnP id¡AµM«á¦A±N¥¦ ¥[¤J¤@¥÷¦b°»´ú ISA ¸Ë¸m®É·|¨Ï¥Îªºªí¤¤¡C¥i¥H°õ¦æ &man.pnpinfo.8; ¨Ó°»´ú³o­Ó¸Ë¸m¡AÁ|¨Ò¨Ó»¡¡A¤U­±¬O &man.pnpinfo.8; §ì¨ìªº¤@­Ó¤º´¡ ¦¡¼Æ¾Ú¾÷ªº¸ê®Æ¡G &prompt.root; pnpinfo Checking for Plug-n-Play devices... Card assigned CSN #1 Vendor ID PMC2430 (0x3024a341)¡ASerial Number 0xffffffff PnP Version 1.0¡AVendor Version 0 Device Description: Pace 56 Voice Internal Plug & Play Modem Logical Device ID: PMC2430 0x3024a341 #0 Device supports I/O Range Check TAG Start DF I/O Range 0x3f8 .. 0x3f8¡Aalignment 0x8¡Alen 0x8 [16-bit addr] IRQ: 4 - only one type (true/edge) [more TAG lines elided] TAG End DF End Tag Successfully got 31 resources¡A1 logical fdevs -- card select # 0x0001 CSN PMC2430 (0x3024a341)¡ASerial Number 0xffffffff Logical device #0 IO: 0x03e8 0x03e8 0x03e8 0x03e8 0x03e8 0x03e8 0x03e8 0x03e8 IRQ 5 0 DMA 4 0 IO range check 0x00 activate 0x01 ±z©Ò»Ý­nªº¸ê°T¬O¤@¶}©l¬Ý¨ìªº Vendor ID ³o¤@¦æ¡C¬A¸¹¤¤ªº¤Q¤»¦ì¤¸½X¡]³o­Ó¨Ò¤l¤¤¬O 0x3024a341¡^´N¬O PnP id¡A¦Ó¦b³o¤§«eªº¦r¦ê¡]PMC2430¡^«h¬O¤@­Ó¿W¤@µL¤Gªº ASCII id¡C ¦Ó³o¨Ç¸ê®Æ»Ý­n³Q¥[¨ì /usr/src/sys/isa/sio.c ³o­ÓÀÉ®×ùØ¡C ¬°¤F¨¾¤î¥ô¦óªF¦è¥X¿ù¡A±zÀ³¸Ó­n¥ý³Æ¥÷¥Ø«eªº sio.c¡C¦Ó¥B±z­n submit PR ®É¤]»Ý­n³o­Ó ­ì©lÀɮרӰµ¥X patch¡]±zÀ³¸Ó·|±N¥¦ submit PR §a..¡G¡^..¡^¡C ±µµÛ´N½s¿è sio.c §ä´M¤U­±³o¦æ static struct isa_pnp_id sio_ids[] = { ±µµÛ©¹¤U±²°Ê¡A§ä­Ó¥¿½Tªº¦ì¸m¨Ó´¡¤J±zªº¸Ë¸m¸ê°T¡C±z¬Ý¨ìªº´N ¤U­±³o­Ó¼Ë¤l¡A¥¦­Ì¬O·Ó¥kÃäµù¸Ñ¸Ì­±ªº ASCII ³o­Ó Vender ID °µ±Æ §Çªº¡A©Î¬O &man.pnpinfo.8; ©Ò§ä¨ìªº¤@³¡¤À ¸Ë¸m´y­z¡G {0x0f804f3f¡ANULL}¡A /* OZO800f - Zoom 2812 (56k Modem) */ {0x39804f3f¡ANULL}¡A /* OZO8039 - Zoom 56k flex */ {0x3024a341¡ANULL}¡A /* PMC2430 - Pace 56 Voice Internal Modem */ {0x1000eb49¡ANULL}¡A /* ROK0010 - Rockwell ? */ {0x5002734a¡ANULL}¡A /* RSS0250 - 5614Jx3(G) Internal Modem */ §â±z³o­Ó¸Ë¸mªº¤Q¤»¶i¦ìªº Vender ID ¥[¨ì¥¿½Tªº¦a¤è¡A¦sÀÉ¡A µM«á­«·s½s¤@­Ó kernel¡A¦A­«¶}¾÷¡C¤§«á³o­Ó¸Ë¸mÀ³¸Ó´N·|¹³¦b FreeBSD 3.X ¤U¡A³Q°»´ú¬° sio ¸Ë¸m¤F¡C
¬°¤°»ò§Ú±`±`¦b¶]¤@¨Çµ{¦¡¡]¨Ò¦p top ©Î systat¡^ªº®É­Ô¥X²{ nlist failed ³o­Ó¿ù»~°T®§¡H ³o­Ó°ÝÃD¬O¦]¬°±z¶]ªºµ{¦¡»Ý­n¤@­Ó¯S§Oªº kernel symbol¡A¥i¬O ¤£ª¾¹D¤°»ò­ì¦]¦Ó§ä¤£¨ì¡Q¦Ó·|µo¥Í³o­Ó°ÝÃD¥i¯à¬O¦]¬°¤U­±¨â­Ó­ì¦]¡G ±zªº kernel ©M userland ªºÀɮת©¥»¨Ã¤£¤@­P¡]¨Ò¦p»¡¡A±z ½s¤F¤@­Ó·sªº kernel¡A¦ý¬O¨Ã¨S¦³°õ¦æ¹ïÀ³ªº installworld¡A©Î¬O¨ä¥LÃþ¦ü±¡§Î¡^¡A ¦]¦¹ symbol table ªº¤º®e´N©MÀ³¥Îµ{¦¡½sĶ®Éªº¤£¤Ó¤@¼Ë¤F¡C¦p ªG¬O³oºØ±¡§Î¡A½Ð°õ¦æ§¹¾ãªº¤É¯Å¨BÆJ¡]½Ð°Ñ¾\ /usr/src/UPDATING ¥H±oª¾¥¿½Tªº¬y µ{¡^¡C ±z¨S¦³¥Î /boot/loader ¨Ó¸ü¤J±zªº kernel¡A¦Ó¬Oª½±µ¥Ñ boot2 ¶}¾÷¡]½Ð°Ñ¾\ &man.boot.8;¡^¡C ÁöµM»¡¸õ¹L /boot/loader ¨Ã¨S¦³¤°»ò¿ù¡A ¦ý¬O¥¦¦b kernel symbols ¸òÀ³¥Îµ{¦¡ªº·¾³q¤è­±¦û¤F«Ü­«ªº¥÷¶q¡C ¬°¤°»ò§Ú¥Î ssh ©Î telnet ³s¨ì§Úªº¹q¸£®É¡A·|µ¥«Ý«Üªøªº¤@¬q®É¶¡¤~¯à³s¤W¡H ¯gª¬¡GTCP ³s½u«Ø¥ß¤§«á©M¸ß°Ý±K½X¤§«e¡]¦pªG¬O¦b»¡ &man.telnet.1; ªº¸Ü¡A«h¬O login ´£¥Ü²Å¸¹¸õ¥X¨Ó¤§«e¡^¡A­nµ¥«Ý«Üªøªº¤@¬q®É ¶¡¡C °ÝÃD©Ò¦b¡G³oºØ©µ¿ð±¡§Î±`±`¬O¦]¬°¦øªA³nÅé¡]server software¡^ ¹Á¸Õ­n±N«È¤áºÝ¡]client¡^ªº IP ¦ì§}Âà´«¦¨¥D¾÷¦WºÙ¡C¦]¬°«Ü¦h¦øªA ³nÅé¡A¥]¬A FreeBSD ¤º«Øªº Telnet ©M SSH¡A¬°¤F±N¥D¾÷¦WºÙ¼g¤J¬ö ¿ýÀɤ¤¥H¨ÑºÞ²zªÌ§@°Ñ¦Ò¡A¦Ó·|°µ³o¶µ°Ê§@¡C ¸Ñ¨M¤èªk¡G¦pªG³o­Ó°ÝÃD¦b±z³s±µ¤£¦Pªº¦øªA¾¹®É³£·|µo¥Í¡A¨º»ò °ÝÃD¬O¦b±z«È¤áºÝ³o¤@¤è¡Q¦P¼Ëªº¡A¦pªG§O¤H¥u¦³¦b³s¨ì±zªº¦øªA¾¹¤W ¤~·|µo¥Í³o­Ó±¡§Î¡A¨º»ò°ÝÃD´N¬O¦b¦øªA¾¹³oÃä¤F¡C ¦pªG¬O«È¤áºÝ³o¤è¦³°ÝÃD¡A°ß¤@ªº¤èªk´N¬O±N DNS ¦øªA¾¹­×¦n¡A ³o¼Ë¹ï¤è¦øªA¾¹¤~¯à¥¿½TªºÂà´«¦WºÙ¡C¦pªG°ÝÃD¬O¦b¤º³¡°Ï°ìºô¸ôµo ¥Íªº¡A³oÀ³¸Ó¬O¦øªA¾¹¦³°ÝÃD¡A½Ð¸Ô²ÓÀˬd¤@¤U¡Q¬Û¤Ïªº¡A¦pªG¬O±z ¦b¤W Internet ®Éµo¥Íªº¡A¨º»ò±z»Ý­n¸ò±zªº ISP Ápµ¸¡A½Ð¥L­Ì¸Ñ¨M ³o­Ó°ÝÃD¡C ¦pªG¬O¦øªA¾¹³oÃ䪺°ÝÃD¡A¦Ó¥B¬Oµo¥Í¦b¤º³¡°Ï°ìºô¸ô¡A¨º»ò±z»Ý ­n³]©w³o­Ó¦øªA¾¹¡A¨Ï¥¦¯à¥¿½T±N¤º³¡ºô¸ôªº IP ¦ì§}Âà´«¬°¥D¾÷¦WºÙ¡C ½Ð°Ñ¾\ &man.hosts.5; ©M &man.named.8; ªº»¡©ú¥HÀò±o§ó¦h¸ê°T¡C¦p ªG¬O¦b Internet ¤Wªº¦øªA¾¹µo¥Í³o­Ó°ÝÃD¡A¨º»ò¦³¥i¯à¬O±z¦øªA¾¹ªº Âà´«¥\¯à¥X°ÝÃD¡C±z¥i¥H¸Õ¸Õ¬d¸ß¥t¤@­Ó¥D¾÷¦WºÙ¡A¤ñ¦p¡G www.yahoo.com¡C¦pªG¬d¤£¨ì¡A¨º»ò¥i¥H½T©w¬O±z³o Ãä¥X°ÝÃD¤F¡C stray IRQ ³o­Ó¿ù»~°T®§¬O¤°»ò·N«ä¡H Stray IRQs ¬OµwÅé IRQ ¦³ÂI¤p°ÝÃDªº²{¶H¡A¤j¦h¬O¦]¬°µwÅ饻¨­ ¦bµo¥X¤¤Â_»Ý¨D«á¡A¤S¨ú®ø¤F¥¦¦Û¤vªº¤¤Â_­n¨D¡C ¦³¤T­Ó¤èªk¥i¥HÀ³¥I³o­Ó°ÝÃD¡G ¤£²z·|³o­Óĵ§i¡C¤Ï¥¿¤@­Ó irq ¥X²{¤­¦¸Äµ§i«á¨t²Î´N¤£·| ¦AÅã¥Ü¤F¡C §â isa_strayintr() ùتº­È¡A¥Ñ 5 §ï¦¨ 0¡A³o¼Ë©Ò¦³ªºÄµ§i°T®§³£¤£·|¥X²{¡C ¦w¸Ë¨Ï¥Î irq 7 ªº¥­¦æ°ðµwÅé³]³Æ¡A¥H¤Î¥¦ªº PPP ÅX°Êµ{¦¡ ¡]³o­Ó¤j³¡¤À¨t²Î³£¦³°µ¡^¡A±µµÛ¦w¸Ë ide µwºÐ©Î¬O¨ä¥L·|¨Ï¥Î irq 15 ªºµwÅé³]³Æ¥H¤Î¥¦ªºÅX°Êµ{¦¡¡C ¬°¤°»ò file: table is full ³o­Ó°T®§ ¤@ª½¦b dmesg ùØ­«½Æ¥X²{¡H ³o­Ó¿ù»~°T®§¥Nªí¤F±z¨t²Îªº file descriptors ¤w¸g¨Ï¥Î¥ú¤F¡C ½Ð°Ñ¾\¤â¥U¤º Tuning Kernel Limits ¸Ì­±ªº kern.maxfiles ³o­Ó³¹¸`¡A¸Ì­±¦³¤@¨Ç°Q½×¤Î¸Ñ¨M¤èªk¡C ¬°¤°»ò§Úµ§°O«¬¹q¸£¤Wªº®ÉÄÁ¤@ª½Åã¥Ü¿ù»~ªº®É¶¡¡H ±zªºµ§°O«¬¹q¸£¸Ì¦³¨â­Ó¥H¤Wªº®ÉÄÁ¡A¦Ó FreeBSD ¿ï¨ì¤F¿ùªº ¨º­Ó¡C °õ¦æ &man.dmesg.8;¡AÀˬd¤@¤U¦³ Timecounter ¦r¦êªº¨º´X¦æ¡C³Ì«á¤@¦æ¬O FreeBSD ¿ï¥Îªº¡A³q±`¬O TSC¡C &prompt.root; dmesg | grep Timecounter Timecounter "i8254" frequency 1193182 Hz Timecounter "TSC" frequency 595573479 Hz ±z¥i¥H°õ¦æ &man.sysctl.3; ¬Ý¤@¤U kern.timecounter.hardware ³o­Ó­È°µ½T»{¡C &prompt.root; sysctl kern.timecounter.hardware kern.timecounter.hardware: TSC BIOS ¥i¯à¦b¤@¨Ç±¡§Î¤U·|§ó§ï TSC ªº®É¯ß—¦³®É­Ô¬O¦]¬° ¦b¨Ï¥Î¹q¦À¤u§@®É·|§ó§ï³B²z¾¹ªº³t«×¡A¥t¥~¤]¦³¥i¯à¬O¶i¤J¤F¬Ù¹q¼Ò ¦¡¡A¥i¬O FreeBSD ¨Ã¤£·|¹îı¨ì³o¨Ç½Õ¾ã¡A¦Ó·|µo¥Í®É¶¡¼W¥[©Î¬O´î ¤Öªº±¡§Î¡C ¦b¤W­±ªº¨Ò¤l·í¤¤¡A§Ú­Ì¬Ý¨ìÁÙ¦³ i8254 ³o­Ó®ÉÄÁ¥i¥H¿ï¾Ü¡A°õ¦æ &man.sysctl.3; ¥Î¤â°Êªº¤è¦¡±N³o­Ó­È¼g¤J kern.timecounter.hardware ¤¤¡C &prompt.root; sysctl -w kern.timecounter.hardware=i8254 kern.timecounter.hardware: TSC -> i8254 ³o¼Ë±zªºµ§°O«¬¹q¸£À³¸Ó´N¥i¥H«O«ù¥¿½Tªº®É¶¡¤F¡C ¦pªG­nÅý³o­Ó§ó§ïªº°Ê§@¦A¨C¦¸¶}¾÷®É¦Û°Ê°õ¦æ¡A¦b /etc/sysctl.conf ùØ¥[¤J¤U­±³o¦æ¡C kern.timecounter.hardware=i8254 ¬°¤°»ò§Úªºµ§°O«¬¹q¸£µLªk¥¿½Tªº°»´ú¨ì PC card ¡H ³o­Ó°ÝÃD±`±`µo¥Í¦bÄé¤F¦h­Ó§@·~¨t²Îªºµ§°O«¬¹q¸£¤W¡C¦³¨Ç«D BSD ªº§@·~¨t²Î·|Åý PC card ªºµwÅé¸Ë¸m³B¦b¤@­Ó¤£¤@­Pªºª¬ºA¤U ¡]inconsistent state¡^¡C¨Ï±o pccardd ¦b°» ´ú³o¤ù¥d®É¡AµLªk§ì¨ì¥¿½Tªº«¬¸¹¡A¦Ó¬O "(null)""(null)"¡C ±z»Ý­n²¾°£ PC card ´¡¼Ñªº¹q·½¥H­«¸m³o­ÓµwÅé¸Ë¸m¡C¤@­Ó¤èªk¬O ±N±zªºµ§°O«¬¹q¸£Ãö¾÷¡]¤£¬O¥ð¯v¼Ò¦¡¡A¤]¤£¬O«Ý©R¼Ò¦¡¡Q­n§¹¥þªºÃö ¾÷¡^¡Cµ¥­Ó´X¬íÄÁ¦A­«¶}¾÷¡C³o¼Ë±zªº PC card À³¸Ó´N¥¿±`¤F¡C ¦³®É¦³¨Çµ§°O«¬¹q¸£ÁöµM¬Ý°_¨Ó¤w¸gÃö¾÷¤F¡A¦ý¹ê»Ú¤W¨Ã¨S¦³¡C ¦pªG±zµo²{¤W­±¨º­Ó¤èªk¨S¦³¥Î¡A½ÐÃö¾÷¡A²¾°£¹q¦À¡Aµ¥­Ó´X¬íÄÁ¡A §â¹q¦À¸Ë¤W¥hµM«á­«¶}¾÷¡C ¬°¤°»ò¦b BIOS µe­±¤§«á¡AFreeBSD ªº boot loader Åã¥Ü Read error µM«á´N°±¤î¤£°Ê¤F¡H ³o¬O¦]¬°FreeBSD ªº boot loader µLªk¥¿½Tªº§ä¥XµwºÐªº geometry¡C³o¼Ëªº¸Ü¡A´N»Ý­n¦b¥Î fdisk ¤À³Î©Î¬O­×§ï FreeBSD ªº slice ®É¡A¤â°Ê±N¥¿½Tªº­È¿é¤J¶i¥h¤F¡C ¥¿½TªºµwºÐ geometry ­È¦b BIOS ¸Ì­±¥i¥H¬dªº¨ì¡Cª`·N¸ÓµwºÐªº cylinders¡Aheads ¥H¤Î sectors ³o¨Ç¼Æ­È¡C ¦b°õ¦æ &man.sysinstall.8;ªº fdisk ®É¡A«ö¤U G ¥H«K¤â°Ê³]©wµwºÐªº geometry¡C ³o®É·|¦³¤@­Ó¹ï¸Ü®Ø¸õ¥X¨Ó¡A¸ß°Ý±z¦³Ãö cylinders¡Aheads ¥H¤Î sectors ³o¨ÇªF¦èªº­È¡C½Ð±N­è­è¦b BIOS ¬d¨ìªº¼Æ¦r¡A¥H / §@¤À¹j¿é ¤J¶i¥h¡C Á|¨Ò¨Ó»¡¡A¦pªG¬O 5000 cylinders¡A250 sectors ©M 60 sectors ´N¿é¤J 5000/250/60 ¿é¤J§¹«á½Ð«ö enter Áä½T»{¡A³Ì«á«ö¤U W Áä§â ·sªº¤À³Î°Ïªí¼g¤JµwºÐ·í¤¤¡C ¥t¤@­Ó§@·~¨t²ÎºR·´¤F§Úªº Boot Manager¡C§Ú­n«ç»ò¼Ë¤~¯à§â¥¦ÁÙ ­ì¦^¨Ó¡H °õ¦æ &man.sysinstall.8; ±µµÛ¿ï Configure¡AµM«á¿ï Fdisk¡C ¦A¨Ó¥ÎªÅ¥ÕÁä¿ï¾Ü­ì¥ý Boot Manager ©Ò¦bªºµwºÐ¡C «ö¤U W Áä¨Ó§@¼g¤Jªº°Ê§@¡C³o®É·|¸õ¥X¤@­Ó´£¥Ü °T®§¡A¸ß°Ý±z­n¦w¸Ë­þ¤@­Ó boot loader¡C½Ð¿ï¾Ü Boot Manager¡A ³o¼Ë´N¥i¥H±N¥¦ÁÙ­ì¤F¡C ³o­Ó¿ù»~°T®§¡Gswap_pager: indefinite wait buffer: ¬O¤°»ò·N«ä©O¡H ³o­Ó°T®§¬O»¡¦³¤@­Ó°õ¦æµ{§Ç¥¿¦b¹Á¸Õ±N¤À­¶°O¾ÐÅé¡]page memory¡^ ¼g¤JµwºÐ¤¤¡A¦Ó³o­Ó°Ê§@¹Á¸Õ¤F 20 ¬íÄÁ¤´µMµLªk¦¨¥\¡C³o­Ó¦³¥i¯à¬O¦]¬° µwºÐ¦³Ãa­y¡B¹q¸ô©Î±Æ½u¦³°ÝÃD¡B¥H¤Î¨ä¥L¸òµwºÐŪ¥X¼g¤J¦³ÃöªºµwÅé³]³Æ¡C ¦pªG¯uªº¬OµwºÐÃa­yªº°ÝÃD¡A±zÀ³¸Ó·|¦b /var/log/messages³o­ÓÀɮפ¤¡A©Î¬O¦b°õ¦æ dmesg³o­Ó«ü¥O«á¡A¬Ý¨ì¦³ÃöºÏºÐ¿ù»~ªº°T®§¡C ¦pªG¨S¦³¡A¨º»ò½ÐÀˬd±zªº±Æ½uÁÙ¦³±µÀY³s±µ¬O§_¨}¦n¡C ¬°¦ó¦b buildworld/installworld ®É¡A·|­w¦b touch: not found ªº¿ù»~°T®§? ³o¿ù»~°T®§¨Ã¤£¬O«ü &man.touch.1; µ{¦¡¤£¨£¤F¡A¨Æ¹ê¤W¥i¯à¬O¸ÓÀÉÀɮ׮ɶ¡³Q³]¬°¥¼¨Óªº®É¶¡¡C ­Y¾÷¾¹¤Wªº CMOS-clock ®ÉÄÁ³]©w¬°·í¦a®É¶¡ («D®æªL«Âªv®É¶¡¡A¤ñ¦p¥xÆW®É¶¡¬° GMT +08:00 ¡A¤]´N¬O CST ¤¤­ì¼Ð·Ç®É¶¡)¡A ¨º»ò½Ð¦b¶}¾÷®É¡A¥ý¿ï single user ¼Ò¦¡¶i¤J¡AµM«á¥´ adjkerntz -i ¨Ó½Õ¾ã kernel clock »P¾÷¾¹¤Wªº CMOS-clock ¨Ó¦P¨B¡C
Vanilla Shu
vanilla@FreeBSD.org
°Ó·~³nÅé ³o¤@¸`ªº¤º®eÁÙ¬O¬Û·í¤Ö¡A¤£¹L§Ú­Ì·íµM§Æ±æ¦U­Ó¤½¥q¯à¬°¥¦¥[ÂI¤º®e :) FreeBSD ²Õ´©M¦C¦b³o¸Ìªº¥ô¦ó¤@®a¤½¥q³£¨S¦³ª÷¿ú¤Wªº§Q®`Ãö«Y¡A¦C¥X¨Ó¯Âºé¥u¬O¹ï¤j²³¤½¶}¤¶²Ð(¦P®É¤]»{¬°¦b FreeBSD ¤Wªº°Ó¾÷­Y¿³©ô¡A·|¹ï FreeBSD ¥iªø¥i¤[¦³·¥¥¿­±ªº®Ä¯q)¡C§Ú­Ì¹ªÀy°Ó·~³nÅ骺¼t°Ó§â¥L­Ìªº²£«~¥]¬A¦b¤U­±ªº¦W³æ¤¤¡A¦b Vendors page ¥i¥H¬Ý¨ì§óªøªº¦Cªí¡C ¦b­þÃä§ä¨ìµ¹ FreeBSD ¥Îªº Office ®M¥ó©O¡H OpenOffice ³o®M open-source ©Ê½èªº office ¥i¥H¦b FreeBSD ¤W¥¿±`¹B¥Î¦Û¦p¡A¦Ó &linux; ª©ªº StarOffice, ³o®M closed-source ªº OpenOffice ¥[­Èª©¡A¤]¥i¥H¦b FreeBSD ¤W¥¿±`¨Ï¥Î¡C FreeBSD ¤WÁÙ¦³³\¦h½s±Æ³nÅé¡B¸Õºâªí(Spreadsheet)¥H¤Îø¹Ï³nÅé³£¥i¥Î Ports Collection ¨Ó¦w¸Ë³á¡C ¦b­þÃä¥i§ä¨ìµ¹ FreeBSD ¥Îªº Motif¡H Open Group ÄÀ¥X¤F Motif 2.1.30 ªº­ì©l½X¡A¥i¥H³z¹L open-motif package ¦w¸Ë¡A©Î¬O¥Ñ ports ¦Û¦æ ½sĶ¡C¬ÛÃöªº¸ê°T¡A½Ð°Ñ¦Ò handbook ¤¤ªº ports ³¹¸`¡C Open Motif ¥u¯à¦b¦P¼Ë¤]¬O open source ªº§@·~¨t²Î©Î­p¹º¤¤¨Ï¥Î¡C ¥t¥~¡A¤]¬O¦³°Ó·~ª©¥»ªº Motif ¦s¦b¡C¤]³\³oºØª©¥»ªº Motif ¤£¬O§K¶Oªº¡A¦ý¬Oµ´¹ï¤¹³\¥Î¦b closed-source ªºÀô¹Ò¤U¡C Apps2go ´£¨Ñ¤F³Ì«K©yªº FreeBSD (¥]¬A i386 ¸ò alpha)ª©¥»ªº ELF Motif 2.1.20 ®M¥ó¡C ¥Ø«e´£¨Ñ¨âºØ¤£¦PÀô¹Òªºª©¥»¡A µo®i¥Îª©¥» ¤Î runtime ª©¥» ¡C³o¨âºØ®M¥ó³£¥]¬A¡G OSF/Motif manager, xmbind, panner, wsm. Development kit with uil, mrm, xm, xmcxx, include and Imake files. Static and dynamic ELF libraries (for use with FreeBSD 3.0 and above). Demonstration applets. ¦]¬° Apps2go ¤]¦³´£¨Ñ NetBSD ©M OpenBSD ªºª©¥»¡A©Ò¥H¦b­qÁʮɽЯS§O«ü©w¬O­n FreeBSD ª©¥»ªº Motif¡I ¥L­Ì¥Ø«e¥u´£¨Ñ¥H FTP ªº¤è¦¡¨ú±o³o¥÷®M¥ó¡C §ó¦h¸ê°T Apps2go WWW page ©Î sales@apps2go.com ©Î support@apps2go.com ©Î phone (817) 431 8775 or +1 817 431-8775 ¤]¥i¥HÁpµ¸ Xi Graphics¡A¥L­Ì´£¨Ñ¤F¤@­Ó FreeBSD a.out ®æ¦¡ªº Motif 2.0 ®M¥ó¡C ¦b³o®M¥ó¤¤¥]¬A¤F¡G OSF/Motif manager, xmbind, panner, wsm. Development kit with uil, mrm, xm, xmcxx, include and Imake files. Static and dynamic libraries (for use with FreeBSD 2.2.8 and earlier). Demonstration applets. Preformatted man pages. ¦b§A¸ò¥L­Ì­qÁÊ Motif ®É¡A½Ð¤@©wµù©ú§A­nªº¬O FreeBSD ªºª©¥»¡I ¦]¬° Xi Graphics ¤]¦P®É´£¨Ñ¤F BSDI ¸ò Linux ª©¥»ªº Motif¡C¥Ø«eµo¦æªºª©¥»¬O©ñ¦b¥|¶ôºÏ¤ù¤¤¡A±N¨Ó¥L­Ì·|±N©Ò¦³ªº ªF¦è³£©ñ¨ì¥úºÐ¸Ì¡A´N¹³¥L­Ì©Òµo¦æªº CDE ¤@¼Ë¡C ¦b­þÃä¥i§ä¨ìµ¹ FreeBSD ¥Îªº CDE¡H Xi Graphics ¥H«e¦³½æ FreeBSD ¥Îªº CDE¡A¤£¹L²{¤w°±¤îµo°â¤F¡C ´N³\¦h¤è­±¦Ó¨¥¡AKDE ³o­Ó open source ªº®à­±Àô¹Ò»P CDE ¬Û·íÃþ¦ü¡C¦¹¥~¡A§A¥i¯à·|³ßÅw¨Ï¥Î xfce¡CKDE ¤Î xfce ³£¥i¥Ñ ports ¾÷¨î¨Ó¦w¸Ë¡C ¦³¨S¦³­n¿ú¡A¦ý¬O°ª®Ä²vªº X servers¡H ¦³¡A Xi Graphics ¦³´£¨Ñµ¹ FreeBSD¡]©Î¨ä¥L Intel ¥­¥x¤W¡^¥Îªº X µøµ¡¥[³t²£«~¡C Xi Graphics ©Ò´£¨Ñªº°ª®Ä¯à X Server ¦³«D±`²³æªº³]©w¤è¦¡¡A ¨Ã¥B¤ä´©¤F¥Ø«e¥«­±¤W·í¬õªº¦U¤j¼tµPªºÅã¥Ü¥d¡C¥¦¥uµ¹§A Binary ÀɮסA ¬O¥ÎºÏ¤ùªº¤è¦¡µo¦æ¡AFreeBSD ¸ò Linux ª©¥»³£¬Û¦P¡CXi Graphics ¦P®É ¤]´£¨Ñ¤F±Mªùµ¹µ§°O«¬¹q¸£¥Îªº°ª®Ä¯à X Server¡C 5.0 ª©¦³´£¨Ñ§K¶Oªº¬Û®e demo ª©¥» Xi Graphics ¤]¦³¦b½æ FreeBSD ¥Îªº Motif ¸ò CDE¡]©¹¤W­±¬Ý¬Ý¡^¡C §ó¦hªº¸ê°T Xi Graphics WWW page ©Î sales@xig.com ©Î support@xig.com ©Î phone (800) 946 7433 or +1 303 298-7478. ¦b FreeBSD ¤W¦³¥ô¦óªº¸ê®Æ®w¶Ü¡H ¦³! ½Ð¬Ý FreeBSD ºô¯¸¤W °Ó·~³nÅ餽¥q ³o¤@³¡¥÷¡C ÁÙ¦³½Ð°Ñ¦Ò ports ¤¤ Databases ¬ÛÃöªº¦¬¶°¡C ¥i¥H¦b FreeBSD ¤W°õ¦æ Oracle ¶Ü¡H ¥i¥H¡A¤U­±³o­Óºô­¶·|»¡©ú¦p¦ó¦b FreeBSD ¤W°õ¦æ Linux ª©ªº Oracle¡G http://www.scc.nl/~marcel/howto-oracle.html http://www.lf.net/lf/pi/oracle/install-linux-oracle-on-freebsd
Kang-min Liu
gugod@gugod.org
¤@¯ëÀ³¥Îµ{¦¡ ¶â..§Ú­n¦b­þ§ä¨ì§Ú­nªºµ{¦¡©O? ½Ð¬Ý¬Ý ports ¥Ø¿ý §a¡C³oÃ䦳¥÷¤w¸g port ¨ì FreeBSD ªº³nÅé¦Cªí¡C ¥Ø«e¦³¶W¹L &os.numports; ­Ó³nÅé¤w¸g³Qport ¨ì FreeBSD ¤W¡A¨Ã¥B¨C¤Ñ ³£¦b¼W¥[¤¤¡C©Ò¥H¦³ªÅ´N¦h¬Ý¬Ý³o¥÷¦Cªí¡A¤£µM§A¤]¥i¥H­q¾\ freebsd-announce - ³o¥÷ mailing list¡A·|¦³¤H±N¨C­Ó¬P´Á³Ì·sªº³nÅé¦Cªí¶K¦b - ¤W­±¡C + ³o¥÷ mailing list¡A·|¦³¤H±N¨C­Ó¬P´Á³Ì·sªº³nÅé¦Cªí¶K¦b¤W­±¡C - ¤j³¡¥÷ªº ports À³¸Ó³£¥i¥H¦b 2.2¡A3.0 ¸ò 4.0 ªº¨t²Î¤W¨Ï - ¥Î¡A¨Ã¥BÁÙ¦³³¡¥÷ªº ports ¥i¥H¦b 2.1.x ªº¨t²Î¤W¹B§@¡C¨C¦¸ - ·í FreeBSD release ®É¡A³£·|¦³¤@¥÷ ports tree ³Q©ñ¦b³o¤@­Ó + ¤j³¡¥÷ªº ports À³¸Ó³£¥i¥H¦b 4.X¡B5.X ¸ò 6.X ªº¨t²Î¤W¨Ï¥Î¡C + ¨C¦¸·í FreeBSD release ·sª©®É¡A³£·|¦³¤@¥÷ ports tree ³Q©ñ¦b³o¤@­Ó release cd ¸Ì­±ªº ports/ ¥Ø¿ý¸Ì¡C §Ú­Ì¤]¤ä´©¤@ºØ¥s package ªº·§©À¡A°ò¥»¤W ´N¬O gzip À£ÁY¡B¥i¥Î¨Óµo¦æªº binary ÀɮסA¦ý¬O¸Ì­±ÂäF¤@ ¨Ç¬Û·í¦³¥Îªº¸ê°T¡A¥i¥Hµ¹¦UºØ¦Û­q¦w¸Ë¨Ó¨Ï¥Î¡C¨Ï¥ÎªÌ¤£¥²ª¾ ¹D¬Y­Ó package ¸Ì¨s³º¦³¥]¬A­þ¨ÇÀɮסA´N¥i`¥H«Ü¤è«K¦a­«½Æ±N ¥¦¦w¸Ë/¤Ï¦w¸Ë¡C - §A¥i¥H°õ¦æ /stand/sysinstall «á¡A + §A¥i¥H°õ¦æ sysinstall(&os; 5.2 ¤§«eª©¥»«h¬O /stand/sysinstall) «á¡A ¦b post-configuration ¿ï³æ¤U¿ï¾Ü package ³o­Ó¦w¸Ë¿ï¶µ¡F©Î ¬O¹ï¬Y­Ó¦³¿³½ìªº package ÀÉ®×°õ¦æ &man.pkg.add.1; - §â¥¦¸Ë°_¨Ó¡CPackage Àɮ׳q±`¥H .tgz - §@¬°©µ¦ùÀɦW¡A¤â¤W¦³ FreeBSD CDROM ªº¤H¥i¥H¦b - packages/All ³o­Ó¥Ø¿ý¤U§ä¨ì³oÃþÀɮסC + §â¥¦¸Ë°_¨Ó¡CPackage Àɮ׳q±`¥H .tgz ©Î .tbz + ¬°°ÆÀɦW¡A¤â¤W¦³ FreeBSD CDROM ªº¤H¥i¥H¦b packages/All ³o­Ó¥Ø¿ý¤U§ä¨ì³oÃþÀɮסC ¹ï¤£¦Pªº FreeBSD ª©¥»¡A¤]¥i¥H±q¤U¦C¦ì§}¥Ñºô¸ô¤W¨ú±o¡G - - µ¹ 2.2.8-release/2.2.8-stable ¥Îªº - - - ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/i386/packages-2.2.8/ - - + + µ¹ 4.X-RELEASE/4-STABLE ¥Îªº + + + ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/i386/packages-4-stable/ + + - µ¹ 3.2-release/3.2-stable ¥Îªº - + µ¹ 5.X-RELEASE/5-STABLE ¥Îªº + - ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/i386/packages-3-stable/ - + url="ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/i386/packages-5-stable/"> + ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/i386/packages-5-stable - - µ¹ 4.X-RELEASE/4-STABLE ¥Îªº + + µ¹ 6.X-RELEASE/6-STABLE ¥Îªº - ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/i386/packages-4-current/ + url="ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/i386/packages-6-stable/"> + ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/i386/packages-6-stable - - µ¹ 5.X-CURRENT ¥Îªº + + µ¹ 7-CURRENT ¥Îªº - ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/i386/packages-5-current + url="ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/i386/packages-7-current/"> + ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/i386/packages-7-current - + ©Î¬OÂ÷§A³Ìªñªº mirror ¯¸¡C ­nª`·Nªº¬O¡A¦]¬°·sªº port ¤@ª½¦b¼W¥[¤¤¡A©Ò¥H¨Ã¤£¬O©Ò¦³ port ³£¦³¬Û¹ïÀ³ªº package¡C³Ì¦n©w®ÉÀˬdftp.FreeBSD.org ¡A¬Ý¬Ý¦³­þ¨Ç package ¥i¥H¥Î¡C + + + ¸Ó«ç»ò³]©w INN(Internet News) ¨Ó·í news server¡H + + + + ¥H package ©Î port ¤è¦¡¨Ó¸Ë¦n news/inn ¤§«á¡ADave + Barr's INN Page ¬O­Ó«D±`¦nªº INN ¤Jªù³B¡A§A¥i¥H¦b¨ºÃä§ä¨ì INN ªº FAQ¡C + + + + + + FreeBSD ¦³¤ä´© &java; ¶Ü¡H + + + + ¦³°Ú¡A½Ð¬Ý + http://www.FreeBSD.org/java/ + + + §Ú¥i¥H¦b­þÃä§ä¨ì libc.so.3.0? §A¥i¯à¦b¤@¥x 2.1.x ªº¾÷¾¹¤W¡A¶]µÛµ¹ 2.2/3.x/4.0 ªº³nÅé¡C ½Ð¦A©¹¤W­±¤@­Ó³¹¸`¬Ý¡A¥¿½Tªº¨ú±oµ¹§A¾÷¾¹¥Îªº port/package¡C ¬°¦ó§Ú±o¨ì¤F³o­Ó°T®§ ?Error: can't find libc.so.4.0? §A¤£¤p¤ß§ì¤Fµ¹ 4.X ¤Î 5.X ¨t²Î¥Îªº package¡A¨Ã¥B¹Á¸ÕµÛ ¥h¸Ë¦b§Aªº 2.X ©Î 3.X ªº¨t²Î¤W­±¡C½Ð¤U¸ü¥¿½Tª©¥»ªº package¡C ghostscript ¦b§Úªº 386/486SX ¤W¦³ÂI°ÝÃD©O¡I §A¨S¦³¯BÂI¹Bºâ¾¹¡A¹ï§a¡H§A¥²¶·¦b§Aªº kernel ¤¤¥[¤J¼Æ¾Ç ¹Bºâ¼ÒÀÀ¾¹¡A§A¥i¥H¸òµÛ¤U­±ªº¨BÆJ°µ¡A¨Ã¦b§ó§ï¹L§Aªº kernel ³]©w ÀÉ«á¡A­«·s½sĶ¹L¤@¦¸¡C options GPL_MATH_EMULATE ·í§A¥[¤J¤W¤@¦æªº¦P®É¡A§A¥²¶·±N MATH_EMULATE ²¾°£±¼¡C ¬°¤°»ò·í§Ú°õ¦æ SCO/iBCS2 ªºµ{¦¡®É¡A¥¦¦b socksys ³o­Ó¦a¤è¥X¤F°ÝÃD¡H (FreeBSD 3.0 ¥H¤Î§ó¦­ªºª©¥»¤~¦³¦¹°ÝÃD¡C) §A¥²¶·¥ý­×§ï /etc/sysconfig (©Î¬O /etc/rc.conf, ½ÐŪ &man.rc.conf.5;) ³oÀɮ׳̫á¤@­Ó³¹¸`¡A±N¤U­±©ÒÁ¿¨ìªºÅܼƳ]¦¨ YES¡G # Set to YES if you want ibcs2 (SCO) emulation loaded at startup ibcs2=NO ³o·|¦b¶}¾÷®É±N ibcs2 ³o¤@­Ó kernel ¼Ò²Õ¸ü¤J¡C §AÁÙ­n±N§Aªº /compat/ibcs2/dev §ï¦¨¤U­±³o¼Ë¡G lrwxr-xr-x 1 root wheel 9 Oct 15 22:20 X0R@ -> /dev/null lrwxr-xr-x 1 root wheel 7 Oct 15 22:20 nfsd@ -> socksys -rw-rw-r-- 1 root wheel 0 Oct 28 12:02 null lrwxr-xr-x 1 root wheel 9 Oct 15 22:20 socksys@ -> /dev/null crw-rw-rw- 1 root wheel 41, 1 Oct 15 22:14 spx §A¥u»Ý­n±N socksys Âà¦V¨ì /dev/null (½ÐŪ &man.null.4;) ¥hÄF¹L open & close ªº°Ê§@¡C¦b -current ¸Ì­±ªº ibcs2 ¬ÛÃöµ{¦¡½X±N·|³B²z¨ä¾lªº³¡¥÷¡A³oºØ§@ªk¤ñ¥H«eªº¤è¦¡ °®²b¤Ó¦h¤F¡C°²¦p§A·Q­n¨Ï¥Î spx ¤è­±ªº µ{¦¡¡A¦b§Aªº kernel ³]©wÀɸ̭± ¥[¤WSPX_HACK¡C - - - - §Ú­n¦p¦ó¦b§Úªº¾÷¾¹¤W³]©w INN (Internet News)¡H - - - - ¦b§A¨Ï¥Î package ©ÎªÌ¬O port ¦w¸Ë§¹ inn ¤§«á¡ADave Barr's - INN Page ¬O­Ó«D±`¦nªº¶}©l¡A§A¥i¥H¦b¨ºÃä§ä¨ìINN ªº FAQ¡C - - - - + §Ú¸Ó¨Ï¥Î¨º­Óª©¥»ªº Microsoft FrontPage¡H Use the Port, Luke¡I¦b ports tree ¤¤¤w¸g¦³¤@­Ó¥]§t FrontPage ªº Apache ª©¥»¤F¡C - - - - FreeBSD ¤ä´© Java ¶Ü¡H - - - - ¦³¡A½Ð¬Ý - http://www.FreeBSD.org/java. - - - + ¬°¤°»ò§ÚµLªk¦b 3.X-STABLE ¾÷¾¹¤W¶¶§Q½s¦n³o­Ó port? ¦pªG§Aªº FreeBSD ª©¥»¬Û¸û -CURRENT ©Î -STABLE ¤§¤U¬O«Ü¥j ¦­ªº¸Ü¡A©Î³\§A·|»Ý­n¤@­Ó¤É¯Å ports ªº¤u¨ã¡A¦b http://www.FreeBSD.org/ports/¡C¦pªG§A¥H±N¨ä§ó·s«o¤´µL¥Î¡A ¨º»ò¤@©w¬O¬Y¤H§ó°Ê¤§«á³y¦¨ -CURRENT ¤~¯à¥Î¡A-STABLE µLªk¥Îªº±¡ªp¡C ¥Ñ©ó ports ¤º©Ò¦¬¶°ªº³nÅé¦b -CURRENT ©Î¬O -STABLE ¤W³£­n¯à¥Î¡A ©Ò¥H½Ð¾¨³t°e¥XÃö©ó¦¹°ÝÃDªºÂγø§i¡F½Ð¨Ï¥Î &man.send-pr.1; ³o­Ó«ü ¥O¨Ó°eÂγø§i¡C ¨º¸Ì¥i¥H§ä±o¨ì ld.so¡H ¦³¨Ç a.out ®æ¦¡ªºÀ³¥Îµ{¦¡·|»Ý­n a.out ®æ¦¡ªº¨ç¦¡®w¡A Netscape Navigator ´N¬O¤@­Ó¨Ò¤l¡C¤£¹L¥Î ELF ¨ç¦¡®w½s°_¨Ó ªº FreeBSD ¹w³]¨Ã¤£·|¦w¸Ëªº a.out ¨ç¦¡®w¡A©Ò¥H±z¥i¯à·|±o ¨ìÃþ¦ü§ä¤£¨ì /usr/libexec/ld.so ªº©ê«è°T ®§¡C¦pªG»¡±zªº¨t²Î¦³³o¦w¸Ë a.out ¨ç¦¡®wªº¥²­n¡A³o¨Ç¨ç¦¡®w (compat22) ¤]¯à°÷§Q¥Î &man.sysinstall.8; ¨Ó¦w¸Ë¡C©ÎªÌ§Q¥Î FreeBSD ­ì©l½X¨Ó¦w¸Ë¡G &prompt.root; cd /usr/src/lib/compat/compat22&prompt.root; make install clean ¦pªG§A§Æ±æ¨C¦¸ make world ®É·|¦Û°Ê§ó·s compat22 ¨ç¦¡®w¡A¨º»ò­×§ï /etc/make.conf¡A ¥[¤J COMPAT22=YES¡C³o¨Ç¬Û®e©ó¥j¦Ñª©¥»ªº¨ç¦¡®w ¤w¸g¨S¤°»ò¦b§ó·s¤F¡A©Ò¥H¤@¯ë»¡¨Ó¬O¤£»Ý­n³o¼Ëªº¡C ¦P®É¤]½Ð±z¬Ý¤@¤U 3.1-RELEASE ©M 3.2-RELEASE ªº°É»~ªí(ERRATA)¡C §Ú§ó·s¤F¨t²Î­ì©l½X¡A²{¦b§Ú­n«ç¼Ë¤É¯Å¬Y­Ó¤w¸g¦w¸Ë¤W ªº ports ? FreeBSD ¥»¨­¨Ã¨S¦³¦Û°Ê¤É¯Å ports ªº¤u¨ã¡A¦ý¦³¤@¨Ç¥i¥HÅý¤É¯Å ²¤Æ¤@¨Çªº¤pµ{¦¡¡C§A¤]¥i¥H¦Û¤v¸Ë¤WÃB¥~ªº¤u¨ã¨Ó³B²z¡C &man.pkg.version.1; «ü¥O¥i¥H¦Û°Ê²£¥Í¥Î¨Ó¹F¨ì¦Û°Ê¤É¯Å¨ì ports tree ³Ì·sª©¥»ªº script¡C &prompt.root; pkg_version > /tmp/myscript ¤@©w­n¦b¤â°Ê­×§ï¤@¤U²£¥Í¥X¨Óªº script¡C ¥Ø«eªº &man.pkg.version.1; ¦b script ³Ì«e­±¥[¤J &man.exit.1; ±j ­¢§A¥h­×§ï¥¦¡C §AÀ³±N°õ¦æ script ©Ò²£¥Íªº¿é¥X°O¿ý¤U¨Ó¡A¦]¬°¸Ì­±·|¦³°O¸ü¬Y¨Ç ©|¥¼¤É¯Å¦ý¤w¸g§ó·sªº ports¡C¤£¹L§A¤£¤@©w­n¥h¤É¯Å¥¦­Ì¡C³q±`¬O¦]¬° ¦³¬Y­Ó¦@¥Îªº¨ç¦¡®w¤w¸g§ïÅܪ©¥»¸¹¤F¡A¤~­n¥h­«½s¤@¦¸¨º¨Ç¨Ï¥Î¨ì¸Ó¨ç ¦¡®wªº ports¡C ¦pªG§AªºµwºÐªÅ¶¡«Ü°÷¡A¨º»ò¥i¥H¥Î portupgrade ³o­Ó¤u¨ã¨Ó°µ¥þ¦Û°Ê³B¸Ì¡Cportupgrade ¸Ì­±¤]¦³ ¤@¨Ç¤pµ{¦¡¨Ó²¤Æ package ¤É¯Å¡A¥¦¦b sysutils/portupgrade¡C ³o­Ó¤u¨ã¬O¥Î Ruby ³o­Ó»y¨¥¼gªº¡A©Ò¥H¨Ã¤£¾A¦X¥[¤J¨ì FreeBSD ªº­ì ©l½X¤¤¡A¤£¹L¨Ã¤£·|¦]¦¹Åý¬Y¨Ç¤H¤£¥Î¥¦¡C ¦pªG§Aªº¨t²Î¤@ª½³£³B©ó¶}¾÷ª¬ºA¡A¥i§Q¥Î &man.periodic.8; ¨t²Î¡A ¨C­Ó¬P´Á²£¥Í¤@±i»Ý­n¤É¯Åªº²M³æ¡C¥u­n¦b /etc/periodic.conf ¥[¤J weekly_status_pkg_enable="YES" ´N¥i¥H¤F¡C ¬°¤°»ò /bin/sh³o»òªº¤p¡H¬°¤°»ò FreeBSD ¤£§ï¥Î bash ©ÎªÌ¬O¨ä¥L¤ñ¸û±j®«ªº shell¡H ¦]¬° POSIX »¡¡A¸Ó­n¦³³o»ò¼Ëªº¤@­Ó shell ¦b¤~¦æ¡C ¤ñ¸ûÁcº¾ªºµª®×¡G³\¦h¤H»Ý­n¼g¥i¥H¸ó«Ü¦h¥­¥xªº shell script ¡C ³o¤]¬O¬°¦ó POSIX ±N shell ¥H¤Î¤u¨ã©RºÙ³£©w¸qªº«D±`¸Ô²Óªº½t¬G¡C ¤j³¡¥÷ªº script ³£¾A¥Î©ó Bourne shell¡A¤S¦]¬°¦³´X­Ó­«­nªº ¼gµ{¦¡©Ò¥Î¨ìªºµ{¦¡©ÎªÌ¨ç¦¡ (&man.make.1; , &man.system.3;, &man.popen.3;, ÁÙ¦³¦b Perl ©ÎªÌ Tcl ¸Ì­±©I¥s¨t²Îµ{¦¡ªº¦a¤è) ³£«ü©w¥Î Bourne shell ¡C¨º»ò¦]¬° Bourne Shell ¦p¦¹ªº¼sªx±`¥Î¡A ¨º»ò¥¦ªº°õ¦æ®Ä²v«K«Ü­«­n¡A§Ö³t¬O¥¦¨M©w©Êªº­nÂI¤§¤@¡AÁÙ­n¤£¦û¤Ó¦h °O¾ÐÅé¡C ¥Ø«eªº /bin/sh ¤w¬O§Ú­Ì¹Ã¤ßÃw¦å¤§§@¡A¥¦¤w ¸gºÉ¶q¦a²Å¦X¼Ð·Ç³W©w¡C¬°¤FÅý¥¦«D±`¤p¡A§Ú­Ì®³±¼¤F¤@¨Ç¨ä¥L shell ¦³ªº¤è«K¥\¯à¡C³o¤]¬O¬°¤°»ò ports ¸Ì­±ÁÙ¦³«Ü¦h±j®«ªº shell ¡A¹³¬O bash, scsh, tcsh ¥H¤Î zsh ¡C (§A¥i¥H¦Û¤v¤ñ¸û¤@¤U³o¨Ç shell °õ¦æ ®É©Ò¦ûªº°O¾ÐÅé¤j¤p¡A¥h¬Ý¬Ý ps -u ¦C¥X¨Óªº VSZ ©M RSS ³o¨â­ÓÄæ¦ì´Nª¾¹D¤F¡C) ¬°¤°»ò Netscape ©M Opera ­nªá¦n¤[ªº®É¶¡¤~¯à±Ò°Ê¡H ³q±`¬O¦]¬°§Aªº DNS ¨S¦³³]©w¦n¡C Netscape ¸ò Opera ¦b±Ò°Êªº®É­Ô ³£·|¥hÀˬd¤@¤U DNS¡Cª½¨ì DNS ¦³¦^À³¡A©ÎªÌ¬OÂ_©wºô¸ô¥Ø«e¬OÂ_½u¤§«á¡A ¥¦­Ì¤~·|Åã¥Üµe­±¥X¨Ó¡C
- + + + + + + Yi-Feng + Tzeng + +
yftzeng@iis.sinica.edu.tw
+
+
+
+ + Ports and Packages ±`¨£°ÝÃD + + + + + ¦p¦ó¥u§ì¨ú tarball¡H + + + + ¦pªG¥u§Æ±æ§ì¨ú tarball ¤U¨Óªº¸Ü¡A¶È»Ý¥´¤U­±«ü¥O§Y¥i¡G + &prompt.root; make fetch + ¦pªG¬O­n§ì¨ú³æ¤@ªº port¡A¥H editors/joe ¬°¨Òªº¸Ü¡A«h¡G + &prompt.root; cd /usr/ports/editors/joe +&prompt.root; make fetch + ¨º»ò¡A¹w³]·|±N editors/joe ªº tarball ¤U¸ü¦Ü /usr/ports/distfiles ¥Ø¿ý¤U¡C + + ¦pªG¬O§Æ±æ§ì¨ú¦w¸Ë¦¹ ports ©Ò¦³¬ÛÃö¬Û¨Ì ports ªº tarball¡A¥H systuils/portupgrade ¬°¨Òªº¸Ü¡A«h¡G + &prompt.root; cd /usr/ports/systuils/portupgrade +&prompt.root; make fetch-recursive + ¹w³]·|±N¦¹ port »P©Ò¦³»Ý­nªº¨ä¥L port ªº tarball¡A³£¤U¸ü¦Ü /usr/ports/distfiles ¥Ø¿ý¤U¡C + + ¦pªG¬O§Æ±æ§ì¨ú ftp ¤ÀÃþ¤U©Ò¦³ ports ªº tarball ¡A«h¡G + &prompt.root; cd /usr/ports/ftp +&prompt.root; make fetch-recursive + «h·|©Ò±N ftp ¤ÀÃþ¤U©Ò¦³ ports ªº tarball ³£¤U¸ü¦Ü /usr/ports/distfiles ¥Ø¿ý¤U¡C + + + + + + ¦p¦ó¶È°µ¨ì¸Ñ¶} tarballªº¨BÆJ¡H + + + + ¦³®É­Ô²ßºD¦Û¤v patch ­ì©l½Xªº®É­Ô¡A·|«Ü±`¥Î¨ì³o­Ó¥\¯à¡C¥H editors/joe ¬°¨Òªº¸Ü¡A«h¡G + &prompt.root; cd /usr/ports/editors/joe + &prompt.root; make extract + + ¨º»ò´N·|±N tarball¸Ñ¶}¦Ü /usr/ports/editors/joe/work ¥Ø¿ý¤U¡C + + + + + + ¦p¦ó¶È°µ¨ì¸Ñ¶} tarball ¨Ã¸É¤W©x¤è´£¨Ñªº patch ¡H + + + + ¦¹ªk»P¤W­±¤è¦¡¦³¤@¨ÇÃþ¦ü¡A¤£¦P©ó¬O¥ý¸É¤W©x¤è´£¨Ñªº patch ¡A¦A¦æ patch ¦Û¤vªº­×¥¿¡C¦³®É­Ô²ßºD¦Û¤v patch ­ì©l½Xªº®É­Ô¡A·|«Ü±`¥Î¨ì³o­Ó¥\¯à¡C + ¥H editors/joe ¬°¨Òªº¸Ü¡A«h¡G + + &prompt.root; cd /usr/ports/editors/joe + &prompt.root; make patch + + ¨º»ò´N·|±N tarball¸Ñ¶}¦Ü /usr/ports/editors/joe/work ¥Ø¿ý¤U + ¡A¨Ã¸É¤W©x¤è´£¨Ñªº patch¡C + + + + + + ¦p¦ó¦w¸Ë¤@­Ó·sªº port¡H + + + + ¦pªG¨t²Î¤W¥¼¦w¸Ë¦¹³nÅé¡A«h¥i¥H¿ï¾Ü¦w¸Ë¤@­Ó·sªº port¡C + ¥H editors/joe ¬°¨Òªº¸Ü¡A«h¡G + + &prompt.root; cd /usr/ports/editors/joe + &prompt.root; make install + + ¦p¦¹·|¦b¨t²Î¤W¦w¸Ë¤@­Ó·sªº joe ³nÅé¡C + ¦pªG»Ý­n¦b¦w¸Ë§¹¦¨«á¡A¤]¤@¨Ö²M°£½s¿è®É´Á©Ò¯d¤U¨Óªº¼È¦s¥Ø¿ý¡A«h¥i°t¦X make clean + ¤èªk¤@°_¨Ï¥Î¡A¦p¡G + &prompt.root; cd /usr/ports/editors/joe + &prompt.root; make clean + + + + + + ¦p¦ó¦w¸Ë¤@­Ó·sªº port¡A¨Ã¥´¥](package)°_¨Ó¡H + + + + ±N¦w¸Ë§¹¦¨ªº³nÅ饴¥]°_¨Ó¡A¦³³\¦h«K§Q©Ê¡G¥]¬A¦bÂO¶°¨t²Î¤¤¡A¥i¨Ñ¨ä¥¦¾÷¾¹¨Ï¥Î¡A + ©Î±N¥¼¨Ó¦¹³nÅé¥X°ÝÃD¥i­«·s§Q¥Î¦¹ package ­«·s§Ö³t¦w¸Ë¡C + ¥H editors/joe ¬°¨Òªº¸Ü¡A«h¡G + + &prompt.root; cd /usr/ports/editors/joe + &prompt.root; make package + + ¦p¦¹·|¦b¨t²Î¤W¦w¸Ë¤@­Ó·sªº joe ³nÅé¡A¨Ã±N¦¹³nÅ饴¥](package)°_¨Ó¡C + package ¹w³]·|¦b /usr/ports/editors/joe ¥Ø¿ý¤U¡A¦pªG§Æ±æ¶°¤¤ºÞ²zªº¸Ü¡A«Øij°µ¦p¤Uªº¨BÆJ¡G + + &prompt.root; mkdir -p /usr/ports/packages/All + + ¥H«á¥´¥]ªº packages ³£·|¦s©ñ¦b¦¹¥Ø¿ý¤U¡A¨Ã¥B¨t²Î·|¦Û°Ê°µ¤ÀÃþ¡A¥H¤è«KºÞ²z¡C + ¦pªG»Ý­n¦b¦w¸Ë§¹¦¨«á¡A¤@¨Ö²M°£½s¿è®É´Á©Ò¯d¤U¨Óªº¼È¦s¥Ø¿ý¡A«h¥i¥[¤W make clean ¤@°_¨Ï¥Î¡A¤ñ¦p¡G + + &prompt.root; cd /usr/ports/editors/joe + &prompt.root; make package clean + + + + + + ¦p¦ó¥´¥]¤@­Ó port¡A¨Ã±N¨ä©Ò¦³¬Û¨Ìªº ports ¤]¥´¥]°_¨Ó¡H + + + + ¦]¬°¤W­±­è»¡ªº make package ¤è¦¡¥u¦³¥´¥]³æ¤@®M¥ó¡A + ¤¤¶¡¨Ì¿àªº ports ¨Ã¨S¦³¤@°_¥´¥]¡A³o·|¥X²{¤@­Ó±`¹J¨ìªº°ÝÃD¡G + ´N¬O¦pªG¤@­Ó port »Ý­n¨Ì¿à¨ä¥¦ªº ports¡A¨º»ò¥²¶·±N¨ä¥¦ ports ¤]¤@°_¥´¥]¡A§_«h¦w¸Ë packages ·|¦³¬Û¨Ìªº°ÝÃD¡C + ¥H sysutils/portupgrade ¬°¨Ò¡G + + &prompt.root; cd /usr/ports/sysutils/portupgrade + &prompt.root; make DEPENDS_TARGET=package package + + ¦p¦¹¤@¨Ó¡A´N·|¹ï©Ò¦³ portupgrade ©Ò¬Û¨Ì¿àªº ports ³£¤@¨Ö¥´¥]¡A¤]¥]¬A¦Û¤v¥»¨­¡C + + + + + + ¦p¦ó¹ï¤@­Ó¤w¸g¦w¸Ëªº port ¥´¥]¡H + + + + ¦pªG¦w¸Ë¦n¤@­Ó®M³n¡A¨Æ«e¨Ã¥¼¥´¥]¡A¨Æ«á·Q¥´¥]ªº¸Ü¡A + ¥H editors/joe ¬°¨Ò¡G + + &prompt.root; cd /var/db/pkg + &prompt.root; pkg_create -b joe-{ª©¥»¸¹} + + ¦p¦¹¤@¨Ó¡A´N·|±N¤w¦w¸Ëªº port ¥´¥]°_¨Ó¡A©ñ¦b /var/db/pkg ¥Ø¿ý¤U¡C + + + + + + ¦p¦ó²M²z ports ½s¿è´Á¶¡©Ò²£¥Íªº¼È¦s¸ê®Æ¡H + + + + ¦b¦w¸Ë port ªº®É­Ô¡A³q±`·|¦³½sĶ´Á¶¡©Ò»Ý­nªº¤u§@¥Ø¿ý(work)¡A¦]¦¹³q±`¦w¸Ë¦n¤@­Ó®M¥ó«á¡A·|²M°£¦¹¼È¦s¥Ø¿ý¡A¥H¸`¬ÙµwºÐªÅ¶¡¡C + ¥H editors/joe ¬°¨Ò¡G + + &prompt.root; cd /usr/ports/editors/joe + &prompt.root; make clean + + ¦Ó¦pªG¬O§Æ±æ²M°£©Ò¦³ ports ªº¼È¦s¥Ø¿ý¡A«h¡G + &prompt.root; cd /usr/ports + &prompt.root; make clean + + ¦Ó¦pªG¬O§Æ±æ²M°£©Ò¦³ ftp ¤ÀÃþªº¼È¦s¥Ø¿ý¡A«h¡G + &prompt.root; cd /usr/ports/ftp + &prompt.root; make clean + + + + + + ¦p¦ó²M²z ports ½s¿è´Á¶¡©Ò²£¥Íªº¼È¦s¸ê®Æ¡A¥H¤Î tarball ÀÉ¡H + + + + ¤W­±©ÒÁ¿ªº make clean ¶È¥u¬O²M°£½s¿è´Á¶¡©Ò»Ý­nªº¤u§@¥Ø¿ý(work)¡A¨Ã¨S¦³±N½sĶ + ports ®É¤@¨Ö¤U¸üªº tarball §R°£(¬Û¹ïÀ³¤§ tarball ¹w³]·|¦s©ñ¦b /usr/ports/distfiles) + ¦pªG¥´ºâ§â tarball ¤]¤@¨Ö²M°£ªº¸Ü¡A¥H editors/joe ¬°¨Ò¡G + + &prompt.root; cd /usr/ports/editors/joe + &prompt.root; make distclean + + make distclean ªº¨BÆJ¥]§t¤F make clean + ªº¥\¯à¡A¤]´N¬O»¡°£¤F·|§R°£ tarball ¥~¡AÁÙ·|¤@¨Ö²M°£½sĶ®Éªº¼È¦s work ¥Ø¿ý¡C + + ¦pªG¬O§Æ±æ²M°£©Ò¦³ ports ªº¼È¦s work ¥Ø¿ý¤Î tarball¡A«h¡G + &prompt.root; cd /usr/ports + &prompt.root; make distclean + + ¦Ó¦pªG¬O§Æ±æ²M°£©Ò¦³ ftp ¤ÀÃþªº¼È¦s¥Ø¿ý¥H¤Î tarball¡A«h¡G + &prompt.root; cd /usr/ports/ftp + &prompt.root; make distclean + + + + + + ¦p¦ó¦b¦w¸Ë ports «e¬d¸ß©Ò¨Ì¿àªº¬ÛÃö®M¥ó¡H + + + + ¦b¦w¸Ë ports «e¡A¥i¥H¬d¸ß©Ò»Ý¨Ì¿à/¬ÛÃöªº®M¥ó¡C + ¥H mail/p5-Mail-SpamAssassin ¬°¨Ò¡G + + &prompt.root; cd /usr/ports/mail/p5-Mail-SpamAssassin + &prompt.root; make all-depends-list + make all-depends-list Åã¥Ü¦¹®M¥ó©Ò¦³¬Û¨Ìªº®M¥ó¡C + + &prompt.root; cd /usr/ports/mail/p5-Mail-SpamAssassin + &prompt.root; make pretty-print-build-depends-list + make all-depends-list Åã¥Ü¦¹®M¥ó¦b½sĶ´Á¶¡©Ò»Ý­nªº®M¥ó¡C + + &prompt.root; cd /usr/ports/mail/p5-Mail-SpamAssassin + &prompt.root; make pretty-print-run-depends-list + make all-depends-list Åã¥Ü¦¹®M¥ó­n°õ¦æ®É©Ò»Ý­nªº®M¥ó¡C + + + + + + ¦p¦ó²¾°£¤w¦w¸Ëªº ports¡H + + + + ¥H editors/joe ¬°¨Ò¡G + + &prompt.root; cd /usr/ports/editors/joe + &prompt.root; make deinstall + + ©Î¬O¨Ï¥Î pkg_delete¡G + &prompt.root; pkg_delete joe-{version} + + ¦³®É­Ô®M¥ó¤§¶¡ªº¬Û¨Ì©Ê·|¾É­PµLªkª½±µ²¾°£¡A¦pªG­n±j¨î²¾°£ªº¸Ü¡A«h¡G + &prompt.root; pkg_delete -f joe-{version} + ¦ý½Ðª`·N¡G«Ü¦³¥i¯à·|¾É­P¨ä¥¦¬Û¨Ì¨ì³o³nÅ骺®M¥ó°õ¦æ°_¨Ó¥X²{°ÝÃD¡C + + + + + + ¦p¦ó¤@¨Ö²¾°£©Ò¬Û¨Ìªº ports¡H + + + + ¥H sysutils/portupgrade ¬°¨Ò¡G + + &prompt.root; cd /usr/ports/sysutils/portupgrade + &prompt.root; make deinstall-depends + + °õ¦æ¦¹¨BÆJ«e¡A½Ðª`·N¬O§_·|²¾°£¨ä¥L®M¥ó¤]¦³¦@¦P¬Û¨Ìªº³¡¤À¡C«Øij¥ý°Ñ¦Ò + ¤W­±©ÒÁ¿ªº make-depends-list ªº¤èªk¨ÓÀˬd¡C + &prompt.root; pkg_delete joe-{version} + + ©ÎªÌ«Øij¥Î¡Gpkg_delete¡A³o¼Ë­Y¤´¦³¬Û¨Ì¸Ó®M¥óªº¸Ü¡A·|¥ýĵ§i¦Ó¤£·|²¾°£¡C + °£«D¦³¥t¥~¥[¤F -f °Ñ¼Æ¨Ó±j¨î²¾°£...¡C + &prompt.root; pkg_delete -r joe-{version} + + + + + + ¦p¦ó­«·s¦w¸Ë¤w¦w¸Ë¹Lªº ports¡H + + + + ­«·s¦w¸Ëªº«e´£¬O¡G¤§«e¦³¦w¸Ë¹L©Î¥Ø«e¤w¦w¸Ë¡C¥H editors/joe ¬°¨Ò¡G + + &prompt.root; cd /usr/ports/editors/joe + &prompt.root; make deinstall clean install + + ©Î¬O + &prompt.root; cd /usr/ports/editors/joe + &prompt.root; make reinstall + + ©Î¬O + &prompt.root; portupgrade -f joe + + + + + + ¦p¦ó¥HÃöÁä¦r·j´M©Ò­n§äªº ports¡H + + + + ¦pªG­n±q¥þ³¡ªº ports collection ¤¤§ä´M»PÃöÁä¦r "ldap" ¦³Ãöªº ports¡A«h¡G + + &prompt.root; cd /usr/ports + &prompt.root; make search key=ldap + + ¦pªG¥u­n±q»P ftp ¬ÛÃöªº ports ¤U§ä´M»PÃöÁä¦r "ldap" ¦³Ãöªº ports¡A«h¡G + &prompt.root; cd /usr/ports/ftp + &prompt.root; make search key=ldap + + ¥t¥~¡AÁÙ¦³¥t¤@­Ó¥Îªk¡A¤èªk¥u¬O±N key ´«¦¨ name¡C¦pªG¤w¸gª¾¹D­n·j´M ports ªº¦WºÙ¡A©Î¥u·Q§ä¦WºÙ¬ÛÃöªºÃöÁä¦r "ldap"¡A «h¡G + &prompt.root; cd /usr/ports + &prompt.root; make search name=ldap + + + + + + ¦p¦ó¤É¯Å¤w¦w¸Ëªº ports¡H + + + + ¦pªG¤w¸g¦w¸Ë®M¥ó¡A¨Æ«á±ý¤É¯Åªº¸Ü¡A¥²¶·¥ý²¾°£Âª©ªº port¡C¥H editors/joe ¬°¨Ò¡G + + &prompt.root; portupgrade joe + + ©Î¬O + &prompt.root; cd /usr/ports/editors/joe + &prompt.root; make clean reinstall + + ©Î¬O + &prompt.root; portupgrade -f joe + + + + + + ¦p¦ó¬d¸ß¥Ø«e¨t²Î¦w¸Ë¤F­þ¨Ç®M¥ó¡H + + + + ¬d¸ß¥Ø«e¨t²Î¤w¦w¸Ëªº¥þ³¡®M¥ó¡G + + &prompt.root; pkg_info + + + + + + ¦p¦ó¬d¸ß¥Ø«e¨t²Î¦³¨S¦³¦w¸Ë³o­ÓÃöÁä¦rªº®M¥ó¡H + + + + °²³]­n§äªºÃöÁä¦r¬O joe ªº¸Ü¡G + &prompt.root; pkg_info | grep joe + + + + + + ¦p¦ó¬d¸ß¬Y­ÓÀɮ׬OÄÝ©ó­þ¨Ç®M¥ó¡H + + + + ¦pªG·Q¬d¸ß /usr/local/bin/joe ¬OÄÝ©ó­þ­Ó®M¥óªº¸Ü¡A«h¡G + &prompt.root; pkg_info -W /usr/local/bin/joe + ¦pªG¨S¦³¦^¶Ç¥ô¦ó¸ê°Tªº¸Ü¡A¥NªíµÛ³o­ÓÀɮ׬O¥Ñ FreeBSD ¤º«Øªº¡C + + + + + + ¦p¦ó¬d¸ß¬Y­Ó®M¥ó¦w¸Ë¤F­þ¨ÇÀɮסH + + + + ¦pªG·Q¬d¸ß¥Ø«e¨t²Î©Ò¦w¸Ëªº joe ¥]§t¤F­þ¨ÇÀɮסA«h¡G + &prompt.root; pkg_info -L /var/db/pkg/joe-{version} + + + + + + ¦p¦ó¦w¸Ëª©ªº ports¡H + + + + ¦³®É­Ô·|¦]¬°¬Û¨Ì©Ê¡A©Î¬O·sª©¦³°ÝÃD¡A¦Ó·|·Q¸Ëª©¥»ªº®M¥ó¡C + ³o¸Ì¤¶²Ðªº¤èªk¬O§Q¥Î CVS ªº¦n³B¡A¦^Âk¨ì¥H«eª©¥»¦s¦bªº¤é¤l¡A¥H¦w¸Ëª©¥»ªº®M¥ó¡C + + ­º¥ý¡A­Y§Ú­Ì­n¦^´_¨ì¬Y¤@­Ó®M¥óªºª©¥»®É¡A»Ý­n¥h¬d¸ß FreeBSD ports CVS repository¡C + ³Ì±`¨£ªº´N¬O Freshports ºô¯¸¡B FreeBSD ªº + Mailing FreeBSD cvs ©Î¬O FreeBSD + ports cvsweb¡C + + ¬d¨ì¸Ó®M¥óª©¥»©Ò¨Ì¦sªº¤é¤l«á¡A´N­×§ï CVS tag¡C¤@¯ë¹w³] ports ªº CVS tag ·|¼g¦b /usr/share/examples/cvsup/ports-supfile + ¡A¦p­n¦^·¹¨ì 2002/10/05 ¸¹ªº¸Ü¡A«h¡G + &prompt.root; vi /usr/share/examples/cvsup/ports-supfile + default date=2002.10.05.00.00.00 #±N date §ï¦¨·í¤é + + µM«á«ö·Ó¤@¯ë CVSup ©Î csup ªº®É­Ô¤@¼Ë¡A°õ¦æ CVSup ©Î csup (make update)¡A¦¹®Éªº + ports collections ´N·|¦^¨ì·í®Éªº±¡§Î¡A¨º»ò¸Ó®M¥óªºÂª©¤]·|¥X²{¦b ports collections ¤¤¡A¥u­n¦w¸Ë§Y¥i¡C + + ¦pªG¶È¬O·Q¦^·¹¬Y³¡¥÷ªº ports¡A«h¥²¶·¥[¤WÃB¥~ªº¸ê°T¡A¦p¶È§Æ±æ§â lang/perl5.8 ¦^·¹¡A + ¦Ó§Ú­Ì±oª¾¦¹ÄÝ©ó lang ¤¤ªº¤@¤ä¡A«h¡G + &prompt.root; vi /usr/share/examples/cvsup/ports-supfile + #ports-all #±N ports-all ¼Ð¥Ü°_¨Ó + ports-lang #¥[¤J³o¦æ + + ³Ì«á¡A°õ¦æ CVSup ©Î csup ¡A¨Ã¦w¸Ë§Y¥i¡C¥Ø«e­Y§Æ±æ³æ¿W¦^·¹³æ¤@ªº port¡A«h¤ñ¸û³Â·Ð¡C + + + + +
+ + Kang-min Liu
gugod@gugod.org
kernel ³]©w §Ú·Q¦Û­q kernel¡A³o·|«Ü§xÃø¶Ü¡H ¤£·|¡I½Ð¬d¾\ ¨Ï¥Î¤â¥U¤¤ªº kernel ³]©w¤@¸`¡C §Ú·|«Øij§A¦b§AÅý®Ö¤ß¯à¥¿±`¤u§@«á¡A°µ¤@­Ó kernel.YYMMDD ¤é´Á§Î¦¡ªº³Æ¥÷¡A¦P®É¤]³Æ¥÷ /module³o­Ó¥Ø¿ý¦Ü /modules.YYMMDD¡C³o¼Ë¤U¦¸¦pªG§A«Ü¤£©¯ªºª± Ãa¤F³]©w¡A¦Ü¤Ö¥i¥H¤£»Ý­n¨Ï¥Î³Ì­ì©lªº kernel.GENERIC¡C¦p§A¥¿±q¤@­Ó GENERIC kernel ¸Ì­±¤£¤ä´©ªº±±¨î¾¹¸Ì±Ò°Ê®É¡A³o´NÅã±o¯S§O­«­n¡C §Úªº®Ö¤ß¦]¬° _hw_float¿ò¥¢¦Ó½sĶ¥¢±Ñ¡C ¸Ó«ç»ò­×¥¿©O¡H Åý§Ú²q¬Ý¬Ý¡A§A§â npx0 (¸Ô¨£ &man.npx.4;) ±q§Aªº kernel ³]©wÀɲ¾°£¤F¡A¦]¬°§A¨S¦³¼Æ¾Ç¹Bºâ¾¹¡A ¹ï¶Ü¡H¿ù¤F¡I:-) ³o­Ó npx0¬O ¥²¶·­n¦³ªº¡C´Nºâ§A¨S¦³¼Æ¾Ç¹Bºâ¾¹¡A§AÁÙ¬O ¥²¶· ¤Þ¤J npx0 ¸Ë¸m¡C ¬°¤°»ò³y¥X¨Óªº kernel ³o»ò¤j (10MB ¥H¤W) ¡H ³o«Ü¦³¥i¯à¬O¦]¬°¡A§A§â kernel ½s¦¨ °»¿ù¼Ò¦¡ ¤F¡C°»¿ù¼Ò¦¡¤§¤Uªº kernel ¸Ì­±·|¦sµÛ°»¿ù¥Îªº³\¦h²Å¸¹¡A¦]¦¹·|¤j´T ¼W¥[ kernel ªº¤j¤p¡C¦pªG»¡§Aªº FreeBSD ¬O 3.0 ¥H«áªºª©¥»¡A³o¹ï©ó ®Ä¯à¨Ó»¡¼vÅT¨Ã¤£¤j¡A´X¥G¬O¨S¦³¡C¦Ó¦b¨t²Î·|¦]¬Y¨Ç­ì¦] panic ®É¡A ¦³­Ó°»¿ù¼Ò¦¡ªº kernel ¦b¤]®¼¦³¥Îªº¡C ¤£¹L©O¡A¦pªG§AªººÏºÐªÅ¶¡«Ü¤p¡A©ÎªÌ§A´N¬O¤£·Q¥Î°»¿ù¼Ò¦¡ªº kernel ªº¸Ü¡A½Ð½T»{¥H¤U¨Æ±¡¡G kernel ³]©wÀɸ̭±¨S¦³³o¤@¦æ¡G makeoptions DEBUGS=-g °õ¦æ &man.config.8; ®É¨S¦³¥[¤W ³o­Ó¿ï¶µ¡C ¥H¤W¨â¥ó¨Æ±¡³£·|Åý§A½s¥X¤@­Ó°»¿ù¼Ò¦¡ªº kernel¡C¦ý¥u­nÁקK¤§¡A ´N¥i¥H½s¥X¤@­Ó¥¿±`ªº kernel¡A¦Ó§A¤]·|ª`·N¨ì¡Akernel ©úÅ㪺Åܤp¤F¡F ¤j³¡¥÷ªº kernel ³£®t¤£¦h¦b 1.5MB ¨ì 2MB ¤§¶¡¡C ¬°¦ó¥X²{¤F multi-port serial code ªº¤¤Â_½Ä¬ð¡H ·í§Ú½sĶ¤@­Ó multi-port serial code ªº®Ö¤ß®É¡A¥¦§i¶D§Ú¥u¦³ ²Ä¤@­Ó³Q°»´ú¨ì¡A¨ä¥Lªº«h¦]¤¤Â_½Ä¬ð¦Ó¸õ¹L¤F¡A§Ú¸Ó«ç»ò­×¥¿¥¦¡H ³o­Ó°ÝÃD¬O¦]¬° FreeBSD ¨Ï¥Î¤º«Øµ{¦¡½XÁקK¦]¬°µwÅé©Î³nÅé½Ä¬ð ¾É­P kernel ¹L©óªÎ¤j©ÎµL¥Î¡C­n­×¥¿³oºØ±¡§Îªº¤èªk¬O°£¤F¤@­Ó port ¥~§â¨ä¥L©Ò¦³ªº IRQ ³]©w³£°µ«O¯d¡C³o¸Ì¦³¤@­Ó½d¨Ò¡G # # Multiport high-speed serial line - 16550 UARTS # device sio2 at isa? port 0x2a0 tty irq 5 flags 0x501 vector siointr device sio3 at isa? port 0x2a8 tty flags 0x501 vector siointr device sio4 at isa? port 0x2b0 tty flags 0x501 vector siointr device sio5 at isa? port 0x2b8 tty flags 0x501 vector siointr ¬°¤°»ò§Ú¤@­Ó kernel ³£½s¤£°_¨Ó¡H¬Æ¦Ü GENERIC ¤]¤£¦æ¡H ³o¦³«Ü¦hºØ¥i¯àªº­ì¦]¡G §A¨S¦³¥Î·sªº make buildkernel »P make installkernel ³o¨â­Ó¤èªk¨Ó½s¡A¦Ó¥¿¦n §Aªº¨t²Î­ì©l½Xªºª©¥»©M¥¿¦b°õ¦æªº¨t²Î®Ö¤ßª©¥»¤£¤@¼Ë (¹³¬O¡A ¦b¶] 4.0-RELEASE ªº¨t²Î¤W¹Á¸ÕµÛ½s 4.3-RELEASE)¡C¦pªG»¡§A­n¤É ¯Å¨t²Îªº¸Ü¡A½Ð°È¥²¥h¬Ý¬Ý /usr/src/UPDATING ³o­ÓÀɮסA¯S§Oª`·N³Ì«á­±ªº COMMON ITEMS ³o­Ó¤p¸`¡C §A¤w¸g¥Î¤W make buildkernel ¥H¤Î make installkernel ¤F¡A¦ý¬O¦b make buildworld ®É¥¢±Ñ¤F¡C¥i±¤ªº¬O¡A make buildkernel ­n¦¨¥\¡A»Ý­n¨Ì¿à make buildworld «á³y¥X¨Óªº¤@¨ÇÀɮסC - ´Nºâ¬O§A¦b½s FreeBSD-STABLE¡A + ´Nºâ¬O§A¦b½s &os.stable;¡A ÁÙ¬O¦³¥i¯à§A§ì¨ì¤F¥¿¦b­×§ï¤¤¡A©ÎµÛ¦]¬°¬Y¨Ç½t¬G¦Ó®Ú¥»ÁÙ¨S§ï¦n - ªº­ì©l½X¡FÁöµM»¡ FreeBSD-STABLE + ªº­ì©l½X¡FÁöµM»¡ &os.stable; ¤j³¡¥÷ªº®É­Ô³£¬O¥i¥H½sªº¡A¦ý¥u¦³ RELEASE ¤~¬O«OÃÒ¥i¥H½sªº¡C¸I ¨ì³o­Ó°ÝÃD®É¡A¦A¦¸§ó·s­ì©l½X¨Ã¥B¦A¸Õ¸Õ¬Ý¡C¤]¦³¥i¯à¬O©ñ­ì©l½Xªº ¦øªA¾¹¥X²{¬Y¨Ç°ÝÃD¡A©Ò¥H§ó·s­ì©l½X®É¤]¸Õ¸Õ±q¤£¦P¦øªA¾¹¨Ó§ó·s¬Ý ¬Ý¡C
µwºÐ¡BÀɮרt²Î¡BBoot Loader ¦p¦ó¦b FreeBSD ¤º§â·sµwºÐ±¾¤W¥h¥Î©O¡H ½Ð°Ñ¾\ ºÏºÐ®æ¦¡¤Æ±Ð¾Ç¡C How do I move my system over to my huge new disk? ²z·Qªº¤è¦¡¬O¥ý¦b·sµwºÐ¤W­«¸Ë¦n§@·~¨t²Î¡AµM«á§â¨Ï¥ÎªÌ¬ÛÃöµ{¦¡¡B¸ê®Æ·h¹L¥h´N¦n¡C This is highly recommended if you have been tracking -STABLE for more than one release, or have updated a release instead of installing a new one. You can install booteasy on both disks with &man.boot0cfg.8;, and dual boot them until you are happy with the new configuration. Skip the next paragraph to find out how to move the data after doing this. Should you decide not to do a fresh install, you need to partition and label the new disk with either - /stand/sysinstall, or &man.fdisk.8; + sysinstall(&os; 5.2 ¤§«eª©¥»«h¬O /stand/sysinstall), or &man.fdisk.8; and &man.disklabel.8;. You should also install booteasy on both disks with &man.boot0cfg.8;, so that you can dual boot to the old or new system after the copying is done. See the formatting-media article for details on this process. Now you have the new disk set up, and are ready to move the data. Unfortunately, you cannot just blindly copy the data. Things like device files (in /dev), flags, and links tend to screw that up. You need to use tools that understand these things, which means &man.dump.8;. Although it is suggested that you move the data in single user mode, it is not required. You should never use anything but &man.dump.8; and &man.restore.8; to move the root filesystem. The &man.tar.1; command may work - then again, it may not. You should also use &man.dump.8; and &man.restore.8; if you are moving a single partition to another empty partition. The sequence of steps to use dump to move a partitions data to a new partition is: newfs the new partition. mount it on a temporary mount point. cd to that directory. dump the old partition, piping output to the new one. For example, if you are going to move root to /dev/ad1s1a, with /mnt as the temporary mount point, it is: &prompt.root; newfs /dev/ad1s1a &prompt.root; mount /dev/ad1s1a /mnt &prompt.root; cd /mnt &prompt.root; dump 0af - / | restore xf - Rearranging your partitions with dump takes a bit more work. To merge a partition like /var into its parent, create the new partition large enough for both, move the parent partition as described above, then move the child partition into the empty directory that the first move created: &prompt.root; newfs /dev/ad1s1a &prompt.root; mount /dev/ad1s1a /mnt &prompt.root; cd /mnt &prompt.root; dump 0af - / | restore xf - &prompt.root; cd var &prompt.root; dump 0af - /var | restore xf - To split a directory from its parent, say putting /var on its own partition when it was not before, create both partitions, then mount the child partition on the appropriate directory in the temporary mount point, then move the old single partition: &prompt.root; newfs /dev/ad1s1a &prompt.root; newfs /dev/ad1s1d &prompt.root; mount /dev/ad1s1a /mnt &prompt.root; mkdir /mnt/var &prompt.root; mount /dev/ad1s1d /mnt/var &prompt.root; cd /mnt &prompt.root; dump 0af - / | restore xf - You might prefer &man.cpio.1;, &man.pax.1;, &man.tar.1; to &man.dump.8; for user data. At the time of this writing, these are known to lose file flag information, so use them with caution. Will a dangerously dedicated disk endanger my health? The installation procedure allows you to chose two different methods in partitioning your hard disk(s). The default way makes it compatible with other operating systems on the same machine, by using fdisk table entries (called slices in FreeBSD), with a FreeBSD slice that employs partitions of its own. Optionally, one can chose to install a boot-selector to switch between the possible operating systems on the disk(s). The alternative uses the entire disk for FreeBSD, and makes no attempt to be compatible with other operating systems. So why it is called dangerous? A disk in this mode does not contain what normal PC utilities would consider a valid fdisk table. Depending on how well they have been designed, they might complain at you once they are getting in contact with such a disk, or even worse, they might damage the BSD bootstrap without even asking or notifying you. In addition, the dangerously dedicated disk's layout is known to confuse many BIOSes, including those from AWARD (e.g. as found in HP Netserver and Micronics systems as well as many others) and Symbios/NCR (for the popular 53C8xx range of SCSI controllers). This is not a complete list, there are more. Symptoms of this confusion include the read error message printed by the FreeBSD bootstrap when it cannot find itself, as well as system lockups when booting. Why have this mode at all then? It only saves a few kbytes of disk space, and it can cause real problems for a new installation. Dangerously dedicated mode's origins lie in a desire to avoid one of the most common problems plaguing new FreeBSD installers - matching the BIOS geometry numbers for a disk to the disk itself. Geometry is an outdated concept, but one still at the heart of the PC's BIOS and its interaction with disks. When the FreeBSD installer creates slices, it has to record the location of these slices on the disk in a fashion that corresponds with the way the BIOS expects to find them. If it gets it wrong, you will not be able to boot. Dangerously dedicated mode tries to work around this by making the problem simpler. In some cases, it gets it right. But it is meant to be used as a last-ditch alternative - there are better ways to solve the problem 99 times out of 100. So, how do you avoid the need for DD mode when you are installing? Start by making a note of the geometry that your BIOS claims to be using for your disks. You can arrange to have the kernel print this as it boots by specifying at the boot: prompt, or using boot -v in the loader. Just before the installer starts, the kernel will print a list of BIOS geometries. Do not panic - wait for the installer to start and then use scrollback to read the numbers. Typically the BIOS disk units will be in the same order that FreeBSD lists your disks, first IDE, then SCSI. When you are slicing up your disk, check that the disk geometry displayed in the FDISK screen is correct (ie. it matches the BIOS numbers); if it is wrong, use the g key to fix it. You may have to do this if there is absolutely nothing on the disk, or if the disk has been moved from another system. Note that this is only an issue with the disk that you are going to boot from; FreeBSD will sort itself out just fine with any other disks you may have. Once you have got the BIOS and FreeBSD agreeing about the geometry of the disk, your problems are almost guaranteed to be over, and with no need for DD mode at all. If, however, you are still greeted with the dreaded read error message when you try to boot, it is time to cross your fingers and go for it - there is nothing left to lose. To return a dangerously dedicated disk for normal PC use, there are basically two options. The first is, you write enough NULL bytes over the MBR to make any subsequent installation believe this to be a blank disk. You can do this for example with &prompt.root; dd if=/dev/zero of=/dev/rda0 count=15 Alternatively, the undocumented DOS feature C:\> fdisk /mbr will to install a new master boot record as well, thus clobbering the BSD bootstrap. Which partitions can safely use Soft Updates? I have heard that Soft Updates on / can cause problems. Short answer: you can usually use Soft Updates safely on all partitions. Long answer: There used to be some concern over using Soft Updates on the root partition. Soft Updates has two characteristics that caused this. First, a Soft Updates partition has a small chance of losing data during a system crash. (The partition will not be corrupted; the data will simply be lost.) Also, Soft Updates can cause temporary space shortages. When using Soft Updates, the kernel can take up to thirty seconds to actually write changes to the physical disk. If you delete a large file, the file still resides on disk until the kernel actually performs the deletion. This can cause a very simple race condition. Suppose you delete one large file and immediately create another large file. The first large file is not yet actually removed from the physical disk, so the disk might not have enough room for the second large file. You get an error that the partition does not have enough space, although you know perfectly well that you just released a large chunk of space! When you try again mere seconds later, the file creation works as you expect. This has left more than one user scratching his head and doubting his sanity, the FreeBSD filesystem, or both. If a system should crash after the kernel accepts a chunk of data for writing to disk, but before that data is actually written out, data could be lost or corrupted. This risk is extremely small, but generally manageable. Use of IDE write caching greatly increases this risk; it is strongly recommended that you disable IDE write caching when using Soft Updates. These issues affect all partitions using Soft Updates. So, what does this mean for the root partition? Vital information on the root partition changes very rarely. Files such as /kernel and the contents of /etc only change during system maintenance, or when users change their passwords. If the system crashed during the thirty-second window after such a change is made, it is possible that data could be lost. This risk is negligible for most applications, but you should be aware that it exists. If your system cannot tolerate this much risk, do not use Soft Updates on the root filesystem! / is traditionally one of the smallest partitions. By default, FreeBSD puts the /tmp directory on /. If you have a busy /tmp, you might see intermittent space problems. Symlinking /tmp to /var/tmp will solve this problem. What is inappropriate about my ccd? The symptom of this is: &prompt.root; ccdconfig -C ccdconfig: ioctl (CCDIOCSET): /dev/ccd0c: Inappropriate file type or format This usually happens when you are trying to concatenate the c partitions, which default to type unused. The ccd driver requires the underlying partition type to be FS_BSDFFS. Edit the disklabel of the disks you are trying to concatenate and change the types of partitions to 4.2BSD. Why can I not edit the disklabel on my ccd? The symptom of this is: &prompt.root; disklabel ccd0 (it prints something sensible here, so let us try to edit it) &prompt.root; disklabel -e ccd0 (edit, save, quit) disklabel: ioctl DIOCWDINFO: No disk label on disk; use "disklabel -r" to install initial label This is because the disklabel returned by ccd is actually a fake one that is not really on the disk. You can solve this problem by writing it back explicitly, as in: &prompt.root; disklabel ccd0 > /tmp/disklabel.tmp &prompt.root; disklabel -Rr ccd0 /tmp/disklabel.tmp &prompt.root; disklabel -e ccd0 (this will work now) Can I mount other foreign filesystems under FreeBSD? FreeBSD supports a variety of other filesystems. Digital UNIX UFS CDROMs can be mounted directly on FreeBSD. Mounting disk partitions from Digital UNIX and other systems that support UFS may be more complex, depending on the details of the disk partitioning for the operating system in question. &linux; FreeBSD supports ext2fs partitions. See &man.mount.ext2fs.8; for more information. &windowsnt; FreeBSD includes a read-only NTFS driver. For more information, see &man.mount.ntfs.8;. FAT FreeBSD includes a read-write FAT driver. For more information, see &man.mount.msdosfs.8;. FreeBSD also supports network filesystems such as NFS (see &man.mount.nfs.8;), NetWare (see &man.mount.nwfs.8;), and Microsoft-style SMB filesystems (see &man.mount.smbfs.8;). How do I mount a secondary DOS partition? The secondary DOS partitions are found after ALL the primary partitions. For example, if you have an E partition as the second DOS partition on the second SCSI drive, you need to create the special files for slice 5 in /dev, then mount /dev/da1s5: &prompt.root; cd /dev &prompt.root; sh MAKEDEV da1s5 &prompt.root; mount -t msdos /dev/da1s5 /dos/e You can omit this step if you are running FreeBSD 5.0-RELEASE or newer with &man.devfs.5; enabled. - Is there a cryptographic filesystem for &os;? + &os; ¦³ÀÉ®×¥[±K¨t²Î¶Ü¡H - Yes. If you are running FreeBSD 5.0 or later, see - &man.gbde.8;. For earlier releases, see the security/cfs port. + ¦³°Ú¡I FreeBSD 5.0 °_¤º«Ø &man.gbde.8;¡A¦Ó FreeBSD 6.0 + ¤S¥[¤W &man.geli.8;¡C ¦Ó¸û¦­´Áªºª©¥»¡A½Ð¦h§Q¥Î security/cfs port¡AÁÂÁ¡C How can I use the &windowsnt; loader to boot FreeBSD? The general idea is that you copy the first sector of your native root FreeBSD partition into a file in the DOS/&windowsnt; partition. Assuming you name that file something like c:\bootsect.bsd (inspired by c:\bootsect.dos), you can then edit the c:\boot.ini file to come up with something like this: [boot loader] timeout=30 default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS [operating systems] multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Windows NT" C:\BOOTSECT.BSD="FreeBSD" C:\="DOS" If FreeBSD is installed on the same disk as the &windowsnt; boot partition simply copy /boot/boot1 to C:\BOOTSECT.BSD. However, if FreeBSD is installed on a different disk /boot/boot1 will not work, /boot/boot0 is needed. /boot/boot0 needs to be installed - using sysinstall by selecting the FreeBSD boot manager on + using sysinstall(&os; 5.2 ¤§«eª©¥»«h¬O /stand/sysinstall) by selecting the FreeBSD boot manager on the screen which asks if you wish to use a boot manager. This is because /boot/boot0 has the partition table area filled with NULL characters but sysinstall copies the partition table before copying /boot/boot0 to the MBR. Do not simply copy /boot/boot0 instead of /boot/boot1; you will overwrite your partition table and render your computer un-bootable! When the FreeBSD boot manager runs it records the last OS booted by setting the active flag on the partition table entry for that OS and then writes the whole 512-bytes of itself back to the MBR so if you just copy /boot/boot0 to C:\BOOTSECT.BSD then it writes an empty partition table, with the active flag set on one entry, to the MBR. How do I boot FreeBSD and &linux; from LILO? If you have FreeBSD and &linux; on the same disk, just follow LILO's installation instructions for booting a non-&linux; operating system. Very briefly, these are: Boot &linux;, and add the following lines to /etc/lilo.conf: other=/dev/hda2 table=/dev/hda label=FreeBSD (the above assumes that your FreeBSD slice is known to &linux; as /dev/hda2; tailor to suit your setup). Then, run lilo as root and you should be done. If FreeBSD resides on another disk, you need to add loader=/boot/chain.b to the LILO entry. For example: other=/dev/dab4 table=/dev/dab loader=/boot/chain.b label=FreeBSD In some cases you may need to specify the BIOS drive number to the FreeBSD boot loader to successfully boot off the second disk. For example, if your FreeBSD SCSI disk is probed by BIOS as BIOS disk 1, at the FreeBSD boot loader prompt you need to specify: Boot: 1:da(0,a)/kernel - On FreeBSD 2.2.5 and later, you can configure + You can configure &man.boot.8; to automatically do this for you at boot time. The &linux;+FreeBSD mini-HOWTO is a good reference for FreeBSD and &linux; interoperability issues. How do I boot FreeBSD and &linux; using BootEasy? Install LILO at the start of your &linux; boot partition instead of in the Master Boot Record. You can then boot LILO from BootEasy. If you are running &windows; 95 and &linux; this is recommended anyway, to make it simpler to get &linux; booting again if you should need to reinstall &windows; 95 (which is a Jealous Operating System, and will bear no other Operating Systems in the Master Boot Record). How do I change the boot prompt from ??? to something more meaningful? You can not do that with the standard boot manager without rewriting it. There are a number of other boot managers in the sysutils ports category that provide this functionality. I have a new removable drive, how do I use it? Whether it is a removable drive like a &iomegazip; or an EZ drive (or even a floppy, if you want to use it that way), or a new hard disk, once it is installed and recognized by the system, and you have your cartridge/floppy/whatever slotted in, things are pretty much the same for all devices. (this section is based on Mark Mayo's ZIP FAQ) If it is a ZIP drive or a floppy, you have already got a DOS filesystem on it, you can use a command like this: &prompt.root; mount -t msdos /dev/fd0c /floppy if it is a floppy, or this: &prompt.root; mount -t msdos /dev/da2s4 /zip for a ZIP disk with the factory configuration. For other disks, see how they are laid out using &man.fdisk.8; or &man.sysinstall.8;. The rest of the examples will be for a ZIP drive on da2, the third SCSI disk. Unless it is a floppy, or a removable you plan on sharing with other people, it is probably a better idea to stick a BSD filesystem on it. You will get long filename support, at least a 2X improvement in performance, and a lot more stability. First, you need to redo the DOS-level partitions/filesystems. You can either use &man.fdisk.8; or - /stand/sysinstall, or for a small drive + sysinstall(&os; 5.2 ¤§«eª©¥»«h¬O /stand/sysinstall), or for a small drive that you do not want to bother with multiple operating system support on, just blow away the whole FAT partition table (slices) and just use the BSD partitioning: &prompt.root; dd if=/dev/zero of=/dev/rda2 count=2 &prompt.root; disklabel -Brw da2 auto You can use disklabel or - /stand/sysinstall to create multiple BSD + sysinstall to create multiple BSD partitions. You will certainly want to do this if you are adding swap space on a fixed disk, but it is probably irrelevant on a removable drive like a ZIP. Finally, create a new filesystem, this one is on our ZIP drive using the whole disk: &prompt.root; newfs /dev/rda2c and mount it: &prompt.root; mount /dev/da2c /zip and it is probably a good idea to add a line like this to /etc/fstab (see &man.fstab.5;) so you can just type mount /zip in the future: /dev/da2c /zip ffs rw,noauto 0 0 Why do I get Incorrect super block when mounting a CDROM? You have to tell &man.mount.8; the type of the device that you want to mount. This is described in the Handbook section on optical media, specifically the section Using Data CDs. Why do I get Device not configured when mounting a CDROM? This generally means that there is no CDROM in the CDROM drive, or the drive is not visible on the bus. Please see the Using Data CDs section of the Handbook for a detailed discussion of this issue. Why do all non-English characters in filenames show up as ? on my CDs when mounted in FreeBSD? Your CDROM probably uses the Joliet extension for storing information about files and directories. This is discussed in the Handbook chapter on creating and using CDROMs, specifically the section on Using Data CDROMs. I burned a CD under FreeBSD and now I can not read it under any other operating system. Why? You most likely burned a raw file to your CD, rather than creating an ISO 9660 filesystem. Take a look at the Handbook chapter on creating CDROMs, particularly the section on burning raw data CDs. How can I create an image of a data CD? This is discussed in the Handbook section on duplicating data CDs. For more on working with CDROMs, see the Creating CDs Section in the Storage chapter in the Handbook. Why can I not mount an audio CD? If you try to mount an audio CD, you will get an error like cd9660: /dev/acd0c: Invalid argument. This is because mount only works on filesystems. Audio CDs do not have filesystems; they just have data. You need a program that reads audio CDs, such as the audio/xmcd port. How do I mount a multi-session CD? By default, &man.mount.8; will attempt to mount the last data track (session) of a CD. If you would like to load an earlier session, you must use the command line argument. Please see &man.mount.cd9660.8; for specific examples. How do I let ordinary users mount floppies, CDROMs and other removable media? Ordinary users can be permitted to mount devices. Here is how: As root set the sysctl variable vfs.usermount to 1. &prompt.root; sysctl -w vfs.usermount=1 As root assign the appropriate permissions to the block device associated with the removable media. For example, to allow users to mount the first floppy drive, use: &prompt.root; chmod 666 /dev/fd0 To allow users in the group operator to mount the CDROM drive, use: &prompt.root; chgrp operator /dev/acd0c &prompt.root; chmod 640 /dev/acd0c If you are running &os; 5.X or later, you will need to alter /etc/devfs.conf to make these changes permanent across reboots. As root, add the necessary lines to /etc/devfs.conf. For example, to allow users to mount the first floppy drive add: # Allow all users to mount the floppy disk. own /dev/fd0 root:operator perm /dev/fd0 0666 To allow users in the group operator to mount the CD-ROM drive add: # Allow members of the group operator to mount CD-ROMs. own /dev/acd0 root:operator perm /dev/acd0 0660 Finally, add the line vfs.usermount=1 to the file /etc/sysctl.conf so that it is reset at system boot time. All users can now mount the floppy /dev/fd0 onto a directory that they own: &prompt.user; mkdir ~/my-mount-point &prompt.user; mount -t msdos /dev/fd0 ~/my-mount-point Users in group operator can now mount the CDROM /dev/acd0c onto a directory that they own: &prompt.user; mkdir ~/my-mount-point &prompt.user; mount -t cd9660 /dev/acd0c ~/my-mount-point Unmounting the device is simple: &prompt.user; umount ~/my-mount-point Enabling vfs.usermount, however, has negative security implications. A better way to access &ms-dos; formatted media is to use the emulators/mtools package in the ports collection. The device name used in the previous examples must be changed according to your configuration. The du and df commands show different amounts of disk space available. What is going on? You need to understand what du and df really do. du goes through the directory tree, measures how large each file is, and presents the totals. df just asks the filesystem how much space it has left. They seem to be the same thing, but a file without a directory entry will affect df but not du. When a program is using a file, and you delete the file, the file is not really removed from the filesystem until the program stops using it. The file is immediately deleted from the directory listing, however. You can see this easily enough with a program such as more. Assume you have a file large enough that its presence affects the output of du and df. (Since disks can be so large today, this might be a very large file!) If you delete this file while using more on it, more does not immediately choke and complain that it cannot view the file. The entry is simply removed from the directory so no other program or user can access it. du shows that it is gone — it has walked the directory tree and the file is not listed. df shows that it is still there, as the filesystem knows that more is still using that space. Once you end the more session, du and df will agree. Note that Soft Updates can delay the freeing of disk space; you might need to wait up to 30 seconds for the change to be visible! This situation is common on web servers. Many people set up a FreeBSD web server and forget to rotate the log files. The access log fills up /var. The new administrator deletes the file, but the system still complains that the partition is full. Stopping and restarting the web server program would free the file, allowing the system to release the disk space. To prevent this from happening, set up &man.newsyslog.8;. How can I add more swap space? In the Configuration and Tuning section of the Handbook, you will find a section describing how to do this. Why does &os; see my disk as smaller than the manufacturer says it is? Disk manufacturers calculate gigabytes as a billion bytes each, whereas &os; calculates them as 1,073,741,824 bytes each. This explains why, for example, &os;'s boot messages will report a disk that supposedly has 80GB as holding 76319MB. Also note that &os; will (by default) reserve 8% of the disk space. How is it possible for a partition to be more than 100% full? A portion of each UFS partition (8%, by default) is reserved for use by the operating system and the root user. &man.df.1; does not count that space when calculating the Capacity column, so it can exceed 100%. Also, you will notice that the Blocks column is always greater than the sum of the Used and Avail columns, usually by a factor of 8%. For more details, look up the option in &man.tunefs.8;. Wei-Hon Chen
plasmaball@pchome.com.tw
¨t²ÎºÞ²z ¨t²Î°_©l³]©wÀɦb­þ¡H ±q 2.0.5R ¨ì 2.2.1R¡A¥D­nªº³]©wÀɬO /etc/sysconfig¡C©Ò¦³ªº¿ï¶µ³£³Q«ü©w¦b³o­ÓÀÉ¡A ¦Ó¨ä¥L¹³ /etc/rc (°Ñ¨£ &man.rc.8;) ©M /etc/netstart ¥u¬O¤Þ¥Î¥¦¡C Æ[¹î /etc/sysconfig ³o­ÓÀɨíץ¿¨ä­È¥H ¾A¦X§Aªº¨t²Î¡C³o­ÓÀɥεù¸Ñ¶ñº¡¥Hªí¥Ü¦ó³B¸Ó©ñ¸m¤°»ò³]©w¡C ¦b post-2.2.1 ¥H«á¤Î 3.0¡A/etc/sysconfig ¥ç§ó¦W¬°¤@­Ó§ó®e©ö´y­zªºÀɦW¥s &man.rc.conf.5; ¡A¨Ã¥B»yªk²¤Æ¤F¨Ç¡C /etc/netstart ¥ç§ó¦W¬° /etc/rc.network ¦]¦¹©Ò¦³ªºÀɮ׳£¥i¥H¥Î cp /usr/src/etc/rc* /etc ¨Ó«þ¨©¡C ¦b 3.1 ¥H¤Î¡A/etc/rc.conf ³Q²¾¨ì /etc/defaults/rc.conf¡C ¤d¸U¤£­n½s¿è³o­ÓÀÉ¡I ¦pªG /etc/defaults/rc.conf ¤º¦³·Q­n§ó°Êªº¶µ¥Ø¡A §AÀ³¸Ó±N¨º¤@¦æªº¤º®e«þ¨©¨ì /etc/rc.conf¡A µM«á¦A­×§ï¥¦¡C ¨Ò¦p FreeBSD 3.1 ¤Î¥H«áªºª©¥»¤º¡A¦³¤@­Ó DNS ¦øªA¾¹ named¡A ¦Ó§A·Q­n±Ò°Ê¥¦¡C§A©Ò»Ý­n§@ªº¨Æ´N¬O¡G &prompt.root; echo named_enable="YES" >> /etc/rc.conf ·Q­n¦b FreeBSD 3.1 ¤Î¥H«áªºª©¥»¤¤¡A±Ò°Ê¥»¦aºÝªA°Èªº¸Ü¡A±N shell script ¸m©ó /usr/local/etc/rc.d ¥Ø¿ý ¤U¡C³o¨Ç shell script À³¸Ó³]©w¦¨¥i°õ¦æ¡A¨Ã¥BÀɦW¥H .sh µ²§ô¡C ¦b FreeBSD 3.0 ¤Î§ó¦­ªºª©¥»¤¤¡A§AÀ³¸Óª½±µ½s¿è /etc/rc.local ÀÉ¡C /etc/rc.serial¥Î¨Óªì©l¤Æ§Ç¦C°ð ¡]¹³¬OÂê©w°ðªº¯S©Êµ¥¡^¡C /etc/rc.i386 ¬O Intel ±M¥Î³]©w¡A ¹³¬O iBCS2 ¼ÒÀÀ©Î¬O PC ¨t²Î¥D±±¥x³]©w¡C - §Ú¸Ó¦p¦ó²³æ¦a¥[¤J¨Ï¥ÎªÌ¡H + ¸Ó¦p¦ó²³æ¦a·s¼W±b¸¹¡H ¨Ï¥Î &man.adduser.8; «ü¥O¡C¦pªG»Ý­n§ó½ÆÂøªº¨Ï¥Î¤è¦¡¡A ½Ð¥Î &man.pw.8; ³o­Ó«ü¥O¡C ­n¦A¦¸²¾°£¨Ï¥ÎªÌ¡A¨Ï¥Î &man.rmuser.8; «ü¥O¡CÁÙ¦³¡A &man.pw.8; ¤]¥i¥H¨Ï¥Î¡C - ¦b§Ú½s¿è crontab Àɮפ§«á¡A¬°¤°»ò§Ú¦Ñ¬O¦¬¨ì³o¼Ëªº°T®§¡G + ¦b§ï§¹ crontab Àɮ׫á¡A¬°¤°»ò¦Ñ¬O¦¬¨ì³o¼Ëªº°T®§¡G root: not found¡H ³q±`³£¬O¦]¬°½s¿è¤F¨t²Îªº crontab (/etc/crontab) µM«á´N¥Î &man.crontab.1; ¥h¦w¸Ë¥¦¡G &prompt.root; crontab /etc/crontab ³o¼Ë§@¬O¤£¹ïªº¡C¨t²Îªº crontab ©M &man.crontab.1; ©Ò§ó·sªº¨Ï¥ÎªÌªº crontab ®æ¦¡¨Ã¤£¤@¼Ë (&man.crontab.5; »¡©ú¤å¥ó°w¹ï®t²§³B¦³¸Ô²Óªº»¡©ú)¡C ¦pªG§A¤w¸g¥Î³oºØ¤èªk¡AÃB¥~¦h¥Xªº crontab ¥u´N¬O /etc/crontab ªº«þ¨©¡A¥u¬O®æ¦¡¬O¿ù»~ªº¡C ¥i¥Î¥H¤Uªº©R¥O§R°£¡G &prompt.root; crontab -r ¤U¦¸§A½s¿è /etc/crontab Àɮתº®É­Ô¡A §A¤£¥Î§@¥ô¦ó°Ê§@¥h³qª¾ &man.cron.8; ¡A¥¦¦Û°Ê·|¥h°»´ú¬O§_¦³§ó°Ê¡C ¦pªG§A·Q­n¨C¤Ñ¡B¨C¶g¡B©Î¬O¨C¤ë©T©w°õ¦æ¬Y¨Ç°Ê§@¤@¦¸¡A¤]³\¥[­Ó shell script ¦b /usr/local/etc/periodic ¥Ø¿ý¤U·|§ó¦n¡A¨t²Îªº cron ·|©T©w°õ¦æ &man.periodic.8; ©R¥O¡A ¥¦¥i±N§Aªºµ{¦¡©M¨ä¥¦ªº¨t²Î¶g´Á©Ê¤u§@¤@°_°õ¦æ¡C ³o­Ó¿ù»~ªº¯u¥¿­ì¦]¡A¬O¦]¬°¨t²Îªº crontab ¦³¤@­ÓÃB¥~ªºÄæ¦ì¡A »¡©ú¸Ó©R¥O­n¥H¤°»ò¨Ï¥ÎªÌ¨­¥÷°õ¦æ¡C¦b FreeBSD ªº¹w³]¨t²Î crontab ¤¤¡A©Ò¦³ªº¶µ¥Ø³£¬O root¡C ·í³o­Ó crontab ³Q·í§@¬O root ªº¨Ï¥ÎªÌ crontab (¥¦©M¨t²Îªº crontab ¬O ¤£ ¤@¼Ëªº)¡A&man.cron.8; ·|¥H¬° root ¦r¦ê¬O±ý°õ¦æªº©R¥Oªº²Ä¤@­Ó¦r¡A¦ý¬O¹ê»Ú¤W ¨Ã¨S¦³³o¼Ëªº©R¥O¦s¦b¡C ¬°¤°»ò§Ú·Q­n¥Î su ¦¨¬° root ®É¡A·|±o¨ì you are not in the correct group to su root ªº¿ù»~°T®§¡H ³o¬O¤@­Ó¦w¥þ¯S©Ê¡C·Q­n§Q¥Î su ¦¨¬° root (©Î¨ä¥¦¦³ superuser Åv­­ªº±b¸¹)¡A§A¤@©w­n¦b wheel ¸s²Õ¤º¡C¦pªG¨S¦³³o­Ó¯S©Êªº¸Ü¡A ¥ô¦ó¤H¥u­n¦b¨t²Î¸Ì¦³±b¸¹¡A¨Ã¥B«ê¥©ª¾¹D root ªº±K½X¡A´N¥i¥H¨ú±o superuser µ¥¯ÅªºÅv­­¥H¦s¨ú¨t²Î¡C¦³¤F³o­Ó¯S©Ê¡A ³o¼Ëªº±¡ªp´N¤£·|µo¥Í¡F¦pªG¨Ï¥ÎªÌ¤£¦b wheel ¸s²Õ¤ºªº¸Ü¡A&man.su.1; ·|Åý¥L­Ì³s¸ÕµÛÁä¤J±K½Xªº¾÷·|³£¨S¦³¡C ­nÅý¬Y¤H¥i¥H§Q¥Î su ¦¨¬° root ªº¸Ü¡A ¥u­n§â¥L­Ì©ñ¤J wheel ¸s²Õ¤º§Y¥i¡C §Ú¦b rc.conf ÁÙ¬O¬Y­Ó°_°ÊÀɮ׸̥ǤF¿ù»~¡A ¦]¬°Àɮרt²ÎÅܦ¨°ßŪªº¡A§ÚµLªk¥h½s¿è¥¦¡C§Ú¸Ó«ç»ò¿ì¡H ·í¹q¸£°Ý§A shell §¹¾ã¸ô®|¦W®É¡A¥u­n«ö ENTER ¡AµM«á°õ¦æ mount / ¥HŪ¼g¼Ò¦¡ ­«·s±¾¸ü®ÚÀɮרt²Î¡C§A¤]³\»Ý­n°õ¦æ mount -a -t ufs ¡A±N§AºD¥Îªº¤å¦r½s¿è¾¹©Ò¦bªºÀɮרt²Î±¾¸ü¤W¨Ó¡C¦pªG §AºD¥Îªº¤å¦r½s¿è¾¹¦bºô¸ôÀɮרt²Î¤Wªº¸Ü¡A§A¥²¶·¥ý¤â°Ê±Nºô¸ô³]©w °_¨Ó¡A¥H«K±Nºô¸ôÀɮרt²Î±¾¸ü¤W¨Ó¡A©Î¬O¨Ï¥Î¥»¦aºÝÀɮרt²Î¤Wªº ½s¿è¾¹¡A¨Ò¦p &man.ed.1;¡C ¦pªG§A·Q­n¨Ï¥Î¹³ &man.vi.1; ©Î¬O &man.emacs.1; µ¥ªº¥þ¿Ã¹õ ¤å¦r½s¿è¾¹ªº¸Ü¡A§A¤]»Ý­n°õ¦æ export TERM=cons25 ¡A¥H«KÅý³o¨Ç½s¿è¾¹¯à°÷±q &man.termcap.5; ¸ê®Æ®w¸ÌŪ¨ú¥¿½Tªº¸ê®Æ¡C ·í§A¤w¸g§¹¦¨¤F³o¨Ç¨BÆJ«á¡A§A¥i¥H·Ó§A¥­±`­×§ï¤åªk¿ù»~ªº¤è¦¡ ¥h½s¿è /etc/rc.conf ÀɮסC¦b®Ö¤ß (kernel) ±Ò°Ê®É©ÒÅã¥Üªº¿ù»~°T®§¡A¯à°÷§i¶D§AÀɮפ¤­þ¤@¦æ¦³¿ù»~¡C ¬°¤°»ò§Ú¨S¿ìªk³]©w§Úªº¦Lªí¾÷¡H ½Ð°Ñ¦Ò¤@¤U Handbook ¤¤¡A¦³Ãö¦C¦Lªº³¡¥÷¡C¥¦À³¸Ó¯à°÷¸Ñ¨M §A¤j³¡¥÷ªº°ÝÃD¡C½Ð°Ñ¦Ò Handbook ¤¤ªº¦C¦L³¡¥÷¡C ¦³¨Ç¦Lªí¾÷»Ý­n¥D¾÷¤ä´©ªºÅX°Êµ{¦¡ (host-based driver) ¤~¯à °õ¦æ¥ô¦ó¦C¦L¥\¯à¡CFreeBSD ¥»¨­¨Ã¤£¤ä´©³o¨Ç©Ò¿×ªº WinPrinters¡C ¦pªG§Aªº¦Lªí¾÷µLªk¦b DOS ©Î Windows NT 4.0 ¤U°õ¦æ¡A¨º¥¦¤j·§´N¬O¤@¥x WinPrinter¡C§A°ß¤@¯à¨Ï¥Î ³o¼Ëªº¦Lªí¾÷ªº§Æ±æ¡A´N¬O¸Õ¸Õ print/pnm2ppa ¤ä¤£¤ä´©¥¦¤F¡C §Ú­n«ç»ò¼Ë­×¥¿§Úªº¨t²Î©Ò¨Ï¥ÎªºÁä½L¹ï¬M (keyboard mapping)¡H ½Ð°Ñ¦Ò Handbook ¤¤ªº using localization ³¹¸`¡A¤×¨ä¬O console setup ³¹¸`¡C ¬°¤°»ò§Ú¦b¨t²Î±Ò°Ê®É¡A±o¨ì unknown: <PNP0303> can't assign resources ªº°T®§¡H - ¥H¤U¬O±q freebsd-current ³q«H½×¾Âªº¤@½g¤å³¹¤¤¸`¿ý¥X¨Óªº¡C + ¥H¤U¬O±q &os.current; ³q«H½×¾Âªº¤@½g¤å³¹¤¤¸`¿ý¥X¨Óªº¡C
&a.wollman;, 2001 ¦~¥|¤ë 24 ¤é µLªk«ü¬£¸ê·½ (can't assign resources) °T®§ªí¥Ü ¨º¨Ç¸Ë¸m¬O¶Ç²Îªº ISA ¸Ë¸m¡A¦Ó®Ö¤ß¤¤¤w¸g½s¤J¤£»{±o PNP ªºÅX°Êµ{ ¦¡¡C³o¨Ç¸Ë¸m¥]¬AÁä½L±±¨î¾¹¡A¥iµ{¦¡¤Æ§ÃÂ_±±¨î´¹¤ù¡AÁÙ¦³´X­Ó¼Ð·Ç ³]³Æ¡C¸ê·½µLªk«ü¬£µ¹³o¨Ç¸Ë¸m¡A¬O¦]¬°¦­¤w¦³ÅX°Êµ{¦¡¨Ï¥Î¨º¨Ç¦ì§} ¤F¡C
- ¬°¤°»ò§ÚµLªkÅý user quotas ¥¿±`¤u§@¡H + ¬°¤°»ò user quotas µLªk¥¿±`¹B§@¡H - ¤£­n¦b / ¥´¶} quotas¡A + ¥i¯à§A kernel ³]©w¥¼¥[¤J quotas ¤ä´©(¹w³]¬OµL)¡C¦pªG¬O³o¼Ë¤lªº¸Ü¡A + ¨º»ò½Ð§â¤U­±³o¦æ¥[¨ì kernel ³]©wÀɤº¨Ã­«·s½sĶ¡B¦w¸Ë¡G + options QUOTA + + ²Ó¸`³¡¤À¡A½Ð°Ñ¾\ Handbook ¤ºªº + quotas ³¹¸`¡C + + + + ½Ð¤£­nª½±µ¦b / ¥´¶} quotas §â quotas ÀÉ©ñ¦b¥¦¥²¶·±j­¢¸m¤JªºÀɮרt²Î¤º¡AÁ|¨Ò¡G Àɮרt²Î Quota ÀÉ /usr /usr/admin/quotas /home /home/admin/quotas FreeBSD ¤ä´© System V IPC ®æ¦¡«ü¥O¶°¡H ¬Oªº¡AFreeBSD ¤ä´© System V-style IPC¡C³o¥]¬A¦@¨É°O¾ÐÅé¡A °T®§¸ò«H¸¹¡C§A»Ý­n¦b§Aªº kernel ³]©wÀɤº¥[¤J¤U¦C´X¦æ¥H±Ò°Ê¥¦­Ì¡C options SYSVSHM # enable shared memory options SYSVSEM # enable for semaphores options SYSVMSG # enable for messaging ¦b FreeBSD 3.2 ¥H¤Î¤§«áªºª©¥»¡A³o¨Ç¿ï¶µ¤w¸g¬O GENERIC ®Ö¤ßªº¤@³¡¥÷¡A¤]´N¬O»¡¥¦­Ì¤w ¸g½s¶i¤F§Aªº¨t²Î¤¤¡C ­«·s½sĶ¨Ã¦w¸Ë¡C §Ú¸Ó¦p¦óÅý sendmail ³z¹L UUCP ¨Ó»¼°e¶l¥ó¡H ¸òÀH FreeBSD ®M¸Ë¦Ó¨Óªº sendmail ³]©w¬O¾A¦X¨º¨Çª½±µ³s¤Wºô»Úºô¸ô ªº¯¸¥x¡C·Q³z¹L UUCP ¥æ´«¶l¥óªº¯¸¥x¥²¶·¥t¥~¦w¸Ë sendmail ªº³]©wÀɮסC ¤â°Ê­×§ï /etc/sendmail.cf ¬Oµ´¹ï¥²­nªº¡C ²Ä 8 ª©ªº sendmail ´£¨Ñ¤@­Ó¥þ·sªº¤J¤f¥H³z¹L¤@¨Ç¹³ &man.m4.1; ªº³B²z´N¯à²£¥Í³]©wÀÉ¡A³o¨Æ¹ê¤W¬O¤@­Ó°ª¼h·§©Àµ¥¯Åªº§Þ¥©©Ê³]©w¡C §AÀ³¸Ó¥i¥H¦b /usr/src/usr.sbin/sendmail/cf ¥H¤U¸Ì¨Ï¥Î¥¦¡G °²¦p§A¤£¬O¥Î full sources ¤è¦¡¦w¸Ë¨t²Î¡A¨º»ò sendmail ³]©w¶µ¥Ø¥i¯à¤w¸g¤À´²¦¨¦n´X­Ó¨Ó·½¤À¥¬Àɦbµ¥µÛ§A¡A°²³]§A¤w¸g mount ¥úºÐ¾÷¡A°µ¥H¤U°Ê§@¡G &prompt.root; cd /cdrom/src &prompt.root; cat scontrib.?? | tar xzf - -C /usr/src contrib/sendmail §OÅå·W¡A³o¥u¦³¼Æ¤Q¸U­Ó¦ì¤¸²Õªº¤j¤p¡C¦b cf ¥Ø¿ý¸Ìªº README ¥i¥H´£¨Ñ¤@­Ó m4 ³]©wªkªº°ò ¥»¤¶²Ð¡C ¥H UUCP »¼°e¨Ó»¡¡A«Øij§A³Ì¦n¨Ï¥Î mailertable ¯SÂI¡C«Øºc¤@­Ó¸ê®Æ®wÅý sendmail ¥i¥H¨Ï¥Î¥¦¦Û¤vªº¸ô®|¨Mµ¦¡C ­º¥ý¡A§A¥²¶·«Ø¥ß¦Û¤vªº .mc ÀÉ¡C /usr/src/usr.sbin/sendmail/cf/cf ¥Ø¿ý¬O³o¨Ç Àɮתº®a¡C¬d¬Ý¤@¤U¡A¤w¸g¦³¦n´X­Ó½d¨ÒÀÉ¡A°²³]§A¤w¸g©R¦W¦Û¤vªºÀÉ¥s foo.mc¡A§A­n°µªº¥u¬O§â¥¦Âà´«¦¨¤@­Ó¦³®Äªº sendmail.cf¡G &prompt.root; cd /usr/src/usr.sbin/sendmail/cf/cf &prompt.root; make foo.cf &prompt.root; cp foo.cf /etc/mail/sendmail.cf ¤@­Ó¨å«¬ªº .mc Àɬݰ_¨Ó¥i¯à¹³³o¼Ë¡G VERSIONID(`Your version number') OSTYPE(bsd4.4) FEATURE(accept_unresolvable_domains) FEATURE(nocanonify) FEATURE(mailertable, `hash -o /etc/mail/mailertable') define(`UUCP_RELAY', your.uucp.relay) define(`UUCP_MAX_SIZE', 200000) define(`confDONT_PROBE_INTERFACES') MAILER(local) MAILER(smtp) MAILER(uucp) Cw your.alias.host.name Cw youruucpnodename.UUCP accept_unresolvable_domains¡A nocanonify¡A ©M confDONT_PROBE_INTERFACES ¯S©Ê±NÁקK¥ô¦ó¦b »¼°e¶l¥ó®É·|¥Î¨ì DNS ªº¾÷·|¡CUUCP_RELAY ¶µ¥Øªº¥X²{²z¥Ñ«Ü©_©Ç¡A´N¤£­n°Ý¬°¦ó¤F¡C²³æªº©ñ¤J¤@­Óºô»Úºô¸ô ¤W¥i¥H³B²z .UUCP µêÀÀºô°ì¦ì§}ªº¥D¾÷¦WºÙ¡F³q±`¡A§A¥u»Ý­n¦b³o ¸Ì¶ñ¤J§A ISP ªº«H¥ó¦^ÂгB (mail replay)¡C §A¤w¸g°µ¨ì³o¸Ì¤F¡A§AÁٻݭn³o­Ó¥s /etc/mail/mailertable¡C¦pªG§A¥u¦³¤@­Ó¥Î ¨Ó¶Ç»¼©Ò¦³¶l¥óªº¹ï¥~³q¹Dªº¸Ü¡A¥H¤UªºÀÉ®×´N¨¬°÷¤F¡G # # makemap hash /etc/mail/mailertable.db < /etc/mail/mailertable uucp-dom:your.uucp.relay ¥t¤@­Ó§ó½ÆÂøªº¨Ò¤l¬Ý°_¨Ó¹³³o¼Ë¡G # # makemap hash /etc/mail/mailertable.db < /etc/mail/mailertable # horus.interface-business.de uucp-dom:horus interface-business.de uucp-dom:if-bus interface-business.de uucp-dom:if-bus heep.sax.de smtp8:%1 horus.UUCP uucp-dom:horus if-bus.UUCP uucp-dom:if-bus uucp-dom: ¦p§A©Ò¨£¡A³o¬O¬Y­Ó¯u¹êÀɮ׸̪º¤@³¡¥÷¡C­º¤T¦æ³B²zºô°ì©w§}«H¥ó ¤£À³¸Ó³Q°e¥X¨ì¤º©w¸ô®|¡A¦Ó¥Ñ¬Y¨Ç UUCP ¾F©~(UUCP neighbor)¨ú¥N ªº¯S®í±¡§Î¡A³o¬O¬°¤F ÁYµu»¼°eªº¸ô®|¡C¤U¤@¦æ³B²z¨ì ¥»¦a¤A¤Óºô¸ôºô°ìªº«H¥óÅý¥¦¥i¥H¨Ï¥Î SMTP ¨Ó»¼°e¡C³Ì«á¡AUUCP ¾F©~´£¨ì .UUCP µêÀÀºô°ìªº°O¸ü¡A¤¹³\¤@­Ó uucp-neighbor !recipient ±À½ ¤º©w³W«h¡C³Ì«á¤@¦æ«h¥H¤@­Ó³æ¿Wªº¥yÂI°µµ²§ô¡A¥H UUCP »¼°e¨ì´£¨Ñ·í §A¥þ¥@¬É©Ê¶l¥ó¹hªùªºUUCP ¾F©~¡C©Ò¦³¦b uucp-dom: ÃöÁä¦r¸Ìªº¸`ÂI¦WºÙ¥²¶·³£¬O¦³®Äªº UUCP ¾F©~¡A§A¥i¥H¥Î uuname ©R¥O¥h½T»{¡C ´£¿ô§A³o­ÓÀɮצb¨Ï¥Î«e¥²¶·³QÂà´«¦¨ DBM ¸ê®Æ®wÀɮסA³Ì¦n¦b mailertable ³Ì¤W­±¥Îµù¸Ñ¼g¥X©R¥O¦C¨Ó§¹¦¨³o­Ó¤u§@¡C·í§A¨C¦¸§ó´«§A ªº mailertable «á§AÁ`¬O»Ý­n°õ¦æ³o­Ó©R¥O¡C ³Ì«á´£¥Ü¡G¦pªG§A¤£½T©w¬Y¨Ç¯S©wªº«H¥ó¸ô®|¥i¥Î¡A°O±o§â ¿ï¶µ¥[¨ì sendmail¡C³o·|±N sendmail ±Ò°Ê¦b address test mode¡F¥u­n«ö¤U 0¡A±µµÛ¿é¤J§A§Æ±æ´ú¸Õªº«H¥ó¸ô®|¦ì§}¡C ³Ì«á¤@¦æ§i¶D§A¨Ï¥Î¤º³¡ªº«H¥ó¥N²zµ{¦¡¡A¥N²zµ{¦¡ªº·|³qª¾¥Øªº¥D¾÷¡A ¥H¤Î(¥i¯àÂà´«ªº)¦ì§}¡C­nÂ÷¶}¦¹¼Ò¦¡½Ð«ö Control-D¡C &prompt.user; sendmail -bt ADDRESS TEST MODE (ruleset 3 NOT automatically invoked) Enter <ruleset> <address> > 3,0 foo@example.com canonify input: foo @ example . com .. parse returns: $# uucp-dom $@ your.uucp.relay $: foo < @ example . com . > > ^D ·í§Ú¥Î¼·±µ³s¤Wºô¸ô®É¸Ó«ç»ò³]©w«H¥ó»¼°e¡H ¦pªG§A¤w¸g¦³¤@­Ó©T©wªº IP ¼Æ¦r¡A§A¤£»Ý­n½Õ¾ã¥ô¦ó¤º©w­È¡C³]¦n §A­n«ü©wªººô¸ô¦WºÙ¡A¨ä¥Lªº sendmail ³£·|À°§A°µ§¹¡C ¦pªG§A®³¨ìªº¬O°ÊºA°t¸mªº IP ¼Æ¦r¦Ó¨Ï¥Î¼·±µ ppp ³s±µ¨ìºô»Úºô ¸ô¡A§A¥i¯à¤w¸g¦b§Aªº ISP «H¥ó¥D¾÷¤W¦³¤@­Ó«H½c¡C°²³]§Aªº ISP ºô°ì ¬O example.net¡A§Aªº¨Ï¥ÎªÌ¦W ºÙ¬O user¡C¥ç°²³]§AºÙ¦Û¤vªº¥D¾÷¦WºÙ¬O bsd.home ¦Ó§Aªº ISP §i¶D§A¥i¥H¨Ï¥Î relay.example.net ·í§@«H¥ó¦^ÂгB¡C ¬°¤F±q§Aªº«H½c±µ¦¬«H¥ó¡A§A±N»Ý­n¦w¸Ë¨ú«Hµ{¦¡¥H«K±q«H½c¨ú¦^«H¥ó¡C Fetchmail ¬O¤@­Ó¤£¿ùªº¿ï¾Ü¡A¦]¬°¥¦¤ä ´©³\¦h¤£¦Pªº³q°T¨ó©w¡A³q±`§Aªº ISP ·|´£¨Ñ POP3¡C¦pªG§A¿ï¾Ü¨Ï¥Î user-ppp¡A§A¥i¥H¦b³s½u¨ìºô¸ô¦¨¥\«á¦Û°Ê§ì¨ú§Aªº«H¥ó¡A¥u­n¦b /etc/ppp/ppp.linkup¸Ì­±³]©w¥H¤U³o¶µ¡G MYADDR: !bg su user -c fetchmail °²¨Ï§A¥¿¨Ï¥Î sendmail (¦p¤U©Ò¥Ü) ¶Ç°e«H¥ó¨ì«D¥»¦a±b¸¹¡A¸m¤J¥H¤U©R¥O¡G !bg su user -c "sendmail -q" ¦b¤W­±¨º¶µ©R¥O¤§«á¡C³o·|±j­¢ sendmail ¦b³s±µ¤Wºô¸ô«á°¨¤W¶}©l³B²z mailqueue¡C §Ú°²³]§A¦b bsd.home ¾÷¾¹¤W¦³¤@­Ó user ªº±b¸¹¡C¦b bsd.home ¾÷¾¹¤W user ªº®a¥Ø¿ý¸Ì«Ø¥ß¤@­Ó .fetchmailrc ªºÀɮסG poll example.net protocol pop3 fetchall pass MySecret µL¶·Âب¥¡A³o­ÓÀÉ°£¤F user ¥~¤£À³¸Ó³Q¥ô ¦ó¤HŪ¨ú¡A¦]¬°¥¦¥]§t MySecret ³o­Ó±K½X¡C ¬°¤F¦b±H«H®É¦³¥¿½Tªº©ïÀY from:¡A§A¥²¶·§i¶D sendmail ¨Ï¥Î user@example.net ¦Ó«D user@bsd.home¡C§A¥i¯à·|§Æ±æ§i¶D sendmail ±q relay.example.net °e¥X©Ò¦³«H¥ó¡A ¥[§Ö«H¥ó¶Ç°e¡C ¥H¤Uªº .mc ÀÉÀ³¯àº¡¨¬§Aªº­n¨D¡G VERSIONID(`bsd.home.mc version 1.0') OSTYPE(bsd4.4)dnl FEATURE(nouucp)dnl MAILER(local)dnl MAILER(smtp)dnl Cwlocalhost Cwbsd.home MASQUERADE_AS(`example.net')dnl FEATURE(allmasquerade)dnl FEATURE(masquerade_envelope)dnl FEATURE(nocanonify)dnl FEATURE(nodns)dnl define(`SMART_HOST', `relay.example.net') Dmbsd.home define(`confDOMAIN_NAME',`bsd.home')dnl define(`confDELIVERY_MODE',`deferred')dnl ¦p¦óÂà´«³o­Ó .mc Àɮרì sendmail.cf Àɪº¸Ô²Ó²Ó¸`¡A½Ð°Ñ¦Ò¤W¤@¸`¡C ¥t¥~¡A¦b§ó·s sendmail.cf ¥H«á¤£­n§Ñ°O­«·s±Ò°Ê sendmail¡C °£¤F Sendmail ¥~¡AÁÙ¦³­þ¨Ç¶l¥ó¦øªA¾¹¥i¥H¨Ï¥Î©O¡H Sendmail ¬O FreeBSD ¹w³]¨Ï¥Îªº¶l¥ó¦øªA¾¹¡A¦ý¬O§AÁÙ¬O¥i¥H«Ü®e©ö¦a¥H¨ä¥¦ ¶l¥ó¦øªA¾¹ (¨Ò¦p¡A±q port ¦w¸Ëªº¶l¥ó¦øªA¾¹) ¨ú¥N¤§¡C port ¸Ì¦³«Ü¦h¥i¨Ñ¿ï¾Üªº¶l¥ó¦øªA¾¹¡A¹³ mail/exim¡B mail/postfix¡B mail/qmail¡B mail/zmailer µ¥¡A ´N¬O´X­Ó«Ü¨üÅwªïªº¿ï¾Ü¡C ¦h¼Ë¿ï¾Ü¬O¦n¨Æ¡A¦Ó¥B¤j®a¦³³\¦h¶l¥ó¦øªA¾¹¥i¥H¨Ï¥Î¤]³Q»{¬°¬O ¦n¨Æ¡F©Ò¥H½ÐÁקK¦b³q«H½×¾Â¸Ì°Ý¹³ Sendmail ¦³¤ñ Qmail ¦n¶Ü¡H ³o¼Ëªº°ÝÃD¡C¦pªG§A¯uªº«Ü·Q°Ýªº¸Ü¡A½Ð¥ý¨ì³q«H½×¾Â archive ¸Ì§ä¤@¤U¡C¨C¤@­Ó¶l¥ó¦øªA¾¹ªºÀuÂI»P¯ÊÂI¡A¥H«e¤j·§´N¤w¸g °Q½×¦n´X¦¸¤F¡C §Ú§Ñ¤F root ±K½X¤F¡I«ç»ò¿ì¡H ¤£­nÅå·W¡I¥u­n­«·s±Ò°Ê¨t²Î¡A¦b¬Ý¨ì Boot: ®É¿é¤J boot -s §Y¥i¶i¤J³æ¨Ï¥ÎªÌ¼Ò¦¡ (¦b 3.2-RELEASE ¤§«eªºª©¥»½Ð§ï¥Î -s)¡C ¦b°Ý­n¨Ï¥Î­þ­Ó shell ®É¡A«ö¤U ENTER¡C§A·|¬Ý¨ì¤@­Ó &prompt.root; ªº´£¥Ü¸¹¡A¿é¤J mount -u / ¥H­«·s±¾¤W(mount) §Aªº®ÚÀɮרt²Î¥i¨ÑŪ/¼g¡C°õ¦æ passwd root ¥H§ó´« root ±K½X¡AµM«á°õ¦æ &man.exit.1; Ä~Äò±Ò°Êµ{§Ç¡C §Ú¸Ó«ç»òÅý Control-Alt-Delete ¤£·|­«·s±Ò°Ê¨t²Î¡H ¦pªG§A¬O¨Ï¥Î FreeBSD 2.2.7-RELEASE ©Î¤§«áª©¥»ªº syscons(¨t²Î¤º©wªº¥D±±¥xÅX°Êµ{¦¡)¡A§â¤U¦C³o¦æ©ñ¨ì kernel ³]©wÀɤº¡A µM«á­«°µ¤@­Ó·sªº®Ö¤ß¡G options SC_DISABLE_REBOOT ­Y¬O¨Ï¥Î FreeBSD 2.2.5-RELEASE ©Î¤§«áª©¥»ªº PCVT ¥D±±¥xÅX°Ê µ{¦¡¡A«h¥H¤U¦C¿ï¶µ¥N´À¡G options PCVT_CTRL_ALT_DEL ¨ä¥L§ó¦­´Áªº FreeBSD ª©¥»¡A½Ð­×§ï§A¥¿¦b¨Ï¥Îªº¥D±±¥xÁä½L¹ïÀ³¡A ¨Ã±N©Ò¦³ boot ÃöÁä¦r¥H nop ¨ú¥N¡C¤º©wªºÁä½L¹ïÀ³¬O¦b /usr/share/syscons/keymaps/us.iso.kbd¡C §A¥i¯à»Ý­n©ú¥Õªº§h©J /etc/rc.conf ¥hŪ¨ú ³o­ÓÁä½L¹ïÀ³¥H½T«O§ó°Ê¥Í®Ä¡C·íµM¦pªG§A¥¿¦b¥Î¾A¦X§A°êÄyªºÁä½L¹ïÀ³¡A §AÀ³¸Ó½s¿è¨º¤@­Ó¡C §Ú¸Ó«ç»ò§â DOS ¤å¦rÀÉ®×­«·s®æ¦¡¤Æ¦¨ UNIX ªº¡H ¥u­n¨Ï¥Î³o­Ó perl ©R¥O¡G &prompt.user; perl -i.bak -npe 's/\r\n/\n/g' file ... file ´N¬O­n³B²zªºÀɮסC³o­Ó­×§ï¬O¦b¤º³¡§¹¦¨¡A­ì©lªºÀÉ®×·|Àx¦s¦¨ °ÆÀɦW¬° .bak ªºÀɮסC ©ÎªÌ§A¥i¥H¨Ï¥Î &man.tr.1; ³o­Ó©R¥O¡G &prompt.user; tr -d '\r' < dos-text-file > unix-file dos-text-file ¬O¥]§t DOS ¤å¦rªº ÀɮסA¦Ó unix-text-file «h¬O¥]§tÂà´« ªº¿é¥Xµ²ªG¡C³o¤ñ¨Ï¥Î perl ÁÙ­n§Ö¤W¤@ÂIÂI¡C §Ú¸Ó«ç»ò¥Î¦WºÙ¬å±¼ process¡H ¨Ï¥Î &man.killall.1; ¡C ¬°¦ó¦b su ¤@ª½»¡§Ú¤£¦b root ªº ACL ¸Ì¡H ³o­Ó¿ù»~¬O¦]¬° Kerberos ¤À´²»{ÃÒ¨t²Î¡C³o­Ó°ÝÃD¨Ã¤£¬O«ÜÄY­« ¦ý¬O¥O¤H¹½·Ð¡C§A¥i¥H¥Î -K ¿ï¶µ¥h°õ¦æ su¡A©Î¬O¹³¤U­Ó°ÝÃD©Ò´y­zªº ²¾°£ Kerberos¡C §Ú¸Ó«ç»ò²¾°£ Kerberos¡H ­n±q¨t²Î¸Ì²¾°£ Kerberos¡A­«¸Ë§A¥¿¦b°õ¦æªº release ª©¥»ªº bin distribution¡C¦pªG§A¦³ CDROM¡A§A¥i¥H mount cd(°²³]¦b /cdrom) ¨Ã°õ¦æ¡G &prompt.root; cd /cdrom/bin &prompt.root; ./install.sh ©ÎªÌ§A¤]¥i¥H±N /etc/make.conf ¸Ìªº "MAKE_KERBEROS" ¿ï¶µ¥þ³£®³±¼¡AµM«á¦A build world. §Ú¸Ó«ç»ò¼W¥[¨t²ÎªºµêÀÀ²×ºÝ¾÷¡H ¦pªG§A¦³³\¦h telnet¡Assh¡AX ©Î¬O screen ¨Ï¥ÎªÌ¡A§A©Î³\·|¥Î§¹ µêÀÀ²×ºÝ¾÷¡A³o¯à±Ð§A«ç»ò¥[§ó¦h¡G «Ø¥ß¨Ã¦w¸Ë¤@­Ó·sªº kernel ¨Ã¥B§â³o¤@¦æ pseudo-device pty 256 ¥[¤J¨ì³]©wÀɸ̡C °õ¦æ³o­Ó©R¥O¡G &prompt.root; cd /dev &prompt.root; sh MAKEDEV pty{1,2,3,4,5,6,7} ·|³y¥X 256 ­ÓµêÀÀ²×ºÝ¾÷ªº¸Ë¸m¸`ÂI¡C ½s¿è /etc/ttys ¨Ã¥[¤J²Å¦X 256 ­Ó²×ºÝ¾÷ªº¦æ¼Æ¡C¥¦­ÌÀ³¸Ó²Å¦X¤w¸g¦s¦b³æ¶µªº®æ¦¡¡AÁ|¨Ò¨Ó»¡¡A ¥¦­Ì¬Ý°_¨Ó¹³¡G ttyqc none network ¦r¥À³]­pªº¶¶§Ç¬O tty[pqrsPQRS][0-9a-v]¡A¨Ï¥Î¥¿³Wªí¥Ü¦¡¡C ¥Î·sªº kernel ­«·s±Ò°Ê¹q¸£´N¥i¥H¤F¡C /dev/snd0 ³o­Ó¸Ë¸m°µ¤£¥X¨Ó¡I ¨Ã¨S snd ³o­Ó¸Ë¸mªº¦s¦b¡C³o­Ó¦W¦r ¬O¥Î¨Ó·í§@¦U­Ó²Õ¦¨ FreeBSD Án­µÅX°Êµ{¦¡²Õ¡A½Ñ¦p mixer¡A sequencer¡A¥H¤Î dsp ªºÂ²ºÙ¡C ¥i¥H¥Î¥H¤Uªº©R¥O§@¥X³o¨Ç¸Ë¸m¡G &prompt.root; cd /dev &prompt.root; sh MAKEDEV snd0 ¥i¥H¤£¥Î¶}¾÷¡A­«·sŪ¨ú /etc/rc.conf¡B ¦A¦¸±Ò°Ê /etc/rc ¶Ü? ¥ý¶i¤J³æ¤H¨Ï¥ÎªÌ¼Ò¦¡¡AµM«á¦A¦^¨ì¦h¨Ï¥ÎªÌ¼Ò¦¡¡C ¦b¥D±±¥x°õ¦æ¡G &prompt.root; shutdown now (Note: without -r or -h) &prompt.root; return &prompt.root; exit §Ú·Q­n§â§Úªº¨t²Îª@¯Å¨ì³Ì·sªº -STABLE¡A¦ý¬O±o¨ìªº¬O -RC ©Î -PRERELEASE¡I«ç»ò¤F¡H ²³æ¦a»¡¡G¨º¥u¬O¦W¦r¦Ó¤w¡CRC ªº·N«ä¬O Release Candiate¡A µo¦æ­Ô¿ïª©¥»¡A¥¦ªí¥Ü·sª©¥»§Ö­nµo¦æ¤F¡C¦b FreeBSD ¤¤¡A -PRERELEASE ³q±`¬Oµo¦æ«eªºµ{¦¡½X­áµ²ªº¥N¦Wµü¡C(¦³¨Çµo¦æª©¥»¤¤¡A -BETA ¼ÐÅÒ¸ò -PRERELEASE ¬O¬Û¦P·N«äªº¡C) ¸Ô²Ó¦a»¡¡GFreeBSD ±q¨â­Ó¦a¤è¤À¤ä¥X¥¦ªºµo¦æª©¥»¡C¥Dª©¸¹¡B ÂI¹s¡Brelease (¨Ò¦p 3.0-RELEASE ¤Î 4.0-RELEASE) ªº¡A¬O±qµo®i¹Lµ{ ¶}©l®É¤À¤ä¥X¨Óªº¡A³q±`ºÙ¬° -CURRENT ¡C¦³°Æª©¸¹ªºª©¥» (¨Ò¦p 3.1-RELEASE ©Î 4.2-RELEASE)¡A¬O ¬¡ÅDªº -STABLE ¤À¤ä¤¤ªºµo¦æª©¥» §Ö·Ó¡C±q 4.3-RELEASE ¶}©l¡A¨C¤@­Óµo¦æª©¥»¦³¥¦¦Û¤vªº¤À¤ä¡A¥i¬° °¾¦n·¥«×«O¦uªºµo®i³t«× (³q±`¥u·|§@¦w¥þ¤è­±ªº§ó·s) ªº¤H©Ò¥Î¡C ·Ç³Æ­n»s§@µo¦æª©¥»®É¡A¨ä©Ò¦bªº¤À¤ä·|¸g¹L¤@©wªºµ{§Ç¡C¦³¤@­Ó¬O µ{¦¡½X­áµ²¡C·íµ{¦¡½X­áµ²¶}©l®É¡A¤À¤ä¦WºÙ·|§ó¦W¡A¥H¤Ï¬M¥¦§Ö­n¦¨¬° ¤@­Óµo¦æª©¥»¤F¡CÁ|­Ó¨Ò¤l¡A¦pªG­ì¨Óªº¤À¤ä¥s 4.5-STABLE¡A¥¦ªº¦W¦r ·|Åܦ¨ 4.6-PRERELEASE ¥Hªí¥Üµ{¦¡½X¤w­áµ²¡A¨Ã¥BÃB¥~ªºµo¦æ«e´ú¸Õ ±N­n¶}©l¤F¡C¯äÂΧ󥿤´¥i¦^³ø¡A¥H¦¨¬°µo¦æª©¥»ªº¤@³¡¥÷¡C·íµ{¦¡½X ¦³¤F¥i¦¨¬°µo¦æª©¥»ªºÂú§Î®É¡A¥¦ªº¦W¦r´N·|Åܦ¨ 4.6-RC¡A¥Hªí¥Üµo¦æ ª©¥»§Ö¦n¤F¡C¶i¤J RC ¶¥¬q«á¡A¥u¦³§ä¨ìªº³Ì¦³¼vÅTªº¯äÂΤ~·|³Q­×¥¿¡C ·íµo¦æª©¥» (¥»¨Ò¤¤¬° 4.6-RELEASE) ²£¥Í«á¡Aµo¦æª©¥»·|¦³¦Û¤vªº¤À¤ä¡A ­ì¤À¤ä·|³Q§ó¦W¬° 4.6-STABLE¡C ·Q­n±oª¾§ó¦h¦³Ãöª©¥»¸¹½X»P¦U CVS ¤À¤äªº¸ê°T¡A½Ð°Ñ¦Ò Release Engineering ¤@¤å¡C §Ú¸ÕµÛ­n¦w¸Ë¤@­Ó·sªº®Ö¤ß¡A¦ý¬OµLªk chflags¡C§Ú¸Ó«ç»ò¸Ñ¨M¡H ²³æ¦a»¡¡G§Aªº securelevel ¥i¯à¤j©ó¹s¡Cª½±µ­«·s¶}¾÷¨ì ³æ¤H¼Ò¦¡¡A¦A¦w¸Ë®Ö¤ß¡C ¸Ô²Ó¦a»¡¡GFreeBSD ¦b securelevel ¤j©ó¹s±¡ªp¤U¡A¤£¤¹³\ Åܧó¨t²ÎºX¼Ð (system flags)¡C§A¥i¥H¥Î³o­Ó«ü¥OÀˬd§Aªº securelevel¡G &prompt.root; sysctl kern.securelevel §A¨S¦³¿ìªk­°§C securelevel¡F§A¥²¶·±Ò°Ê¨t²Î¨ì³æ¤H¼Ò¦¡¥H ¦w¸Ë®Ö¤ß¡A©Î¬O­×§ï /etc/rc.conf ¤ºªº securelevel ¦A­«·s¶}¾÷¡C½Ð°Ñ¦Ò &man.init.8; »¡©ú¤å¥ó¡A¥H¨ú±o §ó¦h¦³Ãö securelevel ªº¸ê°T¡AÁÙ¦³ /etc/defaults/rc.conf ©M &man.rc.conf.5; »¡©ú¤å¥ó¡A¥H¨ú±o§ó¦h¦³Ãö rc.conf ªº¸ê°T¡C ¦b§Úªº¨t²Î¤W¡A§ÚµLªkÅܧó®É¶¡¶W¹L¤@¬í¥H¤Wªº½d³ò¡I §Ú¸Ó«ç»ò¿ì¡H ²³æ¦aÁ¿¡G§A¨t²Îªº securelevel ¤]³\¤j©ó 1¡Cª½±µ­«·s¶}¾÷¦Ü ³æ¤H¼Ò¦¡¡AµM«á¦A­×§ï®É¶¡¡C ¸Ô²Ó¦a»¡¡G¦b securelevel ¤j©ó 1 ªº±¡ªp¤U¡AFreeBSD ¤£¤¹³\®É¶¡ Åܰʤj©ó¤@¬í¡C§A¥i¥H¥Î¥H¤Uªº©R¥O¨ÓÀˬd¥Ø«eªº securelevel¡G &prompt.root; sysctl kern.securelevel §AµLªk­°§C securelevel¡F§A¥²¶·±Ò°Ê¹q¸£¦Ü³æ¤H¼Ò¦¡¤U¥H­×§ï®É¶¡¡A ©Î¬O­×§ï /etc/rc.conf ¦A­«·s¶}¾÷¡C½Ð°Ñ¦Ò &man.init.8; »¡©ú¤å¥ó¡A¥H¨ú±o§ó¦h¦³Ãö securelevel ªº¸ê°T¡AÁÙ¦³ /etc/defaults/rc.conf ©M &man.rc.conf.5; »¡©ú¤å¥ó¡A¥H¨ú±o§ó¦h¦³Ãö rc.conf ªº¸ê°T¡C ¬°¤°»ò rpc.statd ¥Î¤F 256 megabytes ªº°O¾ÐÅé¡H ¤£¡A¨º¤£¬O memory leak¡A¦Ó¥B¥¦¤]¤£¬O¯uªº¥Î¤F 256 Mbyte ªº°O¾ÐÅé¡C¥¦¥u¬O³ßÅw (·N«ä´N¬OÁ`·|³o¼Ë§@) ±N¤@ª¯²¼ªº°O¾ÐÅé ¬MÁ¨쥦¦Û¤vªº¦ì§}ªÅ¶¡¡A¥H¤è«K§@¨Æ¡C´N§Þ³N¦Ó¨¥¡A³o¼Ë¨Ã¨S¦³ ¤°»ò¤£¹ï¡F³o¼Ë¥u¬O·|Åý &man.top.1; ©M &man.ps.1; À~¤@¤j¸õ¦Ó¤w¡C &man.rpc.statd.8; ·|±N¥¦ªºª¬ºAÀÉ®× (¦ì©ó /var ) ¬M®g¦Ü¥¦ªº¦ì§}ªÅ¶¡¸Ì¡F¬°¤F¨¾¤î»Ý­nªº®É­Ô¦A¼W¤j©Ò ¾É­Pªº­«·s¬M®g¡A¥¦¤@¦¸·|¨Ï¥Î¬Û·í¤jªº¤j¤p¡C±qµ{¦¡½X¨Ó¬Ýªº¸Ü´N §ó©úÅã¤F¡A¥i¥H¬Ý¨ì &man.mmap.2; ªºªø«×°Ñ¼Æ¬° 0x10000000 ¡A¥¦¬O IA32 ¬[ºc¤Wªº¤Q¤»¤À¤§¤@ªº©w§}ªÅ¶¡¡A¤]´N¬O 256MB¡C ¬°¤°»ò§Ú¨S¿ìªk¨ú®ø schg Àɮ׺X¼Ð¡H §A¥¿¦b¤@­Ó´£°ª¤F securelevel (¤]´N¬O¤j©ó 0) ªº¨t²Î¹B§@¡C ­°§C securelevel ¦A¸Õ¸Õ¬Ý¡C½Ð°Ñ¦Ò FAQ ¤¤¹ï securelevel ªº»¡©ú ©M &man.init.8; »¡©ú¤å¥ó¡C ¬°¤°»òªñ¨Óªº·sª© FreeBSD ¹w³]µLªk§Q¥Î .shosts §¹¦¨ SSH »{ÃÒ¡H ¬°¤°»òªñ¨Ó·sª© FreeBSD .shosts »{ÃÒ¹w³] ¬°¨ú®øªº­ì¦]¡A¬O¦]¬° &man.ssh.1; ¹w³]¤£¦w¸Ë¬° suid ¦¨ root¡C­n ­×¥¿ ³oÂI¡A§A¥i¥H§@¤U¦Cªº ¥ô¦ó¤@¥ó¨Æ¡G ­n¤@³Ò¥Ã¶h¸Ñ¨M¡A½Ð±N /etc/make.conf ¸Ìªº ENABLE_SUID_SSH ³]¦¨ true ¡AµM«á¦A­«·s build ssh (©Î¬O°õ¦æ make world)¡C ¥u§@¤@®Éªº­×¥¿ªº¸Ü¡A¥i¥H root ¨­¥÷ °õ¦æ chmod 4755 /usr/bin/ssh ±N /usr/bin/ssh ³]¦¨ 4555 ¡CµM«á±N ENABLE_SUID_SSH= true ¥[¤J /etc/make.conf ¸Ì¡A³o¼Ë¤U¦¸ make world °õ¦æ´N·|¥Í®Ä¤F¡C ¤°»ò¬O vnlru? ·í¨t²Î¹F¨ì¤W­­ kern.maxvnodes ®É¡A vnlru ·|²M°£¨ÃÄÀ©ñ vnode¡C³o­Ó®Ö¤ß °õ¦æºü¤j³¡¥÷ªº®É¶¡³£¨S¨Æ§@¡A¥u¦³·í§A¦³«Ü¤jªº°O¾ÐÅé¡A¦Ó¥B ¥¿¦b¦s¨ú¤W¸U­Ó¤pÀɮ׮ɡA¤~·|³Q±Ò°Ê¡C
Wei-Hon Chen
plasmaball@pchome.com.tw
X Window System ¤Î Virtual Consoles §Ú·Q­n°õ¦æ X ¡A§Ú¸Ó«ç»ò°µ¡H ³Ì²³æªº¤èªk´N¬O¦b¦w¸Ë¨t²Îªº®É­Ô¤@¨Ö¦w¸Ë¡C µM«á¬Ý¬Ý &man.xorgconfig.1; ªº¤å¥ó¡A³o­Óµ{¦¡¥i¥H - À°±z³]©w &xfree86; ¬ÛÃö³]©w¡A¨Ï¥¦¯à°÷¥¿½T¹B¥Î±zªºÅã¥Ü¥d¡B·Æ¹«µ¥¶gÃä¡C¦¹¥~¡AÁÙ¥i¥H¥Î &man.xorgcfg.1; + À°±z³]©w &xorg; ¬ÛÃö³]©w¡A¨Ï¥¦¯à°÷¥¿½T¹B¥Î±zªºÅã¥Ü¥d¡B·Æ¹«µ¥¶gÃä¡C¦¹¥~¡AÁÙ¥i¥H¥Î &man.xorgcfg.1; ªº¹Ï§Î¤¶­±¨Ó°µ¬ÛÃö³]©w¡C ±z©Î³\¤]·Q¸Õ¸Õ¬Ý Xaccel server¡C¸Ô±¡½Ð¬Ý Xi Graphics ³o¤@¬q¡C §Ú ¸ÕµÛ ­n°õ¦æ X, ¦ý¬O·í§ÚÁä¤J startx ®É¡A±o¨ì KDENABIO failed (Operation not permitted) ¿ù»~¡C§Ú¸Ó«ç»ò¿ì¡H §Aªº¨t²Î¤@©w´£°ª¤F securelevel¡A¹ï¤£¹ï¡H¦b¤@­Ó´£°ª¤F securelevel ªº¨t²Î¤W¡A¬Oµ´¹ïµLªk°_°Ê X ªº¡C·Qª¾¹D¬°¤°»ò¡A ½Ð°Ñ¦Ò &man.init.8; »¡©ú¤å¥ó¡C ©Ò¥H³o­Ó°ÝÃDÅܦ¨¡G§AÁÙ¯à«ç»ò¿ì¡C°ò¥»¤W§A¦³¨âºØ¿ï¾Ü¡G ±N§Aªº securelevel ³]¦^¹s (³q±`¦b /etc/rc.conf ¸Ì­±³]©w)¡A©Î¬O¦b±Ò°Ê®É°õ¦æ &man.xdm.1; (¦b securelevel ³Qª@°ª«e)¡C ½Ð°Ñ¦Ò ¥H¨ú±o§ó¦h¦³Ãö±Ò°Ê®É °õ¦æ &man.xdm.1; ªº¸ê°T¡C ¬°¤°»ò§Ú¤£¯à¦b X ¸Ì¨Ï¥Î·Æ¹«¡H ¦pªG±z¥Îªº¬O syscons (¤º©wªº console ÅX°Êµ{¦¡) ªº¸Ü¡A±z¥i¥H ¸g¥Ñ³]©w FreeBSD ¨ÓÅý¥¦¤ä´©¦b¨C­Ó virtual console ¨Ï¥Î·Æ¹«¡C¬°¤F ÁקK©M X ²£¥Í½Ä¬ð¡Asyscons ¨Ï¥Î¤F¤@­Ó¥s°µ /dev/sysmouse ªºµêÀÀ¸Ë¸m¡C©Ò¦³·Æ¹«²£¥Íªº event ³£·|§Q¥Î moused ¨Ó¼g¨ì sysmouse ³o­Ó¸Ë¸m¡C¦pªG±z§Æ±æ¦b¤@­Ó ©Î¥H¤Wªº virtual console ¤W¨Ï¥Î·Æ¹«¡A¨Ã¥B ¯à°÷¨Ï¥Î X ªº¸Ü¡A½Ð°Ñ¦Ò ¨Ã¥B³]©w¦n moused¡C µM«á½s¿è /etc/XF86Config ³o­ÓÀɮסA ¨Ã¥B½T»{§A¦³¥H¤U³o´X¦æªº³]©w¡C Section Pointer Protocol "SysMouse" Device "/dev/sysmouse" .... ¥H¤Wªº¨Ò¤l¡A¾A¥Î©ó XFree86 3.3.2 ¤Î¨ä«áªºª©¥»¡C¥Î©ó§ó¦­ªº ª©¥»ªº¡A¨ä Protocol À³¬° MouseSystems¡C ¦³¨Ç¤H¤ñ¸û³ßÅw¦b³]©w X ªº®É­Ô¥Î /dev/mouse ³o­Ó¸Ë¸m¡C¦pªG±z­nÅý¥¦¯à°÷ ¥¿±`¤u§@ªº¸Ü¡A±z´N¥²¶·§â /dev/mouse ³sµ²¨ì /dev/sysmouse (½Ð°Ñ¦Ò &man.sysmouse.4;): &prompt.root; cd /dev &prompt.root; rm -f mouse &prompt.root; ln -s sysmouse mouse - §Úªº·Æ¹«¦³­Ó«Ü¬¯ªººu½ü¡C§Ú¯à¦b X ¸Ì­±¨Ï¥Î¶Ü¡H + ·Æ¹«ªººu½ü¡A¯à¦b X ¸Ì­±¨Ï¥Î¶Ü¡H - ¥i¥H¡C¤£¹L§A»Ý­n³]©w X ¥Î¤áºÝµ{¦¡¡C ½Ð°Ñ¦Ò ¥i¥H¡C¤£¹L»Ý­n³]©w X client ºÝµ{¦¡¡C ½Ð°Ñ¦Ò Colas Nahaboo ªººô­¶ (http://www.inria.fr/koala/colas/mouse-wheel-scroll/) . ¦pªG§A­n¨Ï¥Î imwheel µ{¦¡¡A ¥u­n¸òµÛ¤U¦C¨BÆJ§@§Y¥i¡C Âà´«ºu½ü event Translate the Wheel Events imwheel µ{¦¡ªº¹B§@­ì²z¡A ¬O±N·Æ¹«ªº²Ä¥|Áä»P²Ä¤­ÁäÂà´«¦¨«öÁä event¡C¦]¬°¦p¦¹¡A©Ò¥H §A¥²¶·Åý·Æ¹«ÅX°Êµ{¦¡±N·Æ½ü¨Æ¥óÂà´«¦¨²Ä¥|Áä»P²Ä¤­Áä event¡C ¦³¨âºØ¤èªk¥i¥H¹F¨ì¥Øªº¡A¤@¬OÅý &man.moused.8; §@Âà´«¡A¤G¬O Åý X ¥»¨­¥h§@ event Âà´«¡C ¨Ï¥Î &man.moused.8; ¨ÓÂà´«ºu½ü Event ­nÅý &man.moused.8; ¨Ó§@ event Âà´«¡A¥u­n¦b °õ¦æ &man.moused.8; ªº©R¥O¦C¤¤¥[¤W §Y¥i¡CÁ|­Ó¨Ò¤l¡A¦pªG§A¤@¯ë³£¬O¥H moused -p /dev/psm0 ¨Ó°_°Ê &man.moused.8; ªº¸Ü¡A¥u­n§ï¦¨ moused -p /dev/psm0 -z 4 §Y¥i¡C¦pªG§A¬O¦b¶}¾÷¹Lµ{¤¤§Q¥Î /etc/rc.conf ¨Ó°_°Ê &man.moused.8;¡A §A¥i¥H¦b /etc/rc.conf ¤¤±N moused_flags ¤W¥[ §Y¥i¡C §A²{¦b»Ý­nÅý X ª¾¹D§Aªº·Æ¹«¦³¤­­Ó«öÁä¡A¥u­n¦b /etc/XF86Config ¤¤ªº Pointer °Ï¶ô¤¤¥[¤W Buttons 5 ³o¤@¦æ§Y¥i¡C¨Ò¦p¡A §A¥i¯à¦b /etc/XF86Config ¤¤¦³ ¥H¤Uªº Pointer °Ï¶ô¡G ¦b XFree86 3.3.x ¨t¦Cªº XF86Config ³]©wÀɪº <quote>Pointer</quote> °Ï¶ô¤¤¡A¥H moused §@Âà´« ªººu½ü¹«ªº³]©w½d¨Ò Section "Pointer" Protocol "SysMouse" Device "/dev/sysmouse" Buttons 5 EndSection ¦b XFree86 4.x ¨t¦Cªº XF86Config ³]©wÀɪº <quote>InputDevice</quote> °Ï¶ô¤¤¡A¥H X Server §@Âà´« ªººu½ü¹«ªº³]©w½d¨Ò Section "InputDevice" Identifier "Mouse1" Driver "mouse" Option "Protocol" "auto" Option "Device" "/dev/sysmouse" Option "Buttons" "5" EndSection ¦b <quote>.emacs</quote> ¤¤¡A³]©wºu½ü¹«ªº­ì¥Í ­¶­±ºu°Ê¤ä´©½d¨Ò ;; wheel mouse (global-set-key [mouse-4] 'scroll-down) (global-set-key [mouse-5] 'scroll-up) §Q¥Î§Aªº X Server ¨Ó§@ºu½ü Event Âà´« ¦pªG§A¨S¦³°õ¦æ &man.moused.8;¡A©Î¬O§A¤£·Q§Q¥Î &man.moused.8; ¥h§@ºu½ü event Âà´«¡A§A¥i¥H§ï¥Î X server ¨Ó§@³o¼Ëªº event Âà´«¡C§A±o¦b /etc/XF86Config Àɮפ¤§@´X­Ó§ó°Ê¡C²Ä¤@¡A §A­n¬°§Aªº·Æ¹«¿ï¾Ü¾A·íªº³q°T¨ó©w¡C¤j¦h¼Æªººu½ü¹«³£ ¨Ï¥Î IntelliMouse ¨ó©w¡A¤£¹L XFree86 ¤]¤ä´©¨ä¥¦ªº³q°T¨ó©w¡A¨Ò¦pù§Þªº MouseMan+ ·Æ¹«©Ò¥Îªº MouseManPlusPS/2¡C·í§A¿ï¦n¤§«á¡A¥u­n ¥[¶i¤@¦æ Pointer °Ï¶ôªº Protocol ÅܼƧY¥i¡C ²Ä¤G¡A§A­n§i¶D X server ±N±²°Ê¨Æ¥ó­«·s¹ï¬M¦Ü·Æ¹«ªº ²Ä¥|©M²Ä¤­Áä¡C³o¥i¥H§Q¥Î ZAxisMapping ¿ï¶µ¿ì¨ì¡C Á|­Ó¨Ò¤l¡A¦pªG§A¨S¦³¨Ï¥Î &man.moused.8;¡A¦Ó§A¦³¤@­Ó IntelliMouse ¦w¸Ë¦b PS/2 ·Æ¹«°ðªº¸Ü¡A§A¥i¥H¦b /etc/XF86Config ¸Ì¨Ï¥Î¥H¤Uªº³]©w¡C ¦b XF86Config ³]©wÀɪº <quote>Pointer</quote> °Ï¶ô¤¤¡A¥H X Server §@Âà´«ªººu½ü¹«ªº³]©w½d¨Ò Section "Pointer" Protocol "IntelliMouse" Device "/dev/psm0" ZAxisMapping 4 5 EndSection ¦b XFree86 4.x ¨t¦Cªº XF86Config ³]©wÀɪº <quote>InputDevice</quote> °Ï¶ô¤¤¡A¥H X Server §@Âà´« ªººu½ü¹«ªº³]©w½d¨Ò Section "InputDevice" Identifier "Mouse1" Driver "mouse" Option "Protocol" "auto" Option "Device" "/dev/psm0" Option "ZAxisMapping" "4 5" EndSection ¦b <quote>.emacs</quote> ¤¤¡A³]©wºu½ü¹«ªº­ì¥Í ­¶­±ºu°Ê¤ä´©½d¨Ò ;; wheel mouse (global-set-key [mouse-4] 'scroll-down) (global-set-key [mouse-5] 'scroll-up) ¦w¸Ë imwheel ±µ¤U¨Ó¡A±q Ports ¸Ì¦w¸Ë imwheel ¡C¦b x11 Ãþ§O¸Ì¥i¥H§ä¨ì¥¦¡A¥¦¥i¥H±N ºu½ü event ¹ï¬M¨ìÁä½L event¡CÁ|­Ó¨Ò¤l¡A¥¦¥i¥H¦b§A ±Nºu½ü©¹«e±À®É¡A°e¥X¤@­Ó Page Up ¨ì§AªºÀ³¥Îµ{¦¡¥h¡CImwheel §Q¥Î¤@­Ó³]©wÀÉ¡A¥H«K¹ïÀ³ºu½ü event ¦ÜÁä½L event¡A³o¼Ë ¥¦´N¥i¥H¦b¤£¦PªºÀ³¥Îµ{¦¡¤¤¡A°e¥X¤£¦PªºÁä½L«öÁä¡C¹w³]ªº imwheel ³]©wÀɬO¦b /usr/X11R6/etc/imwheelrc¡A¦pªG§A·Q ½s¿è¦Û­qªº³]©wÀɪº¸Ü¡A¥i¥H±N¥¦½Æ»s¨ì ~/.imwheelrc¡AµM«á¨Ì§Aªº»Ý­n­×§ï¥¦¡C ³]©wÀɪº®æ¦¡¦b &man.imwheel.1; ¸Ì­±¦³¸Ô²Óªº»¡©ú¡C ³]©w Emacs »P Imwheel ¨ó¦P¤u§@ (¿ï¾Ü©Ê) ¦pªG§A¨Ï¥Î emacs ©Î¬O Xemacs ªº¸Ü¡A¨º§A»Ý­n¦b§Aªº ~/.emacs Àɮ׸̥[¤W¤@¤p¬q³]©w¡C emacs ½Ð¥[¤W³o¤@¬q¡G <application>Imwheel</application> ªº <application>Emacs</application> ³]©w ;;; For imwheel (setq imwheel-scroll-interval 3) (defun imwheel-scroll-down-some-lines () (interactive) (scroll-down imwheel-scroll-interval)) (defun imwheel-scroll-up-some-lines () (interactive) (scroll-up imwheel-scroll-interval)) (global-set-key [?\M-\C-\)] 'imwheel-scroll-up-some-lines) (global-set-key [?\M-\C-\(] 'imwheel-scroll-down-some-lines) ;;; end imwheel section Xemacs «h¦b ~/.emacs Àɸ̥[¤W³o¤@¬q¡G <application>Imwheel</application> ªº <application>Xemacs</application> ³]©w ;;; For imwheel (setq imwheel-scroll-interval 3) (defun imwheel-scroll-down-some-lines () (interactive) (scroll-down imwheel-scroll-interval)) (defun imwheel-scroll-up-some-lines () (interactive) (scroll-up imwheel-scroll-interval)) (define-key global-map [(control meta \))] 'imwheel-scroll-up-some-lines) (define-key global-map [(control meta \()] 'imwheel-scroll-down-some-lines) ;;; end imwheel section °õ¦æ Imwheel ¦w¸Ë¤§«á¡A§A¥i¥Hª½±µ¦b xterm ¸ÌÁä¤J imwheel ©R¥O¥H°_°Ê¥¦¡C¥¦·|¥H­I´º°õ¦æ¡A¨Ã¥B°¨¤Wµo´§®Ä¥Î¡C ¦pªG§A½T©w­nª½±µ¨Ï¥Î imwheel¡A ¥u­n§â¥¦¥[¶i§A¦Û¤vªº .xinitrc ©Î .xsession ¤ºÀɮקY¥i¡C§A¥i¥H¤£ºÞ imwheel ©Ò°e¥X¨Ó¦³Ãö PID ÀÉ®× Äµ§i¡C¨º¨Çĵ§i¥u¹ï Linux ª©ªº imwheel ¦³®Ä¦Ó¤w¡C ¬°¤°»ò X Window ªº¿ï³æ©M¹ï¸Ü®Ø¤£¯à¥¿±`¹B§@¡H §â Num Lock Ãö±¼¸Õ¸Õ¡C ¦pªG±zªº Num Lock ¦b¶}¾÷®Éªº¹w³]­È¬O¶}µÛªº¸Ü¡A±z¥²¶·§â¤U¦C ³o¦æ©ñ¨ì XF86Config ³]©wÀɤ¤ªº Keyboard ³¡¥÷¡C # Let the server do the NumLock processing. This should only be # required when using pre-R6 clients ServerNumLock ¤°»ò¬O virtual console¡H§Ú­n«ç»ò°µ¤~¯à¥Î¦h¤@ÂI¡H ²³æ¨Ó»¡¡Avirtual console ´N¬O¥i¥HÅý±z¤£¥²°µ¤Ó¦h½ÆÂøªº³]©w ¦p¨Ï¥Îºô¸ô©Î°õ¦æ X ¡A¦Ó¦b¦P¤@»O¾÷¾¹¤W¦P®É°µ¦n´X¥ó¨Æªº¤èªk¡C ·í±Ò°Ê¨t²Î¨ÃÅã¥Ü§¹©Ò¦³¶}¾÷°T®§¤§«á¡A±z´N·|¦b¿Ã¹õ¤W¬Ý¨ì¤@­Ó login ªº´£¥Ü²Å¸¹¡C¦b³o­Ó®É­Ô±z´N¥i¥H¿é¤J±zªº login name ¥H¤Î password ¡AµM«á´N¥i¥H¦b²Ä¤@­Ó virtual console ¤W¶}©l¤u§@¤F (©ÎªÌ¶}©lª±¡I) ¡C ¦b¬Y¨Ç±¡ªp¤U¡A±z¥i¯à·|·Q­n§@¨ä¥Lªº¤u§@¡A¨Ò¦p»¡¬O¬Ý¬Ý±z¥¿¦b °õ¦æªºµ{¦¡ªº»¡©ú¤å¥ó¡A©Î¬O·í±z¦b FTP ¶Ç¿éªºµ¥«Ý®É¶¡¤¤¬Ý¬Ý±zªº ¶l¥ó¡C±z¥u»Ý­n«ö Alt-F2 («ö¦í Alt Á䤣©ñ¡A¨Ã«ö¤U F2 Áä) ¡AµM«á ±z´N·|¦b²Ä¤G­Ó virtual console ¤W¬Ý¨ì¤@­Ó login ´£¥Ü²Å¸¹¡I·í±z·Q­n¦^¨ì­ì¨Óªº¤u§@®É¡A½Ð«ö Alt-F1¡C FreeBSD ¦b¦w¸Ë®Éªº¹w³]­È¬O¨Ï¥Î¤T­Ó virtual console (3.3-RELEASE «á¬°¤K­Ó)¡A±z¥i¥H¥Î Alt-F1¡AAlt-F2¡A¥H¤Î Alt-F3 ¦b¥¦­Ì¤§¶¡°µ¤Á´«¡C ¦pªG±z·Q­n¦h¤@ÂI virtual console ªº¸Ü¡A±z¥u»Ý­n½s¿è /etc/ttys ³o­ÓÀÉ (½Ð°Ñ¦Ò &man.ttys.5;)¡A ¦b Virtual terminals ³o­Óµù¸Ñ«á­±¥[¤J ttyv4 ¨ì ttyvc ªºÄæ¦ì¡G # Edit the existing entry for ttyv3 in /etc/ttys and change # "off" to "on". ttyv3 "/usr/libexec/getty Pc" cons25 on secure ttyv4 "/usr/libexec/getty Pc" cons25 on secure ttyv5 "/usr/libexec/getty Pc" cons25 on secure ttyv6 "/usr/libexec/getty Pc" cons25 on secure ttyv7 "/usr/libexec/getty Pc" cons25 on secure ttyv8 "/usr/libexec/getty Pc" cons25 on secure ttyv9 "/usr/libexec/getty Pc" cons25 on secure ttyva "/usr/libexec/getty Pc" cons25 on secure ttyvb "/usr/libexec/getty Pc" cons25 on secure ±z·Q¥Î´X­Ó´N³]´X­Ó¡C±z³]¶V¦h virtual terminal ¡A¥¦­Ì´N¥Î±¼ ¶V¦h¨t²Î¸ê·½¡F¦pªG±z¥u¦³¤£¨ì 8MB ªº°O¾ÐÅ骺¸Ü¡A³o¼vÅT´N¤j¤F¡C ±z¥i¯à¤]·|·Q§â secure ´«¦¨ insecure¡C ¦pªG±z·Q­n°õ¦æ X ªº¸Ü¡A±z ¥²¶· ¬°¥¦«O¯d (©ÎÃö±¼) ¦Ü¤Ö¤@­Ó virtual terminal ¡C³o´N¬O»¡¡A¦pªG ±z·Q¦b«ö¤Q¤G­Ó Alt ¥\¯àÁä®É³£¦³ login ´£¥Ü²Å¸¹¡A¦Ó¥B¤S¦b¦P¤@ ³¡¹q¸£¤W¤]·Q°õ¦æ X ªº¸Ü¡A¨º»ò³o¯u¬O¤Ó¤£©¯¤F - ±z¥u¯à¥Î¤Q¤@­Ó¡C ¨ú®ø¤@­Ó console ³Ì²³æªº¤èªk´N¬O§â¥¦Ãö±¼¡CÁ|¨Ò¨Ó»¡¡A¦pªG ±z¹³¤W­±Á¿ªº¤@¼Ë³]©w¤F¥þ³¡ªº 12 ­Ó terminal ¨Ã¥B·Q­n°õ¦æ X ¡A ±z¥²»Ý§â virtual terminal 12 ±q¡G ttyvb "/usr/libexec/getty Pc" cons25 on secure ³]¦¨¡G ttyvb "/usr/libexec/getty Pc" cons25 off secure ¦pªG±zªºÁä½L¥u¦³ 10 ­Ó¥\¯àÁ䪺¸Ü¡A±z´N­n§ï¦¨³o¼Ë¡G ttyv9 "/usr/libexec/getty Pc" cons25 off secure ttyva "/usr/libexec/getty Pc" cons25 off secure ttyvb "/usr/libexec/getty Pc" cons25 off secure (±z¤]¥i¥Hª½±µ§â³o´X¦æ¬å±¼¡C) ¤@¥¹±z§ï¤F /etc/ttys¡A¤U¤@­Ó¨BÆJ´N¬O­n ½T©w±z¦³¨¬°÷ªº virtual terminal ¸Ë¸m¡C³Ì²³æªº¤èªk´N¬O¡G &prompt.root; cd /dev &prompt.root; sh MAKEDEV vty12 ¦A¹L¨Ó¡A·Q­n±Ò°Ê³o¨Ç virtual console ³Ì²³æ (¤]¬O³Ì°®²b) ªº°µªk´N¬O­«¶}¾÷¡CµM«á¡A¦pªG±z¤£·Q­«¶}¾÷ªº¸Ü¡A±z¥i¥H§â X Window Ãö±¼¡AµM«á¥Î root ªº¨­¥÷°õ¦æ¤U¦C«ü¥O¡G &prompt.root; kill -HUP 1 ·í±z°õ¦æ³o­Ó©R¥O«e¡A±z¤@©w­n§¹¥þ§â X Window Ãö±¼¡C¦pªG ±z¤£³o»ò°µªº¸Ü¡A±zªº¨t²Î¥i¯à·|¦b±z°õ¦æ kill ©R¥O«á¥X²{·í±¼©Î Âꦺªº±¡ªp¡C §Ú­n«ç»ò±q X ¤Á´«¨ì virtual console¡H ½Ð¥Î Ctrl Alt Fn ¥H¤Á¦^¦Ü virtual console¡C Ctrl Alt F1 ¥i¥H¤Á¦^¦Ü²Ä¤@­Ó virtual console¡C ·í§A¤Á¦^¦Ü¤å¦r console «á¡A§A´N¥i¥H¨Ï¥Î¤@¯ë Alt Fn «öÁä²Õ¦X¡A¦b¦U console ¤§¶¡¤Á´«¡C ­n¦^¨ì X ªº¸Ü¡A§A¥²¶·¤Á¦^¦Ü°õ¦æ X ªº virtual console¡C ¦pªG§A¬O±q©R¥O¦C¸Ì°_°Ê X ªº¸Ü (¨Ò¦p¨Ï¥Î startx «ü¥O)¡A¨º»ò X ·|¨Ìªþ¦b¤U¤@­Ó¥¼¨Ï¥Îªº virtual console¡A¦Ó¤£¬O¥¦³Q °_°Êªº¤å¦r console¡C¦pªG§A¦³¤K­Ó¨Ï¥Î¤¤ªº virtual terminal¡A¨º»ò X ´N·|¦b²Ä¤E­Ó¤W°õ¦æ¡A§A´N¥i¥H¨Ï¥Î Alt F9 ¥Hªð¦^¦Ü X ¤¤¡C §Ú­n«ç»ò°µ¤~¯à¦b¶}¾÷®É±Ò°Ê XDM¡H ¦³¨âºØ¤èªk¥i¥H±Ò°Ê xdm¡C¤@ºØ¤èªk¬O±q /etc/ttys ¨Ó±Ò°Ê¡A ¥i¥H°Ñ¦Ò &man.ttys.5; »¡©ú¤å¥ó¤¤ªº½d¨Ò¡F¥t¤@ºØ¤èªk¬O¦b rc.local (½Ð°Ñ¦Ò &man.rc.8;) °õ¦æ xdm¡A©Î¬O ¦b /usr/local/etc/rc.d ©ñ¤@­Ó X.sh¡C³o¨âºØ¤èªk³£¬O¦Xªkªº¡A¦pªG±z¸Õ¬Y¤@ºØ ¤èªkµL®Äªº¸Ü¡A±z¥i¥H¸Õ¸Õ¥t¥~¤@ºØ¡C³o¨âºØ¤èªkªºµ²ªG¬O¤@¼Ëªº¡GX ·|Åã¥Ü¤@­Ó¹Ï§Î¤Æªº login: ´£¥Ü¡C ¥Î ttys ªº¤èªkªºÀuÂI¡A¦b©ó«ü©ú¤F X ¦b±Ò°Ê®É¨ì©³¬O¥Î¨º­Ó vty¡A ¨Ã¥B±N logout ®É­«·s±Ò°Ê X server ªº³d¥ô¥áµ¹ init¡C rc.local ªº¤èªk«h¬O¦b·í±Ò°Ê X ¥X¤F°ÝÃD®É¡A¥i¥H«Ü»´ÃP¦a§â xdm ±þ±¼¨Ó¸Ñ¨M °ÝÃD¡C ¦pªG¬O¥Î rc.local ªº¤èªk¡A¦b°õ¦æ xdm ®É±z¤£¯à¥[¥ô¦ó°Ñ¼Æ¡]¤]´N¬O¶]¦¨ daemon¡^¡C¥²¶·¦b getty °õ¦æ«á ¤~¯à±Ò°Ê xdm¡A§_«h getty ©M xdm ·|¤¬¬Û½Ä¬ð¦ÓÂê¦í console¡C³Ì¦nªº ¤è¦¡¬O¦b script ¤¤¥[­Ó sleep¡AÅý¥¦¼È°± 10 ¬íÄÁ¥ª¥k¡A±µµÛ¤~°õ¦æ xdm¡C ¦pªG§A¬O±q /etc/ttys ±Ò°Ê xdm¡Axdm »P &man.getty.8; ¤´¦³¾÷·|¤¬¬Û½Ä¬ð¡C¤@­ÓÁקK¥¦ªº¤èªk¡A´N¬O¦b /usr/X11R6/lib/X11/xdm/Xservers Àɮפ¤¥[¤J vt ¼Æ¦r¡C :0 local /usr/X11R6/bin/X vt4 ¤W­±ªº¨Ò¤l¤¤¡A·|«ü¥Ü X server ¦b /dev/ttyv3 ¤¤°õ¦æ¡C½Ðª`·N¼Æ¦r¬O®t¤@ªº¡CX server ±q¤@¶}©l¼Æ vty¡A¦Ó FreeBSD ®Ö¤ß«h¬O±q¹s¶}©l¼Æ vty ªº¡C ¬°¤°»ò·í§Ú°õ¦æ xconsole ®É¡Aµo¥Í¤F Couldn't open console ªº¿ù»~¡H ¦pªG§A¬O¥Î startx ¨Ó±Ò°Ê startx ªº¸Ü¡A/dev/console ªºÅv­­¨Ã ¤£·| §ïÅÜ¡Aµ²ªG´N¬O xterm -C ©M xconsole ³oÃþªºµ{¦¡µLªk ¥¿±`°õ¦æ¡C ³o¤@¤Áªº°ÝÃD¡A³£¬O¦]¬° console ªºÅv­­¬O±Ä¥Î¨t²Î¹w³]­È¡C ¦b¤@­Ó¦h¨Ï¥ÎªÌªº¨t²Î¸Ì¡A§Ú­Ì¤£§Æ±æ¨C­Ó¨Ï¥ÎªÌ³£¥i¥Hª½±µ¼g¤J¨t²Î console ¡C¦pªG¨Ï¥ÎªÌ¬O±q¾÷¾¹ªº VTY ª½±µ login ªº¸Ü¡A¨º»ò &man.fbtab.5; ¥i¥H¸Ñ¨M³oÃþªº°ÝÃD¡C ²³æ¦a»¡¡A½Ð½T«O /etc/fbtab (½Ð°Ñ¦Ò &man.fbtab.5;) ³o­ÓÀɮפ¤ªº³o¤@¦æ¨S¦³³Qµù¸Ñ±¼¡G /dev/ttyv0 0600 /dev/console ³o¤@¦æ³]©wªº¦s¦b¥i¥H½T«O±q /dev/ttyv0 µn¤Jªº¨Ï¥ÎªÌ¥i¥H±±¨î console¡C ¥H«e§Ú¥i¥H¥H¤@¯ë¨Ï¥ÎªÌ°õ¦æ XFree86¡A¬°¤°»ò²{¦b¥¦»¡§Ú¤@©w­n ¥H root ¤~¯à°õ¦æ¡H ©Ò¦³ªº X server ³£»Ý­n¥H root ¨Ó°õ¦æ¡A ¤~¯àª½±µ¦s¨ú§Aªºµø°TµwÅé¡Cª©¥»ªº XFree86 (<= 3.3.6) ·|¦Û°Ê ±N©Òªþªº server ¥H§Q¥Î root ¨­¥÷°õ¦æªº¤è¦¡ ¦w¸Ë°_¨Ó (setuid ¬° root)¡C¥Ñ©ó X server ³£¬OÅé¿nÃe¤j¤S½ÆÂøªºµ{¦¡¡AÅã¦Ó©ö¨£¦a¡A³o¬O¤@­Ó¦w¥þ¤Wªº¨aÃø¡C ¦]¬°³o­Ó­ì¦]¡A·sª©ªº XFree86 ´N¤£±N³o¨Ç server ¥H setuid ¬° root ªº¤è¦¡¦w¸Ë¡C «Ü©úÅã¦a¡A§Ú­Ì§¹¥þµLªk±µ¨ü±N X server ¥H root ªº¨­¥÷°õ¦æ¡C°_½X´N¦w¥þ¤W¤£¬O­Ó¦n¥D·N¡C ¦³¨âºØ¤èªk¥i¥H¥H¤@¯ë¨Ï¥ÎªÌªº¨­¥÷¨Ï¥Î X¡C²Ä¤@¬O§Q¥Î xdm ©Î¬O¨ä¥¦ªº display manager (¨Ò¦p kdm)¡F²Ä¤G¬O§Q¥Î Xwrapper¡C xdm ¬O¤@­Ó³B²z¹Ï§Î¬É­±µn¤Jªº daemon¡C ¥¦³q±`¦b¶}¾÷®É°õ¦æ°_¨Ó¡A¦Ó¥B­t³d¹ï¨Ï¥ÎªÌ§@¨­¥÷»{ÃÒ¡A¥H¤Î°_°Ê ¨Ï¥ÎªÌªº¤u§@Àô¹Ò¡F¥¦¥i»¡¬O¹Ï§ÎÀô¹Ò¤Uªº &man.getty.8; »P &man.login.1; ªº¹ïÀ³µ{¦¡¡C·Q±oª¾§ó¦h¦³Ãö xdm ªº¸ê°T¡A½Ð°Ñ¦Ò XFree86 ¤å¥ó¡A¥H¤Î¨ä FAQ ¶µ¥Ø¡C Xwrapper ¬O X server ªº¥]¸Ëµ{¦¡¡F¥¦¥i¥H Åý¤@¯ë¨Ï¥ÎªÌ¥i¥H¤â°Ê°_°Ê X server ªº¤p¤u¨ã¡A¦ÓÁÙ¯àºû«ù¤@©wªº¦w¥þ Àô¹Ò¡C¥¦·|Àˬd¶Ç¤Jªº©R¥O¦C°Ñ¼Æ¡A¦pªG¨S°ÝÃDªº¸Ü¡A´N°_°Ê¾A·íªº X server¡C¦pªG§A¦]¬°¬YºØ²z¥Ñ¦Ó¤£·Q°õ¦æ display manager ªº¸Ü¡A ¥¦¬O¬°§A¦Ó³]©wªº¡C¦pªG§A¦w¸Ë¤F§¹¾ãªº ports¡A§A¥i¥H¦b /usr/ports/x11/wrapper ¤¤§ä¨ì¥¦¡C §Úªº PS/2 ·Æ¹«¦b X ¤¤¦³ÂI¤£¥¿±`¡H ±zªº·Æ¹«©M±zªº·Æ¹«ÅX°Êµ{¦¡¥i¯à¦s¦b¦³¤£¦P¨Bªº²{¶H¡C ¦b 2.2.5 ¥H¤Î§ó¦­ªº¨t²Î¸Ì¡A±q X ¤Á¨ì virtual terminal µM«á ¦A¤Á¦^¨Ó´N¥i¥H¨Ï¥¦­Ì­«·s°µ¦P¨Bªº°Ê§@¡C¦pªG³o­Ó°ÝÃD±`±`µo¥Íªº¸Ü¡A ±z¥i¥H¦b±zªº kernel ³]©wÀɤ¤¥[¤J¤U­±³o­Ó¿ï¶µµM«á­«·s½sĶ¡G options PSM_CHECKSYNC ¦pªG±z¨S¦³«Ø¥ß kernel ªº¸gÅç¡A½Ð¬Ý ¦Û­q®Ö¤ß ³o¤@¸`¡C ¥[¤W³o­Ó¿ï¶µ¥H«á¡A·Æ¹«©M·Æ¹«ÅX°Êµ{¦¡¶¡ªº¦P¨B°ÝÃDÀ³¸Ó´N¤ñ¸û ¤£·|¥X²{¤F¡C¦pªG³o­Ó°ÝÃD¤´µM¦s¦bªº¸Ü¡A¦b²¾°Ê·Æ¹«®É«ö«ö·Æ¹««öÁä ¥i¥H¨Ï·Æ¹«©M·Æ¹«ÅX°Êµ{¦¡­«·s°µ¦P¨Bªº°Ê§@¡C ¸Óª`·Nªº¬O³o­Ó¿ï¶µ¨Ã¤£¬O¹ï¨C¤@­Ó¨t²Î³£¦³®Ä¡A¥¦¥i¯à·|Åý±µ¦b PS/2 ·Æ¹«¦ì¸mªº ALPS GlidePoint ¸Ë¸m¥¢¥h tap ³o¶µ¥\¯à¡C ¦b 2.2.6 ¤Î¨ä«áªºª©¥»¡A¦P¨Bªº½T»{¤w¸g¦³¤F¸û¦nªº¸Ñ¨M¿ìªk¡A ¦Ó¥B³o¨Ç³£¤w¸g¬O PS/2 ·Æ¹«ÅX°Êµ{¦¡ªº¼Ð·Ç¤F¡C³o­Ó¤èªk¤]¥i¥H¦b GlidePoint ¤W¥¿±`¤u§@¡C (¦]¬°½T»{ªºµ{¦¡½X¤w¸g¦¨¬°¤@­Ó¼Ð·Ç¥\¯à¡A ©Ò¥H¦b³o¨Çª©¥»¤¤§Ú­Ì¤£¦b´£¨Ñ PSM_CHECKSYNC ªº¿ï¶µ¤F¡C) ¤£¹L¦b ·¥¤Ö¼Æªº®×¨Ò¤¤¡A³o¨ÇÅX°Êµ{¦¡·|»~³ø¦P¨B©Ê¿ù»~¡AµM«á±z´N·|¬Ý¨ì ³o¼Ëªº®Ö¤ß°T®§¡G psmintr: out of sync (xxxx != yyyy) µM«á±z´N·|µo²{±zªº·Æ¹«¤£¯à¥¿±`¹B§@¤F¡C ¦pªG±zµo¥Í¤F³o¼Ëªºª¬ªp¡A±z¥²¶·Âǥѧâ PS/2 ·Æ¹«ÅX°Êµ{¦¡ªº flag ³]¦¨ 0x100 ¨Ó§â¦P¨B½T»{ªºµ{¦¡½Xµ¹¨ú®ø±¼¡CµM«á¦b¶}¾÷´£¥Ü²Å¸¹®É¥Î ¿ï¶µ¨Ó¶i¤J UserConfig¡G boot: -c µM«á¡A¦b UserConfig ©R¥O¦C¤¤Áä¤J¡G UserConfig> flags psm0 0x100 UserConfig> quit §Úªº PS/2 ·Æ¹«¤£¯à³z¹L MouseSystem ¨Ó¹B§@¡H ¦³¤@¨Ç³ø§i«ü¥X¬Y¨Ç¼tµPªº PS/2 ·Æ¹«¥u¯à¦b °ª¸ÑªR«× ª¬ºA¤U¤~¯à¹B§@¡C¦pªG¤£¬Oªº¸Ü¡A·Æ¹«´å¼Ð ·|±`±`¶]¨ì¿Ã¹õªº¥ª¤W¨¤¥h¡C «D±`¤£©¯ªº¡A³o­Ó°ÝÃD¦b 2.0.X ©M 2.1.X ¤U¬OµL¸Ñªº¡C¦b 2.2 ¨ì 2.2.5 ª©¡A±z¥i¥H¹ï /sys/i386/isa/psm.c ¨Ï¥Î¤U¦C patch µM«á­««Ø±zªº®Ö¤ß¡C¦pªG±z¨S¦³«Ø¥ß kernel ªº¸gÅç¡A ½Ð¬Ý ¦Û­q®Ö¤ß ³o¸`¡C @@ -766,6 +766,8 @@ if (verbose >= 2) log(LOG_DEBUG, "psm%d: SET_DEFAULTS return code:%04x\n", unit, i); + set_mouse_resolution(sc->kbdc, PSMD_RES_HIGH); + #if 0 set_mouse_scaling(sc->kbdc); /* 1:1 scaling */ set_mouse_mode(sc->kbdc); /* stream mode */ ¦b 2.2.6 ¤Î¥H«áªºª©¥»¡A¦b PS/2 ·Æ¹«ÅX°Êµ{¦¡¤¤³]©w 0x04 ªº flag ·|§â·Æ¹«³]¦¨°ª¸ÑªR«×¼Ò¦¡¡C¦b¶}¾÷´£¥Ü²Å¸¹®É¥Î ¿ï¶µ¨Ó¶i¤J UserConfig¡G boot: -c µM«á¡A¦b UserConfig ªº©R¥O¦C¤¤Áä¤J¡G UserConfig> flags psm0 0x04 UserConfig> quit «e¤@¸`¦³´£¨ì¥t¤@­Ó¥i¯à¾É­P·Æ¹«°ÝÃDªº­ì¦]¡C ·í§Ú«Ø¥ß X µ{¦¡®É¡Aimake »¡¥¦§ä¤£¨ì Imake.tmpl¡C¥¦¦b­þ¨à¡H Imake.tmpl ¬O Imake ®M¥óªº¤@³¡¥÷¡AImake ¬O¼Ð·Çªº«Ø¥ß X µ{¦¡ªº¤u¨ã¡C Imake.tmpl ©M¨ä¥L¼Æ­Ó header file ¤@¼Ë¬O«Ø¥ß X µ{¦¡ªº¥²­nÀɮסA±z¥i¥H¦b - X prog distribution ¤¤§ä¨ì¥¦­Ì¡C±z¥i¥H¥Î sysinstall ¨Ó¦w¸Ë©Î¬O - ª½±µ±q X distribution ¤¤¤â°Ê¦w¸Ë¡C + X prog distribution ¤¤§ä¨ì¥¦­Ì¡C±z¥i¥H¥Î sysinstall(&os; 5.2 ¤§«eª©¥»«h¬O /stand/sysinstall) + ¨Ó¦w¸Ë©Î¬Oª½±µ±q X distribution ¤¤¤â°Ê¦w¸Ë¡C §Ú¦b build ¤@­Ó X À³¥Îµ{¦¡¡A¥¦»Ý­n XFree86 3.3.x¡A¦ý¬O §Ú¤w¸g¦w¸Ë XFree86 4.x ¤F¡C§Ú¸Ó«ç»ò¿ì¡H ­n§i¶D port ¦b½sĶµ{¦¡®É¡A¨Ï¥Î XFree86 4.x ¨ç¦¡®w¡A§A¥i¥H ¦b /etc/make.conf ¸Ì (¦pªG§A¨S¦³³o­ÓÀÉ¡A ½Ð«Ø¥ß¥¦) ¥[¤W¤U­±³o¤@¦æ¡G XFREE86_VERSION= 4 §Ú­n«ç»ò°µ¤~¯à³]©w¥ªºJ¤l¥Îªº·Æ¹«¡H ¦b±zªº .xinitrc ©Î¬O .xsession ¤¤°õ¦æ xmodmap -e "pointer = 3 2 1" ªº«ü¥O¡C ­n¦p¦ó¦w¸Ë splash ¹Ï§ÎÅã¥Üµ{¦¡¡H¨º¸Ì¥i¥H§ä±o¨ì©O¡H ´N¦bµo¦æ FreeBSD 3.1 ¤§«e¡A§Ú­Ì¥[¶i¤F¦b¶}¾÷®ÉÅã¥Ü splash ¹Ï§Îªº·s¥\¯à¡C¥Ø«e¥Î¨ÓÅã¥Ü¦b¿Ã¹õ¤WªºÀÉ®× ¥²¶·¬O 256 ¦âªºÂI¯x°}¹Ï§Î (*.BMP) ©Î ZSoft PCX(*.PCX) ªº®æ¦¡¡C°£¦¹¤§¥~¡A¸ÑªR«×¤]¥²¶·¦b 320x200 ¥H¤U¡A¤~¯à©M¼Ð·Ç VGA Åã¥Ü¥d·f°t¨Ï¥Î¡C¦pªG±z½sĶ kernel ®É¦³¥[¤J VESA ¤ä´©¡A¨º»ò³Ì¤j¸ÑªR«×¥i¥H¨ì 1024x768¡Cª`·N VESA ªº ¤ä´©»Ý­n¥[¤J VM86 ³o­Ó kernel ¿ï¶µ¡CVESA ¤ä´©¹ê»Ú¤W¥i¥H¦b½sĶ kernel ®É¥[¤J VESA ¿ï¶µ¡B ©Î¸ü¤J VESA ªº kld module ¨Ó¹F¦¨¡C ±z­n­×§ï±±¨î FreeBSD ¶}¾÷¨BÆJªº³]©wÀÉ¡A¤~¯à¨Ï¥Î splash Åã¥Ü¹Ï§Îªº¥\¯à¡C³]©wÀɦbµo¦æ FreeBSD 3.2 «e¦³¨Ç§ó°Ê¡A©Ò¥H²{¦b ¦³¨â­Ó¤èªk¥i¥H¸ü¤J splash ªº¥\¯à¡G FreeBSD 3.1 ¥ý¿ï¥X¥Î¨ÓÅã¥Ü¦b¿Ã¹õ¤Wªº¹Ï§Î¡A3.1 ª©¥u¤ä´© Windows ªºÂI¯x°}®æ¦¡¡C¿ï¦n¤F±z­nªº¹ÏÀÉ«á¡A±N¥¦«þ¨ì /boot/splash.bmp¡C±µµÛ§â¤U­±´X¦æ¥[¤J /boot/loader.rc ¤¤¡G load kernel load -t splash_image_data /boot/splash.bmp load splash_bmp autoboot FreeBSD 3.2+ °£¤F¥[¤J¹ï PCX Àɮתº¤ä´©¥~¡AFreeBSD 3.2 ¤]§ï¶i¤F ¶}¾÷µ{§Çªº³]©w¤è¦¡¡C¦pªG±zÄ@·Nªº¸Ü¡A¥i¥H¥Î¤W­z FreeBSD 3.1 ªº¤èªk¡A±N splash_bmp ´«¦¨ splash_pcx ¨Ó¸ü¤J PCX ÀɮקY¥i¡C ¦pªG·Q¥Î·sªº³]©w¤è¦¡¡A±zªº /boot/loader.rc ¥²¶·¥]¬A³o´X¦æ¡G include /boot/loader.4th start Áٻݭn¤@­Ó¥]§t¥H¤U´X¦æªº /boot/loader.conf ¡G splash_bmp_load="YES" bitmap_load="YES" ³o¬O°²³]±z¥Î /boot/splash.bmp ¨Ó·í§@ splash ªº¿Ã¹õÅã¥Ü¡C¦pªG·Q¥Î PCX ªºÀɮסA§â¥¦«þ¦¨ /boot/splash.pcx¡A¦p¤W­z°µ¥X /boot/loader.rc¡A¦A±N³o´X¦æ¥[¨ì /boot/loader.conf ¤¤¡G splash_pcx_load="YES" bitmap_load="YES" bitmap_name="/boot/splash.pcx" ²{¦b´N¥u³Ñ¤U splash ¥Î¨ÓÅã¥Üªº¹ÏÀÉ¡A±z¥i¥H¦b http://www.baldwin.cx/splash/ §ä¨ì¦UºØ¼Ë«~¡C §Ú¯à¦b X ¸Ì¨Ï¥ÎÁä½L¤Wªº Windows ¶Ü¡H ¥i¥H¡C§A©Ò­n§@ªº¡A´N¬O§Q¥Î &man.xmodmap.1; ¥h©w¸q§A·Q¨Ï¥Î ªº¥\¯à¡C °²³]©Ò¦³ªº Windows ³£¬O¼Ð·Çªº¡A ¨º¥¦­Ìªº keycode ¤À§O¬°¡G 115 - Windows Áä¡A ¦b¥ª¤âªº Ctrl »P Alt Á䤧¶¡ 116 - Windows Áä¡A ¦b Alt-Gr Áä¥kÃä 117 - ¿ï³æÁä¡A¥k¤âªº Ctrl Á䥪Ãä ­nÅý¥ªÃ䪺 Windows Áä¦L¥X¤@­Ó³rÂI¡A¸Õ¸Õ³o­Ó¡G &prompt.root; xmodmap -e "keycode 115 = comma" §A¥i¯à­n­«¶]§Aªº windows manager¡A¤~·|¦³°Ê§@¡C ­nÅý Windows Áä ªº¹ï¬M¦b¨C¦¸ X °_°Ê®É¦Û°Ê³]©w¦n¡A§A¥i¥H¦b§Aªº ~/.xinitrc ¸Ì¥[¤W xmodmap¡A ©Î¬O³Ì¦n«Ø¥ß¤@­Ó ~/.xmodmaprc ÀɮסA¸Ì­± ¨C¤@¦æ´N¬O¤@­Ó xmodmap ªº¿ï¶µ¡AµM«á¦b§Aªº ~/.xinitrc ¸Ì¥[¤W¡G xmodmap $HOME/.xmodmaprc ³o¤@¦æ¡C ¨Ò¦p¡A§A·Q­n±N³o¤T­ÓÁä¦U¹ï¬M¨ì F13¡BF14 ©M F15¡C³oÅý§A¯à ¦b§Aªºµ{¦¡©Î¬O window manager ¤º±N¨ä¹ïÀ³¨ì«K§Qªº¥\¯à¤W¡Aµ¥¤@¤U §Ú­Ì·|¥Ü½d¡C §â³o¨Ç©ñ¶i ~/.xmodmaprc ¸Ì¡G keycode 115 = F13 keycode 116 = F14 keycode 117 = F15 °²¦p§A¥Î fvwm2 ªº¸Ü¡A§A¥i¥H§@³o¼Ëªº¹ï¬M¡A Åý F13 ¯à°÷Åý´å¼Ð©Ò¦bªºµøµ¡ÁY¦¨¤p¹Ï¥Ü (©Î¬O¤Ï¹L¨Ó)¡CF14 Åý´å¼Ð ©Ò¦bªºµøµ¡Åܦ¨³Ì¤W¼hªºµøµ¡¡A©Î¬O°h¨ì¤U¼h¥h (¦pªG¥¦¤w¸g¬O³Ì¤W¼h ¤Fªº¸Ü)¡CF15 «h±N Workplace (application) ¿ï³æ¥s¥X¨Ó¡A§Y¨Ï´å¼Ð ¤£¦b®à­±¤W¡C·í§A¨S¦³¥i¨£ªº®à­±°Ï°ì®É¡A³o­Ó¥\¯à´N¬Û·í¦a¤è«K (¦Ó¥B «öÁä¤Wªº¹Ï®×©M³o­Ó¥\¯à¬Û§k¦X)¡C ¥H¤Uªº ~/.fvwmrc ³]©w¥i§@¥X«e­zªº¥\¯à¡C Key F13 FTIWS A Iconify Key F14 FTIWS A RaiseLower Key F15 A A Menu Workplace Nop §Ú­n«ç»ò¼Ë¤~¯à±o¨ì OpenGL ªº 3D µwÅé¥[³t¥\¯à¡H 3D ¥[³t¥\¯àªº¦³µL¡Aµø§A©Ò¨Ï¥Îªº XFree86 ª©¥»»PÅã¥Ü´¹¤ù ªº«¬¸¹¦Ó©w¡C¦pªG§Aªº¬O NVIDIA ´¹¤ùªº¸Ü¡A½Ð¥h FreeBSD NVIDIA Driver Initiative ºô­¶¬Ý¬Ý¡A¨º¸Ì¦³¦b XFree86-4 ¤W¨Ï¥Î NVIDIA ´¹¤ùªº 3D ¥[³t¥\¯àªº°Q½×¡CXFree86-4 ¤Wªº¨ä¥¦Åã¥Ü¥d¼tµP µwÅé¥[³t¥\¯àªº¸ê°T¡A ¥]¬A Matrox G200/G400, ATI Rage 128/Radeon, 3dfx Voodoo 3, 4, 5, ¥H¤Î Banshee¡A¥i¦b XFree86-4 Direct Rendering on FreeBSD ºô­¶¤W§ä¨ì¡CXFree 3.3 ªº ¨Ï¥ÎªÌ¥i¥H¨Ï¥Î Utah-GLX port¡A¥¦¥i¥H¦b graphics/utah-glx §ä¨ì¡C ¨Ï¥Î¥¦¥i¥H¦b Matrox Gx00, ATI Rage Pro, SiS 6326, i810, Savage, ¥H¤Îªº NVIDIA ¤W±o¨ì¦³­­ªº OpenGL ¥[³t¡C
Biing Jong Lin
bjlin@stic.gov.tw
Networking §ÚÀ³¸Ó¨ì­þÃä§ä¦³ÃöµLºÏºÐ¶}¾÷ diskless booting ªº¸ê®Æ¡H Diskless booting ´N¬OÅý FreeBSD ¥D¾÷±qºô¸ô ¤W¶}¾÷¡A¨Ã¥B±qºô¸ô¤Wªº server ¤WŪ¨ú¨ä¥L¥²­nªºÀɮסA¦Ó«D¥Ñ¥D¾÷ ªºµwºÐ¤W¨ú±o³o¨ÇÀɮסC¸Ô²Óªº¸ê®Æ¥i¥H°Ñ¦Ò FreeBSD ¤â¥UªºµLºÏºÐ¶}¾÷½g ¡C FreeBSD ªº¥D¾÷¥i¥H·í§@¬Y­Óºô¸ô¤Wªº¸ô¥Ñ¾¹(router)¶Ü¡H ¬Oªº¡C½Ð°Ñ¦Ò FreeBSD ¤â¥Uªººô¸ô¶i¶¥½g advanced networking¡A¤×¨ä¬O¸ô¥Ñ»P¹h¹D¾¹ routing and gatewaysªº³¡¤À¡C §Ú¥i¥H³z¹L FreeBSD ±N§Úªº Win95 ¾÷¾¹³s¤W Internet ¶Ü¡H °ò¥»¤W¡A·|°Ý³oºØ°ÝÃDªº¤H¦b®a¸Ì¦Ü¤Ö¦³¨â¥x¹q¸£¡A¤@¥x¶] FreeBSD ¥t¥~¤@¥x¶] Win95¡F³o­Ó·Qªk¬O±N FreeBSD ¥D¾÷³s¤W Internet¡AµM«á³z ¹L³o¥x FreeBSD ¥D¾÷¡AÅý¶] Win95 ªº¹q¸£¯à°÷¤Wºô¡C³o­Ó°ÝÃDºâ¬O«e¤@ ­Ó°ÝÃDªº¤@­Ó¯S¨Ò ... µª®×¬O¡G¥i¥Hªº¡I¦b FreeBSD 3.x ª©¤¤¡A¨Ï¥ÎªÌ¼Ò¦¡(user-mode)ªº &man.ppp.8; ¥]§t¤F ¿ï¶µ¡C¦pªG§A¦b /etc/rc.conf ¨Ï¥Î¿ï¶µ¨Ã ³]©w gateway_enable ¬° YES ¡A¥H³oºØ³]©w±Ò°Ê &man.ppp.8; ¡A¨Ã¥B¥¿½Tªº³]©w§Aªº Windows ¥D¾÷ªº ¸Ü¡A³o­Ó°µªkÀ³¸Ó¬O¥i¥H¥¿±`¨Ï¥Îªº¡C Ãö©ó¥»¥DÃD§ó¸Ô²Óªº¸ê®Æ¥i¥H°Ñ¦Ò Steve Sims ©Ò¼¶¼gªº Pedantic PPP Primer ¤@¤å¡C ¦pªG§A¨Ï¥Îªº¬O®Ö¤ß¼Ò¦¡ (kernel-mode) PPP¡A©ÎªÌ§A¦³°Ï°ì³s½u (Ethernet connection) ¥i³q¹F Internet ªº¸Ü¡A§A±N»Ý­n¨Ï¥Î &man.natd.8;¡C½Ð¬d¾\ FAQ ¤¤Ãö©ó natd ªº³¡¤À¡C FreeBSD ¤ä´© SLIP ©M PPP ¶Ü¡H ¬Oªº¡C§A¥i¥H¬d¬d man pages ¤¤Ãö©ó &man.slattach.8;¡A &man.sliplogin.8;¡A&man.ppp.8;¡A¥H¤Î &man.pppd.8; ªº³¡¤À¡C &man.ppp.8; ¤Î &man.pppd.8; ´£¨Ñ¶i¥XÂù¦V³s½uªº¤ä´©¡A¥t¥~ &man.sliplogin.8; ±Mªù´£¨Ñ¶i¤J³s½uªº¤ä´©¡A¦Ó &man.slattach.8; ±Mªù´£¨Ñ¦V¥~³s½uªº¤ä´©¡C ¦pªG§A»Ý­n§ó¶i¤@¨Bªº¸ê®Æªº¸Ü,½Ð¬d¾\ FreeBSD ¤â¥U¤¤Ãö©ó PPP »P SLIP ªº»¡©ú¡C ¦pªG§A¥u¯à°÷¹L shell account ³s½u¨ì Internet ªº¸Ü¡A§A¤]³\¥i¥H¸Õ¸Õ net/slirp ³o­Ó®M¥óµ{¦¡¡C³o­Ó®M¥óµ{¦¡¥i¥H´£¨Ñ§Aªº¹q¸£ª½±µ³s¤W¬Y¨Ç(­­©wªº)ªA°È ³s½u¡A¦p ftp ¤Î http µ¥µ¥¡C FreeBSD ¤ä´© NAT ©Î Masquerading ¶Ü¡H ¦pªG§A¦³¤@­ÓªñºÝªº¤lºô¸ô(¦³¤@¥x¥H¤Wªº¾÷¾¹)¡A¦ý¬O§Aªº Internet provider «o¥u¤À°t¤@­Ó IP number µ¹§A(©ÎªÌ§A¥u¤À°t¨ì¤@­Ó °ÊºAªº IP number)¡A§A¥i¥H°Ñ¦Ò &man.natd.8; ³o­Óµ{¦¡¡C &man.natd.8; Åý§A¥i¥H³z¹L³o¤@­Ó IP number Åý¾ã­Ó¤lºô¸ôªº¹q¸£³£¯à³s¤W internet¡C &man.ppp.8; ³o­Óµ{¦¡¤]´£¨ÑÃþ¦üªº¥\¯à¡A¦pªG§A«ü©w ¿ï¶µ¡Calias library (&man.libalias.3;) ¦b³o¨â­Ó³B²z¤è¦¡¤¤³£·|³Q¨Ï¥Î¨ì¡C §Ú¦p¦ó±N¨â¥x FreeBSD ¥D¾÷¥Î¥­¦æ°ð (parallel line) ³z¹L PLIP ³s½u¡H ½Ð°Ñ¦Ò¤â¥U¤¤Ãö©ó PLIP section ªº³¡¤À¡C §Ú¨S¦³¿ìªk«Ø¥ß /dev/ed0 ³o­Ó device¡A ¬°¤°»ò¡H ¦]¬°¤£»Ý­n¡I¦b Berkeley ºô¸ô¬[ºc¤¤¡A¥u¦³ kernel µ{¦¡½X¥i¥Hª½ ±µ¦s¨úºô¸ô¬É­±¥d¡C½Ð°Ñ¦Ò /etc/rc.network ³o ­ÓÀɮשM manual pages ¨ú±o»P¨ä¥L¤£¦Pºô¸ôµ{¦¡¡C§ó¶i¤@¨Bªº¸ê°T¡G¦p ªG§Aı±o§A§¹¥þ·d²V¤Fªº¸Ü¡A±zÀ³¸Ó§ä¤@¥»»P¨ä¥L BSD ¬ÛÃö§@·~¨t²Îºô¸ô ºÞ²z¦³Ãö®Ñ¨Ó°Ñ¦Ò¡F°£¤F¤Ö¼ÆÅãµÛªº¤£¦P¥~¡AFreeBSD ªººô¸ôºÞ²z°ò¥»¤W©M SunOS 4.0 ©M Ultrix ¬O¤@¼Ëªº¡C §Ú¦p¦ó«Ø¥ß Ethernet aliases¡H ¦pªG§Aªº alias ¦ì§}¸ò§A¥Ø«eºô¸ô¤¶­±ªº¦ì§}¦b¦P¤@­Ó¤lºô¸ô¤Uªº ¸Ü¡A¥[¤J¤@­Ó netmask 0xffffffff ¦b§Aªº &man.ifconfig.8; command-line¡A½d¨Ò¦p¤U¡G &prompt.root; ifconfig ed0 alias 192.0.2.2 netmask 0xffffffff ¤£µMªº¸Ü¡A´N¦p¦P¥[¤J¤@­Ó·sªººô¸ô¦ì§}¤@¼Ë¿é¤J§Aªººô¸ô¦ì§}»P¤l ºô¸ô¾B¸n¡G &prompt.root; ifconfig ed0 alias 172.16.141.5 netmask 0xffffff00 §Ú¦p¦ó«ü©w§Úªº 3C503 ¨Ï¥Î¨ä¥L¤£¦Pªºªº network port¡H ¦pªG±z·Q¨Ï¥Î¨ä¥Lªº port¡A§A¥²¶·¦b &man.ifconfig.8; ªº©R¥O¤¤ «ü©wÃB¥~ªº°Ñ¼Æ¡C¤º©wªº port ¬O link0¡C­n¨Ï¥Î AUI port ¥N´À BNC port ªº¸Ü¡A§ï¥Î link2¡C³o¨Ç flags À³¸Ó§ïÅÜifconfig_* ªºÅܼƨӫü©w¡A §A¥i¥H¦b /etc/rc.conf ³o­ÓÀɮ׸̭±§ä¨ì (½Ð°Ñ¦Ò &man.rc.conf.5;)¡C ¬°¤°»ò§Ú¦b¨Ï¥Î FreeBSD ªº NFS ®É¥X²{°ÝÃD¡H §Ú­Ì¥Î§t»W¤@ÂIªº»¡ªk¡A¬Y¨Ç PC ªººô¸ô¥d¤ñ¨ä¥Lªº¦n¡A³oºØª¬ªp¦b ³y¦¨ NFS ³oºØ¹ïºô¸ô±Ó·Pªºµ{¦¡¦³®É·|¥X²{°ÝÃD¡C °Ñ¦Ò the Handbook entry on NFS ¥HÀò±o³o­Ó¥DÃDªº§ó¦h¸ê°T¡C ¬°¤°»ò§Ú¤£¯à NFS-mount Linux ªº¾÷¾¹¡H ¬Y¨Çª©¥»ªº Linux NFS µ{¦¡½X¥u±µ¨ü privileged port ªº mount request¡F¸Õ¥Î³o¦æ«ü¥O¬Ý¬Ý &prompt.root; mount -o -P linuxbox:/blah /mnt ¬°¤°»ò§Ú¤£¯à NFS-mount Sun ªº¾÷¾¹¡H ¶] SunOS 4.X ªº Sun ¤u§@¯¸¥u±µ¨ü¨Ó¦Û privileged port ªº mount request¡F¸Õ¥Î³o¦æ«ü¥O¬Ý¬Ý &prompt.root; mount -o -P sunbox:/blah /mnt ¬°¤°»ò mountd ¤@ª½°­¥s»¡ can't change attributes ¦Ó¥B§Ú¤@ª½¬Ý¨ì bad exports list ³o­Ó°T®§¦b§Úªº FreeBSD NFS ¦øªA¾¹¤W¡H ³o­Ó°ÝÃD³Ì±`µo¥Íªº­ì¦]¬O¦b©ó¤£¤F¸Ñ /etc/exports ªº¥¿½T®æ¦¡¡C½Ð¸ÔŪ &man.exports.5; ¥H¤Î¤â¥U¤¤Ãö©ó NFS ªº³¡¤À¡A¯S§O¬Oconfiguring NFS³o¤@¬q¡C ¬°¤°»ò§Ú¦b¨Ï¥Î PPP ³s½u¨ì NeXTStep ¾÷¾¹®É¦³°ÝÃD¡H §â TCP extensions ¨ú®ø¡A³o­Ó³]©w¦b /etc/rc.conf ¸Ì­±(°Ñ¦Ò &man.rc.conf.5;) §â ¥H¤U³o­Ó­È³]¦¨ NO¡G tcp_extensions=NO Xylogic ªº Annex ¥D¾÷¤]¦³¬Û¦Pªº°ÝÃD¡A±z­n°µ¬Û¦Pªº­×§ï¤~¯à³s ¤W³o¨Ç¥D¾÷¡C §Ú­n«ç¼Ë¤~¯à§â IP multicast support ¥´¶}¡H FreeBSD 2.0 ¥H«áªºª©¥»¤º©w³£¦³ ¤ä´© Multicast host ¾Þ§@¡C¦pªG ±z·Q±N±zªº¥D¾÷³]©w¦¨ multicast router ªº¸Ü¡A±z¥²¶·­«·s compile ±z ªº kernel¡A¥[¤J MROUTING ªº¿ï¶µ¡A¨Ã¥B°õ¦æ &man.mrouted.8; FreeBSD 2.2 ¤Î¤§«áªºª©¥»·|¦b¶}¾÷®É°õ¦æ &man.mrouted.8; ¦pªG¦b /etc/rc.conf ¤¤ mrouted_enable ³]©w¬° "YES" MBONE ªº¦UºØ¤u¨ã¥i¥H¦b¥L­Ì ports ¤U©ÒÄÝ¥s°µ mbone ¥Ø¿ý ¤¤§ä¨ì¡C¦pªG±z¦b§äµø°T·|ijªº¤u¨ã¦p vic ¥H¤Î vatªº¸Ü¡A¨ì¨ºÃä§ä§ä§a¡I ­þ¨Çºô¸ô¥d¬O¨Ï¥Î DEC PCI chipset¡H ¥H¤U¬O Glen Foster gfoster@driver.nsta.org ´£¨Ñªº²M³æ¡G Network cards based on the DEC PCI chipset Vendor Model ASUS PCI-L101-TB Accton ENI1203 Cogent EM960PCI Compex ENET32-PCI D-Link DE-530 Dayna DP1203, DP2100 DEC DE435, DE450 Danpex EN-9400P3 JCIS Condor JC1260 Linksys EtherPCI Mylex LNP101 SMC EtherPower 10/100 (Model 9332) SMC EtherPower (Model 8432) TopWare TE-3500P Znyx (2.2.x) ZX312, ZX314, ZX342, ZX345, ZX346, ZX348 Znyx (3.x) ZX345Q, ZX346Q, ZX348Q, ZX412Q, ZX414, ZX442, ZX444, ZX474, ZX478, ZX212, ZX214 (10mbps/hd)
¬°¤°»ò­n¥Î FQDN ¤~¯à³s¨ì¨ä¥L¾÷¾¹¡H §A¤]³\·|µo²{­n³sªº¾÷¾¹¨ä¹ê¬O¦b¥t¤@­Óºô°ì¡CÁ|­Ó¨Ò¤l¡A°²³]§A¬O¦b foo.bar.edu ³o­Óºô°ì¤¤¡A·Q­n³s¨ì¦b¤@¥x¥s mumble ªº¥D¾÷¡A¥L¦b example.org ºô°ì¤U¡A §A¥²¶·¥Î Fully-Qualified Domain Name mumble.example.org¡A¦Ó¤£¬O¥u¥Î mumble¡C ¶Ç²Îªº BSD BIND resolver ¤¹³\¥Î³oºØ¤è¦¡¸Ñ¥X¾÷¾¹ªº¦ì§}¡A¦ý¬O FreeBSD ¤ºªþ bind (see &man.named.8;) ª©¥»¤º©w¤è¦¡¡A«h¬O°£¤F§A©Ò¦bªººô°ì¥H¥~¡A¤£¤ä´©¨ä¥L«D FQDN ªºÁY¼g¡C ©Ò¥H¦p mumble ¥²¶·¦b mumble.foo.example.org¡A§_«h´N·|±qºô°ìªº³Ì©³ ¼h¶}©l§ä¡C ³o©M¥ý«eªº°µªk¤£¦P¡A¤]´N¬O¤£¥Î mumble.example.org¡A©M mumble.edu Ä~Äò·j´M¡C ¬Ý¤@¤U RFC 1535¡A¸Ì­±¦³´£¨ì¬°¤°»ò¤§«eªº°µªk¤£¦n¡A¬Æ¦Üºâ¬O­Ó¦w¥þ º|¬}¡C ³o¸Ì¦³­Ó¤£¿ùªº¸Ñªk, §A¥i¥H¥[¤J¤@¦æ search foo.example.org example.org instead of the previous domain foo.example.org ¦b§Aªº /etc/resolv.conf Àɮפ¤ (½Ð°Ñ¦Ò &man.resolv.conf.5;)¡C¦ý¬O­n½T©w·j´M¶¶§Ç¤£·|¹H¤Ï RFC 1535 ©Ò¿×ªº boundary between local and public administration¡C ¬°¤°»ò§Ú¦b³s½u®É¤@ª½¥X²{ Permission denied ªº¿ù»~°T®§¡H ¦pªG¦b½sĶ kernel ®É¥[¤J IPFIREWALL ¿ï¶µ¡A ½Ðª`·N 2.1.7R ¤º©w¬O©Úµ´©Ò¦³¥¼¸g®Ö­ãªººô¸ô«Ê¥](¦ý¦b¶}µo 2.1-STABLE ®É§ï±¼¤F)¡C I¦pªG¤£¤p¤ß§Ë¿ù¤F firewall ªº³]©w¡A§A¥i¥H¥H root °õ¦æ¥H¤U©R¥Oºô¸ô¥\¯à´N·|«ì´_¥¿±`¡G &prompt.root; ipfw add 65534 allow all from any to any ¤]¥i¥H¦b /etc/rc.conf ¥[¤J firewall_type="open" ªº¿ï¶µ¡C ¦pªG·Qª¾¹D¦p¦ó³]©w FreeBSD firewall¡A½Ð°Ñ¦Ò ¤â¥U¤¤¬ÛÃö³¹¸`¡C IPFW ·|³y¦¨¦h¤jªººô¸ô©µ¿ð¡H ½Ð°Ñ¦Ò¤â¥U¤¤ Firewalls ³¹¸`¡A¯S§O¬O IPFW Overhead & Optimization ³o¤@¬q¡C ¬°¤°»ò§Úªº ipfw fwd redirect ³W«h±NªA°ÈÂà¦V¨ä¥L¾÷¾¹®ÉµLªk¥¿±`¹B§@¡H ¥i¯à¬O§A°£¤FÂà°e«Ê¥]¥H¥~ÁÙÃB¥~·Q¶i¦æ¦ì§}ÂàĶ (network address translation, NAT)¡Afwd ³W«h©Ò¶i ¦æªº°Ê§@´N¦p¦P¦r­±©Ò¥Ü¡F¶ÈÂà°e«Ê¥]¡A¥¦¨Ã¤£·|¥h­×§ï«Ê¥]¤¤ªº¸ê®Æ¡C °²³]§Ú­Ì¦³¦p¤Uªº³W«h¡G 01000 fwd 10.0.0.1 from any to foo 21 ·í¤@­Ó³q©¹¯S©w¥Ø¼Ð¦ì§} foo ªº«Ê¥] °e¹F¥D¾÷®É¡A®Ú¾Ú³o±ø³W«h¡A«Ê¥]±N³QÂà°e¦Ü 10.0.0.1¡A¦ý¬O¥¦ªº¥Ø¼Ð¦ì§}«o¤´µM¬O foo¡I«Ê¥]ªº¥Ø¼Ð¦ì§}¨Ã ¨S¦³ §ó§ï¬° 10.0.0.1¡C¤j³¡¤Àªº¥D¾÷·|±N«Ê¥]¥á±ó¡A ¦]¬°¥L­Ì¨Ã¤£¬O³o­Ó¥Ø¼Ð¦ì§}¡C¦]¦¹¡A¨Ï¥Î fwd ³W«h ®É©¹©¹¤£¦p¨Ï¥ÎªÌ©Ò¹w´Áªº¨º¯ë¶¶§Q¡C³oºØ¦æ¬°¬O¨t²Î¯S©Ê¡A¦Ó«D¿ù»~¡C °Ñ¦Ò Ãö©óªA°ÈÂà¦Vªº±`¨£°Ý µª¶°¡A &man.natd.8; ¤â¥U¡A©ÎªÌ¬O¨Ï¥Î ports collection ¤¤³\ ¦hªA°ÈÂà¦Vªº¤u¨ã¨Ó¥¿½Tªº§¹¦¨§A·Q¶i¦æªº¤u§@¡C ­n¦p¦ó§â¹ï¬Y¥x¾÷¾¹ªººô¸ôªA°È­n¨D(service request)Âà¦V¨ì¥t¤@¥x¡H ¦b ports ¥Ø¿ýªºsysutils¤ÀÃþ¤¤¦³­Ó¥s socket ªº®M¥ó¡A¥i¥HÀ°§AÂà¦V FTP ©Î¨ä¥LÃþ¦üªº ºô¸ôªA°È¡C¥u­n§â¸Óºô¸ôªA°Èªº©R¥O§ï¦¨©I¥s socket §Y¥i¡A¦p¤U©Ò¥Ü¡G ftp stream tcp nowait nobody /usr/local/bin/socket socket ftp.example.com ftp ¨ä¤¤ ftp.example.com »P ftp ¤À§O¬O³QÂà¨ìªº¾÷¾¹©M port ¦WºÙ¡C ¨º¸Ì¥i¥H§ä¨ìºÞ²zÀW¼eªº¤u¨ã¡H FreeBSD ¤W¦³¤T®MÀW¼eºÞ²z¤u¨ã¡G &man.dummynet.4; ¤w¸g¾ã¦X¶i¤J FreeBSD ¨t²Î(§ó¸Ô²Óªº¥Î³~, &man.ipfw.4;); ALTQ ¥i¥H§K¶O¨Ï¥Î¡AEmerging Technologies ±À¥Xªº Bandwidth Manager «h¬O°Ó¥Î³nÅé¡C «ç»ò·|¶]¥X /dev/bpf0: device not configured³o­Ó°T®§¡H §A°õ¦æ¤F¤@­Ó»Ý­n¬f§JµÜ«Ê¥]¹LÂo¾¹ (Berkeley Packet Filter) ªº µ{¦¡ (&man.bpf.4;)¡A¦ý¬O§A¦b kernel ¤¤¨S¦³±Ò°Ê¥¦¡C§â¤U­±³o¤@¦æ¥[ ¤J kernel ³]©wÀɤ¤¡A½sĶ¤@­Ó·sªº kernel¡G pseudo-device bpf # Berkeley Packet Filter ¦b­«·s¶}¾÷¤§«á¡AÁÙ­n°µ¥X device node¡A¦b /dev ¤U°õ¦æ¡G &prompt.root; sh MAKEDEV bpf0 ¦pªG·Q­n§ó¶i¤@¨Bª¾¹D¦p¦ó°µ¥X¦UºØ device node¡A½Ð°Ñ¾\ Handbook Ãö©ó¶gÃä¸`ÂIªº»¡©ú ¡C §Ú­n«ç¼Ë¤~¯à±N Windows ¾÷¾¹¤¤ªººÏºÐ±¾¤J¨t²Î, ´N¹³ Linux ´£¨Ñ ªº smbmount ¨º¼Ë¡H ¨Ï¥Î SMBFS ¤u¨ã²Õ¡C³o®M¤u¨ã²Õ¤¤ ¥]§t¤F¤@¨t¦Cªº kernel ­×§ïÁÙ¦³¨Ï¥ÎªÌªº¤u¨ãµ{¦¡(userland programs)¡C ³o¨Çµ{¦¡©M¸ê°T¦b ports ¦¬Âä¤ net/smbfs ¤U¥i¥H§ä¨ì¡C¦b 4.5-RELEASE ¤§«áªºª©¥»«h¬O¨t²Î¤¤¤º«Ø¡C §Ú¦b¨t²Î¤é»x¤¤µo²{¥H¤U°T®§¡G icmp-response bandwidth limit 300/200 pps¡A³o¬O ½¼¦Ì¸J¿|¡H ³o¬O¨t²Î®Ö¤ß§i¶D§A¦³¬Y¨Ç¬¡°Ê¤Þµo¥¦°e¥X¤ñ¥¦©Ò»{¬°À³¸Ó°e¥X§ó ¦hªº ICMP ©Î TCP ­«¸m°T®§ (RST)¡CICMP ¦^À³°T®§±`±`¬O¦]¬°¦³¤H¹Á ¸Õ³s±µ¥¼³Q¨Ï¥Îªº UDP ³q°T°ð¡CTCP ­«¸m°T®§«h¬O¦³¤H¹Á¸Õ³s±µ¥¼¶} ©ñ TCP ³q°T°ð³y¦¨ªºµ²ªG¡C¥H¤U³o¨Ç¬¡°Ê¥i¯à´N¬O³y¦¨³o¨Ç°T®§ªº­ì¦]¡G ¼É¤OªkªºªA°È²Õµ´§ðÀ»(DoS)¤è¦¡ (¬Û¸û©ó°w¹ï¯S®í®zÂI¨Ï¥Î³æ¤@«Ê¥]ªº§ðÀ»¤è¦¡)¡C ¤j¶qªº³q°T°ð±½´y(¬Û¸û©ó¶È¹Á¸Õ¤Ö¼Æªº±`¨£ªA°È³q°T°ð)¡C ¥X²{ªº¼Æ¦r¤¤²Ä¤@­Ó¥Nªí®Ú¾Ú³o¨Ç¬y¶q kernel À³¸Ó°e¥Xªº«Ê¥]¼Æ¡A ²Ä¤G­Ó¼Æ¦r«h¬O kernel ¥Ø«e­­¨î³Ì¤jµo°e¼Æ¡C§A¥i¥H§Q¥Î sysctl ­×§ï net.inet.icmp.icmplim ÅܼƭȨӧó§ï³Ì¤j­È¡CÁ| ¨Ò¨Ó»¡,¦pªG§Æ±æ­×§ï­­¨î¬° 300 packets per second¡G &prompt.root; sysctl -w net.inet.icmp.icmplim=300 ¦pªG§A¤£·Q¦b¨t²Î¬ö¿ý¤¤¬Ý¨ì³o¨Ç°T®§¡A¦ý¬O¤´µM§Æ±æ«O«ù¦^À³ªº­­ ¨îªº¸Ü¡A§A¥i¥H§Q¥Î sysctl ­×§ï net.inet.icmp.icmplim_output ÅܼƨӨú®ø³o¨Ç°T ®§¡G &prompt.root; sysctl -w net.inet.icmp.icmplim_output=0 ³Ì«á¡A¦pªG§A·Q¨ú®ø³o¨Ç­­¨îªº¸Ü¡A§A¥i¥H³]©w net.inet.icmp.icmplim (¦p¤W¨Ò©Ò¥Ü) ¬° 0¡C°ò©ó¤W­z²z¥Ñ¡A§Ú­Ì¤£«Øij§A¨ú®ø³o¨Ç­­¨î¡C ³o­Ó¿ù»~°T®§ arp: unknown hardware address format ¬O¤°»ò·N«ä¡H ³o¥Nªí§Aªº°Ï°ìºô¸ô³s½u¤W¦³¤@¨Ç³]³Æ¨Ï¥Î FreeBSD ¬Ý¤£À´±o MAC ®æ¦¡¡C³o³q±`¬O¥Nªí¦³¤H¦b§Aªº°Ï°ìºô¸ô¤W¶i¦æ¹êÅç¡A³Ì±`¨£ªº´N¬O cable modem ªº³s½u¡C³o°T®§µL®`¡A¦Ó¥BÀ³¸Ó¤£¦Ü©ó¼vÅT¨ì FreeBSD ¥D ¾÷ªº®Ä¯à¡C §Ú­è­è¸Ë¦n CVSup ®M¥ó¡A¦ý¬O¦b¹Á¸Õ°õ¦æ®Éµo¥Í¤F¿ù»~¡A­n«ç»ò¿ì¡H ­º¥ý¡A¬Ý¬Ý¿ù»~ªº°T®§¬O§_¦p¤U¡G /usr/libexec/ld-elf.so.1: Shared object "libXaw.so.6" not found ³oºØ¿ù»~°T®§¥Nªí§A¥D¾÷¤W¦w¸Ëªº net/cvsup ¨S¦³¥]§t XFree86 ®M¥ó¡C¦pªG§A·Q­n¨Ï¥Î CVSup ¤º«Øªº¹Ï§Î¤¶­± GUI ªº¸Ü¡A§A»Ý­n¦w¸Ë XFree86¡C¦¹¥~¡A¦pªG§A¥u·Q¥H©R¥O¦C¤è ¦¡¨Ï¥Î CVSup ªº¸Ü¡A§AÀ³¸Ó¥ý²¾°£¤§«e ¦w¸Ëªº®M¥ó¡C¨Ã¦w¸Ë net/cvsup-without-gui ³o®M ³nÅé¡C¦b FreeBSD ¤â¥U¤¤ CVSup ¬q¸¨¤¤¦³§ó¸Ô²Óªº»¡©ú¡C
Biing Jong Lin
bjlin@stic.gov.tw
¨t²Î¦w¥þ½g ¤°»ò¬O sandbox¡H Sandbox ¬O¨t²Î¦w¥þ¥Îªº³N»y¡A¦³¨â­Ó·N¸q¡G ©ñ¦b¬Y¨ÇµêÀÀ¨¾Å@Àð¸Ìªº°õ¦æµ{§Ç¡A³o¨Ç¨¾Å@Àð¬O¥Î¨Óªý¤î ¬Y¨Ç¤H«I¤J³o¹Dµ{§Ç¡A¶i¦Ó¥X¤J©ó§ó¤jªº¨t²Î¤¤¡C ³o¹Dµ{§Ç¥i¥H§¹¥þ¦b¨¾Å@Àð¸Ì °Ê§@¡C¤]´N ¬O»¡¡A¥¦©Ò°õ¦æªº¥ô¦óµ{¦¡¤£¥i¯à·|º¯³z¨ìÀ𪺥~­±¡C©Ò¥H¦pªG ±z¹ï¥¦¦³¦w¥þ¤WªºÅU¼{¡A¨Ã¤£»Ý­n¯S§O¥hºÊÅ¥¥¦ªº¤@Á|¤@°Ê¡A¤Ï ¥¿¥¦¥u¯à¦bÀ𤺬¡°Ê¡C Á|¨Ò¨Ó»¡¡A¥i¥H¥Î userid ¨Ó°µ³o¹D¨¾Å@Àð¡A³o¥¿¬O security ©M named »¡©ú¤å¥ó¤¤ªº©w¸q¡C ²{¦b´N¥Î ntalk ³o­ÓªA°È§@»¡©ú¡]¨£ /etc/inetd.conf¡^¡C³o­ÓªA°È¥H«eªº userid ¬O root¡A²{¦b°õ¦æ®É«h¬O¥Î tty¡Ctty ³o­Ó¨Ï¥ÎªÌ´N¬O¤@­Ó sandbox¡A¦pªG¦³¤H¯à°÷¶¶§Q¥Î ntalk «I¤J¨t²Î¡A²{¦b¥L´Nºâ¶i±o¨Ó¤]¥u¯à¥Î³o­Ó userid¡C ©ñ¦b¬Y­Ó¼ÒÀÀ¾÷¾¹¸Ìªºµ{¦¡¡A³o¤ñ¤W­z¨Ó±o§óÄY±K¡C°ò¥»¤W ³oªí¥Ü¯à«I¤J¸Óµ{¦¡ªº¤H¬Û«H¥L¯à¦A¶i¤J©ÒÄݪº¾÷¾¹¡A¦ý¨Æ¹ê¤W ¥u·|¶i¤J¼ÒÀÀ¥X¨Óªº¾÷¾¹¡AµLªk¶i¤@¨B­×§ï¥ô¦ó¯u¹êªº¸ê®Æ¡C ¹F¨ì³o­Ó¥Øªº³Ì±`¥Îªº¤èªk¡A´N¬O¦b¬Y­Ó¤l¥Ø¿ý¤U°µ¥X¼ÒÀÀªº Àô¹Ò¡AµM«á¥Î chroot °õ¦æ¸Óµ{¦¡¡A³o¼Ë¸Óµ{¦¡ªº®Ú¥Ø¿ý«K¬O³o­Ó ¤l¥Ø¿ý¡A¦Ó«D¨t²Î¯u¥¿ªº®Ú¥Ø¿ý¡C ¥t¤@­Ó±`¨£§@ªk¬O±N¬Y­ÓÀɮרt²Î mount ¦¨°ßŪ¡A¦ý¦b¥¦ ¤W­±¥t¥~»s³y¥Xµ{¦¡¥H¬°¥i¥H¼g¤JªºÀɮרt²Î¡C³o­Óµ{¦¡·|¬Û«H ¥¦¥i¥H¹ï¨ä¥LÀÉ®×Ū¼g¡A¦ý¥u¦³¥¦¬Ý¤£¨ì³o­Ó°ßŪ®ÄÀ³ - ¨t²Î °õ¦æªº¤@¯ëµ{¦¡³£¬Ý±o¨ì¡C §Ú­Ì¸Õ¹Ï±N³oÃþ sandbox ºÉ¶q³z©ú¤Æ¡AÅý¨Ï¥ÎªÌ©Î«I¤JªÌ µLªk¬Ý¨ì¥L¬O§_¦b¬Y­Ó sandbox ¸Ì­±¡C UNIX ¹ê§@¨âºØ sandbox¡A¤@­Ó¦bµ{¦¡¼h­±¡A¥t¤@­Ó«h¬O¥Ñ userid ¨Ó¹F¦¨¡C ¨C­Ó UNIX °õ¦æµ{§Ç·|¥Î¨¾¤õÀð±N¥¦©M©Ò¦³¨ä¥Lµ{§Ç¹j¶}¡A¬Y­Óµ{§Ç ¤£¥i¥HÀH·N­×§ï¨ä¥Lµ{§Ç¦ì§}ªº¸ê®Æ¡C³o©M Windows ¤¤¡Aµ{¦¡¥i¥H»´©ö ­×§ï¨ä¥L¦ì§}¸ê®Æ¡Aµ²ªG¾É­P·í¾÷ªº±¡§Î¤j¤£¬Û¦P¡C ¨C­Ó UNIX µ{§Ç³£ÄÝ©ó¬Y­Ó¯S©wªº userid¡C¦pªG¸Ó userid ¤£¬O root¡A´N·|±N¥¦©M¨ä¥L¨Ï¥ÎªÌªºµ{§Ç¹j¶}¡C Userid ¦P®É¤]¥Î©óµwºÐ¸ê®Æªº¦s¨úÅv¤W¡C ¤°»ò¬O securelevel? securelevel ¬O®Ö¤ß¤¤©Ò¹ê§@ªº¤@­Ó¦w¥þ¾÷¨î¡C°ò¥»¤W·í securelevel ¬O¥¿­È®É¡A®Ö¤ß·|­­¨î¬Y¨Ç¤u§@¡F§Y¨Ï¬O superuser (¤]´N¬O root) ¤]µLªk§¹¦¨¨º¨Ç¤u§@¡C¦b¼¶¼g ¥»¤å®É¡Asecurelevel ¾÷¨î¦b¤@¯ëªº­­¨î¥~¡AÁÙ¯à°÷­­¨î¥H¤Uªº¥\¯à¡G ²M°£¬Y¨Ç¯S©wªºÀɮ׺X¼Ð¡A¨Ò¦p schg (¨t²Î°ßŪ¼ÐºX, the system immutable flag) ¸g¥Ñ /dev/mem »P /dev/kmem¡A ±N¸ê®Æ¼g¤J¦Ü®Ö¤ß°O¾ÐÅ餤 ¸ü¤J®Ö¤ß¼Ò²Õ §ó°Ê &man.ipfirewall.4; ³W«h¡C ·Q­nÀˬd¦b¬Y­Ó¹B§@¤¤ªº¨t²Îªº securelevel ª¬ºA¡A¥u­n°õ¦æ¥H¤U ©R¥O§Y¥i¡G &prompt.root; sysctl kern.securelevel ¿é¥Xªºµ²ªG·|¥]§t¤@­Ó &man.sysctl.8; ÅܼƦWºÙ (¦b³o­Ó¨Ò¤l¤¤¡A ¥¦¬O kern.securelevel) ¥H¤Î¤@­Ó¼Æ¦r¡C«áªÌ§Y¬O ¥Ø«eªº securelevel ­È¡C¦pªG¥¦¬O¤@­Ó¥¿­È (¤]´N¬O¤j©ó 0)¡Aªí¥Ü¦Ü¤Ö ¦³¤@¨Ç securelevel ªº«OÅ@¾÷¨î¤w¸g¶}±Ò¤F¡C §A¨S¦³¿ìªk­°§C¤@­Ó¹B§@¤¤ªº¨t²Îªº securelevel¡F¦pªG¥i¥Hªº¸Ü¡A ´N¥¢¥h¤F³o­Ó¾÷¨îªº·N¸q¤F¡C¦pªG§A­n§@¤@¨Ç»Ý­n securelevel ¬° «D¥¿­È¤~¥i¥Hªº°Ê§@ªº¸Ü (¨Ò¦p installworld ©Î§ó°Ê¤é´Á)¡A§A»Ý­n­×§ï /etc/rc.conf ¤ºªº securelevel ³]©w (§ä§ä kern_securelevel ©M kern_securelevel_enable ÅܼÆ)¡AµM«á­«·s¶}¾÷¡C ·Q­nª¾¹D§ó¦h¦³Ãö©ó securelevel »P¦U­Ó¤£¦Pµ¥¯Å¼vÅTªº²Ó¸`¡A ½Ð°Ñ¦Ò &man.init.8; »¡©ú¤å¥ó¡C securelevel ¥i¤£¬O¸UÆF¤¦¡F¥¦¦³³\¦h¤wª¾ªº¯Ê³´¡A©¹©¹³y¦¨ ¤@ºØ¦w¥þªº°²¶H¡C ¥¦¤@­Ó³Ì¤jªº°ÝÃD¡A´N¬O­nÅý³o­Ó¥\¯à§¹¥þ¦³®Äªº¸Ü¡A¦b securelevel µo´§§@¥Î«eªº±Ò°Ê¹Lµ{¤¤¡A©Ò¦³¨Ï¥Î¨ìªºÀɮ׳£ ¥²¶·³Q«OÅ@°_¨Ó¡C¦pªG¤@­Ó§ðÀ»ªÌ¦b securelevel ¦³®Ä«e (¥Ñ©ó ¦³¨Ç¨t²Î¦b±Ò°Ê¤¤©Ò§@ªº¨Æ±¡¡AµLªk¦b¸û°ªªº securelevel ¤¤ ¥¿±`¹B§@¡A©Ò¥H³o·|¦b±Ò°Ê¹Lµ{¤¤«á´Á¤~·|¹B§@)¡A¯àÅý¥L­Ìªºµ{¦¡ ³Q°õ¦æªº¸Ü¡Asecurelevel ªº«OÅ@´N§¹¥þµL®Ä¤F¡C«OÅ@±Ò°Êµ{§Ç ¤¤©Ò¦³ªºÀɮצb§Þ³N¤W¬O¥i¦æªº¡A¦ý¬O¦pªG¯uªº³o¼Ë§@ªº¸Ü¡A¨t²Î ºûÅ@±N·|Åܦ¨¤@³õ¹ÚÆL¡C§Y¨Ï¥u¬O­×§ï¤@­Ó³]©wÀÉ¡A¤]¥²¶·±N¾ã­Ó ¨t²ÎÃö³¬¡A¦Ü¤Ö¤]±o¨ì³æ¤H¼Ò¦¡¡C °£¤F³oÂI¡AÁÙ¦³³\¦h¨ä¥¦ªºªF¦è³£¦b³q«H½×¾Â¤W°Q½×¡A¤×¨ä¬O freebsd-security¡C½Ð¨ì ³o¸Ì ·j´M¥H«eªº °Q½×¡C¦³¨Ç¤H§Æ±æ securelevel ¯à°÷¾¨§Ö®ø¥¢¡A¥Ñ¥t¤@­Ó§óÀu¨qªº ¾÷¨î¨ú¥N¡A¤£¹L¾÷·|¦³ÂI´ù¯í¡C ­·ÀI¦Û¦æ©Ó¾á¡C BIND (named) °£¤F¦b³q°T°ð 53 ¥H¥~¤]¦b ¨ä¥L°ª½s¸¹³q°T°ð (high-numbered port) ²âÅ¥ (Listen)¡C ³o¬O«ç»ò¦^¨Æ¡H FreeBSD 3.0 «áªºª©¥»¨Ï¥Î¤@­Ó¯S®íªº BIND ª©¥»¡A³o­Óª©¥»·|¨Ï ¥ÎÀH¾÷ªº°ª½s¸¹³q°T°ð¨Ó¦^À³¥~³¡ªº¬d¸ß¡C¦pªG§A¦]¬°­n¾A¦X¨¾¤õÀ𪺠³]©w©Î¬O³æ¯Âªº·QÅý¦Û¤v¬Ý¨ÓµÎªA¤@ÂI¦Ó·Q¥Î 53 ³q°T°ð¦^À³¥~³¡¬d¸ß¡A ¨º»ò§A¥i¥H¹Á¸Õ§ó§ï¥H¤UÀɮ׬ÛÃö¤º®e /etc/namedb/named.conf¡G options { query-source address * port 53; }; §A¤]¥i¥H±N * §ó§ï¬°¯S©w IP address¡A ÂÇ¥H¥[±j±±¨î±ø¥ó¡C ¶¶«K®¥³ß§A¡C¯à°÷Ū¨ú§A¨t²Î¤Wªº &man.sockstat.1; ³ø§i¨Ã¥Bª`·N ¤£¥¿±`ª¬ªp¬O¤@¥ó¦n¨Æ¡I Sendmail °£¤F¦b¼Ð·Çªº³q°T°ð 25 ¥~¤]¦b³q°T°ð 587 ²âÅ¥¡I³o¬O«ç »ò¦^¨Æ¡H ¸û·sª©¥»ªº Sendmail ¤ä´© mail submission ³o¶µ¥\¯à¡A¨Ã¥B¨Ï ¥Î³q°T°ð 587¡C³o¶µ¥\¯àÁÙ¨S¦³³Q¼sªx¤ä´©¦ý¬O¤ä´©ªº¼Æ¥Ø¥¿¦b¼Wªø ¤¤¡C §Úµo²{¤F³o­Ó UID 0 toor ±b¸¹¡A³o¬O¤°»ò ¸J¿|¡H§Ú³Q¶Â±¼¤F¶Ü¡H ©ñ¤ß¡Ctoor ¬O¤@­Ó alternative ºÞ²zªÌ±b¸¹ (toor ¬O root ªºÂà¦V«÷ªk)¡C ¥H©¹¬O¸òÀH &man.bash.1; ¦w¸Ë¦Ó«Ø¨îªº¡A«á¨Ó«h¦¨¬°¨t²Î¤º©w«Ø¨îªº¤@ ­Ó±b¸¹¡C³o­Ó±b¸¹±N¦ñÀH¤@­Ó«D¼Ð·Çªº shell ´ú¸Õ¨Ï¥Î¡A Åý§A¤£»Ý­n¥h §ó§ï¨ì root ªº¤º«Ø shell¡C¦]¬°³o¨Ç¨ä¥Lªº shell ¨Ã¨S¦³¸òÀH¨t²Î¹w³]­È¦w¸Ë (Á|¨Ò¨Ó»¡¡A¬Y¨Ç¥Ñ ports ¦w¸Ëªº shell package)¡A¦Ó³Q¤º©w¦w¸Ë¦b /usr/local/bin ¥Ø¿ý¤U¡A¦³¥i¯à¦s¦b¤£¦PªºÀɮרt²Î¤¤¡C ­Õ­Y root ªº shell ³Q©ñ¦b /usr/local/bin¡A¥B /usr (©Î¬O¨ä¥L¥]§tµÛ /usr/local/bin ³o­Ó¤l¥Ø¿ýªºÀɮרt²Î) ¦]¬°¬Y¨Ç­ì¦]¨Ã¨S¦³³Q¥¿±`ªº mount °_¨Óªº¸Ü¡Aroot ±NµLªk¥¿±`ªºµn¤J¨t²Î¶i¦æºû­× (ÁöµM»¡§A­«¶}¾÷¦¨³æ¤H¼Ò¦¡´N·|°Ý§A­n ¸ü¤J­þ­Ó shell)¡C ¦³¨Ç¤H¨Ï¥Î toor ±b¸¹¶i¦æ¨C¤éªº root ºûÅ@¤u§@¡A¦p¦¹¥i¥H¨Ï¥Î«D¼Ð·Çªº shell¡A¦Ó root ¥i¥H«O¯d¼Ð·Ç shell¡A ¥H¦]À³³æ¤@¨Ï¥ÎªÌ¼Ò¦¡ (single user mode) ©Îºò«æª¬ªp³B²z¡C ¨Ì·Ó¨t²Î¤º©w­È¡A§A±NµLªk¨Ï¥Î toor µn¤J¡A ¦]¬°³o­Ó±b¸¹©|¥¼§ó§ï±K½X³]©w¡C¦]¦¹§A¦pªG§A·Q±Ò°Ê³o­Ó±b¸¹¡A§A»Ý­n ¨Ï¥Î root µn¤J¨t²Î¨Ã¥B­×§ï toor ªº±K½X¡C ¬°¤°»ò suidperl µLªk¥¿±`¹B§@¡H ¦]¬°¬Y¨Ç¦w¥þªº¦Ò¡Asuidperl ¤º©wªº¦w¸Ë ¨Ã¨S¦³³]©w suid bit¡C¨t²ÎºÞ²zªÌ¥i¥H¨Ì·Ó¥H¤U©R¥O±Ò°Ê suid ³]©w¡C &prompt.root; chmod u+s /usr/bin/suidperl ¦pªG§A·Q­n¦b¥Ñ source ¤É¯Å®É suidperl ¤º©w ±Ò°Ê suid ¥\¯àªº¸Ü¡A½s¿è /etc/make.conf ¥[¤J ENABLE_SUIDPERL=true µM«á°õ¦æ make buildworld¡C
PPP I cannot make &man.ppp.8; work. What am I doing wrong? You should first read the &man.ppp.8; man page and the PPP section of the handbook. Enable logging with the command set log Phase Chat Connect Carrier lcp ipcp ccp command This command may be typed at the &man.ppp.8; command prompt or it may be entered in the /etc/ppp/ppp.conf configuration file (the start of the default section is the best place to put it). Make sure that /etc/syslog.conf (see &man.syslog.conf.5;) contains the lines !ppp *.* /var/log/ppp.log and that the file /var/log/ppp.log exists. You can now find out a lot about what is going on from the log file. Do not worry if it does not all make sense. If you need to get help from someone, it may make sense to them. If your version of &man.ppp.8; does not understand the set log command, you should download the latest version. It will build on FreeBSD version 2.1.5 and higher. Why does &man.ppp.8; hang when I run it? This is usually because your hostname will not resolve. The best way to fix this is to make sure that /etc/hosts is consulted by your resolver first by editing /etc/host.conf and putting the hosts line first. Then, simply put an entry in /etc/hosts for your local machine. If you have no local network, change your localhost line: 127.0.0.1 foo.bar.com foo localhost Otherwise, simply add another entry for your host. Consult the relevant man pages for more details. You should be able to successfully ping -c1 `hostname` when you are done. Why will &man.ppp.8; not dial in -auto mode? First, check that you have got a default route. By running netstat -rn (see &man.netstat.1;), you should see two entries like this: Destination Gateway Flags Refs Use Netif Expire default 10.0.0.2 UGSc 0 0 tun0 10.0.0.2 10.0.0.1 UH 0 0 tun0 This is assuming that you have used the addresses from the handbook, the man page or from the ppp.conf.sample file. If you do not have a default route, it may be because you are running an old version of &man.ppp.8; that does not understand the word HISADDR in the ppp.conf file. If your version of &man.ppp.8; is from before FreeBSD 2.2.5, change the add 0 0 HISADDR line to one saying add 0 0 10.0.0.2 Another reason for the default route line being missing is that you have mistakenly set up a default router in your /etc/rc.conf (see &man.rc.conf.5;) file (this file was called /etc/sysconfig prior to release 2.2.2), and you have omitted the line saying delete ALL from ppp.conf. If this is the case, go back to the Final system configuration section of the handbook. What does No route to host mean? This error is usually due to a missing MYADDR: delete ALL add 0 0 HISADDR section in your /etc/ppp/ppp.linkup file. This is only necessary if you have a dynamic IP address or do not know the address of your gateway. If you are using interactive mode, you can type the following after entering packet mode (packet mode is indicated by the capitalized PPP in the prompt): delete ALL add 0 0 HISADDR Refer to the PPP and Dynamic IP addresses section of the handbook for further details. Why does my connection drop after about 3 minutes? The default PPP timeout is 3 minutes. This can be adjusted with the line set timeout NNN where NNN is the number of seconds of inactivity before the connection is closed. If NNN is zero, the connection is never closed due to a timeout. It is possible to put this command in the ppp.conf file, or to type it at the prompt in interactive mode. It is also possible to adjust it on the fly while the line is active by connecting to ppps server socket using &man.telnet.1; or &man.pppctl.8;. Refer to the &man.ppp.8; man page for further details. Why does my connection drop under heavy load? If you have Link Quality Reporting (LQR) configured, it is possible that too many LQR packets are lost between your machine and the peer. Ppp deduces that the line must therefore be bad, and disconnects. Prior to FreeBSD version 2.2.5, LQR was enabled by default. It is now disabled by default. LQR can be disabled with the line disable lqr Why does my connection drop after a random amount of time? Sometimes, on a noisy phone line or even on a line with call waiting enabled, your modem may hang up because it thinks (incorrectly) that it lost carrier. There is a setting on most modems for determining how tolerant it should be to temporary losses of carrier. On a USR Sportster for example, this is measured by the S10 register in tenths of a second. To make your modem more forgiving, you could add the following send-expect sequence to your dial string: set dial "...... ATS10=10 OK ......" Refer to your modem manual for details. Why does my connection hang after a random amount of time? Many people experience hung connections with no apparent explanation. The first thing to establish is which side of the link is hung. If you are using an external modem, you can simply try using &man.ping.8; to see if the TD light is flashing when you transmit data. If it flashes (and the RD light does not), the problem is with the remote end. If TD does not flash, the problem is local. With an internal modem, you will need to use the set server command in your ppp.conf file. When the hang occurs, connect to &man.ppp.8; using &man.pppctl.8;. If your network connection suddenly revives (PPP was revived due to the activity on the diagnostic socket) or if you cannot connect (assuming the set socket command succeeded at startup time), the problem is local. If you can connect and things are still hung, enable local async logging with set log local async and use &man.ping.8; from another window or terminal to make use of the link. The async logging will show you the data being transmitted and received on the link. If data is going out and not coming back, the problem is remote. Having established whether the problem is local or remote, you now have two possibilities: The remote end is not responding. What can I do? There is very little you can do about this. Most ISPs will refuse to help if you are not running a Microsoft OS. You can enable lqr in your ppp.conf file, allowing &man.ppp.8; to detect the remote failure and hang up, but this detection is relatively slow and therefore not that useful. You may want to avoid telling your ISP that you are running user-PPP... First, try disabling all local compression by adding the following to your configuration: disable pred1 deflate deflate24 protocomp acfcomp shortseq vj deny pred1 deflate deflate24 protocomp acfcomp shortseq vj Then reconnect to ensure that this makes no difference. If things improve or if the problem is solved completely, determine which setting makes the difference through trial and error. This will provide good ammunition when you contact your ISP (although it may make it apparent that you are not running a Microsoft product). Before contacting your ISP, enable async logging locally and wait until the connection hangs again. This may use up quite a bit of disk space. The last data read from the port may be of interest. It is usually ascii data, and may even describe the problem (Memory fault, core dumped?). If your ISP is helpful, they should be able to enable logging on their end, then when the next link drop occurs, they may be able to tell you why their side is having a problem. Feel free to send the details to &a.brian;, or even to ask your ISP to contact me directly. &man.ppp.8; has hung. What can I do? Your best bet here is to rebuild &man.ppp.8; by adding CFLAGS+=-g and STRIP= to the end of the Makefile, then doing a make clean && make && make install. When &man.ppp.8; hangs, find the &man.ppp.8; process id with ps ajxww | fgrep ppp and run gdb ppp PID. From the gdb prompt, you can then use bt to get a stack trace. Send the results to brian@Awfulhak.org. Why does nothing happen after the Login OK! message? Prior to FreeBSD version 2.2.5, once the link was established, &man.ppp.8; would wait for the peer to initiate the Line Control Protocol (LCP). Many ISPs will not initiate negotiations and expect the client to do so. To force &man.ppp.8; to initiate the LCP, use the following line: set openmode active It usually does no harm if both sides initiate negotiation, so openmode is now active by default. However, the next section explains when it does do some harm. I keep seeing errors about magic being the same. What does it mean? Occasionally, just after connecting, you may see messages in the log that say magic is the same. Sometimes, these messages are harmless, and sometimes one side or the other exits. Most PPP implementations cannot survive this problem, and even if the link seems to come up, you will see repeated configure requests and configure acknowledgments in the log file until &man.ppp.8; eventually gives up and closes the connection. This normally happens on server machines with slow disks that are spawning a getty on the port, and executing &man.ppp.8; from a login script or program after login. I have also heard reports of it happening consistently when using slirp. The reason is that in the time taken between &man.getty.8; exiting and &man.ppp.8; starting, the client-side &man.ppp.8; starts sending Line Control Protocol (LCP) packets. Because ECHO is still switched on for the port on the server, the client &man.ppp.8; sees these packets reflect back. One part of the LCP negotiation is to establish a magic number for each side of the link so that reflections can be detected. The protocol says that when the peer tries to negotiate the same magic number, a NAK should be sent and a new magic number should be chosen. During the period that the server port has ECHO turned on, the client &man.ppp.8; sends LCP packets, sees the same magic in the reflected packet and NAKs it. It also sees the NAK reflect (which also means &man.ppp.8; must change its magic). This produces a potentially enormous number of magic number changes, all of which are happily piling into the server's tty buffer. As soon as &man.ppp.8; starts on the server, it is flooded with magic number changes and almost immediately decides it has tried enough to negotiate LCP and gives up. Meanwhile, the client, who no longer sees the reflections, becomes happy just in time to see a hangup from the server. This can be avoided by allowing the peer to start negotiating with the following line in your ppp.conf file: set openmode passive This tells &man.ppp.8; to wait for the server to initiate LCP negotiations. Some servers however may never initiate negotiations. If this is the case, you can do something like: set openmode active 3 This tells &man.ppp.8; to be passive for 3 seconds, and then to start sending LCP requests. If the peer starts sending requests during this period, &man.ppp.8; will immediately respond rather than waiting for the full 3 second period. LCP negotiations continue until the connection is closed. What is wrong? There is currently an implementation mis-feature in &man.ppp.8; where it does not associate LCP, CCP & IPCP responses with their original requests. As a result, if one PPP implementation is more than 6 seconds slower than the other side, the other side will send two additional LCP configuration requests. This is fatal. Consider two implementations, A and B. A starts sending LCP requests immediately after connecting and B takes 7 seconds to start. When B starts, A has sent 3 LCP REQs. We are assuming the line has ECHO switched off, otherwise we would see magic number problems as described in the previous section. B sends a REQ, then an ACK to the first of A's REQs. This results in A entering the OPENED state and sending and ACK (the first) back to B. In the meantime, B sends back two more ACKs in response to the two additional REQs sent by A before B started up. B then receives the first ACK from A and enters the OPENED state. A receives the second ACK from B and goes back to the REQ-SENT state, sending another (forth) REQ as per the RFC. It then receives the third ACK and enters the OPENED state. In the meantime, B receives the forth REQ from A, resulting in it reverting to the ACK-SENT state and sending another (second) REQ and (forth) ACK as per the RFC. A gets the REQ, goes into REQ-SENT and sends another REQ. It immediately receives the following ACK and enters OPENED. This goes on until one side figures out that they are getting nowhere and gives up. The best way to avoid this is to configure one side to be passive - that is, make one side wait for the other to start negotiating. This can be done with the set openmode passive command. Care should be taken with this option. You should also use the set stopped N command to limit the amount of time that &man.ppp.8; waits for the peer to begin negotiations. Alternatively, the set openmode active N command (where N is the number of seconds to wait before starting negotiations) can be used. Check the manual page for details. Why does &man.ppp.8; lock up shortly after connection? Prior to version 2.2.5 of FreeBSD, it was possible that your link was disabled shortly after connection due to &man.ppp.8; mis-handling Predictor1 compression negotiation. This would only happen if both sides tried to negotiate different Compression Control Protocols (CCP). This problem is now corrected, but if you are still running an old version of &man.ppp.8; the problem can be circumvented with the line disable pred1 Why does &man.ppp.8; lock up when I shell out to test it? When you execute the shell or ! command, &man.ppp.8; executes a shell (or if you have passed any arguments, &man.ppp.8; will execute those arguments). Ppp will wait for the command to complete before continuing. If you attempt to use the PPP link while running the command, the link will appear to have frozen. This is because &man.ppp.8; is waiting for the command to complete. If you wish to execute commands like this, use the !bg command instead. This will execute the given command in the background, and &man.ppp.8; can continue to service the link. Why does &man.ppp.8; over a null-modem cable never exit? There is no way for &man.ppp.8; to automatically determine that a direct connection has been dropped. This is due to the lines that are used in a null-modem serial cable. When using this sort of connection, LQR should always be enabled with the line enable lqr LQR is accepted by default if negotiated by the peer. Why does &man.ppp.8; dial for no reason in -auto mode? If &man.ppp.8; is dialing unexpectedly, you must determine the cause, and set up Dial filters (dfilters) to prevent such dialing. To determine the cause, use the following line: set log +tcp/ip This will log all traffic through the connection. The next time the line comes up unexpectedly, you will see the reason logged with a convenient timestamp next to it. You can now disable dialing under these circumstances. Usually, this sort of problem arises due to DNS lookups. To prevent DNS lookups from establishing a connection (this will not prevent &man.ppp.8; from passing the packets through an established connection), use the following: set dfilter 1 deny udp src eq 53 set dfilter 2 deny udp dst eq 53 set dfilter 3 permit 0/0 0/0 This is not always suitable, as it will effectively break your demand-dial capabilities - most programs will need a DNS lookup before doing any other network related things. In the DNS case, you should try to determine what is actually trying to resolve a host name. A lot of the time, &man.sendmail.8; is the culprit. You should make sure that you tell sendmail not to do any DNS lookups in its configuration file. See the section on Mail Configuration for details on how to create your own configuration file and what should go into it. You may also want to add the following line to your .mc file: define(`confDELIVERY_MODE', `d')dnl This will make sendmail queue everything until the queue is run (usually, sendmail is invoked with , telling it to run the queue every 30 minutes) or until a sendmail -q is done (perhaps from your ppp.linkup file). What do these CCP errors mean? I keep seeing the following errors in my log file: CCP: CcpSendConfigReq CCP: Received Terminate Ack (1) state = Req-Sent (6) This is because &man.ppp.8; is trying to negotiate Predictor1 compression, and the peer does not want to negotiate any compression at all. The messages are harmless, but if you wish to remove them, you can disable Predictor1 compression locally too: disable pred1 Why does &man.ppp.8; lock up during file transfers with IO errors? Under FreeBSD 2.2.2 and before, there was a bug in the tun driver that prevents incoming packets of a size larger than the tun interface's MTU size. Receipt of a packet greater than the MTU size results in an IO error being logged via syslogd. The PPP specification says that an MRU of 1500 should always be accepted as a minimum, despite any LCP negotiations, therefore it is possible that should you decrease the MTU to less than 1500, your ISP will transmit packets of 1500 regardless, and you will tickle this non-feature - locking up your link. The problem can be circumvented by never setting an MTU of less than 1500 under FreeBSD 2.2.2 or before. Why does &man.ppp.8; not log my connection speed? In order to log all lines of your modem conversation, you must enable the following: set log +connect This will make &man.ppp.8; log everything up until the last requested expect string. If you wish to see your connect speed and are using PAP or CHAP (and therefore do not have anything to chat after the CONNECT in the dial script - no set login script), you must make sure that you instruct &man.ppp.8; to expect the whole CONNECT line, something like this: set dial "ABORT BUSY ABORT NO\\sCARRIER TIMEOUT 4 \ \"\" ATZ OK-ATZ-OK ATDT\\T TIMEOUT 60 CONNECT \\c \\n" Here, we get our CONNECT, send nothing, then expect a line-feed, forcing &man.ppp.8; to read the whole CONNECT response. Why does &man.ppp.8; ignore the \ character in my chat script? Ppp parses each line in your config files so that it can interpret strings such as set phone "123 456 789" correctly (and realize that the number is actually only one argument. In order to specify a " character, you must escape it using a backslash (\). When the chat interpreter parses each argument, it re-interprets the argument in order to find any special escape sequences such as \P or \T (see the man page). As a result of this double-parsing, you must remember to use the correct number of escapes. If you wish to actually send a \ character to (say) your modem, you would need something like: set dial "\"\" ATZ OK-ATZ-OK AT\\\\X OK" resulting in the following sequence: ATZ OK AT\X OK or set phone 1234567 set dial "\"\" ATZ OK ATDT\\T" resulting in the following sequence: ATZ OK ATDT1234567 Why does &man.ppp.8; get a seg-fault, but I see no ppp.core file? Ppp (or any other program for that matter) should never dump core. Because &man.ppp.8; runs with an effective user id of 0, the operating system will not write &man.ppp.8;'s core image to disk before terminating it. If, however &man.ppp.8; is actually terminating due to a segmentation violation or some other signal that normally causes core to be dumped, and you are sure you are using the latest version (see the start of this section), then you should do the following: &prompt.user; tar xfz ppp-*.src.tar.gz &prompt.user; cd ppp*/ppp &prompt.user; echo STRIP= >>Makefile &prompt.user; echo CFLAGS+=-g >>Makefile &prompt.user; make clean all &prompt.user; su &prompt.root; make install &prompt.root; chmod 555 /usr/sbin/ppp You will now have a debuggable version of &man.ppp.8; installed. You will have to be root to run &man.ppp.8; as all of its privileges have been revoked. When you start &man.ppp.8;, take a careful note of what your current directory was at the time. Now, if and when &man.ppp.8; receives the segmentation violation, it will dump a core file called ppp.core. You should then do the following: &prompt.user; su &prompt.root; gdb /usr/sbin/ppp ppp.core (gdb) bt ..... (gdb) f 0 .... (gdb) i args .... (gdb) l ..... All of this information should be given alongside your question, making it possible to diagnose the problem. If you are familiar with gdb, you may wish to find out some other bits and pieces such as what actually caused the dump and the addresses & values of the relevant variables. Why does the process that forces a dial in auto mode never connect? This was a known problem with &man.ppp.8; set up to negotiate a dynamic local IP number with the peer in auto mode. It is fixed in the latest version - search the man page for iface. The problem was that when that initial program calls &man.connect.2;, the IP number of the tun interface is assigned to the socket endpoint. The kernel creates the first outgoing packet and writes it to the tun device. &man.ppp.8; then reads the packet and establishes a connection. If, as a result of &man.ppp.8;'s dynamic IP assignment, the interface address is changed, the original socket endpoint will be invalid. Any subsequent packets sent to the peer will usually be dropped. Even if they are not, any responses will not route back to the originating machine as the IP number is no longer owned by that machine. There are several theoretical ways to approach this problem. It would be nicest if the peer would re-assign the same IP number if possible :-) The current version of &man.ppp.8; does this, but most other implementations do not. The easiest method from our side would be to never change the tun interface IP number, but instead to change all outgoing packets so that the source IP number is changed from the interface IP to the negotiated IP on the fly. This is essentially what the iface-alias option in the latest version of &man.ppp.8; is doing (with the help of &man.libalias.3; and &man.ppp.8;'s switch) - it is maintaining all previous interface addresses and NATing them to the last negotiated address. Another alternative (and probably the most reliable) would be to implement a system call that changes all bound sockets from one IP to another. &man.ppp.8; would use this call to modify the sockets of all existing programs when a new IP number is negotiated. The same system call could be used by dhcp clients when they are forced to re-bind() their sockets. Yet another possibility is to allow an interface to be brought up without an IP number. Outgoing packets would be given an IP number of 255.255.255.255 up until the first SIOCAIFADDR ioctl is done. This would result in fully binding the socket. It would be up to &man.ppp.8; to change the source IP number, but only if it is set to 255.255.255.255, and only the IP number and IP checksum would need to change. This, however is a bit of a hack as the kernel would be sending bad packets to an improperly configured interface, on the assumption that some other mechanism is capable of fixing things retrospectively. Why do most games not work with the -nat switch? The reason games and the like do not work when libalias is in use is that the machine on the outside will try to open a connection or send (unsolicited) UDP packets to the machine on the inside. The NAT software does not know that it should send these packets to the interior machine. To make things work, make sure that the only thing running is the software that you are having problems with, then either run tcpdump on the tun interface of the gateway or enable &man.ppp.8; tcp/ip logging (set log +tcp/ip) on the gateway. When you start the offending software, you should see packets passing through the gateway machine. When something comes back from the outside, it will be dropped (that is the problem). Note the port number of these packets then shut down the offending software. Do this a few times to see if the port numbers are consistent. If they are, then the following line in the relevant section of /etc/ppp/ppp.conf will make the software functional: nat port proto internalmachine:port port where proto is either tcp or udp, internalmachine is the machine that you want the packets to be sent to and port is the destination port number of the packets. You will not be able to use the software on other machines without changing the above command, and running the software on two internal machines at the same time is out of the question - after all, the outside world is seeing your entire internal network as being just a single machine. If the port numbers are not consistent, there are three more options: Submit support in libalias. Examples of special cases can be found in /usr/src/lib/libalias/alias_*.c (alias_ftp.c is a good prototype). This usually involves reading certain recognised outgoing packets, identifying the instruction that tells the outside machine to initiate a connection back to the internal machine on a specific (random) port and setting up a route in the alias table so that the subsequent packets know where to go. This is the most difficult solution, but it is the best and will make the software work with multiple machines. Use a proxy. The application may support socks5 for example, or (as in the cvsup case) may have a passive option that avoids ever requesting that the peer open connections back to the local machine. Redirect everything to the internal machine using nat addr. This is the sledge-hammer approach. Has anybody made a list of useful port numbers? Not yet, but this is intended to grow into such a list (if any interest is shown). In each example, internal should be replaced with the IP number of the machine playing the game. Asheron's Call nat port udp internal :65000 65000 Manually change the port number within the game to 65000. If you have got a number of machines that you wish to play on assign a unique port number for each (i.e. 65001, 65002, etc) and add a nat port line for each one. Half Life nat port udp internal:27005 27015 PCAnywhere 8.0 nat port udp internal:5632 5632 nat port tcp internal:5631 5631 Quake nat port udp internal:6112 6112 Alternatively, you may want to take a look at www.battle.net for Quake proxy support. Quake 2 nat port udp internal:27901 27910 nat port udp internal:60021 60021 nat port udp internal:60040 60040 Red Alert nat port udp internal:8675 8675 nat port udp internal:5009 5009 What are FCS errors? FCS stands for Frame Check Sequence. Each PPP packet has a checksum attached to ensure that the data being received is the data being sent. If the FCS of an incoming packet is incorrect, the packet is dropped and the HDLC FCS count is increased. The HDLC error values can be displayed using the show hdlc command. If your link is bad (or if your serial driver is dropping packets), you will see the occasional FCS error. This is not usually worth worrying about although it does slow down the compression protocols substantially. If you have an external modem, make sure your cable is properly shielded from interference - this may eradicate the problem. If your link freezes as soon as you have connected and you see a large number of FCS errors, this may be because your link is not 8 bit clean. Make sure your modem is not using software flow control (XON/XOFF). If your datalink must use software flow control, use the command set accmap 0x000a0000 to tell &man.ppp.8; to escape the ^Q and ^S characters. Another reason for seeing too many FCS errors may be that the remote end has stopped talking PPP. You may want to enable async logging at this point to determine if the incoming data is actually a login or shell prompt. If you have a shell prompt at the remote end, it is possible to terminate &man.ppp.8; without dropping the line by using the close lcp command (a following term command will reconnect you to the shell on the remote machine. If nothing in your log file indicates why the link might have been terminated, you should ask the remote administrator (your ISP?) why the session was terminated. Why do MacOS and Windows 98 connections freeze when running PPPoE on the gateway? Thanks to Michael Wozniak mwozniak@netcom.ca for figuring this out and Dan Flemming danflemming@mac.com for the Mac solution: This is due to what is called a Black Hole router. MacOS and Windows 98 (and maybe other Microsoft OSs) send TCP packets with a requested segment size too big to fit into a PPPoE frame (MTU is 1500 by default for Ethernet) and have the do not fragment bit set (default of TCP) and the Telco router is not sending ICMP must fragment back to the www site you are trying to load. (Alternatively, the router is sending the ICMP packet correctly, but the firewall at the www site is dropping it.) When the www server is sending you frames that do not fit into the PPPoE pipe the Telco router drops them on the floor and your page does not load (some pages/graphics do as they are smaller than a MSS.) This seems to be the default of most Telco PPPoE configurations (if only they knew how to program a router... sigh...) One fix is to use regedit on your 95/98 boxes to add the following registry entry... HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Class\NetTrans\0000\MaxMTU It should be a string with a value 1436, as some ADSL routers are reported to be unable to deal with packets larger than this. This registry key has been changed to Tcpip\Parameters\Interfaces\ID for adapter\MTU in Windows 2000 and becomes a DWORD. Refer to the Microsoft Knowledge Base documents Q158474 - Windows TCPIP Registry Entries and Q120642 - TCPIP & NBT Configuration Parameters for Windows NT for more information on changing Windows MTU to work with a NAT router. Another regedit possibility under Windows 2000 is to set the Tcpip\Parameters\Interfaces\ID for adapter\EnablePMTUBHDetect DWORD to 1 as mentioned in the Microsoft document 120642 mentioned above. Unfortunately, MacOS does not provide an interface for changing TCP/IP settings. However, there is commercial software available, such as OTAdvancedTuner (OT for OpenTransport, the MacOS TCP/IP stack) by Sustainable Softworks, that will allow users to customize TCP/IP settings. MacOS NAT users should select ip_interface_MTU from the drop-down menu, enter 1450 instead of 1500 in the box, click the box next to Save as Auto Configure, and click Make Active. The latest version of &man.ppp.8; (2.3 or greater) has an enable tcpmssfixup command that will automatically adjust the MSS to an appropriate value. This facility is enabled by default. If you are stuck with an older version of &man.ppp.8;, you may want to look at the tcpmssd port. None of this helps - I am desperate! What can I do? If all else fails, send as much information as you can, including your config files, how you are starting &man.ppp.8;, the relevant parts of your log file and the output of the netstat -rn command (before and after connecting) to the &a.questions; or the comp.unix.bsd.freebsd.misc news group, and someone should point you in the right direction. Serial Communications This section answers common questions about serial communications with FreeBSD. PPP and SLIP are covered in the section. How do I tell if FreeBSD found my serial ports? As the FreeBSD kernel boots, it will probe for the serial ports in your system for which the kernel was configured. You can either watch your system closely for the messages it prints or run the command &prompt.user; dmesg | grep sio after your system is up and running. Here is some example output from the above command: sio0 at 0x3f8-0x3ff irq 4 on isa sio0: type 16550A sio1 at 0x2f8-0x2ff irq 3 on isa sio1: type 16550A This shows two serial ports. The first is on irq 4, is using port address 0x3f8, and has a 16550A-type UART chip. The second uses the same kind of chip but is on irq 3 and is at port address 0x2f8. Internal modem cards are treated just like serial ports---except that they always have a modem attached to the port. The GENERIC kernel includes support for two serial ports using the same irq and port address settings in the above example. If these settings are not right for your system, or if you have added modem cards or have more serial ports than your kernel is configured for, just reconfigure your kernel. See section about building a kernel for more details. How do I tell if FreeBSD found my modem cards? Refer to the answer to the previous question. I just upgraded to 2.0.5 and my tty0X are missing! How do I solve this problem? Do not worry, they have been merged with the ttydX devices. You will have to change any old configuration files you have, though. How do I access the serial ports on FreeBSD? The third serial port, sio2 (see &man.sio.4;, known as COM3 in DOS), is on /dev/cuaa2 for dial-out devices, and on /dev/ttyd2 for dial-in devices. What is the difference between these two classes of devices? You use ttydX for dial-ins. When opening /dev/ttydX in blocking mode, a process will wait for the corresponding cuaaX device to become inactive, and then wait for the carrier detect line to go active. When you open the cuaaX device, it makes sure the serial port is not already in use by the ttydX device. If the port is available, it steals it from the ttydX device. Also, the cuaaX device does not care about carrier detect. With this scheme and an auto-answer modem, you can have remote users log in and you can still dial out with the same modem and the system will take care of all the conflicts. How do I enable support for a multiport serial card? Again, the section on kernel configuration provides information about configuring your kernel. For a multiport serial card, place an &man.sio.4; line for each serial port on the card in the kernel configuration file. But place the irq and vector specifiers on only one of the entries. All of the ports on the card should share one irq. For consistency, use the last serial port to specify the irq. Also, specify the COM_MULTIPORT option. The following example is for an AST 4-port serial card on irq 7: options "COM_MULTIPORT" device sio4 at isa? port 0x2a0 tty flags 0x781 device sio5 at isa? port 0x2a8 tty flags 0x781 device sio6 at isa? port 0x2b0 tty flags 0x781 device sio7 at isa? port 0x2b8 tty flags 0x781 irq 7 vector siointr The flags indicate that the master port has minor number 7 (0x700), diagnostics enabled during probe (0x080), and all the ports share an irq (0x001). Can FreeBSD handle multiport serial cards sharing irqs? Not yet. You will have to use a different irq for each card. Can I set the default serial parameters for a port? The ttydX (or cuaaX) device is the regular device you will want to open for your applications. When a process opens the device, it will have a default set of terminal I/O settings. You can see these settings with the command &prompt.root; stty -a -f /dev/ttyd1 When you change the settings to this device, the settings are in effect until the device is closed. When it is reopened, it goes back to the default set. To make changes to the default set, you can open and adjust the settings of the initial state device. For example, to turn on CLOCAL mode, 8 bits, and XON/XOFF flow control by default for ttyd5, do: &prompt.root; stty -f /dev/ttyid5 clocal cs8 ixon ixoff A good place to do this is in /etc/rc.serial. Now, an application will have these settings by default when it opens ttyd5. It can still change these settings to its liking, though. You can also prevent certain settings from being changed by an application by making adjustments to the lock state device. For example, to lock the speed of ttyd5 to 57600 bps, do &prompt.root; stty -f /dev/ttyld5 57600 Now, an application that opens ttyd5 and tries to change the speed of the port will be stuck with 57600 bps. Naturally, you should make the initial state and lock state devices writable only by root. The &man.MAKEDEV.8; script does NOT do this when it creates the device entries. How can I enable dialup logins on my modem? So you want to become an Internet service provider, eh? First, you will need one or more modems that can auto-answer. Your modem will need to assert carrier-detect when it detects a carrier and not assert it all the time. It will need to hang up the phone and reset itself when the data terminal ready (DTR) line goes from on to off. It should probably use RTS/CTS flow control or no local flow control at all. Finally, it must use a constant speed between the computer and itself, but (to be nice to your callers) it should negotiate a speed between itself and the remote modem. For many Hayes command-set--compatible modems, this command will make these settings and store them in nonvolatile memory: AT &C1 &D3 &K3 &Q6 S0=1 &W See the section on sending AT commands below for information on how to make these settings without resorting to an MS-DOS terminal program. Next, make an entry in /etc/ttys (see &man.ttys.5;) for the modem. This file lists all the ports on which the operating system will await logins. Add a line that looks something like this: ttyd1 "/usr/libexec/getty std.57600" dialup on insecure This line indicates that the second serial port (/dev/ttyd1) has a modem connected running at 57600 bps and no parity (std.57600, which comes from the file /etc/gettytab, see &man.gettytab.5;). The terminal type for this port is dialup. The port is on and is insecure---meaning root logins on the port are not allowed. For dialin ports like this one, use the ttydX entry. It is common practice to use dialup as the terminal type. Many users set up in their .profile or .login files a prompt for the actual terminal type if the starting type is dialup. The example shows the port as insecure. To become root on this port, you have to login as a regular user, then &man.su.1; to become root. If you use secure then root can login in directly. After making modifications to /etc/ttys, you need to send a hangup or HUP signal to the &man.init.8; process: &prompt.root; kill -HUP 1 This forces the &man.init.8; process to reread /etc/ttys. The init process will then start getty processes on all on ports. You can find out if logins are available for your port by typing &prompt.user; ps -ax | grep '[t]tyd1' You should see something like: 747 ?? I 0:00.04 /usr/libexec/getty std.57600 ttyd1 How can I connect a dumb terminal to my FreeBSD box? If you are using another computer as a terminal into your FreeBSD system, get a null modem cable to go between the two serial ports. If you are using an actual terminal, see its accompanying instructions. Then, modify /etc/ttys (see &man.ttys.5;), like above. For example, if you are hooking up a WYSE-50 terminal to the fifth serial port, use an entry like this: ttyd4 "/usr/libexec/getty std.38400" wyse50 on secure This example shows that the port on /dev/ttyd4 has a wyse50 terminal connected at 38400 bps with no parity (std.38400 from /etc/gettytab, see &man.gettytab.5;) and root logins are allowed (secure). Why can I not run tip or cu? On your system, the programs &man.tip.1; and &man.cu.1; are probably executable only by uucp and group dialer. You can use the group dialer to control who has access to your modem or remote systems. Just add yourself to group dialer. Alternatively, you can let everyone on your system run &man.tip.1; and &man.cu.1; by typing: &prompt.root; chmod 4511 /usr/bin/cu &prompt.root; chmod 4511 /usr/bin/tip My stock Hayes modem is not supported---what can I do? Actually, the man page for &man.tip.1; is out of date. There is a generic Hayes dialer already built in. Just use at=hayes in your /etc/remote (see &man.remote.5;) file. The Hayes driver is not smart enough to recognize some of the advanced features of newer modems---messages like BUSY, NO DIALTONE, or CONNECT 115200 will just confuse it. You should turn those messages off when you use &man.tip.1; (using ATX0&W). Also, the dial timeout for &man.tip.1; is 60 seconds. Your modem should use something less, or else tip will think there is a communication problem. Try ATS7=45&W. Actually, as shipped &man.tip.1; does not yet support it fully. The solution is to edit the file tipconf.h in the directory /usr/src/usr.bin/tip/tip. Obviously you need the source distribution to do this. Edit the line #define HAYES 0 to #define HAYES 1. Then make and make install. Everything works nicely after that. How am I expected to enter these AT commands? Make what is called a direct entry in your /etc/remote file (see &man.remote.5;). For example, if your modem is hooked up to the first serial port, /dev/cuaa0, then put in the following line: cuaa0:dv=/dev/cuaa0:br#19200:pa=none Use the highest bps rate your modem supports in the br capability. Then, type tip cuaa0 (see &man.tip.1;) and you will be connected to your modem. If there is no /dev/cuaa0 on your system, do this: &prompt.root; cd /dev &prompt.root; sh MAKEDEV cuaa0 Or use cu as root with the following command: &prompt.root; cu -lline -sspeed with line being the serial port (e.g. /dev/cuaa0) and speed being the speed (e.g.57600). When you are done entering the AT commands hit ~. to exit. Why does the <@> sign for the pn capability not work? The <@> sign in the phone number capability tells tip to look in /etc/phones for a phone number. But the <@> sign is also a special character in capability files like /etc/remote. Escape it with a backslash: pn=\@ How can I dial a phone number on the command line? Put what is called a generic entry in your /etc/remote file (see &man.remote.5;). For example: tip115200|Dial any phone number at 115200 bps:\ :dv=/dev/cuaa0:br#115200:at=hayes:pa=none:du: tip57600|Dial any phone number at 57600 bps:\ :dv=/dev/cuaa0:br#57600:at=hayes:pa=none:du: Then you can do something like tip -115200 5551234. If you prefer &man.cu.1; over &man.tip.1;, use a generic cu entry: cu115200|Use cu to dial any number at 115200bps:\ :dv=/dev/cuaa1:br#57600:at=hayes:pa=none:du: and type cu 5551234 -s 115200. Do I have to type in the bps rate every time I do that? Put in an entry for tip1200 or cu1200, but go ahead and use whatever bps rate is appropriate with the br capability. &man.tip.1; thinks a good default is 1200 bps which is why it looks for a tip1200 entry. You do not have to use 1200 bps, though. How can I more easily access a number of hosts through a terminal server? Rather than waiting until you are connected and typing CONNECT host each time, use tip's cm capability. For example, these entries in /etc/remote (see &man.remote.5;): pain|pain.deep13.com|Forrester's machine:\ :cm=CONNECT pain\n:tc=deep13: muffin|muffin.deep13.com|Frank's machine:\ :cm=CONNECT muffin\n:tc=deep13: deep13:Gizmonics Institute terminal server:\ :dv=/dev/cuaa2:br#38400:at=hayes:du:pa=none:pn=5551234: will let you type tip pain or tip muffin to connect to the hosts pain or muffin; and tip deep13 to get to the terminal server. Can tip try more than one line for each site? This is often a problem where a university has several modem lines and several thousand students trying to use them... Make an entry for your university in /etc/remote (see &man.remote.5;) and use <\@> for the pn capability: big-university:\ :pn=\@:tc=dialout dialout:\ :dv=/dev/cuaa3:br#9600:at=courier:du:pa=none: Then, list the phone numbers for the university in /etc/phones (see &man.phones.5;): big-university 5551111 big-university 5551112 big-university 5551113 big-university 5551114 &man.tip.1; will try each one in the listed order, then give up. If you want to keep retrying, run &man.tip.1; in a while loop. Why do I have to hit CTRL+P twice to send CTRL+P once? CTRL+P is the default force character, used to tell &man.tip.1; that the next character is literal data. You can set the force character to any other character with the ~s escape, which means set a variable. Type ~sforce=single-char followed by a newline. single-char is any single character. If you leave out single-char, then the force character is the nul character, which you can get by typing CTRL+2 or CTRL+SPACE. A pretty good value for single-char is SHIFT+CTRL+6, which I have seen only used on some terminal servers. You can have the force character be whatever you want by specifying the following in your $HOME/.tiprc file: force=single-char Why is everything I type suddenly in UPPER CASE? You must have pressed CTRL+A, &man.tip.1; raise character, specially designed for people with broken caps-lock keys. Use ~s as above and set the variable raisechar to something reasonable. In fact, you can set it to the same as the force character, if you never expect to use either of these features. Here is a sample .tiprc file perfect for Emacs users who need to type CTRL+2 and CTRL+A a lot: force=^^ raisechar=^^ The ^^ is SHIFT+CTRL+6. How can I do file transfers with tip? If you are talking to another Unix system, you can send and receive files with ~p (put) and ~t (take). These commands run &man.cat.1; and &man.echo.1; on the remote system to accept and send files. The syntax is: ~p <local-file> [<remote-file>] ~t <remote-file> [<local-file>] There is no error checking, so you probably should use another protocol, like zmodem. How can I run zmodem with tip? First, install one of the zmodem programs from the ports collection (such as one of the two from the comms category, lrzsz or rzsz. To receive files, start the sending program on the remote end. Then, press enter and type ~C rz (or ~C lrz if you installed lrzsz) to begin receiving them locally. To send files, start the receiving program on the remote end. Then, press enter and type ~C sz files (or ~C lsz files) to send them to the remote system. Why does FreeBSD not find my serial ports, even when the settings are correct? Motherboards and cards with Acer UARTs do not probe properly under the FreeBSD sio probe. Obtain a patch from www.lemis.com to fix your problem. ¨ä¥¦¦U¦¡¦U¼Ëªº°ÝÃD ¬°¬Æ»ò FreeBSD ¥Îªº¸m´«(swap)ªÅ¶¡¤ñ Linux ¦h¡H FreeBSD¶È¬O¬Ý°_¨Ó¸m´«ªÅ¶¡(swap)¥Îªº¤ñLinux¦h¦Ó¤w¡C¦b¨Æ¹ê¤W¡A ¨Ã¤£µM¡C¥D­nªº®t²§¬O¦b©ó¡AFreeBSD¿n·¥ªº±N¶¢¸mµL¥Îªº¥D°O¾ÐÅ餺®e ±À¤J¸m´«ªÅ¶¡(swap)¤¤¡A¥H¨Ï±o¥D°O¾ÐÅé¥i¥H§ó¬°¦³®Ä²vªº³Q¨Ï¥Î¡C¦Ó Linuxªºµ¦²¤¬O±N¸m´«ªÅ¶¡(swap)¥Î¨Ó§@¬°¸Ñ¨M°O¾ÐÅé°ÝÃDªº³Ì²×¤â¬q¡C ¸ûÀWÁcªº¨Ï¥Î¸m´«ªÅ¶¡(swap)¡C¬O¤@ºØ§ó¦³®Ä²vªº¨Ï¥Î¥D°O¾ÐÅ骺¤â¬q¡C µù¡G·í¤@¤è­±FreeBSD¿n·¥ªº¨Ï¥Î¸m´«ªÅ¶¡(swap)ªº¦P®É¡A§A¥²»Ýª` ·N¨ì¡AFreeBSD¨Ã¤£·|¥ô·Nªº±N©Ò¦³ªºªF¦è³£±À¤J¸m´«ªÅ¶¡(swap)¤¤¡C¦p¦¹¡A §A¤~¤£·|¦b¤@©]±J¾K°_§É«áµo²{¡A¾ã­Ó¨t²Î³£³Q­Ë¶i¤F¸m´«ªÅ¶¡(swap)¤§¤¤¡C §Y¨Ï§Ú¥u¦³¹B¦æ¤Ö¼Æµ{¦¡¡A¬°¤°»ò top Åã¥Ü¥X ¨Óªº³Ñ¾l°O¾ÐÅéÁÙ¬O«Ü¤Ö¡H ²³æªºµª®×¬O¡A©Ò¦³¥¼¨Ï¥Î¨ìªº¶¢¸m°O¾ÐÅé³£¬O³Q®ö¶Oªº°O¾ÐÅé¡A ¥ô¦ó¥¼³Q§Aªºµ{¦¡©Ò§Q¥Î¨ìªº°O¾ÐÅé±N³Q®Ö¤ß(kernel)¥Î¨Ó·í §@ºÏºÐ§Ö¨ú(disk cache)¡C¦Ó³oºØ°O¾ÐÅé³Q &man.top.1; ¼Ð°O¬° ¶¢¸mªº(Inact)¡A§Ö¨ú(Cache)¡A ¥H¤Î ½w½Ä°Ï(Buf)¡A¨Ã­t³d¦b¦U­Ó¤£¦Pªº¦ì¸m­t³d ¼È¦s¸ê®Æ¡C³Q¼È¦s(cached)ªº¸ê®Æ¥Nªí¨t²Î¤£»Ý­n¥h¦s¨ú¸ûºCªººÏºÐ¸Ë¸m ´N¥i¥H±o¨ì¸ê®Æ¡A¦p¦¹¡A¥i¥H´£¤É¨t²Îªº®Ä¯à¡CÁ`¦Ó¨¥¤§¡A&man.top.1; Åã¥Ü¥X¸û¤Öªº ¶¢¸m(Free) °O¾ÐÅé¬O¦nªº¡A¥u­nÅã¥Ü ¥X¨Óªº­È¤£¬O «D±` ªº§C¡C ¬°¬Æ»ò­n¥Î(¬Æ»ò¬O) a.out ©M ELF °õ¦æÀɮ榡¡H ­n¤F¸Ñ¬°¤°»òFreebsd¨Ï¥Î ELF ®æ¦¡¡A§A¦³¥² ­n¥ý»{ÃѤ@¤U¤TºØ¦b¥Ø«e Unix ¨t²Î¤¤³Ì³Q¼sªxÀ³¥Î¨ìªº°õ¦æÀɮ榡¡G ¦b FreeBSD 3.x ¤§«e¡AFreeBSD ¨Ï¥Î a.out ®æ¦¡¡C &man.a.out.5; ³o¬O³Ì¦­¡A¦P¬O¤]¬O ³Ì¨å«¬ ªºUnix¥ØªºÀÉ ®æ¦¡¡C³oºØ®æ¦¡ªºÀɮרϥΤ@ºØµu¥Bºò±KªºÀÉÀY¡A¦P®É¡A¦ñÀHµÛ¤@ ­ÓÅ]³N¼Æ¦r¥Î¨Ó¿ëÃѮ榡¡C(°Ñ¦Ò &man.a.out.5; ¦³§ó¦h¸Ô²Óªº»¡ ©ú)¡C¥¦¥]§t¦³¤T­Ó¸`°Ï¡G .text .data ¤Î .bss ¥[¤W¤@­Ó²Å¸¹ªí ¤Î¦r¦êªí¡C COFF SVR3¥ØªºÀɮ榡¡CÀÉÀY¥]§t¤F¤@­Ó¸`°Ïªí¡A©Ò¥H¥i¥H¨ã³Æ¤ñ .text .data .bss ÁÙ¦hªº¸`°Ï¡C ELF ELF¬° COFF ®æ¦¡ªº«áÄ~ªÌ¡A¥D­nªº¯S¼x¬° ¥i¥H¨ã¦³½Æ¼Æ¸`°Ï¬q¡A¨Ã¥i¥H¨Ï¥Î32-bits©Î¬O64-bitsªº¼Æ­È¡C ¥D­nªº¯ÊÂI¬°¡G ELF ®æ¦¡¬O¦b¨C­Ó¨t²Î¤¤¥u ·|¦³¤@ºØ ABI ªº°²³]¬°«eÃD³Q³]­p¥X¨Óªº¡C¦ý¬O¡A¦b¨Æ¹ê¤W¡A³o­Ó °²³]¿ùªºÂ÷ÃСC¦]¬°¡AÁa¨Ï¦b°Ó¥Îªº SYSV ¥@¬É¸Ì¡A¤]¦Ü¤Ö¦³ SVR4¡A Solaris ©M SCO ¤TºØ ABI¡C Ķµù¡GABI(Application Binary Interface)¡C¦pªG¤@©w­n½Ķ¡A ´N¥s¥¦ À³¥Îµ{¦¡¤G¶i¦ì¤¶­± ¦n¤F¡C ABI³Qµo ®i¥X¨Óªº¥Î·N¡A¬O¬°¤F«P¨Ï¦b¬Û¦PCPU©Òµo®i¥X¨ÓªºÀ³¥Îµ{¦¡¡A¯à°÷ ¦b¤£¦Pªº¨t²Î¤W¡A§@¨ì¤G¤¸ÀÉ(Binary Code)¬Û®e¡C¤ñ¤è»¡¡A Sun ©Ò´£¥Xªº Solaris ABI ¡A«OÃÒ°õ¦æÀɯà°÷¦b¬Û¦P CPU ªº Solaris ¨t²Î¤W°õ¦æ¡A¥t¤@­Ó¨Ò¤l¬O Windows ¨t²Î¡C¦PÄÝ©ó Intel x86 ª©¥»ªº°õ¦æÀɯà°÷¦Û¥Ñªº¦bWindows 9x/me¤ÎWindows NT/2k/XP¤§¶¡°õ¦æ¡C FreeBSD´£¨Ñ¤@­Ó¤½¥Îµ{¦¡±Nµ{¦¡©Ò»ÝªºABI¸ê°T¯O¤W¡AÂǦ¹¸ÕµÛ ¥h¸Ñ¨M³o­Ó°ÝÃD¡C½Ð°Ñ¦Ò &man.brandelf.1; ¥H¨ú±o§ó¦h¸ê°T¡Ci FreeBSD ¨Ó¦Û ¶Ç²Î ªº°}Àç¡C¦b¶Ç²Î¤W¡AFreeBSD³£ ¨Ï¥Î &man.a.out.5; ®æ¦¡¡A³o¼Ëªº§Þ³N¦b¦n´X¥Nªº BSD ³£³QÃÒ©ú¬O¥i¾aªº¡C ÁöµM¡A¦bFreeBSD¤W¥i¥H«Ø¥ß¥H¤Î¥¿½Tªº°õ¦æ­ì¥Í ELF ®æ¦¡ÀÉ®×(¥]§t®Ö¤ß)¡CµM¦Ó, FreeBSD¦b¤@¶}©l¤Ï¹ï±N¹w³]®æ¦¡Âà´«¬° ELF¡A ¬°¤°»ò©O¡H·íLinux¶}©lµh­WªºÂà´«¦Ü ELF ®æ¦¡®É¡A ¨Ã«D¬O¬°¤F­n°kÂ÷ a.out ®æ¦¡¡C¬Û¤Ïªº¡A³o¬O¦] ¬°¤§«e Linuxªº¦@¨É¨ç¦¡®w(shared libraries)±Ä¥Î¥H¸õÅDªí®æ (jump-table)¬°°ò¦ªº§Þ³N¥h³]­p¡C³o¬O¤@ºØÅýµo®iªÌ·P¨ì§xÂZ¡A¥B«D±` Ãø¥H¨Ï¥Î¡A¤£¨ã¨¬°÷¼u©Êªº¤èªk¡C¬JµM¡A¤w¸g¦s¦bªº ELF ¤u¨ã´£¨Ñ¤F¦@¨É¨ç¦¡®w(shared libraries)ªº¸Ñ ¨M¤è®×¡A¦Ó¥B¡A¨º¬Ý°_¨Ó¬O­Ó «e½Ãªº¤èªk¡A¦]¦¹¡A©Ò»Ý ªºÂà´«¥N»ù´N¥i±µ¨ü¦]¦ÓÂà´«¡C ¦bFreeBSDªºª¬ªp¤¤¡A§Ú­Ìªº¦@¨É¨ç¦¡®w(shared libraries)¾÷¨î©M SunOS ªº«¬¦¡«D±`¬Ûªñ¡A¥B©ö©ó¨Ï¥Î¡CµM¦Ó¡A ±q 3.0 ¶}©l¡AFreeBSD ¥¿¦¡±N ELF §ï¬°¹w³]®æ¦¡¡C ÁöµM¡Aa.out ®æ¦¡¨Ì¦p¥H©¹¯ëªº¦n¡A¦ý¬O¡A§Ú­Ì ½sĶ¤u¨ãªº¼¶¼gªÌ¡AGNU ªº¦¨­û¡A¥L­Ì¤¤¤î¤F¹ï a.out ®æ¦¡ªº¤ä´©»PºûÅ@¡C¦b³oºØª¬ªp¤U¡A­¢¨Ï §Ú­Ì¥²¶·¦Û¦æºûÅ@¥t¤@¥÷ª©¥»ªº compiler ©M linker¡A¤]¨Ï±o§Ú­ÌµLªk ±q³Ì·sªº GNU µo®i¦¨ªG¤¤Àò±o¦n³B¡C¦¹¥~¡A¹ï ISO-C++ ªº»Ý¨D¡A¤×¨ä¬O «Øºc¤l(constructors)©M¸Ñºc¤l(destructors)¡A¤]±a°Ê¥¼¨Óª©¥»¤¤¹ï ELF ªº­ì¥Í¤ä´©¡C ¬Oªº, ¦ý¬O, ¬°¤°»ò·|¦³³o»ò¦h¤£¦P®æ¦¡ªº°õ¦æÀɦs¦b©O? ¦b¶Â·t¦Ó»»»·ªº¹L¥h¡A¶È¦³Â²­®ªºµwÅé¦s¦b¡C¦Ó¦]¬°µwÅé²­®¡A·íµM¤] ¥u¯à°õ¦æ¤p¦Ó²³æªº¨t²Î¡Ca.out ®æ¦¡¬O°ò©ó¨º­Ó®É¥N©Ò»Ý­n¡A¦Ó³Q³Ð³y ¥X¨Óªº(¨Ò¦p¹³PDP-11)¡C¦b³o¤§«á¡A³\¦h¤H¸ÕµÛ±N Unix ²¾´Ó¨ì¨ä¥L¥­¥x ®É¡A¥L­Ì¤]«O¯d¤F a.out ®æ¦¡ªº°õ¦æÀÉ¡C¦]¬°¡A³o¹ï¦­´Áªº Motorola 68k¡A VAXen ¤§Ãþªº¨t²Î¤w¸g¨¬°÷¨Ï¥Î¤F¡C µM¦Ó¡A¤H¨Ã¤£·|º¡¨¬©ó²{ª¬¡C¤@¨ÇÁo©úªºµwÅé¤uµ{®v·Q¨ì¤F¡A¦pªG¯à Åý³nÅé¦h³B²z¤@¨Ç¨Æ¡A¨º CPU ªº¹q´¹Åé¼Æ´N¯à¤Ö¤@ÂI¡A¨Ã¥B¶]±o§ó§Ö¡C­n ¦b³oºØ·s¦¡ªºµwÅé¤W¤u§@(²{¦bºÙ¬°RISC)¡Aa.out ³oºØ®æ¦¡´N¤£¦X¾A¤F¡C°ò©ó³o¼Ëªº²{¹ê©Ò»Ý¡A§ó¦hªº°õ¦æÀɮ榡³Qµo®i¥X ¨Ó¡A¥H´£¨Ñ¤ñ²³æ¥B¨ü¨ì³\¦h­­¨îªº a.out ®æ¦¡ §ó¦nªº®Ä¯à¡C¤ñ¤è¹³¬O COFF¡A ECOFF¡A¤w¤Î¤@¨Ç¸û¤£¬°¤H©Ò©Pª¾ªº®æ¦¡¯É¯É³Q³Ð³y ¥X¨Ó¡C¦ý¬O¡A³o¨Ç®æ¦¡³£¤w¹F¨ì¦U¦Ûªº·¥­­¡Aª½¨ì¦³¤@¤Ñ ELF ªº¥X²{¡C ¦¹¥~¡A·íµ{¦¡ªºÅé¿n¶V¨Ó¶V¤j¡A¦ÓºÏºÐªÅ¶¡©M¥D°O¾ÐÅé¬Û¹ï¨Ó»¡³£¸û ¤p®É¡A¦@¨É¨ç¦¡®w(shared libraries)ªºÆ[©À³Qµo®i¥X¨Ó¤F¡C¦b³o¦P®É¡A µêÀÀ°O¾ÐÅé¨t²Î(VM System)¤]Åܱo¶V¨Ó¶Vºë¥©¡C·í¨C¤@ºØ¶i¨B³£¦b a.out®æ¦¡¤W³Qµo®i¥X¨Ó®É¡A¥¦ªº¥i¥Î©Ê¤]¦P®ÉÅÜ ±o¶V¨Ó¶V§C¡C¥t¥~¡A¤H­ÌÁ٧Ʊæµ{¦¡¯à¦b°õ¦æ´Á¶¡°ÊºA¸ü¤J¡A©Î¬O±N¤w¸g °õ¦æ¹L¥B¨S¦³¥Îªºªì©l¤Æµ{¦¡½X¥á±ó¡AÂÇ¥H¸`¬Ù§ó¦hªº°O¾Ð¡Cµ{¦¡»y¨¥¦b ³o­Ó®É´Á¤]«K±o§óºë¥©¡A¤H­Ì¤]§Æ±æ¦b main ¤§«e¦Û°Êªº°õ¦æ§ó¦hªºªF¦è¡C ¦]¦¹¡A³\¦hÁcÂø¥B¥t¤H¹Ä¬°Æ[¤îªº§Þ¥©³Q¥Î¦b a.out ®æ¦¡¤W¥h¸Ñ¨M³o¨Ç°ÝÃD¡C¦ý¬O¡A¥Ñ©ó a.out ®æ¦¡ ¥ý¤Ñªº­­¨î¡A­n¸Ñ¨M³o¨Ç°ÝÃD¥²»Ý¥I¥X§ó¦hªº¥N»ù¤Î®É¶¡¦¨¥»¡A¨ÃÅýµ{¦¡ ªº½ÆÂø«×¤j¬°´£¤É¡C¦Ó ELF ®æ¦¡¥i¥H¤@Á|¸Ñ¨M³o¤@ ¤Á°ÝÃD¡C¦ý¬O¡A­n±N¾ã­Ó¨t²Î±q®Ú¥»Âà´«¹L¥h¡A±N·|¦³¤£µuªº°}µh´Á¡A¦] ¦¹¡A ELF®æ¦¡±N·|¦³¤@°}¤l»P a.out ¨Ã¦s¡C µM¦Ó¡AÀHµÛ®É¶¡ªº¹L¥h¡AFreeBSDªº build tools ºt¤Æ¦¨¥­¦æªº¨â­Ó ¤ä½u(¤×¨ä¬O²ÕĶ¾¹©M¸ü¤J¾¹)¡CFreeBSD³o±ø¸ô¥[¶i¤F¦@¨É¨ç¦¡®w (shared libraries)¨Ã­×¥¿¤F¤@¨Ç¿ù»~¡C¦Ó­ì¨Óµo®i³o¨Çµ{¦¡ªº GNU ¦¨­û «h¬°¤F¦]À³²{ªp¡A­«¼g¤F³o¨Çµ{¦¡¡A¥H§ó²³æªº¤è¦¡¹ï¸ó¥­¥x½sĶ (building cross compilers)¡A¥H¤Î¦hºØ®æ¦¡ (plugging in different formats) §@¥X¤F¤ä´©¡C³\¦h¤H·Q§@¥X¥H FreeBSD ¬°¥Øªº¥­¥xªº¸ó¥­¥x½sĶ¾¹¡C¦ý¤£©¯ªº¬O¡AFreeBSD ªº as ©M ld ¤£¯à§@ ³o¶µ¤u§@¡C·sªº GNU ¤u¨ãµ{¦¡¥[¤J¤F¸ó¥­¥x½sĶ (Cross Compiler)¡A ELF®æ¦¡¤ä´©¡A¦@¨É¨ç¦¡®w(shared libraries)¡A C++ ªºÂX¥R... µ¥µ¥¡C¦¹¥~¡A³\¦h¼t°Ó¥H ELF ®æ¦¡ µo¦æ¨ä²£«~¡A¦pªG³o¨ÇªF¦è¯à¦b FreeBSD ¤W°õ¦æªº¸Ü·íµM¬O³Ì¦nªº¡C¬JµM¡A ¯à°÷°õ¦æ ELF ®æ¦¡ªº°õ¦æÀɤF¡A¬°¤°»òÁÙ¶·­n a.out ©O¡H¥¦¤w¸g¬O¤@¤Ç««««¦Ñ¨oªº°¨¤F¡A¦bºÜ¤O ºÉ©¾ªº©^Äm³o»ò¦h¦~¤§«á¡A¸Ó¬OÅý¥¦¦bªª³õªÎ¨Uªº¯ó¦a¤W¦n¦n¥ð®§ªº®É­Ô ¤F¡C ELF ®æ¦¡¤ñ a.out ¨ã¦³§ó¨}¦nªº®i²{¯à¤O¡A¨Ã ¥B¦b©³¼h¨t²Î¤¤¨ã¦³§ó¦hªº¥iÂX®i©Ê¡CELF ¤u¨ãµ{¦¡ §ó®e©ö³QºûÅ@¡A¥B´£¨Ñ¸ó¥­¥x½sĶªº¤ä´©¡A³o¤@ÂI¹ï«Ü¦h¤H¨Ó»¡¬O«Ü­«­n ªº¡CELF ®æ¦¡¥i¯à¤ñ a.out ºC¤@ÂI¡A¦ý¬O¨ä®t²§«D ±`Ãø´ú¶q¥X¨Ó¡C³o¨âªÌ¶¡ÁÙ¦³³\¦h²Ó¸`¤Wªº¤£¦P¡A¤ñ¤è»¡¤À­¶¹ïÀ³ªº¤è¦¡¡A µ{¦¡½Xªì©l¤Æªº¤èªk...µ¥µ¥¡C³o¨Ç¨Ã¤£¬O«Ü­«­n¡A¦ý¬O¡A¨âªÌ´N¬O¤£¦P¡C ¥H«á¡AGENERIC ®Ö¤ß(kernel)±N·|²¾°£¹ï a.out ®æ¦¡¡C·í¤£¦b¦³°õ¦æ¶Ç²Î a.out µ{¦¡ªº¶·­n®É¡A ±N·|±q®Ö¤ß(kernel)¤¤²¾°£¡C ¬°¬Æ»òchmod¤£·|§ïÅܲŸ¹³sµ²(symlink)ªº¦s¨úÅv­­¡H Symlinks ¥»¨­¨Ã¨S¦³¦s¨úÅv­­¡A¦P®É¡A¦b¹w³]ªºª¬ªp¤U¡A &man.chmod.1; ±N¤£·|¸òÀHµÛ symlinks ¥h§ï«K¥Ø¼ÐÀɮתº¦s¨úÅv­­¡C¦]¦¹¡A ¦pªG§A¦³¤@­ÓÀÉ®× foo¡A¦P®É¡A¦³¤@­Ó symlink bar «ü¦V³o­ÓÀɮסA¥H¤U³o­Ó©R¥O±N¥Ã»··|¦¨¥\ ªº³Q°õ¦æ¡C &prompt.user; chmod g-w bar µM¦Ó¡A¦b foo ¤Wªº¦s¨úÅv­­±N¤£·|³Q§ï ÅÜ¡C §A¥²»Ý¨Ï¥Î ©Î¬O±N »P ¿ï¶µ¤@°_¨Ï¥Î¡A°Ñ¦Ò &man.chmod.1; ¥H¤Î &man.symlink.7; ¥H¨ú±o§ó¦hªº¸ê°T¡C ¨Ï¥Î¿ï¶µ ·|Åý &man.chmod.1; ¥H »¼°j(RECURSIVE) ªº¤è¦¡¤u§@¡C·í§A§â &man.chmod.1; ¥Î¦b¥Ø¿ý©Î¬O³sµ²¨ì¥Ø¿ýªº²Å¸¹³sµ²®É§ó­n¤p¤ß¡C ¦pªG§A­n§ïÅܤ@­Ó²Å¸¹³sµ²°Ñ¦Ò¨ìªº¥Ø¿ý¤§¦s¨úÅv­­ &man.chmod.1; ¡A ¥Bª`·N¤£­n¥[¤W¥ô¦ó¿ï¶µ¡A¨Ã¥B¦b symlink ªºµ²§À¥[¤W±×½u (/)¡CÁ|¨Ò¨Ó»¡¡A¦pªG foo ³sµ²¨ì¥Ø¿ý bar¡A ¦Ó§A­n§ó§ï foo (¹ê»Ú¤W¬O bar)¡A¨º´N¨Ï¥Î¡G &prompt.user; chmod 555 foo/ µ²§Àªº±×½u·|¨Ï±o &man.chmod.1; §ïÅÜ foo ©Ò«ü¦Vªº¥Ø¿ý bar ªºÅv­­¡C ¬°¤°»ò¦b FreeBSD 2.2.x ¤Î§ó¦­ªºª©¥»¤¤¡Aµn¤J¦WºÙ(login names) ³Q­­¨î¦b¤K­Ó¦r¤¸¥H¤U©O¡H §A¥i¯à»{¬°­×§ï UT_NAMESIZE «á¦b­«·s½sĶ¾ã­Ó ¨t²Î¬O«Ü®e©öªº¨Æ¡C¦Ó¥B¦b³o¤§«á¡A¨C¥ó¨Æ³£¥i¥H¹B§@ªº«Ü¦n¡C¤£©¯ªº¬O¡A ¦³³\¦hªºµ{¦¡©M¤u¨ã(¥]§t¨t²Î¤u¨ã)§â¼Æ¦r¼g¦º¦bµ{¦¡¸ÌÀY(¨Ã«DÁ`¬O 8 ©Î 9¡A¦³®É¥i¯à¬O¥j©Çªº 15 ©Î 20)¡C³o¤£¶È¶È¬O·|±N §Aªº¨t²Î°O¿ýÀɧËÃa¦Ó¤w(¨Ó¦Û©óÅܰʪø«×©M©T©wªø«×°O¿ýªº®t²§)¡A¦P®É ¤]·|¯}Ãa Sun ªº NIS Client ªº¹B§@¡C¦P®É¡A©M¨ä¥LªºUnix¨t²Î¤§¶¡¤] ¦³¥i¯à·|²£¥Í¥¼ª¾ªº°ÝÃD¡C ¦bFreeBSD 3.0 ¤Î¤§«áªºª©¥»¡A±b¸¹ªº³Ì¤jªø«×¼W¥[¨ì16­Ó¦r¤¸¡A ¦P®É¡A¨º¨Ç±Nªø«×¼g¦ºªºµ{¦¡¤]³Q§ä¥X¨Ó¨Ã§@¤F¾A·íªº­×¥¿¡C¥¿¦]¬°¼vÅT ¨t²Îªº½d³ò«Ü¼s¡A©Ò¥Hª½¨ì3.0ª©¤§«á¤~ºâ¤j­P­×¥¿§¹¦¨¡C ¦pªG§A¦³¦Û«H¦b¥X°ÝÃDªº®É«á¯à¦Û¦æ¸Ñ¨M¡A§A¥i¥H§Q¥Î¤U­±ªº¤èªkÅý ¸û¦­´Áªºª©¥»¤ä´©¸ûªøªº±b¸¹¡C­º¥ý¡A­×§ï /usr/include/utmp.h ¤¤ªºUT_NAMESIZE¡C µM«á¡A§A¥²¶·§â /usr/include/sys/param.h ¤¤ªº MAXLOGNAME §ï¦¨¸ò UT_NAMESIZE ¬Û¦P¡C³Ì«á¡A¦pªG§A¬O±q­ì©lµ{ ¦¡«Ø¥ß¨t²Î, §O§Ñ¤F /usr/include ¨C¦¸³£·|³Q§ó·s¡C ­×§ï /usr/src/.. ¤¤¾A·íªºÀɮסC §Ú¯à¦bFreeBSD¤U°õ¦æDOSµ{¦¡¶Ü¡H ¬Oªº¡A¦Û3.0ª©°_§A¥i¥H¨Ï¥ÎBSDIªº doscmd DOS ¼ÒÀÀ¾¹¡A¦pªG§A¹ï³o­ÓªF¦è ¦³¿³½ì¡A©Î¬O·Q¥[¤Jµo®i¦æ¦C¡A½Ð±H¤@«Ê¹q¤l¶l¥ó¨ì &a.emulation; ¡C ¹ï©ó3.0¤§«eªº¨t²Î¡A¦b ports ¤¤¦³¤@®M³nÅé¥i¥H¼Òèö 8088¡A¨Ã´£ ¨Ñ¨¬°÷ªºBIOS¤¤Â_ªA°È¥H°õ¦æDOS¤å¦r¼Ò¦¡ªºµ{¦¡¡A³o®M³nÅé¥s°µ pcemu¡A¦P®É¡A¹B¦æ¥¦¶·­n X Windows(¥ÑXFree86´£¨Ñ)¡C ¦pªG­n§âFreeBSD¤å¥ó½Ķ¦¨§Úªº¥À»y¡A§Ú»Ý­n§@¤°»ò¡H °Ñ¾\FreeBSD¤å¥ó¤¤ªº ½Ķ±`¨£°Ýµª¡C ¬°¤°»ò§Ú±H¨ì FreeBSD.org ¬ÛÃö¦a§}ªº¹q¤l¶l¥ó³£³Q°h¦^¤F©O¡H FreeBSD.org ªº¶l¥ó¨t²Î¹ï©ó¶i¨Óªº¶l¥ó±Ä¨úÄY®æªºÀˬd¡A¨Ã¥B°h¦^ ©Ò¦³³]©w¤£¥¿½T¡A©Î¬O¼ç¦bªº©U§£¶l¥ó¡C§Aªº¶l¥ó³Q°h¦^¥i¯à¬O¦]¬°¤U¦C ­ì¦]©Ò¤Þ°_¡G ³o«Ê¹q¤l¶l¥ó¨Ó¦Û¤wª¾ªº©U§£¶l¥ó°Ï°ì©Î¬OIP¤¤¡C FreeBSD¶l¥ó¦øªA¾¹±N©Úµ´±µ¦¬¤wª¾ªº©U§£¶l¥ó¨Ó·½ªº¹q¤l¶l¥ó¡C ¦pªG´£¨Ñ§Aºô¸ôªA°Èªº¤½¥q©Î¬Oºô°ì¤¤¦³²£¥Í¹L©U§£¶l¥ó©Î¬O¦³©U§£ ¶l¥óÂ༽¯¸¡A½Ð§A´«¤@­ÓªA°È´£¨ÑªÌ¡A©Î¬O°®¯Ü©ñ±ó¡C ¹q¤l¶l¥óªº¥»¤å¶È¦³HTML¡C ¶l¥óÀ³¸Ó¤w¯Â¤å¦r®æ¦¡µo°e¡A½Ð³]©w§Aªº¹q¤l¶l¥ó³nÅé°e¥X¯Â¤å ¦r®æ¦¡¡C FreeBSDªº¶l¥ó³B²zµ{¦¡µLªk¥ÑIP¤Ï¬d°e¥ó¥D¾÷ªºIP¡C ³]¸m DNS ¤Ï¬d¬O±µ¨ü¤@¥x¥D¾÷¶l¥óªº¤@­Ó¼Ð·Ç­n¨D¡A½Ð¬°±zªº¶l¥ó ¥D¾÷³]¸m DNS ¤Ï¬d¡C³\¦h´£¨Ñ®a®xºô¸ôªA°È (DSL¡Acable¡Adialup µ¥) ªº¤½¥q¨Ã¤£´£¨Ñ³o¼ËªºªA°È¡C¦b³oºØ±¡ªp¤U¡A½Ð³z¹Lºô¸ôªA°È´£¨ÑªÌªº ¶l¥ó¦øªA¾¹°e¥X±zªº¹q¤l¶l¥ó¡C ¦b SMTP ¨Ï¥Î EHLO/HELO ©R¥O®É©Òµ¹¤©ªº hostname µLªk³Q¸ÑªR¨ì ¤@­Ó IP ¦ì¸m¡C ¦b¶l¥ó³Q±µ¨ü¥H«e¡A¤@­Ó¥R¤À¦X®æ¡A¥B¥i³Q¸ÑªRªº¥D¾÷¦WºÙ¦b SMTP ¨ó©wªº¹ï½Í¤¤¬O¥²­nªº¡C¦pªG§A¨S¦³¦b DNS ¦øªA¾¹¤¤µn°O§A ªº¥D¾÷¦WºÙ¡A½Ð³z¹Lºô¸ôªA°È´£¨ÑªÌªº¶l¥ó¦øªA¾¹°e¥X±zªº¹q¤l¶l ¥ó¡C §Aªº°T®§¤¤§¨±aµÛ¤@­Ó message ID ¥H localhost ¦r¦êµ²§ô¡C ¬Y¨Ç¶l¥ó³nÅé²£¥Í¬Y¨Ç¤£¥¿½Tªº message ID¡A³o±N¤£³Q±µ¨ü¡C §A¥²»Ý§ó§ï³]©wÅý§Aªº¶l¥ó³nÅé²£¥Í¥¿½Tªº message ID¡A¦pªG³oµL ªk¸Ñ¨M¡A¦Ò¼{»¡ªA§Aªº¶l¥ó³nÅé§@ªÌ§ó·sµ{¦¡¥H³B²z³o­Ó°ÝÃD¡C §Ú¥i¥H¦b­þ¸Ì§ä¨ì¤@­Ó§K¶OªºFreeBSD±b¸¹¡H FreeBSDªº¦øªA¾¹¥»¨­¤£´£¨Ñ¥ô¦ó¹ï¥~ªºªA°È¡A¨ä¥Lªº³æ¦ì¤¤¡A ¦³¤H´£¨Ñ¶}©ñªº Unix ¨t²ÎªA°È¡C¨ä¤¤¦³¨Ç¥i¯à­n¦¬¨ú¨Ç³\¶O¥Î¡C Arbornet, Inc¡A ¤]³QºÙ¬° M-Net¡A¦Û 1983 ¦~°_´N¶}©l´£¨Ñ Unix ¨t²ÎªA°È¡C¤@¶}©l¡A ¥L­Ì¨Ï¥Î Altos ¨Ã°õ¦æ System III¡C¥L­Ì¦b 1991 ¦~Âà´«¨t²Î¦¨¬° BSD/OS¡C¦b 2000 ¦~¤»¤ë¡A¥L­Ì¦A«×§ó´«¦¨¬° FreeBSD¡CM-Net ¯àÅý¨Ï ¥ÎªÌ³z¹L SSH ¤Î telnet ³s½u¨ì¥D¾÷¡A¨Ã´£¨Ñ§¹¾ãªº FreeBSD ³nÅé¥H ¨Ñ¨Ï¥Î¡CµM¦Ó¡AM-Net §@¬°¤@­Ó«D¬Õ§Q²Õ´¹B¦æ¡A¦s¨úÅv¥u­­©ó¦¨­û©M ÃÙ§UªÌ¡AM-Net ¤]´£¨Ñ BBS ¨t²Î©Mºô¸ô²á¤ÑªA°È¡C Grex ´£¨Ñ¤F«D±` Ãþ¦ü M-Net ªºªA°È¡A¥]¬A¤F BBS ¨t²Î©Mºô¸ô²á¤Ñ¡CµM¦Ó¡A¾÷¾¹¬O¨Ï¥Î Sun 4M¡A¨Ã°õ¦æ SunOS¡C ¤°»ò¬O sup¡A§Ú¸Ó¦p¦ó¨Ï¥Î¥¦¡H SUP ªº·N«ä¬O Software Update Protocol¡A¥Ñ CMU µo®i¡A ¥Î¨Óºû«ù¾ã­Óµo®iªº¦P¨B¡C§Ú­Ì§Q¥Î¥¦«O«ù»·ºÝªº¯¸¥x©M­ì©l¯¸¥x¤§¶¡ ªº¦P¨B¤u§@¡C µM¦Ó¡ASUP ¦bÀW¼eªº¨Ï¥Î¤W¨Ã¤£¤Ó¤Íµ½¡A¦P®É¡A¥Ø«e¤]¤£¦A¨Ï¥Î¤F¡C ¥Ø«e«Øijºû«ù­ì©l½X¦P¨B§ó·sªº¤èªk¬O CVSup¡C - ³o­Ó¥i·Rªº¤p¬õ¤Hªº¦W¦r¬O¤°»ò¡H + ³o­Ó¥i·Rªº¤p¬õ¤H¥s§@¤°»ò¡H ¦ü¥G¡A¥L¨Ã¨S¦³¤@­Ó¥¿¦¡ªº¦W¦r¡A©h¥B´NºÙ¨ä¬° BSD ¤p´cÅ] §a¡C¦pªG§A°õ·N­n¨Ï¥Î¤@­Ó¦W¦r¡C¨º´N¥s¥L ¤p°Êª«(beastie) §a¡Cµù¡Gbeastie ¦bŪ­µ¤W¸ò BSD «Ü±µªñ¡C §A¥i¥H¦bBSD¤p´cÅ]ªº ¥D­¶ ¤W¨ú±o§ó¦hªº¸ê°T¡C - §Ú¯à¨Ï¥ÎBSDªº¤p´cÅ]¹Ï®×¶Ü¡H + §Ú¯à¨Ï¥Î BSD ¤p´cÅ]¹Ï®×¶Ü¡H - ¤]³\§a¡A§Ú¤]¤£½T©w¡CBSD¤p´cÅ]¹Ï®×ªºª©Åv¬OÄÝ©ó°¨·²º¸Ä¬®æÄõ±Ð·| - (Marshall Kirk McKusick)©Ò¾Ö¦³¡C§A¥i¥H¸ÕµÛ¥h¬d¬Ýºô­¶±Ô­zÃö©óBSD¤p´cÅ]¨v¹³ - ¥H¨ú±o§ó¸Ô²ÓÃö©ó¨Ï¥Î¥Lªº¸ê°T¡C + ¤]³\§a¡A§Ú¤]¤£½T©w¡CBSD¤p´cÅ]¹Ï®×ªºª©Åv¬OÄÝ©ó°¨·²º¸Ä¬®æÄõ±Ð·|ªº + Marshall Kirk McKusick ©Ò¾Ö¦³¡C§A¥i¥H¸ÕµÛ¥h¬d¬Ýºô­¶Ãö©óBSD¤p´cÅ]¨v¹³ + ¥H¨ú±o§ó¸Ô²Óªº¨Ï¥Î²Ó¸`¡C - Á`Âkªº¨Ó»¡¡A¦pªG§A¯Âºé¬°¤F¦Û¤v·Q­nŲ½à¡A¨º»ò¡A§A¥i¥H¦Û¥Ñªº¨Ï - ¥Î¨v¹³¡C¦pªG§A¬O­Ó¤H¨Ï¥Î¡A¥u­n±¡ªp¾A·í¡AÀ³¸Ó³£·|³Q³\¥i¡C¦pªG§A·Q - ¦b°Ó·~¤W¨Ï¥Î¡A«h§A¥²»ÝÁpôĬ®æÄõ±Ð·|(Kirk McKusick)¥H¨ú±o³\¥i¡C + Á`¦Ó¨¥¤§¡A¦pªG§A¯Âºé¬°¤F¦Û¤v·Q­nŲ½à¡A¨º»ò¡A§A¥i¥H¦Û¥Ñªº¨Ï¥Î¨v¹³¡C¦pªG§A¬O­Ó¤H¨Ï¥Î¡A¥u­n±¡ªp¾A·í¡AÀ³¸Ó³£·|³Q³\¥i¡C + ¦pªG§A·Q¦b°Ó·~¤W¨Ï¥Î¡A«h§A¥²»ÝÁpôĬ®æÄõ±Ð·|ªº Kirk McKusick ¥H¨ú±o³\¥i¡C ¦pªG§A»Ý­n§ó¶i¤@¨B¸Ô²Óªº¸ê°T¡A½Ð°Ñ¦Ò BSD¤p´cÅ]ªº­º­¶¡C §A¦³¥ô¦óªº BSD ¤p´cÅ]¹Ï®×¥i¥HÅý§Ú¨Ï¥Î¶Ü¡H - §A¥i¥H¦b /usr/share/examples/BSD_daemon/ - µo²{ eps ¤Î Xfig ¨âºØ®æ¦¡ªº¹ÏÀÉ¡C + §A¥i¥H¦b /usr/share/examples/BSD_daemon/ §ä¨ì Xfig ¤Î eps ¨âºØ®æ¦¡ªº¹ÏÀÉ¡C §Ú¦b¤å¥ó¡B¶l»¼½×¾Â¤W¡A±`·|¬Ý¨ì¤@¨ÇÁY¼g¦r¡B§Þ³N¦r·J¡A³o¨Ç¥i¥H¥h­þÃä¬d©O¡H ½Ð°Ñ¾\ &os; ¦r·Jªí¡C - ¬°¤°»ò§Ú¸Ó¦b·N¸}½ñ¨®´×ªºÃC¦â¡H + ¬°¤°»ò§Ú¸Ó¦b·N¸}½ñ¨®¨®´×ªºÃC¦â¡H - ¤@­Ó³Ìµu³Ìµuªºµª®×¬O¡A§A¤£¸Ó¦b·N¡Cµy·Lªø¤@ÂIªºµª®×¬O¡AÁöµM - §A¦³¯à¤O¦Û¤v¥h«Ø³y¤@®y¸}½ñ¨®´×¡A¦ý¬O¡A³o¤£¥Nªí¦]¬°§A¤£³ßÅw²{¦b³o - ­Ó¸}½ñ¨®´×ªºÃC¦â¡A´N¤¤¤î¥Lªº«Ø¿v¡C³o­Ó¤ñ³ëªº·N«ä¬O¡A§A¤£»Ý­n¥hª§½× - ¨C¤@­Ó²Ó¶µ¯S¼x¡A¥u¦]¬°§A¦³¿ìªk¥h§@¥¦¡C¬Y¨Ç¤Hªºµû½×¬O¡AÂø­µªº²£¥Í«× - ¹ïÅܤƪº½ÆÂø©Ê¬Û¤Ï¦a¤ñ¨Ò¡C + ³Ìµu³Ìµuªºµª®×¬O¡G¡y¤£¥Î¦b·N¡z¡Cµy·Lªø¤@ÂIªºµª®×¬O¡G¡yÁöµM§A¦³¯à¤O¦Û¤v¥h«Ø³y¤@®y¸}½ñ¨®¨®´×¡A¦ý¬O¡A + ³o¤£¥Nªí¦]¬°§A¤£³ßÅw²{¦b³o­Ó¨®´×ªºÃC¦â¡A´N­n¤¤¤î¥Lªº«Ø¿v¡C¡z³o­Ó¤ñ³ëªº·N«ä¬O¡A + §A¤£»Ý­n¥hª§½×¨C¤@­Ó²Ó¶µ¯S¼x¡A¥u¦]¬°§A¦³¿ìªk¥h§@¥¦¡C + ¬Y¨Ç¤Hªºµû½×¬O¡G¡yÂø­µªºµ{«×¡A»PÅܤƪº½ÆÂø©Ê¬O¦¨¤Ï¤ñ¡z¡C §óªø¥B¸û§¹¾ãªºµª®×¬O¡A¦b¸g¹Lªø®É¶¡ª§½×Ãö©ó¬O§_¸Ó±N &man.sleep.1; ªº¬í°Ñ¼Æ²¾°£¡A&a.phk;µoªí¤F¤@½gªø½× ¤@®y¦Û¦æ¨®½´ (¥ô¦óÃC¦âªº)¦b«C¯Üªº¯ó¦a¤W...¡C - ¨º«h°T®§³Q¾A·íªº³¡¤À³Q¤Þ¥Î¦b¤U­±¡C + url="http://www.FreeBSD.org/cgi/getmsg.cgi?fetch=506636+517178+/usr/local/www/db/text/1999/freebsd-hackers/19991003.freebsd-hackers"> + ¦b«C»A¯ó¦a¤Wªº¸}½ñ¨®¨®´×(¥ô¦óÃC¦âªº)...¡C¥H¤U¡A¶ÈºK­n¸Ó«h¤å³¹³¡¤À¤º®e¡G
&a.phk; on freebsd-hackers, October 2, 1999 - ¤°»ò¬OÃö©ó³o­Ó¸}½ñ¨®´×? ³¡¤Àªº¤H³o¼Ëªº¸ß - °Ý§Ú¡C + ¤°»ò¬OÃö©ó³o­Ó¸}½ñ¨®¨®´×? ³¡¤Àªº¤H³o¼Ëªº¸ß°Ý§Ú¡C ³o¬O¤@­Ó«D±`ªø»·ªº¬G¨Æ¡A§_«h´N¬O¤@­Ó¥j¦Ñªº¬G¨Æ¡C¦ý¬O¨Æ¹ê¤W¡A - ³o­Ó¬G¨Æ«D±`ªºµu¡CC. Northcote Parkinson ¦b1960¦~¥Nªì´Á¼g¤F¤@¥» - ®Ñ¡A®Ñ¦W¬° Parkinson's Law¡A¦b³o¥»®Ñ¤¤¥]§t¤F«Ü¦h - ¨ã¦³¨ô¨£ªº°ÊºAºÞ²z¾Ç¡C + ³o­Ó¬G¨Æ«D±`ªºµu¡CC¡P¿Õ´µ¬ì¯S¡P©¬ª÷´Ë(C. Northcote Parkinson) ¦b 1960 + ¦~¥Nªì´Á¼g¤F¤@¥»®Ñ¡A®Ñ¦W¬° Parkinson's Law(¤¤¤å®Ñ¦W¡G¤É©x¦³¹D¡Ð¼ÉÅS¤W¥q¤ßºA¤§©¬ª÷´Ë©w«ß) + ¡A³o¥»®Ñ¥]§t¤F«Ü¦h¨ã¦³¨ô¨£ªº°ÊºAºÞ²z¾Ç¡C [¤Þ­z¤@ÂI¦b³o¥»®Ñ¤Wªºµû½×] - ¦b³o­Ó³Q±²¤J¸}½ñ¨®´×®×ªº¯S®í¨Ò¤l¡A¥D­nªº­n¯À¬O®Ö¯àµo¹q³õ¡A - §Ú·Q¡A³o¨¬¥H»¡©ú³o¥»®Ñªº¦~ÄÖ¡C + ¦b³o­Ó³Q±²¤J¸}½ñ¨®¨®´×®×ªº¯S®í¨Ò¤l¡A¥D­nªº­n¯À¬O®Ö¯àµo¹q³õ¡A§Ú·Q¡A³o¨¬¥H»¡©ú³o¥»®Ñªº¦~ÄÖ¡C - Parkinson ®i¥Ü¤F§A¸Ó¦p¦ó¦b¸³¨Æ·|¤¤Ä¹±oÃÙ¦P¥h«Ø³y¤@®y¼Æ¦Ê¸U - ©Î¬Æ¦Ü¤Q»õ¬ü¤¸ªº®Ö¯àµo¹q³õ¡A¦ý¬O¡A¦pªG§A·Q­n¥h«Ø³y¤@®y¸}½ñ¨®´×¡A - §A±N·|³QªÈÄñ¦bµL½aµLºÉªº°Q½×¤§¤¤¡C + ©¬ª÷´Ë®i¥Ü¤F¸Ó¦p¦ó¦b¸³¨Æ·|¤¤Ä¹±oÃÙ¦P¥h«Ø³y¤@®y¼Æ¦Ê¸U©Î¬Æ¦Ü¤Q»õ¬ü¤¸ªº®Ö¯àµo¹q³õ¡A + ¦ý¬O¡A¦pªG§A·Q­n¥h«Ø³y¤@®y¸}½ñ¨®¨®´×¡A§A±N·|³QªÈÄñ¦bµL½aµLºÉªº°Q½×¤§¤¤¡C - Parkinson ¸ÑÄÀ¡A³o¬O¦]¬°¤@­Ó®Ö¯àµo¹q³õ¬O³o¼Ëªº¼sÁï¡A³o¼Ëªº - ©ù¶Q¡A¨Ã¥B³o¼Ëªº½ÆÂø¡A¥H¦Ü©ó¤H­ÌµLªk´x´¤¥¦¡A¦Ó¨Ã«D¹Á¸Õ¡A¥L­Ì«æ - ¤Áªº§Æ±æ¦³¤H¯à°÷À°¥L­Ì³B²z¨Ã¸Ñ¨M©Ò¦³º¾¸Hªº²Ó¶µ¡C - Richard P. Feynmann µ¹¤F¤@¨Ç¦³½ì¡A¥B«D±`¤@°w¨£¦åªº½×ÂI¡A¦b¥Lªº - ®Ñ´£¨ì¤F Los Alamos ªº¨Ò¤l¡C + ¥L(©¬ª÷´Ë)¨Ã¸ÑÄÀ¡A³o¬O¦]¬°¤@­Ó®Ö¯àµo¹q³õ¬O³o¼Ëªº¼sÁï¡A³o¼Ëªº©ù¶Q¡A¨Ã¥B³o¼Ëªº½ÆÂø¡A + ¥H¦Ü©ó¤H­ÌµLªk´x´¤¥¦¡A¦Ó¨Ã«D¹Á¸Õ¡A¥L­Ì«æ¤Áªº§Æ±æ¦³¤H¯à°÷À°¥L­Ì³B²z¨Ã¸Ñ¨M©Ò¦³º¾¸Hªº²Ó¶µ¡C + Richard P. Feynmann µ¹¤F¤@¨Ç¦³½ì¡A¥B«D±`¤@°w¨£¦åªº½×ÂI¡A¦b¥Lªº®Ñ´£¨ì¤F Los Alamos ªº¨Ò¤l¡C - ¥t¤@¤è­±¡A¥ô¦ó¤H³£¯à¦Û¤v¦b¶g¥½²Õ¸Ë¤@®y¸}½ñ¨®´×¥X¨Ó¡A¨Ã¥B¤´ - ¦³¶¢²á¥i¥HÆ[½à¹qµø¤Îª±¹CÀ¸¡C¦]¦¹¡AµL½×§A§@¤F¦h»ò§¹µ½ªº·Ç³Æ¡A¤] - ¤£ºÞ§A´£¥Xªº¤è®×¬O¦h»òªº¦X©y¡A¬Y¨Ç¤H¤´±N§ì¦í¾÷·|¶]¥X¨Ó§i¶D§A¡A - ¥L¥¿¦b§@¦P¼Ëªº¨Æ¡A¥¿¦b¥I¥X§V¤O¡A¥L´N¦b - ³o¸Ì¡C + ¥t¤@¤è­±¡A¥ô¦ó¤H³£¯à¦Û¤v¦b¶g¥½²Õ¸Ë¤@®y¸}½ñ¨®¨®´×¥X¨Ó¡A¨Ã¥B¤´¦³¶¢²á¥i¥HÆ[½à¹qµø¤Îª±¹CÀ¸¡C + ¦]¦¹¡AµL½×§A§@¤F¦h»ò§¹µ½ªº·Ç³Æ¡A¤]¤£ºÞ§A´£¥Xªº¤è®×¬O¦h»òªº§´·í¡A¬Y¨Ç¤H¤´±N§ì¦í¾÷·|¶]¥X¨Ó§i¶D§A¡A + ¥L¥¿¦b§@¦P¼Ëªº¨Æ¡A¥¿¦b¥I¥X§V¤O¡A¥L´N¦b ³o¸Ì¡C - ¦b¤¦³Á¡A§Ú­ÌºÙ³o­Ó¥s§@ - ªê¦º¯d¥Ö(setting your fingerprint)¡C¥¦Ãö«Y¨ì§A - ­Ó¤HªºÅº¶Æ©MÁn±æ¡A³oÃö«Y¨ì§A¬O§_¥i¥H«üµÛ¬Y¦a«á¹ïµÛ§O¤H»¡ - ³o¸Ì! ³o¬O§Ú§@ªº¡C - ³o¬O¬Fªv¤Hª««Ü­«­nªº¤@­Ó¯S¼x¡C¦ý¬O¡A®É¾÷¬O¤j¦h¼Æ¤H¥Á©Ò½á»Pªº¡C - ·Q·Q¨º¨Ç¯d¦b¤ôªd¦a¤Wªº¸}¦L§a¡C + ¦b¤¦³Á¡A§Ú­ÌºÙ³o­Ó¥s§@¡yªê¦º¯d¥Ö¡z(setting your fingerprint)¡C³oÃö«Y¨ì§A­Ó¤HªºÅº¶Æ©MÁn±æ¡A + ³oÃö«Y¨ì§A¬O§_¥i¥H«üµÛ¬Y¦a«á¹ïµÛ§O¤H»¡¡G¡y³o¸Ì! ³o¬O §Ú §@ªº¡C¡z + ³o¬O¬Fªv¤Hª««Ü­«­nªº¤@­Ó¯S¼x¡C¦ý¬O¡A®É¾÷¬O¤j¦h¼Æ¤H¥Á©Ò½á»Pªº¡C·Q·Q¨º¨Ç¯d¦b¤ôªd¦a¤Wªº¸}¦L§a¡C
Edward Chuang
edwardc@firebird.org.tw
The FreeBSD Funnies How cool is FreeBSD¡H °Ý¡G¦³¤H°µ¹L FreeBSD °õ¦æ®Éªº·Å«×´ú¸Õ¶Ü¡H §Úª¾¹D Linux ¤ñ DOS ²D¡A¦ý¨SÅ¥¤H´£¹L FreeBSD¡A¦ü¥G«Ü¼ö¡C µª¡G¨S¦³¡A¦ý¬O¦b¨ýı¤W¦³°µ¹LµL¼Æ¦¸´ú¸Õ¡C§Ú­Ìé¤W¦ÛÄ@¨ü¸ÕªÌªº ²´·ú¡A¨Æ¥ý¦Aµ¹¥L­ÌªA¥Î 250 ²@§Jªº LSD-25 °g¤ÛÃÄ¡C35% ªº¨ü¸ÕªÌ»¡ FreeBSD ¹Á°_¨Ó¹³¾ï¤l¡A¦Ó Linux «h¬Oµµ¦âªººd¾ðªG¹ê¡C¾Ú§Ú©Òª¾¡A¨S ¦³¤@²Õ´£¨ì·Å«×¤W¯S§Oªº®t²§¡C«á¨Óµo²{¡A¦³¤Ó¦h¨ü¸ÕªÌ¦b´ú¸Õ®É¹Ú¹C¨« ¥X©Ð¶¡¼vÅT¨ì¼Æ¾Ú¡A³Ì«á¥u±o©ñ±ó¾ã­Ó½Õ¬d¡C§Ú·Q¤j³¡¥÷ªº¨ü¸ÕªÌ²{¦b¦b Apple ¤u§@¡AÄ~ Drag and Drop ¤§«á¡A¬ã¨s¥þ·sªº Scratch and Sniff ¹Ï§Î¬É­±¡CIt's a funny old business we're in¡I ¤£¶}ª±¯º¤F¡AFreeBSD ©M Linux ³£¨Ï¥Î HLT - (halt) «ü¥O¥H¦b¨t²Î¶¢¸m®É­°§C¹q¤Oªº¨Ï¥Î¤]´î¤Ö¤F¼öªº²£¥Í¡C¦pªG¦³ - ³]©w APM (automatic power management)¡AFreeBSD ¤]¥i¥HÅý CPU ¶i - ¤J§C¹q¤O¼Ò¦¡¡C + (halt) «ü¥O¡A¥i¦b¨t²Î¶¢¸m®É­°§C¹q¤Oªº¨Ï¥Î¤]´î¤Ö¤F¼öªº²£¥Í¡C¦pªG¦³³]©w APM(Automatic Power Management) + ¡AFreeBSD ¤]¥i¥HÅý CPU ¶i¤J¬Ù¹q¼Ò¦¡¡C ½Ö¦b§Úªº°O¾ÐÅé´¡¼Ñ¤¤¨F¨F§@ÅT¡H¡H °Ý¡GFreeBSD ½sĶ®Ö¤ß®É¦³°µ¬Æ»ò ©_¯S ªº¨Æ Åý°O¾ÐÅé¨F¨F§@ÅT¶Ü¡H·í½sĶ®É(ÁÙ¦³¶}¾÷®É½T»{³nºÐ«áªºµu¼È®É¶¡)¡A ¤]ºØ¦ü¥G¨Ó¦Û°O¾ÐÅé´¡¼Ñªº©_©ÇÁn­µ¡C µª¡G¬Oªº¡I¦b BSD ªº¤å¥ó¤¤§A·|±`±`¬Ý¨ì ­I«áÆF¡A ¤j³¡¥÷ªº¤H³£¤£ª¾¹D¨º¬O¤@ºØ¹ê»Ú¦s¦bªººë¯«Åé --- ´x±±µÛ§Aªº¹q¸£¡C §AÅ¥¨ìªºÁn­µ¬O³o¨Ç­I«áÆF¥H°ª­µ¤f­ï¦b·¾³q«ç¼Ë°µ³\¦hªº¨t²ÎºÞ²z¤u §@¡C ¦pªG³o¨ÇÁn­µ«Ü§xÂZ§A¡A¨Ó¦Û DOS ªº fdisk /mbr ´N¯àÂ\²æ¡A¦ý¦pªG¦³¬Û¤Ïªº®ÄªG ¤]¤£­nÅå³Y¡C¨Æ¹ê¤W¡A¦pªG¦b»ö¦¡¤¤Å¥¨ì Bill Gates ®£©ÆªºÁn­µ±q¤º «Øªº³â¥z¶Ç¨Ó¡A°¨¤W°k¦Ó¥B¤£­n¦^ÀY¡I ±q BSD ­I«áÆF¤£¥­¿Åªº¼vÅT¤¤ ¸Ñ©ñ¡ADOS ©M Windows ­I«áÆF³q±`³£¯à­«·s±±¨î¾ã¥x¾÷¾¹¨Ã¹ï§AªºÆF »î¶A©G¡C¦pªG¦³¿ï¾Ü¡A§Ú·Q§Ú¹çÄ@²ßºD©_©ÇªºÁn­µ¡C ­n´X­Ó FreeBSD hacker ¤~¯à´«±¼¤@­Ó¹q¿Oªw¡H ¤@¤d¤@¦Ê¤C¤Q¤G­Ó¡G ¤G¤Q¤T­Ó¦b -current ¤W©ê«è¬Ý¤£¨ì¥ú¤F¡F ¥|­Ó«ÅºÙ³o¬O³]©w¤Wªº°ÝÃD¡A©Ò¥H¹³³o¼Ëªº email À³¸Ó©ñ¦b -questions¡F ¤T­Ó submit PR¡A¨ä¤¤¤@­Ó°e¿ù¨ì doc ¤U¡A¨Ã¥B¤º®e¥u ¦³¡¨³o¸Ì¦n·t¡¨¡F ¤@­Ó commit ©|¥¼´ú¸Õªº¹q¿Oªw¡A³y¦¨¤£¯à buildworld¡A ¤­¤ÀÄÁ«á¥L§â­ì¨Óªº¿Oªw´«¦^¨Ó¡F ¤K­Óº´°_ flame war¡A³d©Ç°e¥X PR ªº¤H¨S¦³¥]¬A patch¡F ¤­­Ó®I«è buildworld Äê±¼¤F¡F ¤T¤Q¤@­Ó»¡ buildworld ¥i¥H¥Î¡A¤£¯à¥Îªº¤H¤@©w¬O cvsup ªº ®É¾÷¤£¹ï¡F ¤@­Ó§â´«¦¨·s¿Oªwªº patch ¥á¨ì -hackers ¤W¡F ¤@­Ó»¡¥L¤T¦~«e´N°µ¥X¤F patch¡A¦ý°e¨ì -current «á«o³Q©¿²¤±¼¡A ©Ò¥H¥L¹ï¾ã­Ó PR ¨t²Î¦³«Ü¤£¦nªº¦L¶H¡C¦¹¥~¡A¥L¤]»{¬°®³¥Xªº·s¿OªwµL ªk¤Ï¥ú¡F ¤T¤Q¤C­Ó©H­ý»¡¹q¿Oªw¤£ÄÝ©ó°ò¥»¨t²Îªº¤@³¡¥÷¡A©Ò¥H committer ¤£¯à¤£¥ý¿Ô¸ß¾ã­Ó Community ªº·N¨£´N³o¼Ë°µ¤U¥h¡CÁÙ¦³¡A-core ¨ì©³©M³o¥ó¨Æ¦³¤°»òÃö«Y¡H¡I ¨â¦Ê¤H©ê«è´«¿Oªw¤§«á¡A¸}½ñ¨®´×ªºÃC¦âÅܱo¦n©_©Ç¡F ¤T­Ó«ü¥X¡A¥Î¨Ó´«¿Oªwªº patch ¤£²Å¦X &man.style.9; ªº³W©w¡F ¤Q¤C­Ó®I«è®³¥X¨Óªº·s¿Oªw¬°¤°»ò¬O¥Î GPL¡F ¤­¦Ê¤K¤Q¤»¤H³´¤J¤@³õ flame war¡A¦b GPL¡BBSD¡BMIT¡BNPL ¦U­Ó license ©M FSF ¬Y¦ì¤£¨ã¦W³Ð¿ì¤H¤h­Ó¤H½Ã¥Í¤§¶¡¡A¤ñ¸û©¼¦¹ ªºÀu¶Õ¡F ¤C­Ó±N³o¤@¦ê°Q½×ªº¤£¦P³¡¥÷¤À§O²¾¨ì -chat ©M -advocacy¡F ´Nºâ´£¥Xªº·s¿Oªw¤ñªº·t¡AÁÙ¬O¦³¤@­Ó§â¥¦ commit ¶i¨Ó¡F ¨â­Ó´«¦^­ì¥ýªº¿Oªw¡A¨Ã¥B¯d¤U·¥¬°¼««ãªº commit °T®§¡C¥L­Ì»{¬° »P¨äÅý FreeBSD ¥Î·t¿Oªw¡AÁÙ¤£¦p°®¯Ü«Ý¦b¶Â·t¤¤ºâ¤F¡F ¥|¤Q¤»¤H¹ï¨ú®ø¤£¥Î·t¿Oªw³o¥ó¨Æ¤jÁn¯e©I¡A­n¨D -core ¥ß¨è´£¥X¼á²M¡F ¤Q¤@­Ó­n¨D´«¦¨¤p¤@ÂIªº¹q¿Oªw¡A¥H«K¥¼¨Ó FreeBSD ¦pªG²¾´Ó¨ì ¹q¤lÂû¤W«á·|§ó¬°¤è«K¡F ¤C¤Q¤T¤H©ê«è -hackers ©M -chat ¤Wªº SNR¡AÂÇ unsubscribe ¨Óªí¥Ü§Üij¡F ¤Q¤T­Ó°e¥X¡¨unsubscribe¡¨¡B¡¨§Ú­n¦p¦ó unsubscribe¡¨©Î¡¨«ô°U§â §Ú±q list ¦W³æ¤¤§R±¼¡¨¡A«Hªº³Ì«á­±«h¬O¤@¯ë¥Ñ majordomo ¥[¤W¥h ªº footer¡F ·í¨C­Ó¤H¦£©ó©¼¦¹¥s½|®É¡A¦³­Ó³Ã¥ë¶X¨S¤Hª`·N¡A§â¥i¥H¥Îªº¿Oªw°½ °½´«¤W¥h¡F ¤T¤Q¤@­Ó«ü¥X¦pªG¥Î TenDRA ½sĶ·sªº¿Oªw¡A·|¤ñªº¨Ó±o«G 0.364%¡]ÁöµM¿Oªw·|³Q½sĶ¦¨¥¿¤»­±Åé¡^¡A©Ò¥H FreeBSD ¤º©wªº½sĶ¾¹ À³¸Ó¬O TenDRA¡A¦Ó¤£¬O EGCS¡F ¦³­Ó¤H»¡·s¿Oªw¯Ê¥F¬ü·P¡F ¤E­Ó¤H¡]¥]¬A­ì¥ý°e PR ªº¤H¡^°Ý¡¨¤°»ò¬O MFC¡H¡¨¡F ¤­¤Q¤C­Ó©ê«è¦Û±q´«¤F¿Oªw«á¡A¨â­Ó¬P´Á³£¨S¦³¥ú¥X²{¡C &a.nik; ¸Éª`¡G ­è¬Ý¨ì®É¡A§Ú§Ö¯ºÂ½¤F¡C µM«á·Q¨ì¡A¡¨µ¥¤@¤U¡A¤£¬OÀ³¸ÓÁÙ¦³¤@­Ó­n±N³o¨Ç°O¦b list ¤W¶Ü¡H¡¨ ±µµÛ²×©ó¤F¸Ñ§Úªº¨Ï©R :-) ¼g¤J /dev/null ªº¸ê®Æ¶]¨ì­þ¸Ì¥h¤F¡H ¦b CPU ¤¤¦³¤@ºØ¯S§Oªº¸ê®Æ´²¼ö¾¹¡A§Q¥Î±Æ¥X´²¼ö¤ù/­·®°²Õ¦X®É¡A Âà´«¦¨¼ö¯à¡D³o´N¬O¬°¤°»ò CPU §N«o¤éÁÍ­«­nªº­ì¦]¡F·í¤H­Ì¨Ï¥Î§ó§Ö ªº³B²z¾¹®É¡A¥L­ÌÅܦ¨¤£¦b¥G¦³¶V¨Ó¶V¦h¥L­Ìªº¸ê®Æ³£°e¶i¤F /dev/null ¡A¦Ó¨Ïªº¥L­Ìªº CPU ¹L¼ö¡D ¦pªG§A§R°£¤F /dev/null (¨º±N·|¦³®ÄªºÃö³¬ CPU ªº¸ê®Æ´²¼ö¾¹) §Aªº CPU ¤]³\·|­°§C¤u§@·Å«×¡A¦ý¬O§Aªº¨t²Î±N ·|«Ü§Öªº¹³¬O¿©±w¤F«K¯µ¦ñÀHµÛ©Ò¦³¶W¥Xªº¸ê®Æ¶}©lÅܦ¨¦æ¬°¤£¥¿±`¡C ¦pªG§A¦³§Ö³tªººô¸ô³s½u¡A§A¥i¥H§Q¥ÎŪ¨ú /dev/random ¨Ã±N¥LÀH·N¶Ç°e¦Ü¦U³B¡A ¨Ó­°§C§A CPU ªº·Å«×¡FµM¦Ó§A±N³´¤J¨Ï§Aºô¸ô³s½u©Î / ¦³¹L¼öªº­·ÀI©Î¬O·S´o§Aªº ISP¡A ¤j³¡¤Àªº¸ê®Æ³Ì²×±N·|¦b¥L­Ìªº³]³Æ¤WÂà´«¦¨¼ö¡A¤£¹L¥L­Ì³q±`³£¾Ö¦³ ¦nªº´²¼ö¡A©Ò¥H¦pªG§A°µªº¤£¤Ó¹L¤À¡AÀ³¸Ó¬O¨S¤°»ò¤j¤£¤Fªº¡C Paul Robinson ¸É¥R¡G ¤¤¤åª© FAQ ª`¡G¥H¤Uµu¤åÄÝ©ó¬ü¦¡«ÕÀq¡A®£Â½Ä¶«á³y¦¨»y²j¤£¸Ô¡A »y·N¤£³qªº±¡§Î¡A©T«O¯d­ì¥Ä­ì¨ýÅýŪªÌ¦Û¦æ«~À|¡C There are other methods. As every good sysadmin knows, it is part of standard practise to send data to the screen of interesting variety to keep all the pixies that make up your picture happy. Screen pixies (commonly mis-typed or re-named as 'pixels') are categorised by the type of hat they wear (red, green or blue) and will hide or appear (thereby showing the colour of their hat) whenever they receive a little piece of food. Video cards turn data into pixie-food, and then send them to the pixies - the more expensive the card, the better the food, so the better behaved the pixies are. They also need constant simulation - this is why screen savers exist. To take your suggestions further, you could just throw the random data to console, thereby letting the pixies consume it. This causes no heat to be produced at all, keeps the pixies happy and gets rid of your data quite quickly, even if it does make things look a bit messy on your screen. Incidentally, as an ex-admin of a large ISP who experienced many problems attempting to maintain a stable temperature in a server room, I would strongly discourage people sending the data they do not want out to the network. The fairies who do the packet switching and routing get annoyed by it as well.
En-Ran Zhou
zhouer@tfcis.org
¶i¶¥¥DÃD ¦p¦ó¯à¾Ç²ß§ó¦h¦³Ãö FreeBSD ¤º³¡ªºªF¦è¡H ¥Ø«e¥«­±¤WÁÙ¨S¦³±´°Q§@·~¨t²Î¤º³¡ªº®Ñ¬O±M¬° FreeBSD ¦Ó¼g ªº¡CµM¦Ó¡A³\¦h¤@¯ëªº UNIX ª¾Ãѳ£¥i¥Hª½±µÀ³¥Î¦b FreeBSD ¤W¡Cªþ ¥[¤@ÂI¡A¤´µM¦³¬ÛÃöªº®Ñ¬O±M¬° BSD ©Ò¼gªº¡C ½Ð°Ñ¦Ò Handbook ªº§@·~¨t²Î¤º³¡¤§°Ñ¦Ò®Ñ¥Ø ¡C ¦p¦ó¯à¬° FreeBSD ¥X¤@¥÷¤O¡H ½Ð°Ñ¦Ò³o½g¤å³¹ Contributing to FreeBSD ¨Ó´£¨Ñ±zªº«Øij¡C¦pªG±z¯àÀ°¦£¨º´N§óÅwªï¤F¡I SNAP ©M RELEASE ¬O¤°»ò¡H ¥Ø«e¦³¤T­Ó¬¡ÅD/¥b¬¡ÅDªº¤À¤ä¦b FreeBSD ªº CVS Repository - (RELENG_2 ¤À¤ä¤@¦~¤j·§§ó°Ê¨â¦¸¡A¥¿¬O¬°¦ó¥u¦³¤T­Ó¬¡ÅDªºµo®i¤¤¤À¤ä)¡G + (¥j¦­¤À¤ä¤w¸g´X¥G¨S¦b§ó·s¤F¡A¦]¬°³q±`¥u¦³¤T­Ó¬¡ÅDªºµo®i¤À¤ä)¡G - RELENG_2_2 §Y - 2.2-STABLE - - - - RELENG_3 §Y - 3.X-STABLE + RELENG_5 §Y + 5-STABLE - RELENG_4 §Y - 4-STABLE + RELENG_6 §Y + 6-STABLE HEAD §Y - -CURRENT §Y - 5.0-CURRENT + -CURRENT ¤]´N¬O¥Ø«eªº + 7.X-CURRENT - - ¦p¦P¨ä¥L¨â­Ó¡AHEAD ¨Ã¤£¬O¯u¥¿ - ªº branch tag¡A¥¦¥u¬O¤@­Ó²Å¸¹±`¼Æ¡A«ü¦V current - (©|¥¼¤À¤äªºµo®i¤¤ª©¥») ²°O¬° - -CURRENT¡C - - ¥H²{¦b¨Ó»¡¡A-CURRENT ´Â¦V 5.0 µo®i¡A¦Ó - 4-STABLE ¤À¤ä¡A¤]´N¬O - RELENG_4¡A¦b 2000 ¦~¤T¤ë±q - -CURRENT ¤À¤ä¥X¨Ó¡C + »P¤W­±¨ä¥L¨â­Ó¤À¤ä¬Û¤ñ¡A¨ä¹ê HEAD ¨Ã¤£¬O¯u¥¿ + ªº branch tag¡A¥¦¥u¬O­Ó symbolic constant¡A¥Nªí current + (©|¥¼¤À¤äªºµo®i¤¤ª©¥»)¡A³q±`§Ú­Ì·|²¼g¬° -CURRENT¡C - 2.2-STABLE ³o­Ó¤À¤ä¡A¤]´N¬O - RELENG_2_2¡A¦b 1996 ¦~¤Q¤@¤ë±q -CURRENT ¤À¤ä¥X - ¨Ó¡A³o­Ó¤À¤ä¥Ø«e¤w¸g§¹¥þ°h¥ð¤F¡C + ´N²{¦b¦Ó¨¥¡A-CURRENT ´N¬O«ü 7.X ªºµo®i¡F + ¦Ó 5-STABLE ¤À¤ä(RELENG_5)¬O¦b 2004 ¦~ 10 ¤ë±q + -CURRENT fork ¥X¨Óªº¡F + 6-STABLE ¤À¤ä(RELENG_6)¬O¦b 2005 ¦~ 11 ¤ë±q + -CURRENT fork ¥X¨Óªº¡C ­n«ç»ò§@¥X¦Û¤vªº release¡H ½Ð°Ñ·Ó Release ¤uµ{ ¤å³¹»¡©ú¡C - ¬°¤°»ò make world §â­ì¨Ó¸Ëªº binary ÀÉ - ³£´«±¼¤F¡H + ¬°¦ó make world ·|§â­ì¨Ó¸Ëªº binary Àɳ£´«±¼¤F¡H ¨S¿ù¡A´N¬O³o¼Ë¤l¡C¦p¦W¦r©Ò¥Ü¡Amake world - ·|­«·s½sĶ¨t²Î¤º«Øªº¨C­Ó binary ÀÉ¡A³o¼Ë¦bµ²§ô®É´N¥i½T©w¦³­Ó¤@­P - ¥B°®²bªºÀô¹Ò(©Ò¥H­nªá¤W¦n¤@¬q®É¶¡)¡C + ·|­«·s½sĶ¨t²Î¤º«Øªº¨C­Ó binary ÀÉ¡A³o¼Ë¦bµ²§ô®É´N¥i½T©w¦³­Ó¤@­P¥B°®²bªºÀô¹Ò(©Ò¥H­nªá¤W¦n¤@¬q®É¶¡)¡C ¦b°õ¦æ make world ©Î make install ®É¡A¦pªG¦³³] DESTDIR ³o­ÓÀô¹ÒÅܼơA·s²£¥Íªº binary ±N·|¸Ë¦b ${DESTDIR} ¤U¦P¼Ëªº¥Ø¿ý¾ð¤¤¡C¦ý¦b¬Y¨Ç­×§ï shared library ©M­««Ø binary ªºµL¯S©w±¡ªp¤U¡A³o¼Ë°µ¥i¯à·|¨Ï make world ¥¢±Ñ¡C + + + Why isn't cvsup.FreeBSD.org a round robin DNS entry to + share the load amongst the various CVSup servers? + + + + While CVSup mirrors update from the master CVSup + server hourly, this update might happen at any time during + the hour. This means that some servers have newer code + than others, even though all servers have code that is + less than an hour old. If cvsup.FreeBSD.org was a round + robin DNS entry that simply redirected users to a random + CVSup server, running CVSup twice in a row could download + code older than the code already on the system. + + + ¦b¨t²Î¶}¾÷®É¡A¥X²{ (bus speed defaulted)¡C Adaptec 1542 SCSI ¥d¤¹³\¨Ï¥ÎªÌ¥Î³nÅé½Õ¾ã¶×¬y±Æªº¦s¨ú³t«×¡C ¦­´Áªº 1542 ÅX°Êµ{¦¡¸Õ¹Ï±N¥¦³]¦¨¥i¥Îªº³Ì§Ö³t«×¡A¦ý«á¨Óµo²{¦b¤@ ¨Ç¾÷¾¹¤W¤£¯à¥Î¡A©Ò¥H²{¦b­n¦b kernel ³]©w¤¤¥[ TUNE_1542 ³o­Ó¿ï¶µ¨Ó±Ò°Ê³o­Ó¥\¯à¡C¦b¤ä´©ªº¾÷¾¹ ¤W¥Î³o­Ó¿ï¶µ·|¨ÏµwºÐ¦s¨ú§ó§Ö¡A¦ý¦b¤£¤ä´©ªº¾÷¾¹¤W¦³¥i¯à·|·´±¼¸ê®Æ¡C ¦bºô¸ôÀW¼e¦³­­ªº±¡ªp¤U¡A§Ú¤]¥i¥H¸ò¤W current ªºµo®i¶Ü¡H ¬Oªº¡AÂÇµÛ CTM ±z´N¥i¥H¤£¥Î¤U¸ü¥þ³¡ªºµ{¦¡½X¡C ¬O«ç»ò§âµo¦æª©¥»¤¤ªºÀɮפÁ¦¨¤@­Ó­Ó 240k ªº¤pÀɮתº¡H ¥H BSD ¬°°ò¦ªº¸û·s¨t²Î¦³­Ó ¿ï¶µ ¥i¥H§âÀÉ®×¥H¥ô·N¼Æ¥Ø byte ¤Á¶}¡C ³o¸Ì¬O /usr/src/Makefile ¤¤ªº¤@­Ó ¨Ò¤l¡G bin-tarball: (cd ${DISTDIR}; \ tar cf - . \ gzip --no-name -9 -c | \ split -b 240640 - \ ${RELEASEDIR}/tarballs/bindist/bin_tgz.) §Ú¦b kernel ¤¤¥[¤F·s¥\¯à¡A§Ú­n§â¥¦±Hµ¹½Ö¡H ½Ð°Ñ¦Ò Contributing to FreeBSD ¤¤ªº¤å³¹¡A¥H¤F¸Ñ­n¦p¦ó´£¨Ñ±zªºµ{¦¡½X¡C ¦P®É¤]ÁÂÁ±zªºÃö¤ß¡I ISA ªºÀH´¡§Y¥Î¥d¬O¦p¦ó°»´ú¤Îªì©l¤Æªº¡H ¥Ñ Frank Durda IV ©Ò¼g¡G uhclem@nemesis.lonestar.org ²³æªº»¡¡A·í¥D¾÷µo¥X¬O§_¦³ PnP ¥dªº¸ß°Ý°T¸¹®É¡A©Ò¦³ªº PnP ¥d ·|¦b´X­Ó©T©wªº I/O port §@¦^À³¡C©Ò¥H·í°»´ú PnP ªºµ{¦¡¶}©l®É¡A¥¦ ·|¥ý°Ý¦³¨S¦³ PnP ¥d¦b¡A±µµÛ©Ò¦³ PnP ¥d·|¦b¥¦Åªªº port ¥H¦Û¤vªº «¬¸¹ # §@¦^µª¡A³o¼Ë°»´úµ{¦¡´N·|±o¨ì¤@­Ó wired-OR yes ªº¼Æ¦r¡A¨ä¤¤¦Ü¤Ö·|¦³¤@­Ó bit ¬O¥´¶}ªº¡CµM«á°»´úµ{¦¡·|­n¨D«¬¸¹ (¥Ñ Microsoft/Intel«ü©w)¤p©ó X ªº¥dÂ÷½u¡C¦A¥h¬Ý¬O §_ÁÙ¦³¥d¦^µª¦P¼Ëªº¸ß°Ý¡A¦pªG±o¨ì 0¡A´Nªí¥Ü¨S ¦³«¬¸¹¤j©ó X ªº¥d¡C ²{¦bµ{¦¡·|°Ý¬O§_¦³«¬¸¹¤p©ó X ªº¥d¡A¦pªG¦³ªº¸Ü¡Aµ{¦¡¦A­n«¬¸¹¤j©ó X-(limit/4) ªº¥dÂ÷½u¡AµM«á­«ÂÐ ¤W­±ªº°Ê§@¡C¥Î­«½Æ³oºØÃþ¦ü semi-binary search ªº¤èªk¡A¦b¬Y½d³ò¤º §ä­Ó´X¦¸«á¡A´úµ{¦¡³Ì«á·|¦b¾÷¾¹¤¤°Ï¤À¥X©Ò¦³ªº PnP ¥d¡A·j´M¦¸¼Æ¤] »·§C©ó¤@­Ó­Ó§äªº 2^64 ¦¸¡C ¤@±i¥dªº ID ¥Ñ¨â­Ó 32-bit(©Ò¥H¤W­±¬O 2ˆ64) + 8bit °»¿ù½X ²Õ¦¨¡A²Ä¤@­Ó 32 bits ¬O¥Î¨Ó°Ï¤À¦U®a¼t°Óªº¡C³o¨Ç¼t°Ó±q¨Ó¨S¦³¥X¨Ó¼á ²M¹L¡A¦ý¬Ý¨ÓÀ³°²³]¦P¤@®a¥Xªº¤£¦PºØÃþªº¥dªº¼t°Ó ID ¦³¥i¯à¤£¦P¡C¥Î 32 bits ¥u¨Óªí¥Ü¤£¦P¼t°Óªº·Qªk¹ê¦b¦³ÂI¹LÀY¤F¡C ²Ä¤G­Ó 32 bits «h¬O«¬¸¹ #¡B¤A¤Óºô¸ô¦ì§}¡B©Î¤@¨Ç¨Ï³o±i¥d¿W¯Sªº ¸ê®Æ¡C°£«D²Ä¤@­Ó 32 bits ¤£¦P¡A§_«h¼t°Ó¤£¥i¯à§@¥X²Ä¤G­Ó 32 bit ¬Û ¦Pªº¨â±i¥d¡C©Ò¥H¦b¤@¥x¾÷¾¹¤¤¥i¥H¦³¦P¼Ëªº¦n´X±i¥d¡AµM¦Ó¥L­Ì¾ã­Ó 64 bits ÁÙ¬O·|³£¤£¤@¼Ë¡C ³o¨â­Ó 32 bit µ´¹ï¤£¥i¥H¥þ¬°¹s¡A³o¤~¯à¨Ï±o³Ì¶}©l binary search ¤¤ªº wired-OR ·|±o¨ì¤@­Ó«D¹s¼Æ¦r¡C ¤@¥¹¨t²Î°Ï¤À¥X©Ò¦³¥dªº ID¡A±µµÛ·|¸g¥Ñ¦P¼Ëªº I/O port ¤@­Ó­Ó­« ·s±Ò°Ê¨C±i¥d¡A±µµÛ§ä¥X¤wª¾¤¶­±¥d©Ò»Ýªº¸ê·½¡B¦³­þ¨Ç¤¤Â_¥i¥H¨Ï¥Îµ¥ µ¥¡C©Ò¦³¥d³£·|³Q±½´y¤@¦¸¡A¨Ó¦¬¶°³o¨Ç¸ê®Æ¡C ³o¨Ç¸ê°T±µµÛ©MµwºÐ¤Wªº ECU ÀɮסB©Î MLB BIOS ¸Ìªº¸ê®Æµ²¦X¦b¤@ °_¡A³q±`¬Oºî¦X ECU ©M MLB ¸Ìªº BIOS PnP ¸ê®Æ¡A³o¨Ç¶gÃä¨Ã¤£¤ä´©¯u¥¿ ªº PnP¡AµM¦Ó°»´úµ{¦¡¦bÀˬd BIOS ©M ECU ¸ê®Æ«á¡A¥¦¥i¥HÁקK PnP ¶gÃä ©M¨º¨Ç°»´ú¤£¨ìªº¬Û½Ä¬ð¡C ±µµÛ¦A«×«ô³X³o¨Ç PnP ¶gÃä¡A³o¦¸·|§â¥i¥Îªº I/O¡BDMA¡BIRQ ©M°O¾Ð Åé¬M®gªº¦ì§}³£«ü©wµ¹¥¦­Ì¡C³o¨Ç¶gÃä´N·|¥X²{¦b©Ò«ü©wªº¦a¤è¡Aª½¨ì¤U¤@ ¦¸­«·s¶}¾÷¬°¤î¡A¤£¹L¤]¨S¦³¤H»¡¤£¯à§â¥¦­ÌÀH®É²¾¨Ó²¾¥h¡C ¤W­±¦³¬Û·í¦hªºÂ²¤Æ¡A¦ý§AÀ³¸Ó¤w¸g¤F¸Ñ¤j­Pªº¹Lµ{¡C Microsoft §âªí¥Ü¦Lªí¾÷ª¬ºAªº´X­Ó¥D­n port ®³¨Ó§@ PnP¡A¥L­Ìªº ÅÞ¿è¬O¨S¦³¤@±i¥d·|¦b³o¨Ç¦a¤è¸Ñ½X§@¬Û¤Ïªº I/O cycles¡C¦ý¬O§Ú§ä¨ì ¤@´Ú¦­´Á¤´¦bµû¦ô PnP ´£®×®Éªº IBM ­ì¼t printer board¡A¥¦ªº½T¥h¸Ñ ¹ï³o¨Çª¬ºA port ªº¼g¤J¸ê®Æ¡A¦ý¬O MS »¡¤F´Nºâ¡C©Ò¥H ¥¦­Ìªº½T¦³¹ï¦Lªí¾÷ª¬ºA port ¼g¤J¡AÁÙ¦³Åª¨ú¸Ó¦ì§} + 0x800¡B©M¥t¤@­Ó¦b 0x200 ¤Î 0x3ff ¤§¶¡ªº port¡C §Ú¬°¬Y³]³Æ¼g¤FÅX°Êµ{¦¡¡A¯à¤£¯àµ¹¥¦¤@­Ó major number¡H ³o­n¬Ý§A¬O§_¥´ºâ±N³o­ÓÅX°Êµ{¦¡¤½¶}¨Ï¥Î¡A¦pªG¬Oªº¸Ü¡A½Ð§â¥¦ªº ­ì©l½X°e¤@¥÷µ¹§Ú­Ì¡AÁÙ¦³ files.i386 ­×§ïªº ³¡¥÷¡Bkernel ³]©wÀɼ˥»¡B¥H¤Î¥Î¨Ó²£¥Í³]³ÆÀɪº &man.MAKEDEV.8;¡C ¦pªG§A¤£¥´ºâ¤½¶}¡B©Î¦]¬°ª©Åv°ÝÃD¦Ó¤£¯à¤½¶}ªº¸Ü¡A§Ú­Ì¦³¯S¦a«O¯d character major number 32 ©M block major number 8 µ¹³o¤è­±ªº¨Ï¥Î¡A ª½±µ¥Î³o¨â­Ó´N¦n¤F¡C¤£½×¦p¦ó¡A§Ú­Ì³£·|«Ü·P¿E§A¯à¦b &a.hackers; µoªíÅX°Êµ{¦¡ªº®ø®§¡C Ãö©ó§ó°Ê¥Ø¿ý©ñ¸mªº­ì«h¡H ¦b¦^µªÃö©ó§ó°Ê¥Ø¿ý©ñ¸mªº­ì«h¤è­±¡A§Ú¦b 1983 ¦~¼g¦n¥Ø«eªº§@ªk «á´N¨S¦³¦A§ïÅܹL¡A³oºØ¤è¦¡¬O°w¹ï­ì¥ýªº FFS Àɮרt²Î¡A«á¨Ó¤]¨S¦³ ¹ï¥¦§@¥ô¦ó§ó°Ê¡C¥¦¦bÁקK cylinder group ³Q¶ñº¡³o¤è­±°µ±o¬Û·í¦¨¥\¡A ¦ý¬O´N¹³¦³¨Ç¤H¤w¸gª`·N¨ì¡A¥¦©M find ´N°t¦X±o¤£¤j¦n¡C¤j³¡¥÷ªºÀÉ®× ¨t²Î¬O¥Ñ¨º¨Ç¥Î depth first search(aka ftw) ²£¥Íªº archive »s³y¥X ¨Ó¡A¸Ñ¥X¨Óªº¥Ø¿ý inode ·|¾î¸ó¦n´X­Ó cylinder group¡A¦pªG¥H«á­n°µ depth first search ªº¸Ü¡A³o¬O³ÌÁV¿|ªº±¡ªp¤§¤@¡C¦pªG§Ú­Ìª¾¹DÁ`¦@ ·|²£¥Í¦h¤Ö¥Ø¿ýªº¸Ü¡A¸Ñªk¬O¦b°µ¥ô¦ó¦s¨ú/¼g¤J°Ê§@¤§«e¡A¦b¨C­Ó cylinder group ¤W¥ý³y¥X(©Ò¦³¥Ø¿ý¼Æ/cylinder greoup ªº¼Æ¥Ø)³o»ò¦h ªº¥Ø¿ý¡C«Ü©úÅ㪺¡A§Ú­Ì¥²¶·­n¦³®Ú¾Ú¦a¥h²q³o ­Ó¼Æ¦r¡A´Nºâ¤@­Ó¹³ 10 ªº«Ü¤p©T©w¼Æ¥Ø¤]·|¨Ï®Ä²v¥H¯Å¼Æ¦¨ªø¡C°Ï¤À restore (§Y¸Ñ¶}¤W­zªº archive) ©M¤@¯ëÀÉ®×¾Þ§@ªº¤èªk¥i¥H¬O(²{¦b¥Îªººtºâªk¥i¯à­n§ó±Ó·P)¡G ¦pªG¤@¨Ç¥Ø¿ý(³Ì¦h 10 ­Ó)³£¦b 10 ¬í¤º²£ ¥Íªº¸Ü¡A¨º»ò´N§â³o¨Ç¥Ø¿ý »E¶°¦b¦P¤@­Ó cylinder group¡C¤£ºÞ«ç¼Ë¡A §Úªº¸gÅç«ü¥X³o¬O¤@­Ó¤w¸g ¥R¥÷¹êÅç¹Lªº³¡¥÷¡C Kirk McKusick, September 1998 ¦p¦ó¦b kernel panics ®É±o¨ì³Ì¦hªº¸ê°T¡H - [³o¸`¬O±q &a.wpaul; ¦b freebsd-current [³o¸`¬O±q &a.wpaul; ¦b &os.current; mailing list ¤Wµoªíªº«H¤¤¸`¿ý¡A &a.des; ­×¥¿¤F¥´¦r¿ù»~¡B¦A¥[¤W¬A©·¸Ìªºª`¸Ñ¡C] From: Bill Paul <wpaul@skynet.ctr.columbia.edu> Subject: Re: the fs fun never stops To: Ben Rosengart Date: Sun, 20 Sep 1998 15:22:50 -0400 (EDT) Cc: current@FreeBSD.org [Ben µoªí¤F¤U­±ªº panic °T®§] > Fatal trap 12: page fault while in kernel mode > fault virtual address = 0x40 > fault code = supervisor read, page not present > instruction pointer = 0x8:0xf014a7e5 ^^^^^^^^^^ > stack pointer = 0x10:0xf4ed6f24 > frame pointer = 0x10:0xf4ed6f28 > code segment = base 0x0, limit 0xfffff, type 0x1b > = DPL 0, pres 1, def32 1, gran 1 > processor eflags = interrupt enabled, resume, IOPL = 0 > current process = 80 (mount) > interrupt mask = > trap number = 12 > panic: page fault ·í§A¬Ý¨ì¹³³o¼Ëªº°T®§®É¡A¥u§â¥¦«þ¤@¥÷°e¤W¨Ó¬O¤£°÷ªº¡C§Ú¦b¤W­± ¯S¦a¼Ð©úªº instruction pointer ­È¬Û·í­«­n¡A¤£©¯ªº¬O¥¦·|¦]³]©w¦Ó ¤£¦P¡C´«¥y¸Ü»¡¡A³o­Ó­È·|¸ò§A¥Îªº kernel image ÀɦÓÅÜ°Ê¡C¦pªG¬O¥Î ¬Y­Ó snapshot ª©¥»ªº GENERIC kernel¡A¤]³\¨ä¥L¤H¥i¥H°lÂܨì¥X°ÝÃD ªº¨ç¦¡¡A¦ý¦pªG§A¬O¥Î¦Û­qªº kernel¡A¨º»ò¥u¦³ §A¤~¯à§i¶D§Ú­Ì°ÝÃD¥X¦b¨º¸Ì¡C ­n°µªº¨Æ¥]¬A³o¨Ç¡G §â instruction pointer ªº­È°O¤U¨Ó¡Cª`·N¦b«e­±ªº 0x8: ¦b³o­Ó±¡ªp¤¤¨Ã¤£­«­n¡A§Ú­Ì­nªº¬O 0xf0xxxxxx¡C ·í¨t²Î­«·s¶}¾÷«á¡A°õ¦æ³o¹D©R¥O¡G &prompt.user; nm -n /(³y¦¨ panic ªº kernel ÀÉ®×) | grep f0xxxxxx ¨ä¤¤ f0xxxxxx ´N¬O°O¤U¨Óªº instruction pointer ­È¡C¦³¥i¯à¤£·|­è¦n§ä¨ì§¹¾ãªº³o­Ó¦r¦ê¡A ³o¬O¦]¬° kernel symbol table ¸Ìªº¦U­Ó symbol ¥u¬O¨ç¦¡ªº¶i ¤JÂI¡A¦ý instruction pointer ©Ò«üªº¦ì§}¦³¥i¯à¬O¦b¨ç¦¡¤ºªº ¬Y¤@³B¡A¦Ó¤£¤@©w¦b¶}ÀY¡C©Ò¥H¦pªG§ä¤£¨ì¾ã­Ó¦r¦ê¡A¨º»ò§â instruction pointer ­Èªº³Ì«á¤@­Ó¼Æ¦r®³±¼¡A¦A¸Õ¤@¦¸¡G &prompt.user; nm -n /(³y¦¨ panic ªº kernel ÀÉ®×) | grep f0xxxxx ¦pªG³o¼Ë¤]§ä¤£¨ì¡A¨º´N§â¥t¤@­Ó¼Æ¦r¥h±¼¦A§ä¡A¤@ª½­«½Æ¨ì§ä¨ì ¬°¤î¡A µ²ªG¬O¤@¦ê¥i¯à³y¦¨ panic ªº¨ç¦¡¦Cªí¡C³o¼Ë¤ñª½±µ§ä¨ì ¥X°ÝÃDªº¨ç¦¡¨Ó±o®t¡A¦ý¦Ü¤Ö¦n¹L¤°»ò³£¨S¦³¡C §Ú±`±`¬Ý¨ì¤H­ÌÅã¥Ü¤@¤j¤ù panic °T®§¡A¦ý«Ü¤Ö¬Ý¨ì¦³¤Hªá¤@ÂI®É¶¡ §â instruction pointer ©M kernel symbol table ¤¤ªº¨ç¦¡¤ñ¸û¤@¤U¡C ­n°lÂÜ¥X³y¦¨ panic ­ì¦]ªº³Ì¦n¤èªk¬O¥ý°µ¥X crash dump¡AµM«á¥Î &man.gdb.1; ¦b¤W­±°µ stack trace¡C ¤£ºÞ¬O¨º¤@ºØ¡A§Ú³q±`¬O¥Î³o­Ó¤èªk¡G ¼g¦n kernel ³]©wÀÉ¡C¦pªG§A»Ý­n¥Î kernel debugger¡A¦b³] ©wÀɤ¤¥[¤W options DDB ³o­Ó¿ï¶µ¡C (·í§ÚÃhºÃ¦³¥X²{µL½a°j°é®É¡A³q±`·|¥Î³o­Ó¨Ó³]©w¤¤Â_ÂI¡C) ¥Î config -g KERNELCONFIG °µ¥X¥Î¨Ó½sĶªº¥Ø¿ý¡C cd /sys/compile/ KERNELCONFIG; make µ¥«Ý kernel ½sĶµ²§ô¡C make install ­«·s¶}¾÷ &man.make.1; ±N·|»s³y¥X¨â­Ó kernel¡Ckernel ÁÙ¦³ kernel.debug¡C kernel ±N·|³Q¦w¸Ë¨ì /kernel¡A¦Ó kernel.debug ¥i¥Î¨Óµ¹ &man.gdb.1; ·í§@ debugging symbols ªº¨Ó·½¡C ­n½T©w¯à§ì¨ì crash dump¡A¥ý½s¿è /etc/rc.conf ±N dumpdev «ü ¨ì swap ¤À³Î°Ï¡C³o¼Ë &man.rc.8; ·|¥Î &man.dumpon.8; ¨Ó±Ò°Ê crash dump¡A§A¤]¥i¥H¤â°Ê°õ¦æ &man.dumpon.8; ¦b panic ¤§«á¡A crash dump ¥i¥H¥Î &man.savecore.8; ¦s°_¨Ó¡F¦pªG /etc/rc.conf ¸Ì¦³³] dumpdev ¨º»ò­«·s¶}¾÷«á &man.rc.8; ·|¦Û°Ê°õ¦æ &man.savecore.8; §â crash dump ¦s¦b /var/crash¡C FreeBSD ªº crash dump ³q±`©M¾÷¾¹¸Ìªº¹ê»Ú°O¾ÐÅé¤@¼Ë¤j¡A´N ¹³¦pªG¦³ 64MB °O¾ÐÅé¡Acrash dump ¤j¤p´N¬O 64MB¡C©Ò¥H­n½T©w /var/crash ¤U¦³¨¬°÷ªºªÅ¶¡¡A©Î¬O¥i¥H¤â °Ê°õ¦æ &man.savecore.8; §â crash dump ©ñ¨ì¥t¤@­ÓªÅ¶¡¸û°÷ªº ¥Ø¿ý¤U¡C¥t¤@ºØ¤]³\¥i¥H­­¨î crash dump ªº¤èªk¡A¬O¦b kernel ³]©wÀɤ¤¥Î options MAXMEM=(foo)¡A±N kernel ¥i¥Îªº°O¾ÐÅé­­¨î¦b¦X²zªº¤j¤p¡CÁ|¨Ò¨Ó»¡¡A¦pªG§A¦³ 128MB ªº°O¾Ð Åé¡A¦ý¬O¥i¥H­­¨î kernel ¥u¯à¥Î 16MB ªº°O¾ÐÅé¡A³o¼Ë crash dump ´N¬O 16MB ¦Ó¤£¬O 128MB ¤F¡C ¤@¥¹µo²{¦³¤F crash dump¡A´N¥i¥H¥Î &man.gdb.1; ¨Ó°µ stack trace ¡A¦p¤U©Ò¥Ü¡G &prompt.user; gdb -k /sys/compile/KERNELCONFIG/kernel.debug /var/crash/vmcore.0 (gdb) where ­nª`·N¥i¯à·|¥X²{¦n´X­Ó¿Ã¹õªº¥i¥Î¸ê°T¡A§A¥i¥H¥Î &man.script.1; §â©Ò¦³¿é¥X³£¦s°_¨Ó¡C¥Î¥]¬A©Ò¦³ debug symbol ªº kernel ¨Ó°£¿ù¡A³o ¼ËÀ³¸Ó¥i¥Hª½±µÅã¥Ü panic ¬Oµo¥Í¦b¨º¤@¦æ¡C³q±`¬O¥Ñ¤U©¹¤WŪ stack strace¡A³o¼Ë¤~¯à¤@­Ó­Ó°lÂÜ¥X¦³­þ¨Ç°Ê§@¤Þ¨ì crash¡C¤]¥i¥H¥Î &man.gdb.1; §â¦UºØÅܼƩε²ºcªº¤º®e¦L¥X¨Ó¡A¥HÀˬd¨t²Î crash ®Éªº ¹ê»Úª¬ºA¡C ¦n°Õ¡A¦pªG§A¦³²Ä¤G¥x¹q¸£¦Ó¥B¦³°÷ºÆ¨g¡A¥i¥H±N &man.gdb.1; ³]©w ¦¨»·ºÝ°£¿ù¡C³o¼Ë§A¥i¥H¦b¤@¥x¾÷¾¹¤¤¥Î &man.gdb.1; ¥h°£¿ù¥t¤@¥x¸Ìªº kernel¡A¥i¥H°õ¦æªº¥]¬A³]©w¤¤Â_ÂI¡B¦b kernel ­ì©l½X¤¤¤@¨B¨B°õ¦æµ¥ µ¥¡A´N¹³¦b¤@¯ë¨Ï¥ÎªÌµ{¦¡¤W°£¿ù¤@¼Ë¡C¥Ñ©ó¨S¦³¤°»ò¾÷·|¬°°£¿ù¦Ó³]¸m ¨â¥x¨Ã¾F¹q¸£¡A©Ò¥H§ÚÁÙ¨S¦³³o¼Ëª±¹L¡C [Bill ¸É¥R¡G"§Ú§Ñ¤F´£¨ì¤@ÂI¡G¦pªG§A¦³±Ò°Ê DDB ¦Ó kernel ¤]¤w¸g¶i¤J°£¿ù¾¹¡A¥i¥H¦b DDB ©R¥O¦C¤U¥´ 'panic'¡A±j­¢²£¥Í panic (ÁÙ¦³ crash dump)¡C¤]¦³¥i¯à¦b panic ¶¥¬q®É¦A¶i¤J°£¿ù¾¹¡A ¦pªG³o¼Ëªº¸Ü¡A¿é¤J 'continue'¡A±µµÛ¥¦´N·|§¹¦¨ crash dump¡C" -ed] ¬°¤°»ò dlsym() ¤£¯à¾Þ§@ ELF °õ¦æÀÉ¡H ¦b ELF ¤@¨t¦Cªº¤u¨ã¤¤¡A¤º©w¬O¤£·|Åý dynamic linker ¬Ý¨ì°õ¦æ Àɸ̩w¸q¤F­þ¨Ç symbol¡C©Ò¥H dlsym() ¨S¦³¿ì ªk¥ÎÂǥѩI¥s dlopen(NULL, flags) ¨ú±oªº handle¡A¥Î¥¦¥h·j´M¦³¨º¨Ç symbol ¤@©w·|¥¢±Ñ¡C ¦pªG§A·Q­n¥Î dlsym() §ä¥X¬Y­Ó process ªº¥D°õ¦æÀɤ¤¦³­þ¨Ç symbol¡A«h­n¦b link ®É¹ï ELF linker (&man.ld.1;) ¥[¤W ³o­Ó°Ñ¼Æ¡C §Ú­n¦p¦ó¼W¥[©Î´î¤Ö kernel ¯à©w§}ªºªÅ¶¡¡H ¹w³]­È¬O¡AFreeBSD 3.x ªº kernel ¥i¥H©w§}ªºªÅ¶¡¬O 256 MB ¦Ó FreeBSD 4.x ¥i¥H¨ì 1 GB¡C¦pªG¬Oºô¸ô­t²ü¬Û·í­«ªº¦øªA¾¹ (¨Ò¦p¤j«¬ FTP ©Î HTTP ¦øªA¾¹)¡A§A¤]³\·|µo²{ 256 MB ¥i¯à¤£¤j°÷¡C ©Ò¥H¡A­n¦p¦ó¼W¥[©w§}ªÅ¶¡©O¡H­n±q¨â¤è­±µÛ¤â¡C­º¥ý­º¥ý§i¶D kernel ¥»¨­­n«O¯d¸û¤jªÅ¶¡µ¹¦Û¤v¡C¨ä¦¸¡A¬JµM¬O¦b©w§}ªÅ¶¡ªº³Ì¤W ­±¸ü¤J kernel¡A©Ò¥HÁÙ­n½Õ§C¸ü¤Jªº¦ì§}¡A¤~¤£·|©M«e­±©w§}ªº½d³ò ­«Å|¡C ¼W¥[ src/sys/i386/include/pmap.h ¸Ìªº NKPDE ´N¥i¥H¹F¦¨²Ä¤@­Ó¥Ø¼Ð¡C1 GB ªº©w§}ªÅ¶¡·| ¹³³o¼Ë¡G #ifndef NKPDE #ifdef SMP #define NKPDE 254 /* addressable number of page tables/pde's */ #else #define NKPDE 255 /* addressable number of page tables/pde's */ #endif /* SMP */ #endif ­nºâ¥X NKPDE ªº¥¿½T­È¡A±N·Q­nªºªÅ¶¡¤j¤p (¥H megabyte ¬°³æ¦ì)°£¥H 4¡A±µµÛ³æ CPU ¾÷¾¹´î 1¡A Âù CPU «h¬O´î 2¡C ­n¸Ñ¨M²Ä¤G­Ó°ÝÃD¡A¥²¶·¦Û¦æºâ¥X kernel ³Q¸ü¤Jªº¦ì§}¡G¨D¥X 0x100100000 ´î±¼©w§}ªÅ¶¡¤j¤pªº­È(¥H byte ¬°³æ¦ì)¡A¦p 1 GB ¤j¤p´N¬O 0xc0100000¡C§âsrc/sys/i386/conf/Makefile.i386 ¸Ìªº LOAD_ADDRESS ³]¦¨³o­Ó­È¡Q±µµÛ¦b src/sys/i386/conf/kernel.script ¤¤¡A±N section ¦Cªí³Ì«e­±ªº location counter ³]¦¨¬Û¦Pªº­È¡A¦p¤U¡G OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") OUTPUT_ARCH(i386) ENTRY(btext) SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/obj/elf/home/src/tmp/usr/i386-unknown-freebsdelf/lib); SECTIONS { /* Read-only sections, merged into text segment: */ . = 0xc0100000 + SIZEOF_HEADERS; .interp : { *(.interp) } µM«á­«·s½sĶ±zªº kernel¡C±z¥i¯à·|¦b°õ¦æ &man.ps.1;¡B&man.top.1; ³oÃþªºµ{¦¡®É¸I¨ì°ÝÃD¡Qmake world À³¸Ó´N¥i¥H¸Ñ¨M (©Î§â§ï¹Lªº pmap.h ½Æ»s¨ì /usr/include/vm/ ¤U¡A¦A¤â°Ê½sĶ libkvm¡A&man.ps.1; ÁÙ¦³ &man.top.1;)¡C ª`·N¡Gkernel ©Ò¯à©w§}ªºªÅ¶¡¤j¤p¥²¶·¬O 4 megabytes ªº­¿¼Æ¡C [&a.dg; ¸É¥R¡G§Ú»{¬° kernel ©w§}ªÅ¶¡¤j¤pÀ³¸Ó­n¬O 2 ªº­¼¾­¡A¦ý¤£¤j½T©w³o¤@ÂI¡Cªº±Ò°Êµ{¦¡·|°Ê¨ì high order address bits¡A°O±o¥¦°²³]¦Ü¤Ö¦³ 256 MB¡C]
Vanilla Shu
vanilla@FreeBSD.org
·PÁÂ
FreeBSD Core Team °²¦p±z¦b³o¥÷ FAQ ¤¤§ä¨ì¿ù»~ªº¦a¤è¡A©Î¬O±z·Q¼W¥[¨Ç¬Æ»ò¡A ½Ð¼g«Ê«H¨ì &a.faq; ¡C§Ú­Ì«D±`·PÁ±zªº«Øij¡A ¦]¬°±zªº«ØijÅý³o¥÷¤å¥óÅܱo§ó¦n¡I
&a.jkh; ¤£°±ªº§ó·s¹L®Éªº FAQ &a.dwhite; ¸g±`¦b freebsd-questions ¤W¦^µª°ÝÃD &a.joerg; ¸g±`¦b Usenet ¤W¦^µª°ÝÃD &a.wollman; Networking and formatting Jim Lowe Multicast information &a.pds; FreeBSD FAQ ³o¥÷¤å¥óªº¥´¦r­W¤u The FreeBSD Team Kvetching, moaning, submitting data ¹ï©ó¨º¨Ç´¿¸g¹ï³o¥÷ FAQ ´£¨ÑÀ°§U¡A¦Ó§Ú­Ì¨S´£¨ìªº¤H­Ì¡A §Ú­Ì¥Ñ°Jªº·PÁ±z¡I
&bibliography;
diff --git a/zh_TW.Big5/books/fdp-primer/see-also/chapter.sgml b/zh_TW.Big5/books/fdp-primer/see-also/chapter.sgml index ab689d847c..add75bf067 100644 --- a/zh_TW.Big5/books/fdp-primer/see-also/chapter.sgml +++ b/zh_TW.Big5/books/fdp-primer/see-also/chapter.sgml @@ -1,135 +1,135 @@ - See Also + ¥L¤s¤§¥Û This document is deliberately not an exhaustive discussion of SGML, the DTDs listed, and the FreeBSD Documentation Project. For more information about these, you are encouraged to see the following web sites. The FreeBSD Documentation Project The FreeBSD Documentation Project web pages The FreeBSD Handbook SGML The SGML/XML web page, a comprehensive SGML resource Gentle introduction to SGML HTML The World Wide Web Consortium The HTML 4.0 specification DocBook The DocBook Technical Committee, maintainers of the DocBook DTD DocBook: The Definitive Guide, the online documentation for the DocBook DTD. The DocBook Open Repository contains DSSSL stylesheets and other resources for people using DocBook. The Linux Documentation Project The Linux Documentation Project web pages diff --git a/zh_TW.Big5/books/fdp-primer/translations/chapter.sgml b/zh_TW.Big5/books/fdp-primer/translations/chapter.sgml index 89a2adaa66..7743dbcac0 100644 --- a/zh_TW.Big5/books/fdp-primer/translations/chapter.sgml +++ b/zh_TW.Big5/books/fdp-primer/translations/chapter.sgml @@ -1,456 +1,454 @@ ½Ķ®Éªº±`¨£°ÝÃD ¥»³¹¬O½Ķ FreeBSD ¤å¥ó(¥]§t¡GFAQ, Handbook, tutorials, manual pagesµ¥)ªº±`¨£°ÝÃD(FAQ)¡C It is very heavily based on the translation FAQ from the FreeBSD German Documentation Project, originally written by Frank Gründer elwood@mc5sys.in-berlin.de and translated back to English by Bernd Warken bwarken@mayn.de. The FAQ is maintained by the &a.doceng;. - Why a FAQ? + FAQ ªº¥Øªº¬O? - More and more people are approaching the freebsd-doc mailing - list and volunteering to translate FreeBSD documentation to other - languages. This FAQ aims to answer their questions so they can start - translating documentation as quickly as possible. + ÀHµÛ¶V¨Ó¶V¦h¤H°Ñ»P freebsd-doc ¶l»¼½×¾Â¡A¦Ó¥B§Æ±æ±N FreeBSD ¤å¥ó½Ķ¬°¦UºØ»y¨¥ª©¥»¡C + §Ú­Ì§Æ±æ³o¥÷ FAQ ¯à¾¨¥i¯à¬°³o¨Ç°Ñ»P½ĶªÌ´£¨Ñ§Ö³tªº¸Ñ´b¡C What do i18n and l10n mean? i18n means internationalization and l10n means localization. They are just a convenient shorthand. i18n can be read as i followed by 18 letters, followed by n. Similarly, l10n is l followed by 10 letters, followed by n. Is there a mailing list for translators? Yes. Different translation groups have their own mailing lists. The list of translation projects has more information about the mailing lists and web sites run by each translation project. Are more translators needed? Yes. The more people work on translation the faster it gets done, and the faster changes to the English documentation are mirrored in the translated documents. You do not have to be a professional translator to be able to help. What languages do I need to know? Ideally, you will have a good knowledge of written English, and obviously you will need to be fluent in the language you are translating to. English is not strictly necessary. For example, you could do a Hungarian translation of the FAQ from the Spanish translation. What software do I need to know? It is strongly recommended that you maintain a local copy of the FreeBSD CVS repository (at least the documentation part) either using CTM or CVSup. The "Staying current with FreeBSD" chapter in the Handbook explains how to use these applications. You should be comfortable using CVS. This will allow you to see what has changed between different versions of the files that make up the documentation. [XXX To Do -- write a tutorial that shows how to use CVSup to get just the documentation, check it out, and see what has changed between two arbitrary revisions] How do I find out who else might be translating to the same language? The Documentation Project translations page lists the translation efforts that are currently known about. If others are already working on translating documentation to your language, please do not duplicate their efforts. Instead, contact them to see how you can help. If no one is listed on that page as translating for your language, then send a message to the &a.doc; in case someone else is thinking of doing a translation, but has not announced it yet. No one else is translating to my language. What do I do? Congratulations, you have just started the FreeBSD your-language-here Documentation Translation Project. Welcome aboard. First, decide whether or not you have got the time to spare. Since you are the only person working on your language at the moment it is going to be your responsibility to publicize your work and coordinate any volunteers that might want to help you. Write an email to the Documentation Project mailing list, announcing that you are going to translate the documentation, so the Documentation Project translations page can be maintained. If there is already someone in your country providing FreeBSD mirroring services you should contact them and ask if you can have some webspace for your project, and possibly an email address or mailing list services. Then pick a document and start translating. It is best to start with something fairly small—either the FAQ, or one of the tutorials. I have translated some documentation, where do I send it? That depends. If you are already working with a translation team (such as the Japanese team, or the German team) then they will have their own procedures for handling submitted documentation, and these will be outlined on their web pages. If you are the only person working on a particular language (or you are responsible for a translation project and want to submit your changes back to the FreeBSD project) then you should send your translation to the FreeBSD project (see the next question). I am the only person working on translating to this language, how do I submit my translation? or We are a translation team, and want to submit documentation that our members have translated for us? First, make sure your translation is organized properly. This means that it should drop into the existing documentation tree and build straight away. Currently, the FreeBSD documentation is stored in a top level directory called doc/. Directories below this are named according to the language code they are written in, as defined in ISO639 (/usr/share/misc/iso639 on a version of FreeBSD newer than 20th January 1999). If your language can be encoded in different ways (for example, Chinese) then there should be directories below this, one for each encoding format you have provided. Finally, you should have directories for each document. For example, a hypothetical Swedish translation might look like: doc/ sv_SE.ISO8859-1/ Makefile books/ faq/ Makefile book.sgml sv_SE.ISO8859-1 is the name of the translation, in lang.encoding form. Note the two Makefiles, which will be used to build the documentation. Use &man.tar.1; and &man.gzip.1; to compress up your documentation, and send it to the project. &prompt.user; cd doc &prompt.user; tar cf swedish-docs.tar sv &prompt.user; gzip -9 swedish-docs.tar Put swedish-docs.tar.gz somewhere. If you do not have access to your own webspace (perhaps your ISP does not let you have any) then you can email &a.doceng;, and arrange to email the files when it is convenient. Either way, you should use &man.send-pr.1; to submit a report indicating that you have submitted the documentation. It would be very helpful if you could get other people to look over your translation and double check it first, since it is unlikely that the person committing it will be fluent in the language. Someone (probably the Documentation Project Manager, currently &a.doceng;) will then take your translation and confirm that it builds. In particular, the following things will be looked at: Do all your files use RCS strings (such as "ID")? Does make all in the sv_SE.ISO8859-1 directory work correctly? Does make install work correctly? If there are any problems then whoever is looking at the submission will get back to you to work them out. If there are no problems your translation will be committed as soon as possible. Can I include language or country specific text in my translation? We would prefer that you did not. For example, suppose that you are translating the Handbook to Korean, and want to include a section about retailers in Korea in your Handbook. There is no real reason why that information should not be in the English (or German, or Spanish, or Japanese, or …) versions as well. It is feasible that an English speaker in Korea might try - and pick up a copy of FreeBSD whilst over there. It also helps + to pick up a copy of FreeBSD whilst over there. It also helps increase FreeBSD's perceived presence around the globe, which is not a bad thing. If you have country specific information, please submit it as a change to the English Handbook (using &man.send-pr.1;) and then translate the change back to your language in the translated Handbook. Thanks. How should language specific characters be included? Non-ASCII characters in the documentation should be included using SGML entities. Briefly, these look like an ampersand (&), the name of the entity, and a semi-colon (;). The entity names are defined in ISO8879, which is in the ports tree as textproc/iso8879. A few examples include: Entity Appearance Description &eacute; é Small e with an acute accent &Eacute; É Large E with an acute accent &uuml; ü Small u with an umlaut After you have installed the iso8879 port, the files in /usr/local/share/sgml/iso8879 contain the complete list. Addressing the reader In the English documents, the reader is addressed as you, there is no formal/informal distinction as there is in some languages. If you are translating to a language which does distinguish, use whichever form is typically used in other technical documentation in your language. If in doubt, use a mildly polite form. Do I need to include any additional information in my translations? Yes. The header of the English version of each document will look something like this: <!-- The FreeBSD Documentation Project $FreeBSD: doc/en_US.ISO8859-1/books/fdp-primer/translations/chapter.sgml,v 1.5 2000/07/07 18:38:38 dannyboy Exp $ --> The exact boilerplate may change, but it will always include a $FreeBSD$ line and the phrase The FreeBSD Documentation Project. Note that the $FreeBSD part is expanded automatically by CVS, so it should be empty (just $FreeBSD$) for new files. Your translated documents should include their own $FreeBSD$ line, and change the FreeBSD Documentation Project line to The FreeBSD language Documentation Project. In addition, you should add a third line which indicates which revision of the English text this is based on. So, the Spanish version of this file might start: <!-- The FreeBSD Spanish Documentation Project $FreeBSD: doc/es_ES.ISO8859-1/books/fdp-primer/translations/chapter.sgml,v 1.3 1999/06/24 19:12:32 jesusr Exp $ Original revision: 1.11 --> diff --git a/zh_TW.Big5/books/handbook/Makefile b/zh_TW.Big5/books/handbook/Makefile index 0f4c36edbc..d7b6509d6b 100644 --- a/zh_TW.Big5/books/handbook/Makefile +++ b/zh_TW.Big5/books/handbook/Makefile @@ -1,255 +1,255 @@ # -# $FreeBSD$ +# $FreeBSD$ # Original revision: 1.97 # # Build the FreeBSD Handbook. # # ------------------------------------------------------------------------ # # Handbook-specific variables # # WITH_PGPKEYS The print version of the handbook only prints PGP # fingerprints by default. If you would like for the # entire key to be displayed, then set this variable. # This option has no affect on the HTML formats. # # Handbook-specific targets # # pgpkeyring This target will read the contents of # pgpkeys/chapter.sgml and will extract all of # the pgpkeys to standard out. This output can then # be redirected into a file and distributed as a # public keyring of FreeBSD developers that can # easily be imported into PGP/GPG. # # ------------------------------------------------------------------------ .PATH: ${.CURDIR}/../../share/sgml/glossary MAINTAINER= doc@FreeBSD.org DOC?= book FORMATS?= html-split HAS_INDEX= true USE_PS2PDF= yes INSTALL_COMPRESSED?= gz INSTALL_ONLY_COMPRESSED?= IMAGES_EN = advanced-networking/isdn-bus.eps IMAGES_EN+= advanced-networking/isdn-twisted-pair.eps IMAGES_EN+= advanced-networking/natd.eps IMAGES_EN+= advanced-networking/net-routing.pic IMAGES_EN+= advanced-networking/static-routes.pic IMAGES_EN+= geom/striping.pic IMAGES_EN+= install/adduser1.scr IMAGES_EN+= install/adduser2.scr IMAGES_EN+= install/adduser3.scr IMAGES_EN+= install/boot-mgr.scr IMAGES_EN+= install/console-saver1.scr IMAGES_EN+= install/console-saver2.scr IMAGES_EN+= install/console-saver3.scr IMAGES_EN+= install/console-saver4.scr IMAGES_EN+= install/desktop.scr IMAGES_EN+= install/disklabel-auto.scr IMAGES_EN+= install/disklabel-ed1.scr IMAGES_EN+= install/disklabel-ed2.scr IMAGES_EN+= install/disklabel-fs.scr IMAGES_EN+= install/disklabel-root1.scr IMAGES_EN+= install/disklabel-root2.scr IMAGES_EN+= install/disklabel-root3.scr IMAGES_EN+= install/disk-layout.eps IMAGES_EN+= install/dist-set.scr IMAGES_EN+= install/dist-set2.scr IMAGES_EN+= install/docmenu1.scr IMAGES_EN+= install/ed0-conf.scr IMAGES_EN+= install/ed0-conf2.scr IMAGES_EN+= install/edit-inetd-conf.scr IMAGES_EN+= install/fdisk-drive1.scr IMAGES_EN+= install/fdisk-drive2.scr IMAGES_EN+= install/fdisk-edit1.scr IMAGES_EN+= install/fdisk-edit2.scr IMAGES_EN+= install/ftp-anon1.scr IMAGES_EN+= install/ftp-anon2.scr IMAGES_EN+= install/hdwrconf.scr IMAGES_EN+= install/keymap.scr IMAGES_EN+= install/main1.scr IMAGES_EN+= install/mainexit.scr IMAGES_EN+= install/main-std.scr IMAGES_EN+= install/main-options.scr IMAGES_EN+= install/main-doc.scr IMAGES_EN+= install/main-keymap.scr IMAGES_EN+= install/media.scr IMAGES_EN+= install/mouse1.scr IMAGES_EN+= install/mouse2.scr IMAGES_EN+= install/mouse3.scr IMAGES_EN+= install/mouse4.scr IMAGES_EN+= install/mouse5.scr IMAGES_EN+= install/mouse6.scr IMAGES_EN+= install/mta-main.scr IMAGES_EN+= install/net-config-menu1.scr IMAGES_EN+= install/net-config-menu2.scr IMAGES_EN+= install/nfs-server-edit.scr IMAGES_EN+= install/ntp-config.scr IMAGES_EN+= install/options.scr IMAGES_EN+= install/pkg-cat.scr IMAGES_EN+= install/pkg-confirm.scr IMAGES_EN+= install/pkg-install.scr IMAGES_EN+= install/pkg-sel.scr IMAGES_EN+= install/probstart.scr IMAGES_EN+= install/routed.scr IMAGES_EN+= install/security.scr IMAGES_EN+= install/sysinstall-exit.scr IMAGES_EN+= install/timezone1.scr IMAGES_EN+= install/timezone2.scr IMAGES_EN+= install/timezone3.scr IMAGES_EN+= install/userconfig.scr IMAGES_EN+= install/userconfig2.scr IMAGES_EN+= install/xf86setup.scr IMAGES_EN+= mail/mutt1.scr IMAGES_EN+= mail/mutt2.scr IMAGES_EN+= mail/mutt3.scr IMAGES_EN+= mail/pine1.scr IMAGES_EN+= mail/pine2.scr IMAGES_EN+= mail/pine3.scr IMAGES_EN+= mail/pine4.scr IMAGES_EN+= mail/pine5.scr IMAGES_EN+= install/example-dir1.eps IMAGES_EN+= install/example-dir2.eps IMAGES_EN+= install/example-dir3.eps IMAGES_EN+= install/example-dir4.eps IMAGES_EN+= install/example-dir5.eps IMAGES_EN+= security/ipsec-network.pic IMAGES_EN+= security/ipsec-crypt-pkt.pic IMAGES_EN+= security/ipsec-encap-pkt.pic IMAGES_EN+= security/ipsec-out-pkt.pic IMAGES_EN+= vinum/vinum-concat.pic IMAGES_EN+= vinum/vinum-mirrored-vol.pic IMAGES_EN+= vinum/vinum-raid10-vol.pic IMAGES_EN+= vinum/vinum-raid5-org.pic IMAGES_EN+= vinum/vinum-simple-vol.pic IMAGES_EN+= vinum/vinum-striped-vol.pic IMAGES_EN+= vinum/vinum-striped.pic # Images from the cross-document image library IMAGES_LIB= callouts/1.png IMAGES_LIB+= callouts/2.png IMAGES_LIB+= callouts/3.png IMAGES_LIB+= callouts/4.png IMAGES_LIB+= callouts/5.png IMAGES_LIB+= callouts/6.png IMAGES_LIB+= callouts/7.png IMAGES_LIB+= callouts/8.png IMAGES_LIB+= callouts/9.png IMAGES_LIB+= callouts/10.png # # SRCS lists the individual SGML files that make up the document. Changes # to any of these files will force a rebuild # # SGML content SRCS+= audit/chapter.sgml SRCS+= book.sgml SRCS+= colophon.sgml SRCS+= freebsd-glossary.sgml SRCS+= advanced-networking/chapter.sgml SRCS+= basics/chapter.sgml SRCS+= bibliography/chapter.sgml SRCS+= boot/chapter.sgml SRCS+= config/chapter.sgml SRCS+= cutting-edge/chapter.sgml SRCS+= desktop/chapter.sgml SRCS+= disks/chapter.sgml SRCS+= eresources/chapter.sgml SRCS+= firewalls/chapter.sgml SRCS+= geom/chapter.sgml SRCS+= install/chapter.sgml SRCS+= introduction/chapter.sgml SRCS+= kernelconfig/chapter.sgml SRCS+= l10n/chapter.sgml SRCS+= linuxemu/chapter.sgml SRCS+= mac/chapter.sgml SRCS+= mail/chapter.sgml SRCS+= mirrors/chapter.sgml SRCS+= multimedia/chapter.sgml SRCS+= network-servers/chapter.sgml SRCS+= pgpkeys/chapter.sgml SRCS+= ports/chapter.sgml SRCS+= ppp-and-slip/chapter.sgml SRCS+= preface/preface.sgml SRCS+= printing/chapter.sgml SRCS+= security/chapter.sgml SRCS+= serialcomms/chapter.sgml SRCS+= users/chapter.sgml SRCS+= vinum/chapter.sgml SRCS+= x11/chapter.sgml # Entities SRCS+= chapters.ent SYMLINKS= ${DESTDIR} index.html handbook.html # Turn on all the chapters. CHAPTERS?= ${SRCS:M*chapter.sgml} SGMLFLAGS+= ${CHAPTERS:S/\/chapter.sgml//:S/^/-i chap./} SGMLFLAGS+= -i chap.freebsd-glossary pgpkeyring: pgpkeys/chapter.sgml @${JADE} -V nochunks ${OTHERFLAGS} ${JADEOPTS} -d ${DSLPGP} -t sgml ${MASTERDOC} # # Handbook-specific variables # .if defined(WITH_PGPKEYS) JADEFLAGS+= -V withpgpkeys .endif URL_RELPREFIX?= ../../../.. DOC_PREFIX?= ${.CURDIR}/../../.. # # rules generating lists of mirror site from XML database. # XMLDOCS= mirrors-ftp:::mirrors.sgml.ftp.inc.tmp \ mirrors-cvsup:::mirrors.sgml.cvsup.inc.tmp \ eresources:::eresources.sgml.www.inc.tmp DEPENDSET.DEFAULT= transtable mirror XSLT.DEFAULT= ${XSL_MIRRORS} XML.DEFAULT= ${XML_MIRRORS} NO_TIDY.DEFAULT= yes PARAMS.mirrors-ftp+= --param 'type' "'ftp'" \ --param 'proto' "'ftp'" \ --param 'target' "'handbook/mirrors/chapter.sgml'" PARAMS.mirrors-cvsup+= --param 'type' "'cvsup'" \ --param 'proto' "'cvsup'" \ --param 'target' "'handbook/mirrors/chapter.sgml'" PARAMS.eresources+= --param 'type' "'www'" \ --param 'proto' "'http'" \ --param 'target' "'handbook/eresources/chapter.sgml'" SRCS+= mirrors.sgml.ftp.inc \ mirrors.sgml.cvsup.inc \ eresources.sgml.www.inc CLEANFILES+= mirrors.sgml.ftp.inc mirrors.sgml.ftp.inc.tmp \ mirrors.sgml.cvsup.inc mirrors.sgml.cvsup.inc.tmp \ eresources.sgml.www.inc eresources.sgml.www.inc.tmp .include "${DOC_PREFIX}/share/mk/doc.project.mk" .for p in ftp cvsup mirrors.sgml.${p}.inc: mirrors.sgml.${p}.inc.tmp ${SED} -e 's,<\([^ >]*\)\([^>]*\)/>,<\1\2>,;s,,,'\ < $@.tmp > $@ || (${RM} -f $@ && false) .endfor eresources.sgml.www.inc: eresources.sgml.www.inc.tmp ${SED} -e 's,<\([^ >]*\)\([^>]*\)/>,<\1\2>,;s,,,'\ < $@.tmp > $@ || (${RM} -f $@ && false) diff --git a/zh_TW.Big5/books/handbook/audit/chapter.sgml b/zh_TW.Big5/books/handbook/audit/chapter.sgml index ceb4525a83..36bdcef9df 100644 --- a/zh_TW.Big5/books/handbook/audit/chapter.sgml +++ b/zh_TW.Big5/books/handbook/audit/chapter.sgml @@ -1,531 +1,571 @@ - - - Tom Rhodes Written by - Kernel Event Auditing + Security Event Auditing Synopsis AUDIT - Kernel Event Auditing + Security Event Auditing MAC - The &os; 6.0 operating system release has included + The &os; 7-CURRENT development branch includes support for Event Auditing based on the &posix;.1e draft and - the &sun; BSM implementation. Event auditing - permits the selective logging of security-relevant system events - for the purposes of system analysis, system monitoring, and - security evaluation. + Sun's published BSM API and file format. + Event auditing permits the selective logging of security-relevant + system events for the purposes of post-mortem analysis, system + monitoring, and intrusion detection. After some settling time in + &os; 7-CURRENT, this support will be merged to &os; 6-STABLE + and appear in subsequent releases. + + + The audit facility in FreeBSD is considered experimental, and + production deployment should occur only after careful consideration + of the risks of deploying experimental software. + This chapter will focus mainly on the installation and configuration of Event Auditing. Explanation of audit policies, and an example configuration will be provided for the convenience of the reader. After reading this chapter, you will know: What Event Auditing is and how it works. How to configure Event Auditing on &os; for users and processes. Before reading this chapter, you should: Understand &unix; and &os; basics (). Be familiar with the basics of kernel configuration/compilation (). Have some familiarity with security and how it pertains to &os; (). Event auditing can generate a great deal of log file - data, exceeding gigabytes a week in some configurations. An administrator - should read this chapter in its entirety to avoid possible - self inflicted DoS attacks due to improper - configuration. + data, exceeding gigabytes a week in some configurations. An + administrator should read this chapter in its entirety to avoid + possible self-inflicted DoS attacks due to + improper configuration. The implementation of Event Auditing in &os; is similar to that of the &sun; Basic Security Module, or BSM library. Thus, the configuration is almost completely - interchangeable with &solaris; and Darwin operating systems. + interchangeable with &solaris; and Mac OS X/Darwin operating + systems. Key Terms - Words to Know Before reading this chapter, a few key terms must be explained. This is intended to clear up any confusion that may occur and to avoid the abrupt introduction of new terms and information. - class: A class specifies the category - different actions the system are placed in. For example, - use of &man.login.1; could be placed in a class. + event: An auditable event is + an event that can be logged using the audit subsystem. The + administrator can configure which events will be audited. + Examples of security-relevant events include the creation of + a file, the building of a network connection, or the logging + in of a user. Events are either attributable, + meaning that they can be traced back to a user + authentication, or non-attributable. Examples + of non-attributable events are any events that occur before + authentication has succeeded in the login process, such as + failed authentication attempts. - event: An event could be considered - an action taken on the system. Creating a file would be - an event. + class: Events may be assigned to + one or more classes, usually based on the general category + of the events, such as file creation, + file access, or network. Login + and logout events are assigned to the lo + class. The use of classes allows the administrator to + specify high level auditing rules without having to specify + whether each individual auditable operation will be logged. - record: A record is a log or a note - about a specific action. + record: A record is a log entry + describing a security event. Records typically have a + record event type, information on the subject (user) associated + with the event, time information, information on any objects, + such as files, and information on whether the event corresponded + to a successful operation. + + trail: An audit trail, or log file, + consists of a series of audit records describing security + events. Typically, trails are in roughly chronological + order with respect to the time events completed. Only + authorized processes are allowed to commit records to the + audit trail. + prefix: A prefix is considered to be the configuration element used to toggle auditing for success and failed events. Installing Audit Support - Support for Event Auditing should have been installed with + Support for Event Auditing is installed with the normal installworld process. An administrator may confirm this by viewing the contents of /etc/security. Files beginning with the word audit should be present. For example, audit_event. In-kernel support for the framework must also exist. This may be done by adding the following lines to the local kernel configuration file: options AUDIT Rebuild and reinstall the kernel via the normal process explained in . Once completed, enable the audit daemon by adding the following line to &man.rc.conf.5;: auditd_enable="YES" Functionality not provided by the default may be added here with the option. Audit Configuration - By default, all configuration is done within the realm of - /etc/security and the - files contained within. The following files must be present - before the audit daemon is started: + All configuration files for security audit are found in + /etc/security. The following + files must be present before the audit daemon is started: audit_class - Contains the definitions of the audit classes. audit_control - Controls aspects of the audit subsystem, such as default audit classes, minimum disk space to leave on the audit log volume, etc. audit_event - Defines the kernel audit events. These map, mostly, to system calls. audit_user - The events to audit - for individual users. A user name does not need to appear - in here. + for individual users. Users not appearing here will be + subject to the default configuration in the control + configuration file. audit_warn - A shell script - used by auditd to form warning messages. + used by auditd to generate warning messages in + exceptional situations, such as when space for audit + records is running low. - If these files do not exist, for whatever reason, they can - be installed easily by issuing the following commands: - - &prompt.root; cd /usr/src/contrib/bsm/etc && make install - Audit File Syntax The configuration file syntax is rather arcane, albeit easy to work with. One thing an administrator must be leery about is overriding system defaults. This could create potential openings for audit data to not be collected properly. The audit subsystem will accept both the short name and long name with regards to configuration syntax. A syntax map has been included below. The following list contains all supported audit classes: - all - All audit flags set. - administrative - Administrative actions performed on the system as a whole. - application - Application defined action. - file_close - Audit calls to the close system call. - exec - Audit program or utility execution. - file_attr_acc - Audit the access of object attributes such as &man.stat.1;, &man.pathconf.2; and similar events. - file_creation - Audit events where a file is created as a result. - file_deletion - Audit events where file deletion occurs. - file_attr_mod - Audit events where file attribute modification occurs, such as &man.chown.8;, &man.chflags.1;, &man.flock.2;, etc. - file_read - Audit events in which data is read, files are opened for reading, etc. - file_write - Audit events in which data is written, files are written or modified, etc. - ioctl - Audit use of the &man.ioctl.2; system call. - ipc - Audit - System V IPC operations. + various forms of Inter-Process Communication, including POSIX + pipes and System V IPC operations. - login_logout - Audit &man.login.1; and &man.logout.1; events occurring on the system. - non_attrib - Audit non-attributable events. - no_class - Null class used to disable event auditing. - network - Audit events related to network actions, such as &man.connect.2; and &man.accept.2;. - other - Audit miscellaneous events. - process - Audit process operations, such as &man.exec.3; and &man.exit.3;. - - - - tfm - - I HAVE NO CLUE! - Following is a list of all supported audit prefixes: none - Audit both the success or failure of an event. For example, just listing a class will result in the auditing of both success and failure. + - Audit successful events only. - - Audit failed events only. Using the class with either the positive or negative prefix can generate a large amount of data at an extremely rapid rate. Extra prefixes used to modify the default configuration values: ^- - Disable auditing of failed events. ^+ - Enable auditing of successful events. ^ - Disable auditing of both successful and failed events. Configuration Files - Configuration is set in only two files, the first being - audit_control and - audit_user being the second. The first - is system-wide, controlling every aspect of event auditing - in the system. The latter may be used for fine grained user - auditing. + In most cases, administrators will need to modify only two files + when configuring the audit system: audit_control + and audit_user. The first controls system-wide + audit paramaters and defaults for both attributable and + non-attributable events. The second may be used to tune the level + and nature of auditing for individual users. The <filename>audit_control</filename> File - The audit_control contains some basic + The audit_control file contains some basic defaults that the administrator may wish to modify. Perhaps even set some new ones. Viewing the contents of this file, we see the following: dir:/var/audit -flags:lo,ad,-all,^-fa,^-fc,^-cl +flags:lo minfree:20 naflags:lo - The is used to set the default - directory where audit logs are stored. - - The is used to set the system-wide - defaults. The current setting, + The option is used to set the default + directory where audit logs are stored. Audit is frequently + configured so that audit logs are stored on a dedicated file + system, so as to prevent interference between the audit + subsystem and other subsystems when file systems become full. + + + The option is used to set the + system-wide defaults. The current setting, + configures the auditing of all &man.login.1; and &man.logout.1; + actions. A more complex example, audits all system &man.login.1; and &man.logout.1; actions, all administrator - actions, all failed events in the system, and finally disable + actions, all failed events in the system, and finally disables auditing of failed attempts for , , and . Even though the turned on the auditing of all failed attempts, the prefix will override that for the latter options. Notice that the previous paragraph shows the file is read from left to right. As such, values further on the right side may override a previous value specified to its left. The option defines the minimum percentage of free space for audit file systems. This relates to the file system where audit logs are stored. For example, if the specifies /var/audit and is set to twenty (20), warning messages will be generated when the /var file system grows to eighty (80) percent full. The option specifies audit - flags to be considered non attributable; i.e.: classes of - events which cannot be attributed to a specific user - on the system. This can be overridden with the - audit_user configuration file. + classes to be audited for non-attributed events — + that is, events for which there is no authenticated user. + The <filename>audit_user</filename> File - The audit_user permits the - administrator to map audit specific events to directly - to users. This adds a finer-grained control mechanism - for all system users. + The audit_user file permits the + administrator to determine which classes of audit events + should be logged for which system users. The following is the defaults currently placed in the audit_user file: root:lo:no audit:fc:no Notice how the default is to audit all cases of login/logout and disable auditing of all other actions for root. This configuration also audits all file creation and disables all other auditing for the audit user. While event auditing does not require a special user exist, some configurations, specifically environments - making use of MAC may require it. + making use of MAC, may require it. Event Audit Administration - Events from the auditd daemon cannot + Events written by the kernel audit subsystem cannot be altered or read in plain text. Data is stored and accessed - in a method similar to that of &man.ktrace.1; and &man.kdump.1, + in a method similar to that of &man.ktrace.1; and &man.kdump.1;, that is, they may only be viewed by dumping them using the - praudit or auditreduce - utilities. + praudit command; audit trails may be reduced + using the auditreduce command, which selects + records from an audit trail based on properties of interest, such + as the user, time of the event, and type of operation. - There are two utilities because of different requirements. - For example, the praudit will dump the entire - contents of a specified audit log in plain text. To dump an + For example, the praudit utility will dump the + entire contents of a specified audit log in plain text. To dump an audit log in its entirety, use: &prompt.root; praudit /var/audit/AUDITFILE Where AUDITFILE is the audit log of viewing choice. Since audit logs may contain enormous amounts of data, an administrator may prefer to select records for specific users. This is made possible with the following command, where trhodes is the user of choice: - &prompt.root; auditreduce -e trhodes /var/audit/AUDITFILE + &prompt.root; auditreduce -e trhodes /var/audit/AUDITFILE | praudit This will select all audit records produced by the user trhodes stored in the AUDITFILE file. There are several other options available for reading audit records, see the aforementioned command's manual pages for a more in depth explanation. Rotating Audit Log Files - Manually rotating audit log files will cause great - havoc within the system. Therefore, adding a line to - &man.newsyslog.conf.5; will provide no usefulness. So how - are the logs to be rotated? Sending the appropriate flag - to the audit utility will shut down - event auditing and safely rotate. The following command - should handle everything for an administrator: + Due to log reliability requirements, audit trails + are written to only by the kernel, and managed only by + auditd. Administrators should not + attempt to use &man.newsyslog.conf.5; or other tools to + directly rotate audit logs. Instead, the audit + management tool should be used to shut down auditing, + reconfigure the audit system, and perform log rotation. + The following command causes the audit daemon to create a + new audit log and signal the kernel to switch to using the + new log. The old log will be terminated and renamed, at + which point it may then be manipulated by the administrator. &prompt.root; audit -n If the auditd daemon is not currently running, the previous command will fail and an error message will be produced. Adding the following line to /etc/crontab will force the rotation every twelve hours from &man.cron.8;: * */12 * * * root /usr/sbin/audit -n The change will take effect once you have saved the new /etc/crontab. + + + Delegating Audit Review Rights + + By default, only the root user has the right to read system audit + logs. However, that right may be delegated to members of the + audit group, as the audit directory and audit + trail files are assigned to that group, and made group-readable. As + the ability to track audit log contents provides significant insight + into the behavior of users and processes, it is recommended that the + delegation of audit review rights be performed with caution. + diff --git a/zh_TW.Big5/books/handbook/basics/chapter.sgml b/zh_TW.Big5/books/handbook/basics/chapter.sgml index 98054a02e6..e9dc78b35c 100644 --- a/zh_TW.Big5/books/handbook/basics/chapter.sgml +++ b/zh_TW.Big5/books/handbook/basics/chapter.sgml @@ -1,2547 +1,2538 @@ Chris Shumway Rewritten by UNIX °ò¦·§©À ·§­z ±µ¤U¨Óªº³o¤@³¹±N§t»\ FreeBSD §@·~¨t²Îªº°ò¥»«ü¥O¤Î¥\¯à¡C ¤j³¡¥÷ªº¤º®e¦b &unix;-like §@·~¨t²Î¤¤³£¬O¬Û³qªº¡C ¦pªG±z¹ï³o¨Ç¤º®e¼ô±xªº¸Ü¡A¥i¥H©ñ¤ßªº¸õ¹L¡C ¦pªG±z­è±µÄ² FreeBSD ¡A¨º±z¤@©w­n¥J²ÓªºÅª§¹³o³¹¡C Ū§¹³o¤@³¹¡A±z±N·|¤F¸Ñ: ¦p¦ó¨Ï¥Î FreeBSD ªºvirtual consoles¡C &unix; ÀÉ®×Åv­­¹B§@ªº¤è¦¡¥H¤Î &os; ¤¤Àɮתº flags¡C ¹w³]ªº &os; Àɮרt²Î°t¸m¡C &os; ªººÏºÐµ²ºc¡C ¦p¦ó±¾¸ü(mount)¡B¨ø¸ü(umount)Àɮרt²Î ¤°»ò¬Oprocesses ¡B daemons ¥H¤Î signals ¡C ¤°»ò¬O shell ¡A¥H¤Î¦p¦óÅܧó±z¹w³]ªºµn¤JÀô¹Ò¡C ¦p¦ó¨Ï¥Î°ò¥»ªº¤å¦r½s¿è¾¹¡C ¤°»ò¬O devices ©M device nodes ¡C &os; ¤U¨Ï¥Îªº binary ®æ¦¡¡C ¦p¦ó¾\Ū manual pages ¥HÀò±o§ó¦hªº¸ê°T¡C Virtual Consoles ©M²×ºÝ¾÷ virtual consoles terminals - FreeBSD ªº¨Ï¥Î¤è¦¡¦³«Ü¦hºØ¡A¨ä¤¤¤@ºØ´N¬O¦b¤å¦r²×ºÝ¾÷¤W¥´¦r¡C + ¦³«Ü¦h¤èªk¥i¥H¾Þ§@ FreeBSD ¡A¨ä¤¤¤@ºØ´N¬O¦b¤å¦r²×ºÝ¾÷¤W¥´¦r¡C ¦p¦¹¨Ï¥Î FreeBSD §Y¥i»´©öªºÅé·|¨ì &unix; §@·~¨t²Îªº«Â¤O©M¼u©Ê¡C ³o¤@¸`´y­z¤°»ò¬O²×ºÝ¾÷©Mconsole¡A¤Î¥H±z¦b FreeBSD ¤¤¥i¥H«ç»ò¨Ï¥Î¥¦­Ì¡C The Console console ¦pªG±z¨S¦³±N FreeBSD ³]©w¦¨¶}¾÷®É¦Û°Ê¶i¤J¹Ï§Î¤Æ¼Ò¦¡¡A¨t²Î·|¦b±Ò°Êªº script ¶]§¹¤§«áÅã¥Üµn¤Jªº´£¥Ü²Å¸¹¡C ±z±N·|¬Ý¨ì¹³¬O³o¼ËªºªF¦è¡G Additional ABI support:. Local package initialization:. Additional TCP options:. Fri Sep 20 13:01:06 EEST 2002 FreeBSD/i386 (pc3.example.org) (ttyv0) login: ³o­Ó°T®§¦b±zªº¨t²Î¤W·|¦³¨Ç³\ªº¤£¦P¡A¦ý¬OÀ³¸Ó·|¬Ý¨ìÃþ¦üªºªF¦è¡C §Ú­Ì·P¿³½ìªº¬O³Ì«á¨â¦æ¡A³Ì«á¨â¦æ¬O¡G FreeBSD/i386 (pc3.example.org) (ttyv0) ³o¦æ¥]§t¤F­è¶}¾÷§¹¨t²Îªº¸ê°T¡C ±z¬Ý¨ìªº¬O¦b Intel ©Î¬Û®e³B²z¾¹ªº x86 ¬[ºc¤W°õ¦æªºFreeBSDªº console³o´N¬O i386 ªº·N¸q¡C ª`·N§Y¨Ï±z¤£¬O¦b Intel ªº 386 ³B²z¾¹¤W°õ¦æ FreeBSD ¡A¤@¼Ë¬Oi386¡C ³o¤£¬O«ü§Aªº³B²z¾¹ªº«¬¸¹¡A³o¸ÌÅã¥Üªº¬O§A³B²z¾¹ªº¬[ºc ¡C ³o¥x¾÷¾¹ªº¦W¦r (¨C¥x &unix; ¾÷¾¹³£¦³¤@­Ó¦W¦r) ¬O pc3.example.org ¡A¦Ó±z²{¦b¬Ý¨ìªº¬O¥¦ªº¨t²Î console— ttyv0²×ºÝ¾÷¡C ³Ì«áªº¤@¦æÀ³¸Ó³£·|¬O¡G login: ³o¬O±zÀ³¸Ó­n¿é¤J±zªº±b¸¹¦WºÙªº¦a¤è¡C ¤U¤@¤p¸`±N´y­z¦p¦óµn¤J FreeBSD¡C µn¤J FreeBSD FreeBSD ¬O¤@­Ó multiuser ¡B multiprocessing ªº¨t²Î¡C ³o¬O¤@­Ó¥¿¦¡ªº¦WºÙ¡A«üªº¬O¤@­Ó¦b³æ¤@¾÷¾¹¤W¥i¥H¦P®É³Q¤£¦Pªº¤H¨Ï¥Î¡A¦P®É¥i¥H°õ¦æ«Ü¦hµ{¦¡ªº¨t²Î¡C ¨C¤@ºØ¦h¨Ï¥ÎªÌ¨t²Î³£»Ý­n¥i¥H¤À¿ë¤£¦P¨Ï¥ÎªÌªº¤èªk¡C ¦b FreeBSD (¥H¤Î©Ò¦³ªº &unix;-like §@·~¨t²Î) ¤¤¡A©Ò¦³ªº¨Ï¥ÎªÌ¦b°õ¦æµ{¦¡¤§«e¥²¶·¥ýµn¤J¨t²Î¡C ¨C­Ó¨Ï¥ÎªÌ³£¦³¤@²Õ¿W¯Sªº±b¸¹¦WºÙ(username)¤Î±K½X(password) ¡CFreeBSD ¦b¤¹³\¨Ï¥ÎªÌ°õ¦æµ{¦¡«e±N·|¥ý°Ý³o¨â­Ó°ÝÃD¡C startup scripts ¦b FreeBSD ¶}¾÷¨Ã¶]§¹°_°Êªº script ¤§«á ³o¨Ç°_°Êªº script ¬O¦b¶}¾÷ªº®É­Ô FreeBSD ·|¦Û°Ê°õ¦æªºµ{¦¡¡C ¥L­Ì¥D­nªº¥\¯à¬O±N©Ò¦³¸Ó°õ¦æªºªF¦è³]©w¦n¡A¨Ã±N±z³]©w¦¨­I´º°õ¦æªºªA°È±Ò°Ê¡C ¡A¥¦±N·|¦L¥X´£¥Ü¦r¤¸­n¨D±z¿é¤J¥¿½Tªº±b¸¹¦WºÙ¡G login: ¦b³o­Ó½d¨Ò¸Ì¡A§Ú­Ì°²³]±zªº±b¸¹¬Ojohn¡C ¦b´£¥Ü¦r¤¸³B¿é¤Jjohn¨Ã«ö¤UEnter¡A±zÀ³¸Ó·|¬Ý¨ì¥t¤@­Ó´£¥Ü¦r¤¸­n±z¿é¤J±K½X¡G login: john Password: ¿é¤J john ªº±K½X, ¦A«ö¤U Enter¡C ¿é¤Jªº±K½X ¤£·|Åã¥Ü¦b¿Ã¹õ¤W¡C ±z¤£»Ý­n¾á¤ß³o­Ó¡A³o¼Ë°µ¬O¬°¤F¦w¥þ¤Wªº°ÝÃD¡C ¦pªG±z¿é¤J¤F¥¿½Tªº±K½X¡A±zÀ³¸Ó¤w¸gµn¤J FreeBSD¡A¥i¥H¹Á¸Õ©Ò¦³¥i¥Îªº«ü¥O¤F¡C ±zÀ³¸Ó·|¬Ý¨ìMOTD (§Y¤µ¤é°T®§¡BMessages Of The Day)¡A«á­±±µµÛ©R¥O´£¥Ü¦r¤¸ (¤@­Ó #,$, ©Î¬O % ¦r¤¸)¡C ³o´Nªí¥Ü±z¤w¸g¦¨¥\µn¤J FreeBSD ¤F¡C - Multiple Consoles - - Running &unix; commands in one console is fine, but FreeBSD can - run many programs at once. Having one console where commands can be - typed would be a bit of a waste when an operating system like FreeBSD - can run dozens of programs at the same time. This is where - virtual consoles can be very helpful. - - FreeBSD can be configured to present you with many different - virtual consoles. You can switch from one of them to any other - virtual console by pressing a couple of keys on your keyboard. Each - console has its own different output channel, and FreeBSD takes care - of properly redirecting keyboard input and monitor output as you - switch from one virtual console to the next. - - Special key combinations have been reserved by FreeBSD for - switching consoles - A fairly technical and accurate description of all the details - of the FreeBSD console and keyboard drivers can be found in the - manual pages of &man.syscons.4;, &man.atkbd.4;, &man.vidcontrol.1; - and &man.kbdcontrol.1;. We will not expand on the details here, - but the interested reader can always consult the manual pages for - a more detailed and thorough explanation of how things - work. - . You can use - AltF1, - AltF2, through - AltF8 to switch - to a different virtual console in FreeBSD. - - As you are switching from one console to the next, FreeBSD takes - care of saving and restoring the screen output. The result is an - illusion of having multiple virtual - screens and keyboards that you can use to type commands for - FreeBSD to run. The programs that you launch on one virtual console - do not stop running when that console is not visible. They continue - running when you have switched to a different virtual console. + ¦h­« Console + + ¦b¤@­Ó Console ¤U°õ¦æ &unix; ·íµM¬O¨S¦³°ÝÃD¡AµM¦ÓFreeBSD¬O¥i¥H¦P®É°õ¦æ«Ü¦hµ{¦¡ªº¡C + ¹³ FreeBSD ³o¼Ë¥i¥H¦P®É°õ¦æ¤@¤j°ïµ{¦¡ªº§@·~¨t²Î¡A¥u¦³¤@­Ó console ¥i¥H¿é¤J«ü¥O¬O¦³ÂI®ö¶O¡C + ¦b¦¹virtual consoles´N«Ü¦³¥Î¤F¡C + + + FreeBSD ¥i¥H³Q³]©w¦¨¦P®É¦³«Ü¦h virtual console ¡A¥Î´X­Ó«öÁ䪺²Õ¦X´N¥i¥H±q¤@­Ó virtual console ¸õ¨ì§Oªº virtual console ¥h¡C ¨C¤@­Ó console ³£¦³¦Û¤w¤£¦Pªº¿é¥XÀW¹D¡A ·í±q¬Y¤@­Ó virtual console ¤Á´«¨ì¤U¤@­Óªº®É­Ô¡AFreeBSD ·|¾A·íªº³B²zÁä½L¿é¤J¤Î¿Ã¹õ¿é¥X¡C + + FreeBSD «O¯d¤F¯S§Oªº«öÁä²Õ¦X¨Ó¤Á´« console + + ¦b &man.syscons.4;¡B &man.atkbd.4;¡B &man.vidcontrol.1;¡B¥H¤Î + &man.kbdcontrol.1;µ¥ manual page ¤¤¡A¹ï©ó FreeBSD ªº console + ¤ÎÁä½LÅX°Êµ{¦¡¦³¤Q¤À§Þ³N©Ê¥B¸Ô²Óªº´y­z¡C + §Ú­Ì¦b³o¸Ì¤£°Q½×²Ó¸`¡A¦³¿³½ìªºÅªªÌÀH®É¥i¥H¦b manual page + ¤¤¬d¨ìÃö©ó¹B§@¤è¦¡ªº§ó¸Ô²Ó¥B§¹¾ãªº¸ÑÄÀ + ¡C ±z¥i¥H¥Î + AltF1¡B + AltF2¡B¨ì + AltF8¨Ó¤Á´« FreeBSD + ªº¤£¦P console¡C + + + ·í±z±q¤@­Ó console ¤Á´«¨ì¤U¤@­Óªº®É­Ô¡A FreeBSD ·|³B²z¿Ã¹õ¿é¥XªºÀx¦s¤Î¦^´_¡C + ³o´N¦n¹³¦³«Ü¦hµêÀÀªº¿Ã¹õ©MÁä½L¥i¥HÅý±z¿é¤J«ü¥Oµ¹ + FreeBSD °õ¦æ¡C ¦b¬Y¤@­Ó console ¤W°õ¦æªºµ{¦¡¨Ã¤£·|¦]¬°¤Á¨ì§Oªº console + ¦Ó°±¤î°õ¦æ¡A·í±z¤Á´«¨ì¥t¤@­Ó console ªº®É­Ô¡A¥L­Ì·|Ä~Äò°õ¦æ¡C + The <filename>/etc/ttys</filename> File The default configuration of FreeBSD will start up with eight virtual consoles. This is not a hardwired setting though, and you can easily customize your installation to boot with more or fewer virtual consoles. The number and settings of the virtual consoles are configured in the /etc/ttys file. You can use the /etc/ttys file to configure the virtual consoles of FreeBSD. Each uncommented line in this file (lines that do not start with a # character) contains settings for a single terminal or virtual console. The default version of this file that ships with FreeBSD configures nine virtual consoles, and enables eight of them. They are the lines that start with ttyv: # name getty type status comments # ttyv0 "/usr/libexec/getty Pc" cons25 on secure # Virtual terminals ttyv1 "/usr/libexec/getty Pc" cons25 on secure ttyv2 "/usr/libexec/getty Pc" cons25 on secure ttyv3 "/usr/libexec/getty Pc" cons25 on secure ttyv4 "/usr/libexec/getty Pc" cons25 on secure ttyv5 "/usr/libexec/getty Pc" cons25 on secure ttyv6 "/usr/libexec/getty Pc" cons25 on secure ttyv7 "/usr/libexec/getty Pc" cons25 on secure ttyv8 "/usr/X11R6/bin/xdm -nodaemon" xterm off secure For a detailed description of every column in this file and all the options you can use to set things up for the virtual consoles, consult the &man.ttys.5; manual page. Single User Mode Console A detailed description of what single user mode is can be found in . It is worth noting that there is only one console when you are running FreeBSD in single user mode. There are no virtual consoles available. The settings of the single user mode console can also be found in the /etc/ttys file. Look for the line that starts with console: # name getty type status comments # # If console is marked "insecure", then init will ask for the root password # when going to single-user mode. console none unknown off secure As the comments above the console line indicate, you can edit this line and change secure to insecure. If you do that, when FreeBSD boots into single user mode, it will still ask for the root password. Be careful when changing this to insecure. If you ever forget the root password, booting into single user mode is a bit involved. It is still possible, but it might be a bit hard for someone who is not very comfortable with the FreeBSD booting process and the programs involved. Permissions UNIX FreeBSD, being a direct descendant of BSD &unix;, is based on several key &unix; concepts. The first and most pronounced is that FreeBSD is a multi-user operating system. The system can handle several users all working simultaneously on completely unrelated tasks. The system is responsible for properly sharing and managing requests for hardware devices, peripherals, memory, and CPU time fairly to each user. Because the system is capable of supporting multiple users, everything the system manages has a set of permissions governing who can read, write, and execute the resource. These permissions are stored as three octets broken into three pieces, one for the owner of the file, one for the group that the file belongs to, and one for everyone else. This numerical representation works like this: permissions file permissions Value Permission Directory Listing 0 No read, no write, no execute --- 1 No read, no write, execute --x 2 No read, write, no execute -w- 3 No read, write, execute -wx 4 Read, no write, no execute r-- 5 Read, no write, execute r-x 6 Read, write, no execute rw- 7 Read, write, execute rwx ls directories You can use the command line argument to &man.ls.1; to view a long directory listing that includes a column with information about a file's permissions for the owner, group, and everyone else. For example, a ls -l in an arbitrary directory may show: &prompt.user; ls -l total 530 -rw-r--r-- 1 root wheel 512 Sep 5 12:31 myfile -rw-r--r-- 1 root wheel 512 Sep 5 12:31 otherfile -rw-r--r-- 1 root wheel 7680 Sep 5 12:31 email.txt ... Here is how the first column of ls -l is broken up: -rw-r--r-- The first (leftmost) character tells if this file is a regular file, a directory, a special character device, a socket, or any other special pseudo-file device. In this case, the - indicates a regular file. The next three characters, rw- in this example, give the permissions for the owner of the file. The next three characters, r--, give the permissions for the group that the file belongs to. The final three characters, r--, give the permissions for the rest of the world. A dash means that the permission is turned off. In the case of this file, the permissions are set so the owner can read and write to the file, the group can read the file, and the rest of the world can only read the file. According to the table above, the permissions for this file would be 644, where each digit represents the three parts of the file's permission. This is all well and good, but how does the system control permissions on devices? FreeBSD actually treats most hardware devices as a file that programs can open, read, and write data to just like any other file. These special device files are stored on the /dev directory. Directories are also treated as files. They have read, write, and execute permissions. The executable bit for a directory has a slightly different meaning than that of files. When a directory is marked executable, it means it can be traversed into, that is, it is possible to cd (change directory) into it. This also means that within the directory it is possible to access files whose names are known (subject, of course, to the permissions on the files themselves). In particular, in order to perform a directory listing, read permission must be set on the directory, whilst to delete a file that one knows the name of, it is necessary to have write and execute permissions to the directory containing the file. There are more permission bits, but they are primarily used in special circumstances such as setuid binaries and sticky directories. If you want more information on file permissions and how to set them, be sure to look at the &man.chmod.1; manual page. Tom Rhodes Contributed by Symbolic Permissions permissionssymbolic Symbolic permissions, sometimes referred to as symbolic expressions, use characters in place of octal values to assign permissions to files or directories. Symbolic expressions use the syntax of (who) (action) (permissions), where the following values are available: Option Letter Represents (who) u User (who) g Group owner (who) o Other (who) a All (world) (action) + Adding permissions (action) - Removing permissions (action) = Explicitly set permissions (permissions) r Read (permissions) w Write (permissions) x Execute (permissions) t Sticky bit (permissions) s Set UID or GID These values are used with the &man.chmod.1; command just like before, but with letters. For an example, you could use the following command to block other users from accessing FILE: &prompt.user; chmod go= FILE A comma separated list can be provided when more than one set of changes to a file must be made. For example the following command will remove the groups and world write permission on FILE, then it adds the execute permissions for everyone: &prompt.user; chmod go-w,a+x FILE Tom Rhodes Contributed by &os; File Flags In addition to file permissions discussed previously, &os; supports the use of file flags. These flags add an additional level of security and control over files, but not directories. These file flags add an additional level of control over files, helping to ensure that in some cases not even the root can remove or alter files. File flags are altered by using the &man.chflags.1; utility, using a simple interface. For example, to enable the system undeletable flag on the file file1, issue the following command: &prompt.root; chflags sunlink file1 And to disable the system undeletable flag, simply issue the previous command with no in front of the . Observe: &prompt.root; chflags nosunlink file1 To view the flags of this file, use the &man.ls.1; with the flags: &prompt.root; ls -lo file1 The output should look like the following: -rw-r--r-- 1 trhodes trhodes sunlnk 0 Mar 1 05:54 file1 Several flags may only added or removed to files by the root user. In other cases, the file owner may set these flags. It is recommended an administrator read over the &man.chflags.1; and &man.chflags.2; manual pages for more information. Directory Structure directory hierarchy The FreeBSD directory hierarchy is fundamental to obtaining an overall understanding of the system. The most important concept to grasp is that of the root directory, /. This directory is the first one mounted at boot time and it contains the base system necessary to prepare the operating system for multi-user operation. The root directory also contains mount points for every other file system that you may want to mount. A mount point is a directory where additional file systems can be grafted onto the root file system. This is further described in . Standard mount points include /usr, /var, /tmp, /mnt, and /cdrom. These directories are usually referenced to entries in the file /etc/fstab. /etc/fstab is a table of various file systems and mount points for reference by the system. Most of the file systems in /etc/fstab are mounted automatically at boot time from the script &man.rc.8; unless they contain the option. Details can be found in . A complete description of the file system hierarchy is available in &man.hier.7;. For now, a brief overview of the most common directories will suffice. Directory Description / Root directory of the file system. /bin/ User utilities fundamental to both single-user and multi-user environments. /boot/ Programs and configuration files used during operating system bootstrap. /boot/defaults/ Default bootstrapping configuration files; see &man.loader.conf.5;. /dev/ Device nodes; see &man.intro.4;. /etc/ System configuration files and scripts. /etc/defaults/ Default system configuration files; see &man.rc.8;. /etc/mail/ Configuration files for mail transport agents such as &man.sendmail.8;. /etc/namedb/ named configuration files; see &man.named.8;. /etc/periodic/ Scripts that are run daily, weekly, and monthly, via &man.cron.8;; see &man.periodic.8;. /etc/ppp/ ppp configuration files; see &man.ppp.8;. /mnt/ Empty directory commonly used by system administrators as a temporary mount point. /proc/ Process file system; see &man.procfs.5;, &man.mount.procfs.8;. /rescue/ Statically linked programs for emergency recovery; see &man.rescue.8;. /root/ Home directory for the root account. /sbin/ System programs and administration utilities fundamental to both single-user and multi-user environments. /stand/ Programs used in a standalone environment. /tmp/ Temporary files. The contents of /tmp are usually NOT preserved across a system reboot. A memory-based file system is often mounted at /tmp. This can be automated using the tmpmfs-related variables of &man.rc.conf.5; (or with an entry in /etc/fstab; see &man.mdmfs.8;, or for FreeBSD 4.X, &man.mfs.8;). /usr/ The majority of user utilities and applications. /usr/bin/ Common utilities, programming tools, and applications. /usr/include/ Standard C include files. /usr/lib/ Archive libraries. /usr/libdata/ Miscellaneous utility data files. /usr/libexec/ System daemons & system utilities (executed by other programs). /usr/local/ Local executables, libraries, etc. Also used as the default destination for the FreeBSD ports framework. Within /usr/local, the general layout sketched out by &man.hier.7; for /usr should be used. Exceptions are the man directory, which is directly under /usr/local rather than under /usr/local/share, and the ports documentation is in share/doc/port. /usr/obj/ Architecture-specific target tree produced by building the /usr/src tree. /usr/ports The FreeBSD Ports Collection (optional). /usr/sbin/ System daemons & system utilities (executed by users). /usr/share/ Architecture-independent files. /usr/src/ BSD and/or local source files. /usr/X11R6/ X11R6 distribution executables, libraries, etc (optional). /var/ Multi-purpose log, temporary, transient, and spool files. A memory-based file system is sometimes mounted at /var. This can be automated using the varmfs-related variables of &man.rc.conf.5 (or with an entry in /etc/fstab; see &man.mdmfs.8;, or for FreeBSD 4.X, &man.mfs.8;). /var/log/ Miscellaneous system log files. /var/mail/ User mailbox files. /var/spool/ Miscellaneous printer and mail system spooling directories. /var/tmp/ Temporary files. The files are usually preserved across a system reboot, unless /var is a memory-based file system. /var/yp NIS maps. Disk Organization The smallest unit of organization that FreeBSD uses to find files is the filename. Filenames are case-sensitive, which means that readme.txt and README.TXT are two separate files. FreeBSD does not use the extension (.txt) of a file to determine whether the file is a program, or a document, or some other form of data. Files are stored in directories. A directory may contain no files, or it may contain many hundreds of files. A directory can also contain other directories, allowing you to build up a hierarchy of directories within one another. This makes it much easier to organize your data. Files and directories are referenced by giving the file or directory name, followed by a forward slash, /, followed by any other directory names that are necessary. If you have directory foo, which contains directory bar, which contains the file readme.txt, then the full name, or path to the file is foo/bar/readme.txt. Directories and files are stored in a file system. Each file system contains exactly one directory at the very top level, called the root directory for that file system. This root directory can then contain other directories. So far this is probably similar to any other operating system you may have used. There are a few differences; for example, &ms-dos; uses \ to separate file and directory names, while &macos; uses :. FreeBSD does not use drive letters, or other drive names in the path. You would not write c:/foo/bar/readme.txt on FreeBSD. Instead, one file system is designated the root file system. The root file system's root directory is referred to as /. Every other file system is then mounted under the root file system. No matter how many disks you have on your FreeBSD system, every directory appears to be part of the same disk. Suppose you have three file systems, called A, B, and C. Each file system has one root directory, which contains two other directories, called A1, A2 (and likewise B1, B2 and C1, C2). Call A the root file system. If you used the ls command to view the contents of this directory you would see two subdirectories, A1 and A2. The directory tree looks like this: / | +--- A1 | `--- A2 A file system must be mounted on to a directory in another file system. So now suppose that you mount file system B on to the directory A1. The root directory of B replaces A1, and the directories in B appear accordingly: / | +--- A1 | | | +--- B1 | | | `--- B2 | `--- A2 Any files that are in the B1 or B2 directories can be reached with the path /A1/B1 or /A1/B2 as necessary. Any files that were in /A1 have been temporarily hidden. They will reappear if B is unmounted from A. If B had been mounted on A2 then the diagram would look like this: / | +--- A1 | `--- A2 | +--- B1 | `--- B2 and the paths would be /A2/B1 and /A2/B2 respectively. File systems can be mounted on top of one another. Continuing the last example, the C file system could be mounted on top of the B1 directory in the B file system, leading to this arrangement: / | +--- A1 | `--- A2 | +--- B1 | | | +--- C1 | | | `--- C2 | `--- B2 Or C could be mounted directly on to the A file system, under the A1 directory: / | +--- A1 | | | +--- C1 | | | `--- C2 | `--- A2 | +--- B1 | `--- B2 If you are familiar with &ms-dos;, this is similar, although not identical, to the join command. This is not normally something you need to concern yourself with. Typically you create file systems when installing FreeBSD and decide where to mount them, and then never change them unless you add a new disk. It is entirely possible to have one large root file system, and not need to create any others. There are some drawbacks to this approach, and one advantage. Benefits of Multiple File Systems Different file systems can have different mount options. For example, with careful planning, the root file system can be mounted read-only, making it impossible for you to inadvertently delete or edit a critical file. Separating user-writable file systems, such as /home, from other file systems also allows them to be mounted nosuid; this option prevents the suid/guid bits on executables stored on the file system from taking effect, possibly improving security. FreeBSD automatically optimizes the layout of files on a file system, depending on how the file system is being used. So a file system that contains many small files that are written frequently will have a different optimization to one that contains fewer, larger files. By having one big file system this optimization breaks down. FreeBSD's file systems are very robust should you lose power. However, a power loss at a critical point could still damage the structure of the file system. By splitting your data over multiple file systems it is more likely that the system will still come up, making it easier for you to restore from backup as necessary. Benefit of a Single File System File systems are a fixed size. If you create a file system when you install FreeBSD and give it a specific size, you may later discover that you need to make the partition bigger. This is not easily accomplished without backing up, recreating the file system with the new size, and then restoring the backed up data. FreeBSD 4.4 and later versions feature the &man.growfs.8; command, which makes it possible to increase the size of file system on the fly, removing this limitation. File systems are contained in partitions. This does not have the same meaning as the common usage of the term partition (for example, &ms-dos; partition), because of &os;'s &unix; heritage. Each partition is identified by a letter from a through to h. Each partition can contain only one file system, which means that file systems are often described by either their typical mount point in the file system hierarchy, or the letter of the partition they are contained in. FreeBSD also uses disk space for swap space. Swap space provides FreeBSD with virtual memory. This allows your computer to behave as though it has much more memory than it actually does. When FreeBSD runs out of memory it moves some of the data that is not currently being used to the swap space, and moves it back in (moving something else out) when it needs it. Some partitions have certain conventions associated with them. Partition Convention a Normally contains the root file system b Normally contains swap space c Normally the same size as the enclosing slice. This allows utilities that need to work on the entire slice (for example, a bad block scanner) to work on the c partition. You would not normally create a file system on this partition. d Partition d used to have a special meaning associated with it, although that is now gone. To this day, some tools may operate oddly if told to work on partition d, so sysinstall will not normally create partition d. Each partition-that-contains-a-file-system is stored in what FreeBSD calls a slice. Slice is FreeBSD's term for what the common call partitions, and again, this is because of FreeBSD's &unix; background. Slices are numbered, starting at 1, through to 4. slices partitions dangerously dedicated Slice numbers follow the device name, prefixed with an s, starting at 1. So da0s1 is the first slice on the first SCSI drive. There can only be four physical slices on a disk, but you can have logical slices inside physical slices of the appropriate type. These extended slices are numbered starting at 5, so ad0s5 is the first extended slice on the first IDE disk. These devices are used by file systems that expect to occupy a slice. Slices, dangerously dedicated physical drives, and other drives contain partitions, which are represented as letters from a to h. This letter is appended to the device name, so da0a is the a partition on the first da drive, which is dangerously dedicated. ad1s3e is the fifth partition in the third slice of the second IDE disk drive. Finally, each disk on the system is identified. A disk name starts with a code that indicates the type of disk, and then a number, indicating which disk it is. Unlike slices, disk numbering starts at 0. Common codes that you will see are listed in . When referring to a partition FreeBSD requires that you also name the slice and disk that contains the partition, and when referring to a slice you should also refer to the disk name. Do this by listing the disk name, s, the slice number, and then the partition letter. Examples are shown in . shows a conceptual model of the disk layout that should help make things clearer. In order to install FreeBSD you must first configure the disk slices, then create partitions within the slice you will use for FreeBSD, and then create a file system (or swap space) in each partition, and decide where that file system will be mounted. Disk Device Codes Code Meaning ad ATAPI (IDE) disk da SCSI direct access disk acd ATAPI (IDE) CDROM cd SCSI CDROM fd Floppy disk
Sample Disk, Slice, and Partition Names Name Meaning ad0s1a The first partition (a) on the first slice (s1) on the first IDE disk (ad0). da1s2e The fifth partition (e) on the second slice (s2) on the second SCSI disk (da1). Conceptual Model of a Disk This diagram shows FreeBSD's view of the first IDE disk attached to the system. Assume that the disk is 4 GB in size, and contains two 2 GB slices (&ms-dos; partitions). The first slice contains a &ms-dos; disk, C:, and the second slice contains a FreeBSD installation. This example FreeBSD installation has three partitions, and a swap partition. The three partitions will each hold a file system. Partition a will be used for the root file system, e for the /var directory hierarchy, and f for the /usr directory hierarchy. .-----------------. --. | | | | DOS / Windows | | : : > First slice, ad0s1 : : | | | | :=================: ==: --. | | | Partition a, mounted as / | | | > referred to as ad0s2a | | | | | :-----------------: ==: | | | | Partition b, used as swap | | | > referred to as ad0s2b | | | | | :-----------------: ==: | Partition c, no | | | Partition e, used as /var > file system, all | | > referred to as ad0s2e | of FreeBSD slice, | | | | ad0s2c :-----------------: ==: | | | | | : : | Partition f, used as /usr | : : > referred to as ad0s2f | : : | | | | | | | | --' | `-----------------' --'
Mounting and Unmounting File Systems The file system is best visualized as a tree, rooted, as it were, at /. /dev, /usr, and the other directories in the root directory are branches, which may have their own branches, such as /usr/local, and so on. root file system There are various reasons to house some of these directories on separate file systems. /var contains the directories log/, spool/, and various types of temporary files, and as such, may get filled up. Filling up the root file system is not a good idea, so splitting /var from / is often favorable. Another common reason to contain certain directory trees on other file systems is if they are to be housed on separate physical disks, or are separate virtual disks, such as Network File System mounts, or CDROM drives. The <filename>fstab</filename> File file systems mounted with fstab During the boot process, file systems listed in /etc/fstab are automatically mounted (unless they are listed with the option). The /etc/fstab file contains a list of lines of the following format: device /mount-point fstype options dumpfreq passno device A device name (which should exist), as explained in . mount-point A directory (which should exist), on which to mount the file system. fstype The file system type to pass to &man.mount.8;. The default FreeBSD file system is ufs. options Either for read-write file systems, or for read-only file systems, followed by any other options that may be needed. A common option is for file systems not normally mounted during the boot sequence. Other options are listed in the &man.mount.8; manual page. dumpfreq This is used by &man.dump.8; to determine which file systems require dumping. If the field is missing, a value of zero is assumed. passno This determines the order in which file systems should be checked. File systems that should be skipped should have their passno set to zero. The root file system (which needs to be checked before everything else) should have its passno set to one, and other file systems' passno should be set to values greater than one. If more than one file systems have the same passno then &man.fsck.8; will attempt to check file systems in parallel if possible. Consult the &man.fstab.5; manual page for more information on the format of the /etc/fstab file and the options it contains. The <command>mount</command> Command file systems mounting The &man.mount.8; command is what is ultimately used to mount file systems. In its most basic form, you use: &prompt.root; mount device mountpoint There are plenty of options, as mentioned in the &man.mount.8; manual page, but the most common are: Mount Options Mount all the file systems listed in /etc/fstab. Except those marked as noauto, excluded by the flag, or those that are already mounted. Do everything except for the actual mount system call. This option is useful in conjunction with the flag to determine what &man.mount.8; is actually trying to do. Force the mount of an unclean file system (dangerous), or forces the revocation of write access when downgrading a file system's mount status from read-write to read-only. Mount the file system read-only. This is identical to using the ( for &os; versions older than 5.2) argument to the option. fstype Mount the given file system as the given file system type, or mount only file systems of the given type, if given the option. ufs is the default file system type. Update mount options on the file system. Be verbose. Mount the file system read-write. The option takes a comma-separated list of the options, including the following: nodev Do not interpret special devices on the file system. This is a useful security option. noexec Do not allow execution of binaries on this file system. This is also a useful security option. nosuid Do not interpret setuid or setgid flags on the file system. This is also a useful security option. The <command>umount</command> Command file systems unmounting The &man.umount.8; command takes, as a parameter, one of a mountpoint, a device name, or the or option. All forms take to force unmounting, and for verbosity. Be warned that is not generally a good idea. Forcibly unmounting file systems might crash the computer or damage data on the file system. and are used to unmount all mounted file systems, possibly modified by the file system types listed after . , however, does not attempt to unmount the root file system. Processes FreeBSD is a multi-tasking operating system. This means that it seems as though more than one program is running at once. Each program running at any one time is called a process. Every command you run will start at least one new process, and there are a number of system processes that run all the time, keeping the system functional. Each process is uniquely identified by a number called a process ID, or PID, and, like files, each process also has one owner and group. The owner and group information is used to determine what files and devices the process can open, using the file permissions discussed earlier. Most processes also have a parent process. The parent process is the process that started them. For example, if you are typing commands to the shell then the shell is a process, and any commands you run are also processes. Each process you run in this way will have your shell as its parent process. The exception to this is a special process called &man.init.8;. init is always the first process, so its PID is always 1. init is started automatically by the kernel when FreeBSD starts. Two commands are particularly useful to see the processes on the system, &man.ps.1; and &man.top.1;. The ps command is used to show a static list of the currently running processes, and can show their PID, how much memory they are using, the command line they were started with, and so on. The top command displays all the running processes, and updates the display every few seconds, so that you can interactively see what your computer is doing. By default, ps only shows you the commands that are running and are owned by you. For example: &prompt.user; ps PID TT STAT TIME COMMAND 298 p0 Ss 0:01.10 tcsh 7078 p0 S 2:40.88 xemacs mdoc.xsl (xemacs-21.1.14) 37393 p0 I 0:03.11 xemacs freebsd.dsl (xemacs-21.1.14) 48630 p0 S 2:50.89 /usr/local/lib/netscape-linux/navigator-linux-4.77.bi 48730 p0 IW 0:00.00 (dns helper) (navigator-linux-) 72210 p0 R+ 0:00.00 ps 390 p1 Is 0:01.14 tcsh 7059 p2 Is+ 1:36.18 /usr/local/bin/mutt -y 6688 p3 IWs 0:00.00 tcsh 10735 p4 IWs 0:00.00 tcsh 20256 p5 IWs 0:00.00 tcsh 262 v0 IWs 0:00.00 -tcsh (tcsh) 270 v0 IW+ 0:00.00 /bin/sh /usr/X11R6/bin/startx -- -bpp 16 280 v0 IW+ 0:00.00 xinit /home/nik/.xinitrc -- -bpp 16 284 v0 IW 0:00.00 /bin/sh /home/nik/.xinitrc 285 v0 S 0:38.45 /usr/X11R6/bin/sawfish As you can see in this example, the output from &man.ps.1; is organized into a number of columns. PID is the process ID discussed earlier. PIDs are assigned starting from 1, go up to 99999, and wrap around back to the beginning when you run out. The TT column shows the tty the program is running on, and can safely be ignored for the moment. STAT shows the program's state, and again, can be safely ignored. TIME is the amount of time the program has been running on the CPU—this is usually not the elapsed time since you started the program, as most programs spend a lot of time waiting for things to happen before they need to spend time on the CPU. Finally, COMMAND is the command line that was used to run the program. &man.ps.1; supports a number of different options to change the information that is displayed. One of the most useful sets is auxww. displays information about all the running processes, not just your own. displays the username of the process' owner, as well as memory usage. displays information about daemon processes, and causes &man.ps.1; to display the full command line, rather than truncating it once it gets too long to fit on the screen. The output from &man.top.1; is similar. A sample session looks like this: &prompt.user; top last pid: 72257; load averages: 0.13, 0.09, 0.03 up 0+13:38:33 22:39:10 47 processes: 1 running, 46 sleeping CPU states: 12.6% user, 0.0% nice, 7.8% system, 0.0% interrupt, 79.7% idle Mem: 36M Active, 5256K Inact, 13M Wired, 6312K Cache, 15M Buf, 408K Free Swap: 256M Total, 38M Used, 217M Free, 15% Inuse PID USERNAME PRI NICE SIZE RES STATE TIME WCPU CPU COMMAND 72257 nik 28 0 1960K 1044K RUN 0:00 14.86% 1.42% top 7078 nik 2 0 15280K 10960K select 2:54 0.88% 0.88% xemacs-21.1.14 281 nik 2 0 18636K 7112K select 5:36 0.73% 0.73% XF86_SVGA 296 nik 2 0 3240K 1644K select 0:12 0.05% 0.05% xterm 48630 nik 2 0 29816K 9148K select 3:18 0.00% 0.00% navigator-linu 175 root 2 0 924K 252K select 1:41 0.00% 0.00% syslogd 7059 nik 2 0 7260K 4644K poll 1:38 0.00% 0.00% mutt ... The output is split into two sections. The header (the first five lines) shows the PID of the last process to run, the system load averages (which are a measure of how busy the system is), the system uptime (time since the last reboot) and the current time. The other figures in the header relate to how many processes are running (47 in this case), how much memory and swap space has been taken up, and how much time the system is spending in different CPU states. Below that are a series of columns containing similar information to the output from &man.ps.1;. As before you can see the PID, the username, the amount of CPU time taken, and the command that was run. &man.top.1; also defaults to showing you the amount of memory space taken by the process. This is split into two columns, one for total size, and one for resident size—total size is how much memory the application has needed, and the resident size is how much it is actually using at the moment. In this example you can see that &netscape; has required almost 30 MB of RAM, but is currently only using 9 MB. &man.top.1; automatically updates this display every two seconds; this can be changed with the option. Daemons, Signals, and Killing Processes When you run an editor it is easy to control the editor, tell it to load files, and so on. You can do this because the editor provides facilities to do so, and because the editor is attached to a terminal. Some programs are not designed to be run with continuous user input, and so they disconnect from the terminal at the first opportunity. For example, a web server spends all day responding to web requests, it normally does not need any input from you. Programs that transport email from site to site are another example of this class of application. We call these programs daemons. Daemons were characters in Greek mythology; neither good or evil, they were little attendant spirits that, by and large, did useful things for mankind. Much like the web servers and mail servers of today do useful things. This is why the BSD mascot has, for a long time, been the cheerful looking daemon with sneakers and a pitchfork. There is a convention to name programs that normally run as daemons with a trailing d. BIND is the Berkeley Internet Name Daemon (and the actual program that executes is called named), the Apache web server program is called httpd, the line printer spooling daemon is lpd and so on. This is a convention, not a hard and fast rule; for example, the main mail daemon for the Sendmail application is called sendmail, and not maild, as you might imagine. Sometimes you will need to communicate with a daemon process. These communications are called signals, and you can communicate with a daemon (or with any other running process) by sending it a signal. There are a number of different signals that you can send—some of them have a specific meaning, others are interpreted by the application, and the application's documentation will tell you how that application interprets signals. You can only send a signal to a process that you own. If you send a signal to someone else's process with &man.kill.1; or &man.kill.2; permission will be denied. The exception to this is the root user, who can send signals to everyone's processes. FreeBSD will also send applications signals in some cases. If an application is badly written, and tries to access memory that it is not supposed to, FreeBSD sends the process the Segmentation Violation signal (SIGSEGV). If an application has used the &man.alarm.3; system call to be alerted after a period of time has elapsed then it will be sent the Alarm signal (SIGALRM), and so on. Two signals can be used to stop a process, SIGTERM and SIGKILL. SIGTERM is the polite way to kill a process; the process can catch the signal, realize that you want it to shut down, close any log files it may have open, and generally finish whatever it is doing at the time before shutting down. In some cases a process may even ignore SIGTERM if it is in the middle of some task that can not be interrupted. SIGKILL can not be ignored by a process. This is the I do not care what you are doing, stop right now signal. If you send SIGKILL to a process then FreeBSD will stop that process there and then Not quite true—there are a few things that can not be interrupted. For example, if the process is trying to read from a file that is on another computer on the network, and the other computer has gone away for some reason (been turned off, or the network has a fault), then the process is said to be uninterruptible. Eventually the process will time out, typically after two minutes. As soon as this time out occurs the process will be killed. . The other signals you might want to use are SIGHUP, SIGUSR1, and SIGUSR2. These are general purpose signals, and different applications will do different things when they are sent. Suppose that you have changed your web server's configuration file—you would like to tell the web server to re-read its configuration. You could stop and restart httpd, but this would result in a brief outage period on your web server, which may be undesirable. Most daemons are written to respond to the SIGHUP signal by re-reading their configuration file. So instead of killing and restarting httpd you would send it the SIGHUP signal. Because there is no standard way to respond to these signals, different daemons will have different behavior, so be sure and read the documentation for the daemon in question. Signals are sent using the &man.kill.1; command, as this example shows. Sending a Signal to a Process This example shows how to send a signal to &man.inetd.8;. The inetd configuration file is /etc/inetd.conf, and inetd will re-read this configuration file when it is sent SIGHUP. Find the process ID of the process you want to send the signal to. Do this using &man.ps.1; and &man.grep.1;. The &man.grep.1; command is used to search through output, looking for the string you specify. This command is run as a normal user, and &man.inetd.8; is run as root, so the options must be given to &man.ps.1;. &prompt.user; ps -ax | grep inetd 198 ?? IWs 0:00.00 inetd -wW So the &man.inetd.8; PID is 198. In some cases the grep inetd command might also occur in this output. This is because of the way &man.ps.1; has to find the list of running processes. Use &man.kill.1; to send the signal. Because &man.inetd.8; is being run by root you must use &man.su.1; to become root first. &prompt.user; su Password: &prompt.root; /bin/kill -s HUP 198 In common with most &unix; commands, &man.kill.1; will not print any output if it is successful. If you send a signal to a process that you do not own then you will see kill: PID: Operation not permitted. If you mistype the PID you will either send the signal to the wrong process, which could be bad, or, if you are lucky, you will have sent the signal to a PID that is not currently in use, and you will see kill: PID: No such process. Why Use <command>/bin/kill</command>? Many shells provide the kill command as a built in command; that is, the shell will send the signal directly, rather than running /bin/kill. This can be very useful, but different shells have a different syntax for specifying the name of the signal to send. Rather than try to learn all of them, it can be simpler just to use the /bin/kill ... command directly. Sending other signals is very similar, just substitute TERM or KILL in the command line as necessary. Killing random process on the system can be a bad idea. In particular, &man.init.8;, process ID 1, is very special. Running /bin/kill -s KILL 1 is a quick way to shutdown your system. Always double check the arguments you run &man.kill.1; with before you press Return. Shells shells command line In FreeBSD, a lot of everyday work is done in a command line interface called a shell. A shell's main job is to take commands from the input channel and execute them. A lot of shells also have built in functions to help everyday tasks such as file management, file globbing, command line editing, command macros, and environment variables. FreeBSD comes with a set of shells, such as sh, the Bourne Shell, and tcsh, the improved C-shell. Many other shells are available from the FreeBSD Ports Collection, such as zsh and bash. Which shell do you use? It is really a matter of taste. If you are a C programmer you might feel more comfortable with a C-like shell such as tcsh. If you have come from Linux or are new to a &unix; command line interface you might try bash. The point is that each shell has unique properties that may or may not work with your preferred working environment, and that you have a choice of what shell to use. One common feature in a shell is filename completion. Given the typing of the first few letters of a command or filename, you can usually have the shell automatically complete the rest of the command or filename by hitting the Tab key on the keyboard. Here is an example. Suppose you have two files called foobar and foo.bar. You want to delete foo.bar. So what you would type on the keyboard is: rm fo[Tab].[Tab]. The shell would print out rm foo[BEEP].bar. The [BEEP] is the console bell, which is the shell telling me it was unable to totally complete the filename because there is more than one match. Both foobar and foo.bar start with fo, but it was able to complete to foo. If you type in ., then hit Tab again, the shell would be able to fill in the rest of the filename for you. environment variables Another feature of the shell is the use of environment variables. Environment variables are a variable key pair stored in the shell's environment space. This space can be read by any program invoked by the shell, and thus contains a lot of program configuration. Here is a list of common environment variables and what they mean: environment variables Variable Description USER Current logged in user's name. PATH Colon separated list of directories to search for binaries. DISPLAY Network name of the X11 display to connect to, if available. SHELL The current shell. TERM The name of the user's terminal. Used to determine the capabilities of the terminal. TERMCAP Database entry of the terminal escape codes to perform various terminal functions. OSTYPE Type of operating system. e.g., FreeBSD. MACHTYPE The CPU architecture that the system is running on. EDITOR The user's preferred text editor. PAGER The user's preferred text pager. MANPATH Colon separated list of directories to search for manual pages. Bourne shells Setting an environment variable differs somewhat from shell to shell. For example, in the C-Style shells such as tcsh and csh, you would use setenv to set environment variables. Under Bourne shells such as sh and bash, you would use export to set your current environment variables. For example, to set or modify the EDITOR environment variable, under csh or tcsh a command like this would set EDITOR to /usr/local/bin/emacs: &prompt.user; setenv EDITOR /usr/local/bin/emacs Under Bourne shells: &prompt.user; export EDITOR="/usr/local/bin/emacs" You can also make most shells expand the environment variable by placing a $ character in front of it on the command line. For example, echo $TERM would print out whatever $TERM is set to, because the shell expands $TERM and passes it on to echo. Shells treat a lot of special characters, called meta-characters as special representations of data. The most common one is the * character, which represents any number of characters in a filename. These special meta-characters can be used to do filename globbing. For example, typing in echo * is almost the same as typing in ls because the shell takes all the files that match * and puts them on the command line for echo to see. To prevent the shell from interpreting these special characters, they can be escaped from the shell by putting a backslash (\) character in front of them. echo $TERM prints whatever your terminal is set to. echo \$TERM prints $TERM as is. Changing Your Shell The easiest way to change your shell is to use the chsh command. Running chsh will place you into the editor that is in your EDITOR environment variable; if it is not set, you will be placed in vi. Change the Shell: line accordingly. You can also give chsh the option; this will set your shell for you, without requiring you to enter an editor. For example, if you wanted to change your shell to bash, the following should do the trick: &prompt.user; chsh -s /usr/local/bin/bash The shell that you wish to use must be present in the /etc/shells file. If you have installed a shell from the ports collection, then this should have been done for you already. If you installed the shell by hand, you must do this. For example, if you installed bash by hand and placed it into /usr/local/bin, you would want to: &prompt.root; echo "/usr/local/bin/bash" >> /etc/shells Then rerun chsh. Text Editors text editors editors A lot of configuration in FreeBSD is done by editing text files. Because of this, it would be a good idea to become familiar with a text editor. FreeBSD comes with a few as part of the base system, and many more are available in the Ports Collection. ee editors ee The easiest and simplest editor to learn is an editor called ee, which stands for easy editor. To start ee, one would type at the command line ee filename where filename is the name of the file to be edited. For example, to edit /etc/rc.conf, type in ee /etc/rc.conf. Once inside of ee, all of the commands for manipulating the editor's functions are listed at the top of the display. The caret ^ character represents the Ctrl key on the keyboard, so ^e expands to the key combination Ctrle. To leave ee, hit the Esc key, then choose leave editor. The editor will prompt you to save any changes if the file has been modified. vi editors vi emacs editors emacs FreeBSD also comes with more powerful text editors such as vi as part of the base system, while other editors, like Emacs and vim, are part of the FreeBSD Ports Collection (editors/emacs and editors/vim). These editors offer much more functionality and power at the expense of being a little more complicated to learn. However if you plan on doing a lot of text editing, learning a more powerful editor such as vim or Emacs will save you much more time in the long run. Devices and Device Nodes A device is a term used mostly for hardware-related activities in a system, including disks, printers, graphics cards, and keyboards. When FreeBSD boots, the majority of what FreeBSD displays are devices being detected. You can look through the boot messages again by viewing /var/run/dmesg.boot. For example, acd0 is the first IDE CDROM drive, while kbd0 represents the keyboard. Most of these devices in a &unix; operating system must be accessed through special files called device nodes, which are located in the /dev directory. Creating Device Nodes When adding a new device to your system, or compiling in support for additional devices, you may need to create one or more device nodes for the new devices. MAKEDEV Script On systems without DEVFS (this concerns all FreeBSD versions before 5.0), device nodes are created using the &man.MAKEDEV.8; script as shown below: &prompt.root; cd /dev &prompt.root; sh MAKEDEV ad1 This example would make the proper device nodes for the second IDE drive when installed. <literal>DEVFS</literal> (DEVice File System) The device file system, or DEVFS, provides access to kernel's device namespace in the global file system namespace. Instead of having to create and modify device nodes, DEVFS maintains this particular file system for you. See the &man.devfs.5; manual page for more information. DEVFS is used by default in FreeBSD 5.0 and above. Binary Formats To understand why &os; uses the &man.elf.5; format, you must first know a little about the three currently dominant executable formats for &unix;: &man.a.out.5; The oldest and classic &unix; object format. It uses a short and compact header with a magic number at the beginning that is often used to characterize the format (see &man.a.out.5; for more details). It contains three loaded segments: .text, .data, and .bss plus a symbol table and a string table. COFF The SVR3 object format. The header now comprises a section table, so you can have more than just .text, .data, and .bss sections. &man.elf.5; The successor to COFF, featuring multiple sections and 32-bit or 64-bit possible values. One major drawback: ELF was also designed with the assumption that there would be only one ABI per system architecture. That assumption is actually quite incorrect, and not even in the commercial SYSV world (which has at least three ABIs: SVR4, Solaris, SCO) does it hold true. FreeBSD tries to work around this problem somewhat by providing a utility for branding a known ELF executable with information about the ABI it is compliant with. See the manual page for &man.brandelf.1; for more information. FreeBSD comes from the classic camp and used the &man.a.out.5; format, a technology tried and proven through many generations of BSD releases, until the beginning of the 3.X branch. Though it was possible to build and run native ELF binaries (and kernels) on a FreeBSD system for some time before that, FreeBSD initially resisted the push to switch to ELF as the default format. Why? Well, when the Linux camp made their painful transition to ELF, it was not so much to flee the a.out executable format as it was their inflexible jump-table based shared library mechanism, which made the construction of shared libraries very difficult for vendors and developers alike. Since the ELF tools available offered a solution to the shared library problem and were generally seen as the way forward anyway, the migration cost was accepted as necessary and the transition made. FreeBSD's shared library mechanism is based more closely on Sun's &sunos; style shared library mechanism and, as such, is very easy to use. So, why are there so many different formats? Back in the dim, dark past, there was simple hardware. This simple hardware supported a simple, small system. a.out was completely adequate for the job of representing binaries on this simple system (a PDP-11). As people ported &unix; from this simple system, they retained the a.out format because it was sufficient for the early ports of &unix; to architectures like the Motorola 68k, VAXen, etc. Then some bright hardware engineer decided that if he could force software to do some sleazy tricks, then he would be able to shave a few gates off the design and allow his CPU core to run faster. While it was made to work with this new kind of hardware (known these days as RISC), a.out was ill-suited for this hardware, so many formats were developed to get to a better performance from this hardware than the limited, simple a.out format could offer. Things like COFF, ECOFF, and a few obscure others were invented and their limitations explored before things seemed to settle on ELF. In addition, program sizes were getting huge and disks (and physical memory) were still relatively small so the concept of a shared library was born. The VM system also became more sophisticated. While each one of these advancements was done using the a.out format, its usefulness was stretched more and more with each new feature. In addition, people wanted to dynamically load things at run time, or to junk parts of their program after the init code had run to save in core memory and swap space. Languages became more sophisticated and people wanted code called before main automatically. Lots of hacks were done to the a.out format to allow all of these things to happen, and they basically worked for a time. In time, a.out was not up to handling all these problems without an ever increasing overhead in code and complexity. While ELF solved many of these problems, it would be painful to switch from the system that basically worked. So ELF had to wait until it was more painful to remain with a.out than it was to migrate to ELF. However, as time passed, the build tools that FreeBSD derived their build tools from (the assembler and loader especially) evolved in two parallel trees. The FreeBSD tree added shared libraries and fixed some bugs. The GNU folks that originally wrote these programs rewrote them and added simpler support for building cross compilers, plugging in different formats at will, and so on. Since many people wanted to build cross compilers targeting FreeBSD, they were out of luck since the older sources that FreeBSD had for as and ld were not up to the task. The new GNU tools chain (binutils) does support cross compiling, ELF, shared libraries, C++ extensions, etc. In addition, many vendors are releasing ELF binaries, and it is a good thing for FreeBSD to run them. ELF is more expressive than a.out and allows more extensibility in the base system. The ELF tools are better maintained, and offer cross compilation support, which is important to many people. ELF may be a little slower than a.out, but trying to measure it can be difficult. There are also numerous details that are different between the two in how they map pages, handle init code, etc. None of these are very important, but they are differences. In time support for a.out will be moved out of the GENERIC kernel, and eventually removed from the kernel once the need to run legacy a.out programs is past. For More Information Manual Pages manual pages The most comprehensive documentation on FreeBSD is in the form of manual pages. Nearly every program on the system comes with a short reference manual explaining the basic operation and various arguments. These manuals can be viewed with the man command. Use of the man command is simple: &prompt.user; man command command is the name of the command you wish to learn about. For example, to learn more about ls command type: &prompt.user; man ls The online manual is divided up into numbered sections: User commands. System calls and error numbers. Functions in the C libraries. Device drivers. File formats. Games and other diversions. Miscellaneous information. System maintenance and operation commands. Kernel developers. In some cases, the same topic may appear in more than one section of the online manual. For example, there is a chmod user command and a chmod() system call. In this case, you can tell the man command which one you want by specifying the section: &prompt.user; man 1 chmod This will display the manual page for the user command chmod. References to a particular section of the online manual are traditionally placed in parenthesis in written documentation, so &man.chmod.1; refers to the chmod user command and &man.chmod.2; refers to the system call. This is fine if you know the name of the command and simply wish to know how to use it, but what if you cannot recall the command name? You can use man to search for keywords in the command descriptions by using the switch: &prompt.user; man -k mail With this command you will be presented with a list of commands that have the keyword mail in their descriptions. This is actually functionally equivalent to using the apropos command. So, you are looking at all those fancy commands in /usr/bin but do not have the faintest idea what most of them actually do? Simply do: &prompt.user; cd /usr/bin &prompt.user; man -f * or &prompt.user; cd /usr/bin &prompt.user; whatis * which does the same thing. GNU Info Files Free Software Foundation FreeBSD includes many applications and utilities produced by the Free Software Foundation (FSF). In addition to manual pages, these programs come with more extensive hypertext documents called info files which can be viewed with the info command or, if you installed emacs, the info mode of emacs. To use the &man.info.1; command, simply type: &prompt.user; info For a brief introduction, type h. For a quick command reference, type ?.
diff --git a/zh_TW.Big5/books/handbook/book.sgml b/zh_TW.Big5/books/handbook/book.sgml index c8968b3651..88d72fe818 100644 --- a/zh_TW.Big5/books/handbook/book.sgml +++ b/zh_TW.Big5/books/handbook/book.sgml @@ -1,317 +1,319 @@ %books.ent; %chapters; %txtfiles; + %pgpkeys; ]> FreeBSD ¨Ï¥Î¤â¥U FreeBSD ¤å¥ó­pµe February 1999 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 FreeBSD ¤å¥ó­pµe &bookinfo.legalnotice; &tm-attrib.freebsd; &tm-attrib.3com; &tm-attrib.3ware; &tm-attrib.arm; &tm-attrib.adaptec; &tm-attrib.adobe; &tm-attrib.apple; &tm-attrib.corel; &tm-attrib.creative; &tm-attrib.cvsup; &tm-attrib.heidelberger; &tm-attrib.ibm; &tm-attrib.ieee; &tm-attrib.intel; &tm-attrib.intuit; &tm-attrib.linux; &tm-attrib.lsilogic; &tm-attrib.m-systems; &tm-attrib.macromedia; &tm-attrib.microsoft; &tm-attrib.netscape; &tm-attrib.nexthop; &tm-attrib.opengroup; &tm-attrib.oracle; &tm-attrib.powerquest; &tm-attrib.realnetworks; &tm-attrib.redhat; &tm-attrib.sap; &tm-attrib.sun; &tm-attrib.symantec; &tm-attrib.themathworks; &tm-attrib.thomson; &tm-attrib.usrobotics; &tm-attrib.vmware; &tm-attrib.waterloomaple; &tm-attrib.wolframresearch; &tm-attrib.xfree86; &tm-attrib.xiph; &tm-attrib.general; Åwªï¨Ï¥ÎFreeBSD¡I ¥»¨Ï¥Î¤â¥U²[»\½d³ò¥]¬A¤F FreeBSD &rel2.current;-RELEASE ©M FreeBSD &rel.current;-RELEASE ªº¦w¸Ë©M¤é±`¨Ï¥Î¡C ³o¥÷¨Ï¥Î¤â¥U¬O«Ü¦h¤Hªº¶°Åé³Ð§@¡A¦Ó¥B¤´µM¡y«ùÄò¤£Â_¡zªº¶i¦æ¤¤¡C ³\¦h³¹¸`¤´¥¼§¹¦¨¡A¤w§¹¦¨ªº³¡¥÷¤]¦³¨Ç»Ý­n§ó·s¡C ¦pªG±z¹ï¨ó§U¥»­pµeªº¶i¦æ¦³¿³½ìªº¸Ü¡A½Ð±H e-mail ¨ì &a.doc;¡C ¦b FreeBSD ºô¯¸ ¥i¥H§ä¨ì³o¥÷¤å¥óªº³Ì·sª©¥»(ª©¤å¥ó¥i±q ¨ú±o)¡A¤]¥i¥H±q FreeBSD FTP ¦øªA¾¹ ©Î¬O²³¦h mirror ¯¸»O ¤U¸ü¤£¦P®æ¦¡¤Î¤£¦PÀ£ÁY¿ï¶µªº¸ê®Æ¡C ¦pªG¤ñ¸û°¾¦n¾Ö¦³¹êÅé®Ñ­±¸ê®Æ¡A¨º¥i¥H¦b FreeBSD Mall ÁʶR¡C ¦¹¥~¡A¤]¥i¥H¦b ¨Ï¥Î¤â¥U ¤¤·j´M¸ê®Æ¡C &chap.preface; ¶}©l¨Ï¥Î FreeBSD ³o³¡¥÷¬O´£¨Ñµ¹ªì¦¸¨Ï¥Î FreeBSD ªº¨Ï¥ÎªÌ©M¨t²ÎºÞ²zªÌ¡C ³o¨Ç³¹¸`¥]¬A¡G ¤¶²Ð FreeBSD µ¹±z¡C ¦b¦w¸Ë¹Lµ{µ¹±z«ü¤Þ¡C ±Ð±z &unix; ªº°ò¦¤Î­ì²z¡C ®i¥Üµ¹±z¬Ý¦p¦ó¦w¸ËÂ×´Iªº FreeBSD ªºÀ³¥Î³nÅé ¦V±z¤¶²Ð X¡A &unix; ªºµøµ¡¨t²Î¥H¤Î¸Ô²Óªº®à­±Àô¹Ò³]©w¡AÅý±z§ó¦³¥Í²£¤O¡C §Ú­Ì¸ÕµÛ¾¨¥i¯àªºÅý³o¬q¤å¦rªº°Ñ¦Ò³sµ²¼Æ¥Ø­°¨ì³Ì§C¡AÅý±z¦bŪ¨Ï¥Î¤â¥Uªº³o³¡¥÷®É¥i¥H¤£¤Ó»Ý­n±`±`«e«á½­¶¡C ¤@¯ë©Ê¤u§@ ¬JµM°ò¦ªº³¡¤À¤w¸g´£¹L¤F¡A±µ¤U¨Óªº³o­Ó³¡¤À±N·|°Q½×¤@¨Ç±`·|¥Î¨ìªº FreeBSD ªº¯S¦â¡A³o¨Ç³¹¸`¥]¬A¡G ¤¶²Ðµ¹±z±`¨£¥B¹ê¥Îªº®à­±À³¥Î³nÅé¡Gºô­¶ÂsÄý¾¹¡B¥Í²£¤O¤u¨ã¡B¤å¥óÀ˵øµ{¦¡µ¥¡C ¤¶²Ðµ¹±z²³¦h FreeBSD ¤W¥i¥Îªº¦h´CÅé¤u¨ã¡C ¸ÑÄÀ¦p¦ó½sĶ¦Û­q FreeBSD ®Ö¤ß¥H¼W¥[ÃB¥~¨t²Î¥\¯àªº¬yµ{¡C ¸Ô²Ó´y­z¦C¦L¨t²Î¡A¥]§t®à¤W«¬¦Lªí¾÷¤Îºô¸ô¦Lªí¾÷ªº³]©w¡C ®i¥Üµ¹±z¬Ý¦p¦ó¦b±zªº FreeBSD ¨t²Î¤¤°õ¦æ Linux À³¥Î³nÅé¡C ³o¨Ç³¹¸`¤¤¦³¨Ç»Ý­n±z¹w¥ý¾\Ū¨Ç¬ÛÃö¤å¥ó¡A¦b¦U³¹¸`¶}ÀYªº·§­n¤º·|´£¤Î¡C ¨t²ÎºÞ²z FreeBSD ¨Ï¥Î¤â¥U³Ñ¤Uªº³o¨Ç³¹¸`²[»\¤F¥þ¤è¦ìªº FreeBSD ¨t²ÎºÞ²z¡C ¨C­Ó³¹¸`ªº¶}ÀY·|¥ý´y­z¦b¸Ó±zŪ§¹¸Ó³¹¸`«á±z·|¾Ç¨ì¤°»ò¡A¤]·|¸Ô­z¦b±z¦b¬Ý³o¨Ç¸ê®Æ®ÉÀ³¸Ó­n¦³ªº¤@¨Ç­I´ºª¾ÃÑ¡C ³o¨Ç³¹¸`¬OÅý±z¦b»Ý­n¬d¸ê®Æªº®É­Ô½¾\¥Îªº¡C ±z¤£»Ý­n¨Ì·Ó¯S©wªº¶¶§Ç¨ÓŪ¡A¤]¤£»Ý­n±N³o¨Ç³¹¸`¥þ³¡¹LŪ¤§«á¤~¶}©l¥Î FreeBSD¡C + ºô¸ô³q°T FreeBSD ¬O¤@ºØ¼sªxªº³Q¨Ï¥Î¦b°ª®Ä¯àªººô¸ô¦øªA¾¹¤¤ªº§@·~¨t²Î¡A³o¨Ç³¹¸`¥]§t¤F¡G §Ç¦C°ð³q°T PPP ©M PPPoE ¹q¤l¶l¥ó °õ¦æºô¸ô¦øªAµ{¦¡ ¨¾¤õÀð ¨ä¥Lªº¶i¶¥ºô¸ô¥DÃD ³o¨Ç³¹¸`¬OÅý±z¦b»Ý­n¬d¸ê®Æªº®É­Ô½¾\¥Îªº¡C ±z¤£»Ý­n¨Ì·Ó¯S©wªº¶¶§Ç¨ÓŪ¡A¤]¤£»Ý­n±N³o¨Ç³¹¸`¥þ³¡Åª¹L¤§«á¤~±N FreeBSD ¥Î¦bºô¸ôÀô¹Ò¤U¡C ªþ¿ý &chap.colophon; diff --git a/zh_TW.Big5/books/handbook/chapters.ent b/zh_TW.Big5/books/handbook/chapters.ent index aed7f9633b..7aa1df904b 100644 --- a/zh_TW.Big5/books/handbook/chapters.ent +++ b/zh_TW.Big5/books/handbook/chapters.ent @@ -1,59 +1,60 @@ + diff --git a/zh_TW.Big5/books/handbook/desktop/chapter.sgml b/zh_TW.Big5/books/handbook/desktop/chapter.sgml index 5480b8557f..b8d2912e93 100644 --- a/zh_TW.Big5/books/handbook/desktop/chapter.sgml +++ b/zh_TW.Big5/books/handbook/desktop/chapter.sgml @@ -1,1108 +1,1093 @@ Christophe Juniet Contributed by - Desktop Applications + ®à­±Àô¹ÒÀ³¥Îµ{¦¡ - Synopsis - - FreeBSD can run a wide variety of desktop applications, such - as browsers and word processors. Most of these are available as - packages or can be automatically built from the ports - collection. Many new users expect to find these kinds of - applications on their desktop. This chapter will show you how - to install some popular desktop applications effortlessly, - either from their packages or from the Ports Collection. - - Note that when installing programs from the ports, they are - compiled from source. This can take a very long time, depending - on what you are compiling and the processing power of your - machine(s). If building from source takes a prohibitively long - amount of time for you, you can install most of the programs of - the Ports Collection from pre-built packages. - - As FreeBSD features Linux binary compatibility, many - applications originally developed for Linux are available for - your desktop. It is strongly recommended that you read - before installing any of the Linux - applications. Many of the ports using the Linux binary - compatibility start with linux-. Remember this - when you search for a particular port, for instance with - &man.whereis.1;. In the following text, it is assumed that you - have enabled Linux binary compatibility before installing any of - the Linux applications. - - Here are the categories covered by this chapter: + ·§­z + + ¦b FreeBSD ¤W­±¥i¥H°õ¦æ«D±`¦hºØÃþªº®à­±À³¥Îµ{¦¡¡A + ¹³¬Oºô­¶ÂsÄý¾¹©M¤å¦r³B²z³nÅéµ¥¡C + ³o¨Çµ{¦¡¤j³£¥i¥H³z¹L®M¥ó¨Ó¦w¸Ë©Î¬O±q ports collection ¤¤¦Û°Ê½sĶ¦w¸Ë¡C + ³\¦h·sªº¨Ï¥ÎªÌ·|§Æ±æ¯à¦b¦b¥L­Ìªº®à­±¨t²Î¤¤§ä¨ì³o¨Çµ{¦¡¡C + ³o³¹±N·|§i¶D§A¦p¦ó¤£¥Î¶O¤Ó¦h¥\¤Ò¥h¦w¸Ë¤@¨Ç¼öªùªº®à­±À³¥Îµ{¦¡¡A + ¤£ºÞ¬O±q®M¥ó©Î¬O±q ports collection ¤¤¦w¸Ë¡C + + »Ý­nª`·N¨ìªº¬O¡G·í±q ports ¤¤¦w¸Ëµ{¦¡ªº®É­Ô¡A + ¥¦­Ì¬O±q·½½X¶}©l½sĶªº¡C¨Ì·Ó§A½sĶªº ports ©M¹q¸£³t«×(µwÅéµ¥¯Å)¡A + ¦³¥i¯à·|ªá«Üªø¤@¬q®É¶¡¤~¯à§¹¦¨¡C + ¦pªG±q·½½X½sĶ¹ï§A¨Ó»¡·|ªá¤Ó¦h®É¶¡ªº¸Ü¡A + ¤j³¡¤Àªº ports §A³£¯à§ä¨ì¨Æ¥ý½sĶ¦nªº®M¥ó¨Ó¦w¸Ë¡C + + ¦]¬° FreeBSD ¨ã¦³¬Û®e Linux ¤G¶i¨îªº¯S©Ê¡A + ³\¦h­ì¥ý¦b Linux ¤W¶}µoªºÀ³¥Îµ{¦¡³£¯à¦b§Aªº FreeBSD ®à­±Àô¹Ò°õ¦æ¡C + ¦b¦w¸Ë¥ô¦ó Linux À³¥Îµ{¦¡¤§«e¡A±j¯P«Øij§A¥ý¾\Ū + Linux °õ¦æ¬Û®e¼Ò¦¡³o­Ó³¹¸`¡C + ¦Ó³\¦h¥Î Linux ¤G¶i¨î¬Û®e¼Ò¦¡ªº³nÅé¦b ports ¸ÌÀY³q±`³£·|¥Î + linux- ¶}ÀY¡C + ·í§A¦b·j´M¬Y­Ó¯S©w³nÅé®É¡A°O¦í³oÂI¡A¨Ã¥B¥i¥H¨Ï¥Î &man.whereis.1; + ¨Ó§ä¡C ¦b¤U¦Cªº»¡©ú¤¤¡A + ³£°²³]§A¦b¦w¸Ë¥ô¦ó Linux À³¥Î³nÅ餧«e¡A + ¤w¸g¨Æ¥ý±Ò¥Î¤F Linux ¤G¶i¨î¬Û®e¼Ò¦¡¡C + + ¤U¦C¥Ø¿ý¬O³o³¹¤¤©Ò²[»\ªºÀ³¥Îµ{¦¡¡G - Browsers (such as Mozilla, + ÂsÄý¾¹ (¹³¬O Mozilla, Opera, Firefox, Konqueror) - Productivity (such as + ¿ì¤½³nÅé (¹³¬O KOffice, AbiWord, The GIMP, OpenOffice.org) - Document Viewers (such as &acrobat.reader;, + ¤å¥óÂsÄý³nÅé (¹³¬O &acrobat.reader;, gv, Xpdf, GQview) - Finance (such as + °]°È³B²z³nÅé (¹³¬O GnuCash, Gnumeric, Abacus) - Before reading this chapter, you should: + ¦b¾\Ū³o³¹¤§«e¡A§A¥²¶· - Know how to install additional third-party software + ª¾¹D¦p¦ó¦w¸Ë¨ä¥Lªº³nÅé(third-party software) (). - Know how to install additional Linux software + ª¾¹D¦p¦ó¦w¸Ë Linux ³nÅé (). - For information on how to get a multimedia environment, read - . If you want to set up and use - electronic mail, please refer to . + ­nª¾¹D§ó¦hÃö©ó¦h´CÅéÀô¹Òªº¸ê°T¡A½Ð¥ý¾\Ū + ¦h´CÅé³¹¸`¡C + ¦pªG§A·Q­n³]©w©M¨Ï¥Î¹q¤l¶l¥ó¡A¤]½Ð§A¥ý¬Ý ¶l¥ó³¹¸`¡C - Browsers + ÂsÄý¾¹ - browsers - web + ÂsÄý¾¹ + ºô¸ô - FreeBSD does not come with a particular browser - pre-installed. Instead, the - www - directory of the Ports Collection contains a lot of browsers - ready to be installed. If you do not have time to compile - everything (this can take a very long time in some cases) many - of them are available as packages. - - KDE and - GNOME already provide HTML browsers. - Please refer to for more information on - how to set up these complete desktops. - - If you are looking for light-weight browsers, you should - investigate the Ports Collection for + ¦b FreeBSD ¤¤¨Ã¨S¦³¹w¥ý¦w¸Ë¦nªº¯S©wÂsÄý¾¹¡C + ¦ý¦b Ports Collection ¤§¤¤«o¦³³\¦hÂsÄý¾¹¥i¨Ñ§A¦w¸Ë¨Ï¥Î¡C + ¦pªG§A¨S¦³¨¬°÷®É¶¡¥h½sĶ©Ò¦³ªºªF¦è + (¦b¬Y¨Ç±¡ªp¤U³o¥i¯à·|ªá¤W«Üªøªº¤@¬q®É¶¡)¡A + ³o¨Ç³£¦³²{¦¨ªº®M¥ó¥i¨Ñª½±µ¦w¸Ë¡C + + KDE ©M + GNOME ®à­±Àô¹Ò³£¤w´£¨Ñ HTML ÂsÄý¾¹¡C + ½Ð°Ñ¦Ò ¨Ó¤F¸Ñ§ó¦h¦³Ãö¦p¦ó³]©w³o¨Ç§¹¾ãªº®à­±Àô¹Ò¨t²Î¸ê°T¡C + + ¦pªG§A¦b´M§ä»´¶q¤ÆªºÂsÄý¾¹¡A§A¥i¥H±q Ports Collection ¤¤§ä¨ì¤U­±ªº´XºØ¡G www/dillo, - www/links, or - www/w3m. + www/links, ©Î + www/w3m¡C - This section covers these applications: + ³o¸`¤¶²Ð³o¨ÇÂsÄý¾¹¡G - Application Name - Resources Needed - Installation from Ports - Major Dependencies + ÂsÄý¾¹¦WºÙ + ©Ò»Ýªº¨t²Î¸ê·½ + ±q ports ¦w¸Ë®É¶¡ + ¥D­n¬Û¨Ìªº³nÅé Mozilla - heavy - heavy + ¦h + ªø Gtk+ Opera - light - light - FreeBSD and Linux versions available. The Linux - version depends on the Linux Binary Compatibility and + ¤Ö + µu + FreeBSD ©M Linux ªºª©¥»³£¦³¡C + Linux ªºª©¥»»Ý­n Linux ¤G¶i¨î¬Û®e¼Ò²Õ¥H¤Î linux-openmotif. Firefox - medium - heavy + ¤¤«× + ªø Gtk+ Konqueror - medium - heavy - KDE Libraries + ¤¤«× + ªø + KDE ¨ç¦¡®w Mozilla Mozilla - Mozilla is perhaps the most - suitable browser for your FreeBSD Desktop. It is modern, - stable, and fully ported to FreeBSD. It features a very - standards-compliant HTML display engine. It provides a mail - and news reader. It even has a HTML composer if you plan to - write some web pages yourself. Users of - &netscape; will recognize the - similarities with Communicator - suite, as both browsers shared the same basis. - - On slow machines, with a CPU speed less than 233MHz or - with less than 64MB of RAM, Mozilla - can be too resource-consuming to be fully usable. You may - want to look at the Opera browser - instead, described a little later in this chapter. - - If you cannot or do not want to compile - Mozilla for any reason, the FreeBSD - GNOME team has already done this for you. Just install the - package from the network by: + Mozilla + ¤]³\¬O³Ì¾A¦X FreeBSD ®à­±Àô¹ÒªºÂsÄý¾¹¡C + ¥¦·¥¨ã²{¥N¤Æ¡Bí©w¥B§¹¥þ²¾´Ó¦Ü FreeBSD ¨t²Î¤W¡C + ¥¦¤]¨ã³Æ¦³¤Q¤À²Å¦X HTML ¼Ð·ÇªºÅã¥Ü¤ÞÀº¡A + ¥¦§ó´£¨Ñ¤F¶l¥ó¤Î·s»D¸s²Õªº¾\Ū¥\¯à¡C + ¦¹¥~¦pªG§A¥´ºâ­n¦Û¤v¼g¤@¨Çºô­¶ªº¸Ü¡A¥¦ÁÙ´£¨Ñ¤F HTML ªº½s¿è¾¹¡C + ¦pªG¬O &netscape; ªº¨Ï¥ÎªÌ¡A + §A¥i¯à·|»{¥X³o¸ò Communicator «Ü¹³¡A + ¥¦­Ì¨ä¹ê¦P¼Ë¬O¨Ï¥Î¬Û¦P°ò¦ªºÂsÄý¾¹¡C + + ¦b³t«×¸ûºC¡A¹³¬O CPU ³t«×¤Ö©ó 233MHz ©Î¬O¤p©ó 64MB °O¾ÐÅ骺¾÷¾¹¤W­±¡A + §¹¥þ¨Ï¥Î Mozilla ·|¬O¥ó·¥«×¯Ó¶O¸ê·½ªº¨Æ¡C + ©Ò¥H¦b³o¼Ëªº¾÷¾¹¤W­±¡A§A¥i¯à·|·Q­n¨Ï¥Î Opera + ³o¼Ë»´¶q¯ÅªºÂsÄý¾¹¡A¦Ó±µ¤U¨Ó«á­±·|´£¨ì¡C + + + ¦pªG§A¦³¤°»ò­ì¦]¤£¯à©Î¬O¤£·Q½sĶ + Mozilla ªº¸Ü¡AFreeBSD + GNOME ¹Î¶¤¤w¸g¬°§A°µ¦n¤F³o¥ó¨Æ¡C + ¥u­n¥Î¤U­±ªº«ü¥O³z¹Lºô¸ô¦w¸Ë®M¥ó´N¦æ¤F¡G &prompt.root; pkg_add -r mozilla - If the package is not available, and you have enough time - and disk space, you can get the source for - Mozilla, compile it and install it - on your system. This is accomplished by: + ¦pªG¨S¦³§ä¨ì®M¥ó¥i¥H¨Ï¥Î¡A¦Ó§A¤]¦³¨¬°÷ªº®É¶¡©MºÏºÐªÅ¶¡¨Ó½sĶ + Mozilla ¨Ã¦w¸Ë¨ì§Aªº¨t²Î¤¤¡A + §A¥i¥H³z¹L¤U¦C¨BÆJ¨Ó¦w¸Ë¡G &prompt.root; cd /usr/ports/www/mozilla &prompt.root; make install clean - The Mozilla port ensures a - correct initialization by running the chrome registry setup - with root privileges. However, if you - want to fetch some add-ons like mouse gestures, you must run - Mozilla as - root to get them properly - installed. - Once you have completed the installation of - Mozilla, you do not need to be - root any longer. You can start - Mozilla as a browser by typing: + Mozilla »Ý­n¨Ï¥Î + root ªºÅv­­¨Ó°õ¦æ chrome + µù¥U¨Ó½T«O¥¿½Tªºªì©l¤Æ¡C + ¥t¥~¡A¦pªG§A»Ý­n§ì¤@¨ÇÃB¥~ªº¥~±¾µ{¦¡¹³¬O mouse gestures¡A + §A´N¥²¶·­n¨Ï¥Î root ªºÅv­­¨Ó¦w¸Ë¡A + ¥H¾A·íªº¦w¸Ë³o¨Ç¥~±¾µ{¦¡¡C + + ¤@¥¹§A§¹¦¨¤F Mozilla ªº¦w¸Ë¡A + ¡@§A´N¦A¤]¤£»Ý­n root ªºÅv­­¤F¡C + ¡@§A¥i¥Hª½±µ¥´¤U­±ªº«ü¥O¨Ó±Ò°Ê Mozilla¡G &prompt.user; mozilla - You can start it directly as a mail and news reader as - shown below: + §A¤]¥i¥Hª½±µ¥´¤U­±ªº«ü¥Oª½±µ±Ò°Ê¶l¥ó©M·s»D¾\Ū¾¹¡G &prompt.user; mozilla -mail Tom Rhodes Contributed by - Mozilla and &java; plugin + Mozilla and &java; ¥~±¾µ{¦¡ + + ¥u¦w¸Ë Mozilla «Ü²³æ¡A + ¦ý¦w¸Ë¹³¬O &java; ©M ¯omedia; &flash; + ¤§Ãþªº¥~±¾µ{¦¡¤ä´©´N»Ý­n¯Ó¶O®É¶¡©MµwºÐªÅ¶¡¤F¡C - Installing Mozilla is simple, but - unfortunately installing Mozilla with - support for add-ons like &java; and - ¯omedia; &flash; - consumes both time and disk - space. - - The first thing is to download the files which will be used - with Mozilla. Take your current web - browser up to - and - create an account on their website. Remember to save the username - and password from here as it may be needed in the future. Download - the jdk-1_5_0-bin-scsl.zip (JDK 5.0 - SCSL Binaries) and jdk-1_5_0-src-scsl.zip (JDK 5.0 - SCSL Source) files and place them in - /usr/ports/distfiles as the port will not - fetch them automatically. This is due to license restrictions. While - we are here, download the java environment from - . - The filename is j2sdk-1_4_2_08-linux-i586.bin. - Like before, this file must be placed into - /usr/ports/distfiles. Download a copy - of the java patchkit from + ­º¥ý¤U¸ü Mozilla¡@©Ò»Ý­nªºÀɮסC + ¥Î§Aªººô­¶ÂsÄý¾¹³s¨ì + + ¨Ãµù¥U¤@­Ó±b¸¹¡C + °O±o­n«O¦s¦n³o²Õ¨Ï¥ÎªÌ±b¸¹©M±K½X¡Aº¸«á·|¦A¥Î¨ì¡C + ±µ¤U¨Ó¤U¸ü jdk-1_5_0-bin-scsl.zip (JDK 5.0 + SCSL ¤G¶i¦ìÀÉ) ©M jdk-1_5_0-src-scsl.zip (JDK 5.0 + SCSL ·½½X) ³o¨â­ÓÀɮרéñ¦b /usr/ports/distfiles ¥Ø¿ý¤U¡A + ¦]¬°±ÂÅvªº­­¨î¡A©Ò¥H port ¤£¯à¦Û°Ê¤U¸ü³o¨ÇÀɮסC + ¦P®É¤]­n±q + ¤U¸ü¡ujava¡@Àô¹Ò¡v¡A + ³o­ÓÀɮצWºÙ¬O j2sdk-1_4_2_08-linux-i586.bin¡C + ´N¹³¥ý«e´y­zªº¤@¼Ë¡A³o­ÓÀÉ®×¥²¶·©ñ¦b + /usr/ports/distfiles ¥Ø¿ý©³¤U¡C + ¥t¥~¤]­n±q - and place it - into /usr/ports/distfiles. Finally, install the - java/jdk15 port - with the standard make install clean. + ¤U¸ü¡ujava ­×¸Éµ{¦¡¶°¡v¨Ã©ñ¦b /usr/ports/distfiles ¥Ø¿ý¤¤¡C + ³Ì«á¥Î¼Ð·Çªº¦w¸Ë«ü¥O make install clean ±q port ¤¤¨Ó¦w¸Ë + java/jdk15 - Start Mozilla and access the - About Plug-ins option from the - Help menu. &java; - plugin should be listed there now. + ±µ¤U¨Ó¶}±Ò Mozilla¡A + ¨Ã¥B±q¨ó§U(Help)¿ï³æ¤¤¿ï¨úÃö©ó¥~±¾µ{¦¡(About Plug-ins)¡C + §A´N¥i¥H¬Ý¨ì &java; ªº¥~±¾µ{¦¡´N·|¥X²{¦b¸Ì­±¤F¡C - Mozilla and ¯omedia; &flash; plugin - - ¯omedia; &flash; plugin is not available for &os;. However, - a software layer (wrapper) for running the Linux version of the plugin - exists. This wrapper also supports &adobe; &acrobat; plugin, - RealPlayer plugin and more. - - Install the www/linuxpluginwrapper - port. This port requires - emulators/linux_base which is a - large port. Follow the instructions displayed by the port to set up - your /etc/libmap.conf correctly! Example - configurations are installed into - /usr/local/share/examples/linuxpluginwrapper/ - directory. - - Install the www/mozilla port, - if Mozilla is not already installed. - - Now just start Mozilla with: + Mozilla and ¯omedia; &flash; ¥~±¾µ{¦¡ + + + Ķµù¡G¦b FreeBSD ¤W­±¨S¦³­ì¥Íªº ¯omedia; &flash; ¥~±¾µ{¦¡¡A + ¡@¦ý¬O¦b Ports Collection ¤¤¦³ www/mozilla-plugin + ³o­Ó®Ú¾Ú GPL ¿W¥ßªº &flash; Mozilla ¥~±¾µ{¦¡¡C + ¤£¹L§Ú­Ì±j¯P«Øij¦w¸Ë³nÅé¼hªº wrapper ¨Ó°õ¦æ Linux ª©¥»ªº¥~±¾µ{¦¡¡C + ³o­Ó wrapper ¦P®É¤]¤ä´© &adobe; &acrobat; ÁÙ¦³ RealPlayer ¥~±¾µ{¦¡µ¥¡C + + + ±q port ¦w¸Ë www/linuxpluginwrapper¡C + linuxpluginwrapper »Ý­n¥ý¸Ë¤@­Ó«Ü¤jªº emulators/linux_base + port¡C µM«á®Ú¾Ú port ¤¤«ü¥Üªº§@ªk + Ķµù¡G¦w¸Ë§¹®ÉÅã¥Üªº»¡©ú¡A©Î°Ñ¾\ pkg_message) + ¥h¥¿½T¦a³]©w§Aªº /etc/libmap.conf¡C + ³]©wªº½d¨ÒÀɮצì©ó /usr/local/share/examples/linuxpluginwrapper/ + ªº¥Ø¿ý©³¤U¡C + + ¦pªG Mozilla ÁÙ¨S¦w¸Ëªº¸Ü¡A + ±q www/mozilla port ¨Ó¦w¸Ë¡C + + ²{¦b¥u­n¥Î¤U¦Cªº«ü¥O±Ò°Ê Mozilla ¡G &prompt.user; mozilla & - And access the About Plug-ins option from the - Help menu. A list should appear with all the currently - available plugins. - + ±µ¤U¨Ó¶}±Ò Mozilla¡A + ¨Ã¥B±q¨ó§U(Help)¿ï³æ¤¤¿ï¨úÃö©ó + ¥~±¾µ{¦¡(About Plug-ins)¡C + §A´N¥i¥H¬Ý¨ì©Ò¦³¦w¸Ë¦nªº¥~±¾µ{¦¡¤§¦Cªí²M³æ¡C + + + ¤£¹L¦pªG§A¦b Mozilla + ©Î¤U­±´£¨ìªº Firefox + ¤¤¨Ï¥Î¤W­zªº¤èªkÁÙ¬OµLªk¥¿±`ªº±Ò¥Î &flash; ¥~±¾µ{¦¡ªº¸Ü¡A + ®Ú¾Ú Beech Rintoul ¦b¶l¥ó½×¾Â¤¤ªº¸Ñ¨M¤è®×¦p¤U¡G + + ¦b¦w¸Ë www/linuxpluginwrapper ¤§«e¡A + °õ¦æ¤U¦C¨BÆJ¡G + + &prompt.root; rm -R /usr/X11R6/lib/browser_linux_plugins +&prompt.root; ln -s /usr/X11R6/lib/browser_plugins /usr/X11R6/lib/browser_linux_plugins + + ±µ¤U¨Ó¥Î¤U¦Cªº«ü¥O¨Ó½sĶ www/linuxpluginwrapper + + &prompt.root; cd /usr/ports/www/linuxpluginwrapper&prompt.root; make -DWITH_PLUGINS install clean + - The linuxpluginwrapper only works on - the &i386; system architecture. + linuxpluginwrapper ¥u¯à¦b + &i386; ªº¨t²Î¬[ºc¤U¹B¦æ¡C Opera Opera - Opera is a very fast, - full-featured, and standards-compliant browser. It comes in - two favors: a native FreeBSD version and a - version that runs under Linux emulation. + Opera ¬O­Ó¨ã³Æ§¹¾ã¥\¯à¡B²Å¦X¼Ð·ÇªºÂsÄý¾¹¡C + ¥¦¦P®É¤]¨ã³Æ¤F¤º«Øªº¶l¥ó©M·s»D¾\Ū¾¹¡BIRC¡BRSS/Atom feeds ¾\Ū¾¹µ¥¡C + ¾¨ºÞ¦p¦¹¡A¬Û¹ï¦Ó¨¥ Opera ¬O­Ó»´¶q¯Å¡B°õ¦æ³t«×¤S§ÖªºÂsÄý¾¹¡C + ¥¦¦b ports ¤¤¦³¨âºØª©¥»¡G¡u­ì¥Í¡vªº FreeBSD ª©¥»ÁÙ¦³¦b Linux ¼ÒÀÀ¼Ò¦¡¤Uªºª©¥»¡C - To browse the Web with the FreeBSD version of Opera, - install the package: + ­n¥Î Opera ªº FreeBSD ª©¥»¨ÓÂsÄýºô­¶ªº¸Ü¡A + ¥Î¤U­±ªº«ü¥O¦w¸Ë¡G &prompt.root; pkg_add -r opera - Some FTP sites do not have all the packages, but the same - result can be obtained with the Ports Collection by - typing: + ¦³¨Ç FTP ¯¸¥x¨Ã¨S¦³¥þ³¡ªº®M¥ó¡A + ¦ý¬O¥´¤U­±ªº«ü¥O´N¯à±q Ports Collection ¤¤¦w¸Ë¡G &prompt.root; cd /usr/ports/www/opera &prompt.root; make install clean - To install the Linux version of - Opera, substitute - linux-opera in place of - opera in the examples above. The Linux - version is useful in situations requiring the use of plug-ins - that are only available for Linux, such as Adobe - &acrobat.reader;. In all other respects, the - FreeBSD and Linux versions appear to be functionally - identical. - + ­n¦w¸Ë Opera ªº Linux ª©¥»ªº¸Ü¡A + ½Ð±N¤W­±¨Ò¤l¤¤ªº opera ´À´«¦¨ + linux-opera¡C + ¦³¨Ç®É­Ô¡A Linux ªºª©¥»¬O¤Q¤À¦³¥Îªº¡A + ¹³¬O¥u¦³ Linux ª©¥»¥~±¾µ{¦¡ªº®É­Ô¡C + ¦ý¦b¨ä¥L¤è­±¨Ó»¡¡A FreeBSD ©M Linux ªºª©¥»¥\¯à¤W¬O¤@¼Ëªº¡C + Firefox Firefox - Firefox is the next-generation - browser based on the Mozilla - codebase. Mozilla is a complete - suite of applications, such as a browser, a mail client, a chat - client and much more. Firefox is - just a browser, which makes it smaller and faster. + Firefox ¬O«Øºc¦b + Mozilla ·½½X®w¤¤ªº¤U¤@¥NÂsÄý¾¹¡C + Mozilla ¬O¤@­Ó§¹¾ãªººô­¶³nÅé¾ã¦X¤è®×¡A + ¹³¬O¶l¥ó¦¬µoµ{¦¡¡B²á¤Ñ«Çµ{¦¡¤Î¨ä¥Lµ{¦¡µ¥¡C + Firefox ´N¥u¬O­Ó³æ¯ÂªºÂsÄý¾¹¡A + ³o¤]¬OÅý¥¦µu¤pºë®«ªº­ì¦]¡C - Install the package by typing: + §A¥i¥H¥´¥H¤Uªº«ü¥O¨Ó¦w¸Ë¡G &prompt.root; pkg_add -r firefox - You can also use the Ports Collection if you - prefer to compile from source code: - + ¦pªG§A¤ñ¸û³ßÅw±q·½½X¦w¸Ëªº¸Ü¡A§A¤]¥i¥H¦b Ports Collection ¤¤¥´¥H¤U«ü¥O¡G + &prompt.root; cd /usr/ports/www/firefox &prompt.root; make install clean Konqueror Konqueror - Konqueror is part of - KDE but it can also be used outside - of KDE by installing - x11/kdebase3. - Konqueror is much more than a browser, - it is also a file manager and a multimedia viewer. + Konqueror ¬O KDE + ®à­±¨t²Îªº¤@³¡¤À¡A¦ý¬O¥¦¤]¥i¥HÂǥѦw¸Ë + x11/kdebase3 + ¦b KDE Àô¹Ò¥H¥~¨Ï¥Î¡C + Konqueror ¤£¥u¬O­Óºô­¶ÂsÄý¾¹¡A + ¥L¦P®É¤]¬OÀɮ׺޲z¾¹©M¦h´CÅéÂsÄý¾¹¡C - Konqueror also comes with a set of plugins, - available in misc/konq-plugins. + Konqueror ¤]¦³³\¦hªº¥~±¾µ{¦¡¡A + ³o¨Ç¥~±¾µ{¦¡¥i¥H±q misc/konq-plugins + ¤¤¦w¸Ë¡C - Konqueror also supports &flash; and a How To - is available at . + Konqueror ¤]¤ä´© &flash; ªº¥~±¾µ{¦¡¡C + ¦p¦ó¦w¸Ëªº»¡©ú½Ð°Ñ¾\¡G¡C - Productivity + ¿ì¤½«Ç³nÅé - When it comes to productivity, new users often look for a - good office suite or a friendly word processor. While some - desktop environments like - KDE already provide an office suite, - there is no default application. FreeBSD provides all that is - needed, regardless of your desktop environment. + ·í¶}©l¶i¦æ¿ì¤½¡A + ·sªº¨Ï¥ÎªÌ³q±`·|¥h§ä¦n¥Îªº¿ì¤½«Ç³nÅé©Î¬O¦n¤W¤âªº¤å¦r³B²z¾¹¡C + ¥Ø«e ¦³¨Ç®à­±Àô¹Ò ¹³¬O + KDE¤w¸g´£¨Ñ¤F¿ì¤½³nÅé²Õ¦Xªº®M¥ó¡C + FreeBSD ´£¨Ñ¤F©Ò»Ýªº©Ò¦³¿ì¤½³nÅé¡A®à­±Àô¹Ò¤]¤£¨Ò¥~¡C - This section covers these applications: + ³o¸`²[»\¤F¤U¦Cªº³o¨Ç³nÅé¡G - Application Name - Resources Needed - Installation from Ports - Major Dependencies + ³nÅé¦WºÙ + ©Ò»Ý¨t²Î¸ê·½ + ±q Ports ¦w¸Ëªº®É¶¡ + ¥D­n¬Û¨Ì®M¥ó KOffice - light - heavy + ¤Ö + ªø KDE AbiWord - light - light - Gtk+ or GNOME + ¤Ö + µu + Gtk+ ©Î¬O GNOME The Gimp - light - heavy + ¤Ö + ªø Gtk+ OpenOffice.org - heavy - huge + ¦h + «Ü¤[ &jdk; 1.4, Mozilla KOffice KOffice - office suite + ¿ì¤½³nÅé®M¥ó KOffice - The KDE community has provided its desktop environment - with an office suite which can be used outside - KDE. It includes the four standard - components that can be found in other office suites. - KWord is the word processor, - KSpread is the spreadsheet program, - KPresenter manages slide - presentations, and Kontour lets you - draw graphical documents. - - Before installing the latest - KOffice, make sure you have an - up-to-date version of KDE. - - To install KOffice as a - package, issue the following command: - + KDE ªÀ¸s¦b¥¦ªº®à­±Àô¹Ò¸ÌÀY´£¨Ñ¤F¤@­Ó¥i¥H¦b KDE + ¥~¨Ï¥Îªº¿ì¤½³nÅé²Õ¦X¡C ¥¦¥]§t¤F¥|ºØ¼Ò²Õ¡G + KWord ¬O¤å¦r³B²z¾¹¡A + KSpread ¬O¸Õºâªíµ{¦¡¡A + KPresenter ¬O²³ø¼½©ñµ{¦¡¡A + ¥t¥~ Karbon14 Åý§A¥i¥H²£¥Í¹Ï§Î¤Æªº¤å¥ó¡C + Ķµù¡GKarbon14 ¬O¦V¶qø¹Ï³nÅé¡A¥H«e¥s Kontour ¡A§ó¦­¤§«eºÙ¬° Killustrator¡C + + + + ¦b¦w¸Ë³Ì·sª©ªº KOffice ¤§«e¡A + ½Ð¥ý½T©w§A¦³³Ì·sª©¥»ªº KDE¡C + + ­Y­n¥Î®M¥ó¨Ó¦w¸Ë KOffice¡A + ½Ð¨Ì·Ó¤U­±ªº«ü¥O¡G + &prompt.root; pkg_add -r koffice - If the package is not available, you can use the ports - collection. For instance, to install - KOffice for - KDE3, do: + ¦pªG®M¥ó¤£¦s¦bªº¸Ü¡A§A¥i¥H¨Ï¥Î ports + collection. ¨Ò¦p­n¦w¸Ë KDE3 ¤¤ªº + KOffice¡A½Ð¨Ï¥Î¤U¦C«ü¥O¦w¸Ë¡G &prompt.root; cd /usr/ports/editors/koffice-kde3 &prompt.root; make install clean AbiWord AbiWord - AbiWord is a free word - processing program similar in look and feel to µsoft; Word. - It is suitable for typing papers, letters, reports, memos, and - so forth. It is very fast, contains many features, and is - very user-friendly. - - AbiWord can import or export - many file formats, including some proprietary ones like - Microsoft .doc. + AbiWord + ¬O¤@­Ó§K¶Oªº¤å¦r³B²z³nÅé¡A¥~Æ[©M·Pı³£ªñ¦ü©ó µsoft; Word¡C + ¥¦¾A¦X³B²z¤å¥ó¡B«H¥ó¡B³ø§i¡B³Æ§Ñ¿ýµ¥µ¥¡C + ¥¦¤]«D±`§Ö³t¡A¥]§t¤F³\¦h¥\¯à¦Ó¥B«D±`®e©ö¤W¤â¡C - AbiWord is available as a - package. You can install it by: + AbiWord ¥i¥H¿é¤J©Î¿é¥X³\¦hÀɮ׮榡¡A + ¥]¬A¤@¨Ç¦³±M§Qªº®æ¦¡¡A¨Ò¦p·L³n(Microsoft)¤½¥qªº + .doc ®æ¦¡¡C + AbiWord ¤]¯à¥Î®M¥ó¦w¸Ë¡A + §A¥i¥H¥Î¤U¦C«ü¥O¨Ó¦w¸Ë¡G + &prompt.root; pkg_add -r abiword - If the package is not available, it can be compiled from - the Ports Collection. The Ports Collection should be more - up to date. It can be done as follows: + ¦pªG§ä¤£¨ì®M¥óªº¸Ü¡A¥¦¤]¥i¥H±q Ports Collection ¤¤½sĶ¦w¸Ë¡C + ¦Ó Ports Collection À³¸Ó­n«O«ù¦b³Ì·sªºª¬ºA¡C + AbiWord ¥i¥H³z¹L¤U¦C¤è¦¡½sĶ¦w¸Ë¡G &prompt.root; cd /usr/ports/editors/abiword &prompt.root; make install clean The GIMP The GIMP - For image authoring or picture retouching, - The GIMP is a very sophisticated - image manipulation program. It can be used as a simple paint - program or as a quality photo retouching suite. It supports a - large number of plug-ins and features a scripting interface. - The GIMP can read and write a wide - range of file formats. It supports interfaces with scanners - and tablets. - - You can install the package by issuing this - command: + ¹ï©ó¼v¹³ªº½s¿è¤Î­×§ï¨Ó»¡¡AGIMP + ¬O«D±`ºë½oªº¼v¹³³B²z³nÅé¡C + ¥¦¥i¥H·í§@²³æªºÃ¸¹Ï³nÅé©Î¬O°ª«~½èªº¬Û¤ù³B²z³nÅé¡C + ¥¦¤ä´©¬°¼Æ²³¦hªº¥~±¾µ{¦¡¤Î«ü¥O½Z (script-fu) ¤¶­±¡C + GIMP ¥i¥HŪ¼g³\¦hÀɮ׮榡¡C + ¥¦¤]¤ä´©±½´y¾¹ + + Ķµù¡G§A¥²¶·³z¹L sane-frontends ©Î xsane ¨Ó±½´y + ©M¤â¼gªO¡C + + Ķµù¡GGIMP ¦b¥Ø«e¬O 2.x ª©¡A¦pªG§A·Q­n¦w¸Ë + 1.x ª©ªº¸Ü¡A½Ð¥Î Ports Collection ¤¤ªº + graphics/gimp1¡C + ¥t¥~¦pªG§A¤w¸g¨Ï¥Î²ßºD Adobe Photoshop ¡A¦Ó¥B¤£²ßºD + GIMP ¤¶­±ªº¸Ü¡A§A¤]¥i¥H¹Á¸Õ¦w¸Ë + graphics/gimpshop¡A + ¥¦ªº¨Ï¥Î¤¶­±¤Q¤ÀÃþ¦ü Adobe Photoshop¡C + + §A¥i¥H¨Ï¥Î¤U­±«ü¥O¦w¸Ë®M¥ó¡G &prompt.root; pkg_add -r gimp - If your FTP site does not have this package, you can use - the Ports Collection. The + ¦pªGªº§Aªº FTP ¯¸¥x¨S¦³³o­Ó®M¥ó¡A§A¥i¥H¨Ï¥Î + Ports Collection¡C ¦b Ports Collection ªº graphics - directory of the Ports Collection also contains - The Gimp Manual. Here is how to - get them installed: + ¥Ø¿ý¤U¤]¥]§t¤F + The Gimp Manual(GIMP ¨Ï¥Î¤â¥U)¡C + ¤U­±¥Ü½d¦p¦ó¦w¸Ë³o¨Çµ{¦¡¡G &prompt.root; cd /usr/ports/graphics/gimp &prompt.root; make install clean &prompt.root; cd /usr/ports/graphics/gimp-manual-pdf &prompt.root; make install clean - - The - graphics - directory of the Ports Collection holds the development - version of The GIMP in - graphics/gimp-devel. - An HTML version of - The Gimp Manual is available from - graphics/gimp-manual-html. - + Ķµù¡G¥t¥~¦b Ports Collection ¤¤¤]¦³¤@¨Ç¥~±¾µ{¦¡¥i¥H¨Ï¥Î¡A + ¨Ò¦p»¡¥i¥H³B²z¼Æ¦ì¬Û¾÷ raw Àɮ׮榡ªº gimp-ufraw¡C + + + GIMP ¨Ï¥Î¤â¥U¤]¦³ HTML ®æ¦¡ªº¡A§A¥i¥H¦b + graphics/gimp-manual-html + ¤¤¦w¸Ë¡C + OpenOffice.org OpenOffice.org office suite OpenOffice.org - OpenOffice.org includes all of the - mandatory applications in a complete office productivity - suite: a word processor, a spreadsheet, a presentation manager, - and a drawing program. Its user interface is very similar - to other office suites, and it can import and export in various - popular file formats. It is available in a number of - different languages including interfaces, spell checkers, and - dictionaries. - - The word processor of - OpenOffice.org uses a native XML - file format for increased portability and flexibility. The - spreadsheet program features a macro language and it can be - interfaced with external databases. - OpenOffice.org is already stable - and runs natively on &windows;, &solaris;, Linux, FreeBSD, - and &macos; X. More - information about OpenOffice.org - can be found on the - OpenOffice.org web site. - For FreeBSD specific information, and to directly - download packages use the OpenOffice.org ¥]§t¤F©Ò¦³§¹¾ãªº¿ì¤½³nÅé²Õ¦X¡G + ¤å¦r³B²z¾¹¡B¸Õºâªí¡B²³ø³nÅéÁÙ¦³Ã¸¹Ï³nÅé¡C + °£¤F¥¦ªº¨Ï¥ÎªÌ¤¶­±«D±`Ãþ¦ü¨ä¥Lªº¿ì¤½³nÅé¡A + ¥LÁÙ¯à°÷¿é¤J©M¿é¥X³\¦h¼öªùªºÀɮ׮榡¡C + ¥¦¤]¥]§t¤F¤£¦P»y¨¥ªº¨Ï¥ÎªÌ¤¶­±¡B«÷¦rÀˬd©M¦r¨å¡C + + OpenOffice.org + ªº¤å¦r³B²z¾¹¨Ï¥Î XML Àɮ׮榡¨Ó¼W¥[²¾´Ó©Ê¤Î¼u©Ê¡C + ¸Õºâªíµ{¦¡¤ä´©¥¨¶°(macro)¥\¯à¦Ó¥B¯à°÷¨Ï¥Î¥~¨Óªº¸ê®Æ®w¤¶­±¡C + OpenOffice.org ¤w¸g¤Q¤Àí©w¡A + ¨Ã¥B¯à°÷¦b &windows;, &solaris;, Linux, FreeBSD ¤Î + &macos; X µ¥§@·~¨t²Î¤W­±°õ¦æ¡C + ·Qª¾¹D§ó¦hÃö©ó OpenOffice.org + ªº¸ê°T¥i¥H¦b + OpenOffice.org ºô­¶ + ¤W¬d¸ß¡C§A¤]¥i¥H¦b FreeBSD OpenOffice.org - Porting Team's web site. + ²¾´Ó¹Î¶¤ + ªººô­¶¤W¬d¸ßÃö©ó FreeBSD ¤W OpenOffice ¯S©wªº¸ê°T©Îª½±µ¤U¸ü¤w½sĶ¦nªº®M¥ó - To install OpenOffice.org, - do: + ­n¦w¸Ë OpenOffice.org¡A + ½Ð¥Î¥H¤U¤è¦¡¨Ó°õ¦æ¡G &prompt.root; pkg_add -r openoffice - When running a -RELEASE version of &os;, this should work. - Otherwise, you should look on the &os; OpenOffice.org Porting Team's - web site to download and install the appropriate package - using &man.pkg.add.1;. Both the current release and - development version are available for download at this - location. + ·í§A¦b¨Ï¥Î &os; -RELEASE ª©¥»ªº®É­Ô¡A¤W­±ªº§@ªkÀ³¸Ó¦æ±o³q¡C + ­n¬O¨ä¥Lªºª©¥»¡A§AÀ³¸Ó¬Ý¤@¤U &os; OpenOffice.org + ²¾´Ó¹Î¶¤ªººô¯¸¡A¨Ã¥B¥Î &man.pkg.add.1; ¦w¸Ë¦X¾Aªº®M¥ó¡C + ¦b³o­Ó¯¸¥x³£¥i¥H¤U¸ü¨ìí©wªºÄÀ¥Xª©(release)©Î¶}µo¤¤ªºª©¥»¡C - Once the package is installed, you just have to type the - following command to run - OpenOffice.org: + ·í¤w¸g¦w¸Ë§¹¤§«á¡A§A¥u­nÁä¤J¤U­±ªº«ü¥O´N¯à°õ¦æ + OpenOffice.org¡G &prompt.user; openoffice.org + + Ķµù¡GºÝ¬Ý§Aªºª©¥»¡A¦³®É­Ô»Ý­n¿é¤J¦p openoffice.org-2.0.1 ¤§Ãþªº«ü¥O¡A + ¤£¹L§A¤]¥i¥H¥Î shell ¤¤ªº alias ©Î¬O¥Î symbolic link ¨Ó³B²z¡C - During the first launch, you will be asked some - questions and a .openoffice.org2 folder - will be created in your home directory. + ¦b²Ä¤@¦¸±Ò°Êªº®É­Ô¡AOpenOffice ·|°Ý¨ì¤@¨Ç°Ý´£¡C + ¦Ó¥B¦b§Aªº®a¥Ø¿ý©³¤U·|¦Û°Ê«Ø¥ß¤@­Ó .openoffice.org2 + ªº¸ê®Æ§¨¡C - If the OpenOffice.org packages - are not available, you still have the option to compile the - port. However, you must bear in mind that it requires a lot of - disk space and a fairly long time to compile. + ¦pªGµLªk¨ú±o OpenOffice.org + ªº®M¥ó¡A§A¤´µM¥i¥H¿ï¾Ü±q port ½sĶ¡C + ¤£¹L§A¥²¶·ÂÔ°O¦b¤ß¡G½sĶªº¹Lµ{·|»Ý­n¤j¶qªººÏºÐªÅ¶¡¥B¬Û·í¯Ó®É¡C &prompt.root; cd /usr/ports/editors/openoffice.org-2.0 &prompt.root; make install clean - If you want to build a localized version, replace the - previous command line with the following: + ¦pªG§A·Q­n¦w¸Ë¥»¦a¤Æªºª©¥»¡A§â«e­±ªº«ü¥O¥N´«¦¨¤U­±ªº¡G - &prompt.root; make LOCALIZED_LANG=your_language install clean + &prompt.root; make LOCALIZED_LANG=§Aªº»y¨¥ install clean - You have to replace - your_language with the correct - language ISO-code. A list of supported language codes is - available in the - files/Makefile.localized file, located - in the port directory. + §A¥²¶·§â§Aªº»y¨¥ + ´«¦¨¥¿½Tªº»y¨¥ ISO-code Ķµù¡G¦p»OÆW¥¿Å餤¤å¨Ï¥ÎªÌ¬° zh-TW)¡C + ©Ò¤ä´©ªº»y¨¥¥N½X²M³æ¥i¥H¦b port ¥Ø¿ý¸Ìªºfiles/Makefile.localized + Àɮפ¤§ä¨ì¡C + - Once this is done, - OpenOffice.org can be launched with - the command: + ¤@¥¹§¹¦¨¤F¤W­z¨BÆJ¡A + OpenOffice.org ¥i¥Î¥H¤U«ü¥O±Ò°Ê¡G &prompt.user; openoffice.org + - Document Viewers + ¤å¥ó¾\Äý¾¹ - Some new document formats have recently gained popularity. - The standard viewers they require may not be available in the - base system. We will see how to install them in this - section. + ªñ¦~¨Ó¦³¨Ç¤å¥ó®æ¦¡Åܱo·U¨Ó·U¬y¦æ¡A + °ò¥»ªº¨t²Î¤¤¤]³\¤£·|¦³³o¨Ç®æ¦¡©Ò»Ýªº¼Ð·Ç¾\Äý¾¹¡C + ¦b³o¤@¸`¡A§Ú­Ì¨Ó¬Ý¬Ý«ç»ò¦w¸Ë³o¨Ç³nÅé¡C - This section covers these applications: + ³o±i²[»\¤F¤U¦Cªº³nÅé - Application Name - Resources Needed - Installation from Ports - Major Dependencies + ³nÅé¦WºÙ + ©Ò»Ý¨t²Î¸ê·½ + ±q Ports ¦w¸Ë®É¶¡ + ¥D­n¬Û¨Ì®M¥ó &acrobat.reader; - light - light - Linux Binary Compatibility + ¤Ö + µu + Linux ¤G¶i¨î¬Û®e¼Ò²Õ gv - light - light + ¤Ö + µu Xaw3d Xpdf - light - light + ¤Ö + µu FreeType GQview - light - light - Gtk+ or GNOME + ¤Ö + µu + Gtk+ ©Î¬O GNOME &acrobat.reader; Acrobat Reader PDF - viewing + ¾\Äý - Many documents are now distributed as PDF files, - which stands for Portable Document Format. One - of the recommended viewers for these types of files is - &acrobat.reader;, released by Adobe - for Linux. As FreeBSD can run Linux binaries, it is also - available for FreeBSD. + ³\¦h¤å¥ó¦b´²§Gªº®É­Ô³£¬O¥Î PDF ªºÀɮ׮榡¡A + ³o­Ó®æ¦¡¬O°ò©ó ¥iÄ⦡¤å¥ó®æ¦¡(Portable Document Format)¡C + ¨ä¤¤¤@­Ó±ÀÂ˪º¾\Äý³nÅé´N¬O&acrobat.reader;¡A + ¥¦¬O¥Ñ Adobe ¤½¥qµo¦æµ¹ Linux ¨Ï¥Îªºª©¥»¡C + ¦]¬° FreeBSD ¤]¥i¥H°õ¦æ Linux ¤G¶i¦ìÀɮסA + ©Ò¥H¥¦¤]¯à¦b FreeBSD ¤W­±°õ¦æ¡C - To install &acrobat.reader; 7 from - the Ports collection, do: + + ­n±q Ports collection ¤¤¦w¸Ë + &acrobat.reader; 7 + ¥u­n¡G &prompt.root; cd /usr/ports/print/acroread7 &prompt.root; make install clean - A package is not available due to licencing restrictions. + ¦]¬°±ÂÅvªº­­¨î¡A©Ò¥H¤£´£¨Ñ½sĶ¦nªº®M¥ó¡C gv gv PDF viewing PostScript - viewing + ¾\Äý - gv is a &postscript; and PDF - viewer. It is originally based on - ghostview but it has a nicer look - thanks to the Xaw3d library. It is fast and its interface is - clean. gv has many features like - orientation, paper size, scale, or antialias. Almost any - operation can be done either from the keyboard or the - mouse. - - To install gv as a package, - do: + gv¬O &postscript; ©M PDF ªº¾\Äý¾¹¡C + ¥¦«Øºc©ó ghostviewªº°ò¦¤W¡A + ¤£¹L¦]¬°¨Ï¥Î Xaw3d ¨ç¦¡®w¡A + ©Ò¥H¥~Æ[¬Ý°_¨Ó¤ñ¸ûº}«G¡C gv ³t«×§Ö¡A¤¶­±Â²¼ä¨Ã¥B¦³³\¦h¥\¯à¡A + ¤ñ¦p»¡¤è¦V©Ê¡B¯È±i¤j¤p¡BÁY©ñ¤ñ¨Ò¡B©M¤Ï¿÷¾¦(antialias)µ¥¡C + ¦Ó¥B´X¥G©Ò¦³ªº¨Ï¥Î³£¥i¥H±qÁä½L©Î·Æ¹«¨Ó§¹¦¨¡C + ¥Î®M¥ó¨Ó¦w¸Ë gv¡A¨Ï¥Î¤U¦C«ü¥O¡G + &prompt.root; pkg_add -r gv - If you cannot get the package, you can use the Ports - collection: + ¦pªG§A¤£¯à¨ú±o®M¥ó¡A§A¥i¥H¨Ï¥Î Ports collection¡G &prompt.root; cd /usr/ports/print/gv &prompt.root; make install clean Xpdf Xpdf PDF - viewing + ¾\Äý - If you want a small FreeBSD PDF viewer, - Xpdf is a light-weight and - efficient viewer. It requires very few resources and is - very stable. It uses the standard X fonts and does not - require &motif; or any other X toolkit. + ¦pªG§A·Q­n¤@­Ó¤p«¬ªº FreeBSD PDF ¾\Äý³nÅé¡A + Xpdf¬O­Ó»´¶q¯Å¦Ó¥B¦³®Ä²vªº¾\Äý¾¹¡C + ¥¦¥u»Ý­n«D±`¤Öªº¸ê·½¦Ó¥B¤Q¤Àí©w¡C + ¥¦¥u¨Ï¥Î¼Ð·Çªº X ¦r«¬¦Ó¤£»Ý­n &motif; + ©Î¬O¨ä¥Lªº X ¤u¨ã²Õ(toolkit)¡C - To install the Xpdf package, - issue this command: + ¥Î®M¥ó¨Ó¦w¸Ë Xpdf¡A¨Ï¥Î¤U¦C«ü¥O¡G &prompt.root; pkg_add -r xpdf - If the package is not available or you prefer to use the - Ports Collection, do: - + ¦pªG®M¥ó¤£¦s¦b©Î¬O§A°¾¦n¨Ï¥Î Ports Collection¡A + ¨Ï¥Î¥H¤U«ü¥O¡G + &prompt.root; cd /usr/ports/graphics/xpdf &prompt.root; make install clean - Once the installation is complete, you can launch - Xpdf and use the right mouse button - to activate the menu. + ¤@¥¹§¹¦¨¤F¦w¸Ë¡A§A¥i¥H±Ò°Ê Xpdf + ¨Ã¥B¨Ï¥Î·Æ¹«¥kÁä¥h¨Ï¥Î¿ï³æ¡C GQview GQview - GQview is an image manager. - You can view a file with a single click, launch an external - editor, get thumbnail previews, and much more. It also - features a slideshow mode and some basic file operations. You - can manage image collections and easily find duplicates. - GQview can do full screen viewing - and supports internationalization. - - If you want to install the - GQview package, do: + GQview ¬O¼v¹³ºÞ²z³nÅé¡C + §A¥i¥H¥Î³æÁä¨Ó¾\ÄýÀɮסB±Ò°ÊÃB¥~ªº½s¿è¾¹¡BÁY¹Ï¹wÄýµ¥¥\¯à¡C + ¥¦¤]¦³¤Û¿O¤ù¼½©ñ(slideshow)¤Î¤@¨Ç°ò¥»ªºÀÉ®×¾Þ§@¥\¯à¡C + §A¥i¥Î GQview ºÞ²z¼v¹³¶°¨Ã¯à»´ÃP¦a§ä¥X­«½ÆªºÀɮסC + GQview + ¯à°÷¨Ï¥Î¥þ¿Ã¹õÆ[¬Ý¨Ã¤ä´©°ê»Ú¤Æ¡C + ¦pªG§A·Q­n¦w¸Ë GQviewªº®M¥ó¡A + ½Ð¨Ï¥Î¤U¦C«ü¥O¡G + &prompt.root; pkg_add -r gqview - If the package is not available or you prefer to use the - Ports Collection, do: + ¦pªG®M¥óµLªk¨ú±o¡A©Î¬O§A¤ñ¸û³ßÅw¨Ï¥Î Ports Collection¡A¥u­n¡G &prompt.root; cd /usr/ports/graphics/gqview &prompt.root; make install clean - Finance + °]°È - If, for any reason, you would like to manage your personal - finances on your FreeBSD Desktop, there are some powerful and - easy to use applications ready to be installed. Some of them - are compatible with widespread file formats like those of - Quicken or Excel documents. + ¦pªG¦³¥ô¦ó²z¥Ñ§A·Q­n¦b§Aªº FreeBSD ®à­±Àô¹Ò¤WºÞ²z§Aªº­Ó¤H°]°È¡A + ³o¸Ì¦³¤@¨Ç¥\¯à±j¤j¡B¨Ï¥Î²³æªºÀ³¥Îµ{¦¡¥i¨Ñ¦w¸Ë¡C + ³o¨Ç°]°ÈºÞ²z³nÅ餧¤¤¦³¨Ç¬O¬Û®e©ó¬y¦æªº + Quicken ©Î Excel ¤å¥ó¡C - This section covers these applications: + ³o¸`²[»\¤F¤U­±³o¨Ç³nÅé¡G - Application Name - Resources Needed - Installation from Ports - Major Dependencies + ³nÅé¦WºÙ + ©Ò»Ý¨t²Î¸ê·½ + ±q Ports ¦w¸Ëªº®É¶¡ + ¥D­nªº¬Û¨Ì®M¥ó GnuCash - light - heavy + ¤Ö + ªø GNOME Gnumeric - light - heavy + ¤Ö + ªø GNOME Abacus - light - light + ¤Ö + µu Tcl/Tk GnuCash GnuCash - GnuCash is part of the - GNOME effort to provide - user-friendly yet powerful applications to end-users. With - GnuCash, you can keep track of your - income and expenses, your bank accounts, or your stocks. It - features an intuitive interface while remaining very - professional. - - GnuCash provides a smart - register, a hierarchical system of accounts, many keyboard - accelerators and auto-completion methods. It can split a - single transaction into several more detailed pieces. - GnuCash can import and merge - Quicken QIF files. It also handles most international date - and currency formats. - - To install GnuCash on your - system, do: + GnuCash ¬O + GNOME ¹Î¶¤§V¤O¦¨ªG¤¤ªº¤@³¡¤À¡A + ¦Ó GNOME ¥D­n¬O´£¨Ñ²×ºÝ¨Ï¥ÎªÌ(end-users) + ¿Ë¤Á¦Ó±j¤jªº®à­±À³¥Îµ{¦¡¡C + ¨Ï¥Î GnuCash¡A + §A¥i¥H«ùÄò¬ö¿ý§Aªº¦¬¤J¤Îªá¶O¡B§Aªº»È¦æ±b¤á¡B©Î¬O§AªºªÑ²¼ÃҨ鵥¡C + ¥¦ªº¯S©Ê¬O¤¶­±ª½Ä±¦ý¥\¯à¤´«D±`±M·~¡C + + GnuCash ´£¨Ñ¤F¤@­Ó´¼¼zªºµù¥U¾¹¡B + ±b¤á¼h¯Å¨t²Î¡B³\¦h§Ö³tÁä¤Î¦Û°Ê§¹¦¨(auto-completion)¼Ò¦¡¡C + ¥¦¤]¯à¤À¶}³æ¤@ªº³øªí¦Ü¼Æ­Ó¸Ô²Óªº³¡¥÷¡C + GnuCash ¤]¯à°÷¿é¤J¤Î¦X¨Ö + Quicken QIF ÀɮסC + ¥¦¤]¯à³B²z¤j³¡¤À°ê»Úªº¤é´Á¤Î³q¥Î³f¹ô¤§®æ¦¡¡C + + ­n¦w¸Ë GnuCash ¨ì§Aªº¨t²Î¤¤¡A + ¥u­n°µ¤U¦C¨BÆJ¡G &prompt.root; pkg_add -r gnucash - If the package is not available, you can use the ports - collection: + ¦pªG¤£¯à¨ú±o®M¥ó¡A§A¥i¥H¨Ï¥Î ports collection: &prompt.root; cd /usr/ports/finance/gnucash &prompt.root; make install clean Gnumeric Gnumeric - spreadsheet + ¸Õºâªí Gnumeric - Gnumeric is a spreadsheet, part - of the GNOME desktop environment. - It features convenient automatic guessing of user - input according to the cell format and an autofill system for - many sequences. It can import files in a number of popular - formats like those of Excel, Lotus 1-2-3, or Quattro Pro. - Gnumeric supports graphs through - the math/guppi graphing - program. It has a large number of built-in functions and - allows all of the usual cell formats such as number, currency, - date, time, and much more. - - To install Gnumeric as a - package, type in: + Gnumeric ¬O + GNOME ®à­±Àô¹Ò¤¤ªº¸Õºâªí¡C + ¥¦ªº¯SÂI¬O¯à°÷®Ú¾ÚÀx¦s®æ®æ¦¡(cell format)¤Î¦Û°Ê¸É»ôªº¨t²Î¡A + ¨Ó¤è«K¦Û°Ê¦a¡u²q¥X¡v¨Ï¥ÎªÌªº¿é¤J¡C + ¥¦¤]¯à°÷¿é¤J³\¦h¼öªùªºÀɮ׮榡¡A¹³¬O + Excel, Lotus 1-2-3, ©Î¬O Quattro Pro¡C + + Gnumeric ¤ä´©¨Ï¥Î + math/guppi ø¹Ï³nÅé¨Óø¹Ï¡C + ¥¦¦³³\¦h¤º«Øªº¨ç¼Æ¦Ó¥B¤¹³\¤@¯ëªºÀx¦s®æ®æ¦¡¡A¹³¬O: + ¼Æ¦r¡B³f¹ô¡B¤é´Á¡B®É¶¡¤Î¨ä¥L®æ¦¡µ¥¡C + + ­n¥Î®M¥ó¦w¸Ë Gnumeric¡A¥u­n¥´¥H¤U«ü¥O¡G &prompt.root; pkg_add -r gnumeric - If the package is not available, you can use the ports - collection by doing: + ¦pªG®M¥ó¤£¦s¦b¡A§A¥i¥H°µ¤U­±ªº¨BÆJ¨Ó¨Ï¥Î ports collection ½sĶ¦w¸Ë¡G &prompt.root; cd /usr/ports/math/gnumeric &prompt.root; make install clean Abacus Abacus - spreadsheet + ¸Õºâªí Abacus - Abacus is a small and easy to - use spreadsheet. It includes many built-in functions useful - in several domains such as statistics, finances, and - mathematics. It can import and export the Excel file format. - Abacus can produce &postscript; - output. + Abacus ¬O­Ó¤p¥©¤S¨Ï¥Î²³æªº¸Õºâªí¡C + ¥¦¥]§t¤F³\¦h¤º«Øªº¨ç¼Æ¡A¦b¬ÛÃöªº»â°ì¦p²Î­p¾Ç¡B°]°È¡B¼Æ¾Ç¤¤«Ü¹ê¥Î¡C + ¥¦¤]¥i¥H¿é¥X¿é¤J Excel ªºÀɮ׮榡¡C + ¥t¥~ Abacus¤]¯à°÷¿é¥X &postscript; ®æ¦¡¡C - To install Abacus from its - package, do: + ±q®M¥ó¦w¸Ë Abacus ¥u­n°µ¡G &prompt.root; pkg_add -r abacus - If the package is not available, you can use the ports - collection by doing: + ¦pªG®M¥ó¤£¯à¨ú±oªº¸Ü¡A§A¥i¥H¨Ï¥Î ports collection ¡A + ¨Ã¥Î¥H¤U«ü¥O¡G &prompt.root; cd /usr/ports/deskutils/abacus &prompt.root; make install clean - Summary + ºK­n - While FreeBSD is popular among ISPs for its performance and - stability, it is quite ready for day-to-day use as a desktop. - With several thousand applications available as - packages or + ÁöµM FreeBSD ¬O¦]¬°®Ä¯à¤Îí©w©Ê¦Ó¦b ISP ¤§¶¡«Ü¬y¦æ¡A + ¤£¹L¥¦¤]¥i¥H§¹¥þ·í§@®à­±Àô¹Ò(desktop)¨Ó¨Ï¥Î¡A + ¨Ã¤£«]­­©ó¨Ï¥Î¦b¦øªA¾¹¤W­±¡C¥Ø«e¦³¼Æ¤dºØÀ³¥Îµ{¦¡ªº + ®M¥ó(packages) + ©Î ports, - you can build a perfect desktop that suits all your needs. - - Once you have achieved the installation of your desktop, you - may want to go one step further with - misc/instant-workstation. - This meta-port allows you to build a typical set - of ports for a workstation. You can customize it by editing - /usr/ports/misc/instant-workstation/Makefile. - Follow the syntax used for the default set to add or remove - ports, and build it with the usual procedure. - Eventually, you will be able to create a big package that - corresponds to your very own desktop and install it to your - other workstations! - - Here is a quick review of all the desktop applications - covered in this chapter: + ¥i¨Ñ¨Ï¥Î¡A§A¥i¥H®Ú¾Ú§Aªº»Ý¨D¥´³y¥X¤@­Ó§¹¬üªº®à­±Àô¹Ò¡C + + ¤@¥¹§A§¹¦¨¤F§Aªº®à­±Àô¹Òªº¦w¸Ë¡A§A¤]³\·Q­n¨Ï¥Î + misc/instant-workstations + ¨Ó°µ§ó¶i¤@¨Bªº³]¸m¡C³o­Ó¡umeta-port¡v¤¹³\§A¨Ï¥Î¼Æ­Ó ports + ¨Ó«Ø³y¦Û©wªº¤u§@¯¸Àô¹Ò¡C§A¥i¥H¦Û¦æ½s¿è«È»s¤Æ + /usr/ports/misc/instant-workstations/Makefile + ³o­ÓÀɮסC ¿í´`¹w³]ªº»yªk¥h¼W¥[©Î´î¤Ö ports¡A + ¨Ã¥B¨Ï¥Î¤@¯ëªºµ{§Ç¥h°µ¡C + ³Ì«á¡A§A±N¯à°÷«Ø¥ß¤@­Ó¾A¦X§A¦Û¤v®à­±Àô¹Òªº®M¥ó¡A + ¨Ã¥B¥i¥H¦w¸Ë¦b§A¦Û¤v¨ä¥Lªº¤u§@¯¸¸ÌÀY¡C + + ¤U­±¬O³o³¹²[»\ªº©Ò¦³®à­±À³¥Î³nÅ餧§Ö³t¦^ÅU¦Cªí¡G - Application Name - Package Name - Ports Name + ³nÅé¦WºÙ + ®M¥ó¦WºÙ + Ports ¦WºÙ Mozilla mozilla www/mozilla Opera opera www/opera Firefox firefox www/firefox KOffice koffice-kde3 editors/koffice-kde3 AbiWord abiword editors/abiword The GIMP gimp graphics/gimp OpenOffice.org openoffice editors/openoffice-1.1 &acrobat.reader; acroread print/acroread7 gv gv print/gv Xpdf xpdf graphics/xpdf GQview gqview graphics/gqview GnuCash gnucash finance/gnucash Gnumeric gnumeric math/gnumeric Abacus abacus deskutils/abacus diff --git a/zh_TW.Big5/books/handbook/disks/chapter.sgml b/zh_TW.Big5/books/handbook/disks/chapter.sgml index 27e04beb85..c6ec473169 100644 --- a/zh_TW.Big5/books/handbook/disks/chapter.sgml +++ b/zh_TW.Big5/books/handbook/disks/chapter.sgml @@ -1,4131 +1,4114 @@ Àx¦s³]³Æ½g ·§­z - ¥»³¹²[»\¦p¦ó¦b FreeBSD ¤U¨Ï¥ÎºÐ¤ù¸Ë¸m¡A¥]§t - memory-backed disk (¥Î°O¾ÐÅé§@¬°µwºÐ¨Ï¥Î)¡B¸óºô¸ô¨Ï¥ÎªºµwºÐ¡B + ¥»³¹²[»\¦p¦ó¦b FreeBSD ¤U¨Ï¥ÎºÐ¤ù¸Ë¸m + Ķµù¡GÁöµM¦³¨Ç³]³Æ¨S¦³¡yºÐ¤ù¡z¡A¨Ò¦p USB ÀH¨­ºÐ¡A + ¤£¹L¦b¦¹¤´§â Disk Ķ¬°¡yºÐ¤ù¸Ë¸m¡z¡C¦¹¥~¡A¬°¤è«K°_¨£¡A + «á¤å©Ò¦³ªº Disk ³£Ä¶¬°¡yµwºÐ¡z¡C + ¥]§t memory-backed disk (¥Î°O¾ÐÅé§@¬°µwºÐ¨Ï¥Î)¡B¸óºô¸ô¨Ï¥ÎªºµwºÐ¡B ¼Ð·Ç SCSI/IDE µwºÐ¡BUSB ¤¶­±ªº³]³Æµ¥¡C ¾\Ū¥»³¹«á¡A±z¸Ë¾Ç·|¡G FreeBSD ¦p¦ó´y­z¸ê®Æ¦bµwºÐ¤Wªº¹º¤À±¡§Î (partition ©M slices)¡C ¦p¦ó¦b¨t²Î¤W¥[¤JµwºÐ ¦p¦ó³]©w &os; ¨Ó¨Ï¥Î USB ¸Ë¸m¡C ¦p¦ó³]©wµêÀÀÀɮרt²Î (virtual file systems), ¨Ò¦p memory disks (¥Î°O¾ÐÅé§@¬°µwºÐ¨Ï¥Î)¡C ¦p¦ó¥Î quota ¨Ó­­¨îµwºÐªÅ¶¡ªº¨Ï¥Î¡C ¦p¦ó¹ïµwºÐ¥[±K¥HÀ³¥I§ðÀ»¡C ¦p¦ó¦b FreeBSD ¤U«Ø¥ß¡B¿N¿ý CD ©M DVD¡C ¦UºØ¤£¦Pªº³Æ¥÷³]³Æ¡C ¦p¦ó¨Ï¥Î FreeBSD ´£¨Ñªº³Æ¥÷¤u¨ã¡C ¦p¦ó³Æ¥÷¨ì³nºÐ¡C ¤°»ò¬O snapshots ¡A¥B¦p¦ó¦³®Ä²v¦a¨Ï¥Î¤§¡C ¦b¾\Ū¤§«e¡A±zÀ³¸Ó¡G ª¾¹D¦p¦ó°t¸m¡B¦w¸Ë·sªº FreeBSD ®Ö¤ß¡C (). ¸Ë¸m¦WºÙ ¤U­±¬O FreeBSD ¤ä´©ªºÀx¦s´CÅé¦Cªí¡A¤Î¥¦­Ì¹ïÀ³ªº¸Ë¸m¦WºÙ¡C ©R¦W³W«h ¸Ë¸mÃþ«¬ ¸Ë¸m¦WºÙ IDE µwºÐ¾÷ ad IDE ¥úºÐ¾÷ acd SCSI µwºÐ¾÷©M USB ºÐ da SCSI ¥úºÐ¾÷ cd «D¼Ð·Ç³W®æ¥úºÐ¾÷ Mitsumi ¥úºÐ¾÷¥Î mcd¡A Sony ¥úºÐ¾÷¥Î scd¡A Matsushita/Pansonic ¥úºÐ¾÷¥Î matcd 2002 ¦~ 10 ¤ë 5 ¤é FreeBSD 4.X ²¾°£¤F &man.matcd.4; ÅX°Êµ{¦¡¡A ¦]¦¹ FreeBSD 5.0 ¤Î¥H«áªºª©¥»¤£¦A¤ä´©¡C ³nºÐ¾÷ fd SCSI ºÐ±a¾÷ sa IDE ºÐ±a¾÷ ast Flash ºÏºÐ¾÷ &diskonchip; Flash ºÏºÐ¾÷¥Î fla RAID ºÏºÐ¾÷ &adaptec; AdvancedRAID ¥Îaacd¡A &mylex; ¥Î mlxd ©M mlyd¡A AMI &megaraid; ¥Î amrd¡A Compaq Smart RAID ¥Î idad¡A &tm.3ware; RAID ¥Î twed¡C
David O'Brien Originally contributed by ·s¼WµwºÐ disk adding °²³]§Ú­Ì·Q·s¼W SCSI µwºÐ¨ì¤@»O­ì¥ý¥u¦³¤@ÁûµwºÐªº¾÷¾¹¤W¡A ­º¥ý±N¹q¸£Ãö¾÷¡A¨Ì»s³y°Óªº«ü¥Ü±NµwºÐ¸Ë¤W¥h¡A ¸Ô²Óªº¾Þ§@¤è¦¡½Ð°Ñ¦Ò»s³y°Óªº»¡©ú¤å¥ó¡C ¦w¸Ë¦nµwºÐ«á¡A¥Î root µn¤J¨t²Î¡A ¬Ý¤@¤U /var/run/dmesg.boot ¥H½T»{¨t²Î¬O§_§ì¨ì·sµwºÐ¡C Ä~Äò­è¤~ªº½d¨Ò¡A·s¼WªºµwºÐ·|¬O da1¡A °²³]§Ú­Ì·Q±N¥¦±¾¸ü¨ì /1 ³o­Ó¦ì¸m (¦pªG±z·s¼Wªº¬O IDE µwºÐªº¸Ü¡A4.0 ¤§«eªº¨t²Î¬O wd1¡A4.X ¤Î¤§«áªº¨t²Î«h¬O ad1)¡C partitions slices fdisk FreeBSD ¬°¤F¦b IBM-PC ¬Û®e¹q¸£¤W°õ¦æ¡A ¥²¶·°t¦X PC BIOS partition¡A¦]¦¹©M¶Ç²Îªº BSD partition ¦³«Ü¤jªº¤£¦P¡C ¦b PC ¸ÌµwºÐ³Ì¦h¥i¥H¦³¥|µ§ BIOS partition ¸ê°T(¥ç§Y³Ì¦h¥i¤À³Î¦¨¥|­Ó partition)¡C¦pªG³o­ÓµwºÐ¥´ºâ¥þ³¡Åý FreeBSD ¨Ï¥Î¡A¥i¿ï¾Ü dedicated ¼Ò¦¡¡A ¤£µMªº¸Ü FreeBSD ¥²¶·¸m¨­©ó¨ä¤¤¤@­Ó PC BIOS partition ¤¤¡C ¦b FreeBSD ¸Ì¡APC BIOS partition ºÙ¬° slice¡A - ³o¬O¬°¤F¤£­n©M¶Ç²Îªº BSD partition ·d²V¤F¡C + ³o¬O¬°¤F¤£­n©M¶Ç²Îªº BSD partition ·d²V¤F + Ķµù¡G°ò©ó¬Û¦Pªº²z¥Ñ¡A + ²{¦b BSD partition ±`ºÙ¬° BSD label¡A©Î²ºÙ label¡C ¤£½×¬O§¹¥þ¥Ñ FreeBSD ¨Ï¥ÎªºµwºÐ¡AÁÙ¬O¦w¸Ë¤F¨ä¥¦§@·~¨t²ÎªºµwºÐ¡A ±z³£¥i¥H¨Ï¥Î slice¡C³o¼Ëªº¦n³B¬O¡A¨ä¥¦«D FreeBSD §@·~¨t²Îªº fdisk ¤u¨ã¥i¥H¶¶§Q¾Þ§@¡C ¦pªG¨Ï¥Î slice¡A³o­Ó·s¼WªºµwºÐ·|¬O /dev/da1s1e¡C¥i¥H³o¼Ë¨Ó¸ÑŪ¥¦¡GSCSI µwºÐ¡B unit number 1(²Ä¤G­Ó SCSI µwºÐ)¡Bslice 1(²Ä¤@­Ó PC BIOS partition)¡B ¤Î e BSD partition¡C¦b dedicated ¼Ò¦¡ªº¸Ü¡A ·sµwºÐ«h¬O /dev/da1e¡C ¦]¬° &man.bsdlabel.8;(¦b &os; 4.X ºÙ¬° &man.disklabel.8;) ¥Î 32-bit ¾ã¼Æ¨ÓÀx¦s sector(ºÏ°Ï) ¼Æ¡A ¦]¦¹­­¨î¤@­ÓµwºÐ³Ì¤j¥u¯à¦³ 2^32-1 ­Ó sector¡A¥ç§Y 2TB ªºªÅ¶¡¡C ¦Ó &man.fdisk.8; ªº®æ¦¡®e³\°_©l sector ½s¸¹¤£¶W¹L 2^32-1¡A ªø«×¤]¤£¶W¹L 2^32-1¡A¦]¦¹ partition ³Ì¤jªÅ¶¡¬O 2TB¡A¦ÓµwºÐ³Ì¤j¬O 4TB¡C &man.sunlabel.8; «h­­¨î partition ³Ì¤j¬O 2TB¡AµwºÐ³Ì¦h¥i¦³ 8 ­Ó partition¡A ¦]¦¹³Ì¤j¬O 16TB¡C¦pªG­n¨Ï¥Î§ó¤jªºµwºÐ¡A½Ð¨Ï¥Î &man.gpt.8;¡C - Using &man.sysinstall.8; + ¨Ï¥Î &man.sysinstall.8; sysinstall - adding disks + ·s¼WµwºÐ su - Navigating <application>Sysinstall</application> + ¾Þ§@ <application>Sysinstall</application> - You may use sysinstall + ³z¹L sysinstall (/stand/sysinstall in &os; versions older - than 5.2) to - partition and label a new disk using its easy to use menus. - Either login as user root or use the - su command. Run - sysinstall and enter the - Configure menu. Within the - FreeBSD Configuration Menu, scroll down and - select the Fdisk option. + than 5.2) ªº¿ï³æ¤¶­±¡A±z¥i¥H»´©ö¬°µwºÐ¤À³Î BIOS partition(slice) + ©M BSD patition¡C±z¥²¶·¥H root ¨­¥÷¨Ï¥Î sysinstall¡A + ­n¹À¥Î root µn¤J¡A­n¹À¥Î su ¤Á´«¨ì root¡C + °õ¦æ sysinstall «á¡A¿ï Configure + ¡A¦b FreeBSD Configuration Menu ¸Ì²¾¨ì + Fdisk ¿ï¶µ¡A - <application>fdisk</application> Partition Editor - Once inside fdisk, typing A will - use the entire disk for FreeBSD. When asked if you want to - remain cooperative with any future possible operating - systems, answer YES. Write the - changes to the disk using W. Now exit the - FDISK editor by typing q. Next you will be - asked about the Master Boot Record. Since you are adding a - disk to an already running system, choose - None. + <application>fdisk</application> Partition ½s¿è¾¹ + ¦b fdisk ¸Ì¡A«ö¤U + A ªí¥Ü¾ã­ÓµwºÐ³£µ¹ FreeBSD ¨Ï¥Î¡C + ±µµÛ·|´£¥Ü±z¡y¬O§_­n¬Û®e¨ä¥¦ªº§@·~¨t²Î¡z¡A¦^µª YES¡C + «ö W ·|±N³o¨Ç§ïÅܥߧY¼g¤JµwºÐ¡A + ¦A«ö q ¥i¥HÂ÷¶} FDISK ½s¿è¾¹¡C + ±µ¤U¨Ó·|°Ý±z­n±N Master Boot Record ¦w¸Ë©ó¦ó³B¡A + ¥Ñ©ó²{¦b¬O·s¼WµwºÐ¡Aªí¥Ü§@·~¨t²Î¤w¸g¸Ë¦b§OªºµwºÐ¤W¤F¡A©Ò¥H¥i¥H + None ´N¦æ¤F¡C - Disk Label Editor + Disk Label Editor(µwºÐ Label ½s¿è¾¹) BSD partitions - Next, you need to exit sysinstall - and start it again. Follow the directions above, although this - time choose the Label option. This will - enter the Disk Label Editor. This - is where you will create the traditional BSD partitions. A - disk can have up to eight partitions, labeled - a-h. - A few of the partition labels have special uses. The - a partition is used for the root partition - (/). Thus only your system disk (e.g, - the disk you boot from) should have an a - partition. The b partition is used for - swap partitions, and you may have many disks with swap - partitions. The c partition addresses the - entire disk in dedicated mode, or the entire FreeBSD slice in - slice mode. The other partitions are for general use. - - sysinstall's Label editor - favors the e - partition for non-root, non-swap partitions. Within the - Label editor, create a single file system by typing - C. When prompted if this will be a FS - (file system) or swap, choose FS and type in a - mount point (e.g, /mnt). When adding a - disk in post-install mode, sysinstall - will not create entries - in /etc/fstab for you, so the mount point - you specify is not important. - - You are now ready to write the new label to the disk and - create a file system on it. Do this by typing - W. Ignore any errors from - sysinstall that - it could not mount the new partition. Exit the Label Editor - and sysinstall completely. + ±µµÛ½ÐÃö³¬ sysinstall¡A + ¦A­«¶}¤@¦¸¡C·ÓµÛ¤W¤@¸`ªº«ü¥Ü¡A¤£¹L³o¦¸§ï¿ï Label + ¶i¤J Disk Label Editor¡A¦b¦¹±z¥i¥H½s¿è¶Ç²Îªº + BSD partition¡C¤@­ÓµwºÐ(©ÎµÛ¤@­Ó slice) ³Ì¦h¥i¤Á¤À¦¨ 8 ­Ó BSD partition¡A + ¨Ì§Ç¥Î a-h ¨Óªí¥Ü¡C + ¦³¨Ç¦r¥À¦³¯S§Oªº·N¸q¡Aa partition ªí¥Ü³o¬O + root partition(®Ú¤À³Î°Ï¡A/)¡A + ¦]¦¹¥u¦³¦w¸Ë¨t²ÎªºµwºÐ(¨Ò¦p¥Î¨Ó¶}¾÷ªºµwºÐ) ¦³ + a partition¡Cb partition + ªí¥Ü³o¬O swap partitions(¥æ´«¤À³Î°Ï)¡A¨C­ÓµwºÐ¤W³£¥i¥H¦³¥æ´«¤À³Î°Ï¡C + c partition + ¥Î¨Óªí¥Ü¾ã­ÓµwºÐ(¦pªG¨Ï¥Î dedicated mode ªº¸Ü) + ©Î¾ã­Ó slice¡C¨ä¥¦ªº¦r¥À«h¥Î¨Óªí¥Ü´¶³qªº BSD partition¡C + + sysinstall ªº + Label editor(µwºÐ Label ½s¿è¾¹) °¾¦n¥Î e + ¨Óªí¥Ü«D root¡B¤]«D swap ªº¤À³Î°Ï + Ķµù¡G¦Ñ¹ê»¡§Ú¬Ý¤£À´³o¥y«üªº¬O¤°»ò¡H­ì¤å¬O + sysinstall Label editor + favors the e partition for non-root, + non-swap partitions. ¦b Label editor ¸Ì¡A + «ö C ¥i¥H·s¼W¤@­ÓÀɮרt²Î(BSD label)¡A + ¥¦·|°Ý±z³o¬O¤@­Ó FS(file system¡AÀɮרt²Î) ©Î¬O swap(¥æ´«¤À³Î°Ï)¡A + ¿ï¾Ü FS ±µµÛ¿é¤J­n±¾¸üªº¦ì¸m + (¨Ò¦p /mnt)¡C¦pªG¨t²Î¦w¸Ë§¹«á¤~·s¼WµwºÐ¡A + sysinstall ¤£·|À°±z§â³oµ§±¾¸ü¸ê®Æ¥[¤J + /etc/fstab¡A©Ò¥H±¾¸üªº¦ì¸m¤£¤Ó­«­n¡C + + ·í±z·Ç³Æ¦n±N·sªº label ¼g¤JµwºÐ¡B«Ø¥ßÀɮרt²Î¡A + «ö W §Y¥i¡C¦pªG¥X²{¦b¤°»ò¿ù»~¡A + sysinstall ¥i¯àµLªkÀ°±z±¾¸ü³o­Ó·s¤À³Î°Ï¡C + µ²§ô Label Editor¡Bµ²§ô sysinstall ´N¦æ¤F¡C - Finish + §¹¦¨ - The last step is to edit /etc/fstab - to add an entry for your new disk. + ³Ì«á­n°µªº¬O½s¿è /etc/fstab¡A + ¥[¤J±z·s¼Wªº¤À³Î°Ï¸ê°T¡C - Using Command Line Utilities + ¨Ï¥Î©R¥O¦C¤u¨ã - Using Slices - - This setup will allow your disk to work correctly with - other operating systems that might be installed on your - computer and will not confuse other operating systems' - fdisk utilities. It is recommended - to use this method for new disk installs. Only use - dedicated mode if you have a good reason - to do so! - + ¨Ï¥Î Slices(BIOS partitions) + + ³oºØ¼Ò¦¡¯àÅý±zªºµwºÐ¤À³Î°Ï»P¨ä¥¦§@·~¨t²Îªº + fdisk ¤u¨ã©M¥­¦@³B¡A¦]¦¹§Ú­Ì«Øij±z¨Ï¥Î slice ¼Ò¦¡¡C + ¦pªG±z¤@©w­n¨Ï¥Î dedicated ¼Ò¦¡¡A + ±z±o¦³­Ó¦n²z¥Ñ¡I + Ķµù¡G¦pªG±z¦Û©l¦Ü²×³£¤£¥´ºâ±N³o­ÓµwºÐ¥Î©ó FreeBSD + ¤§¥~ªº§@·~¨t²Î¡A¨º¥i¥Hºâ¬O­Ó¦n²z¥Ñ¡C¤£¹L´Nºâ¦p¦¹¡A + ¥Î slice ¼Ò¦¡¤]¨S¤°»òÃa³B´N¬O¤F:-)¡C + &prompt.root; dd if=/dev/zero of=/dev/da1 bs=1k count=1 -&prompt.root; fdisk -BI da1 #Initialize your new disk -&prompt.root; disklabel -B -w -r da1s1 auto #Label it. -&prompt.root; disklabel -e da1s1 # Edit the disklabel just created and add any partitions. +&prompt.root; fdisk -BI da1 # ªì©l±zªºµwºÐ¡C +&prompt.root; disklabel -B -w -r da1s1 auto # «Ø¥ß disklabel¡C +&prompt.root; disklabel -e da1s1 # ½s¿è disklabel ¥H·s¼W label¡C &prompt.root; mkdir -p /1 -&prompt.root; newfs /dev/da1s1e # Repeat this for every partition you created. -&prompt.root; mount /dev/da1s1e /1 # Mount the partition(s) -&prompt.root; vi /etc/fstab # Add the appropriate entry/entries to your /etc/fstab. - - If you have an IDE disk, substitute ad - for da. On pre-4.X systems use - wd. +&prompt.root; newfs /dev/da1s1e # ¦pªG±z·s¼W¤F¦h­Ó label¡A¹ï¨C­Ó label ­«Âгo­Ó¨BÆJ¡C +&prompt.root; mount /dev/da1s1e /1 # ±¾¸ü³o¨Ç·s label¡C +&prompt.root; vi /etc/fstab # ¦b /etc/fstab ¥[¤J¾A·íªº¸ê°T¡C + + ¦pªG±z·s¼Wªº¬O IDE µwºÐ¡A±N da + §ï¦¨ da §Y¥i + Ķµù¡Gda ¬O direct access¡Aad «h¬O ata disk¡C¡C + ¦Ó¦pªG¬O 4.X ¤§«eªº¨t²Î¡A¥Î wd¡C Dedicated OS/2 - If you will not be sharing the new drive with another operating - system, you may use the dedicated mode. Remember - this mode can confuse Microsoft operating systems; however, no damage - will be done by them. IBM's &os2; however, will - appropriate any partition it finds which it does not - understand. - + ¦pªG±z¤£¥´ºâ±N·sµwºÐ¥Î©ó¨ä¥¦ªº§@·~¨t²Î¡A + ±z¥i¥H¨Ï¥Î dedicated ¼Ò¦¡¡Cª`·N¡G + Microsoft ªº§@·~¨t²Î»{¤£±o³o­Ó¼Ò¦¡¡A¤£¹L¤]¤£·|¥h¯}Ãa¥¦¡F + µM¦Ó IBM ªº &os2; ´N¨S¨º»ò¦n¤ß¤F¡A¥¦·|¥h½Õ¾ã©Ò¦³¥¦¤£»{±oªº¤À³Î°Ï + Ķµù¡G§Ú¹ï³o¥yªº·N«ä¨S¤°»ò«H¤ß¡A­ì¤å¬O IBM's &os2; however, + will appropriate any partition it finds which it does + not understand.¡C + &prompt.root; dd if=/dev/zero of=/dev/da1 bs=1k count=1 &prompt.root; disklabel -Brw da1 auto -&prompt.root; disklabel -e da1 # create the `e' partition +&prompt.root; disklabel -e da1 # «Ø¥ß `e' partition¡C &prompt.root; newfs -d0 /dev/da1e &prompt.root; mkdir -p /1 -&prompt.root; vi /etc/fstab # add an entry for /dev/da1e +&prompt.root; vi /etc/fstab # ·s¼W¤@µ§ /dev/da1e ªº¸ê°T¡C &prompt.root; mount /1 - An alternate method is: + ¥t¤@ºØ¤èªk¡G &prompt.root; dd if=/dev/zero of=/dev/da1 count=2 &prompt.root; disklabel /dev/da1 | disklabel -BrR da1 /dev/stdin &prompt.root; newfs /dev/da1e &prompt.root; mkdir -p /1 -&prompt.root; vi /etc/fstab # add an entry for /dev/da1e +&prompt.root; vi /etc/fstab # ·s¼W¤@µ§ /dev/da1e ªº¸ê°T¡C &prompt.root; mount /1 - Since &os; 5.1-RELEASE, the &man.bsdlabel.8; - utility replaces the old &man.disklabel.8; program. With - &man.bsdlabel.8; a number of obsolete options and parameters - have been retired; in the examples above the option - should be removed with &man.bsdlabel.8;. - For more information, please refer to the &man.bsdlabel.8; - manual page. + ±q &os; 5.1-RELEASE ¶}©l¡A&man.bsdlabel.8; ¨ú¥N­ì¥»ªº + &man.disklabel.8; µ{¦¡¡A¬Y¨Ç«ü¥O°Ñ¼Æ¤w¸g¼o±ó¤£¥Î¡C + ¤W­±½d¨Ò¸Ì¡A¦pªG¥Îªº¬O &man.bsdlabel.8;¡A + °Ñ¼ÆÀ³¸Ó®³±¼¡C§ó¦hªº¸ê°T½Ð°Ñ¦Ò &man.bsdlabel.8; manual page¡C + RAID - Software RAID + ³nÅé RAID Christopher Shumway Original work by Jim Brown Revised by RAIDsoftware RAIDCCD - Concatenated Disk Driver (CCD) Configuration - When choosing a mass storage solution the most important - factors to consider are speed, reliability, and cost. It is - rare to have all three in balance; normally a fast, reliable mass - storage device is expensive, and to cut back on cost either speed - or reliability must be sacrificed. + ³s±µ¦¡ºÏºÐ¸Ë¸mÅX°Êµ{¦¡(CCD, Concatenated Disk Driver) ³]©w + ¹ï¤j®e¶qÀx¦s³]³Æ¦Ó¨¥¡A³ÌÃöÁ䪺­n¯À¤D¬O³t«×¡B¥i¾a©Ê¤Î»ù®æ¡C + µM¦Ó³o¤TªÌ©¹©¹Ãø¥H­ÝÅU¡G§Ö³t¥i¾aªº³]³Æ³q±`«Ü¶Q¡F + ¦Ó­°§C¦¨¥»³q±`¤]Ä묹¤F³t«×©Î¥i¾a©Ê¡C + + ±µ¤U¨Ó­n¤¶²Ðªº¨t²Î¡A»ù®æ¬O³Ì­«­nªº¦Ò¶q¡A±µ¤U¨Ó¬O³t«×¡A³Ì«á¤~¬O¥i¾a©Ê¡C + ¶¶§Ç¦p¦¹¬O¦]¬°¸ê®Æ¶Ç¿éªº³t«×³Ì²×¨ú¨M©óºô¸ô¡A¦Ó¾¨ºÞ¥i¾a©Ê¤Q¤À­«­n¡A + «o¦³Â²³æªº¨ú¥N¤è®×¡G±N¸ê®Æ§¹¾ã³Æ¥÷©ó CD-R ¤¤¡C - In designing the system described below, cost was chosen - as the most important factor, followed by speed, then reliability. - Data transfer speed for this system is ultimately - constrained by the network. And while reliability is very important, - the CCD drive described below serves online data that is already - fully backed up on CD-R's and can easily be replaced. + ¿ï¾Ü¤j®e¶qÀx¦s³]³Æ¤è®×®É¡A­º¥ý­n©w¸q±zªº»Ý¨D¡C¦pªG±z­«µø³t«×©Î¥i¾a©Ê + ¬Æ©ó»ù®æ¡A±µ¤U¨Óªº¤¶²Ð®£«D±z©Ò»Ý¡C - Defining your own requirements is the first step - in choosing a mass storage solution. If your requirements prefer - speed or reliability over cost, your solution will differ from - the system described in this section. + + ¦w¸ËµwÅé + °£¤F¨t²ÎºÏºÐ¥~¡A¤U­±¤¶²Ðªº CCD ºÏºÐ°}¦C±N¨Ï¥Î¨ì¤TÁû 30GB¡B + 5400 RPM ªº Western Digital IDE ºÏºÐ¡A¥H´£¨Ñ¬ù 90GB ªºÀx¦sªÅ¶¡¡C + ³Ì²z·Qªº±¡ªp¬O¨C­ÓºÏºÐ¥Ñ¿W¥ß¨Ï¥Îªº±Æ½u³s±µ¿W¥ß¨Ï¥Îªº IDE ±±¨î¾¹¡A + ¤£¹L¬°¤F­°§C¦¨¥»¡A§Q¥Î jumper ³]©wºÏºÐ¡A¨Ï¨C­Ó IDE ±±¨î¾¹¥i³s±µ + ¤@­Ó¥DºÏºÐ¥[¤@­Ó°ÆºÏºÐ¡A¦p¦¹¥i¤£¥²¥[¸ËÃB¥~ªº IDE ±±¨î¾¹¡C - - Installing the Hardware - - In addition to the IDE system disk, three Western - Digital 30GB, 5400 RPM IDE disks form the core - of the CCD disk described below providing approximately - 90GB of online storage. Ideally, - each IDE disk would have its own IDE controller - and cable, but to minimize cost, additional - IDE controllers were not used. Instead the disks were - configured with jumpers so that each IDE controller has - one master, and one slave. - - Upon reboot, the system BIOS was configured to - automatically detect the disks attached. More importantly, - FreeBSD detected them on reboot: + ¶}¾÷«á¡ABIOS À³¸Ó³]©w¦¨¦Û­«°»´úºÏºÐ¡C§ó­«­nªº¬O FreeBSD À³¸Ó + ­n°»´ú¨ì¥¦­Ì¡G ad0: 19574MB <WDC WD205BA> [39770/16/63] at ata0-master UDMA33 ad1: 29333MB <WDC WD307AA> [59598/16/63] at ata0-slave UDMA33 ad2: 29333MB <WDC WD307AA> [59598/16/63] at ata1-master UDMA33 ad3: 29333MB <WDC WD307AA> [59598/16/63] at ata1-slave UDMA33 - If FreeBSD does not detect all the disks, ensure - that you have jumpered them correctly. Most IDE drives - also have a Cable Select jumper. This is - not the jumper for the master/slave - relationship. Consult the drive documentation for help in - identifying the correct jumper. - - Next, consider how to attach them as part of the file - system. You should research both &man.vinum.8; () and &man.ccd.4;. In this - particular configuration, &man.ccd.4; was chosen. + ¦pªG FreeBSD ¨S¦³°»´ú¨ì©Ò¦³ºÏºÐ¡A½Ð½T»{ jumper ³£³]©w¥¿½T¡C + ³\¦h IDE ºÏºÐ¥i¥H³]©w¦¨ Cable Select(®Ú¾Ú±Æ½u¦ì¸m¨M©w)¡A + ³o¨Ã«D master(¥DºÏºÐ) ©Î slave(°ÆºÏºÐ)¡C½Ð°Ñ¾\ºÏ + ºÐªº»¡©ú¤å¥ó¥H¥¿½T³]©w jumper¡C + + ±µ¤U¨Ó¡A¦Ò¼{¦p¦ó±N¥¦­ÌÅܦ¨Àɮרt²Îªº¤@³¡¥÷¡C±z¥i¥H°Ñ¦Ò + &man.vinum.8;() ¤Î &man.ccd.4¡C + ¦b¦¹§Ú­Ì¿ï¾Ü &man.ccd.4; ¡C Setting Up the CCD The &man.ccd.4; driver allows you to take several identical disks and concatenate them into one logical file system. In order to use &man.ccd.4;, you need a kernel with &man.ccd.4; support built in. Add this line to your kernel configuration file, rebuild, and reinstall the kernel: pseudo-device ccd 4 On 5.X systems, you have to use instead the following line: device ccd In FreeBSD 5.X, it is not necessary to specify a number of &man.ccd.4; devices, as the &man.ccd.4; device driver is now self-cloning — new device instances will automatically be created on demand. The &man.ccd.4; support can also be loaded as a kernel loadable module in FreeBSD 3.0 or later. To set up &man.ccd.4;, you must first use &man.disklabel.8; to label the disks: disklabel -r -w ad1 auto disklabel -r -w ad2 auto disklabel -r -w ad3 auto This creates a disklabel for ad1c, ad2c and ad3c that spans the entire disk. Since &os; 5.1-RELEASE, the &man.bsdlabel.8; utility replaces the old &man.disklabel.8; program. With &man.bsdlabel.8; a number of obsolete options and parameters have been retired; in the examples above the option should be removed. For more information, please refer to the &man.bsdlabel.8; manual page. The next step is to change the disk label type. You can use &man.disklabel.8; to edit the disks: disklabel -e ad1 disklabel -e ad2 disklabel -e ad3 This opens up the current disk label on each disk with the editor specified by the EDITOR environment variable, typically &man.vi.1;. An unmodified disk label will look something like this: 8 partitions: # size offset fstype [fsize bsize bps/cpg] c: 60074784 0 unused 0 0 0 # (Cyl. 0 - 59597) Add a new e partition for &man.ccd.4; to use. This can usually be copied from the c partition, but the must be 4.2BSD. The disk label should now look something like this: 8 partitions: # size offset fstype [fsize bsize bps/cpg] c: 60074784 0 unused 0 0 0 # (Cyl. 0 - 59597) e: 60074784 0 4.2BSD 0 0 0 # (Cyl. 0 - 59597) Building the File System The device node for ccd0c may not exist yet, so to create it, perform the following commands: cd /dev sh MAKEDEV ccd0 In FreeBSD 5.0, &man.devfs.5; will automatically manage device nodes in /dev, so use of MAKEDEV is not necessary. Now that you have all the disks labeled, you must build the &man.ccd.4;. To do that, use &man.ccdconfig.8;, with options similar to the following: ccdconfig ccd0 32 0 /dev/ad1e /dev/ad2e /dev/ad3e The use and meaning of each option is shown below: The first argument is the device to configure, in this case, /dev/ccd0c. The /dev/ portion is optional. The interleave for the file system. The interleave defines the size of a stripe in disk blocks, each normally 512 bytes. So, an interleave of 32 would be 16,384 bytes. Flags for &man.ccdconfig.8;. If you want to enable drive mirroring, you can specify a flag here. This configuration does not provide mirroring for &man.ccd.4;, so it is set at 0 (zero). The final arguments to &man.ccdconfig.8; are the devices to place into the array. Use the complete pathname for each device. After running &man.ccdconfig.8; the &man.ccd.4; is configured. A file system can be installed. Refer to &man.newfs.8; for options, or simply run: newfs /dev/ccd0c Making it All Automatic Generally, you will want to mount the &man.ccd.4; upon each reboot. To do this, you must configure it first. Write out your current configuration to /etc/ccd.conf using the following command: ccdconfig -g > /etc/ccd.conf During reboot, the script /etc/rc runs ccdconfig -C if /etc/ccd.conf exists. This automatically configures the &man.ccd.4; so it can be mounted. If you are booting into single user mode, before you can &man.mount.8; the &man.ccd.4;, you need to issue the following command to configure the array: ccdconfig -C To automatically mount the &man.ccd.4;, place an entry for the &man.ccd.4; in /etc/fstab so it will be mounted at boot time: /dev/ccd0c /media ufs rw 2 2 The Vinum Volume Manager RAIDsoftware RAID Vinum The Vinum Volume Manager is a block device driver which implements virtual disk drives. It isolates disk hardware from the block device interface and maps data in ways which result in an increase in flexibility, performance and reliability compared to the traditional slice view of disk storage. &man.vinum.8; implements the RAID-0, RAID-1 and RAID-5 models, both individually and in combination. See for more information about &man.vinum.8;. Hardware RAID RAID hardware FreeBSD also supports a variety of hardware RAID controllers. These devices control a RAID subsystem without the need for FreeBSD specific software to manage the array. Using an on-card BIOS, the card controls most of the disk operations itself. The following is a brief setup description using a Promise IDE RAID controller. When this card is installed and the system is started up, it displays a prompt requesting information. Follow the instructions to enter the card's setup screen. From here, you have the ability to combine all the attached drives. After doing so, the disk(s) will look like a single drive to FreeBSD. Other RAID levels can be set up accordingly. Rebuilding ATA RAID1 Arrays FreeBSD allows you to hot-replace a failed disk in an array. This requires that you catch it before you reboot. You will probably see something like the following in /var/log/messages or in the &man.dmesg.8; output: ad6 on monster1 suffered a hard error. ad6: READ command timeout tag=0 serv=0 - resetting ad6: trying fallback to PIO mode ata3: resetting devices .. done ad6: hard error reading fsbn 1116119 of 0-7 (ad6 bn 1116119; cn 1107 tn 4 sn 11)\\ status=59 error=40 ar0: WARNING - mirror lost Using &man.atacontrol.8;, check for further information: &prompt.root; atacontrol list ATA channel 0: Master: no device present Slave: acd0 <HL-DT-ST CD-ROM GCR-8520B/1.00> ATA/ATAPI rev 0 ATA channel 1: Master: no device present Slave: no device present ATA channel 2: Master: ad4 <MAXTOR 6L080J4/A93.0500> ATA/ATAPI rev 5 Slave: no device present ATA channel 3: Master: ad6 <MAXTOR 6L080J4/A93.0500> ATA/ATAPI rev 5 Slave: no device present &prompt.root; atacontrol status ar0 ar0: ATA RAID1 subdisks: ad4 ad6 status: DEGRADED You will first need to detach the ata channel with the failed disk so you can safely remove it: &prompt.root; atacontrol detach ata3 Replace the disk. Reattach the ata channel: &prompt.root; atacontrol attach ata3 Master: ad6 <MAXTOR 6L080J4/A93.0500> ATA/ATAPI rev 5 Slave: no device present Add the new disk to the array as a spare: &prompt.root; atacontrol addspare ar0 ad6 Rebuild the array: &prompt.root; atacontrol rebuild ar0 It is possible to check on the progress by issuing the following command: &prompt.root; dmesg | tail -10 [output removed] ad6: removed from configuration ad6: deleted from ar0 disk1 ad6: inserted into ar0 disk1 as spare &prompt.root; atacontrol status ar0 ar0: ATA RAID1 subdisks: ad4 ad6 status: REBUILDING 0% completed Wait until this operation completes. Marc Fonvieille Contributed by USB Storage Devices USB disks A lot of external storage solutions, nowadays, use the Universal Serial Bus (USB): hard drives, USB thumbdrives, CD-R burners, etc. &os; provides support for these devices. Configuration The USB mass storage devices driver, &man.umass.4;, provides the support for USB storage devices. If you use the GENERIC kernel, you do not have to change anything in your configuration. If you use a custom kernel, be sure that the following lines are present in your kernel configuration file: device scbus device da device pass device uhci device ohci device usb device umass The &man.umass.4; driver uses the SCSI subsystem to access to the USB storage devices, your USB device will be seen as a SCSI device by the system. Depending on the USB chipset on your motherboard, you only need either device uhci or device ohci, however having both in the kernel configuration file is harmless. Do not forget to compile and install the new kernel if you added any lines. If your USB device is a CD-R or DVD burner, the SCSI CD-ROM driver, &man.cd.4;, must be added to the kernel via the line: device cd Since the burner is seen as a SCSI drive, the driver &man.atapicam.4; should not be used in the kernel configuration. Support for USB 2.0 controllers is provided on &os; 5.X, and on the 4.X branch since &os; 4.10-RELEASE. You have to add: device ehci to your configuration file for USB 2.0 support. Note &man.uhci.4; and &man.ohci.4; drivers are still needed if you want USB 1.X support. On &os; 4.X, the USB daemon (&man.usbd.8;) must be running to be able to see some USB devices. To enable it, add usbd_enable="YES" to your /etc/rc.conf file and reboot the machine. Testing the Configuration The configuration is ready to be tested: plug in your USB device, and in the system message buffer (&man.dmesg.8;), the drive should appear as something like: umass0: USB Solid state disk, rev 1.10/1.00, addr 2 GEOM: create disk da0 dp=0xc2d74850 da0 at umass-sim0 bus 0 target 0 lun 0 da0: <Generic Traveling Disk 1.11> Removable Direct Access SCSI-2 device da0: 1.000MB/s transfers da0: 126MB (258048 512 byte sectors: 64H 32S/T 126C) Of course, the brand, the device node (da0) and other details can differ according to your configuration. Since the USB device is seen as a SCSI one, the camcontrol command can be used to list the USB storage devices attached to the system: &prompt.root; camcontrol devlist <Generic Traveling Disk 1.11> at scbus0 target 0 lun 0 (da0,pass0) If the drive comes with a file system, you should be able to mount it. The will help you to format and create partitions on the USB drive if needed. If you unplug the device (the disk must be unmounted before), you should see, in the system message buffer, something like the following: umass0: at uhub0 port 1 (addr 2) disconnected (da0:umass-sim0:0:0:0): lost device (da0:umass-sim0:0:0:0): removing device entry GEOM: destroy disk da0 dp=0xc2d74850 umass0: detached Further Reading Beside the Adding Disks and Mounting and Unmounting File Systems sections, reading various manual pages may be also useful: &man.umass.4;, &man.camcontrol.8;, and &man.usbdevs.8;. Mike Meyer Contributed by Creating and Using Optical Media (CDs) CDROMs creating Introduction CDs have a number of features that differentiate them from conventional disks. Initially, they were not writable by the user. They are designed so that they can be read continuously without delays to move the head between tracks. They are also much easier to transport between systems than similarly sized media were at the time. CDs do have tracks, but this refers to a section of data to be read continuously and not a physical property of the disk. To produce a CD on FreeBSD, you prepare the data files that are going to make up the tracks on the CD, then write the tracks to the CD. ISO 9660 file systems ISO 9660 The ISO 9660 file system was designed to deal with these differences. It unfortunately codifies file system limits that were common then. Fortunately, it provides an extension mechanism that allows properly written CDs to exceed those limits while still working with systems that do not support those extensions. sysutils/cdrtools The sysutils/cdrtools port includes &man.mkisofs.8;, a program that you can use to produce a data file containing an ISO 9660 file system. It has options that support various extensions, and is described below. CD burner ATAPI Which tool to use to burn the CD depends on whether your CD burner is ATAPI or something else. ATAPI CD burners use the burncd program that is part of the base system. SCSI and USB CD burners should use cdrecord from the sysutils/cdrtools port. burncd has a limited number of supported drives. To find out if a drive is supported, see the CD-R/RW supported drives list. CD burner ATAPI/CAM driver If you run &os; 5.X, &os; 4.8-RELEASE version or higher, it will be possible to use cdrecord and other tools for SCSI drives on an ATAPI hardware with the ATAPI/CAM module. If you want a CD burning software with a graphical user interface, you should have a look to X-CD-Roast or K3b. These tools are available as packages or from the sysutils/xcdroast and sysutils/k3b ports. X-CD-Roast and K3b require the ATAPI/CAM module with ATAPI hardware. mkisofs The &man.mkisofs.8; program, which is part of the sysutils/cdrtools port, produces an ISO 9660 file system that is an image of a directory tree in the &unix; file system name space. The simplest usage is: &prompt.root; mkisofs -o imagefile.iso /path/to/tree file systems ISO 9660 This command will create an imagefile.iso containing an ISO 9660 file system that is a copy of the tree at /path/to/tree. In the process, it will map the file names to names that fit the limitations of the standard ISO 9660 file system, and will exclude files that have names uncharacteristic of ISO file systems. file systems HFS file systems Joliet A number of options are available to overcome those restrictions. In particular, enables the Rock Ridge extensions common to &unix; systems, enables Joliet extensions used by Microsoft systems, and can be used to create HFS file systems used by &macos;. For CDs that are going to be used only on FreeBSD systems, can be used to disable all filename restrictions. When used with , it produces a file system image that is identical to the FreeBSD tree you started from, though it may violate the ISO 9660 standard in a number of ways. CDROMs creating bootable The last option of general use is . This is used to specify the location of the boot image for use in producing an El Torito bootable CD. This option takes an argument which is the path to a boot image from the top of the tree being written to the CD. By default, &man.mkisofs.8; creates an ISO image in the so-called floppy disk emulation mode, and thus expects the boot image to be exactly 1200, 1440 or 2880 KB in size. Some boot loaders, like the one used by the FreeBSD distribution disks, do not use emulation mode; in this case, the option should be used. So, if /tmp/myboot holds a bootable FreeBSD system with the boot image in /tmp/myboot/boot/cdboot, you could produce the image of an ISO 9660 file system in /tmp/bootable.iso like so: &prompt.root; mkisofs -R -no-emul-boot -b boot/cdboot -o /tmp/bootable.iso /tmp/myboot Having done that, if you have vn (FreeBSD 4.X), or md (FreeBSD 5.X) configured in your kernel, you can mount the file system with: &prompt.root; vnconfig -e vn0c /tmp/bootable.iso &prompt.root; mount -t cd9660 /dev/vn0c /mnt for FreeBSD 4.X, and for FreeBSD 5.X: &prompt.root; mdconfig -a -t vnode -f /tmp/bootable.iso -u 0 &prompt.root; mount -t cd9660 /dev/md0 /mnt At which point you can verify that /mnt and /tmp/myboot are identical. There are many other options you can use with &man.mkisofs.8; to fine-tune its behavior. In particular: modifications to an ISO 9660 layout and the creation of Joliet and HFS discs. See the &man.mkisofs.8; manual page for details. burncd CDROMs burning If you have an ATAPI CD burner, you can use the burncd command to burn an ISO image onto a CD. burncd is part of the base system, installed as /usr/sbin/burncd. Usage is very simple, as it has few options: &prompt.root; burncd -f cddevice data imagefile.iso fixate Will burn a copy of imagefile.iso on cddevice. The default device is /dev/acd0 (or /dev/acd0c under &os; 4.X). See &man.burncd.8; for options to set the write speed, eject the CD after burning, and write audio data. cdrecord If you do not have an ATAPI CD burner, you will have to use cdrecord to burn your CDs. cdrecord is not part of the base system; you must install it from either the port at sysutils/cdrtools or the appropriate package. Changes to the base system can cause binary versions of this program to fail, possibly resulting in a coaster. You should therefore either upgrade the port when you upgrade your system, or if you are tracking -STABLE, upgrade the port when a new version becomes available. While cdrecord has many options, basic usage is even simpler than burncd. Burning an ISO 9660 image is done with: &prompt.root; cdrecord dev=device imagefile.iso The tricky part of using cdrecord is finding the to use. To find the proper setting, use the flag of cdrecord, which might produce results like this: CDROMs burning &prompt.root; cdrecord -scanbus Cdrecord 1.9 (i386-unknown-freebsd4.2) Copyright (C) 1995-2000 Jörg Schilling Using libscg version 'schily-0.1' scsibus0: 0,0,0 0) 'SEAGATE ' 'ST39236LW ' '0004' Disk 0,1,0 1) 'SEAGATE ' 'ST39173W ' '5958' Disk 0,2,0 2) * 0,3,0 3) 'iomega ' 'jaz 1GB ' 'J.86' Removable Disk 0,4,0 4) 'NEC ' 'CD-ROM DRIVE:466' '1.26' Removable CD-ROM 0,5,0 5) * 0,6,0 6) * 0,7,0 7) * scsibus1: 1,0,0 100) * 1,1,0 101) * 1,2,0 102) * 1,3,0 103) * 1,4,0 104) * 1,5,0 105) 'YAMAHA ' 'CRW4260 ' '1.0q' Removable CD-ROM 1,6,0 106) 'ARTEC ' 'AM12S ' '1.06' Scanner 1,7,0 107) * This lists the appropriate value for the devices on the list. Locate your CD burner, and use the three numbers separated by commas as the value for . In this case, the CRW device is 1,5,0, so the appropriate input would be . There are easier ways to specify this value; see &man.cdrecord.1; for details. That is also the place to look for information on writing audio tracks, controlling the speed, and other things. Duplicating Audio CDs You can duplicate an audio CD by extracting the audio data from the CD to a series of files, and then writing these files to a blank CD. The process is slightly different for ATAPI and SCSI drives. SCSI Drives Use cdda2wav to extract the audio. &prompt.user; cdda2wav -v255 -D2,0 -B -Owav Use cdrecord to write the .wav files. &prompt.user; cdrecord -v dev=2,0 -dao -useinfo *.wav Make sure that 2,0 is set appropriately, as described in . ATAPI Drives The ATAPI CD driver makes each track available as /dev/acddtnn, where d is the drive number, and nn is the track number written with two decimal digits, prefixed with zero as needed. So the first track on the first disk is /dev/acd0t01, the second is /dev/acd0t02, the third is /dev/acd0t03, and so on. Make sure the appropriate files exist in /dev. If the entries are missing, force the system to retaste the media: &prompt.root; dd if=/dev/acd0 of=/dev/null count=1 In &os; 4.X, the entries are not prefixed with zero. If the necessary entries in /dev are missing, use MAKEDEV to create them: &prompt.root; cd /dev &prompt.root; sh MAKEDEV acd0t99 Extract each track using &man.dd.1;. You must also use a specific block size when extracting the files. &prompt.root; dd if=/dev/acd0t01 of=track1.cdr bs=2352 &prompt.root; dd if=/dev/acd0t02 of=track2.cdr bs=2352 ... Burn the extracted files to disk using burncd. You must specify that these are audio files, and that burncd should fixate the disk when finished. &prompt.root; burncd -f /dev/acd0 audio track1.cdr track2.cdr ... fixate Duplicating Data CDs You can copy a data CD to a image file that is functionally equivalent to the image file created with &man.mkisofs.8;, and you can use it to duplicate any data CD. The example given here assumes that your CDROM device is acd0. Substitute your correct CDROM device. Under &os; 4.X, a c must be appended to the end of the device name to indicate the entire partition or, in the case of CDROMs, the entire disc. &prompt.root; dd if=/dev/acd0 of=file.iso bs=2048 Now that you have an image, you can burn it to CD as described above. Using Data CDs Now that you have created a standard data CDROM, you probably want to mount it and read the data on it. By default, &man.mount.8; assumes that a file system is of type ufs. If you try something like: &prompt.root; mount /dev/cd0 /mnt you will get a complaint about Incorrect super block, and no mount. The CDROM is not a UFS file system, so attempts to mount it as such will fail. You just need to tell &man.mount.8; that the file system is of type ISO9660, and everything will work. You do this by specifying the option &man.mount.8;. For example, if you want to mount the CDROM device, /dev/cd0, under /mnt, you would execute: &prompt.root; mount -t cd9660 /dev/cd0 /mnt Note that your device name (/dev/cd0 in this example) could be different, depending on the interface your CDROM uses. Also, the option just executes &man.mount.cd9660.8;. The above example could be shortened to: &prompt.root; mount_cd9660 /dev/cd0 /mnt You can generally use data CDROMs from any vendor in this way. Disks with certain ISO 9660 extensions might behave oddly, however. For example, Joliet disks store all filenames in two-byte Unicode characters. The FreeBSD kernel does not speak Unicode (yet!), so non-English characters show up as question marks. (If you are running FreeBSD 4.3 or later, the CD9660 driver includes hooks to load an appropriate Unicode conversion table on the fly. Modules for some of the common encodings are available via the sysutils/cd9660_unicode port.) Occasionally, you might get Device not configured when trying to mount a CDROM. This usually means that the CDROM drive thinks that there is no disk in the tray, or that the drive is not visible on the bus. It can take a couple of seconds for a CDROM drive to realize that it has been fed, so be patient. Sometimes, a SCSI CDROM may be missed because it did not have enough time to answer the bus reset. If you have a SCSI CDROM please add the following option to your kernel configuration and rebuild your kernel. options SCSI_DELAY=15000 This tells your SCSI bus to pause 15 seconds during boot, to give your CDROM drive every possible chance to answer the bus reset. Burning Raw Data CDs You can choose to burn a file directly to CD, without creating an ISO 9660 file system. Some people do this for backup purposes. This runs more quickly than burning a standard CD: &prompt.root; burncd -f /dev/acd1 -s 12 data archive.tar.gz fixate In order to retrieve the data burned to such a CD, you must read data from the raw device node: &prompt.root; tar xzvf /dev/acd1 You cannot mount this disk as you would a normal CDROM. Such a CDROM cannot be read under any operating system except FreeBSD. If you want to be able to mount the CD, or share data with another operating system, you must use &man.mkisofs.8; as described above. Marc Fonvieille Contributed by CD burner ATAPI/CAM driver Using the ATAPI/CAM Driver This driver allows ATAPI devices (CD-ROM, CD-RW, DVD drives etc...) to be accessed through the SCSI subsystem, and so allows the use of applications like sysutils/cdrdao or &man.cdrecord.1;. To use this driver, you will need to add the following line to your kernel configuration file: device atapicam You also need the following lines in your kernel configuration file: device ata device scbus device cd device pass which should already be present. Then rebuild, install your new kernel, and reboot your machine. During the boot process, your burner should show up, like so: acd0: CD-RW <MATSHITA CD-RW/DVD-ROM UJDA740> at ata1-master PIO4 cd0 at ata1 bus 0 target 0 lun 0 cd0: <MATSHITA CDRW/DVD UJDA740 1.00> Removable CD-ROM SCSI-0 device cd0: 16.000MB/s transfers cd0: Attempt to query device size failed: NOT READY, Medium not present - tray closed The drive could now be accessed via the /dev/cd0 device name, for example to mount a CD-ROM on /mnt, just type the following: &prompt.root; mount -t cd9660 /dev/cd0 /mnt As root, you can run the following command to get the SCSI address of the burner: &prompt.root; camcontrol devlist <MATSHITA CDRW/DVD UJDA740 1.00> at scbus1 target 0 lun 0 (pass0,cd0) So 1,0,0 will be the SCSI address to use with &man.cdrecord.1; and other SCSI application. For more information about ATAPI/CAM and SCSI system, refer to the &man.atapicam.4; and &man.cam.4; manual pages. Marc Fonvieille Contributed by Andy Polyakov With inputs from Creating and Using Optical Media (DVDs) DVD burning Introduction Compared to the CD, the DVD is the next generation of optical media storage technology. The DVD can hold more data than any CD and is nowadays the standard for video publishing. Five physical recordable formats can be defined for what we will call a recordable DVD: DVD-R: This was the first DVD recordable format available. The DVD-R standard is defined by the DVD Forum. This format is write once. DVD-RW: This is the rewriteable version of the DVD-R standard. A DVD-RW can be rewritten about 1000 times. DVD-RAM: This is also a rewriteable format supported by the DVD Forum. A DVD-RAM can be seen as a removable hard drive. However, this media is not compatible with most DVD-ROM drives and DVD-Video players; only a few DVD writers support the DVD-RAM format. DVD+RW: This is a rewriteable format defined by the DVD+RW Alliance. A DVD+RW can be rewritten about 1000 times. DVD+R: This format is the write once variation of the DVD+RW format. A single layer recordable DVD can hold up to 4,700,000,000 bytes which is actually 4.38 GB or 4485 MB (1 kilobyte is 1024 bytes). A distinction must be made between the physical media and the application. For example, a DVD-Video is a specific file layout that can be written on any recordable DVD physical media: DVD-R, DVD+R, DVD-RW etc. Before choosing the type of media, you must be sure that both the burner and the DVD-Video player (a standalone player or a DVD-ROM drive on a computer) are compatible with the media under consideration. Configuration The program &man.growisofs.1; will be used to perform DVD recording. This command is part of the dvd+rw-tools utilities (sysutils/dvd+rw-tools). The dvd+rw-tools support all DVD media types. These tools use the SCSI subsystem to access to the devices, therefore the ATAPI/CAM support must be added to your kernel. If your burner uses the USB interface this addition is useless, and you should read the for more details on USB devices configuration. You also have to enable DMA access for ATAPI devices, this can be done in adding the following line to the /boot/loader.conf file: hw.ata.atapi_dma="1" Before attempting to use the dvd+rw-tools you should consult the dvd+rw-tools' hardware compatibility notes for any information related to your DVD burner. If you want a graphical user interface, you should have a look to K3b (sysutils/k3b) which provides a user friendly interface to &man.growisofs.1; and many others burning tools. Burning Data DVDs The &man.growisofs.1; command is a frontend to mkisofs, it will invoke &man.mkisofs.8; to create the file system layout and will perform the write on the DVD. This means you do not need to create an image of the data before the burning process. To burn onto a DVD+R or a DVD-R the data from the /path/to/data directory, use the following command: &prompt.root; growisofs -dvd-compat -Z /dev/cd0 -J -R /path/to/data The options are passed to &man.mkisofs.8; for the file system creation (in this case: an ISO 9660 file system with Joliet and Rock Ridge extensions), consult the &man.mkisofs.8; manual page for more details. The option is used for the initial session recording in any case: multiple sessions or not. The DVD device, /dev/cd0, must be changed according to your configuration. The parameter will close the disk, the recording will be unappendable. In return this should provide better media compatibility with DVD-ROM drives. It is also possible to burn a pre-mastered image, for example to burn the image imagefile.iso, we will run: &prompt.root; growisofs -dvd-compat -Z /dev/cd0=imagefile.iso The write speed should be detected and automatically set according to the media and the drive being used. If you want to force the write speed, use the parameter. For more information, read the &man.growisofs.1; manual page. DVD DVD-Video Burning a DVD-Video A DVD-Video is a specific file layout based on ISO 9660 and the micro-UDF (M-UDF) specifications. The DVD-Video also presents a specific data structure hierarchy, it is the reason why you need a particular program such as multimedia/dvdauthor to author the DVD. If you already have an image of the DVD-Video file system, just burn it in the same way as for any image, see the previous section for an example. If you have made the DVD authoring and the result is in, for example, the directory /path/to/video, the following command should be used to burn the DVD-Video: &prompt.root; growisofs -Z /dev/cd0 -dvd-video /path/to/video The option will be passed down to &man.mkisofs.8; and will instruct it to create a DVD-Video file system layout. Beside this, the option implies &man.growisofs.1; option. DVD DVD+RW Using a DVD+RW Unlike CD-RW, a virgin DVD+RW needs to be formatted before first use. The &man.growisofs.1; program will take care of it automatically whenever appropriate, which is the recommended way. However you can use the dvd+rw-format command to format the DVD+RW: &prompt.root; dvd+rw-format /dev/cd0 You need to perform this operation just once, keep in mind that only virgin DVD+RW medias need to be formatted. Then you can burn the DVD+RW in the way seen in previous sections. If you want to burn new data (burn a totally new file system not append some data) onto a DVD+RW, you do not need to blank it, you just have to write over the previous recording (in performing a new initial session), like this: &prompt.root; growisofs -Z /dev/cd0 -J -R /path/to/newdata DVD+RW format offers the possibility to easily append data to a previous recording. The operation consists in merging a new session to the existing one, it is not multisession writing, &man.growisofs.1; will grow the ISO 9660 file system present on the media. For example, if we want to append data to our previous DVD+RW, we have to use the following: &prompt.root; growisofs -M /dev/cd0 -J -R /path/to/nextdata The same &man.mkisofs.8; options we used to burn the initial session should be used during next writes. You may want to use the option if you want better media compatibility with DVD-ROM drives. In the DVD+RW case, this will not prevent you from adding data. If for any reason you really want to blank the media, do the following: &prompt.root; growisofs -Z /dev/cd0=/dev/zero DVD DVD-RW Using a DVD-RW A DVD-RW accepts two disc formats: the incremental sequential one and the restricted overwrite. By default DVD-RW discs are in sequential format. A virgin DVD-RW can be directly written without the need of a formatting operation, however a non-virgin DVD-RW in sequential format needs to be blanked before to be able to write a new initial session. To blank a DVD-RW in sequential mode, run: &prompt.root; dvd+rw-format -blank=full /dev/cd0 A full blanking () will take about one hour on a 1x media. A fast blanking can be performed using the option if the DVD-RW will be recorded in Disk-At-Once (DAO) mode. To burn the DVD-RW in DAO mode, use the command: &prompt.root; growisofs -use-the-force-luke=dao -Z /dev/cd0=imagefile.iso The option should not be required since &man.growisofs.1; attempts to detect minimally (fast blanked) media and engage DAO write. In fact one should use restricted overwrite mode with any DVD-RW, this format is more flexible than the default incremental sequential one. To write data on a sequential DVD-RW, use the same instructions as for the other DVD formats: &prompt.root; growisofs -Z /dev/cd0 -J -R /path/to/data If you want to append some data to your previous recording, you will have to use the &man.growisofs.1; option. However, if you perform data addition on a DVD-RW in incremental sequential mode, a new session will be created on the disc and the result will be a multi-session disc. A DVD-RW in restricted overwrite format does not need to be blanked before a new initial session, you just have to overwrite the disc with the option, this is similar to the DVD+RW case. It is also possible to grow an existing ISO 9660 file system written on the disc in a same way as for a DVD+RW with the option. The result will be a one-session DVD. To put a DVD-RW in the restricted overwrite format, the following command must be used: &prompt.root; dvd+rw-format /dev/cd0 To change back to the sequential format use: &prompt.root; dvd+rw-format -blank=full /dev/cd0 Multisession Very few DVD-ROM drives support multisession DVDs, they will most of time, hopefully, only read the first session. DVD+R, DVD-R and DVD-RW in sequential format can accept multiple sessions, the notion of multiple sessions does not exist for the DVD+RW and the DVD-RW restricted overwrite formats. Using the following command after an initial (non-closed) session on a DVD+R, DVD-R, or DVD-RW in sequential format, will add a new session to the disc: &prompt.root; growisofs -M /dev/cd0 -J -R /path/to/nextdata Using this command line with a DVD+RW or a DVD-RW in restricted overwrite mode, will append data in merging the new session to the existing one. The result will be a single-session disc. This is the way used to add data after an initial write on these medias. Some space on the media is used between each session for end and start of sessions. Therefore, one should add sessions with large amount of data to optimize media space. The number of sessions is limited to 154 for a DVD+R, about 2000 for a DVD-R, and 127 for a DVD+R Double Layer. For More Information To obtain more information about a DVD, the dvd+rw-mediainfo /dev/cd0 command can be ran with the disc in the drive. More information about the dvd+rw-tools can be found in the &man.growisofs.1; manual page, on the dvd+rw-tools web site and in the cdwrite mailing list archives. The dvd+rw-mediainfo output of the resulting recording or the media with issues is mandatory for any problem report. Without this output, it will be quite impossible to help you. Julio Merino Original work by Martin Karlsson Rewritten by Creating and Using Floppy Disks Storing data on floppy disks is sometimes useful, for example when one does not have any other removable storage media or when one needs to transfer small amounts of data to another computer. This section will explain how to use floppy disks in FreeBSD. It will primarily cover formatting and usage of 3.5inch DOS floppies, but the concepts are similar for other floppy disk formats. Formatting Floppies The Device Floppy disks are accessed through entries in /dev, just like other devices. To access the raw floppy disk in 4.X and earlier releases, one uses /dev/fdN, where N stands for the drive number, usually 0, or /dev/fdNX, where X stands for a letter. In 5.0 or newer releases, simply use /dev/fdN. The Disk Size in 4.X and Earlier Releases There are also /dev/fdN.size devices, where size is a floppy disk size in kilobytes. These entries are used at low-level format time to determine the disk size. 1440kB is the size that will be used in the following examples. Sometimes the entries under /dev will have to be (re)created. To do that, issue: &prompt.root; cd /dev && ./MAKEDEV "fd*" The Disk Size in 5.0 and Newer Releases In 5.0, &man.devfs.5; will automatically manage device nodes in /dev, so use of MAKEDEV is not necessary. The desired disk size is passed to &man.fdformat.1; through the flag. Supported sizes are listed in &man.fdcontrol.8;, but be advised that 1440kB is what works best. Formatting A floppy disk needs to be low-level formated before it can be used. This is usually done by the vendor, but formatting is a good way to check media integrity. Although it is possible to force larger (or smaller) disk sizes, 1440kB is what most floppy disks are designed for. To low-level format the floppy disk you need to use &man.fdformat.1;. This utility expects the device name as an argument. Make note of any error messages, as these can help determine if the disk is good or bad. Formatting in 4.X and Earlier Releases Use the /dev/fdN.size devices to format the floppy. Insert a new 3.5inch floppy disk in your drive and issue: &prompt.root; /usr/sbin/fdformat /dev/fd0.1440 Formatting in 5.0 and Newer Releases Use the /dev/fdN devices to format the floppy. Insert a new 3.5inch floppy disk in your drive and issue: &prompt.root; /usr/sbin/fdformat -f 1440 /dev/fd0 The Disk Label After low-level formatting the disk, you will need to place a disk label on it. This disk label will be destroyed later, but it is needed by the system to determine the size of the disk and its geometry later. The new disk label will take over the whole disk, and will contain all the proper information about the geometry of the floppy. The geometry values for the disk label are listed in /etc/disktab. You can run now &man.disklabel.8; like so: &prompt.root; /sbin/disklabel -B -r -w /dev/fd0 fd1440 Since &os; 5.1-RELEASE, the &man.bsdlabel.8; utility replaces the old &man.disklabel.8; program. With &man.bsdlabel.8; a number of obsolete options and parameters have been retired; in the example above the option should be removed. For more information, please refer to the &man.bsdlabel.8; manual page. The File System Now the floppy is ready to be high-level formated. This will place a new file system on it, which will let FreeBSD read and write to the disk. After creating the new file system, the disk label is destroyed, so if you want to reformat the disk, you will have to recreate the disk label. The floppy's file system can be either UFS or FAT. FAT is generally a better choice for floppies. To put a new file system on the floppy, issue: &prompt.root; /sbin/newfs_msdos /dev/fd0 The disk is now ready for use. Using the Floppy To use the floppy, mount it with &man.mount.msdos.8; (in 4.X and earlier releases) or &man.mount.msdosfs.8; (in 5.0 or newer releases). One can also use emulators/mtools from the ports collection. Creating and Using Data Tapes tape media The major tape media are the 4mm, 8mm, QIC, mini-cartridge and DLT. 4mm (DDS: Digital Data Storage) tape media DDS (4mm) tapes tape media QIC tapes 4mm tapes are replacing QIC as the workstation backup media of choice. This trend accelerated greatly when Conner purchased Archive, a leading manufacturer of QIC drives, and then stopped production of QIC drives. 4mm drives are small and quiet but do not have the reputation for reliability that is enjoyed by 8mm drives. The cartridges are less expensive and smaller (3 x 2 x 0.5 inches, 76 x 51 x 12 mm) than 8mm cartridges. 4mm, like 8mm, has comparatively short head life for the same reason, both use helical scan. Data throughput on these drives starts ~150 kB/s, peaking at ~500 kB/s. Data capacity starts at 1.3 GB and ends at 2.0 GB. Hardware compression, available with most of these drives, approximately doubles the capacity. Multi-drive tape library units can have 6 drives in a single cabinet with automatic tape changing. Library capacities reach 240 GB. The DDS-3 standard now supports tape capacities up to 12 GB (or 24 GB compressed). 4mm drives, like 8mm drives, use helical-scan. All the benefits and drawbacks of helical-scan apply to both 4mm and 8mm drives. Tapes should be retired from use after 2,000 passes or 100 full backups. 8mm (Exabyte) tape media Exabyte (8mm) tapes 8mm tapes are the most common SCSI tape drives; they are the best choice of exchanging tapes. Nearly every site has an Exabyte 2 GB 8mm tape drive. 8mm drives are reliable, convenient and quiet. Cartridges are inexpensive and small (4.8 x 3.3 x 0.6 inches; 122 x 84 x 15 mm). One downside of 8mm tape is relatively short head and tape life due to the high rate of relative motion of the tape across the heads. Data throughput ranges from ~250 kB/s to ~500 kB/s. Data sizes start at 300 MB and go up to 7 GB. Hardware compression, available with most of these drives, approximately doubles the capacity. These drives are available as single units or multi-drive tape libraries with 6 drives and 120 tapes in a single cabinet. Tapes are changed automatically by the unit. Library capacities reach 840+ GB. The Exabyte Mammoth model supports 12 GB on one tape (24 GB with compression) and costs approximately twice as much as conventional tape drives. Data is recorded onto the tape using helical-scan, the heads are positioned at an angle to the media (approximately 6 degrees). The tape wraps around 270 degrees of the spool that holds the heads. The spool spins while the tape slides over the spool. The result is a high density of data and closely packed tracks that angle across the tape from one edge to the other. QIC tape media QIC-150 QIC-150 tapes and drives are, perhaps, the most common tape drive and media around. QIC tape drives are the least expensive serious backup drives. The downside is the cost of media. QIC tapes are expensive compared to 8mm or 4mm tapes, up to 5 times the price per GB data storage. But, if your needs can be satisfied with a half-dozen tapes, QIC may be the correct choice. QIC is the most common tape drive. Every site has a QIC drive of some density or another. Therein lies the rub, QIC has a large number of densities on physically similar (sometimes identical) tapes. QIC drives are not quiet. These drives audibly seek before they begin to record data and are clearly audible whenever reading, writing or seeking. QIC tapes measure (6 x 4 x 0.7 inches; 152 x 102 x 17 mm). Data throughput ranges from ~150 kB/s to ~500 kB/s. Data capacity ranges from 40 MB to 15 GB. Hardware compression is available on many of the newer QIC drives. QIC drives are less frequently installed; they are being supplanted by DAT drives. Data is recorded onto the tape in tracks. The tracks run along the long axis of the tape media from one end to the other. The number of tracks, and therefore the width of a track, varies with the tape's capacity. Most if not all newer drives provide backward-compatibility at least for reading (but often also for writing). QIC has a good reputation regarding the safety of the data (the mechanics are simpler and more robust than for helical scan drives). Tapes should be retired from use after 5,000 backups. DLT tape media DLT DLT has the fastest data transfer rate of all the drive types listed here. The 1/2" (12.5mm) tape is contained in a single spool cartridge (4 x 4 x 1 inches; 100 x 100 x 25 mm). The cartridge has a swinging gate along one entire side of the cartridge. The drive mechanism opens this gate to extract the tape leader. The tape leader has an oval hole in it which the drive uses to hook the tape. The take-up spool is located inside the tape drive. All the other tape cartridges listed here (9 track tapes are the only exception) have both the supply and take-up spools located inside the tape cartridge itself. Data throughput is approximately 1.5 MB/s, three times the throughput of 4mm, 8mm, or QIC tape drives. Data capacities range from 10 GB to 20 GB for a single drive. Drives are available in both multi-tape changers and multi-tape, multi-drive tape libraries containing from 5 to 900 tapes over 1 to 20 drives, providing from 50 GB to 9 TB of storage. With compression, DLT Type IV format supports up to 70 GB capacity. Data is recorded onto the tape in tracks parallel to the direction of travel (just like QIC tapes). Two tracks are written at once. Read/write head lifetimes are relatively long; once the tape stops moving, there is no relative motion between the heads and the tape. AIT tape media AIT AIT is a new format from Sony, and can hold up to 50 GB (with compression) per tape. The tapes contain memory chips which retain an index of the tape's contents. This index can be rapidly read by the tape drive to determine the position of files on the tape, instead of the several minutes that would be required for other tapes. Software such as SAMS:Alexandria can operate forty or more AIT tape libraries, communicating directly with the tape's memory chip to display the contents on screen, determine what files were backed up to which tape, locate the correct tape, load it, and restore the data from the tape. Libraries like this cost in the region of $20,000, pricing them a little out of the hobbyist market. Using a New Tape for the First Time The first time that you try to read or write a new, completely blank tape, the operation will fail. The console messages should be similar to: sa0(ncr1:4:0): NOT READY asc:4,1 sa0(ncr1:4:0): Logical unit is in process of becoming ready The tape does not contain an Identifier Block (block number 0). All QIC tape drives since the adoption of QIC-525 standard write an Identifier Block to the tape. There are two solutions: mt fsf 1 causes the tape drive to write an Identifier Block to the tape. Use the front panel button to eject the tape. Re-insert the tape and dump data to the tape. dump will report DUMP: End of tape detected and the console will show: HARDWARE FAILURE info:280 asc:80,96. rewind the tape using: mt rewind. Subsequent tape operations are successful. Backups to Floppies Can I Use Floppies for Backing Up My Data? backup floppies floppy disks Floppy disks are not really a suitable media for making backups as: The media is unreliable, especially over long periods of time. Backing up and restoring is very slow. They have a very limited capacity (the days of backing up an entire hard disk onto a dozen or so floppies has long since passed). However, if you have no other method of backing up your data then floppy disks are better than no backup at all. If you do have to use floppy disks then ensure that you use good quality ones. Floppies that have been lying around the office for a couple of years are a bad choice. Ideally use new ones from a reputable manufacturer. So How Do I Backup My Data to Floppies? The best way to backup to floppy disk is to use &man.tar.1; with the (multi volume) option, which allows backups to span multiple floppies. To backup all the files in the current directory and sub-directory use this (as root): &prompt.root; tar Mcvf /dev/fd0 * When the first floppy is full &man.tar.1; will prompt you to insert the next volume (because &man.tar.1; is media independent it refers to volumes; in this context it means floppy disk). Prepare volume #2 for /dev/fd0 and hit return: This is repeated (with the volume number incrementing) until all the specified files have been archived. Can I Compress My Backups? tar gzip compression Unfortunately, &man.tar.1; will not allow the option to be used for multi-volume archives. You could, of course, &man.gzip.1; all the files, &man.tar.1; them to the floppies, then &man.gunzip.1; the files again! How Do I Restore My Backups? To restore the entire archive use: &prompt.root; tar Mxvf /dev/fd0 There are two ways that you can use to restore only specific files. First, you can start with the first floppy and use: &prompt.root; tar Mxvf /dev/fd0 filename The utility &man.tar.1; will prompt you to insert subsequent floppies until it finds the required file. Alternatively, if you know which floppy the file is on then you can simply insert that floppy and use the same command as above. Note that if the first file on the floppy is a continuation from the previous one then &man.tar.1; will warn you that it cannot restore it, even if you have not asked it to! Lowell Gilbert Original work by Backup Strategies The first requirement in devising a backup plan is to make sure that all of the following problems are covered: Disk failure Accidental file deletion Random file corruption Complete machine destruction (e.g. fire), including destruction of any on-site backups. It is perfectly possible that some systems will be best served by having each of these problems covered by a completely different technique. Except for strictly personal systems with very low-value data, it is unlikely that one technique would cover all of them. Some of the techniques in the toolbox are: Archives of the whole system, backed up onto permanent media offsite. This actually provides protection against all of the possible problems listed above, but is slow and inconvenient to restore from. You can keep copies of the backups onsite and/or online, but there will still be inconveniences in restoring files, especially for non-privileged users. Filesystem snapshots. This is really only helpful in the accidental file deletion scenario, but it can be very helpful in that case, and is quick and easy to deal with. Copies of whole filesystems and/or disks (e.g. periodic rsync of the whole machine). This is generally most useful in networks with unique requirements. For general protection against disk failure, it is usually inferior to RAID. For restoring accidentally deleted files, it can be comparable to UFS snapshots, but that depends on your preferences. RAID. Minimizes or avoids downtime when a disk fails. At the expense of having to deal with disk failures more often (because you have more disks), albeit at a much lower urgency. Checking fingerprints of files. The &man.mtree.8; utility is very useful for this. Although it is not a backup technique, it helps guarantee that you will notice when you need to resort to your backups. This is particularly important for offline backups, and should be checked periodically. It is quite easy to come up with even more techniques, many of them variations on the ones listed above. Specialized requirements will usually lead to specialized techniques (for example, backing up a live database usually requires a method particular to the database software as an intermediate step). The important thing is to know what dangers you want to protect against, and how you will handle each. Backup Basics The three major backup programs are &man.dump.8;, &man.tar.1;, and &man.cpio.1;. Dump and Restore backup software dump / restore dump restore The traditional &unix; backup programs are dump and restore. They operate on the drive as a collection of disk blocks, below the abstractions of files, links and directories that are created by the file systems. dump backs up an entire file system on a device. It is unable to backup only part of a file system or a directory tree that spans more than one file system. dump does not write files and directories to tape, but rather writes the raw data blocks that comprise files and directories. If you use dump on your root directory, you would not back up /home, /usr or many other directories since these are typically mount points for other file systems or symbolic links into those file systems. dump has quirks that remain from its early days in Version 6 of AT&T UNIX (circa 1975). The default parameters are suitable for 9-track tapes (6250 bpi), not the high-density media available today (up to 62,182 ftpi). These defaults must be overridden on the command line to utilize the capacity of current tape drives. .rhosts It is also possible to backup data across the network to a tape drive attached to another computer with rdump and rrestore. Both programs rely upon &man.rcmd.3; and &man.ruserok.3; to access the remote tape drive. Therefore, the user performing the backup must be listed in the .rhosts file on the remote computer. The arguments to rdump and rrestore must be suitable to use on the remote computer. When rdumping from a FreeBSD computer to an Exabyte tape drive connected to a Sun called komodo, use: &prompt.root; /sbin/rdump 0dsbfu 54000 13000 126 komodo:/dev/nsa8 /dev/da0a 2>&1 Beware: there are security implications to allowing .rhosts authentication. Evaluate your situation carefully. It is also possible to use dump and restore in a more secure fashion over ssh. Using <command>dump</command> over <application>ssh</application> &prompt.root; /sbin/dump -0uan -f - /usr | gzip -2 | ssh -c blowfish \ targetuser@targetmachine.example.com dd of=/mybigfiles/dump-usr-l0.gz Or using dump's built-in method, setting the environment variable RSH: Using <command>dump</command> over <application>ssh</application> with <envar>RSH</envar> set &prompt.root; RSH=/usr/bin/ssh /sbin/dump -0uan -f targetuser@targetmachine.example.com:/dev/sa0 /usr <command>tar</command> backup software tar &man.tar.1; also dates back to Version 6 of AT&T UNIX (circa 1975). tar operates in cooperation with the file system; it writes files and directories to tape. tar does not support the full range of options that are available from &man.cpio.1;, but it does not require the unusual command pipeline that cpio uses. tar On FreeBSD 5.3 and later, both GNU tar and the default bsdtar are available. The GNU version can be invoked with gtar. It supports remote devices using the same syntax as rdump. To tar to an Exabyte tape drive connected to a Sun called komodo, use: &prompt.root; /usr/bin/gtar cf komodo:/dev/nsa8 . 2>&1 The same could be accomplished with bsdtar by using a pipeline and rsh to send the data to a remote tape drive. &prompt.root; tar cf - . | rsh hostname dd of=tape-device obs=20b If you are worried about the security of backing up over a network you should use the ssh command instead of rsh. <command>cpio</command> backup software cpio &man.cpio.1; is the original &unix; file interchange tape program for magnetic media. cpio has options (among many others) to perform byte-swapping, write a number of different archive formats, and pipe the data to other programs. This last feature makes cpio an excellent choice for installation media. cpio does not know how to walk the directory tree and a list of files must be provided through stdin. cpio cpio does not support backups across the network. You can use a pipeline and rsh to send the data to a remote tape drive. &prompt.root; for f in directory_list; do find $f >> backup.list done &prompt.root; cpio -v -o --format=newc < backup.list | ssh user@host "cat > backup_device" Where directory_list is the list of directories you want to back up, user@host is the user/hostname combination that will be performing the backups, and backup_device is where the backups should be written to (e.g., /dev/nsa0). <command>pax</command> backup software pax pax POSIX IEEE &man.pax.1; is IEEE/&posix;'s answer to tar and cpio. Over the years the various versions of tar and cpio have gotten slightly incompatible. So rather than fight it out to fully standardize them, &posix; created a new archive utility. pax attempts to read and write many of the various cpio and tar formats, plus new formats of its own. Its command set more resembles cpio than tar. <application>Amanda</application> backup software Amanda Amanda Amanda (Advanced Maryland Network Disk Archiver) is a client/server backup system, rather than a single program. An Amanda server will backup to a single tape drive any number of computers that have Amanda clients and a network connection to the Amanda server. A common problem at sites with a number of large disks is that the length of time required to backup to data directly to tape exceeds the amount of time available for the task. Amanda solves this problem. Amanda can use a holding disk to backup several file systems at the same time. Amanda creates archive sets: a group of tapes used over a period of time to create full backups of all the file systems listed in Amanda's configuration file. The archive set also contains nightly incremental (or differential) backups of all the file systems. Restoring a damaged file system requires the most recent full backup and the incremental backups. The configuration file provides fine control of backups and the network traffic that Amanda generates. Amanda will use any of the above backup programs to write the data to tape. Amanda is available as either a port or a package, it is not installed by default. Do Nothing Do nothing is not a computer program, but it is the most widely used backup strategy. There are no initial costs. There is no backup schedule to follow. Just say no. If something happens to your data, grin and bear it! If your time and your data is worth little to nothing, then Do nothing is the most suitable backup program for your computer. But beware, &unix; is a useful tool, you may find that within six months you have a collection of files that are valuable to you. Do nothing is the correct backup method for /usr/obj and other directory trees that can be exactly recreated by your computer. An example is the files that comprise the HTML or &postscript; version of this Handbook. These document formats have been created from SGML input files. Creating backups of the HTML or &postscript; files is not necessary. The SGML files are backed up regularly. Which Backup Program Is Best? LISA &man.dump.8; Period. Elizabeth D. Zwicky torture tested all the backup programs discussed here. The clear choice for preserving all your data and all the peculiarities of &unix; file systems is dump. Elizabeth created file systems containing a large variety of unusual conditions (and some not so unusual ones) and tested each program by doing a backup and restore of those file systems. The peculiarities included: files with holes, files with holes and a block of nulls, files with funny characters in their names, unreadable and unwritable files, devices, files that change size during the backup, files that are created/deleted during the backup and more. She presented the results at LISA V in Oct. 1991. See torture-testing Backup and Archive Programs. Emergency Restore Procedure Before the Disaster There are only four steps that you need to perform in preparation for any disaster that may occur. disklabel First, print the disklabel from each of your disks (e.g. disklabel da0 | lpr), your file system table (/etc/fstab) and all boot messages, two copies of each. fix-it floppies Second, determine that the boot and fix-it floppies (boot.flp and fixit.flp) have all your devices. The easiest way to check is to reboot your machine with the boot floppy in the floppy drive and check the boot messages. If all your devices are listed and functional, skip on to step three. Otherwise, you have to create two custom bootable floppies which have a kernel that can mount all of your disks and access your tape drive. These floppies must contain: fdisk, disklabel, newfs, mount, and whichever backup program you use. These programs must be statically linked. If you use dump, the floppy must contain restore. Third, create backup tapes regularly. Any changes that you make after your last backup may be irretrievably lost. Write-protect the backup tapes. Fourth, test the floppies (either boot.flp and fixit.flp or the two custom bootable floppies you made in step two.) and backup tapes. Make notes of the procedure. Store these notes with the bootable floppy, the printouts and the backup tapes. You will be so distraught when restoring that the notes may prevent you from destroying your backup tapes (How? In place of tar xvf /dev/sa0, you might accidentally type tar cvf /dev/sa0 and over-write your backup tape). For an added measure of security, make bootable floppies and two backup tapes each time. Store one of each at a remote location. A remote location is NOT the basement of the same office building. A number of firms in the World Trade Center learned this lesson the hard way. A remote location should be physically separated from your computers and disk drives by a significant distance. A Script for Creating a Bootable Floppy After the Disaster The key question is: did your hardware survive? You have been doing regular backups so there is no need to worry about the software. If the hardware has been damaged, the parts should be replaced before attempting to use the computer. If your hardware is okay, check your floppies. If you are using a custom boot floppy, boot single-user (type -s at the boot: prompt). Skip the following paragraph. If you are using the boot.flp and fixit.flp floppies, keep reading. Insert the boot.flp floppy in the first floppy drive and boot the computer. The original install menu will be displayed on the screen. Select the Fixit--Repair mode with CDROM or floppy. option. Insert the fixit.flp when prompted. restore and the other programs that you need are located in /mnt2/rescue (/mnt2/stand for &os; versions older than 5.2). Recover each file system separately. mount root partition disklabel newfs Try to mount (e.g. mount /dev/da0a /mnt) the root partition of your first disk. If the disklabel was damaged, use disklabel to re-partition and label the disk to match the label that you printed and saved. Use newfs to re-create the file systems. Re-mount the root partition of the floppy read-write (mount -u -o rw /mnt). Use your backup program and backup tapes to recover the data for this file system (e.g. restore vrf /dev/sa0). Unmount the file system (e.g. umount /mnt). Repeat for each file system that was damaged. Once your system is running, backup your data onto new tapes. Whatever caused the crash or data loss may strike again. Another hour spent now may save you from further distress later. * I Did Not Prepare for the Disaster, What Now? ]]> Marc Fonvieille Reorganized and enhanced by Network, Memory, and File-Backed File Systems virtual disks disks virtual Aside from the disks you physically insert into your computer: floppies, CDs, hard drives, and so forth; other forms of disks are understood by FreeBSD - the virtual disks. NFS Coda disks memory These include network file systems such as the Network File System and Coda, memory-based file systems and file-backed file systems. According to the FreeBSD version you run, you will have to use different tools for creation and use of file-backed and memory-based file systems. The FreeBSD 4.X users will have to use &man.MAKEDEV.8; to create the required devices. FreeBSD 5.0 and later use &man.devfs.5; to allocate device nodes transparently for the user. File-Backed File System under FreeBSD 4.X disks file-backed (4.X) The utility &man.vnconfig.8; configures and enables vnode pseudo-disk devices. A vnode is a representation of a file, and is the focus of file activity. This means that &man.vnconfig.8; uses files to create and operate a file system. One possible use is the mounting of floppy or CD images kept in files. To use &man.vnconfig.8;, you need &man.vn.4; support in your kernel configuration file: pseudo-device vn To mount an existing file system image: Using vnconfig to Mount an Existing File System Image under FreeBSD 4.X &prompt.root; vnconfig vn0 diskimage &prompt.root; mount /dev/vn0c /mnt To create a new file system image with &man.vnconfig.8;: Creating a New File-Backed Disk with <command>vnconfig</command> &prompt.root; dd if=/dev/zero of=newimage bs=1k count=5k 5120+0 records in 5120+0 records out &prompt.root; vnconfig -s labels -c vn0 newimage &prompt.root; disklabel -r -w vn0 auto &prompt.root; newfs vn0c Warning: 2048 sector(s) in last cylinder unallocated /dev/vn0c: 10240 sectors in 3 cylinders of 1 tracks, 4096 sectors 5.0MB in 1 cyl groups (16 c/g, 32.00MB/g, 1280 i/g) super-block backups (for fsck -b #) at: 32 &prompt.root; mount /dev/vn0c /mnt &prompt.root; df /mnt Filesystem 1K-blocks Used Avail Capacity Mounted on /dev/vn0c 4927 1 4532 0% /mnt File-Backed File System under FreeBSD 5.X disks file-backed (5.X) The utility &man.mdconfig.8; is used to configure and enable memory disks, &man.md.4;, under FreeBSD 5.X. To use &man.mdconfig.8;, you have to load &man.md.4; module or to add the support in your kernel configuration file: device md The &man.mdconfig.8; command supports three kinds of memory backed virtual disks: memory disks allocated with &man.malloc.9;, memory disks using a file or swap space as backing. One possible use is the mounting of floppy or CD images kept in files. To mount an existing file system image: Using <command>mdconfig</command> to Mount an Existing File System Image under FreeBSD 5.X &prompt.root; mdconfig -a -t vnode -f diskimage -u 0 &prompt.root; mount /dev/md0 /mnt To create a new file system image with &man.mdconfig.8;: Creating a New File-Backed Disk with <command>mdconfig</command> &prompt.root; dd if=/dev/zero of=newimage bs=1k count=5k 5120+0 records in 5120+0 records out &prompt.root; mdconfig -a -t vnode -f newimage -u 0 &prompt.root; disklabel -r -w md0 auto &prompt.root; newfs md0c /dev/md0c: 5.0MB (10240 sectors) block size 16384, fragment size 2048 using 4 cylinder groups of 1.27MB, 81 blks, 256 inodes. super-block backups (for fsck -b #) at: 32, 2624, 5216, 7808 &prompt.root; mount /dev/md0c /mnt &prompt.root; df /mnt Filesystem 1K-blocks Used Avail Capacity Mounted on /dev/md0c 4846 2 4458 0% /mnt If you do not specify the unit number with the option, &man.mdconfig.8; will use the &man.md.4; automatic allocation to select an unused device. The name of the allocated unit will be output on stdout like md4. For more details about &man.mdconfig.8;, please refer to the manual page. Since &os; 5.1-RELEASE, the &man.bsdlabel.8; utility replaces the old &man.disklabel.8; program. With &man.bsdlabel.8; a number of obsolete options and parameters have been retired; in the example above the option should be removed. For more information, please refer to the &man.bsdlabel.8; manual page. The utility &man.mdconfig.8; is very useful, however it asks many command lines to create a file-backed file system. FreeBSD 5.0 also comes with a tool called &man.mdmfs.8;, this program configures a &man.md.4; disk using &man.mdconfig.8;, puts a UFS file system on it using &man.newfs.8;, and mounts it using &man.mount.8;. For example, if you want to create and mount the same file system image as above, simply type the following: Configure and Mount a File-Backed Disk with <command>mdmfs</command> &prompt.root; dd if=/dev/zero of=newimage bs=1k count=5k 5120+0 records in 5120+0 records out &prompt.root; mdmfs -F newimage -s 5m md0 /mnt &prompt.root; df /mnt Filesystem 1K-blocks Used Avail Capacity Mounted on /dev/md0 4846 2 4458 0% /mnt If you use the option without unit number, &man.mdmfs.8; will use &man.md.4; auto-unit feature to automatically select an unused device. For more details about &man.mdmfs.8;, please refer to the manual page. Memory-Based File System under FreeBSD 4.X disks memory file system (4.X) The &man.md.4; driver is a simple, efficient means to create memory file systems under FreeBSD 4.X. &man.malloc.9; is used to allocate the memory. Simply take a file system you have prepared with, for example, &man.vnconfig.8;, and: md Memory Disk under FreeBSD 4.X &prompt.root; dd if=newimage of=/dev/md0 5120+0 records in 5120+0 records out &prompt.root; mount /dev/md0c /mnt &prompt.root; df /mnt Filesystem 1K-blocks Used Avail Capacity Mounted on /dev/md0c 4927 1 4532 0% /mnt For more details, please refer to &man.md.4; manual page. Memory-Based File System under FreeBSD 5.X disks memory file system (5.X) The same tools are used for memory-based and file-backed file systems: &man.mdconfig.8; or &man.mdmfs.8;. The storage for memory-based file system is allocated with &man.malloc.9;. Creating a New Memory-Based Disk with <command>mdconfig</command> &prompt.root; mdconfig -a -t malloc -s 5m -u 1 &prompt.root; newfs -U md1 /dev/md1: 5.0MB (10240 sectors) block size 16384, fragment size 2048 using 4 cylinder groups of 1.27MB, 81 blks, 256 inodes. with soft updates super-block backups (for fsck -b #) at: 32, 2624, 5216, 7808 &prompt.root; mount /dev/md1 /mnt &prompt.root; df /mnt Filesystem 1K-blocks Used Avail Capacity Mounted on /dev/md1 4846 2 4458 0% /mnt Creating a New Memory-Based Disk with <command>mdmfs</command> &prompt.root; mdmfs -M -s 5m md2 /mnt &prompt.root; df /mnt Filesystem 1K-blocks Used Avail Capacity Mounted on /dev/md2 4846 2 4458 0% /mnt Instead of using a &man.malloc.9; backed file system, it is possible to use swap, for that just replace with in the command line of &man.mdconfig.8;. The &man.mdmfs.8; utility by default (without ) creates a swap-based disk. For more details, please refer to &man.mdconfig.8; and &man.mdmfs.8; manual pages. Detaching a Memory Disk from the System disks detaching a memory disk When a memory-based or file-based file system is not used, you should release all resources to the system. The first thing to do is to unmount the file system, then use &man.mdconfig.8; to detach the disk from the system and release the resources. For example to detach and free all resources used by /dev/md4: &prompt.root; mdconfig -d -u 4 It is possible to list information about configured &man.md.4; devices in using the command mdconfig -l. For FreeBSD 4.X, &man.vnconfig.8; is used to detach the device. For example to detach and free all resources used by /dev/vn4: &prompt.root; vnconfig -u vn4 Tom Rhodes Contributed by File System Snapshots file systems snapshots FreeBSD 5.0 offers a new feature in conjunction with Soft Updates: File system snapshots. Snapshots allow a user to create images of specified file systems, and treat them as a file. Snapshot files must be created in the file system that the action is performed on, and a user may create no more than 20 snapshots per file system. Active snapshots are recorded in the superblock so they are persistent across unmount and remount operations along with system reboots. When a snapshot is no longer required, it can be removed with the standard &man.rm.1; command. Snapshots may be removed in any order, however all the used space may not be acquired because another snapshot will possibly claim some of the released blocks. The un-alterable file flag is set by &man.mksnap.ffs.8; after initial creation of a snapshot file. The &man.unlink.1; command makes an exception for snapshot files since it allows them to be removed. Snapshots are created with the &man.mount.8; command. To place a snapshot of /var in the file /var/snapshot/snap use the following command: &prompt.root; mount -u -o snapshot /var/snapshot/snap /var Alternatively, you can use &man.mksnap.ffs.8; to create a snapshot: &prompt.root; mksnap_ffs /var /var/snapshot/snap One can find snapshot files on a file system (e.g. /var) by using the &man.find.1; command: &prompt.root; find /var -flags snapshot Once a snapshot has been created, it has several uses: Some administrators will use a snapshot file for backup purposes, because the snapshot can be transfered to CDs or tape. File integrity, &man.fsck.8; may be ran on the snapshot. Assuming that the file system was clean when it was mounted, you should always get a clean (and unchanging) result. This is essentially what the background &man.fsck.8; process does. Run the &man.dump.8; utility on the snapshot. A dump will be returned that is consistent with the file system and the timestamp of the snapshot. &man.dump.8; can also take a snapshot, create a dump image and then remove the snapshot in one command using the flag. &man.mount.8; the snapshot as a frozen image of the file system. To &man.mount.8; the snapshot /var/snapshot/snap run: &prompt.root; mdconfig -a -t vnode -f /var/snapshot/snap -u 4 &prompt.root; mount -r /dev/md4 /mnt You can now walk the hierarchy of your frozen /var file system mounted at /mnt. Everything will initially be in the same state it was during the snapshot creation time. The only exception is that any earlier snapshots will appear as zero length files. When the use of a snapshot has delimited, it can be unmounted with: &prompt.root; umount /mnt &prompt.root; mdconfig -d -u 4 For more information about and file system snapshots, including technical papers, you can visit Marshall Kirk McKusick's website at . File System Quotas accounting disk space disk quotas Quotas are an optional feature of the operating system that allow you to limit the amount of disk space and/or the number of files a user or members of a group may allocate on a per-file system basis. This is used most often on timesharing systems where it is desirable to limit the amount of resources any one user or group of users may allocate. This will prevent one user or group of users from consuming all of the available disk space. Configuring Your System to Enable Disk Quotas Before attempting to use disk quotas, it is necessary to make sure that quotas are configured in your kernel. This is done by adding the following line to your kernel configuration file: options QUOTA The stock GENERIC kernel does not have this enabled by default, so you will have to configure, build and install a custom kernel in order to use disk quotas. Please refer to for more information on kernel configuration. Next you will need to enable disk quotas in /etc/rc.conf. This is done by adding the line: enable_quotas="YES" disk quotas checking For finer control over your quota startup, there is an additional configuration variable available. Normally on bootup, the quota integrity of each file system is checked by the &man.quotacheck.8; program. The &man.quotacheck.8; facility insures that the data in the quota database properly reflects the data on the file system. This is a very time consuming process that will significantly affect the time your system takes to boot. If you would like to skip this step, a variable in /etc/rc.conf is made available for the purpose: check_quotas="NO" Finally you will need to edit /etc/fstab to enable disk quotas on a per-file system basis. This is where you can either enable user or group quotas or both for all of your file systems. To enable per-user quotas on a file system, add the option to the options field in the /etc/fstab entry for the file system you want to enable quotas on. For example: /dev/da1s2g /home ufs rw,userquota 1 2 Similarly, to enable group quotas, use the option instead of . To enable both user and group quotas, change the entry as follows: /dev/da1s2g /home ufs rw,userquota,groupquota 1 2 By default, the quota files are stored in the root directory of the file system with the names quota.user and quota.group for user and group quotas respectively. See &man.fstab.5; for more information. Even though the &man.fstab.5; manual page says that you can specify an alternate location for the quota files, this is not recommended because the various quota utilities do not seem to handle this properly. At this point you should reboot your system with your new kernel. /etc/rc will automatically run the appropriate commands to create the initial quota files for all of the quotas you enabled in /etc/fstab, so there is no need to manually create any zero length quota files. In the normal course of operations you should not be required to run the &man.quotacheck.8;, &man.quotaon.8;, or &man.quotaoff.8; commands manually. However, you may want to read their manual pages just to be familiar with their operation. Setting Quota Limits disk quotas limits Once you have configured your system to enable quotas, verify that they really are enabled. An easy way to do this is to run: &prompt.root; quota -v You should see a one line summary of disk usage and current quota limits for each file system that quotas are enabled on. You are now ready to start assigning quota limits with the &man.edquota.8; command. You have several options on how to enforce limits on the amount of disk space a user or group may allocate, and how many files they may create. You may limit allocations based on disk space (block quotas) or number of files (inode quotas) or a combination of both. Each of these limits are further broken down into two categories: hard and soft limits. hard limit A hard limit may not be exceeded. Once a user reaches his hard limit he may not make any further allocations on the file system in question. For example, if the user has a hard limit of 500 kbytes on a file system and is currently using 490 kbytes, the user can only allocate an additional 10 kbytes. Attempting to allocate an additional 11 kbytes will fail. soft limit Soft limits, on the other hand, can be exceeded for a limited amount of time. This period of time is known as the grace period, which is one week by default. If a user stays over his or her soft limit longer than the grace period, the soft limit will turn into a hard limit and no further allocations will be allowed. When the user drops back below the soft limit, the grace period will be reset. The following is an example of what you might see when you run the &man.edquota.8; command. When the &man.edquota.8; command is invoked, you are placed into the editor specified by the EDITOR environment variable, or in the vi editor if the EDITOR variable is not set, to allow you to edit the quota limits. &prompt.root; edquota -u test Quotas for user test: /usr: kbytes in use: 65, limits (soft = 50, hard = 75) inodes in use: 7, limits (soft = 50, hard = 60) /usr/var: kbytes in use: 0, limits (soft = 50, hard = 75) inodes in use: 0, limits (soft = 50, hard = 60) You will normally see two lines for each file system that has quotas enabled. One line for the block limits, and one line for inode limits. Simply change the value you want updated to modify the quota limit. For example, to raise this user's block limit from a soft limit of 50 and a hard limit of 75 to a soft limit of 500 and a hard limit of 600, change: /usr: kbytes in use: 65, limits (soft = 50, hard = 75) to: /usr: kbytes in use: 65, limits (soft = 500, hard = 600) The new quota limits will be in place when you exit the editor. Sometimes it is desirable to set quota limits on a range of UIDs. This can be done by use of the option on the &man.edquota.8; command. First, assign the desired quota limit to a user, and then run edquota -p protouser startuid-enduid. For example, if user test has the desired quota limits, the following command can be used to duplicate those quota limits for UIDs 10,000 through 19,999: &prompt.root; edquota -p test 10000-19999 For more information see &man.edquota.8; manual page. Checking Quota Limits and Disk Usage disk quotas checking You can use either the &man.quota.1; or the &man.repquota.8; commands to check quota limits and disk usage. The &man.quota.1; command can be used to check individual user or group quotas and disk usage. A user may only examine his own quota, and the quota of a group he is a member of. Only the super-user may view all user and group quotas. The &man.repquota.8; command can be used to get a summary of all quotas and disk usage for file systems with quotas enabled. The following is some sample output from the quota -v command for a user that has quota limits on two file systems. Disk quotas for user test (uid 1002): Filesystem usage quota limit grace files quota limit grace /usr 65* 50 75 5days 7 50 60 /usr/var 0 50 75 0 50 60 grace period On the /usr file system in the above example, this user is currently 15 kbytes over the soft limit of 50 kbytes and has 5 days of the grace period left. Note the asterisk * which indicates that the user is currently over his quota limit. Normally file systems that the user is not using any disk space on will not show up in the output from the &man.quota.1; command, even if he has a quota limit assigned for that file system. The option will display those file systems, such as the /usr/var file system in the above example. Quotas over NFS NFS Quotas are enforced by the quota subsystem on the NFS server. The &man.rpc.rquotad.8; daemon makes quota information available to the &man.quota.1; command on NFS clients, allowing users on those machines to see their quota statistics. Enable rpc.rquotad in /etc/inetd.conf like so: rquotad/1 dgram rpc/udp wait root /usr/libexec/rpc.rquotad rpc.rquotad Now restart inetd: &prompt.root; kill -HUP `cat /var/run/inetd.pid` Lucky Green Contributed by
shamrock@cypherpunks.to
Encrypting Disk Partitions disks encrypting FreeBSD offers excellent online protections against unauthorized data access. File permissions and Mandatory Access Control (MAC) (see ) help prevent unauthorized third-parties from accessing data while the operating system is active and the computer is powered up. However, the permissions enforced by the operating system are irrelevant if an attacker has physical access to a computer and can simply move the computer's hard drive to another system to copy and analyze the sensitive data. Regardless of how an attacker may have come into possession of a hard drive or powered-down computer, both GEOM Based Disk Encryption (gbde) and geli cryptographic subsystems in &os; are able to protect the data on the computer's file systems against even highly-motivated attackers with significant resources. Unlike cumbersome encryption methods that encrypt only individual files, gbde and geli transparently encrypt entire file systems. No cleartext ever touches the hard drive's platter. Disk Encryption with <application>gbde</application> Become <username>root</username> Configuring gbde requires super-user privileges. &prompt.user; su - Password: Verify the Operating System Version &man.gbde.4; requires FreeBSD 5.0 or higher. &prompt.root; uname -r 5.0-RELEASE Add &man.gbde.4; Support to the Kernel Configuration File Add the following line to the kernel configuration file: options GEOM_BDE Rebuild the kernel as described in . Reboot into the new kernel. Preparing the Encrypted Hard Drive The following example assumes that you are adding a new hard drive to your system that will hold a single encrypted partition. This partition will be mounted as /private. gbde can also be used to encrypt /home and /var/mail, but this requires more complex instructions which exceed the scope of this introduction. Add the New Hard Drive Install the new drive to the system as explained in . For the purposes of this example, a new hard drive partition has been added as /dev/ad4s1c. The /dev/ad0s1* devices represent existing standard FreeBSD partitions on the example system. &prompt.root; ls /dev/ad* /dev/ad0 /dev/ad0s1b /dev/ad0s1e /dev/ad4s1 /dev/ad0s1 /dev/ad0s1c /dev/ad0s1f /dev/ad4s1c /dev/ad0s1a /dev/ad0s1d /dev/ad4 Create a Directory to Hold gbde Lock Files &prompt.root; mkdir /etc/gbde The gbde lock file contains information that gbde requires to access encrypted partitions. Without access to the lock file, gbde will not be able to decrypt the data contained in the encrypted partition without significant manual intervention which is not supported by the software. Each encrypted partition uses a separate lock file. Initialize the gbde Partition A gbde partition must be initialized before it can be used. This initialization needs to be performed only once: &prompt.root; gbde init /dev/ad4s1c -i -L /etc/gbde/ad4s1c &man.gbde.8; will open your editor, permitting you to set various configuration options in a template. For use with UFS1 or UFS2, set the sector_size to 2048: $FreeBSD: src/sbin/gbde/template.txt,v 1.1 2002/10/20 11:16:13 phk Exp $ # # Sector size is the smallest unit of data which can be read or written. # Making it too small decreases performance and decreases available space. # Making it too large may prevent filesystems from working. 512 is the # minimum and always safe. For UFS, use the fragment size # sector_size = 2048 [...] &man.gbde.8; will ask you twice to type the passphrase that should be used to secure the data. The passphrase must be the same both times. gbde's ability to protect your data depends entirely on the quality of the passphrase that you choose. For tips on how to select a secure passphrase that is easy to remember, see the Diceware Passphrase website. The gbde init command creates a lock file for your gbde partition that in this example is stored as /etc/gbde/ad4s1c. gbde lock files must be backed up together with the contents of any encrypted partitions. While deleting a lock file alone cannot prevent a determined attacker from decrypting a gbde partition, without the lock file, the legitimate owner will be unable to access the data on the encrypted partition without a significant amount of work that is totally unsupported by &man.gbde.8; and its designer. Attach the Encrypted Partition to the Kernel &prompt.root; gbde attach /dev/ad4s1c -l /etc/gbde/ad4s1c You will be asked to provide the passphrase that you selected during the initialization of the encrypted partition. The new encrypted device will show up in /dev as /dev/device_name.bde: &prompt.root; ls /dev/ad* /dev/ad0 /dev/ad0s1b /dev/ad0s1e /dev/ad4s1 /dev/ad0s1 /dev/ad0s1c /dev/ad0s1f /dev/ad4s1c /dev/ad0s1a /dev/ad0s1d /dev/ad4 /dev/ad4s1c.bde Create a File System on the Encrypted Device Once the encrypted device has been attached to the kernel, you can create a file system on the device. To create a file system on the encrypted device, use &man.newfs.8;. Since it is much faster to initialize a new UFS2 file system than it is to initialize the old UFS1 file system, using &man.newfs.8; with the option is recommended. The option is the default with &os; 5.1-RELEASE and later. &prompt.root; newfs -U -O2 /dev/ad4s1c.bde The &man.newfs.8; command must be performed on an attached gbde partition which is identified by a *.bde extension to the device name. Mount the Encrypted Partition Create a mount point for the encrypted file system. &prompt.root; mkdir /private Mount the encrypted file system. &prompt.root; mount /dev/ad4s1c.bde /private Verify That the Encrypted File System is Available The encrypted file system should now be visible to &man.df.1; and be available for use. &prompt.user; df -H Filesystem Size Used Avail Capacity Mounted on /dev/ad0s1a 1037M 72M 883M 8% / /devfs 1.0K 1.0K 0B 100% /dev /dev/ad0s1f 8.1G 55K 7.5G 0% /home /dev/ad0s1e 1037M 1.1M 953M 0% /tmp /dev/ad0s1d 6.1G 1.9G 3.7G 35% /usr /dev/ad4s1c.bde 150G 4.1K 138G 0% /private Mounting Existing Encrypted File Systems After each boot, any encrypted file systems must be re-attached to the kernel, checked for errors, and mounted, before the file systems can be used. The required commands must be executed as user root. Attach the gbde Partition to the Kernel &prompt.root; gbde attach /dev/ad4s1c -l /etc/gbde/ad4s1c You will be asked to provide the passphrase that you selected during initialization of the encrypted gbde partition. Check the File System for Errors Since encrypted file systems cannot yet be listed in /etc/fstab for automatic mounting, the file systems must be checked for errors by running &man.fsck.8; manually before mounting. &prompt.root; fsck -p -t ffs /dev/ad4s1c.bde Mount the Encrypted File System &prompt.root; mount /dev/ad4s1c.bde /private The encrypted file system is now available for use. Automatically Mounting Encrypted Partitions It is possible to create a script to automatically attach, check, and mount an encrypted partition, but for security reasons the script should not contain the &man.gbde.8; password. Instead, it is recommended that such scripts be run manually while providing the password via the console or &man.ssh.1;. As of &os; 5.2-RELEASE, there is a new rc.d script provided. Arguments for this script can be passed via &man.rc.conf.5;, for example: gbde_autoattach_all="YES" gbde_devices="ad4s1c" This will require that the gbde passphrase be entered at boot time. After typing the correct passphrase, the gbde encrypted partition will be mounted automatically. This can be very useful when using gbde on notebooks. Cryptographic Protections Employed by gbde &man.gbde.8; encrypts the sector payload using 128-bit AES in CBC mode. Each sector on the disk is encrypted with a different AES key. For more information on gbde's cryptographic design, including how the sector keys are derived from the user-supplied passphrase, see &man.gbde.4;. Compatibility Issues &man.sysinstall.8; is incompatible with gbde-encrypted devices. All *.bde devices must be detached from the kernel before starting &man.sysinstall.8; or it will crash during its initial probing for devices. To detach the encrypted device used in our example, use the following command: &prompt.root; gbde detach /dev/ad4s1c Also note that, as &man.vinum.4; does not use the &man.geom.4; subsystem, you cannot use gbde with vinum volumes. Daniel Gerzo Contributed by Disk Encryption with <command>geli</command> A new cryptographic GEOM class is available as of &os; 6.0 - geli. It is currently being developed by &a.pjd;. Geli is different to gbde; it offers different features and uses a different scheme for doing cryptographic work. The most important features of &man.geli.8; are: Utilizes the &man.crypto.9; framework — when cryptographic hardware is available, geli will use it automatically. Supports multiple cryptographic algorithms (currently AES, Blowfish, and 3DES). Allows the root partition to be encrypted. The passphrase used to access the encrypted root partition will be requested during the system boot. Allows the use of two independent keys (e.g. a key and a company key). geli is fast - performs simple sector-to-sector encryption. Allows backup and restore of Master Keys. When a user has to destroy his keys, it will be possible to get access to the data again by restoring keys from the backup. Allows to attach a disk with a random, one-time key — useful for swap partitions and temporary file systems. More geli features can be found in the &man.geli.8; manual page. The next steps will describe how to enable support for geli in the &os; kernel and will explain how to create a new geli encryption provider. At the end it will be demonstrated how to create an encrypted swap partition using features provided by geli. In order to use geli, you must be running &os; 6.0-RELEASE or later. Super-user privileges will be required since modifications to the kernel are necessary. Adding <command>geli</command> Support to the Kernel Configuration File Add the following lines to the kernel configuration file: options GEOM_ELI device crypto Rebuild the kernel as described in . Alternatively, the geli module can be loaded at boot time. Add the following line to the /boot/loader.conf: geom_eli_load="YES" &man.geli.8; should now be supported by the kernel. Generating the Master Key The following example will describe how to generate a key file, which will be used as part of the Master Key for the encrypted provider mounted under /private. The key file will provide some random data used to encrypt the Master Key. The Master Key will be protected by a passphrase as well. Provider's sector size will be 4kB big. Furthermore, the discussion will describe how to attach the geli provider, create a file system on it, how to mount it, how to work with it, and finally how to detach it. It is recommended to use a bigger sector size (like 4kB) for better performance. The Master Key will be protected with a passphrase and the data source for key file will be /dev/random. The sector size of /dev/da2.eli, which we call provider, will be 4kB. &prompt.root; dd if=/dev/random of=/root/da2.key bs=64 count=1 &prompt.root; geli init -s 4096 -K /root/da2.key /dev/da2 Enter new passphrase: Reenter new passphrase: It is not mandatory that both a passphrase and a key file are used; either method of securing the Master Key can be used in isolation. If key file is given as -, standard input will be used. This example shows how more than one key file can be used. &prompt.root; cat keyfile1 keyfile2 keyfile3 | geli init -K - /dev/da2 Attaching the Provider with the generated Key &prompt.root; geli attach -k /root/da2.key /dev/da2 Enter passphrase: The new plaintext device will be named /dev/da2.eli. &prompt.root; ls /dev/da2* /dev/da2 /dev/da2.eli Creating the new File System &prompt.root; dd if=/dev/random of=/dev/da2.eli bs=1m &prompt.root; newfs /dev/da2.eli &prompt.root; mount /dev/da2.eli /private The encrypted file system should be visible to &man.df.1; and be available for use now. &prompt.root; df -H Filesystem Size Used Avail Capacity Mounted on /dev/ad0s1a 248M 89M 139M 38% / /devfs 1.0K 1.0K 0B 100% /dev /dev/ad0s1f 7.7G 2.3G 4.9G 32% /usr /dev/ad0s1d 989M 1.5M 909M 0% /tmp /dev/ad0s1e 3.9G 1.3G 2.3G 35% /var /dev/da2.eli 150G 4.1K 138G 0% /private Unmounting and Detaching the Provider Once the work on the encrypted partition is done, and the /private partition is no longer needed, it is prudent to consider unmounting and detaching the geli encrypted partition from the kernel. &prompt.root; umount /private &prompt.root; geli detach da2.eli More information about the use of &man.geli.8; can be found in the manual page. Encrypting a Swap Partition The following example demonstrates how to create a geli encrypted swap partition. &prompt.root; dd if=/dev/random of=/dev/ad0s1b bs=1m &prompt.root; geli onetime -d -a 3des ad0s1b &prompt.root; swapon /dev/ad0s1b.eli Using the <filename>geli</filename> <filename>rc.d</filename> Script geli comes with a rc.d script which can be used to simplify the usage of geli. An example of configuring geli through &man.rc.conf.5; follows: geli_devices="da2" geli_da2_flags="-p -k /root/da2.key" This will configure /dev/da2 as a geli provider of which the Master Key file is located in /root/da2.key, and geli will not use a passphrase when attaching the provider (note that this can only be used if -P was given during the geli init phase). The system will detach the geli provider from the kernel before the system shuts down. More information about configuring rc.d is provided in the rc.d section of the Handbook.
diff --git a/zh_TW.Big5/books/handbook/firewalls/chapter.sgml b/zh_TW.Big5/books/handbook/firewalls/chapter.sgml index df23209f99..eae7b2e7e4 100644 --- a/zh_TW.Big5/books/handbook/firewalls/chapter.sgml +++ b/zh_TW.Big5/books/handbook/firewalls/chapter.sgml @@ -1,3378 +1,3307 @@ Joseph J. Barbish Contributed by Brad Davis Converted to SGML and updated by - Firewalls + ¨¾¤õÀð - firewall + ¨¾¤õÀð - security + ¦w¥þ - firewalls + ¨¾¤õÀð - Introduction - - Firewalls make it possible to filter - incoming and outgoing traffic that flows through your system. - A firewall can use one or more sets of rules to - inspect the network packets as they come in or go out of your - network connections and either allows the traffic through or - blocks it. The rules of a firewall can inspect one or more - characteristics of the packets, including but not limited to the - protocol type, the source or destination host address, and the - source or destination port. - - Firewalls can greatly enhance the security of a host or a - network. They can be used to do one or more of - the following things: - + ¤¶²Ð + + ¨¾¤õÀð¯à°÷¹LÂo§Aªº¨t²Î¤¤¶i¥Xªº¬y¶q¡C + ¨¾¤õÀð¤]¯àÂǥѳ]¸m¤@©Î¦h²Õ¡u³W«h (rules)¡v + ¨ÓÀˬd§Aªººô¸ô³sµ²¤¤¶i¥Xªººô¸ô«Ê¥] (network packets)¡A + ¨Ã¥B¯à¤¹³\©Îªý¾×¨ä³q¹L¡C + ³o¨Ç¨¾¤õÀ𪺳W«h¥i¥HÀˬd«Ê¥]¤¤ªº¯S¼x¡A + ³o¨Ç¯S¼x²[»\¡A¦ý¤£­­©ó¬Y¨Ç³q°T¨ó©wÃþ«¬¡B¥D¾÷¦ì§}ªº¨Ó·½©Î¥Øªº¡A + ¥H¤Î³s±µ°ð (port) ªº¨Ó·½¤Î¥Øªº¡C + + ¨¾¤õÀð¯à°÷¤j´T¦a¼W±j¥D¾÷©Î¬Oºô¸ôªº¦w¥þ©Ê¡C + ¥¦¤]¯à°÷¥Î¨Ó°õ¦æ¤U¦C¨Æ¶µ¡G + - To protect and insulate the applications, services and - machines of your internal network from unwanted traffic - coming in from the public Internet. + «OÅ@©Î¹jÂ÷§A¤º³¡ºô¸ôªºÀ³¥Îµ{¦¡¡B + ªA°È¥H¤Î¾÷¾¹¡A§K©ó³Q¨Ó¦Û Internet ¤¤§A¤£·Q­nªº¶Ç¿é©Ò¼vÅT + - To limit or disable access from hosts of the internal - network to services of the public Internet. + ­­¨î©Î¸T¤î¤º³¡ºô¸ô¹ï Internet ªº¦s¨úªA°È - To support network address translation - (NAT), which allows your internal network - to use private IP addresses and share a - single connection to the public Internet (either with a - single IP address or by a shared pool of - automatically assigned public addresses). + ¤ä´©¡uºô¸ô¦ì§}Âà´«¡v(network address translation + , NAT)¡A + ¥¦¥i¥H¤¹³\§Aªº¤º³¡ºô¸ô¨Ï¥Î¨p¦³IP + ¦ì§}¨Ã¥i¥H¦@¦P¤À¨É¤@­Ó³æ¤@³s½u¨ìºô»Úºô¸ô¤W + (¥i¦P®É¥Î³æ¤@IP¦ì§}©Î¬O¤@²Õ¤½¦@ºô§}) + - After reading this chapter, you will know: + Ū§¹³o³¹¤§«á¡A§A±N·|ª¾¹D¡G - How to properly define packet filtering rules. + ¦p¦ó¾A·í¦a­q¥X«Ê¥]¹LÂoªº³W«h¡C - The differences between the firewalls - built into &os;. + &os; ¤¤¤º«Øªº¨¾¤õÀ𤧶¡ªº®t²§¡C - How to use and configure the OpenBSD - PF firewall. + ¦p¦ó¨Ï¥Î¤Î³]©w OpenBSD ªº + PF ¨¾¤õÀð¡C - How to use and configure - IPFILTER. + ¦p¦ó¨Ï¥Î¤Î³]©w + IPFILTER¡C - How to use and configure - IPFW. + ¦p¦ó¨Ï¥Î¤Î³]©w + IPFW¡C - Before reading this chapter, you should: + ¦b¾\Ū³o³¹¤§«e¡A§A¥²¶·¡G - Understand basic &os; and Internet concepts. + ¤F¸Ñ°ò¥»ªº &os; ©M Internet Æ[©À - Firewall Concepts + ¨¾¤õÀ𷧩À - firewall + ¨¾¤õÀð - rulesets + ³W«h - There are two basic ways to create firewall rulesets: - inclusive or exclusive. An - exclusive firewall allows all traffic through except for the - traffic matching the ruleset. An inclusive firewall does the - reverse. It only allows traffic matching the rules through and - blocks everything else. - - Inclusive firewalls are generally safer than exclusive - firewalls because they significantly reduce the risk of allowing - unwanted traffic to pass through the firewall. - - Security can be tightened further using a stateful - firewall. With a stateful firewall the firewall keeps - track of which connections are opened through the firewall and - will only allow traffic through which either matches an existing - connection or opens a new one. The disadvantage of a stateful - firewall is that it can be vulnerable to Denial of Service - (DoS) attacks if a lot of new connections are - opened very fast. With most firewalls it is possible to use a - combination of stateful and non-stateful behavior to make an - optimal firewall for the site. + + ¦³¨âºØ°ò¥»ªº¤è¦¡¥i¥H«Ø¥ß¨¾¤õÀð³W«h¡G + ¡u¥ý®e¦¡(exclusive)¡v©Î¬O¡u«á®e¦¡(inclusive)¡v¡C + + ¡u¥ý®e¦¡(exclusive)¡vÃþ¦ü¡u¶Â¦W³æ¡v¡A¥¦¥ý¤¹³\©Ò¦³«Ê¥]³q¹L¡A + µM«á¹H¤Ï³W«hªº«Ê¥]«h¸T¤î³q¹L¨¾¤õÀð¡C + ¬Û¤Ïªº¡A¡u«á®e¦¡(inclusive)¡vÃþ¦ü¡u¥Õ¦W³æ¡v¡A¥¦¥ý¾×¦í©Ò¦³«Ê¥]³q¹L¡A + µM«á¥u¤¹³\¦³²Å¦X³W«hªº¤~¥i³q¹L¨¾¤õÀð¡C + + + ¾ãÅé¨Ó»¡¡A¡u«á®e¦¡(inclusive)¡vªº¨¾¤õÀð·|¤ñ¡u¥ý®e¦¡(exclusive)¡vªº¨¾¤õÀð¦w¥þ¨Ç¡C + ¦]¬°«á®e¦¡©úÅã­°§C¤F¤£¥²­nªº­·ÀI¡C + + ¦¹¥~¡A¨Ï¥Î¡uª¬ºA¨¾¤õÀð(stateful firewall)¡v¥iÅý¦w¥þ©Ê§óÄY±K¡C + ¥¦·|«ùÄò°O¿ý³q¹L¨¾¤õÀð¶}©ñªº³s½u¡A + ¨Ã¥B¥u¤¹³\²Å¦X²{¦s©Î¶}±Ò·sªº³s½u¤~¯à³q¹L¨¾¤õÀð¡C + ª¬ºA¨¾¤õÀ𪺯ÊÂI¬O¦pªG¦b«D±`§Öªº³t«×¤U¶}±Ò³\¦h·s³s½u¡A´N¥i¯à·|¨ü¨ìªýµ´¦¡ªA°È§ðÀ» + (DoS, Denial of Service)¡C + ¦b¤j¦h¼Æªº¨¾¤õÀð¤è®×¤¤¡A¤]¥i¥H¥æ¤¬¹B¥Î¡uª¬ºA¡v¤Î¡u«Dª¬ºA¡v¨¾¤õÀ𪺲զX¡A + ¨Ï¸Ó¯¸ªº¨¾¤õÀð¹F¨ì³Ì¨Î¤Æ¡C + + - Firewall Packages - - &os; has three different firewall packages built - into the base system. They are: IPFILTER - (also known as IPF), - IPFIREWALL (also known as IPFW), - and OpenBSD's PacketFilter (also known as - PF). &os; also has two built in packages for - traffic shaping (basically controlling bandwidth usage): - &man.altq.4; and &man.dummynet.4;. Dummynet has traditionally been - closely tied with IPFW, and - ALTQ with - IPF/PF. IPF, - IPFW, and PF all use rules to control the access of packets to and - from your system, although they go about it different ways and - have different rule syntaxes. - - The reason that &os; has multiple built in firewall packages - is that different people have different requirements and - preferences. No single firewall package is the best. - - The author prefers IPFILTER because its stateful rules are - much less complicated to use in a NAT - environment and it has a built in ftp proxy that simplifies the - rules to allow secure outbound FTP usage. - - Since all firewalls are based on inspecting the values of - selected packet control fields, the creator of the firewall - rulesets must have an understanding of how - TCP/IP works, what the different values in - the packet control fields are and how these values are used in a - normal session conversation. For a good explanation go to: + ¨¾¤õÀð³nÅé®M¥ó + + + ¦b &os; °ò¥»¨t²Î¤¤¤º«Ø¦³¤TºØ¤£¦Pªº¨¾¤õÀð³nÅé®M¥ó¡C + ¥¦­Ì¤À§O¬O IPFILTER + (¤]´N¬O IPF)¡B + IPFIREWALL (¤]´N¬O IPFW)¡A + ¥H¤Î OpenBSD ªº PacketFilter (§Y¦³¦Wªº PF)¡C + &os; ¤]¦³¨â­Ó¤º«Øªº¬y¶q±±ºÞ®M¥ó(°ò¥»¤W¬O±±¨îÀW¼eªº¨Ï¥Î)¡G + &man.altq.4; ¥H¤Î &man.dummynet.4;¡C + ³q±`§Ú­Ì²ßºD§â Dummynet »P IPFW ¤@¨Ö¹B¥Î¡A + ¦Ó ALTQ «h¬O·f°t + IPF/PF ¤@¦P¨Ï¥Î¡C + ÁöµM IPF¡BIPFW ¥H¤Î PF ¬O¨Ï¥Î¤£¦Pªº¹ê°µ¤è¦¡¤Î³W«h»yªk¡A + ¦ý¬O¥¦­Ì³£¨Ï¥Î³W«h¨Ó±±¨î¬O§_¤¹³\¸ê®Æ«Ê¥]¶i¥X§Aªº¨t²Î¡C + + &os; ¬°¦ó·|¤º«Ø³\¦h¤£¦Pªº¨¾¤õÀð³nÅé®M¥ó¡A + ³o¬O¦]¬°¤£¦P¤H·|¦³¤£¦Pªº»Ý¨D¡B°¾¦n¡A«ÜÃø»¡­þ¤@­Ó¨¾¤õÀð³nÅé®M¥ó¬O³Ì¦nªº¡C + + ¦Óµ§ªÌ°¾¦n IPFILTER ªº­ì¦]¡A¬O¦]¬°¹B¥Î¦b NAT + Àô¹Òªº®É­Ô¡A¥¦ªºª¬ºA³W«h¬O¬Û¹ï²³æ³\¦hªº¡C + ¦Ó¥B¥¦¤º«Øªº FTP ¥N²z¡A¤]²¤Æ¤F¦p¦ó³]©w¦w¥þªº¹ï¥~ FTP ªA°È³W«h¡C + + + ¥¿¥Ñ©ó©Ò¦³ªº¨¾¤õÀ𳣬O¥H¡uÀˬd¡B±±¨î©Ò¿ï©w¤§«Ê¥]¡vªº¹ê§@¡A©Ò¥H¡A + ¨î©w¨¾¤õÀð³W«hªº¤H´N§ó¥²¶·¤F¸Ñ TCP/IP ¦p¦ó¹B§@¡A + ¥H¤Î¦p¦ó±±¨î«Ê¥]¦b¥¿±` session ªº¦UºØ§@¥Î¡C + §ó¸ÔºÉªº»¡©ú¡A½Ð°Ñ¾\¡G . + url="http://www.ipprimer.com/overview.cfm">¡C + - The OpenBSD Packet Filter (PF) and + <title>OpenBSD «Ê¥]¹LÂo¾¹ (Packet Filter, PF)¤Î <acronym>ALTQ</acronym> - firewall + ¨¾¤õÀð PF - As of July 2003 the OpenBSD firewall software application - known as PF was ported to &os; and was made - available in the &os; Ports Collection; the first release that - contained PF as an integrated part of the - base system was &os; 5.3 in November 2004. - PF is a complete, fully featured firewall - that has optional support for ALTQ (Alternate - Queuing). ALTQ provides Quality of Service - (QoS) bandwidth shaping that allows - guaranteeing bandwidth to different services based on filtering - rules. The OpenBSD Project does an outstanding job of - maintaining the PF User's Guide that it will not be made part of - this handbook firewall section as that would just be duplicated - effort. - - The availability of PF for the various &os; releases and - versions is summarized below: - - - - - - &os; Version - - PF Availability - - - - - - Pre-4.X versions - - PF is not available for any release of &os; older - than the 4.X branch. - - - - All versions of the 4.X branch - - PF is available as part of KAME. - - - - 5.X releases before 5.3-RELEASE - - The security/pf - port can be used to install PF on these versions of &os;. - These releases were targeted to developers and people who - wanted a preview of early 5.X versions. Upgrading to - 5.3-RELEASE or newer versions of &os; is strongly - recommended. - - - - 5.3-RELEASE and later versions - - PF is part of the base system. Do - not use the security/pf port on these - versions of &os;. It will not work. Use the &man.pf.4; - support of the base system instead. - - - - - - More info can be found at the PF for &os; web site: ¦b 2003 ¦~ 6 ¤ë¥÷¡AOpenBSD ªº¨¾¤õÀð³nÅé PF + ³Q²¾´Ó¨ì &os; ¤¤¡A¨Ã¥B¦¬¿ý©ó Ports Collection ¤º¡C + ¦Ó 2004 ¦~ 11 ¤ë¥÷©Òµo¦æªº &os; 5.3 ª©¤]¬O²Ä¤@¦¸±N PF + ¾ã¦X¬°°ò¦¨t²Îªº¤@³¡¤À¡C + PF¬O­Ó§¹³Æ¡B¥þ¥\¯àªº¨¾¤õÀð¡A + ¨Ã¥B¨ã¦³¿ï¾Ü©Ê ALTQ(¥æ¿ù¦î¦C¡AAlternate Queuing) + + ªº¥\¯à¡C + ALTQ´£¨Ñ¤F¡uªA°È«~½è¡v(QoS¡A + Quality of Service)ªºÀW¼eºÞ²z¥\¯à¡A + ³o´£¨Ñ¤F¥H¹LÂo³W«hªº¤è¦¡¨Ó«O»Ù¦UºØ¤£¦PªA°ÈªºÀW¼e¡C + OpenBSD ­p¹º¤¤¤w¸g¹ï PF ªº¨Ï¥Î«ü«n´£¨Ñ¤F¸ÔºÉªº¸Ñ»¡¡A + ¦]¦¹¦b³o¥»¤â¥U¤¤§Ú­Ì¤£·|§@­«½ÆªºÂØ­z¡A¦Ó¥u¤¶²Ð·§­n¡C + + + §ó¦hÃö©ó PF ªº¸ê°T¥i©ó¤U¦Cºô§}¬d¸ß: . - Enabling PF + ±Ò¥Î PF - PF is included in the basic &os; install for versions newer - than 5.3 as a separate run time loadable module. The system - will dynamically load the PF kernel loadable module when the - rc.conf statement pf_enable="YES" is used. - The loadable module was created with &man.pflog.4; logging - enabled. + PF ¦b &os; 5.3 ¤§«áªº¨t²Î¤¤¡A¥i¥H»´ÃP¨Ï¥Î°ÊºA¼Ò²Õ¨Ó¸ü¤J¡C + ¦b rc.conf ¤¤¥[¤J pf_enable="YES" «á¡A + ¨t²Î±N·|°ÊºA¦a¸ü¤J PF ®Ö¤ß°ÊºA¼Ò²Õ¡C³o­Ó¼Ò²Õ·|¦b«Ø¥ß®É¤]±Ò¥Î + &man.pflog.4; °O¿ý¥\¯à¡C - The module assumes the presence of options - INET and device bpf. Unless - NOINET6 (for example in &man.make.conf.5;) - was defined during the build, it also requires options - INET6. + ³o­Ó¼Ò²Õ·|°²³]®Ö¤ß¤º¤w¦³ options INET ©M + device bpf¡C + °£«D½sĶ®É¦b®Ö¤ß¤¤¦³¨Æ¥ý(¹³¬O¦b &man.make.conf.5; ¤¤)¥[¤J NOINET6¡A + &os; 6.0 ¥H«áªºª©¥»«h¬O NO_INET6 + ³o¼Ë¤~·|ÁקK¤£¥´¶} IPv6 ¤ä´©¡A§_«h pf ¼Ò²Õ¦P®É¤]»Ý­n options INET6¡A + ¤]´N¬O IPv6 ¤ä´©¡C + + ¤@¥¹¸ü¤J PF ®Ö¤ß¼Ò²Õ©ÎÀRºA¦a½sĶ¤J®Ö¤ß¤¤¡A + ´N¥i¥H¨Ï¥Î pfctl ¨Ó±Ò°Ê©ÎÃö³¬ + pf¡C - Once the kernel module is loaded or the kernel is statically - built with PF support, it is possible to enable or disable - pf with the pfctl - command. - - This example demonstrates how to enable + ³o­Ó¨Ò¤l¥Ü½d¤F¦p¦ó±Ò°Ê pf: &prompt.root; pfctl -e - The pfctl command provides a way to work - with the pf firewall. It is a good - idea to check the &man.pfctl.8; manual page to find out more - information about using it. + pfctl«ü¥O´£¨Ñ¤F¤@­Ó¨Ï¥Îpf + ¨¾¤õÀ𪺤覡¡C + ­n¤F¸Ñ§ó¦h¨Ï¥Î pfctl ªº¸ê°T¡A + ¬d¾\ &man.pfctl.8; ªº½u¤W¤â¥U·|¬O­Ó¦n¤è¦¡¡C - Kernel options + kernel ¿ï¶µ - kernel options + kernel ¿ï¶µ device pf - kernel options + kernel ¿ï¶µ device pflog - kernel options + kernel ¿ï¶µ device pfsync - It is not a mandatory requirement that you enable PF by - compiling the following options into the &os; kernel. It is - only presented here as background information. Compiling PF - into the kernel causes the loadable module to never be - used. - - Sample kernel config PF option statements are in the - /usr/src/sys/conf/NOTES kernel source and - are reproduced here: - + ¦b½sĶ &os; kernel ®É¡A¨Ã¤£¥²§¹¥þ¥[¤J¤U¦Cªº¿ï¶µ¨Ó±Ò¥Î PF¡C + ¦b³o¸Ì¥u¬O­n¦C¥Xµ¹§A°Ñ¦Òªº¤@¨Ç¸ê°T¦Ó¤w¡C + ±N PF ½sĶ¤J kernel ¤¤¡A·|¾É­PµLªk¨Ï¥Î kernel ªº°ÊºA¸ü¤J¼Ò²Õ¡C + + ³]©w PF ªº®Ö¤ß¿ï¶µ½d¨Ò¦b kernel ­ì©l½X¤¤ªº + /usr/src/sys/conf/NOTES¡AÂà¶K¤º®e¦p¤U¡G + device pf device pflog device pfsync - device pf enables support for the - Packet Filter firewall. - - device pflog enables the optional - &man.pflog.4; pseudo network device which can be used to log - traffic to a &man.bpf.4; descriptor. The &man.pflogd.8; daemon - can be used to store the logging information to disk. - - device pfsync enables the optional - &man.pfsync.4; pseudo network device that is used to monitor - state changes. As this is not part of the - loadable module one has to build a custom kernel to use - it. - - These settings will take effect only after you have built - and installed a kernel with them set. + device pf ±Ò¥Î¤F + ¡u«Ê¥]¹LÂo(packet filter)¡v ªº¨¾¤õÀð¤ä´©. + + device pflog ±Ò°Ê¤F¿ï¾Ü©Êªº &man.pflog.4; + µêÀÀºô¸ô³]³Æ pseudo network device)¡A¥¦¥i¥H³z¹L &man.bpf.4; + ªº´y­z²Å¸¹¨Ó°O¿ý¬y¶q¡C + &man.pflogd.8; ªA°È¥i¥H¥Î¨ÓÀx¦s°T®§¡A¨Ã¥i¥H¥Î¤é»xªº§Î¦¡°O¿ý¦bµwºÐ¤W¡C + + + device pfsync ±Ò°Ê¤F¿ï¾Ü©Ê ªº&man.pfsync.4; + µêÀÀºô¸ô³]³Æ¡A¥¦¥i¥H¥Î¨ÓºÊ±±¡uª¬ºAªº§ïÅÜ¡v¡C + device pfsync¨Ã¤£¬O¥i¸ü¤J¼Ò²Õ¡A + ­n¨Ï¥Îªº¸Ü¡A¥²¶·­n½s¤J¦Û­qªº®Ö¤ß¤¤¤~¦æ¡C + + ³o¨Ç³]©w±N·|¦b§A½sĶ¤Î¦w¸Ë¦n·s®Ö¤ß«á¤~·|¥Í®Ä¡C - Available rc.conf Options + rc.conf ¥i¥Îªº¿ï¶µ - You need the following statements in - /etc/rc.conf to activate PF at boot - time: + §A»Ý­n¦b /etc/rc.conf + ¤¤¥[¤J¤U¦Cªº³]©w¥H«K¦b±Ò°Ê¨t²Î®É¦P®É±Ò¥Î PF¡G - pf_enable="YES" # Enable PF (load module if required) -pf_rules="/etc/pf.conf" # rules definition file for pf -pf_flags="" # additional flags for pfctl startup -pflog_enable="YES" # start pflogd(8) -pflog_logfile="/var/log/pflog" # where pflogd should store the logfile -pflog_flags="" # additional flags for pflogd startup + pf_enable="YES" # ±Ò¥Î PF (¦pªG»Ý­nªº¸Ü¸ü¤J¼Ò²Õ) +pf_rules="/etc/pf.conf" # PF ªº³W«h©w¸qÀÉ®× +pf_flags="" # pfctl ±Ò°Ê®Éªþ¥[ªº¿ï¶µ +pflog_enable="YES" # ±Ò°Ê pflogd(8) +pflog_logfile="/var/log/pflog" # pflogd Àx¦s°O¿ýÀɮתº¦a¤è +pflog_flags="" # pflogd ±Ò°Ê®Éªþ¥[ªº¿ï¶µ - If you have a LAN behind this firewall and have to forward - packets for the computers in the LAN or want to do NAT, you - have to enable the following option as well: + ¦pªG¦b³o­Ó¨¾¤õÀð«á¤è§A¦³­Ó°Ï°ìºô¸ô¡A¨Ã³z¹L¥¦¨ÓÂà°e«Ê¥]¡A + §A´N¥²¶·­n³]©w¤U¦C¿ï¶µ¡G - gateway_enable="YES" # Enable as LAN gateway + gateway_enable="YES" # ±Ò¥Î§@¬°°Ï°ìºô¸ô¹h¹D¾¹ - Enabling <acronym>ALTQ</acronym> - - ALTQ is only available by compiling the - options into the &os; Kernel. ALTQ is not - supported by all of the available network card drivers. Please - see the &man.altq.4; manual page for a list of drivers that are - supported in your release of &os;. The following options will - enable ALTQ and add additional - functionality. + ±Ò¥Î <acronym>ALTQ</acronym> + + ALTQªº¿ï¶µ¥u¦³¦b½s¤J &os; ®Ö¤ß¤¤¤~¯à¥Í®Ä¡C + ¤£¬O©Ò¦³ªººô¸ô¥dÅX°Êµ{¦¡³£¤ä´© ALTQ¡C + ½Ð¬Ý &man.altq.4; ½u¤W¤â¥U¨Ó¤F¸Ñ§A¨Ï¥Îªº &os; ª©¥»¤¤¤ä´©ÅX°Êµ{¦¡ªº²M³æ¡C + ¤U­±¦C¥Xªº¿ï¶µ±N·|±Ò¥Î ALTQ ¤Î¥[¤J¨ä¥Lªþ¥[ªº¥\¯à¡C options ALTQ options ALTQ_CBQ # Class Bases Queuing (CBQ) options ALTQ_RED # Random Early Detection (RED) options ALTQ_RIO # RED In/Out options ALTQ_HFSC # Hierarchical Packet Scheduler (HFSC) options ALTQ_PRIQ # Priority Queuing (PRIQ) options ALTQ_NOPCC # Required for SMP build - options ALTQ enables the - ALTQ framework. + options ALTQ ±Ò¥Î¤F + ALTQ ¥D¬[ºc¡C - options ALTQ_CBQ enables Class Based - Queuing (CBQ). CBQ + options ALTQ_CBQ ±Ò¥Î¡u°ò©ó¤ÀÃþªº¦î¦C¡v + (Class Based Queuing, CBQ)¤ä´©¡C + CBQ ¤¹³\§A allows you to divide a connection's bandwidth into different classes or queues to prioritize traffic based on filter rules. options ALTQ_RED enables Random Early Detection (RED). RED is used to avoid network congestion. RED does this by measuring the length of the queue and comparing it to the minimum and maximum thresholds for the queue. If the queue is over the maximum all new packets will be dropped. True to its name, RED drops packets from different connections randomly. options ALTQ_RIO enables Random Early Detection In and Out. options ALTQ_HFSC enables the Hierarchical Fair Service Curve Packet Scheduler. For more information about HFSC see: . options ALTQ_PRIQ enables Priority Queuing (PRIQ). PRIQ will always pass traffic that is in a higher queue first. options ALTQ_NOPCC enables SMP support for ALTQ. This option is required on SMP systems. Creating Filtering Rules The Packet Filter reads its configuration rules from the &man.pf.conf.5; file and it modifies, drops or passes packets according to the rules or definitions specified there. The &os; installation comes with a default /etc/pf.conf which contains useful examples and explanations. Although &os; has its own /etc/pf.conf the syntax is the same as one used in OpenBSD. A great resource for configuring the pf firewall has been written by OpenBSD team and is available at . When browsing the pf user's guide, please keep in mind that different versions of &os; contain different versions of pf. The pf firewall in &os; 5.X is at the level of OpenBSD version 3.5 and in &os; 6.X is at the level of OpenBSD version 3.7. The &a.pf; is a good place to ask questions about configuring and running the pf firewall. Do not forget to check the mailing list archives before asking questions. - The IPFILTER (IPF) Firewall + IPFILTER (IPF) ¨¾¤õÀð - firewall + ¨¾¤õÀð IPFILTER - This section is work in progress. The contents might - not be accurate at all times. + ¦¹¤p¸`ªº»¡©ú¤´«Ý³°Äò¸É¥R¡B§ó·s¡A©Ò¥H¥»¤º®e¥i¯à¨Ã«D§¹¥þ²Å¦X²{ªp¡C - The author of IPFILTER is Darren Reed. IPFILTER is not - operating system dependent: it is an open source application and - has been ported to &os;, NetBSD, OpenBSD, &sunos;, HP/UX, and - &solaris; operating systems. IPFILTER is actively being - supported and maintained, with updated versions being released - regularly. + IPFILTER ªº§@ªÌ¬° Darren Reed¡CIPFILTER ¨Ã«D + operating system dependent¡G¥¦¬O­Ó open source À³¥Îµ{¦¡¡A¥B¤w³Q²¾´Ó¨ì + &os;¡BNetBSD¡BOpenBSD¡B&sunos;¡BHP/UX ¥H¤Î + &solaris; ³o¨Ç§@·~¨t²Î¤W¡C¦¹¥~¡AIPFILTER ªº¤ä´©¥H¤ÎºûÅ@¤]¬Û·í¿n·¥¡A¤]¦³©w´ÁÄÀ¥Xªº§ó·sª©¡C IPFILTER is based on a kernel-side firewall and NAT mechanism that can be controlled and monitored by userland interface programs. The firewall rules can be set or deleted with the &man.ipf.8; utility. The NAT rules can be set or deleted with the &man.ipnat.1; utility. The &man.ipfstat.8; utility can print run-time statistics for the kernel parts of IPFILTER. The &man.ipmon.8; program can log IPFILTER actions to the system log files. IPF was originally written using a rule processing logic of - the last matching rule wins and used only + ¡uthe last matching rule wins¡v and used only stateless type of rules. Over time IPF has been enhanced to - include a quick option and a stateful keep - state option which drastically modernized the rules + include a ¡uquick¡v option and a stateful ¡ukeep + state¡v option which drastically modernized the rules processing logic. IPF's official documentation covers the legacy rule coding parameters and the legacy rule file processing logic. The modernized functions are only included as additional options, completely understating their benefits in producing a far superior secure firewall. The instructions contained in this section are based on - using rules that contain the quick option and the - stateful keep state option. This is the basic + using rules that contain the ¡uquick¡v option and the + stateful ¡ukeep state¡v option. This is the basic framework for coding an inclusive firewall rule set. An inclusive firewall only allows packets matching the rules to pass through. This way you can control what services can originate behind the firewall destined for the public Internet and also control the services which can originate from the public Internet accessing your private network. Everything else is blocked and logged by default design. Inclusive firewalls are much, much more secure than exclusive firewall rule sets and is the only rule set type covered herein. For detailed explanation of the legacy rules processing method see: and . - The IPF FAQ is at IPF ªº FAQ ¦ì©ó . - Enabling IPF + ±Ò¥Î IPF IPFILTER - enabling + ±Ò¥Î IPF is included in the basic &os; install as a separate run time loadable module. The system will dynamically load the IPF kernel loadable module when the rc.conf statement ipfilter_enable="YES" is used. The loadable module was created with logging enabled and the default pass all options. You do not need to compile IPF into the &os; kernel just to change the default to block all, you can do that by just coding a block all rule at the end of your rule set. - Kernel options + kernel ¿ï¶µ kernel options IPFILTER kernel options IPFILTER_LOG kernel options IPFILTER_DEFAULT_BLOCK IPFILTER kernel options - It is not a mandatory requirement that you enable IPF by - compiling the following options into the &os; kernel. It is - only presented here as background information. Compiling IPF - into the kernel causes the loadable module to never be - used. + ¦b½sĶ &os; kernel ®É¡A¨Ã¤£¥²§¹¥þ¥[¤J¤U¦Cªº¿ï¶µ¨Ó±Ò¥Î IPF¡C + ¦b³o¸Ì¥u¬O­n¦C¥Xµ¹§A°Ñ¦Òªº¤@¨Ç¸ê°T¦Ó¤w¡C + ±N IPF ½sĶ¤J kernel ¤¤¡A·|¾É­PµLªk¨Ï¥Î kernel ªº°ÊºA¸ü¤J¼Ò²Õ¡C Sample kernel config IPF option statements are in the /usr/src/sys/conf/NOTES kernel source (/usr/src/sys/arch/conf/LINT for &os; 4.X) and are reproduced here: options IPFILTER options IPFILTER_LOG options IPFILTER_DEFAULT_BLOCK options IPFILTER enables support for the - IPFILTER firewall. + ¡uIPFILTER¡v firewall. options IPFILTER_LOG enables the option to have IPF log traffic by writing to the ipl packet logging pseudo—device for every rule that has the log keyword. options IPFILTER_DEFAULT_BLOCK changes the default behavior so any packet not matching a firewall pass rule gets blocked. These settings will take effect only after you have built and installed a kernel with them set. - Available rc.conf Options + ¥i¥Îªº rc.conf ¿ï¶µ - You need the following statements in - /etc/rc.conf to activate IPF at boot - time: + ¶·¦b /etc/rc.conf ¤º¥[¤J¤U¦C¤º®e¡A¥H«K¦b¶}¾÷®É´N·|±Ò¥Î IPF¡G ipfilter_enable="YES" # Start ipf firewall -ipfilter_rules="/etc/ipf.rules" # loads rules definition text file -ipmon_enable="YES" # Start IP monitor log -ipmon_flags="-Ds" # D = start as daemon - # s = log to syslog - # v = log tcp window, ack, seq - # n = map IP & port to names +ipfilter_rules="/etc/ipf.rules" # ¸ü¤J©w¸q³W«hªº¤å¦rÀÉ®× +ipmon_enable="YES" # ±Ò¥Î IP ºÊ±±°O¿ý +ipmon_flags="-Ds" # D = ¨Ï¥ÎªA°Èµ{§Ç (daemon) ±Ò°Ê + # s = ¨Ï¥Î syslog °O¿ý + # v = °O¿ý©ó tcp window, ack, seq + # n = ±N IP ¤Î port ¹ïÀ³¦Ü¦WºÙ¤¤ If you have a LAN behind this firewall that uses the reserved private IP address ranges, then you need to add the following to enable NAT functionality: - gateway_enable="YES" # Enable as LAN gateway + gateway_enable="YES" # ±Ò¥Î¬°°Ï°ìºô¸ô¹h¹D¾¹ ipnat_enable="YES" # Start ipnat function ipnat_rules="/etc/ipnat.rules" # rules definition file for ipnat IPF ipf The ipf command is used to load your rules file. Normally you create a file containing your custom rules and use this command to replace in mass the currently running firewall internal rules: &prompt.root; ipf -Fa -f /etc/ipf.rules means flush all internal rules tables. means this is the file to read for the rules to load. This gives you the ability to make changes to your custom rules file, run the above IPF command, and thus update the running firewall with a fresh copy of all the rules without having to reboot the system. This method is very convenient for testing new rules as the procedure can be executed as many times as needed. See the &man.ipf.8; manual page for details on the other flags available with this command. The &man.ipf.8; command expects the rules file to be a standard text file. It will not accept a rules file written as a script with symbolic substitution. There is a way to build IPF rules that utilizes the power of script symbolic substitution. For more information, see . IPFSTAT ipfstat IPFILTER statistics The default behavior of &man.ipfstat.8; is to retrieve and display the totals of the accumulated statistics gathered as a result of applying the user coded rules against packets going in and out of the firewall since it was last started, or since the last time the accumulators were reset to zero by the ipf -Z command. See the &man.ipfstat.8; manual page for details. The default &man.ipfstat.8; command output will look something like this: input packets: blocked 99286 passed 1255609 nomatch 14686 counted 0 output packets: blocked 4200 passed 1284345 nomatch 14687 counted 0 input packets logged: blocked 99286 passed 0 output packets logged: blocked 0 passed 0 packets logged: input 0 output 0 log failures: input 3898 output 0 fragment state(in): kept 0 lost 0 fragment state(out): kept 0 lost 0 packet state(in): kept 169364 lost 0 packet state(out): kept 431395 lost 0 ICMP replies: 0 TCP RSTs sent: 0 Result cache hits(in): 1215208 (out): 1098963 IN Pullups succeeded: 2 failed: 0 OUT Pullups succeeded: 0 failed: 0 Fastroute successes: 0 failures: 0 TCP cksum fails(in): 0 (out): 0 Packet log flags set: (0) When supplied with either for inbound or for outbound, it will retrieve and display the appropriate list of filter rules currently installed and in use by the kernel. ipfstat -in displays the inbound internal rules table with rule number. ipfstat -on displays the outbound internal rules table with the rule number. The output will look something like this: @1 pass out on xl0 from any to any @2 block out on dc0 from any to any @3 pass out quick on dc0 proto tcp/udp from any to any keep state ipfstat -ih displays the inbound internal rules table, prefixing each rule with a count of how many times the rule was matched. ipfstat -oh displays the outbound internal rules table, prefixing each rule with a count of how many times the rule was matched. The output will look something like this: 2451423 pass out on xl0 from any to any 354727 block out on dc0 from any to any 430918 pass out quick on dc0 proto tcp/udp from any to any keep state One of the most important functions of the ipfstat command is the flag which displays the state table in a way similar to the way &man.top.1; shows the &os; running process table. When your firewall is under attack this function gives you the ability to identify, drill down to, and see the attacking packets. The optional sub-flags give the ability to select the destination or source IP, port, or protocol that you want to monitor in real time. See the &man.ipfstat.8; manual page for details. IPMON ipmon IPFILTER logging In order for ipmon to work properly, the kernel option IPFILTER_LOG must be turned on. This command has two different modes that it can be used in. Native mode is the default mode when you type the command on the command line without the flag. Daemon mode is for when you want to have a continuous system log file available so that you can review logging of past events. This is how &os; and IPFILTER are configured to work together. &os; has a built in facility to automatically rotate system logs. That is why outputting the log information to syslogd is better than the default of outputting to a regular file. In the default rc.conf file you see the ipmon_flags statement uses the flags: ipmon_flags="-Ds" # D = start as daemon # s = log to syslog # v = log tcp window, ack, seq # n = map IP & port to names The benefits of logging are obvious. It provides the ability to review, after the fact, information such as which packets had been dropped, what addresses they came from and where they were going. These all give you a significant edge in tracking down attackers. Even with the logging facility enabled, IPF will not generate any rule logging on its own. The firewall administrator decides what rules in the rule set he wants to log and adds the log keyword to those rules. Normally only deny rules are logged. It is very customary to include a default deny everything rule with the log keyword included as your last rule in the rule set. This way you get to see all the packets that did not match any of the rules in the rule set. IPMON Logging Syslogd uses its own special method for segregation of log data. It uses special groupings - called facility and level. IPMON + called ¡ufacility¡v and level. IPMON in mode uses security - (local0 in 4.X) as the facility + (local0 in 4.X) as the ¡ufacility¡v name. All IPMON logged data goes to security (local0 in 4.X). The following levels can be used to further segregate the logged data if desired: LOG_INFO - packets logged using the "log" keyword as the action rather than pass or block. LOG_NOTICE - packets logged which are also passed LOG_WARNING - packets logged which are also blocked LOG_ERR - packets which have been logged and which can be considered short To setup IPFILTER to log all data to /var/log/ipfilter.log, you will need to create the file. The following command will do that: &prompt.root; touch /var/log/ipfilter.log The syslog function is controlled by definition statements in the /etc/syslog.conf file. The syslog.conf file offers considerable flexibility in how syslog will deal with system messages issued by software applications like IPF. Add the following statement to /etc/syslog.conf for &os; 5.X and later: security.* /var/log/ipfilter.log Or add the following statement to /etc/syslog.conf for &os; 4.X: local0.* /var/log/ipfilter.log The security.* (local0 for 4.X) means to write all the logged messages to the coded file location. To activate the changes to /etc/syslog.conf you can reboot or bump the syslog task into re-reading /etc/syslog.conf by running /etc/rc.d/syslogd reload (killall -HUP syslogd in &os; 4.X). Do not forget to change /etc/newsyslog.conf to rotate the new log you just created above. The Format of Logged Messages Messages generated by ipmon consist of data fields separated by white space. Fields common to all messages are: The date of packet receipt. The time of packet receipt. This is in the form HH:MM:SS.F, for hours, minutes, seconds, and fractions of a second (which can be several digits long). The name of the interface the packet was processed on, e.g. dc0. The group and rule number of the rule, e.g. @0:17. These can be viewed with ipfstat -in. The action: p for passed, b for blocked, S for a short packet, n did not match any rules, L for a log rule. The order of precedence in showing flags is: S, p, b, n, L. A capital P or B means that the packet has been logged due to a global logging setting, not a particular rule. The addresses. This is actually three fields: the source address and port (separated by a comma), the -> symbol, and the destination address and port. 209.53.17.22,80 -> 198.73.220.17,1722. PR followed by the protocol name or number, e.g. PR tcp. len followed by the header length and total length of the packet, e.g. len 20 40. If the packet is a TCP packet, there will be an additional field starting with a hyphen followed by letters corresponding to any flags that were set. See the &man.ipmon.8; manual page for a list of letters and their flags. If the packet is an ICMP packet, there will be two fields - at the end, the first always being ICMP, and the + at the end, the first always being ¡uICMP¡v, and the next being the ICMP message and sub-message type, separated by a slash, e.g. ICMP 3/3 for a port unreachable message. Building the Rule Script with Symbolic Substitution Some experienced IPF users create a file containing the rules and code them in a manner compatible with running them as a script with symbolic substitution. The major benefit of doing this is that you only have to change the value associated with the symbolic name and when the script is run all the rules containing the symbolic name will have the value substituted in the rules. Being a script, you can use symbolic substitution to code frequently used values and substitute them in multiple rules. You will see this in the following example. The script syntax used here is compatible with the sh, csh, and tcsh shells. Symbolic substitution fields are prefixed with a dollar sign: $. Symbolic fields do not have the $ prefix. The value to populate the symbolic field must be enclosed with double quotes ("). Start your rule file with something like this: - ############# Start of IPF rules script ######################## + ############# IPF ³W«h©R¥O½Zªº¶}©l ######################## -oif="dc0" # name of the outbound interface -odns="192.0.2.11" # ISP's DNS server IP address -myip="192.0.2.7" # my static IP address from ISP +oif="dc0" # ¹ï¥~ºô¸ô¸Ë¸mªº¦WºÙ +odns="192.0.2.11" # ISP ªº DNS ¦øªA¾¹ IP ¦ì§} +myip="192.0.2.7" # ±q§Úªº ISP ´£¨ÑªºÀRºA IP ks="keep state" fks="flags S keep state" # You can choose between building /etc/ipf.rules file # from this script or running this script "as is". # # Uncomment only one line and comment out another. # # 1) This can be used for building /etc/ipf.rules: #cat > /etc/ipf.rules << EOF # # 2) This can be used to run script "as is": /sbin/ipf -Fa -f - << EOF # Allow out access to my ISP's Domain name server. pass out quick on $oif proto tcp from any to $odns port = 53 $fks pass out quick on $oif proto udp from any to $odns port = 53 $ks # Allow out non-secure standard www function pass out quick on $oif proto tcp from $myip to any port = 80 $fks # Allow out secure www function https over TLS SSL pass out quick on $oif proto tcp from $myip to any port = 443 $fks EOF ################## End of IPF rules script ######################## That is all there is to it. The rules are not important in this example; how the symbolic substitution fields are populated and used are. If the above example was in a file named /etc/ipf.rules.script, you could reload these rules by entering the following command: &prompt.root; sh /etc/ipf.rules.script There is one problem with using a rules file with embedded symbolics: IPF does not understand symbolic substitution, and cannot read such scripts directly. This script can be used in one of two ways: Uncomment the line that begins with cat, and comment out the line that begins with /sbin/ipf. Place ipfilter_enable="YES" into /etc/rc.conf as usual, and run script once after each modification to create or update /etc/ipf.rules. Disable IPFILTER in system startup scripts by adding ipfilter_enable="NO" (this is default value) into /etc/rc.conf file. Add a script like the following to your /usr/local/etc/rc.d/ startup directory. The script should have an obvious name like ipf.loadrules.sh. The .sh extension is mandatory. #!/bin/sh sh /etc/ipf.rules.script The permissions on this script file must be read, write, execute for owner root. &prompt.root; chmod 700 /usr/local/etc/rc.d/ipf.loadrules.sh - Now, when your system boots, your IPF rules will be - loaded. + ±q²{¦b°_¡A·í§Aªº¨t²Î¶}¾÷®É¡A + §Aªº IPF ³W«h±N·|³Q¸ü¤J - IPF Rule Sets + IPF ³W«h A rule set is a group of ipf rules coded to pass or block packets based on the values contained in the packet. The bi-directional exchange of packets between hosts comprises a session conversation. The firewall rule set processes the packet two times, once on its arrival from the public Internet host and again as it leaves for its return trip back to the public Internet host. Each TCP/IP service (i.e. telnet, www, mail, etc.) is predefined by its protocol, source and destination IP address, or the source and destination port number. This is the basic selection criteria used to create rules which will pass or block services. IPFILTER rule processing order IPF was originally written using a rules processing logic - of the last matching rule wins and used only + of ¡uthe last matching rule wins¡v and used only stateless rules. Over time IPF has been enhanced to include a - quick option and a stateful keep - state option which drastically modernized the rule + ¡uquick¡v option and a stateful ¡ukeep + state¡v option which drastically modernized the rule processing logic. The instructions contained in this section are based on - using rules that contain the quick option and - the stateful keep state option. This is the + using rules that contain the ¡uquick¡v option and + the stateful ¡ukeep state¡v option. This is the basic framework for coding an inclusive firewall rule set. An inclusive firewall only allows services matching the rules through. This way you can control what services can originate behind the firewall destined for the public Internet and also control the services which can originate from the public Internet accessing your private network. Everything else is blocked and logged by default design. Inclusive firewalls are much, much securer than exclusive firewall rule sets and is the only rule set type covered herein. When working with the firewall rules, be very careful. Some configurations will lock you out of the server. To be on the safe side, you may wish to consider performing the initial firewall configuration from the local console rather than doing it remotely e.g. via ssh. Rule Syntax IPFILTER rule syntax The rule syntax presented here has been simplified to only - address the modern stateful rule context and first - matching rule wins logic. For the complete legacy rule + address the modern stateful rule context and ¡ufirst + matching rule wins¡v logic. For the complete legacy rule syntax description see the &man.ipf.8; manual page. A # character is used to mark the start of a comment and may appear at the end of a rule line or on its own line. Blank lines are ignored. Rules contain keywords. These keywords have to be coded in a specific order from left to right on the line. Keywords are identified in bold type. Some keywords have sub-options which may be keywords themselves and also include more sub-options. Each of the headings in the below syntax has a bold section header which expands on the content. ACTION IN-OUT OPTIONS SELECTION STATEFUL PROTO SRC_ADDR,DST_ADDR OBJECT PORT_NUM TCP_FLAG STATEFUL ACTION = block | pass IN-OUT = in | out OPTIONS = log | quick | on interface-name SELECTION = proto value | source/destination IP | port = number | flags flag-value PROTO = tcp/udp | udp | tcp | icmp SRC_ADD,DST_ADDR = all | from object to object OBJECT = IP address | any PORT_NUM = port number TCP_FLAG = S STATEFUL = keep state ACTION The action indicates what to do with the packet if it matches the rest of the filter rule. Each rule must have a action. The following actions are recognized: block indicates that the packet should be dropped if the selection parameters match the packet. pass indicates that the packet should exit the firewall if the selection parameters match the packet. IN-OUT A mandatory requirement is that each filter rule explicitly state which side of the I/O it is to be used on. The next keyword must be either in or out and one or the other has to be coded or the rule will not pass syntax checks. in means this rule is being applied against an inbound packet which has just been received on the interface facing the public Internet. out means this rule is being applied against an outbound packet destined for the interface facing the public Internet. OPTIONS These options must be used in the order shown here. log indicates that the packet header will be written to the ipl log (as described in the LOGGING section below) if the selection parameters match the packet. quick indicates that if the selection parameters match the packet, this rule will be the last rule - checked, allowing a short-circuit path to avoid processing + checked, allowing a ¡ushort-circuit¡v path to avoid processing any following rules for this packet. This option is a mandatory requirement for the modernized rules processing logic. on indicates the interface name to be incorporated into the selection parameters. Interface names are as displayed by &man.ifconfig.8;. Using this option, the rule will only match if the packet is going through that interface in the specified direction (in/out). This option is a mandatory requirement for the modernized rules processing logic. When a packet is logged, the headers of the packet are written to the IPL packet logging pseudo-device. Immediately following the log keyword, the following qualifiers may be used (in this order): body indicates that the first 128 bytes of the packet contents will be logged after the headers. first If the log - keyword is being used in conjunction with a keep - state option, it is recommended that this option is + keyword is being used in conjunction with a ¡ukeep + state¡v option, it is recommended that this option is also applied so that only the triggering packet is logged and - not every packet which thereafter matches the keep - state information. + not every packet which thereafter matches the ¡ukeep + state¡v information. SELECTION The keywords described in this section are used to describe attributes of the packet to be interrogated when determining whether rules match or not. There is a keyword subject, and it has sub-option keywords, one of which has to be selected. The following general-purpose attributes are provided for matching, and must be used in this order: PROTO proto is the subject keyword and must be coded along with one of its corresponding keyword sub-option values. The value allows a specific protocol to be matched against. This option is a mandatory requirement for the modernized rules processing logic. tcp/udp | udp | tcp | icmp or any protocol names found in /etc/protocols are recognized and may be used. The special protocol keyword tcp/udp may be used to match either a TCP or a UDP packet, and has been added as a convenience to save duplication of otherwise identical rules. SRC_ADDR/DST_ADDR The all keyword is essentially a - synonym for from any to any with no other + synonym for ¡ufrom any to any¡v with no other match parameters. from src to dst: the from and to keywords are used to match against IP addresses. Rules must specify BOTH source and destination parameters. any is a special keyword that matches any - IP address. Examples of use: from any to any - or from 0.0.0.0/0 to any or from any to - 0.0.0.0/0 or from 0.0.0.0 to any or - from any to 0.0.0.0. + IP address. Examples of use: ¡ufrom any to any¡v + or ¡ufrom 0.0.0.0/0 to any¡v or from any to + 0.0.0.0/0¡v or ¡ufrom 0.0.0.0 to any or + ¡ufrom any to 0.0.0.0¡v. IP addresses may be specified as a dotted IP address numeric form/mask-length, or as single dotted IP address numeric form. There is no way to match ranges of IP addresses which do not express themselves easily as mask-length. See this web page for help on writing mask-length: . PORT If a port match is included, for either or both of source and destination, then it is only applied to TCP and UDP packets. When composing port comparisons, either the service name from /etc/services or an integer port number may be used. When the port appears as part of the from object, it matches the source port number; when it appears as part of the to object, it matches the destination port number. The use of the port option with the to object is a mandatory requirement for the modernized rules processing logic. Example of use: - from any to any port = 80 + ¡ufrom any to any port = 80¡v Port comparisons may be done in a number of forms, with a number of comparison operators, or port ranges may be specified. port "=" | "!=" | "<" | ">" | "<=" | ">=" | "eq" | "ne" | "lt" | "gt" | "le" | "ge". To specify port ranges, port "<>" | "><" Following the source and destination matching parameters, the following two parameters are mandatory requirements for the modernized rules processing logic. <acronym>TCP</acronym>_FLAG Flags are only effective for TCP filtering. The letters represents one of the possible flags that can be interrogated in the TCP packet header. The modernized rules processing logic uses the flags S parameter to identify the tcp session start request. STATEFUL keep state indicates that on a pass rule, any packets that match the rules selection parameters should activate the stateful filtering facility. This option is a mandatory requirement for the modernized rules processing logic. Stateful Filtering IPFILTER stateful filtering Stateful filtering treats traffic as a bi-directional exchange of packets comprising a session conversation. When activated, keep-state dynamically generates internal rules for each anticipated packet being exchanged during the bi-directional session conversation. It has the interrogation abilities to determine if the session conversation between the originating sender and the destination are following the valid procedure of bi-directional packet exchange. Any packets that do not properly fit the session conversation template are automatically rejected as impostors. Keep state will also allow ICMP packets related to a TCP or UDP session through. So if you get ICMP type 3 code 4 in response to some web surfing allowed out by a keep state rule, they will be automatically allowed in. Any packet that IPF can be certain is part of an active session, even if it is a different protocol, will be let in. What happens is: Packets destined to go out the interface connected to the public Internet are first checked against the dynamic state table, if the packet matches the next expected packet comprising in a active session conversation, then it exits the firewall and the state of the session conversation flow is updated in the dynamic state table, the remaining packets get checked against the outbound rule set. Packets coming in to the interface connected to the public Internet are first checked against the dynamic state table, if the packet matches the next expected packet comprising a active session conversation, then it exits the firewall and the state of the session conversation flow is updated in the dynamic state table, the remaining packets get checked against the inbound rule set. When the conversation completes it is removed from the dynamic state table. Stateful filtering allows you to focus on blocking/passing new sessions. If the new session is passed, all its subsequent packets will be allowed through automatically and any impostors automatically rejected. If a new session is blocked, none of its subsequent packets will be allowed through. Stateful filtering has technically advanced interrogation abilities capable of defending against the flood of different attack methods currently employed by attackers. Inclusive Rule Set Example The following rule set is an example of how to code a very secure inclusive type of firewall. An inclusive firewall only allows services matching pass rules through and blocks all other by default. All firewalls have at the minimum two interfaces which have to have rules to allow the firewall to function. All &unix; flavored systems including &os; are designed to use interface lo0 and IP address 127.0.0.1 for internal communication within the operating system. The firewall rules must contain rules to allow free unmolested movement of these special internally used packets. The interface which faces the public Internet is the one where you place your rules to authorize and control access out to the public Internet and access requests arriving from the public Internet. This can be your user PPP tun0 interface or your NIC that is connected to your DSL or cable modem. In cases where one or more NICs are cabled to private LANs behind the firewall, those interfaces must have a rule coded to allow free unmolested movement of packets originating from those LAN interfaces. The rules should be first organized into three major sections: all the free unmolested interfaces, the public interface outbound, and the public interface inbound. The rules in each of the public interface sections should have the most frequently matched rules placed before less commonly matched rules, with the last rule in the section blocking and logging all packets on that interface and direction. The Outbound section in the following rule set only contains 'pass' rules which contain selection values that uniquely identify the service that is authorized for public Internet access. All the rules have the 'quick', 'on', 'proto', 'port', and 'keep state' option coded. The 'proto tcp' rules have the 'flag' option included to identify the session start request as the triggering packet to activate the stateful facility. The Inbound section has all the blocking of undesirable packets first, for two different reasons. The first is that these things being blocked may be part of an otherwise valid packet which may be allowed in by the later authorized service rules. The second reason is that by having a rule that explicitly blocks selected packets that I receive on an infrequent basis and that I do not want to see in the log, they will not be caught by the last rule in the section which blocks and logs all packets which have fallen through the rules. The last rule in the section which blocks and logs all packets is how you create the legal evidence needed to prosecute the people who are attacking your system. Another thing you should take note of, is there is no response returned for any of the undesirable stuff, their packets just get dropped and vanish. This way the attacker has no knowledge if his packets have reached your system. The less the attackers can learn about your system, the more time they must invest before actually doing something bad. The inbound 'nmap OS fingerprint' attempts rule I log the first occurrence because this is something a attacker would do. Any time you see log messages on a rule with 'log first'. You should do an ipfstat -hio command to see the number of times the rule has been matched so you know if you are being flooded, i.e. under attack. When you log packets with port numbers you do not recognize, look it up in /etc/services or go to and do a port number lookup to find what the purpose of that port number is. Check out this link for port numbers used by Trojans . The following rule set is a complete very secure 'inclusive' type of firewall rule set that I have used on my system. You can not go wrong using this rule set for your own. Just comment out any pass rules for services that you do not want to authorize. If you see messages in your log that you want to stop seeing just add a block rule in the inbound section. You have to change the dc0 interface name in every rule to the interface name of the Nic card that connects your system to the public Internet. For user PPP it would be tun0. Add the following statements to /etc/ipf.rules: ################################################################# # No restrictions on Inside LAN Interface for private network # Not needed unless you have LAN ################################################################# #pass out quick on xl0 all #pass in quick on xl0 all ################################################################# # No restrictions on Loopback Interface ################################################################# pass in quick on lo0 all pass out quick on lo0 all ################################################################# # Interface facing Public Internet (Outbound Section) # Interrogate session start requests originating from behind the # firewall on the private network # or from this gateway server destine for the public Internet. ################################################################# # Allow out access to my ISP's Domain name server. # xxx must be the IP address of your ISP's DNS. # Dup these lines if your ISP has more than one DNS server # Get the IP addresses from /etc/resolv.conf file pass out quick on dc0 proto tcp from any to xxx port = 53 flags S keep state pass out quick on dc0 proto udp from any to xxx port = 53 keep state # Allow out access to my ISP's DHCP server for cable or DSL networks. # This rule is not needed for 'user ppp' type connection to the # public Internet, so you can delete this whole group. # Use the following rule and check log for IP address. # Then put IP address in commented out rule & delete first rule pass out log quick on dc0 proto udp from any to any port = 67 keep state #pass out quick on dc0 proto udp from any to z.z.z.z port = 67 keep state # Allow out non-secure standard www function pass out quick on dc0 proto tcp from any to any port = 80 flags S keep state # Allow out secure www function https over TLS SSL pass out quick on dc0 proto tcp from any to any port = 443 flags S keep state # Allow out send & get email function pass out quick on dc0 proto tcp from any to any port = 110 flags S keep state pass out quick on dc0 proto tcp from any to any port = 25 flags S keep state # Allow out Time pass out quick on dc0 proto tcp from any to any port = 37 flags S keep state # Allow out nntp news pass out quick on dc0 proto tcp from any to any port = 119 flags S keep state # Allow out gateway & LAN users non-secure FTP ( both passive & active modes) # This function uses the IPNAT built in FTP proxy function coded in # the nat rules file to make this single rule function correctly. # If you want to use the pkg_add command to install application packages # on your gateway system you need this rule. pass out quick on dc0 proto tcp from any to any port = 21 flags S keep state # Allow out secure FTP, Telnet, and SCP # This function is using SSH (secure shell) pass out quick on dc0 proto tcp from any to any port = 22 flags S keep state # Allow out non-secure Telnet pass out quick on dc0 proto tcp from any to any port = 23 flags S keep state # Allow out FBSD CVSUP function pass out quick on dc0 proto tcp from any to any port = 5999 flags S keep state # Allow out ping to public Internet pass out quick on dc0 proto icmp from any to any icmp-type 8 keep state # Allow out whois for LAN PC to public Internet pass out quick on dc0 proto tcp from any to any port = 43 flags S keep state # Block and log only the first occurrence of everything # else that's trying to get out. # This rule enforces the block all by default logic. block out log first quick on dc0 all ################################################################# # Interface facing Public Internet (Inbound Section) # Interrogate packets originating from the public Internet # destine for this gateway server or the private network. ################################################################# # Block all inbound traffic from non-routable or reserved address spaces block in quick on dc0 from 192.168.0.0/16 to any #RFC 1918 private IP block in quick on dc0 from 172.16.0.0/12 to any #RFC 1918 private IP block in quick on dc0 from 10.0.0.0/8 to any #RFC 1918 private IP block in quick on dc0 from 127.0.0.0/8 to any #loopback block in quick on dc0 from 0.0.0.0/8 to any #loopback block in quick on dc0 from 169.254.0.0/16 to any #DHCP auto-config block in quick on dc0 from 192.0.2.0/24 to any #reserved for docs block in quick on dc0 from 204.152.64.0/23 to any #Sun cluster interconnect block in quick on dc0 from 224.0.0.0/3 to any #Class D & E multicast ##### Block a bunch of different nasty things. ############ # That I do not want to see in the log # Block frags block in quick on dc0 all with frags # Block short tcp packets block in quick on dc0 proto tcp all with short # block source routed packets block in quick on dc0 all with opt lsrr block in quick on dc0 all with opt ssrr # Block nmap OS fingerprint attempts # Log first occurrence of these so I can get their IP address block in log first quick on dc0 proto tcp from any to any flags FUP # Block anything with special options block in quick on dc0 all with ipopts # Block public pings block in quick on dc0 proto icmp all icmp-type 8 # Block ident block in quick on dc0 proto tcp from any to any port = 113 # Block all Netbios service. 137=name, 138=datagram, 139=session # Netbios is MS/Windows sharing services. # Block MS/Windows hosts2 name server requests 81 block in log first quick on dc0 proto tcp/udp from any to any port = 137 block in log first quick on dc0 proto tcp/udp from any to any port = 138 block in log first quick on dc0 proto tcp/udp from any to any port = 139 block in log first quick on dc0 proto tcp/udp from any to any port = 81 # Allow traffic in from ISP's DHCP server. This rule must contain # the IP address of your ISP's DHCP server as it's the only # authorized source to send this packet type. Only necessary for # cable or DSL configurations. This rule is not needed for # 'user ppp' type connection to the public Internet. # This is the same IP address you captured and # used in the outbound section. pass in quick on dc0 proto udp from z.z.z.z to any port = 68 keep state # Allow in standard www function because I have apache server pass in quick on dc0 proto tcp from any to any port = 80 flags S keep state # Allow in non-secure Telnet session from public Internet # labeled non-secure because ID/PW passed over public Internet as clear text. # Delete this sample group if you do not have telnet server enabled. #pass in quick on dc0 proto tcp from any to any port = 23 flags S keep state # Allow in secure FTP, Telnet, and SCP from public Internet # This function is using SSH (secure shell) pass in quick on dc0 proto tcp from any to any port = 22 flags S keep state # Block and log only first occurrence of all remaining traffic # coming into the firewall. The logging of only the first # occurrence stops a .denial of service. attack targeted # at filling up your log file space. # This rule enforces the block all by default logic. block in log first quick on dc0 all ################### End of rules file ##################################### <acronym>NAT</acronym> NAT IP masquerading NAT network address translation NAT NAT stands for Network Address Translation. To those familiar with &linux;, this concept is called IP Masquerading; NAT and IP Masquerading are the same thing. One of the many things the IPF NAT function enables is the ability to have a private Local Area Network (LAN) behind the firewall sharing a single ISP assigned IP address on the public Internet. You may ask why would someone want to do this. ISPs normally assign a dynamic IP address to their non-commercial users. Dynamic means that the IP address can be different each time you dial in and log on to your ISP, or for cable and DSL modem users when you power off and then power on your modems you can get assigned a different IP address. This IP address is how you are known to the public Internet. Now lets say you have five PCs at home and each one needs Internet access. You would have to pay your ISP for an individual Internet account for each PC and have five phone lines. With NAT you only need a single account with your ISP, then cable your other four PCs to a switch and the switch to the NIC in your &os; system which is going to service your LAN as a gateway. NAT will automatically translate the private LAN IP address for each separate PC on the LAN to the single public IP address as it exits the firewall bound for the public Internet. It also does the reverse translation for returning packets. NAT is most often accomplished without the approval, or knowledge, of your ISP and in most cases is grounds for your ISP terminating your account if found out. Commercial users pay a lot more for their Internet connection and usually get assigned a block of static IP address which never change. The ISP also expects and consents to their Commercial customers using NAT for their internal private LANs. There is a special range of IP addresses reserved for NATed private LAN IP address. According to RFC 1918, you can use the following IP ranges for private nets which will never be routed directly to the public Internet: Start IP 10.0.0.0 - Ending IP 10.255.255.255 Start IP 172.16.0.0 - Ending IP 172.31.255.255 Start IP 192.168.0.0 - Ending IP 192.168.255.255 IP<acronym>NAT</acronym> NAT and IPFILTER ipnat NAT rules are loaded by using the ipnat command. Typically the NAT rules are stored in /etc/ipnat.rules. See &man.ipnat.1; for details. When changing the NAT rules after NAT has been started, make your changes to the file containing the NAT rules, then run ipnat command with the flags to delete the internal in use NAT rules and flush the contents of the translation table of all active entries. To reload the NAT rules issue a command like this: &prompt.root; ipnat -CF -f /etc/ipnat.rules To display some statistics about your NAT, use this command: &prompt.root; ipnat -s To list the NAT table's current mappings, use this command: &prompt.root; ipnat -l To turn verbose mode on, and display information relating to rule processing and active rules/table entries: &prompt.root; ipnat -v IP<acronym>NAT</acronym> Rules NAT rules are very flexible and can accomplish many different things to fit the needs of commercial and home users. The rule syntax presented here has been simplified to what is most commonly used in a non-commercial environment. For a complete rule syntax description see the &man.ipnat.5; manual page. The syntax for a NAT rule looks something like this: map IF LAN_IP_RANGE -> PUBLIC_ADDRESS The keyword map starts the rule. Replace IF with the external interface. The LAN_IP_RANGE is what your internal clients use for IP Addressing, usually this is something like 192.168.1.0/24. The PUBLIC_ADDRESS can either be the external IP address or the special keyword 0/32, which means to use the IP address assigned to IF. How <acronym>NAT</acronym> works A packet arrives at the firewall from the LAN with a public destination. It passes through the outbound filter rules, NAT gets his turn at the packet and applies its rules top down, first matching rule wins. NAT tests each of its rules against the packets interface name and source IP address. When a packets interface name matches a NAT rule then the [source IP address, i.e. private LAN IP address] of the packet is checked to see if it falls within the IP address range specified to the left of the arrow symbol on the NAT rule. On a match the packet has its source IP address rewritten with the public IP address obtained by the 0/32 keyword. NAT posts a entry in its internal NAT table so when the packet returns from the public Internet it can be mapped back to its original private IP address and then passed to the filter rules for processing. Enabling IP<acronym>NAT</acronym> To enable IPNAT add these statements to /etc/rc.conf. To enable your machine to route traffic between interfaces: gateway_enable="YES" To start IPNAT automatically each time: ipnat_enable="YES" To specify where to load the IPNAT rules from: ipnat_rules="/etc/ipnat.rules" <acronym>NAT</acronym> for a very large LAN For networks that have large numbers of PC's on the LAN or networks with more than a single LAN, the process of funneling all those private IP addresses into a single public IP address becomes a resource problem that may cause problems with the same port numbers being used many times across many NATed LAN PC's, causing collisions. There are two ways to relieve this resource problem. Assigning Ports to Use A normal NAT rule would look like: map dc0 192.168.1.0/24 -> 0/32 In the above rule the packet's source port is unchanged as the packet passes through IPNAT. By adding the portmap keyword you can tell IPNAT to only use source ports in a range. For example the following rule will tell IPNAT to modify the source port to be within that range: map dc0 192.168.1.0/24 -> 0/32 portmap tcp/udp 20000:60000 Additionally we can make things even easier by using the auto keyword to tell IPNAT to determine by itself which ports are available to use: map dc0 192.168.1.0/24 -> 0/32 portmap tcp/udp auto Using a pool of public addresses In very large LANs there comes a point where there are just too many LAN addresses to fit into a single public address. By changing the following rule: map dc0 192.168.1.0/24 -> 204.134.75.1 Currently this rule maps all connections through 204.134.75.1. This can be changed to specify a range: map dc0 192.168.1.0/24 -> 204.134.75.1-10 Or a subnet using CIDR notation such as: map dc0 192.168.1.0/24 -> 204.134.75.0/24 Port Redirection A very common practice is to have a web server, email server, database server and DNS server each segregated to a different PC on the LAN. In this case the traffic from these servers still have to be NATed, but there has to be some way to direct the inbound traffic to the correct LAN PCs. IPNAT has the redirection facilities of NAT to solve this problem. Lets say you have your web server on LAN address 10.0.10.25 and your single public IP address is 20.20.20.5 you would code the rule like this: rdr dc0 20.20.20.5/32 port 80 -> 10.0.10.25 port 80 or: rdr dc0 0/32 port 80 -> 10.0.10.25 port 80 or for a LAN DNS Server on LAN address of 10.0.10.33 that needs to receive public DNS requests: rdr dc0 20.20.20.5/32 port 53 -> 10.0.10.33 port 53 udp FTP and <acronym>NAT</acronym> FTP is a dinosaur left over from the time before the Internet as it is known today, when research universities were leased lined together and FTP was used to share files among research Scientists. This was a time when data security was not a consideration. Over the years the FTP protocol became buried into the backbone of the emerging Internet and its username and password being sent in clear text was never changed to address new security concerns. FTP has two flavors, it can run in active mode or passive mode. The difference is in how the data channel is acquired. Passive mode is more secure as the data channel is acquired be the ordinal ftp session requester. For a real good explanation of FTP and the different modes see . IP<acronym>NAT</acronym> Rules IPNAT has a special built in FTP proxy option which can be specified on the NAT map rule. It can monitor all outbound packet traffic for FTP active or passive start session requests and dynamically create temporary filter rules containing only the port number really in use for the data channel. This eliminates the security risk FTP normally exposes the firewall to from having large ranges of high order port numbers open. This rule will handle all the traffic for the internal LAN: map dc0 10.0.10.0/29 -> 0/32 proxy port 21 ftp/tcp This rule handles the FTP traffic from the gateway: map dc0 0.0.0.0/0 -> 0/32 proxy port 21 ftp/tcp This rule handles all non-FTP traffic from the internal LAN: map dc0 10.0.10.0/29 -> 0/32 The FTP map rule goes before our regular map rule. All packets are tested against the first rule from the top. Matches on interface name, then private LAN source IP address, and then is it a FTP packet. If all that matches then the special FTP proxy creates temp filter rules to let the FTP session packets pass in and out, in addition to also NATing the FTP packets. All LAN packets that are not FTP do not match the first rule and fall through to the third rule and are tested, matching on interface and source IP, then are NATed. IP<acronym>NAT</acronym> FTP Filter Rules Only one filter rule is needed for FTP if the NAT FTP proxy is used. Without the FTP Proxy you will need the following three rules: # Allow out LAN PC client FTP to public Internet # Active and passive modes pass out quick on rl0 proto tcp from any to any port = 21 flags S keep state # Allow out passive mode data channel high order port numbers pass out quick on rl0 proto tcp from any to any port > 1024 flags S keep state # Active mode let data channel in from FTP server pass in quick on rl0 proto tcp from any to any port = 20 flags S keep state FTP <acronym>NAT</acronym> Proxy Bug As of &os; 4.9 which includes IPFILTER version 3.4.31 the FTP proxy works as documented during the FTP session until the session is told to close. When the close happens packets returning from the remote FTP server are blocked and logged coming in on port 21. The NAT FTP/proxy appears to remove its temp rules prematurely, before receiving the response from the remote FTP server acknowledging the close. A problem report was posted to the IPF mailing list. The solution is to add a filter rule to get rid of these unwanted log messages or do nothing and ignore FTP inbound error messages in your log. Most people do not use outbound FTP too often. block in quick on rl0 proto tcp from any to any port = 21 IPFW firewall IPFW This section is work in progress. The contents might not be accurate at all times. The IPFIREWALL (IPFW) is a &os; sponsored firewall software application authored and maintained by &os; volunteer staff members. It uses the legacy stateless rules and a legacy rule coding technique to achieve what is referred to as Simple Stateful logic. The IPFW sample rule set (found in /etc/rc.firewall) in the standard &os; install is rather simple and it is not expected that it used directly without modifications. The example does not use stateful filtering, which is beneficial in most setups, so it will not be used as base for this section. The IPFW stateless rule syntax is empowered with technically sophisticated selection capabilities which far surpasses the knowledge level of the customary firewall installer. IPFW is targeted at the professional user or the advanced technical computer hobbyist who have advanced packet selection requirements. A high degree of detailed knowledge into how different protocols use and create their unique packet header information is necessary before the power of the IPFW rules can be unleashed. Providing that level of explanation is out of the scope of this section of the handbook. IPFW is composed of seven components, the primary component is the kernel firewall filter rule processor and its integrated packet accounting facility, the logging facility, the 'divert' rule which triggers the NAT facility, and the advanced special purpose facilities, the dummynet traffic shaper facilities, the 'fwd rule' forward facility, the bridge facility, and the ipstealth facility. Enabling IPFW IPFW enabling IPFW is included in the basic &os; install as a separate run time loadable module. The system will dynamically load the kernel module when the rc.conf statement firewall_enable="YES" is used. You do not need to compile IPFW into the &os; kernel unless you want NAT function enabled. After rebooting your system with firewall_enable="YES" in rc.conf the following white highlighted message is displayed on the screen as part of the boot process: ipfw2 initialized, divert disabled, rule-based forwarding disabled, default to deny, logging disabled The loadable module does have logging ability compiled in. To enable logging and set the verbose logging limit, there is a knob you can set in /etc/sysctl.conf by adding these statements, logging will be enabled on future reboots: net.inet.ip.fw.verbose=1 net.inet.ip.fw.verbose_limit=5 Kernel Options kernel options IPFIREWALL kernel options IPFIREWALL_VERBOSE kernel options IPFIREWALL_VERBOSE_LIMIT IPFW kernel options It is not a mandatory requirement that you enable IPFW by compiling the following options into the &os; kernel unless you need NAT function. It is presented here as background information. options IPFIREWALL This option enables IPFW as part of the kernel options IPFIREWALL_VERBOSE Enables logging of packets that pass through IPFW and have the 'log' keyword specified in the rule set. options IPFIREWALL_VERBOSE_LIMIT=5 Limits the number of packets logged through &man.syslogd.8; on a per entry basis. You may wish to use this option in hostile environments which you want to log firewall activity. This will close a possible denial of service attack via syslog flooding. kernel options IPFIREWALL_DEFAULT_TO_ACCEPT options IPFIREWALL_DEFAULT_TO_ACCEPT This option will allow everything to pass through the firewall by default, which is a good idea when you are first setting up your firewall. options IPV6FIREWALL options IPV6FIREWALL_VERBOSE options IPV6FIREWALL_VERBOSE_LIMIT options IPV6FIREWALL_DEFAULT_TO_ACCEPT These options are exactly the same as the IPv4 options but they are for IPv6. If you do not use IPv6 you might want to use IPV6FIREWALL without any rules to block all IPv6 kernel options IPDIVERT options IPDIVERT This enables the use of NAT functionality. If you do not include IPFIREWALL_DEFAULT_TO_ACCEPT or set your rules to allow incoming packets you will block all packets going to and from this machine. <filename>/etc/rc.conf</filename> Options If you do not have IPFW compiled into your kernel you will need to load it with the following statement in your /etc/rc.conf: firewall_enable="YES" Set the script to run to activate your rules: firewall_script="/etc/ipfw.rules" Enable logging: firewall_logging="YES" The only thing that the firewall_logging variable will do is setting the net.inet.ip.fw.verbose sysctl variable to the value of 1 (see ). There is no rc.conf variable to set log limitations, but it can be set via sysctl variable, manually or from the /etc/sysctl.conf file: net.inet.ip.fw.verbose_limit=5 If your machine is acting as a gateway, i.e. providing Network Address Translation (NAT) via &man.natd.8;, please refer to for information regarding the required /etc/rc.conf options. The IPFW Command ipfw The ipfw command is the normal vehicle for making manual single rule additions or deletions to the firewall active internal rules while it is running. The problem with using this method is once your system is shutdown or halted all the rules you added or changed or deleted are lost. Writing all your rules in a file and using that file to load the rules at boot time, or to replace in mass the currently running firewall rules with changes you made to the files content is the recommended method used here. The ipfw command is still a very useful to display the running firewall rules to the console screen. The IPFW accounting facility dynamically creates a counter for each rule that counts each packet that matches the rule. During the process of testing a rule, listing the rule with its counter is the one of the ways of determining if the rule is functioning. To list all the rules in sequence: &prompt.root; ipfw list To list all the rules with a time stamp of when the last time the rule was matched: &prompt.root; ipfw -t list To list the accounting information, packet count for matched rules along with the rules themselves. The first column is the rule number, followed by the number of outgoing matched packets, followed by the number of incoming matched packets, and then the rule itself. &prompt.root; ipfw -a list List the dynamic rules in addition to the static rules: &prompt.root; ipfw -d list Also show the expired dynamic rules: &prompt.root; ipfw -d -e list Zero the counters: &prompt.root; ipfw zero Zero the counters for just rule NUM: &prompt.root; ipfw zero NUM IPFW Rule Sets A rule set is a group of ipfw rules coded to allow or deny packets based on the values contained in the packet. The bi-directional exchange of packets between hosts comprises a session conversation. The firewall rule set processes the packet twice: once on its arrival from the public Internet host and again as it leaves for its return trip back to the public Internet host. Each tcp/ip service (i.e. telnet, www, mail, etc.) is predefined by its protocol, and port number. This is the basic selection criteria used to create rules which will allow or deny services. IPFW rule processing order When a packet enters the firewall it is compared against the first rule in the rule set and progress one rule at a time moving from top to bottom of the set in ascending rule number sequence order. When the packet matches a rule selection parameters, the rules action field value is executed and the search of the rule set terminates for that packet. This is - referred to as the first match wins search + referred to as ¡uthe first match wins¡v search method. If the packet does not match any of the rules, it gets caught by the mandatory ipfw default rule, number 65535 which denies all packets and discards them without any reply back to the originating destination. The search continues after count, skipto and tee rules. The instructions contained here are based on using rules that contain the stateful 'keep state', 'limit', 'in'/'out', and via options. This is the basic framework for coding an inclusive type firewall rule set. An inclusive firewall only allows services matching the rules through. This way you can control what services can originate behind the firewall destine for the public Internet and also control the services which can originate from the public Internet accessing your private network. Everything else is denied by default design. Inclusive firewalls are much, much more secure than exclusive firewall rule sets and is the only rule set type covered here in. When working with the firewall rules be careful, you can end up locking your self out. Rule Syntax IPFW rule syntax The rule syntax presented here has been simplified to what is necessary to create a standard inclusive type firewall rule set. For a complete rule syntax description see the &man.ipfw.8; manual page. Rules contain keywords: these keywords have to be coded in a specific order from left to right on the line. Keywords are identified in bold type. Some keywords have sub-options which may be keywords them selves and also include more sub-options. # is used to mark the start of a comment and may appear at the end of a rule line or on its own lines. Blank lines are ignored. CMD RULE_NUMBER ACTION LOGGING SELECTION STATEFUL CMD Each new rule has to be prefixed with add to add the rule to the internal table. RULE_NUMBER Each rule has to have a rule number to go with it. ACTION A rule can be associated with one of the following actions, which will be executed when the packet matches the selection criterion of the rule. allow | accept | pass | permit These all mean the same thing which is to allow packets that match the rule to exit the firewall rule processing. The search terminates at this rule. check-state Checks the packet against the dynamic rules table. If a match is found, execute the action associated with the rule which generated this dynamic rule, otherwise move to the next rule. The check-state rule does not have selection criterion. If no check-state rule is present in the rule set, the dynamic rules table is checked at the first keep-state or limit rule. deny | drop Both words mean the same thing which is to discard packets that match this rule. The search terminates. Logging log or logamount When a packet matches a rule with the log keyword, a message will be logged to syslogd with a facility name of SECURITY. The logging only occurs if the number of packets logged so far for that particular rule does not exceed the logamount parameter. If no logamount is specified, the limit is taken from the sysctl variable net.inet.ip.fw.verbose_limit. In both cases, a value of zero removes the logging limit. Once the limit is reached, logging can be re-enabled by clearing the logging counter or the packet counter for that rule, see the ipfw reset log command. Logging is done after all other packet matching conditions have been successfully verified, and before performing the final action (accept, deny) on the packet. It is up to you to decide which rules you want to enable logging on. Selection The keywords described in this section are used to describe attributes of the packet to be interrogated when determining whether rules match the packet or not. The following general-purpose attributes are provided for matching, and must be used in this order: udp | tcp | icmp or any protocol names found in /etc/protocols are recognized and may be used. The value specified is protocol to be matched against. This is a mandatory requirement. from src to dst The from and to keywords are used to match against IP addresses. Rules must specify BOTH source and destination parameters. any is a special keyword that matches any IP address. me is a special keyword that matches any IP address configured on an interface in your &os; system to represent the PC the firewall is running on (i.e. this box) as in 'from me to any' or 'from any to me' or 'from 0.0.0.0/0 to any' or 'from any to 0.0.0.0/0' or 'from 0.0.0.0 to any' or 'from any to 0.0.0.0' or 'from me to 0.0.0.0'. IP addresses are specified as a dotted IP address numeric form/mask-length, or as single dotted IP address numeric form. This is a mandatory requirement. See this link for help on writing mask-lengths. port number For protocols which support port numbers (such as TCP and UDP). It is mandatory that you code the port number of the service you want to match on. Service names (from /etc/services) may be used instead of numeric port values. in | out Matches incoming or outgoing packets, respectively. The in and out are keywords and it is mandatory that you code one or the other as part of your rule matching criterion. via IF Matches packets going through the interface specified by exact name. The via keyword causes the interface to always be checked as part of the match process. setup This is a mandatory keyword that identifies the session start request for TCP packets. keep-state This is a mandatory> keyword. Upon a match, the firewall will create a dynamic rule, whose default behavior is to match bidirectional traffic between source and destination IP/port using the same protocol. limit {src-addr | src-port | dst-addr | dst-port} The firewall will only allow N connections with the same set of parameters as specified in the rule. One or more of source and destination addresses and ports can be specified. The 'limit' and 'keep-state' can not be used on same rule. Limit provides the same stateful function as 'keep-state' plus its own functions. Stateful Rule Option IPFW stateful filtering Stateful filtering treats traffic as a bi-directional exchange of packets comprising a session conversation. It has the interrogation abilities to determine if the session conversation between the originating sender and the destination are following the valid procedure of bi-directional packet exchange. Any packets that do not properly fit the session conversation template are automatically rejected as impostors. 'check-state' is used to identify where in the IPFW rules set the packet is to be tested against the dynamic rules facility. On a match the packet exits the firewall to continue on its way and a new rule is dynamic created for the next anticipated packet being exchanged during this bi-directional session conversation. On a no match the packet advances to the next rule in the rule set for testing. The dynamic rules facility is vulnerable to resource depletion from a SYN-flood attack which would open a huge number of dynamic rules. To counter this attack, &os; version 4.5 added another new option named limit. This option is used to limit the number of simultaneous session conversations by interrogating the rules source or destinations fields as directed by the limit option and using the packet's IP address found there, in a search of the open dynamic rules counting the number of times this rule and IP address combination occurred, if this count is greater that the value specified on the limit option, the packet is discarded. Logging Firewall Messages IPFW logging The benefits of logging are obvious: it provides the ability to review after the fact the rules you activated logging on which provides information like, what packets had been dropped, what addresses they came from, where they were going, giving you a significant edge in tracking down attackers. Even with the logging facility enabled, IPFW will not generate any rule logging on it's own. The firewall administrator decides what rules in the rule set he wants to log and adds the log verb to those rules. Normally only deny rules are logged, like the deny rule for incoming ICMP pings. It is very customary to duplicate the ipfw default deny everything rule with the log verb included as your last rule in the rule set. This way you get to see all the packets that did not match any of the rules in the rule set. Logging is a two edged sword, if you are not careful, you can lose yourself in the over abundance of log data and fill your disk up with growing log files. DoS attacks that fill up disk drives is one of the oldest attacks around. These log message are not only written to syslogd, but also are displayed on the root console screen and soon become very annoying. The IPFIREWALL_VERBOSE_LIMIT=5 kernel option limits the number of consecutive messages sent to the system logger syslogd, concerning the packet matching of a given rule. When this option is enabled in the kernel, the number of consecutive messages concerning a particular rule is capped at the number specified. There is nothing to be gained from 200 log messages saying the same identical thing. For instance, five consecutive messages concerning a particular rule would be logged to syslogd, the remainder identical consecutive messages would be counted and posted to the syslogd with a phrase like this: last message repeated 45 times All logged packets messages are written by default to /var/log/security file, which is defined in the /etc/syslog.conf file. Building a Rule Script Most experienced IPFW users create a file containing the rules and code them in a manner compatible with running them as a script. The major benefit of doing this is the firewall rules can be refreshed in mass without the need of rebooting the system to activate the new rules. This method is very convenient in testing new rules as the procedure can be executed as many times as needed. Being a script, you can use symbolic substitution to code frequent used values and substitution them in multiple rules. You will see this in the following example. The script syntax used here is compatible with the 'sh', 'csh', 'tcsh' shells. Symbolic substitution fields are prefixed with a dollar sign $. Symbolic fields do not have the $ prefix. The value to populate the Symbolic field must be enclosed to "double quotes". Start your rules file like this: ############### start of example ipfw rules script ############# # ipfw -q -f flush # Delete all rules # Set defaults oif="tun0" # out interface odns="192.0.2.11" # ISP's DNS server IP address cmd="ipfw -q add " # build rule prefix ks="keep-state" # just too lazy to key this each time $cmd 00500 check-state $cmd 00502 deny all from any to any frag $cmd 00501 deny tcp from any to any established $cmd 00600 allow tcp from any to any 80 out via $oif setup $ks $cmd 00610 allow tcp from any to $odns 53 out via $oif setup $ks $cmd 00611 allow udp from any to $odns 53 out via $oif $ks ################### End of example ipfw rules script ############ That is all there is to it. The rules are not important in this example, how the Symbolic substitution field are populated and used are. If the above example was in /etc/ipfw.rules file, you could reload these rules by entering on the command line. &prompt.root; sh /etc/ipfw.rules The /etc/ipfw.rules file could be located anywhere you want and the file could be named any thing you would like. The same thing could also be accomplished by running these commands by hand: &prompt.root; ipfw -q -f flush &prompt.root; ipfw -q add check-state &prompt.root; ipfw -q add deny all from any to any frag &prompt.root; ipfw -q add deny tcp from any to any established &prompt.root; ipfw -q add allow tcp from any to any 80 out via tun0 setup keep-state &prompt.root; ipfw -q add allow tcp from any to 192.0.2.11 53 out via tun0 setup keep-state &prompt.root; ipfw -q add 00611 allow udp from any to 192.0.2.11 53 out via tun0 keep-state Stateful Ruleset The following non-NATed rule set is an example of how to code a very secure 'inclusive' type of firewall. An inclusive firewall only allows services matching pass rules through and blocks all other by default. All firewalls have at the minimum two interfaces which have to have rules to allow the firewall to function. All &unix; flavored operating systems, &os; included, are designed to use interface lo0 and IP address 127.0.0.1 for internal communication with in the operating system. The firewall rules must contain rules to allow free unmolested movement of these special internally used packets. The interface which faces the public Internet, is the one which you code your rules to authorize and control access out to the public Internet and access requests arriving from the public Internet. This can be your ppp tun0 interface or your NIC that is connected to your DSL or cable modem. In cases where one or more than one NIC are connected to a private LANs behind the firewall, those interfaces must have rules coded to allow free unmolested movement of packets originating from those LAN interfaces. The rules should be first organized into three major sections, all the free unmolested interfaces, public interface outbound, and the public interface inbound. The order of the rules in each of the public interface sections should be in order of the most used rules being placed before less often used rules with the last rule in the section being a block log all packets on that interface and direction. The Outbound section in the following rule set only contains 'allow' rules which contain selection values that uniquely identify the service that is authorized for public Internet access. All the rules have the, proto, port, in/out, via and keep state option coded. The 'proto tcp' rules have the 'setup' option included to identify the start session request as the trigger packet to be posted to the keep state stateful table. The Inbound section has all the blocking of undesirable packets first for two different reasons. First is these things being blocked may be part of an otherwise valid packet which may be allowed in by the later authorized service rules. Second reason is that by having a rule that explicitly blocks selected packets that I receive on an infrequent bases and do not want to see in the log, this keeps them from being caught by the last rule in the section which blocks and logs all packets which have fallen through the rules. The last rule in the section which blocks and logs all packets is how you create the legal evidence needed to prosecute the people who are attacking your system. Another thing you should take note of, is there is no response returned for any of the undesirable stuff, their packets just get dropped and vanish. This way the attackers has no knowledge if his packets have reached your system. The less the attackers can learn about your system the more secure it is. When you log packets with port numbers you do not recognize, look the numbers up in /etc/services/ or go to and do a port number lookup to find what the purpose of that port number is. Check out this link for port numbers used by Trojans: . An Example Inclusive Ruleset The following non-NATed rule set is a complete inclusive type ruleset. You can not go wrong using this rule set for you own. Just comment out any pass rules for services you do not want. If you see messages in your log that you want to stop seeing just add a deny rule in the inbound section. You have to change the 'dc0' interface name in every rule to the interface name of the NIC that connects your system to the public Internet. For user ppp it would be 'tun0'. You will see a pattern in the usage of these rules. All statements that are a request to start a session to the public Internet use keep-state. All the authorized services that originate from the public Internet have the limit option to stop flooding. All rules use in or out to clarify direction. All rules use via interface name to specify the interface the packet is traveling over. The following rules go into /etc/ipfw.rules. ################ Start of IPFW rules file ############################### # Flush out the list before we begin. ipfw -q -f flush # Set rules command prefix cmd="ipfw -q add" pif="dc0" # public interface name of NIC # facing the public Internet ################################################################# # No restrictions on Inside LAN Interface for private network # Not needed unless you have LAN. # Change xl0 to your LAN NIC interface name ################################################################# #$cmd 00005 allow all from any to any via xl0 ################################################################# # No restrictions on Loopback Interface ################################################################# $cmd 00010 allow all from any to any via lo0 ################################################################# # Allow the packet through if it has previous been added to the # the "dynamic" rules table by a allow keep-state statement. ################################################################# $cmd 00015 check-state ################################################################# # Interface facing Public Internet (Outbound Section) # Interrogate session start requests originating from behind the # firewall on the private network or from this gateway server # destine for the public Internet. ################################################################# # Allow out access to my ISP's Domain name server. # x.x.x.x must be the IP address of your ISP.s DNS # Dup these lines if your ISP has more than one DNS server # Get the IP addresses from /etc/resolv.conf file $cmd 00110 allow tcp from any to x.x.x.x 53 out via $pif setup keep-state $cmd 00111 allow udp from any to x.x.x.x 53 out via $pif keep-state # Allow out access to my ISP's DHCP server for cable/DSL configurations. # This rule is not needed for .user ppp. connection to the public Internet. # so you can delete this whole group. # Use the following rule and check log for IP address. # Then put IP address in commented out rule & delete first rule $cmd 00120 allow log udp from any to any 67 out via $pif keep-state #$cmd 00120 allow udp from any to x.x.x.x 67 out via $pif keep-state # Allow out non-secure standard www function $cmd 00200 allow tcp from any to any 80 out via $pif setup keep-state # Allow out secure www function https over TLS SSL $cmd 00220 allow tcp from any to any 443 out via $pif setup keep-state # Allow out send & get email function $cmd 00230 allow tcp from any to any 25 out via $pif setup keep-state $cmd 00231 allow tcp from any to any 110 out via $pif setup keep-state # Allow out FBSD (make install & CVSUP) functions # Basically give user root "GOD" privileges. $cmd 00240 allow tcp from me to any out via $pif setup keep-state uid root # Allow out ping $cmd 00250 allow icmp from any to any out via $pif keep-state # Allow out Time $cmd 00260 allow tcp from any to any 37 out via $pif setup keep-state # Allow out nntp news (i.e. news groups) $cmd 00270 allow tcp from any to any 119 out via $pif setup keep-state # Allow out secure FTP, Telnet, and SCP # This function is using SSH (secure shell) $cmd 00280 allow tcp from any to any 22 out via $pif setup keep-state # Allow out whois $cmd 00290 allow tcp from any to any 43 out via $pif setup keep-state # deny and log everything else that.s trying to get out. # This rule enforces the block all by default logic. $cmd 00299 deny log all from any to any out via $pif ################################################################# # Interface facing Public Internet (Inbound Section) # Interrogate packets originating from the public Internet # destine for this gateway server or the private network. ################################################################# # Deny all inbound traffic from non-routable reserved address spaces $cmd 00300 deny all from 192.168.0.0/16 to any in via $pif #RFC 1918 private IP $cmd 00301 deny all from 172.16.0.0/12 to any in via $pif #RFC 1918 private IP $cmd 00302 deny all from 10.0.0.0/8 to any in via $pif #RFC 1918 private IP $cmd 00303 deny all from 127.0.0.0/8 to any in via $pif #loopback $cmd 00304 deny all from 0.0.0.0/8 to any in via $pif #loopback $cmd 00305 deny all from 169.254.0.0/16 to any in via $pif #DHCP auto-config $cmd 00306 deny all from 192.0.2.0/24 to any in via $pif #reserved for docs $cmd 00307 deny all from 204.152.64.0/23 to any in via $pif #Sun cluster interconnect $cmd 00308 deny all from 224.0.0.0/3 to any in via $pif #Class D & E multicast # Deny public pings $cmd 00310 deny icmp from any to any in via $pif # Deny ident $cmd 00315 deny tcp from any to any 113 in via $pif # Deny all Netbios service. 137=name, 138=datagram, 139=session # Netbios is MS/Windows sharing services. # Block MS/Windows hosts2 name server requests 81 $cmd 00320 deny tcp from any to any 137 in via $pif $cmd 00321 deny tcp from any to any 138 in via $pif $cmd 00322 deny tcp from any to any 139 in via $pif $cmd 00323 deny tcp from any to any 81 in via $pif # Deny any late arriving packets $cmd 00330 deny all from any to any frag in via $pif # Deny ACK packets that did not match the dynamic rule table $cmd 00332 deny tcp from any to any established in via $pif # Allow traffic in from ISP's DHCP server. This rule must contain # the IP address of your ISP.s DHCP server as it.s the only # authorized source to send this packet type. # Only necessary for cable or DSL configurations. # This rule is not needed for .user ppp. type connection to # the public Internet. This is the same IP address you captured # and used in the outbound section. #$cmd 00360 allow udp from any to x.x.x.x 67 in via $pif keep-state # Allow in standard www function because I have apache server $cmd 00400 allow tcp from any to me 80 in via $pif setup limit src-addr 2 # Allow in secure FTP, Telnet, and SCP from public Internet $cmd 00410 allow tcp from any to me 22 in via $pif setup limit src-addr 2 # Allow in non-secure Telnet session from public Internet # labeled non-secure because ID & PW are passed over public # Internet as clear text. # Delete this sample group if you do not have telnet server enabled. $cmd 00420 allow tcp from any to me 23 in via $pif setup limit src-addr 2 # Reject & Log all incoming connections from the outside $cmd 00499 deny log all from any to any in via $pif # Everything else is denied by default # deny and log all packets that fell through to see what they are $cmd 00999 deny log all from any to any ################ End of IPFW rules file ############################### An Example <acronym>NAT</acronym> and Stateful Ruleset NAT and IPFW There are some additional configuration statements that need to be enabled to activate the NAT function of IPFW. The kernel source needs 'option divert' statement added to the other IPFIREWALL statements compiled into a custom kernel. In addition to the normal IPFW options in /etc/rc.conf, the following are needed. natd_enable="YES" # Enable NATD function natd_interface="rl0" # interface name of public Internet NIC natd_flags="-dynamic -m" # -m = preserve port numbers if possible Utilizing stateful rules with divert natd rule (Network Address Translation) greatly complicates the rule set coding logic. The positioning of the check-state, and 'divert natd' rules in the rule set becomes very critical. This is no longer a simple fall-through logic flow. A new action type is used, called 'skipto'. To use the skipto command it is mandatory that you number each rule so you know exactly where the skipto rule number is you are really jumping to. The following is an uncommented example of one coding method, selected here to explain the sequence of the packet flow through the rule sets. The processing flow starts with the first rule from the top of the rule file and progress one rule at a time deeper into the file until the end is reach or the packet being tested to the selection criteria matches and the packet is released out of the firewall. It is important to take notice of the location of rule numbers 100 101, 450, 500, and 510. These rules control the translation of the outbound and inbound packets so their entries in the keep-state dynamic table always register the private LAN IP address. Next notice that all the allow and deny rules specified the direction the packet is going (IE outbound or inbound) and the interface. Also notice that all the start outbound session requests all skipto rule 500 for the network address translation. Lets say a LAN user uses their web browser to get a web page. Web pages use port 80 to communicate over. So the packet enters the firewall, It does not match 100 because it is headed out not in. It passes rule 101 because this is the first packet so it has not been posted to the keep-state dynamic table yet. The packet finally comes to rule 125 a matches. It is outbound through the NIC facing the public Internet. The packet still has it's source IP address as a private LAN IP address. On the match to this rule, two actions take place. The keep-state option will post this rule into the keep-state dynamic rules table and the specified action is executed. The action is part of the info posted to the dynamic table. In this case it is "skipto rule 500". Rule 500 NATs the packet IP address and out it goes. Remember this, this is very important. This packet makes its way to the destination and returns and enters the top of the rule set. This time it does match rule 100 and has it destination IP address mapped back to its corresponding LAN IP address. It then is processed by the check-state rule, it's found in the table as an existing session conversation and released to the LAN. It goes to the LAN PC that sent it and a new packet is sent requesting another segment of the data from the remote server. This time it gets checked by the check-state rule and its outbound entry is found, the associated action, 'skipto 500', is executed. The packet jumps to rule 500 gets NATed and released on it's way out. On the inbound side, everything coming in that is part of an existing session conversation is being automatically handled by the check-state rule and the properly placed divert natd rules. All we have to address is denying all the bad packets and only allowing in the authorized services. Lets say there is a apache server running on the firewall box and we want people on the public Internet to be able to access the local web site. The new inbound start request packet matches rule 100 and its IP address is mapped to LAN IP for the firewall box. The packet is them matched against all the nasty things we want to check for and finally matches against rule 425. On a match two things occur. The packet rule is posted to the keep-state dynamic table but this time any new session requests originating from that source IP address is limited to 2. This defends against DoS attacks of service running on the specified port number. The action is allow so the packet is released to the LAN. On return the check-state rule recognizes the packet as belonging to an existing session conversation sends it to rule 500 for NATing and released to outbound interface. Example Ruleset #1: #!/bin/sh cmd="ipfw -q add" skip="skipto 500" pif=rl0 ks="keep-state" good_tcpo="22,25,37,43,53,80,443,110,119" ipfw -q -f flush $cmd 002 allow all from any to any via xl0 # exclude LAN traffic $cmd 003 allow all from any to any via lo0 # exclude loopback traffic $cmd 100 divert natd ip from any to any in via $pif $cmd 101 check-state # Authorized outbound packets $cmd 120 $skip udp from any to xx.168.240.2 53 out via $pif $ks $cmd 121 $skip udp from any to xx.168.240.5 53 out via $pif $ks $cmd 125 $skip tcp from any to any $good_tcpo out via $pif setup $ks $cmd 130 $skip icmp from any to any out via $pif $ks $cmd 135 $skip udp from any to any 123 out via $pif $ks # Deny all inbound traffic from non-routable reserved address spaces $cmd 300 deny all from 192.168.0.0/16 to any in via $pif #RFC 1918 private IP $cmd 301 deny all from 172.16.0.0/12 to any in via $pif #RFC 1918 private IP $cmd 302 deny all from 10.0.0.0/8 to any in via $pif #RFC 1918 private IP $cmd 303 deny all from 127.0.0.0/8 to any in via $pif #loopback $cmd 304 deny all from 0.0.0.0/8 to any in via $pif #loopback $cmd 305 deny all from 169.254.0.0/16 to any in via $pif #DHCP auto-config $cmd 306 deny all from 192.0.2.0/24 to any in via $pif #reserved for docs $cmd 307 deny all from 204.152.64.0/23 to any in via $pif #Sun cluster $cmd 308 deny all from 224.0.0.0/3 to any in via $pif #Class D & E multicast # Authorized inbound packets $cmd 400 allow udp from xx.70.207.54 to any 68 in $ks $cmd 420 allow tcp from any to me 80 in via $pif setup limit src-addr 1 $cmd 450 deny log ip from any to any # This is skipto location for outbound stateful rules $cmd 500 divert natd ip from any to any out via $pif $cmd 510 allow ip from any to any ######################## end of rules ################## The following is pretty much the same as above, but uses a self documenting coding style full of description comments to help the inexperienced IPFW rule writer to better understand what the rules are doing. Example Ruleset #2: #!/bin/sh ################ Start of IPFW rules file ############################### # Flush out the list before we begin. ipfw -q -f flush # Set rules command prefix cmd="ipfw -q add" skip="skipto 800" pif="rl0" # public interface name of NIC # facing the public Internet ################################################################# # No restrictions on Inside LAN Interface for private network # Change xl0 to your LAN NIC interface name ################################################################# $cmd 005 allow all from any to any via xl0 ################################################################# # No restrictions on Loopback Interface ################################################################# $cmd 010 allow all from any to any via lo0 ################################################################# # check if packet is inbound and nat address if it is ################################################################# $cmd 014 divert natd ip from any to any in via $pif ################################################################# # Allow the packet through if it has previous been added to the # the "dynamic" rules table by a allow keep-state statement. ################################################################# $cmd 015 check-state ################################################################# # Interface facing Public Internet (Outbound Section) # Interrogate session start requests originating from behind the # firewall on the private network or from this gateway server # destine for the public Internet. ################################################################# # Allow out access to my ISP's Domain name server. # x.x.x.x must be the IP address of your ISP's DNS # Dup these lines if your ISP has more than one DNS server # Get the IP addresses from /etc/resolv.conf file $cmd 020 $skip tcp from any to x.x.x.x 53 out via $pif setup keep-state # Allow out access to my ISP's DHCP server for cable/DSL configurations. $cmd 030 $skip udp from any to x.x.x.x 67 out via $pif keep-state # Allow out non-secure standard www function $cmd 040 $skip tcp from any to any 80 out via $pif setup keep-state # Allow out secure www function https over TLS SSL $cmd 050 $skip tcp from any to any 443 out via $pif setup keep-state # Allow out send & get email function $cmd 060 $skip tcp from any to any 25 out via $pif setup keep-state $cmd 061 $skip tcp from any to any 110 out via $pif setup keep-state # Allow out FreeBSD (make install & CVSUP) functions # Basically give user root "GOD" privileges. $cmd 070 $skip tcp from me to any out via $pif setup keep-state uid root # Allow out ping $cmd 080 $skip icmp from any to any out via $pif keep-state # Allow out Time $cmd 090 $skip tcp from any to any 37 out via $pif setup keep-state # Allow out nntp news (i.e. news groups) $cmd 100 $skip tcp from any to any 119 out via $pif setup keep-state # Allow out secure FTP, Telnet, and SCP # This function is using SSH (secure shell) $cmd 110 $skip tcp from any to any 22 out via $pif setup keep-state # Allow out whois $cmd 120 $skip tcp from any to any 43 out via $pif setup keep-state # Allow ntp time server $cmd 130 $skip udp from any to any 123 out via $pif keep-state ################################################################# # Interface facing Public Internet (Inbound Section) # Interrogate packets originating from the public Internet # destine for this gateway server or the private network. ################################################################# # Deny all inbound traffic from non-routable reserved address spaces $cmd 300 deny all from 192.168.0.0/16 to any in via $pif #RFC 1918 private IP $cmd 301 deny all from 172.16.0.0/12 to any in via $pif #RFC 1918 private IP $cmd 302 deny all from 10.0.0.0/8 to any in via $pif #RFC 1918 private IP $cmd 303 deny all from 127.0.0.0/8 to any in via $pif #loopback $cmd 304 deny all from 0.0.0.0/8 to any in via $pif #loopback $cmd 305 deny all from 169.254.0.0/16 to any in via $pif #DHCP auto-config $cmd 306 deny all from 192.0.2.0/24 to any in via $pif #reserved for docs $cmd 307 deny all from 204.152.64.0/23 to any in via $pif #Sun cluster $cmd 308 deny all from 224.0.0.0/3 to any in via $pif #Class D & E multicast -# Deny ident +# ©Úµ´ ident $cmd 315 deny tcp from any to any 113 in via $pif -# Deny all Netbios service. 137=name, 138=datagram, 139=session -# Netbios is MS/Windows sharing services. -# Block MS/Windows hosts2 name server requests 81 +# ©Úµ´©Ò¦³ªº Netbios ªA°È. 137=name, 138=datagram, 139=session +# Netbios ¬O MS/Windows ºô¸ô¤À¨ÉªA°È +# ªý¾×©Ò¦³ªº MS/Windows ¥D¾÷¦WºÙ¦øªA¾¹hosts2 name server requests 81 $cmd 320 deny tcp from any to any 137 in via $pif $cmd 321 deny tcp from any to any 138 in via $pif $cmd 322 deny tcp from any to any 139 in via $pif $cmd 323 deny tcp from any to any 81 in via $pif -# Deny any late arriving packets +# ©Úµ´¥ô¦óªº©µ¿ð¨ì¹F¤§«Ê¥] $cmd 330 deny all from any to any frag in via $pif # Deny ACK packets that did not match the dynamic rule table $cmd 332 deny tcp from any to any established in via $pif # Allow traffic in from ISP's DHCP server. This rule must contain # the IP address of your ISP's DHCP server as it's the only # authorized source to send this packet type. # Only necessary for cable or DSL configurations. # This rule is not needed for 'user ppp' type connection to # the public Internet. This is the same IP address you captured # and used in the outbound section. $cmd 360 allow udp from x.x.x.x to any 68 in via $pif keep-state # Allow in standard www function because I have Apache server $cmd 370 allow tcp from any to me 80 in via $pif setup limit src-addr 2 # Allow in secure FTP, Telnet, and SCP from public Internet $cmd 380 allow tcp from any to me 22 in via $pif setup limit src-addr 2 # Allow in non-secure Telnet session from public Internet # labeled non-secure because ID & PW are passed over public # Internet as clear text. # Delete this sample group if you do not have telnet server enabled. $cmd 390 allow tcp from any to me 23 in via $pif setup limit src-addr 2 # Reject & Log all unauthorized incoming connections from the public Internet $cmd 400 deny log all from any to any in via $pif # Reject & Log all unauthorized out going connections to the public Internet $cmd 450 deny log all from any to any out via $pif # This is skipto location for outbound stateful rules $cmd 800 divert natd ip from any to any out via $pif $cmd 801 allow ip from any to any # Everything else is denied by default # deny and log all packets that fell through to see what they are $cmd 999 deny log all from any to any ################ End of IPFW rules file ############################### diff --git a/zh_TW.Big5/books/handbook/install/chapter.sgml b/zh_TW.Big5/books/handbook/install/chapter.sgml index d69e529b00..874ef49286 100644 --- a/zh_TW.Big5/books/handbook/install/chapter.sgml +++ b/zh_TW.Big5/books/handbook/install/chapter.sgml @@ -1,5523 +1,5488 @@ Jim Mock Restructured, reorganized, and parts rewritten by Randy Pratt The sysinstall walkthrough, screenshots, and general copy by ¦w¸Ë FreeBSD ·§­z installation FreeBSD ´£¨Ñ¤@­Ó²³æ¦n¥Îªº¤å¦r¤¶­±¦w¸Ëµ{¦¡¡A¥s°µ sysinstall¡C ³o¬O FreeBSD ¹w³]¨Ï¥Îªº¦w¸Ëµ{¦¡¡C¨ó¤O¼t°Ó¦pªG·Q¡A¤]¥i¥H§ï¥Î¦Û¤vªº¦w¸Ëµ{¦¡¡C ¥»³¹±N»¡©ú¦p¦ó¨Ï¥Î sysinstall ¨Ó¦w¸Ë FreeBSD¡C Ū§¹³o³¹¡A±z±N¤F¸Ñ¡J ¦p¦ó»s§@ FreeBSD ¦w¸Ë¤ù FreeBSD ¹ïµwºÐªº¨Ï¥Î¤Î°t¸m¡C ¦p¦ó±Ò°Ê sysinstall µ{¦¡¡C ¦b°õ¦æ sysinstall ®É·|°Ýªº¬ÛÃö°ÝÃD¦³­þ¨Ç¡B ³o¨Ç°ÝÃDªº·N«ä¬°¦ó¡B¥H¤Î¸Ó¦p¦ó¦^µª¡C ¦b¶}©l¾\Ū³o³¹¤§«e¡A±z»Ý­n¡J ¾\Ū­n¦w¸Ëªº FreeBSD ª©¥»©Òªþ¤§µwÅé¤ä´©ªí¡A¥H½T©w±zªºµwÅ馳¨S¦³³Q¤ä´©¡C ¤@¯ë¨Ó»¡¡A¦¹¦w¸Ë»¡©ú¬O°w¹ï &i386; (¬Û®eªº PC ¾÷ºØ) ¬[ºcªº¹q¸£¡C ¦pªG¦³¨ä¥L¬[ºc(¤ñ¦p Alpha)ªº¦w¸Ë»¡©ú¡A§Ú­Ì·|¤@¨Ö¦C¥X¡C ÁöµM¥»¤å¥ó·|±`±`§ó·s¡A¦ý¦³¥i¯à»P±z¦w¸Ëª©¥»¤W©Òªþªº»¡©ú¤å¥ó¦³¨Ç³\¥X¤J¡C ¦b¦¹¡A§Ú­Ì«Øij±z§â¥»»¡©ú¤å³¹·í§@¤@¯ëªº¦w¸Ë°Ñ¦Ò­ì«h´N¦n¡C ¦w¸Ë«eªº·Ç³Æ¤u§@ ¦C¥X±z¹q¸£ªºµwÅé²M³æ ¦b¦w¸Ë FreeBSD ¤§«e¡A±zÀ³¸Ó¸ÕµÛ±N±z¹q¸£¤¤ªºµwÅé²M³æ¦C¥X¨Ó¡C FreeBSD ¦w¸Ëµ{¦¡·|±N³o¨ÇµwÅé(µwºÐ¡Bºô¸ô¥d¡B¥úºÐ¾÷µ¥µ¥)¥H«¬¸¹¤Î»s³y¼t°Ó¦C¥X¨Ó¡C FreeBSD ¤]·|¹Á¸Õ¬°³o¨ÇµwÅé§ä¥X³Ì¾A·íªº IRQ ¤Î IO port ªº³]©w¡C ¦ý¬O¦]¬° PC ªºµwÅéºØÃþ¹ê¦b¤Ó¹L½ÆÂø¡A³o­Ó¨BÆJ¤£¤@©w«OÃÒµ´¹ï¦¨¥\¡C ³o®É¡A±z´N¥i¯à»Ý­n¤â°Ê§ó§ï¦³°ÝÃDªº³]©w­È­ù¡C ¦pªG±z¤w¸Ë¤F¨ä¥¦ªº§@·~¨t²Î¡A¦p¡G &windows; ©Î Linux¡A¨º»ò¥i¥ý¥Ñ³o¨Ç¨t²Î©Ò´£¨Ñªº¤u¨ã¡A¨Ó¬d¬Ý³o¨ÇµwÅé³]©w­È¬O«ç»ò³]©wªº¡C ­Y¯uªº¨S¿ìªk½T©w¬Y¨Ç¥d¥Î¤°»ò³]©w­È¡A¨º»ò¥i¥HÀˬd¬Ý¬Ý¥d¤W­±©Ò¼Ð¥ÜªºªF¦è¡A»¡¤£©w¥¦ªº³]©w¤w¦³¼Ð¥Ü¦b¥d¤W¡C ±`¥Îªº IRQ ¸¹½X¬° 3¡B5 ¥H¤Î 7¡F¦Ó IO °ðªº­È³q±`¥H 16 ¶i¦ìªí¥Ü¡A¨Ò¦p 0x330¡C «Øij±z¦b¦w¸Ë FreeBSD ¤§«e¡A§â³o¨Ç¸ê®Æ¦C¦L©Î§Û¿ý¤U¨Ó¡A°µ¦¨ªí®æªº¼Ë¤l¤]³\·|¸û¦³¥Î³á¡A¨Ò¦p¡G µwÅé²M³æ(Á|¨Ò) µwÅé¦WºÙ IRQ IO port(s) ³Æµù ²Ä¤@Áû IDE µwºÐ N/A N/A 40 GB¡ASeagate »s³y¡Afirst IDE master CDROM N/A N/A First IDE slave ²Ä¤GÁûµwºÐ N/A N/A 20 GB¡AIBM »s³y¡A second IDE master ²Ä¤@­Ó IDE controller 14 0x1f0 ºô¸ô¥d N/A N/A &intel; 10/100 ¼Æ¾Ú¾÷ N/A N/A &tm.3com; 56K faxmodem¡A±µ¦b COM1
³Æ¥÷±zªº¸ê®Æ ¦pªG­n¸Ëªº¹q¸£¤W­±¦s¦³­«­n¸ê®Æ¡A¨º»ò¦b¦w¸Ë FreeBSD «e¡A ½Ð½T©w±z¤w¸g±N³o¨Ç¸ê®Æ³Æ¥÷¤F¡A¨Ã¥B¥ý´ú¸Õ¹L³o¨Ç³Æ¥÷ÀɬO§_¨S¦³°ÝÃD¡C FreeBSD ¦w¸Ëµ{¦¡¦b­n¼g¤J¥ô¦ó¸ê®Æ¨ì±zªºµwºÐ«e¡A³£·|¥ý´£¿ô±z½T»{¡A ¤@¥¹±z½T©w­n¼g¤J¡A¨º»ò¤§«á´N¦A¤]¨S¦³¤Ï®¬ªº¾÷·|Åo¡C ¨M©w­n±N FreeBSD ¦w¸Ë¨ì­þ¸Ì ¦pªG±z·QÅý FreeBSD ª½±µ¨Ï¥Î¾ãÁûµwºÐ¡A¨º»ò½Ðª½±µ¸õ¨ì¤U¤@¸`¡C µM¦Ó¡A¦pªG±z·Q­n FreeBSD ¸ò¬J¦³ªº¨t²Î¨Ã¦s¡A¨º»ò¡A±z¥²¶·¹ïµwºÐªº¸ê®Æ¤À§G¤è¦¡¦³²`¤Jªº¤F¸Ñ¡A ¥H¤Î¨ä©Ò³y¦¨ªº¼vÅT¡C &i386; ¬[ºcªºµwºÐ°t¸m¼Ò¦¡ PC ¤WªºµwºÐ¥i¥H³Q²Ó¤À¬°³\¦h¤À´²ªº°Ï°ì¡C³o¨Ç°Ï°ì¥s°µ ¤À³Î°Ï(Partitions)¡C ¦]¬°³]­pªº¤è¦¡¡A¨C­ÓµwºÐ³Ì¦h¥i¥H¦³ 4 ­Ó¤À³Î°Ï¡A¦Ó³o¨Ç¤À³Î¥s°µ ¥D­n¤À³Î°Ï(Primary Partitions)¡C ¬°¤F¬ð¯}³o­Ó­­¨î¡A¥H«K¯à¨Ï¥Î§ó¦hªº¤À³Î°Ï¡A´N¦³¤F·sªº¤À³Î°ÏÃþ«¬¡A¥s§@¡G ©µ¦ù¤À³Î°Ï(Extended Partition)¡C ¨C­ÓµwºÐ´N¥u¯à¦³¤@­Ó©µ¦ù¤À³Î°Ï¡CµM¦Ó¡A¦b©µ¦ù¤À³Î°Ï¸Ì­±¥i¥H«Ø¥ß³\¦h­Ó¯S®í¤À³Î°Ï¡A¥s§@ ÅÞ¿è¤À³Î°Ï(Logical Partitions)¡C ¨CºØ¤À³Î°Ï³£¦³¨ä ¤À³Î°Ï¥N¸¹(Partition ID) ¥Î¥H°Ï§O¨CºØ¤À³Î°Ïªº¸ê®ÆÃþ«¬¡C¦Ó FreeBSD ¤À³Î°Ï¥N¸¹¬O 165¡C ¤@¯ë¨ÓÁ¿¡A¨CºØ§@·~¨t²Î³£·|¦³¦Û¤v¿W¯Sªº¤è¦¡¨Ó°Ï§O¤À³Î°Ï¡CÁ|¨Ò¡G DOS ¤Î¨ä¤§«áªº§@·~¨t²Î¡A¤ñ¦p &windows; ¡A·|¤À°tµ¹¨C­Ó¥D­n¤À³Î°Ï¤ÎÅÞ¿è¤À³Î°Ï 1 ­Ó ºÏºÐ¥N¸¹(drive letter)¡A±q C: ¶}©l¡C FreeBSD ¥²¶·¦w¸Ë¦b¥D­n¤À³Î°Ï¡CFreeBSD ¥i¥H¦b³o­Ó¤À³Î°Ï¤W­±¦s©ñ¸ê®Æ©Î¬O±z«Ø¥ßªº¥ô¦óÀɮסC µM¦Ó¡A¦pªG±z¦³«Ü¦hÁûµwºÐ¡A¤]¥i¥H¦b³o¨Ç(©Î³¡¥÷)µwºÐ«Ø¥ß FreeBSD ¤À³Î°Ï¡C ¦w¸Ë FreeBSD ªº®É­Ô¡A¥²¶·¦Ü¤Ö­n¦³ 1 ­Ó¤À³Î°Ïµ¹ FreeBSD ¨Ï¥Î¡A ³o­Ó¤À³Î°Ï¥i¥H¬O©|¥¼¨Ï¥Îªº¤À³Î°Ï¡A©Î¬O²{¦sªº¤À³Î°Ï¡C(¦ý¤W­±ªº¸ê®Æ¤£¥´ºâÄ~Äò¨Ï¥Î) ¦pªG±z¤w¸g¥Î§¹¤F±zºÏºÐ¤W©Ò¦³ªº¤À³Î°Ï¡A¨º»ò±z¥²¶·¨Ï¥Î¨ä¥L§@·~¨t²Î©Ò´£¨Ñªº¤u¨ã (¹³¬O DOS or &windows; ¤Wªº fdisk)¨ÓÄË¥X¤@­Ó¤À³Î°Ïµ¹ FreeBSD ¥Î¡C ¦pªG¦³¦h¾lªº¤À³Î°Ï¡A¤]¥i¥H¨Ï¥Î¥¦¡C¦ý¨Ï¥Î«e¡A±z¥i¯à»Ý­n¥ý¾ã²z¤@¤U³o¨Ç¤À³Î°Ï¡C FreeBSD³Ì¤p¦w¸Ë»Ý­n¬ù 100 MB ªºªÅ¶¡¡A¦ý¬O³o¥u¬O¡y³Ì¤p¦w¸Ë¡z¡A ´X¥G¨S³Ñ¤U¦h¤ÖªÅ¶¡¨Ó¦s©ñ±z¦Û¤vªºÀɮסC ¸û²z·Qªº(¤£§t¹Ï§Î¤¶­±)³Ì¤p¦w¸Ë¬O¬ù 250 MB¡A©ÎªÌ¬O 350 MB ¥ª¥k(¥]§t¹Ï§Î¤¶­±)¡C Áٻݭn¦w¸Ë¨ä¥Lªº®M¥ó³nÅé¡A¨º»ò±N»Ý­n§ó¦hªºµwºÐªÅ¶¡¡C ±z¥i¥H¨Ï¥Î°Ó·~³nÅé¡A¨Ò¦p &partitionmagic; ¨Ó­«·s½Õ¾ã¤À³Î°ÏªÅ¶¡¡A¨Óµ¹ FreeBSD ¥ÎªºªÅ¶¡¡CFreeBSD ¥úºÐ¡BFTP ¤W­±ªº tools ¥Ø¿ý¥]§t¨â­Ó§K¶Oªº¤u¨ã¡A¤]¥i¥H¹F¦¨³o­Ó¤u§@¡A¥s§@¡G FIPS ¤Î PResizer¡C³o¨Ç¤u¨ãªº»¡©ú¤å¥ó¥i¥H¦b¦P­Ó¥Ø¿ý¤º§ä¨ì¡C FIPS, PResizer ©M &partitionmagic; ¥i¥H­«·s½Õ¾ã¦b &ms-dos; ¨ì &windows; ME ©Ò¨Ï¥Îªº FAT16 ¤Î FAT32 ¤À³Î°Ï¤j¤p¡C¥t¥~¡A &partitionmagic; «h¬O¤W­z³nÅ餤°ß¤@¥i¥H­«·s½Õ¾ã NTFS ¤À³Î°Ï¤j¤p¡C ¤£·íªº¨Ï¥Î³o¨Ç¤u¨ã¡A¥i¯à·|§R°£©Ò¦³µwºÐ¤Wªº¸ê®Æ¡C ¦b¨Ï¥Î³o¨Ç¤u¨ã«e¡A½Ð½T©w±z¤w¦³¥ý³Æ¥÷¦n¸ê®Æ¡C ¨Ï¥Î²{¦³ªº¤À³Î°Ï °²³]±z¥u¦³¤@­Ó 4 GB ªºµwºÐ¡A¦Ó¥B¤w¸g¸Ë¤F &windows; ¡AµM«á±N³oÁûµwºÐ¤À¦¨¨â­ÓºÏºÐ¥N¸¹¡GC: ¤Î D:¡A¨C­Ó¤j¤p¬° 2 GB ¡C C: ¼Ñ¤W©ñ¤F 1 GB ªº¸ê®Æ¡A¦Ó D: ¼Ñ¤W©ñ¤F 0.5 GB ªº¸ê®Æ¡C ³oªí¥ÜµwºÐ¤W¦³¨â­Ó¤À³Î°Ï¡A¨C­ÓºÏºÐ¥N¸¹¼Ñ³£¬O¤À³Î°Ï¡C±z¥i¥H§â©Ò¦³©ñ¦b D: ªº¸ê®Æ¡A³£²¾°Ê¨ì C: ¡A³o¼Ë´NªÅ¥X¤F²Ä¤G­Ó¤À³Î°Ï¥i¥Hµ¹ FreeBSD ¨Ï¥Î¡C ÁY´î²{¦³ªº¤À³Î°Ï °²³]±z¥u¦³¤@­Ó 4 GB µwºÐ¡A¦Ó¥B¤w¸g¸Ë¤F &windows; ¡C¦b¦w¸Ë &windows; ®É§â 4 GB ³£µ¹ C: ¼Ñ¡A¨Ã¥B²{¦b¤w¸g¥Î¤F 1.5 GB ªÅ¶¡¡A¦Ó§A·Q±N³Ñ¤UªÅ¶¡ªº 2 GB µ¹ FreeBSD ¨Ï¥Î¡C ¦p¦¹¤@¨Ó¡A¬°¤F¸Ë FreeBSD ¡A§A¥²¶·¦b¥H¤U¨âºØ¤è¦¡¤G¿ï¤@¡G ³Æ¥÷ &windows; ¸ê®Æ¡AµM«á­«¸Ë &windows;¡A¨Ã¦b¦w¸Ë &windows; ®Éµ¹ 2 GB ªº¤À³ÎªÅ¶¡¡C ¨Ï¥Î¤W­zªº¤u¨ã¡A¹³¬O &partitionmagic;¡A¨Ó­«·s½Õ¾ã &windows; ©Ò¥Îªº¤À³Î°Ï¤j¤p¡C Alpha ¬[ºcªººÏºÐ°t¸m¼Ò¦¡ Alpha ¦b Alpha ¤W¡A±z¥²¶·¨Ï¥Î¤@¾ãÁûµwºÐµ¹ FreeBSD ¡A¨S¦³¿ìªk¦b¦PÁûµwºÐ¤W¸ò¨ä¥L§@·~¨t²Î¦@¦s¡C®Ú¾Ú¤£¦P«¬¸¹ªº Alpha ¾÷¾¹¡A±zªºµwºÐ¥i¥H¬O SCSI ©Î IDE µwºÐ¡A¥u­n±zªº¾÷¾¹¥i¥H±q³o¨ÇµwºÐ¶}¾÷´N¥i¥H¡C «ö·Ó Digital / Compaq ¨Ï¥Î¤â¥Uªº½s±Æ­·®æ¡A©Ò¦³ SRM ¿é¤Jªº³¡¤À³£¥Î¤j¼gªí¥Ü¡C ª`·N¡ASRM ¤j¤p¼g¦³§O¡C ­n±oª¾±zºÏºÐªº¦WºÙ¥H¤Î«¬¸¹¡A¥i¥H¦b SRM console ´£¥Ü¤U¨Ï¥Î SHOW DEVICE ©R¥O¡G >>>SHOW DEVICE dka0.0.0.4.0 DKA0 TOSHIBA CD-ROM XM-57 3476 dkc0.0.0.1009.0 DKC0 RZ1BB-BS 0658 dkc100.1.0.1009.0 DKC100 SEAGATE ST34501W 0015 dva0.0.0.0.1 DVA0 ewa0.0.0.3.0 EWA0 00-00-F8-75-6D-01 pkc0.7.0.1009.0 PKC0 SCSI Bus ID 7 5.27 pqa0.0.0.4.0 PQA0 PCI EIDE pqb0.0.1.4.0 PQB0 PCI EIDE ¨Ò¤l¤¤¾÷¾¹¬° Digital Personal Workstation 433au ¨Ã¥BÅã¥Ü¥X¦¹¾÷¾¹¦³³s±µ¤T­ÓºÏºÐ¾÷¡C²Ä¤@­Ó¬O CDROM¡A¥s°µ DKA0 ¡F¥t¥~¨â­Ó¬OºÏºÐ¾÷¡A ¤À§O¥s°µ¡G DKC0 ¤Î DKC100 ¡C ºÏºÐ¾÷ªº¦WºÙ¤¤¦³ DKx ¦r¼Ëªº¬O SCSI µwºÐ¡C¨Ò¦p¡G DKA100 ªí¥Ü¬O SCSI µwºÐ¡A¨ä SCSI ID ¬° 1¡A ¦ì¦b²Ä¤@­Ó SCSI ¶×¬y±Æ(A)¡F ¦Ó DKC300 ªí¥Ü¬O SCSI µwºÐ¡A¨ä SCSI ID ¬° 3 ¡A¦ì©ó²Ä¤T­Ó SCSI ¶×¬y±Æ(C)¡C¸Ë¸m¦WºÙ PKx ªí¥Ü SCSI ±±¨î¥d¡C¥Ñ¤W­z SHOW DEVICE ªºµ²ªG¬Ý¨Ó¡A SCSI ¥úºÐ¾÷¤]³Qµø¬°¬O SCSI µwºÐªº¤@ºØ¡C ­Y¬° IDE µwºÐªº¸Ü¡A¦WºÙ·|¦³ DQx ¦r¼Ë¡A¦Ó PQx «hªí¥Ü¬Û¹ïÀ³ªº IDE ºÏºÐ±±¨î¾¹¡C ¾ã²z§Aªººô¸ô³]©w¸ê®Æ ¦pªG·Q³z¹Lºô¸ô( FTP ¯¸©Î NFS)¦w¸Ë FreeBSD¡A¨º»ò´N¥²¶·ª¾¹D±zªººô¸ô²ÕºA¡C ¦b¦w¸Ë FreeBSD ªº¹Lµ{¤¤±N·|´£¥Ü±z¿é¤J³o¨Ç¸ê°T¡A¥H¶¶§Q§¹¦¨¦w¸Ë¹Lµ{¡C ¨Ï¥Î¤A¤Óºô¸ô(Ethernet)©Î Cable/DSL ¼Æ¾Ú¾÷¤Wºô ­Y¨Ï¥Î¤A¤Óºô¸ô¡A©Î¬O­n³z¹L Cable/DSL ¼Æ¾Ú¾÷¤Wºô¡A¨º»ò±z¥²¶··Ç³Æ ¤U­±ªº¸ê°T¡G IP ¦ì§} ¹w³] Gateway(¹h¹D) ªº IP ¦ì§} Hostname(¾÷¾¹¦WºÙ) DNS ¦øªA¾¹ªº IP ¦ì§} Subnet Mask ­Y¤£ª¾¹D³o¨Ç¸ê°T¡A±z¥i¥H¸ß°Ý¨t²ÎºÞ²zªÌ©Î¬O±zªº ISP ·~ªÌ¡C ¥L­Ì¥i¯à·|»¡³o¨Ç¸ê°T·|¥Ñ DHCP ¦Û°Ê«ü¬£¡F¦pªG¬O³o¼Ëªº¸Ü¡A ½Ð°O¦í³o¤@ÂI´N¥i¥H¤F¡C ¨Ï¥Î¼Æ¾Ú¾÷¤Wºô ­Y¥Ñ¤@¯ëªº¼Æ¾Ú¾÷¼·±µ¤Wºô¡A±z¤´µM¥i¥H¦w¸Ë FreeBSD¡A¥u¬O·|»Ý­n«Üªøªº®É¶¡¡C ±z¥²¶·ª¾¹D¡G ¼·±µ¨ì ISP ªº¹q¸Ü¸¹½X¡C ±zªº¼Æ¾Ú¾÷¬O³s¨ì­þ­Ó COM °ð¡C ±z¼·±µ¨ì ISP ©Ò¥Îªº±b¸¹¸ò±K½X¡C ¬d¾\ FreeBSD °É»~ªí(Errata) ÁöµM§Ú­ÌºÉ¤O¨Ï±o¨C­Ó FreeBSD µo¦æª©¥»³£«Üí©w¡A¦ý¬O¹Lµ{¤¤¤´µM¤£§K¦³®É·|µo¥Í¿ù»~¡C ¦b«Ü¨u¨£ªº±¡§Î¤U¡A³o¨Ç¿ù»~·|¼vÅT¨ì¦w¸Ëªº¹Lµ{¡C·íµo²{³o¨Ç¿ù»~¥B­×¥¿«á¡A·|±N¥¦­Ì¦C¦b FreeBSD °É»~ªí(Errata) ¤¤¡C¦b±z¦w¸Ë FreeBSD «e¡AÀ³¸Ó¥ý¬Ý¬Ý°É»~ªí¤¤¦³¨S¦³¤°»ò°ÝÃD·|¼vÅT¨ì±zªº¦w¸Ë¡C Ãö©ó©Ò¦³µo¦æª©¥»ªº¸ê°T¡A¥]¬A°É»~ªí¡A¥i¥H¦b FreeBSD ºô¯¸ ªº µo¦æ±¡³ø(release information) §ä¨ì¡C ·Ç³Æ¦n FreeBSD ¦w¸ËÀÉ®× FreeBSD ¥i¥H³z¹L¤U­±¥ô¦ó¤@ºØ¦w¸Ë¨Ó·½¶i¦æ¦w¸Ë¡J Local Media CDROM ©Î DVD ²{¦³ªº DOS ¤À³Î°Ï SCSI ©Î QIC ºÏ±a¡C ³nºÐºÏ¤ù Network FTP ¯¸¡B¤ä´© Passvie ¼Ò¦¡ªº FTP ¯¸(­Y±z¾÷¾¹¦b NAT ¤º)¡B¬Æ¦Ü HTTP proxy ³£¥i¥H¡C NFS ¦øªA¾¹ ±M¥Î(dedicated)ªº parallel ©Î serial ³s½u ­Y¤w¸g¦³ FreeBSD ªº CD ©Î DVD¡A¦ý¾÷¾¹¤£¤ä´©±q¥úºÐ¶}¾÷ªº¸Ü¡A¨º»ò½Ðª½±µ¶i¤U¤@¸` ()¡C ­Y¨S¦³ FreeBSD ¦w¸Ë¤ùªº¸Ü¡A¨º»ò½Ð¥ý¬Ý ³o¸Ì·|¤¶²Ð¦p¦ó·Ç³Æ©Ò»Ý­nªº¦w¸Ë¤ù¡A·Ó¸Ó¸`¨BÆJ§Ë¦n«á¡A´N¥i¥HÄ~Äò¤U¤@¨B ¡C ·Ç³Æ¦n¶}¾÷ºÏ¤ù FreeBSD ¦w¸Ë¬yµ{¬O­n±q¹q¸£¶}¾÷«á¡A¶i¤J FreeBSD ¦w¸Ëµe­± ¡X¡X ¦Ó¤£¬O¦b¨ä¥L§@·~¨t²Î¤W°õ¦æµ{¦¡¡C ¤@¯ë¨ÓÁ¿¡A¹q¸£³£¬O¥Î¸Ë¦bµwºÐ¤Wªº§@·~¨t²Î¨Ó¶}¾÷¡A¤]¥i¥H¥Î¶}¾÷ºÏ¤ù¨Ó¶}¾÷¡F ¦¹¥~¡A²{¦b¤j¦h¼Æ¹q¸£³£¥i¥H±q¥úºÐ¶}¾÷¡C ¦pªG±z¦³ FreeBSD ªº CDROM ©Î DVD(µL½×¬O¥Î¶Rªº©Î¬O¦Û¤v¿N¿ýªº)¡A ¥B±zªº¹q¸£¥i¤ä´©¥Ñ¥úºÐ¶}¾÷¡A (³q±`¦b BIOS ¤¤·|¦³ Boot Order ©ÎÃþ¦ü¿ï¶µ)¡A¨º»ò±z´N¥i¥H¸õ¹L¦¹¤p¸`¡C¦]¬° FreeBSD CDROM ©Î DVD ³£¥i¥H¥Î¨Ó¶}¾÷¡C ½Ð«ö·Ó¤U­±¨BÆJ¡A¥H»s§@¶}¾÷¤ù¡G ¨ú±o¶}¾÷¤ùªº¬M¹³ÀÉ(images) ¶}¾÷ºÏ¤ù¥Îªº¬M¹³ÀÉ(images)³q±`·|©ñ¦b¥úºÐ¤ù¤Wªº floppies/ ¥Ø¿ý¤º¡A¥t¥~¤]¥i¥H±q¹³¬O¤U­± FTP ¯¸ªº floppies ¥Ø¿ý¤U¸ü¡G ftp://ftp.FreeBSD.org/pub/FreeBSD/releases/<arch>/<version>-RELEASE/floppies/ ¡C½Ð±N¡yarch¡z¡B¡yversion¡z´À´«¬°¥´ºâ¦w¸Ëªº¹q¸£¬[ºc¡BOS ª©¥»¡C¨Ò¦p¡G­n¸Ëªº¹q¸£ÄÝ &i386 ¬[ºc¡A¦Ó­n¸Ëªº¬O &os; &rel.current;-RELEASE ¡A¨º»ò¥i¥H¨ì ¤U¸ü¡C ¬M¹³ÀÉ(images)ªºªþÀɦW³£¬O .flp ¡C¦Ó floppies/ ¥Ø¿ý¤º¥]§t¤@¨Ç¤£¦P¥Î³~ªº¬M¹³ÀÉ(images)¡A³o¨ú¨M©ó±z­n¸Ëªº FreeBSD ª©¥»¡B»Ý¨D¡BµwÅé°t³Æ¬°¦ó¡C ­Y­n¸Ëªº¬O FreeBSD 4.X ¨º»ò³q±`¥u»Ý­n 2 ­Ó¬M¹³ÀÉ¡A¤]´N¬O kern.flp »P mfsroot.flp¡C¦Ó­Y­n¸Ëªº¬O FreeBSD 5.X ¡A¨º»ò³q±`­n 3 ­Ó¬M¹³ÀÉ¡A¤]´N¬O¡G boot.flp¡B kern1.flp¡B kern2.flp¡C­Y¦³ºÃ°Ýªº¸Ü¡A½Ð½¾\¦P¤@¥Ø¿ý¤Uªº README.TXT ¤å¥óÀÉ¡A¥HÁA¸Ñ¬ÛÃö³Ì·sª`·N¨Æ¶µ¡C ¦w¸Ë &os; 5.3 ¤§«eªº 5.X ¨t²Î®É¡A¦³¨ÇµwÅé³]³Æ¥i¯à»Ý­nÃB¥~ªºÅX°Êµ{¦¡¤~¯à¨Ï¥Î¡C ³o¨ÇÅX°Êµ{¦¡³£·|©ñ¦b drivers.flp ³o­Ó¬M¹³Àɤº¡C ¦b¨Ï¥Î FTP ¤U¸ü®É¡A¥²¶·¨Ï¥Î binary ¼Ò¦¡ ¶i¦æ¶Ç¿é¡C¦³¨ÇÂsÄý¾¹¹w³]¬O¥H text (©Î ASCII) ¼Ò¦¡¨Ó¶Ç¿é¸ê®Æ¡A©Ò¥H³o¨Ç¿ù»~¶Ç¿é¼Ò¦¡¤U¸üªº¬M¹³ÀÉ©Ò°µ¦¨ªººÏ¤ù¡A·|µLªk¨Ï¥Î¡C ·Ç³Æ¶}¾÷ºÏ¤ù ¨C­Ó¬M¹³Àɳ£»Ý­n¤@±iºÏ¤ù¡A¨Ã¥B½ÐÁקK¨Ï¥Î¨ìÃaªººÏ¤ù¡C³Ì²³æªºÀË´ú¤è¦¡´N¬O¦Û¤v¥ý§â³o¨ÇºÏ¤ù¦A­«·s®æ¦¡¤Æ(format) ¦Ó¤£­n¬Û«H©Ò¿×ªº¤w®æ¦¡¤ÆªººÏ¤ù¡A&windows; ¤ºªº format ¦b®æ¦¡¤Æ®É¡A¨Ã¤£·|§i¶D§A¬O§_¦³Ãa­y¡A¦Ó¥u·|ª½±µ±N¥¦­Ì¼Ð¥ÜÃa­y¦Ó¤£¨Ï¥ÎÃa­y³¡¤À¦Ó¤w¡C ¦¹¥~¡A«Øij±Ä¥Î¥þ·sªººÏ¤ù¨Ó»s§@¦w¸Ë¤ù¤ñ¸û«OÀI¡C ­Y¦b¦w¸Ë FreeBSD ªº¹Lµ{¤¤µo¥Í·í¾÷¡Bµe­±­áµ²©Î¬O¨ä¥L©Ç²§ªº²{¶H¡A­º¥ý­nÃhºÃªº´N¬O¶}¾÷ºÏ¤ù¬O§_Ãa±¼¡C ½Ð¥Î¨ä¥LªººÏ¤ù»s§@¬M¹³ÀɦA¸Õ¸Õ¬Ý¡C ±N¬M¹³ÀÉ(images)¼g¤J¨ìºÏ¤ù¤º .flp ÀɨëD¤@¯ëÀɮסA¤£¯àª½±µ§â¥¦½Æ»s¨ìºÏ¤ù¤W¡C ¨Æ¹ê¤W¥¦¬O¥]§t¾ã±iºÏ¤ù©Ò¦³¤º®eªº¬M¹³ÀÉ(image)¡C¤]´N¬O»¡¡A¤£¯à¯Âºé½Æ»sÀɮרìºÏ¤ù¤W¡A ¦Ó¥²¶·¨Ï¥Î¯S§Oªº¤u¨ãµ{¦¡¡A¨Ó±N¬M¹³Àɪ½±µ¼g¨ìºÏ¤ù¤W¡C DOS ­Y­n¥Î &ms-dos;/&windows; ¨Ó§@¦w¸Ë¤ùªº¸Ü¡A¨º»ò¥i¥H¥Î fdimage ¤u¨ãµ{¦¡¨Ó±N¬M¹³ÀÉ¡A¼g¨ìºÏ¤ù¤W¡C ­Y±z¥Îªº¬O FreeBSD ¥úºÐªº¸Ü(°²³]¥úºÐ¾÷¥N¸¹¬° E: ¡A¨º»ò½Ð°õ¦æÃþ¦ü¤U­±ªº«ü¥O¡G E:\> tools\fdimage floppies\kern.flp A: ½Ð°w¹ï¨C­Ó»Ý­n¥Î¨ìªº .flp ¬M¹³ÀÉ¡A­«½Æ¤W­zªº«ü¥O(°O±o§ó§ï¬ÛÃöÀɦW)¡A¨C¦¸ªº¬M¹³Àɧ¹¦¨«á¡A ³£»Ý­n´«¥t¥~¤@¤ù¨Ó¸Ë·sªº¬M¹³ÀÉ¡F½Ð°O±o¡A¦b§@¦nªººÏ¤ù¤Wµù©ú¬O¨Ï¥Î­þ­Ó¬M¹³Àɧ@ªº¡C­Y .flp ¬M¹³ÀÉ©ñ¦b¤£¦P¦a¤è¡A½Ð¦Û¦æ­×§ï¤W­z«ü¥O¡C­Y¨S¦³ FreeBSD ¥úºÐªº¸Ü¡A¥i¥H¨ì FTP ¤W­±ªº tools ¥Ø¿ý ¤U¸ü fdimage ¨Ï¥Î¡C ¦pªG­n¥Î &unix; ¨t²Î(¤ñ¦p¨ä¥L¥x FreeBSD ¾÷¾¹)¨Ó»s§@¶}¾÷¤ùªº¸Ü¡A¥i¥H¥Î &man.dd.1; «ü¥O¨Ó§â¬M¹³Àɪ½±µ¼g¤J¨ìºÏ¤ù¤W¡C¦b FreeBSD¤Wªº¸Ü¡A¥i¥H¥´Ãþ¦ü¤U­±ªº«ü¥O¡G &prompt.root; dd if=kern.flp of=/dev/fd0 ¦b FreeBSD ¤¤¡A/dev/fd0 ´N¬O«ü²Ä¤@¥x³nºÐ¾÷(§Y¤@¯ë &ms-dos;/&windows; ¤Wªº A: ºÏºÐ¾÷)¡F¦Ó /dev/fd1 «ü B: ºÏºÐ¾÷¡A¨ä¾lªº¨Ì¦¹Ãþ±À¡C¤£¹L¨ä¥Lªº &unix; ¨t²Î¥i¯à·|¥Î¤£¦Pªº¦WºÙ¡A³o®É´N­n¬d¾\¸Ó¨t²Îªº»¡©ú¤å¥ó¤F¡C ²{¦b°_¡A§Ú­Ì¥i¥H¶}©l¦w¸Ë FreeBSD Åo¡I
¶}©l¦w¸Ë ¹w³]ªº±¡ªp¤U¡A¦w¸Ë¹Lµ{¨Ã¤£·|§ïÅܱzºÏºÐ¾÷¤¤ªº¥ô¦ó¸ê®Æ¡A°£«D±z¬Ý¨ì¤U­±ªº°T®§¡G Last Chance: Are you SURE you want continue the installation? If you're running this on a disk with data you wish to save then WE STRONGLY ENCOURAGE YOU TO MAKE PROPER BACKUPS before proceeding! We can take no responsibility for lost disk contents! ¦b¬Ý¨ì³o³Ì«áªºÄµ§i°T®§«e¡A±z³£¥i¥HÀH®ÉÂ÷¶}¦w¸Ëµ{¦¡¦Ó¤£·|Åܧó±zªºµwºÐ¡C ¦pªG±zµo²{¦³¥ô¦ó³]©w¿ù»~¡A³o®É±z¥i¥Hª½±µ±N¹q·½Ãö±¼¦Ó¤£·|³y¦¨¥ô¦ó¶Ë®`¡C ¶}¾÷±Ò°Ê¬yµ{½g &i386; ¥­¥xªº¶}¾÷¬yµ{ ¦b¤@¶}©l¡A¹q¸£¹q·½¶}Ãö¬OÃö³¬ªº¡C ¥´¶}¹q¸£¹q·½¶}Ãö¡C­è¶}©lªº®É­Ô¡A¥¦À³¸Ó·|Åã¥Ü¶i¤J¨t²Î³]©w¿ï³æ©Î BIOS ­n«ö­þ­ÓÁä¡A±`¨£ªº¦³¡G F2, F10, Del ©Î Alt S ¡C(«öÁä½Ð¨Ì¾Ú¹ê»Ú±¡ªp¨M©w)¤£½×¬O­n«ö­þ­ÓÁä¡A½Ð«ö¥¦¶i¤J BIOS ³]©wµe­±¡C¦³®É±zªº¹q¸£¥i¯à·|Åã¥Ü¤@­Ó¹Ï§Îµe­±¡A³q±`°µªk¬O«ö Esc Áä±NÂ÷¶}³o­Ó¹Ï§Îµe­±¡A¥H¨Ï±z¯à°÷¬Ý¨ì¥²­nªº³]©w°T®§¡C §ä¥X¥i¥H³]©w¡y¶}¾÷¶¶§Ç(Boot Order)¡zªº¿ï¶µ¡A³q±`¸Ó¿ï¶µ·|¦C¥X¤@¨Ç³]³ÆÅý±z¿ï¾Ü¡A¨Ò¦p¡J Floppy, CDROM, First Hard Disk µ¥µ¥¡C ¦pªG­n¥Î³nºÐ¦w¸Ë¡A½Ð½T©w floppy disk ­n¦C¬°¶}¾÷¶¶§Çªº²Ä¤@­Ó¡F­Y­n¥Î¥úºÐ¦w¸Ë¡A°O±o CDROM ­n¦C¬°¶}¾÷¶¶§Çªº²Ä¤@­Ó¡C¬°¤FÁקKºÃ´b¡A½Ð°Ñ¦Ò¾÷¾¹¡B¥D¾÷ªO»¡©ú¤â¥U¡C Àx¦s³]©w¨ÃÂ÷¶}¡A¨t²ÎÀ³¸Ó·|­«·s±Ò°Ê¡C - ¥ÎºÏ¤ù¦w¸Ë¡A½Ð§â¦b + ­Y­n¥ÎºÏ¤ù¦w¸Ë¡A½Ð§â¦b ¤@¸`¤¤»s§@¦nªº kern.flp ¨º±i¦w¸ËºÏ¤ù©ñ¨ì²Ä¤@¥x³nºÐ¾÷¤¤¡C ¦pªG¬O±q¥úºÐ¦w¸Ë¡A¨º»ò¶}¾÷«á½Ð±N FreeBSD ¥úºÐ©ñ¤J¥úºÐ¾÷¤¤¡C ¦pªG¡A¶}¾÷«á¦p©¹±`¤@¼Ë¦Ó¨S¦³±q³nºÐ©Î¥úºÐ¶}¾÷¡A½ÐÀˬd¡J ¬O¤£¬OºÏ¤ù©Î¥úºÐ¤Ó±ß©ñ¤J¦Ó¿ù¥¢¶}¾÷®É¶¡¡C¦pªG¬O¡A½Ð±N¥¦­Ì©ñ¤J¡AµM«á­«·s¶}¾÷¡C BIOS ³]©w¤£¹ï©Î§Ñ¤FÀx¦s³]©w¡A½Ð­«·sÀˬd BIOS ªº³]©w¡C ±zªº¹q¸£ BIOS ¤£¤ä´©±q¥úºÐ¶}¾÷¡C ¦¹®É¡AFreeBSD ´N¶}©l±Ò°Ê¤F¡C¦pªG¬O±q¥úºÐ¶}¾÷¡A·|¨£¨ìÃþ¦ü¤U­±ªºµe­±(ª©¥»³¡¤À¬Ù²¤)¡G: Verifying DMI Pool Data ........ Boot from ATAPI CD-ROM : 1. FD 2.88MB System Type-(00) Uncompressing ... done BTX loader 1.00 BTX version is 1.01 Console: internal video/keyboard BIOS drive A: is disk0 BIOS drive B: is disk1 BIOS drive C: is disk2 BIOS drive D: is disk3 BIOS 639kB/261120kB available memory FreeBSD/i386 bootstrap loader, Revision 0.8 /kernel text=0x277391 data=0x3268c+0x332a8 | | Hit [Enter] to boot immediately, or any other key for command prompt. Booting [kernel] in 9 seconds... _ ¦pªG±z±q³nºÐ¶}¾÷¡A·|¬Ý¨ìÃþ¦ü¤U­±ªºµe­±(ª©¥»³¡¤À¬Ù²¤)¡G Verifying DMI Pool Data ........ BTX loader 1.00 BTX version is 1.01 Console: internal video/keyboard BIOS drive A: is disk0 BIOS drive C: is disk1 BIOS 639kB/261120kB available memory FreeBSD/i386 bootstrap loader, Revision 0.8 /kernel text=0x277391 data=0x3268c+0x332a8 | Please insert MFS root floppy and press enter: ½Ð®Ú¾Ú´£¥Ü±N kern.flp ºÏ¤ù¨ú¥X¡A ¨Ã©ñ¤J mfsroot.flp ³o±iºÏ¤ù¡AµM«á«ö Enter Áä¡C­Y¬O &os; 5.3 (§t¤§«á)ªº¸Ü¡AÁÙ¦³¥t¥~¤@±iºÏ¤ù(¦b«e¤@¸`¤w¸g¤¶²Ð¹L¤F)¡C Á`¤§¡A±z¥u»Ý±q²Ä¤@±iºÏ¤ù±Ò°Ê¡A µM«á®Ú¾Ú´£¥Ü¡A¦A©ñ¤J¬ÛÃöºÏ¤ù§Y¥i¡C - ¤£½×±q³nºÐ©Î¥úºÐ¶}¾÷¡A±z³£·|¬Ý¨ì¤U­±³o¬q°T®§¡G + µL½×±q³nºÐ©Î¥úºÐ¶}¾÷¡A±z³£·|¬Ý¨ì¤U­±³o¬q°T®§¡G Hit [Enter] to boot immediately, or any other key for command prompt. Booting [kernel] in 9 seconds... _ ±z¥i¥Hµ¥«Ý 10 ¬í¡A©Î¬O«ö Enter Áä¡C (­Y¬O &os; 4.X ªº¸Ü¡A«h±N¥X²{ kernel configuration ¿ï³æµe­±) Alpha ¥­¥xªº¶}¾÷¬yµ{ Alpha - Start with your computer turned off. + ¦b¤@¶}©l¡A¹q¸£¹q·½¶}Ãö¬OÃö³¬ªº¡C - Turn on the computer and wait for a boot monitor - prompt. + ¥´¶}¹q¸£¹q·½¶}Ãö¡AµM«áµ¥¶}¾÷µe­±¥X²{¡C - If you needed to prepare boot floppies, as described in - then one of them will be the - first boot disc, probably the one containing - kern.flp. Put this disc in your floppy - drive and type the following command to boot the disk - (substituting the name of your floppy drive if - necessary): + ­Y­n¥ÎºÏ¤ù¦w¸Ë¡A½Ð§â¦b + ¤@¸`¤¤»s§@¦nªº kern.flp ¨º±i¦w¸ËºÏ¤ù©ñ¨ì²Ä¤@¥x³nºÐ¾÷¤¤¡C + µM«á¡A¥´¤U¦C«ü¥O¨Ó±qºÏ¤ù¶}¾÷(½Ð§â¤U¦C³nºÐ¾÷¥N¸¹§ï¬°§A¹q¸£ªº³nºÐ¾÷¥N¸¹)¡G >>>BOOT DVA0 -FLAGS '' -FILE '' - If you are booting from CDROM, insert the CDROM into - the drive and type the following command to start the - installation (substituting the name of the appropriate - CDROM drive if necessary): + ­Y­n¥Î¥úºÐ¦w¸Ë¡A½Ð§â°µ¦nªº¦w¸Ë¤ù©ñ¤J¥úºÐ¾÷¡AµM«á¥´¤U¦C«ü¥O¨Ó±q¥úºÐ¶}¾÷(½Ð§â¤U¦C¥úºÐ¾÷¥N¸¹§ï¬°§A¹q¸£ªº¥úºÐ¾÷¥N¸¹)¡G >>>BOOT DKA0 -FLAGS '' -FILE '' - FreeBSD will start to boot. If you are booting from a - floppy disc, at some point you will see the message: + ±µµÛ FreeBSD ¶}¾÷¤ù´N·|¶}©l¤F¡C­Y¬O¥Ñ³nºÐ¶}¾÷ªº¸Ü¡A³o®É·|¬Ý¨ì¥H¤U°T®§¡G Please insert MFS root floppy and press enter: - Follow these instructions by removing the - kern.flp disc, insert the - mfsroot.flp disc, and press - Enter. + ½Ð·Ó«ü¥Ü¡A®³¨« kern.flp ¤ù¡A§ï©ñ + mfsroot.flp ¤ù¡AµM«á«ö Enter¡C - Whether you booted from floppy or CDROM, the - boot process will then get to this point: + µL½×±q³nºÐ©Î¥úºÐ¶}¾÷¡A±z³£·|¬Ý¨ì¤U­±³o¬q°T®§¡G Hit [Enter] to boot immediately, or any other key for command prompt. Booting [kernel] in 9 seconds... _ - Either wait ten seconds, or press Enter. This - will then launch the kernel configuration menu. + ±z¥i¥Hµ¥«Ý 10 ¬í¡A©Î¬O«ö Enter Áä¡C±µ¤U¨Ó´N·|¶i¤Jkernel configuration ¿ï³æ¡C Kernel ªº³]©w ±q FreeBSD 5.0 ª©¶}©l¡A§ï¥Î·sªº &man.device.hints.5; ¤è¦¡¡A¦Ó²^¨Oªº userconfig ¤è¦¡¡C Ãö©ó &man.device.hints.5; ¾÷¨îªº²Ó¸`¤¶²Ð¡A½Ð°Ñ¾\ ¡C - The kernel is the core of the operating - system. It is responsible for many things, including access to all - the devices you may have on your system, such as hard disks, network - cards, sound cards, and so on. Each piece of hardware supported by - the FreeBSD kernel has a driver associated with it. Each driver has a - two or three letter name, such as sa for the - SCSI sequential access driver, or sio for the - Serial I/O driver (which manages COM ports). - - When the kernel starts, each driver checks the system to see - whether or not the hardware it supports exists on your system. If it - does, then the driver configures the hardware and makes it available - to the rest of the kernel. - - This checking is commonly referred to as device - probing. Unfortunately, it is not always possible to do - this in a safe way. Some hardware drivers do not co-exist well, - and probing for one piece of hardware can sometimes leave - another in an inconsistent state. This is a basic - limitation of the PC design. + kernel ¤D¬O§@·~¨t²Î¤¤ªº®Ö¤ß¡A­t³d³\¦h¨Æ±¡¡A¹³¬O¡G±±¨î¨t²Î¤W©Ò¦³³]³Æ¡A¤ñ¦pµwºÐ¡Bºô¸ô¥d¡B­µ®Ä¥dµ¥¡C + ¨C¶µ FreeBSD ©Ò¤ä´©ªºµwÅé³£¦³¬Û¹ïÀ³ªºÅX°Êµ{¦¡¡C + ¨C­ÓÅX°Êµ{¦¡¦WºÙ³£¦³ 2 ¨ì 3 ­Ó¦r¥À©Ò²Õ¦¨¡A¹³¬O sa ¥Nªí SCSI ÅX°Êµ{¦¡¡A¦Ó + sio ¥Nªí Serial I/O ÅX°Êµ{¦¡(ºÞ COM ports ¥Îªº)¡C + + ·í kernel ¶}©l±Ò°Ê®É¡A¨C­ÓÅX°Êµ{¦¡´N·|¥hÀˬd¨t²Î¤W¬O§_¦³¤ä´©ªºµwÅé¦s¦b¡A + ­Y¦³ªº¸Ü¡AÅX°Êµ{¦¡´N·|§@¬ÛÃöµwÅé³]©w¡A¥H«KÅý kernel ¨Ï¥Î¸ÓµwÅé¡C + + ¤W­zªºÀˬd°Ê§@¡A§Ú­ÌºÙ¬° device probing(°»´úµwÅé)¡C + ¦ý¬O¡A³o¼Ë¤lªº¤è¦¡¨Ã¤£¬O¥Ã»·³£¨º»ò¶¶§Q¡C + ¦³¨ÇµwÅéÅX°Êµ{¦¡µLªk¦P®É¦@¦s¡A¦Ó¦³®É­Ô°»´ú¬YµwÅé®É¡A¤S·|³y¦¨¥t¤@µwÅ餣í¥Xºl¡C + ³o°ÝÃD¡A¤D¬O¥Ñ©ó PC ¥»¨­³]­p¤W¤Ñ¥Íªº­­¨î©Ò­P¡C Many older devices are called ISA devices—as opposed to PCI devices. The ISA specification requires each device to have some information hard coded into it, typically the Interrupt Request Line number (IRQ) and IO port address that the driver uses. This information is commonly set by using physical jumpers on the card, or by using a DOS based utility. This was often a source of problems, because it was not possible to have two devices that shared the same IRQ or port address. Newer devices follow the PCI specification, which does not require this, as the devices are supposed to cooperate with the BIOS, and are told which IRQ and IO port addresses to use. If you have any ISA devices in your computer then FreeBSD's driver for that device will need to be configured with the IRQ and port address that you have set the card to. This is why carrying out an inventory of your hardware (see ) can be useful. Unfortunately, the default IRQs and memory ports used by some drivers clash. This is because some ISA devices are shipped with IRQs or memory ports that clash. The defaults in FreeBSD's drivers are deliberately set to mirror the manufacturer's defaults, so that, out of the box, as many devices as possible will work. This is almost never an issue when running FreeBSD day-to-day. Your computer will not normally contain two pieces of hardware that clash, because one of them would not work (irrespective of the operating system you are using). It becomes an issue when you are installing FreeBSD for the first time because the kernel used to carry out the install has to contain as many drivers as possible, so that many different hardware configurations can be supported. This means that some of those drivers will have conflicting configurations. The devices are probed in a strict order, and if you own a device that is probed late in the process, but conflicted with an earlier probe, then your hardware might not function or be probed correctly when you install FreeBSD. Because of this, the first thing you have the opportunity to do when installing FreeBSD is look at the list of drivers that are configured into the kernel, and either disable some of them, if you do not own that device, or confirm (and alter) the driver's configuration if you do own the device but the defaults are wrong. This probably sounds much more complicated than it actually is. shows the first kernel configuration menu. We recommend that you choose the Start kernel configuration in full-screen visual mode option, as it presents the easiest interface for the new user.
Kernel ³]©wµe­± &txt.install.userconfig;
The kernel configuration screen () is then divided into four sections: A collapsible list of all the drivers that are currently marked as active, subdivided into groups such as Storage, and Network. Each driver is shown as a description, its two or three letter driver name, and the IRQ and memory port used by that driver. In addition, if an active driver conflicts with another active driver then CONF is shown next to the driver name. This section also shows the total number of conflicting drivers that are currently active. Drivers that have been marked inactive. They remain in the kernel, but they will not probe for their device when the kernel starts. These are subdivided into groups in the same way as the active driver list. More detail about the currently selected driver, including its IRQ and memory port address. Information about the keystrokes that are valid at this point in time.
Kernel Device ªº³]©wµe­± &txt.install.userconfig2;
Do not worry if any conflicts are listed, it is to be expected; all the drivers are enabled, and as has already been explained, some of them will conflict with one another. You now have to work through the list of drivers, resolving the conflicts. ¸Ñ°£¬Û½ÄªºÅX°Êµ{¦¡ Press X. This will completely expand the list of drivers, so you can see all of them. You will need to use the arrow keys to scroll back and forth through the active driver list. shows the result of pressing X.
®i¶}ÅX°Êµ{¦¡¤@Äýªí
Disable all the drivers for devices that you do not have. To disable a driver, highlight it with the arrow keys and press Del. The driver will be moved to the Inactive Drivers list. If you inadvertently disable a device that you need then press Tab to switch to the Inactive Drivers list, select the driver that you disabled, and press Enter to move it back to the active list. Do not disable sc0. This controls the screen, and you will need this unless you are installing over a serial cable. Only disable atkbd0 if you are using a USB keyboard. If you have a normal keyboard then you must keep atkbd0. If there are no conflicts listed then you can skip this step. Otherwise, the remaining conflicts need to be examined. If they do not have the indication of an allowed conflict in the message area, then either the IRQ/address for device probe will need to be changed, or the IRQ/address on the hardware will need to be changed. To change the driver's configuration for IRQ and IO port address, select the device and press Enter. The cursor will move to the third section of the screen, and you can change the values. You should enter the values for IRQ and port address that you discovered when you made your hardware inventory. Press Q to finish editing the device's configuration and return to the active driver list. If you are not sure what these figures should be then you can try using -1. Some FreeBSD drivers can safely probe the hardware to discover what the correct value should be, and a value of -1 configures them to do this. The procedure for changing the address on the hardware varies from device to device. For some devices you may need to physically remove the card from your computer and adjust jumper settings or DIP switches. Other cards may have come with a DOS floppy that contains the programs used to reconfigure the card. In any case, you should refer to the documentation that came with the device. This will obviously entail restarting your computer, so you will need to boot back into the FreeBSD installation routine when you have reconfigured the card. When all the conflicts have been resolved the screen will look similar to .
¨S¦³½Ä¬ðªºÅX°Êµ{¦¡³]©w
As you can see, the active driver list is now much smaller, with only drivers for the hardware that actually exists being listed. You can now save these changes, and move on to the next step of the install. Press Q to quit the device configuration interface. This message will appear: Save these parameters before exiting? ([Y]es/[N]o/[C]ancel) Answer Y to save the parameters to memory (it will be saved to disk if you finish the install) and the probing will start. After displaying the probe results in white on black text sysinstall will start and display its main menu ().
Sysinstall ¥D¿ï³æ
¨º­n«ç»ò¥h½¾\°»´úµwÅ骺µ²ªG©O¡H ¥ý«e¦b¿Ã¹õ¤W©ÒÅã¥Üªº³Ì«á´X¦Ê¦æ¦r¡A·|¦s¦b¼È¦s°Ï(buffer)¥H«K±z½¾\¡C ­Y­n½¾\¼È¦s°Ï¡A½Ð«ö Scroll Lock Áä¡A³o·|¶}±Ò±²°Êµe­±¥\¯à¡C µM«á´N¥i¥H¨Ï¥Î¤è¦VÁä¡A©Î¬O PageUp¡BPageDown Áä¨Ó¤W¤U½¾\¡C¦A«ö¤@¦¸ Scroll Lock Áä¡A´N·|°±¤îµe­±±²°Ê¡C Do this now, to review the text that scrolled off the screen when the kernel was carrying out the device probes. You will see text similar to , although the precise text will differ depending on the devices that you have in your computer.
°»´úµwÅ骺¨Ò¤l avail memory = 253050880 (247120K bytes) Preloaded elf kernel "kernel" at 0xc0817000. Preloaded mfs_root "/mfsroot" at 0xc0817084. md0: Preloaded image </mfsroot> 4423680 bytes at 0xc03ddcd4 md1: Malloc disk Using $PIR table, 4 entries at 0xc00fde60 npx0: <math processor> on motherboard npx0: INT 16 interface pcib0: <Host to PCI bridge> on motherboard pci0: <PCI bus> on pcib0 pcib1:<VIA 82C598MVP (Apollo MVP3) PCI-PCI (AGP) bridge> at device 1.0 on pci0 pci1: <PCI bus> on pcib1 pci1: <Matrox MGA G200 AGP graphics accelerator> at 0.0 irq 11 isab0: <VIA 82C586 PCI-ISA bridge> at device 7.0 on pci0 isa0: <iSA bus> on isab0 atapci0: <VIA 82C586 ATA33 controller> port 0xe000-0xe00f at device 7.1 on pci0 ata0: at 0x1f0 irq 14 on atapci0 ata1: at 0x170 irq 15 on atapci0 uhci0 <VIA 83C572 USB controller> port 0xe400-0xe41f irq 10 at device 7.2 on pci 0 usb0: <VIA 83572 USB controller> on uhci0 usb0: USB revision 1.0 uhub0: VIA UHCI root hub, class 9/0, rev 1.00/1.00, addr1 uhub0: 2 ports with 2 removable, self powered pci0: <unknown card> (vendor=0x1106, dev=0x3040) at 7.3 dc0: <ADMtek AN985 10/100BaseTX> port 0xe800-0xe8ff mem 0xdb000000-0xeb0003ff ir q 11 at device 8.0 on pci0 dc0: Ethernet address: 00:04:5a:74:6b:b5 miibus0: <MII bus> on dc0 ukphy0: <Generic IEEE 802.3u media interface> on miibus0 ukphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto ed0: <NE2000 PCI Ethernet (RealTek 8029)> port 0xec00-0xec1f irq 9 at device 10. 0 on pci0 ed0 address 52:54:05:de:73:1b, type NE2000 (16 bit) isa0: too many dependant configs (8) isa0: unexpected small tag 14 orm0: <Option ROM> at iomem 0xc0000-0xc7fff on isa0 fdc0: <NEC 72065B or clone> at port 0x3f0-0x3f5,0x3f7 irq 6 drq2 on isa0 fdc0: FIFO enabled, 8 bytes threshold fd0: <1440-KB 3.5" drive> on fdc0 drive 0 atkbdc0: <Keyboard controller (i8042)> at port 0x60,0x64 on isa0 atkbd0: <AT Keyboard> flags 0x1 irq1 on atkbdc0 kbd0 at atkbd0 psm0: <PS/2 Mouse> irq 12 on atkbdc0 psm0: model Generic PS/@ mouse, device ID 0 vga0: <Generic ISA VGA> at port 0x3c0-0x3df iomem 0xa0000-0xbffff on isa0 sc0: <System console> at flags 0x100 on isa0 sc0: VGA <16 virtual consoles, flags=0x300> sio0 at port 0x3f8-0x3ff irq 4 flags 0x10 on isa0 sio0: type 16550A sio1 at port 0x2f8-0x2ff irq 3 on isa0 sio1: type 16550A ppc0: <Parallel port> at port 0x378-0x37f irq 7 on isa0 pppc0: SMC-like chipset (ECP/EPP/PS2/NIBBLE) in COMPATIBLE mode ppc0: FIFO with 16/16/15 bytes threshold plip0: <PLIP network interface> on ppbus0 ad0: 8063MB <IBM-DHEA-38451> [16383/16/63] at ata0-master UDMA33 acd0: CD-RW <LITE-ON LTR-1210B> at ata1-slave PIO4 Mounting root from ufs:/dev/md0c /stand/sysinstall running as init on vty0
Check the probe results carefully to make sure that FreeBSD found all the devices you expected. If a device was not found, then it will not be listed. If the device's driver required configuring with the IRQ and port address then you should check that you entered them correctly. If you need to make changes to the UserConfig device probing, it is easy to exit the sysinstall program and start over again. It is also a good way to become more familiar with the process.
Â÷¶} Sysinstall µ{¦¡
Use the arrow keys to select Exit Install from the Main Install Screen menu. The following message will display: User Confirmation Requested Are you sure you wish to exit? The system will reboot (be sure to remove any floppies from the drives). [ Yes ] No The install program will start again if the CDROM is left in the drive and &gui.yes; is selected. If you are booting from floppies it will be necessary to remove the mfsroot.flp floppy and replace it with kern.flp before rebooting.
¤¶²Ð Sysinstall The sysinstall utility is the installation application provided by the FreeBSD Project. It is console based and is divided into a number of menus and screens that you can use to configure and control the installation process. The sysinstall menu system is controlled by the arrow keys, Enter, Space, and other keys. A detailed description of these keys and what they do is contained in sysinstall's usage information. To review this information, ensure that the Usage entry is highlighted and that the [Select] button is selected, as shown in , then press Enter. The instructions for using the menu system will be displayed. After reviewing them, press Enter to return to the Main Menu.
¿ï¾Ü Sysinstall ¥D¿ï³æªº¡yUsage(§Ö³t»¡©ú)¡z
¿ï¾Ü¡y Documentation(»¡©ú¤å¥ó)¡z¿ï³æ From the Main Menu, select Doc with the arrow keys and press Enter.
¿ï¾Ü¡yDocumentation(»¡©ú¤å¥ó)¡z¿ï³æ
This will display the Documentation Menu.
Sysinstall ªº»¡©ú¤å¥ó(Documentation)¿ï³æ
It is important to read the documents provided. To view a document, select it with the arrow keys and press Enter. When finished reading a document, pressing Enter will return to the Documentation Menu. To return to the Main Installation Menu, select Exit with the arrow keys and press Enter.
¿ï¾Ü¡yÁä½L¹ïÀ³¡z¿ï³æ To change the keyboard mapping, use the arrow keys to select Keymap from the menu and press Enter. This is only required if you are using a non-standard or non-US keyboard.
Sysinstall ¥D¿ï³æ
A different keyboard mapping may be chosen by selecting the menu item using up/down arrow keys and pressing Space. Pressing Space again will unselect the item. When finished, choose the &gui.ok; using the arrow keys and press Enter. Only a partial list is shown in this screen representation. Selecting &gui.cancel; by pressing Tab will use the default keymap and return to the Main Install Menu.
Sysinstall Áä½L¹ïÀ³¿ï³æ
¦w¸Ë¿ï¶µªº³]©wµe­± Select Options and press Enter.
Sysinstall ¥D¿ï³æ
Sysinstall ¿ï¶µ³]©w
The default values are usually fine for most users and do not need to be changed. The release name will vary according to the version being installed. The description of the selected item will appear at the bottom of the screen highlighted in blue. Notice that one of the options is Use Defaults to reset all values to startup defaults. Press F1 to read the help screen about the various options. Pressing Q will return to the Main Install menu.
¶}©l¶i¦æ¼Ð·Ç¦w¸Ë Standard(¼Ð·Ç)¦w¸Ë¾A¥Î©ó¨º¨Çªì±´ &unix; ©Î FreeBSD ªº¨Ï¥ÎªÌ¡C¥Î¤è¦VÁä¿ï¾Ü Standard µM«á«ö Enter §Y¥i¶}©l¶i¤J¼Ð·Ç¦w¸Ë¡C
¶}©l¶i¦æ¼Ð·Ç¦w¸Ë
µwºÐªÅ¶¡ªº¤À°t Your first task is to allocate disk space for FreeBSD, and label that space so that sysinstall can prepare it. In order to do this you need to know how FreeBSD expects to find information on the disk. BIOS ºÏºÐ¾÷½s¸¹ Before you install and configure FreeBSD on your system, there is an important subject that you should be aware of, especially if you have multiple hard drives. DOS Microsoft Windows In a PC running a BIOS-dependent operating system such as &ms-dos; or µsoft.windows;, the BIOS is able to abstract the normal disk drive order, and the operating system goes along with the change. This allows the user to boot from a disk drive other than the so-called primary master. This is especially convenient for some users who have found that the simplest and cheapest way to keep a system backup is to buy an identical second hard drive, and perform routine copies of the first drive to the second drive using Ghost or XCOPY . Then, if the first drive fails, or is attacked by a virus, or is scribbled upon by an operating system defect, he can easily recover by instructing the BIOS to logically swap the drives. It is like switching the cables on the drives, but without having to open the case. SCSI BIOS More expensive systems with SCSI controllers often include BIOS extensions which allow the SCSI drives to be re-ordered in a similar fashion for up to seven drives. A user who is accustomed to taking advantage of these features may become surprised when the results with FreeBSD are not as expected. FreeBSD does not use the BIOS, and does not know the logical BIOS drive mapping. This can lead to very perplexing situations, especially when drives are physically identical in geometry, and have also been made as data clones of one another. When using FreeBSD, always restore the BIOS to natural drive numbering before installing FreeBSD, and then leave it that way. If you need to switch drives around, then do so, but do it the hard way, and open the case and move the jumpers and cables. ½d¨Ò¡GBill ¤Î Fred ªº¦w¸Ë¾úÀI Bill breaks-down an older Wintel box to make another FreeBSD box for Fred. Bill installs a single SCSI drive as SCSI unit zero and installs FreeBSD on it. Fred begins using the system, but after several days notices that the older SCSI drive is reporting numerous soft errors and reports this fact to Bill. After several more days, Bill decides it is time to address the situation, so he grabs an identical SCSI drive from the disk drive archive in the back room. An initial surface scan indicates that this drive is functioning well, so Bill installs this drive as SCSI unit four and makes an image copy from drive zero to drive four. Now that the new drive is installed and functioning nicely, Bill decides that it is a good idea to start using it, so he uses features in the SCSI BIOS to re-order the disk drives so that the system boots from SCSI unit four. FreeBSD boots and runs just fine. Fred continues his work for several days, and soon Bill and Fred decide that it is time for a new adventure — time to upgrade to a newer version of FreeBSD. Bill removes SCSI unit zero because it was a bit flaky and replaces it with another identical disk drive from the archive. Bill then installs the new version of FreeBSD onto the new SCSI unit zero using Fred's magic Internet FTP floppies. The installation goes well. Fred uses the new version of FreeBSD for a few days, and certifies that it is good enough for use in the engineering department. It is time to copy all of his work from the old version. So Fred mounts SCSI unit four (the latest copy of the older FreeBSD version). Fred is dismayed to find that none of his precious work is present on SCSI unit four. Where did the data go? When Bill made an image copy of the original SCSI unit zero onto SCSI unit four, unit four became the new clone. When Bill re-ordered the SCSI BIOS so that he could boot from SCSI unit four, he was only fooling himself. FreeBSD was still running on SCSI unit zero. Making this kind of BIOS change will cause some or all of the Boot and Loader code to be fetched from the selected BIOS drive, but when the FreeBSD kernel drivers take-over, the BIOS drive numbering will be ignored, and FreeBSD will transition back to normal drive numbering. In the illustration at hand, the system continued to operate on the original SCSI unit zero, and all of Fred's data was there, not on SCSI unit four. The fact that the system appeared to be running on SCSI unit four was simply an artifact of human expectations. We are delighted to mention that no data bytes were killed or harmed in any way by our discovery of this phenomenon. The older SCSI unit zero was retrieved from the bone pile, and all of Fred's work was returned to him, (and now Bill knows that he can count as high as zero). Although SCSI drives were used in this illustration, the concepts apply equally to IDE drives. ¥H FDisk ¨Ó«Ø¥ß¤À³ÎºÏ°Ï(Slices) No changes you make at this point will be written to the disk. If you think you have made a mistake and want to start again you can use the menus to exit sysinstall and try again or press U to use the Undo option. If you get confused and can not see how to exit you can always turn your computer off. After choosing to begin a standard installation in sysinstall you will be shown this message: Message In the next menu, you will need to set up a DOS-style ("fdisk") partitioning scheme for your hard disk. If you simply wish to devote all disk space to FreeBSD (overwriting anything else that might be on the disk(s) selected) then use the (A)ll command to select the default partitioning scheme followed by a (Q)uit. If you wish to allocate only free space to FreeBSD, move to a partition marked "unused" and use the (C)reate command. [ OK ] [ Press enter or space ] Press Enter as instructed. You will then be shown a list of all the hard drives that the kernel found when it carried out the device probes. shows an example from a system with two IDE disks. They have been called ad0 and ad2.
¿ï¾Ü FDisk ­n¤À³ÎªºµwºÐ
You might be wondering why ad1 is not listed here. Why has it been missed? Consider what would happen if you had two IDE hard disks, one as the master on the first IDE controller, and one as the master on the second IDE controller. If FreeBSD numbered these as it found them, as ad0 and ad1 then everything would work. But if you then added a third disk, as the slave device on the first IDE controller, it would now be ad1, and the previous ad1 would become ad2. Because device names (such as ad1s1a) are used to find filesystems, you may suddenly discover that some of your filesystems no longer appear correctly, and you would need to change your FreeBSD configuration. To work around this, the kernel can be configured to name IDE disks based on where they are, and not the order in which they were found. With this scheme the master disk on the second IDE controller will always be ad2, even if there are no ad0 or ad1 devices. This configuration is the default for the FreeBSD kernel, which is why this display shows ad0 and ad2. The machine on which this screenshot was taken had IDE disks on both master channels of the IDE controllers, and no disks on the slave channels. You should select the disk on which you want to install FreeBSD, and then press &gui.ok;. FDisk will start, with a display similar to that shown in . The FDisk display is broken into three sections. The first section, covering the first two lines of the display, shows details about the currently selected disk, including its FreeBSD name, the disk geometry, and the total size of the disk. The second section shows the slices that are currently on the disk, where they start and end, how large they are, the name FreeBSD gives them, and their description and sub-type. This example shows two small unused slices, which are artifacts of disk layout schemes on the PC. It also shows one large FAT slice, which almost certainly appears as C: in &ms-dos; / &windows;, and an extended slice, which may contain other drive letters for &ms-dos; / &windows;. The third section shows the commands that are available in FDisk.
(Á|¨Ò)¥¼½s¿è«eªº Fdisk ¤À³Î°Ï(Partition)
What you do now will depend on how you want to slice up your disk. If you want to use FreeBSD for the entire disk (which will delete all the other data on this disk when you confirm that you want sysinstall to continue later in the installation process) then you can press A, which corresponds to the Use Entire Disk option. The existing slices will be removed, and replaced with a small area flagged as unused (again, an artifact of PC disk layout), and then one large slice for FreeBSD. If you do this, then you should select the newly created FreeBSD slice using the arrow keys, and press S to mark the slice as being bootable. The screen will then look very similar to . Note the A in the Flags column, which indicates that this slice is active, and will be booted from. If you will be deleting an existing slice to make space for FreeBSD then you should select the slice using the arrow keys, and then press D. You can then press C, and be prompted for size of slice you want to create. Enter the appropriate figure and press Enter. The default value in this box represents the largest possible slice you can make, which could be the largest contiguous block of unallocated space or the size of the entire hard disk. If you have already made space for FreeBSD (perhaps by using a tool such as &partitionmagic;) then you can press C to create a new slice. Again, you will be prompted for the size of slice you would like to create.
Fdisk ±Ä¥Î¾ãÁûµwºÐ§@¤À³Î°Ï(Partition)
When finished, press Q. Your changes will be saved in sysinstall, but will not yet be written to disk.
¦w¸Ë Boot Manager You now have the option to install a boot manager. In general, you should choose to install the FreeBSD boot manager if: You have more than one drive, and have installed FreeBSD onto a drive other than the first one. You have installed FreeBSD alongside another operating system on the same disk, and you want to choose whether to start FreeBSD or the other operating system when you start the computer. If FreeBSD is going to be the only operating system on this machine, installed on the first hard disk, then the Standard boot manager will suffice. Choose None if you are using a third-party boot manager capable of booting FreeBSD. Make your choice and press Enter.
Sysinstall ªº Boot Manager ¿ï³æ
The help screen, reached by pressing F1, discusses the problems that can be encountered when trying to share the hard disk between operating systems.
¦b¨ä¥LµwºÐ¤W«Ø¥ß¤À³ÎºÏ°Ï(Slices) If there is more than one drive, it will return to the Select Drives screen after the boot manager selection. If you wish to install FreeBSD on to more than one disk, then you can select another disk here and repeat the slice process using FDisk. If you are installing FreeBSD on a drive other than your first, then the FreeBSD boot manager needs to be installed on both drives.
Â÷¶}¡y¿ï¾ÜµwºÐ¡zµe­±
The Tab key toggles between the last drive selected, &gui.ok;, and &gui.cancel;. Press the Tab once to toggle to the &gui.ok;, then press Enter to continue with the installation.
¥H <application>Disklabel</application> ¨Ó«Ø¥ß¤À³Î°Ï(Partitions) You must now create some partitions inside each slice that you have just created. Remember that each partition is lettered, from a through to h, and that partitions b, c, and d have conventional meanings that you should adhere to. Certain applications can benefit from particular partition schemes, especially if you are laying out partitions across more than one disk. However, for this, your first FreeBSD installation, you do not need to give too much thought to how you partition the disk. It is more important that you install FreeBSD and start learning how to use it. You can always re-install FreeBSD to change your partition scheme when you are more familiar with the operating system. This scheme features four partitions—one for swap space, and three for filesystems. ²Ä¤@ÁûµwºÐªº¤À³Î°Ï(Partition)°t¸m Partition Filesystem Size Description a / 100 MB This is the root filesystem. Every other filesystem will be mounted somewhere under this one. 100 MB is a reasonable size for this filesystem. You will not be storing too much data on it, as a regular FreeBSD install will put about 40 MB of data here. The remaining space is for temporary data, and also leaves expansion space if future versions of FreeBSD need more space in /. b N/A 2-3 x RAM The system's swap space is kept on this partition. Choosing the right amount of swap space can be a bit of an art. A good rule of thumb is that your swap space should be two or three times as much as the available physical memory (RAM). You should also have at least 64 MB of swap, so if you have less than 32 MB of RAM in your computer then set the swap amount to 64 MB. If you have more than one disk then you can put swap space on each disk. FreeBSD will then use each disk for swap, which effectively speeds up the act of swapping. In this case, calculate the total amount of swap you need (e.g., 128 MB), and then divide this by the number of disks you have (e.g., two disks) to give the amount of swap you should put on each disk, in this example, 64 MB of swap per disk. e /var 50 MB The /var directory contains files that are constantly varying; log files, and other administrative files. Many of these files are read-from or written-to extensively during FreeBSD's day-to-day running. Putting these files on another filesystem allows FreeBSD to optimize the access of these files without affecting other files in other directories that do not have the same access pattern. f /usr Rest of disk All your other files will typically be stored in /usr and its subdirectories.
If you will be installing FreeBSD on to more than one disk then you must also create partitions in the other slices that you configured. The easiest way to do this is to create two partitions on each disk, one for the swap space, and one for a filesystem. ¨ä¥LµwºÐªº¤À³Î°Ï(Partition)°t¸m Partition Filesystem Size Description b N/A See description As already discussed, you can split swap space across each disk. Even though the a partition is free, convention dictates that swap space stays on the b partition. e /diskn Rest of disk The rest of the disk is taken up with one big partition. This could easily be put on the a partition, instead of the e partition. However, convention says that the a partition on a slice is reserved for the filesystem that will be the root (/) filesystem. You do not have to follow this convention, but sysinstall does, so following it yourself makes the installation slightly cleaner. You can choose to mount this filesystem anywhere; this example suggests that you mount them as directories /diskn, where n is a number that changes for each disk. But you can use another scheme if you prefer.
Having chosen your partition layout you can now create it using sysinstall. You will see this message: Message Now, you need to create BSD partitions inside of the fdisk partition(s) just created. If you have a reasonable amount of disk space (200MB or more) and don't have any special requirements, simply use the (A)uto command to allocate space automatically. If you have more specific needs or just don't care for the layout chosen by (A)uto, press F1 for more information on manual layout. [ OK ] [ Press enter or space ] Press Enter to start the FreeBSD partition editor, called Disklabel. shows the display when you first start Disklabel. The display is divided in to three sections. The first few lines show the name of the disk you are currently working on, and the slice that contains the partitions you are creating (at this point Disklabel calls this the Partition name rather than slice name). This display also shows the amount of free space within the slice; that is, space that was set aside in the slice, but that has not yet been assigned to a partition. The middle of the display shows the partitions that have been created, the name of the filesystem that each partition contains, their size, and some options pertaining to the creation of the filesystem. The bottom third of the screen shows the keystrokes that are valid in Disklabel.
Sysinstall ªº Disklabel ½s¿è¾¹
Disklabel can automatically create partitions for you and assign them default sizes. Try this now, by Pressing A. You will see a display similar to that shown in . Depending on the size of the disk you are using, the defaults may or may not be appropriate. This does not matter, as you do not have to accept the defaults. Beginning with FreeBSD 4.5, the default partitioning assigns the /tmp directory its own partition instead of being part of the / partition. This helps avoid filling the / partition with temporary files.
Sysinstall ªº Disklabel ½s¿è¾¹ ¡X ¨Ï¥Î¦Û°Ê¤À°t
If you choose to not use the default partitions and wish to replace them with your own, use the arrow keys to select the first partition, and press D to delete it. Repeat this to delete all the suggested partitions. To create the first partition (a, mounted as / — root), make sure the proper disk slice at the top of the screen is selected and press C. A dialog box will appear prompting you for the size of the new partition (as shown in ). You can enter the size as the number of disk blocks you want to use, or as a number followed by either M for megabytes, G for gigabytes, or C for cylinders. Beginning with FreeBSD 5.X, users can: select UFS2 (which is default on &os; 5.1 and above) using the Custom Newfs (Z) option, create labels with Auto Defaults and modify them with the Custom Newfs option or add during the regular creation period. Do not forget to add for SoftUpdates if you use the Custom Newfs option!
Free Space for Root Partition
The default size shown will create a partition that takes up the rest of the slice. If you are using the partition sizes described in the earlier example, then delete the existing figure using Backspace, and then type in 64M, as shown in . Then press &gui.ok;.
Edit Root Partition Size
Having chosen the partition's size you will then be asked whether this partition will contain a filesystem or swap space. The dialog box is shown in . This first partition will contain a filesystem, so check that FS is selected and press Enter.
Choose the Root Partition Type
Finally, because you are creating a filesystem, you must tell Disklabel where the filesystem is to be mounted. The dialog box is shown in . The root filesystem's mount point is /, so type /, and then press Enter.
Choose the Root Mount Point
The display will then update to show you the newly created partition. You should repeat this procedure for the other partitions. When you create the swap partition, you will not be prompted for the filesystem mount point, as swap partitions are never mounted. When you create the final partition, /usr, you can leave the suggested size as is, to use the rest of the slice. Your final FreeBSD DiskLabel Editor screen will appear similar to , although your values chosen may be different. Press Q to finish.
Sysinstall Disklabel Editor
¿ï¾Ü·Q­n¦w¸Ëªº ¿ï¾Ü­n¦w¸Ëªº®M¥ó¶°(Distribution Set) Deciding which distribution set to install will depend largely on the intended use of the system and the amount of disk space available. The predefined options range from installing the smallest possible configuration to everything. Those who are new to &unix; and/or FreeBSD should almost certainly select one of these canned options. Customizing a distribution set is typically for the more experienced user. Press F1 for more information on the distribution set options and what they contain. When finished reviewing the help, pressing Enter will return to the Select Distributions Menu. If a graphical user interface is desired then a distribution set that is preceded by an X should be chosen. The configuration of the X server and selection of a default desktop must be done after the installation of &os;. More information regarding the configuration of a X server can be found in . The default version of X11 that is installed depends on the version of FreeBSD that you are installing. For FreeBSD versions prior to 5.3, &xfree86; 4.X is installed. For &os; 5.3 and later, &xorg; is the default. If compiling a custom kernel is anticipated, select an option which includes the source code. For more information on why a custom kernel should be built or how to build a custom kernel, see . Obviously, the most versatile system is one that includes everything. If there is adequate disk space, select All as shown in by using the arrow keys and press Enter. If there is a concern about disk space consider using an option that is more suitable for the situation. Do not fret over the perfect choice, as other distributions can be added after installation.
¿ï¾Ü®M¥ó(Distributions)
¦w¸Ë Ports Collection After selecting the desired distribution, an opportunity to install the FreeBSD Ports Collection is presented. The ports collection is an easy and convenient way to install software. The Ports Collection does not contain the source code necessary to compile the software. Instead, it is a collection of files which automates the downloading, compiling and installation of third-party software packages. discusses how to use the ports collection. The installation program does not check to see if you have adequate space. Select this option only if you have adequate hard disk space. As of FreeBSD &rel.current;, the FreeBSD Ports Collection takes up about &ports.size; of disk space. You can safely assume a larger value for more recent versions of FreeBSD. User Confirmation Requested Would you like to install the FreeBSD ports collection? This will give you ready access to over &os.numports; ported software packages, at a cost of around &ports.size; of disk space when "clean" and possibly much more than that if a lot of the distribution tarballs are loaded (unless you have the extra CDs from a FreeBSD CD/DVD distribution available and can mount it on /cdrom, in which case this is far less of a problem). The Ports Collection is a very valuable resource and well worth having on your /usr partition, so it is advisable to say Yes to this option. For more information on the Ports Collection & the latest ports, visit: http://www.FreeBSD.org/ports [ Yes ] No Select &gui.yes; with the arrow keys to install the Ports Collection or &gui.no; to skip this option. Press Enter to continue. The Choose Distributions menu will redisplay.
Confirm Distributions
If satisfied with the options, select Exit with the arrow keys, ensure that &gui.ok; is highlighted, and pressing Enter to continue.
¿ï¾Ü¦w¸Ë¨Ó·½ - If Installing from a CDROM or DVD, use the arrow keys to highlight - Install from a FreeBSD CD/DVD. Ensure - that &gui.ok; is highlighted, then press - Enter to proceed with the installation. + ­Y­n±q CDROM ©Î DVD ¦w¸Ë¡A¥Î¤è¦VÁä±N´å¼Ð²¾¨ì Install from a FreeBSD CD/DVD¡A¨Ã½T©w + ¿ï &gui.ok; «á«ö¤U Enter ´N·|¶}©l¸Ë¤F¡C - For other methods of installation, select the appropriate - option and follow the instructions. + ­Y¬O­n¥Î¨ä¥Lªº¤è¦¡¦w¸Ëªº¸Ü¡A½Ð¿ï¾Ü¾A·íªº¦w¸Ë¨Ó·½¡AµM«á¿í·Ó¿Ã¹õ«ü¥Ü¶i¦æ¦w¸Ë§Y¥i¡C - Press F1 to display the Online Help for - installation media. Press Enter to return - to the media selection menu. + «ö F1 ¥i¥HÅã¥Ü°w¹ï¦¹³¡¤À(¦w¸Ë¨Ó·½)ªº½u¤W»¡©ú¡C«ö¤@¤U Enter + ´N·|¦^¨ì¡y¿ï¾Ü¦w¸Ë¨Ó·½¡zªºµe­±¤F¡C
¿ï¾Ü¦w¸Ë¨Ó·½
FTP ¦w¸Ë¼Ò¦¡ installation network FTP - There are three FTP installation modes you can choose from: - active FTP, passive FTP, or via a HTTP proxy. + ¨Ï¥Î FTP ¦w¸Ëªº¸Ü¡A¦³¤À¤TºØ¼Ò¦¡¡J¥D°Ê¦¡(active)FTP¡B³Q°Ê¦¡(passive)FTP ©Î¬O³z¹L HTTP proxy server¡C FTP Active: Install from an FTP server This option will make all FTP transfers use Active mode. This will not work through firewalls, but will often work with older FTP servers that do not support passive mode. If your connection hangs with passive mode (the default), try active! FTP Passive: Install from an FTP server through a firewall FTP passive mode This option instructs sysinstall to use Passive mode for all FTP operations. This allows the user to pass through firewalls that do not allow incoming connections on random TCP ports. FTP via a HTTP proxy: Install from an FTP server through a http proxy FTP via a HTTP proxy This option instructs sysinstall to use the HTTP protocol (like a web browser) to connect to a proxy for all FTP operations. The proxy will translate the requests and send them to the FTP server. This allows the user to pass through firewalls that do not allow FTP at all, but offer a HTTP proxy. In this case, you have to specify the proxy in addition to the FTP server. For a proxy FTP server, you should usually give the name of the server you really want as a part of the username, after an @ sign. The proxy server then fakes the real server. For example, assuming you want to install from ftp.FreeBSD.org, using the proxy FTP server foo.example.com, listening on port 1024. In this case, you go to the options menu, set the FTP username to ftp@ftp.FreeBSD.org, and the password to your email address. As your installation media, you specify FTP (or passive FTP, if the proxy supports it), and the URL ftp://foo.example.com:1234/pub/FreeBSD. Since /pub/FreeBSD from ftp.FreeBSD.org is proxied under foo.example.com, you are able to install from that machine (which will fetch the files from ftp.FreeBSD.org as your installation requests them).
¶}©l¶i¦æ¦w¸Ë ¨ì¦¹¬°¤î¡A¥i¥H¶}©l¶i¦æ¦w¸Ë¤F¡A³o¤]¬O±zÁקK§ó°Ê¨ìµwºÐªº³Ì«á¾÷·|¡C User Confirmation Requested Last Chance! Are you SURE you want to continue the installation? If you're running this on a disk with data you wish to save then WE STRONGLY ENCOURAGE YOU TO MAKE PROPER BACKUPS before proceeding! We can take no responsibility for lost disk contents! [ Yes ] No ¿ï¾Ü &gui.yes; ¨Ã«ö¤U Enter¥H½T»{¯uªº­n¶}©l¦w¸Ë ¦w¸Ë©Ò»Ý®É¶¡·|¨Ì¾Ú©Ò¿ï¾Ü¦w¸Ëªº®M¥ó¶°(distribution) ¡B¦w¸Ë¨Ó·½¥H¤Î¹q¸£³t«×¦Ó¦³©Ò¤£¦P¡C ¦b¦w¸Ëªº¹Lµ{¤¤¡A·|¦³¤@¨Ç°T®§Åã¥Ü¥Ø«eªº¦w¸Ë¶i«×¡C ·í±z¬Ý¨ì¤U­±ªº°T®§ªí¥Ü¤w¸g¦w¸Ë§¹¦¨¤F¡J Message Congratulations! You now have FreeBSD installed on your system. We will now move on to the final configuration questions. For any option you do not wish to configure, simply select No. If you wish to re-enter this utility after the system is up, you may do so by typing: /stand/sysinstall . [ OK ] [ Press enter to continue ] - Press Enter to proceed with post-installation - configurations. + ½Ð«ö Enter Áä¨Ó¶i¦æ¬ÛÃöªº«áÄò³]©w¡C - Selecting &gui.no; and pressing - Enter will abort - the installation so no changes will be made to your system. The - following message will appear: + ¦pªG­è¿ïªº¬O &gui.no; ¨Ã«ö¤U + Enter Áä¡A¨º»ò·|¤¤Â_¦w¸Ë(´N¤£·|°Ê¨ì§Aªº­ì¦³¨t²Î)¡C + ±µµÛ¡A·|¥X²{¥H¤U°T®§¡G Message Installation complete with some errors. You may wish to scroll through the debugging messages on VTY1 with the scroll-lock feature. You can also choose "No" at the next prompt and go back into the installation menus to retry whichever operations have failed. [ OK ] - This message is generated because nothing was installed. - Pressing Enter will return to the - Main Installation Menu to exit the installation. + ³o¬q°T®§¤D¬O¦]¬°³£¨S¸Ë¥ô¦óªF¦è¤§¬G¡A½Ð«ö Enter ¥H¸õ¦^¥Dµe­±¡C «áÄò¦w¸Ë ¦w¸Ë¨t²Î¦¨¥\¤§«á¡A¥i¥H¦b·s¸Ë¦nªº FreeBSD ­«¶}¾÷¤§«e¡A©ÎªÌ¬O¨Æ«á¦A³z¹L sysinstall (&os; 5.2 ¤§«eª©¥»«h¬O /stand/sysinstall) µM«á¿ï¾Ü Configure ¿ï¶µ¥H¶i¦æ«áÄò³]©w¡C - Network Device Configuration + ³]©wºô¸ô - If you previously configured PPP for an FTP install, this screen - will not display and can be configured later as described - above. + ¦pªG±z¤§«e¦³³]©w¥Î PPP ³s½u³z¹L FTP ¦w¸Ë¡A¨º»ò³o­Óµe­±±N¤£·|¥X²{¡F + ¥¿¦p¤W­±­è©Ò»¡ªº¡A±z¥i¥Hµy«á¦A°µ§ó§ï¡C - For detailed information on Local Area Networks and - configuring FreeBSD as a gateway/router refer to the - Advanced Networking - chapter. + ¦³Ãö LAN ©Î§â FreeBSD ³]©w¬° gateway ©Î router ½Ð°Ñ¾\¨Ï¥Î¤â¥U¤¤¦³Ãö + ºô¸ô¶i¶¥¹B¥Î ªº³¹¸`¡C User Confirmation Requested Would you like to configure any Ethernet or SLIP/PPP network devices? [ Yes ] No - To configure a network device, select - &gui.yes; and press Enter. - Otherwise, select &gui.no; to continue. + ¦pªG­n³]©wºô¸ô¥d¡A½Ð¿ï¾Ü &gui.yes; µM«á«ö Enter¡C + §_«h½Ð¿ï &gui.no; ¥HÄ~Äò¡C
- Selecting an Ethernet Device + ¿ï¾Üºô¸ô¥d
- Select the interface to be configured with the arrow keys and press - Enter. + ¥Î¤è¦VÁä¿ï¾Ü±z­n³]©wªººô¸ô¥d¡AµM«á«ö Enter¡C User Confirmation Requested Do you want to try IPv6 configuration of the interface? Yes [ No ] In this private local area network, the current Internet type protocol (IPv4) was sufficient and &gui.no; was selected with the arrow keys and Enter pressed. If you are connected to an existing IPv6 network with an RA server, then choose &gui.yes; and press Enter. It will take several seconds to scan for RA servers. User Confirmation Requested Do you want to try DHCP configuration of the interface? Yes [ No ] If DHCP (Dynamic Host Configuration Protocol) is not required select &gui.no; with the arrow keys and press Enter. Selecting &gui.yes; will execute dhclient, and if successful, will fill in the network configuration information automatically. Refer to for more information. The following Network Configuration screen shows the configuration of the Ethernet device for a system that will act as the gateway for a Local Area Network.
Set Network Configuration for ed0
Use Tab to select the information fields and fill in appropriate information: Host The fully-qualified hostname, such as k6-2.example.com in this case. Domain The name of the domain that your machine is in, such as example.com for this case. IPv4 Gateway IP address of host forwarding packets to non-local destinations. You must fill this in if the machine is a node on the network. Leave this field blank if the machine is the gateway to the Internet for the network. The IPv4 Gateway is also known as the default gateway or default route. Name server IP address of your local DNS server. There is no local DNS server on this private local area network so the IP address of the provider's DNS server (208.163.10.2) was used. IPv4 address The IP address to be used for this interface was 192.168.0.1 Netmask The address block being used for this local area network is a Class C block (192.168.0.0 - 192.168.255.255). The default netmask is for a Class C network (255.255.255.0). Extra options to ifconfig Any interface-specific options to ifconfig you would like to add. There were none in this case. Use Tab to select &gui.ok; when finished and press Enter. User Confirmation Requested Would you like to Bring Up the ed0 interface right now? [ Yes ] No Choosing &gui.yes; and pressing Enter will bring the machine up on the network and be ready for use. However, this does not accomplish much during installation, since the machine still needs to be rebooted.
Configure Gateway User Confirmation Requested Do you want this machine to function as a network gateway? [ Yes ] No If the machine will be acting as the gateway for a local area network and forwarding packets between other machines then select &gui.yes; and press Enter. If the machine is a node on a network then select &gui.no; and press Enter to continue. Configure Internet Services User Confirmation Requested Do you want to configure inetd and the network services that it provides? Yes [ No ] If &gui.no; is selected, various services such telnetd will not be enabled. This means that remote users will not be able to telnet into this machine. Local users will be still be able to access remote machines with telnet. These services can be enabled after installation by editing /etc/inetd.conf with your favorite text editor. See for more information. Select &gui.yes; if you wish to configure these services during install. An additional confirmation will display: User Confirmation Requested The Internet Super Server (inetd) allows a number of simple Internet services to be enabled, including finger, ftp and telnetd. Enabling these services may increase risk of security problems by increasing the exposure of your system. With this in mind, do you wish to enable inetd? [ Yes ] No Select &gui.yes; to continue. User Confirmation Requested inetd(8) relies on its configuration file, /etc/inetd.conf, to determine which of its Internet services will be available. The default FreeBSD inetd.conf(5) leaves all services disabled by default, so they must be specifically enabled in the configuration file before they will function, even once inetd(8) is enabled. Note that services for IPv6 must be separately enabled from IPv4 services. Select [Yes] now to invoke an editor on /etc/inetd.conf, or [No] to use the current settings. [ Yes ] No Selecting &gui.yes; will allow adding services by deleting the # at the beginning of a line.
Editing <filename>inetd.conf</filename>
After adding the desired services, pressing Esc will display a menu which will allow exiting and saving the changes.
Anonymous FTP FTP anonymous User Confirmation Requested Do you want to have anonymous FTP access to this machine? Yes [ No ] Deny Anonymous FTP Selecting the default &gui.no; and pressing Enter will still allow users who have accounts with passwords to use FTP to access the machine. Allow Anonymous FTP Anyone can access your machine if you elect to allow anonymous FTP connections. The security implications should be considered before enabling this option. For more information about security see . To allow anonymous FTP, use the arrow keys to select &gui.yes; and press Enter. The following screen (or similar) will display:
Default Anonymous FTP Configuration
Pressing F1 will display the help: This screen allows you to configure the anonymous FTP user. The following configuration values are editable: UID: The user ID you wish to assign to the anonymous FTP user. All files uploaded will be owned by this ID. Group: Which group you wish the anonymous FTP user to be in. Comment: String describing this user in /etc/passwd FTP Root Directory: Where files available for anonymous FTP will be kept. Upload subdirectory: Where files uploaded by anonymous FTP users will go. The ftp root directory will be put in /var by default. If you do not have enough room there for the anticipated FTP needs, the /usr directory could be used by setting the FTP Root Directory to /usr/ftp. When you are satisfied with the values, press Enter to continue. User Confirmation Requested Create a welcome message file for anonymous FTP users? [ Yes ] No If you select &gui.yes; and press Enter, an editor will automatically start allowing you to edit the message.
Edit the FTP Welcome Message
This is a text editor called ee. Use the instructions to change the message or change the message later using a text editor of your choice. Note the file name/location at the bottom of the editor screen. Press Esc and a pop-up menu will default to a) leave editor. Press Enter to exit and continue. Press Enter again to save changes if you made any.
Configure Network File System Network File System (NFS) allows sharing of files across a network. A machine can be configured as a server, a client, or both. Refer to for a more information. NFS Server User Confirmation Requested Do you want to configure this machine as an NFS server? Yes [ No ] If there is no need for a Network File System server, select &gui.no; and press Enter. If &gui.yes; is chosen, a message will pop-up indicating that the exports file must be created. Message Operating as an NFS server means that you must first configure an /etc/exports file to indicate which hosts are allowed certain kinds of access to your local filesystems. Press [Enter] now to invoke an editor on /etc/exports [ OK ] Press Enter to continue. A text editor will start allowing the exports file to be created and edited.
Editing <filename>exports</filename>
Use the instructions to add the actual exported filesystems now or later using a text editor of your choice. Note the file name/location at the bottom of the editor screen. Press Esc and a pop-up menu will default to a) leave editor. Press Enter to exit and continue.
NFS Client The NFS client allows your machine to access NFS servers. User Confirmation Requested Do you want to configure this machine as an NFS client? Yes [ No ] With the arrow keys, select &gui.yes; or &gui.no; as appropriate and press Enter.
Security Profile A security profile is a set of configuration options that attempts to achieve the desired ratio of security to convenience by enabling and disabling certain programs and other settings. The more severe the security profile, the fewer programs will be enabled by default. This is one of the basic principles of security: do not run anything except what you must. Please note that the security profile is just a default setting. All programs can be enabled and disabled after you have installed FreeBSD by editing or adding the appropriate line(s) to /etc/rc.conf. For more information, please see the &man.rc.conf.5; manual page. The following table describes what each of the security profiles does. The columns are the choices you have for a security profile, and the rows are the program or feature that the profile enables or disables. Possible Security Profiles Extreme Moderate &man.sendmail.8; NO YES &man.sshd.8; NO YES &man.portmap.8; NO MAYBE The portmapper is enabled if the machine has been configured as an NFS client or server earlier in the installation. NFS server NO YES &man.securelevel.8; YES If you choose a security profile that sets the securelevel to Extreme or High, you must be aware of the implications. Please read the &man.init.8; manual page and pay particular attention to the meanings of the security levels, or you may have significant trouble later! NO
User Confirmation Requested Do you want to select a default security profile for this host (select No for "medium" security)? [ Yes ] No Selecting &gui.no; and pressing Enter will set the security profile to medium. Selecting &gui.yes; and pressing Enter will allow selecting a different security profile.
Security Profile Options
Press F1 to display the help. Press Enter to return to selection menu. Use the arrow keys to choose Medium unless your are sure that another level is required for your needs. With &gui.ok; highlighted, press Enter. An appropriate confirmation message will display depending on which security setting was chosen. Message Moderate security settings have been selected. Sendmail and SSHd have been enabled, securelevels are disabled, and NFS server setting have been left intact. PLEASE NOTE that this still does not save you from having to properly secure your system in other ways or exercise due diligence in your administration, this simply picks a standard set of out-of-box defaults to start with. To change any of these settings later, edit /etc/rc.conf [OK] Message Extreme security settings have been selected. Sendmail, SSHd, and NFS services have been disabled, and securelevels have been enabled. PLEASE NOTE that this still does not save you from having to properly secure your system in other ways or exercise due diligence in your administration, this simply picks a more secure set of out-of-box defaults to start with. To change any of these settings later, edit /etc/rc.conf [OK] Press Enter to continue with the post-installation configuration. The security profile is not a silver bullet! Even if you use the extreme setting, you need to keep up with security issues by reading an appropriate mailing list (), using good passwords and passphrases, and generally adhering to good security practices. It simply sets up the desired security to convenience ratio out of the box.
System Console Settings There are several options available to customize the system console. User Confirmation Requested Would you like to customize your system console settings? [ Yes ] No To view and configure the options, select &gui.yes; and press Enter.
System Console Configuration Options
A commonly used option is the screen saver. Use the arrow keys to select Saver and then press Enter.
Screen Saver Options
Select the desired screen saver using the arrow keys and then press Enter. The System Console Configuration menu will redisplay. The default time interval is 300 seconds. To change the time interval, select Saver again. At the Screen Saver Options menu, select Timeout using the arrow keys and press Enter. A pop-up menu will appear:
Screen Saver Timeout
The value can be changed, then select &gui.ok; and press Enter to return to the System Console Configuration menu.
System Console Configuration Exit
Selecting Exit and pressing Enter will continue with the post-installation configurations.
Setting the Time Zone Setting the time zone for your machine will allow it to automatically correct for any regional time changes and perform other time zone related functions properly. The example shown is for a machine located in the Eastern time zone of the United States. Your selections will vary according to your geographical location. User Confirmation Requested Would you like to set this machine's time zone now? [ Yes ] No Select &gui.yes; and press Enter to set the time zone. User Confirmation Requested Is this machine's CMOS clock set to UTC? If it is set to local time or you don't know, please choose NO here! Yes [ No ] Select &gui.yes; or &gui.no; according to how the machine's clock is configured and press Enter.
Select Your Region
The appropriate region is selected using the arrow keys and then pressing Enter.
Select Your Country
Select the appropriate country using the arrow keys and press Enter.
Select Your Time Zone
The appropriate time zone is selected using the arrow keys and pressing Enter. Confirmation Does the abbreviation 'EDT' look reasonable? [ Yes ] No Confirm the abbreviation for the time zone is correct. If it looks okay, press Enter to continue with the post-installation configuration.
Linux Compatibility User Confirmation Requested Would you like to enable Linux binary compatibility? [ Yes ] No Selecting &gui.yes; and pressing Enter will allow running Linux software on FreeBSD. The install will add the appropriate packages for Linux compatibility. If installing by FTP, the machine will need to be connected to the Internet. Sometimes a remote ftp site will not have all the distributions like the Linux binary compatibility. This can be installed later if necessary. Mouse Settings This option will allow you to cut and paste text in the console and user programs with a 3-button mouse. If using a 2-button mouse, refer to manual page, &man.moused.8;, after installation for details on emulating the 3-button style. This example depicts a non-USB mouse configuration (such as a PS/2 or COM port mouse): User Confirmation Requested Does this system have a non-USB mouse attached to it? [ Yes ] No Select &gui.yes; for a non-USB mouse or &gui.no; for a USB mouse and press Enter.
Select Mouse Protocol Type
Use the arrow keys to select Type and press Enter.
Set Mouse Protocol
The mouse used in this example is a PS/2 type, so the default Auto was appropriate. To change protocol, use the arrow keys to select another option. Ensure that &gui.ok; is highlighted and press Enter to exit this menu.
Configure Mouse Port
Use the arrow keys to select Port and press Enter.
Setting the Mouse Port
This system had a PS/2 mouse, so the default PS/2 was appropriate. To change the port, use the arrow keys and then press Enter.
Enable the Mouse Daemon
Last, use the arrow keys to select Enable, and press Enter to enable and test the mouse daemon.
Test the Mouse Daemon
Move the mouse around the screen and verify the cursor shown responds properly. If it does, select &gui.yes; and press Enter. If not, the mouse has not been configured correctly — select &gui.no; and try using different configuration options. Select Exit with the arrow keys and press Enter to return to continue with the post-installation configuration.
Tom Rhodes Contributed by Configure Additional Network Services Configuring network services can be a daunting task for new users if they lack previous knowledge in this area. Networking, including the Internet, is critical to all modern operating systems including &os;; as a result, it is very useful to have some understanding &os;'s extensive networking capabilities. Doing this during the installation will ensure users have some understanding of the various services available to them. Network services are programs that accept input from anywhere on the network. Every effort is made to make sure these programs will not do anything harmful. Unfortunately, programmers are not perfect and through time there have been cases where bugs in network services have been exploited by attackers to do bad things. It is important that you only enable the network services you know that you need. If in doubt it is best if you do not enable a network service until you find out that you do need it. You can always enable it later by re-running sysinstall or by using the features provided by the /etc/rc.conf file. Selecting the Networking option will display a menu similar to the one below:
Network Configuration Upper-level
The first option, Interfaces, was previously covered during the , thus this option can safely be ignored. Selecting the AMD option adds support for the BSD automatic mount utility. This is usually used in conjunction with the NFS protocol (see below) for automatically mounting remote file systems. No special configuration is required here. Next in line is the AMD Flags option. When selected, a menu will pop up for you to enter specific AMD flags. The menu already contains a set of default options: -a /.amd_mnt -l syslog /host /etc/amd.map /net /etc/amd.map The option sets the default mount location which is specified here as /.amd_mnt. The option specifies the default log file; however, when syslogd is used all log activity will be sent to the system log daemon. The /host directory is used to mount an exported file system from a remote host, while /net directory is used to mount an exported file system from an IP address. The /etc/amd.map file defines the default options for AMD exports. FTP anonymous The Anon FTP option permits anonymous FTP connections. Select this option to make this machine an anonymous FTP server. Be aware of the security risks involved with this option. Another menu will be displayed to explain the security risks and configuration in depth. The Gateway configuration menu will set the machine up to be a gateway as explained previously. This can be used to unset the Gateway option if you accidentally selected it during the installation process. The Inetd option can be used to configure or completely disable the &man.inetd.8; daemon as discussed above. The Mail option is used to configure the system's default MTA or Mail Transfer Agent. Selecting this option will bring up the following menu:
Select a default MTA
Here you are offered a choice as to which MTA to install and set as the default. An MTA is nothing more than a mail server which delivers email to users on the system or the Internet. Selecting Sendmail will install the popular sendmail server which is the &os; default. The Sendmail local option will set sendmail to be the default MTA, but disable its ability to receive incoming email from the Internet. The other options here, Postfix and Exim act similar to Sendmail. They both deliver email; however, some users prefer these alternatives to the sendmail MTA. After selecting an MTA, or choosing not to select an MTA, the network configuration menu will appear with the next option being NFS client. The NFS client option will configure the system to communicate with a server via NFS. An NFS server makes file systems available to other machines on the network via the NFS protocol. If this is a stand alone machine, this option can remain unselected. The system may require more configuration later; see for more information about client and server configuration. Below that option is the NFS server option, permitting you to set the system up as an NFS server. This adds the required information to start up the RPC remote procedure call services. RPC is used to coordinate connections between hosts and programs. Next in line is the Ntpdate option, which deals with time synchronization. When selected, a menu like the one below shows up:
Ntpdate Configuration
From this menu, select the server which is the closest to your location. Selecting a close one will make the time synchronization more accurate as a server further from your location may have more connection latency. The next option is the PCNFSD selection. This option will install the net/pcnfsd package from the Ports Collection. This is a useful utility which provides NFS authentication services for systems which are unable to provide their own, such as Microsoft's &ms-dos; operating system. Now you must scroll down a bit to see the other options:
Network Configuration Lower-level
The &man.rpcbind.8;, &man.rpc.statd.8;, and &man.rpc.lockd.8; utilities are all used for Remote Procedure Calls (RPC). The rpcbind utility manages communication between NFS servers and clients, and is required for NFS servers to operate correctly. The rpc.statd daemon interacts with the rpc.statd daemon on other hosts to provide status monitoring. The reported status is usually held in the /var/db/statd.status file. The next option listed here is the rpc.lockd option, which, when selected, will provide file locking services. This is usually used with rpc.statd to monitor what hosts are requesting locks and how frequently they request them. While these last two options are marvelous for debugging, they are not required for NFS servers and clients to operate correctly. As you progress down the list the next item here is Routed, which is the routing daemon. The &man.routed.8; utility manages network routing tables, discovers multicast routers, and supplies a copy of the routing tables to any physically connected host on the network upon request. This is mainly used for machines which act as a gateway for the local network. When selected, a menu will be presented requesting the default location of the utility. The default location is already defined for you and can be selected with the Enter key. You will then be presented with yet another menu, this time asking for the flags you wish to pass on to routed. The default is and it should already appear on the screen. Next in line is the Rwhod option which, when selected, will start the &man.rwhod.8; daemon during system initialization. The rwhod utility broadcasts system messages across the network periodically, or collects them when in consumer mode. More information can be found in the &man.ruptime.1; and &man.rwho.1; manual pages. The next to the last option in the list is for the &man.sshd.8; daemon. This is the secure shell server for OpenSSH and it is highly recommended over the standard telnet and FTP servers. The sshd server is used to create a secure connection from one host to another by using encrypted connections. Finally there is the TCP Extensions option. This enables the TCP Extensions defined in RFC 1323 and RFC 1644. While on many hosts this can speed up connections, it can also cause some connections to be dropped. It is not recommended for servers, but may be beneficial for stand alone machines. Now that you have configured the network services, you can scroll up to the very top item which is Exit and continue on to the next configuration section.
Configure X Server As of &os; 5.3-RELEASE, the X server configuration facility has been removed from sysinstall, you have to install and configure the X server after the installation of &os;. More information regarding the installation and the configuration of a X server can be found in . You can skip this section if you are not installing a &os; version prior to 5.3-RELEASE. In order to use a graphical user interface such as KDE, GNOME, or others, the X server will need to be configured. In order to run &xfree86; as a non root user you will need to have x11/wrapper installed. This is installed by default beginning with FreeBSD 4.7. For earlier versions this can be added from the Package Selection menu. To see whether your video card is supported, check the &xfree86; web site. User Confirmation Requested Would you like to configure your X server at this time? [ Yes ] No It is necessary to know your monitor specifications and video card information. Equipment damage can occur if settings are incorrect. If you do not have this information, select &gui.no; and perform the configuration after installation when you have the information using sysinstall (/stand/sysinstall in &os; versions older than 5.2), selecting Configure and then XFree86. Improper configuration of the X server at this time can leave the machine in a frozen state. It is often advised to configure the X server once the installation has completed. If you have graphics card and monitor information, select &gui.yes; and press Enter to proceed with configuring the X server.
Select Configuration Method Menu
There are several ways to configure the X server. Use the arrow keys to select one of the methods and press Enter. Be sure to read all instructions carefully. The xf86cfg and xf86cfg -textmode methods may make the screen go dark and take a few seconds to start. Be patient. The following will illustrate the use of the xf86config configuration tool. The configuration choices you make will depend on the hardware in the system so your choices will probably be different than those shown: Message You have configured and been running the mouse daemon. Choose "/dev/sysmouse" as the mouse port and "SysMouse" or "MouseSystems" as the mouse protocol in the X configuration utility. [ OK ] [ Press enter to continue ] This indicates that the mouse daemon previously configured has been detected. Press Enter to continue. Starting xf86config will display a brief introduction: This program will create a basic XF86Config file, based on menu selections you make. The XF86Config file usually resides in /usr/X11R6/etc/X11 or /etc/X11. A sample XF86Config file is supplied with XFree86; it is configured for a standard VGA card and monitor with 640x480 resolution. This program will ask for a pathname when it is ready to write the file. You can either take the sample XF86Config as a base and edit it for your configuration, or let this program produce a base XF86Config file for your configuration and fine-tune it. Before continuing with this program, make sure you know what video card you have, and preferably also the chipset it uses and the amount of video memory on your video card. SuperProbe may be able to help with this. Press enter to continue, or ctrl-c to abort. Pressing Enter will start the mouse configuration. Be sure to follow the instructions and use Mouse Systems as the mouse protocol and /dev/sysmouse as the mouse port even if using a PS/2 mouse is shown as an illustration. First specify a mouse protocol type. Choose one from the following list: 1. Microsoft compatible (2-button protocol) 2. Mouse Systems (3-button protocol) & FreeBSD moused protocol 3. Bus Mouse 4. PS/2 Mouse 5. Logitech Mouse (serial, old type, Logitech protocol) 6. Logitech MouseMan (Microsoft compatible) 7. MM Series 8. MM HitTablet 9. Microsoft IntelliMouse If you have a two-button mouse, it is most likely of type 1, and if you have a three-button mouse, it can probably support both protocol 1 and 2. There are two main varieties of the latter type: mice with a switch to select the protocol, and mice that default to 1 and require a button to be held at boot-time to select protocol 2. Some mice can be convinced to do 2 by sending a special sequence to the serial port (see the ClearDTR/ClearRTS options). Enter a protocol number: 2 You have selected a Mouse Systems protocol mouse. If your mouse is normally in Microsoft-compatible mode, enabling the ClearDTR and ClearRTS options may cause it to switch to Mouse Systems mode when the server starts. Please answer the following question with either 'y' or 'n'. Do you want to enable ClearDTR and ClearRTS? n You have selected a three-button mouse protocol. It is recommended that you do not enable Emulate3Buttons, unless the third button doesn't work. Please answer the following question with either 'y' or 'n'. Do you want to enable Emulate3Buttons? y Now give the full device name that the mouse is connected to, for example /dev/tty00. Just pressing enter will use the default, /dev/mouse. On FreeBSD, the default is /dev/sysmouse. Mouse device: /dev/sysmouse The keyboard is the next item to be configured. A generic 101-key model is shown for illustration. Any name may be used for the variant or simply press Enter to accept the default value. Please select one of the following keyboard types that is the better description of your keyboard. If nothing really matches, choose 1 (Generic 101-key PC) 1 Generic 101-key PC 2 Generic 102-key (Intl) PC 3 Generic 104-key PC 4 Generic 105-key (Intl) PC 5 Dell 101-key PC 6 Everex STEPnote 7 Keytronic FlexPro 8 Microsoft Natural 9 Northgate OmniKey 101 10 Winbook Model XP5 11 Japanese 106-key 12 PC-98xx Series 13 Brazilian ABNT2 14 HP Internet 15 Logitech iTouch 16 Logitech Cordless Desktop Pro 17 Logitech Internet Keyboard 18 Logitech Internet Navigator Keyboard 19 Compaq Internet 20 Microsoft Natural Pro 21 Genius Comfy KB-16M 22 IBM Rapid Access 23 IBM Rapid Access II 24 Chicony Internet Keyboard 25 Dell Internet Keyboard Enter a number to choose the keyboard. 1 Please select the layout corresponding to your keyboard 1 U.S. English 2 U.S. English w/ ISO9995-3 3 U.S. English w/ deadkeys 4 Albanian 5 Arabic 6 Armenian 7 Azerbaidjani 8 Belarusian 9 Belgian 10 Bengali 11 Brazilian 12 Bulgarian 13 Burmese 14 Canadian 15 Croatian 16 Czech 17 Czech (qwerty) 18 Danish Enter a number to choose the country. Press enter for the next page 1 Please enter a variant name for 'us' layout. Or just press enter for default variant us Please answer the following question with either 'y' or 'n'. Do you want to select additional XKB options (group switcher, group indicator, etc.)? n Next, we proceed to the configuration for the monitor. Do not exceed the ratings of your monitor. Damage could occur. If you have any doubts, do the configuration after you have the information. Now we want to set the specifications of the monitor. The two critical parameters are the vertical refresh rate, which is the rate at which the whole screen is refreshed, and most importantly the horizontal sync rate, which is the rate at which scanlines are displayed. The valid range for horizontal sync and vertical sync should be documented in the manual of your monitor. If in doubt, check the monitor database /usr/X11R6/lib/X11/doc/Monitors to see if your monitor is there. Press enter to continue, or ctrl-c to abort. You must indicate the horizontal sync range of your monitor. You can either select one of the predefined ranges below that correspond to industry- standard monitor types, or give a specific range. It is VERY IMPORTANT that you do not specify a monitor type with a horizontal sync range that is beyond the capabilities of your monitor. If in doubt, choose a conservative setting. hsync in kHz; monitor type with characteristic modes 1 31.5; Standard VGA, 640x480 @ 60 Hz 2 31.5 - 35.1; Super VGA, 800x600 @ 56 Hz 3 31.5, 35.5; 8514 Compatible, 1024x768 @ 87 Hz interlaced (no 800x600) 4 31.5, 35.15, 35.5; Super VGA, 1024x768 @ 87 Hz interlaced, 800x600 @ 56 Hz 5 31.5 - 37.9; Extended Super VGA, 800x600 @ 60 Hz, 640x480 @ 72 Hz 6 31.5 - 48.5; Non-Interlaced SVGA, 1024x768 @ 60 Hz, 800x600 @ 72 Hz 7 31.5 - 57.0; High Frequency SVGA, 1024x768 @ 70 Hz 8 31.5 - 64.3; Monitor that can do 1280x1024 @ 60 Hz 9 31.5 - 79.0; Monitor that can do 1280x1024 @ 74 Hz 10 31.5 - 82.0; Monitor that can do 1280x1024 @ 76 Hz 11 Enter your own horizontal sync range Enter your choice (1-11): 6 You must indicate the vertical sync range of your monitor. You can either select one of the predefined ranges below that correspond to industry- standard monitor types, or give a specific range. For interlaced modes, the number that counts is the high one (e.g. 87 Hz rather than 43 Hz). 1 50-70 2 50-90 3 50-100 4 40-150 5 Enter your own vertical sync range Enter your choice: 2 You must now enter a few identification/description strings, namely an identifier, a vendor name, and a model name. Just pressing enter will fill in default names. The strings are free-form, spaces are allowed. Enter an identifier for your monitor definition: Hitachi The selection of a video card driver from a list is next. If you pass your card on the list, continue to press Enter and the list will repeat. Only an excerpt from the list is shown: Now we must configure video card specific settings. At this point you can choose to make a selection out of a database of video card definitions. Because there can be variation in Ramdacs and clock generators even between cards of the same model, it is not sensible to blindly copy the settings (e.g. a Device section). For this reason, after you make a selection, you will still be asked about the components of the card, with the settings from the chosen database entry presented as a strong hint. The database entries include information about the chipset, what driver to run, the Ramdac and ClockChip, and comments that will be included in the Device section. However, a lot of definitions only hint about what driver to run (based on the chipset the card uses) and are untested. If you can't find your card in the database, there's nothing to worry about. You should only choose a database entry that is exactly the same model as your card; choosing one that looks similar is just a bad idea (e.g. a GemStone Snail 64 may be as different from a GemStone Snail 64+ in terms of hardware as can be). Do you want to look at the card database? y 288 Matrox Millennium G200 8MB mgag200 289 Matrox Millennium G200 SD 16MB mgag200 290 Matrox Millennium G200 SD 4MB mgag200 291 Matrox Millennium G200 SD 8MB mgag200 292 Matrox Millennium G400 mgag400 293 Matrox Millennium II 16MB mga2164w 294 Matrox Millennium II 4MB mga2164w 295 Matrox Millennium II 8MB mga2164w 296 Matrox Mystique mga1064sg 297 Matrox Mystique G200 16MB mgag200 298 Matrox Mystique G200 4MB mgag200 299 Matrox Mystique G200 8MB mgag200 300 Matrox Productiva G100 4MB mgag100 301 Matrox Productiva G100 8MB mgag100 302 MediaGX mediagx 303 MediaVision Proaxcel 128 ET6000 304 Mirage Z-128 ET6000 305 Miro CRYSTAL VRX Verite 1000 Enter a number to choose the corresponding card definition. Press enter for the next page, q to continue configuration. 288 Your selected card definition: Identifier: Matrox Millennium G200 8MB Chipset: mgag200 Driver: mga Do NOT probe clocks or use any Clocks line. Press enter to continue, or ctrl-c to abort. Now you must give information about your video card. This will be used for the "Device" section of your video card in XF86Config. You must indicate how much video memory you have. It is probably a good idea to use the same approximate amount as that detected by the server you intend to use. If you encounter problems that are due to the used server not supporting the amount memory you have (e.g. ATI Mach64 is limited to 1024K with the SVGA server), specify the maximum amount supported by the server. How much video memory do you have on your video card: 1 256K 2 512K 3 1024K 4 2048K 5 4096K 6 Other Enter your choice: 6 Amount of video memory in Kbytes: 8192 You must now enter a few identification/description strings, namely an identifier, a vendor name, and a model name. Just pressing enter will fill in default names (possibly from a card definition). Your card definition is Matrox Millennium G200 8MB. The strings are free-form, spaces are allowed. Enter an identifier for your video card definition: Next, the video modes are set for the resolutions desired. Typically, useful ranges are 640x480, 800x600, and 1024x768 but those are a function of video card capability, monitor size, and eye comfort. When selecting a color depth, select the highest mode that your card will support. For each depth, a list of modes (resolutions) is defined. The default resolution that the server will start-up with will be the first listed mode that can be supported by the monitor and card. Currently it is set to: "640x480" "800x600" "1024x768" "1280x1024" for 8-bit "640x480" "800x600" "1024x768" "1280x1024" for 16-bit "640x480" "800x600" "1024x768" "1280x1024" for 24-bit Modes that cannot be supported due to monitor or clock constraints will be automatically skipped by the server. 1 Change the modes for 8-bit (256 colors) 2 Change the modes for 16-bit (32K/64K colors) 3 Change the modes for 24-bit (24-bit color) 4 The modes are OK, continue. Enter your choice: 2 Select modes from the following list: 1 "640x400" 2 "640x480" 3 "800x600" 4 "1024x768" 5 "1280x1024" 6 "320x200" 7 "320x240" 8 "400x300" 9 "1152x864" a "1600x1200" b "1800x1400" c "512x384" Please type the digits corresponding to the modes that you want to select. For example, 432 selects "1024x768" "800x600" "640x480", with a default mode of 1024x768. Which modes? 432 You can have a virtual screen (desktop), which is screen area that is larger than the physical screen and which is panned by moving the mouse to the edge of the screen. If you don't want virtual desktop at a certain resolution, you cannot have modes listed that are larger. Each color depth can have a differently-sized virtual screen Please answer the following question with either 'y' or 'n'. Do you want a virtual screen that is larger than the physical screen? n For each depth, a list of modes (resolutions) is defined. The default resolution that the server will start-up with will be the first listed mode that can be supported by the monitor and card. Currently it is set to: "640x480" "800x600" "1024x768" "1280x1024" for 8-bit "1024x768" "800x600" "640x480" for 16-bit "640x480" "800x600" "1024x768" "1280x1024" for 24-bit Modes that cannot be supported due to monitor or clock constraints will be automatically skipped by the server. 1 Change the modes for 8-bit (256 colors) 2 Change the modes for 16-bit (32K/64K colors) 3 Change the modes for 24-bit (24-bit color) 4 The modes are OK, continue. Enter your choice: 4 Please specify which color depth you want to use by default: 1 1 bit (monochrome) 2 4 bits (16 colors) 3 8 bits (256 colors) 4 16 bits (65536 colors) 5 24 bits (16 million colors) Enter a number to choose the default depth. 4 Finally, the configuration needs to be saved. Be sure to enter /etc/X11/XF86Config as the location for saving the configuration. I am going to write the XF86Config file now. Make sure you don't accidently overwrite a previously configured one. Shall I write it to /etc/X11/XF86Config? y If the configuration fails, you can try the configuration again by selecting &gui.yes; when the following message appears: User Confirmation Requested The XFree86 configuration process seems to have failed. Would you like to try again? [ Yes ] No If you have trouble configuring &xfree86;, select &gui.no; and press Enter and continue with the installation process. After installation you can use xf86cfg -textmode or xf86config to access the command line configuration utilities as root. There is an additional method for configuring &xfree86; described in . If you choose not to configure &xfree86; at this time the next menu will be for package selection. The default setting which allows the server to be killed is the hotkey sequence CtrlAlt Backspace. This can be executed if something is wrong with the server settings and prevent hardware damage. The default setting that allows video mode switching will permit changing of the mode while running X with the hotkey sequence CtrlAlt+ or CtrlAlt- . After you have &xfree86; running, the display can be adjusted for height, width, or centering by using xvidtune. There are warnings that improper settings can damage your equipment. Heed them. If in doubt, do not do it. Instead, use the monitor controls to adjust the display for X Window. There may be some display differences when switching back to text mode, but it is better than damaging equipment. Read the &man.xvidtune.1; manual page before making any adjustments. Following a successful &xfree86; configuration, it will proceed to the selection of a default desktop.
Select Default X Desktop As of &os; 5.3-RELEASE, the X desktop selection facility has been removed from sysinstall, you have to configure the X desktop after the installation of &os;. More information regarding the installation and the configuration of a X desktop can be found in . You can skip this section if you are not installing a &os; version prior to 5.3-RELEASE. There are a variety of window managers available. They range from very basic environments to full desktop environments with a large suite of software. Some require only minimal disk space and low memory while others with more features require much more. The best way to determine which is most suitable for you is to try a few different ones. Those are available from the Ports Collection or as packages and can be added after installation. You can select one of the popular desktops to be installed and configured as the default desktop. This will allow you to start it right after installation.
Select Default Desktop
Use the arrow keys to select a desktop and press Enter. Installation of the selected desktop will proceed.
Install Packages Packages are pre-compiled binaries and are a convenient way to install software. Installation of one package is shown for purposes of illustration. Additional packages can also be added at this time if desired. After installation sysinstall (/stand/sysinstall in &os; versions older than 5.2) can be used to add additional packages. User Confirmation Requested The FreeBSD package collection is a collection of hundreds of ready-to-run applications, from text editors to games to WEB servers and more. Would you like to browse the collection now? [ Yes ] No Selecting &gui.yes; and pressing Enter will be followed by the Package Selection screens:
Select Package Category
Only packages on the current installation media are available for installation at any given time. All packages available will be displayed if All is selected or you can select a particular category. Highlight your selection with the arrow keys and press Enter. A menu will display showing all the packages available for the selection made:
Select Packages
The bash shell is shown selected. Select as many as desired by highlighting the package and pressing the Space key. A short description of each package will appear in the lower left corner of the screen. Pressing the Tab key will toggle between the last selected package, &gui.ok;, and &gui.cancel;. When you have finished marking the packages for installation, press Tab once to toggle to the &gui.ok; and press Enter to return to the Package Selection menu. The left and right arrow keys will also toggle between &gui.ok; and &gui.cancel;. This method can also be used to select &gui.ok; and press Enter to return to the Package Selection menu.
Install Packages
Use the Tab and arrow keys to select [ Install ] and press Enter. You will then need to confirm that you want to install the packages:
Confirm Package Installation
Selecting &gui.ok; and pressing Enter will start the package installation. Installing messages will appear until completed. Make note if there are any error messages. The final configuration continues after packages are installed. If you end up not selecting any packages, and wish to return to the final configuration, select Install anyways.
Add Users/Groups You should add at least one user during the installation so that you can use the system without being logged in as root. The root partition is generally small and running applications as root can quickly fill it. A bigger danger is noted below: User Confirmation Requested Would you like to add any initial user accounts to the system? Adding at least one account for yourself at this stage is suggested since working as the "root" user is dangerous (it is easy to do things which adversely affect the entire system). [ Yes ] No Select &gui.yes; and press Enter to continue with adding a user.
Select User
Select User with the arrow keys and press Enter.
Add User Information
The following descriptions will appear in the lower part of the screen as the items are selected with Tab to assist with entering the required information: Login ID The login name of the new user (mandatory). UID The numerical ID for this user (leave blank for automatic choice). Group The login group name for this user (leave blank for automatic choice). Password The password for this user (enter this field with care!). Full name The user's full name (comment). Member groups The groups this user belongs to (i.e. gets access rights for). Home directory The user's home directory (leave blank for default). Login shell The user's login shell (leave blank for default, e.g. /bin/sh). The login shell was changed from /bin/sh to /usr/local/bin/bash to use the bash shell that was previously installed as a package. Do not try to use a shell that does not exist or you will not be able to login. The most common shell used in the BSD-world is the C shell, which can be indicated as /bin/tcsh. The user was also added to the wheel group to be able to become a superuser with root privileges. When you are satisfied, press &gui.ok; and the User and Group Management menu will redisplay:
Exit User and Group Management
Groups can also be added at this time if specific needs are known. Otherwise, this may be accessed through using sysinstall (/stand/sysinstall in &os; versions older than 5.2) after installation is completed. When you are finished adding users, select Exit with the arrow keys and press Enter to continue the installation.
Set the <username>root</username> Password Message Now you must set the system manager's password. This is the password you'll use to log in as "root". [ OK ] [ Press enter to continue ] Press Enter to set the root password. The password will need to be typed in twice correctly. Needless to say, make sure you have a way of finding the password if you forget. Notice that the password you type in is not echoed, nor are asterisks displayed. Changing local password for root. New password : Retype new password : The installation will continue after the password is successfully entered. Exiting Install If you need to configure additional network devices or any other configuration, you can do it at this point or after installation with sysinstall (/stand/sysinstall in &os; versions older than 5.2). User Confirmation Requested Visit the general configuration menu for a chance to set any last options? Yes [ No ] Select &gui.no; with the arrow keys and press Enter to return to the Main Installation Menu.
Exit Install
Select [X Exit Install] with the arrow keys and press Enter. You will be asked to confirm exiting the installation: User Confirmation Requested Are you sure you wish to exit? The system will reboot (be sure to remove any floppies from the drives). [ Yes ] No Select &gui.yes; and remove the floppy if booting from the floppy. The CDROM drive is locked until the machine starts to reboot. The CDROM drive is then unlocked and the disk can be removed from drive (quickly). The system will reboot so watch for any error messages that may appear.
FreeBSD Bootup FreeBSD Bootup on the &i386; If everything went well, you will see messages scroll off the screen and you will arrive at a login prompt. You can view the content of the messages by pressing Scroll-Lock and using PgUp and PgDn. Pressing Scroll-Lock again will return to the prompt. The entire message may not display (buffer limitation) but it can be viewed from the command line after logging in by typing dmesg at the prompt. Login using the username/password you set during installation (rpratt, in this example). Avoid logging in as root except when necessary. Typical boot messages (version information omitted): Copyright (c) 1992-2002 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. Timecounter "i8254" frequency 1193182 Hz CPU: AMD-K6(tm) 3D processor (300.68-MHz 586-class CPU) Origin = "AuthenticAMD" Id = 0x580 Stepping = 0 Features=0x8001bf<FPU,VME,DE,PSE,TSC,MSR,MCE,CX8,MMX> AMD Features=0x80000800<SYSCALL,3DNow!> real memory = 268435456 (262144K bytes) config> di sn0 config> di lnc0 config> di le0 config> di ie0 config> di fe0 config> di cs0 config> di bt0 config> di aic0 config> di aha0 config> di adv0 config> q avail memory = 256311296 (250304K bytes) Preloaded elf kernel "kernel" at 0xc0491000. Preloaded userconfig_script "/boot/kernel.conf" at 0xc049109c. md0: Malloc disk Using $PIR table, 4 entries at 0xc00fde60 npx0: <math processor> on motherboard npx0: INT 16 interface pcib0: <Host to PCI bridge> on motherboard pci0: <PCI bus> on pcib0 pcib1: <VIA 82C598MVP (Apollo MVP3) PCI-PCI (AGP) bridge> at device 1.0 on pci0 pci1: <PCI bus> on pcib1 pci1: <Matrox MGA G200 AGP graphics accelerator> at 0.0 irq 11 isab0: <VIA 82C586 PCI-ISA bridge> at device 7.0 on pci0 isa0: <ISA bus> on isab0 atapci0: <VIA 82C586 ATA33 controller> port 0xe000-0xe00f at device 7.1 on pci0 ata0: at 0x1f0 irq 14 on atapci0 ata1: at 0x170 irq 15 on atapci0 uhci0: <VIA 83C572 USB controller> port 0xe400-0xe41f irq 10 at device 7.2 on pci0 usb0: <VIA 83C572 USB controller> on uhci0 usb0: USB revision 1.0 uhub0: VIA UHCI root hub, class 9/0, rev 1.00/1.00, addr 1 uhub0: 2 ports with 2 removable, self powered chip1: <VIA 82C586B ACPI interface> at device 7.3 on pci0 ed0: <NE2000 PCI Ethernet (RealTek 8029)> port 0xe800-0xe81f irq 9 at device 10.0 on pci0 ed0: address 52:54:05:de:73:1b, type NE2000 (16 bit) isa0: too many dependant configs (8) isa0: unexpected small tag 14 fdc0: <NEC 72065B or clone> at port 0x3f0-0x3f5,0x3f7 irq 6 drq 2 on isa0 fdc0: FIFO enabled, 8 bytes threshold fd0: <1440-KB 3.5" drive> on fdc0 drive 0 atkbdc0: <keyboard controller (i8042)> at port 0x60-0x64 on isa0 atkbd0: <AT Keyboard> flags 0x1 irq 1 on atkbdc0 kbd0 at atkbd0 psm0: <PS/2 Mouse> irq 12 on atkbdc0 psm0: model Generic PS/2 mouse, device ID 0 vga0: <Generic ISA VGA> at port 0x3c0-0x3df iomem 0xa0000-0xbffff on isa0 sc0: <System console> at flags 0x1 on isa0 sc0: VGA <16 virtual consoles, flags=0x300> sio0 at port 0x3f8-0x3ff irq 4 flags 0x10 on isa0 sio0: type 16550A sio1 at port 0x2f8-0x2ff irq 3 on isa0 sio1: type 16550A ppc0: <Parallel port> at port 0x378-0x37f irq 7 on isa0 ppc0: SMC-like chipset (ECP/EPP/PS2/NIBBLE) in COMPATIBLE mode ppc0: FIFO with 16/16/15 bytes threshold ppbus0: IEEE1284 device found /NIBBLE Probing for PnP devices on ppbus0: plip0: <PLIP network interface> on ppbus0 lpt0: <Printer> on ppbus0 lpt0: Interrupt-driven port ppi0: <Parallel I/O> on ppbus0 ad0: 8063MB <IBM-DHEA-38451> [16383/16/63] at ata0-master using UDMA33 ad2: 8063MB <IBM-DHEA-38451> [16383/16/63] at ata1-master using UDMA33 acd0: CDROM <DELTA OTC-H101/ST3 F/W by OIPD> at ata0-slave using PIO4 Mounting root from ufs:/dev/ad0s1a swapon: adding /dev/ad0s1b as swap device Automatic boot in progress... /dev/ad0s1a: FILESYSTEM CLEAN; SKIPPING CHECKS /dev/ad0s1a: clean, 48752 free (552 frags, 6025 blocks, 0.9% fragmentation) /dev/ad0s1f: FILESYSTEM CLEAN; SKIPPING CHECKS /dev/ad0s1f: clean, 128997 free (21 frags, 16122 blocks, 0.0% fragmentation) /dev/ad0s1g: FILESYSTEM CLEAN; SKIPPING CHECKS /dev/ad0s1g: clean, 3036299 free (43175 frags, 374073 blocks, 1.3% fragmentation) /dev/ad0s1e: filesystem CLEAN; SKIPPING CHECKS /dev/ad0s1e: clean, 128193 free (17 frags, 16022 blocks, 0.0% fragmentation) Doing initial network setup: hostname. ed0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500 inet 192.168.0.1 netmask 0xffffff00 broadcast 192.168.0.255 inet6 fe80::5054::5ff::fede:731b%ed0 prefixlen 64 tentative scopeid 0x1 ether 52:54:05:de:73:1b lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x8 inet6 ::1 prefixlen 128 inet 127.0.0.1 netmask 0xff000000 Additional routing options: IP gateway=YES TCP keepalive=YES routing daemons:. additional daemons: syslogd. Doing additional network setup:. Starting final network daemons: creating ssh RSA host key Generating public/private rsa1 key pair. Your identification has been saved in /etc/ssh/ssh_host_key. Your public key has been saved in /etc/ssh/ssh_host_key.pub. The key fingerprint is: cd:76:89:16:69:0e:d0:6e:f8:66:d0:07:26:3c:7e:2d root@k6-2.example.com creating ssh DSA host key Generating public/private dsa key pair. Your identification has been saved in /etc/ssh/ssh_host_dsa_key. Your public key has been saved in /etc/ssh/ssh_host_dsa_key.pub. The key fingerprint is: f9:a1:a9:47:c4:ad:f9:8d:52:b8:b8:ff:8c:ad:2d:e6 root@k6-2.example.com. setting ELF ldconfig path: /usr/lib /usr/lib/compat /usr/X11R6/lib /usr/local/lib a.out ldconfig path: /usr/lib/aout /usr/lib/compat/aout /usr/X11R6/lib/aout starting standard daemons: inetd cron sshd usbd sendmail. Initial rc.i386 initialization:. rc.i386 configuring syscons: blank_time screensaver moused. Additional ABI support: linux. Local package initialization:. Additional TCP options:. FreeBSD/i386 (k6-2.example.com) (ttyv0) login: rpratt Password: Generating the RSA and DSA keys may take some time on slower machines. This happens only on the initial boot-up of a new installation. Subsequent boots will be faster. If the X server has been configured and a Default Desktop chosen, it can be started by typing startx at the command line. Bootup of FreeBSD on the Alpha Alpha Once the install procedure has finished, you will be able to start FreeBSD by typing something like this to the SRM prompt: >>>BOOT DKC0 This instructs the firmware to boot the specified disk. To make FreeBSD boot automatically in the future, use these commands: >>> SET BOOT_OSFLAGS A >>> SET BOOT_FILE '' >>> SET BOOTDEF_DEV DKC0 >>> SET AUTO_ACTION BOOT The boot messages will be similar (but not identical) to those produced by FreeBSD booting on the &i386;. FreeBSD Shutdown It is important to properly shutdown the operating system. Do not just turn off power. First, become a superuser by typing su at the command line and entering the root password. This will work only if the user is a member of the wheel group. Otherwise, login as root and use shutdown -h now. The operating system has halted. Please press any key to reboot. It is safe to turn off the power after the shutdown command has been issued and the message Please press any key to reboot appears. If any key is pressed instead of turning off the power switch, the system will reboot. You could also use the Ctrl Alt Del key combination to reboot the system, however this is not recommended during normal operation.
¤ä´©ªºµwÅé hardware FreeBSD currently runs on a wide variety of ISA, VLB, EISA, and PCI bus-based PCs with Intel, AMD, Cyrix, or NexGen x86 processors, as well as a number of machines based on the Compaq Alpha processor. Support for generic IDE or ESDI drive configurations, various SCSI controllers, PCMCIA cards, USB devices, and network and serial cards is also provided. FreeBSD also supports IBM's microchannel (MCA) bus. A list of supported hardware is provided with each FreeBSD release in the FreeBSD Hardware Notes. This document can usually be found in a file named HARDWARE.TXT, in the top-level directory of a CDROM or FTP distribution or in sysinstall's documentation menu. It lists, for a given architecture, what hardware devices are known to be supported by each release of FreeBSD. Copies of the supported hardware list for various releases and architectures can also be found on the Release Information page of the FreeBSD Web site. ¦w¸ËªººÃÃøÂø¯g¸Ñ¨M installation troubleshooting The following section covers basic installation troubleshooting, such as common problems people have reported. There are also a few questions and answers for people wishing to dual-boot FreeBSD with &ms-dos;. What to Do If Something Goes Wrong Due to various limitations of the PC architecture, it is impossible for probing to be 100% reliable, however, there are a few things you can do if it fails. Check the Hardware Notes document for your version of FreeBSD to make sure your hardware is supported. If your hardware is supported and you still experience lock-ups or other problems, reset your computer, and when the visual kernel configuration option is given, choose it. This will allow you to go through your hardware and supply information to the system about it. The kernel on the boot disks is configured assuming that most hardware devices are in their factory default configuration in terms of IRQs, IO addresses, and DMA channels. If your hardware has been reconfigured, you will most likely need to use the configuration editor to tell FreeBSD where to find things. It is also possible that a probe for a device not present will cause a later probe for another device that is present to fail. In that case, the probes for the conflicting driver(s) should be disabled. Some installation problems can be avoided or alleviated by updating the firmware on various hardware components, most notably the motherboard. The motherboard firmware may also be referred to as BIOS and most of the motherboard or computer manufactures have a website where the upgrades and upgrade information may be located. Most manufacturers strongly advise against upgrading the motherboard BIOS unless there is a good reason for doing so, which could possibly be a critical update of sorts. The upgrade process can go wrong, causing permanent damage to the BIOS chip. Do not disable any drivers you will need during the installation, such as your screen (sc0). If the installation wedges or fails mysteriously after leaving the configuration editor, you have probably removed or changed something you should not have. Reboot and try again. In configuration mode, you can: List the device drivers installed in the kernel. Disable device drivers for hardware that is not present in your system. Change IRQs, DRQs, and IO port addresses used by a device driver. After adjusting the kernel to match your hardware configuration, type Q to boot with the new settings. Once the installation has completed, any changes you made in the configuration mode will be permanent so you do not have to reconfigure every time you boot. It is still highly likely that you will eventually want to build a custom kernel. Dealing with Existing &ms-dos; Partitions DOS Many users wish to install &os; on PCs inhabited by µsoft; based operating systems. For those instances, &os; has a utility known as FIPS. This utility can be found in the tools directory on the install CD-ROM, or downloaded from one of various &os; mirrors. The FIPS utility allows you to split an existing &ms-dos; partition into two pieces, preserving the original partition and allowing you to install onto the second free piece. You first need to defragment your &ms-dos; partition using the &windows; Disk Defragmenter utility (go into Explorer, right-click on the hard drive, and choose to defrag your hard drive), or use Norton Disk Tools. Now you can run the FIPS utility. It will prompt you for the rest of the information, just follow the on screen instructions. Afterwards, you can reboot and install &os; on the new free slice. See the Distributions menu for an estimate of how much free space you will need for the kind of installation you want. There is also a very useful product from PowerQuest (http://www.powerquest.com) called &partitionmagic;. This application has far more functionality than FIPS, and is highly recommended if you plan to add/remove operating systems often. It does cost money, so if you plan to install &os; and keep it installed, FIPS will probably be fine for you. Using &ms-dos; and &windows; File Systems At this time, &os; does not support file systems compressed with the Double Space™ application. Therefore the file system will need to be uncompressed before &os; can access the data. This can be done by running the Compression Agent located in the Start> Programs > System Tools menu. &os; can support &ms-dos; based file systems. This requires you use the &man.mount.msdos.8; command (in &os; 5.X, the command is &man.mount.msdosfs.8;) with the required parameters. The utilities most common usage is: &prompt.root; mount_msdos /dev/ad0s1 /mnt In this example, the &ms-dos; file system is located on the first partition of the primary hard disk. Your situation may be different, check the output from the dmesg, and mount commands. They should produce enough information to give an idea of the partition layout. Extended &ms-dos; file systems are usually mapped after the &os; partitions. In other words, the slice number may be higher than the ones &os; is using. For instance, the first &ms-dos; partition may be /dev/ad0s1, the &os; partition may be /dev/ad0s2, with the extended &ms-dos; partition being located on /dev/ad0s3. To some, this can be confusing at first. NTFS partitions can also be mounted in a similar manner using the &man.mount.ntfs.8; command. Alpha User's Questions and Answers Alpha This section answers some commonly asked questions about installing FreeBSD on Alpha systems. Can I boot from the ARC or Alpha BIOS Console? ARC Alpha BIOS SRM No. &os;, like Compaq Tru64 and VMS, will only boot from the SRM console. Help, I have no space! Do I need to delete everything first? Unfortunately, yes. Can I mount my Compaq Tru64 or VMS filesystems? No, not at this time. Valentino Vaschetto Contributed by ¶i¶¥¦w¸Ë«ü«n This section describes how to install FreeBSD in exceptional cases. Installing FreeBSD on a System without a Monitor or Keyboard installation headless (serial console) serial console This type of installation is called a headless install, because the machine that you are trying to install FreeBSD on either does not have a monitor attached to it, or does not even have a VGA output. How is this possible you ask? Using a serial console. A serial console is basically using another machine to act as the main display and keyboard for a system. To do this, just follow the steps to create installation floppies, explained in . To modify these floppies to boot into a serial console, follow these steps: Enabling the Boot Floppies to Boot into a Serial Console mount If you were to boot into the floppies that you just made, FreeBSD would boot into its normal install mode. We want FreeBSD to boot into a serial console for our install. To do this, you have to mount the kern.flp floppy onto your FreeBSD system using the &man.mount.8; command. &prompt.root; mount /dev/fd0 /mnt Now that you have the floppy mounted, you must change into the /mnt directory: &prompt.root; cd /mnt Here is where you must set the floppy to boot into a serial console. You have to make a file called boot.config containing /boot/loader -h. All this does is pass a flag to the bootloader to boot into a serial console. &prompt.root; echo "/boot/loader -h" > boot.config Now that you have your floppy configured correctly, you must unmount the floppy using the &man.umount.8; command: &prompt.root; cd / &prompt.root; umount /mnt Now you can remove the floppy from the floppy drive. Connecting Your Null-modem Cable null-modem cable You now need to connect a null-modem cable between the two machines. Just connect the cable to the serial ports of the 2 machines. A normal serial cable will not work here, you need a null-modem cable because it has some of the wires inside crossed over. Booting Up for the Install It is now time to go ahead and start the install. Put the kern.flp floppy in the floppy drive of the machine you are doing the headless install on, and power on the machine. Connecting to Your Headless Machine cu Now you have to connect to that machine with &man.cu.1;: &prompt.root; cu -l /dev/cuaa0 That's it! You should now be able to control the headless machine through your cu session. It will ask you to put in the mfsroot.flp, and then it will come up with a selection of what kind of terminal to use. Select the FreeBSD color console and proceed with your install! »s§@¦w¸Ë¤ù ¬°ÁקK­«Âл¡©ú¡A¦b¤å¤¤©Ò´£¨ìªº¡uFreeBSD ¥úºÐ¡v¡A ¦b³o¸Ì«üªº¬O±z©ÒÁʶR©Î¦Û¦æ¿N¿ýªº FreeBSD CDROM ©Î DVD¡C There may be some situations in which you need to create your own FreeBSD installation media and/or source. This might be physical media, such as a tape, or a source that sysinstall can use to retrieve the files, such as a local FTP site, or an &ms-dos; partition. For example: You have many machines connected to your local network, and one FreeBSD disc. You want to create a local FTP site using the contents of the FreeBSD disc, and then have your machines use this local FTP site instead of needing to connect to the Internet. You have a FreeBSD disc, and FreeBSD does not recognize your CD/DVD drive, but &ms-dos;/&windows; does. You want to copy the FreeBSD installation files to a DOS partition on the same computer, and then install FreeBSD using those files. The computer you want to install on does not have a CD/DVD drive or a network card, but you can connect a Laplink-style serial or parallel cable to a computer that does. You want to create a tape that can be used to install FreeBSD. Creating an Installation CDROM As part of each release, the FreeBSD project makes available two CDROM images (ISO images). These images can be written (burned) to CDs if you have a CD writer, and then used to install FreeBSD. If you have a CD writer, and bandwidth is cheap, then this is the easiest way to install FreeBSD. Download the Correct ISO Images The ISO images for each release can be downloaded from ftp://ftp.FreeBSD.org/pub/FreeBSD/ISO-IMAGES-arch/version or the closest mirror. Substitute arch and version as appropriate. That directory will normally contain the following images: FreeBSD 4.<replaceable>X</replaceable> ISO Image Names and Meanings Filename Contains version-RELEASE-arch-miniinst.iso Everything you need to install FreeBSD. version-RELEASE-arch-disc1.iso Everything you need to install FreeBSD, and as many additional third party packages as would fit on the disc. version-RELEASE-arch-disc2.iso A live filesystem, which is used in conjunction with the Repair facility in sysinstall. A copy of the FreeBSD CVS tree. As many additional third party packages as would fit on the disc.
FreeBSD 5.<replaceable>X</replaceable> ISO Image Names and Meanings Filename Contains version-RELEASE-arch-bootonly.iso Everything you need to boot into a FreeBSD kernel and start the installation interface. The installable files have to be pulled over FTP or some other supported source. version-RELEASE-arch-miniinst.iso Everything you need to install FreeBSD. version-RELEASE-arch-disc1.iso Everything you need to install &os; and a live filesystem, which is used in conjunction with the Repair facility in sysinstall. version-RELEASE-arch-disc2.iso &os; documentation and as many third party packages as would fit on the disc.
You must download one of either the miniinst ISO image, or the image of disc one. Do not download both of them, since the disc one image contains everything that the miniinst ISO image contains. The miniinst ISO image is only available for releases prior to 5.4-RELEASE. Use the miniinst ISO if Internet access is cheap for you. It will let you install FreeBSD, and you can then install third party packages by downloading them using the ports/packages system (see ) as necessary. Use the image of disc one if you want to install a &os; 4.X release and want a reasonable selection of third party packages on the disc as well. The additional disc images are useful, but not essential, especially if you have high-speed access to the Internet.
Write the CDs You must then write the CD images to disc. If you will be doing this on another FreeBSD system then see for more information (in particular, and ). If you will be doing this on another platform then you will need to use whatever utilities exist to control your CD writer on that platform. The images provided are in the standard ISO format, which many CD writing applications support.
If you are interested in building a customized release of FreeBSD, please see the Release Engineering Article.
Creating a Local FTP Site with a FreeBSD Disc installation network FTP FreeBSD discs are laid out in the same way as the FTP site. This makes it very easy for you to create a local FTP site that can be used by other machines on your network when installing FreeBSD. On the FreeBSD computer that will host the FTP site, ensure that the CDROM is in the drive, and mounted on /cdrom. &prompt.root; mount /cdrom Create an account for anonymous FTP in /etc/passwd. Do this by editing /etc/passwd using &man.vipw.8; and adding this line: ftp:*:99:99::0:0:FTP:/cdrom:/nonexistent Ensure that the FTP service is enabled in /etc/inetd.conf. Anyone with network connectivity to your machine can now chose a media type of FTP and type in ftp://your machine after picking Other in the FTP sites menu during the install. If the boot media (floppy disks, usually) for your FTP clients is not precisely the same version as that provided by the local FTP site, then sysinstall will not let you complete the installation. If the versions are not similar and you want to override this, you must go into the Options menu and change distribution name to any. This approach is OK for a machine that is on your local network, and that is protected by your firewall. Offering up FTP services to other machines over the Internet (and not your local network) exposes your computer to the attention of crackers and other undesirables. We strongly recommend that you follow good security practices if you do this. Creating Installation Floppies installation floppies If you must install from floppy disk (which we suggest you do not do), either due to unsupported hardware or simply because you insist on doing things the hard way, you must first prepare some floppies for the installation. At a minimum, you will need as many 1.44 MB or 1.2 MB floppies as it takes to hold all the files in the bin (binary distribution) directory. If you are preparing the floppies from DOS, then they must be formatted using the &ms-dos; FORMAT command. If you are using &windows;, use Explorer to format the disks (right-click on the A: drive, and select Format). Do not trust factory pre-formatted floppies. Format them again yourself, just to be sure. Many problems reported by our users in the past have resulted from the use of improperly formatted media, which is why we are making a point of it now. If you are creating the floppies on another FreeBSD machine, a format is still not a bad idea, though you do not need to put a DOS filesystem on each floppy. You can use the disklabel and newfs commands to put a UFS filesystem on them instead, as the following sequence of commands (for a 3.5" 1.44 MB floppy) illustrates: &prompt.root; fdformat -f 1440 fd0.1440 &prompt.root; disklabel -w -r fd0.1440 floppy3 &prompt.root; newfs -t 2 -u 18 -l 1 -i 65536 /dev/fd0 Use fd0.1200 and floppy5 for 5.25" 1.2 MB disks. Then you can mount and write to them like any other filesystem. After you have formatted the floppies, you will need to copy the files to them. The distribution files are split into chunks conveniently sized so that five of them will fit on a conventional 1.44 MB floppy. Go through all your floppies, packing as many files as will fit on each one, until you have all of the distributions you want packed up in this fashion. Each distribution should go into a subdirectory on the floppy, e.g.: a:\bin\bin.aa, a:\bin\bin.ab, and so on. Once you come to the Media screen during the install process, select Floppy and you will be prompted for the rest. Installing from an &ms-dos; Partition installation from MS-DOS To prepare for an installation from an &ms-dos; partition, copy the files from the distribution into a directory called freebsd in the root directory of the partition. For example, c:\freebsd. The directory structure of the CDROM or FTP site must be partially reproduced within this directory, so we suggest using the DOS xcopy command if you are copying it from a CD. For example, to prepare for a minimal installation of FreeBSD: C:\> md c:\freebsd C:\> xcopy e:\bin c:\freebsd\bin\ /s C:\> xcopy e:\manpages c:\freebsd\manpages\ /s Assuming that C: is where you have free space and E: is where your CDROM is mounted. If you do not have a CDROM drive, you can download the distribution from ftp.FreeBSD.org. Each distribution is in its own directory; for example, the base distribution can be found in the &rel.current;/base/ directory. In the 4.X and older releases of &os; the base distribution is called bin. Adjust the sample commands and URLs above accordingly, if you are using one of these versions. For as many distributions you wish to install from an &ms-dos; partition (and you have the free space for), install each one under c:\freebsd — the BIN distribution is the only one required for a minimum installation. Creating an Installation Tape installation from QIC/SCSI Tape Installing from tape is probably the easiest method, short of an online FTP install or CDROM install. The installation program expects the files to be simply tarred onto the tape. After getting all of the distribution files you are interested in, simply tar them onto the tape: &prompt.root; cd /freebsd/distdir &prompt.root; tar cvf /dev/rwt0 dist1 ... dist2 When you perform the installation, you should make sure that you leave enough room in some temporary directory (which you will be allowed to choose) to accommodate the full contents of the tape you have created. Due to the non-random access nature of tapes, this method of installation requires quite a bit of temporary storage. When starting the installation, the tape must be in the drive before booting from the boot floppy. The installation probe may otherwise fail to find it. Before Installing over a Network installation network serial (SLIP or PPP) installation network parallel (PLIP) installation network Ethernet There are three types of network installations available. Serial port (SLIP or PPP), Parallel port (PLIP (laplink cable)), or Ethernet (a standard Ethernet controller (includes some PCMCIA)). The SLIP support is rather primitive, and limited primarily to hard-wired links, such as a serial cable running between a laptop computer and another computer. The link should be hard-wired as the SLIP installation does not currently offer a dialing capability; that facility is provided with the PPP utility, which should be used in preference to SLIP whenever possible. If you are using a modem, then PPP is almost certainly your only choice. Make sure that you have your service provider's information handy as you will need to know it fairly early in the installation process. If you use PAP or CHAP to connect your ISP (in other words, if you can connect to the ISP in &windows; without using a script), then all you will need to do is type in dial at the ppp prompt. Otherwise, you will need to know how to dial your ISP using the AT commands specific to your modem, as the PPP dialer provides only a very simple terminal emulator. Please refer to the user-ppp handbook and FAQ entries for further information. If you have problems, logging can be directed to the screen using the command set log local .... If a hard-wired connection to another FreeBSD (2.0-R or later) machine is available, you might also consider installing over a laplink parallel port cable. The data rate over the parallel port is much higher than what is typically possible over a serial line (up to 50 kbytes/sec), thus resulting in a quicker installation. Finally, for the fastest possible network installation, an Ethernet adapter is always a good choice! FreeBSD supports most common PC Ethernet cards; a table of supported cards (and their required settings) is provided in the Hardware Notes for each release of FreeBSD. If you are using one of the supported PCMCIA Ethernet cards, also be sure that it is plugged in before the laptop is powered on! FreeBSD does not, unfortunately, currently support hot insertion of PCMCIA cards during installation. You will also need to know your IP address on the network, the netmask value for your address class, and the name of your machine. If you are installing over a PPP connection and do not have a static IP, fear not, the IP address can be dynamically assigned by your ISP. Your system administrator can tell you which values to use for your particular network setup. If you will be referring to other hosts by name rather than IP address, you will also need a name server and possibly the address of a gateway (if you are using PPP, it is your provider's IP address) to use in talking to it. If you want to install by FTP via a HTTP proxy, you will also need the proxy's address. If you do not know the answers to all or most of these questions, then you should really probably talk to your system administrator or ISP before trying this type of installation. Before Installing via NFS installation network NFS The NFS installation is fairly straight-forward. Simply copy the FreeBSD distribution files you want onto an NFS server and then point the NFS media selection at it. If this server supports only privileged port (as is generally the default for Sun workstations), you will need to set the option NFS Secure in the Options menu before installation can proceed. If you have a poor quality Ethernet card which suffers from very slow transfer rates, you may also wish to toggle the NFS Slow flag. In order for NFS installation to work, the server must support subdir mounts, for example, if your FreeBSD &rel.current; distribution directory lives on: ziggy:/usr/archive/stuff/FreeBSD, then ziggy will have to allow the direct mounting of /usr/archive/stuff/FreeBSD, not just /usr or /usr/archive/stuff. In FreeBSD's /etc/exports file, this is controlled by the options. Other NFS servers may have different conventions. If you are getting permission denied messages from the server, then it is likely that you do not have this enabled properly.
diff --git a/zh_TW.Big5/books/handbook/introduction/chapter.sgml b/zh_TW.Big5/books/handbook/introduction/chapter.sgml index 3f0c083c59..d2ccd9ed9a 100644 --- a/zh_TW.Big5/books/handbook/introduction/chapter.sgml +++ b/zh_TW.Big5/books/handbook/introduction/chapter.sgml @@ -1,825 +1,826 @@ Jim Mock Restructured, reorganized, and parts rewritten by ²¤¶ ·§­z «D±`·PÁ±z¹ï FreeBSD ·P¿³½ì¡I¥H¤U³¹¸`²[»\ FreeBSD ­p¹ºªº¦U¤è­±¡G¤ñ¦p¥¦ªº¾ú¥v¡B¥Ø¼Ð¡B¶}µo¼Ò¦¡µ¥µ¥¡C Ū§¹³o³¹¡A±z±N¤F¸Ñ¡J FreeBSD »P¨ä¥L OS ¤§¶¡ªºÃö«Y¡F - FreeBSD ­p¹ºªº¾ú¥v²W·½¡F + FreeBSD ­p¹ºªº¾ú¥v·½¬y¡F FreeBSD ­p¹ºªº¥Ø¼Ð¡F FreeBSD open-source ¶}µo¼Ò¦¡ªº°ò¦·§©À¡F ·íµMÅo¡AÁÙ¦³ FreeBSD ³o¦W¦rªº½t¬G¡C Welcome to FreeBSD! 4.4BSD-Lite FreeBSD ¬O¤@­Ó±q 4.4BSD-Lite ­l¥Í¥X¦Ó¯à¦b¥H Intel (x86 and &itanium;), AMD64, Alpha, Sun &ultrasparc; ¬°°ò¦ªº¹q¸£¤W°õ¦æªº§@·~¨t²Î¡C¦P®É¡A²¾´Ó¨ì¨ä¥L¥­¥xªº¤u§@¤]¦b¶i¦æ¤¤¡C - ¹ï©ó¥»­p¹º¾ú¥vªº¤¶²Ð¡A½Ð¬Ý FreeBSD ¾ú¥v²W·½¡A + ¹ï©ó¥»­p¹º¾ú¥vªº¤¶²Ð¡A½Ð¬Ý FreeBSD ¾ú¥v·½¬y¡A ¹ï©ó FreeBSD ªº³Ì·sª©¥»¤¶²Ð¡A½Ð¬Ý current release ¡C­Y¥´ºâ¹ï©ó FreeBSD ­p¹º¦³©Ò°^Ämªº¸Ü(¹³¬Oµ{¦¡½XµwÅé³]³Æ¡A¸êª÷)¡A ½Ð¬Ý ¦p¦ó¹ï FreeBSD ¦³°^Äm¡C FreeBSD ¯à°µ¤°»ò¡H FreeBSD ´£¨Ñµ¹§A³\¦h¥ý¶i¥\¯à¡C³o¨Ç¥\¯à¥]¬A¡G ¥ý¦û¦¡¦h¤u(preemptive multitasking) °ÊºAÀu¥ýÅv½Õ¾ãªº¡y¥ý¦û¦¡¦h¤u¡z¯à°÷½T«O¡A§Y¨Ï¦b¨t²Î­t¾á«Ü­«ªº±¡ªp¤U¡A µ{¦¡°õ¦æ¥­¶¶¨Ã¥BÀ³¥Îµ{¦¡»P¨Ï¥ÎªÌ¤½¥­¦a¦@¨É¸ê·½¡C ¤ä´©¦h¤H¦@¥Î ¡y¦h¤H¦@¥Î(multi-user)¡z¥NªíµÛ³\¦h¤H¥i¥H¦P®É¨Ï¥Î¤@­Ó FreeBSD ¨t²Î¨Ó³B²z¦U¦Ûªº¨Æ°È¡C ¨t²ÎªºµwÅé©PÃä(¦p¦Lªí¾÷¤ÎºÏ±a¾÷)¤]¥i¥HÅý©Ò¦³ªº¨Ï¥ÎªÌ¾A·í¦a¤À¨É¡C ¤]¥i¥H°w¹ï¦U§O¨Ï¥ÎªÌ©Î¤@¸s¨Ï¥ÎªÌªº¨t²Î¸ê·½¡A¤©¥H³]­­¡A ¥H«OÅ@¨t²Î¤£­P³Q¹L«×¨Ï¥Î¡C TCP/IP ºô¸ô¥\¯à ¦n¥Îªº¡yTCP/IP ºô¸ô¥\¯à¡z¥i¤ä´©³\¦h·~¬É¼Ð·Ç¡A¤ñ¦p¡GSLIP¡BPPP¡BNFS¡BDHCP ©M NIS ªº¤ä´©¡A¤]´N¬O»¡ FreeBSD ¥i¥H®e©ö¦a¸ò¨ä¥L§@·~¨t²Î³z¹Lºô¸ô¦@¦P¹B§@¡A ©Î¬O·í§@¥ø·~ªº¦øªA¾¹¥Î³~¡A¨Ò¦p´£¨Ñ»·ºÝÀɮצ@¨É(NFS)¤Î¹q¤l¶l¥ó(email)µ¥ªA°È¡A ©Î¬OÅý±zªº¥ø·~³s¤Wºô»Úºô¸ô(Internet)¨Ã´£¨Ñ WWW¡BFTP¡B¸ô¥Ñ(routing) ¡B¤Î¨¾¤õÀð(firewall¡Bsecurity) µ¥¥²³ÆªA°È¡C °O¾ÐÅé«OÅ@ ¡y°O¾ÐÅé«OÅ@(Memory protection)¡z¯à½T«Oµ{¦¡(©Î¬O¨Ï¥ÎªÌ)¤£·|¤¬¬Û¤zÂZ¡A §Y¨Ï¥ô¦óµ{¦¡¦³¤£¥¿±`ªº¹B§@¡A³£¤£·|¼vÅT¨ä¥Lµ{¦¡ªº°õ¦æ¡C FreeBSD ¬O¡y32¦ì¤¸(32-bit)¡zªº§@·~¨t²Î (¦b Alpha¡B&itanium;¡B AMD64 ¤Î &ultrasparc; ¤W«h¬O¡y64¦ì¤¸(64-bit)¡z) ¡X ¥´±q¤@¶}©l«K¬O³o¼Ë³]­pªº¡C X Window System XFree86 ·~¬É¼Ð·Çªº¡yX Window ¨t²Î¡z(X11R6)¥i¥H¦b±`¨£ªº«K©y VGA Åã¥Ü¥d/¿Ã¹õ¡A ´£¨Ñ¤F¹Ï§Î¤Æªº¨Ï¥ÎªÌ¤¶­±(GUI)¡A¨Ã¥B¥]¬A¤F§¹¾ãªº­ì©lµ{¦¡½X¡C binary compatibility Linux binary compatibility SCO binary compatibility SVR4 binary compatibility BSD/OS binary compatibility NetBSD ¯à¡yª½±µ°õ¦æ¡z³\¦h¨ä¥L§@·~¨t²Î(¤ñ¦p¡G Linux¡BSCO¡BSVR4¡BBSDI ©M NetBSD) ªº¥i°õ¦æÀÉ¡C ¼Æ¥H¸U­pªº¥ß§Y¥i¥H°õ¦æªºÀ³¥Îµ{¦¡¡A³o¨Ç³£¥i³z¹L FreeBSD ªº¡yports¡z¤Î¡ypackages¡z³nÅéºÞ²z¾÷¨î¨Ó¨ú±o¡C ¤£¦A»Ý­n¶O¤ß¨ìºô¸ô¤W¨ì³B·j´M©Ò»Ý­nªº³nÅé¡C ¦¹¥~¡Aºô¸ô¤W©|¦³¥i«D±`®e©ö²¾´Óªº¼Æ¥H¸U­pÀ³¥Îµ{¦¡¡C FreeBSD ªº­ì©lµ{¦¡½X»P³\¦h±`¨£ªº°Ó·~ª© &unix; ¨t²Î³£¬Û®e¡A ©Ò¥H¤j³¡¤Àªºµ{¦¡³£¥u»Ý­n«Ü¤Öªº­×§ï(©Î®Ú¥»¤£¥Î­×§ï) ¡A´N¥i¥H½sĶ°õ¦æ¡C virtual memory »Ý­n®É¤~¸m´«(demand paged) virtual memory ¤Î merged VM/buffer cache ªº³]­p¡A ³oÂI¦b¨t²Î¤¤¦³¥Î¥h¤j¶q°O¾ÐÅ骺µ{¦¡°õ¦æ®É¡A¤´µM¦³¤£¿ùªº®Ä²vªí²{¡C Symmetric Multi-Processing (SMP) ¤ä´© CPU ªº¹ïºÙ¦h¤u³B²z(SMP)¡G¥i¥H¤ä´©¦h CPU ªº¹q¸£¨t²Î¡C compilers C compilers C++ compilers FORTRAN - §¹¥þ¬Û®eªº C¡BC++¡B - Fortran ©M Perl ¶}µo¤u¨ã¤ÎÀô¹Ò¡C + §¹¥þ¬Û®eªº C¡BC++ ¥H¤Î + Fortran ªºÀô¹Ò©M¨ä¥L¶}µo¤u¨ã¡C ¥H¤Î¨ä¥L³\¦h¥i¨Ñ¶i¶¥¬ãµoªºµ{¦¡»y¨¥¤]¦¬¶°¦b ports ©M packages¡C source code ¾ã­Ó¨t²Î³£¦³¡y­ì©lµ{¦¡½X¡z¡A ³oÅý§A¹ï§@·~Àô¹Ò¾Ö¦³³Ì§¹¥þªº´x´¤«×¡C ¬JµM¯à¾Ö¦³§¹¥þ¶}©ñªº¨t²Î¡A¦ó­W³Q¯S©w«Ê³¬³nÅé©Ò¬ù§ô¡A¥ô¼t°ÓÂ\§G©O¡H ¼sªx¥BÂ×´Iªº¡y½u¤W¤å¥ó¡z¡C ·íµMÅo¡AÁÙ¤£¤î¦p¦¹¡I 4.4BSD-Lite Computer Systems Research Group (CSRG) U.C. Berkeley FreeBSD ¨t²Î¤D¬O°ò©ó¬ü°ê¥[¦{¤j¾Ç¬f§JµÜ¤À®Õªº¹q¸£¨t²Î¬ã¨s¸s (Computer Systems Research Group ¤]´N¬O CSRG) ©Òµo¦æªº 4.4BSD-Lite¡A¥H¤Î°ò©ó BSD ¨t²Î¶}µoªºÀu¨}¶Ç²Î¡C °£¤F¥Ñ CSRG ©Ò´£¨Ñªº°ª«~½èªº¦¨ªG¡A ¬°¤F´£¨Ñ¥i³B²z¯u¥¿¨ã­t²üªº¤u§@¡A FreeBSD ­p¹º¤]§ë¤J¤F¼Æ¤d¤p®É¥H¤Wªº²Ó³¡½Õ¾ã¡A ¥H¯àÀò±o³Ì¦nªº°õ¦æ®Ä²v¥H¤Î¨t²ÎªºÃ­©w«×¡C ¥¿·í³\¦h°Ó·~¤Wªº¥¨¤H¥¿§V¤O¦a§Æ±æ¯à´£¨Ñ®Ä¯à¤Îí©w®É¡A FreeBSD ¤w¸g¨ã³Æ³o¼Ëªº¯S½è -- ´N¬O²{¦b¡I FreeBSD ªº¹B¥Î½d³òµL­­¡A¨ä¹ê§¹¥þ­­¨î¦b§Aªº·Q¹³¤O¤W¡C ±q³nÅ骺¶}µo¨ì¤u¼t¦Û°Ê¤Æ¡A©Î¬O¤H³y½Ã¬P¤W­±ªº¤Ñ½uªº¤è¦ì¨¤«×ªº»·ºÝ±±¨î¡F ³o¨Ç¥\¯à­Y¥i¥H¥Î°Ó¥Îªº Unix ²£«~¨Ó¹F¦¨¡A ¨º»ò·¥¦³¥i¯à¨Ï¥Î FreeBSD ¤]¯à¿ì¨ì¡I FreeBSD ¤]¨ü¯q©ó¨Ó¦Û©ó¥þ²y¦U¬ã¨s¤¤¤ß¤Î¤j¾Ç©Ò¶}µoªº¼Æ¤d­Ó°ª«~½èªº³nÅé ¡A³o¨Ç³q±`¥u»Ý­nªá¶O«Ü¤Öªº¶O¥Î©Î®Ú¥»´N¬O§K¶Oªº¡C ·íµM¤]¦³°Ó·~³nÅé¡A¦Ó¥B¥X²{ªº¼Æ¥Ø¬O»P¤é­Ñ¼W¡C ¥Ñ©ó¨C­Ó¤H³£¥i¥H¨ú±o FreeBSD ªº­ì©lµ{¦¡½X¡A ³o­Ó¨t²Î¥i¥H³Q½Õ¾ã¦Ó¯à°õ¦æ¥ô¦ó­ì¥»§¹¥þµLªk·Q¹³ªº¥\¯à©Î­p¹º¡A ¦Ó¹ï©ó±q¦U¼t°Ó¨ú±oªº§@·~¨t²Î³q±`¨S¦³¿ìªk³o¼Ë¦a³Q­×§ï¡C ¥H¤U´£¨Ñ¤@¨Ç¤H­Ì¨Ï¥Î FreeBSD ªº¨Ò¤l¡G ºô¸ôªA°È¡G FreeBSD ¤º«Ø±j«lªººô¸ô¥\¯à¨Ï¥¦¦¨¬°ºô¸ôªA°È(¦p¤U¨Ò)ªº²z·Q¥­¥x¡G FTP servers ÀɮצøªA¾¹(FTP servers) web servers ¥þ²y¸ê°Tºô¦øªA¾¹(WWW servers) (¼Ð·Çªº©Î§ó¦w¥þªº SSL ³s½u) firewall IP masquerading ¨¾¤õÀð¥H¤Î NAT (IP masquerading) gateways¡C electronic mail ¹q¤l¶l¥ó¦øªA¾¹(Electronic Mail servers) USENET ºô¸ô·s»D¦øªA¾¹(USENET News) ©Î¬O¹q¤l§G§iÄæ¨t²Î(BBS) ÁÙ¦³§ó¦h... ¦³¤F FreeBSD¡A±z¥i¥H®e©ö¦a¥ý¥Î«K©yªº 386 PC¡A ¦A³v¨B¤É¯Å±zªº¾÷¾¹¨ì¥|­Ó CPU ªº Xeon ¨Ã¨Ï¥ÎºÏºÐ°}¦C(RAID)¨Óº¡¨¬±z¥ø·~¹B¥Î¤Wªº»Ý¨D¡C ±Ð¨|¡G ¦pªG§A¬O¸ê°T©Î¬ÛÃö¤uµ{»â°ìªº¾Ç¥Í¡A¦A¤]¨S¦³¤ñ¨Ï¥Î FreeBSD ¯à¾Ç¨ì§ó¦h§@·~¨t²Î¡B­pºâ¾÷µ²ºc¡B¤Îºô¸ôªº¤èªk¤F¡C ¥t¥~¦pªG§A·Q§Q¥Î¹q¸£¨Ó³B²z¤@¨Ç¨ä¥Lªº ¤u§@¡AÁÙ¦³¤@¨Ç¦p CAD¡B ¼Æ¾Ç¹Bºâ¥H¤Î¹Ï§Î³B²z³nÅéµ¥¥i¥H§K¶O¦a¨ú±o¨Ï¥Î¡C ¬ã¨s¡G¦³¤F§¹¾ãªº­ì©lµ{¦¡½X¡AFreeBSD ¬O¬ã¨s§@·~¨t²Î¤Î¹q¸£¬ì¾Çªº·¥¨ÎÀô¹Ò¡C ¨ã¦³§K¶O¥B¦Û¥Ñ¨ú±o¯S©Êªº FreeBSD ¤]¨Ï±o¤@­Ó¤À¸m¨â¦aªº¦X§@­p¹º¡A¤£¥²¾á¤ßª©Åv¤Î¨t²Î¶}©ñ©Êªº°ÝÃD¡A ¦Ó¯à¦Û¦bªº¥æ¬y¡C router DNS Server ºô¸ô¡G §A¦pªG»Ý­n router¡BName Server (DNS) ©Î¦w¥þªº¨¾¤õÀð(Firewall)¡A FreeBSD ¥i¥H»´©öªº±N§A¨S¦³¥Î¨ìªº 386 ©Î 486 PC Åܨ­¦¨¬°µ´¨Îªº¦øªA¾¹¡A¬Æ¦Ü¨ã¦³¹LÂo«Ê¥](packet-filter) ªº¥\¯à¡C X Window System XFree86 X Window System Accelerated-X X µøµ¡¤u§@¯¸¡G FreeBSD ¬O X ²×ºÝ¾÷ªº¨}µ¦¡A§A¥i¥H¨Ï¥Î§K¶Oªº X11 Server ©Î¬O¥Ñ Xi Graphics ©Ò´£¨Ñªº°Ó·~ª© X Server¡C FreeBSD ¤£¦ý¥i¥H¥R·í»·ºÝ X µ{¦¡²×ºÝ¾÷¡A ¤]¥i¥H°õ¦æ¥»¦aªº X µ{¦¡¦Ó´î»´¤j«¬¤u§@¯¸ªº­t²ü¡C ¦pªG¦³¤@¥x¤¤¥¡¦øªA¾¹ªº¸Ü¡AFreeBSD ¬Æ¦Ü¥i¥H¸g¥Ñºô¸ô¶}¾÷ (¤£»ÝµwºÐ¡A¤]´N¬Odiskless) ¡A¦ÓÅܦ¨§ó«K©y¥B©ö©óºÞ²zªº¤u§@¯¸¡C GNU Compiler Collection ³nÅé¶}µo¡G °ò¥»¦w¸Ëªº FreeBSD ´N¥]§t¤F§¹¾ãªºµ{¦¡¶}µo¤u¨ã¡A¦p GNU C/C++ ½sĶ¾¹¤Î°£¿ù¾¹¡C §A¥i¥H¸g¥Ñ¿N¿ý CDROM¡BDVD ©Î¬O±q FTP ¯¸¤W§ì¦^ FreeBSD -- ¥]¬A¥ß§Y¥i°õ¦æªº¨t²Î¥H¤Î¨t²Îªº§¹¾ãµ{¦¡½X¡C ¸Ô±¡½Ð°Ñ¾\ ¨ú±o FreeBSD¡C ½Ö¦b¥Î FreeBSD¡H users large sites running FreeBSD ³\¦h Internet ¤Wªº¤j«¬ºô¯¸³£¬O¥H FreeBSD §@¬°¥¦ªº§@·~¨t²Î¡A¨Ò¦p¡G Yahoo! Yahoo! Apache Apache Blue Mountain Arts Blue Mountain Arts Pair Networks Pair Networks Sony Japan Sony Japan Netcraft Netcraft Weathernews Weathernews Supervalu Supervalu TELEHOUSE America TELEHOUSE America Sophos Anti-Virus Sophos Anti-Virus JMA Wired JMA Wired ¥H¤Î³\¦h¨ä¥Lªººô¯¸¡C Ãö©ó FreeBSD ­p¹º - ±µ¤U¨ÓÁ¿ªº¬O FreeBSD ­p¹ºªº­I´º¡A¥]§t¾ú¥v²W·½ªºÂ²¤¶¡B­p¹ºªº¥Ø¼Ð¡A¥H¤Î¶}µoªº¼Ò¦¡¡C + ±µ¤U¨ÓÁ¿ªº¬O FreeBSD ­p¹ºªº­I´º¡A¥]§t¾ú¥v·½¬yªºÂ²¤¶¡B­p¹ºªº¥Ø¼Ð¡A¥H¤Î¶}µoªº¼Ò¦¡¡C Jordan Hubbard Contributed by - FreeBSD ¾ú¥v²W·½ªºÂ²¤¶ + FreeBSD ¾ú¥v·½¬yªºÂ²¤¶ 386BSD Patchkit Hubbard, Jordan Williams, Nate Grimes, Rod FreeBSD Project history FreeBSD ­pµeªº·Qªk¬O¦b 1993 ¦~ªì©Ò§Î¦¨ªº¡A ¨º¬O·½¦Û©óºûÅ@¤@²Õ ¡y«D©x¤è 386BSD ªº patchkit(­×¥¿¤u¨ã)¡z­p¹ºªº¤T­Ó¨ó½ÕºûÅ@¤H Nate Williams¡ARod Grimes ©M§Ú(Jordan Hubbard)¡C 386BSD §Ú­Ì³Ìªìªº¥Ø¼Ð¬O°µ¥X¤@¥÷ 386BSD ºî¦X­×¥¿ªº snapshot ª©¡A¥H«K­×¥¿·í®É¤@°ï patchkit ³£¤£®e©ö¸Ñ¨Mªº°ÝÃD¡C¦³¨Ç¤H¥i¯àÁÙ°O±o¦­´Áªº­p¹º¦WºÙ¥s°µ 386BSD 0.5 ©Î 386BSD Interim ´N¬O³o­Ó­ì¦]¡C Jolitz, Bill 386BSD ¬O Bill Jolitz ªº§@·~¨t²Î¡A¦b·í®É´N¤w¦³¬ù¤@¦~ªº¤Àµõ°Q½×¡C ·í¸Ó­×¥¿¤u¨ã (patchkit) ¤éº¥ÃeÂø±o¥O¤H¤£µÎªA¡A§Ú­ÌµL²§Ä³¦a¦P·N­n§@¤@¨Ç¨Æ¤F¡A ¨Ã¨M©w´£¨Ñ¤@¥÷Á{®É©Êªº ²b¤Æª©(cleanup) ¨ÓÀ°§U Bill¡C µM¦Ó¡A¥Ñ©ó Bill Jolitz ©¿µM¨M©w¨ú®ø¨ä¹ï¸Ó­p¹ºªº»{¥i¡A¥B¨S¦³©ú½T«ü¥X¥¼¨Óªº¥´ºâ¡A ©Ò¥H¸Ó­p¹º«K¬ðµM­±Á{Â_ª¤¦M¾÷¡C Greenman, David Walnut Creek CDROM ¤£¤[§Ú­Ì«K¨M©w¦b§Y¨Ï¨S¦³ Bill ªº¤ä«ù¤U¡AÅý¸Ó­p¹º¤´µMÄ~Äò¤U¥h¡A ³Ì«á§Ú­Ì±Ä¥Î David Greenman ¥á»ÉªO¨M©wªº¦W¦r¡A¤]´N¬O¡yFreeBSD¡z¡C ¦b¸ß°Ý¤F·í®Éªº¤@¨Ç¨Ï¥ÎªÌ·N¨£¤§«á¡A´N¶}©l¨M©w¤F³Ìªìªº¥Ø¼Ð¡A ·í¸Ó­p¹º¶}©l¹ê¬I¤@¤Á´N­n¦¨¯u®É¡A¤@¤Á´NÅܱo§ó²M·¡¤F¡C §Ú¸ò Walnut Creek CDROM °Q½×µo¦æ CDROM ³o¼Ë¤l¤£«K¤Wºôªº¤H´N¥i¥H¥Î¤ñ¸û²³æªº¤è¦¡¨ú±o FreeBSD¡C Walnut Creek CDROM ¤£¥uÃÙ¦¨¥H CDROM ¨Óµo¦æ FreeBSD ªº·Qªk¡A¦P®É´£¨Ñ¤F¤@¥x¾÷¾¹¥H¤Î§Ö³tªººô»Úºô¸ôªºÀW¼e¡C ¦pªG¤£¬O Walnut Creek CDROM ´X¥G¬OªÅ«eªº«H¥ô³o­Ó­è¶}©lÁÙ¬O§¹¥þÀqÀqµL»Dªº­p¹º¡A ¨º»ò«Ü¥i¯à FreeBSD ¤£·|¦p¦¹§Ö³tªº¦¨ªø¨ì¤µ¤é³o¼Ëªº³W¼Ò¡C 4.3BSD-Lite Net/2 U.C. Berkeley 386BSD Free Software Foundation ²Ä¤@±i¥H CDROM (¤Îºô¸ô)µo¦æªº FreeBSD 1.0 ¬O¦b 1993 ¦~¤Q¤G¤ë¡C ¸Óª©¥»¬O°ò©ó¥Ñ U.C. Berkeley ¥HºÏ±a¤è¦¡µo¦æªº 4.3BSD-Lite (Net/2)¥H¤Î³\¦h¨Ó¦Û©ó 386BSD ©M¦Û¥Ñ³nÅé°òª÷·|ªº³nÅé¡C¹ï©ó²Ä¤@¦¸µo¦æ¦Ó¨¥Áٺ⦨¥\¡A §Ú­Ì¤S±µµÛ©ó 1994 ¦~ 5 ¤ëµo¦æ¤F¬Û·í¦¨¥\ªº FreeBSD 1.1¡C Novell U.C. Berkeley Net/2 AT&T µM¦Ó¦¹«á¤£¤[¡A¥t¤@­Ó·N¥~ªº­·¼É¦b Novell ©M U.C. Berkeley Ãö©ó Berkeley Net/2 ºÏ±a¤§ªk«ß¦a¦ìªº¶D³^½T©w¤§«á§Î¦¨¡C U.C. Berkeley ±µ¨ü¤j³¡¥÷ªº Net/2 ªºµ{¦¡½X³£¬O¡y«I¦û¨Óªº¡z¥B¬OÄÝ©ó Novell ªº°]²£ -- ¨Æ¹ê¤W¬O·í®É¤£¤[«e±q AT&T ¨ú±oªº¡C Berkeley ±o¨ìªº¬O Novell ¹ï©ó 4.4BSD-Lite ªº¡y¯¬ºÖ¡z¡A³Ì«á·í 4.4BSD-Lite ²×©óµo¦æ¤§«á¡A«K¤£¦A¬O«I¦û¦æ¬°¡C ¦Ó©Ò¦³²{¦³ Net/2 ¨Ï¥ÎªÌ³£³Q±j¯P«Øij§ó´«·sª©¥»¡A³o¥]¬A¤F FreeBSD¡C ©ó¬O¡A§Ú­Ì³Q­n¨D©ó 1994 ¦~ 6 ¤ë©³«e°±¤î´²§G°ò©ó Net/2 ªº²£«~¡C¦b¦¹«e´£¤§¤U¡A¥»­p¹º³Q¤¹³\¦b´Á­­¥H«e§@³Ì«á¤@¦¸µo¦æ¡A¤]´N¬O FreeBSD 1.1.5.1¡C FreeBSD «K¶}©l¤F³o©{¦p¡y­«·sµo©ú½ü¤l¡zªºÁ}¹d¤u§@ -- ±q¥þ·sªº¥B¤£§¹¾ãªº 4.4BSD-Lite ­«·s¾ã¦X¡C ³o­Ó Lite ª©¥»¬O¤£§¹¾ãªº¡A¦]¬° Berkeley ªº CSRG ¤w¸g§R°£¤F¤j¶q¦b«Ø¥ß¤@­Ó¥i¥H¶}¾÷°õ¦æªº¨t²Î©Ò»Ý­nªºµ{¦¡½X (°ò©ó­Y¤zªk«ß¤Wªº­n¨D)¡A¥B¸Óª©¥»¦b Intel ¥­¥xªº²¾´Ó¬O«D±`¤£§¹¾ãªº¡C ª½¨ì 1994 ¦~ 11 ¤ë¥»­p¹º¤~§¹¦¨¤F³o­ÓÂಾ¡A ¦P®É¦b¸Ó¦~ 12 ¤ë©³¥H CDROM ¥H¤Îºô¸ôªº§Î¦¡µo¦æ¤F FreeBSD 2.0¡C ÁöµM¸Ó¥÷ª©¥»¦b·í®É¦³ÂI¥^«P²ÊÁW¡A¦ý¤´¬O´I¦³·N¸qªº¦¨¥\¡C ÀH¤§©ó 1995 ¦~ 6 ¤ë¤Sµo¦æ¤F§ó®e©ö¦w¸Ë¡A§ó¦nªº FreeBSD 2.0.5¡C §Ú­Ì¦b 1996 ¦~ 8 ¤ëµo¦æ¤F FreeBSD 2.1.5¡A¦b ISP ©M°Ó·~¹ÎÅ餤«D±`¬y¦æ¡C ÀH«á¡A 2.1-STABLE ¤À¤äªº¥t¤@­Óª©¥»À³¹B¦Ó¥Í¡A¥¦´N¬O¦b 1997 ¦~ 2 ¤ëµo¦æ FreeBSD 2.1.7.1 ¡A¦P®É¤]¬O 2.1-STABLE ¤À¤äªº³Ì«áª©¡C¤§«á¦¹¤À¤ä«K¶i¤JºûÅ@ª¬ºA¡A ¶È¶È´£¨Ñ¦w¥þ©Êªº¥[±j©M¨ä¥LÄY­«¿ù»~­×¸ÉªººûÅ@(RELENG_2_1_0)¡C 1996 ¦~ 11 ¤ë FreeBSD 2.2 ±q¶}µo¥D¶b¤À¤ä (-CURRENT) ¥X¨Ó¦¨¬° RELENG_2_2 ¤À¤ä¡C¥¦ªº²Ä¤@­Ó§¹¾ãª©(2.2.1)©ó 1997 ¦~ 4 ¤ëµo¦æ¡C 2.2 ¤À¤äªº©µÄòª©¥»¦b 97 ¦~®L¬î¤§¶¡µo¦æªº¡A¨ä³Ì«áª©¬O¦b 1998 ¦~ 11 ¤ëµo¦æªº 2.2.8 ª©¡C ²Ä¤@­Ó¥¿¦¡ªº 3.0 ª©¥»¦b 1998 ¦~ 10 ¤ëµo¦æ¡A¥ç§Y«Å§i 2.2 ¤À¤äªº¸¨¹õ¡C 1999/01/20 ¤é¦A«×¤À¤ä¡A³o²£¥Í¤F 4.0-CURRENT ¥H¤Î 3.X-STABLE ¨â­Ó¤À¤ä¡C 3.X-STABLE ¤è­±¡A3.1 µo¦æ©ó 1999/02/15¡A3.2 µo¦æ©ó1999/05/15¡A3.3 µo¦æ©ó 1999/09/16¡A 3.4 µo¦æ©ó 1999/12/20¡A3.5 µo¦æ©ó 2000/06/24 ¡A±µ¤U¨Ó´X¤Ñ«áµo§G¤F¤@¨Çªº­×¸ÉÀÉ(¹ï Kerberos ¦w¥þ©Ê¤è­±ªº­×¥¿)¡A´N¤É¯Å¦Ü 3.5.1 ¡A³o¬O 3.X ¤À¤ä³Ì«á¤@­Óµo¦æª©¥»¡C ¦b 2000/03/13 ¤S¦³¤F¤@­Ó·sªº¤À¤ä¡A ¤]´N¬O 4.X-STABLE ¡C³o­Ó¤À¤ä¤§«áµo§G¤F³\¦hªºµo¦æª©¥»¡J 4.0-RELEASE ¦b 2000 ¦~ 3 ¤ëµo¦æ¡A ¦Ó³Ì«áªº 4.11-RELEASE «h¦b 2005 ¦~ 1 ¤ëµo¦æ¡C4-STABLE ¤À¤äªº¤ä´©·|«ùÄò¨ì 2007/01/31 ¡A¦ý¥D­nµJÂI¦b©ó¦w¥þ¤è­±ªºº|¬}¡B¯äÂΤΨä¥LÄY­«°ÝÃDªº­×¸É¡C ´Á«Ý¤w¤[ªº 5.0-RELEASE ¦b 2003/01/19 ¥¿¦¡µo¦æ¡C³o¬O±Nªñ¶}µo¤T¦~ªºÅq®p¤§§@¡A¦P®É ¤]¶}©l¥[±j¦hÁûCPU(SMPng)ªº¤ä´©¡Bkernel thread(KSE) ªº¤ä´©¡BÀɮרt²Î±Ä¥Î UFS2 ¥H¤Î¤ä´© snapshot µ¥¡A ¨Ã¤ä´© &ultrasparc; ©M ia64 ¥­¥x¡B¤ä´©ÂŪޡB32 bit ªº PCMCIA µ¥¡C¤§«á©ó 2003 ¦~ 6 ¤ëµo¦æ¤F 5.1¡C ¦Ó -CURRENT ³o­Óµo®i¥D¶b¤À¤äªº³Ì«á 5.X ª©¥»¬O¦b 2004 ¦~ 2 ¤ë¥¿¦¡µo¦æªº 5.2.1-RELEASE¡A¦b 5.X ¨t¦C¶i¤J -STABLE (RELENG_5¤À¤ä)¤§«á¡A-CURRENT ´NÂಾ¬° 6.X ¨t¦C¡C RELENG_5 ¤À¤ä©ó 2004 ¦~ 8 ¤ë¥¿¦¡¶}¶]¡A¤§«á¬O 5.3-RELEASE - ¡A¥¦¬O 5-STABLE ¤À¤äªº²Ä¤@­Óµo¦æª©¥»¡C5-STABLE ªº³Ì·sµoªí¬O¦b &rel2.current.date; µo¦æªº &rel2.current;-RELEASE¡A·íµMÅo¡ARELENG_5 ¤À¤äÁÙ±N¦³«áÄòªºµo¦æª©¡C + ¡A¥¦¬O 5-STABLE ¤À¤äªº²Ä¤@­Óµo¦æª©¥»¡C&rel2.current;-RELEASE ªº³Ì·sµoªí¬O¦b &rel2.current.date; µo¦æªº &rel2.current;-RELEASE¡A·Ó©¹¨Ò RELENG_5 ¤À¤äÁÙ±N¦³«áÄòªºµo¦æª©¡C - RELENG_6 ¤À¤ä©ó 2005 ¦~ 11 ¤ë¶}¶]¡A³Ì·sªº &rel.current;-RELEASE ¬O¦b &rel.current.date; µo¦æ¡C + RELENG_6 ¤À¤ä©ó 2005 ¦~ 7 ¤ë¶}¶]¡A¦Ó 6.X ¤À¤äªº²Ä¤@­Ó release(6.0-RELEASE) ¬O¦b 2005 ¦~ 11 ¤ë¥Xªº¡C + ³Ì·sªº &rel.current;-RELEASE ¬O¦b &rel.current.date; µo¦æ¡C·íµMÅo¡ARELENG_6 ¤À¤äÁÙ±N¦³«áÄòªºµo¦æª©¡C ¥Ø«e¡Aªø´Áªº¶}µo­pµeÄ~Äò¦b 7.X-CURRENT (trunk) ¤À¤ä¤¤¶i¦æ¡A¦Ó 7.X ªº CDROM (·íµM¡A¤]¥i¥H¥Îºô¸ô§ì) snapshot ª©¥»¥i¥H¦b FreeBSD snapshot server ¨ú±o¡C Jordan Hubbard Contributed by FreeBSD ­p¹ºªº¥Ø¼Ð FreeBSD Project goals FreeBSD ­p¹ºªº¥Ø¼Ð¦b©ó´£¨Ñ¥i§@¥ô·N¥Î³~ªº³nÅé¦Ó¤£ªþ±a¥ô¦ó­­¨î±ø¤å¡C §Ú­Ì¤§¤¤³\¦h¤H¹ïµ{¦¡½X (¥H¤Î­pµe¥»¨­) ³£¦³«D±`¤jªº§ë¤J¡A ¦]¦¹¡A·íµM¤£¤¶·N°¸º¸¦³¤@¨Ç¸êª÷¤Wªº¸ÉÀv¡A¦ý§Ú­Ì¨Ã¨S¥´ºâ°í¨M¦a­n¨D±o¨ì³oÃþ¸ê§U¡C §Ú­Ì»{¬°§Ú­Ìªº­º­n¡y¨Ï©R(mission)¡z¬O¬°¥ô¦ó¤H´£¨Ñµ{¦¡½X¡A ¤£ºÞ¥L­Ì¥´ºâ¥Î³o¨Çµ{¦¡½X°µ¤°»ò¡A ¦]¬°³o¼Ëµ{¦¡½X±N¯à°÷³Q§ó¼sªx¦a¨Ï¥Î¡A±q¦Óµo´§¨ä»ù­È¡C §Ú»{¬°³o¬O¦Û¥Ñ³nÅé³Ì°ò¥»ªº¡A¦P®É¤]¬O§Ú­Ì©Ò­Ò¾Éªº¤@­Ó¥Ø¼Ð¡C GNU General Public License (GPL) GNU Lesser General Public License (LGPL) BSD Copyright §Ú­Ìµ{¦¡½X¾ð¤¤¡A¦³­Y¤z¬O¥H GNU GPL ©ÎªÌ LGPL µo§Gªº¨º¨Çµ{¦¡½X±a¦³¤Ö³\ªºªþ¥[­­¨î¡AÁÙ¦n¥u¬O±j¨î©Êªº­n¨D¶}©ñµ{¦¡½X¦Ó¤£¬O§Oªº¡C ¥Ñ©ó¨Ï¥Î GPL ªº³nÅé¦b°Ó·~¥Î³~¤W·|¼W¥[­Y¤z½ÆÂø©Ê¡A¦]¦¹¡A¦pªG¥i¥H¿ï¾Üªº¸Ü¡A §Ú­Ì·|¤ñ¸û³ßÅw¨Ï¥Î­­¨î¬Û¹ï§ó¼eÃPªº BSD ª©Åv¨Óµo§G³nÅé¡C Satoshi Asami Contributed by FreeBSD ªº¶}µo¼Ò¦¡ FreeBSD Project development model FreeBSD ªº¶}µo¬O¤@­Ó«D±`¶}©ñ¥B¨ã¼u©Êªº¹Lµ{¡A´N¹³±q °^ÄmªÌ¦W³æ ©Ò¬Ý¨ìªº¡A¬O¥Ñ¥þ¥@¬É¤W¤d¤W¸Uªº°^ÄmªÌµo®i°_¨Óªº¡C FreeBSD ªº¶}µo°ò¦¬[ºc¤¹³\¼Æ¥H¦Ê­pªº¶}µoªÌ³z¹Lºô»Úºô¸ô¨ó¦P¤u§@¡C §Ú­Ì¤]¸g±`Ãöª`µÛ¨º¨Ç¹ï§Ú­Ìªº­pµe·P¿³½ìªº·s¶}µoªÌ©M·sªº³Ð·N¡A ¨º¨Ç¦³¿³½ì§ó¶i¤@¨B°Ñ»P­p¹ºªº¤H¥u»Ý­n¦b &a.hackers; ³sô§Ú­Ì¡C &a.announce; ¹ï¨º¨Ç§Æ±æ¤F¸Ñ§Ú­Ì¶i«×ªº¤H¤]¬O¬Û·í¦³¥Îªº¡C µL½×¬O³æ¿W¶}µoªÌ©ÎªÌ«Ê³¬¦¡ªº¹Î¶¤¦X§@¡A­Y¯à¤F¸Ñ FreeBSD ­p¹º©M¥¦ªº¶}µo¹Lµ{³£¬O¦³¥Îªº¡J The CVS repository CVS repository Concurrent Versions System CVS The central source tree for FreeBSD is maintained by - CVS + CVS (Concurrent Versions System), a freely available source code control tool that comes bundled with FreeBSD. The primary CVS repository resides on a machine in Santa Clara CA, USA from where it is replicated to numerous mirror machines throughout the world. The CVS tree, which contains the -CURRENT and -STABLE trees, can all be easily replicated to your own machine as well. Please refer to the Synchronizing your source tree section for more information on doing this. The committers list committers The committers are the people who have write access to the CVS tree, and are authorized to make modifications to the FreeBSD source (the term committer comes from the &man.cvs.1; commit command, which is used to bring new changes into the CVS repository). The best way of making submissions for review by the committers list is to use the &man.send-pr.1; command. If something appears to be jammed in the system, then you may also reach them by sending mail to the &a.committers;. The FreeBSD core team core team FreeBSD core team ´Nµ¥©ó¸³¨Æ·| -- ¦pªG§â FreeBSD ¬Ý¦¨¬O¤@®a¤½¥qªº¸Ü¡C core team ªº¥D­n¾³d¦b©ó½T«O¦¹­p¹º¦³¨}¦nªº¬[ºc¡A¥H´ÂµÛ¥¿½Tªº¤è¦Vµo®i¡C ¦¹¥~¡AÁܽмö¦å¥B­t³dªº³nÅé¶}µoªÌ¥[¤J committers ¦æ¦C¡A¥H¦b­Y¤z¦¨­ûÂ÷¥h®É±o¥H¸É¥R·s¦å¡C ¥Ø«eªº core team ¬O¦b 2004 ¦~ 6 ¤ë committers ­Ô¿ï¤H¤¤¿ï¥X¨Óªº¡A¨C¨â¦~·|Á|¿ì¤@¦¸¿ïÁ| Some core team members also have specific areas of responsibility, meaning that they are committed to ensuring that some large portion of the system works as advertised. For a complete list of FreeBSD developers and their areas of responsibility, please see the Contributors List Most members of the core team are volunteers when it comes to FreeBSD development and do not benefit from the project financially, so commitment should also not be misconstrued as meaning guaranteed support. The board of directors analogy above is not very accurate, and it may be more suitable to say that these are the people who gave up their lives in favor of FreeBSD against their better judgment! Outside contributors contributors Last, but definitely not least, the largest group of developers are the users themselves who provide feedback and bug fixes to us on an almost constant basis. The primary way of keeping in touch with FreeBSD's more non-centralized development is to subscribe to the &a.hackers; where such things are discussed. See for more information about the various FreeBSD mailing lists. The FreeBSD Contributors List is a long and growing one, so why not join it by contributing something back to FreeBSD today? Providing code is not the only way of contributing to the project; for a more complete list of things that need doing, please refer to the FreeBSD Project web site. In summary, our development model is organized as a loose set of concentric circles. The centralized model is designed for the convenience of the users of FreeBSD, who are provided with an easy way of tracking one central code base, not to keep potential contributors out! Our desire is to present a stable operating system with a large set of coherent application programs that the users can easily install and use — this model works very well in accomplishing that. All we ask of those who would join us as FreeBSD developers is some of the same dedication its current people have to its continued success! ³Ì·sªº FreeBSD µo¦æª©¥» NetBSD OpenBSD 386BSD Free Software Foundation U.C. Berkeley Computer Systems Research Group (CSRG) FreeBSD ¬O§K¶O¨Ï¥Î¥B±a¦³§¹¾ã­ì©lµ{¦¡½Xªº¥H 4.4BSD-Lite ¬°°ò¦ªº¨t²Î¡A¥i¥H¦b Intel &i386;, &i486;, &pentium;, &pentium; Pro, &celeron;, &pentium; II, &pentium; III, &pentium; 4 (©ÎªÌ¬Û®e«¬¸¹), &xeon;, DEC Alpha ©M Sun &ultrasparc; ¬°°ò¦ªº¹q¸£¤W°õ¦æªº§@·~¨t²Î¡C ¥¦¥D­n¥H¥[¦{¤j¾Ç¤Úº¸§J§Q¤À®Õ ªº CSRG ¬ã¨s¤p²Õªº³nÅ鬰°ò¦¡A¨Ã¥[¤J¤F NetBSD¡BOpenBSD¡B386BSD ¥H¤Î¦Û¥Ñ³nÅé°òª÷·|ªº¤@¨ÇªF¦è¡C ¦Û±q 1994 ¦~¥½¡A§Ú­Ìµo§G¤F FreeBSD 2.0 ¤§«á¡A¨t²Îªº°õ¦æ®Ä²v¡B ¥\¯à¡Bí©w©Ê³£¦³¤F¥O¤Hª`¥Øªº´£¤É¡C ³Ì¤jªº§ïÅÜ´N¬O§Ú­Ì±N°O¾ÐÅé»PÀɮרt²Îªº cache ¾÷¨îµ²¦X¦b¤@°_¡C ³o¤£¥u¨Ï±o¨t²Îªºªí²{Åܱo§ó¦n, ¨Ã¥B¨Ï±o FreeBSD ¨t²Î³Ì¤Öªº°O¾ÐÅé»Ý¨D´î¤Ö¨ì 5 MB¡C ¨ä¥¦ªº§ï¶i¥]¬A§¹¾ãªº NIS cilent and server ¥\¯à¤ä´©¡A ¤ä´© transaction TCP¡BPPP ¼·±µ³s½u¡B¾ã¦Xªº DHCP ¤ä´©¡B SCSI ¤l¨t²Îªº§ï¶i¡BISDN ªº¤ä´©¡AATM¡BFDDI ¥H¤Î¤A¤Óºô¸ô (Ethernet¡B¥]¬A 100 Mbit ©M Gigabit) ªº¤ä´©¡A´£¤É¤F³Ì·sªº Adaptec ±±¨î¥dÅX°Êµ{¦¡ªº§ïµ½¡A¥H¤Î¼Æ¥H¤d­pªº bug ­×¥¿¡C °£¤F³Ì°ò¥»ªº¨t²Î³nÅé¡AFreeBSD ÁÙ´£¨Ñ¤F¼s¨üÅwªïªº®M¥ó³nÅéºÞ²z¾÷¨î¡G Ports Collection¡C ¨ì¥»®Ñ¥I¦L®É¡A¤w¦³¶W¹L &os.numports; ­Ó ports¡A¨ä¤¤½dÃ¥¥]¬A±q http(WWW) ¦øªA¾¹¨ì¹CÀ¸¡Bµ{¦¡»y¨¥¡B½s¿è¾¹¥H¤Î±z¯à·Q¨ìªº´X¥G©Ò¦³ªºªF¦è¡C §¹¾ãªº Ports Collection »Ý­n¬ù &ports.size; ªºµwºÐªÅ¶¡¡A°£¤F port °ò¥»¬[ºcÀÉ®×¥~¡A³£¥uÀx¦s»P¸Ó port ³nÅ骺­ì©l½X¦³¡y¶·­nÅܧó¡zªº³¡¥÷¡C ¦p¦¹¤@¨Ó¡A§Ú­Ì¥i¥H§ó®e©ö§ó·s³o¨Ç ports¡A ¤]¤j¶qªº´î¤Ö¦pªº 1.0 ª© Ports Collection ¹ï©óµwºÐªÅ¶¡ªº»Ý¨D¡C ­n¦w¸Ë¤@­Ó port ªº¸Ü¡A¥u»Ý­n¶i¤J¸Ó port ªº¥Ø¿ý¡A¿é¤J make install ¡A³o¼Ë¤l¨t²Î´N·|À°§A¸Ë¦n¤F¡C±z­n½sĶªº¨C­Óµ{¦¡ªº§¹¾ã­ì©lµ{¦¡¡A ³£¥i±q FTP ©Î CDROM ¤¤Àò±o¡A©Ò¥H±z¥u»Ý·Ç³Æ¨¬°÷ªºµwºÐªÅ¶¡¨Ó½sĶ§A­nªº port ³nÅé¡C ´X¥G¨C¤@­Ó port ³£¦³¤w¨Æ¥ý½sĶ¦nªº package¥H¤è«K¦w¸Ë¡A ¦pªG¤£·Q±q½sĶ port ªº¤H¡A¥u­n¥Î­Ó²³æ«ü¥O(pkg_add)´N¥i¥H¦w¸Ë¡C ¦³Ãö packages ©M ports ªº²Ó¸`¡A¥i¥H°Ñ¾\ ¡C FreeBSD ¥D¾÷ªº /usr/share/doc ¥Ø¿ý¤U§ä¨ì³\¦h¦³¥Îªº¤å¥ó¡A ¨ÓÀ°§U±z¦w¸Ë¡B¨Ï¥Î FreeBSD¡C¤]¥i¥H¨Ï¥Î¤U­±ªººô§}¡A¥HÂsÄý¾¹¨Ó½¾\¥»¾÷¤W¦w¸Ëªº¤â¥U¡J FreeBSD ¨Ï¥Î¤â¥U /usr/share/doc/handbook/index.html FreeBSD ±`¨£°Ýµª¶° /usr/share/doc/faq/index.html ¦¹¥~¡A¥i¦b¤U¦Cºô§}§ä¨ì³Ì·sª© (¤]¬O§ó·s³ÌÀWÁcªºª©¥»)¡G¡C diff --git a/zh_TW.Big5/books/handbook/kernelconfig/chapter.sgml b/zh_TW.Big5/books/handbook/kernelconfig/chapter.sgml index f81768c10d..5615d71d15 100644 --- a/zh_TW.Big5/books/handbook/kernelconfig/chapter.sgml +++ b/zh_TW.Big5/books/handbook/kernelconfig/chapter.sgml @@ -1,1694 +1,1669 @@ Jim Mock - Updated and restructured by + §ó·s¡B­«±Æ¡G Jake Hamby - Originally contributed by + ­ì§@¬°¡G - Configuring the FreeBSD Kernel + ³]©w FreeBSD Kernel - Synopsis + ·§­z kernel building a custom kernel - The kernel is the core of the &os; operating system. It is - responsible for managing memory, enforcing security controls, - networking, disk access, and much more. While more and more of &os; - becomes dynamically configurable it is still occasionally necessary to - reconfigure and recompile your kernel. + kernel ¬O¾ã­Ó &os; §@·~¨t²Îªº®Ö¤ß¡C + ¥¦±±¨î¤F¨t²Îªº¾ãÅé¹B§@¡A¥]§t©M°O¾ÐÅéºÞ²z¡B¦w¥þ±±ºÞ¡Bºô¸ô¡BµwºÐ¦s¨úµ¥µ¥¡C + ¾¨ºÞ¥Ø«e &os; ¤j¦h¥i¥H¥Î°ÊºA module ¨Ó¸ü¤J¡B¨ø¸ü©Ò»Ý¥\¯à¡A¦ý¦³®É­Ô¤´¦³¥²­n¾Ç·|­«·s½Õ°t kernel¡C - After reading this chapter, you will know: + Ū§¹³o³¹¡A±z±N¤F¸Ñ¡J - Why you might need to build a custom kernel. + ¬°¦ó»Ý­n­«·s½Õ°t¡B½sĶ kernel¡H - How to write a kernel configuration file, or alter an existing - configuration file. + ­n«ç»ò­×§ï kernel ³]©wÀÉ¡H - How to use the kernel configuration file to create and build a - new kernel. + ¦p¦ó¥H kernel ³]©wÀɨӫإߡB½sĶ·sªº kernel ©O¡H - How to install the new kernel. + ¦p¦ó¦w¸Ë·sªº kernel¡C - How to create any entries in /dev that may - be required. + ¦p¦ó¦b /dev ¤U¨Ó¦w¸Ë·sªºµwÅé¡C - How to troubleshoot if things go wrong. + ¦p¦ó³B²z kernel ¿ù»~µLªk¶}¾÷ªº±¡§Î¡C - All of the commands listed within this chapter by way of example - should be executed as root in order to - succeed. + ¥»³¹©ÒÁ|¨Òªº¬ÛÃö«ü¥O³£¬O¥H root Åv­­¨Ó¶i¦æ¡C - Why Build a Custom Kernel? - - Traditionally, &os; has had what is called a - monolithic kernel. This means that the kernel was one - large program, supported a fixed list of devices, and if you wanted to - change the kernel's behavior then you had to compile a new kernel, and - then reboot your computer with the new kernel. - - Today, &os; is rapidly moving to a model where much of the - kernel's functionality is contained in modules which can be - dynamically loaded and unloaded from the kernel as necessary. - This allows the kernel to adapt to new hardware suddenly - becoming available (such as PCMCIA cards in a laptop), or for - new functionality to be brought into the kernel that was not - necessary when the kernel was originally compiled. This is - known as a modular kernel. - - Despite this, it is still necessary to carry out some static kernel - configuration. In some cases this is because the functionality is so - tied to the kernel that it can not be made dynamically loadable. In - others it may simply be because no one has yet taken the time to write a - dynamic loadable kernel module for that functionality. - - Building a custom kernel is one of the most important rites of - passage nearly every BSD user must endure. This process, while - time consuming, will provide many benefits to your &os; system. - Unlike the GENERIC kernel, which must support a - wide range of hardware, a custom kernel only contains support for - your PC's hardware. This has a number of - benefits, such as: + ¬°¦ó»Ý­n­«·s½Õ°t¡B½sĶ kernel¡H + + ¦­´Áªº &os; ªº kernel ³QÀ¸ºÙ¬° monolithic kernel¡C + ³o·N«ä¬O»¡·í®Éªº kernel ¬O­Ó¤j¶ôÀYµ{¦¡¡A¥B¥u¤ä´©©T©wªºµwÅé¦Ó¤w¡C + ¦pªG±z·Q§ïÅÜ kernel ªº³]©w¡A¨º»ò¥²¶·½sĶ¤@­Ó·sªº¨Ã­«·s¶}¾÷¡A¤~¯à±Ò¥Î¡C + + ²{¦bªº &os; ¤w§Ö³t¦¨ªø¨ì·s«¬ºAªººÞ²z¼Ò¦¡¡A¨ä­«­n¯S¦â¬O¡G + kernel ¥\¯à¥i¥HÀH®É¨Ì¾Ú»Ý¨D¡A¦Ó¥H°ÊºA¸ü¤J©Î¨ø¸ü¬ÛÃöªº kernel module¡C + ³o¨Ï±o kernel ¯à°÷§Ö³t¦]À³·sªºÀô¹Ò¦Ó§@½Õ¾ã(¦³ÂI¹³¬O¡Gµ§°O«¬¹q¸£¤Wªº PCMCIA ¥d¤@¼Ë§Y´¡§Y¥Î) + ¡A©Î¬O¼W¥[¨ä¥L­ì¥»ªº¹w³] kernel(GENERIC) ©Ò¨S¦³ªº¥\¯à¡C + ³oºØ¼Ò¦¡¡A´N¥s°µ modular kernel(®Ö¤ß¼Ò²Õ)¡C + + ¾¨ºÞ¦p¦¹¡AÁÙ¬O¦³¤@¨Ç¥\¯à¤´¶·½sĶ¦b kernel ¤º¤~¦æ¡C¦]¬°¦³®É­Ô¬O¦]¬°³o¨Ç¥\¯à»P kernel + µ²¦Xªº¬Û·í½ÆÂøºò±K¡A¦ÓµLªk±N¥¦­Ì§Ë¦¨¥i°ÊºA¸ü¤Jªº module + ¡F¦Ó¦³®É­Ô¡A«h¬O¦]¬°¨S¦³¤H¦³ªÅ¨Ó§Ë¨º¨Ç kernel module ªº¹ê§@¡C + + ­«·s½Õ°t¡B½sĶ kernel ´X¥G¬O¨C¦ì BSD ¨Ï¥ÎªÌ©Ò¥²¶·¸g¾úªº¹Lµ{¡C + ¾¨ºÞ³o¶µ¤u§@¥i¯à¤ñ¸û¯Ó®É¡A¦ý¦b &os; ªº¨Ï¥Î¤W·|¦³³\¦h¦n³B¡C + ¸ò¥²¶·¤ä´©¤j¦h¼Æ¦U¦¡µwÅ骺 GENERIC kernel ¬Û¤ñªº¸Ü¡A¦Û¦æ½Õ°t kernel ¤£¦P³B¦b©ó¡G¥i¥H§ó¡yÅé¶K¡z¡A¥u¤ä´©¡y¦Û¤vµwÅé¡zªº³¡¤À´N¦n¡C + ¦n³B¦b©ó¡AÄ´¦p¡J - Faster boot time. Since the kernel will only probe the - hardware you have on your system, the time it takes your system to - boot can decrease dramatically. + ¶}¾÷³t«×§ó§Ö¡G¦]¬°¦Û¦æ½Õ°tªº kernel ¥u»Ý­n°»´ú±z¨t²Î¤WªºµwÅé¡A©Ò¥HÅý±Ò°Ê©Òªáªº¹Lµ{§ó¬yºZ§Ö³t¡C - Lower memory usage. A custom kernel often uses less memory - than the GENERIC kernel, which is important - because the kernel must always be present in real - memory. For this reason, a custom kernel is especially useful - on a system with a small amount of RAM. + ¦û¥Îªº°O¾ÐÅé§ó¤Ö¡G¦Û¦æ½Õ°tªº kernel ³q±`·|¤ñ GENERIC ®Ö¤ß¨Ï¥Î§ó¤Öªº°O¾ÐÅé¡A + ¥Ñ©ó kernel ¥²¶·¤@ª½¦s©ñ¦b°O¾ÐÅ餺¡A¦]¦¹³o´NÅã±o§ó¥[­«­n¡C¦]¦¹¡A¹ï©ó°O¾ÐÅé¸û¤pªº¨t²Î¨Ó»¡¡A¦Û¦æ½Õ°tªº kernel ´N¥iµo´§§ó¦hªº§@¥Î¡B´§ÅxªÅ¶¡¡C - Additional hardware support. A custom kernel allows you to - add in support for devices which are not - present in the GENERIC kernel, such as - sound cards. + ¥i¤ä´©§ó¦hµwÅé¡G±z¥i¦b¦Û¦æ½Õ°tªº kernel ¼W¥[¤@¨Ç­ì¥» GENERIC ®Ö¤ß¨S¦³´£¨ÑªºµwÅé¤ä´©¡A¹³¬O­µ®Ä¥d¤§Ãþªº¡C - Building and Installing a Custom Kernel + ­«·s½Õ°t¡B½sĶ kernel kernel building / installing First, let us take a quick tour of the kernel build directory. All directories mentioned will be relative to the main /usr/src/sys directory, which is also accessible through the path name /sys. There are a number of subdirectories here representing different parts of the kernel, but the most important for our purposes are arch/conf, where you will edit your custom kernel configuration, and compile, which is the staging area where your kernel will be built. arch represents one of i386, alpha, amd64, ia64, powerpc, sparc64, or pc98 (an alternative development branch of PC hardware, popular in Japan). Everything inside a particular architecture's directory deals with that architecture only; the rest of the code is machine independent code common to all platforms to which &os; could potentially be ported. Notice the logical organization of the directory structure, with each supported device, file system, and option in its own subdirectory. Versions of &os; prior to 5.X support only the i386, alpha and pc98 architectures. This chapter assumes that you are using the i386 architecture in the examples. If this is not the case for your situation, make appropriate adjustments to the path names for your system's architecture. If there is not a /usr/src/sys directory on your system, then the kernel source has not been installed. The easiest way to do this is by running sysinstall (/stand/sysinstall in &os; versions older than 5.2) as root, choosing Configure, then Distributions, then src, then sys. If you have an aversion to sysinstall and you have access to an official &os; CDROM, then you can also install the source from the command line: &prompt.root; mount /cdrom &prompt.root; mkdir -p /usr/src/sys &prompt.root; ln -s /usr/src/sys /sys &prompt.root; cat /cdrom/src/ssys.[a-d]* | tar -xzvf - Next, move to the arch/conf directory and copy the GENERIC configuration file to the name you want to give your kernel. For example: &prompt.root; cd /usr/src/sys/i386/conf &prompt.root; cp GENERIC MYKERNEL Traditionally, this name is in all capital letters and, if you are maintaining multiple &os; machines with different hardware, it is a good idea to name it after your machine's hostname. We will call it MYKERNEL for the purpose of this example. Storing your kernel configuration file directly under /usr/src can be a bad idea. If you are experiencing problems it can be tempting to just delete /usr/src and start again. After doing this, it usually only takes a few seconds for you to realize that you have deleted your custom kernel configuration file. Also, do not edit GENERIC directly, as it may get overwritten the next time you update your source tree, and your kernel modifications will be lost. You might want to keep your kernel configuration file elsewhere, and then create a symbolic link to the file in the i386 directory. For example: &prompt.root; cd /usr/src/sys/i386/conf &prompt.root; mkdir /root/kernels &prompt.root; cp GENERIC /root/kernels/MYKERNEL &prompt.root; ln -s /root/kernels/MYKERNEL Now, edit MYKERNEL with your favorite text editor. If you are just starting out, the only editor available will probably be vi, which is too complex to explain here, but is covered well in many books in the bibliography. However, &os; does offer an easier editor called ee which, if you are a beginner, should be your editor of choice. Feel free to change the comment lines at the top to reflect your configuration or the changes you have made to differentiate it from GENERIC. SunOS If you have built a kernel under &sunos; or some other BSD operating system, much of this file will be very familiar to you. If you are coming from some other operating system such as DOS, on the other hand, the GENERIC configuration file might seem overwhelming to you, so follow the descriptions in the Configuration File section slowly and carefully. If you sync your source tree with the latest sources of the &os; project, be sure to always check the file /usr/src/UPDATING before you perform any update steps. This file describes any important issues or areas requiring special attention within the updated source code. /usr/src/UPDATING always matches your version of the &os; source, and is therefore more up to date with new information than this handbook. You must now compile the source code for the kernel. There are two procedures you can use to do this, and the one you will use depends on why you are rebuilding the kernel and the version of &os; that you are running. If you have installed only the kernel source code, use procedure 1. If you are running a &os; version prior to 4.0, and you are not upgrading to &os; 4.0 or higher using the make buildworld procedure, use procedure 1. If you are building a new kernel without updating the source code (perhaps just to add a new option, such as IPFIREWALL) you can use either procedure. If you are rebuilding the kernel as part of a make buildworld process, use procedure 2. cvsup CTM CVS anonymous If you have not upgraded your source tree in any way since the last time you successfully completed a buildworld-installworld cycle (you have not run CVSup, CTM, or used anoncvs), then it is safe to use the config, make depend, make, make install sequence. Procedure 1. Building a Kernel the <quote>Traditional</quote> Way Run &man.config.8; to generate the kernel source code. &prompt.root; /usr/sbin/config MYKERNEL Change into the build directory. &man.config.8; will print the name of this directory after being run as above. &prompt.root; cd ../compile/MYKERNEL For &os; versions prior to 5.0, use the following form instead: &prompt.root; cd ../../compile/MYKERNEL Compile the kernel. &prompt.root; make depend &prompt.root; make Install the new kernel. &prompt.root; make install Procedure 2. Building a Kernel the <quote>New</quote> Way Change to the /usr/src directory. &prompt.root; cd /usr/src Compile the kernel. &prompt.root; make buildkernel KERNCONF=MYKERNEL Install the new kernel. &prompt.root; make installkernel KERNCONF=MYKERNEL This method of kernel building requires full source files. If you only installed the kernel source, use the traditional method, as described above. By default, when you build a custom kernel, - all kernel modules also will be rebuilded. + all kernel modules will be rebuilt as well. If you want to update a kernel faster or to build only custom modules, you should edit /etc/make.conf before starting to build the kernel: MODULES_OVERRIDE = linux acpi sound/sound sound/driver/ds1 ntfs This variable sets up a list of modules to build instead of all of them. For other variables which you may find useful in the process of building kernel, refer to &man.make.conf.5; manual page. In &os; 4.2 and older you must replace KERNCONF= with KERNEL=. 4.2-STABLE that was fetched before Feb 2nd, 2001 does not recognize KERNCONF=. /boot/kernel.old The new kernel will be copied to the /boot/kernel directory as /boot/kernel/kernel and the old kernel will be moved to /boot/kernel.old/kernel. Now, shutdown the system and reboot to use your new kernel. If something goes wrong, there are some troubleshooting instructions at the end of this chapter that you may find useful. Be sure to read the section which explains how to recover in case your new kernel does not boot. In &os; 4.X and earlier, kernels are installed in /kernel, modules in /modules, and old kernels are backed up in /kernel.old. Other files relating to the boot process, such as the boot &man.loader.8; and configuration are stored in /boot. Third party or custom modules can be placed in /modules, although users should be aware that keeping modules in sync with the compiled kernel is very important. Modules not intended to run with the compiled kernel may result in instability or incorrectness. If you have added any new devices (such as sound cards) and you are running &os; 4.X or previous versions, you may have to add some device nodes to your /dev directory before you can use them. For more information, take a look at Making Device Nodes section later on in this chapter. Joel Dahl Updated for &os; 5.X by The Configuration File kernel NOTES kernel LINT NOTES LINT kernel configuration file The general format of a configuration file is quite simple. Each line contains a keyword and one or more arguments. For simplicity, most lines only contain one argument. Anything following a # is considered a comment and ignored. The following sections describe each keyword, in the order they are listed in GENERIC. For an exhaustive list of architecture dependent options and devices, see the NOTES file in the same directory as GENERIC. For architecture independent options, see /usr/src/sys/conf/NOTES. NOTES does not exist in &os; 4.X. Instead, see the LINT file for detailed explanations of options and devices in GENERIC. LINT served two purposes in 4.X: to provide a reference for choosing kernel options when building a custom kernel, and to provide a kernel configuration with as many tweakable options tweaked to non-default values as possible. The reason behind this was that such a configuration helped (and still does) a lot when testing new code and changes to existing code that may cause conflicts with other parts of the kernel. However, the kernel configuration framework went through some heavy changes in 5.X; one example of this is that the driver configuration options were moved to a hints file so that they could be changed and loaded dynamically at boot time, and LINT could not contain those hints anymore. For this and other reasons, the LINT file was renamed to NOTES and retained mostly the first reason for its existence: documenting the available options for user convenience. In &os; 5.X and later versions you can still generate a buildable LINT file by typing: &prompt.root; cd /usr/src/sys/i386/conf && make LINT kernel configuration file The following is an example of the GENERIC kernel configuration file with various additional comments where needed for clarity. This example should match your copy in /usr/src/sys/i386/conf/GENERIC fairly closely. kernel options machine machine i386 This is the machine architecture. It must be either alpha, amd64, i386, ia64, pc98, powerpc, or sparc64. kernel options cpu cpu I486_CPU cpu I586_CPU cpu I686_CPU The above option specifies the type of CPU you have in your system. You may have multiple instances of the CPU line (if, for example, you are not sure whether you should use I586_CPU or I686_CPU), but for a custom kernel it is best to specify only the CPU you have. If you are unsure of your CPU type, you can check the /var/run/dmesg.boot file to view your boot messages. kernel options cpu type Support for I386_CPU is still provided in the source of &os;, but it is disabled by default in both -STABLE and -CURRENT. This means that to install &os; with a 386-class cpu, you now have the following options: Install an older &os; release and rebuild from source as described in . Build the userland and kernel on a newer machine and install on the 386 using the precompiled /usr/obj files (see for details). Roll your own release of &os; which includes I386_CPU support in the kernels of the installation CD-ROM. The first of these options is probably the easiest of all, but you will need a lot of disk space which, on a 386-class machine, may be difficult to find. kernel options ident ident GENERIC This is the identification of the kernel. You should change this to whatever you named your kernel, i.e. MYKERNEL if you have followed the instructions of the previous examples. The value you put in the ident string will print when you boot up the kernel, so it is useful to give the new kernel a different name if you want to keep it separate from your usual kernel (e.g., you want to build an experimental kernel). #To statically compile in device wiring instead of /boot/device.hints #hints "GENERIC.hints" # Default places to look for devices. In &os; 5.X and newer versions the &man.device.hints.5; is used to configure options of the device drivers. The default location that &man.loader.8; will check at boot time is /boot/device.hints. Using the hints option you can compile these hints statically into your kernel. Then there is no need to create a device.hints file in /boot. #makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols The normal build process of &os; does not include debugging information when building the kernel and strips most symbols after the resulting kernel is linked, to save some space at the install location. If you are going to do tests of kernels in the -CURRENT branch or develop changes of your own for the &os; kernel, you might want to uncomment this line. It will enable the use of the option which enables debugging information when passed to &man.gcc.1;. The same can be accomplished by the &man.config.8; option, if you are using the traditional way for building your kernels (see for more information). options SCHED_4BSD # 4BSD scheduler The traditional scheduler for &os;. Depending on your system's workload, you may gain performance by using the new ULE scheduler for &os; that has been designed specially for SMP, but works just fine on UP systems too. If you wish to try it out, replace SCHED_4BSD with SCHED_ULE in your configuration file. options INET # InterNETworking Networking support. Leave this in, even if you do not plan to be connected to a network. Most programs require at least loopback networking (i.e., making network connections within your PC), so this is essentially mandatory. options INET6 # IPv6 communications protocols This enables the IPv6 communication protocols. options FFS # Berkeley Fast Filesystem This is the basic hard drive file system. Leave it in if you boot from the hard disk. options SOFTUPDATES # Enable FFS Soft Updates support This option enables Soft Updates in the kernel, this will help speed up write access on the disks. Even when this functionality is provided by the kernel, it must be turned on for specific disks. Review the output from &man.mount.8; to see if Soft Updates is enabled for your system disks. If you do not see the soft-updates option then you will need to activate it using the &man.tunefs.8; (for existing file systems) or &man.newfs.8; (for new file systems) commands. options UFS_ACL # Support for access control lists This option, present only in &os; 5.X, enables kernel support for access control lists. This relies on the use of extended attributes and UFS2, and the feature is described in detail in . ACLs are enabled by default and should not be disabled in the kernel if they have been used previously on a file system, as this will remove the access control lists, changing the way files are protected in unpredictable ways. options UFS_DIRHASH # Improve performance on big directories This option includes functionality to speed up disk operations on large directories, at the expense of using additional memory. You would normally keep this for a large server, or interactive workstation, and remove it if you are using &os; on a smaller system where memory is at a premium and disk access speed is less important, such as a firewall. options MD_ROOT # MD is a potential root device This option enables support for a memory backed virtual disk used as a root device. kernel options NFS kernel options NFS_ROOT options NFSCLIENT # Network Filesystem Client options NFSSERVER # Network Filesystem Server options NFS_ROOT # NFS usable as /, requires NFSCLIENT The network file system. Unless you plan to mount partitions from a &unix; file server over TCP/IP, you can comment these out. kernel options MSDOSFS options MSDOSFS # MSDOS Filesystem The &ms-dos; file system. Unless you plan to mount a DOS formatted hard drive partition at boot time, you can safely comment this out. It will be automatically loaded the first time you mount a DOS partition, as described above. Also, the excellent emulators/mtools software allows you to access DOS floppies without having to mount and unmount them (and does not require MSDOSFS at all). options CD9660 # ISO 9660 Filesystem The ISO 9660 file system for CDROMs. Comment it out if you do not have a CDROM drive or only mount data CDs occasionally (since it will be dynamically loaded the first time you mount a data CD). Audio CDs do not need this file system. options PROCFS # Process filesystem The process file system. This is a pretend file system mounted on /proc which allows programs like &man.ps.1; to give you more information on what processes are running. In &os; 5.X and above, use of PROCFS is not required under most circumstances, as most debugging and monitoring tools have been adapted to run without PROCFS: unlike in &os; 4.X, new installations of &os; 5.X will not mount the process file system by default. In addition, 6.X-CURRENT kernels making use of PROCFS must now also include support for PSEUDOFS: options PSEUDOFS # Pseudo-filesystem framework PSEUDOFS is not available in &os; 4.X. options GEOM_GPT # GUID Partition Tables. This option brings the ability to have a large number of partitions on a single disk. options COMPAT_43 # Compatible with BSD 4.3 [KEEP THIS!] Compatibility with 4.3BSD. Leave this in; some programs will act strangely if you comment this out. options COMPAT_FREEBSD4 # Compatible with &os;4 This option is required on &os; 5.X &i386; and Alpha systems to support applications compiled on older versions of &os; that use older system call interfaces. It is recommended that this option be used on all &i386; and Alpha systems that may run older applications; platforms that gained support only in 5.X, such as ia64 and &sparc64;, do not require this option. options SCSI_DELAY=15000 # Delay (in ms) before probing SCSI This causes the kernel to pause for 15 seconds before probing each SCSI device in your system. If you only have IDE hard drives, you can ignore this, otherwise you will probably want to lower this number, perhaps to 5 seconds, to speed up booting. Of course, if you do this and &os; has trouble recognizing your SCSI devices, you will have to raise it again. options KTRACE # ktrace(1) support This enables kernel process tracing, which is useful in debugging. options SYSVSHM # SYSV-style shared memory This option provides for System V shared memory. The most common use of this is the XSHM extension in X, which many graphics-intensive programs will automatically take advantage of for extra speed. If you use X, you will definitely want to include this. options SYSVMSG # SYSV-style message queues Support for System V messages. This option only adds a few hundred bytes to the kernel. options SYSVSEM # SYSV-style semaphores Support for System V semaphores. Less commonly used but only adds a few hundred bytes to the kernel. The option of the &man.ipcs.1; command will list any processes using each of these System V facilities. options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions Real-time extensions added in the 1993 &posix;. Certain applications in the Ports Collection use these (such as &staroffice;). options KBD_INSTALL_CDEV # install a CDEV entry in /dev This option is related to the keyboard. It installs a CDEV entry in /dev. options AHC_REG_PRETTY_PRINT # Print register bitfields in debug # output. Adds ~128k to driver. options AHD_REG_PRETTY_PRINT # Print register bitfields in debug # output. Adds ~215k to driver. This helps debugging by printing easier register definitions for reading. options ADAPTIVE_GIANT # Giant mutex is adaptive. Giant is the name of a mutual exclusion mechanism (a sleep mutex) that protects a large set of kernel resources. Today, this is an unacceptable performance bottleneck which is actively being replaced with locks that protect individual resources. The ADAPTIVE_GIANT option causes Giant to be included in the set of mutexes adaptively spun on. That is, when a thread wants to lock the Giant mutex, but it is already locked by a thread on another CPU, the first thread will keep running and wait for the lock to be released. Normally, the thread would instead go back to sleep and wait for its next chance to run. If you are not sure, leave this in. kernel options SMP device apic # I/O APIC The apic device enables the use of the I/O APIC for interrupt delivery. The apic device can be used in both UP and SMP kernels, but is required for SMP kernels. Add options SMP to include support for multiple processors. device isa All PCs supported by &os; have one of these. Do not remove this, even if you have no ISA slots. If you have an IBM PS/2 (Micro Channel Architecture) system, &os; provides only limited support at this time. For more information about the MCA support, see /usr/src/sys/i386/conf/NOTES. device eisa Include this if you have an EISA motherboard. This enables auto-detection and configuration support for all devices on the EISA bus. device pci Include this if you have a PCI motherboard. This enables auto-detection of PCI cards and gatewaying from the PCI to ISA bus. # Floppy drives device fdc This is the floppy drive controller. # ATA and ATAPI devices device ata This driver supports all ATA and ATAPI devices. You only need one device ata line for the kernel to detect all PCI ATA/ATAPI devices on modern machines. device atadisk # ATA disk drives This is needed along with device ata for ATA disk drives. device ataraid # ATA RAID drives This is needed along with device ata for ATA RAID drives. device atapicd # ATAPI CDROM drives This is needed along with device ata for ATAPI CDROM drives. device atapifd # ATAPI floppy drives This is needed along with device ata for ATAPI floppy drives. device atapist # ATAPI tape drives This is needed along with device ata for ATAPI tape drives. options ATA_STATIC_ID # Static device numbering This makes the controller number static; without this, the device numbers are dynamically allocated. # SCSI Controllers device ahb # EISA AHA1742 family device ahc # AHA2940 and onboard AIC7xxx devices device ahd # AHA39320/29320 and onboard AIC79xx devices device amd # AMD 53C974 (Teckram DC-390(T)) device isp # Qlogic family device mpt # LSI-Logic MPT-Fusion #device ncr # NCR/Symbios Logic device sym # NCR/Symbios Logic (newer chipsets) device trm # Tekram DC395U/UW/F DC315U adapters device adv # Advansys SCSI adapters device adw # Advansys wide SCSI adapters device aha # Adaptec 154x SCSI adapters device aic # Adaptec 15[012]x SCSI adapters, AIC-6[23]60. device bt # Buslogic/Mylex MultiMaster SCSI adapters device ncv # NCR 53C500 device nsp # Workbit Ninja SCSI-3 device stg # TMC 18C30/18C50 SCSI controllers. Comment out any you do not have in your system. If you have an IDE only system, you can remove these altogether. # SCSI peripherals device scbus # SCSI bus (required for SCSI) device ch # SCSI media changers device da # Direct Access (disks) device sa # Sequential Access (tape etc) device cd # CD device pass # Passthrough device (direct SCSI access) device ses # SCSI Environmental Services (and SAF-TE) SCSI peripherals. Again, comment out any you do not have, or if you have only IDE hardware, you can remove them completely. The USB &man.umass.4; driver and a few other drivers use the SCSI subsystem even though they are not real SCSI devices. Therefore make sure not to remove SCSI support, if any such drivers are included in the kernel configuration. # RAID controllers interfaced to the SCSI subsystem device amr # AMI MegaRAID device arcmsr # Areca SATA II RAID device asr # DPT SmartRAID V, VI and Adaptec SCSI RAID device ciss # Compaq Smart RAID 5* device dpt # DPT Smartcache III, IV - See NOTES for options device hptmv # Highpoint RocketRAID 182x device iir # Intel Integrated RAID device ips # IBM (Adaptec) ServeRAID device mly # Mylex AcceleRAID/eXtremeRAID device twa # 3ware 9000 series PATA/SATA RAID # RAID controllers device aac # Adaptec FSA RAID device aacp # SCSI passthrough for aac (requires CAM) device ida # Compaq Smart RAID device mlx # Mylex DAC960 family device pst # Promise Supertrak SX6000 device twe # 3ware ATA RAID Supported RAID controllers. If you do not have any of these, you can comment them out or remove them. # atkbdc0 controls both the keyboard and the PS/2 mouse device atkbdc # AT keyboard controller The keyboard controller (atkbdc) provides I/O services for the AT keyboard and PS/2 style pointing devices. This controller is required by the keyboard driver (atkbd) and the PS/2 pointing device driver (psm). device atkbd # AT keyboard The atkbd driver, together with atkbdc controller, provides access to the AT 84 keyboard or the AT enhanced keyboard which is connected to the AT keyboard controller. device psm # PS/2 mouse Use this device if your mouse plugs into the PS/2 mouse port. device vga # VGA video card driver The video card driver. # splash screen/screen saver device splash # Splash screen and screen saver support Splash screen at start up! Screen savers require this too. Use the line pseudo-device splash with &os; 4.X. # syscons is the default console driver, resembling an SCO console device sc sc is the default console driver and resembles a SCO console. Since most full-screen programs access the console through a terminal database library like termcap, it should not matter whether you use this or vt, the VT220 compatible console driver. When you log in, set your TERM variable to scoansi if full-screen programs have trouble running under this console. # Enable this for the pcvt (VT220 compatible) console driver #device vt #options XSERVER # support for X server on a vt console #options FAT_CURSOR # start with block cursor This is a VT220-compatible console driver, backward compatible to VT100/102. It works well on some laptops which have hardware incompatibilities with sc. Also set your TERM variable to vt100 or vt220 when you log in. This driver might also prove useful when connecting to a large number of different machines over the network, where termcap or terminfo entries for the sc device are often not available — vt100 should be available on virtually any platform. device agp Include this if you have an AGP card in the system. This will enable support for AGP, and AGP GART for boards which have these features. # Floating point support - do not disable. device npx npx is the interface to the floating point math unit in &os;, which is either the hardware co-processor or the software math emulator. This is not optional. APM # Power management support (see NOTES for more options) #device apm Advanced Power Management support. Useful for laptops, although in &os; 5.X and above this is disabled in GENERIC by default. # Add suspend/resume support for the i8254. device pmtimer Timer device driver for power management events, such as APM and ACPI. # PCCARD (PCMCIA) support # PCMCIA and cardbus bridge support device cbb # cardbus (yenta) bridge device pccard # PC Card (16-bit) bus device cardbus # CardBus (32-bit) bus PCMCIA support. You want this if you are using a laptop. # Serial (COM) ports device sio # 8250, 16[45]50 based serial ports These are the serial ports referred to as COM ports in the &ms-dos;/&windows; world. If you have an internal modem on COM4 and a serial port at COM2, you will have to change the IRQ of the modem to 2 (for obscure technical reasons, IRQ2 = IRQ 9) in order to access it from &os;. If you have a multiport serial card, check the manual page for &man.sio.4; for more information on the proper values to add to your /boot/device.hints. Some video cards (notably those based on S3 chips) use IO addresses in the form of 0x*2e8, and since many cheap serial cards do not fully decode the 16-bit IO address space, they clash with these cards making the COM4 port practically unavailable. Each serial port is required to have a unique IRQ (unless you are using one of the multiport cards where shared interrupts are supported), so the default IRQs for COM3 and COM4 cannot be used. # Parallel port device ppc This is the ISA-bus parallel port interface. device ppbus # Parallel port bus (required) Provides support for the parallel port bus. device lpt # Printer Support for parallel port printers. All three of the above are required to enable parallel printer support. device plip # TCP/IP over parallel This is the driver for the parallel network interface. device ppi # Parallel port interface device The general-purpose I/O (geek port) + IEEE1284 I/O. #device vpo # Requires scbus and da zip drive This is for an Iomega Zip drive. It requires scbus and da support. Best performance is achieved with ports in EPP 1.9 mode. #device puc Uncomment this device if you have a dumb serial or parallel PCI card that is supported by the &man.puc.4; glue driver. # PCI Ethernet NICs. device de # DEC/Intel DC21x4x (Tulip) device em # Intel PRO/1000 adapter Gigabit Ethernet Card device ixgb # Intel PRO/10GbE Ethernet Card device txp # 3Com 3cR990 (Typhoon) device vx # 3Com 3c590, 3c595 (Vortex) Various PCI network card drivers. Comment out or remove any of these not present in your system. # PCI Ethernet NICs that use the common MII bus controller code. # NOTE: Be sure to keep the 'device miibus' line in order to use these NICs! device miibus # MII bus support MII bus support is required for some PCI 10/100 Ethernet NICs, namely those which use MII-compliant transceivers or implement transceiver control interfaces that operate like an MII. Adding device miibus to the kernel config pulls in support for the generic miibus API and all of the PHY drivers, including a generic one for PHYs that are not specifically handled by an individual driver. device bfe # Broadcom BCM440x 10/100 Ethernet device bge # Broadcom BCM570xx Gigabit Ethernet device dc # DEC/Intel 21143 and various workalikes device fxp # Intel EtherExpress PRO/100B (82557, 82558) device lge # Level 1 LXT1001 gigabit ethernet device nge # NatSemi DP83820 gigabit ethernet device pcn # AMD Am79C97x PCI 10/100 (precedence over 'lnc') device re # RealTek 8139C+/8169/8169S/8110S device rl # RealTek 8129/8139 device sf # Adaptec AIC-6915 (Starfire) device sis # Silicon Integrated Systems SiS 900/SiS 7016 device sk # SysKonnect SK-984x & SK-982x gigabit Ethernet device ste # Sundance ST201 (D-Link DFE-550TX) device ti # Alteon Networks Tigon I/II gigabit Ethernet device tl # Texas Instruments ThunderLAN device tx # SMC EtherPower II (83c170 EPIC) device vge # VIA VT612x gigabit ethernet device vr # VIA Rhine, Rhine II device wb # Winbond W89C840F device xl # 3Com 3c90x (Boomerang, Cyclone) Drivers that use the MII bus controller code. # ISA Ethernet NICs. pccard NICs included. device cs # Crystal Semiconductor CS89x0 NIC # 'device ed' requires 'device miibus' device ed # NE[12]000, SMC Ultra, 3c503, DS8390 cards device ex # Intel EtherExpress Pro/10 and Pro/10+ device ep # Etherlink III based cards device fe # Fujitsu MB8696x based cards device ie # EtherExpress 8/16, 3C507, StarLAN 10 etc. device lnc # NE2100, NE32-VL Lance Ethernet cards device sn # SMC's 9000 series of Ethernet chips device xe # Xircom pccard Ethernet # ISA devices that use the old ISA shims #device le ISA Ethernet drivers. See /usr/src/sys/i386/conf/NOTES for details of which cards are supported by which driver. # Wireless NIC cards device wlan # 802.11 support device an # Aironet 4500/4800 802.11 wireless NICs. device awi # BayStack 660 and others device wi # WaveLAN/Intersil/Symbol 802.11 wireless NICs. #device wl # Older non 802.11 Wavelan wireless NIC. Support for various wireless cards. # Pseudo devices device loop # Network loopback This is the generic loopback device for TCP/IP. If you telnet or FTP to localhost (a.k.a. 127.0.0.1) it will come back at you through this device. This is mandatory. Under &os; 4.X you have to use the line pseudo-device loop. device mem # Memory and kernel memory devices The system memory devices. device io # I/O device This option allows a process to gain I/O privileges. This is useful in order to write userland programs that can handle hardware directly. This is required to run the X Window system. device random # Entropy device Cryptographically secure random number generator. device ether # Ethernet support ether is only needed if you have an Ethernet card. It includes generic Ethernet protocol code. Under &os; 4.X use the line pseudo-device ether. device sl # Kernel SLIP sl is for SLIP support. This has been almost entirely supplanted by PPP, which is easier to set up, better suited for modem-to-modem connection, and more powerful. With &os; 4.X use the line pseudo-device sl. device ppp # Kernel PPP This is for kernel PPP support for dial-up connections. There is also a version of PPP implemented as a userland application that uses tun and offers more flexibility and features such as demand dialing. With &os; 4.X use the line pseudo-device ppp. device tun # Packet tunnel. This is used by the userland PPP software. See the PPP section of this book for more information. With &os; 4.X use the line pseudo-device tun. device pty # Pseudo-ttys (telnet etc) This is a pseudo-terminal or simulated login port. It is used by incoming telnet and rlogin sessions, xterm, and some other applications such as Emacs. Under &os; 4.X, you have to use the line pseudo-device pty number. The number after pty indicates the number of ptys to create. If you need more than the default of 16 simultaneous xterm windows and/or remote logins, be sure to increase this number accordingly, up to a maximum of 256. device md # Memory disks Memory disk pseudo-devices. With &os; 4.X use the line pseudo-device md. device gif # IPv6 and IPv4 tunneling This implements IPv6 over IPv4 tunneling, IPv4 over IPv6 tunneling, IPv4 over IPv4 tunneling, and IPv6 over IPv6 tunneling. Beginning with &os; 4.4 the gif device is auto-cloning, and you should use the line pseudo-device gif. Earlier versions of &os; 4.X require a number, for example pseudo-device gif 4. device faith # IPv6-to-IPv4 relaying (translation) This pseudo-device captures packets that are sent to it and diverts them to the IPv4/IPv6 translation daemon. With &os; 4.X use the line pseudo-device faith 1. # The `bpf' device enables the Berkeley Packet Filter. # Be aware of the administrative consequences of enabling this! # Note that 'bpf' is required for DHCP. device bpf # Berkeley packet filter This is the Berkeley Packet Filter. This pseudo-device allows network interfaces to be placed in promiscuous mode, capturing every packet on a broadcast network (e.g., an Ethernet). These packets can be captured to disk and or examined with the &man.tcpdump.1; program. With &os; 4.X use the line pseudo-device bpf. The &man.bpf.4; device is also used by &man.dhclient.8; to obtain the IP address of the default router (gateway) and so on. If you use DHCP, leave this uncommented. # USB support device uhci # UHCI PCI->USB interface device ohci # OHCI PCI->USB interface #device ehci # EHCI PCI->USB interface (USB 2.0) device usb # USB Bus (required) #device udbp # USB Double Bulk Pipe devices device ugen # Generic device uhid # Human Interface Devices device ukbd # Keyboard device ulpt # Printer device umass # Disks/Mass storage - Requires scbus and da device ums # Mouse device urio # Diamond Rio 500 MP3 player device uscanner # Scanners # USB Ethernet, requires mii device aue # ADMtek USB Ethernet device axe # ASIX Electronics USB Ethernet device cdce # Generic USB over Ethernet device cue # CATC USB Ethernet device kue # Kawasaki LSI USB Ethernet device rue # RealTek RTL8150 USB Ethernet Support for various USB devices. # FireWire support device firewire # FireWire bus code device sbp # SCSI over FireWire (Requires scbus and da) device fwe # Ethernet over FireWire (non-standard!) Support for various Firewire devices. For more information and additional devices supported by &os;, see /usr/src/sys/i386/conf/NOTES. Large Memory Configurations (<acronym>PAE</acronym>) Physical Address Extensions (PAE) large memory Large memory configuration machines require access to more than the 4 gigabyte limit on User+Kernel Virtual Address (KVA) space. Due to this limitation, Intel added support for 36-bit physical address space access in the &pentium; Pro and later line of CPUs. The Physical Address Extension (PAE) capability of the &intel; &pentium; Pro and later CPUs allows memory configurations of up to 64 gigabytes. &os; provides support for this capability via the kernel configuration option, available in the 4.X series of &os; beginning with 4.9-RELEASE and in the 5.X series of &os; beginning with 5.1-RELEASE. Due to the limitations of the Intel memory architecture, no distinction is made for memory above or below 4 gigabytes. Memory allocated above 4 gigabytes is simply added to the pool of available memory. To enable PAE support in the kernel, simply add the following line to your kernel configuration file: options PAE The PAE support in &os; is only available for &intel; IA-32 processors. It should also be noted, that the PAE support in &os; has not received wide testing, and should be considered beta quality compared to other stable features of &os;. PAE support in &os; has a few limitations: A process is not able to access more than 4 gigabytes of VM space. KLD modules cannot be loaded into a PAE enabled kernel, due to the differences in the build framework of a module and the kernel. Device drivers that do not use the &man.bus.dma.9; interface will cause data corruption in a PAE enabled kernel and are not recommended for use. For this reason, the PAE kernel configuration file is provided in &os; 5.X, which excludes all drivers not known to work in a PAE enabled kernel. Some system tunables determine memory resource usage by the amount of available physical memory. Such tunables can unnecessarily over-allocate due to the large memory nature of a PAE system. One such example is the sysctl, which controls the maximum number of vnodes allowed in the kernel. It is advised to adjust this and other such tunables to a reasonable value. It might be necessary to increase the kernel virtual address (KVA) space or to reduce the amount of specific kernel resource that is heavily used (see above) in order to avoid KVA exhaustion. The kernel option can be used for increasing the KVA space. For performance and stability concerns, it is advised to consult the &man.tuning.7; manual page. The &man.pae.4; manual page contains up-to-date information on &os;'s PAE support. Making Device Nodes device nodes MAKEDEV If you are running &os; 5.0 or later you can safely skip this section. These versions use &man.devfs.5; to allocate device nodes transparently for the user. Almost every device in the kernel has a corresponding node entry in the /dev directory. These nodes look like regular files, but are actually special entries into the kernel which programs use to access the device. The shell script /dev/MAKEDEV, which is executed when you first install the operating system, creates nearly all of the device nodes supported. However, it does not create all of them, so when you add support for a new device, it pays to make sure that the appropriate entries are in this directory, and if not, add them. Here is a simple example: Suppose you add the IDE CD-ROM support to the kernel. The line to add is: device acd0 This means that you should look for some entries that start with acd0 in the /dev directory, possibly followed by a letter, such as c, or preceded by the letter r, which means a raw device. It turns out that those files are not there, so you must change to the /dev directory and type: MAKEDEV &prompt.root; sh MAKEDEV acd0 When this script finishes, you will find that there are now acd0c and racd0c entries in /dev so you know that it executed correctly. For sound cards, the following command creates the appropriate entries: &prompt.root; sh MAKEDEV snd0 When creating device nodes for devices such as sound cards, if other people have access to your machine, it may be desirable to protect the devices from outside access by adding them to the /etc/fbtab file. See &man.fbtab.5; for more information. Follow this simple procedure for any other non-GENERIC devices which do not have entries. All SCSI controllers use the same set of /dev entries, so you do not need to create these. Also, network cards and SLIP/PPP pseudo-devices do not have entries in /dev at all, so you do not have to worry about these either. If Something Goes Wrong There are five categories of trouble that can occur when building a custom kernel. They are: config fails: If the &man.config.8; command fails when you give it your kernel description, you have probably made a simple error somewhere. Fortunately, &man.config.8; will print the line number that it had trouble with, so that you can quickly locate the line containing the error. For example, if you see: config: line 17: syntax error Make sure the keyword is typed correctly by comparing it to the GENERIC kernel or another reference. make fails: If the make command fails, it usually signals an error in your kernel description which is not severe enough for &man.config.8; to catch. Again, look over your configuration, and if you still cannot resolve the problem, send mail to the &a.questions; with your kernel configuration, and it should be diagnosed quickly. Installing the new kernel fails: If the kernel compiled fine, but failed to install (the make install or make installkernel command failed), the first thing to check is if your system is running at securelevel 1 or higher (see &man.init.8;). The kernel installation tries to remove the immutable flag from your kernel and set the immutable flag on the new one. Since securelevel 1 or higher prevents unsetting the immutable flag for any files on the system, the kernel installation needs to be performed at securelevel 0 or lower. The above only applies to &os; 4.X and earlier versions. &os; 5.X, along with later versions, does not set the immutable flag on the kernel and a failure to install a kernel probably indicates a more fundamental problem. The kernel does not boot: If your new kernel does not boot, or fails to recognize your devices, do not panic! Fortunately, &os; has an excellent mechanism for recovering from incompatible kernels. Simply choose the kernel you want to boot from at the &os; boot loader. You can access this when the system counts down from 10 at the boot menu. Hit any key except for the Enter key, type unload and then type boot /boot/kernel.old/kernel, or the filename of any other kernel that will boot properly. When reconfiguring a kernel, it is always a good idea to keep a kernel that is known to work on hand. After booting with a good kernel you can check over your configuration file and try to build it again. One helpful resource is the /var/log/messages file which records, among other things, all of the kernel messages from every successful boot. Also, the &man.dmesg.8; command will print the kernel messages from the current boot. If you are having trouble building a kernel, make sure to keep a GENERIC, or some other kernel that is known to work on hand as a different name that will not get erased on the next build. You cannot rely on kernel.old because when installing a new kernel, kernel.old is overwritten with the last installed kernel which may be non-functional. Also, as soon as possible, move the working kernel to the proper /boot/kernel location or commands such as &man.ps.1; may not work properly. To do this, simply rename the directory containing the good kernel: &prompt.root; mv /boot/kernel /boot/kernel.bad &prompt.root; mv /boot/kernel.good /boot/kernel For versions of &os; prior to 5.X, the proper command to unlock the kernel file that make installs (in order to move another kernel back permanently) is: &prompt.root; chflags noschg /kernel If you find you cannot do this, you are probably running at a &man.securelevel.8; greater than zero. Edit kern_securelevel in /etc/rc.conf and set it to -1, then reboot. You can change it back to its previous setting when you are happy with your new kernel. And, if you want to lock your new kernel into place, or any file for that matter, so that it cannot be moved or tampered with: &prompt.root; chflags schg /kernel The kernel works, but &man.ps.1; does not work any more: If you have installed a different version of the kernel from the one that the system utilities have been built with, for example, a 5.X kernel on a 4.X system, many system-status commands like &man.ps.1; and &man.vmstat.8; will not work any more. You should recompile and install a world built with the same version of the source tree as your kernel. This is one reason it is not normally a good idea to use a different version of the kernel from the rest of the operating system. diff --git a/zh_TW.Big5/books/handbook/l10n/chapter.sgml b/zh_TW.Big5/books/handbook/l10n/chapter.sgml index 36e2aa63ff..b937b7d4ad 100644 --- a/zh_TW.Big5/books/handbook/l10n/chapter.sgml +++ b/zh_TW.Big5/books/handbook/l10n/chapter.sgml @@ -1,972 +1,972 @@ Andrey Chernov Contributed by Michael C. Wu Rewritten by - Localization - I18N/L10N Usage and Setup + ¦a°Ï¡B»y¨t - I18N/L10N ¥Îªk»P³]©w - Synopsis + ·§­z FreeBSD is a very distributed project with users and contributors located all over the world. This chapter discusses the internationalization and localization features of FreeBSD that allow non-English speaking users to get real work done. There are many aspects of the i18n implementation in both the system and application levels, so where applicable we refer the reader to more specific sources of documentation. After reading this chapter, you will know: How different languages and locales are encoded on modern operating systems. How to set the locale for your login shell. How to configure your console for non-English languages. How to use X Window System effectively with different languages. Where to find more information about writing i18n-compliant applications. Before reading this chapter, you should: Know how to install additional third-party applications (). The Basics - What Is I18N/L10N? + Ô£¬O I18N/L10N¡H internationalization localization localization Developers shortened internationalization into the term I18N, counting the number of letters between the first and the last letters of internationalization. L10N uses the same naming scheme, coming from localization. Combined together, I18N/L10N methods, protocols, and applications allow users to use languages of their choice. I18N applications are programmed using I18N kits under libraries. It allows for developers to write a simple file and translate displayed menus and texts to each language. We strongly encourage programmers to follow this convention. Why Should I Use I18N/L10N? I18N/L10N is used whenever you wish to either view, input, or process data in non-English languages. What Languages Are Supported in the I18N Effort? I18N and L10N are not FreeBSD specific. Currently, one can choose from most of the major languages of the World, including but not limited to: Chinese, German, Japanese, Korean, French, Russian, Vietnamese and others. Using Localization In all its splendor, I18N is not FreeBSD-specific and is a convention. We encourage you to help FreeBSD in following this convention. locale Localization settings are based on three main terms: Language Code, Country Code, and Encoding. Locale names are constructed from these parts as follows: LanguageCode_CountryCode.Encoding Language and Country Codes language codes country codes In order to localize a FreeBSD system to a specific language (or any other I18N-supporting &unix; like systems), the user needs to find out the codes for the specify country and language (country codes tell applications what variation of given language to use). In addition, web browsers, SMTP/POP servers, web servers, etc. make decisions based on them. The following are examples of language/country codes: Language/Country Code Description en_US English - United States ru_RU Russian for Russia zh_TW Traditional Chinese for Taiwan Encodings encodings ASCII Some languages use non-ASCII encodings that are 8-bit, wide or multibyte characters, see &man.multibyte.3; for more details. Older applications do not recognize them and mistake them for control characters. Newer applications usually do recognize 8-bit characters. Depending on the implementation, users may be required to compile an application with wide or multibyte characters support, or configure it correctly. To be able to input and process wide or multibyte characters, the FreeBSD Ports Collection has provided each language with different programs. Refer to the I18N documentation in the respective FreeBSD Port. Specifically, the user needs to look at the application documentation to decide on how to configure it correctly or to pass correct values into the configure/Makefile/compiler. Some things to keep in mind are: Language specific single C chars character sets (see &man.multibyte.3;), e.g. ISO-8859-1, ISO-8859-15, KOI8-R, CP437. Wide or multibyte encodings, e.g. EUC, Big5. You can check the active list of character sets at the IANA Registry. FreeBSD versions 4.5 and up use X11-compatible locale encodings instead. I18N Applications In the FreeBSD Ports and Package system, I18N applications have been named with I18N in their names for easy identification. However, they do not always support the language needed. Setting Locale Usually it is sufficient to export the value of the locale name as LANG in the login shell. This could be done in the user's ~/.login_conf file or in the startup file of the user's shell (~/.profile, ~/.bashrc, ~/.cshrc). There is no need to set the locale subsets such as LC_CTYPE, LC_CTIME. Please refer to language-specific FreeBSD documentation for more information. You should set the following two environment variables in your configuration files: POSIX LANG for &posix; &man.setlocale.3; family functions MIME MM_CHARSET for applications' MIME character set This includes the user shell configuration, the specific application configuration, and the X11 configuration. Setting Locale Methods locale login class There are two methods for setting locale, and both are described below. The first (recommended one) is by assigning the environment variables in login class, and the second is by adding the environment variable assignments to the system's shell startup file. Login Classes Method This method allows environment variables needed for locale name and MIME character sets to be assigned once for every possible shell instead of adding specific shell assignments to each shell's startup file. User Level Setup can be done by an user himself and Administrator Level Setup require superuser privileges. User Level Setup Here is a minimal example of a .login_conf file in user's home directory which has both variables set for Latin-1 encoding: me:\ :charset=ISO-8859-1:\ :lang=de_DE.ISO8859-1: Traditional ChineseBIG-5 encoding Here is an example of a .login_conf that sets the variables for Traditional Chinese in BIG-5 encoding. Notice the many more variables set because some software does not respect locale variables correctly for Chinese, Japanese, and Korean. #Users who do not wish to use monetary units or time formats #of Taiwan can manually change each variable me:\ :lang=zh_TW.Big5:\ :lc_all=zh_TW.Big:\ :lc_collate=zh_TW.Big5:\ :lc_ctype=zh_TW.Big5:\ :lc_messages=zh_TW.Big5:\ :lc_monetary=zh_TW.Big5:\ :lc_numeric=zh_TW.Big5:\ :lc_time=zh_TW.Big5:\ :charset=big5:\ :xmodifiers="@im=xcin": #Setting the XIM Input Server See Administrator Level Setup and &man.login.conf.5; for more details. Administrator Level Setup Verify that the user's login class in /etc/login.conf sets the correct language. Make sure these settings appear in /etc/login.conf: language_name:accounts_title:\ :charset=MIME_charset:\ :lang=locale_name:\ :tc=default: So sticking with our previous example using Latin-1, it would look like this: german:German Users Accounts:\ :charset=ISO-8859-1:\ :lang=de_DE.ISO8859-1:\ :tc=default: Changing Login Classes with &man.vipw.8; vipw Use vipw to add new users, and make the entry look like this: user:password:1111:11:language:0:0:User Name:/home/user:/bin/sh Changing Login Classes with &man.adduser.8; adduser login class Use adduser to add new users, and do the following: Set defaultclass = language in /etc/adduser.conf. Keep in mind you must enter a default class for all users of other languages in this case. An alternative variant is answering the specified language each time that Enter login class: default []: appears from &man.adduser.8;. Another alternative is to use the following for each user of a different language that you wish to add: &prompt.root; adduser -class language Changing Login Classes with &man.pw.8; pw If you use &man.pw.8; for adding new users, call it in this form: &prompt.root; pw useradd user_name -L language Shell Startup File Method This method is not recommended because it requires a different setup for each possible shell program chosen. Use the Login Class Method instead. MIME locale To add the locale name and MIME character set, just set the two environment variables shown below in the /etc/profile and/or /etc/csh.login shell startup files. We will use the German language as an example below: In /etc/profile: LANG=de_DE.ISO8859-1; export LANG MM_CHARSET=ISO-8859-1; export MM_CHARSET Or in /etc/csh.login: setenv LANG de_DE.ISO8859-1 setenv MM_CHARSET ISO-8859-1 Alternatively, you can add the above instructions to /usr/share/skel/dot.profile (similar to what was used in /etc/profile above), or /usr/share/skel/dot.login (similar to what was used in /etc/csh.login above). For X11: In $HOME/.xinitrc: LANG=de_DE.ISO8859-1; export LANG Or: setenv LANG de_DE.ISO8859-1 Depending on your shell (see above). Console Setup For all single C chars character sets, set the correct console fonts in /etc/rc.conf for the language in question with: font8x16=font_name font8x14=font_name font8x8=font_name The font_name here is taken from the /usr/share/syscons/fonts directory, without the .fnt suffix. sysinstall keymap screenmap Also be sure to set the correct keymap and screenmap for your single C chars character set through sysinstall (/stand/sysinstall in &os; versions older than 5.2). Once inside sysinstall, choose Configure, then Console. Alternatively, you can add the following to /etc/rc.conf: scrnmap=screenmap_name keymap=keymap_name keychange="fkey_number sequence" The screenmap_name here is taken from the /usr/share/syscons/scrnmaps directory, without the .scm suffix. A screenmap with a corresponding mapped font is usually needed as a workaround for expanding bit 8 to bit 9 on a VGA adapter's font character matrix in pseudographics area, i.e., to move letters out of that area if screen font uses a bit 8 column. If you have the moused daemon enabled by setting the following in your /etc/rc.conf: moused_enable="YES" then examine the mouse cursor information in the next paragraph. moused By default the mouse cursor of the &man.syscons.4; driver occupies the 0xd0-0xd3 range in the character set. If your language uses this range, you need to move the cursor's range outside of it. To enable the workaround for FreeBSD versions before 5.0, insert the following line into your kernel configuration: options SC_MOUSE_CHAR=0x03 For FreeBSD versions 4.4 and up insert the following line into /etc/rc.conf: mousechar_start=3 The keymap_name here is taken from the /usr/share/syscons/keymaps directory, without the .kbd suffix. If you are uncertain which keymap to use, you use can &man.kbdmap.1; to test keymaps without rebooting. The keychange is usually needed to program function keys to match the selected terminal type because function key sequences cannot be defined in the key map. Also be sure to set the correct console terminal type in /etc/ttys for all ttyv* entries. Current pre-defined correspondences are: Character Set Terminal Type ISO-8859-1 or ISO-8859-15 cons25l1 ISO-8859-2 cons25l2 ISO-8859-7 cons25l7 KOI8-R cons25r KOI8-U cons25u CP437 (VGA default) cons25 US-ASCII cons25w For wide or multibyte characters languages, use the correct FreeBSD port in your /usr/ports/language directory. Some ports appear as console while the system sees it as serial vtty's, hence you must reserve enough vtty's for both X11 and the pseudo-serial console. Here is a partial list of applications for using other languages in console: Language Location Traditional Chinese (BIG-5) chinese/big5con Japanese japanese/kon2-16dot or japanese/mule-freewnn Korean korean/han X11 Setup Although X11 is not part of the FreeBSD Project, we have included some information here for FreeBSD users. For more details, refer to the &xorg; web site or whichever X11 Server you use. In ~/.Xresources, you can additionally tune application specific I18N settings (e.g., fonts, menus, etc.). Displaying Fonts X11 True Type font server Install &xorg; server (x11-servers/xorg-server) or &xfree86; server (x11-servers/XFree86-4-Server), then install the language &truetype; fonts. Setting the correct locale should allow you to view your selected language in menus and such. Inputting Non-English Characters X11 Input Method (XIM) The X11 Input Method (XIM) Protocol is a new standard for all X11 clients. All X11 applications should be written as XIM clients that take input from XIM Input servers. There are several XIM servers available for different languages. Printer Setup Some single C chars character sets are usually hardware coded into printers. Wide or multibyte character sets require special setup and we recommend using apsfilter. You may also convert the document to &postscript; or PDF formats using language specific converters. Kernel and File Systems The FreeBSD fast filesystem (FFS) is 8-bit clean, so it can be used with any single C chars character set (see &man.multibyte.3;), but there is no character set name stored in the filesystem; i.e., it is raw 8-bit and does not know anything about encoding order. Officially, FFS does not support any form of wide or multibyte character sets yet. However, some wide or multibyte character sets have independent patches for FFS enabling such support. They are only temporary unportable solutions or hacks and we have decided to not include them in the source tree. Refer to respective languages' web sites for more information and the patch files. DOS Unicode The FreeBSD &ms-dos; filesystem has the configurable ability to convert between &ms-dos;, Unicode character sets and chosen FreeBSD filesystem character sets. See &man.mount.msdos.8; for details. Compiling I18N Programs Many FreeBSD Ports have been ported with I18N support. Some of them are marked with -I18N in the port name. These and many other programs have built in support for I18N and need no special consideration. MySQL However, some applications such as MySQL need to be have the Makefile configured with the specific charset. This is usually done in the Makefile or done by passing a value to configure in the source. Localizing FreeBSD to Specific Languages Andrey Chernov Originally contributed by Russian Language (KOI8-R Encoding) localization Russian For more information about KOI8-R encoding, see the KOI8-R References (Russian Net Character Set). Locale Setup Put the following lines into your ~/.login_conf file: me:My Account:\ :charset=KOI8-R:\ :lang=ru_RU.KOI8-R: See earlier in this chapter for examples of setting up the locale. Console Setup For the FreeBSD versions before 5.0 add the following line to your kernel configuration file: options SC_MOUSE_CHAR=0x03 For FreeBSD versions 4.4 and up insert the following line into /etc/rc.conf: mousechar_start=3 Use following settings in /etc/rc.conf: keymap="ru.koi8-r" scrnmap="koi8-r2cp866" font8x16="cp866b-8x16" font8x14="cp866-8x14" font8x8="cp866-8x8" For each ttyv* entry in /etc/ttys, use cons25r as the terminal type. See earlier in this chapter for examples of setting up the console. Printer Setup printers Since most printers with Russian characters come with hardware code page CP866, a special output filter is needed to convert from KOI8-R to CP866. Such a filter is installed by default as /usr/libexec/lpr/ru/koi2alt. A Russian printer /etc/printcap entry should look like: lp|Russian local line printer:\ :sh:of=/usr/libexec/lpr/ru/koi2alt:\ :lp=/dev/lpt0:sd=/var/spool/output/lpd:lf=/var/log/lpd-errs: See &man.printcap.5; for a detailed description. &ms-dos; FS and Russian Filenames The following example &man.fstab.5; entry enables support for Russian filenames in mounted &ms-dos; filesystems: /dev/ad0s2 /dos/c msdos rw,-Wkoi2dos,-Lru_RU.KOI8-R 0 0 The option selects the locale name used, and sets the character conversion table. To use the option, be sure to mount /usr before the &ms-dos; partition because the conversion tables are located in /usr/libdata/msdosfs. For more information, see the &man.mount.msdos.8; manual page. X11 Setup Do non-X locale setup first as described. The Russian KOI8-R locale may not work with old &xfree86; releases (lower than 3.3). &xorg; is now the default version of the X Window System on FreeBSD. This should not be an issue unless you are using an old version of FreeBSD. If you use &xorg;, install x11-fonts/xorg-fonts-cyrillic package. Check the "Files" section in your /etc/X11/xorg.conf file. The following lines must be added before any other FontPath entries: FontPath "/usr/X11R6/lib/X11/fonts/cyrillic/misc" FontPath "/usr/X11R6/lib/X11/fonts/cyrillic/75dpi" FontPath "/usr/X11R6/lib/X11/fonts/cyrillic/100dpi" If you use a high resolution video mode, swap the 75 dpi and 100 dpi lines. To activate a Russian keyboard, add the following to the "Keyboard" section of your XF86Config file. For &xfree86; 3.X: XkbLayout "ru" XkbOptions "grp:caps_toggle" For &xorg; (or &xfree86; 4.X): Option "XkbLayout" "us,ru" Option "XkbOptions" "grp:toggle" Also make sure that XkbDisable is turned off (commented out) there. For grp:caps_toggle the RUS/LAT switch will be CapsLock. The old CapsLock function is still available via ShiftCapsLock (in LAT mode only). For grp:toggle the RUS/LAT switch will be Right Alt. grp:caps_toggle does not work in &xorg; for unknown reason. If you have &windows; keys on your keyboard, and notice that some non-alphabetical keys are mapped incorrectly in RUS mode, add the following line in your XF86Config file. For &xfree86; 3.X: XkbVariant "winkeys" For &xorg; (or &xfree86; 4.X): Option "XkbVariant" ",winkeys" The Russian XKB keyboard may not work with old &xfree86; versions, see the above note for more information. The Russian XKB keyboard may also not work with non-localized applications as well. Minimally localized applications should call a XtSetLanguageProc (NULL, NULL, NULL); function early in the program. See KOI8-R for X Window for more instructions on localizing X11 applications. Traditional Chinese Localization for Taiwan localization Traditional Chinese The FreeBSD-Taiwan Project has an Chinese HOWTO for FreeBSD at using many Chinese ports. Current editor for the FreeBSD Chinese HOWTO is Shen Chuan-Hsing statue@freebsd.sinica.edu.tw. Chuan-Hsing Shen statue@freebsd.sinica.edu.tw has created the Chinese FreeBSD Collection (CFC) using FreeBSD-Taiwan's zh-L10N-tut. The packages and the script files are available at . German Language Localization (for All ISO 8859-1 Languages) localization German Slaven Rezic eserte@cs.tu-berlin.de wrote a tutorial how to use umlauts on a FreeBSD machine. The tutorial is written in German and available at . Japanese and Korean Language Localization localization Japanese localization Korean For Japanese, refer to , and for Korean, refer to . Non-English FreeBSD Documentation Some FreeBSD contributors have translated parts of FreeBSD to other languages. They are available through links on the main site or in /usr/share/doc. diff --git a/zh_TW.Big5/books/handbook/mirrors/chapter.sgml b/zh_TW.Big5/books/handbook/mirrors/chapter.sgml index 4ae6c6af8d..0f48824b55 100644 --- a/zh_TW.Big5/books/handbook/mirrors/chapter.sgml +++ b/zh_TW.Big5/books/handbook/mirrors/chapter.sgml @@ -1,3178 +1,3188 @@ ¨ú±o FreeBSD CDROM ¤Î DVD Publishers Retail Boxed Products FreeBSD is available as a boxed product (FreeBSD CDs, additional software, and printed documentation) from several retailers:
CompUSA WWW:
Frys Electronics WWW:
CD and DVD Sets FreeBSD CD and DVD sets are available from many online retailers:
BSD Mall by Daemon News PO Box 161 Nauvoo, IL 62354 USA Phone: +1 866 273-6255 Fax: +1 217 453-9956 Email: sales@bsdmall.com WWW:
BSD-Systems Email: info@bsd-systems.co.uk WWW:
fastdiscs.com 6 Eltham Close Leeds, LS6 2TY United Kingdom Phone: +44 870 1995 171 Email: sales@fastdiscs.com WWW:
FreeBSD Mall, Inc. 3623 Sanford Street Concord, CA 94520-1405 USA Phone: +1 925 674-0783 Fax: +1 925 674-0821 Email: info@freebsdmall.com WWW:
Hinner EDV St. Augustinus-Str. 10 D-81825 München Germany Phone: (089) 428 419 WWW:
Ikarios 22-24 rue Voltaire 92000 Nanterre France WWW:
JMC Software Ireland Phone: 353 1 6291282 WWW:
Linux CD Mall Private Bag MBE N348 Auckland 1030 New Zealand Phone: +64 21 866529 WWW:
The Linux Emporium Hilliard House, Lester Way Wallingford OX10 9TA United Kingdom Phone: +44 1491 837010 Fax: +44 1491 837016 WWW:
Linux+ DVD Magazine Lewartowskiego 6 Warsaw 00-190 Poland Phone: +48 22 860 18 18 Email: editors@lpmagazine.org WWW:
Linux System Labs Australia 21 Ray Drive Balwyn North VIC - 3104 Australia Phone: +61 3 9857 5918 Fax: +61 3 9857 8974 WWW:
LinuxCenter.Ru Galernaya Street, 55 Saint-Petersburg 190000 Russia Phone: +7-812-3125208 Email: info@linuxcenter.ru WWW:
Distributors If you are a reseller and want to carry FreeBSD CDROM products, please contact a distributor:
Cylogistics 809B Cuesta Dr., #2149 Mountain View, CA 94040 USA Phone: +1 650 694-4949 Fax: +1 650 694-4953 Email: sales@cylogistics.com WWW:
Ingram Micro 1600 E. St. Andrew Place Santa Ana, CA 92705-4926 USA Phone: 1 (800) 456-8000 WWW:
Kudzu, LLC 7375 Washington Ave. S. Edina, MN 55439 USA Phone: +1 952 947-0822 Fax: +1 952 947-0876 Email: sales@kudzuenterprises.com
LinuxCenter.Ru Galernaya Street, 55 Saint-Petersburg 190000 Russia Phone: +7-812-3125208 Email: info@linuxcenter.ru WWW:
Navarre Corp 7400 49th Ave South New Hope, MN 55428 USA Phone: +1 763 535-8333 Fax: +1 763 535-0341 WWW:
FTP Sites The official sources for FreeBSD are available via anonymous FTP from a worldwide set of mirror sites. The site is well connected and allows a large number of connections to it, but you are probably better off finding a closer mirror site (especially if you decide to set up some sort of mirror site). The FreeBSD mirror sites database is more accurate than the mirror listing in the Handbook, as it gets its information from the DNS rather than relying on static lists of hosts. Additionally, FreeBSD is available via anonymous FTP from the following mirror sites. If you choose to obtain FreeBSD via anonymous FTP, please try to use a site near you. The mirror sites listed as Primary Mirror Sites typically have the entire FreeBSD archive (all the currently available versions for each of the architectures) but you will probably have faster download times from a site that is in your country or region. The regional sites carry the most recent versions for the most popular architecture(s) but might not carry the entire FreeBSD archive. All sites provide access via anonymous FTP but some sites also provide access via other methods. The access methods available for each site are provided in parentheses after the hostname. &chap.mirrors.ftp.inc; Anonymous CVS <anchor id="anoncvs-intro">Introduction CVS anonymous Anonymous CVS (or, as it is otherwise known, anoncvs) is a feature provided by the CVS utilities bundled with FreeBSD for synchronizing with a remote CVS repository. Among other things, it allows users of FreeBSD to perform, with no special privileges, read-only CVS operations against one of the FreeBSD project's official anoncvs servers. To use it, one simply sets the CVSROOT environment variable to point at the appropriate anoncvs server, provides the well-known password anoncvs with the cvs login command, and then uses the &man.cvs.1; command to access it like any local repository. The cvs login command, stores the passwords that are used for authenticating to the CVS server in a file called .cvspass in your HOME directory. If this file does not exist, you might get an error when trying to use cvs login for the first time. Just make an empty .cvspass file, and retry to login. While it can also be said that the CVSup and anoncvs services both perform essentially the same function, there are various trade-offs which can influence the user's choice of synchronization methods. In a nutshell, CVSup is much more efficient in its usage of network resources and is by far the most technically sophisticated of the two, but at a price. To use CVSup, a special client must first be installed and configured before any bits can be grabbed, and then only in the fairly large chunks which CVSup calls collections. Anoncvs, by contrast, can be used to examine anything from an individual file to a specific program (like ls or grep) by referencing the CVS module name. Of course, anoncvs is also only good for read-only operations on the CVS repository, so if it is your intention to support local development in one repository shared with the FreeBSD project bits then CVSup is really your only option. <anchor id="anoncvs-usage">Using Anonymous CVS Configuring &man.cvs.1; to use an Anonymous CVS repository is a simple matter of setting the CVSROOT environment variable to point to one of the FreeBSD project's anoncvs servers. At the time of this writing, the following servers are available: Austria: :pserver:anoncvs@anoncvs.at.FreeBSD.org:/home/ncvs (Use cvs login and enter any password when prompted.) France: :pserver:anoncvs@anoncvs.fr.FreeBSD.org:/home/ncvs (pserver (password anoncvs), ssh (no password)) Germany: :pserver:anoncvs@anoncvs.de.FreeBSD.org:/home/ncvs (Use cvs login and enter the password anoncvs when prompted.) Germany: :pserver:anoncvs@anoncvs2.de.FreeBSD.org:/home/ncvs (rsh, pserver, ssh, ssh/2022) Japan: :pserver:anoncvs@anoncvs.jp.FreeBSD.org:/home/ncvs (Use cvs login and enter the password anoncvs when prompted.) - USA: anoncvs@anoncvs1.FreeBSD.org:/home/ncvs (ssh only - no password) - SSH HostKey: 1024 4b:83:b6:c5:70:75:6c:5b:18:8e:3a:7a:88:a0:43:bb root@ender.liquidneon.com -SSH2 HostKey: 1024 80:a7:87:fa:61:d9:25:5c:33:d5:48:51:aa:8f:b6:12 ssh_host_dsa_key.pub + SSH HostKey: 1024 8b:c4:6f:9a:7e:65:8a:eb:50:50:29:7c:a1:47:03:bc root@ender.liquidneon.com +SSH2 HostKey: 2048 4d:59:19:7b:ea:9b:76:0b:ca:ee:da:26:e2:3a:83:b8 ssh_host_dsa_key.pub Since CVS allows one to check out virtually any version of the FreeBSD sources that ever existed (or, in some cases, will exist), you need to be familiar with the revision () flag to &man.cvs.1; and what some of the permissible values for it in the FreeBSD Project repository are. There are two kinds of tags, revision tags and branch tags. A revision tag refers to a specific revision. Its meaning stays the same from day to day. A branch tag, on the other hand, refers to the latest revision on a given line of development, at any given time. Because a branch tag does not refer to a specific revision, it may mean something different tomorrow than it means today. contains revision tags that users might be interested in. Again, none of these are valid for the Ports Collection since the Ports Collection does not have multiple revisions. When you specify a branch tag, you normally receive the latest versions of the files on that line of development. If you wish to receive some past version, you can do so by specifying a date with the flag. See the &man.cvs.1; manual page for more details. Examples While it really is recommended that you read the manual page for &man.cvs.1; thoroughly before doing anything, here are some quick examples which essentially show how to use Anonymous CVS: Checking Out Something from -CURRENT (&man.ls.1;): &prompt.user; setenv CVSROOT :pserver:anoncvs@anoncvs.jp.FreeBSD.org:/home/ncvs &prompt.user; cvs login At the prompt, enter the password anoncvs. &prompt.user; cvs co ls Using SSH to check out the <filename>src/</filename> tree: &prompt.user; cvs -d freebsdanoncvs@anoncvs.FreeBSD.org:/home/ncvs co src The authenticity of host 'anoncvs.freebsd.org (128.46.156.46)' can't be established. DSA key fingerprint is 52:02:38:1a:2f:a8:71:d3:f5:83:93:8d:aa:00:6f:65. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'anoncvs.freebsd.org' (DSA) to the list of known hosts. Checking Out the Version of &man.ls.1; in the 6-STABLE Branch: &prompt.user; setenv CVSROOT :pserver:anoncvs@anoncvs.jp.FreeBSD.org:/home/ncvs &prompt.user; cvs login At the prompt, enter the password anoncvs. &prompt.user; cvs co -rRELENG_6 ls Creating a List of Changes (as Unified Diffs) to &man.ls.1; &prompt.user; setenv CVSROOT :pserver:anoncvs@anoncvs.jp.FreeBSD.org:/home/ncvs &prompt.user; cvs login At the prompt, enter the password anoncvs. &prompt.user; cvs rdiff -u -rRELENG_5_3_0_RELEASE -rRELENG_5_4_0_RELEASE ls Finding Out What Other Module Names Can Be Used: &prompt.user; setenv CVSROOT :pserver:anoncvs@anoncvs.jp.FreeBSD.org:/home/ncvs &prompt.user; cvs login At the prompt, enter the password anoncvs. &prompt.user; cvs co modules &prompt.user; more modules/modules Other Resources The following additional resources may be helpful in learning CVS: CVS Tutorial from Cal Poly. - CVS Home, + CVS Home, the CVS development and support community. CVSweb is the FreeBSD Project web interface for CVS. Using CTM CTM CTM is a method for keeping a remote directory tree in sync with a central one. It has been developed for usage with FreeBSD's source trees, though other people may find it useful for other purposes as time goes by. Little, if any, documentation currently exists at this time on the process of creating deltas, so contact the &a.ctm-users.name; mailing list for more information and if you wish to use CTM for other things. Why Should I Use <application>CTM</application>? CTM will give you a local copy of the FreeBSD source trees. There are a number of flavors of the tree available. Whether you wish to track the entire CVS tree or just one of the branches, CTM can provide you the information. If you are an active developer on FreeBSD, but have lousy or non-existent TCP/IP connectivity, or simply wish to have the changes automatically sent to you, CTM was made for you. You will need to obtain up to three deltas per day for the most active branches. However, you should consider having them sent by automatic email. The sizes of the updates are always kept as small as possible. This is typically less than 5K, with an occasional (one in ten) being 10-50K and every now and then a large 100K+ or more coming around. You will also need to make yourself aware of the various caveats related to working directly from the development sources rather than a pre-packaged release. This is particularly true if you choose the current sources. It is recommended that you read Staying current with FreeBSD. What Do I Need to Use <application>CTM</application>? You will need two things: The CTM program, and the initial deltas to feed it (to get up to current levels). The CTM program has been part of FreeBSD ever since version 2.0 was released, and lives in /usr/src/usr.sbin/ctm if you have a copy of the source available. The deltas you feed CTM can be had two ways, FTP or email. If you have general FTP access to the Internet then the following FTP sites support access to CTM: or see section mirrors. FTP the relevant directory and fetch the README file, starting from there. If you wish to get your deltas via email: Subscribe to one of the CTM distribution lists. &a.ctm-cvs-cur.name; supports the entire CVS tree. &a.ctm-src-cur.name; supports the head of the development branch. &a.ctm-src-4.name; supports the 4.X release branch, etc.. (If you do not know how to subscribe yourself to a list, click on the list name above or go to &a.mailman.lists.link; and click on the list that you wish to subscribe to. The list page should contain all of the necessary subscription instructions.) When you begin receiving your CTM updates in the mail, you may use the ctm_rmail program to unpack and apply them. You can actually use the ctm_rmail program directly from a entry in /etc/aliases if you want to have the process run in a fully automated fashion. Check the ctm_rmail manual page for more details. No matter what method you use to get the CTM deltas, you should subscribe to the &a.ctm-announce.name; mailing list. In the future, this will be the only place where announcements concerning the operations of the CTM system will be posted. Click on the list name above and follow the instructions to subscribe to the list. Using <application>CTM</application> for the First Time Before you can start using CTM deltas, you will need to get to a starting point for the deltas produced subsequently to it. First you should determine what you already have. Everyone can start from an empty directory. You must use an initial Empty delta to start off your CTM supported tree. At some point it is intended that one of these started deltas be distributed on the CD for your convenience, however, this does not currently happen. Since the trees are many tens of megabytes, you should prefer to start from something already at hand. If you have a -RELEASE CD, you can copy or extract an initial source from it. This will save a significant transfer of data. You can recognize these starter deltas by the X appended to the number (src-cur.3210XEmpty.gz for instance). The designation following the X corresponds to the origin of your initial seed. Empty is an empty directory. As a rule a base transition from Empty is produced every 100 deltas. By the way, they are large! 70 to 80 Megabytes of gzip'd data is common for the XEmpty deltas. Once you have picked a base delta to start from, you will also need all deltas with higher numbers following it. Using <application>CTM</application> in Your Daily Life To apply the deltas, simply say: &prompt.root; cd /where/ever/you/want/the/stuff &prompt.root; ctm -v -v /where/you/store/your/deltas/src-xxx.* CTM understands deltas which have been put through gzip, so you do not need to gunzip them first, this saves disk space. Unless it feels very secure about the entire process, CTM will not touch your tree. To verify a delta you can also use the flag and CTM will not actually touch your tree; it will merely verify the integrity of the delta and see if it would apply cleanly to your current tree. There are other options to CTM as well, see the manual pages or look in the sources for more information. That is really all there is to it. Every time you get a new delta, just run it through CTM to keep your sources up to date. Do not remove the deltas if they are hard to download again. You just might want to keep them around in case something bad happens. Even if you only have floppy disks, consider using fdwrite to make a copy. Keeping Your Local Changes As a developer one would like to experiment with and change files in the source tree. CTM supports local modifications in a limited way: before checking for the presence of a file foo, it first looks for foo.ctm. If this file exists, CTM will operate on it instead of foo. This behavior gives us a simple way to maintain local changes: simply copy the files you plan to modify to the corresponding file names with a .ctm suffix. Then you can freely hack the code, while CTM keeps the .ctm file up-to-date. Other Interesting <application>CTM</application> Options Finding Out Exactly What Would Be Touched by an Update You can determine the list of changes that CTM will make on your source repository using the option to CTM. This is useful if you would like to keep logs of the changes, pre- or post- process the modified files in any manner, or just are feeling a tad paranoid. Making Backups Before Updating Sometimes you may want to backup all the files that would be changed by a CTM update. Specifying the option causes CTM to backup all files that would be touched by a given CTM delta to backup-file. Restricting the Files Touched by an Update Sometimes you would be interested in restricting the scope of a given CTM update, or may be interested in extracting just a few files from a sequence of deltas. You can control the list of files that CTM would operate on by specifying filtering regular expressions using the and options. For example, to extract an up-to-date copy of lib/libc/Makefile from your collection of saved CTM deltas, run the commands: &prompt.root; cd /where/ever/you/want/to/extract/it/ &prompt.root; ctm -e '^lib/libc/Makefile' ~ctm/src-xxx.* For every file specified in a CTM delta, the and options are applied in the order given on the command line. The file is processed by CTM only if it is marked as eligible after all the and options are applied to it. Future Plans for <application>CTM</application> Tons of them: Use some kind of authentication into the CTM system, so as to allow detection of spoofed CTM updates. Clean up the options to CTM, they became confusing and counter intuitive. Miscellaneous Stuff There is a sequence of deltas for the ports collection too, but interest has not been all that high yet. CTM Mirrors CTM/FreeBSD is available via anonymous FTP from the following mirror sites. If you choose to obtain CTM via anonymous FTP, please try to use a site near you. In case of problems, please contact the &a.ctm-users.name; mailing list. California, Bay Area, official source South Africa, backup server for old deltas Taiwan/R.O.C. If you did not find a mirror near to you or the mirror is incomplete, try to use a search engine such as alltheweb. Using CVSup Introduction CVSup is a software package for distributing and updating source trees from a master CVS repository on a remote server host. The FreeBSD sources are maintained in a CVS repository on a central development machine in California. With CVSup, FreeBSD users can easily keep their own source trees up to date. CVSup uses the so-called pull model of updating. Under the pull model, each client asks the server for updates, if and when they are wanted. The server waits passively for update requests from its clients. Thus all updates are instigated by the client. The server never sends unsolicited updates. Users must either run the CVSup client manually to get an update, or they must set up a cron job to run it automatically on a regular basis. The term CVSup, capitalized just so, refers to the entire software package. Its main components are the client cvsup which runs on each user's machine, and the server cvsupd which runs at each of the FreeBSD mirror sites. As you read the FreeBSD documentation and mailing lists, you may see references to sup. Sup was the predecessor of CVSup, and it served a similar purpose. CVSup is used much in the same way as sup and, in fact, uses configuration files which are backward-compatible with sup's. Sup is no longer used in the FreeBSD project, because CVSup is both faster and more flexible. Installation The easiest way to install CVSup is to use the precompiled net/cvsup package from the FreeBSD packages collection. If you prefer to build CVSup from source, you can use the net/cvsup port instead. But be forewarned: the net/cvsup port depends on the Modula-3 system, which takes a substantial amount of time and disk space to download and build. If you are going to be using CVSup on a machine which will not have &xfree86; or &xorg; installed, such as a server, be sure to use the port which does not include the CVSup GUI, net/cvsup-without-gui. CVSup Configuration CVSup's operation is controlled by a configuration file called the supfile. There are some sample supfiles in the directory /usr/share/examples/cvsup/. The information in a supfile answers the following questions for CVSup: Which files do you want to receive? Which versions of them do you want? Where do you want to get them from? Where do you want to put them on your own machine? Where do you want to put your status files? In the following sections, we will construct a typical supfile by answering each of these questions in turn. First, we describe the overall structure of a supfile. A supfile is a text file. Comments begin with # and extend to the end of the line. Lines that are blank and lines that contain only comments are ignored. Each remaining line describes a set of files that the user wishes to receive. The line begins with the name of a collection, a logical grouping of files defined by the server. The name of the collection tells the server which files you want. After the collection name come zero or more fields, separated by white space. These fields answer the questions listed above. There are two types of fields: flag fields and value fields. A flag field consists of a keyword standing alone, e.g., delete or compress. A value field also begins with a keyword, but the keyword is followed without intervening white space by = and a second word. For example, release=cvs is a value field. A supfile typically specifies more than one collection to receive. One way to structure a supfile is to specify all of the relevant fields explicitly for each collection. However, that tends to make the supfile lines quite long, and it is inconvenient because most fields are the same for all of the collections in a supfile. CVSup provides a defaulting mechanism to avoid these problems. Lines beginning with the special pseudo-collection name *default can be used to set flags and values which will be used as defaults for the subsequent collections in the supfile. A default value can be overridden for an individual collection, by specifying a different value with the collection itself. Defaults can also be changed or augmented in mid-supfile by additional *default lines. With this background, we will now proceed to construct a supfile for receiving and updating the main source tree of FreeBSD-CURRENT. Which files do you want to receive? The files available via CVSup are organized into named groups called collections. The collections that are available are described in the following section. In this example, we wish to receive the entire main source tree for the FreeBSD system. There is a single large collection src-all which will give us all of that. As a first step toward constructing our supfile, we simply list the collections, one per line (in this case, only one line): src-all Which version(s) of them do you want? With CVSup, you can receive virtually any version of the sources that ever existed. That is possible because the cvsupd server works directly from the CVS repository, which contains all of the versions. You specify which one of them you want using the tag= and value fields. Be very careful to specify any tag= fields correctly. Some tags are valid only for certain collections of files. If you specify an incorrect or misspelled tag, CVSup will delete files which you probably do not want deleted. In particular, use only tag=. for the ports-* collections. The tag= field names a symbolic tag in the repository. There are two kinds of tags, revision tags and branch tags. A revision tag refers to a specific revision. Its meaning stays the same from day to day. A branch tag, on the other hand, refers to the latest revision on a given line of development, at any given time. Because a branch tag does not refer to a specific revision, it may mean something different tomorrow than it means today. contains branch tags that users might be interested in. When specifying a tag in CVSup's configuration file, it must be preceded with tag= (RELENG_4 will become tag=RELENG_4). Keep in mind that only the tag=. is relevant for the Ports Collection. Be very careful to type the tag name exactly as shown. CVSup cannot distinguish between valid and invalid tags. If you misspell the tag, CVSup will behave as though you had specified a valid tag which happens to refer to no files at all. It will delete your existing sources in that case. When you specify a branch tag, you normally receive the latest versions of the files on that line of development. If you wish to receive some past version, you can do so by specifying a date with the value field. The &man.cvsup.1; manual page explains how to do that. For our example, we wish to receive FreeBSD-CURRENT. We add this line at the beginning of our supfile: *default tag=. There is an important special case that comes into play if you specify neither a tag= field nor a date= field. In that case, you receive the actual RCS files directly from the server's CVS repository, rather than receiving a particular version. Developers generally prefer this mode of operation. By maintaining a copy of the repository itself on their systems, they gain the ability to browse the revision histories and examine past versions of files. This gain is achieved at a large cost in terms of disk space, however. Where do you want to get them from? We use the host= field to tell cvsup where to obtain its updates. Any of the CVSup mirror sites will do, though you should try to select one that is close to you in cyberspace. In this example we will use a fictional FreeBSD distribution site, cvsup99.FreeBSD.org: *default host=cvsup99.FreeBSD.org You will need to change the host to one that actually exists before running CVSup. On any particular run of cvsup, you can override the host setting on the command line, with . Where do you want to put them on your own machine? The prefix= field tells cvsup where to put the files it receives. In this example, we will put the source files directly into our main source tree, /usr/src. The src directory is already implicit in the collections we have chosen to receive, so this is the correct specification: *default prefix=/usr Where should cvsup maintain its status files? The CVSup client maintains certain status files in what is called the base directory. These files help CVSup to work more efficiently, by keeping track of which updates you have already received. We will use the standard base directory, /var/db: *default base=/var/db If your base directory does not already exist, now would be a good time to create it. The cvsup client will refuse to run if the base directory does not exist. Miscellaneous supfile settings: There is one more line of boiler plate that normally needs to be present in the supfile: *default release=cvs delete use-rel-suffix compress release=cvs indicates that the server should get its information out of the main FreeBSD CVS repository. This is virtually always the case, but there are other possibilities which are beyond the scope of this discussion. delete gives CVSup permission to delete files. You should always specify this, so that CVSup can keep your source tree fully up-to-date. CVSup is careful to delete only those files for which it is responsible. Any extra files you happen to have will be left strictly alone. use-rel-suffix is ... arcane. If you really want to know about it, see the &man.cvsup.1; manual page. Otherwise, just specify it and do not worry about it. compress enables the use of gzip-style compression on the communication channel. If your network link is T1 speed or faster, you probably should not use compression. Otherwise, it helps substantially. Putting it all together: Here is the entire supfile for our example: *default tag=. *default host=cvsup99.FreeBSD.org *default prefix=/usr *default base=/var/db *default release=cvs delete use-rel-suffix compress src-all The <filename>refuse</filename> File As mentioned above, CVSup uses a pull method. Basically, this means that you connect to the CVSup server, and it says, Here is what you can download from me..., and your client responds OK, I will take this, this, this, and this. In the default configuration, the CVSup client will take every file associated with the collection and tag you chose in the configuration file. However, this is not always what you want, especially if you are synching the doc, ports, or www trees — most people cannot read four or five languages, and therefore they do not need to download the language-specific files. If you are CVSuping the Ports Collection, you can get around this by specifying each collection individually (e.g., ports-astrology, ports-biology, etc instead of simply saying ports-all). However, since the doc and www trees do not have language-specific collections, you must use one of CVSup's many nifty features: the refuse file. The refuse file essentially tells CVSup that it should not take every single file from a collection; in other words, it tells the client to refuse certain files from the server. The refuse file can be found (or, if you do not yet have one, should be placed) in base/sup/. base is defined in your supfile; our defined base is /var/db, which means that by default the refuse file is /var/db/sup/refuse. The refuse file has a very simple format; it simply contains the names of files or directories that you do not wish to download. For example, if you cannot speak any languages other than English and some German, and you do not feel the need to read the German translation of documentation, you can put the following in your refuse file: doc/bn_* doc/da_* doc/de_* doc/el_* doc/es_* doc/fr_* doc/it_* doc/ja_* doc/nl_* doc/no_* doc/pl_* doc/pt_* doc/ru_* doc/sr_* doc/tr_* doc/zh_* and so forth for the other languages (you can find the full list by browsing the FreeBSD CVS repository). With this very useful feature, those users who are on slow links or pay by the minute for their Internet connection will be able to save valuable time as they will no longer need to download files that they will never use. For more information on refuse files and other neat features of CVSup, please view its manual page. Running <application>CVSup</application> You are now ready to try an update. The command line for doing this is quite simple: &prompt.root; cvsup supfile where supfile is of course the name of the supfile you have just created. Assuming you are running under X11, cvsup will display a GUI window with some buttons to do the usual things. Press the go button, and watch it run. Since you are updating your actual /usr/src tree in this example, you will need to run the program as root so that cvsup has the permissions it needs to update your files. Having just created your configuration file, and having never used this program before, that might understandably make you nervous. There is an easy way to do a trial run without touching your precious files. Just create an empty directory somewhere convenient, and name it as an extra argument on the command line: &prompt.root; mkdir /var/tmp/dest &prompt.root; cvsup supfile /var/tmp/dest The directory you specify will be used as the destination directory for all file updates. CVSup will examine your usual files in /usr/src, but it will not modify or delete any of them. Any file updates will instead land in /var/tmp/dest/usr/src. CVSup will also leave its base directory status files untouched when run this way. The new versions of those files will be written into the specified directory. As long as you have read access to /usr/src, you do not even need to be root to perform this kind of trial run. If you are not running X11 or if you just do not like GUIs, you should add a couple of options to the command line when you run cvsup: &prompt.root; cvsup -g -L 2 supfile The tells CVSup not to use its GUI. This is automatic if you are not running X11, but otherwise you have to specify it. The tells CVSup to print out the details of all the file updates it is doing. There are three levels of verbosity, from to . The default is 0, which means total silence except for error messages. There are plenty of other options available. For a brief list of them, type cvsup -H. For more detailed descriptions, see the manual page. Once you are satisfied with the way updates are working, you can arrange for regular runs of CVSup using &man.cron.8;. Obviously, you should not let CVSup use its GUI when running it from &man.cron.8;. <application>CVSup</application> File Collections The file collections available via CVSup are organized hierarchically. There are a few large collections, and they are divided into smaller sub-collections. Receiving a large collection is equivalent to receiving each of its sub-collections. The hierarchical relationships among collections are reflected by the use of indentation in the list below. The most commonly used collections are src-all, and ports-all. The other collections are used only by small groups of people for specialized purposes, and some mirror sites may not carry all of them. cvs-all release=cvs The main FreeBSD CVS repository, including the cryptography code. distrib release=cvs Files related to the distribution and mirroring of FreeBSD. doc-all release=cvs Sources for the FreeBSD Handbook and other documentation. This does not include files for the FreeBSD web site. ports-all release=cvs The FreeBSD Ports Collection. If you do not want to update the whole of ports-all (the whole ports tree), but use one of the subcollections listed below, make sure that you always update the ports-base subcollection! Whenever something changes in the ports build infrastructure represented by ports-base, it is virtually certain that those changes will be used by real ports real soon. Thus, if you only update the real ports and they use some of the new features, there is a very high chance that their build will fail with some mysterious error message. The very first thing to do in this case is to make sure that your ports-base subcollection is up to date. If you are going to be building your own local copy of ports/INDEX, you must accept ports-all (the whole ports tree). Building ports/INDEX with a partial tree is not supported. See the FAQ. ports-accessibility release=cvs Software to help disabled users. ports-arabic release=cvs Arabic language support. ports-archivers release=cvs Archiving tools. ports-astro release=cvs Astronomical ports. ports-audio release=cvs Sound support. ports-base release=cvs The Ports Collection build infrastructure - various files located in the Mk/ and Tools/ subdirectories of /usr/ports. Please see the important warning above: you should always update this subcollection, whenever you update any part of the FreeBSD Ports Collection! ports-benchmarks release=cvs Benchmarks. ports-biology release=cvs Biology. ports-cad release=cvs Computer aided design tools. ports-chinese release=cvs Chinese language support. ports-comms release=cvs Communication software. ports-converters release=cvs character code converters. ports-databases release=cvs Databases. ports-deskutils release=cvs Things that used to be on the desktop before computers were invented. ports-devel release=cvs Development utilities. ports-dns release=cvs DNS related software. ports-editors release=cvs Editors. ports-emulators release=cvs Emulators for other operating systems. ports-finance release=cvs Monetary, financial and related applications. ports-ftp release=cvs FTP client and server utilities. ports-games release=cvs Games. ports-german release=cvs German language support. ports-graphics release=cvs Graphics utilities. ports-hebrew release=cvs Hebrew language support. ports-hungarian release=cvs Hungarian language support. ports-irc release=cvs Internet Relay Chat utilities. ports-japanese release=cvs Japanese language support. ports-java release=cvs &java; utilities. ports-korean release=cvs Korean language support. ports-lang release=cvs Programming languages. ports-mail release=cvs Mail software. ports-math release=cvs Numerical computation software. ports-mbone release=cvs MBone applications. ports-misc release=cvs Miscellaneous utilities. ports-multimedia release=cvs Multimedia software. ports-net release=cvs Networking software. ports-net-im release=cvs Instant messaging software. ports-net-mgmt release=cvs Network management software. ports-net-p2p release=cvs Peer to peer networking. ports-news release=cvs USENET news software. ports-palm release=cvs Software support for Palm series. ports-polish release=cvs Polish language support. ports-portuguese release=cvs Portuguese language support. ports-print release=cvs Printing software. ports-russian release=cvs Russian language support. ports-science release=cvs Science. ports-security release=cvs Security utilities. ports-shells release=cvs Command line shells. ports-sysutils release=cvs System utilities. ports-textproc release=cvs text processing utilities (does not include desktop publishing). ports-ukrainian release=cvs Ukrainian language support. ports-vietnamese release=cvs Vietnamese language support. ports-www release=cvs Software related to the World Wide Web. ports-x11 release=cvs Ports to support the X window system. ports-x11-clocks release=cvs X11 clocks. ports-x11-fm release=cvs X11 file managers. ports-x11-fonts release=cvs X11 fonts and font utilities. ports-x11-toolkits release=cvs X11 toolkits. ports-x11-servers release=cvs X11 servers. ports-x11-themes release=cvs X11 themes. ports-x11-wm release=cvs X11 window managers. src-all release=cvs The main FreeBSD sources, including the cryptography code. src-base release=cvs Miscellaneous files at the top of /usr/src. src-bin release=cvs User utilities that may be needed in single-user mode (/usr/src/bin). src-contrib release=cvs Utilities and libraries from outside the FreeBSD project, used relatively unmodified (/usr/src/contrib). src-crypto release=cvs Cryptography utilities and libraries from outside the FreeBSD project, used relatively unmodified (/usr/src/crypto). src-eBones release=cvs Kerberos and DES (/usr/src/eBones). Not used in current releases of FreeBSD. src-etc release=cvs System configuration files (/usr/src/etc). src-games release=cvs Games (/usr/src/games). src-gnu release=cvs Utilities covered by the GNU Public License (/usr/src/gnu). src-include release=cvs Header files (/usr/src/include). src-kerberos5 release=cvs Kerberos5 security package (/usr/src/kerberos5). src-kerberosIV release=cvs KerberosIV security package (/usr/src/kerberosIV). src-lib release=cvs Libraries (/usr/src/lib). src-libexec release=cvs System programs normally executed by other programs (/usr/src/libexec). src-release release=cvs Files required to produce a FreeBSD release (/usr/src/release). src-sbin release=cvs System utilities for single-user mode (/usr/src/sbin). src-secure release=cvs Cryptographic libraries and commands (/usr/src/secure). src-share release=cvs Files that can be shared across multiple systems (/usr/src/share). src-sys release=cvs The kernel (/usr/src/sys). src-sys-crypto release=cvs Kernel cryptography code (/usr/src/sys/crypto). src-tools release=cvs Various tools for the maintenance of FreeBSD (/usr/src/tools). src-usrbin release=cvs User utilities (/usr/src/usr.bin). src-usrsbin release=cvs System utilities (/usr/src/usr.sbin). www release=cvs The sources for the FreeBSD WWW site. distrib release=self The CVSup server's own configuration files. Used by CVSup mirror sites. gnats release=current The GNATS bug-tracking database. mail-archive release=current FreeBSD mailing list archive. www release=current The pre-processed FreeBSD WWW site files (not the source files). Used by WWW mirror sites. For More Information For the CVSup FAQ and other information about CVSup, see The CVSup Home Page. Most FreeBSD-related discussion of CVSup takes place on the &a.hackers;. New versions of the software are announced there, as well as on the &a.announce;. Questions and bug reports should be addressed to the author of the program at cvsup-bugs@polstra.com. CVSup Sites CVSup servers for FreeBSD are running at the following sites: &chap.mirrors.cvsup.inc; Using Portsnap Introduction Portsnap is a system for securely distributing the &os; ports tree. Approximately once an hour, a snapshot of the ports tree is generated, repackaged, and cryptographically signed. The resulting files are then distributed via HTTP. Like CVSup, Portsnap uses a pull model of updating: The packaged and signed ports trees are placed on a web server which waits passively for clients to request files. Users must either run &man.portsnap.8; manually to download updates or set up a &man.cron.8; job to download updates automatically on a regular basis. For technical reasons, Portsnap does not update the live ports tree in /usr/ports/ directly; instead, it works via a compressed copy of the ports tree stored in /var/db/portsnap/ by default. This compressed copy is then used to update the live ports tree. If Portsnap is installed from the &os; Ports Collection, then the default location for its compressed snapshot will be /usr/local/portsnap/ instead of /var/db/portsnap/. Installation On &os; 6.0 and more recent versions, Portsnap is contained in the &os; base system. On older versions of &os;, it can be installed using the sysutils/portsnap port. Portsnap Configuration Portsnap's operation is controlled by the /etc/portsnap.conf configuration file. For most users, the default configuration file will suffice; for more details, consult the &man.portsnap.conf.5; manual page. If Portsnap is installed from the &os; Ports Collection, it will use the configuration file /usr/local/etc/portsnap.conf instead of /etc/portsnap.conf. This configuration file is not created when the port is installed, but a sample configuration file is distributed; to copy it into place, run the following command: &prompt.root; cd /usr/local/etc && cp portsnap.conf.sample portsnap.conf Running <application>Portsnap</application> for the First Time The first time &man.portsnap.8; is run, it will need to download a compressed snapshot of the entire ports tree into /var/db/portsnap/ (or /usr/local/portsnap/ if Portsnap was installed from the - Ports Collection). This is approximately a 38 MB + Ports Collection). For the beginning of 2006 this is approximately a 41 MB download. &prompt.root; portsnap fetch Once the compressed snapshot has been downloaded, a live copy of the ports tree can be extracted into /usr/ports/. This is necessary even if a ports tree has already been created in that directory (e.g., by using CVSup), since it establishes a baseline from which portsnap can determine which parts of the ports tree need to be updated later. &prompt.root; portsnap extract In the default installation /usr/ports is not - created. It should be created before - portsnap is used. + created. If you run &os; 6.0-RELEASE, it should be created before + portsnap is used. On more recent + versions of &os; or Portsnap, + this operation will be done automatically at first use + of the portsnap command. Updating the Ports Tree After an initial compressed snapshot of the ports tree has been downloaded and extracted into /usr/ports/, updating the ports tree consists of two steps: fetching updates to the compressed snapshot, and using them to update the live ports tree. These two steps can be specified to portsnap as a single command: &prompt.root; portsnap fetch update Some older versions of portsnap do not support this syntax; if it fails, try instead the following: &prompt.root; portsnap fetch &prompt.root; portsnap update Running Portsnap from cron In order to avoid problems with flash crowds accessing the Portsnap servers, portsnap fetch will not run from a &man.cron.8; job. Instead, a special portsnap cron command exists, which waits for a random duration up to 3600 seconds before fetching updates. In addition, it is strongly recommended that portsnap update not be run from a cron job, since it is liable to cause major problems if it happens to run at the same time as a port is being built or installed. However, it is safe to update - the ports INDEX files, and this can be done by passing the + the ports' INDEX files, and this can be done by passing the flag to portsnap. (Obviously, if portsnap -I update is run from cron, then it will be necessary to run portsnap update without the flag at a later time in order to update the rest of the tree.) Adding the following line to /etc/crontab will cause portsnap to update its - compressed snapshot and the INDEX files in + compressed snapshot and the INDEX files in /usr/ports/, and will send an email if any installed ports are out of date: 0 3 * * * root portsnap -I cron update && pkg_version -vIL= If the system clock is not set to the local time zone, please replace 3 with a random value between 0 and 23, in order to spread the load on the Portsnap servers more evenly. Some older versions of portsnap do not support listing multiple commands (e.g., cron update) in the same invocation of portsnap. If the line above fails, try replacing portsnap -I cron update with portsnap cron && portsnap -I update. CVS Tags When obtaining or updating sources using cvs or CVSup, a revision tag must be specified. A revision tag refers to either a particular line of &os; development, or a specific point in time. The first type are called branch tags, and the second type are called release tags. Branch Tags All of these, with the exception of HEAD (which is always a valid tag), only apply to the src/ tree. The ports/, doc/, and www/ trees are not branched. HEAD Symbolic name for the main line, or FreeBSD-CURRENT. Also the default when no revision is specified. In CVSup, this tag is represented by a . (not punctuation, but a literal . character). In CVS, this is the default when no revision tag is specified. It is usually not a good idea to checkout or update to CURRENT sources on a STABLE machine, unless that is your intent. RELENG_6 The line of development for FreeBSD-6.X, also known as FreeBSD 6-STABLE + + + + + RELENG_6_1 + + + The release branch for FreeBSD-6.1, used only for + security advisories and other critical fixes. RELENG_6_0 The release branch for FreeBSD-6.0, used only for security advisories and other critical fixes. RELENG_5 The line of development for FreeBSD-5.X, also known as FreeBSD 5-STABLE. RELENG_5_4 The release branch for FreeBSD-5.4, used only for security advisories and other critical fixes. RELENG_5_3 The release branch for FreeBSD-5.3, used only for security advisories and other critical fixes. RELENG_5_2 The release branch for FreeBSD-5.2 and FreeBSD-5.2.1, used only for security advisories and other critical fixes. RELENG_5_1 The release branch for FreeBSD-5.1, used only for security advisories and other critical fixes. RELENG_5_0 The release branch for FreeBSD-5.0, used only for security advisories and other critical fixes. RELENG_4 The line of development for FreeBSD-4.X, also known as FreeBSD 4-STABLE. RELENG_4_11 The release branch for FreeBSD-4.11, used only for security advisories and other critical fixes. RELENG_4_10 The release branch for FreeBSD-4.10, used only for security advisories and other critical fixes. RELENG_4_9 The release branch for FreeBSD-4.9, used only for security advisories and other critical fixes. RELENG_4_8 The release branch for FreeBSD-4.8, used only for security advisories and other critical fixes. RELENG_4_7 The release branch for FreeBSD-4.7, used only for security advisories and other critical fixes. RELENG_4_6 The release branch for FreeBSD-4.6 and FreeBSD-4.6.2, used only for security advisories and other critical fixes. RELENG_4_5 The release branch for FreeBSD-4.5, used only for security advisories and other critical fixes. RELENG_4_4 The release branch for FreeBSD-4.4, used only for security advisories and other critical fixes. RELENG_4_3 The release branch for FreeBSD-4.3, used only for security advisories and other critical fixes. RELENG_3 The line of development for FreeBSD-3.X, also known as 3.X-STABLE. RELENG_2_2 The line of development for FreeBSD-2.2.X, also known as 2.2-STABLE. This branch is mostly obsolete. Release Tags These tags refer to a specific point in time when a particular version of &os; was released. The release engineering process is documented in more detail by the Release Engineering Information and Release Process documents. The src tree uses tag names that start with RELENG_ tags. The ports and doc trees use tags whose names begin with RELEASE tags. Finally, the www tree is not tagged with any special name for releases. RELENG_6_0_0_RELEASE FreeBSD 6.0 RELENG_5_4_0_RELEASE FreeBSD 5.4 RELENG_4_11_0_RELEASE FreeBSD 4.11 RELENG_5_3_0_RELEASE FreeBSD 5.3 RELENG_4_10_0_RELEASE FreeBSD 4.10 RELENG_5_2_1_RELEASE FreeBSD 5.2.1 RELENG_5_2_0_RELEASE FreeBSD 5.2 RELENG_4_9_0_RELEASE FreeBSD 4.9 RELENG_5_1_0_RELEASE FreeBSD 5.1 RELENG_4_8_0_RELEASE FreeBSD 4.8 RELENG_5_0_0_RELEASE FreeBSD 5.0 RELENG_4_7_0_RELEASE FreeBSD 4.7 RELENG_4_6_2_RELEASE FreeBSD 4.6.2 RELENG_4_6_1_RELEASE FreeBSD 4.6.1 RELENG_4_6_0_RELEASE FreeBSD 4.6 RELENG_4_5_0_RELEASE FreeBSD 4.5 RELENG_4_4_0_RELEASE FreeBSD 4.4 RELENG_4_3_0_RELEASE FreeBSD 4.3 RELENG_4_2_0_RELEASE FreeBSD 4.2 RELENG_4_1_1_RELEASE FreeBSD 4.1.1 RELENG_4_1_0_RELEASE FreeBSD 4.1 RELENG_4_0_0_RELEASE FreeBSD 4.0 RELENG_3_5_0_RELEASE FreeBSD-3.5 RELENG_3_4_0_RELEASE FreeBSD-3.4 RELENG_3_3_0_RELEASE FreeBSD-3.3 RELENG_3_2_0_RELEASE FreeBSD-3.2 RELENG_3_1_0_RELEASE FreeBSD-3.1 RELENG_3_0_0_RELEASE FreeBSD-3.0 RELENG_2_2_8_RELEASE FreeBSD-2.2.8 RELENG_2_2_7_RELEASE FreeBSD-2.2.7 RELENG_2_2_6_RELEASE FreeBSD-2.2.6 RELENG_2_2_5_RELEASE FreeBSD-2.2.5 RELENG_2_2_2_RELEASE FreeBSD-2.2.2 RELENG_2_2_1_RELEASE FreeBSD-2.2.1 RELENG_2_2_0_RELEASE FreeBSD-2.2.0 AFS Sites AFS servers for FreeBSD are running at the following sites: Sweden The path to the files are: /afs/stacken.kth.se/ftp/pub/FreeBSD/ stacken.kth.se # Stacken Computer Club, KTH, Sweden 130.237.234.43 #hot.stacken.kth.se 130.237.237.230 #fishburger.stacken.kth.se 130.237.234.3 #milko.stacken.kth.se Maintainer ftp@stacken.kth.se rsync Sites The following sites make FreeBSD available through the rsync protocol. The rsync utility works in much the same way as the &man.rcp.1; command, but has more options and uses the rsync remote-update protocol which transfers only the differences between two sets of files, thus greatly speeding up the synchronization over the network. This is most useful if you are a mirror site for the FreeBSD FTP server, or the CVS repository. The rsync suite is available for many operating systems, on FreeBSD, see the net/rsync port or use the package. Czech Republic rsync://ftp.cz.FreeBSD.org/ Available collections: ftp: A partial mirror of the FreeBSD FTP server. FreeBSD: A full mirror of the FreeBSD FTP server. Germany rsync://grappa.unix-ag.uni-kl.de/ Available collections: freebsd-cvs: The full FreeBSD CVS repository. This machine also mirrors the CVS repositories of the NetBSD and the OpenBSD projects, among others. Netherlands rsync://ftp.nl.FreeBSD.org/ Available collections: vol/4/freebsd-core: A full mirror of the FreeBSD FTP server. United Kingdom rsync://rsync.mirror.ac.uk/ Available collections: ftp.FreeBSD.org: A full mirror of the FreeBSD FTP server. United States of America rsync://ftp-master.FreeBSD.org/ This server may only be used by FreeBSD primary mirror sites. Available collections: FreeBSD: The master archive of the FreeBSD FTP server. acl: The FreeBSD master ACL list. rsync://ftp13.FreeBSD.org/ Available collections: FreeBSD: A full mirror of the FreeBSD FTP server.
diff --git a/zh_TW.Big5/books/handbook/multimedia/chapter.sgml b/zh_TW.Big5/books/handbook/multimedia/chapter.sgml index 689de84000..cdd803f47f 100644 --- a/zh_TW.Big5/books/handbook/multimedia/chapter.sgml +++ b/zh_TW.Big5/books/handbook/multimedia/chapter.sgml @@ -1,1842 +1,1833 @@ Ross Lippert Edited by ¦h´CÅé¼v­µ®T¼Ö(Multimedia) ·§­z FreeBSD ¼sªx¦a¤ä´©¦UºØ­µ®Ä¥d¡A Åý±z¥i¥H¨É¨ü¨Ó¦Û¹q¸£¤Wªº°ª¶Ç¯u­µ½è(Hi-Fi)¡A ¦¹¥~ÁÙ¥]¬A¤F¿ý»s©M¼½©ñ MPEG Audio Layer 3 (MP3)¡B WAV¡B ¥H¤Î Ogg Vorbis µ¥³\¦hºØ®æ¦¡Án­µªº¯à¤O¡C¦P®É FreeBSD Ports Collection ¤]¥]¬A¤F³\¦hªºÀ³¥Îµ{¦¡¡A Åý±z¥i¥H¿ý­µ¡B½s­×­µ®Ä¥H¤Î±±¨î MIDI °t³Æ¡C ­n¬O³ßÅw°Ê¤â¹Á¸Õ¤£¦PªºÅéÅç¡A FreeBSD ¤]¯à¼½©ñ¤@¯ëªºµø°TÀÉ©M DVD¡C ½s½X¡BÂà´«©M¼½©ñµø°Tªºµ{¦¡¤ñ°_³B²zÁn­µªºµ{¦¡²¤¤Ö¤@¨Ç¡C¨Ò¦p¡A ¦b¼¶¼g³o³¹®É¡A FreeBSD Ports Collection ¤¤ÁÙ¨S¦³Ãþ¦ü audio/sox ¨º¼Ë¦n¥Îªº½s½X¤u¨ã¡A¯à°÷¥Î¨ÓÂà´«¤£¦Pªº®æ¦¡¡C ¤£¹L¡A³o­Ó»â°ìªº³nÅé¬ãµo¶i®i¬O¬Û·í¨³³tªº¡C ¥»³¹±N¤¶²Ð³]©w­µ®Ä¥dªº¥²­n¨BÆJ¡C¥ý«e¤¶²Ð¨ìªº X11 () ¦w¸Ë©M³]©w¸Ì¡A¤w¸gÁ¿¨ì¤FÅã¥Ü¥dªº³¡¥÷¡A ¦ý­n·Q¦³§ó¦nªº¼½©ñ®ÄªG¡A ¤´»Ý­n¤@¨Ç²Ó³¡½Õ¾ã¡C Ū§¹³o³¹¡A±z±N¤F¸Ñ¡G ¦p¦ó³]©w¨t²Î¡A¥H¥¿½TÃѧO­µ®Ä¥d¡C Methods to test that your card is working using sample applications. ¦p¦ó¸Ñ¨M­µ®Ä¥dªº³]©w°ÝÃD¡C How to playback and encode MP3s and other audio. How video is supported by the X server. Some video player/encoder ports which give good results. ¦p¦ó¼½©ñ DVD ªº .mpg ¤Î .avi ÀÉ ¦p¦ó±q CD ©M DVD ¤¤Â^¨ú(rip)ÀɮסC ¦p¦ó³]©w¹qµø¥d ¦p¦ó³]©w±½´y¾¹ ¦b¾\Ū³o³¹¤§«e¡A±zÀ³·í¤F¸Ñ¡G ª¾¹D¦p¦ó³]©w¡B¦w¸Ë·sªº kernel ()¡C Trying to mount audio CDs with the &man.mount.8; command will result in an error, at least, and a kernel panic, at worst. These media have specialized encodings which differ from the usual ISO-filesystem. Moses Moore Contributed by Marc Fonvieille Enhanced for &os; 5.X by ³]©w­µ®Ä¥d Configuring the System PCI ISA sound cards Before you begin, you should know the model of the card you have, the chip it uses, and whether it is a PCI or ISA card. FreeBSD supports a wide variety of both PCI and ISA cards. Check the supported audio devices list of the Hardware Notes to see if your card is supported. This document will also mention which driver supports your card. kernel configuration To use your sound device, you will need to load the proper device driver. This may be accomplished in one of two ways. The easiest way is to simply load a kernel module for your sound card with &man.kldload.8; which can either be done from the command line: &prompt.root; kldload snd_emu10k1 or by adding the appropriate line to the file /boot/loader.conf like this: snd_emu10k1_load="YES" These examples are for a Creative &soundblaster; Live! sound card. Other available loadable sound modules are listed in /boot/defaults/loader.conf. If you are not sure which driver to use, you may try to load the snd_driver module: &prompt.root; kldload snd_driver This is a metadriver loading the most common device drivers at once. This speeds up the search for the correct driver. It is also possible to load all sound drivers via the /boot/loader.conf facility. If you wish to find out the driver selected for your soundcard after loading the snd_driver metadriver, you may check the /dev/sndstat file with the cat /dev/sndstat command. Under &os; 4.X, to load all sound drivers, you have to load the snd module instead of snd_driver. A second method is to statically compile in support for your sound card in your kernel. The section below provides the information you need to add support for your hardware in this manner. For more information about recompiling your kernel, please see . Configuring a Custom Kernel with Sound Support The first thing to do is adding the generic audio driver &man.sound.4; to the kernel, for that you will need to add the following line to the kernel configuration file: device sound Under &os; 4.X, you would use the following line: device pcm Then we have to add the support for our sound card. Therefore, we need to know which driver supports the card. Check the supported audio devices list of the Hardware Notes, to determine the correct driver for your sound card. For example, a Creative &soundblaster; Live! sound card is supported by the &man.snd.emu10k1.4; driver. To add the support for this card, use the following: device snd_emu10k1 Be sure to read the manual page of the driver for the syntax to use. Information regarding the syntax of sound drivers in the kernel configuration can also be found in the /usr/src/sys/conf/NOTES file (/usr/src/sys/i386/conf/LINT for &os; 4.X). Non-PnP ISA cards may require you to provide the kernel with information on the sound card settings (IRQ, I/O port, etc). This is done via the /boot/device.hints file. At system boot, the &man.loader.8; will read this file and pass the settings to the kernel. For example, an old Creative &soundblaster; 16 ISA non-PnP card will use the &man.snd.sbc.4; driver in conjunction with snd_sb16(4). For this card the following lines have to be added to the kernel configuration file: device snd_sbc device snd_sb16 as well as the following in /boot/device.hints: hint.sbc.0.at="isa" hint.sbc.0.port="0x220" hint.sbc.0.irq="5" hint.sbc.0.drq="1" hint.sbc.0.flags="0x15" In this case, the card uses the 0x220 I/O port and the IRQ 5. The syntax used in the /boot/device.hints file is covered in the sound driver manual page. On &os; 4.X, these settings are directly written in the kernel configuration file. In the case of our ISA card, we would only use this line: device sbc0 at isa? port 0x220 irq 5 drq 1 flags 0x15 The settings shown above are the defaults. In some cases, you may need to change the IRQ or the other settings to match your card. See the &man.snd.sbc.4; manual page for more information. Under &os; 4.X, some systems with built-in motherboard sound devices may require the following option in the kernel configuration: options PNPBIOS Testing the Sound Card After rebooting with the modified kernel, or after loading the required module, the sound card should appear in your system message buffer (&man.dmesg.8;) as something like: pcm0: <Intel ICH3 (82801CA)> port 0xdc80-0xdcbf,0xd800-0xd8ff irq 5 at device 31.5 on pci0 pcm0: [GIANT-LOCKED] pcm0: <Cirrus Logic CS4205 AC97 Codec> The status of the sound card may be checked via the /dev/sndstat file: &prompt.root; cat /dev/sndstat FreeBSD Audio Driver (newpcm) Installed devices: pcm0: <Intel ICH3 (82801CA)> at io 0xd800, 0xdc80 irq 5 bufsz 16384 kld snd_ich (1p/2r/0v channels duplex default) The output from your system may vary. If no pcm devices show up, go back and review what was done earlier. Go through your kernel configuration file again and make sure the correct device is chosen. Common problems are listed in . If all goes well, you should now have a functioning sound card. If your CD-ROM or DVD-ROM drive is properly coupled to your sound card, you can put a CD in the drive and play it with &man.cdcontrol.1;: &prompt.user; cdcontrol -f /dev/acd0 play 1 Various applications, such as audio/workman can provide a friendlier interface. You may want to install an application such as audio/mpg123 to listen to MP3 audio files. A quick way to test the card is sending data to the /dev/dsp, like this: &prompt.user; cat filename > /dev/dsp where filename can be any file. This command line should produce some noise, confirming the sound card is actually working. &os; 4.X users need to create the sound card device nodes before being able to use it. If the card showed up in message buffer as pcm0, you will have to run the following as root: &prompt.root; cd /dev &prompt.root; sh MAKEDEV snd0 If the card detection returned pcm1, follow the same steps as shown above, replacing snd0 with snd1. MAKEDEV will create a group of device nodes that will be used by the different sound related applications. Sound card mixer levels can be changed via the &man.mixer.8; command. More details can be found in the &man.mixer.8; manual page. Common Problems device nodes I/O port IRQ DSP Error Solution unsupported subdevice XX One or more of the device nodes was not created correctly. Repeat the steps above. sb_dspwr(XX) timed out The I/O port is not set correctly. bad irq XX The IRQ is set incorrectly. Make sure that the set IRQ and the sound IRQ are the same. xxx: gus pcm not attached, out of memory There is not enough available memory to use the device. xxx: can't open /dev/dsp! Check with fstat | grep dsp if another application is holding the device open. Noteworthy troublemakers are esound and KDE's sound support. Munish Chopra Contributed by Utilizing Multiple Sound Sources It is often desirable to have multiple sources of sound that are able to play simultaneously, such as when esound or artsd do not support sharing of the sound device with a certain application. FreeBSD lets you do this through Virtual Sound Channels, which can be set with the &man.sysctl.8; facility. Virtual channels allow you to multiplex your sound card's playback channels by mixing sound in the kernel. To set the number of virtual channels, there are two sysctl knobs which, if you are the root user, can be set like this: &prompt.root; sysctl hw.snd.pcm0.vchans=4 &prompt.root; sysctl hw.snd.maxautovchans=4 The above example allocates four virtual channels, which is a practical number for everyday use. hw.snd.pcm0.vchans is the number of virtual channels pcm0 has, and is configurable once a device has been attached. hw.snd.maxautovchans is the number of virtual channels a new audio device is given when it is attached using &man.kldload.8;. Since the pcm module can be loaded independently of the hardware drivers, hw.snd.maxautovchans can store how many virtual channels any devices which are attached later will be given. You cannot change the number of virtual channels for a device while it is in use. First close any programs using the device, such as music players or sound daemons. If you are not using &man.devfs.5;, you will have to point your applications at /dev/dsp0.x, where x is 0 to 3 if hw.snd.pcm.0.vchans is set to 4 as in the above example. On a system using &man.devfs.5;, the above will automatically be allocated transparently to the user. Josef El-Rayes Contributed by ³]©w¹w³](Mixer Channel)ªº­µ¶q¤j¤p ¥»¥\¯à¥u¦³¦b &os; 5.3-RELEASE ¤Î¤§«áª©¥»¤~¦³¤ä´©¡C The default values for the different mixer channels are hardcoded in the sourcecode of the &man.pcm.4; driver. There are a lot of different applications and daemons that allow you to set values for the mixer they remember and set each time they are started, but this is not a clean solution, we want to have default values at the driver level. This is accomplished by defining the appropriate values in /boot/device.hints. E.g.: hint.pcm.0.vol="100" This will set the volume channel to a default value of 100, when the &man.pcm.4; module is loaded. Chern Lee Contributed by MP3 ­µ¼Ö MP3 (MPEG Layer 3 Audio) accomplishes near CD-quality sound, leaving no reason to let your FreeBSD workstation fall short of its offerings. MP3 Players By far, the most popular X11 MP3 player is XMMS (X Multimedia System). Winamp skins can be used with XMMS since the GUI is almost identical to that of Nullsoft's Winamp. XMMS also has native plug-in support. XMMS can be installed from the multimedia/xmms port or package. XMMS' interface is intuitive, with a playlist, graphic equalizer, and more. Those familiar with Winamp will find XMMS simple to use. The audio/mpg123 port is an alternative, command-line MP3 player. mpg123 can be run by specifying the sound device and the MP3 file on the command line, as shown below: &prompt.root; mpg123 -a /dev/dsp1.0 Foobar-GreatestHits.mp3 High Performance MPEG 1.0/2.0/2.5 Audio Player for Layer 1, 2 and 3. Version 0.59r (1999/Jun/15). Written and copyrights by Michael Hipp. Uses code from various people. See 'README' for more! THIS SOFTWARE COMES WITH ABSOLUTELY NO WARRANTY! USE AT YOUR OWN RISK! Playing MPEG stream from Foobar-GreatestHits.mp3 ... MPEG 1.0 layer III, 128 kbit/s, 44100 Hz joint-stereo /dev/dsp1.0 should be replaced with the dsp device entry on your system. Ripping CD Audio Tracks Before encoding a CD or CD track to MP3, the audio data on the CD must be ripped onto the hard drive. This is done by copying the raw CDDA (CD Digital Audio) data to WAV files. The cdda2wav tool, which is a part of the sysutils/cdrtools suite, is used for ripping audio information from CDs and the information associated with them. With the audio CD in the drive, the following command can be issued (as root) to rip an entire CD into individual (per track) WAV files: &prompt.root; cdda2wav -D 0,1,0 -B cdda2wav will support ATAPI (IDE) CDROM drives. To rip from an IDE drive, specify the device name in place of the SCSI unit numbers. For example, to rip track 7 from an IDE drive: &prompt.root; cdda2wav -D /dev/acd0a -t 7 The indicates the SCSI device 0,1,0, which corresponds to the output of cdrecord -scanbus. To rip individual tracks, make use of the option as shown: &prompt.root; cdda2wav -D 0,1,0 -t 7 This example rips track seven of the audio CDROM. To rip a range of tracks, for example, track one to seven, specify a range: &prompt.root; cdda2wav -D 0,1,0 -t 1+7 The utility &man.dd.1; can also be used to extract audio tracks on ATAPI drives, read for more information on that possibility. Encoding MP3s Nowadays, the mp3 encoder of choice is lame. Lame can be found at audio/lame in the ports tree. Using the ripped WAV files, the following command will convert audio01.wav to audio01.mp3: &prompt.root; lame -h -b 128 \ --tt "Foo Song Title" \ --ta "FooBar Artist" \ --tl "FooBar Album" \ --ty "2001" \ --tc "Ripped and encoded by Foo" \ --tg "Genre" \ audio01.wav audio01.mp3 128 kbits seems to be the standard MP3 bitrate in use. Many enjoy the higher quality 160, or 192. The higher the bitrate, the more disk space the resulting MP3 will consume--but the quality will be higher. The option turns on the higher quality but a little slower mode. The options beginning with indicate ID3 tags, which usually contain song information, to be embedded within the MP3 file. Additional encoding options can be found by consulting the lame man page. Decoding MP3s In order to burn an audio CD from MP3s, they must be converted to a non-compressed WAV format. Both XMMS and mpg123 support the output of MP3 to an uncompressed file format. Writing to Disk in XMMS: Launch XMMS. Right-click on the window to bring up the XMMS menu. Select Preference under Options. Change the Output Plugin to Disk Writer Plugin. Press Configure. Enter (or choose browse) a directory to write the uncompressed files to. Load the MP3 file into XMMS as usual, with volume at 100% and EQ settings turned off. Press PlayXMMS will appear as if it is playing the MP3, but no music will be heard. It is actually playing the MP3 to a file. Be sure to set the default Output Plugin back to what it was before in order to listen to MP3s again. Writing to stdout in mpg123: Run mpg123 -s audio01.mp3 > audio01.pcm XMMS writes a file in the WAV format, while mpg123 converts the MP3 into raw PCM audio data. Both of these formats can be used with cdrecord to create audio CDs. You have to use raw PCM with &man.burncd.8;. If you use WAV files, you will notice a small tick sound at the beginning of each track, this sound is the header of the WAV file. You can simply remove the header of a WAV file with the utility SoX (it can be installed from the audio/sox port or package): &prompt.user; sox -t wav -r 44100 -s -w -c 2 track.wav track.raw Read for more information on using a CD burner in FreeBSD. Ross Lippert Contributed by ¼½©ñ¼v¤ù Video playback is a very new and rapidly developing application area. Be patient. Not everything is going to work as smoothly as it did with sound. Before you begin, you should know the model of the video card you have and the chip it uses. While &xorg; and &xfree86; support a wide variety of video cards, fewer give good playback performance. To obtain a list of extensions supported by the X server using your card use the command &man.xdpyinfo.1; while X11 is running. It is a good idea to have a short MPEG file which can be treated as a test file for evaluating various players and options. Since some DVD players will look for DVD media in /dev/dvd by default, or have this device name hardcoded in them, you might find it useful to make symbolic links to the proper devices: &prompt.root; ln -sf /dev/acd0c /dev/dvd &prompt.root; ln -sf /dev/racd0c /dev/rdvd On FreeBSD 5.X, which uses &man.devfs.5; there is a slightly different set of recommended links: &prompt.root; ln -sf /dev/acd0 /dev/dvd &prompt.root; ln -sf /dev/acd0 /dev/rdvd Note that due to the nature of &man.devfs.5;, manually created links like these will not persist if you reboot your system. In order to create the symbolic links automatically whenever you boot your system, add the following lines to /etc/devfs.conf: link acd0 dvd link acd0 rdvd Additionally, DVD decryption, which requires invoking special DVD-ROM functions, requires write permission on the DVD devices. kernel options CPU_ENABLE_SSE kernel options USER_LDT Some of the ports discussed rely on the following kernel options to build correctly. Before attempting to build, add this option to the kernel configuration file, build a new kernel, and reboot: options CPU_ENABLE_SSE On &os; 4.X options USER_LDT should be added to the kernel configuration file. This option is not available on &os; 5.X and later version. To enhance the shared memory X11 interface, it is recommended that the values of some &man.sysctl.8; variables should be increased: kern.ipc.shmmax=67108864 kern.ipc.shmall=32768 Determining Video Capabilities XVideo SDL DGA There are several possible ways to display video under X11. What will really work is largely hardware dependent. Each method described below will have varying quality across different hardware. Secondly, the rendering of video in X11 is a topic receiving a lot of attention lately, and with each version of &xorg;, or of &xfree86;, there may be significant improvement. A list of common video interfaces: X11: normal X11 output using shared memory. XVideo: an extension to the X11 interface which supports video in any X11 drawable. SDL: the Simple Directmedia Layer. DGA: the Direct Graphics Access. SVGAlib: low level console graphics layer. XVideo &xorg; and &xfree86; 4.X have an extension called XVideo (aka Xvideo, aka Xv, aka xv) which allows video to be directly displayed in drawable objects through a special acceleration. This extension provides very good quality playback even on low-end machines. To check whether the extension is running, use xvinfo: &prompt.user; xvinfo XVideo is supported for your card if the result looks like: X-Video Extension version 2.2 screen #0 Adaptor #0: "Savage Streams Engine" number of ports: 1 port base: 43 operations supported: PutImage supported visuals: depth 16, visualID 0x22 depth 16, visualID 0x23 number of attributes: 5 "XV_COLORKEY" (range 0 to 16777215) client settable attribute client gettable attribute (current value is 2110) "XV_BRIGHTNESS" (range -128 to 127) client settable attribute client gettable attribute (current value is 0) "XV_CONTRAST" (range 0 to 255) client settable attribute client gettable attribute (current value is 128) "XV_SATURATION" (range 0 to 255) client settable attribute client gettable attribute (current value is 128) "XV_HUE" (range -180 to 180) client settable attribute client gettable attribute (current value is 0) maximum XvImage size: 1024 x 1024 Number of image formats: 7 id: 0x32595559 (YUY2) guid: 59555932-0000-0010-8000-00aa00389b71 bits per pixel: 16 number of planes: 1 type: YUV (packed) id: 0x32315659 (YV12) guid: 59563132-0000-0010-8000-00aa00389b71 bits per pixel: 12 number of planes: 3 type: YUV (planar) id: 0x30323449 (I420) guid: 49343230-0000-0010-8000-00aa00389b71 bits per pixel: 12 number of planes: 3 type: YUV (planar) id: 0x36315652 (RV16) guid: 52563135-0000-0000-0000-000000000000 bits per pixel: 16 number of planes: 1 type: RGB (packed) depth: 0 red, green, blue masks: 0x1f, 0x3e0, 0x7c00 id: 0x35315652 (RV15) guid: 52563136-0000-0000-0000-000000000000 bits per pixel: 16 number of planes: 1 type: RGB (packed) depth: 0 red, green, blue masks: 0x1f, 0x7e0, 0xf800 id: 0x31313259 (Y211) guid: 59323131-0000-0010-8000-00aa00389b71 bits per pixel: 6 number of planes: 3 type: YUV (packed) id: 0x0 guid: 00000000-0000-0000-0000-000000000000 bits per pixel: 0 number of planes: 0 type: RGB (packed) depth: 1 red, green, blue masks: 0x0, 0x0, 0x0 Also note that the formats listed (YUV2, YUV12, etc) are not present with every implementation of XVideo and their absence may hinder some players. If the result looks like: X-Video Extension version 2.2 screen #0 no adaptors present Then XVideo is probably not supported for your card. If XVideo is not supported for your card, this only means that it will be more difficult for your display to meet the computational demands of rendering video. Depending on your video card and processor, though, you might still be able to have a satisfying experience. You should probably read about ways of improving performance in the advanced reading . Simple Directmedia Layer The Simple Directmedia Layer, SDL, was intended to be a porting layer between µsoft.windows;, BeOS, and &unix;, allowing cross-platform applications to be developed which made efficient use of sound and graphics. The SDL layer provides a low-level abstraction to the hardware which can sometimes be more efficient than the X11 interface. The SDL can be found at devel/sdl12. Direct Graphics Access Direct Graphics Access is an X11 extension which allows a program to bypass the X server and directly alter the framebuffer. Because it relies on a low level memory mapping to effect this sharing, programs using it must be run as root. The DGA extension can be tested and benchmarked by &man.dga.1;. When dga is running, it changes the colors of the display whenever a key is pressed. To quit, use q. Ports and Packages Dealing with Video video ports video packages This section discusses the software available from the FreeBSD Ports Collection which can be used for video playback. Video playback is a very active area of software development, and the capabilities of various applications are bound to diverge somewhat from the descriptions given here. Firstly, it is important to know that many of the video applications which run on FreeBSD were developed as Linux applications. Many of these applications are still beta-quality. Some of the problems that you may encounter with video packages on FreeBSD include: An application cannot playback a file which another application produced. An application cannot playback a file which the application itself produced. The same application on two different machines, rebuilt on each machine for that machine, plays back the same file differently. A seemingly trivial filter like rescaling of the image size results in very bad artifacts from a buggy rescaling routine. An application frequently dumps core. Documentation is not installed with the port and can be found either on the web or under the port's work directory. Many of these applications may also exhibit Linux-isms. That is, there may be issues resulting from the way some standard libraries are implemented in the Linux distributions, or some features of the Linux kernel which have been assumed by the authors of the applications. These issues are not always noticed and worked around by the port maintainers, which can lead to problems like these: The use of /proc/cpuinfo to detect processor characteristics. A misuse of threads which causes a program to hang upon completion instead of truly terminating. Software not yet in the FreeBSD Ports Collection which is commonly used in conjunction with the application. So far, these application developers have been cooperative with port maintainers to minimize the work-arounds needed for port-ing. MPlayer MPlayer is a recently developed and rapidly developing video player. The goals of the MPlayer team are speed and flexibility on Linux and other Unices. The project was started when the team founder got fed up with bad playback performance on then available players. Some would say that the graphical interface has been sacrificed for a streamlined design. However, once you get used to the command line options and the key-stroke controls, it works very well. Building MPlayer MPlayer making MPlayer resides in multimedia/mplayer. MPlayer performs a variety of hardware checks during the build process, resulting in a binary which will not be portable from one system to another. Therefore, it is important to build it from ports and not to use a binary package. Additionally, a number of options can be specified in the make command line, as described in the Makefile and at the start of the build: &prompt.root; cd /usr/ports/multimedia/mplayer &prompt.root; make N - O - T - E Take a careful look into the Makefile in order to learn how to tune mplayer towards you personal preferences! For example, make WITH_GTK1 builds MPlayer with GTK1-GUI support. If you want to use the GUI, you can either install /usr/ports/multimedia/mplayer-skins or download official skin collections from http://www.mplayerhq.hu/homepage/dload.html The default port options should be sufficient for most users. However, if you need the XviD codec, you have to specify the WITH_XVID option in the command line. The default DVD device can also be defined with the WITH_DVD_DEVICE option, by default /dev/acd0 will be used. As of this writing, the MPlayer port will build its HTML documentation and two executables, mplayer, and mencoder, which is a tool for re-encoding video. The HTML documentation for MPlayer is very informative. If the reader finds the information on video hardware and interfaces in this chapter lacking, the MPlayer documentation is a very thorough supplement. You should definitely take the time to read the MPlayer documentation if you are looking for information about video support in &unix;. Using MPlayer MPlayer use Any user of MPlayer must set up a .mplayer subdirectory of her home directory. To create this necessary subdirectory, you can type the following: &prompt.user; cd /usr/ports/multimedia/mplayer &prompt.user; make install-user The command options for mplayer are listed in the manual page. For even more detail there is HTML documentation. In this section, we will describe only a few common uses. To play a file, such as testfile.avi, through one of the various video interfaces set the option: &prompt.user; mplayer -vo xv testfile.avi &prompt.user; mplayer -vo sdl testfile.avi &prompt.user; mplayer -vo x11 testfile.avi &prompt.root; mplayer -vo dga testfile.avi &prompt.root; mplayer -vo 'sdl:dga' testfile.avi It is worth trying all of these options, as their relative performance depends on many factors and will vary significantly with hardware. To play from a DVD, replace the testfile.avi with where N is the title number to play and DEVICE is the device node for the DVD-ROM. For example, to play title 3 from /dev/dvd: &prompt.root; mplayer -vo xv dvd://3 -dvd-device /dev/dvd The default DVD device can be defined during the build of the MPlayer port via the WITH_DVD_DEVICE option. By default, this device is /dev/acd0. More details can be found in the port Makefile. To stop, pause, advance and so on, consult the keybindings, which are output by running mplayer -h or read the manual page. Additional important options for playback are: which engages the fullscreen mode and which helps performance. In order for the mplayer command line to not become too large, the user can create a file .mplayer/config and set default options there: vo=xv fs=yes zoom=yes Finally, mplayer can be used to rip a DVD title into a .vob file. To dump out the second title from a DVD, type this: &prompt.root; mplayer -dumpstream -dumpfile out.vob dvd://2 -dvd-device /dev/dvd The output file, out.vob, will be MPEG and can be manipulated by the other packages described in this section. mencoder mencoder Before using mencoder it is a good idea to familiarize yourself with the options from the HTML documentation. There is a manual page, but it is not very useful without the HTML documentation. There are innumerable ways to improve quality, lower bitrate, and change formats, and some of these tricks may make the difference between good or bad performance. Here are a couple of examples to get you going. First a simple copy: &prompt.user; mencoder input.avi -oac copy -ovc copy -o output.avi Improper combinations of command line options can yield output files that are unplayable even by mplayer. Thus, if you just want to rip to a file, stick to the in mplayer. To convert input.avi to the MPEG4 codec with MPEG3 audio encoding (audio/lame is required): &prompt.user; mencoder input.avi -oac mp3lame -lameopts br=192 \ -ovc lavc -lavcopts vcodec=mpeg4:vhq -o output.avi This has produced output playable by mplayer and xine. input.avi can be replaced with and run as root to re-encode a DVD title directly. Since you are likely to be dissatisfied with your results the first time around, it is recommended you dump the title to a file and work on the file. The xine Video Player The xine video player is a project of wide scope aiming not only at being an all in one video solution, but also in producing a reusable base library and a modular executable which can be extended with plugins. It comes both as a package and as a port, multimedia/xine. The xine player is still very rough around the edges, but it is clearly off to a good start. In practice, xine requires either a fast CPU with a fast video card, or support for the XVideo extension. The GUI is usable, but a bit clumsy. As of this writing, there is no input module shipped with xine which will play CSS encoded DVD's. There are third party builds which do have modules for this built in them, but none of these are in the FreeBSD Ports Collection. Compared to MPlayer, xine does more for the user, but at the same time, takes some of the more fine-grained control away from the user. The xine video player performs best on XVideo interfaces. By default, xine player will start up in a graphical user interface. The menus can then be used to open a specific file: &prompt.user; xine Alternatively, it may be invoked to play a file immediately without the GUI with the command: &prompt.user; xine -g -p mymovie.avi The transcode Utilities The software transcode is not a player, but a suite of tools for re-encoding video and audio files. With transcode, one has the ability to merge video files, repair broken files, using command line tools with stdin/stdout stream interfaces. A great number of options can be specified during the build from the multimedia/transcode port, we recommend the following command line to build transcode: &prompt.root; make WITH_OPTIMIZED_CFLAGS=yes WITH_LIBA52=yes WITH_LAME=yes WITH_OGG=yes \ WITH_MJPEG=yes -DWITH_XVID=yes The proposed settings should be sufficient for most users. To illustrate transcode capacities, one example to show how to convert a DivX file into a PAL MPEG-1 file (PAL VCD): &prompt.user; transcode -i input.avi -V --export_prof vcd-pal -o output_vcd &prompt.user; mplex -f 1 -o output_vcd.mpg output_vcd.m1v output_vcd.mpa The resulting MPEG file, output_vcd.mpg, is ready to be played with MPlayer. You could even burn the file on a CD-R media to create a Video CD, in this case you will need to install and use both multimedia/vcdimager and sysutils/cdrdao programs. There is a manual page for transcode, but you should also consult the transcode wiki for further information and examples. Further Reading The various video software packages for FreeBSD are developing rapidly. It is quite possible that in the near future many of the problems discussed here will have been resolved. In the mean time, those who want to get the very most out of FreeBSD's A/V capabilities will have to cobble together knowledge from several FAQs and tutorials and use a few different applications. This section exists to give the reader pointers to such additional information. The MPlayer documentation is very technically informative. These documents should probably be consulted by anyone wishing to obtain a high level of expertise with &unix; video. The MPlayer mailing list is hostile to anyone who has not bothered to read the documentation, so if you plan on making bug reports to them, RTFM. The xine HOWTO contains a chapter on performance improvement which is general to all players. Finally, there are some other promising applications which the reader may try: Avifile which is also a port multimedia/avifile. Ogle which is also a port multimedia/ogle. Xtheater multimedia/dvdauthor, an open source package for authoring DVD content. Josef El-Rayes Original contribution by Marc Fonvieille Enhanced and adapted by ³]©w¹qµø¥d(TV Cards) TV cards ¤¶²Ð ¹qµø¥d(TV card)¥i¥HÅý±z¥Î¹q¸£¨Ó¬ÝµL½u¡B¦³½u¹qµø¸`¥Ø¡C³\¦h¥d³£¬O³z¹L RCA ©Î S-video ¿é¤JºÝ¤l¨Ó±µ¦¬µø°T¡A¦Ó¥B¦³¨Ç¥dÁÙ¥i±µ¦¬ FM ¼s¼½ªº¥\¯à¡C &os; ¥i³z¹L &man.bktr.4; ÅX°Êµ{¦¡¡A¨Ó¤ä´© PCI ¤¶­±ªº¹qµø¥d¡A¥u­n³o¨Ç¥d¨Ï¥Îªº¬O Brooktree Bt848/849/878/879 ©Î Conexant CN-878/Fusion 878a µø°TÂ^¨ú´¹¤ù¡C¦¹¥~¡A­n¦A½T»{­þ¨Ç¥d¤W©Òªþªº¿ï¥x¥\¯à¬O§_¦³¤ä´©¡A¥i¥H°Ñ¦Ò &man.bktr.4; »¡©ú¡A¥H¬d¬Ý©Ò¤ä´©ªºµwÅé²M³æ¡C ³]©w¬ÛÃöÅX°Êµ{¦¡ ­n¥Î¹qµø¥dªº¸Ü¡A´N­n¸ü¤J &man.bktr.4; ÅX°Êµ{¦¡¡A³o­Ó¥i¥H³z¹L¦b /boot/loader.conf ÀÉ¥[¤W¤U­±³o¤@¦æ´N¥i¥H¤F¡G bktr_load="YES" ¦¹¥~¡A¤]¥i¥H§â¸Ó kernel module ª½±µ»P kernel ½sĶ¦b¤@°_¡A§@ªk´N¬O¦b§Aªº kernel ³]©wÀɤº¡A¥[¤W¤U­±³o´X¦æ¡G device bktr device iicbus device iicbb device smbus ¤§©Ò¥H­n¥[¤W³o¨ÇÃB¥~ªºÅX°Êµ{¦¡¡A¬O¦]¬°¥dªº¦U²Õ¦¨³¡¤À³£¬O³z¹L I2C ¶×¬y±Æ¦Ó¬Û¤¬³s±µªº¡C±µ¤U¨Ó¡A½Ð­«·s½sĶ¡B¦w¸Ë·sªº kernel ¡C ¦w¸Ë¦n·sªº kernel ¤§«á¡A­n­«¶}¾÷¤~·|¥Í®Ä¡C¶}¾÷®É¡AÀ³¸Ó·|¬Ý¨ìÃþ¦ü¤U­±ªº¥¿½T°»´ú¨ì TV card °T®§¡G bktr0: <BrookTree 848A> mem 0xd7000000-0xd7000fff irq 10 at device 10.0 on pci0 iicbb0: <I2C bit-banging driver> on bti2c0 iicbus0: <Philips I2C bus> on iicbb0 master-only iicbus1: <Philips I2C bus> on iicbb0 master-only smbus0: <System Management Bus> on bti2c0 bktr0: Pinnacle/Miro TV, Philips SECAM tuner. ·íµM¡A³o¨Ç°T®§¥i¯à¦]±zªºµwÅ餣¦P¦Ó¦³©Ò¤£¦P¡CHowever you should check if the tuner is correctly detected; it is still possible to override some of the detected parameters with &man.sysctl.8; MIBs and kernel configuration file options. For example, if you want to force the tuner to a Philips SECAM tuner, you should add the following line to your kernel configuration file: options OVERRIDE_TUNER=6 or you can directly use &man.sysctl.8;: &prompt.root; sysctl hw.bt848.tuner=6 See the &man.bktr.4; manual page and the /usr/src/sys/conf/NOTES file for more details on the available options. (If you are under &os; 4.X, /usr/src/sys/conf/NOTES is replaced with /usr/src/sys/i386/conf/LINT.) ¦n¥Îªºµ{¦¡ ­n¥Î¹qµø¥d¡A¥i¥Hµø»Ý­n¦w¸Ë¤U¦CÀ³¥Îµ{¦¡¤§¤@¡J multimedia/fxtv provides TV-in-a-window and image/audio/video capture capabilities. multimedia/xawtv is also a TV application, with the same features as fxtv. misc/alevt decodes and displays Videotext/Teletext. audio/xmradio, an application to use the FM radio tuner coming with some TV cards. audio/wmtune, a handy desktop application for radio tuners. More applications are available in the &os; Ports Collection. Troubleshooting If you encounter any problem with your TV card, you should check at first if the video capture chip and the tuner are really supported by the &man.bktr.4; driver and if you used the right configuration options. For more support and various questions about your TV card you may want to contact and use the archives of the &a.multimedia.name; mailing list. Marc Fonvieille Written by ±½´y¾¹ image scanners ¤¶²Ð - &os;, like any modern operating system, allows the use of - image scanners. Standardized access to scanners is provided - by the SANE (Scanner Access Now - Easy) API available through the &os; Ports - Collection. SANE will also use - some &os; devices drivers to access to the scanner - hardware. - - &os; supports both SCSI and USB scanners. Be sure your - scanner is supported by SANE prior - to performing any configuration. - SANE has a supported - devices list that can provide you with information - about the support for a scanner and its status. The - &man.uscanner.4; manual page also provides a list of supported - USB scanners. + &os; ´N¹³¥ô¦ó²{¥N§@·~¨t²Î¤@¼Ë¡A³£¥i¥H¨Ï¥Î±½´y¾¹¡C + ¦b &os; ¬O³z¹L Ports Collection ¤ºªº SANE(Scanner Access Now Easy) + ©Ò´£¨Ñªº API ¨Ó¾Þ§@±½´y¾¹¡C + SANE ¤]·|¨Ï¥Î¤@¨Ç &os; ªºÅX°Êµ{¦¡¨Ó±±¨î±½´y¾¹µwÅé¡C + + &os; ¦P®É¤ä´© SCSI ©M USB ¨âºØ¤¶­±ªº±½´y¾¹¡C¦b°µ¥ô¦ó³]©w¤§«e¡A½Ð½T«O + SANE ¦³¤ä´©±zªº±½´y¾¹¡C + SANE ¦³±i ¤ä´©µwÅé + ªº²M³æ¡A³o¸Ì¦³¤¶²Ð±½´y¾¹ªº¤ä´©±¡ªp©Mª¬ºA°T®§¡C + ¦b &man.uscanner.4; ¤º¤]¦³´£¨Ñ¤@¥÷ USB ±½´y¾¹ªº¤ä´©¦Cªí¡C - Kernel Configuration + Kernel ªº³]©w - As mentioned above both SCSI and USB interfaces are - supported. According to your scanner interface, different - device drivers are required. + ¦p¦P¤W­z©Ò´£ªº SCSI ©M USB ¬É­±³£¦³¤ä´©¡C³o­n¨ú¨M©ó±zªº±½´y¾¹¬É­±¡A¦Ó»Ý­n¤£¦Pªº³]³ÆÅX°Êµ{¦¡¡C - USB Interface + USB ¤¶­± The GENERIC kernel by default includes the device drivers needed to support USB scanners. Should you decide to use a custom kernel, be sure that the following lines are present in your kernel configuration file: device usb device uhci device ohci device uscanner Depending upon the USB chipset on your motherboard, you will only need either device uhci or device ohci, however having both in the kernel configuration file is harmless. If you do not want to rebuild your kernel and your kernel is not the GENERIC one, you can directly load the &man.uscanner.4; device driver module with the &man.kldload.8; command: &prompt.root; kldload uscanner To load this module at each system startup, add the following line to /boot/loader.conf: uscanner_load="YES" After rebooting with the correct kernel, or after loading the required module, plug in your USB scanner. The scanner should appear in your system message buffer (&man.dmesg.8;) as something like: uscanner0: EPSON EPSON Scanner, rev 1.10/3.02, addr 2 This shows that our scanner is using the /dev/uscanner0 device node. On &os; 4.X, the USB daemon (&man.usbd.8;) must be running to be able to see some USB devices. To enable this, add usbd_enable="YES" to your /etc/rc.conf file and reboot the machine. - SCSI Interface + SCSI ¤¶­± If your scanner comes with a SCSI interface, it is important to know which SCSI controller board you will use. According to the SCSI chipset used, you will have to tune your kernel configuration file. The GENERIC kernel supports the most common SCSI controllers. Be sure to read the NOTES file (LINT under &os; 4.X) and add the correct line to your kernel configuration file. In addition to the SCSI adapter driver, you need to have the following lines in your kernel configuration file: device scbus device pass Once your kernel has been properly compiled, you should be able to see the devices in your system message buffer, when booting: pass2 at aic0 bus 0 target 2 lun 0 pass2: <AGFA SNAPSCAN 600 1.10> Fixed Scanner SCSI-2 device pass2: 3.300MB/s transfers If your scanner was not powered-on at system boot, it is still possible to manually force the detection by performing a SCSI bus scan with the &man.camcontrol.8; command: &prompt.root; camcontrol rescan all Re-scan of bus 0 was successful Re-scan of bus 1 was successful Re-scan of bus 2 was successful Re-scan of bus 3 was successful Then the scanner will appear in the SCSI devices list: &prompt.root; camcontrol devlist <IBM DDRS-34560 S97B> at scbus0 target 5 lun 0 (pass0,da0) <IBM DDRS-34560 S97B> at scbus0 target 6 lun 0 (pass1,da1) <AGFA SNAPSCAN 600 1.10> at scbus1 target 2 lun 0 (pass3) <PHILIPS CDD3610 CD-R/RW 1.00> at scbus2 target 0 lun 0 (pass2,cd0) More details about SCSI devices, are available in the &man.scsi.4; and &man.camcontrol.8; manual pages. - SANE Configuration + ³]©w SANE The SANE system has been splitted in two parts: the backends (graphics/sane-backends) and the frontends (graphics/sane-frontends). The backends part provides access to the scanner itself. The SANE's supported devices list specifies which backend will support your image scanner. It is mandatory to determine the correct backend for your scanner if you want to be able to use your device. The frontends part provides the graphical scanning interface (xscanimage). The first thing to do is install the graphics/sane-backends port or package. Then, use the sane-find-scanner command to check the scanner detection by the SANE system: &prompt.root; sane-find-scanner -q found SCSI scanner "AGFA SNAPSCAN 600 1.10" at /dev/pass3 The output will show the interface type of the scanner and the device node used to attach the scanner to the system. The vendor and the product model may not appear, it is not important. Some USB scanners require you to load a firmware, this is explained in the backend manual page. You should also read &man.sane-find-scanner.1; and &man.sane.7; manual pages. Now we have to check if the scanner will be identified by a scanning frontend. By default, the SANE backends comes with a command line tool called &man.scanimage.1;. This command allows you to list the devices and to perform an image acquisition from the command line. The option is used to list the scanner device: &prompt.root; scanimage -L device `snapscan:/dev/pass3' is a AGFA SNAPSCAN 600 flatbed scanner No output or a message saying that no scanners were identified indicates that &man.scanimage.1; is unable to identify the scanner. If this happens, you will need to edit the backend configuration file and define the scanner device used. The /usr/local/etc/sane.d/ directory contains all backends configuration files. This identification problem does appear with certain USB scanners. For example, with the USB scanner used in the , sane-find-scanner gives us the following information: &prompt.root; sane-find-scanner -q found USB scanner (UNKNOWN vendor and product) at device /dev/uscanner0 The scanner is correctly detected, it uses the USB interface and is attached to the /dev/uscanner0 device node. We can now check if the scanner is correctly identified: &prompt.root; scanimage -L No scanners were identified. If you were expecting something different, check that the scanner is plugged in, turned on and detected by the sane-find-scanner tool (if appropriate). Please read the documentation which came with this software (README, FAQ, manpages). Since the scanner is not identified, we will need to edit the /usr/local/etc/sane.d/epson.conf file. The scanner model used was the &epson.perfection; 1650, so we know the scanner will use the epson backend. Be sure to read the help comments in the backends configuration files. Line changes are quite simple: comment out all lines that have the wrong interface for your scanner (in our case, we will comment out all lines starting with the word scsi as our scanner uses the USB interface), then add at the end of the file a line specifying the interface and the device node used. In this case, we add the following line: usb /dev/uscanner0 Please be sure to read the comments provided in the backend configuration file as well as the backend manual page for more details and correct syntax to use. We can now verify if the scanner is identified: &prompt.root; scanimage -L device `epson:/dev/uscanner0' is a Epson GT-8200 flatbed scanner Our USB scanner has been identified. It is not important if the brand and the model do not match. The key item to be concerned with is the `epson:/dev/uscanner0' field, which give us the right backend name and the right device node. Once the scanimage -L command is able to see the scanner, the configuration is complete. The device is now ready to scan. While &man.scanimage.1; does allow us to perform an image acquisition from the command line, it is preferable to use a graphical user interface to perform image scanning. SANE offers a simple but efficient graphical interface: xscanimage (graphics/sane-frontends). Xsane (graphics/xsane) is another popular graphical scanning frontend. This frontend offers advanced features such as various scanning mode (photocopy, fax, etc.), color correction, batch scans, etc. Both of these applications are useable as a GIMP plugin. Allowing Scanner Access to Other Users All previous operations have been done with root privileges. You may however, need other users to have access to the scanner. The user will need read and write permissions to the device node used by the scanner. As an example, our USB scanner uses the device node /dev/uscanner0 which is owned by the operator group. Adding the user joe to the operator group will allow him to use the scanner: &prompt.root; pw groupmod operator -m joe For more details read the &man.pw.8; manual page. You also have to set the correct write permissions (0660 or 0664) on the /dev/uscanner0 device node, by default the operator group can only read the device node. This is done by adding the following lines to the /etc/devfs.rules file: [system=5] add path uscanner0 mode 660 Then add the following to /etc/rc.conf and reboot the machine: devfs_system_ruleset="system" More information regarding these lines can be found in the &man.devfs.8; manual page. Under &os; 4.X, the operator group has, by default, read and write permissions to /dev/uscanner0. Of course, for security reasons, you should think twice before adding a user to any group, especially the operator group. diff --git a/zh_TW.Big5/books/handbook/ports/chapter.sgml b/zh_TW.Big5/books/handbook/ports/chapter.sgml index d508252e61..fa1a33c1fb 100644 --- a/zh_TW.Big5/books/handbook/ports/chapter.sgml +++ b/zh_TW.Big5/books/handbook/ports/chapter.sgml @@ -1,1367 +1,1353 @@ ³nÅé®M¥óºÞ²z½g¡GPackages ¤Î Ports ¾÷¨î ·§­z ports packages ¾¨ºÞ FreeBSD ¦b base system ¤w¥[¤F«Ü¦h¨t²Î¤u¨ã¡C µM¦Ó¡A¦b¹ê°È¹B¥Î¤W¡A±z¥i¯à¤´»Ý­n¦w¸ËÃB¥~ªº³nÅé¡C FreeBSD ´£¨Ñ¤F 2 ºØ¦w¸ËÀ³¥Îµ{¦¡ªº®M¥óºÞ²z¨t²Î¡JPorts Collection(¥H soucre ¨Ó½sĶ¡B¦w¸Ë) ©M package(¹w¥ý½sĶ¦nªº binary ÀÉ)¡C¤W­zªº¤è¦¡¡AµL½×­n¥Î­þ¤@ºØ¡A³£¥i¥H¥Ñ¹³¬O CDROM µ¥©Îºô¸ô¤W¨Ó¦w¸Ë·Q¸Ëªº³Ì·sª©³nÅé¡C Ū§¹³o³¹¡A±z±N¤F¸Ñ¡G ¦p¦ó¥H packages ¨Ó¦w¸Ë³nÅé¡C ¦p¦ó¥H ports ¨Ó¦w¸Ë³nÅé¡C ¤w¦w¸Ëªº packages ©Î ports ­n¦p¦ó²¾°£¡C ¦p¦ó§ó§ï(override) ports collection ©Ò¨Ï¥Îªº¹w³]­È¡C ¦p¦ó¦b®M¥óºÞ²z¨t²Î¤¤¡A§ä¥X·Q¸Ëªº³nÅé¡C ¦p¦ó¤É¯Å¤w¦w¸Ëªº³nÅé¡C ¦w¸Ë³nÅ骺¦UºØ¤è¦¡¤¶²Ð ³q±`­n¦b &unix; ¨t²Î¤W¦w¸Ë³nÅé®É¡A¦³´X­Ó¨BÆJ­n§@¡G ¥ý¤U¸ü¸Ó³nÅéÀ£ÁYÀÉ(tarball)¡A¦³¥i¯à¬O­ì©l½X©Î¬O binary °õ¦æÀÉ¡C ¸Ñ¶}¸ÓÀ£ÁYÀÉ¡C(³q±`¬O¥H &man.compress.1; , &man.gzip.1; ©Î &man.bzip2.1; À£ÁYªº) ¾\Ū¬ÛÃö¤å¥óÀÉ¡A¥H¤F¸Ñ¦p¦ó¦w¸Ë¡C(³q±`ÀɦW¬O INSTALL ©Î README¡A ©Î¦b doc/ ¥Ø¿ý¤Uªº¤@¨Ç¤å¥ó) ¦pªG©Ò¤U¸üªº¬O­ì©l½X¡A¥i¯à­n¥ý­×§ï Makefile ©Î¬O°õ¦æ ./configure ¤§Ãþªº script ¡A±µµÛ¦A½sĶ¸Ó³nÅé¡C ³Ì«á´ú¸Õ¦A´ú¸Õ»P¦w¸Ë¡C ¦pªG¤@¤Á¶¶§Qªº¸Ü¡A´N³o»ò²³æ¡C¦pªG¦b¦w¸Ë«D±Mªù³]­p(²¾´Ó)µ¹ FreeBSD ªº³nÅé®É¥X°ÝÃD¡A ¨º¥i¯à»Ý­n­×§ï¤@¤U¥¦ªºµ{¦¡½X¡A¤~¯à¥¿±`¨Ï¥Î¡C ·íµM¡A§Ú­Ì¥i¥H¦b FreeBSD ¤W¨Ï¥Î¤W­zªº¶Ç²Î¤è¦¡¨Ó¦w¸Ë³nÅé¡A¦ý¬O¡A§Ú­ÌÁÙ¦³§ó²³æªº¿ï¾Ü¡C FreeBSD ´£¨Ñ¤F¨âºØ¬Ù¨Æªº³nÅéºÞ²z¾÷¨î¡G packages ©M ports¡C´N¦b¼g³o½g¤å³¹ªº®É­Ô¡A ¤w¸g¦³¶W¹L &os.numports; ­Ó port ³nÅé¥i¥H¨Ï¥Î¡C - For any given application, the FreeBSD package for that - application is a single file which you must download. The - package contains pre-compiled copies of all the commands for the - application, as well as any configuration files or - documentation. A downloaded package file can be manipulated - with FreeBSD package management commands, such as - &man.pkg.add.1;, &man.pkg.delete.1;, &man.pkg.info.1;, and so - on. Installing a new application can be carried out with a - single command. - - A FreeBSD port for an application is a collection of files - designed to automate the process of compiling an application - from source code. + ©Ò¿×ªº FreeBSD package ´N¬O§O¤H§â¸ÓÀ³¥Îµ{¦¡½sĶ¡B¥´¥]§¹²¦¡C + ¸Ó package ·|¥]¬A¸ÓÀ³¥Îµ{¦¡ªº©Ò¦³°õ¦æÀÉ¡B³]©wÀÉ¡B¤å¥óµ¥¡C + ¦Ó¤U¸ü¨ìµwºÐ¤Wªº package ³£¥i³z¹L FreeBSD ®M¥óºÞ²z«ü¥O¨Ó¶i¦æºÞ²z¡A¤ñ¦p¡G + &man.pkg.add.1;¡B&man.pkg.delete.1;¡B&man.pkg.info.1;µ¥«ü¥O¡C + ©Ò¥H¡A¥u»Ý²³æ¥´­Ó«ü¥O´N¥i»´ÃP¦w¸Ë·sªºÀ³¥Îµ{¦¡¤F¡C + + ¦Ó FreeBSD port «h¬O¥Î¤@¨ÇÀɮסA¨Ó¦Û°Ê³B²zÀ³¥Îµ{¦¡ªº¦w¸Ë¬yµ{¡C Remember that there are a number of steps you would normally carry out if you compiled a program yourself (downloading, unpacking, patching, compiling, installing). The files that make up a port contain all the necessary information to allow the system to do this for you. You run a handful of simple commands and the source code for the application is automatically downloaded, extracted, patched, compiled, and installed for you. - In fact, the ports system can also be used to generate packages - which can later be manipulated with pkg_add - and the other package management commands that will be introduced - shortly. + ¨Æ¹ê¤W¡Aports ¾÷¨îÁÙ¥i¥H¥Î¨Ó²£¥Í packages¡A¥H«K¥L¤H¥i¥H¥Î + pkg_add ¨Ó¦w¸Ë¡A©Î¬Oµy«á·|¤¶²Ð¨ìªº¨ä¥L®M¥óºÞ²z«ü¥O¡C Both packages and ports understand dependencies. Suppose you want to install an application that depends on a specific library being installed. Both the application and the library have been made available as FreeBSD ports and packages. If you use the pkg_add command or the ports system to add the application, both will notice that the library has not been installed, and automatically install the library first. Given that the two technologies are quite similar, you might be wondering why FreeBSD bothers with both. Packages and ports both have their own strengths, and which one you use will depend on your own preference. Package ¦n³B¦b©ó¡G A compressed package tarball is typically smaller than the compressed tarball containing the source code for the application. Packages do not require any additional compilation. For large applications, such as Mozilla, KDE, or GNOME this can be important, particularly if you are on a slow system. Packages do not require any understanding of the process involved in compiling software on FreeBSD. Ports ¦n³B¦b©ó¡G Packages are normally compiled with conservative options, because they have to run on the maximum number of systems. By installing from the port, you can tweak the compilation options to (for example) generate code that is specific to a Pentium IV or Athlon processor. Some applications have compile time options relating to what they can and cannot do. For example, Apache can be configured with a wide variety of different built-in options. By building from the port you do not have to accept the default options, and can set them yourself. In some cases, multiple packages will exist for the same application to specify certain settings. For example, Ghostscript is available as a ghostscript package and a ghostscript-nox11 package, depending on whether or not you have installed an X11 server. This sort of rough tweaking is possible with packages, but rapidly becomes impossible if an application has more than one or two different compile time options. The licensing conditions of some software distributions forbid binary distribution. They must be distributed as source code. Some people do not trust binary distributions. At least with source code, you can (in theory) read through it and look for potential problems yourself. If you have local patches, you will need the source in order to apply them. Some people like having code around, so they can read it if they get bored, hack it, borrow from it (license permitting, of course), and so on. To keep track of updated ports, subscribe to the &a.ports; and the &a.ports-bugs;. - Before installing any application, you should check for security issues - related to your application. - - You can also install security/portaudit which will - automatically check all installed applications for known - vulnerabilities; a check will be also performed before any port - build. Meanwhile, you can use the command portaudit - -F -a after you have installed some - packages. + ¦b¦w¸Ë³nÅé«e¡A³Ì¦n¥ý¬Ý ¤º¬O§_¦³¸Ó³nÅ骺¦w¥þº|¬}³q³ø¡C + + + ¦¹¥~¡A¤]¥i¥H¸Ë security/portaudit¡A¥¦·|¦Û°ÊÀˬd©Ò¦³¤w¸Ëªº + ªº³nÅé¬O§_¦³¤wª¾ªº¦w¥þº|¬}¡A¥t¥~¡A¥¦ÁÙ·|¦b¸Ë³nÅ骺½sĶ¹Lµ{«e¥ý¦æÀˬd¡C + ¤]¥i¥H¦b¸Ë¤F¬Y¨Ç³nÅ餧«á¡A¥Î portaudit -F -a + ¨Ó§@¥þ­±±j¨î¦wÀË¡C The remainder of this chapter will explain how to use packages and ports to install and manage third party software on FreeBSD. ´M§ä·Q¸Ëªº³nÅé - Before you can install any applications you need to know what you - want, and what the application is called. + ¦b¦w¸Ë¥ô¦ó³nÅ餧«e¡A§A¥²¶·¥ý¤F¸Ñ§A·Q­n¤°»òªº³nÅé¡A¥H¤Î¸Ó³nÅé¥s°µ¤°»ò¦WºÙ¡C - FreeBSD's list of available applications is growing all the - time. Fortunately, there are a number of ways to find what you - want: + FreeBSD ¤W¥i¸Ëªº³nÅé²M³æ¤£Â_¦b¼W¥[¤¤¡A + ¤£¹L¡A§Ú­Ì«Ü¼y©¯¦³´XºØ¤è¦¡¥i¥H¨Ó§ä§A·Q¸Ëªº³nÅé¡G - The FreeBSD web site maintains an up-to-date searchable - list of all the available applications, at http://www.FreeBSD.org/ports/. - The ports are divided into categories, and you may either + FreeBSD ºô¯¸¤W¦³§ó·sÀWÁcªº³nÅé²M³æ¡A¦b + http://www.FreeBSD.org/ports/¡C + ¦U ports ¬Ò¨Ì¨ä©Ê½è¦Ó¤Àªù§OÃþ¡Aand you may either search for an application by name (if you know it), or see all the applications available in a category. FreshPorts - Dan Langille maintains FreshPorts, at . FreshPorts + Dan Langille ºûÅ@ FreshPorts ºô¯¸¡Aºô§}¦b ¡C FreshPorts tracks changes to the applications in the ports tree as they happen, allows you to watch one or more ports, and can send you email when they are updated. FreshMeat If you do not know the name of the application you want, try using a site like FreshMeat () to find an application, then check back at the FreeBSD site to see if the application has been ported yet. If you know the exact name of the port, but just need to find out which category it is in, you can use the &man.whereis.1; command. Simply type whereis file, where file is the program you want to install. If it is found on your system, you will be told where it is, as follows: &prompt.root; whereis lsof lsof: /usr/ports/sysutils/lsof This tells us that lsof (a system utility) can be found in the /usr/ports/sysutils/lsof directory. Yet another way to find a particular port is by using the Ports Collection's built-in search mechanism. To use the search feature, you will need to be in the /usr/ports directory. Once in that directory, run make search name=program-name where program-name is the name of the program you want to find. For example, if you were looking for lsof: &prompt.root; cd /usr/ports &prompt.root; make search name=lsof Port: lsof-4.56.4 Path: /usr/ports/sysutils/lsof Info: Lists information about open files (similar to fstat(1)) Maint: obrien@FreeBSD.org Index: sysutils B-deps: R-deps: The part of the output you want to pay particular attention to is the Path: line, since that tells you where to find the port. The other information provided is not needed in order to install the port, so it will not be covered here. For more in-depth searching you can also use make search key=string where string is some text to search for. This searches port names, comments, descriptions and dependencies and can be used to find ports which relate to a particular subject if you do not know the name of the program you are looking for. In both of these cases, the search string is case-insensitive. Searching for LSOF will yield the same results as searching for lsof. Chern Lee Contributed by ¨Ï¥Î Packages ºÞ²z¾÷¨î Package ªº¦w¸Ë¤è¦¡ packages installing pkg_add You can use the &man.pkg.add.1; utility to install a FreeBSD software package from a local file or from a server on the network. ¤â°Ê¤U¸ü¡B¦w¸Ë Package (ĶªÌchinsan: ¦]¤ñ¸û¤£«K¦Ó¤£«Øij³o»ò°µ) &prompt.root; ftp -a ftp2.FreeBSD.org Connected to ftp2.FreeBSD.org. 220 ftp2.FreeBSD.org FTP server (Version 6.00LS) ready. 331 Guest login ok, send your email address as password. 230- 230- This machine is in Vienna, VA, USA, hosted by Verio. 230- Questions? E-mail freebsd@vienna.verio.net. 230- 230- 230 Guest login ok, access restrictions apply. Remote system type is UNIX. Using binary mode to transfer files. ftp> cd /pub/FreeBSD/ports/packages/sysutils/ 250 CWD command successful. ftp> get lsof-4.56.4.tgz local: lsof-4.56.4.tgz remote: lsof-4.56.4.tgz 200 PORT command successful. 150 Opening BINARY mode data connection for 'lsof-4.56.4.tgz' (92375 bytes). 100% |**************************************************| 92375 00:00 ETA 226 Transfer complete. 92375 bytes received in 5.60 seconds (16.11 KB/s) ftp> exit &prompt.root; pkg_add lsof-4.56.4.tgz If you do not have a source of local packages (such as a FreeBSD CD-ROM set) then it will probably be easier to use the option to &man.pkg.add.1;. This will cause the utility to automatically determine the correct object format and release and then fetch and install the package from an FTP site. pkg_add &prompt.root; pkg_add -r lsof The example above would download the correct package and add it without any further user intervention. If you want to specify an alternative &os; Packages Mirror, instead of the main distribution site, you have to set PACKAGESITE accordingly, to override the default settings. &man.pkg.add.1; uses &man.fetch.3; to download the files, which honors various environment variables, including FTP_PASSIVE_MODE, FTP_PROXY, and FTP_PASSWORD. You may need to set one or more of these if you are behind a firewall, or need to use an FTP/HTTP proxy. See &man.fetch.3; for the complete list. Note that in the example above lsof is used instead of lsof-4.56.4. When the remote fetching feature is used, the version number of the package must be removed. &man.pkg.add.1; will automatically fetch the latest version of the application. &man.pkg.add.1; will download the latest version of your application if you are using &os.current; or &os.stable;. If you run a -RELEASE version, it will grab the version of the package that was built with your release. It is possible to change this behavior by overriding the PACKAGESITE environment variable. For example, if you run a &os; 5.4-RELEASE system, by default &man.pkg.add.1; will try to fetch packages from ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-5.4-release/Latest/. If you want to force &man.pkg.add.1; to download &os; 5-STABLE packages, set PACKAGESITE to ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-5-stable/Latest/. Package files are distributed in .tgz and .tbz formats. You can find them at , or on the FreeBSD CD-ROM distribution. Every CD on the FreeBSD 4-CD set (and the PowerPak, etc.) contains packages in the /packages directory. The layout of the packages is similar to that of the /usr/ports tree. Each category has its own directory, and every package can be found within the All directory. The directory structure of the package system matches the ports layout; they work with each other to form the entire package/port system. ºÞ²z Packages packages managing &man.pkg.info.1; is a utility that lists and describes the various packages installed. pkg_info &prompt.root; pkg_info cvsup-16.1 A general network file distribution system optimized for CV docbook-1.2 Meta-port for the different versions of the DocBook DTD ... &man.pkg.version.1; is a utility that summarizes the versions of all installed packages. It compares the package version to the current version found in the ports tree. pkg_version &prompt.root; pkg_version cvsup = docbook = ... The symbols in the second column indicate the relative age of the installed version and the version available in the local ports tree. ²Å¸¹ ¥Nªí·N¸q = The version of the installed package matches the one found in the local ports tree. < The installed version is older than the one available in the ports tree. >The installed version is newer than the one found in the local ports tree. (The local ports tree is probably out of date.) ?The installed package cannot be found in the ports index. (This can happen, for instance, if an installed port is removed from the Ports Collection or renamed.) *There are multiple versions of the package. ²¾°£¤w¦w¸Ëªº Package pkg_delete packages deleting To remove a previously installed software package, use the &man.pkg.delete.1; utility. &prompt.root; pkg_delete xchat-1.7.1 ¨ä¥L²Ó¸`³¡¥÷ All package information is stored within the /var/db/pkg directory. The installed file list and descriptions of each package can be found within files in this directory. ¨Ï¥Î Ports ºÞ²z¾÷¨î The following sections provide basic instructions on using the Ports Collection to install or remove programs from your system. The detailed description of available make targets and environment variables is available in &man.ports.7;. °O±o¦w¸Ë Ports Collection Before you can install ports, you must first obtain the Ports Collection—which is essentially a set of Makefiles, patches, and description files placed in /usr/ports. When installing your FreeBSD system, sysinstall asked if you would like to install the Ports Collection. If you chose no, you can follow these instructions to obtain the ports collection: CVSup ¤è¦¡ This is a quick method for getting and keeping your copy of the Ports Collection up to date using CVSup. If you want to learn more about CVSup, see Using CVSup. Install the net/cvsup-without-gui package: &prompt.root; pkg_add -r cvsup-without-gui See CVSup Installation () for more details. Run cvsup: &prompt.root; cvsup -L 2 -h cvsup.FreeBSD.org /usr/share/examples/cvsup/ports-supfile Change cvsup.FreeBSD.org to a CVSup server near you. See CVSup Mirrors () for a complete listing of mirror sites. One may want to use his own ports-supfile, for example to avoid the need of passing the CVSup server on the command line. In this case, as root, copy /usr/share/examples/cvsup/ports-supfile to a new location, such as /root or your home directory. Edit ports-supfile. Change CHANGE_THIS.FreeBSD.org to a CVSup server near you. See CVSup Mirrors () for a complete listing of mirror sites. And now to run cvsup, use the following: &prompt.root; cvsup -L 2 /root/ports-supfile Running the &man.cvsup.1; command later will download and apply all the recent changes to your Ports Collection, except actually rebuilding the ports for your own system. Portsnap ¤è¦¡ &man.portsnap.8; is an alternative system for distributing the Ports Collection. It was first included in &os; 6.0. On older systems, you can install it from sysutils/portsnap port: &prompt.root; pkg_add -r portsnap Please refer to Using Portsnap for a detailed description of all Portsnap features. Create an empty directory /usr/ports if it does not exists. &prompt.root; mkdir /usr/ports Download a compressed snapshot of the Ports Collection into /var/db/portsnap. You can disconnect from the Internet after this step, if you wish. &prompt.root; portsnap fetch If you are running Portsnap for the first time, extract the snapshot into /usr/ports: &prompt.root; portsnap extract If you already have a populated /usr/ports and you are just updating, run the following command instead: &prompt.root; portsnap update Sysinstall ¤è¦¡ This method involves using sysinstall to install the Ports Collection from the installation media. Note that the old copy of Ports Collection from the date of the release will be installed. If you have Internet access, you should always use one of the methods mentioned above. As root, run sysinstall (/stand/sysinstall in &os; versions older than 5.2) as shown below: &prompt.root; sysinstall Scroll down and select Configure, press Enter. Scroll down and select Distributions, press Enter. Scroll down to ports, press Space. Scroll up to Exit, press Enter. Select your desired installation media, such as CDROM, FTP, and so on. Scroll up to Exit and press Enter. Press X to exit sysinstall. Ports ªº¦w¸Ë¤è¦¡ ports installing The first thing that should be explained when it comes to the Ports Collection is what is actually meant by a skeleton. In a nutshell, a port skeleton is a minimal set of files that tell your FreeBSD system how to cleanly compile and install a program. Each port skeleton includes: A Makefile. The Makefile contains various statements that specify how the application should be compiled and where it should be installed on your system. A distinfo file. This file contains information about the files that must be downloaded to build the port and their checksums, to verify that files have not been corrupted during the download using &man.md5.1;. A files directory. This directory contains patches to make the program compile and install on your FreeBSD system. Patches are basically small files that specify changes to particular files. They are in plain text format, and basically say Remove line 10 or Change line 26 to this .... Patches are also known as diffs because they are generated by the &man.diff.1; program. This directory may also contain other files used to build the port. A pkg-descr file. This is a more detailed, often multiple-line, description of the program. A pkg-plist file. This is a list of all the files that will be installed by the port. It also tells the ports system what files to remove upon deinstallation. Some ports have other files, such as pkg-message. The ports system uses these files to handle special situations. If you want more details on these files, and on ports in general, check out the FreeBSD Porter's Handbook. The port includes instructions on how to build source code, but does not include the actual source code. You can get the source code from a CD-ROM or from the Internet. Source code is distributed in whatever manner the software author desires. Frequently this is a tarred and gzipped file, but it might be compressed with some other tool or even uncompressed. The program source code, whatever form it comes in, is called a distfile. The two methods for installing a &os; port are described below. You must be logged in as root to install ports. Before installing any port, you should be sure to have an up-to-date Ports Collection and you should check for security issues related to your port. A security vulnerabilities check can be automatically done by portaudit before any new application installation. This tool can be found in the Ports Collection (security/portaudit). Consider running portaudit -F before installing a new port, to fetch the current vulnerabilities database. A security audit and an update of the database will be performed during the daily security system check. For more information read the &man.portaudit.1; and &man.periodic.8; manual pages. The Ports Collection makes an assumption that you have a working Internet connection. If you do not, you will need to put a copy of the distfile into /usr/ports/distfiles manually. To begin, change to the directory for the port you want to install: &prompt.root; cd /usr/ports/sysutils/lsof Once inside the lsof directory, you will see the port skeleton. The next step is to compile, or build, the port. This is done by simply typing make at the prompt. Once you have done so, you should see something like this: &prompt.root; make >> lsof_4.57D.freebsd.tar.gz doesn't seem to exist in /usr/ports/distfiles/. >> Attempting to fetch from ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/. ===> Extracting for lsof-4.57 ... [extraction output snipped] ... >> Checksum OK for lsof_4.57D.freebsd.tar.gz. ===> Patching for lsof-4.57 ===> Applying FreeBSD patches for lsof-4.57 ===> Configuring for lsof-4.57 ... [configure output snipped] ... ===> Building for lsof-4.57 ... [compilation output snipped] ... &prompt.root; Notice that once the compile is complete you are returned to your prompt. The next step is to install the port. In order to install it, you simply need to tack one word onto the make command, and that word is install: &prompt.root; make install ===> Installing for lsof-4.57 ... [installation output snipped] ... ===> Generating temporary packing list ===> Compressing manual pages for lsof-4.57 ===> Registering installation for lsof-4.57 ===> SECURITY NOTE: This port has installed the following binaries which execute with increased privileges. &prompt.root; Once you are returned to your prompt, you should be able to run the application you just installed. Since lsof is a program that runs with increased privileges, a security warning is shown. During the building and installation of ports, you should take heed of any other warnings that may appear. It is a good idea to delete the working subdirectory, which contains all the temporary files used during compilation. Not only it consumes a valuable disk space, it would also cause problems later when upgrading to the newer version of the port. &prompt.root; make clean ===> Cleaning for lsof-4.57 &prompt.root; You can save an extra step by just running make install clean instead of make, make install and make clean as three separate steps. Some shells keep a cache of the commands that are available in the directories listed in the PATH environment variable, to speed up lookup operations for the executable file of these commands. If you are using one of these shells, you might have to use the rehash command after installing a port, before the newly installed commands can be used. This command will work for shells like tcsh. Use the hash -r command for shells like sh. Look at the documentation for your shell for more information. Some third party DVD-ROM products such as the FreeBSD Toolkit from the FreeBSD Mall contain distfiles. They can be used with the Ports Collection. Mount the DVD-ROM on /cdrom. If you use a different mount point, set CD_MOUNTPTS make variable. The needed distfiles will be automatically used if they are present on the disk. Please be aware that the licenses of a few ports do not allow for inclusion on the CD-ROM. This could be because a registration form needs to be filled out before downloading or redistribution is not allowed, or for another reason. If you wish to install a port not included on the CD-ROM, you will need to be online in order to do so. The ports system uses &man.fetch.1; to download the files, which honors various environment variables, including FTP_PASSIVE_MODE, FTP_PROXY, and FTP_PASSWORD. You may need to set one or more of these if you are behind a firewall, or need to use an FTP/HTTP proxy. See &man.fetch.3; for the complete list. For users which cannot be connected all the time, the make fetch option is provided. Just run this command at the top level directory (/usr/ports) and the required files will be downloaded for you. This command will also work in the lower level categories, for example: /usr/ports/net. Note that if a port depends on libraries or other ports this will not fetch the distfiles of those ports too. Replace fetch with fetch-recursive if you want to fetch all the dependencies of a port too. You can build all the ports in a category or as a whole by running make in the top level directory, just like the aforementioned make fetch method. This is dangerous, however, as some ports cannot co-exist. In other cases, some ports can install two different files with the same filename. In some rare cases, users may need to acquire the tarballs from a site other than the MASTER_SITES (the location where files are downloaded from). You can override the MASTER_SITES option with the following command: &prompt.root; cd /usr/ports/directory &prompt.root; make MASTER_SITE_OVERRIDE= \ ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/distfiles/ fetch In this example we change the MASTER_SITES option to ftp.FreeBSD.org/pub/FreeBSD/ports/distfiles/. Some ports allow (or even require) you to provide build options which can enable/disable parts of the application which are unneeded, certain security options, and other customizations. A few which come to mind are www/mozilla, security/gpgme, and mail/sylpheed-claws. A message will be displayed when options such as these are available. §ó§ï(Override)¹w³]ªº Ports ¥Ø¿ý Sometimes it is useful (or mandatory) to use a different distfiles and ports directory. The PORTSDIR and PREFIX variables can override the default directories. For example: &prompt.root; make PORTSDIR=/usr/home/example/ports install will compile the port in /usr/home/example/ports and install everything under /usr/local. &prompt.root; make PREFIX=/usr/home/example/local install will compile it in /usr/ports and install it in /usr/home/example/local. And of course, &prompt.root; make PORTSDIR=../ports PREFIX=../local install will combine the two (it is too long to completely write on this page, but it should give you the general idea). Alternatively, these variables can also be set as part of your environment. Read the manual page for your shell for instructions on doing so. Dealing with <command>imake</command> Some ports that use imake (a part of the X Window System) do not work well with PREFIX, and will insist on installing under /usr/X11R6. Similarly, some Perl ports ignore PREFIX and install in the Perl tree. Making these ports respect PREFIX is a difficult or impossible job. ²¾°£¤w¦w¸Ëªº Ports ports removing Now that you know how to install ports, you are probably wondering how to remove them, just in case you install one and later on decide that you installed the wrong port. We will remove our previous example (which was lsof for those of you not paying attention). Ports are being removed exactly the same as the packages (discussed in the Packages section), using the &man.pkg.delete.1; command: &prompt.root; pkg_delete lsof-4.57 ¤É¯Å¤w¦w¸Ëªº Ports ports upgrading First, list outdated ports that have a newer version available in the Ports Collection with the &man.pkg.version.1; command: &prompt.root; pkg_version -v Once you updated your Ports Collection, before attempting a port upgrade, you should check the /usr/ports/UPDATING file. This file describes various issues and additional steps users may encounter and need to perform when updating a port. ¥H Portupgrade ¨Ó¤É¯Å¤w¦w¸Ëªº Ports portupgrade The portupgrade utility is designed to easily upgrade installed ports. It is available from the sysutils/portupgrade port. Install it like any other port, using the make install clean command: &prompt.root; cd /usr/ports/sysutils/portupgrade &prompt.root; make install clean Scan the list of installed ports with the pkgdb -F command and fix all the inconsistencies it reports. It is a good idea to do this regularly, before every upgrade. When you run portupgrade -a, portupgrade will begin to upgrade all the outdated ports installed on your system. Use the flag if you want to be asked for confirmation of every individual upgrade. &prompt.root; portupgrade -ai If you want to upgrade only a certain application, not all available ports, use portupgrade pkgname. Include the flag if portupgrade should first upgrade all the ports required by the given application. &prompt.root; portupgrade -R firefox To use packages instead of ports for installation, provide flag. With this option portupgrade searches the local directories listed in PKG_PATH, or fetches packages from remote site if it is not found locally. If packages can not be found locally or fetched remotely, portupgrade will use ports. To avoid using ports, specify . &prompt.root; portupgrade -PR gnome2 To just fetch distfiles (or packages, if is specified) without building or installing anything, use . For further information see &man.portupgrade.1;. ¥H Portmanager ¨Ó¤É¯Å¤w¦w¸Ëªº Ports portmanager Portmanager is another utility for easy upgrading of installed ports. It is available from the sysutils/portmanager port: &prompt.root; cd /usr/ports/sysutils/portmanager &prompt.root; make install clean All the installed ports can be upgraded using this simple command: &prompt.root; portmanager -u You can add the flag to get asked for confirmation of every step Portmanager will perform. Portmanager can also be used to install new ports on the system. Unlike the usual make install clean command, it will upgrade all the dependencies prior to building and installing the selected port. &prompt.root; portmanager x11/gnome2 If there are any problems regarding the dependencies for the selected port, you can use Portmanager to rebuild all of them in the correct order. Once finished, the problematic port will be rebuilt too. &prompt.root; portmanager graphics/gimp -f For more information see Portmanager's manual page. Ports »PµwºÐªÅ¶¡ ports disk-space Using the Ports Collection will use up disk space over time. After building and installing software from the ports, you should always remember to clean up the temporary work directories using the make clean command. You can sweep the whole Ports Collection with the following command: &prompt.root; portsclean -C You will accumulate a lot of old source distribution files in the distfiles directory over time. You can remove them by hand, or you can use the following command to delete all the distfiles that are no longer referenced by any ports: &prompt.root; portsclean -D The portsclean utility is part of the portupgrade suite. Do not forget to remove the installed ports once you no longer need them. A nice tool to help automate this task is available from the sysutils/pkg_cutleaves port. ¦w¸Ë¤§«á¡A¦³¤°»ò«áÄòª`·N¨Æ¶µ¶Ü¡H ³q±`¡A¦w¸Ë§¹³nÅé«á¡A§Ú­Ì¥i¥H¾\Ū©Òªþªº¤@¨Ç¤å¥ó¡A©Î»Ý­n½s¿è³]©wÀÉ¡A ¨Ó½T«O³o­Ó³nÅé¯à¶¶§Q¹B§@¡A©Î¦b¾÷¾¹¶}¾÷ªº®É­Ô±Ò°Ê(¦pªG¬O daemon ªº¸Ü)µ¥µ¥¡C ¤£¦Pªº³nÅé·|¦³¤£¦Pªº³]©w¨BÆJ¡C¤£ºÞ«ç¼Ë¡A¦pªG¸Ë¦n¤F³nÅé¡A ¦ý¬O¤£ª¾¹D¤U¤@¨B«ç»ò¿ìªº®É­Ô¡A ¥i¥H¸Õ¸Õ¬Ý³o¨Ç¤p§Þ¥©¡G µ½¥Î &man.pkg.info.1; ¡A³o«ü¥O¥i¥HÅã¥Ü¡G³z¹L®M¥óºÞ²z¨t²Î(Packages/Ports)¸Ë¤F­þ¨Ç³nÅé¡BÀɮ׸˦b­þÃä¡CÁ|¨Ò¨Ó»¡¡A­Y­è¸Ë¤F FooPackage (ª©¥» 1.0.0)¡A¨º»ò¤U­±³o«ü¥O¡G &prompt.root; pkg_info -L foopackage-1.0.0 | less ´N·|Åã¥Ü³o³nÅé©Ò¦w¸ËªºÀɮײM³æ¡C Pay special attention to files in man/ directories, which will be manual pages, etc/ directories, which will be configuration files, and doc/, which will be more comprehensive documentation. If you are not sure which version of the application was just installed, a command like this &prompt.root; pkg_info | grep -i foopackage will find all the installed packages that have foopackage in the package name. Replace foopackage in your command line as necessary. Once you have identified where the application's manual pages have been installed, review them using &man.man.1;. Similarly, look over the sample configuration files, and any additional documentation that may have been provided. If the application has a web site, check it for additional documentation, frequently asked questions, and so forth. If you are not sure of the web site address it may be listed in the output from &prompt.root; pkg_info foopackage-1.0.0 A WWW: line, if present, should provide a URL for the application's web site. Ports that should start at boot (such as Internet servers) will usually install a sample script in /usr/local/etc/rc.d. You should review this script for correctness and edit or rename it if needed. See Starting Services for more information. ¦p¦ó³B²zÄê±¼(Broken)ªº Ports¡H ¦pªGµo²{¬Y­Ó port µLªk¶¶§Q¦w¸Ë¡B¹B§@¡A ¦³´XºØ¤èªk¥i¥H¸Õ¸Õ¬Ý¡G ±q Problem Report ¸ê®Æ®w ¤¤«õÄ_¬Ý¬Ý¡A»¡¤£©w¤w¸g¦³¤H°e¥i¥Îªº patch ¤W¥hÅo¡A ¨º»ò©Î³\´N¥i¥H¶¶§Q¸Ñ¨M°ÝÃD­ù¡C ¦V¸Ó port ªº maintainer ´M¨D¨ó§U¡G½Ð¥´ make maintainer ©Î½¾\ Makefile ¥H¬d¸ß maintainer ªº email address¡C°O±o±H«Hµ¹ maintainer ®É¡A­nªþµù¸Ó port ªº¦WºÙ¡Bª©¥»(©Î¬O§â Makefile ¤ºªº $FreeBSD: ¨º¤@¾ã¦æªþ¤W) ¥H¤Î¬ÛÃö¿ù»~°T®§¡C - Some ports are not maintained by an individual but - instead by a ¦³¨Ç port ¤£¬O¥Ñ±Mªùªº³æ¤@ maintainer ­t³d¡A¦Ó¬O³z¹L mailing - list. Many, but not all, of these addresses look like - freebsd-listname@FreeBSD.org. Please - take this into account when phrasing your questions. + list ªº±MÃD°Q½×¡C³\¦h(¦ý«D¥þ³¡)ªºÁpµ¸ email ®æ¦¡³q±`¬O + freebsd-list¦WºÙ@FreeBSD.org¡Cµo°Ý®É¡A½Ð°O±o§â¡yfreebsd-list¦WºÙ¡z§ï¬°¬ÛÃö°Q½×ªº mailing list ¦WºÙ¡C ¤×¨ä·í port ªº maintainer Äæ¦ì¬O freebsd-ports@FreeBSD.org ®É¡A¨Æ¹ê¤W¤w¸g¨S¤H·í¸Ó port maintainer ¤F¡C ¦]¦¹­Y¸Ó port ¤´¦³­×¥¿©Î¨ä¥L§Þ³N¤ä´©ªº¸Ü¡A¬ÛÃö°Q½×³£·|¦b freebsd-ports ¶l»¼½×¾Â¤W¥X²{¡C ³á¡A¹ï¤F¡A¦pªG¦³¼ô±x¸Ó³nÅéªÌ¡A§ÓÄ@·í¸Ó port maintainer ªº¸Ü¡A§Ú­Ì¤]³£«ÜÅwªï±zªº¥[¤J³á¡C ­Y port maintainer ¨S¦³¦^Âбzªº«H¥ó¡A «h¥i¥H¥Î &man.send-pr.1; ¨Ó´£¥æ°ÝÃD³ø§i PR¡C(½Ð°Ñ¾\ Writing FreeBSD Problem Reports)¡C ¸Õ¸Õ¬Ý­×¥¿¥¦§a! Porter's Handbook ¥]¬A¤F Ports ¬[ºcªº²Ó¸`³¡¥÷¡A³o¨Ç®Ñ¤¤¤º®e¦³§U±z­×¦n¦³°ÝÃDªº port ¬Æ¦Ü´£¥æ¦Û¤vªº port¡T ±q¸ûªñªº FTP ¯¸ÂI¤U¸ü½sĶ¦nªº package¡C package collection ªº³Ì¤W´å¯¸¬O¦b ftp.FreeBSD.org ¤Wªº packages ¥Ø¿ý¤º¡A¦ý½Ð°O±o¥ýÀˬd¬O§_¤w¦³ local mirror ¯¸! ³q±`±¡ªp¤U³o¨Ç package ³£¥i¥Hª½±µ¨Ï¥Î¡A¦Ó¥BÀ³¸Ó¤ñ¦Û¦æ½sĶ§Ö¤@¨Ç¡C ¥Î &man.pkg.add.1; §Y¥i¶¶§Q¦w¸Ë package ¡C diff --git a/zh_TW.Big5/books/porters-handbook/book.sgml b/zh_TW.Big5/books/porters-handbook/book.sgml index 49bf3f4ce0..a27d6c900a 100644 --- a/zh_TW.Big5/books/porters-handbook/book.sgml +++ b/zh_TW.Big5/books/porters-handbook/book.sgml @@ -1,10036 +1,9980 @@ %books.ent; ]> FreeBSD Porter's Handbook FreeBSD ¤å¥ó­p¹º April 2000 2000 2001 2002 2003 2004 2005 2006 FreeBSD ¤å¥ó­p¹º &bookinfo.trademarks; &bookinfo.legalnotice; ·¤¤l ´X¥G¨C­Ó FreeBSD ·R¥ÎªÌ³£¬O³z¹L FreeBSD Ports Collection ¨Ó¸Ë¦U¦¡À³¥Îµ{¦¡("ports")¡C¦p¦P FreeBSD ªº¨ä¥L³¡¤À¤@¼Ë¡A ³o¨Ç ports ³£¥D­n¨Ó¦Û³\¦h§Ó¤uªº§V¤O¦¨ªG¡A©Ò¥H¦b¾\Ū³o¥÷¤å¥ó®É¡A ½Ð°È¥²·P®¦¦b¤ß¡C ¦b FreeBSD ¤W­±¡A¨C­Ó¤H³£¥i¥H´£¥æ·sªº port¡A ©Î°²¦p¸Ó port ¨Ã¨S¦³¤HºûÅ@ªº¸Ü¡A¥i¥H¦ÛÄ@ºûÅ@ — ³oÂI¨Ã¤£»Ý­n¥ô¦ó commit ªºÅv­­¡A´N¥i¥H¨Ó°µ³o¥ó¨Æ±¡¡C ¦Û¦æ¥´³y port ¨º»ò¡A¶}©l¹ï¦Û¦æ»s§@ port ©Î§ó·s²{¦³ port ¦³¤@¨Ç¿³½ì¤F¶Ü¡H¤Ó¦nÅo¡I ¤U­±±N¤¶²Ð¤@¨Ç«Ø¥ß port ®É¸Óª`·Nªº¨Æ¶µ¡C¦pªG¬O·Q¤É¯Å²{¦³ªº port ¡A¨º»ò¤]½Ð°Ñ¾\ »¡©ú¡C ¦]¬°³o¥÷¤å¥ó¥i¯àÁ¿±o¤£¬O¤Q¤À¸Ô²Ó¡A¥i¯à»Ý­n°Ñ¦Ò /usr/ports/Mk/bsd.port.mk ³oÀɬO©Ò¦³ port ªº Makefile Àɳ£·|¥Î¨ìªº¡C´Nºâ§A¤£¬O¨C¤Ñ¤£Â_ hacking Makefiles ¡A¤]³£¥i¥HÂǥѥ¦¨Ó¹ï¾ã­Ó port ¾÷¨î¡BMakefile §óÁA¸Ñ¡A¸Ì­±ªºµùÄÀ¬Û·í¸Ô²Ó¡C ¦¹¥~¡A­Y¦³¨ä¥L¯S©w port ªº°ÝÃD¡A¤]¥i¥H¨ì &a.ports; ¨ÓÀò±oµª®×¡C - Only a fraction of the variables - (VAR) that can be - overridden are mentioned in this document. Most (if not all) - are documented at the start of /usr/ports/Mk/bsd.port.mk; - the others probably ought to be. - Note that this file uses a non-standard tab setting: - Emacs and - Vim should recognize the setting on - loading the file. Both &man.vi.1; and - &man.ex.1; can be set to use the correct value by - typing :set tabstop=4 once the file has been - loaded. + ¥»¤å¤º©Ò´£¤ÎªºÀô¹ÒÅܼÆ(VAR)³¡¥÷¡A + ¥u¦³¤@¨Ç¥i¥H´À´«(overridden)¡C¤j³¡¥÷ªºÀô¹ÒÅܼÆ(«D¥þ³¡)³q±`³£·|¼g¦b + /usr/ports/Mk/bsd.port.mk ¤º¡A¨ä¥Lªº¤]¬O®t¤£¦h¡C + ½Ðª`·N¡G¸ÓÀɨëD¨Ï¥Î¤@¯ëªº tab ³]©w­È¡A¦Ó¬O±Ä¥Î 1 ­Ó tab µ¥©ó 4 ­Ó space¡G + Emacs »P + Vim À³¸Ó³£·|¦b¸ü¤J¸ÓÀɮɶ¶«KŪ¨ú¬ÛÃö³]©w­È¡C + &man.vi.1; ¤Î + &man.ex.1; ³o¨â­Óµ{¦¡¤]³£¥i¥H¥´ :set tabstop=4 ¥H­×§ï³]©w­È¡C ¥´³y Port §Ö³t¤W¤â½g ¥»¸`¥D­n¤¶²Ð¦p¦ó¨Ó§Ö³t¥´³y port¡AµM¦Ó¡A«Ü¦h®É­Ô³o¨Ç¤º®e¨Ã¤£¬O«Ü°÷¥Î¡A «Øij¾\Ū¥»¤å¥ó¤¤§ó²`¶øªº¦a¤è¡C ­º¥ý¨ú±o¸ÓÀ³¥Îµ{¦¡ªº­ì©lµ{¦¡½XÀ£ÁYÀÉ(tarball)¡A¨Ã§â¥¦©ñ¨ì DISTDIR¡A¹w³]¸ô®|À³¸Ó¬O /usr/ports/distfiles¡C ¤U­±ªº¨Ò¤l¡A¬O°²³]¨Ã¤£»Ý­n¦A­×§ï¸ÓÀ³¥Îµ{¦¡ªº­ì©l½X¡A´N¥i¥H¦b FreeBSD ¤W½sĶ¦¨¥\ªº¡F°²¦pÁٻݭn¥t¥~­×§ï¤~¯à¦¨¥\½sĶªº¸Ü¡A¨º»ò½Ð°Ñ¦Ò¤U¤@³¹ªº»¡©ú¡C ½s¼g <filename>Makefile</filename> ³Ì²³æªº Makefile ¤j·§¬O¹³³o¼Ë¡G # New ports collection makefile for: oneko # Date created: 5 December 1994 # Whom: asami # # $FreeBSD$ # PORTNAME= oneko PORTVERSION= 1.1b CATEGORIES= games MASTER_SITES= ftp://ftp.cs.columbia.edu/archives/X11R5/contrib/ MAINTAINER= asami@FreeBSD.org COMMENT= A cat chasing a mouse all over the screen MAN1= oneko.1 MANCOMPRESSED= yes USE_IMAKE= yes .include <bsd.port.mk> ¶â¡A¤j­P´N¬O³o¼Ë¡A¬Ý¬Ý§A¤w¸g»â²¤¦h¤Ö¤F©O¡H¬Ý¨ì $FreeBSD$ ³o¤@¦æªº¸Ü¡A§O·Q¤Ó¦h¡A¥¦¬O CVS ID tag ¥Î³~¡A·í¸Ó port ¥¿¦¡¶i¤J port tree ®É¡A´N·|¦Û°ÊÂà´«¬°¬ÛÃö¦r¦êÅo¡C ¦³Ãö³oÂIªº²Ó¸`³¡¥÷¡A¥i¥H°Ñ¾\ sample Makefile ³¹¸`¡C ¼¶¼g¸Ó³nÅ骺»¡©úÀÉ µL½×¬O§_¥´ºâ¦A¥[¤u°µ¦¨ package¡A¦³ 2 ­ÓÀɮ׬O¥ô¦ó¹êÅé port (Slave port«h¤£¤@©w)³£¥²¶·­n¨ã³Æªº¡C ³o 2 ­ÓÀɤÀ§O¬O pkg-descr ÀɤΠpkg-plist ÀÉ¡C³o¨â­ÓÀÉ®×ÀɦW«e­±³£¦³ pkg- ¥H¸ò¨ä¥LÀÉ®×°µ°Ï§O¡C <filename>pkg-descr</filename> ³o¬O¦¹ port ªº¸Ô²Ó»¡©úÀÉ¡A½Ð¥Î¤@¬q©Î´X¬q¤å¦r¨Ó»¡©ú¸Ó port ªº§@¥Î¡A¨Ãªþ¤W WWW ºô§}(­Y¦³ªº¸Ü) ½Ðª`·N¡A³oÀɵ´«D¡u¸Ó³nÅ骺»¡©ú¤â¥U¡v©Î¬O¡u¦p¦ó½sĶ¡B¨Ï¥Î¸Ó port ªº»¡©ú¡v¡C ­Y¬O±q¸Ó³nÅ骺 README ©Î manpage ª½±µ½Æ»s¹L¨Óªº¸Ü¡A ½Ðª`·N¡A¦]¬°¥¦­Ì³q±`³£¼g±o¤Ó¸Ô²Ó¡B®æ¦¡¸û¯S§O(¤ñ¦p manpage ·|¦Û°Ê½Õ¾ãªÅ¥Õ)¡A ½Ð¾¨¶qÁקK³o¨Ç¤¾ªøÂصü©Î±Ä¥Î¯S®í®æ¦¡¡C­Y¸Ó³nÅ馳©x¤èª©­º­¶ªº¸Ü¡A½Ð¦b¦¹¦C¥X¨Ó¡C ¨C­Óºô§}½Ð¥Î WWW: §@¬°¶}ÀY¡A³o¼Ë¤l¬ÛÃö¤u¨ãµ{¦¡´N·|¦Û°Ê³B²z§¹²¦¡C ¸Ó port ªº pkg-descr ¤º®e¡A¤j­P¦p¤U­±¨Ò¤l¡G This is a port of oneko, in which a cat chases a poor mouse all over the screen. : (etc.) WWW: http://www.oneko.org/ <filename>pkg-plist</filename> ³o¬O¸Ó port ©Ò·|¸Ëªº©Ò¦³ÀɮײM³æ¡A¥t¥~¦]¬° package ·|¥Ñ³o²M³æ©Ò²£¥Í¡A¦]¦¹¤]³QºÙ¬°¡ypacking list (¥´¥]²M³æ)¡z¡C ¥H ${PREFIX} ¬°°ò·ÇÂI¡A¦Ó¥Î¬Û¹ï¸ô®|ªí¥Ü¡C (${PREFIX} ³q±`¬O /usr/local ©Î /usr/X11R6) ¦ý¬O¦pªG¸Óµ{¦¡¦³¦w¸Ë man page ªº¸Ü¡A«h­n¥HÃþ¦ü MANn= ªº¤è¦¡¼g¦b Makefile ¤º¡A¤£¯à¦C¦b pkg-plist ®@¡C °£¤F¦C¥XÀÉ®×¥H¥~¡A¤]­n§â¸Ó port ©Ò·|«Ø¥ßªº¥Ø¿ý¤]¦C¶i¥h¡A¤è¦¡¦³¨âºØ¡G¤@ºØ¬O¼g¦b pkg-plist ¤ºªº¤è¦¡¡A¤ñ¦p¡G @dirrm ¡C¦Ü©ó¥t¥~¤@ºØ¤è¦¡¡A«h¬O¼g¦b Makefile ¤º¡A¤ñ¦p ¡GPLIST_FILES= ¤§Ãþªº¤è¦¡¡C ¸Ó port ªº pkg-plist ¤º®e¡A¤j­P¦p¤U­±¨Ò¤l: bin/oneko lib/X11/app-defaults/Oneko lib/X11/oneko/cat1.xpm lib/X11/oneko/cat2.xpm lib/X11/oneko/mouse.xpm @dirrm lib/X11/oneko Ãö©ó packing list ¤è­±¡A¥i¥H°Ñ¾\ &man.pkg.create.1; ·|¦³¸Ô¸Ñ¡C «Øij²M³æ¤ºªºÀɦW¡A¨Ì·Ó¦r¥À¶¶§Ç§@±Æ§Ç¡A¨º»ò¤U¦¸­n¤É¯Å®É¡A·|¤ñ¸û²M·¡¡B¤è«K¨Ó§ó·s³o¥÷²M³æ¡C ¤â°Ê¥Í³o¥÷²M³æ¹ê¦b¤Ó­W¤F¡C¤×¨ä­Y¸Ó port ·|¸Ë¤@¤j°ïÀɮתº¸Ü¡A½Ð¦hµ½¥Î ¦Û°Ê²£¥Í packing list ·|¤ñ¸û¬Ù®É¬Ù¤O­ò¡C - ¥u¦³¦b¤@ ºØ±¡ªp¤U¥i¥H¬Ù²¤¤£¥Î¥Í pkg-plist ÀÉ¡C If the port installs just a handful - of files, and perhaps directories, the files and directories may - be listed in the variables PLIST_FILES and - PLIST_DIRS, respectively, within the port's - Makefile. For instance, we could get along - without pkg-plist in the above - oneko port by adding the - following lines to the Makefile: + ¥u¦³¦b¤@ºØ±¡ªp¤U¥i¥H¬Ù²¤¤£¥Î¥Í pkg-plist ÀÉ¡G + ­Y¦w¸Ëªº port ¬Û·í³æ¯Â¡A¥u¦³¸Ë¤@¨ÇÀɮסA¥H¤Î³£¦b¦P¤@¥Ø¿ý¤Uªº¸Ü¡A + ¨º»ò¥i¥H¦b Makefile ¤º§ï¥Î PLIST_FILES ¤Î + PLIST_DIRS ¨Ó¨ú¥N¡C + ¤ñ¦p¡A¥i¥H¦b¤W­zªº oneko port ¤º¤£¥²ªþ¤W + pkg-plist ¡A¦Ó¥u»Ý¦b Makefile ¤º¥[¤J¤U¦C´X¦æ¡G PLIST_FILES= bin/oneko \ lib/X11/app-defaults/Oneko \ lib/X11/oneko/cat1.xpm \ lib/X11/oneko/cat2.xpm \ lib/X11/oneko/mouse.xpm PLIST_DIRS= lib/X11/oneko - Of course, PLIST_DIRS should be left - unset if a port installs no directories of its own. - - The price for this way of listing port's files and - directories is that you cannot use command sequences - described in &man.pkg.create.1;. Therefore, it is suitable - only for simple ports and makes them even simpler. At the - same time, it has the advantage of reducing the number of files - in the ports collection. Please consider using this technique - before you resort to pkg-plist. - - Later we will see how pkg-plist - and PLIST_FILES can be used to fulfil - more sophisticated - tasks. + ·íµM¡A­Y¸Ó port ¨ÃµL¦w¸Ë¦ÛÄݪº¥Ø¿ýªº¸Ü¡A´N¤£¥²³] PLIST_DIRS Åo¡C + + µM¦Ó¡A¨Ï¥Î PLIST_FILES ¡BPLIST_DIRS ¬O¥²¶·¥I¥X¥N»ù¡G + ¤£¯à¨Ï¥Î &man.pkg.create.1; ¤º©Ò»¡ªº command sequences¡C + ¦]¦¹¡A³o©Û¶È¾A¥Î©ó¸û²³æªº port ¡A¥H¤Î²¤Æ¸Ó port ªº§@ªk¡C + ¦¹¥~¡A³o©ÛÁÙ¦³¤@­Ó¦n³B¡G¥i¥H´î¤Ö ports collection ªº¾ãÅéÀÉ®×Á`¼Æ¡C + ©Ò¥H¡A¦b¦Ò¼{¬O§_¤@©w­n¥Î pkg-plist ¤§«e¡A¥i¥H¥ý·r°u³o­Ó´À¥N¤è®×¬Ý¬Ý¡C + + «á­±·|¤¶²Ð¨ì¦p¦ó¹B¥Î pkg-plist¡BPLIST_FILES + ³o¨Ç§Þ¥©¥H¦]À³ §ó½ÆÂøªºª¬ªp¡C ²£¥Í checksum ¥Î³~ªº distinfo ÀÉ ¥u­n¥´¡ymake makesum¡z´N¦n¤F¡A±µ¤U¨Ó´N·|¦Û°Ê²£¥Í¬Û¹ïÀ³ªº - distinfo ÀÉ­ù¡C - - If a file fetched has its checksum changed regularly and you are - certain the source is trusted (i.e. it comes from manufacturer CDs - or documentation generated daily), you should specify these files in - the IGNOREFILES variable. - Then the checksum is not calculated for that file when you run - make makesum, but set to - IGNORE. + distinfo ÀɤF­ò¡C + + ­Y§ì¤U¨ÓªºÀɮסA¥¦ªº checksum ·|¸g±`Åܧó¡A¦Ó§A¤]«Ü½T«H©Ò§ìªº¨Ó·½¬O¥¿½TµL»~ªº¸Ü¡A + (¤ñ¦p¡G¨Ó·½¬O¥úºÐ©Î¬O¨C¤Ñ¦Û°Ê²£¥Íªº¤å¥ó)¡A¨º»ò¥i¥H³]©w¨º¨ÇÀɮ׬° IGNOREFILES ¡C + ¦p¦¹¤@¨Ó¡A¦b¥´ make makesum ªº®É­Ô´N¤£·|­pºâ¨º¨ÇÀɮתº checksum¡A¦Ó¦Û°Ê§ï¬° + IGNORE Åo¡C ÀËÅç port ¬O§_§¹¾ã¡B¥i¦æ - You should make sure that the port rules do exactly what you - want them to do, including packaging up the port. These are the - important points you need to verify. + ±µ¤U¨Ó¡A¥²¶·ÀËÅç¬O§_¦³²Å¦X port ªº¹CÀ¸³W«h¡A¥]¬A¥´¥]¸Ó port ¬° package¡C + ¥H¤U¦³´X­Ó»Ý­n½T»{ªº­«­n¦a¤è¡G - pkg-plist does not contain anything not - installed by your port + ­Y¸Ó port ¨S¸ËªºªF¦è¡A¤£­n¦C¦b pkg-plist ¤º¡C - pkg-plist contains everything that is - installed by your port + ­Y¸Ó port ¦³¸ËªºªF¦è¡A½Ð°È¥²¦C¦b pkg-plist ¤º¡C - Your port can be installed multiple times using the - reinstall target + ¸Ó port ¥i¥H¥Î reinstall ¨Ó­«·s¦w¸Ë¡C - Your port cleans up - after itself upon deinstall + ¸Ó port ¦b²¾°£¤§«á¡A½T©w³£¥i cleans up¡C - «Øij±Ä¦æªº´ú¸Õ¶¶§Ç¡G + «Øijªº´ú¸Õ¨BÆJ¶¶§Ç¡G make install make package make deinstall pkg_add package-name make deinstall make reinstall make package - Make sure that there are not any warnings issued in any of the - package and - deinstall stages. After step 3, check to - see if all the new directories are correctly deleted. Also, try - using the software after step 4, to ensure that it works correctly - when installed from a package. + ½T»{¦b package ©M deinstall + ³o¨â­Ó¶¥¬q³£¨S¦³¥ô¦ó¿ù»~°T®§¥X²{¡C + §¹¦¨²Ä¤T¨BÆJ¤§«á¡AÀˬd¤@¤U¬O§_©Ò¸ËªºÀɮסB¥Ø¿ý³£¦³²¾°£§¹²¦¡C¦¹¥~¡A²Ä¥|¨BÆJ§¹¦¨«á¡A¤]Àˬd¤@¤U¥H package + ¸Ëªº¸Ó³nÅé¡A¬O§_³£¯à¥¿±`¹B§@¡C ¥H <command>portlint</command> ¨Ó§@ÀËÅç - ½Ð¥Î portlint ¨ÓÀˬd¸Ó port ¬O§_¦³¿í´`¤W­z³W«h¡C The - devel/portlint program is part of the ports collection. - In particular, you may want to check if the - Makefile is in the right - shape and the package is named - appropriately. + ½Ð¥Î portlint ¨ÓÀˬd¸Ó port ¬O§_¦³¿í´`¤W­z¹CÀ¸³W«h¡C »¡¨ì³o + devel/portlint ¥¦¬O ports collection ªº¨ä¤¤¤@­Ó®M¥ó¡C + ¥¦¥D­n¥i¥H¥Î¨ÓÀËÅç Makefile ¤º®e¬O§_¥¿½T¥H¤Î + package ¬O§_¦³¥¿½T©R¦W¡C ´£¥æ(Submit) port ­º¥ý¡A½Ð½T»{¬O§_¦³ÁA¸Ñ DOs and DON'Ts ¸Ó³¹³¡¤À¡C ²{¦b§A«Ü°ª¿³²×©ó¥´³y¥X port ¨ÓÅo¡A°ß¤@³Ñ¤U­n°µªº´N¬O§â¥¦¥¿¦¡©ñ¨ì FreeBSD ports tree ¤º¡A¤~¯àÅý¨C­Ó¤H³£¯à¤À¨É¨Ï¥Î³o­Ó port¡C½Ð¥ý®³±¼ work ¥Ø¿ý©ÎÀɦW¹³¬O pkgname.tgz ªº package ¥i¥H¬å±¼¡C±µµÛ¡A¥u­n¥Î shar `find port_dir` ¨Ó²£¥Í shar ®æ¦¡¡A¨Ã°t¦X &man.send-pr.1; µ{¦¡¥H´£¥æ¥X¥h¡C (&man.send-pr.1; ªº³¡¤À¥i¥H°Ñ¾\ - ¿ù»~³ø§i©M·N¨£µoªí) °O±o¦b¶ñ¼g PR ®É¡y¤ÀÃþ(Category)¡z¿ï - ports ÁÙ¦³¡yºØÃþ(Class)¡z¶ñ change-request + ¿ù»~³ø§i©M·N¨£µoªí) + + °O±o¦b¶ñ¼g PR ®É¡y¤ÀÃþ(Category)¡z¿ï ports¡AÁÙ¦³¡yºØÃþ(Class)¡z¶ñ change-request (¤d¸U§O¶Ì¶Ì¦a§â¸Ó PR ªº¡yConfidential(¾÷±K)¡z³]¬° yes¡I)¡A¦¹¥~¦b¡y´y­z(Description)¡z ¨ºÃä¼g¤W¸Óµ{¦¡ªºÂ²¼ä»¡©ú¡A¦Ó shar ÀÉ«hªþ¦b¡y­×¥¿(Fix)¡zÄæ¦ì¤º¡C - You can make our work a lot easier, if you use a good - description in the synopsis of the problem report. - We prefer something like + ­Y Synopsis Äæ²M·¡´y­z¸Ó PR ­«ÂIªº¸Ü¡A¨º»ò·|Åý¾ã­Ó¬yµ{§ó¬°¶¶ºZ¡C + new ports ªº¸Ü¡A§Ú­Ì²ßºD¥Î¡G New port: <category>/<portname> - <short description of the port> for new ports and + <¸Ó port ªºÂ²¤¶> ¡A¦Ó§ó·s port ªº¸Ü¡A«h¬O Update port: <category>/<portname> - <short description of the update> for port updates. - If you stick to this scheme, the chance that someone will take a - look at your PR soon is much better. + <¥»¦¸ update ªºÂ²¤¶>¡C + ­Y§A¤]±Ä¥Î³o¼Ëªº®æ¦¡ªº¸Ü¡A¨º»ò·|³Q¨ü²zªº¾÷·|´N·|¶V°ªÅo¡C - One more time, do not include the original source - distfile, the work directory, or the package - you built with make package. - - After you have submitted your port, please be patient. - Sometimes it can take a few months before a port is included - in FreeBSD, although it might only take a few days. You can - view the list of ports - waiting to be committed to FreeBSD. - - Once we have looked at your port, we will get back to you if necessary, and put - it in the tree. Your name will also appear in the list of - Additional FreeBSD Contributors - and other files. Isn't that great?!? :-) Slow Porting - Ok...¨Æ¹ê¤W¨Ã¤£¤Ó¥i¯à³o»ò²³æ¡Aport¤è­±¥i¯à»Ý­n§@¨Ç­×§ï¤~¯à¥¿±`¨Ï¥Î¡C + Ok...¨Æ¹ê¤W¨Ã¤£¤Ó¥i¯à³o»ò²³æ¡Aport ¤è­±¥i¯à»Ý­n§@¨Ç­×§ï¤~¯à¥¿±`¨Ï¥Î¡C ¦]¦¹¡A¥»¸`±N¤@¨B¤@¨B¨Ó¤¶²Ð¦p¦ó­×§ï¤W¤@³¹ªº¼Ë¥»¥H¥¿±`¨Ï¥Î¡C How things work - First, this is the sequence of events which occurs when the user - first types make in your port's directory. - You may find that having bsd.port.mk in another - window while you read this really helps to understand it. + ­º¥ý¡A¥ý¤¶²Ð¤@¤U¦b§A©Ò§@ªº port ¥Ø¿ý¤º¥´ make ®É¡A©Ò·|§@­þ¨Ç¨Æ±¡ªº¶¶§Ç§a¡C + §A¥i¥H¥t¶}¤@µ¡¨Ó¬Ý bsd.port.mk ¤º®e¡A¥H«KÁA¸Ñ§Ú­Ì¤U­±¦bÁ¿¤°»ò¡C ¦ý§O¤Ó¾á¤ß¬O§_§¹¥þ¬ÝÀ´ bsd.port.mk ¦b°µÔ£¡A«Ü¦h¤H³£ÁÙ¨S§¹¥þ¬Ý§¹... :-> - The fetch target is run. The - fetch target is responsible for making - sure that the tarball exists locally in - DISTDIR. If fetch - cannot find the required files in DISTDIR it - will look up the URL MASTER_SITES, which is - set in the Makefile, as well as our main FTP site at , - where we put sanctioned distfiles as backup. It will then - attempt to fetch the named distribution file with - FETCH, assuming that the requesting site has - direct access to the Internet. If that succeeds, it will save - the file in DISTDIR for future use and - proceed. + ­º¥ý¡A¶i¦æ fetch ¶¥¬q¡C + fetch ¬O½T»{ tarball Àɦ³¨S¦³¤w¦b + DISTDIR ¤º¤F¡H­Y fetch + ¦b DISTDIR §ä¤£¨ìªº¸Ü¡A¥¦·|·j´M Makefile ¤ºªº MASTER_SITES URL + ¡A©ÎªÌ¬O¥D FTP ¯¸±Mªù©ñ³Æ¥÷ distfiles ªº¥Ø¿ý ¡C + °²³]³£§ä¤£¨ìªº¸Ü¡A¦ý¬Oºô¸ô¦³±µ¤W Internet ªº¸Ü¡A¥¦·|¸ÕµÛ¥Î FETCH ¨Ó§ì©Ò«ü©wªºÀɮסC + §ì¨ì¤§«á¡A¥¦·|§âÀɮצs¨ì DISTDIR ¥H«K¶}©l¨Ï¥Î©Î¤é«á¹B¥Î¡C - The extract target is run. It - looks for your port's distribution file (typically a gzip'd - tarball) in DISTDIR and unpacks it into a - temporary subdirectory specified by WRKDIR - (defaults to work). + ¨ä¦¸¡A¶i¦æ extract ¶¥¬q¡A¥¦·|±q DISTDIR ¤º§ä¥X¸Ó port + ©Ò»ÝªºÀÉ®×(³q±`¬O gzip ®æ¦¡ªº tarball)¡AµM«á¸ÑÀ£ÁY¨ì WRKDIR ©Ò³]©wªºÁ{®É¥Ø¿ý¦WºÙ + (¹w³]¬O work ¥Ø¿ý)¤º¡C - The patch target is run. First, - any patches defined in PATCHFILES are - applied. Second, if any patch files named - patch-* are found in - PATCHDIR (defaults to the - files subdirectory), they are applied at - this time in alphabetical order. + ¤§«á¡A¶i¦æ patch ¶¥¬q¡A¤@¶}©l·|¥ý®M¥Î PATCHFILES + «ü©wªº¥ô¦ó patch ÀÉ¡C + ±µµÛ¡A¬O PATCHDIR(¹w³]¬O files ¤l¥Ø¿ý) ¤ºªºÀɦW¬° + patch-* ¤§ÃþªºÀɮסA·|¥H¦r¥À¶¶§Ç¦Ó³v¤@®M¥Î patch¡C - The configure target is run. This - can do any one of many different things. + ±µµÛ¬O configure ¶¥¬q¡A¥i¥H·Ó port ªºÃþ«¬¨Ó§@¦UºØ¤£¦P³]©w¥H½Õ¾ã¡A¤ñ¦p¡G - If it exists, scripts/configure is - run. + ­Y¦³©ñ scripts/configure ªº¸Ü¡A¨º»ò´N·|¶]¸Ì­±ªº³]©w¡C - If HAS_CONFIGURE or - GNU_CONFIGURE is set, - WRKSRC/configure is - run. + ­Y¦³³] HAS_CONFIGURE ©Î¬O + GNU_CONFIGURE ªº¸Ü¡A¨º»ò´N·|¶] + WRKSRC/configure - If USE_IMAKE is set, - XMKMF (default: xmkmf - -a) is run. + ­Y¦³³] USE_IMAKE ªº¸Ü¡A¨º»ò´N·|¶] + XMKMF (¹w³]¬O xmkmf + -a) ¡C - The build target is run. This is - responsible for descending into the port's private working - directory (WRKSRC) and building it. If - USE_GMAKE is set, GNU make - will be used, otherwise the system make will - be used. + ³Ì«á¬O build ¶¥¬q¡A¥¦·|¦b¸Ó + port ªº working directory(¥Ñ WRKSRC ©Ò³]©w) ¤º¶}©l½sĶ¡C + ­Y¦³³] USE_GMAKE ªº¸Ü¡A¨º»ò´N·|§ï¥Î GNU make + ¨Ó½sĶ¡A§_«h´N¥Î¨t²Î¥»¨­ªº make ¨Ó½sĶ¡C - The above are the default actions. In addition, you can define - targets - pre-something or - post-something, - or put scripts with those names, in the scripts - subdirectory, and they will be run before or after the default - actions are done. - - For example, if you have a post-extract - target defined in your Makefile, and a file - pre-build in the scripts - subdirectory, the post-extract target will - be called after the regular extraction actions, and the - pre-build script will be executed before the - default build rules are done. It is recommended that you use - Makefile targets if the actions are simple - enough, because it will be easier for someone to figure out what - kind of non-default action the port requires. - - The default actions are done by the - bsd.port.mk targets - do-something. - For example, the commands to extract a port are in the target - do-extract. If you are not happy with the - default target, you can fix it by redefining the - do-something - target in your Makefile. + ¤W­±Á¿ªº³£¬O¥´ make ®Éªº¹w³]¶¥¬q¡C + ¦¹¥~¡AÁÙ¥i¥H³]©w¦U¶¥¬q¤§«e¡B¤§«á­n§@ªº¨Æ±¡¡G³z¹L©w¸q + pre-something ©Î + post-something¡A + ©ÎªÌ§â³o¨ÇÀɦWªº script ¥á¨ì scripts ¤l¥Ø¿ý¥h¡A + ³o¼Ë¤l¥¦­Ì´N·|¦b¦U¹w³]¶¥¬qªº¤§«e¡B¤§«á¶i¦æÅo¡C + + Á|¨Ò¨Ó»¡¡A­Y¦b Makefile ¤º³]©w post-extract + ¡A¦Ó¥B¦b scripts ¤l¥Ø¿ý¤º¤S¦³ pre-build Àɪº¸Ü¡A + ¨º»ò¦b§@¸ÑÀ£ÁY¤§«á¡A´N·|¶}©l post-extract ¶¥¬q¥H¶i¦æ¸ÑÀ£ÁY«áªº«áÄò°Ê§@¡A + ¦Ó¦b¶] build ¶¥¬q¤§«e¡A´N·|¥ý°õ¦æ pre-build ³o°¦ script §@¥ý´Á·Ç³Æ¡C + ³q±`¸û²³æªº­×§ï°Ê§@¡A«Øijª½±µ©ñ¦b Makefile + ¤º´N¦n¤F¡A¦]¬°³o¼Ë·|¤ñ¸û¤è«K¥[¤W³o¨Ç­ì¥»¨S¦³ªº¶¥¬q¡A¦P®É¤]¤è«K¥L¤H¨ó§U°£¿ù¡C + + ¹w³]ªº¦U¶¥¬q°Ê§@³£¬O·Ó + bsd.port.mk ¤ºªº + do-something ¤§Ãþ©Ò©w¸qªº¡C + Á|¨Ò¡Gdo-extract ´N¬O©w¸q«ç»ò§âÀɮ׸ÑÀ£ÁYªº¡C + ­Y¹ï¹w³]¤è¦¡Ä±±o¤£§´ªº¸Ü¡A³£¥i¥H¦b¸Ó port ªº Makefile ­«·s©w¸q¡C The main targets (e.g., extract, configure, etc.) do nothing more than make sure all the stages up to that one are completed and call the real targets or scripts, and they are not intended to be changed. If you want to fix the extraction, fix do-extract, but never ever change the way extract operates! - Now that you understand what goes on when the user types - make, let us go through the recommended steps to - create the perfect port. + ²{¦b¡A§A¤w¸gª¾¹D¥´ make ¨ì©³·|§@¨Ç¤°»ò¨ÆÅo¡A±µ¤U¨Ó·|±Ð§A¦p¦ó§@§ó§¹¬üªº + port¡C - Getting the original sources - - Get the original sources (normally) as a compressed tarball - (foo.tar.gz or - foo.tar.Z) and copy - it into DISTDIR. Always use - mainstream sources when and where you - can. + ¨ú±o­ì©lªº source ÀÉ + + ¨ú±o­ì©lªº source ÀÉ(³q±`ÀɦW¬O foo.tar.gz + ©Î foo.tar.Z ¤§ÃþªºÀ£ÁYÀÉ)¡A + µM«á·|§â§ì¤U¨ÓªºÀɮשñ¦b DISTDIR ¤º¡C + °O±o¡G§ìªº®É­Ô¡A¾¨¶q¨Ï¥Î¡y¥D¬y¯¸¡z¤W­±ªº¨Ó·½ÀÉ¡A¥H½T«OÀɮצ³®Ä¡B¥i«H¡C You will need to set the variable MASTER_SITES to reflect where the original tarball resides. You will find convenient shorthand definitions for most mainstream sites in bsd.sites.mk. Please use these sites—and the associated definitions—if at all possible, to help avoid the problem of having the same information repeated over again many times in the source base. As these sites tend to change over time, this becomes a maintenance nightmare for everyone involved. If you cannot find a FTP/HTTP site that is well-connected to the net, or can only find sites that have irritatingly non-standard formats, you might want to put a copy on a reliable FTP or HTTP server that you control (e.g., your home page). If you cannot find somewhere convenient and reliable to put the distfile we can house it ourselves on ftp.FreeBSD.org; however, this is the least-preferred solution. The distfile must be placed into ~/public_distfiles/ of someone's freefall account. Ask the person who commits your port to do this. This person will also set MASTER_SITES to MASTER_SITE_LOCAL and MASTER_SITE_SUBDIR to their freefall username. If your port's distfile changes all the time without any kind of version update by the author, consider putting the distfile on your home page and listing it as the first MASTER_SITES. If you can, try to talk the port author out of doing this; it really does help to establish some kind of source code control. Hosting your own version will prevent users from getting checksum mismatch errors, and also reduce the workload of maintainers of our FTP site. Also, if there is only one master site for the port, it is recommended that you house a backup at your site and list it as the second MASTER_SITES. If your port requires some additional `patches' that are available on the Internet, fetch them too and put them in DISTDIR. Do not worry if they come from a site other than where you got the main source tarball, we have a way to handle these situations (see the description of PATCHFILES below). Modifying the port Unpack a copy of the tarball in a private directory and make whatever changes are necessary to get the port to compile properly under the current version of FreeBSD. Keep careful track of everything you do, as you will be automating the process shortly. Everything, including the deletion, addition, or modification of files should be doable using an automated script or patch file when your port is finished. If your port requires significant user interaction/customization to compile or install, you should take a look at one of Larry Wall's classic Configure scripts and perhaps do something similar yourself. The goal of the new ports collection is to make each port as plug-and-play as possible for the end-user while using a minimum of disk space. Unless explicitly stated, patch files, scripts, and other files you have created and contributed to the FreeBSD ports collection are assumed to be covered by the standard BSD copyright conditions. Patching In the preparation of the port, files that have been added or changed can be picked up with a &man.diff.1; for later feeding to &man.patch.1;. Each patch you wish to apply should be saved into a file named patch-* where * indicates the pathname of the file that is patched, such as patch-Imakefile or patch-src-config.h. These files should be stored in PATCHDIR (usually files/, from where they will be automatically applied. All patches must be relative to WRKSRC (generally the directory your port's tarball unpacks itself into, that being where the build is done). To make fixes and upgrades easier, you should avoid having more than one patch fix the same file (e.g., patch-file and patch-file2 both changing WRKSRC/foobar.c). Please only use characters [-+._a-zA-Z0-9] for naming your patches. Do not use any other characters besides them. Do not name your patches like patch-aa or patch-ab etc, always mention path and file name in patch names. Do not put RCS strings in patches. CVS will mangle them when we put the files into the ports tree, and when we check them out again, they will come out different and the patch will fail. RCS strings are surrounded by dollar ($) signs, and typically start with $Id or $RCS. Using the recurse () option to &man.diff.1; to generate patches is fine, but please take a look at the resulting patches to make sure you do not have any unnecessary junk in there. In particular, diffs between two backup files, Makefiles when the port uses Imake or GNU configure, etc., are unnecessary and should be deleted. If you had to edit configure.in and run autoconf to regenerate configure, do not take the diffs of configure (it often grows to a few thousand lines!); define USE_AUTOTOOLS=autoconf:253 and take the diffs of configure.in. If you had to delete a file, then you can do it in the post-extract target rather than as part of the patch. Simple replacements can be performed directly from the port Makefile using the in-place mode of &man.sed.1;. This is very useful when you need to patch in a variable value. Example: post-patch: @${REINPLACE_CMD} -e 's|for Linux|for FreeBSD|g' ${WRKSRC}/README @${REINPLACE_CMD} -e 's|-pthread|${PTHREAD_LIBS}|' ${WRKSRC}/configure Quite often, there is a situation when the software being ported, especially if it is primarily developed on &windows;, uses the CR/LF convention for most of its source files. This may cause problems with further patching, compiler warnings, scripts execution (/bin/sh^M not found), etc. To quickly convert all files from CR/LF to just LF, add USE_DOS2UNIX=yes to the port Makefile. A list of files to convert can be specified: USE_DOS2UNIX= util.c util.h Configuring Include any additional customization commands in your configure script and save it in the scripts subdirectory. As mentioned above, you can also do this with Makefile targets and/or scripts with the name pre-configure or post-configure. Handling user input If your port requires user input to build, configure, or install, you must set IS_INTERACTIVE in your Makefile. This will allow overnight builds to skip your port if the user sets the variable BATCH in his environment (and if the user sets the variable INTERACTIVE, then only those ports requiring interaction are built). This will save a lot of wasted time on the set of machines that continually build ports (see below). It is also recommended that if there are reasonable default answers to the questions, you check the PACKAGE_BUILDING variable and turn off the interactive script when it is set. This will allow us to build the packages for CDROMs and FTP. Configuring the Makefile Configuring the Makefile is pretty simple, and again we suggest that you look at existing examples before starting. Also, there is a sample Makefile in this handbook, so take a look and please follow the ordering of variables and sections in that template to make your port easier for others to read. Now, consider the following problems in sequence as you design your new Makefile: The original source Does it live in DISTDIR as a standard gzip'd tarball named something like foozolix-1.2.tar.gz? If so, you can go on to the next step. If not, you should look at overriding any of the DISTVERSION, DISTNAME, EXTRACT_CMD, EXTRACT_BEFORE_ARGS, EXTRACT_AFTER_ARGS, EXTRACT_SUFX, or DISTFILES variables, depending on how alien a format your port's distribution file is. (The most common case is EXTRACT_SUFX=.tar.Z, when the tarball is condensed by regular compress, not gzip.) In the worst case, you can simply create your own do-extract target to override the default, though this should be rarely, if ever, necessary. Naming The first part of the port's Makefile names the port, describes its version number, and lists it in the correct category. <makevar>PORTNAME</makevar> and <makevar>PORTVERSION</makevar> You should set PORTNAME to the base name of your port, and PORTVERSION to the version number of the port. <makevar>PORTREVISION</makevar> and <makevar>PORTEPOCH</makevar> <makevar>PORTREVISION</makevar> The PORTREVISION variable is a monotonically increasing value which is reset to 0 with every increase of PORTVERSION (i.e. every time a new official vendor release is made), and appended to the package name if non-zero. Changes to PORTREVISION are used by automated tools (e.g. &man.pkg.version.1;) to highlight the fact that a new package is available. PORTREVISION should be increased each time a change is made to the port which significantly affects the content or structure of the derived package. Examples of when PORTREVISION should be bumped: Addition of patches to correct security vulnerabilities, bugs, or to add new functionality to the port. Changes to the port Makefile to enable or disable compile-time options in the package. Changes in the packing list or the install-time behavior of the package (e.g. change to a script which generates initial data for the package, like ssh host keys). Version bump of a port's shared library dependency (in this case, someone trying to install the old package after installing a newer version of the dependency will fail since it will look for the old libfoo.x instead of libfoo.(x+1)). Silent changes to the port distfile which have significant functional differences, i.e. changes to the distfile requiring a correction to distinfo with no corresponding change to PORTVERSION, where a diff -ru of the old and new versions shows non-trivial changes to the code. Examples of changes which do not require a PORTREVISION bump: Style changes to the port skeleton with no functional change to what appears in the resulting package. Changes to MASTER_SITES or other functional changes to the port which do not affect the resulting package. Trivial patches to the distfile such as correction of typos, which are not important enough that users of the package should go to the trouble of upgrading. Build fixes which cause a package to become compilable where it was previously failing (as long as the changes do not introduce any functional change on any other platforms on which the port did previously build). Since PORTREVISION reflects the content of the package, if the package was not previously buildable then there is no need to increase PORTREVISION to mark a change. A rule of thumb is to ask yourself whether a change committed to a port is something which everyone would benefit from having (either because of an enhancement, fix, or by virtue that the new package will actually work at all), and weigh that against that fact that it will cause everyone who regularly updates their ports tree to be compelled to update. If yes, the PORTREVISION should be bumped. <makevar>PORTEPOCH</makevar> From time to time a software vendor or FreeBSD porter will do something silly and release a version of their software which is actually numerically less than the previous version. An example of this is a port which goes from foo-20000801 to foo-1.0 (the former will be incorrectly treated as a newer version since 20000801 is a numerically greater value than 1). In situations such as this, the PORTEPOCH version should be increased. If PORTEPOCH is nonzero it is appended to the package name as described in section 0 above. PORTEPOCH must never be decreased or reset to zero, because that would cause comparison to a package from an earlier epoch to fail (i.e. the package would not be detected as out of date): the new version number (e.g. 1.0,1 in the above example) is still numerically less than the previous version (20000801), but the ,1 suffix is treated specially by automated tools and found to be greater than the implied suffix ,0 on the earlier package. Dropping or resetting PORTEPOCH incorrectly leads to no end of grief; if you do not understand the above discussion, please keep after it until you do, or ask questions on the mailing lists. It is expected that PORTEPOCH will not be used for the majority of ports, and that sensible use of PORTVERSION can often pre-empt it becoming necessary if a future release of the software should change the version structure. However, care is needed by FreeBSD porters when a vendor release is made without an official version number — such as a code snapshot release. The temptation is to label the release with the release date, which will cause problems as in the example above when a new official release is made. For example, if a snapshot release is made on the date 20000917, and the previous version of the software was version 1.2, the snapshot release should be given a PORTVERSION of 1.2.20000917 or similar, not 20000917, so that the succeeding release, say 1.3, is still a numerically greater value. Example of <makevar>PORTREVISION</makevar> and <makevar>PORTEPOCH</makevar> usage The gtkmumble port, version 0.10, is committed to the ports collection: PORTNAME= gtkmumble PORTVERSION= 0.10 PKGNAME becomes gtkmumble-0.10. A security hole is discovered which requires a local FreeBSD patch. PORTREVISION is bumped accordingly. PORTNAME= gtkmumble PORTVERSION= 0.10 PORTREVISION= 1 PKGNAME becomes gtkmumble-0.10_1 A new version is released by the vendor, numbered 0.2 (it turns out the author actually intended 0.10 to actually mean 0.1.0, not what comes after 0.9 - oops, too late now). Since the new minor version 2 is numerically less than the previous version 10, the PORTEPOCH must be bumped to manually force the new package to be detected as newer. Since it is a new vendor release of the code, PORTREVISION is reset to 0 (or removed from the Makefile). PORTNAME= gtkmumble PORTVERSION= 0.2 PORTEPOCH= 1 PKGNAME becomes gtkmumble-0.2,1 The next release is 0.3. Since PORTEPOCH never decreases, the version variables are now: PORTNAME= gtkmumble PORTVERSION= 0.3 PORTEPOCH= 1 PKGNAME becomes gtkmumble-0.3,1 If PORTEPOCH were reset to 0 with this upgrade, someone who had installed the gtkmumble-0.10_1 package would not detect the gtkmumble-0.3 package as newer, since 3 is still numerically less than 10. Remember, this is the whole point of PORTEPOCH in the first place. <makevar>PKGNAMEPREFIX</makevar> and <makevar>PKGNAMESUFFIX</makevar> Two optional variables, PKGNAMEPREFIX and PKGNAMESUFFIX, are combined with PORTNAME and PORTVERSION to form PKGNAME as ${PKGNAMEPREFIX}${PORTNAME}${PKGNAMESUFFIX}-${PORTVERSION}. Make sure this conforms to our guidelines for a good package name. In particular, you are not allowed to use a hyphen (-) in PORTVERSION. Also, if the package name has the language- or the -compiled.specifics part (see below), use PKGNAMEPREFIX and PKGNAMESUFFIX, respectively. Do not make them part of PORTNAME. Package Naming Conventions The following are the conventions you should follow in naming your packages. This is to have our package directory easy to scan, as there are already thousands of packages and users are going to turn away if they hurt their eyes! The package name should look like language_region-name-compiled.specifics-version.numbers. The package name is defined as ${PKGNAMEPREFIX}${PORTNAME}${PKGNAMESUFFIX}-${PORTVERSION}. Make sure to set the variables to conform to that format. FreeBSD strives to support the native language of its users. The language- part should be a two letter abbreviation of the natural language defined by ISO-639 if the port is specific to a certain language. Examples are ja for Japanese, ru for Russian, vi for Vietnamese, zh for Chinese, ko for Korean and de for German. If the port is specific to a certain region within the language area, add the two letter country code as well. Examples are en_US for US English and fr_CH for Swiss French. The language- part should be set in the PKGNAMEPREFIX variable. The first letter of name part should be lowercase. (The rest of the name can contain capital letters, so use your own discretion when you are converting a software name that has some capital letters in it.) There is a tradition of naming perl 5 modules by prepending p5- and converting the double-colon separator to a hyphen; for example, the Data::Dumper module becomes p5-Data-Dumper. If the software in question has numbers, hyphens, or underscores in its name, you may include them as well (like kinput2). If the port can be built with different hardcoded defaults (usually part of the directory name in a family of ports), the -compiled.specifics part should state the compiled-in defaults (the hyphen is optional). Examples are papersize and font units. The -compiled.specifics part should be set in the PKGNAMESUFFIX variable. The version string should follow a dash (-) and be a period-separated list of integers and single lowercase alphabetics. In particular, it is not permissible to have another dash inside the version string. The only exception is the string pl (meaning patchlevel), which can be used only when there are no major and minor version numbers in the software. If the software version has strings like alpha, beta, rc, or pre, take the first letter and put it immediately after a period. If the version string continues after those names, the numbers should follow the single alphabet without an extra period between them. The idea is to make it easier to sort ports by looking at the version string. In particular, make sure version number components are always delimited by a period, and if the date is part of the string, use the yyyy.mm.dd format, not dd.mm.yyyy or the non-Y2K compliant yy.mm.dd format. Here are some (real) examples on how to convert the name as called by the software authors to a suitable package name: Distribution Name PKGNAMEPREFIX PORTNAME PKGNAMESUFFIX PORTVERSION Reason mule-2.2.2 (empty) mule (empty) 2.2.2 No changes required XFree86-3.3.6 (empty) XFree86 (empty) 3.3.6 No changes required EmiClock-1.0.2 (empty) emiclock (empty) 1.0.2 No uppercase names for single programs rdist-1.3alpha (empty) rdist (empty) 1.3.a No strings like alpha allowed es-0.9-beta1 (empty) es (empty) 0.9.b1 No strings like beta allowed mailman-2.0rc3 (empty) mailman (empty) 2.0.r3 No strings like rc allowed v3.3beta021.src (empty) tiff (empty) 3.3 What the heck was that anyway? tvtwm (empty) tvtwm (empty) pl11 Version string always required piewm (empty) piewm (empty) 1.0 Version string always required xvgr-2.10pl1 (empty) xvgr (empty) 2.10.1 pl allowed only when no major/minor version numbers gawk-2.15.6 ja- gawk (empty) 2.15.6 Japanese language version psutils-1.13 (empty) psutils -letter 1.13 Papersize hardcoded at package build time pkfonts (empty) pkfonts 300 1.0 Package for 300dpi fonts If there is absolutely no trace of version information in the original source and it is unlikely that the original author will ever release another version, just set the version string to 1.0 (like the piewm example above). Otherwise, ask the original author or use the date string (yyyy.mm.dd) as the version. Categorization <makevar>CATEGORIES</makevar> When a package is created, it is put under /usr/ports/packages/All and links are made from one or more subdirectories of /usr/ports/packages. The names of these subdirectories are specified by the variable CATEGORIES. It is intended to make life easier for the user when he is wading through the pile of packages on the FTP site or the CDROM. Please take a look at the current list of categories and pick the ones that are suitable for your port. This list also determines where in the ports tree the port is imported. If you put more than one category here, it is assumed that the port files will be put in the subdirectory with the name in the first category. See below for more discussion about how to pick the right categories. Current list of categories Here is the current list of port categories. Those marked with an asterisk (*) are virtual categories—those that do not have a corresponding subdirectory in the ports tree. They are only used as secondary categories, and only for search purposes. For non-virtual categories, you will find a one-line description in the COMMENT in that subdirectory's Makefile. Category Description Notes accessibility Ports to help disabled users. afterstep* Ports to support the AfterStep window manager. arabic Arabic language support. archivers Archiving tools. astro Astronomical ports. audio Sound support. benchmarks Benchmarking utilities. biology Biology-related software. cad Computer aided design tools. chinese Chinese language support. comms Communication software. Mostly software to talk to your serial port. converters Character code converters. databases Databases. deskutils Things that used to be on the desktop before computers were invented. devel Development utilities. Do not put libraries here just because they are libraries—unless they truly do not belong anywhere else, they should not be in this category. dns DNS-related software. editors General editors. Specialized editors go in the section for those tools (e.g., a mathematical-formula editor will go in math). elisp* Emacs-lisp ports. emulators Emulators for other operating systems. Terminal emulators do not belong here—X-based ones should go to x11 and text-based ones to either comms or misc, depending on the exact functionality. finance Monetary, financial and related applications. french French language support. ftp FTP client and server utilities. If your port speaks both FTP and HTTP, put it in ftp with a secondary category of www. games Games. german German language support. gnome* Ports from the GNOME Project. graphics Graphics utilities. hamradio* Software for amateur radio. haskell* Software related to the Haskell language. hebrew Hebrew language support. hungarian Hungarian language support. ipv6* IPv6 related software. irc Internet Relay Chat utilities. japanese Japanese language support. java Software related to the Java language. The java category shall not be the only one for a port. Save for ports directly related to the Java language, porters are also encouraged not to use java as the main category of a port. kde* Ports from the K Desktop Environment (KDE) Project. korean Korean language support. lang Programming languages. linux* Linux applications and support utilities. lisp* Software related to the Lisp language. mail Mail software. math Numerical computation software and other utilities for mathematics. mbone MBone applications. misc Miscellaneous utilities Basically things that do not belong anywhere else. If at all possible, try to find a better category for your port than misc, as ports tend to get overlooked in here. multimedia Multimedia software. net Miscellaneous networking software. net-im Instant messaging software. net-mgmt Networking management software. net-p2p Peer to peer network applications. news USENET news software. palm Software support for the Palm™ series. parallel* Applications dealing with parallelism in computing. pear* Ports related to the Pear PHP framework. perl5* Ports that require Perl version 5 to run. plan9* Various programs from Plan9. polish Polish language support. portuguese Portuguese language support. print Printing software. Desktop publishing tools (previewers, etc.) belong here too. python* Software related to the Python language. ruby* Software related to the Ruby language. rubygems* Ports of RubyGems packages. russian Russian language support. scheme* Software related to the Scheme language. science Scientific ports that do not fit into other categories such as astro, biology and math. security Security utilities. shells Command line shells. sysutils System utilities. tcl80* Ports that use Tcl version 8.0 to run. tcl81* Ports that use Tcl version 8.1 to run. tcl82* Ports that use Tcl version 8.2 to run. tcl83* Ports that use Tcl version 8.3 to run. tcl84* Ports that use Tcl version 8.4 to run. textproc Text processing utilities. It does not include desktop publishing tools, which go to print. tk80* Ports that use Tk version 8.0 to run. tk82* Ports that use Tk version 8.2 to run. tk83* Ports that use Tk version 8.3 to run. tk84* Ports that use Tk version 8.4 to run. tkstep80* Ports that use TkSTEP version 8.0 to run. ukrainian Ukrainian language support. vietnamese Vietnamese language support. windowmaker* Ports to support the WindowMaker window manager. www Software related to the World Wide Web. HTML language support belongs here too. x11 The X Window System and friends. This category is only for software that directly supports the window system. Do not put regular X applications here; most of them should go into other x11-* categories (see below). If your port is an X application, define USE_XLIB (implied by USE_IMAKE) and put it in the appropriate category. x11-clocks X11 clocks. x11-fm X11 file managers. x11-fonts X11 fonts and font utilities. x11-servers X11 servers. x11-themes X11 themes. x11-toolkits X11 toolkits. x11-wm X11 window managers. xfce* Ports relating to the Xfce desktop environment. zope* Zope support. Choosing the right category As many of the categories overlap, you often have to choose which of the categories should be the primary category of your port. There are several rules that govern this issue. Here is the list of priorities, in decreasing order of precedence: The first category must be a physical category (see above). This is necessary to make the packaging work. Virtual categories and physical categories may be intermixed after that. Language specific categories always come first. For example, if your port installs Japanese X11 fonts, then your CATEGORIES line would read japanese x11-fonts. Specific categories are listed before less-specific ones. For instance, an HTML editor should be listed as www editors, not the other way around. Also, you should not list net when the port belongs to any of irc, mail, mbone, news, security, or www, as net is included implicitly. x11 is used as a secondary category only when the primary category is a natural language. In particular, you should not put x11 in the category line for X applications. Emacs modes should be placed in the same ports category as the application supported by the mode, not in editors. For example, an Emacs mode to edit source files of some programming language should go into lang. misc should not appear with any other non-virtual category. If you have misc with something else in your CATEGORIES line, that means you can safely delete misc and just put the port in that other subdirectory! If your port truly does not belong anywhere else, put it in misc. If you are not sure about the category, please put a comment to that effect in your &man.send-pr.1; submission so we can discuss it before we import it. If you are a committer, send a note to the &a.ports; so we can discuss it first. Too often, new ports are imported to the wrong category only to be moved right away. This causes unnecessary and undesirable bloat in the master source repository. Proposing a new category As the Ports Collection has grown over time, various new categories have been introduced. New categories can either be virtual categories—those that do not have a corresponding subdirectory in the ports tree— or physical categories—those that do. The following text discusses the issues involved in creating a new physical category so that you can understand them before you propose one. Our existing practice has been to avoid creating a new physical category unless either a large number of ports would logically belong to it, or the ports that would belong to it are a logically distinct group that is of limited general interest (for instance, categories related to spoken human languages), or preferably both. The rationale for this is that such a change creates a fair amount of work for both the committers and also for all users who track changes to the Ports Collection. In addition, proposed category changes just naturally seem to attract controversy. (Perhaps this is because there is no clear consensus on when a category is too big, nor whether categories should lend themselves to browsing (and thus what number of categories would be an ideal number), and so forth.) Here is the procedure: Propose the new category on &a.ports;. You should include a detailed rationale for the new category, including why you feel the existing categories are not sufficient, and the list of existing ports proposed to move. (If there are new ports pending in GNATS that would fit this category, list them too.) If you are the maintainer and/or submitter, respectively, mention that as it may help you to make your case. Participate in the discussion. If it seems that there is support for your idea, file a PR which includes both the rationale and the list of existing ports that need to be moved. Ideally, this PR should also include patches for the following: Makefiles for the new ports once they are repocopied Makefile for the new category Makefile for the old ports' categories Makefiles for ports that depend on the old ports (for extra credit, you can include the other files that have to change, as per the procedure in the Committer's Guide.) Since it affects the ports infrastructure and involves not only performing repo-copies but also possibly running regression tests on the build cluster, the PR should be assigned to the &a.portmgr;. If that PR is approved, a committer will need to follow the rest of the procedure that is outlined in the Committer's Guide. Proposing a new virtual category should be similar to the above but much less involved, since no ports will actually have to move. In this case, the only patches to include in the PR would be those to add the new category to the CATEGORIESs of the affected ports. Proposing reorganizing all the categories Occasionally someone proposes reorganizing the categories with either a 2-level structure, or some other kind of keyword structure. To date, nothing has come of any of these proposals because, while they are very easy to make, the effort involved to retrofit the entire existing ports collection with any kind of reorganization is daunting to say the very least. Please read the history of these proposals in the mailing list archives before you post this idea; furthermore, you should be prepared to be challenged to offer a working prototype. The distribution files The second part of the Makefile describes the files that must be downloaded in order to build the port, and where they can be downloaded from. <makevar>DISTVERSION/DISTNAME</makevar> DISTNAME is the name of the port as called by the authors of the software. DISTNAME defaults to ${PORTNAME}-${PORTVERSION}, so override it only if necessary. DISTNAME is only used in two places. First, the distribution file list (DISTFILES) defaults to ${DISTNAME}${EXTRACT_SUFX}. Second, the distribution file is expected to extract into a subdirectory named WRKSRC, which defaults to work/${DISTNAME}. Some vendor's distribution names which do not fit into the ${PORTNAME}-${PORTVERSION}-scheme can be handled automatically by setting DISTVERSION. PORTVERSION and DISTNAME will be derived automatically, but can of course be overridden. The following table lists some examples: DISTVERSION PORTVERSION 0.7.1d 0.7.1.d 10Alpha3 10.a3 3Beta7-pre2 3.b7.p2 8:f_17 8f.17 PKGNAMEPREFIX and PKGNAMESUFFIX do not affect DISTNAME. Also note that if WRKSRC is equal to work/${PORTNAME}-${PORTVERSION} while the original source archive is named something other than ${PORTNAME}-${PORTVERSION}${EXTRACT_SUFX}, you should probably leave DISTNAME alone— you are better off defining DISTFILES than having to set both DISTNAME and WRKSRC (and possibly EXTRACT_SUFX). <makevar>MASTER_SITES</makevar> Record the directory part of the FTP/HTTP-URL pointing at the original tarball in MASTER_SITES. Do not forget the trailing slash (/)! The make macros will try to use this specification for grabbing the distribution file with FETCH if they cannot find it already on the system. It is recommended that you put multiple sites on this list, preferably from different continents. This will safeguard against wide-area network problems. We are even planning to add support for automatically determining the closest master site and fetching from there; having multiple sites will go a long way towards helping this effort. If the original tarball is part of one of the popular archives such as X-contrib, GNU, or Perl CPAN, you may be able refer to those sites in an easy compact form using MASTER_SITE_* (e.g., MASTER_SITE_XCONTRIB and MASTER_SITE_PERL_GNU). Simply set MASTER_SITES to one of these variables and MASTER_SITE_SUBDIR to the path within the archive. Here is an example: MASTER_SITES= ${MASTER_SITE_XCONTRIB} MASTER_SITE_SUBDIR= applications These variables are defined in /usr/ports/Mk/bsd.sites.mk. There are new entries added all the time, so make sure to check the latest version of this file before submitting a port. The user can also set the MASTER_SITE_* variables in /etc/make.conf to override our choices, and use their favorite mirrors of these popular archives instead. <makevar>EXTRACT_SUFX</makevar> If you have one distribution file, and it uses an odd suffix to indicate the compression mechanism, set EXTRACT_SUFX. For example, if the distribution file was named foo.tgz instead of the more normal foo.tar.gz, you would write: DISTNAME= foo EXTRACT_SUFX= .tgz The USE_BZIP2 and USE_ZIP variables automatically set EXTRACT_SUFX to .tar.bz2 or .zip as necessary. If neither of these are set then EXTRACT_SUFX defaults to .tar.gz. You never need to set both EXTRACT_SUFX and DISTFILES. <makevar>DISTFILES</makevar> Sometimes the names of the files to be downloaded have no resemblance to the name of the port. For example, it might be called source.tar.gz or similar. In other cases the application's source code might be in several different archives, all of which must be downloaded. If this is the case, set DISTFILES to be a space separated list of all the files that must be downloaded. DISTFILES= source1.tar.gz source2.tar.gz If not explicitly set, DISTFILES defaults to ${DISTNAME}${EXTRACT_SUFX}. <makevar>EXTRACT_ONLY</makevar> If only some of the DISTFILES must be extracted—for example, one of them is the source code, while another is an uncompressed document—list the filenames that must be extracted in EXTRACT_ONLY. DISTFILES= source.tar.gz manual.html EXTRACT_ONLY= source.tar.gz If none of the DISTFILES should be uncompressed then set EXTRACT_ONLY to the empty string. EXTRACT_ONLY= <makevar>PATCHFILES</makevar> If your port requires some additional patches that are available by FTP or HTTP, set PATCHFILES to the names of the files and PATCH_SITES to the URL of the directory that contains them (the format is the same as MASTER_SITES). If the patch is not relative to the top of the source tree (i.e., WRKSRC) because it contains some extra pathnames, set PATCH_DIST_STRIP accordingly. For instance, if all the pathnames in the patch have an extra foozolix-1.0/ in front of the filenames, then set PATCH_DIST_STRIP=-p1. Do not worry if the patches are compressed; they will be decompressed automatically if the filenames end with .gz or .Z. If the patch is distributed with some other files, such as documentation, in a gzip'd tarball, you cannot just use PATCHFILES. If that is the case, add the name and the location of the patch tarball to DISTFILES and MASTER_SITES. Then, use the EXTRA_PATCHES variable to point to those files and bsd.port.mk will automatically apply them for you. In particular, do not copy patch files into the PATCHDIR directory—that directory may not be writable. The tarball will have been extracted alongside the regular source by then, so there is no need to explicitly extract it if it is a regular gzip'd or compress'd tarball. If you do the latter, take extra care not to overwrite something that already exists in that directory. Also, do not forget to add a command to remove the copied patch in the pre-clean target. Multiple distribution files or patches from different sites and subdirectories (<literal>MASTER_SITES:n</literal>) (Consider this to be a somewhat advanced topic; those new to this document may wish to skip this section at first). This section has information on the fetching mechanism known as both MASTER_SITES:n and MASTER_SITES_NN. We will refer to this mechanism as MASTER_SITES:n hereon. A little background first. OpenBSD has a neat feature inside both DISTFILES and PATCHFILES variables, both files and patches can be postfixed with :n identifiers where n both can be [0-9] and denote a group designation. For example: DISTFILES= alpha:0 beta:1 In OpenBSD, distribution file alpha will be associated with variable MASTER_SITES0 instead of our common MASTER_SITES and beta with MASTER_SITES1. This is a very interesting feature which can decrease that endless search for the correct download site. Just picture 2 files in DISTFILES and 20 sites in MASTER_SITES, the sites slow as hell where beta is carried by all sites in MASTER_SITES, and alpha can only be found in the 20th site. It would be such a waste to check all of them if maintainer knew this beforehand, would it not? Not a good start for that lovely weekend! Now that you have the idea, just imagine more DISTFILES and more MASTER_SITES. Surely our distfiles survey meister would appreciate the relief to network strain that this would bring. In the next sections, information will follow on the FreeBSD implementation of this idea. We improved a bit on OpenBSD's concept. Simplified information This section tells you how to quickly prepare fine grained fetching of multiple distribution files and patches from different sites and subdirectories. We describe here a case of simplified MASTER_SITES:n usage. This will be sufficient for most scenarios. However, if you need further information, you will have to refer to the next section. Some applications consist of multiple distribution files that must be downloaded from a number of different sites. For example, Ghostscript consists of the core of the program, and then a large number of driver files that are used depending on the user's printer. Some of these driver files are supplied with the core, but many others must be downloaded from a variety of different sites. To support this, each entry in DISTFILES may be followed by a colon and a tag name. Each site listed in MASTER_SITES is then followed by a colon, and the tag that indicates which distribution files should be downloaded from this site. For example, consider an application with the source split in two parts, source1.tar.gz and source2.tar.gz, which must be downloaded from two different sites. The port's Makefile would include lines like . Simplified use of <literal>MASTER_SITES:n</literal> with 1 file per site MASTER_SITES= ftp://ftp.example1.com/:source1 \ ftp://ftp.example2.com/:source2 DISTFILES= source1.tar.gz:source1 \ source2.tar.gz:source2 Multiple distribution files can have the same tag. Continuing the previous example, suppose that there was a third distfile, source3.tar.gz, that should be downloaded from ftp.example2.com. The Makefile would then be written like . Simplified use of <literal>MASTER_SITES:n</literal> with more than 1 file per site MASTER_SITES= ftp://ftp.example1.com/:source1 \ ftp://ftp.example2.com/:source2 DISTFILES= source1.tar.gz:source1 \ source2.tar.gz:source2 \ source3.tar.gz:source2 Detailed information Okay, so the previous section example did not reflect your needs? In this section we will explain in detail how the fine grained fetching mechanism MASTER_SITES:n works and how you can modify your ports to use it. Elements can be postfixed with :n where n is [^:,]+, i.e., n could conceptually be any alphanumeric string but we will limit it to [a-zA-Z_][0-9a-zA-Z_]+ for now. Moreover, string matching is case sensitive; i.e., n is different from N. However, the following words cannot be used for postfixing purposes since they yield special meaning: default, all and ALL (they are used internally in item ). Furthermore, DEFAULT is a special purpose word (check item ). Elements postfixed with :n belong to the group n, :m belong to group m and so forth. Elements without a postfix are groupless, i.e., they all belong to the special group DEFAULT. If you postfix any elements with DEFAULT, you are just being redundant unless you want to have an element belonging to both DEFAULT and other groups at the same time (check item ). The following examples are equivalent but the first one is preferred: MASTER_SITES= alpha MASTER_SITES= alpha:DEFAULT Groups are not exclusive, an element may belong to several different groups at the same time and a group can either have either several different elements or none at all. Repeated elements within the same group will be simply that, repeated elements. When you want an element to belong to several groups at the same time, you can use the comma operator (,). Instead of repeating it several times, each time with a different postfix, we can list several groups at once in a single postfix. For instance, :m,n,o marks an element that belongs to group m, n and o. All the following examples are equivalent but the last one is preferred: MASTER_SITES= alpha alpha:SOME_SITE MASTER_SITES= alpha:DEFAULT alpha:SOME_SITE MASTER_SITES= alpha:SOME_SITE,DEFAULT MASTER_SITES= alpha:DEFAULT,SOME_SITE All sites within a given group are sorted according to MASTER_SORT_AWK. All groups within MASTER_SITES and PATCH_SITES are sorted as well. Group semantics can be used in any of the following variables MASTER_SITES, PATCH_SITES, MASTER_SITE_SUBDIR, PATCH_SITE_SUBDIR, DISTFILES, and PATCHFILES according to the following syntax: All MASTER_SITES, PATCH_SITES, MASTER_SITE_SUBDIR and PATCH_SITE_SUBDIR elements must be terminated with the forward slash / character. If any elements belong to any groups, the group postfix :n must come right after the terminator /. The MASTER_SITES:n mechanism relies on the existence of the terminator / to avoid confusing elements where a :n is a valid part of the element with occurrences where :n denotes group n. For compatibility purposes, since the / terminator was not required before in both MASTER_SITE_SUBDIR and PATCH_SITE_SUBDIR elements, if the postfix immediate preceding character is not a / then :n will be considered a valid part of the element instead of a group postfix even if an element is postfixed with :n. See both and . Detailed use of <literal>MASTER_SITES:n</literal> in <makevar>MASTER_SITE_SUBDIR</makevar> MASTER_SITE_SUBDIR= old:n new/:NEW Directories within group DEFAULT -> old:n Directories within group NEW -> new Detailed use of <literal>MASTER_SITES:n</literal> with comma operator, multiple files, multiple sites and multiple subdirectories MASTER_SITES= http://site1/%SUBDIR%/ http://site2/:DEFAULT \ http://site3/:group3 http://site4/:group4 \ http://site5/:group5 http://site6/:group6 \ http://site7/:DEFAULT,group6 \ http://site8/%SUBDIR%/:group6,group7 \ http://site9/:group8 DISTFILES= file1 file2:DEFAULT file3:group3 \ file4:group4,group5,group6 file5:grouping \ file6:group7 MASTER_SITE_SUBDIR= directory-trial:1 directory-n/:groupn \ directory-one/:group6,DEFAULT \ directory The previous example results in the following fine grained fetching. Sites are listed in the exact order they will be used. file1 will be fetched from MASTER_SITE_OVERRIDE http://site1/directory-trial:1/ http://site1/directory-one/ http://site1/directory/ http://site2/ http://site7/ MASTER_SITE_BACKUP file2 will be fetched exactly as file1 since they both belong to the same group MASTER_SITE_OVERRIDE http://site1/directory-trial:1/ http://site1/directory-one/ http://site1/directory/ http://site2/ http://site7/ MASTER_SITE_BACKUP file3 will be fetched from MASTER_SITE_OVERRIDE http://site3/ MASTER_SITE_BACKUP file4 will be fetched from MASTER_SITE_OVERRIDE http://site4/ http://site5/ http://site6/ http://site7/ http://site8/directory-one/ MASTER_SITE_BACKUP file5 will be fetched from MASTER_SITE_OVERRIDE MASTER_SITE_BACKUP file6 will be fetched from MASTER_SITE_OVERRIDE http://site8/ MASTER_SITE_BACKUP How do I group one of the special variables from bsd.sites.mk, e.g., MASTER_SITE_SOURCEFORGE? See . Detailed use of <literal>MASTER_SITES:n</literal> with <makevar>MASTER_SITE_SOURCEFORGE</makevar> MASTER_SITES= http://site1/ ${MASTER_SITE_SOURCEFORGE:S/$/:sourceforge,TEST/} DISTFILES= something.tar.gz:sourceforge something.tar.gz will be fetched from all sites within MASTER_SITE_SOURCEFORGE. How do I use this with PATCH* variables? All examples were done with MASTER* variables but they work exactly the same for PATCH* ones as can be seen in . Simplified use of <literal>MASTER_SITES:n</literal> with <makevar>PATCH_SITES</makevar>. PATCH_SITES= http://site1/ http://site2/:test PATCHFILES= patch1:test What does change for ports? What does not? All current ports remain the same. The MASTER_SITES:n feature code is only activated if there are elements postfixed with :n like elements according to the aforementioned syntax rules, especially as shown in item . The port targets remain the same: checksum, makesum, patch, configure, build, etc. With the obvious exceptions of do-fetch, fetch-list, master-sites and patch-sites. do-fetch: deploys the new grouping postfixed DISTFILES and PATCHFILES with their matching group elements within both MASTER_SITES and PATCH_SITES which use matching group elements within both MASTER_SITE_SUBDIR and PATCH_SITE_SUBDIR. Check . fetch-list: works like old fetch-list with the exception that it groups just like do-fetch. master-sites and patch-sites: (incompatible with older versions) only return the elements of group DEFAULT; in fact, they execute targets master-sites-default and patch-sites-default respectively. Furthermore, using target either master-sites-all or patch-sites-all is preferred to directly checking either MASTER_SITES or PATCH_SITES. Also, directly checking is not guaranteed to work in any future versions. Check item for more information on these new port targets. New port targets There are master-sites-n and patch-sites-n targets which will list the elements of the respective group n within MASTER_SITES and PATCH_SITES respectively. For instance, both master-sites-DEFAULT and patch-sites-DEFAULT will return the elements of group DEFAULT, master-sites-test and patch-sites-test of group test, and thereon. There are new targets master-sites-all and patch-sites-all which do the work of the old master-sites and patch-sites ones. They return the elements of all groups as if they all belonged to the same group with the caveat that it lists as many MASTER_SITE_BACKUP and MASTER_SITE_OVERRIDE as there are groups defined within either DISTFILES or PATCHFILES; respectively for master-sites-all and patch-sites-all. <makevar>DIST_SUBDIR</makevar> Do not let your port clutter /usr/ports/distfiles. If your port requires a lot of files to be fetched, or contains a file that has a name that might conflict with other ports (e.g., Makefile), set DIST_SUBDIR to the name of the port (${PORTNAME} or ${PKGNAMEPREFIX}${PORTNAME} should work fine). This will change DISTDIR from the default /usr/ports/distfiles to /usr/ports/distfiles/DIST_SUBDIR, and in effect puts everything that is required for your port into that subdirectory. It will also look at the subdirectory with the same name on the backup master site at ftp.FreeBSD.org. (Setting DISTDIR explicitly in your Makefile will not accomplish this, so please use DIST_SUBDIR.) This does not affect the MASTER_SITES you define in your Makefile. <makevar>ALWAYS_KEEP_DISTFILES</makevar> If your port uses binary distfiles and has a license that requires that the source code is provided with packages distributed in binary form, e.g. GPL, ALWAYS_KEEP_DISTFILES will instruct the &os; build cluster to keep a copy of the files specified in DISTFILES. Users of these ports will generally not need these files, so it is a good idea to only add the source distfiles to DISTFILES when PACKAGE_BUILDING is defined. Use of <makevar>ALWAYS_KEEP_DISTFILES</makevar>. .if defined(PACKAGE_BUILDING) DISTFILES+= foo.tar.gz ALWAYS_KEEP_DISTFILES= yes .endif When adding extra files to DISTFILES, make sure you also add them to distinfo. Also, the additional files will normally be extracted into WRKDIR as well, which for some ports may lead to undesirable sideeffects and require special handling. <makevar>MAINTAINER</makevar> Set your mail-address here. Please. :-) Note that only a single address without the comment part is allowed as a MAINTAINER value. The format used should be user@hostname.domain. Please do not include any descriptive text such as your real name in this entry—that merely confuses bsd.port.mk. The maintainer is responsible for keeping the port up to date, and ensuring the port works correctly. For a detailed description of the responsibilities of a port maintainer, refer to the The challenge for port maintainers section. Changes to the port will be sent to the maintainer of a port for a review and an approval before being committed. If the maintainer does not respond to an update request after two weeks (excluding major public holidays), then that is considered a maintainer timeout, and the update may be made without explicit maintainer approval. If the maintainer does not respond within three months, then that maintainer is considered absent without leave, and can be replaced as the maintainer of the particular port in question. Exceptions to this are anything maintained by the &a.portmgr;, or the &a.security-officer;. No unauthorized commits may ever be made to ports maintained by those groups. We reserve the right to modify the maintainer's submission to better match existing policies and style of the Ports Collection without explicit blessing from the submitter. Also, large infrastructural changes can result in a port being modified without maintainer's consent. This kind of changes will never affect the port's functionality. The &a.portmgr; reserves the right to revoke or override anyone's maintainership for any reason, and the &a.security-officer; reserves the right to revoke or override maintainership for security reasons. <makevar>COMMENT</makevar> This is a one-line description of the port. Please do not include the package name (or version number of the software) in the comment. The comment should begin with a capital and end without a period. Here is an example: COMMENT= A cat chasing a mouse all over the screen The COMMENT variable should immediately follow the MAINTAINER variable in the Makefile. Please try to keep the COMMENT line less than 70 characters, as it is displayed to users as a one-line summary of the port. Dependencies Many ports depend on other ports. There are seven variables that you can use to ensure that all the required bits will be on the user's machine. There are also some pre-supported dependency variables for common cases, plus a few more to control the behavior of dependencies. <makevar>LIB_DEPENDS</makevar> This variable specifies the shared libraries this port depends on. It is a list of lib:dir:target tuples where lib is the name of the shared library, dir is the directory in which to find it in case it is not available, and target is the target to call in that directory. For example, LIB_DEPENDS= jpeg.9:${PORTSDIR}/graphics/jpeg will check for a shared jpeg library with major version 9, and descend into the graphics/jpeg subdirectory of your ports tree to build and install it if it is not found. The target part can be omitted if it is equal to DEPENDS_TARGET (which defaults to install). The lib part is a regular expression which is being looked up in the ldconfig -r output. Values such as intl.[5-7] and intl are allowed. The first pattern, intl.[5-7], will match any of: intl.5, intl.6 or intl.7. The second pattern, intl, will match any version of the intl library. The dependency is checked twice, once from within the extract target and then from within the install target. Also, the name of the dependency is put into the package so that &man.pkg.add.1; will automatically install it if it is not on the user's system. <makevar>RUN_DEPENDS</makevar> This variable specifies executables or files this port depends on during run-time. It is a list of path:dir:target tuples where path is the name of the executable or file, dir is the directory in which to find it in case it is not available, and target is the target to call in that directory. If path starts with a slash (/), it is treated as a file and its existence is tested with test -e; otherwise, it is assumed to be an executable, and which -s is used to determine if the program exists in the search path. For example, RUN_DEPENDS= ${LOCALBASE}/etc/innd:${PORTSDIR}/news/inn \ wish8.0:${PORTSDIR}/x11-toolkits/tk80 will check if the file or directory /usr/local/etc/innd exists, and build and install it from the news/inn subdirectory of the ports tree if it is not found. It will also see if an executable called wish8.0 is in the search path, and descend into the x11-toolkits/tk80 subdirectory of your ports tree to build and install it if it is not found. In this case, innd is actually an executable; if an executable is in a place that is not expected to be in the search path, you should use the full pathname. The official search PATH used on the ports build cluster is /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin The dependency is checked from within the install target. Also, the name of the dependency is put into the package so that &man.pkg.add.1; will automatically install it if it is not on the user's system. The target part can be omitted if it is the same as DEPENDS_TARGET. <makevar>BUILD_DEPENDS</makevar> This variable specifies executables or files this port requires to build. Like RUN_DEPENDS, it is a list of path:dir:target tuples. For example, BUILD_DEPENDS= unzip:${PORTSDIR}/archivers/unzip will check for an executable called unzip, and descend into the archivers/unzip subdirectory of your ports tree to build and install it if it is not found. build here means everything from extraction to compilation. The dependency is checked from within the extract target. The target part can be omitted if it is the same as DEPENDS_TARGET <makevar>FETCH_DEPENDS</makevar> This variable specifies executables or files this port requires to fetch. Like the previous two, it is a list of path:dir:target tuples. For example, FETCH_DEPENDS= ncftp2:${PORTSDIR}/net/ncftp2 will check for an executable called ncftp2, and descend into the net/ncftp2 subdirectory of your ports tree to build and install it if it is not found. The dependency is checked from within the fetch target. The target part can be omitted if it is the same as DEPENDS_TARGET. <makevar>EXTRACT_DEPENDS</makevar> This variable specifies executables or files this port requires for extraction. Like the previous, it is a list of path:dir:target tuples. For example, EXTRACT_DEPENDS= unzip:${PORTSDIR}/archivers/unzip will check for an executable called unzip, and descend into the archivers/unzip subdirectory of your ports tree to build and install it if it is not found. The dependency is checked from within the extract target. The target part can be omitted if it is the same as DEPENDS_TARGET. Use this variable only if the extraction does not already work (the default assumes gzip) and cannot be made to work using USE_ZIP or USE_BZIP2 described in . <makevar>PATCH_DEPENDS</makevar> This variable specifies executables or files this port requires to patch. Like the previous, it is a list of path:dir:target tuples. For example, PATCH_DEPENDS= ${NONEXISTENT}:${PORTSDIR}/java/jfc:extract will descend into the java/jfc subdirectory of your ports tree to extract it. The dependency is checked from within the patch target. The target part can be omitted if it is the same as DEPENDS_TARGET. <makevar>PERL_BUILD_DEPENDS</makevar> and <makevar>PERL_RUN_DEPENDS</makevar> These variables allow you to specify dependencies on Perl modules. For example, PERL_RUN_DEPENDS= MIME-Base64:${PORTSDIR}/converters/p5-MIME-Base64 will check for the MIME::Base64 Perl module (note the replacement of :: with -) and install it if it is missing. <makevar>DEPENDS</makevar> If there is a dependency that does not fall into either of the above categories, or your port requires having the source of the other port extracted in addition to having it installed, then use this variable. This is a list of dir:target, as there is nothing to check, unlike the previous four. The target part can be omitted if it is the same as DEPENDS_TARGET. <makevar>USE_<replaceable>*</replaceable></makevar> A number of variables exist in order to encapsulate common dependencies that many ports have. Although their use is optional, they can help to reduce the verbosity of the port Makefiles. Each of them is styled as USE_*. The usage of these variables is restricted to the port Makefiles and ports/Mk/bsd.*.mk and is not designed to encapsulate user-settable options — use WITH_* and WITHOUT_* for that purpose. It is always incorrect to set any USE_* in /etc/make.conf. For instance, setting USE_GCC=3.2 would adds a dependency on gcc32 for every port, including gcc32 itself! The <makevar>USE_<replaceable>*</replaceable></makevar> variables Variable Means USE_BZIP2 The port's tarballs are compressed with bzip2. USE_ZIP The port's tarballs are compressed with zip. USE_BISON The port uses bison for building. USE_GCC The port requires a specific version of gcc to build. The exact version can be specified with value such as 3.2. The minimal required version can be specified as 3.2+. The gcc from the base system is used when it satisfies the requested version, otherwise an appropriate gcc is compiled from ports and the CC and CXX variables are adjusted. USE_GCC can't be used together with USE_AUTOTOOLS=libtool:XX.
Variables related to gmake and the configure script are described in , while autoconf, automake and libtool are described in . Perl related variables are described in . X11 variables are listed in . deals with GNOME and with KDE related variables. documents Java variables, while contains information on Apache, PHP and PEAR modules. Python is discussed in , while Ruby in . Finally, provides variables used for SDL applications.
Minimal version of a dependency A minimal version of a dependency can be specified in any *_DEPENDS variable using the following syntax: p5-Spiffy>=0.26:${PORTSDIR}/devel/p5-Spiffy The first field contains a dependent package name, which must match the entry in the package database, a comparison sign, and a package version. The dependency is satisfied if p5-Spiffy-0.26 or newer is installed on the machine. Notes on dependencies As mentioned above, the default target to call when a dependency is required is DEPENDS_TARGET. It defaults to install. This is a user variable; it is never defined in a port's Makefile. If your port needs a special way to handle a dependency, use the :target part of the *_DEPENDS variables instead of redefining DEPENDS_TARGET. When you type make clean, its dependencies are automatically cleaned too. If you do not wish this to happen, define the variable NOCLEANDEPENDS in your environment. This may be particularly desirable if the port has something that takes a long time to rebuild in its dependency list, such as KDE, GNOME or Mozilla. To depend on another port unconditionally, use the variable ${NONEXISTENT} as the first field of BUILD_DEPENDS or RUN_DEPENDS. Use this only when you need to get the source of the other port. You can often save compilation time by specifying the target too. For instance BUILD_DEPENDS= ${NONEXISTENT}:${PORTSDIR}/graphics/jpeg:extract will always descend to the jpeg port and extract it. Do not use DEPENDS unless there is no other way the behavior you want can be accomplished. It will cause the other port to always be built (and installed, by default), and the dependency will go into the packages as well. If this is really what you need, you should probably write it as BUILD_DEPENDS and RUN_DEPENDS instead—at least the intention will be clear. Circular dependencies are fatal Do not introduce any circular dependencies into the ports tree! The ports building technology does not tolerate circular dependencies. If you introduce one, you will have someone, somewhere in the world, whose FreeBSD installation will break almost immediately, with many others quickly to follow. These can really be hard to detect; if in doubt, before you make that change, make sure you have done the following: cd /usr/ports; make index. That process can be quite slow on older machines, but you may be able to save a large number of people—including yourself— a lot of grief in the process.
<makevar>MASTERDIR</makevar> If your port needs to build slightly different versions of packages by having a variable (for instance, resolution, or paper size) take different values, create one subdirectory per package to make it easier for users to see what to do, but try to share as many files as possible between ports. Typically you only need a very short Makefile in all but one of the directories if you use variables cleverly. In the sole Makefile, you can use MASTERDIR to specify the directory where the rest of the files are. Also, use a variable as part of PKGNAMESUFFIX so the packages will have different names. This will be best demonstrated by an example. This is part of japanese/xdvi300/Makefile; PORTNAME= xdvi PORTVERSION= 17 PKGNAMEPREFIX= ja- PKGNAMESUFFIX= ${RESOLUTION} : # default RESOLUTION?= 300 .if ${RESOLUTION} != 118 && ${RESOLUTION} != 240 && \ ${RESOLUTION} != 300 && ${RESOLUTION} != 400 @${ECHO} "Error: invalid value for RESOLUTION: \"${RESOLUTION}\"" @${ECHO} "Possible values are: 118, 240, 300 (default) and 400." @${FALSE} .endif japanese/xdvi300 also has all the regular patches, package files, etc. If you type make there, it will take the default value for the resolution (300) and build the port normally. As for other resolutions, this is the entire xdvi118/Makefile: RESOLUTION= 118 MASTERDIR= ${.CURDIR}/../xdvi300 .include "${MASTERDIR}/Makefile" (xdvi240/Makefile and xdvi400/Makefile are similar). The MASTERDIR definition tells bsd.port.mk that the regular set of subdirectories like FILESDIR and SCRIPTDIR are to be found under xdvi300. The RESOLUTION=118 line will override the RESOLUTION=300 line in xdvi300/Makefile and the port will be built with resolution set to 118. Manpages The MAN[1-9LN] variables will automatically add any manpages to pkg-plist (this means you must not list manpages in the pkg-plist—see generating PLIST for more). It also makes the install stage automatically compress or uncompress manpages depending on the setting of NOMANCOMPRESS in /etc/make.conf. If your port tries to install multiple names for manpages using symlinks or hardlinks, you must use the MLINKS variable to identify these. The link installed by your port will be destroyed and recreated by bsd.port.mk to make sure it points to the correct file. Any manpages listed in MLINKS must not be listed in the pkg-plist. To specify whether the manpages are compressed upon installation, use the MANCOMPRESSED variable. This variable can take three values, yes, no and maybe. yes means manpages are already installed compressed, no means they are not, and maybe means the software already respects the value of NOMANCOMPRESS so bsd.port.mk does not have to do anything special. MANCOMPRESSED is automatically set to yes if USE_IMAKE is set and NO_INSTALL_MANPAGES is not set, and to no otherwise. You do not have to explicitly define it unless the default is not suitable for your port. If your port anchors its man tree somewhere other than PREFIX, you can use the MANPREFIX to set it. Also, if only manpages in certain sections go in a non-standard place, such as some perl modules ports, you can set individual man paths using MANsectPREFIX (where sect is one of 1-9, L or N). If your manpages go to language-specific subdirectories, set the name of the languages to MANLANG. The value of this variable defaults to "" (i.e., English only). Here is an example that puts it all together. MAN1= foo.1 MAN3= bar.3 MAN4= baz.4 MLINKS= foo.1 alt-name.8 MANLANG= "" ja MAN3PREFIX= ${PREFIX}/share/foobar MANCOMPRESSED= yes This states that six files are installed by this port; ${PREFIX}/man/man1/foo.1.gz ${PREFIX}/man/ja/man1/foo.1.gz ${PREFIX}/share/foobar/man/man3/bar.3.gz ${PREFIX}/share/foobar/man/ja/man3/bar.3.gz ${PREFIX}/man/man4/baz.4.gz ${PREFIX}/man/ja/man4/baz.4.gz Additionally ${PREFIX}/man/man8/alt-name.8.gz may or may not be installed by your port. Regardless, a symlink will be made to join the foo(1) manpage and alt-name(8) manpage. Info files If your package needs to install GNU info files, they should be listed in the INFO variable (without the trailing .info), and appropriate installation/de-installation code will be automatically added to the temporary pkg-plist before package registration. Makefile Options Some large applications can be built in a number of configurations, adding functionality if one of a number of libraries or applications is available. Examples include choice of natural (human) language, GUI versus command-line, or type of database to support. Since not all users want those libraries or applications, the ports system provides hooks that the port author can use to control which configuration should be built. Supporting these properly will make users happy, and effectively provide 2 or more ports for the price of one. <makevar>KNOBS</makevar> <makevar>WITH_<replaceable>*</replaceable></makevar> and <makevar>WITHOUT_<replaceable>*</replaceable></makevar> These variables are designed to be set by the system administrator. There are many that are standardized in ports/Mk/bsd.*.mk; others are not, which can be confusing. If you need to add such a configuration variable, please consider using one of the ones from the following list. You should not assume that a WITH_* necessarily has a corresponding WITHOUT_* variable and vice versa. In general, the default is simply assumed. Unless otherwise specified, these variables are only tested for being set or not set, rather than being set to some kind of variable such as YES or NO. The <makevar>WITH_<replaceable>*</replaceable></makevar> and <makevar>WITHOUT_<replaceable>*</replaceable></makevar> variables Variable Means WITH_APACHE2 If set, use www/apache2 instead of the default of www/apache. WITH_BERKELEY_DB Define this variable to specify the ability to use a variant of the Berkeley database package such as databases/db41. An associated variable, WITH_BDB_VER, may be set to values such as 2, 3, 4, 41 or 42. WITH_MYSQL Define this variable to specify the ability to use a variant of the MySQL database package such as databases/mysql40-server. An associated variable, WANT_MYSQL_VER, may be set to values such as 323, 40, 41, or 50. WITHOUT_NLS If set, says that internationalization is not needed, which can save compile time. By default, internationalization is used. WITH_OPENSSL_BASE Use the version of OpenSSL in the base system. WITH_OPENSSL_PORT Use the version of OpenSSL from security/openssh, overwriting the version that was originally installed in the base system. WITH_POSTGRESQL Define this variable to specify the ability to use a variant of the PostGreSQL database package such as databases/postgresql72. WITHOUT_X11 If the port can be built both with and without X support, then it should normally be built with X support. If this variable is defined, then the version that does not have X support should be built instead.
Knob naming It is recommended that porters use like-named knobs, for the benefit of end-users and to help keep the number of knob names down. A list of popular knob names can be found in the KNOBS file. Knob names should reflect what the knob is and does. When a port has a lib-prefix in the PORTNAME the lib-prefix should be dropped in knob naming.
<makevar>OPTIONS</makevar> Background The OPTIONS variable gives the user who installs the port a dialog with the available options and saves them to /var/db/ports/portname/options. Next time when the port has to be rebuild, the options are reused. Never again you will have to remember all the twenty WITH_* and WITHOUT_* options you used to build this port! When the user runs make config (or runs make build for the first time), the framework will check for /var/db/ports/portname/options. If that file does not exist, it will use the values of OPTIONS to create a dialogbox where the options can be enabled or disabled. Then the options file is saved and the selected variables will be used when building the port. Use make showconfig to see the saved configuration. Use make rmconfig to remove the saved configuration. Syntax The syntax for the OPTIONS variable is: OPTIONS= OPTION "descriptive text" default ... The value for default is either ON or OFF. Multiple repetitions of these three fields are allowed. OPTIONS definition must appear before the inclusion of bsd.port.pre.mk. The WITH_* and WITHOUT_* variables can only be tested after the inclusion of bsd.port.pre.mk. Due to a deficiency in the infrastructure, you can only test WITH_* variables for options, which are OFF by default, and WITHOUT_* variables for options, which defaults to ON. Example Simple use of <makevar>OPTIONS</makevar> OPTIONS= FOO "Enable option foo" On \ BAR "Support feature bar" Off .include <bsd.port.pre.mk> .if defined(WITHOUT_FOO) CONFIGURE_ARGS+= --without-foo .else CONFIGURE_ARGS+= --with-foo .endif .if defined(WITH_BAR) RUN_DEPENDS+= bar:${PORTSDIR}/bar/bar .endif .include <bsd.port.post.mk>
Specifying the working directory Each port is extracted in to a working directory, which must be writable. The ports system defaults to having the DISTFILES unpack in to a directory called ${DISTNAME}. In other words, if you have set: PORTNAME= foo PORTVERSION= 1.0 then the port's distribution files contain a top-level directory, foo-1.0, and the rest of the files are located under that directory. There are a number of variables you can override if that is not the case. <makevar>WRKSRC</makevar> The variable lists the name of the directory that is created when the application's distfiles are extracted. If our previous example extracted into a directory called foo (and not foo-1.0) you would write: WRKSRC= ${WRKDIR}/foo or possibly WRKSRC= ${WRKDIR}/${PORTNAME} <makevar>NO_WRKSUBDIR</makevar> If the port does not extract in to a subdirectory at all then you should set NO_WRKSUBDIR to indicate that. NO_WRKSUBDIR= yes <makevar>CONFLICTS</makevar> If your package cannot coexist with other packages (because of file conflicts, runtime incompatibility, etc.), list the other package names in the CONFLICTS variable. You can use shell globs like * and ? here. Packages names should be enumerated the same way they appear in /var/db/pkg. Please make sure that CONFLICTS does not match this port's package itself, or else forcing its installation with FORCE_PKG_REGISTER will no longer work. CONFLICTS automatically sets IGNORE, which is more fully documented in .
Special considerations There are some more things you have to take into account when you create a port. This section explains the most common of those. Shared Libraries If your port installs one or more shared libraries, define a INSTALLS_SHLIB make variable, which will instruct a bsd.port.mk to run ${LDCONFIG} -m on the directory where the new library is installed (usually PREFIX/lib) during post-install target to register it into the shared library cache. This variable, when defined, will also facilitate addition of an appropriate @exec /sbin/ldconfig -m and @unexec /sbin/ldconfig -R pair into your pkg-plist file, so that a user who installed the package can start using the shared library immediately and de-installation will not cause the system to still believe the library is there. If you need, you can override the default location where the new library is installed by defining the LDCONFIG_DIRS make variable, which should contain a list of directories into which shared libraries are to be installed. For example if your port installs shared libraries into PREFIX/lib/foo and PREFIX/lib/bar directories you could use the following in your Makefile: INSTALLS_SHLIB= yes LDCONFIG_DIRS= %%PREFIX%%/lib/foo %%PREFIX%%/lib/bar Remember that non-standard directories will not be passed to &man.ldconfig.8; on (re-)boot! If any port really needs this to work, install a startup-script as x11/kdelibs3 does. Please double-check, often this is not necessary at all or can be avoided through -rpath or setting LD_RUN_PATH during linking (see lang/moscow_ml for an example), or through a shell-wrapper which sets LD_LIBRARY_PATH before invoking the binary, like www/mozilla does. Note that content of LDCONFIG_DIRS is passed through &man.sed.1; just like the rest of pkg-plist, so PLIST_SUB substitutions also apply here. It is recommended that you use %%PREFIX%% for PREFIX, %%LOCALBASE%% for LOCALBASE and %%X11BASE%% for X11BASE. Try to keep shared library version numbers in the libfoo.so.0 format. Our runtime linker only cares for the major (first) number. When the major library version number increments in the update to the new port version, all other ports that link to the affected library should have their PORTREVISION incremented, to force recompilation with the new library version. Ports with distribution restrictions Licenses vary, and some of them place restrictions on how the application can be packaged, whether it can be sold for profit, and so on. It is your responsibility as a porter to read the licensing terms of the software and make sure that the FreeBSD project will not be held accountable for violating them by redistributing the source or compiled binaries either via FTP/HTTP or CD-ROM. If in doubt, please contact the &a.ports;. In situations like this, the variables described in the following sections can be set. <makevar>NO_PACKAGE</makevar> This variable indicates that we may not generate a binary package of the application. For instance, the license may disallow binary redistribution, or it may prohibit distribution of packages created from patched sources. However, the port's DISTFILES may be freely mirrored on FTP/HTTP. They may also be distributed on a CD-ROM (or similar media) unless NO_CDROM is set as well. NO_PACKAGE should also be used if the binary package is not generally useful, and the application should always be compiled from the source code. For example, if the application has configuration information that is site specific hard coded in to it at compile time, set NO_PACKAGE. NO_PACKAGE should be set to a string describing the reason why the package should not be generated. <makevar>NO_CDROM</makevar> This variable alone indicates that, although we are allowed to generate binary packages, we may put neither those packages nor the port's DISTFILES onto a CD-ROM (or similar media) for resale. However, the binary packages and the port's DISTFILES will still be available via FTP/HTTP. If this variable is set along with NO_PACKAGE, then only the port's DISTFILES will be available, and only via FTP/HTTP. NO_CDROM should be set to a string describing the reason why the port cannot be redistributed on CD-ROM. For instance, this should be used if the port's license is for non-commercial use only. <makevar>NOFETCHFILES</makevar> Files defined in the NOFETCHFILES variable are not fetchable from any of the MASTER_SITES. An example of such a file is when the file is supplied on CD-ROM by the vendor. Tools which check for the availability of these files on the MASTER_SITES should ignore these files and not report about them. <makevar>RESTRICTED</makevar> Set this variable alone if the application's license permits neither mirroring the application's DISTFILES nor distributing the binary package in any way. NO_CDROM or NO_PACKAGE should not be set along with RESTRICTED since the latter variable implies the former ones. RESTRICTED should be set to a string describing the reason why the port cannot be redistributed. Typically, this indicates that the port contains proprietary software and that the user will need to manually download the DISTFILES, possibly after registering for the software or agreeing to accept the terms of an EULA. <makevar>RESTRICTED_FILES</makevar> When RESTRICTED or NO_CDROM is set, this variable defaults to ${DISTFILES} ${PATCHFILES}, otherwise it is empty. If only some of the distribution files are restricted, then set this variable to list them. Note that the port committer should add an entry to /usr/ports/LEGAL for every listed distribution file, describing exactly what the restriction entails. Building mechanisms <command>make</command>, <command>gmake</command>, and <command>imake</command> If your port uses GNU make, set USE_GMAKE=yes. Variables for ports related to gmake Variable Means USE_GMAKE The port requires gmake to build. GMAKE The full path for gmake if it is not in the PATH.
If your port is an X application that creates Makefile files from Imakefile files using imake, then set USE_IMAKE=yes. This will cause the configure stage to automatically do an xmkmf -a. If the flag is a problem for your port, set XMKMF=xmkmf. If the port uses imake but does not understand the install.man target, NO_INSTALL_MANPAGES=yes should be set. If your port's source Makefile has something else than all as the main build target, set ALL_TARGET accordingly. Same goes for install and INSTALL_TARGET.
<command>configure</command> script If your port uses the configure script to generate Makefile files from Makefile.in files, set GNU_CONFIGURE=yes. If you want to give extra arguments to the configure script (the default argument is --prefix=${PREFIX} ${CONFIGURE_TARGET}), set those extra arguments in CONFIGURE_ARGS. Extra environment variables can be passed using CONFIGURE_ENV variable. If your package uses GNU configure, and the resulting executable file has a strange name like i386-portbld-freebsd4.7-appname, you will need to additionally override the CONFIGURE_TARGET variable to specify the target in the way required by scripts generated by recent versions of autoconf. Add the following line immediately after the GNU_CONFIGURE=yes line in your Makefile: CONFIGURE_TARGET=--build=${MACHINE_ARCH}-portbld-freebsd${OSREL} Variables for ports that use configure Variable Means GNU_CONFIGURE The port uses configure script to prepare build. HAS_CONFIGURE Same as GNU_CONFIGURE, except default configure target is not added to CONFIGURE_ARGS. CONFIGURE_ARGS Additional arguments passed to configure script. CONFIGURE_ENV Additional environment variables to be set for configure script run. CONFIGURE_TARGET Override default configure target. Default value is ${MACHINE_ARCH}-portbld-freebsd${OSREL}.
Using GNU autotools Introduction The various GNU autotools provide an abstraction mechanism for building a piece of software over a wide variety of operating systems and machine architectures. Within the Ports Collection, an individual port can make use of these tools via a simple construct: USE_AUTOTOOLS= tool:version[:operation] ... At the time of writing, tool can be one of libtool, libltdl, autoconf, autoheader, automake or aclocal. version specifies the particular tool revision to be used (see devel/{automake,autoconf,libtool}[0-9]+ for valid versions). operation is an optional extension to modify how the tool is used. Multiple tools can be specified at once, either by including them all on a single line, or using the += Makefile construct. Before proceeding any further, it cannot be stressed highly enough that the constructs discussed here are for use ONLY in building other ports. For cross-development work, the devel/gnu-{automake,autoconf,libtool} ports should be used, such as within an IDE. devel/anjuta and devel/kdevelop (GNOME and KDE respectively) are good examples of how to achieve this. <command>libtool</command> Shared libraries using the GNU building framework usually use libtool to adjust the compilation and installation of shared libraries to match the specifics of the underlying operating system. The Ports Collection provides a number of versions of libtool modified for use by &os;. USE_AUTOTOOLS= libtool:version[:inc|:env] With no additional operations, libtool:version tells the building framework that the port uses libtool, implying GNU_CONFIGURE. The configure script will be patched with the system-installed copy of libtool. Further, a number of make and shell variables will be assigned for onward use by the port. See bsd.autotools.mk for details. With the :inc operation, the environment will be set up, and a slightly different set of patching will be performed. With the :env operation, only the environment will be set up. Previously USE_AUTOTOOLS construct USE_LIBTOOL_VER=13 libtool:13 USE_INC_LIBTOOL_VER=15 libtool:15:inc WANT_LIBTOOL_VER=15 libtool:15:env Finally, LIBTOOLFLAGS and LIBTOOLFILES can be optionally set to override the most likely arguments to, and files patched by, libtool. Most ports are unlikely to need this. See bsd.autotools.mk for further details. <command>libltdl</command> Some ports make use of the libltdl library package, which is part of the libtool suite. Use of this library does not automatically necessitate the use of libtool itself, so a separate construct is provided. USE_AUTOTOOLS= libltdl:version Currently, all this does is to bring in a LIB_DEPENDS on the appropriate libltdl port, and is provided as a convenience function to help eliminate any dependencies on the autotools ports outside of the USE_AUTOTOOLS framework. There are no optional operations for this tool. Previously USE_AUTOTOOLS construct USE_LIBLTDL=YES libltdl:15 <command>autoconf</command> and <command>autoheader</command> Some ports do not contain a configure script, but do contain an autoconf template in the configure.ac file. You can use the following assignments to let autoconf create the configure script, and also have autoheader create template headers for use by the configure script. USE_AUTOTOOLS= autoconf:version[:env] and USE_AUTOTOOLS= autoheader:version which also implies the use of autoconf:version. Similarly to libtool, the inclusion of the optional :env operation simply sets up the environment for further use. Without it, patching and reconfiguration of the port is carried out. Previously USE_AUTOTOOLS construct USE_AUTOCONF_VER=213 autoconf:213 WANT_AUTOCONF_VER=259 autoconf:259:env USE_AUTOHEADER_VER=253 autoheader:253 (implies autoconf:253) The additional optional variables AUTOCONF_ARGS and AUTOHEADER_ARGS can be overridden by the port Makefile if specifically requested. As with the libtool equivalents, most ports are unlikely to need this. <command>automake</command> and <command>aclocal</command> Some packages only contain Makefile.am files. These have to be converted into Makefile.in files using automake, and the further processed by configure to generate an actual Makefile. Similarly, packages occasionally do not ship with included aclocal.m4 files, again required to build the software. This can be achieved with aclocal, which scans configure.ac or configure.in. aclocal has a similar relationship to automake as autoheader does to autoconf, described in the previous section. aclocal implies the use of automake, thus we have: USE_AUTOTOOLS= automake:version[:env] and USE_AUTOTOOLS= aclocal:version which also implies the use of automake:version. Similarly to libtool and autoconf, the inclusion of the optional :env operation simply sets up the environment for further use. Without it, reconfiguration of the port is carried out. Previously USE_AUTOTOOLS construct USE_AUTOMAKE_VER=14 automake:14 WANT_AUTOMAKE_VER=15 automake:15:env USE_ACLOCAL_VER=19 aclocal:19 (implies automake:19) As with autoconf and autoheader, both automake and aclocal have optional argument variables, AUTOMAKE_ARGS and ACLOCAL_ARGS respectively, which may be overriden by the port Makefile if required. Using <literal>perl</literal> Variables for ports that use <literal>perl</literal> Variable Means USE_PERL5 Says that the port uses perl 5 to build and run. USE_PERL5_BUILD Says that the port uses perl 5 to build. USE_PERL5_RUN Says that the port uses perl 5 to run. PERL The full path of perl 5, either in the system or installed from a port, but without the version number. Use this if you need to replace #!lines in scripts. PERL_CONFIGURE Configure using Perl's MakeMaker. It implies USE_PERL5. PERL_MODBUILD Configure, build and install using Module::Build. It implies PERL_CONFIGURE. Read only variables PERL_VERSION The full version of perl installed (e.g., 5.00503). PERL_VER The short version of perl installed (e.g., 5.005). PERL_LEVEL The installed perl version as an integer of the form MNNNPP (e.g., 500503). PERL_ARCH Where perl stores architecture dependent libraries. Defaults to ${ARCH}-freebsd. PERL_PORT Name of the perl port that is installed (e.g., perl5). SITE_PERL Directory name where site specific perl packages go. This value is added to PLIST_SUB.
Ports of Perl modules, which do not have an official website, should link cpan.org in the WWW line of a pkg-descr file. The suggested URL scheme is http://search.cpan.org/dist/Module-Name.
Using X11 Variable definitions Variables for ports that use X USE_X_PREFIX The port installs in X11BASE, not PREFIX. USE_XLIB The port uses the X libraries. USE_MOTIF The port uses the Motif toolkit. Implies USE_XPM. USE_IMAKE The port uses imake. Implies USE_X_PREFIX. XMKMF Set to the path of xmkmf if not in the PATH. Defaults to xmkmf -a.
Variables for depending on individual parts of X11 X_IMAKE_PORT Port providing imake and several other utilities used to build X11. X_LIBRARIES_PORT Port providing X11 libraries. X_CLIENTS_PORT Port providing X clients. X_SERVER_PORT Port providing X server. X_FONTSERVER_PORT Port providing font server. X_PRINTSERVER_PORT Port providing print server. X_VFBSERVER_PORT Port providing virtual framebuffer server. X_NESTSERVER_PORT Port providing a nested X server. X_FONTS_ENCODINGS_PORT Port providing encodings for fonts. X_FONTS_MISC_PORT Port providing miscellaneous bitmap fonts. X_FONTS_100DPI_PORT Port providing 100dpi bitmap fonts. X_FONTS_75DPI_PORT Port providing 75dpi bitmap fonts. X_FONTS_CYRILLIC_PORT Port providing cyrillic bitmap fonts. X_FONTS_TTF_PORT Port providing &truetype; fonts. X_FONTS_TYPE1_PORT Port providing Type1 fonts. X_MANUALS_PORT Port providing developer oriented manual pages
Using X11 related variables in port # Use X11 libraries and depend on # font server as well as cyrillic fonts. RUN_DEPENDS= ${X11BASE}/bin/xfs:${X_FONTSERVER_PORT} \ ${X11BASE}/lib/X11/fonts/cyrillic/crox1c.pcf.gz:${X_FONTS_CYRILLIC_PORT} USE_XLIB= yes
Ports that require Motif If your port requires a Motif library, define USE_MOTIF in the Makefile. Default Motif implementation is x11-toolkits/open-motif. Users can choose x11-toolkits/lesstif instead by setting WANT_LESSTIF variable. The MOTIFLIB variable will be set by bsd.port.mk to reference the appropriate Motif library. Please patch the source of your port to use ${MOTIFLIB} wherever the Motif library is referenced in the original Makefile or Imakefile. There are two common cases: If the port refers to the Motif library as -lXm in its Makefile or Imakefile, simply substitute ${MOTIFLIB} for it. If the port uses XmClientLibs in its Imakefile, change it to ${MOTIFLIB} ${XTOOLLIB} ${XLIB}. Note that MOTIFLIB (usually) expands to -L/usr/X11R6/lib -lXm or /usr/X11R6/lib/libXm.a, so there is no need to add -L or -l in front. X11 fonts If your port installs fonts for the X Window System, put them in X11BASE/lib/X11/fonts/local. Getting fake <envar>DISPLAY</envar> using Xvfb Some applications require a working X11 display for compilation to succeed. This pose a problem for the FreeBSD package building cluster, which operates headless. When the following canonical hack is used, the package cluster will start the virtual framebuffer X server. The working DISPLAY is then passed to the build. .if defined(PACKAGE_BUILDING) BUILD_DEPENDS+= Xvfb:${X_VFBSERVER_PORT} \ ${X11BASE}/lib/X11/fonts/misc/8x13O.pcf.gz:${X_FONTS_MISC_PORT} .endif
Using GNOME The FreeBSD/GNOME project uses its own set of variables to define which GNOME components a particular port uses. A comprehensive list of these variables exists within the FreeBSD/GNOME project's homepage. Using KDE Variables for ports that use KDE USE_QT_VER The port uses the Qt toolkit. Possible values are 1 and 3; each specify the major version of Qt to use. Sets both MOC and QTCPPFLAGSto default appropriate values. USE_KDELIBS_VER The port uses KDE libraries. Possible values are 3; each specify the major version of KDE to use. Implies USE_QT_VER of the appropriate version. USE_KDEBASE_VER The port uses KDE base. Possible values are 3; each specify the major version of KDE to use. Implies USE_KDELIBS_VER of the appropriate version. MOC Set to the path of moc. Default set according to USE_QT_VER value. QTCPPFLAGS Set the CPPFLAGS to use when processing Qt code. Default set according to USE_QT_VER value.
Using Java Variable definitions If your port needs a Java™ Development Kit (JDK) to either build, run or even extract the distfile, then it should define USE_JAVA. There are several JDKs in the ports collection, from various vendors, and in several versions. If your port must use one of these versions, you can define which one. The most current version is java/jdk14. Variables that may be set by ports that use Java Variable Means USE_JAVA Should be defined for the remaining variables to have any effect. JAVA_VERSION List of space-separated suitable Java versions for the port. An optional "+" allows you to specify a range of versions (allowed values: 1.1[+] 1.2[+] 1.3[+] 1.4[+]). JAVA_OS List of space-separated suitable JDK port operating systems for the port (allowed values: native linux). JAVA_VENDOR List of space-separated suitable JDK port vendors for the port (allowed values: freebsd bsdjava sun ibm blackdown). JAVA_BUILD When set, it means that the selected JDK port should be added to the build dependencies of the port. JAVA_RUN When set, it means that the selected JDK port should be added to the run dependencies of the port. JAVA_EXTRACT When set, it means that the selected JDK port should be added to the extract dependencies of the port. USE_JIKES Whether the port should or should not use the jikes bytecode compiler to build. When no value is set for this variable, the port will use jikes to build if available. You may also explicitly forbid or enforce the use of jikes (by setting 'no' or 'yes'). In the later case, devel/jikes will be added to build dependencies of the port. In any case that jikes is actually used in place of javac, then the HAVE_JIKES variable is defined by bsd.java.mk.
Below is the list of all settings a port will receive after setting USE_JAVA: Variables provided to ports that use Java Variable Value JAVA_PORT The name of the JDK port (e.g. 'java/jdk14'). JAVA_PORT_VERSION The full version of the JDK port (e.g. '1.4.2'). If you only need the first two digits of this version number, use ${JAVA_PORT_VERSION:C/^([0-9])\.([0-9])(.*)$/\1.\2/}. JAVA_PORT_OS The operating system used by the JDK port (e.g. 'linux'). JAVA_PORT_VENDOR The vendor of the JDK port (e.g. 'sun'). JAVA_PORT_OS_DESCRIPTION Description of the operating system used by the JDK port (e.g. 'Linux'). JAVA_PORT_VENDOR_DESCRIPTION Description of the vendor of the JDK port (e.g. 'FreeBSD Foundation'). JAVA_HOME Path to the installation directory of the JDK (e.g. '/usr/local/jdk1.3.1'). JAVAC Path to the Java compiler to use (e.g. '/usr/local/jdk1.1.8/bin/javac' or '/usr/local/bin/jikes'). JAR Path to the jar tool to use (e.g. '/usr/local/jdk1.2.2/bin/jar' or '/usr/local/bin/fastjar'). APPLETVIEWER Path to the appletviewer utility (e.g. '/usr/local/linux-jdk1.2.2/bin/appletviewer'). JAVA Path to the java executable. Use this for executing Java programs (e.g. '/usr/local/jdk1.3.1/bin/java'). JAVADOC Path to the javadoc utility program. JAVAH Path to the javah program. JAVAP Path to the javap program. JAVA_KEYTOOL Path to the keytool utility program. This variable is available only if the JDK is Java 1.2 or higher. JAVA_N2A Path to the native2ascii tool. JAVA_POLICYTOOL Path to the policytool program. This variable is available only if the JDK is Java 1.2 or higher. JAVA_SERIALVER Path to the serialver utility program. RMIC Path to the RMI stub/skeleton generator, rmic. RMIREGISTRY Path to the RMI registry program, rmiregistry. RMID Path to the RMI daemon program rmid. This variable is only available if the JDK is Java 1.2 or higher. JAVA_CLASSES Path to the archive that contains the JDK class files. On JDK 1.2 or later, this is ${JAVA_HOME}/jre/lib/rt.jar. Earlier JDKs used ${JAVA_HOME}/lib/classes.zip. HAVE_JIKES Defined whenever jikes is used by the port (see USE_JIKES above).
You may use the java-debug make target to get information for debugging your port. It will display the value of many of the forecited variables. Additionally, the following constants are defined so all Java ports may be installed in a consistent way: Constants defined for ports that use Java Constant Value JAVASHAREDIR The base directory for everything related to Java. Default: ${PREFIX}/share/java. JAVAJARDIR The directory where JAR files should be installed. Default: ${JAVASHAREDIR}/classes. JAVALIBDIR The directory where JAR files installed by other ports are located. Default: ${LOCALBASE}/share/java/classes.
The related entries are defined in both PLIST_SUB (documented in ) and SUB_LIST.
Building with Ant When the port is to be built using Apache Ant, it has to define USE_ANT. Ant is thus considered to be the sub-make command. When no do-build target is defined by the port, a default one will be set that simply runs Ant according to MAKE_ENV, MAKE_ARGS and ALL_TARGETS. This is similar to the USE_GMAKE mechanism, which is documented in . If jikes is used in place of javac (see USE_JIKES in ), then Ant will automatically use it to build the port. Best practices When porting a Java library, your port should install the JAR file(s) in ${JAVAJARDIR}, and everything else under ${JAVASHAREDIR}/${PORTNAME} (except for the documentation, see below). In order to reduce the packing file size, you may reference the JAR file(s) directly in the Makefile. Just use the following statement (where myport.jar is the name of the JAR file installed as part of the port): PLIST_FILES+= %%JAVAJARDIR%%/myport.jar When porting a Java application, the port usually installs everything under a single directory (including its JAR dependencies). The use of ${JAVASHAREDIR}/${PORTNAME} is strongly encouraged in this regard. It is up the porter to decide whether the port should install the additional JAR dependencies under this directory or directly use the already installed ones (from ${JAVAJARDIR}). Regardless of the type of your port (library or application), the additional documentation should be installed in the same location as for any other port. The JavaDoc tool is known to produce a different set of files depending on the version of the JDK that is used. For ports that do not enforce the use of a particular JDK, it is therefore a complex task to specify the packing list (pkg-plist). This is one reason why porters are strongly encouraged to use the PORTDOCS macro. Moreover, even if you can predict the set of files that will be generated by javadoc, the size of the resulting pkg-plist advocates for the use of PORTDOCS. The default value for DATADIR is ${PREFIX}/share/${PORTNAME}. It is a good idea to override DATADIR to ${JAVASHAREDIR}/${PORTNAME} for Java ports. Indeed, DATADIR is automatically added to PLIST_SUB (documented in ) so you may use %%DATADIR%% directly in pkg-plist. As for the choice of building Java ports from source or directly installing them from a binary distribution, there is no defined policy at the time of writing. However, people from the &os; Java Project encourage porters to have their ports built from source whenever it is a trivial task. All the features that have been presented in this section are implemented in bsd.java.mk. If you ever think that your port needs more sophisticated Java support, please first have a look at the bsd.java.mk CVS log as it usually takes some time to document the latest features. Then, if you think the support you are lacking would be beneficial to many other Java ports, feel free to discuss it on the &a.java;. Although there is a java category for PRs, it refers to the JDK porting effort from the &os; Java project. Therefore, you should submit your Java port in the ports category as for any other port, unless the issue you are trying to resolve is related to either a JDK implementation or bsd.java.mk. Similarly, there is a defined policy regarding the CATEGORIES of a Java port, which is detailed in .
Using Apache and PHP Apache Variables for ports that use Apache USE_APACHE The port requires Apache. WITH_APACHE2 The port requires Apache 2.0. Without this variable, the port will depend on Apache 1.3. APXS Full path to the apxs binary (read-only variable).
PHP Variables for ports that use PHP USE_PHP The port requires PHP. The value yes adds a dependency on PHP. The list of required PHP extensions can be specified instead. Example: pcre xml gettext DEFAULT_PHP_VER Selects which major version of PHP will be installed as a dependency when no PHP is installed yet. Default is 4. Possible values: 4, 5 BROKEN_WITH_PHP The port does not work with PHP of the given version. Possible values: 4, 5 USE_PHPIZE The port will be built as a PHP extension. USE_PHPEXT The port will be treated as a PHP extension, including installation and registration in the extension registry. USE_PHP_BUILD Set PHP as a build dependency. WANT_PHP_CLI Want the CLI (command line) version of PHP. WANT_PHP_CGI Want the CGI version of PHP. WANT_PHP_MOD Want the Apache module version of PHP. WANT_PHP_SCR Want the CLI or the CGI version of PHP. WANT_PHP_WEB Want the Apache module or the CGI version of PHP. WANT_PHP_PEAR Want the PEAR framework.
PEAR modules Porting PEAR modules is a very simple process. Use the variables FILES, TESTS, DATA, SQLS, SCRIPTFILES, DOCS and EXAMPLES to list the files you want to install. All listed files will be automatically installed into the appropriate locations and added to pkg-plist. Include ${PORTSDIR}/devel/pear-PEAR/Makefile.common on the last line of the Makefile. Example Makefile for PEAR class PORTNAME= Date PORTVERSION= 1.4.3 CATEGORIES= devel www pear MAINTAINER= example@domain.com COMMENT= PEAR Date and Time Zone Classes BUILD_DEPENDS= ${PEARDIR}/PEAR.php:${PORTSDIR}/devel/pear-PEAR RUN_DEPENDS= ${BUILD_DEPENDS} FILES= Date.php Date/Calc.php Date/Human.php Date/Span.php \ Date/TimeZone.php TESTS= test_calc.php test_date_methods_span.php testunit.php \ testunit_date.php testunit_date_span.php wknotest.txt \ bug674.php bug727_1.php bug727_2.php bug727_3.php \ bug727_4.php bug967.php weeksinmonth_4_monday.txt \ weeksinmonth_4_sunday.txt weeksinmonth_rdm_monday.txt \ weeksinmonth_rdm_sunday.txt DOCS= TODO _DOCSDIR= . .include <bsd.port.pre.mk> .include "${PORTSDIR}/devel/pear-PEAR/Makefile.common" .include <bsd.port.post.mk>
Using Python Most useful variables for ports that use Python USE_PYTHON The port needs Python. Minimal required version can be specified with values such as 2.3+. Version ranges can also be specified, by separating two version numbers with a dash, e.g.: 2.1-2.3 USE_PYDISTUTILS Use Python distutils for configuring, compiling and installing. This is required when the port comes with setup.py. This overrides the do-build and do-install targets and may also override do-configure if GNU_CONFIGURE is not defined. PYTHON_PKGNAMEPREFIX Used as a PKGNAMEPREFIX to distinguish packages for different Python versions. Example: py24- PYTHON_SITELIBDIR Location of the site-packages tree, that contains installation path of Python (usually LOCALBASE). The PYTHON_SITELIBDIR variable can be very useful when installing Python modules. PYTHONPREFIX_SITELIBDIR The PREFIX-clean variant of PYTHON_SITELIBDIR. Always use %%PYTHON_SITELIBDIR%% in pkg-plist when possible. The default value of %%PYTHON_SITELIBDIR%% is lib/python%%PYTHON_VERSION%%/site-packages PYTHON_CMD Python interpreter command line, including version number. PYNUMERIC Dependency line for numeric extension. PYXML Dependency line for XML extension (not needed for Python 2.0 and higher as it is also in base distribution). USE_TWISTED Add dependency on twistedCore. The list of required components can be specified as a value of this variable. Example: web lore pair flow USE_ZOPE Add dependency on Zope, a web application platform. Change Python dependency to Python 2.3. Set ZOPEBASEDIR containing a directory with Zope installation.
A complete list of available variables can be found in /usr/ports/Mk/bsd.python.mk.
Using Emacs This section is yet to be written. Using Ruby Useful variables for ports that use Ruby Variable Description USE_RUBY The port requires Ruby. USE_RUBY_EXTCONF The port uses extconf.rb to configure. USE_RUBY_SETUP The port uses setup.rb to configure. RUBY_SETUP Set to the alternative name of setup.rb. Common value is install.rb.
The following table shows the selected variables available to port authors via the ports infrastructure. These variables should be used to install files into their proper locations. Use them in pkg-plist as much as possible. These variables should not be redefined in the port. Selected read-only variables for ports that use Ruby Variable Description Example value RUBY_PKGNAMEPREFIX Used as a PKGNAMEPREFIX to distinguish packages for different Ruby versions. ruby18- RUBY_VERSION Full version of Ruby in the form of x.y.z. 1.8.2 RUBY_SITELIBDIR Architecture independent libraries installation path. /usr/local/lib/ruby/site_ruby/1.8 RUBY_SITEARCHILIBDIR Architecture dependent libraries installation path. /usr/local/lib/ruby/site_ruby/1.8/amd64-freebsd6 RUBY_MODDOCDIR Module documentation installation path. /usr/local/share/doc/ruby18/patsy RUBY_MODEXAMPLESDIR Module examples installation path. /usr/local/share/examples/ruby18/patsy
A complete list of available variables can be found in /usr/ports/Mk/bsd.ruby.mk.
Using SDL The USE_SDL variable is used to autoconfigure the dependencies for ports which use an SDL based library like devel/sdl12 and x11-toolkits/sdl_gui. The following SDL libraries are recognized at the moment: sdl: devel/sdl12 gfx: graphics/sdl_gfx gui: x11-toolkits/sdl_gui image: graphics/sdl_image ldbad: devel/sdl_ldbad mixer: audio/sdl_mixer mm: devel/sdlmm net: net/sdl_net sound: audio/sdl_sound ttf: graphics/sdl_ttf Therefore, if a port has a dependency on net/sdl_net and audio/sdl_mixer, the syntax will be: USE_SDL= net mixer The dependency devel/sdl12, which is required by net/sdl_net and audio/sdl_mixer, is automatically added as well. If you use USE_SDL, it will automatically: Add a dependency on sdl12-config to BUILD_DEPENDS Add the variable SDL_CONFIG to CONFIGURE_ENV Add the dependencies of the selected libraries to the LIB_DEPENDS To check whether an SDL library is available, you can do it with the WANT_SDL variable: WANT_SDL=yes .include <bsd.port.pre.mk> .if ${HAVE_SDL:Mmixer}!="" USE_SDL+= mixer .endif .include <bsd.port.post.mk> Starting and stopping services (rc scripts) rc.d scripts are used to start services on system startup, and to give administrators a standard way of stopping, starting and restarting the service. Ports integrate into the system rc.d framework. Details on usage can be found in the rc.d Handbook chapter. Detailed explanation of available commands are in &man.rc.8; and &man.rc.subr.8;. One or more rc scripts can be installed: USE_RC_SUBR= doorman.sh Scripts must be placed in the files subdirectory and a .in suffix must be added to their filename. The only difference from a base system rc.d script is that the . /etc/rc.subr line must be replaced with the . %%RC_SUBR%%, because older versions of &os; do not have an /etc/rc.subr file. Standard SUB_LIST expansions are used too. Use of the %%PREFIX%%, %%LOCALBASE%%, and %%X11BASE%% expansions is strongly encouraged as well. More on SUB_LIST in the relevant section. Prior to &os; 6.1-RELEASE, integration with &man.rcorder.8; is available by using USE_RCORDER instead of USE_RC_SUBR. However, use of this method is deprecated. As of &os; 6.1-RELEASE, local rc.d scripts (including those installed by ports) are included in the overall &man.rcorder.8; of the base system. Example simple rc.d script: #!/bin/sh # PROVIDE: doorman # REQUIRE: LOGIN # # Add the following lines to /etc/rc.conf.local or /etc/rc.conf to enable doorman: # doorman_enable (bool): Set to "NO" by default. # Set it to "YES" to enable doorman # doorman_config (path): Set to "%%PREFIX%%/etc/doormand/doormand.cf" by default. # . %%RC_SUBR%% name="doorman" rcvar=`set_rcvar` load_rc_config $name : ${doorman_enable="NO"} : ${doorman_config="%%PREFIX%%/etc/doormand/doormand.cf"} command=%%PREFIX%%/sbin/doormand pidfile=/var/run/doormand.pid command_args="-p $pidfile -f $doorman_config" run_rc_command "$1" The "=" style of default variable assignment is preferable to the ":=" style here, since the former sets a default value only if the variable is unset, and the latter sets one if the variable is unset or null. A user might very well include something like doorman_flags="" in their rc.conf.local file, and a variable substitution using ":=" would inappropriately override the user's intention.
Advanced <filename>pkg-plist</filename> practices Changing <filename>pkg-plist</filename> based on make variables Some ports, particularly the p5- ports, need to change their pkg-plist depending on what options they are configured with (or version of perl, in the case of p5- ports). To make this easy, any instances in the pkg-plist of %%OSREL%%, %%PERL_VER%%, and %%PERL_VERSION%% will be substituted for appropriately. The value of %%OSREL%% is the numeric revision of the operating system (e.g., 4.9). %%PERL_VERSION%% is the full version number of perl (e.g., 5.00502) and %%PERL_VER%% is the perl version number minus the patchlevel (e.g., 5.005). Several other %%VARS%% related to port's documentation files are described in the relevant section. If you need to make other substitutions, you can set the PLIST_SUB variable with a list of VAR=VALUE pairs and instances of %%VAR%% will be substituted with VALUE in the pkg-plist. For instance, if you have a port that installs many files in a version-specific subdirectory, you can put something like OCTAVE_VERSION= 2.0.13 PLIST_SUB= OCTAVE_VERSION=${OCTAVE_VERSION} in the Makefile and use %%OCTAVE_VERSION%% wherever the version shows up in pkg-plist. That way, when you upgrade the port, you will not have to change dozens (or in some cases, hundreds) of lines in the pkg-plist. This substitution (as well as addition of any manual pages) will be done between the pre-install and do-install targets, by reading from PLIST and writing to TMPPLIST (default: WRKDIR/.PLIST.mktmp). So if your port builds PLIST on the fly, do so in or before pre-install. Also, if your port needs to edit the resulting file, do so in post-install to a file named TMPPLIST. Another possibility to modify port's packing list is based on setting the variables PLIST_FILES and PLIST_DIRS. The value of each variable is regarded as a list of pathnames to write to TMPPLIST along with PLIST contents. Names listed in PLIST_FILES and PLIST_DIRS are subject to %%VAR%% substitution, as described above. Except for that, names from PLIST_FILES will appear in the final packing list unchanged, while @dirrm will be prepended to names from PLIST_DIRS. To take effect, PLIST_FILES and PLIST_DIRS must be set before TMPPLIST is written, i.e. in pre-install or earlier. Empty directories Cleaning up empty directories Do make your ports remove empty directories when they are de-installed. This is usually accomplished by adding @dirrm lines for all directories that are specifically created by the port. You need to delete subdirectories before you can delete parent directories. : lib/X11/oneko/pixmaps/cat.xpm lib/X11/oneko/sounds/cat.au : @dirrm lib/X11/oneko/pixmaps @dirrm lib/X11/oneko/sounds @dirrm lib/X11/oneko However, sometimes @dirrm will give you errors because other ports share the same directory. You can use @dirrmtry to remove only empty directories without warning. @dirrmtry share/doc/gimp This will neither print any error messages nor cause &man.pkg.delete.1; to exit abnormally even if ${PREFIX}/share/doc/gimp is not empty due to other ports installing some files in there. Creating empty directories Empty directories created during port installation need special attention. They will not get created when installing the package, because packages only store the files, and &man.pkg.add.1; creates directories for them as needed. To make sure the empty directory is created when installing the package, add this line to pkg-plist above the corresponding @dirrm line: @exec mkdir -p %D/share/foo/templates Configuration files If your port requires some configuration files in PREFIX/etc, do not just install them and list them in pkg-plist. That will cause &man.pkg.delete.1; to delete files carefully edited by the user and a new installation to wipe them out. Instead, install sample files with a suffix (filename.sample will work well). Copy the sample file as the real configuration file, if it does not exist. On deinstall, delete the configuration file, but only if it was not modified by the user. You need to handle this both in the port Makefile, and in the pkg-plist (for installation from the package). Example of the Makefile part: post-install: @if [ ! -f ${PREFIX}/etc/orbit.conf ]; then \ ${CP} -p ${PREFIX}/etc/orbit.conf.sample ${PREFIX}/etc/orbit.conf ; \ fi Example of the pkg-plist part: @unexec if cmp -s %D/etc/orbit.conf.sample %D/etc/orbit.conf; then rm -f %D/etc/orbit.conf; fi etc/orbit.conf.sample @exec if [ ! -f %D/etc/orbit.conf ] ; then cp -p %D/%F %B/orbit.conf; fi Alternatively, print out a message pointing out that the user has to copy and edit the file before the software can be made to work. Dynamic vs. static package list A static package list is a package list which is available in the Ports Collection either as a pkg-plist file (with or without variable substitution), or embedded into the Makefile via PLIST_FILES and PLIST_DIRS. Even if the contents are auto-generated by a tool or a target in the Makefile before the inclusion into the Ports Collection by a committer, this is still considered a static list, since it is possible to examine it without having to download or compile the distfile. A dynamic package list is a package list which is generated at the time the port is compiled based upon the files and directories which are installed. It is not possible to examine it before the source code of the ported application is downloaded and compiled, or after running a make clean. While the use of dynamic package lists is not forbidden, maintainers should use static package lists wherever possible, as it enables users to &man.grep.1; through available ports to discover, for example, which port installs a certain file. Dynamic lists should be primarily used for complex ports where the package list changes drastically based upon optional features of the port (and thus maintaining a static package list is infeasible), or ports which change the package list based upon the version of dependent software used (e.g. ports which generate docs with Javadoc). Maintainers who prefer dynamic package lists are encouraged to add a new target to their port which generates the pkg-plist file so that users may examine the contents. ¦Û°Ê²£¥Í package list ­º¥ý¡A¥ý½T»{±zªº port °£¤F pkg-plist ©|¥¼·d©w¤§¥~¡A¨ä¥L³£§¹¦¨¤F¡C ±µµÛ¡A create a temporary directory tree into which your port can be installed, and install any dependencies. port-type should be local for non-X ports and x11-4 or x11 for ports which install into the directory hierarchy of XFree86 4 or an earlier XFree86 release, respectively. &prompt.root; mkdir /var/tmp/port-name &prompt.root; mtree -U -f /etc/mtree/BSD.port-type.dist -d -e -p /var/tmp/port-name &prompt.root; make depends PREFIX=/var/tmp/port-name Store the directory structure in a new file. &prompt.root; (cd /var/tmp/port-name && find -d * -type d) | sort > OLD-DIRS Create an empty pkg-plist file: &prompt.root; touch pkg-plist If your port honors PREFIX (which it should) you can then install the port and create the package list. &prompt.root; make install PREFIX=/var/tmp/port-name &prompt.root; (cd /var/tmp/port-name && find -d * \! -type d) | sort > pkg-plist You must also add any newly created directories to the packing list. &prompt.root; (cd /var/tmp/port-name && find -d * -type d) | sort | comm -13 OLD-DIRS - | sort -r | sed -e 's#^#@dirrm #' >> pkg-plist Finally, you need to tidy up the packing list by hand; it is not all automated. Manual pages should be listed in the port's Makefile under MANn, and not in the package list. User configuration files should be removed, or installed as filename.sample. The info/dir file should not be listed and appropriate install-info lines should be added as noted in the info files section. Any libraries installed by the port should be listed as specified in the shared libraries section. Alternatively, use the plist script in /usr/ports/Tools/scripts/ to build the package list automatically. The first step is the same as above: take the first three lines, that is, mkdir, mtree and make depends. Then build and install the port: &prompt.root; make install PREFIX=/var/tmp/port-name And let plist create the pkg-plist file: &prompt.root; /usr/ports/Tools/scripts/plist -Md -m /etc/mtree/BSD.port-type.dist /var/tmp/port-name > pkg-plist The packing list still has to be tidied up by hand as stated above. The <filename>pkg-<replaceable>*</replaceable></filename> files There are some tricks we have not mentioned yet about the pkg-* files that come in handy sometimes. <filename>pkg-message</filename> If you need to display a message to the installer, you may place the message in pkg-message. This capability is often useful to display additional installation steps to be taken after a &man.pkg.add.1; or to display licensing information. The pkg-message file does not need to be added to pkg-plist. Also, it will not get automatically printed if the user is using the port, not the package, so you should probably display it from the post-install target yourself. <filename>pkg-install</filename> If your port needs to execute commands when the binary package is installed with &man.pkg.add.1; you can do this via the pkg-install script. This script will automatically be added to the package, and will be run twice by &man.pkg.add.1;: the first time as ${SH} pkg-install ${PKGNAME} PRE-INSTALL and the second time as ${SH} pkg-install ${PKGNAME} POST-INSTALL. $2 can be tested to determine which mode the script is being run in. The PKG_PREFIX environmental variable will be set to the package installation directory. See &man.pkg.add.1; for additional information. This script is not run automatically if you install the port with make install. If you are depending on it being run, you will have to explicitly call it from your port's Makefile, with a line like PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL. <filename>pkg-deinstall</filename> This script executes when a package is removed. This script will be run twice by &man.pkg.delete.1;. The first time as ${SH} pkg-deinstall ${PKGNAME} DEINSTALL and the second time as ${SH} pkg-deinstall ${PKGNAME} POST-DEINSTALL. <filename>pkg-req</filename> If your port needs to determine if it should install or not, you can create a pkg-req requirements script. It will be invoked automatically at installation/de-installation time to determine whether or not installation/de-installation should proceed. The script will be run at installation time by &man.pkg.add.1; as pkg-req ${PKGNAME} INSTALL. At de-installation time it will be run by &man.pkg.delete.1; as pkg-req ${PKGNAME} DEINSTALL. Changing the names of <filename>pkg-<replaceable>*</replaceable></filename> files All the names of pkg-* files are defined using variables so you can change them in your Makefile if need be. This is especially useful when you are sharing the same pkg-* files among several ports or have to write to one of the above files (see writing to places other than WRKDIR for why it is a bad idea to write directly into the pkg-* subdirectory). Here is a list of variable names and their default values. (PKGDIR defaults to ${MASTERDIR}.) Variable Default value DESCR ${PKGDIR}/pkg-descr PLIST ${PKGDIR}/pkg-plist PKGINSTALL ${PKGDIR}/pkg-install PKGDEINSTALL ${PKGDIR}/pkg-deinstall PKGREQ ${PKGDIR}/pkg-req PKGMESSAGE ${PKGDIR}/pkg-message Please change these variables rather than overriding PKG_ARGS. If you change PKG_ARGS, those files will not correctly be installed in /var/db/pkg upon install from a port. Making use of <makevar>SUB_FILES</makevar> and <makevar>SUB_LIST</makevar> The SUB_FILES and SUB_LIST variables are useful for dynamic values in port files, such as the installation PREFIX in pkg-message. The SUB_FILES variable specifies a list of files to be automatically modified. Each file in the SUB_FILES list must have a corresponding file.in present in FILESDIR. A modified version will be created in WRKDIR. Files defined as a value of USE_RC_SUBR (or the deprecated USE_RCORDER) are automatically added to the SUB_FILES. For the files pkg-message, pkg-install, pkg-deinstall and pkg-reg, the corresponding Makefile variable is automatically set to point to the processed version. The SUB_LIST variable is a list of VAR=VALUE pairs. For each pair %%VAR%% will get replaced with VALUE in each file listed in SUB_FILES. Several common pairs are automatically defined: PREFIX, LOCALBASE, X11BASE, DATADIR, DOCSDIR, EXAMPLESDIR. Any line beginning with @comment will be deleted from resulting files after a variable substitution. The following example will replace %%ARCH%% with the system architecture in a pkg-message: SUB_FILES= pkg-message SUB_LIST= ARCH=${ARCH} Note that for this example, the pkg-message.in file must exist in FILESDIR. Example of a good pkg-message.in: Now it's time to configure this package. Copy %%PREFIX%%/share/examples/putsy/%%ARCH%%.conf into your home directory as .putsy.conf and edit it. Testing your port Running <command>make describe</command> Several of the &os; port maintenance tools, such as &man.portupgrade.1;, rely on a database called /usr/ports/INDEX which keeps track of such items as port dependencies. INDEX is created by the top-level ports/Makefile via make index, which descends into each port subdirectory and executes make describe there. Thus, if make describe fails in any port, no one can generate INDEX, and many people will quickly become unhappy. It is important to be able to generate this file no matter what options are present in make.conf, so please avoid doing things such as using .error statements when (for instance) a dependency is not satisfied. (See .) If make describe produces a string rather than an error message, you are probably safe. See bsd.port.mk for the meaning of the string produced. Also note that running a recent version of portlint (as specified in the next section) will cause make describe to be run automatically. Portlint Do check your work with portlint before you submit or commit it. portlint warns you about many common errors, both functional and stylistic. For a new (or repocopied) port, portlint -A is the most thorough; for an existing port, portlint -C is sufficient. Since portlint uses heuristics to try to figure out errors, it can produce false positive warnings. In addition, occasionally something that is flagged as a problem really cannot be done in any other way due to limitations in the ports framework. When in doubt, the best thing to do is ask on &a.ports;. <makevar>PREFIX</makevar> Do try to make your port install relative to PREFIX. The value of this variable will be set to LOCALBASE (default /usr/local). If USE_X_PREFIX or USE_IMAKE is set, PREFIX will be X11BASE (default /usr/X11R6). If USE_LINUX_PREFIX is set, PREFIX will be LINUXBASE (default /compat/linux). Avoiding the hard-coding of /usr/local or /usr/X11R6 anywhere in the source will make the port much more flexible and able to cater to the needs of other sites. For X ports that use imake, this is automatic; otherwise, this can often be done by simply replacing the occurrences of /usr/local (or /usr/X11R6 for X ports that do not use imake) in the various scripts/Makefiles in the port to read ${PREFIX}, as this variable is automatically passed down to every stage of the build and install processes. Make sure your application is not installing things in /usr/local instead of PREFIX. A quick test for this is to do this is: &prompt.root; make clean; make package PREFIX=/var/tmp/port-name If anything is installed outside of PREFIX, the package creation process will complain that it cannot find the files. This does not test for the existence of internal references, or correct use of LOCALBASE for references to files from other ports. Testing the installation in /var/tmp/port-name to do that while you have it installed would do that. Do not set USE_X_PREFIX unless your port truly requires it (i.e., it links against X libs or it needs to reference files in X11BASE). The variable PREFIX can be reassigned in your Makefile or in the user's environment. However, it is strongly discouraged for individual ports to set this variable explicitly in the Makefiles. Also, refer to programs/files from other ports with the variables mentioned above, not explicit pathnames. For instance, if your port requires a macro PAGER to be the full pathname of less, use the compiler flag: -DPAGER=\"${LOCALBASE}/bin/less\" instead of -DPAGER=\"/usr/local/bin/less\". This way it will have a better chance of working if the system administrator has moved the whole /usr/local tree somewhere else. Upgrading When you notice that a port is out of date compared to the latest version from the original authors, you should first ensure that you have the latest port. You can find them in the ports/ports-current directory of the &os; FTP mirror sites. However, if you are working with more than a few ports, you will probably find it easier to use CVSup to keep your whole ports collection up-to-date, as described in the Handbook. This will have the added benefit of tracking all the ports' dependencies. The next step is to see if there is an update already pending. To do this, you have two options. There is a searchable interface to the FreeBSD Problem Report (PR) database (also known as GNATS). Select ports in the dropdown, and enter the name of the port. However, sometimes people forget to put the name of the port into the Synopsis field in an unambiguous fashion. In that case, you can try the FreeBSD Ports Monitoring System (also known as portsmon). This system attempts to classify port PRs by portname. To search for PRs about a particular port, use the Overview of One Port. If there is no pending PR, the next step is to send an email to the port's maintainer, as shown by make maintainer. That person may already be working on an upgrade, or have a reason to not upgrade the port right now (because of, for example, stability problems of the new version); you would not want to duplicate their work. Note that unmaintained ports are listed with a maintainer of ports@FreeBSD.org, which is just the general ports mailing list, so sending mail there probably will not help in this case. If the maintainer asks you to do the upgrade or there is no maintainer, then you have a chance to help out &os; by preparing the update yourself! Please make the changes and save the result of the recursive diff output of the new and old ports directories (e.g., if your modified port directory is called superedit and the original is in our tree as superedit.bak, then save the result of diff -ruN superedit.bak superedit). Either unified or context diff is fine, but port committers generally prefer unified diffs. Note the use of the -N option—this is the accepted way to force diff to properly deal with the case of new files being added or old files being deleted. Before sending us the diff, please examine the output to make sure all the changes make sense. To simplify common operations with patch files, you can use /usr/ports/Tools/scripts/patchtool.py. Before using it, please read /usr/ports/Tools/scripts/README.patchtool. If the port is unmaintained, and you are actively using it yourself, please consider volunteering to become its maintainer. &os; has over 2000 ports without maintainers, and this is an area where more volunteers are always needed. (For a detailed description of the responsibilities of maintainers, refer to the MAINTAINER on Makefiles section.) The best way to send us the diff is by including it via &man.send-pr.1; (category ports). If you are volunteering to maintain the port, be sure to put [maintainer update] at the beginning of your synopsis line and set the Class of your PR to maintainer-update. Otherwise, the Class of your PR should be change-request. Please mention any added or deleted files in the message, as they have to be explicitly specified to &man.cvs.1; when doing a commit. If the diff is more than about 20KB, please compress and uuencode it; otherwise, just include it in the PR as is. Before you &man.send-pr.1;, you should review the Writing the problem report section in the Problem Reports article; it contains far more information about how to write useful problem reports. If your upgrade is motivated by security concerns or a serious fault in the currently committed port, please notify the &a.portmgr; to request immediate rebuilding and redistribution of your port's package. Unsuspecting users of &man.pkg.add.1; will otherwise continue to install the old version via pkg_add -r for several weeks. Once again, please use &man.diff.1; and not &man.shar.1; to send updates to existing ports! Now that you have done all that, you will want to read about how to keep up-to-date in . Ports security Why security is so important Bugs are occasionally introduced to the software. Arguably, the most dangerous of them are those opening security vulnerabilities. From the technical viewpoint, such vulnerabilities are to be closed by exterminating the bugs that caused them. However, the policies for handling mere bugs and security vulnerabilities are very different. A typical small bug affects only those users who have enabled some combination of options triggering the bug. The developer will eventually release a patch followed by a new version of the software, free of the bug, but the majority of users will not take the trouble of upgrading immediately because the bug has never vexed them. A critical bug that may cause data loss represents a graver issue. Nevertheless, prudent users know that a lot of possible accidents, besides software bugs, are likely to lead to data loss, and so they make backups of important data; in addition, a critical bug will be discovered really soon. A security vulnerability is all different. First, it may remain unnoticed for years because often it does not cause software malfunction. Second, a malicious party can use it to gain unauthorized access to a vulnerable system, to destroy or alter sensitive data; and in the worst case the user will not even notice the harm caused. Third, exposing a vulnerable system often assists attackers to break into other systems that could not be compromised otherwise. Therefore closing a vulnerability alone is not enough: the audience should be notified of it in most clear and comprehensive manner, which will allow to evaluate the danger and take appropriate actions. Fixing security vulnerabilities While on the subject of ports and packages, a security vulnerability may initially appear in the original distribution or in the port files. In the former case, the original software developer is likely to release a patch or a new version instantly, and you will only need to update the port promptly with respect to the author's fix. If the fix is delayed for some reason, you should either mark the port as FORBIDDEN or introduce a patch file of your own to the port. In the case of a vulnerable port, just fix the port as soon as possible. In either case, the standard procedure for submitting your change should be followed unless you have rights to commit it directly to the ports tree. Being a ports committer is not enough to commit to an arbitrary port. Remember that ports usually have maintainers, whom you should respect. Please make sure that the port's revision is bumped as soon as the vulnerability has been closed. That is how the users who upgrade installed packages on a regular basis will see they need to run an update. Besides, a new package will be built and distributed over FTP and WWW mirrors, replacing the vulnerable one. PORTREVISION should be bumped unless PORTVERSION has changed in the course of correcting the vulnerability. That is you should bump PORTREVISION if you have added a patch file to the port, but you should not if you have updated the port to the latest software version and thus already touched PORTVERSION. Please refer to the corresponding section for more information. Keeping the community informed The VuXML database A very important and urgent step to take as early as a security vulnerability is discovered is to notify the community of port users about the jeopardy. Such notification serves two purposes. First, should the danger be really severe, it will be wise to apply an instant workaround, e.g., stop the affected network service or even deinstall the port completely, until the vulnerability is closed. Second, a lot of users tend to upgrade installed packages just occasionally. They will know from the notification that they must update the package without delay as soon as a corrected version is available. Given the huge number of ports in the tree, a security advisory cannot be issued on each incident without creating a flood and losing the attention of the audience by the time it comes to really serious matters. Therefore security vulnerabilities found in ports are recorded in the FreeBSD VuXML database. The Security Officer Team members are monitoring it for issues requiring their intervention. If you have committer rights, you can update the VuXML database by yourself. So you will both help the Security Officer Team and deliver the crucial information to the community earlier. However, if you are not a committer, or you believe you have found an exceptionally severe vulnerability, or whatever, please do not hesitate to contact the Security Officer Team directly as described on the FreeBSD Security Information page. All right, you elected the hard way. As it may be obvious from its title, the VuXML database is essentially an XML document. Its source file vuln.xml is kept right inside the port security/vuxml. Therefore the file's full pathname will be PORTSDIR/security/vuxml/vuln.xml. Each time you discover a security vulnerability in a port, please add an entry for it to that file. Until you are familiar with VuXML, the best thing you can do is to find an existing entry fitting your case, then copy it and use as a template. A short introduction to VuXML The full-blown XML is complex and far beyond the scope of this book. However, to gain basic insight on the structure of a VuXML entry, you need only the notion of tags. XML tag names are enclosed in angle brackets. Each opening <tag> must have a matching closing </tag>. Tags may be nested. If nesting, the inner tags must be closed before the outer ones. There is a hierarchy of tags, i.e. more complex rules of nesting them. Sounds very similar to HTML, doesn't it? The major difference is that XML is eXtensible, i.e. based on defining custom tags. Due to its intrinsic structure, XML puts otherwise amorphous data into shape. VuXML is particularly tailored to mark up descriptions of security vulnerabilities. Now let's consider a realistic VuXML entry: <vuln vid="f4bc80f4-da62-11d8-90ea-0004ac98a7b9"> <topic>Several vulnerabilities found in Foo</topic> <affects> <package> <name>foo</name> <name>foo-devel</name> <name>ja-foo</name> <range><ge>1.6</ge><lt>1.9</lt></range> <range><ge>2.*</ge><lt>2.4_1</lt></range> <range><eq>3.0b1</eq></range> </package> <package> <name>openfoo</name> <range><lt>1.10_7</lt></range> <range><ge>1.2,1</ge><lt>1.3_1,1</lt></range> </package> </affects> <description> <body xmlns="http://www.w3.org/1999/xhtml"> <p>J. Random Hacker reports:</p> <blockquote cite="http://j.r.hacker.com/advisories/1"> <p>Several issues in the Foo software may be exploited via carefully crafted QUUX requests. These requests will permit the injection of Bar code, mumble theft, and the readability of the Foo administrator account.</p> </blockquote> </body> </description> <references> <freebsdsa>SA-10:75.foo</freebsdsa> <freebsdpr>ports/987654</freebsdpr> <cvename>CAN-2010-0201</cvename> <cvename>CAN-2010-0466</cvename> <bid>96298</bid> <certsa>CA-2010-99</certsa> <certvu>740169</certvu> <uscertsa>SA10-99A</uscertsa> <uscertta>SA10-99A</uscertta> <mlist msgid="201075606@hacker.com">http://marc.theaimsgroup.com/?l=bugtraq&amp;m=203886607825605</mlist> <url>http://j.r.hacker.com/advisories/1</url> </references> <dates> <discovery>2010-05-25</discovery> <entry>2010-07-13</entry> <modified>2010-09-17</entry> </dates> </vuln> The tag names are supposed to be self-descriptive, so we shall take a closer look only at fields you will need to fill in by yourself: This is the top-level tag of a VuXML entry. It has a mandatory attribute, vid, specifying a universally unique identifier (UUID) for this entry (in quotes). You should generate a UUID for each new VuXML entry (and do not forget to substitute it for the template UUID unless you are writing the entry from scratch). You can use &man.uuidgen.1; in FreeBSD 5.x, or you may install the port devel/p5-Data-UUID and issue the following command: perl -MData::UUID -le 'print lc new Data::UUID->create_str' This is a one-line description of the issue found. The names of packages affected are listed there. Multiple names can be given since several packages may be based on a single master port or software product. This may include stable and development branches, localized versions, and slave ports featuring different choices of important build-time configuration options. It is your responsibility to find all such related packages when writing a VuXML entry. Keep in mind that make search name=foo is your friend. The primary points to look for are as follows: the foo-devel variant for a foo port; other variants with a suffix like -a4 (for print-related packages), -without-gui (for packages with X support disabled), or similar; jp-, ru-, zh-, and other possible localized variants in the corresponding national categories of the ports collection. Affected versions of the package(s) are specified there as one or more ranges using a combination of <lt>, <le>, <eq>, <ge>, and <gt> elements. The version ranges given should not overlap. In a range specification, * (asterisk) denotes the smallest version number. In particular, 2.* is less than 2.a. Therefore an asterisk may be used for a range to match all possible alpha, beta, and RC versions. For instance, <ge>2.*</ge><lt>3.*</lt> will selectively match every 2.x version while <ge>2.0</ge><lt>3.0</lt> will obviously not since the latter misses 2.r3 and matches 3.b. The above example specifies that affected are versions from 1.6 to 1.9 inclusive, versions 2.x before 2.4_1, and version 3.0b1. Several related package groups (essentially, ports) can be listed in the <affected> section. This can be used if several software products (say FooBar, FreeBar and OpenBar) grow from the same code base and still share its bugs and vulnerabilities. Note the difference from listing multiple names within a single <package> section. The version ranges should allow for PORTEPOCH and PORTREVISION if applicable. Please remember that according to the collation rules, a version with a non-zero PORTEPOCH is greater than any version without PORTEPOCH, e.g., 3.0,1 is greater than 3.1 or even than 8.9. This is a summary of the issue. XHTML is used in this field. At least enclosing <p> and </p> should appear. More complex mark-up may be used, but only for the sake of accuracy and clarity: No eye candy please. This section contains references to relevant documents. As many references as apply are encouraged. This is a FreeBSD security advisory. This is a FreeBSD problem report. This is a Mitre CVE identifier. This is a SecurityFocus Bug ID. This is a US-CERT security advisory. This is a US-CERT vulnerability note. This is a US-CERT Cyber Security Alert. This is a US-CERT Technical Cyber Security Alert. This is a URL to an archived posting in a mailing list. The attribute msgid is optional and may specify the message ID of the posting. This is a generic URL. It should be used only if none of the other reference categories apply. This is the date when the issue was disclosed (YYYY-MM-DD). This is the date when the entry was added (YYYY-MM-DD). This is the date when any information in the entry was last modified (YYYY-MM-DD). New entries must not include this field. It should be added upon editing an existing entry. Testing your changes to the VuXML database Assume you just wrote or filled in an entry for a vulnerability in the package clamav that has been fixed in version 0.65_7. As a prerequisite, you need to install fresh versions of the ports security/portaudit and security/portaudit-db. First, check whether there already is an entry for this vulnerability. If there were such entry, it would match the previous version of the package, 0.65_6: &prompt.user; packaudit &prompt.user; portaudit clamav-0.65_6 To run packaudit, you must have permission to write to its DATABASEDIR, typically /var/db/portaudit. If there is none found, you get the green light to add a new entry for this vulnerability. Now you can generate a brand-new UUID (assume it's 74a9541d-5d6c-11d8-80e3-0020ed76ef5a) and add your new entry to the VuXML database. Please verify its syntax after that as follows: &prompt.user; cd ${PORTSDIR}/security/vuxml && make validate You will need at least one of the following packages installed: textproc/libxml2, textproc/jade. Now rebuild the portaudit database from the VuXML file: &prompt.user; packaudit To verify that the <affected> section of your entry will match correct package(s), issue the following command: &prompt.user; portaudit -f /usr/ports/INDEX -r 74a9541d-5d6c-11d8-80e3-0020ed76ef5a Please refer to &man.portaudit.1; for better understanding of the command syntax. Make sure that your entry produces no spurious matches in the output. Now check whether the right package versions are matched by your entry: &prompt.user; portaudit clamav-0.65_6 clamav-0.65_7 Affected package: clamav-0.65_6 (matched by clamav<0.65_7) Type of problem: clamav remote denial-of-service. Reference: <http://www.freebsd.org/ports/portaudit/74a9541d-5d6c-11d8-80e3-0020ed76ef5a.html> 1 problem(s) found. Obviously, the former version should match while the latter one should not. Finally, verify whether the web page generated from the VuXML database looks like expected: &prompt.user; mkdir -p ~/public_html/portaudit &prompt.user; packaudit &prompt.user; lynx ~/public_html/portaudit/74a9541d-5d6c-11d8-80e3-0020ed76ef5a.html If VuXML still scares you... As an easy alternative to writing VuXML, you may opt to add a single line to a different file with much simpler syntax, PORTSDIR/security/portaudit-db/database/portaudit.txt, which resides within the port security/portaudit-db, and send a request for review to the Security Officer Team as described on the FreeBSD Security Information page. A line in that file consists of four fields separated by |, a pipe character. The first field is a &man.pkg.version.1; pattern expression matching the vulnerable packages. The second field contains URLs to relevant information, separated by space characters. The third field is a one-line description of the issue. The fourth and last field is the entry's UUID. You may want take a closer look at existing entries in portaudit.txt before adding your first line to that file. Dos and Don'ts Introduction Here is a list of common dos and don'ts that you encounter during the porting process. You should check your own port against this list, but you can also check ports in the PR database that others have submitted. Submit any comments on ports you check as described in Bug Reports and General Commentary. Checking ports in the PR database will both make it faster for us to commit them, and prove that you know what you are doing. Stripping Binaries Do not strip binaries manually unless you have to. All binaries should be stripped, but the INSTALL_PROGRAM macro will install and strip a binary at the same time (see the next section). If you need to strip a file, but do not wish to use the INSTALL_PROGRAM macro, ${STRIP_CMD} will strip your program. This is typically done within the post-install target. For example: post-install: ${STRIP_CMD} ${PREFIX}/bin/xdl Use the &man.file.1; command on the installed executable to check whether the binary is stripped or not. If it does not say not stripped, it is stripped. Additionally, &man.strip.1; will not strip a previously stripped program; it will instead exit cleanly. INSTALL_* macros Do use the macros provided in bsd.port.mk to ensure correct modes and ownership of files in your own *-install targets. INSTALL_PROGRAM is a command to install binary executables. INSTALL_SCRIPT is a command to install executable scripts. INSTALL_DATA is a command to install sharable data. INSTALL_MAN is a command to install manpages and other documentation (it does not compress anything). These are basically the install command with all the appropriate flags. See below for an example on how to use them. <makevar>WRKDIR</makevar> Do not write anything to files outside WRKDIR. WRKDIR is the only place that is guaranteed to be writable during the port build (see installing ports from a CDROM for an example of building ports from a read-only tree). If you need to modify one of the pkg-* files, do so by redefining a variable, not by writing over it. <makevar>WRKDIRPREFIX</makevar> Make sure your port honors WRKDIRPREFIX. Most ports do not have to worry about this. In particular, if you are referring to a WRKDIR of another port, note that the correct location is WRKDIRPREFIXPORTSDIR/subdir/name/work not PORTSDIR/subdir/name/work or .CURDIR/../../subdir/name/work or some such. Also, if you are defining WRKDIR yourself, make sure you prepend ${WRKDIRPREFIX}${.CURDIR} in the front. Differentiating operating systems and OS versions You may come across code that needs modifications or conditional compilation based upon what version of Unix it is running under. If you need to make such changes to the code for conditional compilation, make sure you make the changes as general as possible so that we can back-port code to older FreeBSD systems and cross-port to other BSD systems such as 4.4BSD from CSRG, BSD/386, 386BSD, NetBSD, and OpenBSD. The preferred way to tell 4.3BSD/Reno (1990) and newer versions of the BSD code apart is by using the BSD macro defined in sys/param.h. Hopefully that file is already included; if not, add the code: #if (defined(__unix__) || defined(unix)) && !defined(USG) #include <sys/param.h> #endif to the proper place in the .c file. We believe that every system that defines these two symbols has sys/param.h. If you find a system that does not, we would like to know. Please send mail to the &a.ports;. Another way is to use the GNU Autoconf style of doing this: #ifdef HAVE_SYS_PARAM_H #include <sys/param.h> #endif Do not forget to add -DHAVE_SYS_PARAM_H to the CFLAGS in the Makefile for this method. Once you have sys/param.h included, you may use: #if (defined(BSD) && (BSD >= 199103)) to detect if the code is being compiled on a 4.3 Net2 code base or newer (e.g. FreeBSD 1.x, 4.3/Reno, NetBSD 0.9, 386BSD, BSD/386 1.1 and below). Use: #if (defined(BSD) && (BSD >= 199306)) to detect if the code is being compiled on a 4.4 code base or newer (e.g. FreeBSD 2.x, 4.4, NetBSD 1.0, BSD/386 2.0 or above). The value of the BSD macro is 199506 for the 4.4BSD-Lite2 code base. This is stated for informational purposes only. It should not be used to distinguish between versions of FreeBSD based only on 4.4-Lite vs. versions that have merged in changes from 4.4-Lite2. The __FreeBSD__ macro should be used instead. Use sparingly: __FreeBSD__ is defined in all versions of FreeBSD. Use it if the change you are making only affects FreeBSD. Porting gotchas like the use of sys_errlist[] vs strerror() are Berkeley-isms, not FreeBSD changes. In FreeBSD 2.x, __FreeBSD__ is defined to be 2. In earlier versions, it is 1. Later versions always bump it to match their major version number. If you need to tell the difference between a FreeBSD 1.x system and a FreeBSD 2.x or above system, usually the right answer is to use the BSD macros described above. If there actually is a FreeBSD specific change (such as special shared library options when using ld) then it is OK to use __FreeBSD__ and #if __FreeBSD__ > 1 to detect a FreeBSD 2.x and later system. If you need more granularity in detecting FreeBSD systems since 2.0-RELEASE you can use the following: #if __FreeBSD__ >= 2 #include <osreldate.h> # if __FreeBSD_version >= 199504 /* 2.0.5+ release specific code here */ # endif #endif In the hundreds of ports that have been done, there have only been one or two cases where __FreeBSD__ should have been used. Just because an earlier port screwed up and used it in the wrong place does not mean you should do so too. FreeBSD ª©¥»³t¬dªí(__FreeBSD_version) ¥H¤U¬O sys/param.h ¤ºªº __FreeBSD_version ª©¥»³t¬dªí¡G __FreeBSD_version values Release __FreeBSD_version 2.0-RELEASE 119411 2.1-CURRENT 199501, 199503 2.0.5-RELEASE 199504 2.2-CURRENT before 2.1 199508 2.1.0-RELEASE 199511 2.2-CURRENT before 2.1.5 199512 2.1.5-RELEASE 199607 2.2-CURRENT before 2.1.6 199608 2.1.6-RELEASE 199612 2.1.7-RELEASE 199612 2.2-RELEASE 220000 2.2.1-RELEASE 220000 (no change) 2.2-STABLE after 2.2.1-RELEASE 220000 (no change) 2.2-STABLE after texinfo-3.9 221001 2.2-STABLE after top 221002 2.2.2-RELEASE 222000 2.2-STABLE after 2.2.2-RELEASE 222001 2.2.5-RELEASE 225000 2.2-STABLE after 2.2.5-RELEASE 225001 2.2-STABLE after ldconfig -R merge 225002 2.2.6-RELEASE 226000 2.2.7-RELEASE 227000 2.2-STABLE after 2.2.7-RELEASE 227001 2.2-STABLE after &man.semctl.2; change 227002 2.2.8-RELEASE 228000 2.2-STABLE after 2.2.8-RELEASE 228001 3.0-CURRENT before &man.mount.2; change 300000 3.0-CURRENT after &man.mount.2; change 300001 3.0-CURRENT after &man.semctl.2; change 300002 3.0-CURRENT after ioctl arg changes 300003 3.0-CURRENT after ELF conversion 300004 3.0-RELEASE 300005 3.0-CURRENT after 3.0-RELEASE 300006 3.0-STABLE after 3/4 branch 300007 3.1-RELEASE 310000 3.1-STABLE after 3.1-RELEASE 310001 3.1-STABLE after C++ constructor/destructor order change 310002 3.2-RELEASE 320000 3.2-STABLE 320001 3.2-STABLE after binary-incompatible IPFW and socket changes 320002 3.3-RELEASE 330000 3.3-STABLE 330001 3.3-STABLE after adding &man.mkstemp.3; to libc 330002 3.4-RELEASE 340000 3.4-STABLE 340001 3.5-RELEASE 350000 3.5-STABLE 350001 4.0-CURRENT after 3.4 branch 400000 4.0-CURRENT after change in dynamic linker handling 400001 4.0-CURRENT after C++ constructor/destructor order change 400002 4.0-CURRENT after functioning &man.dladdr.3; 400003 4.0-CURRENT after __deregister_frame_info dynamic linker bug fix (also 4.0-CURRENT after EGCS 1.1.2 integration) 400004 4.0-CURRENT after &man.suser.9; API change (also 4.0-CURRENT after newbus) 400005 4.0-CURRENT after cdevsw registration change 400006 4.0-CURRENT after the addition of so_cred for socket level credentials 400007 4.0-CURRENT after the addition of a poll syscall wrapper to libc_r 400008 4.0-CURRENT after the change of the kernel's dev_t type to struct specinfo pointer 400009 4.0-CURRENT after fixing a hole in &man.jail.2; 400010 4.0-CURRENT after the sigset_t datatype change 400011 4.0-CURRENT after the cutover to the GCC 2.95.2 compiler 400012 4.0-CURRENT after adding pluggable linux-mode ioctl handlers 400013 4.0-CURRENT after importing OpenSSL 400014 4.0-CURRENT after the C++ ABI change in GCC 2.95.2 from -fvtable-thunks to -fno-vtable-thunks by default 400015 4.0-CURRENT after importing OpenSSH 400016 4.0-RELEASE 400017 4.0-STABLE after 4.0-RELEASE 400018 4.0-STABLE after the introduction of delayed checksums. 400019 4.0-STABLE after merging libxpg4 code into libc. 400020 4.0-STABLE after upgrading Binutils to 2.10.0, ELF branding changes, and tcsh in the base system. 400021 4.1-RELEASE 410000 4.1-STABLE after 4.1-RELEASE 410001 4.1-STABLE after &man.setproctitle.3; moved from libutil to libc. 410002 4.1.1-RELEASE 411000 4.1.1-STABLE after 4.1.1-RELEASE 411001 4.2-RELEASE 420000 4.2-STABLE after combining libgcc.a and libgcc_r.a, and associated GCC linkage changes. 420001 4.3-RELEASE 430000 4.3-STABLE after wint_t introduction. 430001 4.3-STABLE after PCI powerstate API merge. 430002 4.4-RELEASE 440000 4.4-STABLE after d_thread_t introduction. 440001 4.4-STABLE after mount structure changes (affects filesystem klds). 440002 4.4-STABLE after the userland components of smbfs were imported. 440003 4.5-RELEASE 450000 4.5-STABLE after the usb structure element rename. 450001 4.5-STABLE after the sendmail_enable &man.rc.conf.5; variable was made to take the value NONE. 450004 4.5-STABLE after moving to XFree86 4 by default for package builds. 450005 4.5-STABLE after accept filtering was fixed so that is no longer susceptible to an easy DoS. 450006 4.6-RELEASE 460000 4.6-STABLE &man.sendfile.2; fixed to comply with documentation, not to count any headers sent against the amount of data to be sent from the file. 460001 4.6.2-RELEASE 460002 4.6-STABLE 460100 4.6-STABLE after MFC of `sed -i'. 460101 4.6-STABLE after MFC of many new pkg_install features from the HEAD. 460102 4.7-RELEASE 470000 4.7-STABLE 470100 Start generated __std{in,out,err}p references rather than __sF. This changes std{in,out,err} from a compile time expression to a runtime one. 470101 4.7-STABLE after MFC of mbuf changes to replace m_aux mbufs by m_tag's 470102 4.7-STABLE gets OpenSSL 0.9.7 470103 4.8-RELEASE 480000 4.8-STABLE 480100 4.8-STABLE after &man.realpath.3; has been made thread-safe 480101 4.8-STABLE 3ware API changes to twe. 480102 4.9-RELEASE 490000 4.9-STABLE 490100 4.9-STABLE after e_sid was added to struct kinfo_eproc. 490101 4.9-STABLE after MFC of libmap functionality for rtld. 490102 4.10-RELEASE 491000 4.10-STABLE 491100 4.10-STABLE after MFC of revision 20040629 of the package tools 491101 4.10-STABLE after VM fix dealing with unwiring of fictitious pages 491102 4.11-RELEASE 492000 4.11-STABLE 492100 5.0-CURRENT 500000 5.0-CURRENT after adding addition ELF header fields, and changing our ELF binary branding method. 500001 5.0-CURRENT after kld metadata changes. 500002 5.0-CURRENT after buf/bio changes. 500003 5.0-CURRENT after binutils upgrade. 500004 5.0-CURRENT after merging libxpg4 code into libc and after TASKQ interface introduction. 500005 5.0-CURRENT after the addition of AGP interfaces. 500006 5.0-CURRENT after Perl upgrade to 5.6.0 500007 5.0-CURRENT after the update of KAME code to 2000/07 sources. 500008 5.0-CURRENT after ether_ifattach() and ether_ifdetach() changes. 500009 5.0-CURRENT after changing mtree defaults back to original variant, adding -L to follow symlinks. 500010 5.0-CURRENT after kqueue API changed. 500011 5.0-CURRENT after &man.setproctitle.3; moved from libutil to libc. 500012 5.0-CURRENT after the first SMPng commit. 500013 5.0-CURRENT after <sys/select.h> moved to <sys/selinfo.h>. 500014 5.0-CURRENT after combining libgcc.a and libgcc_r.a, and associated GCC linkage changes. 500015 5.0-CURRENT after change allowing libc and libc_r to be linked together, deprecating -pthread option. 500016 5.0-CURRENT after switch from struct ucred to struct xucred to stabilize kernel-exported API for mountd et al. 500017 5.0-CURRENT after addition of CPUTYPE make variable for controlling CPU-specific optimizations. 500018 5.0-CURRENT after moving machine/ioctl_fd.h to sys/fdcio.h 500019 5.0-CURRENT after locale names renaming. 500020 5.0-CURRENT after Bzip2 import. Also signifies removal of S/Key. 500021 5.0-CURRENT after SSE support. 500022 5.0-CURRENT after KSE Milestone 2. 500023 5.0-CURRENT after d_thread_t, and moving UUCP to ports. 500024 5.0-CURRENT after ABI change for descriptor and creds passing on 64 bit platforms. 500025 5.0-CURRENT after moving to XFree86 4 by default for package builds, and after the new libc strnstr() function was added. 500026 5.0-CURRENT after the new libc strcasestr() function was added. 500027 5.0-CURRENT after the userland components of smbfs were imported. 500028 5.0-CURRENT after the new C99 specific-width integer types were added. (Not incremented.) 5.0-CURRENT after a change was made in the return value of &man.sendfile.2;. 500029 5.0-CURRENT after the introduction of the type fflags_t, which is the appropriate size for file flags. 500030 5.0-CURRENT after the usb structure element rename. 500031 5.0-CURRENT after the introduction of Perl 5.6.1. 500032 5.0-CURRENT after the sendmail_enable &man.rc.conf.5; variable was made to take the value NONE. 500033 5.0-CURRENT after mtx_init() grew a third argument. 500034 5.0-CURRENT with Gcc 3.1. 500035 5.0-CURRENT without Perl in /usr/src 500036 5.0-CURRENT after the addition of &man.dlfunc.3; 500037 5.0-CURRENT after the types of some struct sockbuf members were changed and the structure was reordered. 500038 5.0-CURRENT after GCC 3.2.1 import. Also after headers stopped using _BSD_FOO_T_ and started using _FOO_T_DECLARED. This value can also be used as a conservative estimate of the start of &man.bzip2.1; package support. 500039 5.0-CURRENT after various changes to disk functions were made in the name of removing dependency on disklabel structure internals. 500040 5.0-CURRENT after the addition of &man.getopt.long.3; to libc. 500041 5.0-CURRENT after Binutils 2.13 upgrade, which included new FreeBSD emulation, vec, and output format. 500042 5.0-CURRENT after adding weak pthread_XXX stubs to libc, obsoleting libXThrStub.so. 5.0-RELEASE. 500043 5.0-CURRENT after branching for RELENG_5_0 500100 <sys/dkstat.h> is empty and should not be included. 500101 5.0-CURRENT after the d_mmap_t interface change. 500102 5.0-CURRENT after taskqueue_swi changed to run without Giant, and taskqueue_swi_giant added to run with Giant. 500103 cdevsw_add() and cdevsw_remove() no longer exists. Appearance of MAJOR_AUTO allocation facility. 500104 5.0-CURRENT after new cdevsw initialization method. 500105 devstat_add_entry() has been replaced by devstat_new_entry() 500106 Devstat interface change; see sys/sys/param.h 1.149 500107 Token-Ring interface changes. 500108 Addition of vm_paddr_t. 500109 5.0-CURRENT after &man.realpath.3; has been made thread-safe 500110 5.0-CURRENT after &man.usbhid.3; has been synced with NetBSD 500111 5.0-CURRENT after new NSS implementation and addition of POSIX.1 getpw*_r, getgr*_r functions 500112 5.0-CURRENT after removal of the old rc system. 500113 5.1-RELEASE. 501000 5.1-CURRENT after branching for RELENG_5_1. 501100 5.1-CURRENT after correcting the semantics of sigtimedwait(2) and sigwaitinfo(2). 501101 5.1-CURRENT after adding the lockfunc and lockfuncarg fields to &man.bus.dma.tag.create.9;. 501102 5.1-CURRENT after GCC 3.3.1-pre 20030711 snapshot integration. 501103 5.1-CURRENT 3ware API changes to twe. 501104 5.1-CURRENT dynamically-linked /bin and /sbin support and movement of libraries to /lib. 501105 5.1-CURRENT after adding kernel support for Coda 6.x. 501106 5.1-CURRENT after 16550 UART constants moved from <dev/sio/sioreg.h> to <dev/ic/ns16550.h>. Also when libmap functionality was unconditionally supported by rtld. 501107 5.1-CURRENT after PFIL_HOOKS API update 501108 5.1-CURRENT after adding kiconv(3) 501109 5.1-CURRENT after changing default operations for open and close in cdevsw 501110 5.1-CURRENT after changed layout of cdevsw 501111 5.1-CURRENT after adding kobj multiple inheritance 501112 5.1-CURRENT after the if_xname change in struct ifnet 501113 5.1-CURRENT after changing /bin and /sbin to be dynamically linked 501114 5.2-RELEASE 502000 5.2.1-RELEASE 502010 5.2-CURRENT after branching for RELENG_5_2 502100 5.2-CURRENT after __cxa_atexit/__cxa_finalize functions were added to libc. 502101 5.2-CURRENT after change of default thread library from libc_r to libpthread. 502102 5.2-CURRENT after device driver API megapatch. 502103 5.2-CURRENT after getopt_long_only() addition. 502104 5.2-CURRENT after NULL is made into ((void *)0) for C, creating more warnings. 502105 5.2-CURRENT after pf is linked to the build and install. 502106 5.2-CURRENT after time_t is changed to a 64-bit value on sparc64. 502107 5.2-CURRENT after Intel C/C++ compiler support in some headers and execve(2) changes to be more strictly conforming to POSIX. 502108 5.2-CURRENT after the introduction of the bus_alloc_resource_any API 502109 5.2-CURRENT after the addition of UTF-8 locales 502110 5.2-CURRENT after the removal of the getvfsent(3) API 502111 5.2-CURRENT after the addition of the .warning directive for make. 502112 5.2-CURRENT after ttyioctl() was made mandatory for serial drivers. 502113 5.2-CURRENT after import of the ALTQ framework. 502114 5.2-CURRENT after changing sema_timedwait(9) to return 0 on success and a non-zero error code on failure. 502115 5.2-CURRENT after changing kernel dev_t to be pointer to struct cdev *. 502116 5.2-CURRENT after changing kernel udev_t to dev_t. 502117 5.2-CURRENT after adding support for CLOCK_VIRTUAL and CLOCK_PROF to clock_gettime(2) and clock_getres(2). 502118 5.2-CURRENT after changing network interface cloning overhaul. 502119 5.2-CURRENT after the update of the package tools to revision 20040629. 502120 5.2-CURRENT after marking Bluetooth code as non-i386 specific. 502121 5.2-CURRENT after the introduction of the KDB debugger framework, the conversion of DDB into a backend and the introduction of the GDB backend. 502122 5.2-CURRENT after change to make VFS_ROOT take a struct thread argument as does vflush. Struct kinfo_proc now has a user data pointer. The switch of the default X implementation to xorg was also made at this time. 502123 5.2-CURRENT after the change to separate the way ports rc.d and legacy scripts are started. 502124 5.2-CURRENT after the backout of the previous change. 502125 5.2-CURRENT after the removal of kmem_alloc_pageable() and the import of gcc 3.4.2. 502126 5.2-CURRENT after changing the UMA kernel API to allow ctors/inits to fail. 502127 5.2-CURRENT after the change of the vfs_mount signature as well as global replacement of PRISON_ROOT with SUSER_ALLOWJAIL for the suser(9) API. 502128 5.3-BETA/RC before the pfil API change 503000 5.3-RELEASE 503001 5.3-STABLE after branching for RELENG_5_3 503100 5.3-STABLE after addition of glibc style &man.strftime.3; padding options. 503101 5.3-STABLE after OpenBSD's nc(1) import MFC. 503102 5.4-PRERELEASE after the MFC of the fixes in <src/include/stdbool.h> and <src/sys/i386/include/_types.h> for using the GCC-compatibility of the Intel C/C++ compiler. 503103 5.4-PRERELEASE after the MFC of the change of ifi_epoch from wall clock time to uptime. 503104 5.4-PRERELEASE after the MFC of the fix of EOVERFLOW check in vswprintf(3). 503105 5.4-RELEASE. 504000 5.4-STABLE after branching for RELENG_5_4 504100 5.4-STABLE after increasing the default thread stacksizes 504101 5.4-STABLE after the addition of sha256 504102 5.4-STABLE after the MFC of if_bridge 504103 5.4-STABLE after the MFC of bsdiff and portsnap 504104 5.4-STABLE after MFC of ldconfig_local_dirs change. 504105 6.0-CURRENT 600000 6.0-CURRENT after permanently enabling PFIL_HOOKS in the kernel. 600001 6.0-CURRENT after initial addition of ifi_epoch to struct if_data. Backed out after a few days. Do not use this value. 600002 6.0-CURRENT after the re-addition of the ifi_epoch member of struct if_data. 600003 6.0-CURRENT after addition of the struct inpcb argument to the pfil API. 600004 6.0-CURRENT after addition of the "-d DESTDIR" argument to newsyslog. 600005 6.0-CURRENT after addition of glibc style &man.strftime.3; padding options. 600006 6.0-CURRENT after addition of 802.11 framework updates. 600007 6.0-CURRENT after changes to VOP_*VOBJECT() functions and introduction of MNTK_MPSAFE flag for Giantfree filesystems. 600008 6.0-CURRENT after addition of the cpufreq framework and drivers. 600009 6.0-CURRENT after importing OpenBSD's nc(1). 600010 6.0-CURRENT after removing semblance of SVID2 matherr() support. 600011 6.0-CURRENT after increase of default thread stacks' size. 600012 6.0-CURRENT after fixes in <src/include/stdbool.h> and <src/sys/i386/include/_types.h> for using the GCC-compatibility of the Intel C/C++ compiler. 600013 6.0-CURRENT after EOVERFLOW checks in vswprintf(3) fixed. 600014 6.0-CURRENT after changing the struct if_data member, ifi_epoch, from wall clock time to uptime. 600015 6.0-CURRENT after LC_CTYPE disk format changed. 600016 6.0-CURRENT after NLS catalogs disk format changed. 600017 6.0-CURRENT after LC_COLLATE disk format changed. 600018 Installation of acpica includes into /usr/include. 600019 Addition of MSG_NOSIGNAL flag to send(2) API. 600020 Addition of fields to cdevsw 600021 Removed gtar from base system. 600022 LOCAL_CREDS, LOCAL_CONNWAIT socket options added to unix(4). 600023 &man.hwpmc.4; and related tools added to 6.0-CURRENT. 600024 struct icmphdr added to 6.0-CURRENT. 600025 pf updated to 3.7. 600026 Kernel libalias and ng_nat introduced. 600027 POSIX ttyname_r(3) made available through unistd.h and libc. 600028 6.0-CURRENT after libpcap updated to v0.9.1 alpha 096. 600029 6.0-CURRENT after importing NetBSD's if_bridge(4). 600030 6.0-CURRENT after struct ifnet was broken out of the driver softcs. 600031 6.0-CURRENT after the import of libpcap v0.9.1. 600032 6.0-STABLE after bump of all shared library versions that had not been changed since RELENG_5. 600033 6.0-STABLE after credential argument is added to dev_clone vent handler. 6.0-RELEASE. 600034 6.0-STABLE after 6.0-RELEASE 600100 6.0-STABLE after incorporating scripts from the local_startup directories into the base &man.rcorder.8;. 600101 6.0-STABLE after updating the ELF types and constants. 600102 6.0-STABLE after MFC of pidfile(3) API. 600103 6.0-STABLE after MFC of ldconfig_local_dirs change. 600104 7.0-CURRENT. 700000 7.0-CURRENT after bump of all shared library versions that had not been changed since RELENG_5. 700001 7.0-CURRENT after credential argument is added to dev_clone vent handler. 700002 7.0-CURRENT after memmem(3) is added to libc. 700003 7.0-CURRENT after solisten(9) kernel arguments are modified to accept a backlog paramater. 700004 7.0-CURRENT after IFP2ENADDR() was changed to return a pointer to IF_LLADDR(). 700005 7.0-CURRENT after addition of if_addr member to struct ifnet and IFP2ENADDR() removal. 700006 7.0-CURRENT after incorporating scripts from the local_startup directories into the base &man.rcorder.8;. 700007 7.0-CURRENT after removal of MNT_NODEV mount option. 700008 7.0-CURRENT after ELF-64 type changes and symbol versioning. 700009 7.0-CURRENT after addition of hostb and vgapci drivers, addition of pci_find_extcap(), and changing the AGP drivers to no longer map the aperture. 700010 7-0.CURRENT after tv_sec was made time_t on all platforms but Alpha. 700011 7-0.CURRENT after ldconfig_local_dirs change. 700012 7-0.CURRENT after changes to /etc/rc.d/abi to support /compat/linux/etc/ld.so.cache being a symlink in a readonly filesystem. 700013 7-0.CURRENT after pts import. 700014
Note that 2.2-STABLE sometimes identifies itself as 2.2.5-STABLE after the 2.2.5-RELEASE. The pattern used to be year followed by the month, but we decided to change it to a more straightforward major/minor system starting from 2.2. This is because the parallel development on several branches made it infeasible to classify the releases simply by their real release dates. If you are making a port now, you do not have to worry about old -CURRENTs; they are listed here just for your reference.
Writing something after <filename>bsd.port.mk</filename> Do not write anything after the .include <bsd.port.mk> line. It usually can be avoided by including bsd.port.pre.mk somewhere in the middle of your Makefile and bsd.port.post.mk at the end. You need to include either the bsd.port.pre.mk/bsd.port.post.mk pair or bsd.port.mk only; do not mix these two usages. bsd.port.pre.mk only defines a few variables, which can be used in tests in the Makefile, bsd.port.post.mk defines the rest. Here are some important variables defined in bsd.port.pre.mk (this is not the complete list, please read bsd.port.mk for the complete list). Variable Description ARCH The architecture as returned by uname -m (e.g., i386) OPSYS The operating system type, as returned by uname -s (e.g., FreeBSD) OSREL The release version of the operating system (e.g., 2.1.5 or 2.2.7) OSVERSION The numeric version of the operating system; the same as __FreeBSD_version. PORTOBJFORMAT The object format of the system (elf or aout; note that for modern versions of FreeBSD, aout is deprecated.) LOCALBASE The base of the local tree (e.g., /usr/local/) X11BASE The base of the X11 tree (e.g., /usr/X11R6) PREFIX Where the port installs itself (see more on PREFIX). If you have to define the variables USE_IMAKE, USE_X_PREFIX, or MASTERDIR, do so before including bsd.port.pre.mk. Here are some examples of things you can write after bsd.port.pre.mk: # no need to compile lang/perl5 if perl5 is already in system .if ${OSVERSION} > 300003 BROKEN= perl is in system .endif # only one shlib version number for ELF .if ${PORTOBJFORMAT} == "elf" TCL_LIB_FILE= ${TCL_LIB}.${SHLIB_MAJOR} .else TCL_LIB_FILE= ${TCL_LIB}.${SHLIB_MAJOR}.${SHLIB_MINOR} .endif # software already makes link for ELF, but not for a.out post-install: .if ${PORTOBJFORMAT} == "aout" ${LN} -sf liblinpack.so.1.0 ${PREFIX}/lib/liblinpack.so .endif You did remember to use tab instead of spaces after BROKEN= and TCL_LIB_FILE=, did you not? :-). Install additional documentation If your software has some documentation other than the standard man and info pages that you think is useful for the user, install it under PREFIX/share/doc. This can be done, like the previous item, in the post-install target. Create a new directory for your port. The directory name should reflect what the port is. This usually means PORTNAME. However, if you think the user might want different versions of the port to be installed at the same time, you can use the whole PKGNAME. Make the installation dependent on the variable NOPORTDOCS so that users can disable it in /etc/make.conf, like this: post-install: .if !defined(NOPORTDOCS) ${MKDIR} ${DOCSDIR} ${INSTALL_MAN} ${WRKSRC}/docs/xvdocs.ps ${DOCSDIR} .endif Here are some handy variables and how they are expanded by default when used in the Makefile: DATADIR gets expanded to PREFIX/share/PORTNAME. DOCSDIR gets expanded to PREFIX/share/doc/PORTNAME. EXAMPLESDIR gets expanded to PREFIX/share/examples/PORTNAME. These variables are exported to PLIST_SUB. Their values will appear there as pathnames relative to PREFIX if possible. That is, share/doc/PORTNAME will be substituted for %%DOCSDIR%% in the packing list by default, and so on. (See more on pkg-plist substitution here.) All documentation files and directories installed should be included in pkg-plist with the %%PORTDOCS%% prefix, for example: %%PORTDOCS%%%%DOCSDIR%%/AUTHORS %%PORTDOCS%%%%DOCSDIR%%/CONTACT %%PORTDOCS%%@dirrm %%DOCSDIR%% As an alternative to enumerating the documentation files in pkg-plist, a port can set the variable PORTDOCS to a list of file names and shell glob patterns to add to the final packing list. The names will be relative to DOCSDIR. Therefore, a port that utilizes PORTDOCS and uses a non-default location for its documentation should set DOCSDIR accordingly. If a directory is listed in PORTDOCS or matched by a glob pattern from this variable, the entire subtree of contained files and directories will be registered in the final packing list. If NOPORTDOCS is defined then files and directories listed in PORTDOCS would not be installed and neither would be added to port packing list. Installing the documentation at PORTDOCS as shown above remains up to the port itself. A typical example of utilizing PORTDOCS looks as follows: PORTDOCS= README.* ChangeLog docs/* You can also use the pkg-message file to display messages upon installation. See the section on using pkg-message for details. The pkg-message file does not need to be added to pkg-plist. Subdirectories Try to let the port put things in the right subdirectories of PREFIX. Some ports lump everything and put it in the subdirectory with the port's name, which is incorrect. Also, many ports put everything except binaries, header files and manual pages in the a subdirectory of lib, which does not work well with the BSD paradigm. Many of the files should be moved to one of the following: etc (setup/configuration files), libexec (executables started internally), sbin (executables for superusers/managers), info (documentation for info browser) or share (architecture independent files). See &man.hier.7; for details; the rules governing /usr pretty much apply to /usr/local too. The exception are ports dealing with USENET news. They may use PREFIX/news as a destination for their files. UIDs and GIDs If your port requires a certain user to be on the installed system, let the pkg-install script call pw to create it automatically. Look at net/cvsup-mirror for an example. If your port must use the same user/group ID number when it is installed as a binary package as when it was compiled, then you must choose a free UID from 50 to 999 and register it below. Look at japanese/Wnn6 for an example. Make sure you do not use a UID already used by the system or other ports. This is the current list of UIDs between 50 and 999. bind:*:53:53:Bind Sandbox:/:/sbin/nologin majordom:*:54:54:Majordomo Pseudo User:/usr/local/majordomo:/nonexistent rdfdb:*:55:55:rdfDB Daemon:/var/db/rdfdb:/bin/sh spamd:*:58:58:SpamAssassin user:/var/spool/spamd:/sbin/nologin cyrus:*:60:60:the cyrus mail server:/nonexistent:/nonexistent gnats:*:61:1:GNATS database owner:/usr/local/share/gnats/gnats-db:/bin/sh proxy:*:62:62:Packet Filter pseudo-user:/nonexistent:/nonexistent uucp:*:66:66:UUCP pseudo-user:/var/spool/uucppublic:/usr/libexec/uucp/uucico xten:*:67:67:X-10 daemon:/usr/local/xten:/nonexistent pop:*:68:6:Post Office Owner (popper):/nonexistent:/sbin/nologin wnn:*:69:7:Wnn:/nonexistent:/nonexistent pgsql:*:70:70:PostgreSQL pseudo-user:/usr/local/pgsql:/bin/sh oracle:*:71:71::0:0:Oracle:/usr/local/oracle7:/sbin/nologin ircd:*:72:72:IRC daemon:/nonexistent:/nonexistent ircservices:*:73:73:IRC services:/nonexistent:/nonexistent simscan:*:74:74:Simscan User:/nonexistent:/sbin/nologin ifmail:*:75:66:Ifmail user:/nonexistent:/nonexistent www:*:80:80:World Wide Web Owner:/nonexistent:/sbin/nologin alias:*:81:81:QMail user:/var/qmail/alias:/nonexistent qmaild:*:82:81:QMail user:/var/qmail:/nonexistent qmaill:*:83:81:QMail user:/var/qmail:/nonexistent qmailp:*:84:81:QMail user:/var/qmail:/nonexistent qmailq:*:85:82:QMail user:/var/qmail:/nonexistent qmailr:*:86:82:QMail user:/var/qmail:/nonexistent qmails:*:87:82:QMail user:/var/qmail:/nonexistent mysql:*:88:88:MySQL Daemon:/var/db/mysql:/sbin/nologin vpopmail:*:89:89:VPop Mail User:/usr/local/vpopmail:/nonexistent firebird:*:90:90:Firebird Database Administrator:/usr/local/firebird:/bin/sh mailman:*:91:91:Mailman User:/usr/local/mailman:/sbin/nologin gdm:*:92:92:GDM Sandbox:/:/sbin/nologin jabber:*:93:93:Jabber Daemon:/nonexistent:/nonexistent p4admin:*:94:94:Perforce admin:/usr/local/perforce:/sbin/nologin interch:*:95:95:Interchange user:/usr/local/interchange:/sbin/nologin squeuer:*:96:96:SQueuer Owner:/nonexistent:/bin/sh mud:*:97:97:MUD Owner:/nonexistent:/bin/sh msql:*:98:98:mSQL-2 pseudo-user:/var/db/msqldb:/bin/sh rscsi:*:99:99:Remote SCSI:/usr/local/rscsi:/usr/local/sbin/rscsi squid:*:100:100:squid caching-proxy pseudo user:/usr/local/squid:/sbin/nologin quagga:*:101:101:Quagga route daemon pseudo user:/usr/local/etc/quagga:/sbin/nologin ganglia:*:102:102:Ganglia User:/nonexistent:/sbin/nologin sgeadmin:*:103:103:Sun Grid Engine Admin:/nonexistent:/sbin/nologin slimserv:*:104:104:Slim Devices SlimServer pseudo-user:/nonexistent:/sbin/nologin dnetc:*:105:105:distributed.net client and proxy pseudo-user:/nonexistent:/sbin/nologin clamav:*:106:106:Clamav Antivirus:/nonexistent:/sbin/nologin cacti:*:107:107:Cacti Sandbox:/nonexistent:/sbin/nologin webkit:*:108:108:WebKit Default User:/usr/local/www/webkit:/bin/sh quickml:*:109:109:quickml Server:/nonexistent:/sbin/nologin vscan:*:110:110:Scanning Virus Account:/var/amavis:/bin/sh fido:*:111:111:Fido System:/usr/local/fido:/bin/sh dcc:*:112:112:Distributed Checksum Clearinghouse:/nonexistent:/sbin/nologin amavis:*:113:113:Amavis-stats Account:/nonexistent:/sbin/nologin dhis:*:114:114:DHIS Daemon:/nonexistent:/sbin/nologin _symon:*:115:115:Symon Account:/var/empty:/sbin/nologin postfix:*:125:125:Postfix Mail System:/var/spool/postfix:/sbin/nologin rbldns:*:153:153:rbldnsd pseudo-user:/nonexistent:/sbin/nologin sfs:*:171:171:Self-Certifying File System:/nonexistent:/sbin/nologin agk:*:172:172:AquaGateKeeper:/nonexistent:/nonexistent polipo:*:173:173:polipo web cache:/nonexistent:/sbin/nologin bogomilter:*:174:174:milter-bogom:/nonexistent:/sbin/nologin moinmoin:*:192:192:MoinMoin User:/nonexistent:/sbin/nologin sympa:*:200:200:Sympa Owner:/nonexistent:/sbin/nologin privoxy:*:201:201:Privoxy proxy user:/nonexistent:/sbin/nologin dspam:*:202:202:Dspam:/nonexistent:/sbin/nologin shoutcast:*:210:210:Shoutcast sandbox:/nonexistent:/bin/sh _tor:*:256:256:Tor anonymising router:/var/db/tor:/bin/sh smxs:*:260:260:Sendmail X SMTPS:/nonexistent:/sbin/nologin smxq:*:261:261:Sendmail X QMGR:/nonexistent:/sbin/nologin smxc:*:262:262:Sendmail X SMTPC:/nonexistent:/sbin/nologin smxm:*:263:263:Sendmail X misc:/nonexistent:/sbin/nologin smx:*:264:264:Sendmail X other:/nonexistent:/sbin/nologin ldap:*:389:389:OpenLDAP Server:/nonexistent:/sbin/nologin drweb:*:426:426:Dr.Web Mail Scanner:/nonexistent:/sbin/nologin courier:*:465:465:Courier Mail Server:/nonexistent:/sbin/nologin _bbstored:*:505:505::0:0:BoxBackup Store Daemon:/nonexistent:/bin/sh qtss:*:554:554:Darwin Streaming Server:/nonexistent:/sbin/nologin ircdru:*:555:555:Russian hybrid IRC server:/nonexistent:/bin/sh messagebus:*:556:556:D-BUS Daemon User:/nonexistent:/sbin/nologin avahi:*:558:558:Avahi Daemon User:/nonexistent:/sbin/nologin bnetd:*:700:700:Bnetd user:/nonexistent:/sbin/nologin bopm:*:717:717:Blitzed Open Proxy Monitor:/nonexistent:/bin/sh bacula:*:910:910:Bacula Daemon:/var/db/bacula:/sbin/nologin This is the current list of reserved GIDs. bind:*:53: rdfdb:*:55: spamd:*:58: cyrus:*:60: proxy:*:62: authpf:*:63: uucp:*:66: xten:*:67: dialer:*:68: network:*:69: pgsql:*:70: simscan:*:74: www:*:80: qnofiles:*:81: qmail:*:82: mysql:*:88: vpopmail:*:89: firebird:*:90: mailman:*:91: gdm:*:92: jabber:*:93: p4admin:*:94: interch:*:95: squeuer:*:96: mud:*:97: msql:*:98: rscsi:*:99: squid:*:100: quagga:*:101: ganglia:*:102: sgeadmin:*:103: slimserv:*:104: dnetc:*:105: clamav:*:106: cacti:*:107: webkit:*:108: quickml:*:109: vscan:*:110: fido:*:111: dcc:*:112: amavis:*:113: dhis:*:114: _symon:*:115: postfix:*:125: maildrop:*:126: rbldns:*:153: sfs:*:171: agk:*:172: polipo:*:173: moinmoin:*:192: sympa:*:200: dspam:*:202: _tor:*:256: smxs:*:260: smxq:*:261: smxc:*:262: smxm:*:263: smx:*:264: ldap:*:389: drweb:*:426: courier:*:465: _bbstored:*:505: qtss:*:554: ircdru:*:555: messagebus:*:556: realtime:*:557: avahi:*:558: bnetd:*:700: bopm:*:717: bacula:*:910: Please include a notice when you submit a port (or an upgrade) that reserves a new UID or GID in this range. This allows us to keep the list of reserved IDs up to date. Do things rationally The Makefile should do things simply and reasonably. If you can make it a couple of lines shorter or more readable, then do so. Examples include using a make .if construct instead of a shell if construct, not redefining do-extract if you can redefine EXTRACT* instead, and using GNU_CONFIGURE instead of CONFIGURE_ARGS += --prefix=${PREFIX}. If you find yourself having to write a lot of new code to try to do something, please go back and review bsd.port.mk to see if it contains an existing implementation of what you are trying to do. While hard to read, there are a great many seemingly-hard problems for which bsd.port.mk already provides a shorthand solution. Respect both <makevar>CC</makevar> and <makevar>CXX</makevar> The port should respect both CC and CXX variables. What we mean by this is that the port should not set the values of these variables absolutely, overriding existing values; instead, it should append whatever values it needs to the existing values. This is so that build options that affect all ports can be set globally. If the port does not respect these variables, please add NO_PACKAGE=ignores either cc or cxx to the Makefile. An example of a Makefile respecting both CC and CXX variables follows. Note the ?=: CC?= gcc CXX?= g++ Here is an example which respects neither CC nor CXX variables: CC= gcc CXX= g++ Both CC and CXX variables can be defined on FreeBSD systems in /etc/make.conf. The first example defines a value if it was not previously set in /etc/make.conf, preserving any system-wide definitions. The second example clobbers anything previously defined. Respect <makevar>CFLAGS</makevar> The port should respect the CFLAGS variable. What we mean by this is that the port should not set the value of this variable absolutely, overriding the existing value; instead, it should append whatever values it needs to the existing value. This is so that build options that affect all ports can be set globally. If it does not, please add NO_PACKAGE=ignores cflags to the Makefile. An example of a Makefile respecting the CFLAGS variable follows. Note the +=: CFLAGS+= -Wall -Werror Here is an example which does not respect the CFLAGS variable: CFLAGS= -Wall -Werror The CFLAGS variable is defined on FreeBSD systems in /etc/make.conf. The first example appends additional flags to the CFLAGS variable, preserving any system-wide definitions. The second example clobbers anything previously defined. You should remove optimization flags from the third party Makefiles. System CFLAGS contains system-wide optimization flags. An example from an unmodified Makefile: CFLAGS= -O3 -funroll-loops -DHAVE_SOUND Using system optimization flags, the Makefile would look similar to the following example: CFLAGS+= -DHAVE_SOUND Threading libraries The threading library must be linked to the binaries using a special linker flag -pthread on &os;. If a port insists on linking -lpthread or -lc_r directly, patch it to use PTHREAD_LIBS variable provided by the ports framework. This variable usually has the value of -pthread, but on certain architectures and &os; versions it can have different values, so do not just hardcode -pthread into patches and always use PTHREAD_LIBS. Feedback Do send applicable changes/patches to the original author/maintainer for inclusion in next release of the code. This will only make your job that much easier for the next release. <filename>README.html</filename> Do not include the README.html file. This file is not part of the cvs collection but is generated using the make readme command. Marking a port not installable with <makevar>BROKEN</makevar>, <makevar>FORBIDDEN</makevar>, or <makevar>IGNORE</makevar> In certain cases users should be prevented from installing a port. To tell a user that a port should not be installed, there are several make variables that can be used in a port's Makefile. The value of the following make variables will be the reason that is given back to users for why the port refuses to install itself. Please use the correct make variable as each make variable conveys radically different meanings to both users, and to automated systems that depend on the Makefiles, such as the ports build cluster, FreshPorts, and portsmon. Variables BROKEN is reserved for ports that currently do not compile, install, or deinstall correctly. It should be used for ports where the the problem is believed to be temporary. The build cluster will still attempt to try to build them to see if the underlying problem has been resolved. For instance, use BROKEN when a port: does not compile fails its configuration or installation process installs files outside of ${LOCALBASE} and ${X11BASE} does not remove all its files cleanly upon deinstall (however, it may be acceptable, and desirable, for the port to leave user-modified files behind) FORBIDDEN is used for ports that do contain a security vulnerability or induce grave concern regarding the security of a FreeBSD system with a given port installed (ex: a reputably insecure program or a program that provides easily exploitable services). Ports should be marked as FORBIDDEN as soon as a particular piece of software has a vulnerability and there is no released upgrade. Ideally ports should be upgraded as soon as possible when a security vulnerability is discovered so as to reduce the number of vulnerable FreeBSD hosts (we like being known for being secure), however sometimes there is a noticeable time gap between disclosure of a vulnerability and an updated release of the vulnerable software. Do not mark a port FORBIDDEN for any reason other than security. IGNORE is reserved for ports that should not be built for some other reason. It should be used for ports where the the problem is believed to be structural. The build cluster will not, under any circumstances, build ports marked as IGNORE. For instance, use IGNORE when a port: compiles but does not run properly does not work on the installed version of &os; requires &os; kernel sources to build, but the user does not have them installed has a distfile which may not be automatically fetched due to licensing restrictions does not work with some other currently installed port (for instance, the port depends on www/apache21 but www/apache13 is installed) If a port would conflict with a currently installed port (for example, if they install a file in the same place that perfoms a different function), use CONFLICTS instead. CONFLICTS will set IGNORE by itself. If a port sould be marked IGNORE only on certain architectures, there are two other convenience variables that will automatically set IGNORE for you: ONLY_FOR_ARCHS and NOT_FOR_ARCHS. Examples: ONLY_FOR_ARCHS= i386 amd64 NOT_FOR_ARCHS= alpha ia64 sparc64 Implementation Notes The strings should not be quoted. Also, the wording of the string should be somewhat different due to the way the information is shown to the user. Examples: BROKEN= this port is unsupported on FreeBSD 5.x IGNORE= is unsupported on FreeBSD 5.x resulting in the following output from make describe: ===> foobar-0.1 is marked as broken: this port is unsupported on FreeBSD 5.x. ===> foobar-0.1 is unsupported on FreeBSD 5.x. Marking a port for removal with <makevar>DEPRECATED</makevar> or <makevar>EXPIRATION_DATE</makevar> Do remember that BROKEN and FORBIDDEN are to be used as a temporary resort if a port is not working. Permanently broken ports should be removed from the tree entirely. When it makes sense to do so, users can be warned about a pending port removal with DEPRECATED and EXPIRATION_DATE. The former is simply a string stating why the port is scheduled for removal; the latter is a string in ISO 8601 format (YYYY-MM-DD). Both will be shown to the user. It is possible to set DEPRECATED without an EXPIRATION_DATE (for instance, recommending a newer version of the port), but the converse does not make any sense. There is no set policy on how much notice to give. Current practice seems to be one month for security-related issues and two months for build issues. This also gives any interested committers a little time to fix the problems. Avoid use of the <literal>.error</literal> construct The correct way for a Makefile to signal that the port can not be installed due to some external factor (for instance, the user has specified an illegal combination of build options) is to set a nonblank value to IGNORE. This value will be formatted and shown to the user by make install. It is a common mistake to use .error for this purpose. The problem with this is that many automated tools that work with the ports tree will fail in this situation. The most common occurence of this is seen when trying to build /usr/ports/INDEX (see ). However, even more trivial commands such as make -V maintainer also fail in this scenario. This is not acceptable. How to avoid using <literal>.error</literal> Assume that someone has the line USE_POINTYHAT=yes in make.conf. The first of the next two Makefile snippets will cause make index to fail, while the second one will not: .if USE_POINTYHAT .error "POINTYHAT is not supported" .endif .if USE_POINTYHAT IGNORE=POINTYHAT is not supported .endif Necessary workarounds Sometimes it is necessary to work around bugs in software included with older versions of &os;. Some versions of &man.make.1; were broken on at least 4.8 and 5.0 with respect to handling comparisons based on OSVERSION. This would often lead to failures during make describe (and thus, the overall ports make index). The workaround is to enclose the conditional comparison in spaces, e.g.: if ( ${OSVERSION} > 500023 ) Be aware that test-installing a port on 4.9 or 5.2 will not detect this problem. Miscellanea The files pkg-descr and pkg-plist should each be double-checked. If you are reviewing a port and feel they can be worded better, do so. Do not copy more copies of the GNU General Public License into our system, please. Please be careful to note any legal issues! Do not let us illegally distribute software!
A Sample <filename>Makefile</filename> Here is a sample Makefile that you can use to create a new port. Make sure you remove all the extra comments (ones between brackets)! It is recommended that you follow this format (ordering of variables, empty lines between sections, etc.). This format is designed so that the most important information is easy to locate. We recommend that you use portlint to check the Makefile. [the header...just to make it easier for us to identify the ports.] # New ports collection makefile for: xdvi [the "version required" line is only needed when the PORTVERSION variable is not specific enough to describe the port.] # Date created: 26 May 1995 [this is the person who did the original port to FreeBSD, in particular, the person who wrote the first version of this Makefile. Remember, this should not be changed when upgrading the port later.] # Whom: Satoshi Asami <asami@FreeBSD.org> # # $FreeBSD$ [ ^^^^^^^^^ This will be automatically replaced with RCS ID string by CVS when it is committed to our repository. If upgrading a port, do not alter this line back to "$FreeBSD$". CVS deals with it automatically.] # [section to describe the port itself and the master site - PORTNAME and PORTVERSION are always first, followed by CATEGORIES, and then MASTER_SITES, which can be followed by MASTER_SITE_SUBDIR. PKGNAMEPREFIX and PKGNAMESUFFIX, if needed, will be after that. Then comes DISTNAME, EXTRACT_SUFX and/or DISTFILES, and then EXTRACT_ONLY, as necessary.] PORTNAME= xdvi PORTVERSION= 18.2 CATEGORIES= print [do not forget the trailing slash ("/")! if you are not using MASTER_SITE_* macros] MASTER_SITES= ${MASTER_SITE_XCONTRIB} MASTER_SITE_SUBDIR= applications PKGNAMEPREFIX= ja- DISTNAME= xdvi-pl18 [set this if the source is not in the standard ".tar.gz" form] EXTRACT_SUFX= .tar.Z [section for distributed patches -- can be empty] PATCH_SITES= ftp://ftp.sra.co.jp/pub/X11/japanese/ PATCHFILES= xdvi-18.patch1.gz xdvi-18.patch2.gz [maintainer; *mandatory*! This is the person who is volunteering to handle port updates, build breakages, and to whom a users can direct questions and bug reports. To keep the quality of the Ports Collection as high as possible, we no longer accept new ports that are assigned to "ports@FreeBSD.org".] MAINTAINER= asami@FreeBSD.org COMMENT= A DVI Previewer for the X Window System [dependencies -- can be empty] RUN_DEPENDS= gs:${PORTSDIR}/print/ghostscript LIB_DEPENDS= Xpm.5:${PORTSDIR}/graphics/xpm [this section is for other standard bsd.port.mk variables that do not belong to any of the above] [If it asks questions during configure, build, install...] IS_INTERACTIVE= yes [If it extracts to a directory other than ${DISTNAME}...] WRKSRC= ${WRKDIR}/xdvi-new [If the distributed patches were not made relative to ${WRKSRC}, you may need to tweak this] PATCH_DIST_STRIP= -p1 [If it requires a "configure" script generated by GNU autoconf to be run] GNU_CONFIGURE= yes [If it requires GNU make, not /usr/bin/make, to build...] USE_GMAKE= yes [If it is an X application and requires "xmkmf -a" to be run...] USE_IMAKE= yes [et cetera.] [non-standard variables to be used in the rules below] MY_FAVORITE_RESPONSE= "yeah, right" [then the special rules, in the order they are called] pre-fetch: i go fetch something, yeah post-patch: i need to do something after patch, great pre-install: and then some more stuff before installing, wow [and then the epilogue] .include <bsd.port.mk> Keeping Up The &os; Ports Collection is constantly changing. Here is some information on how to keep up. FreshPorts One of the easiest ways to learn about updates that have already been committed is by subscribing to FreshPorts. You can select multiple ports to monitor. Maintainers are strongly encouraged to subscribe, because they will receive notification of not only their own changes, but also any changes that any other &os; committer has made. (These are often necessary to keep up with changes in the underlying ports framework—although it would be most polite to receive an advance heads-up from those committing such changes, sometimes this is overlooked or just simply impractical. Also, in some cases, the changes are very minor in nature. We expect everyone to use their best judgement in these cases.) If you wish to use FreshPorts, all you need is an account. If your registered email address is @FreeBSD.org, you will see the opt-in link on the right hand side of the webpages. For those of you who already have a FreshPorts account, but are not using your @FreeBSD.org email address, just change your email to @FreeBSD.org, subscribe, then change it back again. FreshPorts also has a sanity test feature which automatically tests each commit to the FreeBSD ports tree. If subscribed to this service, you will be notified of any errors which FreshPorts detects during sanity testing of your commits. The Web Interface to the Source Repository It is possible to browse the files in the source repository by using a web interface. Changes that affect the entire port system are now documented in the CHANGES file. Changes that affect individual ports are now documented in the UPDATING file. However, the definitive answer to any question is undoubtedly to read the source code of bsd.port.mk, and associated files. The &os; Ports Mailing List If you maintain ports, you should consider following the &a.ports;. Important changes to the way ports work will be announced there, and then committed to CHANGES. The &os; Port Building Cluster on <hostid role="hostname">pointyhat.FreeBSD.org</hostid> One of the least-publicized strengths of &os; is that an entire cluster of machines is dedicated to continually building the Ports Collection, for each of the major OS releases and for each Tier-1 architecture. You can find the results of these builds at package building logs and errors. Individual ports are built unless they are specifically marked with IGNORE. Ports that are marked with BROKEN will still be attempted, to see if the underlying problem has been resolved. (This is done by passing TRYBROKEN to the port's Makefile.) The &os; Port Distfile Survey The build cluster is dedicated to building the latest release of each port with distfiles that have already been fetched. However, as the Internet continually changes, distfiles can quickly go missing. The FreeBSD Ports distfiles survey attempts to query every download site for every port to find out if each distfile is still currently available. Maintainers are asked to check this report periodically, not only to speed up the building process for users, but to help avoid wasting bandwidth of the sites that volunteer to host all these distfiles. The &os; Ports Monitoring System Another handy resource is the FreeBSD Ports Monitoring System (also known as portsmon). This system comprises a database that processes information from several sources and allows its to be browsed via a web interface. Currently, the ports Problem Reports (PRs), the error logs from the build cluster, and individual files from the ports collection are used. In the future, this will be expanded to include the distfile survey, as well as other sources. To get started, you can view all information about a particular port by using the Overview of One Port. As of this writing, this is the only resource available that maps GNATS PR entries to portnames. (PR submitters do not always include the portname in their Synopsis, although we would prefer that they did.) So, portsmon is a good place to start if you want to find out whether an existing port has any PRs filed against it and/or any build errors; or, to find out if a new port that you may be thinking about creating has already been submitted.
diff --git a/zh_TW.Big5/books/zh-tut/chapters/compose.sgml b/zh_TW.Big5/books/zh-tut/chapters/compose.sgml index 973a2ecfa7..2af07b460c 100644 --- a/zh_TW.Big5/books/zh-tut/chapters/compose.sgml +++ b/zh_TW.Big5/books/zh-tut/chapters/compose.sgml @@ -1,1036 +1,1035 @@ ¤¤¤å±Æª©³nÅé OpenOffice - ¾ã¦X©Êªº¿ì¤½«Ç³nÅé ¦w¸Ë¦n OpenOffice 1.0 «á¡A¹w³]¬O¦b /usr/local/OpenOffice.org1.0/ ¥ô¦ó¨Ï¥ÎªÌ°õ¦æ /usr/local/OpenOffice.org1.0/program/soffice ³£·|¥X²{¬O§_­n repair µe­±(in X)¡A¿ï¾Ü Yes¡A¨Ã¿ï¾Ü Complete ·|§â¤@¨ÇªF¦è¸Ë¨ì ~/OpenOffice.org1.0/¡A ¨Ã¸õ¥X setup ¦A¦¸°õ¦æ /usr/local/OpenOffice.org1.0/program/soffice ´N¥i¥H¬Ý¨ì soffice ªº doc ¤å®Ñ³B²zµe­±¤F Q1: ¦p¦ó¥[¤J¤¤¤å¦r«¬¡H A1: GUI ªº¥[¤J¤è¦¡¡G °õ¦æ /usr/local/OpenOffice.org1.0/program/spadmin ¦C¦LºÞ²zµ{¦¡¡A Fonts -> Add -> Source directory: /usr/local/share/fonts/TrueType/ -> £¾Create soft links only -> ¤å¹©PL²Ó¤W®ü§º(bsmi00lp.ttf) -> Ok CLI ªº¥[¤J¤è¦¡¡G cd /usr/local/OpenOffice.org1.0/share/fonts/truetype ln -s /usr/local/share/fonts/TrueType/bsmi00lp.ttf bsmi00lp.ttf ¦b¥[¤J§¹¦r«¬«á¡AOpenOffice ¦b¨C¦¸¶i¤J³nÅé«e³£·|¦Û°Ê«Ø¥ß fonts.dir Q2: µe­±«ÜÁà¡A­^¤å¦r«Ü¼e¡H A2: ­×§ï¤À¦¨¨â­Ó³¡¥÷¡A¤@­Ó¬O±N Interface User §ï¦¨¤å¹©PL²Ó¤W®ü§º¡A ¥t¤@­Ó«h¬O½Õ¾ã¦r«¬¤j¤p¡A¦r«¬µy·L¤j¤@ÂI´N·|¦³ AntiAlias ªº®ÄªG¡A «Øij­È¬O >= 120% GUI ªº­×§ï¤è¦¡¡G ±Ò°Ê soffice «á­×§ï Interface User Tools -> Options -> OpenOffice.org -> Font Replacement -> £¾Apply replacement table -> Font: Interface User Replace with: ¤å¹© PL ²Ó¤W®ü§º -> £¾ -> £¾always -> Ok ­×§ï¦r«¬¤j¤p Tools -> Options -> OpenOffice.org -> View -> Scale: 120% -> Ok Q3: ¿é¤J¤¤¤åÅܦ¨¤è¶ô¡H A3: ¦]¬°¹w³]ªº Thorndale ¨Ã¤£¯àÅã¥Ü¤¤¤å¡Aµ§ªÌ·|Åý¹w³]¦¨¤å¹©PL²Ó¤W®ü§º GUI ªº­×§ï¤è¦¡¡G ±Ò°Ê soffice «á­×§ï Basic Fonts(Western) ©M Basic Fonts(Asian) Tools -> Options -> OpenOffice.org -> Text Document -> Basic Fonts(Western) -> Default: ¤å¹©PL²Ó¤W®ü§º -> Heading: ¤å¹©PL²Ó¤W®ü§º -> Ok Q4: ¦p¦ó¶}±Ò¤¤¤åªºHTML¤Î¯Â¤å¦rÀÉ¡H A4: ¦pªG±z­n¶}¯Â¤å¦rÀÉ¡A¦b¶}±ÒÀɮתº¹ï¸Ü®Ø¤¤¡A FileType°O±o¿ï¡GText Encoded¡A ·í¿ï§¹±z­n¶}ªºÀɮ׫á¡A·|¦A¥X²{¤@­Ó¹ï¸Ü®Ø¡A ³Ì­«­nªº¬OFonts¨º¨à­n¿ï¡GChinese traditional ( Windows-950 )¡A ³Ñ¤Uªº·Ó±zªº­n¨D¿ï¡A¤§«á¤¤¤å´N¥X¨ÓÅo¡ã ÁÙ¬O¬Ý¤£¨ì¡H¸Õ¸Õ¬Ý§ï¤@¤U¦r§Î¡A¤]³\±z¿ï¨ì¤F­^¤å¦r«¬¡C ¦pªG¬OHTML©O¡H§ó¬O²³æ¡A½Ð¦bÀɮפ@¶}ÀY¥[¤W¡G <HEAD> <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=big5"> </HEAD> Q5: ¨Ï¥Î²Ó©úÅé»P·s²Ó©úÅé®É¡AÅã¥Üªº¦r·|¸H±¼¡H A5: ¼x¨D¸Ñµª¤¤¡C
openoffice snapshot
WWW: http://www.openoffice.org/
- eioffice - ¥Ã¤¤Office 2003 - eioffice ¥Ø«e¥u¦³ Windows ©M GNU/Linux ªºª©¥». - FreeBSD °µªk¨ä¹ê«Ü²³æ, ¦]¬°§Ú¥»¨Ó¥H¬°¥Lªº GNU/Linux - ª©¥Î¤F¯S®íªºÀ£ÁY¨Ó¥]¸Ë, µ²ªG§ì¥h¬Ý¤F¤@¤U, µo²{ fonts.data - ©M source.data ³o¨â­Ó³Ì¤jªºÀɳºµM¬O¥Î zip À£ÁYªº, ¸Ñ¶}·íµMµo²{ - fonts.data ¸Ì­±¥]ªº¬O¦r«¬, source.data ¸Ì­±´N¬O¥D­nªºµ{¦¡Åo, - «þ¨©¨ì¬Û¹ïÀ³ªº¦a¤è«á´N¥i¥H°õ¦æ¤F. - ­nª`·Nªº¬O, unzip ¤@©w­n¥Î chinese/unzip, ¦]¬°§Ú¦³§Ë¤¤¤åªº patch ¦b¤W­±, ¤£µM¥i¯à·|¦³¿ù. - jdk §Ú¥u¦³´ú¸Õ 1.4.1, ¤£ª¾¹D 1.4.2 ¦³¨S¦³®t§O. + eioffice - ¥Ã¤¤Office 2004 + eioffice ¥Ø«e¥u¦³ Windows ©M GNU/Linux ªºª©¥»¡C + FreeBSD °µªk¨ä¹ê«Ü²³æ¡A¦]¬°§Ú¥»¨Ó¥H¬°¥Lªº GNU/Linux + ª©¥Î¤F¯S®íªºÀ£ÁY¨Ó¥]¸Ë¡Aµ²ªG§ì¥h¬Ý¤F¤@¤U¡Aµo²{ fonts.data + ©M source.data ³o¨â­Ó³Ì¤jªºÀɳºµM¬O¥Î zip À£ÁYªº¡C¸Ñ¶}·íµMµo²{ + fonts.data ¸Ì­±¥]ªº¬O¦r«¬¡A¦Ó source.data ¸Ì­±´N¬O¥D­nªºµ{¦¡Åo¡A«þ¨©¨ì¬Û¹ïÀ³ªº¦a¤è«á´N¥i¥H°õ¦æ¤F¡C + ­nª`·Nªº¬O¡Aunzip ¤@©w­n¥Î chinese/unzip ¸Ëªº¡A¦]¬°§Ú¦³§Ë¤¤¤åªº patch ¦b¤W­±¡A¤£µM¥i¯à·|¦³¿ù¡C + jdk §Ú¥u¦³´ú¸Õ 1.4.1¡A¤£ª¾¹D 1.4.2 ¦³¨S¦³®t§O¡C §Ú¤]§Ë¤F¨â­Óª©¥», ²Åé(eioffice-zh_CN)©MÁcÅé(eioffice-zh_TW), §ó·s outta-port «á´N·|¬Ý¨ìÅo. - WWW: ¥xÆW¥Ã¤¤ + WWW: ¥xÆW¥Ã¤¤ WWW: ¤j³°¥Ã¤¤ AbiWord - ¶}©ñ­ì©l½X¡B¸ó¥­¥x¡B©Ò¨£§Y©Ò±oªº¤å¦r½s¿è¾¹ AbiWord ¥i¥H»¡¬O Word ªºÂ½ª©¡A ¥u¬O´«¤F­Ó§@·~¨t²Î¡A®e©ö¤W¤â¡B ¤¶­±¤Íµ½ªºÀuÂI¤´¦b¡C¦ý¦]¥L¤´¬Oµo®i¤¤ªº³nÅé¡A³\¦hªº¥\¯à¡A ¨Ã¤£¯à»P·L³nªº Word ¬Û¤ñ¡A¾ãÅé¤W¦³¤@ÂIÂI¯Ê¾Ñ¡C¥i¬O¥L¤´¬O FreeBSD ¤Wªº­«­n«ü¼Ð¡A¥NªíµÛ¥¼¨Ó FreeBSD ±N¦³¤£¿é©ó Word ªº³nÅé¥X²{¡A¤]»¡©úµÛ¡AFreeBSD ±N±q¦øªA¾¹¨«¦V­Ó¤H¨Ï¥ÎªÌ¡C «Øij±Ä¥Î editors/AbiWord2¡A ¥u­n¦³³]©w¦n gtk2 ´N¥i¥H¥¿±`¨Ï¥Î¡A­ì¥»ªº chinese/abiword ·f°t editors/AbiWord ¤w¸gµLªk¥¿±`¨Ï¥Î¡A ©Ò¥H¥H¤Uªº¤å³¹¥i¥H©¿²¤¡A¥u­n¦w¸Ë§¹ AbiWord2¡A ¿é¤J¤¤¤å«e¿ï¾Ü¤¤¤å¦rÅé¡A´N¥i¥H¥¿±`ªº¿é¤J¤¤¤å¡C AbiWord ¤w¸g¥i¥H¦b zh_TW.Big5 ªº locale ©³¤U¤u§@¨Ã¿é¤J¡A ¿ï³æ¤]¤w¸g³¡¥÷¤¤¤å¤Æ¡A¤¤¤åªº¦C¦L¤]¥i¥H³z¹L moecid-fonts¡C ¦b AbiWord ¤¤·s¼W¦r«¬¡G ­n¦b AbiWord ¤¤¦w¸Ë¤¤¤å¦r«¬¤~¯à¿é¤J¤¤¤å¦r¡A ¦w¸Ëªº¤è¦¡¥²¶·³z¹L ttfm ³o®M¦n¥Îªº³nÅé¡C¦b¦¹®M¥ó¤¤¤w¸g¹w³]¦w¸Ë¤F¤å¹©ÁcÅé»P²Åé¦r«¬¡C ¦pªG·Q¦Û¦æ¦w¸Ë·s¦r«¬¡A¥H¤U¬O¤å¹©ÁcÅ骺¦w¸Ë¡A¥i¥H°Ñ¦Ò¬Ý¬Ý¡G &prompt.root; ttfm.sh --add abiword /usr/local/share/fonts/TrueType/bkai00lp.ttf &prompt.root; ttfm.sh --add abiword /usr/local/share/fonts/TrueType/bsmi00lp.ttf ¨Ã¦b XF86Config ¥[¤J ¡C Ãö©ó¤¤¤å¦C¦Lªº³¡¤À¡A½Ð°Ñ¦Ò abiword ªº²ÊÅé»P±×Åé ¤@¸`¡C
abiword snapshot
WWW: abisource project WWW: gnome-office abiword
XEmacs - ¤ä´© XIM ¥B Big5 ³]©wªº XEmacs ¤å¦r½s¿è¾¹ ·í±z°Ý¤@¨Ç¨Ï¥ÎUnix¦h¦~ªº¦Ñª±®a¡A ¥L­Ì»{¬°³Ì¨ã¥Nªí©Êªº¤å®Ñ³B²z³nÅé¬O¤°»ò©O¡H ¥L­Ì´X¥G³£·|¦^µª¡ÐEmacs¡A¦Ó¦bX Windowªº­·¦æ¤§¤U¡A Emacs¤]±À¥X¤FXWindowsª©¡ÐXEmacs¡C XEmacs¤@¶µµÛ¦Wªº¯à¤O¬O¥¦¯à°÷³B²z¦h°ê»y¤å¡A ¯à°÷³B²z¦UºØ¤£¦P¤å¦rªº³nÅé¤v¸g¥O¤H¤Q¤ÀÅ岧¡A ¦ý­n¦b¤@­Ó¤å¥ó¤¤¦P®É³B²z¦n´XºØ¤£¦P»y¤å¡A XEmacsÁÙ¬O¥i¥H°µ¨ì¡A¥¦¦b³o¤è­±ªº¯à¤O¡A ´X¥G¨S¦³¦PÃþ§Îªº³nÅé¯à±æ¨ä¶µ­I¡C °£¦¹¤§¥~¡AXEmacs¬°¤F¯à³B²z¦UºØ¤å¥ó¡A¥¦±NÂsÄýHTML¤å¥ó¡A ÁÙ¦³¦¬µoE-mailªº¥\¯à¥þ³¡¾ã¦X¶i¨Ó¡AÅý±z¯à°÷¥ÎXEmacs¨Ó½s¼g HTML©Î¬O¼g«Hªº¤u§@¡C¥¦¬Æ¦ÜÁÙ¾ã¦X¤FC©MLisp»y¨¥ªº½sĶ¾¹¡A Åý±z¦bXEmacs¤W¼gµ{¦¡¡A¨Ã¥B¤]¥i¥H¦b¨ä¤¤½sĶµ{¦¡¡A ¨Ï¼gµ{¦¡®É´î¤Ö­±¹ïÁcº¾ªº¨Æ°È¡C ¹³«÷¦rÀˬd³oºØ¤u§@¡A¤@¯ë³£¥u¦³°Ó·~³nÅé´£¨Ñ¡A ¦ý¬OXEmacs¤]´£¨Ñ¤F¡A³s¦r¨å¤]¥i¥H¦Û¤v«ü©w¡AUnixªº¥Ø¿ýµ²ºc¡A XEmacs¤]¥i¥H½s¿è¡C¨ä¥¦ÁÙ¦³³\³\¦h¦hªº¥\¯à¡A«Ü¦h¤H¥Î¤F¤@¬q®É¶¡¡A ³£¥u¦³¨Ï¥Î¤F¤@¤p³¡¤À¡A¥i¨£¨ä¥\¯à¤§¼s¡C XEmacs¬O¤@­Ó¤£¥i¦h±oªº¤å®Ñ³B²z³nÅé¡A¸Õ¸Õ¬Ý¡A ©Î³\¥i¥HÅý±z¦³§ó¤è«K³B²z¤å¥óªº¤èªk¡C ¦w¸Ë chinese/xemacs21¡C ÁÙ¦³¡Aemacs ©M xemacs ¬O¤£¤@¼Ëªº¡Aªì¾Ç *emacs ÁÙ¬O±q xemacs ¾Ç¤ñ¸û¦n¡C¦Ü¤Ö &a.keith; ¤j¤j§â¤@¤Á³£¥´ÂI¦n¤F¡C ~/Emacs «h¬O³] fontset¡C Emacs.Font: fontset-18 Emacs.Fontset-0: -*-*-medium-r-normal-*-18-*-*-*-*-*-fontset-18,\ ascii:-*-lucidatypewriter-medium-r-normal-*-*-100-*-*-m-*-iso8859-1,\ chinese-big5-1:-*-fixed-medium-r-normal-*-*-160-*-*-c-*-big5-0,\ chinese-big5-2:-*-fixed-medium-r-normal-*-*-160-*-*-c-*-big5-0 wvware - ¥i¥HÂà´«·L³n Word Àɮתº¤u¨ã Last Update: 2003¦~ 1¤ë26¤é ©P¤é 03®É34¤À02¬í CST wv ¬O¤@®M¥i¥HÂà´«·L³n Word Àɮתº¤u¨ã¡A ¯à°÷Ū¨ú¨Ã¥B¸ÑªR Word 6-9 ®æ¦¡ (Word 6, 95, 97, 2000)¡C ¨Ã¥B´£¨Ñ³\¦hÂà´«¤u¨ã¡A³qºÙ¬° wvWare¡C wvHtml, wvLatex, wvCleanLatex, wvDVI, wvPS, wvPDF, wvText, wvAbw, wvWml, wvMime ¦w¸Ë textproc/wv¡C ±µµÛ¥H³Ì±`¥Îªº wvHtml ¬°¨Ò¡A­nÂà Word ¦¨ HTML¡A ¥u­n¤U wvHtml --charset=big5 input.doc ouput.html ¡C WWW: wvware project Emacs ¦w¸Ë chinese/emacs20¡C emacs ¤£¬O§¹¾ãªº XIM support¡A½Ð¬Ý http://www.FreeBSD.org/cgi/query-pr.cgi?pr=21160¡C ~/.emacs ¬O³] mule ;; Set environment to Chinese-Big5 (set-language-environment 'chinese-big5) (set-keyboard-coding-system 'chinese-big5) (set-terminal-coding-system 'chinese-big5) (set-buffer-file-coding-system 'chinese-big5) (set-selection-coding-system 'chinese-big5) (modify-coding-system-alist 'process "*" 'chinese-big5) ¦Ü©ó ~/.emacs ÁÙ¦³«Ü¦h¦nª±ªº¡A¥i¥H¨ì http://dotfiles.com °Ñ¦Ò°Ñ¦Ò¡C celvis - Ãþ¦ü vi/ex ¥B¤¤¤åÅã¥Üªº¤å¦r½s¿è¾¹ Celvis ¬O¤@­Ó«Ü¹³ UNIX ¤W¼Ð·Ç½s¿è¾¹ vi/ex ªºªF¦è¡A´X¥G¤ä´©©Ò¦³ vi/ ex ªº«ü¥O¡C Celvis ¥i½s¿è¦P®É§t¦³¤¤­^¤åªº¤å³¹¡C ¥¦¤]¦P®É¤ä´© GB2312-80 ©M BIG5 ½s½X¡C ¦w¸Ë chinese/celvis¡C joe - ²©ö¥B¥\¯à¤£¿ùªº½s¿èµ{¦¡ joe ¬O¤@­Ó UNIX ¤W§K¶O±M·~ªº ASCII ¤å¦r½s¿è¾¹¡C¥¦¥Î°_¨Ó´N¹³¤j³¡¥÷ IBM PC ¤Wªº¤å¦r½s¿è¾¹¡C ¥¦¬O¤@®M¾Þ§@¬Û·í¤è«Kªº¤å®Ñ½s¿èµ{¦¡¡C ¦w¸Ë chinese/joe¡C ­n¦b joe ¤W¨Ï¥Î¤¤¤å¡A¥²¶·­×§ï /usr/local/lib/joerc ©M /usr/local/lib/rjoercªº³]©w¡C -asis Characters 128 - 255 shown as-is quote Enter Ctrl chars ±N¥H¤Wªº¦Û¶Ç­×§ï¦¨¥H¤Uªº¦r¦ê -asis Characters 128 - 255 shown as-is quote .k; Enter Ctrl chars ¬O­n¯àÅã¥Ü¤¤¤å¦r¡A ¦Ó ¬O­n¿é¤J¯S®íªº±±¨î¦r¤¸®É¨Ï¥Îªº«öÁä¡A ¦Ó¹w³]­È¬O ¡A´N·|¹J¨ì¦³¨Ç¤¤¤å¦rªº¤º½X¡A µM«á¥u­n¥[°Ñ¼Æ ´N¥i¥H¬Ý¤¤¤å¡A¦p¡G joe -asis filename ´N¥i¥H¤F¡A¦ý¬O «h¥²¶·§ïÀɮסA©Î¬O¨â­Ó³£§ïÀɮקa¡C
joe snapshot
nvi - Ãþ¦ü vi/ex¡A¦³¦hºØ»y¨¥­×¸É¡A¹w³]¬° big5 ¦³ nvi-big5¡B nvi-enc-cn¡B nvi-enc-tw µ¥¤£¦Pªº®M¥ó¡C BIG5 ©Î GB ¬Û®eªº vi ¾Þ§@¤¶­±½s¿è¾¹ vi ¬O UNIX ªº¼Ð·Ç½s¿è¾¹¡A¦¹µ{¦¡©M¤¤¤åÁcÅé¡Benc-cn¡B euc-tw ¬Û®e¡C ¦w¸Ë chinese/nvi-big5¡C ½s¿è ~/.nexrc set noskipdisplay set displayencoding=big5 set inputencoding=big5 set fileencoding=big5 set autodetect=tw WWW: http://www.itojun.org/ qe - qe ¬O¤@­Ó¼Ò¥é PE2 ªº½s¿èµ{¦¡ qe ¬O¤@­Ó¼Ò¥é PE2 ªº½s¿èµ{¦¡¡A¥s qe ªº­ì¦]¥u¬O¦]¬°¦r¥À Q ¬O±Æ¦b P ¤§«á¡C©M DOS ¤£¦Pªº¬O¡AUNIX ¨S¦³¨º»ò¦hÁä¥i¥Î¡A¦Ó¥B¤£¦Pªº Terminal ªºÁä½X¤]²¤¦³¤£¦P¡C¦]¦¹¤@¨Ç±`¥Îªº function ³Ì¦n©w¸q¨ì Control Key ©Î Meta Key ¤W¡A¥H§K¤£³ô¨Ï¥Î¡C ¦w¸Ë chinese/qe¡C
qe snapshot
WWW: qe project
ve - NTHU-CS Maple BBS µo®iªº BBS-like ¤å¦r½s¿è¾¹ ¤@®M¥Ñ NTHU-CS Maple BBS 2.36 µo®iªº BBS-like ¤å¦r½s¿è¾¹¡C ¦w¸Ë chinese/ve¡C
ve snapshot
ChiTex - ¤¤¤å Tex/LaTex ChiTeX ¬O¤@®M¤¤¤å LeX /LaTeX¡A¥u­n·|­^¤å TeX/LaTeX ´N´X¥G¥ß¨è¥i¨Ï¥Î ChiTeX¡A¥»ª©¥i¾A¥Î©ó Big5 ¤Î GB ¤º½X¤§¤¤¤å¡C¦¹¤@ Unix ª©¥i¥Î©ó¸Ë¦³ teTeX ªº GNU/Linux¡AFreeBSD¡ASolaris¡A»P SunOS ¨t²Î¡C ¦w¸Ë chinese/chitex¡C ChiTeX 6.1.2 ¤@¨t¦Cªº§ï¶i¡A ¥H¤Î¤U¸ü¦ì¸m½Ð°Ñ¦Ò¡G chitex ftp site¡C ChiTex ªº¯SÂI¡G ¥Îªk²³æ¡A¤£¥Î¯S§O¾Ç²ß¡A·|¥Î­^¤å TeX /LaTeX ´N´X¥G¥ß¨è¥i¨Ï¥Î ChiTeX (­Y­n¶i¤@¨B¨Ï¥Î¸û¦h¥\¯à¡A¥u­n¾Ç²ß´X­Ó²³æªº¯S®í«ü¥O´N¥i)¡C »P­^¤å TeX/ LaTeX ¬Û®e©Ê°ª¡C ¥\¯à§¹³Æ¦Ó¦h¼Ë¤Æ¡C ´£¨Ñ cbibtex¡Acmakeindex ¥i¥Î¥H¤Þ¥Î¤º§t¤¤¤åªº¥~¦b°Ñ¦Ò¤åÄm¸ê®Æ¤Î ¦Û°Ê½s¿è§t¤¤¤å¤§¯Á¤Þ¡C´£¨Ñ¤¤¤å¤Æªº chilatex2html ¥i±N§t¤¤¤åªº LaTeX ¤å¥óÂà´«¬° HTML ®æ¦¡ÀÉ¡C ¤ä´©¥Ñ TeX/LaTeX ¤å¥ó²£¥Í pdf ÀÉ¡C ¦P®É¤ä´© Big5 ½X¤¤¤å (¥xÆW¡A­»´ä) ¤Î GB ½X¤¤¤å (·s¥[©Y»P¤j³°)¡C ²{¦b±z¥i¥H®³ ChiTeX ªþªº½d¨Ò¨Ó´ú¸Õ¡G &prompt.root; cd /usr/local/share/texmf/tex/chinese &prompt.root; chilatex math2.tex (½sĶ) &prompt.root; xdvi math2.dvi (¹wµø) &prompt.root; dvips math2.dvi -o math2.ps (Âà´«¦¨ PostScript ÀÉ) &prompt.root; gv math2.ps (¥Î gv Æ[¬Ý) WWW: yih's homepage WWW: Kile: LaTeX source editor CJK - ¥i¥H¨Ï¥Î CJK scripts ªº LaTeX2e ¥¨¶°®M¥ó TeX/LaTeX ¬O¤@®Mªº¹õ«á±Æª©³nÅé¡C¨äÀu¨qªº¿é¥X«~½è¦­¤w¬°¼s¤jªº ¾Ç³N¬ÉªB¤Í©Ò³ß·R¤Î±Ä¥Î¡CCJK ¬O¤@­Ó LaTeX2e ªº¥¨¶°®M¥ó(macro package)¡A ¯àÅý±z¦b TeX ¤å¥ó¤¤¨Ï¥Î CJK (Chinese/Japanese/Korean) ªº¤å¦r½s½X¡C ±zªº¨t²Î¥²¶·¥ý¦w¸Ë¦n teTeX/ LaTeX¡C¦pªG¨S¦³ªº¸Ü¡A±z¤]¥i¥H¦Û¤v¸Ë¡C ½Ð°Ñ¦Ò /usr/ports/print/teTeX ªº»¡©ú¡C ¦w¸Ë chinese/CJK¡C ¦b CJK ®M¥ó¤¤¦³¤@¥÷¤¤¤å¤å¥ó¡A¥Ñ§õ§g¦t¥ý¥Í©Ò¼gªº¤¶²Ð¡A ±Mªù¤¶²Ð CJK ³B²z¤¤¤åªº»yªk¡A¦b /usr/local/share/doc/CJK/chinese/READMEb5.tex¡A ¦b¦¹´£¨Ñ READMEb5.pdf ªº¤U¸ü¡C &prompt.root; cd /usr/local/share/doc/CJK/chinese/ &prompt.root; bg5latex READMEb5.tex (¬Ý¬Ý¦³¨S¦³²£¥Í READMEb5.dvi) &prompt.root; xdvi READMEb5.dvi (¬O§_¯à¬Ý¨ì¤¤¤å? ·íµM±z­n¥ý¶i X Window) &prompt.root; dvips READMEb5.dvi -o READMEb5.ps (Âà´«¦¨ PostScript ®æ¦¡)) &prompt.root; gv READMEb5.ps (¥Î gv Æ[¬Ý) % ´ú¸Õ¤å¥ó \documentclass{article} \usepackage{CJK} \begin{document} \begin{CJK*}{Bg5}{song} §ºÅé \end{CJK*} \begin{CJK*}{Bg5}{kai} ·¢Åé \end{CJK*} \end{document}
CJK snapshot
WWW: §Úªº CJK - by Edward WWW: cjk project
CJK-LyX - ¦³ LaTeX ¨Ï¥Î¤¶­±ªº¤å¥ó½s¿è¾¹(©Ò¨£§Y©Ò±o) LyX ¬O¤@­Ó¦³ LaTeX ¤¶­±¤å¥ó½s¿è¾¹¡A¬O¤@­Ó®e©ö¨Ï¥Îªº¤å¦r½s¿è¾¹ ¡A¤]¬O¤@­Ó¦³¼u©Ê¥B±j¤jªº LaTeX¡C ¦³µÛ©Ò¨£§Y©Ò±oªº¤¶­±¡A©M³\¦h LaTeX ­·®æ©M¦Û°Ê²£¥Íªº³]­p¡C¥[³t¾Ç²ß LaTeX ¨Ã¨Ï½ÆÂøªº³]­p²³æ¤Æ©Mª½Ä±¤Æ¡C·sªº¯S¦â¥]§t«÷¦rÀˬd ¡A°ê»Ú¤Æ¡A¦r¤¸´£¨Ñ¡A©Ò¨£§Y©Ò±oªº¹Ï§Î¡Bªí®æ¡B¤èµ{¦¡¡C LyX ¬O¤@­Ó¶i¥i§ð TeX/LaTeX¡A °h¥i¦u (§â LyX ·í¦¨¤å®Ñ³B²z³nÅé) ªº¤@­Ó¥\¯à±j¤j¡A¥i¥H³B²z¹Ï¤åªº¤å®Ñ³B²z³nÅé¡C ¦w¸Ë print/cjk-lyx¡C ¥²­nªº³]©w¡G ½Ð½s¿è¤@­Ó ~/.lyx/preferences (¨S¦³³o­ÓÀÉ¡A½Ð¦Û¦æ«Ø¥ß)¡A¤º®e¦p¤U¡G \screen_dpi 100 \screen_font_roman "-*-times new roman" \screen_font_sans "-*-arial" \screen_font_typewriter "-*-courier new" \screen_font_i18n1_encoding "big5-0" \screen_font_i18n1_normal "-*-ar pl mingti2l big5" \screen_font_i18n1_gothic "-*-ar pl mingti2l big5" \screen_font_i18n2_encoding "big5-0" \screen_font_i18n2_normal "-*-ar pl kaitim big5" \screen_font_i18n2_gothic "-*-ar pl kaitim big5" ¥t¥~°w¹ï CJK ÁÙ·|³]©w¦p¤UªºªF¦è¡G \language_package "\usepackage{CJK}" \language_command_begin "\begin{CJK*}{Bg5}{aming}" \language_command_end "\end{CJK*}" \language_auto_begin false \language_auto_end false \mark_foreign_language false \converter latex dvi "bg5latex $$i" "latex" #\converter dvi pdf "dvipdfm $$i" "" #\font_encoding default ¦pªG±z TeX/LaTeX ¬O¨Ï¥Î¤¤¤å Type1 ¦r«¬ªº¸Ü¡A½Ð±N³Ì«á¤G¦æªº mark ®³±¼¡C ´ú¸Õ¡G ½Ð¶i¤J LyX «áÀH«K½s¿è¤@­Ó¤¤¤åÀÉ¡A µM«á«ö View => DVI ¤Î View => Postscript ¬Ý¹B§@¬O¤£¬O¥¿±`¡C ¥t¥~ File => Export => Postscript ¬Ý¬O¤£¬O¥i¥H¥¿½T¿é¥X¤å½Zªº *.ps ÀÉ¡C * ¦b¦¹«Øij¨Ï¥Î¤¤¤å Type1 ¦r«¬¡A¥H§K¦hªá®É¶¡µ¥«Ý¨t²Î»s³y pk ¦r«¬¡C ½Ð°Ñ¦Ò¤»¤ë¥÷ªºÂ«H¡A¼ÐÃD¬O¡G ``[FYI] CJK/LaTeX enviroment ¤¤¤å Type1 ¤Î TTF ªº¨Ï¥Î'' ­nÅÜ´«¦r«¬©Î°µ§ó½ÆÂøªºÅܤơALyX ¥»¨­¨Ã¨S¦³ CJK enviroment ªº¯S®í¥\¯à¡A±o¦Û¦æ¥[¤J tags¡C¨Ò¦p­n´«¦r«¬¡A ¥i«ö¥\¯àªí¨º­Ó¤jªº¦V¤Uªº¶Â½bÀY¿ï LaTeX¡A¥H«K¿é¤J CJK enviroment ªº tag¡G \CJKfamily{akai} ³o¼Ë¥H¤Uªº¤å¦r´N·|§ï¥Î·¢Åé¦r¡Aª`·N¡A³o¸Ì«üªº¬O©Ò¿é¥Xªº *.ps Àɪº¦r«¬¡A¦Ó¤£¤@©w¬O±z¿Ã¹õ¤W¬Ý¨ìªº¦r«¬ (¨Ì§Úªº³]©w¡A¿Ã¹õ¤W¬O©úÅé)¡C ¨ä¥Lªº¤¤¤å TeX/LaTeX ¨t²Î¡A¦p cwTeX/ChiTeX ½Ð°Ñ¦Ò¥H¤W³]©w¡A¦Û¦æ§ó§ï¡C Copyright (c) 2001 §õªG¥¿(&a.edwardlee;) ¥»¤å¬°¦Û¥Ñ¤å¥ó(FDL http://www.gnu.org/copyleft/fdl.html) ¥i¦Û¥Ñ½Æ»s/­×§ï/´²§G¡C¦ý½Ð«O¯dª©ÅvÁn©úªº³¡¥÷¡C
CJK-LyX snapshot
WWW: CJK-LyX ¤¤¨Ï¥Î¤¤¤å WWW: lyx project WWW: CJK-LyX project
¦b ConTeXt ¨Ï¥Î Big-5 ¤¤¤å Contributed by &a.edwardlee; Last Update: 2003¦~ 4¤ë30¤é ©P¤T 03®É25¤À52¬í CST ¦bÅý ConTeXt ¨Ï¥Î Big-5 ¤¤¤å«e¡A ¦Ü¤Ö­n¯à¦b­^¤åÀô¹Ò¹B§@¡C &prompt.root; cd ${TEXMF}/web2c &prompt.root; texexec --make en metafun ¬°¤F©M CJK ©M dvipdfmx °t¦X¡A ½Ð¥ý¦w¸Ë chinese/CJK ©M print/dvipdfmx¡A ±Ä¥Î CJK standard encoding vector¡A³o¼Ë¤@¨Ó¡A ¦r«¬¤è­±ªº¸ê®Æ´N¥i¥H¦@¥Î¤F¡C ­×§ïÀɮסG 1. ${TEXMF}/tex/context/config/cont-usr.tex ¦pªG¨S¦³³o­ÓÀÉ¡A½Ð±N ../base/cont-usr.ori «þ¨©¤@¥÷¦¨ cont-usr.tex¡C ¦b \protect \endinput ¤§«e¥[¤J¤U¦C¸ê®Æ¡G % ±N Poorman ªº¹ïÀ³¡AÂন CJK ªº¹ïÀ³ \defineucharmapping{BIG5}#1#2% {\unicodeposition=#1 \advance\unicodeposition -161 \multiply\unicodeposition 157 \advance\unicodeposition #2 \advance\unicodeposition-\ifnum#2>160 98\else64\fi \dorepositionunicode} % for Big-5 CJK standard encoding vector \def\currentucharmapping{BIG5} % font alias¡C³o¼Ë´N¤£¥²§ó°Ê­ì¨Óªº¦r«¬³]©w¤F \definefontsynonym [b5song] [arb5sung] [encoding=big5] \definefontsynonym [b5songsl] [arb5sungs] [encoding=big5] \definefontsynonym [b5kai] [arb5kai] [encoding=big5] \definefontsynonym [b5kaisl] [arb5kais] [encoding=big5] 2. ${TEXMF}/tex/context/base/font-chi.tex ±N¬Y¦æ¥u¦³ §ï¦¨ ¡C §ï¦n«á­«·s°õ¦æ¡G &prompt.root; cd ${TEXMF}/web2c/ &prompt.root; texec --make en «e¸m³B²z script ¥Ñ©ó¡u³\¡B¥\¡vªº°ÝÃD¡A§Ú­Ì¥²¶·«e¸m³B²z¡A¥H¤U¬O§ï¦Û¤ý¦ö¤¤¥ý¥Íªº clatex ªº perl script¡C #!/usr/bin/env perl # # Process Big-5 Traditional Chinese ConTeXt file. # Usage: chcont.pl tex file(NO tex extension) # By Edward G.J. Lee <edt1023@speedymail.org> 2003.04.24 # Inspire heavily from wycc's(wycc@iis.sinica.edu.tw) clatex. # $one = 161; $two = 254; open(CONT,">$ARGV[0].cont"); if ($ARGV[0] =~/(.*)\.tex$/) { -r $ARGV[0] || die " file $ARGV[0] not found\n"; open(INFILE,"<$ARGV[0]"); } else { -r "$ARGV[0].tex" || die "file $ARGV[0].tex not found\n"; open(INFILE,"<$ARGV[0].tex"); } while(<INFILE>) { &trans_print($_); } close(CONT); system "texexec ${ARGV[0]}.cont"; sub trans_print { local($s) = @_; local($i,$c,$nc,$ordc,$ordc1); for($i=0;$i<length($s);$i++) { $c = substr($s,$i,1); $ordc = ord($c); if (($ordc>=$one)&&($ordc<=$two)) { $nc = substr($s,$i+1,1); if ($nc =~/[\\{}\^_]/) { $ordc1 = ord($nc); print CONT "\\uc{$ordc}{$ordc1}"; } else { print CONT $c,$nc; } $i++; } else { print CONT $c; } } } ´ú¸Õ¡G \usemodule[chinese] \starttext \completecontent %\setupindenting[medium] \setupwhitespace[10pt] \chapter{®çªá·½°O} \ConTeXt\ ¤¤¤å´ú¸Õ¡C \section{®çªá·½°O«e¬q} ®Ê¤Ó¤¸¤¤¡AªZ³®¤H¡A®·³½¬°·~¡A½t·Ë¦æ¡A§Ñ¸ô¤§»·ªñ¡F©¿³{®çªáªL¡A§¨©¤¼Æ¦Ê¨B¡A ¤¤µLÂø¾ð¡AªÚ¯óÂA¬ü¡A¸¨­^Ä}¯É¡Aº®¤H¬Æ²§¤§¡C´_«e¦æ¡A±ý½a¨äªL¡CªLºÉ¤ô·½¡A «K±o¤@¤s¡C¤s¦³¤p¤f¡A§Ï©»­Y¦³¥ú¡A«K±Ë²î¡A±q¤f¤J¡C ªì·¥¯U¡AÅ׳q¤H¡F´_¦æ¼Æ¤Q¨B¡AÁŵM¶}®Ô¡C¤g¦a¥­Ãm¡A«ÎªÙÅkµM¡C¦³¨}¥Ð¡B¬ü¦À¡B ®á¡B¦Ë¤§ÄÝ¡A¦é­¯¥æ³q¡AÂû¤ü¬Û»D¡C¨ä¤¤©¹¨ÓºØ§@¡A¨k¤k¦çµÛ¡A±x¦p¥~¤H¡F¶À¾v¡B ««èÔ¡A¨Ã©ÉµM¦Û¼Ö¡C¨£º®¤H¡A¤D¤jÅå¡A°Ý©Ò±q¨Ó¡F¨ãµª¤§¡A«K­nÁÙ®a¡A³]°s¡B±þÂû¡B §@­¹¡C§ø¤¤»D¦³¦¹¤H¡A«w¨Ó°Ý°T¡C¦Û¤ª¡G¡u¥ý¥@Áׯ³®É¶Ã¡A²v©d¤l¨¶¤H¨Ó¦¹µ´¹Ò¡A ¤£´_¥X²j¡F¹E»P¥~¤H¶¢¹j¡C¡v°Ý¤µ¬O¦ó¥@¡F¤D¤£ª¾¦³º~¡AµL½×ÃQ¡B®Ê¡C¦¹¤H¤@¤@ ¬°¨ã¨¥©Ò»D¡A¬Ò¼Û±{¡C¾l¤H¦U´_©µ¦Ü¨ä®a¡A¬Ò¥X°s­¹¡C°±¼Æ¤é¡AÃã¥h¡C¦¹¤¤¤H»y ¤ª¡G¡u¤£¨¬¬°¥~¤H¹D¤]¡C¡v ¬J¥X¡A±o¨ä²î¡A«K§ß¦V¸ô¡A³B³B»x¤§¡C¤Î°p¤U¡A¸Ú¤Ó¦u¡A»¡¦p¦¹¡A¤Ó¦u§Y»º¤HÀH ¨ä©¹¡A´M¦V©Ò»x¡A¹E°g¤£´_±o¸ô¡C«n¶§¼B¤lÆk¡A°ª©|¤h¤]¡A»D¤§¡AªYµM³W©¹¡A¥¼ ªG¡A´M¯f²×¡C«á¹EµL°Ý¬zªÌ¡C \chapter{±N¶i°s} §g¤£¨£¡A¶Àªe¤§¤ô¤Ñ¤W¨Ó¡A©b¬y¨ì®ü¤£´_¦^¡C §g¤£¨£¡A°ª°ó©úÃè´d¥Õ¾v¡A´Â¦p«Cµ·¼Ç¦¨³·¡C ¤H¥Í±o·N¶·ºÉÅw¡A²ö¨Ïª÷¾êªÅ¹ï¤ë¡C ¤Ñ¥Í§Ú§÷¥²¦³¥Î¡A¤dª÷´²ºÉÁÙ´_¨Ó¡C ²i¦Ï®_¤û¥B¬°¼Ö¡A·|¶·¤@¶¼¤T¦ÊªM¡C §Â¤Ò¤l¡A¤¦¥C¥Í¡A±N¶i°s¡A§g²ö°±¡C »P§gºq¤@¦±¡A½Ð§g¬°§Ú°¼¦ÕÅ¥¡C ÄÁ¹ªõW¥É¤£¨¬¶Q¡A¦ýÄ@ªø¾K¤£Ä@¿ô¡C ¥j¨Ó¸t½å¬Ò±I¹æ¡A±©¦³¶¼ªÌ¯d¨ä¦W¡C ³¯¤ý©õ®É®b¥­¼Ö¡A¤æ°s¤Q¤d®¡ùN릡C ¥D¤H¦ó¬°¨¥¤Ö¿ú¡A®|¶·ªf¨ú¹ï§g°u¡C ¤­ªá°¨ ¤dª÷¸Ê¡A©I¨à±N¥X´«¬ü°s¡C »Pº¸¦P®ø¸U¥j·T¡C \chapter{³\¥\¶}ªº°ÝÃD} ³\¥\¶}¡C³o¨Ç¦³°ÝÃDªº¦r¤¸­nÁ׶}¡C ¤]´N¬O»¡¡A­n«e¸m³B²z³o¨Ç¦r¤¸¡C \stoptext &prompt.root; chcont.pl cont-b5 ==> ¤d¸U¤£­n¥[°ÆÀɦW¡A¤Á°O¡I ³o¼Ë·|²£¥Í cont-b5.dvi &prompt.root; dvipdfmx cont-b5 ==> ²£¥Í¤£¤º´O¦r«¬¥B¥i copy&paste ªº pdf ÀÉ¡C ³o¸Ì¨S¦³¥Î¨ì pdftex ´O¤J TTF ªº¥\¯à¡A­ì¦]¬O¥L¤£¶È´O¤J¾ã­Ó subfont ÀÉ®×·|Åܱo«Ü¤j¡A¦Ó¥B¤S¨S¦³ copy&paste&search ªº¥\¯à¡C WWW: http://www.pragma-ade.com/ WWW: http://www.pragma-ade.com/general/manuals/mchinese.pdf cwTeX cwTeX ±Æª©¨t²Î¥Ñ§dÁo±Ó»P§dÁo¼z¦@¦Pµo®i¡A ¥¦©µ¦ù TeX/LaTeX ¤§¥\¯à¡A¨Ï¤§¥i¥H±Æª©¤¤¤å¡C ·íªì§d¦Ñ®v³]­p cwTeX ¦r«¬®É¡A¹ï¦r«¬ªº½s±Æ¬O¥J²Ó³]­pªº¡C ¥L±N³Ì±`¥Îªº¦r«¬¨Ì¥ý«á¶¶§Ç½s±Æ¡A¶V¬O±`¥Îªº¡A´N¶V©ñ¦b«e­±¡C ©Ò¥H¡A³o©M windows ¤Wªº¦r«¬¶¶§Ç¤£¬Û¦P¡C·íªì¤§©Ò¥H¦p¦¹³]­p¡A ¬O¬°¤FÅý½sĶªº³t«×¯à°÷Åܱo¤ñ¸û§Ö¡C ¤£¹L¡AÀHµÛ¹q¸£ªº³t«×¶V¨Ó¶V§Ö¡AµwºÐ¶V¨Ó¶V«K©y¡A¥L¹ï³o¼Ëªº³]­p ¦ü¥Gı±o¤]¥i¥H§ïÅÜ¡C´N©M Windows ªº¦Û¦æ½s±Æ¤è¦¡¤@­P¥Lı±o©Î³\ ¥ç¤£¥¢¬°¤@­Ó user friendly ªº¤èªk¡C¦]¬°¹³ PuTeX ¥i¥H¨Ï¥Î²³¦h ¤¤¤å¦r¦r«¬ªºÀuÂIªº½T«Ü§l¤Þ¤H¡A¤£¹L©O¡A³o¥i¯àÁٻݭn¡u¥Á·N¡v¡C ½Ð¦Ñ®v¨Ó¶Ë¸£µ¬§a¡C ¤ºªþ¦r§Î¬°¡G©úÅé(m)¡B¶ÂÅé(bb)¡B·¢®Ñ(k)¡B¶êÅé(r)¡B¥é§ºÅé(f)¡A ­Y»Ý­n««ª½¦rÅé«h¦b«e­±¥[¤W v¡C ¦w¸Ë chinese/cwtex¡C cwTeX ªº¨Ï¥Î¡G &prompt.user; vi file.ctx &prompt.user; cwtex file &prompt.user; latex file.tex &prompt.user; dvips -o file.ps file.dvi &prompt.user; gv -antialias file.ps ³o¸Ì¦³§d¦Ñ®v cwTeX ±Æª©¨t²Î¤Gª©¤â¥U cxbook.pdf¡C WWW: tmwu's homepage dvipdfmx - Âà´« *.dvi ¦¨¬°¤£¤º´O¤¤¤å¦r«¬ªº *.pdf ÀÉ Copyright (c) 20021 §õªG¥¿(&a.edwardlee;) ³o¬O Jin-Hwan Cho(Áú)¡BShunsaku Hirata(¤é) ­×§ï¦Û Mark A. Wicks ªº dvipdfm ¦Ó¨Óªº¡C ¥D­nªº¥\¯à¬OÂà´« *.dvi ¦¨¬°¤£¤º´O¤¤¤å¦r«¬ªº *.pdf ÀÉ¡C ¤@¯ëªº­^¤åÀɤ]¬O¥i¥H·Ó±`¨Ï¥Î(§t­ì¦³ dvipdfm ªº¥\¯à)¡C ¤£ºÞ¬O¥i³B²z double-byte code ªº Omega ©Î¥u¯à³B²z single-byte ¨Ï¥Î subfont ªº CJK package ³£¥i¥H¨Ï¥Î¡C ³Ì¤jªº¦n³B¬O¥i¥H§Q¥Î TeX/LaTeX ¨Ó»s§@¤¤¤å pdf ÀÉ¡A ¦Ó¥B¤S¤£¤º´O¤¤¤å¦r«¬¡A¥i¥H¨ÏÀɮפp«Ü¦h(¬O¯uªº¡y«Ü¦h¡z¡I:)¡C ¥iª½±µ¨Ï¥Î TTF¡A¦ý·|³Q¼Ð°O¬° use font of acroread ©Ò¹w³]¨Ï¥Îªº¦r«¬(MHei-Medium ¤Î MSung-Light)¡A³o¼ËÁöµM¤£¤º´O¦r«¬¡A ¦ý¦b acroread/xpdf ³£¥i¥H¥¿±`¾\Äý¡A«D±`¤è«Kºô¸ô¤Wªº¬y³q¡C ¤S¤£¥²¦A¥hªá»È¤l¶R³nÅé¨Ó»s§@¡A§ó­«­nªº¬O TeX/LaTeX ªº¯S®í¥\¯àÁÙ¬O¥i¥HÄ~Äòªu¥Î¡C ¦pªG©M pslatex °t¦X¨Ï¥Îªº¸Ü¡A ¨º³s­^¤å¦r«¬¤Î¤Ö¼Æ¯S®í²Å¸¹¤]·|¤£¤º´O¡A¨ÏÀɮקó¤p¡A ·íµM mathtime ªº¤@¨Ç¼Æ¾Ç²Å¸¹¨Ã¨S¦³ free ªº¡A³o·|¤º´O CM ¦r«¬¡C ¦w¸Ë print/dvipdfmx¡C ¥H bsmi00lp.ttf ¬°¨Ò¡A¦w¸Ë¦n«á $TEXMF/dvipdfm/config/cid-x.map ³]¬°¡G arb5sung@Big5@ ETen-B5-H :0:!arb5_sung.ttf arb5sungs@Big5@ ETen-B5-H :0:!arb5_sung.ttf,Italic arb5sung@Big5@ ETen-B5-H :0:!arb5_sung.ttf,Bold arb5sungs@Big5@ ETen-B5-H :0:!arb5_sung.ttf,BoldItalic arb5kai@Big5@ ETen-B5-H :0:!arb5_kai.ttf arb5kais@Big5@ ETen-B5-H :0:!arb5_kai.ttf,Italic arb5kai@Big5@ ETen-B5-H :0:!arb5_kai.ttf,Bold arb5kais@Big5@ ETen-B5-H :0:!arb5_kai.ttf,BoldItalic % ¦ý¤£§t postscript name ªº¦r«¬«hµLªk¨Ï¥Î¡C¥h±¼ ``!'' ·|´O¤J TTF( % CIDFontType2¡A©Î Type11)¡A¤£»Ý *.enc ÀÉ¡C ¥t¥~¤]¦³¤H«Øij±N §ï¦¨ ¡A §ï¦¨ ¥HÁקK±×Åé¦rÅã¥Ü¤£¥¿±`¡A ¨S¦³³rÂIªº°ÝÃD¡C ¸Ë§¹«á°O±o°õ¦æ mktexlsr §Y¥i¡C·íµM¡A­ì¥ýªº¨t²Î CJK package ­n¯à°÷¥¿±`¹B§@ (¤£ºÞ¬O¨Ï¥Î Type1©Î pk ¦r«¬)¡A¦]¬°»Ý­n¥¿½Tªº *.tfm ¦r«¬´y­zÀÉ¡C µM«á¡A¨Ì·Ó¤@¯ë¥¿±`µ{§Ç½sĶ CJK ¤å½Z§Y¥i¡C ¥Ñ©ó¨Ã¨S¦³¥hÅܳy¡B´O¤J¦r«¬¥»¨­¡A ©Ò¥H¥u­n¬O¦Xªk¶R¨Óªº¦r«¬À³¸Ó³£¥i¥H©ñ¤ß¥h¨Ï¥Î¤F¡C % §Ú¤£¬O«ß®v¡A¥i¤£­t¾á«O³d¥ô¡C:) Åý­^¤å¦r«¬¤]¤£¤º´O¡G¥Ñ *.tex ¤å½Z¤¤¡A¥[¤J¡G \usepackage{pslatex} ´ú¸Õ¡G &prompt.user; cat cjk.tex \documentclass{article} \usepackage{CJK} \begin{document} Hello World \begin{CJK*}{Bg5}{song} ±z¦n \end{CJK*} \end{document} &prompt.user; bg5latex cjk.tex &prompt.user; dvips -o ps2pdf-cjk.ps cjk.dvi &prompt.user; ps2pdf ps2pdf-cjk.ps &prompt.user; dvipdfmx -o dvipdfmx-cjk.pdf cjk.dvi &prompt.user; cat bg5pslatex #!/bin/sh f=`echo $1 | sed -e 's|\(.*\)\.[^/]*$|\1|'` bg5conv < $1 > $f.cjk && pslatex $f.cjk &prompt.user; ./bg5pslatex cjk.tex &prompt.user; dvipdfmx -o pslatex-cjk.pdf cjk.dvi &prompt.user; pdffonts ps2pdf-cjk.pdf name type emb sub uni object ID ------------------------------------ ------------ --- --- --- --------- [none] Type 3 no no no 9 0 &prompt.user; pdffonts dvipdfmx-cjk.pdf name type emb sub uni object ID ------------------------------------ ------------ --- --- --- --------- TGRGZY+CMR10 Type 1 yes yes no 10 0 ZenKai-Medium CID TrueType no no no 13 0 &prompt.user; pdffonts pslatex-cjk.pdf name type emb sub uni object ID ------------------------------------ ------------ --- --- --- --------- Times-Roman Type 1 no no no 8 0 ZenKai-Medium CID TrueType no no no 11 0 &prompt.user; ls -l *.pdf -rw-r--r-- 1 root wheel 8427 7 6 00:17 dvipdfmx-cjk.pdf -rw-r--r-- 1 root wheel 5373 7 6 00:17 ps2pdf-cjk.pdf -rw-r--r-- 1 root wheel 3789 7 6 00:17 pslatex-cjk.pdf °ÝÃD¡G µLªk¥Ñ pdf2ps/pdftops ¨ÓÂন ps¡C¤]´N¬O»¡¤@¯ëªí¾÷·|¦L¤£¥X¨Ó¡C ¹ïµ¦¡G ¥i¸g¥Ñ acroread §Q¥Î¸ÌÀYªº CIDKeyed font ¨ÓÂন ps ÀÉ¡C «~½è¬Û·íºë¨}¡A¥u¬OÀɮ׫ܤj´N¬O¤F¡C ²×¨s¸Ñ¨M¤èªk¡G ­n©M gs ¾ã¦X¦b¤@°_¡C
dvipdfmx snapshot
WWW: §Úªº CJK - by Edward WWW: dvipdfmx project
ttf2pt1 - TTF Âत¤å Type1 ¦r«¬ Copyright (c) 2001 §õªG¥¿(&a.edwardlee;) ¥»¤å¬°¦Û¥Ñ¤å¥ó(FDL http://www.gnu.org/copyleft/fdl.html) ¥i¦Û¥Ñ½Æ»s/­×§ï/´²§G¡C¦ý½Ð«O¯dª©ÅvÁn©úªº³¡¥÷¡C ¦w¸Ë chinese/ttf2pt1¡A ¥L·|³s print/ttf2pt1 ¤@°_¦w¸Ë¡C chinese ®M¥ó¥u¬O map ªí¡A¦³­Ê¤Ñ¦r¶°¥i¥Î¡C ¼g¤@­Ó sh script(mkfont) ¤º®e¦p¤U¡G === mkfont begin === #!/bin/sh # # By Edward G.J. Lee 2001.11.25 # This code is Public Domain. # if [ $# -ne 1 ] then echo "Usage: `basename $0` your.ttf" exit 1 fi echo echo "Now create *.t1a and *.enc and *.afm files. Wait... " echo FONTNAME=$1 MAPFILE=/usr/local/share/ttf2pt1/maps/cubig5.map n=1 while [ $n -lt 10 ] do m=0$n ttf2pt1 -GE -pft -Ohub -W0 -L $MAPFILE+$m $FONTNAME ${FONTNAME%.ttf}$m n=`expr $n + 1` done m=10 while [ $m -lt 56 ] do ttf2pt1 -GE -pft -Ohub -W0 -L $MAPFILE+$m $FONTNAME ${FONTNAME%.ttf}$m m=`expr $m + 1` done # avoid dvips(k)(before v5.86) t1part module bug. # perl -pi -e 's/_/Z/g' *.t1a *.afm echo echo "Now create *.pfb, wait... " echo for ps in *.t1a do t1asm -b $ps > ${ps%.t1a}.pfb done echo echo "Now create *.tfm, wait... " echo for afm in *.afm do afm2tfm $afm done AFM=${FONTNAME%.ttf}-afm TFM=${FONTNAME%.ttf}-tfm PFB=${FONTNAME%.ttf}-pfb ENC=${FONTNAME%.ttf}-enc rm -f *.t1a mkdir -p $AFM $TFM $PFB $ENC mv -f *.enc $ENC mv -f *.afm $AFM mv -f *.tfm $TFM mv -f *.pfb $PFB echo echo "OK, all done. :-)" echo === mkfotn end === ¦b¤@­Ó¿W¥ß¥Ø¿ý©ñ mkfont(­n¥ý chmod +x mkfont)¡A ¦A§â¦r«¬¸m©ó¦P¤@¥Ø¿ý¡C * ¤@¨Ç¸ô®|¦³¤£¤@¼Ëªº¸Ü¡A½Ð¦Û¦æ­×§ï¡C ³o¸Ì¥H¤å¹©²Ó¤W®ü§º©M¤å¹©¤¤·¢¬°¨Ò¡G ./mkfont bsmi00lp.ttf; ./mkfont bkai00mp.ttf §Y¥i¡C§¹¦¨«á·|²£¥Í afm, euc, tfm, pfb µ¥¥|­Ó¥Ø¿ý¡A¸Ì­±³£¬O¦r«¬¸ê®Æ¡C ±N¸ê®Æ·h²¾¨ì©ÒÄݪº¦a¤è(arphic ¥Ø¿ý½Ð¦Û¦æ«Ø¥ß)¡C afm copy ¦Ü /usr/local/share/texmf/fonts/afm/arphic¡C tfm copy ¦Ü /usr/local/share/texmf/fonts/tfm/arphic¡C pfb copy ¦Ü /usr/local/share/texmf/fonts/type1/arphic¡C euc copy ¦Ü /usr/local/share/texmf/dvips/arphic¡C ·s¼W /usr/local/share/texmf/dvips/config/aming.map ¤º®e¦p¤U¡G bsmi00lp01 ShanHeiSun-Light-01 <bsmi00lp01.pfb bsmi00lp02 ShanHeiSun-Light-02 <bsmi00lp02.pfb ... bsmi00lp55 ShanHeiSun-Light-55 <bsmi00lp55.pfb ·s¼W /usr/local/share/texmf/dvips/config/akai.map ¤º®e¦p¤U¡G bkai00mp01 ZenKai-Medium-01 <bkai00mp01.pfb bkai00mp02 ZenKai-Medium-02 <bkai00mp02.pfb ... bkai00mp55 ZenKai-Medium-55 <bkai00mp55.pfb ¦b /usr/local/share/texmf/dvips/config/config.ps ¥[¤J¡G p +aming.map p +akai.map ·s¼W /usr/local/share/texmf/dvips/config/bsmi00lp.map ¤º®e¦p¤U¡G bsmi00lp01 <bsmi00lp01.enc <bsmi00lp.ttf bsmi00lp02 <bsmi00lp02.enc <bsmi00lp.ttf ... bsmi00lp55 <bsmi00lp55.enc <bsmi00lp.ttf ·s¼W /usr/local/share/texmf/dvips/config/bkai00lp.map ¤º®e¦p¤U¡G bkai00mp01 <bkai00mp01.enc <bkai00mp.ttf bkai00mp02 <bkai00mp02.enc <bkai00mp.ttf ... bkai00mp55 <bkai00mp55.enc <bkai00mp.ttf * bsmi00lp.ttf,bkai00mp.ttf ­n¸m©ó kpathsea §ä±o¨ìªº¦a¤è¡A¦p /usr/local/share/texmf/fonts/truetype (¥Ø¿ý¥i¦Û¦æ«Ø¥ß)¡C ­×§ï /usr/local/share/texmf/pdftex/config/pdftex.cfg¡A¥[¤J¡G map +bsmi00lp.map map +bkai00mp.map ·s¼W /usr/local/share/texmf/tex/latex/CJK/Bg5/c00aming.fd ¤º®e¦p¤U¡G \def\fileversion{4.2.0} \def\filedate{2001/09/28} \ProvidesFile{c00aming.fd}[\filedate\space\fileversion] \DeclareFontFamily{C00}{aming}{} \DeclareFontShape{C00}{aming}{m}{n}{<-> CJK * bsmi00lp}{} \DeclareFontShape{C00}{aming}{bx}{n}{<-> CJK * bkai00mp}{} \endinput ·s¼W /usr/local/share/texmf/tex/latex/CJK/Bg5/c00bsmi00lp.fd ¤º®e¦p¤U¡G \def\fileversion{4.2.0} \def\filedate{2001/09/28} \ProvidesFile{c00bsmi00lp.fd}[\filedate\space\fileversion] \DeclareFontFamily{C00}{bsmi00lp}{} \DeclareFontShape{C00}{bsmi00lp}{m}{n}{<-> CJK * bsmi00lp}{} \DeclareFontShape{C00}{bsmi00lp}{bx}{n}{<-> CJK * bkai00mp}{} \endinput ³o¼Ë²ÊÅé¦r·|¥h¿ï¥Î¤å¹©·¢®ÑÅé(­Ó¤H¤£³ßÅw¼ÒÀÀ¥X¨Óªº²ÊÅé¦r)¡C ·íµM·¢®ÑÅé¤]­n¦Û¦æ«ö¤W­z¤èªk»s§@¥X¨Ó¡C °õ¦æ texhash(or mktexlsr)¡C³o¼Ë´N¥i¥H¤F¡A­n¨Ï¥Î©úÅé´N¨Ï¥Î aming ªº¦r«¬¦WºÙ¡A­n¨Ï¥Î·¢Åé´N¨Ï¥Î akai(¨Ì¤W­z¤èªk°µ¤@­Ó c00akai.fd)¡C ·íµM¡ACJK ªº¨Ï¥Î¤èªk¡A½Ð°Ñ¦Ò CJK ©Òªþ¤å¥ó¡A¤@©w­n«ü©w aming ¤~·|¥h¨Ï¥Î©Ò©w¸q¥X¨Óªº¦r«¬¡A§_«h·|¥h§ì CJK ¹w³]¦r«¬¡A ¨º·íµM¤@¯ë¨t²Î¤W¬O¨S¦³ªº¡C ¬°¤F°t¦X¤¤¤å Type1 ¦r«¬¡A°õ¦æ dvips ®É½Ð¥[¤W -Ppdf ©Î -Pcmz °Ñ¼Æ¡A ³o¼Ë­^¤å¦r«¬¤~·|¥h¨Ï¥Î Type1¡C ³Ì«á°O±o°õ¦æ texhash¡C ´ú¸Õ¨Ò¤l === begin ex.tex === \def\Fn{\char} \font\Aa=bsmi00lp01 scaled 1000 \font\CCC=bsmi00lp55 scaled 3000 \font\CCc=bsmi00lp55 scaled 2000 \font\Ccc=bsmi00lp55 scaled 1000 \font\JJJ=bsmi00lp24 scaled 3000 \font\JJj=bsmi00lp24 scaled 2000 \font\Jjj=bsmi00lp24 scaled 1000 {\CCC\Fn108} {\CCC\Fn109} {\CCc\Fn110} {\CCc\Fn111} {\Ccc\Fn112} {\Ccc\Fn113} {\Ccc\Fn114} {\JJJ\Fn55} {\JJj\Fn95} {\Jjj\Fn84} {\CCC\Fn101} {\CCC\Fn102} {\CCc\Fn103} {\CCc\Fn104} {\Ccc\Fn106} {\Ccc\Fn107} \bye === end ex.tex === pdftex ex.tex §Y¥i²£¥Í¤º´O¤¤¤å TTF ªº ex.pdf¡C ¦pªG¦³»s§@¤¤¤å Type1 ¦r«¬¡A«h tex ex.tex ; dvipdf ex «h¬O·|¤º´O¤¤¤å Type1¡A¦U¦ì¥i¤ñ¸û¬Ý¬Ý¨âªÌ¦³¦ó¤£¦P¡C ¼g­Ó cjk-latex ½Z¸Õ¬Ý¬Ý§a¡I¦r«¬¦WºÙ­n¨Ï¥Î bsmi00lp¡C§Ú¼gªº sh script ¥u¬O­Ó¥b¦¨«~¡A¥i¯à±o¦h¸Õ´X¦¸¤~·|¦¨¥\¡Chave fun! :) * LaTeX ½Z½Ð¥Î pdflatex¡C ­n½sĶ CJK-latex ¤å½Z¡A¥i¦³¨âºØ¤è¦¡¡G 1. bg5latex test.tex ; pdflatex test.cjk 2. ¼g¤@­Ó sh script(bg5pdflatex) ¤º®e¦p¤U¡G === bg5pdflatex begin === #!/bin/sh FILE=`echo $1 | sed -e 's|\(.*\)\.[^/]*$|\1|'` bg5conv < $1 > $FILE.cjk pdflatex $FILE.cjk === bg5pdflatex end === chmod +x bg5pdflatex «á¸m©ó PATH ¥i¤Î¤§³B¡C bg5pdflatex test.tex §Y¥i¡C¨ä¹ê³o­Ó script ªº¤º®e©M bg5latex ¬O¤@¼Ëªº¡A¥u¤£¹L¬O§â latex ´«¦¨ pdflatex ¦Ó¤w¡C ps. ¤º®e¦p¦³¿ù»~¡A½Ð¤£§[«ü¥¿¡C
ttf2pt1 snapshot
WWW: ¨Ï¥Î pdfTeX/pdfLaTeX Åý pdf Àɤº´O¤¤¤å TTF/TTC WWW: ¥Ñ TeX/LaTeX »s§@¤¤¤å PDF ÀÉ WWW: CJK/LaTeX environment ¤¤¤å Type1 ¤Î TTF ªº¨Ï¥Î WWW: http://ttf2pt1.sourceforge.net/
diff --git a/zh_TW.Big5/books/zh-tut/chapters/fonts.sgml b/zh_TW.Big5/books/zh-tut/chapters/fonts.sgml index 8367b0068b..19c365b23e 100644 --- a/zh_TW.Big5/books/zh-tut/chapters/fonts.sgml +++ b/zh_TW.Big5/books/zh-tut/chapters/fonts.sgml @@ -1,1038 +1,1042 @@ ¿é¥X¦r«¬ ¦b³o­Ó³¹¸`¤¤±N·|¤¶²ÐÂI°}¦r«¬(Bitmapped Font)¡A ¥H¤Î¦±½u´yÃä¦r«¬(Outline Fonts)¡C ÂI°}¦r«¬(Bitmapped Fonts)¡G ³oºØ¦r«¬´N¬Oª½±µ±NÂI¯x°}ªº¦r«¬Àx¦s¦b°O¾ÐÅ餤¡A ¨Ï¥Î®É´Nª½±µ¨ú¥X¡A³oºØ¤è¦¡­YÀx¦sÂI¼Æ¤£¦h«h¿é¥X¦r«¬¤ÓÃø¬Ý¡F ¦ý­YÀx¦sÂI¼Æ¸û¦h«h»Ý­n¦û±¼¤Ó¦h°O¾ÐÅé¡A ¦P®É±N¦rÅé©ñ¤j«á¥i¯à²£¥Í¿÷¾¦§§¡A¦]¦¹¥Ø«e°£¤F¯S®í¥Î³~¥~¡A ´X¥G«Ü¤Ö¥Î¨ì¡C ¦±½u´yÃä¦r«¬(Outline Fonts)¬O§Q¥Î¦±½u¤½¦¡¨Ó´yø¦r®Ø¡A ¦]¦¹¤£½×©ñ¤jÁY¤p¦ì¼Æ¬O¦h¤Ö³£¤@¼Ë¥­·Æ¡A ¦ý¬O¯ÊÂI¬O­pºâ¯Ó®É¡A±`¨£ªº¥]¬A±`¥Î¦b¦L¨êªº Postscript »P¥Î¦b¿Ã¹õÅã¥Üªº TrueType Font(TTF) µ¥¡C ¥Ø«e¨Ï¥ÎÂI°}¦r«¬ªº¥D­n¬O±±¨î¥x³nÅé¡A¹³¬O big5con¡Bzhcon µ¥¡A ¥D­n¬O¦]¬°Åª¨ú¦±½u´yÃä¦r«¬ªº³t«×¸ûºC¡A ¤]¤ñ¸û½ÆÂø¡A©Ò¥H¥Ø«eªº±±¨î¥x³nÅé³£¨S¬Ý¨ì¨Ï¥Î¦±½u´yÃä¦r«¬ªº¡C WWW: Chinese, Japanese and Korean characters in English Windows WWW: Chinese Fonts
showttf snapshot
Bitmapped Font - ÂI°}¦r«¬·§½× ÂI°}¦r«¬¥Nªí¦r«¬ BDF(Bitmap Distribution Format¡AÂI°}¤À´²®æ¦¡)¡B HBF(Hanzi Bitmap Font¡Aº~¦rÂI°}¦rÅé)¡B PCF(Portable Compiled Font)¡C BDF Spec: 5005.BDF_Spec.pdf cmexfonts - ¤¤±À·| Big5+ ÂI°}¦r«¬ ¸ÓµÛ§@Åv¬°¤¤µØ¥Á°ê¦æ¬F°|¬ã¦Ò·|¡B¤¤¤å¹q¸£±À¼s°òª÷·|©Ò¦@¦³¡A ¦r§Î³]­p¬°µØ±d¬ì§Þ Dynalab Inc.¡C ¸Ó®M¦r«¬¨Ã¤£¬O¼Ð·Çªº Big5 ¦r«¬¡A¦Ó¬O·í®É¬°¤F±À¼s Big5+ ©Ò»s§@ªº¡A ¥Ø«e¨ÃµL¨Ï¥Îªº»ù­È¡C ¦w¸Ë chinese/cmexfonts¡C ³o­Ó®M¥ó¤¤¥]§t¤F 16 ÂI¡B24 ÂI¨â®M¤¤¤åÂI°}¦r«¬¡C WWW: cmex org kcfonts - °ê³ìÂI°}¦r«¬ °ê³ì¤¤¤å PCF ¦r«¬¬O FreeBSD ¤U³Ì±`¥ÎªºÂI°}¦r«¬¡C ­n±oª¾¤w¦w¸Ëªº BIG5 ¦r«¬¥Î¡G &prompt.user; xlsfonts | grep big5 kc15f.pcf.gz -kc-fixed-medium-r-normal--16-160-72-72-c-160-big5-0 kc24f.pcf.gz -kc-fixed-medium-r-normal--24-240-100-100-c-240-big5-0 ¦w¸Ë chinese/kcfonts¡C ³o­Ó®M¥ó¸Ì­±¥]§t¤F 16 ÂI¡B20 ÂI¥H¤Î 24 ÂI¤T®M¤¤ ¤åÂI°}¦rÅé¡A¨¬¨Ñ¤@¯ë±¡ªpÅã¥Ü¤¤¤å¤§¥Î¡C ¾A¥Î©ó 640x480 ¸ÑªR«× (NoteBook) &prompt.root; rxvt -ls -fm kc15 -fn 8x16 & ¾A¥Î©ó +1024x768 ¸ÑªR«× (17 ¦T¿Ã¹õ) &prompt.root; rxvt -ls -fm kc24 -fn 12x24 & gugod-clean - ·f°t¤¤¤åÂI°}¦r«¬¥Îªº­^¤åÂI°}¦r«¬ ¬Ý¤F¤@¤U irc ¤W±o²á¤Ñ¡A²×©óÀ´±o¬O¬°¤F²×ºÝ¾÷ªº´Ý¼v°ÝÃD¡C ¸`¿ý gugod ªº¤@¬q¸Ü¡G °t¦X kc15f §ï¤F¤@¤U schumacher ªº clean¡A¥»¨Ó³o¨âºØ¦r¤£¤@¼Ë°ª¡A ©Ò¥H¥Î¤[¤F term ·|żżªº¡A§ï¦¨¤@¼Ë°ª´N¤£·|¤F¡A³o­Ó clean ¬O 15 ªº¡A «ç»ò§ï¦¨¤@¼Ë°ªªº¡H¤j­P¤W¬O§ï bdf ¤¤ªº PIXEL_SIZE, POINT_SIZE, FONT_ASCENT, FONT_DESCENT ÁÙ¦³ FONT ³o¨ÇªFªF¥ý¡A¤£¹L­n¥ý¥Î xmbdfed §â bdf ¦r§ï¦¨·Q­nªºªø¼e¡A¤£µM clean ¦rªº¨C­Ó¦r¥Àªø¼e³£¤£¤@¼Ë¡A«ÜÃø½Z¡A¬ÛÃö¤u¨ã½Ð¬Ý ports/x11-fonts¡C ¦w¸Ë chinese/gugod-clean¡C &prompt.root; cd /usr/X11R6/lib/X11/fonts/local &prompt.root; mkfontdir &prompt.root; xset fp rehash ±N¥H¤U¥[¤J /usr/X11R6/lib/X11/fonts/local/fonts.alias gugod16 -gugod-clean-medium-r-normal--16-160-75-75-c-90-iso8859-1 gugod18 -gugod-clean-medium-r-normal--18-180-75-75-c-80-iso8859-1 gugod20 -gugod-clean-medium-r-normal--20-200-75-75-c-100-iso8859-1 gugod22 -gugod-clean-medium-r-normal--22-220-75-75-c-110-iso8859-1 µM«á°õ¦æ Eterm --font gugod16 & ´N¥i¥H¬Ý¨ì«Üº}«Gªº Eterm ³z©ú­I´º¡A ­ì¨Ó·|ż±¼ªº²×ºÝ¾÷¤]¨S°ÝÃD¤F¡C intlfonts - ¦U°êªº§K¶OÂI°}¦r«¬ ³o­Ó¥]§t¦U°êªº§K¶O PCF ¦r«¬¡A¦Ó¥B¸Ì­±ÁÙ¥]§t¤F cns11643 ¤C­Ó¦r­±ªº 16pt¡B24pt »P 40pt¡A¥H¤Î big5 ªº taipei16 »P taipei24¡A ¸Ë§¹´X¥G¥i¥H³B²z¦UºØ»y¨¥¤F¡C ¦w¸Ë x11-fonts/intlfonts¡C PostScript ·§½× PostScript¬°¬ü°êAdobe( http://www.adobe.com)¤½¥q©ó1985¦~©Òµoªíªº¤å¥ó´y­z§Þ³N¡A Adobe¨Ã§Q¥Î³o­Ó§Þ³N¡A³Ð³yµÛ¦W¦X¥GPostScript§Þ³Nªº¦r«¬¡A ¨Ã±q¦Ó§ïÅܾã­Ó¦L¨ê¤u·~¡APostScript ¥i¥Hºë½Tªº´y­z¥­­±Ã¸»s¥ô¦ó¤å¦r¤Î¹Ï§Î¡A²{¤µPostScript ªº§Þ³N¤w¸g«D±`´¶¹Mªº¨Ï¥Î¦b¦L¨ê»â°ì¡A¥]¬A¿Ã¹õÅã¥Ü(Display)¡A ¹p®g¦Lªí¾÷(Laser Printer)¡A ¿é¥X¾÷(Imagesetter)¡A ¼Æ¦ì¦L¨ê¾÷(Digital Printing)..µ¥µ¥¿é¥X³]³Æ¡C ¦Ó»PPostScript§Þ³N·f°t³Ì­«­nªº¬OPostScript¦r«¬¡A ¨Ï¥ÎªÌ¥i¥H³z¹LPostScript§Þ³N½Õ¾ã¬Y¨Ç°Ñ¼Æ¡A¦Ó§ïÅܦr«¬ªº¤j¤p¡A ³±¼v/¥ßÅé/ªÅ¤ß/²Ê²Óµ¥¯S®í®ÄªG¡A ¥Ñ©óPostScript¦b¦L¨ê¤è­±¨ô¶Vªí²{¡A ¥Ø«e¥@¬É¤W¥D­nªº¤åÄm´X¥G¦h¬O¥HPostScriptªº§Î¦¡¥X²{¡C ¥Ø«e±`¨£ªº¤¤¤å¦C¦L¤è®×³£¬O²£¥Í Postscript «á¡A ¦A¶i¦æ¦C¦L¡C²£¥ÍªºÀɮפS¥i¤À¬°¤º´O(bg5ps¡Benscript¡Bcnprint) »P¤£¤º´O¦r«¬(truetype¡Bcid font)¡A ¥Ø«eªº¸Ñ¨M¤è®×°¾¦V©ó¨Ï¥Î CID-Keyed font¡C CID-Keyed font¡ACID¬OCharacter IDªºÂ²ºÙ¡C CID¦r§Î®æ¦¡ªº³]­p¥D­n¬O¬°¤F¦UºØPostScript¿é¥X³]³Æ¡A ATM(Adobe Type Manager)³nÅé¡A CPSI(Configurable PostScript Interpreter)¸ÑĶ¾¹¤Î DPS(Display PostScript)Åã¥Ü«¬PostScript³nÅéµ¥¡A ¯à¨Ï¥Î©ó¤j¦r®w¦rÅ鶰¡A¯S§O¬O¥xÆW¡B¤j³°¡B¤é¥»¡BÁú°ê µ¥Âù¦ì¤¸»y¨tªº°ê®a¤å¦r¡C CJK(Chinese , Japan , Korean)¦r¶°¤W¤é¡BÁú¤G°ê¤å¦r¡A °£¤F¥­°²¦W¡B¤ù°²¦W¤ÎÁú¤å¦r¥~¡A¦û³Ì¦h¦rÅé®e¶qªºÁÙ¬Oº~¦r³¡¥÷¡A ¦Ó¥B¤¤¡B¤é¡BÁúªºº~¦r«Ü¦h³£¬O¬Û¦Pªºº~¦r¡A¦pªG¤@®MCJK¦r¶°¯à¥]¬A Big5¡BGB¡BJIS¤ÎKSC½Xªº©Ò¦³ªº¦r§Î¡B ®e¶q¤@©w¤ñ¥|ºØ½X¦ì¤À¶}ªº¦r§Î¤Ö30%¥H¤W¡A¦Ó¥B¥i¥H¤£¥Î¾á¤ß¡A ¥H«á±q¥H¤W¥|­Ó¦a°Ï¨Óªº¤å¥ó¡A¿é¥X®É¨S¦³¹ïÀ³ªº¦r§Î¿é¥X¡C ¦b1990¦~Adobeµoªí¥i¥H¤ä´©Âù¦ì¤¸¬[ºcªºPostScript¦r§Î®æ¦¡¡A ¤@¯ë§Ú­Ì³qºÙ¬°OCF(Original Composite Font)®æ¦¡¡A ¥¦¨Ï¥Î¤ñ¸û½ÆÂø¦r§Îºc³y¤Î¦r§ÎÀx¦s¤è¦¡¡A ¦]¬°¥¦¬°¤F­n¤ä´©Âù¦ì¤¸ªº¦r§Î¡A´N¥²¶·­n°µ¦¨³o¼Ë½ÆÂøªº¬[ºc¡A ¹³¥Ø«e¤j®a©Ò¨Ï¥Îªº¤¤¤åType1¡BType3¡BType4µ¥¦r§Î®æ¦¡¡A ³£¬OÄÝ©óOCF®æ¦¡¡C OCF¦r§Î­n§ì¨ú¦C¦L¤@­ÓÂù¦ì¤¸¦r§Î®É¡A¥²¶·­n¸g¹L½ÆÂøªº¹ïÀ³Ãö«Y¡A ¤~¯à¨ú±o¦r§Îªº¥~®Ø¸ê®Æ¥h¦C¦L¡A©Ò¥HType1¡BType3¡BType4µ¥OCF ¦r§ÎªºÀÉÀY(header)´y­z³£«D±`½ÆÂø¡A ¦Ó¥B¨C¤@®a¦r§Î¼t°Ó³£¤£¤Ó¤@¼Ë¡C CID¦r§Îªº¬[ºc¤ñOCF¦r§Î´N²³æ¦h¤F¡A ª½±µ¥ÑCMapÀÉ®×¥h¹ïÀ³¦r§Î¥~®Ø¸ê®Æ¡A ©Ò¥H¸ÑĶ¾¹¯à§Ö³tªº¨ú±o¤Î¸ÑĶ¦r§Îªº¥~®Ø¸ê®Æ¤Î¦C¦L¡A ¦Ó¥B¤ñ¸û¸`¬Ù°O¾ÐÅ骺¨Ï¥Î¡C Character Collection(¦r§Î¶°)¤ÎCMap File(¹ïÀ³ÀÉ)³o¤GªÌAdobe ¦³©w¸q¼Ð·Ç®æ¦¡¡A¦r§Î¼t°Ó¥i¥H¨Ï¥ÎAdobeªº¼Ð·Ç®æ¦¡¡A ¥HÁcÅ餤¤å¬°¨Ò¡AAdobe©w¸q¤@­ÓCharacter Collection¡A ©M«Ü¦h­ÓªºCMap File¡A¦pAdobe-CNS1-0¡AB5-H¡AB5pc-H¡AETen-B5-H µ¥¤£¦PªºCMap file¡C ¤£¦PªºCMap file¨Ï¥Î©ó¤£¦Pªº¤º½X¨t²Î¡A ¦pªG³o¨Ç¤º½X¨t²Îªº¦r½X¦³ÂX¥R®É¡A¥u­n¼W¥[·sªºCMap file¤ÎCID ¦r§Î§Y¥i¡A¥i¥H¤£¼vÅT¨ì­ì¨ÓªºCMap file¤ÎCID¦r§ÎÀÉ¡C WWW: cid faqs at arphic WWW: Fonts / Type / OpenType ¨Ï¥Î TrueType ¦r«¬·í§@¬O CID fonts gs-cjk ¬O¤@­ÓÅý Aladdin/Artifex/GNU ghostscript(gs) ¯à°÷¨Ï¥Î CJK ¥\¯àªºµo®i­pµe¡C¦b³o­Óºô¯¸¤¤¡A©Ò´£¨Ñªºµ{¦¡¶°¡A ¥]§tÅý gs ¯à°÷§â CJK ( Ác¡B²¤¤¤å¡A¤é¤å¡AÁú¤å ) ªº TrueType ¦r«¬·í§@ CID-Keyed ªº¦r«¬¨Ó³B²zªº¥²­n­×¸ÉÀÉ®×( patch)¡A ¥H¤Î§ï¶i¦b gs CID-Keyed ¦r«¬ªºhandler¡C ¸Ó­pµe¤w¸g¾ã¦X¨ì ghostscript7 CID-Keyed font ¥Ñ CID font ©M CMap ©Ò²Õ¦¨¡A ¨Ï¥Î«e°O±o¦w¸Ë print/adobe-cmap ¡C ¨Ï¥Î ghostscript ¨Ó¦C¦L¤å¥ó¡G &prompt.root; gs -sDEVICE=cdj550 -sOutputFile=/dev/lpt0 xx.ps gs --help ·|¦³§ó¦hªº¿ï¶µ ¥H¦¹®M¥ó·f°t arphicttf ´N¥i¥HÅý¤j³¡¤Àªº³nÅé¥i¥H³z¹L gs Ū¨ú ttf ¨Ó²£¥Í¥¿½Tªº gs ÀÉ¡C - ¥H¤U¬O§Q¥Î ttfm ¨Ó±N arphicttf ªº¦r«¬¥[¤J gs-cjk ªº¦Cªí¡G + ¥H¤U¬O§Q¥Î chinese/ttfm ¨Ó±N arphicttf ªº¦r«¬¥[¤J gs-cjk ªº¦Cªí¡G &prompt.root; ttfm.sh --add gs-cjk bkai00mp.ttf &prompt.root; ttfm.sh --add gs-cjk bsmi00lp.ttf ³o¼Ë·|¤À§O²£¥Í±`¥Îªº CID-Keyed¡GShanHeiSun-Light-Eten-B5-H ¥H¤Î ZenKai-Medium-Eten-B5-H ¥H¨Ñ»Ý­n¦C¦Lªº³nÅé¨Ï¥Î¡A¨Ò¦p Mozilla¡BKDEµ¥¡C WWW: Ghostscript, Ghostview and GSview WWW: gs-cjk project moefonts-cid - ¥Ñ Adobe ÂàĶªº MOE CID Font CID-Keyed font ¥Ñ CID font ©M CMap ©Ò²Õ¦¨¡A CMap ¥i¥H³z¹L¦w¸Ë print/adobe-cmaps ¨Ó¹F¦¨¡A ¦Ó CID font «h¥²¶·¥t¥~¦w¸Ë¡C ¤¤¤å CID font(MOEKai ©M MOESung) ¬O±q±Ð¨|³¡¦Ó¨Óªº¡A ­ì¥»¬° 48x48 ÂI°}¦r«¬¡A¥Ñ Adobe »s§@¦¨ CID font¡C ¦w¸Ë chinese/moefonts-cid¡C ¦Û¦æ¦w¸Ëªº¸Ü¡ACID-Keyed font ¥i¥H±q ftp://ftp.oreilly.com/pub/examples/nutshell/cjkv/adobe/samples/ ¨ú±o MOEKai-Regular MOESung-Regular ³o¨â­Ó CIDFont¡A¨Ã¦b ftp://ftp.oreilly.com/pub/examples/nutshell/cjkv/adobe/ ¨ú±o ac14.tar.Z¡A¸Ì­±¥]§t¤F Adobe-CNS1 ªº CMap ÀɮסC ¸Ë§¹«á´N¦³¦p¤Uªº CID-Keyed font ¥i¥H¨Ï¥Î¡G MOEKai-Regular-ETen-B5-H MOEKai-Regular-ETen-B5-V MOESung-Regular-ETen-B5-H MOESung-Regular-ETen-B5-V ¥H¤U¬O¤@­Ó´ú¸Õªº½d¨Ò¡G &prompt.user; cat cid.ps /MOEKai-Regular-ETen-B5-H findfont 60 scalefont setfont 50 600 moveto (²³¸Ì´M¥L¤d¦Ê«×) show 50 520 moveto (ÅZµM¦^­º) show 50 440 moveto (¨º¤H«o¦b¿O¤õÄæ¬À³B) show showpage quit &prompt.user; gv -antialias cid.ps &prompt.user; ps2ps cid.ps cid2.ps &prompt.user; ps2pdf cid.ps &prompt.user; ps2pdf cid2.ps &prompt.user; xpdf cid.pdf (¥i¯à¤£¦æ) &prompt.user; xpdf cid2.pdf
cid-gv snapshot
- ¥Ø«e¤w¸g¥i¥H¥Ñ ttfm ·f°t + ¥Ø«e¤w¸g¥i¥H¥Ñ chinese/ttfm ·f°t gs-cjk ªº¤è¦¡¨Ó¨ú¥N¡A¦Ó¥B®ÄªG§ó¦n¡C ¥H¤U¬O¥H MOESung-Regular ¬°¨Ò¤l¡A¨Ó¼W¥[²ÊÅé¡B±×Åé¡B²Ê±×Åé¤ä´©¡A ¦b¦w¸Ë®É¡A¥Ñ©ó¥²¶·ÃB¥~¦w¸Ë adobe-cmaps ¨Ó·f°t¡A ©Ò¥H·| DEPENDS print/adobe-cmaps¡C ¦A¨Ó¬O«Ø¥ß²ÊÅé¡A±×Åé¡A²Ê±×Åéµ¥¡A¦b¬Ý§¹ ttfm ªº gs-cjk ¼Ò²Õ«á¡A ¦³­Ó·Qªk´N¬O gs-cjk ªº°µªk¬O¦b ttf ¤W­±«Ø¥ß²ÊÅé¡A±×Åé¡A²Ê±×Åéµ¥¡A ³o¨Ç°µªk¬O¤£¬OÀ³¸Ó¤]¾A¥Î©ó moefonts-cid¡H ¦]¦¹´N«Ø¥ß¤F MOESung-Regular-Bold %!PS-Adobe-3.0 Resource-CIDFont %%BeginResource: CIDFont (MOESung-Regular-Bold) /MOESung-Regular-Bold /MOESung-Regular /CIDFont findresource 16 dict begin /basecidfont exch def /basefont-H /.basefont-H /Identity-H [ basecidfont ] composefont def /basefont-V /.basefont-V /Identity-V [ basecidfont ] composefont def /CIDFontName dup basecidfont exch get def /CIDFontType 1 def /CIDSystemInfo dup basecidfont exch get def /FontInfo dup basecidfont exch get def /FontMatrix [ 1 0 0 1 0 0 ] def /FontBBox [ basecidfont /FontBBox get cvx exec 4 2 roll basecidfont /FontMatrix get transform 4 2 roll basecidfont /FontMatrix get transform ] def /cid 2 string def /BuildGlyph { gsave exch begin dup 256 idiv cid exch 0 exch put 256 mod cid exch 1 exch put rootfont /WMode known { rootfont /WMode get 1 eq } { false } ifelse { basefont-V } { basefont-H } ifelse setfont .03 setlinewidth 1 setlinejoin newpath 0 0 moveto cid false charpath stroke 0 0 moveto cid show currentpoint setcharwidth end grestore } bind def currentdict end /CIDFont defineresource pop %%EndResource %%EOF ¥H¤Î MOESung-Regular-Bold-ETen-B5-H.gsf /MOESung-Regular-Bold-ETen-B5-H /MOESung-Regular-Bold (MOESung-Regular-Bold) /ETen-B5-H (CMap/ETen-B5-H) 1 index /CMap resourcestatus {pop pop pop} {runlibfile} ifelse /CMap findresource 3 1 roll 1 index /CIDFont resourcestatus {pop pop pop} {runlibfile} ifelse /CIDFont findresource [ exch ] composefont pop µ²ªGµo²{¦b´ú¸ÕÀÉ cid.ps /MOESung-Regular-ETen-B5-H findfont 30 scalefont setfont 50 600 moveto (2000¦~5¤ë29¤é) show /MOESung-Regular-Bold-ETen-B5-H findfont 30 scalefont setfont 50 560 moveto (2000¦~5¤ë29¤é) show /MOESung-Regular-Italic-ETen-B5-H findfont 30 scalefont setfont 50 520 moveto (2000¦~5¤ë29¤é) show /MOESung-Regular-BoldItalic-ETen-B5-H findfont 30 scalefont setfont 50 480 moveto (2000¦~5¤ë29¤é) show /MOEKai-Regular-ETen-B5-H findfont 30 scalefont setfont 50 440 moveto (2000¦~5¤ë29¤é) show /MOEKai-Regular-Bold-ETen-B5-H findfont 30 scalefont setfont 50 400 moveto (2000¦~5¤ë29¤é) show /MOEKai-Regular-Italic-ETen-B5-H findfont 30 scalefont setfont 50 360 moveto (2000¦~5¤ë29¤é) show /MOEKai-Regular-BoldItalic-ETen-B5-H findfont 30 scalefont setfont 50 320 moveto (2000¦~5¤ë29¤é) show showpage quit ²ÊÅ骺³¡¤À¥X²{¤F¹w´Áªº®ÄªG¡A©Ò¥H´NÄ~Äò»s§@±×Åé»P²Ê±×Åé¡A ³o³¡¤À¥i¥H°Ñ¦Ò gs-cjk¡A±×Å骺¦WºÙ©w¬° MOESung-Regular-Italic¡A ¦Ó²Ê±×Åé«h¬O MOESung-Regular-BoldItalic¡C ³Ì«á¡A°O±o§â³o¨Ç .gsf ¼g¤J /usr/local/share/ghostscript/7.05/lib/Fontmap.GS ¼gªk¬O¡G¦r«¬ (¦r«¬.gsf) ; /MOESung-Regular-ETen-B5-H (MOESung-Regular-ETen-B5-H.gsf) ; /MOESung-Regular-Bold-ETen-B5-H (MOESung-Regular-Bold-ETen-B5-H.gsf) ; /MOESung-Regular-BoldItalic-ETen-B5-H (MOESung-Regular-BoldItalic-ETen-B5-H.gsf) ; /MOESung-Regular-Italic-ETen-B5-H (MOESung-Regular-Italic-ETen-B5-H.gsf) ; ³Ì«á­×§ï¤@¤U -H ¦¨ -V ¦A­«½Æ¤W­±ªº¹Lµ{§Y¥i¡A ¨ä¥Lªº¦r«¬¤]¬O´X¥G¤@¼Ëªº°µªk´N¥i¥H§¹¤u¤F¡A ¤£¹L¡A¯uªº¤ñ¤£¤W¥Î ttf °µ¥X¨Óªº§r ¦p¦¹«Ø¥ß§¹¡A´N·|¦³¤@°ï¥i¥Îªº CID-Keyed ¦r«¬ MOESung-Regular-ETen-B5-H MOESung-Regular-Bold-ETen-B5-H MOESung-Regular-BoldItalic-ETen-B5-H MOESung-Regular-Italic-ETen-B5-H ³o¼Ë¤l¦b°t¦X¤å®Ñ³nÅé¤W¡AÀ³¸Ó·|§ó¦n¡A §Ú·Q¤å®Ñ³nÅéºCºCªº¤]·|§â¦C¦Lªº³¡¤À¥Î gs ©Ò´£¨Ñªº¦r«¬¨Ó¼ÒÀÀ¡A¹³¬O editors/Abiword ´N¬O­Ó«Ü´Îªº¨Ò¤l¡A ¦Ó kde2 «h¬O¦Û¤v°µ²ÊÅé¡A±×Åéµ¥ªº¼ÒÀÀ¡A ¤£¹L§ÚÁÙ¨S¥h´ú¸Õ¨ì²ÊÅé©M±×Å骺³¡¤À¡A µ¥¦³ªÅ¶¢¤F¦A¥h¸Õ¸Õ¡C
moefonts-cid snapshot
¥H gs Æ[¬Ý¤£¤º´Oªº pdf ÀÉ gs/gv ¦³­Ó dirty hack¡A´N¬O¬Ý¨ì name type emb sub uni object ID ------------------------------------ ------------ --- --- --- --------- °ê¦r¼Ð·Ç§ºÅé CID TrueType no no no 22 0 ³oºØÃþ«¬ªº¤£¤º´O¦r¡A´N¦Û¤v¨ì /usr/local/share/ghostscript/7.05/lib/CIDFnmap ¤¤¥[¤W alias¡A¥H§Ú¦Ó¨¥·|¥[¤W¤å¹©¤W®ü§ºªº alias¡G /°ê¦r¼Ð·Ç§ºÅé /ShanHeiSun-Light ; §õªG¥¿ Edward G.J. Lee ¤]´£¥X¤ñ¸û¥¿¦¡ªº¸Ñªk¦p¤U¡G ¬Q¤Ñª±¤F¤@¤U gs¡Cµo²{¥i¯à¤£¥²³o»ò³Â·Ð¡A¦]¬° CJK-latex + dvipdfmix »s§@¥X¨Óªº¤£¤º´O¤¤¤å PDF ÀÉ¡A»á¦X PDF-spec¡CÁöµM¡Apdffonts ¬Ý¨ìªº¬O¡G name type emb sub uni object ID ------------------------------------ ------------ --- --- --- --------- °ê¦r¼Ð·Ç§ºÅé CID TrueType no no no 22 0 ¦ý¨ä¹ê PDF ÀɸÌÀY·|¼Ð°O¦¨ Adobe-CNS1¡A¤]´N¬O»¡·|¥h¨Ï¥Î PDF browser Adobe-CNS1 ªº¹w³]¦r«¬¡A¨Ò¦p¡G 34 0 obj << /Type/Font /Subtype/CIDFontType2 /BaseFont/#b0#ea#a6r#bc#d0#b7#c7#a7#ba#c5#e9,Italic /FontDescriptor 35 0 R /CIDSystemInfo<< /Registry(Adobe) /Ordering(CNS1) /Supplement 0 >> >> endobj ¥H¦¹ object ¬°¨Ò¡C¨ä¤¤ # ¬O¥Nªí hex notation¡A ¨º¤@°ï´N¬O¡y°ê¦r¼Ð·Ç§ºÅé¡z¡A «á­±·|¦³ /Registry(Adobe) /Ordering(CNS1)¡A¦]¦¹¡A¥u­n gs ªº CIDFnmap ³]¦¨¡G /Adobe-CNS1 /ShanHeiSun-Light ; ´N¥i¥H¤F¡A¤]´N¬O»¡¡A¤£ºÞ PDF ¨Ï¥Î¤°»ò¦r«¬¡A¦pªG§ä¤£¨ì¦¹¦r«¬¡A ´N·|¨Ï¥Î¹w³]ªº (Adobe-CNS1)ShanHeiSun-Light¡C ³o¼Ë´N¤£¥²¹J¨ì¨S¦³ªº¦r«¬´N±o¥h¥[¤J alias¡C ¦Ó acroread ¤]·|¥h§ä¥Lªº¹w³]¦r«¬ MHei-Medium ©Î MSung-Light (µø acroread ¦p¦ó³]©w¡A³]¦¨ sans «h¨ú¥Î¶ÂÅé¡A³]¦¨ serif «h¨ú¥Î§ºÅé)¡C¬°¨¾·N¥~¡A«Øij¥H¤U¨â¦æ¤]¥[¤J¡G /Adobe-CNS1-Big5 /ShanHeiSun-Light ; /Adobe-CNS1-Unicode /ShanHeiSun-Light ; ³o¼Ë¤@¨Ó¡A¦C¦Lªº°ÝÃD¤]¸Ñ¨M¤F¡Cpdf2ps(pswrite device) ®É gs ·|¥h¨ú¥Î ShanHeiSun-Light¡C·íµM¡A«e´£¬O /usr/share/ghostscript/Resource ­n§â ShanHeiSun-Light ¹w¥ý³]©w¦n¡C TrueType - ¥þ¯u¦r«¬·§½× TrueType¦r«¬®æ¦¡¬°¬ü°êApple ( http://www.apple.com)¤ÎMicrosoft ( http://www.microsoft.com )©Ò¦@¦P¨î©w¡A³Ì¥ý¨Ï¥Î©óAppleªºMacintosh¨t¦C¤Î Microsoft Windows 3.1¡A ¦Ó¥Ø«eAppleªºOS 8.0¤Î Microsoft Windows 95/NT/2000/XP¤]³£¨Ï¥Î TrueType§@¬°¦r«¬®æ¦¡¡C °ò¥»¤WTrueType©MPostScript¤@¼Ë¡A³£¬O¨Ï¥Î¨©¯÷¦±½u(Bezier Curve) ¨Ó´y­zªº¥~®Ø¦r¡C ¦r«¬¥i¥H§@¥ô·N¤Ø¤oªº©ñ¤jÁY¤p¡A ©Î§@¨ä¥LÄݩʪºÅܤơA¤£¹L¥Ñ©óApple¤ÎMicrosoft ªº§@·~¨t²Î³£ª½±µ¤ä´©¦¹¦r«¬®æ¦¡¡A©Ò¥H¨Ã¤£»Ý­n¦pPostScript ¤@¼Ë¡A¥~±¾(Adobe)Type Manager¤§Ãþªºµ{¦¡¡C WWW: Features of TrueType and OpenType ttfm - TrueType ¦r«¬ºÞ²z¤u¨ã ¥Ø«e¦³³\¦hµ{¦¡³£·|­n¨D¨Ï¥Î TTF ¦r«¬¡A©Ò¥H§Ú­Ì³Ì¦nÁÙ¬OÀ° X ¥[ ¤W¤¤¤åªº TTF ¦r«¬¤ä´©¡C¥Ø«e¦w¸Ë¦r«¬©Ò»Ýªº fonts.dir ¤w¸g¤£»Ý­n - ¨Ï¥Î¼É¤Oªº¤èªk²£¥Í¡A¨Ï¥Î ttfm + ¨Ï¥Î¼É¤Oªº¤èªk²£¥Í¡A¨Ï¥Î chinese/ttfm ´N¥i¥H«Ü¶¶§QªººÞ²z©Ò¦³ªº¤¤¤å¦r - «¬¤F¡C¦Ó²{¦b¦b ports ¤¤ªº TrueType ¦r«¬¦³¤T®M¡A + «¬¤F¡C¦Ó²{¦b¦b ports ¤¤ªº TrueType ¦r«¬¦³¤C®M¡A + arnettf¡B arphicttf¡B + dfsongsd¡B + fireflyttf¡B + mingunittf¡B moettf¡B - wangttf¡C + wqy¡C ¦w¸Ë chinese/ttfm¡C ¦w¸Ë«á¥]§t¤F¡G ttfinfo¡G¤@­Ó¥i¥H¥Î¨ÓŪ¨ú ttf ¦r«¬®æ¦¡¸ê°Tªº¤pµ{¦¡¡A½d¨Ò¦p¤U¡G &prompt.root; ttfinfo /usr/local/share/fonts/TrueType/bkai00mp.ttf TTFINFO_FONT_FILE="/usr/local/share/fonts/TrueType/bkai00mp.ttf" TTFINFO_FONT_NAME="AR PL KaitiM Big5" TTFINFO_FONT_PSNAME="ZenKai-Medium" TTFINFO_FOUNDRY_NAME="Arphic" TTFINFO_WEIGHT_NAME="medium" TTFINFO_WIDTH="normal" TTFINFO_NUMCMAP="2" TTFINFO_CMAP0="1,0" TTFINFO_CMAPNAME0="Apple,Roman" TTFINFO_CMAP1="3,1" TTFINFO_CMAPNAME1="Windows,Unicode" TTFINFO_MAPNUM="1" TTFINFO_FONTMAP1="-Arphic-AR PL KaitiM Big5-medium-r-normal--0-0-0-0-c-0-big5-0" ttfinst.tk¡G¹Ï§Î¤¶­±ªº tk script¡A ¥i¥H¥Î¨Ó¦w¸Ë¦r«¬¡A¤£«Øij¨Ï¥Î¡C ttfm.sh¡Gshell script¡A¹w³Æ§@¬° ttf ¦r«¬Á`ºÞ¡C &prompt.root; ttfm.sh --help True-Type Font Manager 0.9.3 Usage: /usr/local/bin/ttfm.sh [option] --add [module] <file>... install ttf font --remove [module] <file>... remove ttf font from the system --list <module>... list all ttf fonts on the system --modules list all ttf manager modules on the system --initm <module>.. initialize modules --help show this info ³o­Óµ{¦¡·|¥h§Q¥Î¦ì©ó /usr/share/fonts/install/ ©³¤U¥H ".ttfm" µ²§Àªº¥i°õ¦æÀɨӦw¸Ë¡B³]©w¦r«¬¡A ³o¨Ç .ttfm Àɮקں٠¬° ttfm module¡A¥Ñ»Ý­n¨Ï¥Î¨ì ttf ¦r«¬ªºµ{¦¡´£¨Ñ¡A³o¨Ç¼Ò²Õ¥² ¶·²Å¦X¥H¤U­n¨D¡G ¥i¿W¥ß¨Ï¥Î¡A¤£¤@©w³z¹L ttfm.sh ©I¥s°õ¦æ¡C ¤£¹ï¨t²Î¦r«¬¥Ø¿ý¦³¥ô¦ó¹w³]¡A¥uºÞ²z¦Û¤v¼Ò²Õ¦r«¬¥Ø¿ý¤UªºÀɮסC ¹ï ttf Àɮצì¸m»Ý¨D¤£¦P©ó ttfm.sh ¤¤ªº¨t²Î¦r«¬¥Ø¿ý®É¡A¥H link ¤è¦¡³B²z¡A¤£ copy ttf ÀɮסA²¾°£¦r«¬®É¤£§ó°Ê¨t²Î¦r«¬¥Ø ¿ý¤¤ªºÀɮסC ´£¨Ñ¦Ü¤Ö¤U­±´X­Ó°Ñ¼Æ¨Ñ ttfm.sh ¨Ï¥Î¡G --name Åã¥Ü¼Ò²Õ¦WºÙ --list ¦C¥X¼Ò²ÕºÞ²zªº²{¦³¦r«¬»P¹ïÀ³ªº¦WºÙ --add <file> ¼W¥[¦r«¬¡Afile ¬°¤@¦r«¬ÀɮצWºÙ¡A¦p /mnt/windows/fonts/mingliu.ttc --remove <file> ²¾°£¦r«¬¡Afile ¬°¦r«¬ÀɮצWºÙ¡A¥i¥H¬O fullpath¡B¥ç¥i¥H¬O³æ¯ÂÀɮצW¡A¦p /usr/local/share/fonts/TrueType/bkai00mp.ttf or bkai00mp.ttf - ttfm ±Ä¥Î¼Ò²Õ¤Æªº³]­p¡C + chinese/ttfm ±Ä¥Î¼Ò²Õ¤Æªº³]­p¡C ¨C¤@­Ó»Ý­n¨Ï¥Î¨ì ttf ¦r«¬ªº - µ{¦¡³£¥i¥H´£¨Ñ ttfm ªº¼Ò²Õ¡A + µ{¦¡³£¥i¥H´£¨Ñ chinese/ttfm ªº¼Ò²Õ¡A µM«á«K¥i³z¹L ttfm.sh ¨Ó°µ¨ì ¦r«¬ªº¦w¸Ë¡A²¾°£¡A¦Cªí¡A³]©w¹w³]¦r«¬µ¥ºÞ²zªº°Ê§@¡C - ¥Ø«e¤w¦³ªº ttfm ¼Ò²Õ¦³¡G + ¥Ø«e¤w¦³ªº chinese/ttfm ¼Ò²Õ¦³¡G abiword µ¹ AbiWord 0.7.12 ©Î¬O¥H¤Wªºª©¥»¨Ï¥Î¡C chitex ¦w¸Ë ChiTeX ¦r«¬ (by cwhuang) gscjk µ¹ Aladdin Ghostscript ¨Ï¥Î¡C¥i¥HºÞ²z TrueType ¦r«¬ ©M CID ¦r«¬¡AGhostscript ¥²¶·­×¸É¥i¥H¨Ï¥Î TrueType ¦r«¬¡C ttf2pk ¨Ñ freetype-contrib ªº ttf2tfm, ttf2pk ¨Ï¥Î (by cwhuang) xfreetype µ¹ XFree86's freetype backend¡A¦b 3.x ¬O Xfsft¡A ¦b 4.x ¬O freetype ¼Ò²Õ¡C xttfm-tcl µ¹ XFree86 3.3.x X-TrueType server¡C xttfm ¦w¸Ëµ¹ X window ¥Îªº font.dir, font.alias (by ¤p¦ä) ¤@¨Ç¨Ï¥Î½d¨Ò¡G 1. ¥[¤J¦r«¬¡G &prompt.root; ttfm.sh --add <path>/bsmi00lp.ttf (xttfm ·|¥O xfs ­«·s¸ü¤J¦r«¬¦WºÙ¡C¦pªG±z¤£¬O¨Ï¥Î xfs¡A ±z­n¦Û¤v¤U xset fp rehash ¥O·sªº¦r«¬¦WºÙ¥Í®Ä¡A©ÎªÌ­«·s±Ò°Ê X Window ) 2. ¦C¥X¦r«¬¡G &prompt.root; ttfm.sh --list xttfm ·|¦C¥X xttfm ¼Ò²Õ©Ò¦³¦w¸Ëªº¦r«¬¡C ±z²{¦b¥i¥H¥Î xlsfonts ¬Ý¨ì³o¨Ç¦r«¬¦WºÙ¡C ¨Ã¥i¥Î xfd -fn <¦r«¬¦WºÙ> ¸Õ¸Õ¯à§_¬Ý¨ì¦r«¬¡C 3. ²¾°£¦r«¬¡G &prompt.root; ttfm.sh --remove bsmi00lp.ttf ³o¤£»Ý¦h°µ¸ÑÄÀ§a¡H 4. ³]©w¹w³]¦r«¬¡G &prompt.root; ttfm.sh --setdefault xttfm bkai00mp.ttf ±N xttfm ¼Ò²Õªº¹w³]¦r«¬§ó§ï¬° - bkai00mp.ttf ³o©Î³\¬O ttfm + bkai00mp.ttf ³o©Î³\¬O chinese/ttfm ³Ì powerful ªº¥\¯à¤§¤@¤F¡C ±z¥iµo²{ X Window ¹w³]ªº¤¤¤å¦r«¬³q³qÅܦ¨·¢Å骺¡C ª`·N¹w³]¦r«¬¬O¸ò encoding ¦³Ãöªº¡C±z¥i¥H¹ï¤£¦Pªº - encoding ¤À§Oµ¹©w¹w³]¦r«¬¡Cttfm + encoding ¤À§Oµ¹©w¹w³]¦r«¬¡Cchinese/ttfm ·|¦Û°Ê®Ú¾Ú©Òµ¹©w ttf ¦Û°Ê§PÂ_À³³]©w¨ººØ encoding ªº¹w³]¦r«¬¡C ¨Ò¦p ttfm.sh --setdefault xttfm gkai00mp.ttf ·|³]©w GB ªº¹w³]¦r«¬¬°·¢Åé¡C 5. ¼Ò²Õªºªì©l¤Æ¡G &prompt.root; ttfm.sh --initm <module name>... ³o­Ó¥\¯à¬O¥Î¨Ó¦b¦w¸Ë¤@¼Ò²Õ®É¡A±N¨t²Î¤w¦³ªº ttf ¦r«¬³q³q¦w¸Ë¨ì¸Ó¼Ò²Õ¤¤¡C ¦pªG¤U: &prompt.root; ttfm.sh --initm all ·|¥O©Ò¦³¤w¦w¸Ëªº¼Ò²Õ³£°µªì©l¤Æªº°Ê§@¡C (¤]´N¬O±N©Ò¦³¦r«¬¦w¸Ë¨ì©Ò¦³ªº¼Ò²Õ¤¤) ¦pªG±z¼¶¼g¤F¤@­Ó ttfm ªº¼Ò²Õ¡A½Ð°O±o¦b¦w¸Ë®É °õ¦æ ttfm.sh --initm <±zªº¼Ò²Õ¦WºÙ> Ãö©ó TrueType ¦r«¬ªº³]©w¡A¦b±Ò°Ê±zªº X ¤§«e¡A °O±oÀˬd /etc/XFree86 ¤U­±¦³¨S¦³ ©Î¬O¦b ~/.xinitrc ¤¤¥[¤W ¡C &prompt.root; cvs -d :pserver:anonymous@cle.linux.org.tw:/var/lib/CVSROOT login (Logging in to anonymous@cle.linux.org.tw) CVS password: &prompt.root; cvs -d :pserver:anonymous@cle.linux.org.tw:/var/lib/CVSROOT checkout ttfm WWW: ttfm project mingliu - ·L³n²Ó©úÅé TrueType ¦r«¬ Contributed by EricCheng Last Update: 2003¦~ 9¤ë21¤é ©P¤é 21®É13¤À54¬í CST mingliu ¬O·L³n¦VµØ±dÁʶRªº¤¤¤åÁcÅé¦r«¬¡A ¤]¬O Windows ¨Ï¥ÎªÌ³Ì²ßºDªº¹q¸£¦r¡C &prompt.root; cd /usr/ports/outta-port/mingliu &prompt.root; make install clean mingliu.ttc ¦³¨â­Ó faces¡A²Ä¹s­Ó face ¬O ²Ó©úÅé(MingLiU)¡A­^¤å¦r«¬¬Oµ¥¼eªº¡A ²Ä¤@­Ó¬O·s²Ó©úÅé(PMingLiU)¡A¤£µ¥¼eªº­^¤å¦r«¬¡A ¹w³]·|¨Ï¥Î²Ä¹s­Ó¡A¦pªG­n¨Ï¥Î·s²Ó©úÅ骺¸Ü¡A¥²¶·¥t¥~³]©w¡C ²Ó©úÅé¦b 11, 12, 13, 15, 16, 20 ÂIªº¤j¤p¦³¯S§O°µ¤º´OªºÂI°}¦r¡A ´«¥y¸Ü»¡¡A¥Ñ©ó¤¤¤å¦rªº hinting ¤£©ö¡A¦³®ÉÂI°}¦r·|¤ñ¸û¦³®Ä¡C ¤S¦]¬°·s²Ó©úÅé¨Ï¥Î¤F bytecode ¨Ó²Õ¦Xµ§¹º¡A ¨S¦³½s¶i bytecode interpreter ªº freetype ª©¥»¦b render ªº®É­Ô¡A ´N·|¸H±¼¡C ¦b¥Ø«e ports/print/freetype2 ¤¤¡A¹w³]·|§Q¥Î files/patch-include::freetype::config::ftoption.h ±N TT_CONFIG_OPTION_BYTECODE_INTERPRETER ¥´¶}¡C ³]©wÅý²Ó©úÅé¦b³o¨Ç¤j¤p®É¡AÅã¥Ü¤º«ØªºÂI°}¦r¦Ó¤£­n¥Î anti-aliased¡A ¦b ~/.fonts.conf ¥[¤J¡G <match target="font"> <test name="family"><string>MingLiU</string></test> <edit name="antialias"><bool>true</bool></edit> <edit name="hinting"><bool>true</bool></edit> <edit name="autohint"><bool>false</bool></edit> </match> <match target="font"> <test name="family"><string>MingLiU</string></test> <test name="size" compare="less_eq"><int>12</int></test> <edit name="antialias" mode="assign"><bool>false</bool></edit> <edit name="hinting" mode="assign"><bool>true</bool></edit> </match> ¦]¬° MingLiU «ÅºÙ¦Û¤v¬O monospaced ¦r«¬¡A ¦ý¹ê»Ú¤W¥¦¦³¨âºØ©T©w¼e«×¡G¤¤¤åªº¥þ§Î¥H¤Î­^¤åªº¥b§Î¡A ³y¦¨ freetype »~§P©Ò¦³¦r³£¬O¸ò¤¤¤åªº¥þ§Î¤@¼Ë¼e¡A ¨Ï±o­^¤å¦r©M¤¤¤å¦r·|µ¥¼e¡C ¥i¥H­×§ï freetype ªº globaladvance flag ©Î¬O spacing¡A 0 ¬O proportional ªº spacing¡A100 ¬O mono¡A110 ¬O charcell¡G <match target="font"> <test name="family"><string>MingLiU</string></test> <edit name="globaladvance"><bool>false</bool></edit> </match> <match target="font"> <test name="family"><string>MingLiU</string></test> <edit name="spacing"><int>0</int></edit> </match> °O±o¦b ~/.fonts.conf ªºÀY§À¥[¤W <?xml version="1.0"?> <!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <fontconfig> ... </fontconfig> ¦b X11 Core Font ¤W¡A«h¬O§Q¥Î xtt ªº¥\¯à¨Ó¿ï¨ú Face 1 ªº PMingLiU ¨ÓÅã¥Ü¡A¤]´N¬O¦b³Ì«e­±¥[¤W fn=1¡A¨ÃÀˬd Spacing Äæ¦ì¬O§_¬° p¡AMingLiU ªº Spacing Äæ¦ì¬O m¡C ¦pªG¦w¸Ë chinese/ttfm ·|¦Û°Ê¥[¤J¨â­Ó face¡C mingliu.ttc -DynaLab-MingLiU-medium-r-normal--0-0-0-0-m-0-iso8859-1 fn=1:mingliu.ttc -DynaLab-PMingLiU-medium-r-normal--0-0-0-0-p-0-iso8859-1 WWW: EricCheng Fontconfig simsun - ·L³n§ºÅé TrueType ¦r«¬ simsun ¬O·L³n¦V ZHONGYI Electronic Co. ÁʶRªº¤¤¤å²Åé¦r«¬¡A ¤]¬O Windows ¨Ï¥ÎªÌ³Ì²ßºDªº¹q¸£¦r¡C &prompt.root; cd /usr/ports/outta-port/simsun &prompt.root; make install clean simsun.ttc ¦³¨â­Ó faces¡A²Ä¹s­Ó face ¬O SimSun¡A­^¤å¦r«¬¬O¤£µ¥¼eªº¡A ²Ä¤@­Ó¬ONSimSun¡Aµ¥¼eªº­^¤å¦r«¬¡A ¹w³]·|¨Ï¥Î²Ä¹s­Ó¡A¦pªG­n¨Ï¥ÎNSimSunªº¸Ü¡A¥²¶·¥t¥~³]©w¡C ¦]¬° NSimSun «ÅºÙ¦Û¤v¬O monospaced ¦r«¬¡A ¦ý¹ê»Ú¤W¥¦¦³¨âºØ©T©w¼e«×¡G¤¤¤åªº¥þ§Î¥H¤Î­^¤åªº¥b§Î¡A ³y¦¨ freetype »~§P©Ò¦³¦r³£¬O¸ò¤¤¤åªº¥þ§Î¤@¼Ë¼e¡A ¨Ï±o­^¤å¦r©M¤¤¤å¦r·|µ¥¼e¡C ¥i¥H­×§ï freetype ªº globaladvance flag ©Î¬O spacing¡A 0 ¬O proportional ªº spacing¡A100 ¬O mono¡A110 ¬O charcell¡G <match target="font"> <test name="family"><string>NSimSun</string></test> <edit name="globaladvance"><bool>false</bool></edit> </match> <match target="font"> <test name="family"><string>NSimSun</string></test> <edit name="spacing"><int>0</int></edit> </match> °O±o¦b ~/.fonts.conf ªºÀY§À¥[¤W <?xml version="1.0"?> <!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <fontconfig> ... </fontconfig> ­Y­n¨Ï¥Îµ¥¼eªº NSimSun¡A¦b X11 Core Font ¤W¡A «h¬O xtt ªº¥\¯à¨Ó¿ï¨ú Face 1 ªº NSimSun ¨ÓÅã¥Ü¡A¤]´N¬O¦b³Ì«e­±¥[¤W fn=1¡A¨ÃÀˬd Spacing Äæ¦ì¬O§_¬° m¡ASimSun ªº Spacing Äæ¦ì¬O p¡C ¦pªG¦w¸Ë chinese/ttfm ·|¦Û°Ê¥[¤J¨â­Ó face¡C simsun.ttc -misc-SimSun-medium-r-normal--0-0-0-0-p-0-iso8859-1 fn=1:simsun.ttc -misc-NSimSun-medium-r-normal--0-0-0-0-m-0-iso8859-1 mingunittf - ­»´ä¸É¼W¦r²Å¶°2001 mingunittf ¥]§t¤F­»´ä¸É¼W¦r²Å¶°2001ªº©Ò¦³¦r¡C mingunittf ªº¦w¸Ë: &prompt.root; cd /usr/ports/outta-port/mingunittf &prompt.root; make install clean ¥Ñ©ó·f°t ttfm ªº xttfm ¼Ò²Õ¡A¦]¦¹¦b XF86Config ¸Ì­±¤@©w­n ¤~¦æ¡C moettf - ¥xÆW±Ð¨|³¡¼Ð·Ç TrueType ¦r«¬ moettf ¥xÆW±Ð¨|³¡¼Ð·Ç·¢®Ñ¡B§ºÅé ttf ¦r§ÎÀÉ¡A²{¦b¤S¥[¤F¨â­Ó¦r«¬ moe_sungext.ttf ©M moe_sungsym.ttf¡AÁöµM¦r«¬¬O BIG5 ½s½X¡A ¦r¤¸©M²Å¸¹¦b CNS ¤¤ÁÙ¬O°¸¦Ó·|¥Î¨ì¡C ¦w¸Ë chinese/moettf¡C ¥H¤U«ö·Ó¦~¥N»¡©ú 85.12.03 °ê¦r¼Ð·Ç¦rÅé·¢®Ñ¥À½Z 85.12.03 °ê¦r¼Ð·Ç¦rÅ駺Åé¥À½Z 85.12.05 °ê¦r¤èÅé¥À½Z ³o®É Wukai ±q±Ð¨|³¡ªº¼Ð·Ç¦rÅéÂন¨â­Ó ttf¡A http://bbs.ee.ntu.edu.tw/boards/Linux/7/8/4.html ¡A¤]´N¬O²Ä¤@ª©ªº moe_kai.ttf »P moe_sung.ttf¡A moe_sung ªº¦r¼Æ¬O 13865¡Amoe_kai ªº¦r¼Æ¬O 13849 ¤Ö¤F´X­Ó¯S§O½ÆÂøªº¦r¡A ³o¬O±Ð¨|³¡­ì©l´£¨Ñªº¦r­±¥À½Zªº¤Ö¤Fªº¡A¤£¬OÂà´«¹Lµ{¤¤ lost ±¼ªº¡C 87.12.28 °ê¦rÁõ®Ñ¥À½Z 88.05.20 °ê¦r¼Ð·Ç¦rÅ駺Åé¥À½Z¼W¸É½s ³o¨â­Ó´N¬O«á¨Ó¼W¥[ªº edustd-15.exe¡Bedustds1.exe¡Bedustds2.exe¡A ¤]´N¬O«á¨Óªº²Ä¤Gª©¡C 92.02 ±Ð¨|³¡·¢®Ñ¦r§ÎÀÉ ³o­Ó«h¬O³Ìªñ·s¼WªºÀɮסA«~½è¤ñ·¢®Ñ¥À½Z¦n«Ü¦h¡A ¦³ Big5 ©M Unicode ª©¡C·íµM¦³¾÷·|¨ú¥N­ì moe_kai.ttf¡A ¤£¹LÁٻݭn¤ñ¸û¦r¼Æµ¥¥i¯à°ÝÃD¡C Á`µ²¡G¥Ø«e¦b ports/chinese/moettf ¤¤¦³¤­­ÓÀɮסA¤è§O¬O 2059101 edustd-15.exe ±Ð¨|³¡Áõ®Ñ¦r§ÎÀÉ[µù1] 1971355 edustds1.exe ±Ð¨|³¡¼Ð§ºÅé¼W¸É½s¦r§ÎÀÉ[µù2] 139950 edustds2.exe ±Ð¨|³¡¼Ð§ºÅé¼W¸É½s¦r§ÎÀÉ[µù2] 9194491 moe_kai.ttf °ê¦r¼Ð·Ç¦rÅé·¢®Ñ¥À½Z[µù3] 8647174 moe_sung.ttf °ê¦r¼Ð·Ç¦rÅ駺Åé¥À½Z[µù3] [µù1] http://www.edu.tw/mandr/allbook/lishu/lishu.htm [µù2] http://www.edu.tw/mandr/result/5879/5879.html [µù3] http://www.edu.tw/mandr/bbs/1-4-2/ksf.html ¦ý¬O¦b±Ð¨|³¡·¢®Ñ¦r§ÎÀÉ[µù4]¡A¬Ý¨ì¤T­Ó¤£¦Pªº·¢®Ñ¦r«¬¡H 13842688 kai-pc.ttf PC ª©(92.2) Windows ¨t²Î¾A¥Î 13837924 kai-linux.ttf Linux ª©(92.2) Linux§@·~Àô¹Ò¾A¥Î 9300584 ct.sit MAC ª©(92.2) APPLE¹q¸£¾A¥Î [µù4] http://www.edu.tw/mandr/bbs/1-4-2/kai.htm
moettf snapshot
WWW: ±Ð¨|³¡°ê¦r¼Ð·Ç¦rÅ餽§i
arphicttf - ¤å¹©¬ì§Þ TrueType ¦r«¬ arphicttf ¬O¥Ñ¤å¹©¬ì§Þ´£¨Ñ¡A ¥]§t¤å¹©PL²Ó¤W®ü§º¡A¤å¹©PL¤¤·¢ ¡]BIG-5½X¡^©M¤å¹©PL²³ø§º¡B¤å¹©PL²¤¤·¢¡]GB½X¡^¡C¥¦¥i¥H³Q¥Î¨Ó §@¬° X Window ¨t²Î©Î¬O±Æª©³nÅé¨Ò¦p CJK¡C·PÁ¤幩¬ì§Þ¡A±z¥i¥H ¦b GPL-base ª©Åv¤U¦Û¥Ñ´²§G³o¨Ç°ª«~½èªº¦r«¬¡C ARPHIC_*.TXT ¦³§ó¸Ô²Óªº¤å¥ó¡C ºÉ¶qÁקK¨Ï¥Î¤å¹©PL²Ó¤W®ü§º©ó±Ð¨|¥Î³~¡A ¸Ó¦r«¬¦³³\¦h¦rªº¦r§Î·|³y¦¨±Ð¨|¥Î³~¤Wªº»~¾É¡A ¬°¤FÁקK»~¤H¤l§Ì¡AºÉ¥i¯àªº¤£­n¨Ï¥Î¸Ó¦rÅé¡C ¨ä¤¤²Ó¤W®ü§ºªº³¡¥÷¬O±Ä¥Î¹ï©¤ªººD¥ÎªºÁcÅé¼gªk¡A©M¥xÆWªº¼gªk¨Ã¤£¬Û¦P¡A ³ÌÅãµÛªº¨Ò¤l¬O¡y¨¤¡z¡A¤¤¶¡ªº¡y¤g¡z¤¤¶¡¬OÁa¬ïªº¡A ¤j®a¥i¥H©M MS ªº·s²Ó©ú¤ñ¸û«K¥iª¾¹D¡C¦ý¤¤·¢ªº³¡¥÷«hµL¦¹±¡§Î¡C ¦]¦¹¡A´£¿ô¤j®a¡A¦pªG¬O¥Î¦b¾Ç®Õ¡B¤½°È³æ¦ì¡A©Î®a¸Ì¦³¦b¾Ç¤l§Ì¦b¨Ï¥Îªº¸Ü¡A «ØijºÉ¶qÁקK¨Ï¥Î²Ó¤W®ü§º¡A§ï±Ä¤¤·¢¡A©Î¥t¦æÁʸm¥xÆW³q¥Îªº¦r«¬¡C ¯à«O¯d¤¤¤åÁcÅ骺¥¿Åé¼gªkªº°ê®a¡A¤j·§´N¥u³Ñ¥xÆW¤F¡A ½Ð¤j®a¦n¦n·RÅ@§Ú­Ìªº¬Ã¶Q¤å¤Æ¿ò²£¡C ÁÙ¦³¤@¨Ç¥xÆWÁcÅé»P¤j³°ÁcÅ骺¼gªk®t²§¡A ¡u°©¡v¡B¡uÅé¡v¡B¡u¹L¡v¦rµ¥µ¥¡A¡u¢z¡v¨º¨â¹º³Q²¤Æ¦¨¤@¹º¡AÅܦ¨¡u¢{¡v¡C ¯óªáÀY¡G¥xÆW¼Ð·Ç¼gªk¬O ¡u¤Q¤Q¡v¡A¤j³°¼Ð·Ç¼gªk¬O¡u¤{¡v(¥|¹º --> ¤T¹º)¡C ¡u§d¡v¦r¡A¤j³°¼Ð·Ç¼gªk¬O¡u¤f¤Ñ¡v¡A¡u®T¡B»~¡vµ¥¦r¦P¨Ò¡C ¡u¥R¡v¦r¡A¥xÆW¤­¹º (¾î£ª)¡A­»´ä©M¤j³°¤»¹º (ÂI¾î£ª)¡C ¡u³o¡v¦r³¡­º¡A¥xÆW¥|¹º (ÂI¢²±Ì¡^¡A¤j³°¤T¹º (ÂI¢¶±Ì)¡C ¡u¥H¡v¦r¡A¥xÆW¤­¹º¡A¤j³°¥|¹º (³Ì¥ªÃ䪺¨â¹º³sµ§)¡C ¦w¸Ë chinese/arphicttf¡C ¥H¤Uªí®æ¦¡¾ã²z¹L«áªº¤å¹©¦rÅé³t¬dªí¡A ·|¦³¨â­Ó Font Family ¬O¦]¬°­^¤åªº¬O ªº¸ê°T¡A±`¥Î©ó gtk2 µ¥¦r«¬³]©w¡A ¤¤¤åªº«h¬O ªº¸ê°T¡A³q±`¬O utf8 ½s½X¡A±`¥Î©ó openoffice ªº¦r«¬³]©w¡A Font Family, Unique subfamily identification, Full name ªº¸ê°T³q±`³£·|¬Û¦P¡C ¤å¹©¦rÅé³t¬dªí ÀɦW PostScript name Font Family Font Family bkai00mp ZenKai-Medium AR PL KaitiM Big5 ¤å¹©¢Þ¢Ú¤¤·¢ bsmi00lp ShanHeiSun-Light AR PL Mingti2L Big5 ¤å¹©¢Þ¢Ú²Ó¤W®ü§º gkai00mp GBZenKai-Medium AR PL KaitiM GB ¤å¹©¢Þ¢Ú²¤¤·¢ gbsn00lp BousungEG-Light-GB AR PL SungtiL GB ¤å¹©¢Þ¢Ú²³ø§º
arphicttf snapshot
WWW: ¤å¹©¬ì§Þ
wangttf - ¤ýº~©v±Ð±Â TrueType ¦r«¬ wangttf ¥Ñ Dr. Hann-Tzong Wang ´£¨Ñªº¦r«¬¡A¥i¥H¬Ý¬Ý wangttf.txt ±o¨ì§ó¸Ô²Óªº¸ê°T¡A ¤£¹L¦w¸Ë°_¨Ó¦³ 80MB¡A©Ò¥H½Ð·r°u«á¦A¨Ï¥Î¡C Ä~ ¤å¹©¬ì§Þ ®½¥X¥|®M¦r§Î¤§«á¡A ¬ãµo¤ÑÅú¦r®wªº¤¤­ì¤j¾Ç¼Æ¾Ç¨t¤ýº~©v±Ð±Â¡A ¤]®½¥X¤Q®M¦r«¬¡Aµ¹ Linux ªÀ¸s¨Ï¥Î¡Cª©Åv±Ä¥Î GPL ÄÀ¥X¡C ¤ýº~©v±Ð±Â®½¥X¤F¥H¤U¤QºØ¦r«¬¡G ¤ýº~©v·s¼éÅé--ªi®ö¡B ¤ýº~©v¯S©úÅé--¼Ð·Ç¡B ¤ýº~©vªi¥dÅé--ªÅ³±¡B ¤ýº~©vºîÃÀÅé--ÂùªÅ³±¡B ¤ýº~©v¼Ð·¢Åé--ªÅ¤ß¡B ¤ýº~©v¥é§ºÅé--¼Ð·Ç¡B ¤ýº~©v²Ê¿ûÅé--¼Ð·Ç¡B ¤ýº~©v²Ê¶ÂÅé--¹ê³±¡B ¤ýº~©v²Ê¶êÅé--ÂùªÅ¡B ¤ýº~©v®ü³øÅé--¥b¤Ñ¤ô¡C ¦w¸Ë chinese/wangttf¡C
wangttf snapshot
ntuttf - ¥x¤j¦r«¬ Date: Thu, 17 Mar 94 14:18:18 CST From: Lin YawJen <f1506015@csman.csie.ntu.edu.tw> HISTORY: I had written a program to convert fonts from large bitmap into TrueTypefor MS-Windows. For Mac, see ifcss.org:/software/fonts/mac/ the bitmaps came from DYNAFONT (Hua2 Kang1) and ETen.. This is the critical point of this product. Font styles includes: kai: ·¢®Ñ br: ²Ê¶ê fs_m: ¥é§º±`¥Î li_m:Áõ®Ñ±`¥Î mb: ¤¤¶Â mm:¤¤©ú mr:¤¤¶ê tw: ·¥²Ó COPYRIGHT: These fonts are created by Mr. Lin Yaw-JenAll Right reserved. These fonts must not be used for any commercial activities. Lab of OA Network Home: 4F, No. 12-2 Alley 2 Lane 250 Sec 5 Nanking East Rd. Department of Computer Science and Information Engineering Taipei Taiwan R.O.C National Taiwan University Tel: 886-2-7641236 Taipei Taiwan R.O.C Fax: 886-2-760184 Email: f1506015@csman.csie.ntu.edu.tw ¦w¸Ë chinese/ntuttf¡C
ntuttf snapshot
WWW: ntu ctlg
oto - Open Type Organizer µ{¦¡ Joe Man post ¨ì zh-l10n ªº¤å³¹¤¤¸`¿ý³¡¤À¦p¤U: Open Type Organizer(oto) ³o­Ó¤p¤pµ{¦¡µw¬O­n±o¡I ¥¦¥i¥H±N­ì¥»¥u¦³ big5 ©Î gb ½s½Xªº TrueType ¦r¦A¥[¤J¤@­Ó unicode ½s½X¡A¦ýµ´¹ï¤£·|ÅͶí쥻ªº¦r«¬¡C[big5 ³¡¥÷¬O¥Ñ§Ú­×¥¿ªº¡A ½Ð¤j®aÀ°¦£´ú¸Õ :)] ³o­Ó¤è®×ÁÙ¦³¤@­Ó¦n³B... ¦] OpenOffice ¥u»{ Unicode ½s½Xªº TrueType ¦r¡A¤Þ¦Ü«Ü¦h Big5 ½s½Xªº¦r¤£¯à¥Î¡C ²{¦b¥u­n±NÂàÅܫ᪺¦r§Û¨ì OpenOffice ¤Uªº share/fonts/truetype/ ´N¥i¥H¥Î¤F¡C¦n¡I §Ú¤w¸g´ú¸Õ¤F´X­Ó¤ýº~©v±Ð±Âªº¦r«¬¡A (½T«Yè°)¡I---¼sªF¸Ü :) ¦w¸Ë chinese/oto¡C wangttf ªº¦r«¬¥u¦³ Big5 ½s½X¡A©Ò¥H§Ú­ÌÀ°¦o¥[¤W Unicode ½s½X¡C &prompt.root; oto wcl-01.ttf wcl-01-unicode.ttf &prompt.root; ttfinfo wcl-01.ttf TTFINFO_FONT_FILE="wcl-01.ttf" TTFINFO_FONT_NAME="unknown" TTFINFO_FONT_PSNAME="unknown" TTFINFO_FOUNDRY_NAME="misc" TTFINFO_WEIGHT_NAME="medium" TTFINFO_WIDTH="normal" TTFINFO_NUMCMAP="1" TTFINFO_CMAP0="3,4" TTFINFO_CMAPNAME0="Windows,Big 5" TTFINFO_MAPNUM="1" TTFINFO_FONTMAP1="-misc-unknown-medium-r-normal--0-0-0-0-c-0-big5-0" &prompt.root; ttfinfo wcl-01-unicode.ttf TTFINFO_FONT_FILE="wcl-01-2.ttf" TTFINFO_FONT_NAME="unknown" TTFINFO_FONT_PSNAME="unknown" TTFINFO_FOUNDRY_NAME="misc" TTFINFO_WEIGHT_NAME="medium" TTFINFO_WIDTH="normal" TTFINFO_NUMCMAP="2" TTFINFO_CMAP0="3,1" TTFINFO_CMAPNAME0="Windows,Unicode" TTFINFO_CMAP1="3,4" TTFINFO_CMAPNAME1="Windows,Big 5" TTFINFO_MAPNUM="1" TTFINFO_FONTMAP1="-misc-unknown-medium-r-normal--0-0-0-0-c-0-big5-0" oto ¥t¥~¤@­Ó¦n¥Îªº¥\¯à´N¬O¯à­×§ï¦r«¬ªºÄÝ©Ê¡G &prompt.user; oto NTU_KAI.TTF > test &prompt.user; iconv -f utf-8 -t big5 test > test.big5 &prompt.user; vi test.big5 &prompt.user; iconv -f big5 -t utf-8 test.big5 > test.utf-8 &prompt.user; oto NTU_KAI.TTF ntu-kai-new.ttf --names test.utf-8 ½s¿è test.big5 §â §ï¦¨±z·Q­nÅã¥Üªº¦r¡A¨Ï¥Î iconv ¥i¯à­nª`·N¨Ã«D¾ã­ÓÀɳ£¬O utf-8 ½s½Xªº¡A ¤j·§§â Unicode ¨º¨Ç°Ï¬q¦Û¤v§ä¥X¨ÓÂন big5 ½s¿è«á¦A¼g¦^¥h¡A ³Ì«á¦A·f°t --names ¨Ó§âÄݩʧﱼ¡C ¥H¤U¬O Edward G.J. Lee¡]§õªG¥¿¡^ ©Ò°^Ämªº¡C Pfaedit ¤]¬O¥i¥H­×§ï¦r«¬ªºÄÝ©Ê #!/usr/bin/env pfaedit # Reencoding a font to Unicode TTF. # By Edward G.J. Lee, this code is public domain. # $1: your TTF name. if ($argc != 2) Print("usage: ", $0, " your.tt[fc]") Quit(1) endif Print("Loading ", $1, "...") Open($1) SetFontNames("myfont","myfont","myfont") Reencode("iso10646-1") ClearHints() Print("Generating fonts...") Generate($1 + ".ttf") Close() Quit(0) chmod +x unifont.pe ´N¥i¥H°õ¦æ¤F(Unix-like ¨t²Î/Àô¹Ò)¡C³o­Ó script ·|§â¤£¬O Unicode ªº TTF Âন Unicode TTF¡C¨ä¤¤ ps name ªº³¡¥÷½Ð¦Û ¦æ§ó§ï¡A§Ú³o¸Ì¬O¨Ï¥Î myfont¡C ./unifont.pe your.ttf ´N¥i¥H¤F¡A·|²£¥Í your.ttf.ttf¡A¦A¦Û¦æ§ó§ïÀɦW¡C WWW: oto project
diff --git a/zh_TW.Big5/books/zh-tut/chapters/stepbystep.sgml b/zh_TW.Big5/books/zh-tut/chapters/stepbystep.sgml index e086bb2877..e435a6ffd4 100644 --- a/zh_TW.Big5/books/zh-tut/chapters/stepbystep.sgml +++ b/zh_TW.Big5/books/zh-tut/chapters/stepbystep.sgml @@ -1,318 +1,313 @@ ¥H FreeBSD «Ø¥ß¤¤¤å Desktop ªº¦w¸Ë«ü«n ¥H¤U¬Oµ§ªÌ¦Û¤v¦b¦w¸Ë FreeBSD ®Éªº§@ªk¡A ¨Ã¤£·|¾A¦X©Ò¦³¤H¡C ¦b«Ø¥ß¤¤¤å Desktop «e¡A½Ð¥ý°Ñ¦Ò Installing FreeBSD ¦w¸Ë¦n°ò¥»ªº FreeBSD Àô¹Ò¡A ¨Ã³]©w¦nºô¸ô¥d¡C ¤@¯ë¨Ï¥ÎªÌªº»Ý¨D¬O­n¯à°÷¦b X Window ¤U¨Ï¥Î¤¤¤åÀô¹Ò¡A ©Ò¥H¤U­±´N¬O«Ø¥ß°ò¥»¤¤¤åÀô¹Òªº°µªk¡C ·í«ö·Ó¤U­±ªº¤¤¤åÀô¹Ò³]©w¦n«á¡A´N¥i¥H¨Ï¥Î startx ¶}±Ò GNOME ¬ü¤Æ¹L«áªº X Window¡A¨Ã¨Ï¥Î·Æ¹«¥kÁä¶}±Ò¿ï³æ¡A¥ý°õ¦æ xcin2.5 & «á¡A¦A°õ¦æ gnome-terminal¡A³o¼Ë¤l§Y¥i¦b gnome-terminal ¤W¶i¦æ°ò¥»ªº¤¤¤åÅã¥Ü»P¿é¤J¡A ³o¹ï¦b X Window ©³¤U¨Ï¥Î Console ³nÅé¤w¸g¤Q¤À¨¬°÷¡C »´ÃP¦w¸ËFreeBSD¤¤¤å®à­± ¦pªGºô¸ôÁÙºâ§Ö¡A FreeBSD ®à­±¨t²Îªº¦w¸Ë¬O¥i¥H¦b¤T¤Q¤ÀÄÁ¤º§¹¦¨ªº¡C ¦b³o­Ó³¡¤À¥H package ¦w¸Ëªº¤è¦¡¨Ó¶i¦æ¡A ³o¼Ë¤l¥i¥H§Ö³tªº¨Ï¥Î FreeBSD¡C ¦b¦w¸Ë§¹ FreeBSD «á¡A¨t²Î¤WÀ³¸Ó¨S¦³³\¦h¤è«Kªº®M¥ó¡A ¦Ó´Nºâ¬O¥úºÐ¤W¦³¤@¨Ç¡A¤j³¡¤Àªºª¬ªp¤´µM¤£¼Å¨Ï¥Î¡A ¯S§O¬O¥»¦a¤Æªº®M¥ó¤£·|©ñ¦b²Ä¤@¤ù¥úºÐ¤¤¡C ÁöµM¦³²Ä¤T¤ù»P²Ä¥|¤ù¥úºÐ¤º§t³\¦h¡A¦ý®É±`·|¨S¥]§t§Ú­Ì­n¥Îªº¡A ²¦³º²{¦bªº®M¥ó¤w¸g¤Ó¦h¡AªÅ¶¡¤£¨¬®e¯Ç¡C ¦ý¬O¥Ø«e¦U¤j¾Ç³£¦³ mirror §¹¾ãªº packages¡A ³o¹ï§Ú­Ì¦Ó¨¥¬O­Ó«D±`¦³§Qªº¡A¥u­nª¾¹D­þ­Ó¯¸Â÷§A³Ì§Ö¡A «Ü§Öªº´N¯à«Ø¥ß·sªº FreeBSD Àô¹Ò¡C §A¥i¥H¥ý³]©w ¡A³o¬O¥Î¨Ó§ì¨ú®M¥óªº¦ì¸m¡A µ§ªÌ³q±`³]©w setenv PACKAGEROOT ftp://ftp.tw.freebsd.org¡A ¦]¬°³o¬O§Ú»{¬°³Ìí©wªº¾÷¾¹¡AµM«á´N¥i¥H³z¹L pkg_add -r ®M¥ó¦W ¨Ó¦w¸Ë®M¥ó¡A¥L·|¦Û°Êªº¨ì pub/FreeBSD/ports/i386/packages-4.9-release/Latest/ ©³¤U´M§ä®M¥ó¡A¦Ó¥B§A¤£»Ý­nª¾¹Dª©¥»¡A¥u­nª¾¹D®M¥ó¦WºÙ§Y¥i¡A ¥L·|¦Û°Ê¦w¸Ë·í®Éªº³Ì·sª©¡A¤¤¤åªº³¡¤À¥u­n¥[¤W ¡A ¹³¬O zh-xcin¡C ¦pªG­nÅý sysutils/portupgrade ¯à°÷¨Ï¥Î¡A«h­n¦b pkgtools.conf ¸Ì­±¥[¤W ¡A ¨Ã¦b¨Ï¥Î portupgrade ®É¥[¤W ©Î¬O ¨Ó§Q¥Î packages ¦w¸Ë¡C ³]©w ¡C &prompt.root; setenv PACKAGEROOT ftp://ftp.tw.freebsd.org ¦b¤j³°³]©w¬° ¡C ½Õ¾ã®É°Ï¡A¨Ã¹ï®É¡C &prompt.root; tzsetup /usr/share/zoneinfo/Asia/Taipei &prompt.root; ntpdate time.stdtime.gov.tw ½Ð°Ñ¦Ò ®É°Ïªº³]©w ¤@¸`¡C ¦w¸Ë x11/XFree86-4 »P x11/wrapper¡C &prompt.root; pkg_add -r XFree86 &prompt.root; pkg_add -r wrapper ½Ð°Ñ¦Ò ¤¤¤å X Window ¤@¸`³]©w XF86Config¡C ¦w¸Ë x11/gnome2 Window Manager¡C &prompt.root; pkg_add -r gnome2 ³]©w¨Ï¥Î startx ®É±Ò°Ê¡G &prompt.root; echo exec gnome-session > ~/.xinitrc ¤§«á´N¥i¥H¥Î startx ¨Ó±Ò°Ê X ¤F¡C &prompt.root; startx ¶i¥h X «á§â¦rÅé§ï¦¨§Ú­nªº¡G ¡A ¡A ¡A ¡C ½Ð°Ñ¦Ò GNOME ªº¤¤¤å¤Æ ¤@¸`¡C ¦w¸Ë chinese/arphicttf ¤å¹©Ác²¤¤¤å¦r«¬¡C &prompt.root; pkg_add -r zh-arphicttf ±µµÛ½s¿è /etc/XF86Config¡A ¦b °Ï¬q¡A ¥[¤J ¡C Section "Module" : Load "xtt" EndSection ¦b °Ï¬q¡A ¥[¤J »P ¡C Section "Files" : FontPath "/usr/X11R6/lib/X11/fonts/TrueType/" FontPath "/usr/X11R6/lib/X11/fonts/local/" EndSection ½Ð°Ñ¦Ò ¿é¥X¦r«¬ ¤@¸`¡C ¦w¸Ë chinese/auto-tw-l10n¡C &prompt.root; pkg_add -r zh-auto-tw-l10n ¦w¸Ë§¹¡A¦b /usr/local/share/skel/zh_TW.Big5/ ¥Ø¿ý©³¤U·|¦³³\¦hªº°Ñ¦Ò³]©w¡C²Å餤¤å½Ð¥t¥~³]©w¡C &prompt.root; cat /usr/local/share/skel/zh_TW.Big5/dot.cshrc >> ~/.cshrc &prompt.root; cat /usr/local/share/skel/zh_TW.Big5/dot.Xdefaults >> ~/.Xdefaults &prompt.root; cat /usr/local/share/skel/zh_TW.Big5/dot.gtkrc >> ~/.gtkrc.mine ½Ð°Ñ¦Ò ¤¤¤å locale ªº³]©w ¤@¸`¡C ¤¤¤åÁcÅé¿é¤J¦w¸Ë xcin25¡A ²Å餤¤å¿é¤J¥i¥H¦w¸Ë fcitx¡C &prompt.root; pkg_add -r zh-xcin &prompt.root; pkg_add -r zh-fcitx ±µµÛ½s¿è ~/.cshrc¡A ¥[¤J ©Î¬O ¡A Åý¤j³¡¥÷³nÅé³£¥i¥Hª¾¹D±z¦³¦w¸Ë¤F XIM¡C ¨Ã¥B§Ú·|­×§ï xcinrc ªº³¡¥÷³]©w¡A ¥ý chmod 644 /usr/X11R6/etc/xcin «á¡A ­×§ï¨ä¤º®e¡A§â §ï¦¨ ¡A¨Ã¥B§â¹w³]ªº¦r«¬¤j¤p 24 §ï¦¨ 16¡C ½Ð°Ñ¦Ò ¤¤¤åªºÅã¥Ü»P¿é¤J ¤@¸`¡C ÂsÄý¾¹´N¸Ë www/mozilla-gtk2¡C ¦pªG¦w¸Ë GNOME2 ¨º»ò³o­Ó¤]¬O¹w³]·|¦w¸Ëªº¤@³¡¤À¡C¶}±Ò«á¨Ó§ï¦r«¬¡G ¡A ¡A ¡A ¡A ¡A ¡A ¡A ¡C ¨Ã¥B¨ì http://themes.mozdev.org/ ¤U¸ü ORbit 3+1 ¡A http://themes.mozdev.org/themes/orbit.html ªººô­¶¤¤¡A ¥i¥H¿ï¾Ü¦w¸Ë¼Ò¦¡©Î¬OÀÉ®×¼Ò¦¡¡A¦w¸Ë¼Ò¦¡´N¬O¦b Mozilla©³¤UÂI¿ï´N¥i¥H¦w¸Ë¡A ÀÉ®×¼Ò¦¡¥i¥H¦Û¦æ¤U¸ü«á¡A¦b³z¹L Mozilla ªº¥\¯à¨Ó¶×¤J¡C ½Ð°Ñ¦Ò Mozilla ÁcÅ餤¤å»y¨¥¥] ¤@¸`¡C ÁöµM¹w³]ªº ls ¯à¬Ý¨ì¤¤¤å©M±m¦â¡A¤£¹L§ÚÁÙ¬O°¾¦n¨Ï¥Î misc/gnuls¡C &prompt.root; pkg_add -r gnuls ¦w¸Ë§¹«á¡A¦b ~/.cshrc ¼W¥[¤@¦æ ¡A Åý gnuls ªºÃC¦â©M¤¤¤å¥\¯à±Ò°Ê¡C ½Ð°Ñ¦Ò gnuls - ¯S®í¤¤¤åÀɦW©M¥Ø¿ýªºÅã¥Ü ¤@¸`¡C ·í»Ý­n»·ºÝ telnet ¿é¤J¤¤¤å®É¡A´N·|»Ý­n chinese/telnet ³o¼Ë¤lªº³nÅé¡C &prompt.root; pkg_add -r zh-telnet µM«á¦b ~/.cshrc ¸Ì­±¥[¤W ¡C ½Ð°Ñ¦Ò telnet ªº¤¤¤å°ÝÃD ¤@¸`¡C MP3 ¼·©ñ¾¹´N¥Î chinese/xmms¡A ¤¤¤åªº¦±¦W³£¥i¥H¬Ý¨ì¡C &prompt.root; pkg_add -r zh-xmms ½Ð°Ñ¦Ò xmms - mp3 ¼½©ñ¾¹ ¤@¸`¡C Media Player¡A¤ä´© vcd dvd DivX¡A¦w¸Ë multimedia/mplayer¡A ¤¤¤å¦r¹õ³£¤ä´©¡C &prompt.root; pkg_add -r mplayer ½Ð°Ñ¦Ò mplayer ¤@¸`¡C PDF Reader ¦w¸Ë chinese/xpdf¡A ³]©w¤@¤U¤¤¤å¨ú¥N¦r«¬¡A´N¥i¥H¬Ý¨ì¤j³¡¤Àªº¤¤¤å PDF¡C &prompt.root; pkg_add -r zh-xpdf ½Ð°Ñ¦Ò ¤¤¤å PDF ªºÅã¥Ü ¤@¸`¡C §Ú±`¥Îªº¦³ FTP Client ¦³ fetch¡A ftp/wget¡A ftp/ncftp3¡A ftp/IglooFTP¡A «e¤T­Ó¬O¤å¦r¤¶­±¨Ï¥Îªº¡A³Ì«á¤@­Ó¦b X ©³¤U¡A¥H¤U¬O¦w¸Ë¡G &prompt.root; pkg_add -r wget &prompt.root; pkg_add -r ncftp3 &prompt.root; pkg_add -r IglooFTP ¥Ñ©ó wget ªº¤¤¤å¦³ÂI°ÝÃD¡A ©Ò¥H¥Ø«e³£¥Î outta-port ¦b¦w¸Ë¡C MSN Messeger §Ú¨Ï¥Î net/gaim ¨Ó·í§@§ÚºD¥Îªº MSN Messenger¡C &prompt.root; pkg_add -r gaim ½Ð°Ñ¦Ò gaim - ICQ, MSN clone ¤@¸`¡C ¨Ï¥Î¨ä¥L¦r«¬§@¬°¹w³]¦r«¬ Last Update: 2003¦~ 1¤ë25¤é ©P¤» 12®É54¤À03¬í CST ¤£±o¤£©Ó»{²{¦bªº¤å¹©¦r«¬¤£¦p²Ó©úÅé¡A ¥D¦]¬O¨t©úÅ骺¤º´O¤p¦r¬Ý°_¨Ó¯uªºµÎªA«Ü¦h¡A ¥H¤U¤¶²Ð±N¹w³]¦r«¬³]©w¦¨²Ó©úÅ骺¤è¦¡¡C ­º¥ý­n¦³ mingliu.ttc¡A ±N¸Ó¦r«¬«þ¨©¨ì /usr/local/share/fonts/TrueType/ ¤U¡AµM«á¥Î ttfm ¦w¸Ë¸Ó¦r«¬¡G &prompt.root; ttfm.sh --add xttfm /usr/local/share/fonts/TrueType/mingliu.ttc &prompt.root; fc-cache -f -v /usr/X11R6/lib/X11/fonts/TrueType/ ±µµÛ¬O®Ú¾Ú¨C­Ó³nÅé¨Ó­×§ï¡A¦b gtk1 ¨t¦Cªº³nÅé¡A¥i¥H­×§ï ~/.gtkrc¡A ¦b­^¤å¦r«¬«á¡A²Ä¤@­Ó¥[¤W ´N¥i¥H¤F¡C gtk2 ¨t¦Cªº§ï ~/.fonts.conf¡C <alias> <family>serif</family> <prefer> <family>Bitstream Vera Serif</family> <family>PMingLiU</family> </prefer> </alias> <alias> <family>sans-serif</family> <prefer> <family>Bitstream Vera Sans</family> <family>PMingLiU</family> </prefer> </alias> <alias> <family>monospace</family> <prefer> <family>Bitstream Vera Sans Mono</family> <family>PMingLiU</family> </prefer> </alias> WindowMaker «h¬O­×§ï ~/GNUstep/Defaults/WindowMaker¡A §â©Ò¦³¥]§t Font ªº³]©w¥[¤W ¡A³oÃ䪺 16 ­n®Ú¾Ú«e­± Font ªº¦r«¬¤j¤p³]©w¡A³]©w§¹«á¡A ­«¶} X ´N¥i¥H¤F¡C Mozilla-gtk2 ­×§ï¦r«¬¥i¥H¶i¤J¿ï³æ«á­×§ï¡A Edit -> Preference -> Appearance -> Fonts¡A ¿ï¾Ü ¡AµM«á§â¦r«¬³£¿ï¾Ü¦¨ ´N¥i¥H¤F¡C xpdf «h¬O­×§ï /usr/X11R6/etc/xpdfrc¡A ´N¥i¥H¤F¡C «O«ù³Ì·sªº Ports Tree - Last Update: 2003¦~ 1¤ë27¤é ©P¤@ 04®É50¤À10¬í CST + Last Update: 2006¦~ 3¤ë13¤é ©P¤@ 01®É47¤À34¬í CST Contributed by &a.gslin; ¦b¦w¸Ë³nÅé«e¡A³Ì¦n¥ý§ó·s Ports Tree¡A «Øij¥ý¥Ñ¦w¸Ë¥úºÐ¤¤¿ï¾Ü Ports Collection ¥ý¦w¸Ë¦n«á¡A ¦A¨Ó§ó·s Ports Tree¡A³o¼Ë¤l§ó·sªº®É¶¡·|¤ñ¸ûµu¡C ±µµÛ³]©w¦n /etc/make.conf (­Y¨S¦³«h¦Û¦æ«Ø¥ß)¡C SUP_UPDATE= yes SUP= /usr/local/bin/cvsup SUPFLAGS= -g -L 2 # # SUPHOST ¥Nªí­n¨ì­þ¥x CVSup¡A½Ð§ï¦¨Â÷±z¤ñ¸ûªñªº Server¡C -# cvsup[1-9].tw.FreeBSD.org +# cvsup[1-13].tw.FreeBSD.org SUPHOST= cvsup.tw.FreeBSD.org + # -# ¦pªG±z¬O¥Î -stable¡A½Ð¥Î stable-supfile (¥Ø«eªº -stable ¬O 4.3) -# ¦pªG±z¬O¥Î -current¡A½Ð¥Î standard-supfile (¥Ø«eªº -current ¬O 5.0) +# ¦pªG±z¬O¥Î -STABLE¡A½Ð¥Î stable-supfile (¥Ø«eªº 4.X -STABLE ¬O 4.11¡A5.X -STABLE ¬O 5.4¡A6.X -STABLE ¬O 6.0) +# ¦pªG±z¬O¥Î -CURRENT¡A½Ð¥Î standard-supfile (¥Ø«eªº -CURRENT ¬O 7.0) SUPFILE= /usr/share/examples/cvsup/stable-supfile PORTSSUPFILE= /usr/share/examples/cvsup/ports-supfile DOCSUPFILE= /usr/share/examples/cvsup/doc-supfile + # °ê¤º¥D­nªº FreeBSD distfiles mirror ¯¸¥x MASTER_SITE_BACKUP?= \ - ftp://ftp.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\ - ftp://ftp2.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\ - ftp://ftp3.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\ - ftp://ftp4.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\ - ftp://ftp5.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\ - ftp://ftp7.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\ - ftp://ftp8.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\ - ftp://ftp9.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/ + ftp://cvsup.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\ + ftp://cvsup10.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\ + ftp://cvsup13.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\ + ftp://cvsup2.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/ MASTER_SITE_OVERRIDE?= ${MASTER_SITE_BACKUP} ¥i¥H¦w¸Ë sysutils/fastest_cvsup - ¨ÓÀ˹¤@­Ó cvsup ³Ì¾A¦X±z¡A¦w¸Ë§¹«á­×§ï - /usr/local/bin/fastest_cvsup¡A - §â¥xÆWªº­Ó¼Æ §ï¦¨ - ¡A - µM«á°õ¦æ fastest_cvsup -c tw¡C + ¨ÓÀ˹¤@­Ó cvsup ³Ì¾A¦X±z¡A¦w¸Ë§¹«á°õ¦æ fastest_cvsup -c tw¡C + ¦w¸Ë¦n°ò¥»ªº Ports Tree «á¡A¦w¸Ë net/cvsup-without-gui¡C ±µµÛ´N¥i¥H¶i¦æ§ó·s¤F¡G &prompt.root; cd /usr/ports &prompt.root; make update WWW: ¦p¦ó¥Î CVSup ¥h§ó·s±zªº source ¥H¤Î ports diff --git a/zh_TW.Big5/books/zh-tut/freebsd.dsl b/zh_TW.Big5/books/zh-tut/freebsd.dsl index e8c608aa91..52d3a442b9 100644 --- a/zh_TW.Big5/books/zh-tut/freebsd.dsl +++ b/zh_TW.Big5/books/zh-tut/freebsd.dsl @@ -1,24 +1,24 @@ + ]> (define %html-header-tags% '(("META" ("HTTP-EQUIV" "Content-Type") ("CONTENT" "text/html; charset=Big5"))))