Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,731,300 Members 53,209 Now Online
XDA Developers Android and Mobile Development Forum

GUIDE: From Kernel-Sources to a boot.img (Huawei U8860) [SOLVED]

Tip us?
 
kaefert
Old
(Last edited by kaefert; 22nd March 2012 at 02:10 PM.)
#1  
kaefert's Avatar
Senior Member - OP
Thanks Meter 183
Posts: 490
Join Date: Nov 2007
Location: Vienna
Question GUIDE: From Kernel-Sources to a boot.img (Huawei U8860) [SOLVED]

EDIT: For the Guide scroll down to post number 4
http://forum.xda-developers.com/show...56&postcount=4

Hi there!

I would like to get started with building kernels for my newly bought Huawei Honour U8860

My motivation comes from the desire to have this app running on my device, which apparently needs some kernel patches to be applied, since I'm missing the devicefiles called /dev/voc* --> http://code.google.com/p/rvoix/
The Kernel patches can be found here: http://code.google.com/p/rvoix/sourc...pdragon/kernel

What I found on my own is this:
http://source.android.com/source/building-kernels.html

But I have no idea what kernel to start from, the list of devices they have over there
http://source.android.com/source/building-devices.html
have names like: "maguro, panda, wingray, crespo, passion, sapphire, dream" and I have no idea what they mean, except for those few names that are explained on the same page.

I am currently running a rooted Android 4.0.3 that I gained by following this guide:
http://forum.xda-developers.com/show...1&postcount=53

I would really apreciate any help anyone can give me! Thanks in advance

EDIT: okey!! I found a download from huawei here
http://www.huaweidevice.com/worldwid...productId=3834
Thats called: "open source-kernel-3.0.8-U8860-IcecreamSandwich"
http://www.huaweidevice.com/worldwid...oftid=NDQwNDc=
So I will try to work with this and get it build and deployed on my device. Thats gonna be a lot of work, will report back when I finished or aborted my mission frustrated.

EDIT2:
Okey, this is really a hard thing if you don't know what you're doing, like me... I think I'm gonna give up, all these config options (i stopped reading after the first 50 and just hold down the enter key for agreeing to the default), and in the end some strange errors:
..._kernel/arch/arm/include/asm/irqflags.h:11:5: warning: "__LINUX_ARM_ARCH__" is not defined
error, forbidden warning: irqflags.h:11
make[1]: *** [arch/arm/kernel/asm-offsets.s] Fehler 1
make: *** [prepare0] Fehler 2

About my initial motivation for compiling myself a kernel:
There are a lot of call recording apps, though most only record from the microphone, and therefore only record a weak shadow of the other side of the conversation.

For the moment I stick with this one:
https://play.google.com/store/apps/d...oidlab.allcall

When I tested it with a few testcalls, it seemed to me that the other side is also recorded, even though it gave me an error that it can't record the other side. However, now after a few days real usage I'm not so sure if it truely records the other side, or if this is only this shadow that comes in through the mic. It is hardly understandable in the recordings most of the times now.

So this alternative app is at least an interim solution, but I still wan't to get myself a kernel compiled, and once done try to apply or adept the kernel patches from http://code.google.com/p/rvoix/ to this kernel
2002 - Archos Jukebox Multimedia 20GB
2004 - Dell Axim X50v
2005 - Qtek S100 (HTC Magician)
2007 - E-TEN Glofiish X800
2008 - HTC Touch HD (HTC Blackstone)
2011 - HTC Wildfire (HTC Buzz)
2012 - Huawei Honor (U8860)
2013 - Sony Xperia Z (yuga)
The Following 4 Users Say Thank You to kaefert For This Useful Post: [ Click to Expand ]
 
