Difference between revisions of "Kernel compiling"

From odroid US
Jump to: navigation, search
Line 3: Line 3:
 
DO THIS ON YOUR ODROID, NOT ON YOUR PC!
 
DO THIS ON YOUR ODROID, NOT ON YOUR PC!
  
you can easily build the kernel on your own:
+
=== Prerequisites ===
<pre>wget https://github.com/hardkernel/linux/archive/odroid-3.0.y.zip
+
 
mv odroid-3.0.y.zip /usr/src/linux.zip
+
make sure you have the neccessary programs installed
apt-get install p7zip-full
+
<pre>
 +
apt-get -y install p7zip-full build-essential
 +
</pre>
 +
 
 +
=== Grabbing the source ===
 +
you can easily build the kernel on your own.
 +
grab the source from github:
 +
#browse to https://github.com/hardkernel/linux
 +
#choose your branch (as of today -2013-01-12- it's odroid-3.0.y)
 +
<pre>wget https://github.com/hardkernel/linux/archive/odroid-3.0.y.zip</pre>
 +
 
 +
=== Unpacking the source ===
 +
<pre>mv odroid-3.0.y.zip /usr/src/linux.zip
 
cd /usr/src
 
cd /usr/src
 
7z x -y linux.zip > /dev/null
 
7z x -y linux.zip > /dev/null
mv linux-odroid* linux
+
mv linux-odroid* linux</pre>
cd linux</pre>
+
 
make sure to select the right config for your device in the next step.
+
=== Configuring the kernel ===
 +
<pre>cd /usr/src/linux</pre>
 +
make sure to select the correct config for your device in the next step.
 
execute the following to get a list of odroid kernel configs:
 
execute the following to get a list of odroid kernel configs:
 
<pre>
 
<pre>
Line 26: Line 40:
 
make xconfig</pre>
 
make xconfig</pre>
 
change everything to your needs (use / for searching)
 
change everything to your needs (use / for searching)
 +
=== Building the kernel ===
 
<pre>make -j8
 
<pre>make -j8
 
make modules_install
 
make modules_install
make zImage
+
make zImage</pre>
kernelversion=`cat ./include/config/kernel.release`
+
 
 +
=== Copying the kernel and initramfs to the boot partition ===
 +
<pre>kernelversion=`cat ./include/config/kernel.release`
 
mount -o bind /media/boot/ /boot
 
mount -o bind /media/boot/ /boot
 
cp /media/boot/zImage /media/boot/zImage.prev
 
cp /media/boot/zImage /media/boot/zImage.prev

Revision as of 11:17, 12 January 2013

WATCH THE SIZE OF YOUR BOOT PARTITION, MAYBE YOU HAVE TO DELETE SOME OF THE BACKUP FILES!

DO THIS ON YOUR ODROID, NOT ON YOUR PC!

Prerequisites

make sure you have the neccessary programs installed

apt-get -y install p7zip-full build-essential

Grabbing the source

you can easily build the kernel on your own. grab the source from github:

  1. browse to https://github.com/hardkernel/linux
  2. choose your branch (as of today -2013-01-12- it's odroid-3.0.y)
wget https://github.com/hardkernel/linux/archive/odroid-3.0.y.zip

Unpacking the source

mv odroid-3.0.y.zip /usr/src/linux.zip
cd /usr/src
7z x -y linux.zip > /dev/null
mv linux-odroid* linux

Configuring the kernel

cd /usr/src/linux

make sure to select the correct config for your device in the next step. execute the following to get a list of odroid kernel configs:

ls /usr/src/linux/arch/arm/configs/ | grep odroid

now choose your config and copy it to /usr/src/linux/.config (i chose odroid-x2s ubuntu config)

cp arch/arm/configs/odroidx2_ubuntu_defconfig /usr/src/linux/.config

Text mode:

apt-get install ncurses-dev
make menuconfig

Graphical mode:

apt-get install qt4-dev-tools
make xconfig

change everything to your needs (use / for searching)

Building the kernel

make -j8
make modules_install
make zImage

Copying the kernel and initramfs to the boot partition

kernelversion=`cat ./include/config/kernel.release`
mount -o bind /media/boot/ /boot
cp /media/boot/zImage /media/boot/zImage.prev
cp /media/boot/uInitrd /media/boot/uInitrd.prev
cp arch/arm/boot/zImage /media/boot
cp .config /boot/config-$kernelversion

optionally:

cp System.map /boot/System.map-$kernelversion

NOT optional:

mkinitramfs -c gzip -o ./initramfs-$kernelversion $kernelversion
mkimage -A arm -O linux -T ramdisk -C none -a 0 -e 0 -n initramfs -d ./initramfs-$kernelversion ./uInitrd
cp uInitrd /media/boot

halt:

shutdown -h 0

power cycle after that.