(Answer) (Category) Linux on PowerPC FAQ-O-Matic : (Category) MkLinux :
How do I build a new kernel and a new vmlinux server from sources?
The following answer talks about the DR2.1 compilation process.
From MkLinux-setup:

> I'm interested in learning how to recompile the kernel, so I can apply the
> various patches people have come up with to increase stability and so on.
> The problem is that I'm not really sure how to begin.
> 
> What files specifically do I need to download.  My best guess is:
>     ftp://ftp.mklinux.apple.com/pub/DR3/mklinux_source/DR3.osfmk.src.tgz
> 
> and maybe:
>     ftp://ftp.mklinux.apple.com/pub/DR3/mklinux_source/DR3.osfmk.export.tgz

You'd only need one of those two sets of files.  There are two pieces to
MkLinux:  the Mach kernel (technically micro-kernel, hence Mk), and Linux
(a Mach application that is the front half of the operating system). 
[This is different that the typical 'PC' Linux in which Linux does not run
on top of Mach, but I digress]

DR3.osfmk.src.tgz has the source to the Mach Kernel.  If you have problems
or patches with drivers, etc, you'll need to rebuild this.

DR3.osfmk.export.tgz are the 'exported' files that the Mach kernel's build
exports to Mach applications.  Linux, being a Mach application, uses these
headers and libraries to talk (tech term) with the underlying Mach kernel
for services such as Disk I/O, process management, memory management, etc.

The mklinux.tgz is "Linux" itself (though you also need Mach to run
MkLinux).  This is the "Linux" part of the tree, which represents most of
the visible part of the OS (mail, X, login, etc). 

I think you'll also need the tools.tgz to build Mach itself.

For build instructions, download the appropriate file.  What's
appropriate?

  Build Mach Kernel - tools osfmk.src
  Build Linux only - osfmk.export mklinux
  Build Mach+Linux - tools osfmk.src mklinux

Justin Vallon <vallon@mindspring.com>

## NEXT ANSWER ###########################################################

You really are going to need almost all of the files in that directory. 
Here is what the archives contain:

DR3.osfmk.src.tgz         Mach Kernel sources
DR3.mklinux.src.tgz       vmlinux server sources
DR3.tools.tgz             contains mach interface generator and more
ode-bin.tgz               Open Development Environment make and more
DR3.osfmk.export.tgz      Mach interface exported to vmlinux

This last file (DR3.osfmk.export.tgz) contains code that is generated by
MIG (mach interface generator) each time you compile the Mach Kernel. 
If you are going to be recompiling the Mach Kernel, then there is no
need to download this.

The DR3.tools.tgz is absolutely necessary to patch and rebuild the mach
kernel, as is ode-bin.tgz.  The Mach build procedure relies on a
special version of make available in ode-bin.tgz.  GNU's make will not
work.  DR3.mklinux.src.tgz is, of course, the source for linux, and
DR3.osfmk.src.tgz is obviously the Open Software Foundation's
implementation of mach.

