How to regenerate bionic/libc/common/kernel headers for linux kernel v2.6.30

by Elvis Dowson » Thu, 23 Jul 2009 20:35:50 GMT

Sponsored Links
I'm working on trying to port android to linux-omap-2.6.30
kernel version. I've managed to successfully compile the kernel image.
When performing the port to a new kernel version, the bionic/libc
headers also require an update to linux kernel 2.6.30.

I was wondering if someone would be able to validate the changes and
modifications that I have made so far, and suggest some better fixes,
for example, I've had to disable boot animation, to get the
compilation to proceed, due to a linker error. Since this is a first
iteration, at this port, I thought it was acceptable just to try to
see how far it goes. I haven't tested it yet, but was wondering if
someone would be interested in trying this out in parallel, and get
android 1.5 SDK running on android-2.6.30 kernel version.

The reason for attempting this is to update the kernel version for the
gumstix overo, to better take advantage of the power management
functionality currently under development in kevin hilman's linux-omap-
pm pm branch.

Best regards,


Technote android-2.6.30-001: How to regenerate bionic/libc/common/
kernel headers for linux kernel v2.6.30


This document describes how to update the android/bionic/libc/kernel
headers to linux kernel v2.6.30.


Step 01.00: Backup the existing android/bionic/libc folder.

You will need the following header files from the existing v2.6.29
linux kernel headers at a later step:


Step 02.00: Clean up the existing android/bionic/libc/kernel folder.

Delete the contents of the following folders


Step 03.00: Copy the required linux kernel v2.6.30 headers to the
android/bionic/libc/kernel/original folder.

[TODO: Insert steps on how to clone linux-omap-2.6 git repository and
switch to the omap-2.6.30 branch].

Copy the contents of the following folder to the specific target

linux-omap-2.6/include/asm-generic to android/bionic/libc/kernel/
linux-omap-2.6/include/linux to android/bionic/libc/kernel/original/
linux-omap-2.6/include/mtd to android/bionic/libc/kernel/original/

Step 04.00: Generate the clean linux headers.

Run the tools/ script to generate the clean linux

$ cd android/bionic/libc/kernel
$ tools/

This will generate the headers into the android/bionic/libc/kernel/
common folder.

Step 05.00: Copy the following headers from the backup v2.6.29 bionic/
libc/kernel/common/linux folder to the new android/bionic/libc/kernel/
common/linux folder.


Step 06.00: Copy the architecture-specific headers.

Copy the contents of the architecture-specific asm folders to the
following target location:

linux-omap-2.6/arch/arm/include/asm to android/bionic/libc/kernel/arch-
linux-omap-2.6/arch/x86/include/asm to android/bionic/libc/kernel/arch-

Step 07.00: Delete the contents of the android/out folder.

Step 08.00: Build the android sdk.

$ cd android
$ make -j4

Step 09.00: Apply the following patches for the errors that pop up
during the build process.

Fixes for errors that can come up during compilation

Other Threads

1. Faster "Canvas.drawLine()" for rectangular lines?


I'm developing a SurfaceView based, vector-styled game, so I'm using
Canvas.drawLine(startX, startY, stopX, stopY, Paint) very often. All
those lines are rectangular (startX=stopX or startY=stopY).
The TraceViewer shows me, that more than 50% of time are used to draw
those lines (about 100 per frame).

I read that drawLine is pretty slow on Android but I didn't find any
suggestions for an alternative.
What could be a faster method for this special case? I wouldn't need
the Bresenham algorithm for example, which drawLine will use I guess.

Any suggestions?
(Besides 'use openGL', as it's too late for that)

Regards, F Heft

PS: If anyone's interested: The game still runs with a sufficient
frame rate, but I want to improve wherever I can :)

2. how to add a line drawing to ListView?

When I try extending the View class to a subclass that will underline
portions of the text drawn by ListView, the code compiles okay but
results in a runtime exception apparently due to an improper class
cast.  Does anyone see what I've done wrong or have suggestions about
getting access to the Canvas of ListView items so portions of text can
be underlined?

Here is the code, which is the Efficient Adapter View/List example
from ApiDemos with an added UnderlinedView class.

- - -

 * Copyright (C) 2008 The Android Open Source Project
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * See the License for the specific language governing permissions and
 * limitations under the License.


import android.content.Context;
import android.os.Bundle;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

 * Demonstrates how to write an efficient list adapter. The adapter
used in this example binds
 * to an ImageView and to a TextView for each row in the list.
 * To work efficiently the adapter implemented here uses two
 * - It reuses the convertView passed to getView() to avoid inflating
View when it is not necessary
 * - It uses the ViewHolder pattern to avoid calling findViewById()
when it is not necessary
 * The ViewHolder pattern consists in storing a data structure in the
tag of the view returned by
 * getView(). This data structures contains references to the views we
want to bind data to, thus
 * avoiding calls to findViewById() every time getView() is invoked.
public class List14 extends ListActivity {