kaefert
Old
#2  
kaefert's Avatar
Senior Member - OP
Thanks Meter 183
Posts: 490
Join Date: Nov 2007
Location: Vienna
Okey. So about building this kernel from huawei. From googling a bit I learned that this error
Code:
...arch/arm/include/asm/irqflags.h:11:5: warning: "__LINUX_ARM_ARCH__" is not defined
error, forbidden warning: irqflags.h:11
make[1]: *** [arch/arm/kernel/asm-offsets.s] Fehler 1
make: *** [prepare0] Fehler 2
stems from problems with the toolchain used for building

But first let me document a bit how I got this far:

1.) download the kernel sources from:
http://www.huaweidevice.com/worldwid...ctId=3834&tb=0

2.) get the kernel config from the device, by connecting it via usb, turning on the usb debugging on it and then using
Code:
adb pull /proc/config.gz
to fetch it. unpack it and put it into the same directory as the extracted kernel, but by the name ".config"
--> learned this one from http://mjanja.co.ke/2011/06/compilin...-huawei-u8150/

3.) Download and extract an android NDK

4.) open a terminal and set up a few environment variables:
Code:
export ARCH=arm
export SUBARCH=arm
export CROSS_COMPILE=/path_where_i_extracted/android-ndk-r7b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-
5.) simply call make. I also tried to run "make menuconfig" before running make, since a few sources stated it would be neccecary, but that didn't change the error I got.

This guy here states that 7b is not good and 5c is the way to go, but this error kept the same.
http://www.android-hilfe.de/root-hac...mpilieren.html

So I looked into ubuntu and found that there is also an arm gcc toolchain, and got it by simply installing this package:
Code:
sudo apt-get install gcc-arm-linux-gnueabi
and since the system puts its stuff all into the proper path so you can use it easily just call
Code:
export CROSS_COMPILE=arm-linux-gnueabi-
and afterwards again "make" and I got a new and different output:
Code:
  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
make[1]: »include/generated/mach-types.h« ist bereits aktualisiert.
  CC      kernel/bounds.s
  GEN     include/generated/bounds.h
  CC      arch/arm/kernel/asm-offsets.s
In file included from include/linux/irqflags.h:15:0,
                 from path_to_kernel/arch/arm/include/asm/system.h:61,
                 from path_to_kernel/arch/arm/include/asm/bitops.h:27,
                 from include/linux/bitops.h:22,
                 from include/linux/kernel.h:17,
                 from include/linux/sched.h:55,
                 from arch/arm/kernel/asm-offsets.c:13:
path_to_kernel/arch/arm/include/asm/irqflags.h:11:5: Warnung: »__LINUX_ARM_ARCH__« ist nicht definiert [-Wundef]
In file included from path_to_kernel/arch/arm/include/asm/bitops.h:27:0,
                 from include/linux/bitops.h:22,
                 from include/linux/kernel.h:17,
                 from include/linux/sched.h:55,
                 from arch/arm/kernel/asm-offsets.c:13:
path_to_kernel/arch/arm/include/asm/system.h:123:5: Warnung: »__LINUX_ARM_ARCH__« ist nicht definiert [-Wundef]
path_to_kernel/arch/arm/include/asm/system.h:129:5: Warnung: »__LINUX_ARM_ARCH__« ist nicht definiert [-Wundef]
path_to_kernel/arch/arm/include/asm/system.h:130:3: Warnung: »__LINUX_ARM_ARCH__« ist nicht definiert [-Wundef]
path_to_kernel/arch/arm/include/asm/system.h:136:5: Warnung: »__LINUX_ARM_ARCH__« ist nicht definiert [-Wundef]
path_to_kernel/arch/arm/include/asm/system.h:140:35: Warnung: »__LINUX_ARM_ARCH__« ist nicht definiert [-Wundef]
In file included from path_to_kernel/arch/arm/include/asm/bitops.h:27:0,
                 from include/linux/bitops.h:22,
                 from include/linux/kernel.h:17,
                 from include/linux/sched.h:55,
                 from arch/arm/kernel/asm-offsets.c:13:
