[ Create account | Log-in ]
Main Menu

Friends
News sites
· MacSlash (en)
· osnews (en)
· ppcnux (de)
· tevac (it)
· penguinppc (en)
· macbytes (en)
· linux op je mac (nl)
· ppczone (en)

Other sites
· napoli ug (it)


Languages
Scegli una lingua:

Inglese Italiano


ricerca nel sito



Online
Abbiamo 0 _MEMBER0 in linea.

Non siete registrati?
Potete farlo con un click qui.


RSS



Kernel recompiling in Darwin/MacOS X (Part I)
Posted 10 Gen 2004 - 03:54 AM

mac os x
Darwin, the BSD subsystem Mac OS X lays on, is open-source. This means, among many other things, that you can recompile the kernel of the operating system so that it fits your needs. This is a little guide to Darwin kernel recompiling.

At the moment the article does not cover Kernel configuration, so these are just the default steps to get your very firdt kernel compiled. The default configuration includes debug symbols and support compiled into the kernel, so it will be not a deployment kernel.

Disclaimer: doing something wrong can put your system in unbootable state. We take no responsability of what you do with these informations. More: this article is an ongoing work, so it will change periodically. Check back often to read more about the kernel recompiling and configuration.

Where to start
First of all you must have Developer Tools installed on your system: the developer tools contain the compiler we will use.
Second thing: you need the kernel source. You can download it for free at Apple opensource website.
You are practically ready to start.

But why recompiling?
Well, sometimes people just recompile it for fun. Ok, that'not that fun for "normal users", but there are people interested in doing such things just for fun.
Sometimes there are people that do it for more serious reasons. The existence of a bad bug in the kernel shipped with Mac OS X / Darwin , for example, and the availability of a patch to that bug could be a good reason to recompile the kernel with that patch applied to the source code. Apple usually patch bugs after few days, but hey, who can know?

Starting
We are going to work with the Terminal.app. Don't be scared by that. It is not that bad working from the command line.

The source file comes in a .tar format. To extract a .tar just type:

tar -xzvf filename.tar

where filename.tar is your file. This will extract the archive. Before proceeding with the extraction consider putting the tar file into a directory you created. To create a directory type:

mkdir directoryname

Please, when choosing the name of the directory, avoid using spaces and other strange not-alphanumeric symbols for it. It is a good habit, and makes your life easy when doing nice things from the shell.
Before compiling the kernel we need to get some more tools from the Apple opensource website: download bootstrap_cmds, Libstreams, and cctools packages there and extract the .tar files.
Once extracted in a directory of our choice we must solve some few other problems before starting the compilation phase.

We consider you extracted the packages in the same directory and you are actually in that directory:

cd bootstrap_cmds-version/relpath.tproj
make
sudo make install

then, going back to the directory where we extracted them:

cd Libstreams-version
make
sudo make install

once again going back to the extraction dir:

cd cctools
sudo cp /usr/include/sys/unistd.h /System/Library/Frameworks/Kernel.framework/Headers/sys

cctools package still needs some work: edit with your favourite editor (we suggest vim) the Makefile contained in its directory and look for the COMMON_SUBDIRS line. Make it look:

COMMON_SUBDIRS = libstuff libmacho misc

Ok, almost finished with the cctools. Now type the following commands:

make RC_OS=macos
sudo cp misc/seg_hack.NEW /usr/local/bin/seg_hack
cd ld
make RC_OS=macos kld_build
sudo cp static_kld/libkld.a /usr/local/lib
sudo ranlib /usr/local/lib/libkld.a

This implies that for future passes /usr/local/bin is in your PATH environment variable. If you're using bash shell, the default one in Panther, you can add /usr/local/bin to your path typing:

export PATH=$PATH:/usr/local/bin


You can add this line to your .bashrc file that is located in your home directory, so that evertyme you get a shell by the Terminal.app it will setup the PATH variable for you.

We get to the point, the kernel compiling :)
Get to the directory where you extracted the kernel sources and type:

source SETUP/setup.sh

This will setup some other needed environment variables for you automatically.

The easy way, now. Type:

make exporthdrs
make all

And you will get your kernel in BUILD/obj/RELEASE_PPC/mach_kernel


Kernel recompiling in Darwin/MacOS X (Part I) | Log-in/Creare un account | 2 Commenti
I soli responsabili dei commenti sono i rispettivi autori.

Re: Kernel recompiling in Darwin/MacOS X (Part I)


da Anonymous di 24 Giu 2004 - 12:52 AM
Very interesting, but hich of the 267 tar files is the source (or do you have to download them all individually?) It seems especially ambiguous on this one point, especially the unnamed filename.tar deal. Is there a way do download it all as a bundle?

Re: Kernel recompiling in Darwin/MacOS X (Part I)


da Anonymous di 04 Gen 2005 - 02:53 AM
When author says "Get to the directory where you extracted the kernel sources..." he means the untarred package xnu-xxx.yy.z that as of Jan-2005 is xnu-517.9.5

This is where the kernel itself is... I guess "nu" in "xnu" stands for nucleus but how would I know?! I had to download all 200+ packages, untar them and do
find ./ -name "setup.sh" to find it.

no patents!

no_patents


Login




 


Registrazione

Recupero pwd smarrita.



vecchi articoli
Articoli più vecchi


Poll

Telecom potenzia gratis le linee ADSL, cosa ne pensate?

  • E` solo propaganda
  • Deve potenziare tutte le offerte
  • E` un'ottima notizia
  • E` follia

[ Risultati | Sondaggi ]

Voti: 19
Commenti: 4



Home ::  Share your story :: 
debian powered
Page created in 0.0956408977509 seconds.