[HOW TO] Compile and Deploy a Kernel

Good to know, I thought it would be the same problem as with the ICS kernel at the beginning ...my fault.
 
I'm sorry for the inconvenience and thank you, I can now build and boot the kernel.
I misunderstood you...I thought that the kernel can only build correctly with a customized tool chain, but the problem was really at the source and at the initramfs.
I have no idea what was wrong, but after I unpacked both new it worked.
If anyone is interested in it: I'm using the toolchain provided by CM.

Hey Guys,

I'm a noob to android kernel development. Thanks for the great work in this thread. I've learned a lot, but still stuck on booting my kernel. Here's a briefly overview about the things I did in order to get a working kernel. My Device is a Medion Lifetab S9714 aka Lenovo A2110 or A2109. I got the last released sources from Medion (S9714-JB_OTA_GPL_Source_316).

1. Unlock bootloader and temporarly installed CWM to create a backup - OK

2. Pulled /proc/config.gz from device via adb - OK

3. Installed Linux Mint 64-Bit in VM running von virtualbox.

4. Installed pre-requisites to run the arm-eabi-4.6 precompiled toolchain from google.

5. Got the necessary tools to unpack / repack boot.img

6. Unpacked the original boot.img for testing. I did a successful boot with the repacked image via fastboot boot... So i know, that this part of the toolbox is pretty ok.

7. Compiled the stock kernel against the original config file. Worked like a charm - no problems.

8. Tried to launch the recompiled kernel together with the original ramdisk. It fails to boot.

I think, the problem is somewhere between chair an computer. May you can help me, to see, what I did wrong. BTW I did another try to compile with arm-eabi-4.4.3. But the result stays the same :/
 
So, I finally made it. The kernel is runnig. So what was the problem ?

Look at this code:

Code:
#!/bin/bash
#

export ARCH=arm
export CROSS_COMPILE=arm-eabi-
export PATH=/home/smarcdroid/S9714/tools/arm-eabi/arm-eabi-4.6/bin:$PATH

cd kernel
make tegra3_android_defconfig
make -j4

The line containing 'make tegra3_android_defconfig' lead me to problems compiling my kernel. For some reason the .config-File in the top-directory of the kernel source looked like the one from /proc/config.gz, but it wasn't.

I assumed, that something on the config went wrong. I copied /proc/config.gz to [kernel-source]/arch/arm/configs/ and gunzipped it. I've renamed tegra3_android_defconfig to tegra3_android_defconfig.old. Then replaced the name of config with tegra3_android_defconfig.

I've compiled the kernel, packed the bootimage and an update.zip with the modules. Wrote the stuff to the device and now it runs. Nice base for more adventures :)

Let's see what's next...
 
So, I finally made it. The kernel is runnig. So what was the problem ?

Look at this code:

Code:
#!/bin/bash
#

export ARCH=arm
export CROSS_COMPILE=arm-eabi-
export PATH=/home/smarcdroid/S9714/tools/arm-eabi/arm-eabi-4.6/bin:$PATH

cd kernel
make tegra3_android_defconfig
make -j4

The line containing 'make tegra3_android_defconfig' lead me to problems compiling my kernel. For some reason the .config-File in the top-directory of the kernel source looked like the one from /proc/config.gz, but it wasn't.

I assumed, that something on the config went wrong. I copied /proc/config.gz to [kernel-source]/arch/arm/configs/ and gunzipped it. I've renamed tegra3_android_defconfig to tegra3_android_defconfig.old. Then replaced the name of config with tegra3_android_defconfig.

I've compiled the kernel, packed the bootimage and an update.zip with the modules. Wrote the stuff to the device and now it runs. Nice base for more adventures :)

Let's see what's next...
Nice! It'd be nice if you could get a kernel withSeLinux running so we can have KitKat.
 
So, I finally made it. The kernel is runnig. So what was the problem ?
So the problem was wrong .config, right?
Anyways: congratulations with the achievement.
What is it in the kernel you wish to improve, add or remove?
I personally also look forward to see a lean (say AOSP) ROM with a lean kernel.
Lenovo/Medion has IMO done a great job on this device (I also have the Medion).
For example, all my SD partitions (apart from swap) are ext4 linux ones. I do not know any other Android device that would seamlessly allow you to get rid of (x)fat partitions.
One cool thing to add to any kernel though would be a DVB-T driver for your USB stick. That is what I always wanted to try but never dared...
 
Nice to get some feedback, so I know, there's till life in this thread ;-) Here's an update on my work. I've little time at the moment for this thing. Will get more in the next days. But back to the current work:

I took the grouper-kernel-source for Android 5.0 from google aosp:

https://android.googlesource.com/kernel/tegra/+/android-tegra3-grouper-3.1-lollipop-release

I did a couple of diff-runs against the orignal .config from the JB-Source from Medion.