path_to_kernel/arch/arm/include/asm/system.h: In Funktion »__xchg«:
path_to_kernel/arch/arm/include/asm/system.h:274:5: Warnung: »__LINUX_ARM_ARCH__« ist nicht definiert [-Wundef]
path_to_kernel/arch/arm/include/asm/system.h:281:5: Warnung: »__LINUX_ARM_ARCH__« ist nicht definiert [-Wundef]
In file included from path_to_kernel/arch/arm/include/asm/bitops.h:27:0,
                 from include/linux/bitops.h:22,
                 from include/linux/kernel.h:17,
                 from include/linux/sched.h:55,
                 from arch/arm/kernel/asm-offsets.c:13:
path_to_kernel/arch/arm/include/asm/system.h: Auf höchster Ebene:
path_to_kernel/arch/arm/include/asm/system.h:351:5: Warnung: »__LINUX_ARM_ARCH__« ist nicht definiert [-Wundef]
In file included from include/linux/bitops.h:22:0,
                 from include/linux/kernel.h:17,
                 from include/linux/sched.h:55,
                 from arch/arm/kernel/asm-offsets.c:13:
path_to_kernel/arch/arm/include/asm/bitops.h:217:5: Warnung: »__LINUX_ARM_ARCH__« ist nicht definiert [-Wundef]
In file included from include/linux/swab.h:6:0,
                 from include/linux/byteorder/little_endian.h:12,
                 from path_to_kernel/arch/arm/include/asm/byteorder.h:21,
                 from include/asm-generic/bitops/le.h:5,
                 from path_to_kernel/arch/arm/include/asm/bitops.h:308,
                 from include/linux/bitops.h:22,
                 from include/linux/kernel.h:17,
                 from include/linux/sched.h:55,
                 from arch/arm/kernel/asm-offsets.c:13:
path_to_kernel/arch/arm/include/asm/swab.h:25:28: Warnung: »__LINUX_ARM_ARCH__« ist nicht definiert [-Wundef]
In file included from path_to_kernel/arch/arm/include/asm/thread_info.h:16:0,
                 from include/linux/thread_info.h:53,
                 from include/linux/preempt.h:9,
                 from include/linux/spinlock.h:50,
                 from include/linux/seqlock.h:29,
                 from include/linux/time.h:8,
                 from include/linux/timex.h:56,
                 from include/linux/sched.h:57,
                 from arch/arm/kernel/asm-offsets.c:13:
path_to_kernel/arch/arm/include/asm/fpstate.h:32:5: Warnung: »__LINUX_ARM_ARCH__« ist nicht definiert [-Wundef]
In file included from include/linux/spinlock_up.h:8:0,
                 from include/linux/spinlock.h:89,
                 from include/linux/seqlock.h:29,
                 from include/linux/time.h:8,
                 from include/linux/timex.h:56,
                 from include/linux/sched.h:57,
                 from arch/arm/kernel/asm-offsets.c:13:
path_to_kernel/arch/arm/include/asm/processor.h:88:5: Warnung: »__LINUX_ARM_ARCH__« ist nicht definiert [-Wundef]
path_to_kernel/arch/arm/include/asm/processor.h:108:5: Warnung: »__LINUX_ARM_ARCH__« ist nicht definiert [-Wundef]
In file included from include/linux/spinlock.h:387:0,
                 from include/linux/seqlock.h:29,
                 from include/linux/time.h:8,
                 from include/linux/timex.h:56,
                 from include/linux/sched.h:57,
                 from arch/arm/kernel/asm-offsets.c:13:
path_to_kernel/arch/arm/include/asm/atomic.h:30:5: Warnung: »__LINUX_ARM_ARCH__« ist nicht definiert [-Wundef]
In file included from include/linux/time.h:9:0,
                 from include/linux/timex.h:56,
                 from include/linux/sched.h:57,
                 from arch/arm/kernel/asm-offsets.c:13:
include/linux/math64.h: In Funktion »div_u64_rem«:
include/linux/math64.h:51:15: Fehler: »__LINUX_ARM_ARCH__« nicht deklariert (erste Benutzung in dieser Funktion)
include/linux/math64.h:51:15: Anmerkung: jeder nicht deklarierte Bezeichner wird nur einmal für jede Funktion, in der er vorkommt, gemeldet
In file included from include/linux/mm_types.h:15:0,
                 from include/linux/sched.h:64,
                 from arch/arm/kernel/asm-offsets.c:13:
path_to_kernel/arch/arm/include/asm/page.h: Auf höchster Ebene:
path_to_kernel/arch/arm/include/asm/page.h:116:2: Fehler: #error Unknown user operations model
In file included from path_to_kernel/arch/arm/include/asm/pgtable.h:27:0,
                 from include/linux/mm.h:44,
                 from arch/arm/kernel/asm-offsets.c:14:
path_to_kernel/arch/arm/include/asm/tlbflush.h:215:2: Fehler: #error Unknown TLB model
path_to_kernel/arch/arm/include/asm/tlbflush.h:577:5: Warnung: »__LINUX_ARM_ARCH__« ist nicht definiert [-Wundef]
In file included from include/linux/mm.h:44:0,
                 from arch/arm/kernel/asm-offsets.c:14:
path_to_kernel/arch/arm/include/asm/pgtable.h:379:5: Warnung: »__LINUX_ARM_ARCH__« ist nicht definiert [-Wundef]
In file included from path_to_kernel/arch/arm/include/asm/cacheflush.h:15:0,
                 from arch/arm/kernel/asm-offsets.c:16:
path_to_kernel/arch/arm/include/asm/glue-cache.h:129:2: Fehler: #error Unknown cache maintenance model
In file included from path_to_kernel/arch/arm/include/asm/cacheflush.h:17:0,
                 from arch/arm/kernel/asm-offsets.c:16:
path_to_kernel/arch/arm/include/asm/cachetype.h:26:5: Warnung: »__LINUX_ARM_ARCH__« ist nicht definiert [-Wundef]
path_to_kernel/arch/arm/include/asm/cachetype.h:30:7: Warnung: »__LINUX_ARM_ARCH__« ist nicht definiert [-Wundef]
In file included from arch/arm/kernel/asm-offsets.c:16:0:
path_to_kernel/arch/arm/include/asm/cacheflush.h:215:7: Warnung: »__LINUX_ARM_ARCH__« ist nicht definiert [-Wundef]
path_to_kernel/arch/arm/include/asm/cacheflush.h:217:7: Warnung: »__LINUX_ARM_ARCH__« ist nicht definiert [-Wundef]
In file included from arch/arm/kernel/asm-offsets.c:17:0:
path_to_kernel/arch/arm/include/asm/glue-df.h:107:2: Fehler: #error Unknown data abort handler type
In file included from arch/arm/kernel/asm-offsets.c:18:0:
path_to_kernel/arch/arm/include/asm/glue-pf.h:54:2: Fehler: #error Unknown prefetch abort handler type
make[1]: *** [arch/arm/kernel/asm-offsets.s] Fehler 1
make: *** [prepare0] Fehler 2
But well. I also can't make a lot of meaning out of this... So still looking for help on how to get myself a kernel compiled
2002 - Archos Jukebox Multimedia 20GB
2004 - Dell Axim X50v
2005 - Qtek S100 (HTC Magician)
2007 - E-TEN Glofiish X800
2008 - HTC Touch HD (HTC Blackstone)
2011 - HTC Wildfire (HTC Buzz)
2012 - Huawei Honor (U8860)
2013 - Sony Xperia Z (yuga)
The Following 3 Users Say Thank You to kaefert For This Useful Post: [ Click to Expand ]
 
kaefert
Old
(Last edited by kaefert; 21st March 2012 at 02:39 PM.)
#3  
kaefert's Avatar
Senior Member - OP
Thanks Meter 183
Posts: 490
Join Date: Nov 2007
Location: Vienna
Okey, big progress! I found this string somewhere:
Linux version 3.0.8-perf (android@localhost) (gcc version 4.4.3 (GCC))
#1 PREEMPT Tue Mar 6 17:48:17 CST 2012

