Compiling your own Linux Kernel

Tutorials and Guides about using/developing Linux/BSD/Mac OS @Xbox360
User avatar
tuxuser
Administrator
Administrator
Posts: 301
Joined: Sat Feb 19, 2011 4:53 pm
Location: Germany
Contact:

Compiling your own Linux Kernel

Postby tuxuser » Wed Mar 16, 2011 7:09 am

Here's a short tutorial how you compile your own Linux-Kernel.

Prerequisites:

Installed Linux OS (Native or Virtual Machine)
Installed Xenon-Toolchain - you wont need it if you are compiling on a PPC Machine

1. At first download the Kernel Source in a new folder and extract it:

Code: Select all

mkdir xenon-linux-kernel
cd xenon-linux-kernel/
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.36.4.tar.bz2
tar xvjf linux-2.6.36.4.tar.bz2


2. Now download the xenon-patchset && kernel config file

Code: Select all

wget http://file.libxenon.org/free60/linux/kernel/patch-2.6.36.4-xenon0.11.diff
wget http://file.libxenon.org/free60/linux/kernel/.config


3. Apply the patchset and copy over the config-file

Code: Select all

cd linux-2.6.36.4
patch -p1 < ../patch-2.6.36.4-xenon0.11.diff
cp ../.config .


4. Edit the config to your needs

Code: Select all

nano .config
->Editor Window opens in Terminal
-> Press CTRL + W for "Search"
-> Type "CONFIG_CMDLINE"


The most important part you probably want to edit is the root= parameter. Edit it to the device where your linux system is installed. Now:

Code: Select all

-> Press CTRL + O
-> Confirm the filename with pressing ENTER
-> Press CTRL + X to close nano


5. Start the compiling process

(If you are on a native PPC machine (like PS3 etc) you dont need the "CROSS_COMPILE=xenon-" parameter !)
To make sure you are working with a proper config, type the following:

Code: Select all

make CROSS_COMPILE=xenon- ARCH=powerpc oldconfig

It should only say that it saved the .config


Now the actual compiling begins. Type:

Code: Select all

make CROSS_COMPILE=xenon- ARCH=powerpc all


If you are using a Hyperthreading captable processor you could also append the -j parameter. It should be Number of CPU-Cores + 1, so for a quad-core (5) you would do:

Code: Select all

make -j 5 CROSS_COMPILE=xenon- ARCH=powerpc all


Once the compiling is finished you will find the ready-to-use kernel in "arch/powerpc/boot" with the name "zImage.xenon"!

Have fun  :)  :) :) 
Last edited by tuxuser on Sun Jun 19, 2011 11:56 pm, edited 1 time in total.
I have no idea what I am doing but atleast I am trying

User avatar
Razkar
Team
Team
Posts: 16
Joined: Sat Feb 19, 2011 6:18 pm
Location: France

Re: Compiling your own Linux Kernel

Postby Razkar » Wed Mar 16, 2011 7:19 am

Nice tuto Tux, this will be very helpful
Thx ;)
Image

charlo.charli

Re: Compiling your own Linux Kernel

Postby charlo.charli » Wed Mar 16, 2011 12:29 pm

Thanks very helpfull!

val532

Re: Compiling your own Linux Kernel

Postby val532 » Wed Mar 16, 2011 3:09 pm

Thanks

val532

Re: Compiling your own Linux Kernel

Postby val532 » Thu Mar 17, 2011 12:45 am

Linux kernel 2.6.38 is out can we use it ?

User avatar
Cancerous1
Administrator
Administrator
Posts: 88
Joined: Sat Feb 19, 2011 5:25 pm

Re: Compiling your own Linux Kernel

Postby Cancerous1 » Fri Mar 18, 2011 2:47 am

thanks for the help tux! finally my kernel builds work as expected :D

User avatar
Juggahaxor
Global Moderator
Global Moderator
Posts: 21
Joined: Sat Feb 19, 2011 6:43 pm
Location: Dayton Ohio
Contact:

Re: Compiling your own Linux Kernel

Postby Juggahaxor » Fri Mar 18, 2011 1:26 pm

[quote=&quot;val532&quot;]Linux kernel 2.6.38 is out can we use it ?[/quote]

You can find patches and config files for 2.6.38-rc3 in the link below.
Here ----> http://vserver.13thfloor.at/Stuff/XBOX360/
Last edited by Juggahaxor on Sun Jun 19, 2011 11:57 pm, edited 1 time in total.
"Smoke if you got 'em"

