User:Urjaman/Building the kernel on the Pandora: Difference between revisions

From Pandora Wiki
Jump to navigationJump to search
Urjaman (talk | contribs)
Initial WIP draft of my pandora kernel building Howto
 
Urjaman (talk | contribs)
 
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
Building the kernel on the Pandora
This is still a WIP set of notes. Testing in progress.
Will add SGX and WiFi module building later.


This is still a WIP set of notes. Wikification in progress.
== Install local toolchain and git ==
Open up a terminal if you havent already. This stuff (opkg) is currently quite dangerous and you might end up breaking your install. I recommend using an SD install for this.
sudo opkg update
This is untested  and IIRC I needed to fiddle with the names a bit.
You can "search" for a name with eg. with sudo opkg list | grep name
sudo opkg install gcc gcc-symlinks make binutils-dev cpp cpp-symlinks g++ \
g++-symlinks libstdc++-dev git u-boot-mkimage
Note: I did this 26.3.2012 and I needed to add --force to this opkg, and it slightly broke the install; before rebooting do this (be root before the opkg, skip the sudo) to atleast somewhat fix it:
cd /usr/lib
ln -s libncursesw.so.5 libncurses.so.5


0. Open up a terminal
== Get ext2 space ==
1. Install local toolchain and git
=== Choose from ===
sudo opkg update
==== I run my OS from SD ====
# This is untested and IIRC I needed to fiddle with the names a bit.
Make a directory in your home folder then:
# You can "search" for a name with eg. with sudo opkg list | grep name
mkdir dev && cd dev
sudo opkg install gcc gcc-symlinks make binutils-dev cpp cpp-symlinks g++ g++-symlinks libstdc++-dev git
==== I have an ext2 formatted SD card ====
Make a directory on the card then:
cd /media/<ext2card>
mkdir dev && cd dev
==== I only have a FAT32 formatted SD card ====
Then you can create an ext2 loop file (1GiB) on the card:
cd /media/<fatcard>
dd if=/dev/zero of=dev.ext2 bs=1M count=1024
mke2fs -m 0 dev.ext2
mkdir dev
sudo mount -o loop dev.ext2 dev
cd dev
You should now be in a folder named "dev" suitable for the job.


2. Get ext2 space
== Checkout pandora-kernel ==
2.1 Choose from (pick one of):
git clone --depth=1 git://git.openpandora.org/pandora-kernel.git
2.1.1 root in SD
cd pandora-kernel && git checkout --track -b pandora-27-omap1 origin/pandora-27-omap1 && cd ..
mkdir dev && cd dev
This will take a moment. Go grab your chosen beverage.
2.1.2 ext2 formatted SD card
cd /media/<ext2card>
mkdir dev && cd dev
2.1.3 ext2 loop file (1GiB) on an SD card:
cd /media/<fatcard>
dd if=/dev/zero of=dev.ext2 bs=1M count=1024
mke2fs -m 0 dev.ext2
mkdir dev
sudo mount -o loop dev.ext2 dev
2.2 You should now be in a folder named "dev" suitable for the job.


3. Checkout pandora-kernel
== Checkout and apply patches ==
git clone --depth=1 git://git.openpandora.org/pandora-kernel.git
git clone --depth=1 git://git.openpandora.org/openpandora.oe.git
cd pandora-kernel
Here cross-ref against ../openpandora.oe/recipes/linux/omap3-pandora-kernel_2.6.27-pandora.bb wont hurt.


3.1 Checkout and apply patches
Warning: Mega-list-of-commands follows, formatted it as an sh script if needed
git clone --depth=1 git://git.openpandora.org/openpandora.oe.git
#!/bin/bash -e
cd pandora-kernel
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/0001-Add-EHCI-patch-suggested-by-Steven-Kipisz.patch
# Here cross-ref against ../openpandora.oe/recipes/linux/omap3-pandora-kernel_2.6.27-pandora.bb wont hurt.
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/0002-Add-missing-define-to-EHCI-OMAP.c.patch
# Warning: Mega-list-of-commands follows, formatted it as an sh script if needed
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/no-empty-flash-warnings.patch
#!/bin/bash -e
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/oprofile-0.9.3.armv7.diff
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/0001-Add-EHCI-patch-suggested-by-Steven-Kipisz.patch
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/no-cortex-deadlock.patch
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/0002-Add-missing-define-to-EHCI-OMAP.c.patch
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/read_die_ids.patch
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/no-empty-flash-warnings.patch
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/fix-install.patch
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/oprofile-0.9.3.armv7.diff
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/mru-fix-timings.diff
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/no-cortex-deadlock.patch
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/mru-fix-display-panning.diff
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/read_die_ids.patch
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/mru-make-dpll4-m4-ck-programmable.diff
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/fix-install.patch
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/mru-improve-pixclock-config.diff
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/mru-fix-timings.diff
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/mru-make-video-timings-selectable.diff
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/mru-fix-display-panning.diff
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/mru-enable-overlay-optimalization.diff
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/mru-make-dpll4-m4-ck-programmable.diff
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/dvb-fix-dma.diff
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/mru-improve-pixclock-config.diff
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/0001-Removed-resolution-check-that-prevents-scaling-when.patch
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/mru-make-video-timings-selectable.diff
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/0001-Implement-downsampling-with-debugs.patch
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/mru-enable-overlay-optimalization.diff
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/musb-rxtx.patch
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/dvb-fix-dma.diff
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/squashfs/0006-SquashFS-Backport-SquashFS4-to-our-2.6.27-tree.patch
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/0001-Removed-resolution-check-that-prevents-scaling-when.patch
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/aufs2/0007-AUFS2-Add-latest-AUFS2-in-tree-code-for-2.6.27.patch
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/0001-Implement-downsampling-with-debugs.patch
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/musb-rxtx.patch
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/squashfs/0006-SquashFS-Backport-SquashFS4-to-our-2.6.27-tree.patch
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/aufs2/0007-AUFS2-Add-latest-AUFS2-in-tree-code-for-2.6.27.patch


