0

I'm compiling a nexus one android kernel from source as found on HTCs developer website. I've obtained an ARM tool chain by DLing the android NDK from the android dev site. I am able to run make clean and make defconfig without incident, but when I run make, it only gets so fare before running into compiler errors.

Currently i see the following:

$MY_DIR/nexus_one/arch/arm/include/asm/glue.h:156:29: error: '#' is not followed by a macro parameter

The offending line is:

1  /*
2  * Instruction Fault Status Register.  (New register as of ARMv6)
3  * If processor has IFSR then set value, else set translation fault
4  */
5 #if defined(CONFIG_CPU_ABRT_EV7) || defined(CONFIG_CPU_ABRT_EV6)
6 # define CPU_PABORT_IFSR(reg)    mrc p15, 0, reg, cr5, cr0, 1         @asm macro;
7 #else
8 # define CPU_PABORT_IFSR(reg)    mov reg, #5                          @asm macro;
9 #endif

Specifically, line 8 above is what hoses the compiler. Apparently you can't have that second # sign, but i'm not really sure whats going on in this code, and it looks pretty important so i don't want to touch it.

I'm guessing i'm compiling with the wrong tool chain maybe? Or perhaps i have configured things wrong somehow? Does any one have any idea what this is all about?

thanks, brian

Brian Sweeney
  • 6,693
  • 14
  • 54
  • 69
  • fyi, i've tried this now with like 4 different tool chains, so i'm starting to think that the specific cross-compiler is not the issue. i'm not sure what else to look at though. – Brian Sweeney Jun 16 '11 at 22:22

2 Answers2

1

I strongly recommend you to use CodeSourcery toolchain for Linux for compiling Linux kernel.

Kazuki Sakamoto
  • 13,929
  • 2
  • 34
  • 96
  • that was the first one i triedi *think*. i'll try again and see if it makes a difference. thanks! – Brian Sweeney Jun 17 '11 at 15:16
  • just curious; what in particular makes you recommend this toolchain? – Brian Sweeney Jun 17 '11 at 15:17
  • 1
    so i had previously tried a similar but distinct toolchain from codesourcery and have seen the same error now in both cases (plus with the ndk toolchain). so i guess the issue must be something else. – Brian Sweeney Jun 17 '11 at 16:04
1

Turns out it was nothing to do with the specific toolchain. The # sign needed 'escaping' of some sort. The solution was as follows:

/* this is needed to get the mov reg, 5 macro to compile and function correctly */
#define hash_hackery #
#define f(x) x

#if defined(CONFIG_CPU_ABRT_EV7) || defined(CONFIG_CPU_ABRT_EV6)
# define CPU_PABORT_IFSR(reg)   mrc p15, 0, reg, cr5, cr0, 1         @asm macro;
#else
# define CPU_PABORT_IFSR(reg)   mov reg, f(hash_hackery)5            @asm macro;
#endif

This post was very informative in finding the answer.

Community
  • 1
  • 1
Brian Sweeney
  • 6,693
  • 14
  • 54
  • 69