User avatar
tuxuser
Administrator
Administrator
Posts: 301
Joined: Sat Feb 19, 2011 4:53 pm
Location: Germany
Contact:

Re: Compiling your own Linux Kernel

Postby tuxuser » Fri Mar 18, 2011 2:31 pm

[quote=&quot;"Juggahaxor"&quot;][quote=&quot;"val532"&quot;]Linux kernel 2.6.38 is out can we use it ?[/quote]

You can find patches and config files for 2.6.38-rc3 in the link below. [/quote]

But they got a delta-patch for the atomic ops in it.. so the kernel is spitting a lot of exceptions and its running more unstable than the one we are currently using..
Guys, I am using 2.6.36.4 for a reason :P
I have no idea what I am doing but atleast I am trying

val532

Re: Compiling your own Linux Kernel

Postby val532 » Fri Mar 18, 2011 3:28 pm

Made this patch work for 2.6.38 ^^.

Doerek

Re: Compiling your own Linux Kernel

Postby Doerek » Thu Apr 21, 2011 12:20 pm

Link:  http://libxenon.org/http://libxenon.org//viewtopic.php?p=221#p221

[quote=&quot;tuxuser&quot;]@Sonic-NKT

Yep, of course its possible! It's called "persistence".. however it needs modification to the Kernel CMDLINE..and as we are unable to just pass the whole CMDLINE to a "naked" kernel YET.. a new Kernel Compile has to be made to accomplish such.

Here is a little info about the persistence:

<!-- m -->https://help.ubuntu.com/community/LiveCD/Persistence<!-- m -->

Go for the initramfs attached here and compile it into the kernel.
To do so you extract the archive and set the following correctly in the kernel's .config
(CMDLINE needs to be adjusted probably)

Code: Select all

CONFIG_CMDLINE="boot=casper video=xenonfb console=tty0 ip=dhcp panic=60 nosmp maxcpus=1 persistence"
CONFIG_INITRAMFS_SOURCE="/path/to/casper-initramfs"
CONFIG_INITRAMFS_COMPRESSION_LZMA=y


The Kernel's Config which is used in the "Kernel Compile Tutorial" is also updated, the changes mentioned above need to be done still.

Greetz
tux[/quote]

Hi tux,
müssen die änderungen immernoch durchgeführt werden?
Bin grad bei der VMware installation und wollte mich mit deinem Kernel Tut mal daran versuchen...
Ich weiß nur noch nicht welche distro ich benutzen soll, hab etwas platzmangel auf meinen HDDs.
(Kannst du mir in dem Fall eine Distro empfehlen?)

greetz
DCDoerek
Last edited by Doerek on Mon Jun 20, 2011 12:01 am, edited 1 time in total.

User avatar
tuxuser
Administrator
Administrator
Posts: 301
Joined: Sat Feb 19, 2011 4:53 pm
Location: Germany
Contact:

Re: Compiling your own Linux Kernel

Postby tuxuser » Sat Apr 23, 2011 1:53 pm

@Doerek

Yes the changes still need to be made if you want a persistance partition .. so you data does not get lost after you turn off your live-system.

For a small linux system in a virtual maschine: If you are not afraid of using the terminal (textconsole) all the time, just install Ubuntu without a XServer (without a GUI). Then you can still do everything.. but its fast and does not need much space.

Greetz
tux
I have no idea what I am doing but atleast I am trying

Doerek

Re: Compiling your own Linux Kernel

Postby Doerek » Sun Apr 24, 2011 10:40 am

Hi,

Also die installation per VMware ist fehlgeschlagen...VMware tools for inux habe ich nicht vernünftig zum laufen gebracht.

Neuer Versuch...diesmal mit "Wubi" + Ubuntu 10.10 (64bit) auf eine Externe HDD.
Ich melde mich später nochmal.

Doerek

Re: Compiling your own Linux Kernel

Postby Doerek » Sun Apr 24, 2011 12:40 pm

Hi,

Habe gerade ubuntu installiert und alle updates gezogen...soweit so gut:

Allerdings...
wenn ich versuche den Kernel zu kompilieren bekomme ich folgende fehlermeldung:

Code: Select all