3.2 fix Makefile
== Fix Makefile ==
# This gem is from vminko's ebuild
This gem is from vminko's ebuild.
sed -i 's/?= arm-linux-/=/' Makefile
It will remove the cross-compiling prefix from the Makefile, so that it will use gcc instead of arm-linux-gcc.
sed -i 's/?= arm-linux-/=/' Makefile


4. Configure kernel
== Configure kernel ==
cp ../openpandora.oe/recipes/linux/omap3-pandora-kernel/defconfig .config
cp ../openpandora.oe/recipes/linux/omap3-pandora-kernel/defconfig .config
make oldconfig
make oldconfig
# if you want to change configuration:
if you want to change configuration:
make menuconfig
make menuconfig
# You will need to change the configuration if you want the kernel name to match stock:
You will need to change the configuration if you want the kernel name to match stock, disable General Setup -> Automatically append version information to the version string .
# Disable General Setup -> Automatically append version information to the version string


== Build the kernel ==
This will take time and CPU power, so if you're like me, dont forget to overclock.


5. Build the kernel
Modules, if desired:
make modules
make modules
make uImage
and the kernel:
# if you want to install modules:
make uImage
sudo make modules_install
if you want to install modules:
sudo make modules_install

Latest revision as of 02:17, 26 March 2012

This is still a WIP set of notes. Testing in progress. Will add SGX and WiFi module building later.

Install local toolchain and git

Open up a terminal if you havent already. This stuff (opkg) is currently quite dangerous and you might end up breaking your install. I recommend using an SD install for this.

sudo opkg update

This is untested and IIRC I needed to fiddle with the names a bit. You can "search" for a name with eg. with sudo opkg list | grep name

sudo opkg install gcc gcc-symlinks make binutils-dev cpp cpp-symlinks g++ \
g++-symlinks libstdc++-dev git u-boot-mkimage

Note: I did this 26.3.2012 and I needed to add --force to this opkg, and it slightly broke the install; before rebooting do this (be root before the opkg, skip the sudo) to atleast somewhat fix it:

cd /usr/lib
ln -s libncursesw.so.5 libncurses.so.5

Get ext2 space

Choose from

I run my OS from SD

Make a directory in your home folder then:

mkdir dev && cd dev

I have an ext2 formatted SD card

Make a directory on the card then:

cd /media/<ext2card>
mkdir dev && cd dev

I only have a FAT32 formatted SD card

Then you can create an ext2 loop file (1GiB) on the card:

cd /media/<fatcard>
dd if=/dev/zero of=dev.ext2 bs=1M count=1024
mke2fs -m 0 dev.ext2
mkdir dev
sudo mount -o loop dev.ext2 dev
cd dev

You should now be in a folder named "dev" suitable for the job.

Checkout pandora-kernel

git clone --depth=1 git://git.openpandora.org/pandora-kernel.git
cd pandora-kernel && git checkout --track -b pandora-27-omap1 origin/pandora-27-omap1 && cd ..

This will take a moment. Go grab your chosen beverage.

Checkout and apply patches

git clone --depth=1 git://git.openpandora.org/openpandora.oe.git
cd pandora-kernel

Here cross-ref against ../openpandora.oe/recipes/linux/omap3-pandora-kernel_2.6.27-pandora.bb wont hurt.

Warning: Mega-list-of-commands follows, formatted it as an sh script if needed

#!/bin/bash -e
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/0001-Add-EHCI-patch-suggested-by-Steven-Kipisz.patch
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/0002-Add-missing-define-to-EHCI-OMAP.c.patch
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/no-empty-flash-warnings.patch
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/oprofile-0.9.3.armv7.diff
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/no-cortex-deadlock.patch
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/read_die_ids.patch
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/fix-install.patch
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/mru-fix-timings.diff
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/mru-fix-display-panning.diff
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/mru-make-dpll4-m4-ck-programmable.diff
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/mru-improve-pixclock-config.diff
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/mru-make-video-timings-selectable.diff
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/mru-enable-overlay-optimalization.diff
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/dvb-fix-dma.diff
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/0001-Removed-resolution-check-that-prevents-scaling-when.patch
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/0001-Implement-downsampling-with-debugs.patch
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/musb-rxtx.patch
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/squashfs/0006-SquashFS-Backport-SquashFS4-to-our-2.6.27-tree.patch
patch -Np1 < ../openpandora.oe/recipes/linux/omap3-pandora-kernel/aufs2/0007-AUFS2-Add-latest-AUFS2-in-tree-code-for-2.6.27.patch

Fix Makefile

This gem is from vminko's ebuild. It will remove the cross-compiling prefix from the Makefile, so that it will use gcc instead of arm-linux-gcc.

sed -i 's/?= arm-linux-/=/' Makefile

Configure kernel

cp ../openpandora.oe/recipes/linux/omap3-pandora-kernel/defconfig .config
make oldconfig

if you want to change configuration:

make menuconfig

You will need to change the configuration if you want the kernel name to match stock, disable General Setup -> Automatically append version information to the version string .

Build the kernel

This will take time and CPU power, so if you're like me, dont forget to overclock.

Modules, if desired:

make modules

and the kernel:

make uImage

if you want to install modules:

sudo make modules_install