Building a Kernel for Dream

Search This thread

Koush

Retired Recognized Developer
Sep 21, 2007
917
871
Does anyone know how to make a new kernel/boot.img for Dream without running through the whole make process? The release-1.0 branch doesn't build, and cupcake is too. :p

I've managed to rebuild the kernel, but can't figure out what is packaged up to make the boot.img.
 

JesusFreke

Inactive Recognized Developer
Oct 23, 2008
736
54
Dallas
Does anyone know how to make a new kernel/boot.img for Dream without running through the whole make process? The release-1.0 branch doesn't build, and cupcake is too. :p

I've managed to rebuild the kernel, but can't figure out what is packaged up to make the boot.img.

Try the build environments I released with v1.3
 

Koush

Retired Recognized Developer
Sep 21, 2007
917
871
Awesome, thanks! Should have scrolled to the end of the post for more goodies...
 

jashsu

Senior Member
Nov 15, 2008
1,849
20
Does anyone know how to make a new kernel/boot.img for Dream without running through the whole make process? The release-1.0 branch doesn't build, and cupcake is too. :p

I've managed to rebuild the kernel, but can't figure out what is packaged up to make the boot.img.

Maybe i'm mistaken but doesn't the mkbootimg tool perform this task? It's documented in alansj's sticky here, section titled "Unpacking, Editing, and Repacking the Images"
 

joeko2202

New member
Nov 13, 2008
4
1
Here's what I've done in the past. This assumes you have already repo sync'ed and have a toolchain available. I also work with a fresh copy of the MSM kernel from git. You can use the repo you checked out with repo (which is in .repo), but I can't remember how to do it off the top of my head right now. I make some assumptions people are comfortable with a "standard" kernel compile and git. These steps also assume you're on a Unix-based OS (Linux, Mac OS X, and (possibily) Cygwin).

1) In your clone of the MSM kernel repo, switch to the commit that Google used for their RC30 kernel:

git checkout -b my-build c092738

This creates a branch named "my-build" from the commit ID that starts with c092738e. I got this from the vendor/htc/dream git log. There are more recent kernels, but this one seems to be OK. You also want to make sure you dont use 2.6.27 yet. Apparently some of the kernel bits moved around, and the non-cupcake userspace doesn't know about this...but I never confirmed that.

2) Extract a starting config.

Unzip an RC30 full update from somewhere, and extract the kernel from boot.img. (I use split_bootimg.pl from the android-dls wiki). Remember where boot.img-kernel is located. Go into the directory containing the kernel tree you checked out in step 1, and run:

scripts/extract-ikconfig > g1.config

You can read the resulting config (less g1.config), but to use/change it:

mv g1.config .config
make ARCH=arm CROSS_COMPILE=/path/to/android/repo/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi- oldconfig
make ARCH=arm CROSS_COMPILE=/path/to/android/repo/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi- oldconfig


(Yes, run oldconfig twice!)

3) Apply patches. Apply any patches you want. JF's build sandbox has some good ones. I'd recommend the alarm driver fix at the very least (the uptime_fix.patch).

4) Edit your config. After patching, patches can give new config options. So the config needs to be updated. This is best done by:

make ARCH=arm CROSS_COMPILE=/path/to/android/repo/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi- oldconfig
make ARCH=arm CROSS_COMPILE=/path/to/android/repo/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi- oldconfig
make ARCH=arm CROSS_COMPILE=/path/to/android/repo/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi- menuconfig


If a new option is added, oldconfig will stop and wait for some input. Also, running oldconfig twice is a paranoid way to make sure any dependencies within the kernel config process are ironed out.

With menuconfig, you can change the config as you desire. Remember to TURN OFF "Automatically append version information to the version string", else your kernel version string will be horked. Make sure it is turned off (no * by the option)! Also, do not turn off PREEMPT or set SMP in the config. Doing so will cause the wlan module to not load at runtime(unless you can compile your own module...which can be done, but I haven't done it yet). (Actually, be careful setting options, you may cause symbols to not be exported and prebuilt modules may not work afterwards...)

5) Build the kernel. After making your changes to the config, save them off and type:

make ARCH=arm CROSS_COMPILE=/path/to/android/repo/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi- EXTRAVERSION=-018430-gfea26b0 zImage
make ARCH=arm CROSS_COMPILE=/path/to/android/repo/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi- EXTRAVERSION=-018430-gfea26b0 modules
make ARCH=arm CROSS_COMPILE=/path/to/android/repo/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi- INSTALL_MOD_PATH=/tmp/modules modules_install


