Welcome, Guest

Author Topic: Building kernel for debian rootfs  (Read 3652 times)

Evgeny Boger

  • Newbie
  • *
  • Posts: 25
  • Karma: +0/-0
Building kernel for debian rootfs
« on: November 04, 2012, 01:53:47 AM »
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

Code: [Select]
$: 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

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

Code: [Select]
$: 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.

Code: [Select]
PACKAGE_CLASSES ?= "package_deb"
DPKG_ARCH = "armel"

Configure the kernel:
Code: [Select]
$ bitbake -c menuconfig linux-imx

And compile it

Code: [Select]
$ 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
Code: [Select]
bitbake   elftosb-native imx-bootlets virtual/kernel

Then, make the bootable partition:
Code: [Select]
$ 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:

Code: [Select]
$# 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
Code: [Select]
1:2345:respawn:/sbin/getty -L ttyAM0 115200 vt100

to

Code: [Select]
1:2345:respawn:/sbin/getty -L ttyAMA0 115200 vt100

in /etc/inittab to get login prompt.













« Last Edit: November 04, 2012, 01:56:16 AM by evgeny_boger »

aasaeedi

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
Re: Building kernel for debian rootfs
« Reply #1 on: December 09, 2012, 07:37:40 AM »
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

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
Re: Building kernel for debian rootfs
« Reply #2 on: December 09, 2012, 09:12:16 PM »
For future reference, adding /dev/ttyAMA0 to /etc/securetty solved the issue.

Thanks for the great tutorial!