Sunday, January 31, 2010

Linux on HD2 source code (so far)

Just a small update. I managed to get a git up a few days ago on and today I've managed to tidy up and commit the code that I have so far to this git.

I also planned on making a guide to build the kernel from scratch, but didn't get to that yet. You can take a look however at other guides for other phones, and just swap the git repository with the one linked above. Here is a guide for the Blackstone. I suggest you use the prebuilt toolchain by Google though. Otherwise you may run into compile issues regarding floating point instructions.

For a HaRET build you can check

As default.txt you can use:
set mtype 2524

# This is the physical location of the first memory bank
set ramaddr 0x20000000

# 224MB ram, just a guess though. Not sure how large
# the first bank is (or the second).
set ramsize 0x0E000000

# You must use "Image" instead of "zImage", as the
# decompression routine fails on the Leo!
set kernel Image

# The most important parameter is "lpj=8000000"
# here, without it, the kernel hangs during boot
# when it tries to calculate the loops per jiffie.
set cmdline "init=/init root=/dev/ram mem=64M lpj=8000000"

# Boot the image
Have fun!


  1. Just a guess:

    The HD2 has 576MB RAM. When we assume it is divided into two memory banks, the ram size should be 288MB = 0x12000000


  2. The answer is "you might be correct". We don't know for sure. This early in development, it doesn't really matter much. The 224 was based on 448MB / 2, it's an old figure.

    Maybe some kind of testtool should be made that can find out for sure. Would help a lot of other devices too.

    Also some areas of the memory is usually protected. So not all memory on those banks can be used.

  3. Actually, let me correct that. A memory module of 288MB won't be possible.

    The first memory bank has physical address 0x20000000, and the second memory bank physical address has 0x30000000. This means there's only 0x10000000 (=256MB) of space between them. So this means the first memory bank can only hold a 256MB memory module. It's unknown how large the second one can be though. It might be bigger, but there might also be a 3rd memory bank or some other way to add additional memory.

  4. can u tell how to make a image instead of zimage, coz i found all of the files that are zimage.

  5. Hi Kam,

    It's exactly the same way. If you build a zImage, there should be Image in the same directory.

  6. just wondering, is it possible for a noob to install linux on a htc hd2? O:) yeah, I've had my cell for 2 days and im already sick of rebooting it.. fucking windows...

  7. Development of linux on hd2 is by far not usable for any user. Only the kernel boots, but there's _nothing_ you can do with the device in linux yet.

    Check back in half a year if you want something more usable, user-wise. :)