Building ArchLinux kernel with cross toolchain

Started by r3flow, October 01, 2012, 09:05:36 PM

Previous topic - Next topic

r3flow

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 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.

dingbatca

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#


dingbatca

Thanks, that fixed it!

Odd ball question: Difference between imx-bootlets-src-10.05.02 and 10.12.01?

rabinath

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?

r3flow

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...

r3flow

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...