[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From 2.0 to current in 22 steps



Someone (Theo?) recently said that updating from a 2.0 to current was
a bitch.  That sounded enough like a challenge that I thought I'd try
it -- and document what I had to do at the same time.  Hope this is
helpful to others.

Given:
 o System running 2.0 code
 o -current source tree mounted as /usr/src.  My -current source lives on a
   different host, so it happens to be NFS mounted.  This code was current
   as of 1 May.
 o An empty /usr/obj on the local disk.

Variables:

 * $arch=i386, the architecture I'm generating the code for
 * $config=TRAVEL, my configuration file.  This is a copy of ALL with
   everything I don't use commented out and a few minor changes.  Travel
   is a Toshiba laptop and I wanted the PCMCIA modem to be com1 and the
   PCMCIA ethernet card to be either ed0 or ep0, depending upon which
   flavor or card I happen to be using.

Ok, here are the steps.  Disclaimer mode:
 - Some may not be necessary.
 - There may be necessary steps that I missed and just luckely
   have not run into problems yet.
 - The order that I did things may be wrong.
 - Etc.   
[ FAQ assembler's note: This mailing was hearlded by some as a masterpiece
rivaling the Magna Carta :) ]

 [ 1] cd /usr/src/share/mk && make install
      use the new make for everything

 [ 2] cd /usr/src/includes && make includes
      use the new included for everything

 [ 3] cd /usr/src/bin/pdksh && make && make install && make clean
      This is installed as /bin/sh which is needed for the next step.
      The 2.0 /bin/sh does not work with making the object links.
      The `make clean' step is to get the $arch specific objects
      out of the source directory.

 [ 4] cd /usr/src && make obj
      make the obj links so that code is generated on the local disk,
      not the NFS mounted source disk.  (Note: the kernel is still
      generated in /sys/arch/$arch/compile/$config).

 [ 5] cd /usr/src/usr.bin/mktemp && make && make install
      mktemp is required to generate a kernel

 [ 6] cd /usr/src/usr.sbin/config && make depend && make && make install
      The latest config MUST be used to generate the new kernel.  If you
      don't use this config you won't get past the "make depend" step
      of kernel generation.

 [ 7] cd /sys/arch/$arch/conf
      edit your $config file if necessary.

 [ 8] config $config
      generate required files to build updated kernel.

 [ 9] cd ../compile/$config && make clean && make depend && make
      Don't forget the make clean.  It may not be necessary, but doesn't
      hurt in any case.  The new config may have even warned you to do
      this.

 [10] mv /bsd /bsd- && mv bsd /
      Get ready...

 [11] reboot
      Reboot your box and watch the console to see what's going on.  In
      my case all went well.  Xdm started and gave me my console login.
      I ssh'd from another host, su'd, and then re-mounted the current
      source on /usr/src.  uname -a says:

	OpenBSD travel.codewright.com 2.1 TRAVEL#0 i386

 [12] cd /usr/src && make cleandir
      We start with this step of the build process because the 
      /usr/src/share/mk and the include files were installed above.

 [13] cd /usr/src/usr.bin/compile_et && make depend && make && make install
      this tool is required to build the libraries.

 [14] cd /usr/src/usr.bin/mk_cmds && make depend && make && make install
      this tool is required to build the libraries

 [15] cd /usr/src/lib && make depend && make && make install
      Go and have dinner then see a movie.  This should be done
      just about the time you get back to the console.  At least
      that's how long it takes on my old pentium portable.

 [16] cd /usr/src/gnu/usr.bin/ld && make depend && make && make install
      needed for the gnu libraries (libg++ will fail)

 [17] cd /usr/src/gnu/lib && make depend && make && make install

 [18] cd /usr/src/kerberosIV && make build

 [19] cd /usr/src/gnu/usr.bin/texinfo && \
      make -f Makefile.bsd-wrapper && \
      make -f Makefile.bsd-wrapper install
      The updated makeinfo is required by gcc which is generated
      before makeinfo when doing a standard `make'

 [20] cd /usr/src && make depend && make && make install

 [21] reboot
      See that everything comes up.  If your source lives on a
      remote machine (like mine does), mount it on /usr/src.

 [22] cd /usr/src && make build
      This step is optional.  I like to use the generated system to
      regenerate the full system just to ensure that all is OK.
      Probably best to start this before you go to bed.  It might
      be done by the time you wake up.

As I type this I've completed steps 1-21.  Step 22 is in progress.  I'll
mail out an update if I run into any problems.  Again, I hope this is
helpful to others.

// marc

There you have it!

6) Why can't I use my old linux ifconfig commands and flags?

Linux's implementations of "ifconfig" and "route" are not standard.
OpenBSD's versions are normal. To get my ne2000 clone working, I type:

corinne# ifconfig ed2 205.212.82.80 up
corinne# route add default 205.212.82.1

That should work to get ANY ethernet interface working, as long as you
specify the correct IP numbers and interface.

6.1) Whenever I do anything to the network I get a "device timeout"
	error!?!