This told me, that this kernel can be built with gcc version 4.4

I looked into ubuntu, and found this version is also available in the repository. So I removed the standard version which is 4.6 and installed 4.4 --> now the kernel seems to build. I'm gonna leave the PC runnign over night and look in the morning at the results.

If someone wants to redo my steps:
the ubuntu package you need is "gcc-4.4-arm-linux-gnueabi"
be sure to remove all other arm gcc packages, and then set a link:
Code:
ln /usr/bin/arm-linux-gnueabi-gcc-4.4 /usr/bin/arm-linux-gnueabi-gcc
EDIT: so the "make" command finished without any error messages. So next step is to find out how to pack the builded kernel into a boot.img to deploy it to the device.
2002 - Archos Jukebox Multimedia 20GB
2004 - Dell Axim X50v
2005 - Qtek S100 (HTC Magician)
2007 - E-TEN Glofiish X800
2008 - HTC Touch HD (HTC Blackstone)
2011 - HTC Wildfire (HTC Buzz)
2012 - Huawei Honor (U8860)
2013 - Sony Xperia Z (yuga)
The Following 3 Users Say Thank You to kaefert For This Useful Post: [ Click to Expand ]
 
kaefert
Old
(Last edited by kaefert; 23rd March 2012 at 08:27 AM.)
#4  
kaefert's Avatar
Senior Member - OP
Thanks Meter 183
Posts: 490
Join Date: Nov 2007
Location: Vienna
Okey! So I finshed the whole process! I am now able to build and deploy the 3.0.8 kernel sources released by huawei!

I will document the steps for reproducability:

-) Install and link the arm gcc version 4.4
Code:
sudo apt-get install gcc-4.4-arm-linux-gnueabi
sudo ln /usr/bin/arm-linux-gnueabi-gcc-4.4 /usr/bin/arm-linux-gnueabi-gcc
-) Download the Kernel sources from
http://www.huaweidevice.com/worldwid...ctId=3834&tb=1

-) Unpack Kernel and cd into it.

-) Get the original Kernel config from your device like this:
Code:
adb pull /proc/config.gz
then unpack it into the Kernel directory and rename it to ".config"

If you want, you can adjust it with any texteditor, or by calling "make menuconfig" but for this you should first export the variables below so that make knows you want to build for the arm platform, not for x86

