Building kernel for debian rootfs

Started by Evgeny Boger, November 04, 2012, 01:53:47 am

Previous topic - Next topic

Evgeny Boger

November 04, 2012, 01:53:47 am Last Edit: November 04, 2012, 01:56:16 am by evgeny_boger
Hello,

I've finally managed to compile the fsl-community-bsp Linux kernel for Debian rootfs from https://github.com/OLIMEX/OLINUXINO/blob/master/SOFTWARE/iMX233/DEBIAN/DEBIAN-README.TXT .

The goal was to be able to use usb ethernet and wifi dongles since default kernel have no support for it.

Myself, I haven't found step-by-step guide, so someone might find this information useful.
I'm also wondering if there is simpler (or proper) way to compile kernel.  :)

So, first follow the guides from http://www.jann.cc/2012/08/08/building_freescale_s_community_yocto_bsp_for_the_olinuxino.html and https://github.com/Freescale/fsl-community-bsp-platform


$: curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
$: chmod a+x ~/bin/repo

Then add ~/bin/ to the PATH, or just copy ~/bin/repo it to /usr/bin


$: mkdir fsl-community-bsp
$: cd fsl-community-bsp
$: repo init -u https://github.com/Freescale/fsl-community-bsp-platform -b denzil
$: repo sync



$: MACHINE=imx233-olinuxino-micro . ./setup-environment build


You need to change local.conf to set proper PACKAGE_CLASSES and DPKG_ARCH to make bitbake creating deb packages.


PACKAGE_CLASSES ?= "package_deb"
DPKG_ARCH = "armel"


Configure the kernel:

$ bitbake -c menuconfig linux-imx


And compile it


$ bitbake linux-imx


You will find linux image in the tmp/deploy/images/ directory. The kernel modules are packaged to tmp/deploy/deb/imx233_olinuxino_micro/ directory. However, it's not possible to use then with Debian rootfs and default kernel included in "TV_console_FS.tar.gz" since kernel and module version strings do not match each other.

One might try to somehow force OE to set KVER environment variable while compiling modules or just replace default kernel with the newly compiled one.

The "sources/meta-fsl-arm/classes/image_types_fsl.bbclass" file gives an idea how to create bootable kernel partition.

First, prepare bitbake packages

bitbake   elftosb-native imx-bootlets virtual/kernel


Then, make the bootable partition:

$ cd tmp/deploy/images/
$ ../../../../build/tmp/work/x86_64-linux/elftosb-native-10.12.01-r4/elftosb-10.12.01/bld/linux/elftosb -z -c imx-bootlets-linux.bd-imx233-olinuxino-micro -o imx23_linux.sb

$ dd if=/dev/zero of=mx23.img bs=512 count=4
$ dd if=imx23_linux.sb of=mx23.img ibs=512 seek=4 conv=sync,notrunc


The mx23.img file contains bootable kernel partition.
Copy it to SD card:


$# sudo dd if=mx23.img of=/dev/mmcblk0p1____


Where /dev/mmcblk0p1____ is the first partition on the microSD card.


To be able to use deb packages with kernel modules you should install module-init-tools on the board first.

Don't forget to change

1:2345:respawn:/sbin/getty -L ttyAM0 115200 vt100


to


1:2345:respawn:/sbin/getty -L ttyAMA0 115200 vt100


in /etc/inittab to get login prompt.














aasaeedi

I have successfully completed these steps.

Which rootfs should I use when I am preparing the SD card?

I used the one suggested here (https://github.com/OLIMEX/OLINUXINO/blob/master/SOFTWARE/iMX233/DEBIAN/DEBIAN-README.TXT) But it gives me login error with root account.

aasaeedi

For future reference, adding /dev/ttyAMA0 to /etc/securetty solved the issue.

Thanks for the great tutorial!