        private static class UnderlinedView extends View {
                public UnderlinedView(Context context) {
                public UnderlinedView(Context context, AttributeSet as) {
                        super(context, as);
                public UnderlinedView(Context context, AttributeSet as, int i) {
                        super(context, as, i);
            protected void onDraw(Canvas canvas) {

                // Would like to do some line drawing here (e.g., underlining
portions of text)

    private static class EfficientAdapter extends BaseAdapter {
        private LayoutInflater mInflater;
        private Bitmap mIcon1;
        private Bitmap mIcon2;

        public EfficientAdapter(Context context) {
            // Cache the LayoutInflate to avoid asking for a new one
each time.
            mInflater = LayoutInflater.from(context);

            // Icons bound to the rows.
            mIcon1 = BitmapFactory.decodeResource(context.getResources
(), R.drawable.icon48x48_1);
            mIcon2 = BitmapFactory.decodeResource(context.getResources
(), R.drawable.icon48x48_2);

         * The number of items in the list is determined by the number
of speeches
         * in our array.
         * @see android.widget.ListAdapter#getCount()
        public int getCount() {
            return DATA.length;

         * Since the data comes from an array, just returning the
index is
         * sufficent to get at the data. If we were using a more
complex data
         * structure, we would return whatever object represents one
row in the
         * list.
         * @see android.widget.ListAdapter#getItem(int)
        public Object getItem(int position) {
            return position;

         * Use the array index as a unique id.
         * @see android.widget.ListAdapter#getItemId(int)
        public long getItemId(int position) {
            return position;

         * Make a view to hold each row.
         * @see android.widget.ListAdapter#getView(int,
         *      android.view.ViewGroup)
        public View getView(int position, View convertView, ViewGroup
parent) {
            // A ViewHolder keeps references to children views to
avoid unneccessary calls
            // to findViewById() on each row.
            ViewHolder holder;
            UnderlinedView underlinedView = (UnderlinedView)

            // When convertView is not null, we can reuse it directly,
there is no need
            // to reinflate it. We only inflate a new View when the
convertView supplied
            // by ListView is null.
            if (convertView == null) {
                convertView = mInflater.inflate
(R.layout.list_item_icon_text, null);
                underlinedView = (UnderlinedView)convertView;

                // Creates a ViewHolder and store references to the
two children views
                // we want to bind data to.
                holder = new ViewHolder();
                holder.text = (TextView) underlinedView.findViewById
                holder.icon = (ImageView) underlinedView.findViewById

            } else {
                // Get the ViewHolder back to get fast access to the
                // and the ImageView.
                holder = (ViewHolder) underlinedView.getTag();

            // Bind the data efficiently with the holder.
            holder.icon.setImageBitmap((position & 1) == 1 ? mIcon1 :

            return underlinedView;

        static class ViewHolder {
            TextView text;
            ImageView icon;

    public void onCreate(Bundle savedInstanceState) {
        setListAdapter(new EfficientAdapter(this));

    private static final String[] DATA = {
            "Abbaye de Belloc", "Abbaye du Mont des Cats", "Abertam",
            "Abondance", "Ackawi", "Acorn", "Adelost", "Affidelice au
            "Afuega'l Pitu", "Airag", "Airedale", "Aisy Cendre",
            "... a lot more strings are defined in original ApiDemos
sample ...",
            "Yarra Valley Pyramid", "Yorkshire Blue", "Zamorano",
            "Zanetti Grana Padano", "Zanetti Parmigiano Reggiano"};

- - -

The stack trace from logcat suggests a problem with the class cast in
line 127, which is the cast after the row's XML inflation in getView:

                convertView = mInflater.inflate
(R.layout.list_item_icon_text, null);
                underlinedView = (UnderlinedView)convertView;

D/AndroidRuntime(  723): Shutting down VM

W/dalvikvm(  723): threadid=3: thread exiting with uncaught exception

E/AndroidRuntime(  723): Uncaught handler: thread main exiting due to
uncaught exception

E/AndroidRuntime(  723): java.lang.ClassCastException:

E/AndroidRuntime(  723):        at$EfficientAdapter.getView

E/AndroidRuntime(  723):        at android.widget.AbsListView.obtainView

E/AndroidRuntime(  723):        at android.widget.ListView.makeAndAddView

E/AndroidRuntime(  723):        at android.widget.ListView.fillDown

E/AndroidRuntime(  723):        at android.widget.ListView.fillFromTop

E/AndroidRuntime(  723):        at android.widget.ListView.layoutChildren

E/AndroidRuntime(  723):        at android.widget.AbsListView.onLayout

E/AndroidRuntime(  723):        at android.view.View.layout(

E/AndroidRuntime(  723):        at android.widget.FrameLayout.onLayout

E/AndroidRuntime(  723):        at android.view.View.layout(

E/AndroidRuntime(  723):        at android.widget.LinearLayout.setChildFrame

E/AndroidRuntime(  723):        at android.widget.LinearLayout.layoutVertical

E/AndroidRuntime(  723):        at android.widget.LinearLayout.onLayout

E/AndroidRuntime(  723):        at android.view.View.layout(

E/AndroidRuntime(  723):        at android.widget.FrameLayout.onLayout

E/AndroidRuntime(  723):        at android.view.View.layout(

E/AndroidRuntime(  723):        at android.view.ViewRoot.performTraversals

E/AndroidRuntime(  723):        at android.view.ViewRoot.handleMessage

E/AndroidRuntime(  723):        at android.os.Handler.dispatchMessage

E/AndroidRuntime(  723):        at android.os.Looper.loop(

E/AndroidRuntime(  723):        at

E/AndroidRuntime(  723):        at java.lang.reflect.Method.invokeNative
(Native Method)

E/AndroidRuntime(  723):        at java.lang.reflect.Method.invoke

E/AndroidRuntime(  723):        at

E/AndroidRuntime(  723):        at

E/AndroidRuntime(  723):        at dalvik.system.NativeStart.main(Native

I/Process (  564): Sending signal. PID: 723 SIG: 3

- - -

Initially I tried posting this question to the Android Beginners group
(as I'm a Java novice), but got no responses.  Anyone here have any

Thanks and best regards,


3. Is there any UI can connect to SQLite database?

4. Linux kernel Include files

5. Android BUG....

6. what is the point of ProviderTestCase2?

7. Garbage Collector - best practice