Then I've patched the original source to match the nexus 7 (grouper) config. Also enabled the SeLinux stuff. The bootimage is packed and is starting up without problems. JB doesn't work correct with this kernel. I've expected this ;). Now I work on aosp lollipop source. Right now I deal with the device stuff and the verndor/board specific blobs. I believe, it's absolutely possible to port lollipop to this device. Nexus 7 and Lifetab S9714 are both based on NVIDIA's kai reference board. Great situation.

I hope to have news, soon.
 
Is there an existing thread dealing with the Medion Lifetab S9714 ? Do you'll think it's a good idea to create one, if not ? I'm thinking about the right place to discuss all the device depending stuff during build of Android 5.0 Lollipop.

The Lollipop kernel source from google nexus 7 (ASUS grouper) is also a 3.1.10. So it's pretty the same as the original JB-Kernel except for some settings that have to be done to the .config.

Has anybody ever found a place to get the blobs for the 3G-Module. It's a Huawei MU739. I guess it's driven bei AT commands. I made this assumption based on some config-files I've seen. So there is a kind of virtual serial port in the loop. The modem is connected to usb. We need blobs for Lollipop to make it operational. Maybe the sources are available somewhere for download. But I don't believe in that.
 
Is there an existing thread dealing with the Medion Lifetab S9714 ? Do you'll think it's a good idea to create one, if not ? I'm thinking about the right place to discuss all the device depending stuff during build of Android 5.0 Lollipop.

AFAIK S9714 = A2109 + 3G

So ROM development could go together (but perhaps with separate kernel).

Anyways: big congratulations! If I can help with S9714 let me know how.
 
"AFAIK S9714 = A2109 + 3G"

That might be exactly correct. But I'd some issues on using A2109 ROMS on my S9714. Especially the one from Paranoid I've tried. The version I put on my tab had problems with the different standby/sleep states. Switched the tab sleep at a battery load of 88%. About 10 hrs later the left percentage was at 18%. That's not something you want to have.

I checked the bootimage. The kernel was build with the Linaro-Toolchain. I think the maker of this one made use of the optimization flags of the compiler, leading to a pretty fast kernel binary on one hand and a significant loss of stability on the other.

Did you observe effects like this on your A2109 in the past ? Was it a problem fixable by turning the right setup values ?

I look forward to work together with you on that ROM. I've the device stuff ready. Still problems with the 3G-Modem, but that's ok for the moment. Build process can start now. I'll report status within the next days...
 
"AFAIK S9714 = A2109 + 3G"

That might be exactly correct. But I'd some issues on using A2109 ROMS on my S9714. Especially the one from Paranoid I've tried. The version I put on my tab had problems with the different standby/sleep states. Switched the tab sleep at a battery load of 88%. About 10 hrs later the left percentage was at 18%. That's not something you want to have.

I checked the bootimage. The kernel was build with the Linaro-Toolchain. I think the maker of this one made use of the optimization flags of the compiler, leading to a pretty fast kernel binary on one hand and a significant loss of stability on the other.

Did you observe effects like this on your A2109 in the past ? Was it a problem fixable by turning the right setup values ?

I look forward to work together with you on that ROM. I've the device stuff ready. Still problems with the 3G-Modem, but that's ok for the moment. Build process can start now. I'll report status within the next days...

'S9714 = A2109 + 3G' expression is not mine but, I believe, rather from people like 'gmarkall' and 'superhansi' who made early CM 10.1 ROMS for these devices.

I guess you have seen them on the lenovo forums (forums.lenovo.com) like 'Development-Cyanogenmod-10-for-the-A2109'.

I believe I once tried CM (long ago).

If you have a build recipe for me I can try it.

Success!
 
two questions

- what about the kernel modules in /system/lib/modules ?
I guess fastboot does not touch them, so perhaps one needs to copy them manually?

- does this device support hardfloat toolchain
that is can we use CROSS_COMPILE=arm-linux-gnueabihf- ?
 
thanks smarcDroid,

I tried to reflash original kernel as proof of concept but I get (from Linux, both gentoo and ubuntu).

lsusb mentiones
Bus 001 Device 062: ID 0489:e110 Foxconn / Hon Hai


# fastboot flash:raw boot zImage initrd.img
< waiting for device >
^C <<-- that's me ;-)

note however it was correctly seen as a lenovo fastboot product (from dmesg)

[1514528.515465] usb 1-5: New USB device found, idVendor=0489, idProduct=e110
[1514528.515469] usb 1-5: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[1514528.515471] usb 1-5: Product: Fastboot
[1514528.515473] usb 1-5: Manufacturer: LENOVO
[1514528.515474] usb 1-5: SerialNumber: 015d2ea4aa3c2210


also when booted normally I get:
# adb devices
List of devices attached
S97140E4E1 device

so there is -some- USB communication ...


I feel like using:

(on tablet for stock or new kernel)
dd if=boot.img of=/dev/mmcblk0p2 bs=8192
where
/dev/block/platform/sdhci-tegra.3/by-name/LNX -> /dev/mmcblk0p2
(and on linux for -new- kernel)
abootimg --create boot.img -f bootimg.cfg -k zImage -r initrd.img

Any advice / caveats ?
 
Last edited:
Back
Top