Once you have these unpacked (and it's best to put them in /usr/src)
you will find instructions on how to build everything in the DR3
directory.  If the instructions there are insufficient, let me know.
You may also want to purchase the PTF book.  It has a short chapter on
how to rebuild everthing.

A word of caution: 
- ------------------
Egcs-1.1 has serious difficulty building vmlinux.  The executable works,
but your build will stop frequently due to new warning messages in the
compiler.  Since the make process for linux specifies -Werror, every new
warning (no matter how trivial) is treated as an error and will stop the
build.  You will either have to compile a number of files by hand or
turn off -Werror.  Some of these new warnings are endemic to the design
of linux and cannot be easily fixed.

Fred Bacon <bacon@aerodyne.com>

## NEXT ANSWER ###########################################################

> I just basically need a short guide about how to set up the source
> directories, apply patches (without losing the originals), and compile.

Install everything in /usr/src.  The trees intermesh nicely.  Then, if
you're planning to build the Mach Kernel, copy the sandboxrc.template into
your home directory and name it .sandboxrc, then set the correct paths in
that file.  The linux server just takes a make.  For the Mach Kernel, read
the build instructions that come in one of the above tarballs.

"David A. Gatwood" <marsmail@globegate.utm.edu>
hollis@andrew.cmu.edu
> You recently sent an email to toe@unlinfo.unl.edu. UNLINFO > has been decommissioned, but as a courtesy, your email > was forwarded to the last known email address of the > account holder.
> The last known email address for this account holder is > toe@unlserve.unl.edu. This forwarding service will not be > provided forever. Please update your records to reflect > this new email address.
Christopher Zselexovski <kkz@MIMUW.EDU.PL>
 Philippe Laliberté
 
 
	Here is an exchange who went on the list (thank's guys...:)) about how
 to build a new kernel. It contains alot of good informations.
 
 
 
 
 
_________________
Date: Sun, 20 Apr 1997 18:35:52 -0500
From: toe@unlinfo.unl.edu (Takashi Oe)
Subject: Re: DR2.1.2 console colors still broken
 
Greg Dunn wrote:
> I'd be glad to look into this as soon as I get all the sources downloaded
> and installed, but it seems to me I remember this being referred to as a
> Mach bug rather than a Linux server bug. Is this true?  Anyone have a
> suggestion where the problem lies?  I suppose there's code marked for the
> new virtual console stuff, right?
 
I can't help you on this, but Nick or somebody should be able to point you
in the right direction.  If you get no response and need a place to start,
my suggestion is the part where the default color is set, namely,
/usr/src/DR2.1update2/mklinux/src/drivers/char/console.c
From there, you might eventually get to some Mach calls and on to Mach
Kernel sources.
 
> 
> I'm a little wary of wading right into this, as a couple of friends have
> tried reompiling the Mach kernel, and their comments lead me to believe
> that the documentation for recompiling Mach is very sketchy.  I know the
> MkLinux book leaves out the installation of several critical files, because
> both my friends stumbled on them.
 
I had a lot of troubles compiling Mach Kernel with much older updates like
121196.mklinux but never had a single trouble with the newer ones.
 
Just for your infomation, here is the steps I took with the DR2.1update1
and DR2.1update2.
 
0. Set up /usr/src directory so that your user account has a write
permission for the directory.  The reason for using an user account is that
the root account's default shell is /bin/sh not /bin/bash, and, in order to
work with the kernel sources smoothly, it's simpler to use /bin/bash which
is the default shell for a newly created user account under MkLinux.  I
know /bin/sh is just a sym-link to /bin/bash, but it makes a lot of
differences.
 
1. Download two source tar balls and tools tar ball.  You need ode-bin,
too, if you don't have one yet.  (Note: I never download those obj tar
balls, just because I think a lot of my initial problems were related to my
"misuse" of the obj files.)
 
2. As the user, install all sources and tools to /usr/src.  For example,
 
        $ tar zxpf /path_to_tar_balls/DR2.1update2.osfmk.src.tgz -C /usr/src
        $ tar zxpf /path_to_tar_balls/DR2.1update2.mklinux.src.tgz -C /usr/src
        $ tar zxpf /path_to_tar_balls/DR2.1update2.tools.tgz -C /usr/src
        $ tar zxpf /path_to_tar_balls/ode-bin.tgz -C /usr/src
 
3. Copy /usr/src/DR2.1update2/sandboxrc.template to your user's home
directory with the name, .sandboxrc.  For example as the user,
 
        $ cp /usr/src/DR2.1update2/sandboxrc.template ~/.sandboxrc
 
4. Edit your user's .bashrc to source the shell script
/usr/src/DR2.1update2/set_ode_path.sh.  For example, you should have a line
in your .bashrc like
 
        . /usr/src/DR2.1update2/set_ode_path.sh
 
5. Now, whenever you login as the user, you should be ready to work on
either Mach Kernel or Linux Server sources.  For example, when you want to
work on the Mach Kernel,
 
        $ workon -sb osfmk
 
Or, when you want to work on the Linux Server,
 
        $ cd /usr/src/DR2.1update2/mklinux/src
 
6. There is a simple script called build_world which will build Mach Kernel
for you, so to speak.  What I usually do is to copy the script to src
directory and edit that to reflect my own configuration.  There are two
steps I take to accomplish this.  For example,
 
        $ workon -sb osfmk  <-- I'm in Mach Kernel mode.
        $ cp /usr/src/DR2.1update2/build_world buildme  <-- I'm copying it
as buildme
        $ chmod 700 buildme  <-- Making it excutable.
        $ vi buildme  <-- I just change the line which says PRODUCTION to
MINE.  Also, you might uncomment the part which build default_pager for
DR2.1update2.
        $ cd mach_kernel/conf/POWERMAC  <-- I'm cd'ing to the directory
which has various configuration files.
        $ cp PRODUCTION MINE  <-- "MINE" is the name of the configuration I
always use.  You might give it a hard thought to the name of this because
this name appears every time you boot into MkLinux.
        $ vi MINE  <-- I just change the line which says PRODUCTION to MINE.
 
7. You can now edit or destroy any part of Mach Kernel or Linux Server
sources to your liking.  When you want to actually compile your version,
type buildme at /usr/src/DR2.1update2/osfmk/src for Mach Kernel.  After 20
minutes or so, you should be able to find your version of Mach Kernel as
/usr/src/DR2.1update2/osfmk/obj/powermac/mach_kernel/MINE/Mach_Kernel
 
Or, for Linux Server, type "make config", "make dep", "make" to get it to
compile and the compiled one is /usr/src/DR2.1update2/mklinux/src/vmlinux
 
8. When you are in doubt as to whether you are in Mach Kernel or Linux
mode, try the following:
 
        $ which make  <-- this tells you whether you are in Mach Kernel
mode or Linux Server mode.  It would be the usual "make", if you are in
Linux mode.
 
 
Hope this helps (at least to get you started),
 
Takashi Oe
University of Nebraska-Lincoln
 
toe@unlinfo.unl.edu
See http://www.mklinux.org/development/cvs.html for the latest information.
jdalbec@cboss.com
[Append to This Answer]
Previous: (Answer) Partitioning Jaz cartridges for MkLinux
Next: (Answer) How do I run a second vmlinux?
This document is: http://www.jonh.net/cgi-bin/lppcfom/fom?file=137
[Search] [Appearance]
This is a Faq-O-Matic 2.717d.
Hosted by anduin.org and SourceForge Logo