2013年9月29日 星期日

Build OK6041 environment

http://note.jhpeng.com/2013/01/sudo-apt-get-install-git-core-gnupg.html
http://e-xiao.blogspot.tw/2011/10/resolve-build-errors-for-android-234.html

1.
gedit /etc/init.d/rc.local
//add
mount /dev/sda3 /extdriver

add-apt-repository ppa:sun-java-community-team/sun-java6
apt-get update
apt-get install sun-java6-jdk

//remove ppa:sun-java-community-team/sun-java6 list, option
gedit /etc/apt/sources.list

2.
///fail
apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc

///new sucess
apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev libc6-dev lib64ncurses5-dev           x11proto-core-dev libx11-dev lib64readline5-dev lib64z-dev libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc

3.
android2.3.4_32bit/system/core/init/init.c
//property_set("ro.serialno", serialno[0] ? serialno : "");
property_set("ro.serialno", "OK1ATV800006"); //by stone

4.
/////////////find define mk
/xxxxxx/android2.3.4_32bit/build/core/core/envsetup.mk
TARGET_OUT := $(PRODUCT_OUT)/system
TARGET_OUT_SHARED_LIBRARIES:= $(TARGET_OUT)/lib

5.
//////////////HAL files reference///////////
C:\dev_board\android\android2.3.4_32bit\frameworks\base\services
C:\dev_board\android\android2.3.4_32bit\hardware\libhardware
C:\dev_board\android\android2.3_kernel_v1.01\arch\arm
C:\dev_board\android\android2.3_kernel_v1.01\drivers\char

//follows on the android2.3_kernel_v1.01 of foxlinx
//s3c6140_leds.c
static int __init dev_init(void)
{
       int ret;
       unsigned tmp;

       //gpm0-3 pull up
        tmp = readl(S3C64XX_GPMPUD);
        tmp &= (~0xFF);
        tmp |= 0xaa;
        writel(tmp,S3C64XX_GPMPUD);

        //gpm0-3 output mode
        tmp =readl(S3C64XX_GPMCON);
        tmp &= (~0xFFFF);
        tmp |= 0x1111;
        writel(tmp,S3C64XX_GPMCON);
      
        //gpm0-3 output 0
        tmp = __raw_readl(S3C64XX_GPMDAT);
        tmp |= 0x10;
        writel(tmp,S3C64XX_GPMDAT); 

        ret = misc_register(&misc);

        printk ("\n@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
        printk (DEVICE_NAME"\tinitialized\n");
        printk ("\n@@@@@@@@@@@@@@@@@@@@@@@@@@\n");

        return ret;
}

6.
/////////////////////////IO Mapping
//gpio-bank-m.h
#define S3C64XX_GPMCON          (S3C64XX_GPM_BASE + 0x00)
#define S3C64XX_GPMDAT          (S3C64XX_GPM_BASE + 0x04)
#define S3C64XX_GPMPUD          (S3C64XX_GPM_BASE + 0x08)

//regs-gpio.h
#define S3C64XX_GPIOREG(reg)        (S3C64XX_VA_GPIO + (reg))
#define S3C64XX_GPM_BASE        S3C64XX_GPIOREG(0x0820)

//map.h
#define S3C64XX_VA_GPIO                S3C_ADDR_CPU(0x00000000)

//map-base.h
#define S3C_ADDR_BASE        (0xF4000000)

#ifndef __ASSEMBLY__
#define S3C_ADDR(x)        ((void __iomem __force *)S3C_ADDR_BASE + (x))
#else
#define S3C_ADDR(x)        (S3C_ADDR_BASE + (x))
#endif

#define S3C_ADDR_CPU(x)        S3C_ADDR(0x00500000 + (x))

7.
////////////////makefile////////////////////
///////android: android2.3_kernel_v1.01 of foxlinx
gedit /xxxxxx/android2.3_kernel_v1.01./.configure

//////find follows of makefile
CONFIG_CROSS_COMPILE="arm-none-linux-gnueabi-"

///makefile type in////
    obj-m := alphagpcio.o
    CROSS_COMPILE=arm-none-linux-gnueabi-
    KERNELDIR ?= /extdriver/android2.3_kernel_v1.01
    PWD := $(shell pwd)

default:
    $(MAKE) -C $(KERNELDIR) M=$(PWD) modules

clean:
    $(MAKE) -C $(KERNELDIR) M=$(PWD) clean

8.
/////////////////make android tollchain first, "android-ndk-r7-crystax-5.beta3" is my ndk on ubuntu
/usr/local/android-ndk-r7-crystax-5.beta3/build/tools/make-standalone-toolchain.sh --platform=android-9 --install-dir=/usr/local/android-toolchain

/usr/local/android-toolchain/bin/arm-linux-androideabi-gcc -o testled testgpcio.c

//then copy to sdcard, and go to c:\adb shell
//no color code first, stop garbled text
alias ls='ls --color=never'

cd /mnt/sdcard/ledfiles
/mnt/sdcard/ledfiles# insmod alpha_gpcio.ko
/mnt/sdcard/ledfiles# cp testled /
/# chmod 777 ./testled
/# ./testled

9.
/////boot load device
add follows in forlinx.rc or init.rc
insmod /ledfiles/alpha_gpcio.ko
chmod 777 /dev/alphagpc

1 則留言:

  1. Really Liked the information you have provided. I have an article relaed to it. I was searching about it on the internet and I found an amazing article on iFixit Site. The provided Article was about a site that provides working modded android apps. The name of the site was “Fineapkapps”. The Article was very halpful, You should read that. Click Here to reach that amazing article: iFixit Modded Apps.

    回覆刪除