This is because you have an incorrect hardware or irq address assigned to
your ethernet interface. To fix this, reboot the machine with the "-c"
flag and change the attributes for your ethernet interface. See the
general instructions in item 1 of this FAQ on how to change how the
kernel talks to your hardware.

6.2) Hey, my IP Aliasing breaks after trying to add a third host!

Aliasing one additional host usually isn't a big deal. When a user tries
to alias a third or fourth host, sometimes things break. Adding 
"netmask 0xffffffff" to the end of your "ifconfig" for adding the aliased
host solves the problem. i.e.:

sparcy# ifconfig le0 alias 123.45.67.89 netmask 0xffffffff

6.3) How do I view the hosts that I've aliased?

If you are using the 2.1 release, you must use netstat to see what
IP numbers you have added to your interface. In "current" (post
June 17, 1997) source, "ifconfig -a" will show your aliases. 

7) Why won't XFree86 load on my (insert really cool/expensive, you
know-it-will-work-because-you-checked-it-on-the-compatability-list at
xfree86.org)  graphics card? 

Some of the X servers require direct access to "/dev/mem" (raw memory) 
in order to work. By default, the OpenBSD kernel does not allow for this.
There are two solutions:
	A) recompile a kernel with "option insecure" in your configuration
	   file.
	B) Use the "apature" Loadable Kernel Module (lkm) found in the X11
	   distribution.

In addition, the Matrox Millenium and possibly other cards may require BOTH
lkm be loaded as well as option insecure.

8) Where's pine (or other GNU/semi-free utility)?

All about ports (as cribbed from www.openbsd.org/ports.html)
  
OpenBSD is a fairly complete system of its own, but there still is a lot
of software that one might want see added to their own system.  However,
one has to draw the line on what to include and leave out, as well as
having to follow licensing and export restrictions laws.  Because of these
problems, some software cannot be shipped with the system. We wanted to
find a way for users to easily get software we don't provide and started
to look around. We didn't have to look far because a sibling project,
FreeBSD, has an excellent mechanism for exactly this purpose called "The
Ports Collection". After thinking about it for a while we decided to try
and use their collection as is, feeding back necessary patches that make
the ports work on OpenBSD as well as FreeBSD. 

The ports idea is to have, for each piece of software, a Makefile that
describes where to download it from, how to alter the sources (if needed)
and how to build and install it. Furthermore some patches will have to be
kept in the "port" as well as some administration files for the package
registry utilities. Normally this information is kept in an hierarchy
under /usr/ports (this is configurable, and can be changed). The entire
ports tree can be found at
	ftp://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current/ports.tar.gz

Note that this isn't a file on their server, rather it archives their
directories on-the-fly. The entire collection is almost 3.1M tarred and
gzip'd and will probably be twice that when uncompressed. The ports tree
is also on the 2.1 CD.

Let's say you managed to get a ports tree sitting under /usr/ports, then
you should be able to something like this:

	mitnick% su
	mitnick# cd /usr/ports/archivers/unzip
	mitnick# make
	mitnick# make install
	mitnick# exit

Easy, huh?

9) Where do I get my OpenBSD 2.1 CD?

To preface, because OpenBSD contains powerful crypto, CDs are being
distributed from Canda, Sweden, and Argentina. CDs cost $30 US plus
shipping ($3-$8 US, generally). The CDs are a two CD set, complete with
binaries for the Alpha, i386, Sparc, Amiga, Arc, Mac (68k), Pmax, and
Motorola 68k VME systems, source code, X11R6.3, XFree86 3.3 (binaries and
sources). In addition, The CDs are designed to be bootable on multiple
architectures.

http://www.openbsd.org/orders.html will take you through the credit card
on-line odering system. To order VIA phone, call +1 (403) 605-8166
between 8AM and 5PM North American Mountain Standard Time. Please
have your American Express, Master Card or Visa ready.

10) disklabel and fdisk

disklabel and fdisk are different in OpenBSD than what most users are used
to in different operating systems. 

In OpenBSD, disklabel is the core program used to modify and view a
system's hard disk. disklabel is used to establish the disk's partitions
as well as write the OpenBSD disklabel to disk. disklabel is also used to
display which partitions are which. By running disklabel with an argument
like "wd0" (think "disklabel wd0") the output will show not only what
partitions of the disk are used by OpenBSD, but also what partitions can be
used to access DOS partitions. Please note that disklabel is used by ALL
platforms that OpenBSD supports.

In all install procedures, disklabel is loaded up and the disk must be
partitioned. Disklabeling is done in 512-byte sectors, so have a calculator
ready :-)

A typical, finished disklabel looks like this:

----[start disklabel]-----

# /dev/rsd0c:
type: SCSI
disk: SCSI disk
label: ST41200N
flags:
bytes/sector: 512
sectors/track: 70
tracks/cylinder: 15
sectors/cylinder: 1050
cylinders: 1931
total sectors: 2031705
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0		# milliseconds
track-to-track seek: 0	# milliseconds
drivedata: 0 