The kernel to use lives in arch/arm/boot/zImage. (note the case!)

6) Follow the instructions at http://android-dls.com/wiki/index.p...cking.2C_Editing.2C_and_Re-Packing_the_images Remember, in the JF releases, the extra modules are put into a cramfs. What I've done:

rm /tmp/modules/lib/modules/2.6.25-018430-gfea26b0 source
rm /tmp/modules/lib/modules/2.6.25-018430-gfea26b0 build
mkcramfs -b 8192 /tmp/modules/lib/modules modules.cramfs


You can also fastboot install the kernel image.
 
  • Like
Reactions: sol-invictus

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    Here's what I've done in the past. This assumes you have already repo sync'ed and have a toolchain available. I also work with a fresh copy of the MSM kernel from git. You can use the repo you checked out with repo (which is in .repo), but I can't remember how to do it off the top of my head right now. I make some assumptions people are comfortable with a "standard" kernel compile and git. These steps also assume you're on a Unix-based OS (Linux, Mac OS X, and (possibily) Cygwin).

    1) In your clone of the MSM kernel repo, switch to the commit that Google used for their RC30 kernel:

    git checkout -b my-build c092738

    This creates a branch named "my-build" from the commit ID that starts with c092738e. I got this from the vendor/htc/dream git log. There are more recent kernels, but this one seems to be OK. You also want to make sure you dont use 2.6.27 yet. Apparently some of the kernel bits moved around, and the non-cupcake userspace doesn't know about this...but I never confirmed that.

    2) Extract a starting config.

    Unzip an RC30 full update from somewhere, and extract the kernel from boot.img. (I use split_bootimg.pl from the android-dls wiki). Remember where boot.img-kernel is located. Go into the directory containing the kernel tree you checked out in step 1, and run:

    scripts/extract-ikconfig > g1.config

    You can read the resulting config (less g1.config), but to use/change it:

    mv g1.config .config
    make ARCH=arm CROSS_COMPILE=/path/to/android/repo/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi- oldconfig
    make ARCH=arm CROSS_COMPILE=/path/to/android/repo/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi- oldconfig


    (Yes, run oldconfig twice!)

    3) Apply patches. Apply any patches you want. JF's build sandbox has some good ones. I'd recommend the alarm driver fix at the very least (the uptime_fix.patch).

    4) Edit your config. After patching, patches can give new config options. So the config needs to be updated. This is best done by:

    make ARCH=arm CROSS_COMPILE=/path/to/android/repo/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi- oldconfig
    make ARCH=arm CROSS_COMPILE=/path/to/android/repo/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi- oldconfig
    make ARCH=arm CROSS_COMPILE=/path/to/android/repo/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi- menuconfig


    If a new option is added, oldconfig will stop and wait for some input. Also, running oldconfig twice is a paranoid way to make sure any dependencies within the kernel config process are ironed out.

    With menuconfig, you can change the config as you desire. Remember to TURN OFF "Automatically append version information to the version string", else your kernel version string will be horked. Make sure it is turned off (no * by the option)! Also, do not turn off PREEMPT or set SMP in the config. Doing so will cause the wlan module to not load at runtime(unless you can compile your own module...which can be done, but I haven't done it yet). (Actually, be careful setting options, you may cause symbols to not be exported and prebuilt modules may not work afterwards...)

    5) Build the kernel. After making your changes to the config, save them off and type:

    make ARCH=arm CROSS_COMPILE=/path/to/android/repo/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi- EXTRAVERSION=-018430-gfea26b0 zImage
    make ARCH=arm CROSS_COMPILE=/path/to/android/repo/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi- EXTRAVERSION=-018430-gfea26b0 modules
    make ARCH=arm CROSS_COMPILE=/path/to/android/repo/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi- INSTALL_MOD_PATH=/tmp/modules modules_install


    The kernel to use lives in arch/arm/boot/zImage. (note the case!)

    6) Follow the instructions at http://android-dls.com/wiki/index.p...cking.2C_Editing.2C_and_Re-Packing_the_images Remember, in the JF releases, the extra modules are put into a cramfs. What I've done:

    rm /tmp/modules/lib/modules/2.6.25-018430-gfea26b0 source
    rm /tmp/modules/lib/modules/2.6.25-018430-gfea26b0 build
    mkcramfs -b 8192 /tmp/modules/lib/modules modules.cramfs


    You can also fastboot install the kernel image.