subscribe

You can update this text in your control panel, under Theme Options. Nam massa. Ut tempor augue non sapien lobortis aliquam. Maecenas.

Howto: Compile a linux kernel for Samsung Galaxy

September 8th, 2009

A howto for compiling a linux kernel for the Samsung Galaxy was requested. If you interested read this article.

Steps:

  1. Download and unzip the kernel sources
  2. Download gcc arm toolchain
  3. Convert files to linux text format
  4. make defconfig
  5. make menuconfig (if wanted)
  6. make
  7. fin

1.) Download and unzip the kernel sources

Download the kernel source of the Samsung Galaxy from opensource.samsungmobile.com and unzip the file.

2.) Download gcc arm toolchain

It exist a few ways to get a working toolchain. It goes from install the debian arm toolchain, download and install the toolchain from CodeSourcery or use the toolchain of the android sources. I prefer the last. Simple setup the android source.

3. Convert files to linux text format

The files form the Galaxy sources are in a Windows text format and need converting. Change Dir to kernel_2.6.27 and type:

find . -type f -name ‘*’ -exec dos2unix {} \;

4. make defconfig

The arm kernel need a defconfig. First type “make ARCH=arm CROSS_COMPILE=path_to_your_toolchain defconfig capela_defconfig”. For me is that:

make ARCH=arm CROSS_COMPILE=/android/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi- defconfig capela_defconfig

5. make menuconfig (if wanted)

Simple type “make ARCH=arm CROSS_COMPILE=path_to_your_toolchain menuconfig”.

6. make

After configuration of the linux kernel it is time to compiling it. Type:

make ARCH=arm CROSS_COMPILE=path_to_your_toolchain

If you only want the kernel or the modules append zImage or modules.

7. fin

After a few time you find the kernelĀ  in arch/arm/boot/zImage.

I have created a build script. Download kernel_build. Edit the first three lines before using.

Finally don’t forget to write a comment.

Tags: , , ,

10 Responses to Howto: Compile a linux kernel for Samsung Galaxy

  1. chrmhoffmann says:

    Thanks for the tutorial. Building right now. Could you explain how to make a boot image from the compiled kernel?
    Do you know what these different hardware revisions are? The scripts in the samsung folder do something like
    make ARCH=arm CROSS_COMPILE=$CROSS_COMPILER
    capela_rev0${HW_REV}_${MEM_SIZE}_defconfig

    Cheers,

    Chris

  2. Michael_GBR says:

    Hello,

    I’m at step 4. make defconfig.

    I cannot see the defconfig….

    make ARCH=arm CROSS_COMPILE=~/mydroidNew/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi- …there is no defconfig ???

    Can you help please. Thanks, joshua

  3. Kei says:

    Same problem as Michael, stuck on Step 4.

  4. step21 says:

    @Kei/Michael_GBR what toolchain did you use?

  5. step21 says:

    status update: at least got android to build now. (on os x 10.6)
    not the kernel though. Also defconfig error. in fact there seems to be no defconfig in the whole android tree, apart from something to do with wpa_supplicant. Btw, which one is the most recent version on the samsung open source page? It’s kinda confusing I think. Is it necessary to extract defconfig from the system kernel or something? (read about that somewhere)

  6. step21 says:

    defconfig issue: most likely you downloaded the topmost GT7500 file on samsung’s page. This one has no capela_defconfig and also a little bit of a different layout than an older one. Also a problem could be if you copied n’ pasted the dos2unix command and it didn’t properly convert things.

  7. mrbrdo says:

    so, how to build the new one? update3… also, did samsung release sources for ik4 firmware?

  8. Steffen Lindner says:

    find . -type f -exec dos2unix {} \; works better

  9. jamerson says:

    Great article, saved my life.
    I only have to make the change suggested by Steffen Lindner.
    Thank you

Leave a Reply

Name and Email Address are required fields. Your email will not be published or shared with third parties.

*