8 partitions:
#        size   offset    fstype   [fsize bsize   cpg]
  a:   163840        0    4.2BSD     1024  8192    16 	# (Cyl.    0 - 156*)
  b:    92160   163840      swap                    	# (Cyl.  156*- 243*)
  c:  2031705        0    unused        0     0       	# (Cyl.    0 - 1934*)
  e:  1775705   256000    4.2BSD     1024  8192    16 	# (Cyl.  243*- 1934*)

-----[end disklabel]-----

This is the disklabel from my DEC Alpha's SCSI disk-- /dev/sd0. Letters
"a-e" are the different partitions on the disk. When the OpenBSD install
procedure fires up disklabel, it generates the top 20 lines of the label.
It's up to you (the person doing the install) to mete out the partitions
as necessary for your system. The example I give here is pretty generic.
Different systems will want to have different sized partitions for different
uses. 

To OpenBSD, there are a few special partition names that are reserved and have
a special purpose. Partition "a" is reserved for the root file system. 
Partition "b" is reserved for swap space. "c" is reserved as a way to access
the whole, raw disk. For compatibility reasons with other *BSD's on the i386
platform, some people choose not to use partition "d." In setting up my Alpha,
I left out partition d, with no great loss.

You don't have to be a math major to figure out how to proclaim space using
disklabel on your OpenBSD install. From the disklabel above, the root 
partition ("a") of the install above is roughly 80 Megabytes large. How 
does "163840" represent this?

Some of us may remember some dimensional analysis from chemistry. This is
much easier than finding Avagadro's number.....

	80 * 1024 * 1024 / 512 = 163840  
	M ->  K  ->  b -> b/s  = sectors

	(the long way)

Since for us, the conversion factor will always be the same, multiply
the amount of Megs that you want in a partition by "2048" and you'll
get the amount of sectors you need to allot.

	80 * 2048 = 163840

	(the easy way)

Now that we know how to size out our partitions, we need to know how 
to place them.

Back to our example:

#        size   offset    fstype   [fsize bsize   cpg]
  a:   163840        0    4.2BSD     1024  8192    16 	# (Cyl.    0 - 156*)
  b:    92160   163840      swap                    	# (Cyl.  156*- 243*)
  c:  2031705        0    unused        0     0       	# (Cyl.    0 - 1934*)
  e:  1775705   256000    4.2BSD     1024  8192    16 	# (Cyl.  243*- 1934*)

You'll notice the "offset" column. That tells the disklabel where it should
start the next partition. If you notice, the offset for the first partition 
is 0, and for the following partition it is the size of the previous partition.
This is because disklabel starts counting from 0 and not from 1. Remember,
partition "c" spans the entire disk, so it's offset is 0 and it's size is
the size of the disk in sectors.

The fstype column is used to write to the disklabel what kind of filesystem
should be on the disk. Notice for "b", the swap partition, it's filesystem
is declared as "swap" since OpenBSD uses unformatted disk space for swapping.
Also not that the "c" partition must not have a filesystem on it, otherwise
it will scrub the disk. Most importantly, OpenBSD uses the 4.2BSD ffs
filesystem. Partitions like the root partition and /usr, etc need to be
declared as "4.2BSD" in the disklabel!

fsize, bsize, and cpg

fsize is the minimum file size, a partial block that is allocated for
small files. fsize should be smaller than bsize.
bsize is the blocksize for a normal block of data on the partition.
cpg is the amount of cylinders per group, which is used for when some
low level programs do mappings and other low-level functions on a per-cylinder
basis. The defaults for this are 1024, 8192, and 16, respectively. This 
can be changed based on your needs. For more information, check the FFS
papers in /usr/share/doc/smm/03.fsck_ffs for starters.

FDISK....

Unlike Linux, DOS, or FreeBSD, OpenBSD's fdisk is not
full-screen/interactive. fdisk is used to manipulate partitions other than
OpenBSD partitions as well as the MBR on various hard disks. If you are
sharing a disk between DOS and OpenBSD, you can change which partition is
active with fdisk. fdisk can also be used to display the same partition
information as disklabel, although the format of the output is different.

11) XXYYZZ (system something) is broken!

The OpenBSD source tree is always evolving. The 2.1 release is wonderful
and stable; however since the release snapshots will be made with many
bugfixes every so often.  Make sure you are running the latest code before
giving up. See the OpenBSD ftp mirrors (as listed on the OpenBSD www
sites) as well as the CVS section on how to obtain the source. ALSO, watch
the misc@openbsd.org and announce@openbsd.org mailing lists for vital
information. As another resource with your problems, check the OpenBSD
mailing list archive, where it is quite possible that your question or
concern has already been addressed. PS: always "man (utility)" and
"apropos (problem)" because the answer you are looking for can lurk in the
documentation. 

970712 jkatz@openbsd.org

  -Jon	   College Sophomore   *   OpenBSD Enthusiast   *   T. Sax
  -  Founder and President, Corinne Posse * http://posse.cpio.org  - 
  jkatz@cpio.org   *   http://www.cpio.org   *   http://jon.katz.com
  "OpenBSD: high performance computing for high performance people."