I'm having trouble building the Thumb2 kernel on, I actually believe this same code worked some time ago before a toolchain update. There are actually two problems described below. I get past the first with a config change but don't know how to fix the second one.
Start with mx51_defconfig, it builds uImage fine:
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- mx51_defconfig $ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage
Save the working .config to config1
$ cp .config config1
Edit .config and remove this line then run make oldconfig. $ CONFIG_THUMB2_KERNEL is not set
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- oldconfig
Answer y to THUMB2_KERNEL and THUMB2_AVOID_R_ARM_THM_JUMP11 Save new Thumb2 enabled config to config2 Here is the diff:
$ diff -u config1 config2 --- config1 2011-08-21 14:50:23.014654705 -0600 +++ config2 2011-08-21 14:51:13.164654727 -0600 @@ -339,9 +339,10 @@ CONFIG_PREEMPT_VOLUNTARY=y # CONFIG_PREEMPT is not set CONFIG_HZ=100 -# CONFIG_THUMB2_KERNEL is not set +CONFIG_THUMB2_KERNEL=y +CONFIG_THUMB2_AVOID_R_ARM_THM_JUMP11=y +CONFIG_ARM_ASM_UNIFIED=y CONFIG_AEABI=y -# CONFIG_OABI_COMPAT is not set # CONFIG_ARCH_SPARSEMEM_DEFAULT is not set # CONFIG_ARCH_SELECT_MEMORY_MODEL is not set CONFIG_HAVE_ARCH_PFN_VALID=y @@ -1417,7 +1418,6 @@ # CONFIG_DEBUG_SG is not set # CONFIG_DEBUG_NOTIFIERS is not set # CONFIG_DEBUG_CREDENTIALS is not set -CONFIG_FRAME_POINTER=y # CONFIG_BOOT_PRINTK_DELAY is not set # CONFIG_RCU_TORTURE_TEST is not set # CONFIG_BACKTRACE_SELF_TEST is not set @@ -1429,7 +1429,6 @@ # CONFIG_SYSCTL_SYSCALL_CHECK is not set # CONFIG_DEBUG_PAGEALLOC is not set CONFIG_HAVE_FUNCTION_TRACER=y -CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y CONFIG_HAVE_DYNAMIC_FTRACE=y CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y CONFIG_HAVE_C_RECORDMCOUNT=y
Attempt to build this:
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage
...
LD init/built-in.o LD .tmp_vmlinux1 arch/arm/kernel/built-in.o: In function `get_wchan': early_printk.c:(.text+0x1400): undefined reference to `unwind_frame' arch/arm/kernel/built-in.o: In function `walk_stackframe': early_printk.c:(.text+0x2832): undefined reference to `unwind_frame' make: *** [.tmp_vmlinux1] Error 1
Poke around a bit and it looks like setting ARM_UNWIND could make difference so try that. Edit .config the remove # CONFIG_ARM_UNWIND is not set then run make old config again.
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- oldconfig
Call the result config3
$ cp .config config3
So here is the cumulative diff
$ diff -u config1 config3 --- config1 2011-08-21 14:50:23.014654705 -0600 +++ config3 2011-08-21 14:54:29.584654811 -0600 @@ -339,9 +339,10 @@ CONFIG_PREEMPT_VOLUNTARY=y # CONFIG_PREEMPT is not set CONFIG_HZ=100 -# CONFIG_THUMB2_KERNEL is not set +CONFIG_THUMB2_KERNEL=y +CONFIG_THUMB2_AVOID_R_ARM_THM_JUMP11=y +CONFIG_ARM_ASM_UNIFIED=y CONFIG_AEABI=y -# CONFIG_OABI_COMPAT is not set # CONFIG_ARCH_SPARSEMEM_DEFAULT is not set # CONFIG_ARCH_SELECT_MEMORY_MODEL is not set CONFIG_HAVE_ARCH_PFN_VALID=y @@ -1417,7 +1418,6 @@ # CONFIG_DEBUG_SG is not set # CONFIG_DEBUG_NOTIFIERS is not set # CONFIG_DEBUG_CREDENTIALS is not set -CONFIG_FRAME_POINTER=y # CONFIG_BOOT_PRINTK_DELAY is not set # CONFIG_RCU_TORTURE_TEST is not set # CONFIG_BACKTRACE_SELF_TEST is not set @@ -1429,7 +1429,6 @@ # CONFIG_SYSCTL_SYSCALL_CHECK is not set # CONFIG_DEBUG_PAGEALLOC is not set CONFIG_HAVE_FUNCTION_TRACER=y -CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y CONFIG_HAVE_DYNAMIC_FTRACE=y CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y CONFIG_HAVE_C_RECORDMCOUNT=y @@ -1443,7 +1442,7 @@ # CONFIG_KGDB is not set # CONFIG_TEST_KSTRTOX is not set # CONFIG_STRICT_DEVMEM is not set -# CONFIG_ARM_UNWIND is not set +CONFIG_ARM_UNWIND=y # CONFIG_DEBUG_USER is not set CONFIG_DEBUG_LL=y CONFIG_EARLY_PRINTK=y
Try building again.
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage
...
LD vmlinux SYSMAP System.map SYSMAP .tmp_System.map OBJCOPY arch/arm/boot/Image Kernel: arch/arm/boot/Image is ready AS arch/arm/boot/compressed/head.o arch/arm/boot/compressed/head.S: Assembler messages: arch/arm/boot/compressed/head.S:127: Error: selected processor does not support requested special purpose register -- `mrs r2,cpsr' arch/arm/boot/compressed/head.S:134: Error: selected processor does not support requested special purpose register -- `mrs r2,cpsr' arch/arm/boot/compressed/head.S:136: Error: selected processor does not support requested special purpose register -- `msr cpsr_c,r2' make[2]: *** [arch/arm/boot/compressed/head.o] Error 1 make[1]: *** [arch/arm/boot/compressed/vmlinux] Error 2 make: *** [uImage] Error 2
Here is my gcc version:
$ arm-linux-gnueabi-gcc --version arm-linux-gnueabi-gcc (Ubuntu/Linaro 4.6.1-5ubuntu2~ppa1) 4.6.1 Copyright (C) 2011 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
And as version: GNU assembler (GNU Binutils for Ubuntu) 2.21.52.20110707 Copyright 2011 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License version 3 or later. This program has absolutely no warranty. This assembler was configured for a target of `arm-linux-gnueabi'.
Three configs attached:
config1 -- original config from make mx51_defconfig config2 -- config after turning on thumb2 config3 -- config after setting ARM_UNWIND
Any help would be appreciated.
Thanks John