Olimex Support Forum

OLinuXino Android / Linux boards and System On Modules => iMX233 => Topic started by: r3flow on October 01, 2012, 09:05:36 pm

Title: Building ArchLinux kernel with cross toolchain
Post by: r3flow on October 01, 2012, 09:05:36 pm
Anybody who missing drivers from the Arch Linux kernel and don't want to use the alarm native build system, I wrote a small script (https://dl.dropbox.com/u/170847/share/olimex/olimex-arch-kernel-build.tgz) that rebuilds the Arch kernel with your favorite cross tolchain. It's doesn't generate a pacman package, but I think it's also would be possible.

The only requirement is that your toolchain should be in the PATH and the CROSS_TOOL_PREFIX variable should be set according to your toolchain. Everything else will be downloaded from the internet.

Step 1: download

./olimex-arch-kernel-build.sh prepare


Step 2: configure the kernel (optional, but this is the goal)

./olimex-arch-kernel-build.sh config


Step 3: build the kernel and modules

./olimex-arch-kernel-build.sh build


Step 4: generate boot image and module archive

./olimex-arch-kernel-build.sh pack


The binaries will be placed in the "bin" directory and should be installed manually. Tested on CentOS 6 but I think it will works on other systems too.
Title: Re: Building ArchLinux kernel with cross toolchain
Post by: dingbatca on October 16, 2012, 11:45:51 pm
Missing patch?


root@raspberrypi# pwd
/mnt/gentoo/usr/src/arch_kernel-2.6

root@raspberrypi# ./olimex-arch-kernel-build.sh prepare
...
imx-bootlets-src-10.12.01/uboot_ivt.bd
imx-bootlets-src-10.12.01/updater.bd
imx-bootlets-src-10.12.01/updater_ivt.bd
patching file linux_prep/cmdlines/iMX28_EVK.txt
patching file linux_prep/cmdlines/stmp378x_dev.txt
patching file linux.bd
patching file linux_prep/include/mx23/platform.h
patch: **** Can't open patch file ../imx-boot-build.patch : No such file or directory
...

root@raspberrypi# find . | grep imx-boot-build.patch
root@raspberrypi#
Title: Re: Building ArchLinux kernel with cross toolchain
Post by: r3flow on October 17, 2012, 12:31:51 am
this patch included in the archive
https://dl.dropbox.com/u/170847/share/olimex/olimex-arch-kernel-build.tgz
Title: Re: Building ArchLinux kernel with cross toolchain
Post by: dingbatca on October 17, 2012, 12:39:56 am
Thanks, that fixed it!

Odd ball question: Difference between imx-bootlets-src-10.05.02 and 10.12.01?
Title: Re: Building ArchLinux kernel with cross toolchain
Post by: rabinath on October 17, 2012, 11:53:51 am
Thank you so much! I had to make two small changes to make it work:


--- olimex-arch-kernel-build.sh.o       2012-10-17 10:04:35.133216603 +0200
+++ olimex-arch-kernel-build.sh 2012-10-17 10:20:49.493216604 +0200
@@ -147,7 +147,8 @@
     rm -rf lib
     popd

-    cp "${BOOT_SRC_DIR}/imx23_linux.sb" "${OUTPUT_ROOT_DIR}/sd_mmc_bootstream.raw"
+    dd if=/dev/zero of="${OUTPUT_ROOT_DIR}/sd_mmc_bootstream.raw" bs=512 count=4
+    cat "${BOOT_SRC_DIR}/imx23_linux.sb" >> "${OUTPUT_ROOT_DIR}/sd_mmc_bootstream.raw"
}

export PATH=`pwd`/"${IMX23_ELFTOSB_DIR}":$PATH


as well as unchecking "Kernel support for a.out and ECOFF binaries" in "Userspace binary formats" to make my Kernel compile.
But also with this Kernel standby & resume (via PWR BTN) does not work on my board - it suspends but I can not wake it up. Does it work with yours?
Title: Re: Building ArchLinux kernel with cross toolchain
Post by: r3flow on October 17, 2012, 02:24:41 pm
Theoretically the resulted kernel is same as the official Arch ARM kernel, just built with a cross toolchain instead of the native toolchain. So should not be any regression there compared to the offical ARM kernel.

The wakeup (from standby) also doesn't work for me. I didn't tried this with the offical 2.6.35 ArchARM kernel but I hope that's doesn't work too. :)

Also I use the freescale trunk (the commented line git clone --depth=1 ${KGIT_ROOT} "${KSRC_DIR}") instead of the offical "imx_2.6.35_10.12.01" branch/commit, beacuse it seems more stable for me. Also might be should try with other versions of imx-bootlets...
Title: Re: Building ArchLinux kernel with cross toolchain
Post by: r3flow on October 17, 2012, 02:33:05 pm
Quote from: rabinath on October 17, 2012, 11:53:51 am
Thank you so much! I had to make two small changes to make it work:


-    cp "${BOOT_SRC_DIR}/imx23_linux.sb" "${OUTPUT_ROOT_DIR}/sd_mmc_bootstream.raw"
+    dd if=/dev/zero of="${OUTPUT_ROOT_DIR}/sd_mmc_bootstream.raw" bs=512 count=4
+    cat "${BOOT_SRC_DIR}/imx23_linux.sb" >> "${OUTPUT_ROOT_DIR}/sd_mmc_bootstream.raw"



Yes, it's simpler for advanced users, but the offical installation instructions already does this
http://archlinuxarm.org/platforms/armv5/olinuxino

Also the imx-bootlets-src-10.12.01/Makefile also contains this step, but commented out...