Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

I am on Ubuntu Server 12.04 x86_64 and I need to build Android CyanogenMod 7.2 kernel module. My phone has custom ROM and a patched kernel:

adb shell cat /proc/version


Linux version (subbotin@avs234) (gcc version 4.4.0 (GCC) ) #2 PREEMPT Sun Mar 13 14:55:50 MSK 2011

I have this variable setup in addition to toolchain variables etc.

export LOCALVERSION="-cyanogenmod-gf3345ef-dirty (subbotin@avs234)"

When I run make (note that on Ubuntu bash is dash) I get the following:

CHK    include/linux/version.h
/bin/sh: 1: Syntax error: "(" unexpected (expecting ")")
make: ***[include/generated/utsrelease.h] Error 2

However, if I remove "(subbotin@avs234)" the kernel compiles just fine. I need a full vermagic string since I suspect that this kernel module wouldn't load because of difference in the version string. What is the problem with parentheses?

A more detailed description: The device is HTC Desire (bravo) GSM and the application is EDS Lite ( I partially followed this and this is a kernel module compilation guide In the latter link it is mentioned that vermagic string should probably match completely. When I try to load this module from the application mount menu I get 'failed loading kernel module'

#get repo tool
mkdir -p ~/bin 
curl > ~/bin/repo 
chmod a+x ~/bin/repo 

#clone repo for cm-kernel
mkdir -p ~/Android/kernel 
cd ~/Android/kernel 
git clone git:// 
cd cm-kernel

#pull the kernel configuration from the device
#my config file is here:
adb pull /proc/config.gz ~/Android/kernel/cm-kernel
cd ~/Android/kernel/cm-kernel
gunzip config.gz
sed 's/CONFIG_LOCALVERSION\([[:alnum:][:punct:]]\)*//' config > .config
cp config .config

#toolchain from (sdk tools)

export CROSS_COMPILE=~/Android/Toolchain/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-
export CCOMPILER=~/Android/Toolchain/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-
export ARCH=arm
export SUBARCH=arm
export LOCALVERSION="-cyanogenmod-gf3345ef-dirty (subbotin@avs234)"
make oldconfig

#Answer "no" CONFIG_LOCALVERSION_AUTO (the second prompt) request.

#download EDS kernel module src
#extract to ~/Android/km
cd ~/km
make -C ~/Android/kernel/cm-kernel\
 ARCH=arm CROSS_COMPILE=~/Android/Toolchain/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-\
 SUBDIRS=~/Android/km modules

#if LOCALVERSION="-cyanogenmod-gf3345ef-dirty" then vermagic string is as in the following
modinfo eds.ko
vermagic: preempt mod_unload ARMv7 

upd: just noticed that the stable version of currently installed kernel (which is 3) is not equal to the built kernel stable version (6). Not sure if they are compatible - maybe the problem is with installed kernel version string after all?

share|improve this question
There are probably missing quote marks somewhere in the build scripts. Please link to the source archive or repository that you downloaded and tell us exactly what environment variables you set and what commands you ran. – Gilles Jul 19 '13 at 23:51
Minor correction: bash is always bash, but sh is linked to dash, whereas on some systems (including older Ubuntu) it is a link to bash. For what it's worth, invoking bash as sh disables many bashisms, albeit not all of them. – tripleee Jul 20 '13 at 16:25

1 Answer 1

up vote 0 down vote accepted

However, if I remove "(subbotin@avs234)" the kernel compiles just fine.

You don't need this in the LOCALVERSION. "subbotin@avs234" is just the one that compiled the kernel (user@host). It's not part of the version string nor needed for anything related to the compilation of the kernel.

share|improve this answer
Marking this as an answer since I gave up trying to do what I intended back when I created the question and because this answers the original question about parentheses. – Dmitry Jul 6 '14 at 9:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.