-) finally build the Kernel like this:
Code:
export ARCH=arm
export SUBARCH=arm
export CROSS_COMPILE=arm-linux-gnueabi-
make
-) I found the easiest way to deploy the built kernel is the following:
install the package abootimg
Code:
sudo apt-get install abootimg
and then make a copy of some preexisting boot.img (look at your device either with the pink screen mode or with certain custom ROMs that are not built as "production build" you can directly see the folder /.cust_backup/image

warning, this copy will be directly edited, so be sure to have another copy of the same image somewhere else.
Okey, now replace the path to your built kernel and the path to your boot.img and run:
Code:
abootimg -u path/to/bootimg/boot.img -k /path/to/kernel/arch/arm/boot/zImage
thats it, this replaces the kernel from this boot.img with your newly built kernel and can be written to folder /.cust_backup/image (be sure to keep a backup of your previous boot.img) and then reboot your device - voilà!

EDIT: This deployment method does not include deployment of kernel modules, for that you need more complex deployment methods as for example described here:
http://forum.xda-developers.com/showthread.php?t=916198

For making a custom kernel just adjust the sources between download/unpacking and building
2002 - Archos Jukebox Multimedia 20GB
2004 - Dell Axim X50v
2005 - Qtek S100 (HTC Magician)
2007 - E-TEN Glofiish X800
2008 - HTC Touch HD (HTC Blackstone)
2011 - HTC Wildfire (HTC Buzz)
2012 - Huawei Honor (U8860)
2013 - Sony Xperia Z (yuga)
The Following 5 Users Say Thank You to kaefert For This Useful Post: [ Click to Expand ]
 
Decheah
Old
(Last edited by Decheah; 26th April 2012 at 03:46 PM.)
#5  
Junior Member
Thanks Meter 0
Posts: 5
Join Date: Apr 2011
thanks for your effort mate.... good job!

a noob question, what is kernel for?? mind to explain for me??? I've flash to MIUI 4.03, rooted, overclocked, but except kernel. any difference?
 
SiL3nTKiLL
Old
#6  
Senior Member
Thanks Meter 67
Posts: 1,929
Join Date: Jun 2006
thanks for the guide!
Phones:
1. Galaxy S2 Skyrocket
2. iPhone 4S
Tabs:
Apple iPad 2
Galaxy Tab 10.1

 
kaefert
Old
#7  
kaefert's Avatar
Senior Member - OP
Thanks Meter 183
Posts: 490
Join Date: Nov 2007
Location: Vienna
Quote:
Originally Posted by SiL3nTKiLL View Post
thanks for the guide!
you're welcome. But please for the future, if you don't have anything to add but to thank some poster before you for his post, use the thanks button instead of posting a reply!
2002 - Archos Jukebox Multimedia 20GB
2004 - Dell Axim X50v
2005 - Qtek S100 (HTC Magician)
2007 - E-TEN Glofiish X800
2008 - HTC Touch HD (HTC Blackstone)
2011 - HTC Wildfire (HTC Buzz)
2012 - Huawei Honor (U8860)
2013 - Sony Xperia Z (yuga)
The Following User Says Thank You to kaefert For This Useful Post: [ Click to Expand ]
 
kaefert
Old
#8  
kaefert's Avatar
Senior Member - OP
Thanks Meter 183
Posts: 490
Join Date: Nov 2007
Location: Vienna
Quote:
Originally Posted by Decheah View Post
thanks for your effort mate.... good job!

a noob question, what is kernel for?? mind to explain for me??? I've flash to MIUI 4.03, rooted, overclocked, but except kernel. any difference?
Well.. its the inner core of a linux operating system, such as android. originally linux = the kernel, but since people are lazy whole distros are for simplification just called linux.
2002 - Archos Jukebox Multimedia 20GB
2004 - Dell Axim X50v
2005 - Qtek S100 (HTC Magician)
2007 - E-TEN Glofiish X800
2008 - HTC Touch HD (HTC Blackstone)
2011 - HTC Wildfire (HTC Buzz)
2012 - Huawei Honor (U8860)
2013 - Sony Xperia Z (yuga)
The Following User Says Thank You to kaefert For This Useful Post: [ Click to Expand ]
 
yoda89
Old
#9  
Junior Member
Thanks Meter 0
Posts: 1
Join Date: Mar 2010
Hi kaefert,

I'd like to work on the U8860's kernel but I don't have the .config file.
Could you give me the config.gz file please ?

Thanks
 
kaefert
Old
#10  
kaefert's Avatar
Senior Member - OP
Thanks Meter 183
Posts: 490
Join Date: Nov 2007
Location: Vienna
Quote:
Originally Posted by yoda89 View Post
Hi kaefert,

I'd like to work on the U8860's kernel but I don't have the .config file.
Could you give me the config.gz file please ?

Thanks
sure, no problem. This one I took right now from my miui 2.5.4 installation.
Attached Files
File Type: gz config.gz - [Click for QR Code] (19.0 KB, 101 views)
2002 - Archos Jukebox Multimedia 20GB
2004 - Dell Axim X50v
2005 - Qtek S100 (HTC Magician)
2007 - E-TEN Glofiish X800
2008 - HTC Touch HD (HTC Blackstone)
2011 - HTC Wildfire (HTC Buzz)
2012 - Huawei Honor (U8860)
2013 - Sony Xperia Z (yuga)

The Following User Says Thank You to kaefert For This Useful Post: [ Click to Expand ]
Tags
call recording, kernel, rvoix
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes