Compiling custom kernels for the Huawei U8150

Last week I talked about my frustration with booting kernels I had personally compiled for my Huawei U8150. Now that I have figured it out, I wanted to document the process so other people can follow along (and let the hoardes of Kenyan hackers take control of their devices!).


Get (and unpack) these first and then we’ll talk!

Setup (kidogo tu)…

To make sure your Linux user has permission to manipulate the device when we plug it in. udev is a daemon which runs in the background detecting devices and performing various tasks depending on certain hardware events. Create the following file with contents as shown below, then plug your IDEOS in, we’re almost ready to rock.

# Huawei IDEOS in bootloader mode
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="d00d", MODE="0666"
# Huawei IDEOS in adb mode
SUBSYSTEM=="usb", ATTR{idVendor}=="12d1", ATTR{idProduct}=="1038", MODE="0666"

And install a few packages into your Linux environment. If you’re on a Debian-based Linux distribution (like Ubuntu), the build-essential and git-core packages should suffice. Otherwise, you’ll have to search around to see which packages provide the GNU Compiler Collection (GCC), make, and git.

sudo apt-get install build-essential git-core

May the source be with you…

Get a copy of the Linux kernel sources used in Huawei’s Froyo Android builds (~80-90 megabytes). As part of Huawei’s GPL obligation they are required to make public the changes to the Linux kernel. I’ve mirrored and tweaked them on my github account to make hacking and sharing easier:

git clone git://
cd kernel_huawei_u8150

Configure the kernel…

The Linux kernel has been around since 1991, and in that time a LOT has changed. There are thousands of configuration options possible, each of which represent support for dozens of different hardware platforms. Kernel configuration, while once a straight-forward task, is now a driven by a menu-based, quasi-graphical system, into which we can feed existing configuration files. For now we’ll just get a config from your device:

~/src/adb pull /proc/config.gz
gunzip config.gz
mv config U8150-Safaricom.config

Renaming the config to U8150-Safaricom.config isn’t necessary, but it’s a good idea to save a copy of the config with a meaningful name so you can reference it later. Now, make another copy for the kernel’s compilation utilities (by default it looks for a file in the current directory called .config):

cp U8150-Safaricom.config .config

Twende kazi…

Now we move to building the kernel using the make command. Pay careful attention to the value of the CROSS_COMPILE variable below, as it points to the location where you unpacked the Android NDK (you did download it, right?). This variable tells the build process to “cross” compile the Linux kernel; that is, compile for an architecture other than the one we’re running on. Embedded devices like phones often run on ARM processors, while most desktop machines these days run on x86.

ARCH=arm CROSS_COMPILE=/home/aorth/src/android-ndk-r5b/toolchains/arm-eabi-4.4.0/prebuilt/linux-x86/bin/arm-eabi- make

Create the boot image…

If your kernel compile was successful you can move on to creating a boot image. The boot image is comprised of two pieces: the kernel and the ramdisk. The ramdisk is a whole nother ball game, so I’ve included a default, unmodified one in the kernel source tree for you to use. Use the mkbootimg-U8150 tool to glue the kernel and ramdisk together (along with some other settings).

./release/mkbootfs release/boot.img-ramdisk | gzip > release/boot.img-ramdisk.gz
./release/mkbootimg-U8150 --cmdline 'mem=211M console=ttyMSM2,115200n8 androidboot.hardware=huawei console=ttyUSBCONSOLE0 \
androidboot.console=ttyUSBCONSOLE0' --kernel arch/arm/boot/zImage --ramdisk release/boot.img-ramdisk.gz -o release/boot.img

The output should be located in the release folder; just do a quick sanity check to make sure it’s not empty (or non existent). For example, mine shows a size of 2797568:

ls -l release/boot.img
-rw-r--r-- 1 aorth aorth 2797568 2011-06-29 00:30 release/boot.img

Flash the boot image…

Now you need to reboot your phone into bootloader mode. First, unplug it and power it off. Once the device is properly shut down, hold down the following keys: Power, Volume Down, and Red Key. The phone should vibrate, and then start up to the IDEOS screen. plug it back in, and wow you’re ready to flash…

~/src/fastboot flash boot release/boot.img
~/src/fastboot reboot


Here’s what you should see if your phone boots up… if it doesn’t boot, leave a message in the comment and I’ll sort you out!


Some questions, food for thought, things to write about later:

  • How can we automate the build process?
  • For reference, the Kenyan ROM I pulled my config from was V100R001C18B842
  • The Kenyan ROM has multi-touch gesture support if your touchscreen hardware supports it, but the kernel generated by this compilation no longer does… why?
  • If you’re having fun, why not fork my Huawei U8150 kernel repository on github? πŸ™‚

48 thoughts on “Compiling custom kernels for the Huawei U8150

  1. Nice writeup Alan, followed your steps and managed to get the Kernel up and running. Will be checking now and then on your blog to pick your brain for U8150 πŸ™‚


    1. Awesome, dude, that’s great to hear! I have some stuff in the works for sure… nothing revolutionary, but documentation about root, kernels, init scripts, etc. For fun (others can profit, but I’m only interested in the fun part ;)!

  2. hey i have my ideos u8150 and i want to enable multitouch, a i followed a bit and managed to see that its synaptic. i also downloaded the files but the other part of the instructions i wasn’t able to clearly follow it up. so was wondering is it possible you clarify for me how to run those settings when i have rebooted?

    1. Hey, jj, which part exactly were you lost at? Did you get all the tools unzipped somewhere, like in your Download folder?

      1. hey your still fresh in campus btw i have great intrests in programming.need your help.where do i start from especially programming an android it’s kernel.the way you are doing.

        1. Start by learning about Linux. Android’s kernel is Linux, just like Ubuntu or Debian or Fedora. This is systems development, not really programming. This type of stuff is more about kernel vs userland, boot environment, embedded systems, etc. If you’re not running Linux on your desktop, erase Windows and do it now. Also, start a blog to write about your experiences, it will help you refine your writing skills, as well as express what you learn (which is harder than you think).

  3. yea alan i downloaded all of them. i even tried to to put my fon in reboot mode but then running that “~/src/fastboot flash boot noma_20110711v26_boot.img” has proved to be rather hard for me. i just cant seem to get how it is done

    1. Hehe, you’re close. First, where did you download and unzip “fastboot” to? The “~/src/fastboot” is the location where fastboot lives on MY computer (“~” is a shortcut for “home”, wherever that may be for your Linux user, such as: /home/aorth/). Second, which file are you trying to flash? If the file you downloaded is noma_20110903v83_boot.img, then it doesn’t make much sense to flash the 20110711v26 one!

  4. Hey buddy..

    I want to know how exactly i could upgrade my android 2.2 version on my ideos u8150 phone.

    I rooted it with z4root and it worked well making the phone faster.

    1. Hey, dude… first, define “upgrade” :). You can upgrade kernels, apps, “ROMs”… heheh. In this post I was showing how to compile custom kernels (the kernel is the part of the OS which sits in between the hardware and the applications, it’s an abstraction of sorts). Re read this post with that in mind, or check out my custom “noma” kernel here: Noma – experimental Froyo hotness. There are files you can flash directly to your phone in that message board.

      If you just want to upgrade from Froyo (Android 2.2.x) to Gingerbread (2.3.x) you’re pretty much out of luck. Huawei hasn’t released Gingerbread for this device… but there’s a community-driven effort to port the AOSP Gingerbread sources to U8150 by way of CyanogenMod. See here for more information:

  5. kali! kali !!!!!! cheki, thnx nyway, si now try adding support for loop devices on the kernel….jus wanted to run linux debian (ubuntu) on mine.. pliz reply if u can

    1. Hmmm, loop device support. So you’d need both the kernel module as well as the userland utilities to manipulate them (losetup?), or is mount enough?

  6. Alan, Excellent post which cleared many things for me (being very noob).
    I followed the compilation path and found a (new) zImage in arch/arm/boot.
    However running the adding the ramdisk step I received the following error:
    error: could not load ramdisk ‘release/boot.img-ramdisk.cpio.gz’

    There is no boot.img-ramdisk.cpio.gz in the git clone I made.
    The command I ran is :
    release/mkbootimg-U8150 –cmdline ‘mem=211M console=ttyMSM2,115200n8 androidboot.hardware=huawei console=ttyUSBCONSOLE0 androidboot.console=ttyUSBCONSOLE0’ –kernel arch/arm/boot/zImage –ramdisk release/boot.img-ramdisk.cpio.gz -o release/boot.img

    Any idea what went wrong ?


    1. Awesome, glad you made it that far! You’re totally right, when I wrote this post everything was working, but then I updated my kernel repository to be MOAR AWESOME!!!1… and some stuff changed. Now the release folder has an unzipped ramdisk, which you must zip manually! I’ve update the instructions to include that step. πŸ™‚

  7. Alan thanks for the new instructions.
    Now I received the boot.img and I’ll try to flash it later,

    I do have a clarification request and question:

    The command that is packing the ramdisk and Zimage to image.boot is using a RAM disk file that has a .cpio.gz suffix while the previous command does produce only a .gz file . – this needs to be clarified.

    My questions : Does mkbootfs cpio the boot.img-ramdisk directory ?
    and then does mkbootimg-U8150 cpio both zImage and boot.img-ramdisk.gz?

    Thanks again for really excellent post.


  8. Hi Allan,
    I have seen an article on how to use a serial port on G1 phone, i need to have a kernel with the Linux serial drivers enabled on Huawei U8150 to do the same. I want to use the google serial port API ( to make an app for communicating with my micro-controller custom hardware board. I already have the micro-controller board communicating both ways with a PC and made the serial cable for the phone, such that the phone can even charge from my custom board.

    There is an instructible:

    I picked this up:

    I installed the gingerman v7 rom on the ideos but the google api isnt working, cant open the port. how do i compile a kernel so that it has the native serial drivers enabled?

    from the phones terminal, i can see the ttyMSM2 entry in /dev and had done chmod 777 /dev/ttyMSM2. any help or comment will be highly appreciated.

    1. Hey, that sounds pretty cool. I’m actually not sure what you’d need to enable. So you want to read/write to a serial port from your app. This would be serial over USB, yeah?

      1. yeah, Serial over USB.

        Check the last two comments at this page
        The comments suggest that some configurations should be enabled/disabled for the app to access(rw) the port through the system/kernel:


        & also:

        probably set to “=y” or “=n” for yes or no……

        1. Good news and bad news, those kernel config options are in the kernel, but don’t compile. Hmmm…

          CC drivers/serial/msm_serial_debugger.o
          drivers/serial/msm_serial_debugger.c: In function 'dump_irqs':
          drivers/serial/msm_serial_debugger.c:214:28: error: 'struct kernel_stat' has no member named 'irqs'
          drivers/serial/msm_serial_debugger.c:216:3: error: 'struct kernel_stat' has no member named 'irqs'
          drivers/serial/msm_serial_debugger.c:216:3: error: 'struct kernel_stat' has no member named 'irqs'
          drivers/serial/msm_serial_debugger.c:221:30: error: 'struct kernel_stat' has no member named 'irqs'
          make[2]: *** [drivers/serial/msm_serial_debugger.o] Error 1
          make[1]: *** [drivers/serial] Error 2
          make[1]: *** Waiting for unfinished jobs....

          I’ll try to debug later when I get some more time. Have you tried compiling the kernel? I could help you if you’re not sure how?

  9. First i would like to say thanks a lot man, you’re the first one to give me some hope in this.

    dump_irqs could be a function written for dumping the kernel status if hardware fails, seems like it tries to extract interrupts info from the kernel but from a struct entry that doesnt exist…could be the interrupt entry is a different name in the kernel… am not an expert in linux.
    anyway, am actually not sure how to compile the kernel, will need all the help i can get, even if its just a link to some of your already existing guides. If it takes long to copy the sources its fine, i can leave my machine on, i got stable unlimited internet at home.

    Again, thanks.

  10. i figured out that on cloning the source, the line

    git clone git://

    had to change to:

    git clone

    after exporting proxy environmental variables since i am working behind a proxy server.

    i checked and in the file kernel_huawei_u8150/include/linux/kernel_stat.h there’s this code for the struct in question:

    struct kernel_stat {
    struct cpu_usage_stat cpustat;
    unsigned int irqs[NR_IRQS];
    unsigned int softirqs[NR_SOFTIRQS];

    so is the error misleading?

    i commented out the for loop making use of this struct in the “drivers/serial/msm_serial_debuger.c” file and it compiled successfully.
    i don’t think that’d be a good idea…seems like we need to move kstat_irqs array to irq_desc struct. saw that here:;a=commit;h=dee4102a9a5882b4f7d5cc165ba29e8cc63cf92e

    On another note, i had already flashed to clockwork recovery, i have dronix on my Huawei U8150. how do i flash the boot.img? in clockwork recovery mode, i can only install a zip from sd, right? tried fastboot but says ‘waiting for device’ even though my device is connected and in recovery mode. Looking forward to some advice.

    Ujanja wangu umefika hapo msee…

    1. Hmmm, yeah, cloning over HTTP might be more reliable for a lot of people. I guess git:// TCP 9418, which is most definitely not open in most whitelist-style firewalls. Glad you got it cloned, though.

      About the code… wow, that commit is a good find. Having a second look at it I noticed that the kernel_stat struct only defines irq if CONFIG_GENERIC_HARDIRQS is set. I checked the kernel config (search with “/” in ARCH=arm menuconfig) and that config option doesn’t even exist so I just changed include/linux/kernel_stat.h to read:

      struct kernel_stat {
          struct cpu_usage_stat   cpustat;
          unsigned int irqs[NR_IRQS];
          unsigned int softirqs[NR_SOFTIRQS];

      It compiles and boots on my U8150 running a CM7 nightly build, but I don’t know how to use it, so give it a try and let me know!

      Regarding fastboot, you might need to add some permissions to /etc/udev/rules.d/60-android.rules (or similar) so your user has write permission to the device node. Try fastboot as root and if that works then that’s your problem.

  11. Hey, progress, was able to restore to safaricom stockrom, cant get the phone into bootloader mode, exactly what am i supposed to see on the screen at this point:

    “Once the device is properly shut down, hold down the following keys: Power, Volume Down, and Red Key. The phone should vibrate, and then start up to the IDEOS screen. plug it back in, and wow you’re ready to flash…”

    i get the IDEOS wording on the screen but “fastboot devices” lists null. i was able to use adb commands so this is nothing to do with udev rules-fixed ’em. the phone was rooted using z4root

    1. The device has different product IDs when in different USB modes. Check to make sure you have proper udev rules for the device when it’s in fastboot mode (lsusb | grep Huawei)!

      Or… try as root. :(!

  12. different product id’s thank you….Bingo!!! Root never worked, was making one blander still,i rectified it by placing fastboot binary in the /tools folder of the sdk and worked just like adb, managed to boot my custom kernel at last., feels very nice. am proud of you. i have actually learnt a lot in the process, but there’s a lot to learn on kernel compile options like schedulers and stuff. Am now working on the android app, will let you know if it works.

    1. Awesome, dude. That’s why I write this stuff on the Internet after I learn it… hehe. Keep me posted on your app, I’m curious about the serial stuff…

  13. Thanks for this great post, Alan, it helps a lot for me also trying to compile the kernel for C8650 for me. A question is that where did you originally find the kernel source of Huawei? Thanks!

    1. Glad it helped, Ryan. The source for the kernel comes from Huawei’s open-source release center (as part of the requirements of the GPL)… last time I looked the source link didn’t work any more. πŸ™

  14. Hi mjanja.
    seeems like my joy was short lived, but i found a patch “morfes-kernel_ideos_usb_host” on github. it has everything : the patch for the input devices. Very stable now. Am too busy at work and studies to make a post. hope someone will be able to use this source. I should mention, the ADB mode is not available in the usb_host kernel and you cannot mount the sdcard by simply plugging into another usb host PC(makes sense). You actually need an externally powered usb bus coz the phone cannot power the bus. I got a dual usb connector off an old PC motherboard in the lab, yap, that worked for me. My blog will be up in two days, will post there.

    Here’s the github link:

  15. How would one go about increasing overclock frequencies? I have a kernel my brother gave me to work on and he wants me to increase his overclock frequency, because he noticed that in the acpu-clock-7×30.c that it looks as though it would possibly get up to 804000khz.

    1. If it asks you to set values it’s because there are kernel config options in your kernel source which AREN’T in your .config. If your device is based on a different major version of the kernel source then these can be quite many (2.6.32 -> 2.6.33) is a major version increase.

      What device are you using, and what kernel is it running?

  16. One question though:

    How do you get to brand the kernel, i.e in your case, aorth@iko?

    I’d assume the build system uses the combination of your username and hostname as username@hostname but….I have been wrong before.

    1. You’re right. My system at that time was called “iko” hahah. The kernel build scripts grab the username and host who built it. πŸ™‚

  17. I just got back at compiling a kernel for u8150 after a while, am stuck somewhere am not supposed to be…am not sure whats supposed to happen after I run the command
    ./release/mkbootimg-U8150 –cmdline ‘mem=211M console=ttyMSM2,115200n8 androidboot.hardware=huawei console=ttyUSBCONSOLE0 androidboot
    but the terminal sits there like its waiting for input..
    I guess nime-rust tu sana after physics exams, please help me out kiasi.

  18. Thanks for the guide.
    I successfully compiled the kernel for Huawei U8818 device.
    I also added the new product directory tree for Huawei.
    I successfully compiled the source code using make -j4 command.
    But when I use command make -j4 otapackage to make an ota package.It gives me an error “NO recovery.fstab found For the TARGET DEVICE”.
    How to solve this issue.
    Please help I am googling for almost 15 days but no significant help.
    Looking forward to here from You.

    1. Hmm, is the “no recovery.fstab” error fatal (ie, does the build continue)? Just give it a recovery.fstab from a stock ROM. Hell, you could probably just create a blank file in your device tree just to make the build system happy!

  19. Pingback: USB host mode serial on huawei u8150 in python using pyserial
  20. Hi there, AWESOME WORK!!.Really great.
    I have a u8150 running ICSIdeos2 which seems to be based on CM7 for ideos. So im into customizing things and and i’ve really perspnalized alot of this rom save for one thing “initlogo.rle”- the bootlogo inside boot.img
    Everytime i try to use my own custom logo, i repack the boot image succesfully and phone boots up but consequently i lose all my radio functions (wifi, phone bluetooth etc)
    What could be the problem?
    Could you have a solution.
    Thank’s alot

    1. Hi ,
      That sounds like music in my ears !I have tried to Flash ICS on mine with countless failure .What is the location of the ROM you used?

  21. Hello Alan,

    Used the same instructions (slightly modified) to compile a custom kernel for a ZTE Blade and a Huawei U8150.
    Notes for these who get stuck:

    1. You must create an udev rule for your device before you can flash it. Alan has explained it all above.(And in a post in reply to Karibe)
    2. The adb and fastboot programs are 32-bit ELF binaries:
    Running file ~/bin/adb (Where I downloaded ADB) returns:

    /home/lin/bin/adb: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.8, not stripped

    Same applies to fastboot:

    /home/lin/bin/fastboot: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.2.0, not stripped

    This implies that if you’re on a 64-bit Linux, you’ll need to install the 32-bit multiarch libraries (ia32-libs on Ubuntu) BEFORE you can execute these programs.

    Happy hacking, dudes.
    Back to lulz.



  22. Can’t bliv i had to do this all over again to return the phone from usb host mode in order to sell it :D, old is gold, great source and guide!!!

  23. Hi Mjanja,
    Happened to format system,boot and recovery and later tried to restore an old backup using an updated version of cwm and failed!Now its frozen on ideos screen and it cant load.Ive successfully istalled ultrajack though.I still have the old clockworkmod backup files.Is it possible to use ultrajack to install a newer Rom ( where can I download them?)or Restore the old backup? Kindly help bana nimesota.

  24. hi Allan! I have huawei ideos u8150 but the problems are that;
    1. I can’t access my SD card via a PC coz it keeps displaying “USB device not recognized” whenever I connect.
    2. A number of times trying to send messages they keep bouncing back.
    3. When on a voice call the recipient can’t hear me clearly (voice so low even if I shout). could this be a hardware problem?
    4. I do have sudden end of calls when on air.

    I’ll appreciate assistance on these pliz!

Comments are closed.