doerek@ubuntu:~/xenon-linux-kernel/linux-2.6.36.4$ make -j 3 CROSS_COMPILE=xenon- ARCH=powerpc all
make: xenon-gcc: Kommando nicht gefunden
scripts/kconfig/conf --silentoldconfig arch/powerpc/Kconfig
/home/doerek/xenon-linux-kernel/linux-2.6.36.4/scripts/gcc-version.sh: Zeile 25: xenon-gcc: Kommando nicht gefunden.
/home/doerek/xenon-linux-kernel/linux-2.6.36.4/scripts/gcc-version.sh: Zeile 26: xenon-gcc: Kommando nicht gefunden.
make: xenon-gcc: Kommando nicht gefunden
/home/doerek/xenon-linux-kernel/linux-2.6.36.4/scripts/gcc-version.sh: Zeile 25: xenon-gcc: Kommando nicht gefunden.
/home/doerek/xenon-linux-kernel/linux-2.6.36.4/scripts/gcc-version.sh: Zeile 26: xenon-gcc: Kommando nicht gefunden.
/home/doerek/xenon-linux-kernel/linux-2.6.36.4/scripts/gcc-version.sh: Zeile 25: xenon-gcc: Kommando nicht gefunden.
/home/doerek/xenon-linux-kernel/linux-2.6.36.4/scripts/gcc-version.sh: Zeile 26: xenon-gcc: Kommando nicht gefunden.
/home/doerek/xenon-linux-kernel/linux-2.6.36.4/scripts/gcc-version.sh: Zeile 28: xenon-gcc: Kommando nicht gefunden.
*** 2.6 kernels no longer build correctly with old versions of binutils.
*** Please upgrade your binutils to 2.12.1 or newer
make: *** [checkbin] Fehler 1
make: *** Warte auf noch nicht beendete Prozesse...
make: *** wait: Keine Kind-Prozesse.  Schluss.


Ich hab im softwarecenter zwar mal nach "binutils" gesucht aber wirklich fündig (im sinne eines updates) bin ich nicht geworden.

Doerek

Re: Compiling your own Linux Kernel

Postby Doerek » Sun Apr 24, 2011 6:54 pm

mir ist grade aufgefallen dass ich vergessen habe die Xenon toolchain zu bauen...lesen bildet ;)
Danach versuch ichs nochmal

Doerek

Re: Compiling your own Linux Kernel

Postby Doerek » Sun Apr 24, 2011 8:06 pm

also die Toolchain habe ich nach angaben auf free60.org erstellt.

Danach habe ich das verzeichnis vom Xbox Kernel gelöscht und nochmal neu angefangen.

Beim kompilieren bekomme ich trotzdem eine fehlermeldung:

Code: Select all

doerek@ubuntu:~/xenon-linux-kernel/linux-2.6.36.4$ make CROSS_COMPILE=xenon- ARCH=powerpc all
/home/doerek/xenon-linux-kernel/linux-2.6.36.4/scripts/gcc-version.sh: Zeile 25: xenon-gcc: Kommando nicht gefunden.
/home/doerek/xenon-linux-kernel/linux-2.6.36.4/scripts/gcc-version.sh: Zeile 26: xenon-gcc: Kommando nicht gefunden.
make: xenon-gcc: Kommando nicht gefunden
/home/doerek/xenon-linux-kernel/linux-2.6.36.4/scripts/gcc-version.sh: Zeile 25: xenon-gcc: Kommando nicht gefunden.
/home/doerek/xenon-linux-kernel/linux-2.6.36.4/scripts/gcc-version.sh: Zeile 26: xenon-gcc: Kommando nicht gefunden.
/home/doerek/xenon-linux-kernel/linux-2.6.36.4/scripts/gcc-version.sh: Zeile 25: xenon-gcc: Kommando nicht gefunden.
/home/doerek/xenon-linux-kernel/linux-2.6.36.4/scripts/gcc-version.sh: Zeile 26: xenon-gcc: Kommando nicht gefunden.
/home/doerek/xenon-linux-kernel/linux-2.6.36.4/scripts/gcc-version.sh: Zeile 28: xenon-gcc: Kommando nicht gefunden.
*** 2.6 kernels no longer build correctly with old versions of binutils.
*** Please upgrade your binutils to 2.12.1 or newer
make: *** [checkbin] Fehler 1


P.s.

Code: Select all

doerek@ubuntu:~/xenon-linux-kernel/linux-2.6.36.4$ ld -v
GNU ld (GNU Binutils for Ubuntu) 2.20.51-system.20100908


Return to “Operating Systems”

Who is online

Users browsing this forum: No registered users and 1 guest