2012年5月14日 星期一

How to create new splash on android

1. Using GIMP to create new picture and store is as BMP file
2. Convert BMP to RAW format
    #convert initlogo.bmp rgb:initlogo.raw
3. Convert RAW to RLE format
    #rgb2565 < initlogo.raw > initlogo.rle

Image convert obj file by objcopy

objcopy

copy and translate object files:
  • 複製 .o 檔 (obj file) 的內部內容到另一個檔案中 (.o 檔或是單純地做 hex dump)
  • 將一個 binary data (如JPEG 圖片) 做成 .o 檔
  • 把執行碼從 ELF 中抽取出來
  • 只抽取指定的 section

常用參數

objcopy [`-I' bfdname|`--input-target='bfdname]
        [`-O' bfdname|`--output-target='bfdname]
        [`-B' bfdarch|`--binary-architecture='bfdarch]
        [`-S'|`--strip-all']
        [`-g'|`--strip-debug']
        [`-j' sectionname|`--only-section='sectionname]
        [`-R' sectionname|`--remove-section='sectionname]
        [`--help']
        infile [outfile]

GNU binutil manual



==============================================
 Ex:
splash.o:
    $(OBJCOPY) -I binary -O elf32-littlearm -B arm initlogo.rle $@
  



2012年3月28日 星期三

How to separate config into project

How to separate config into project:

Ex: If we want to access different DRAM, we must build differnet config into image

1. bootloader:
Bootloader need to build different configuration

step1:
Makefile:

+project_config \
+project_512m_config : unconfig
+ @./mkconfig -a cpuproject arm cpu cpuproject
+ @if [ "$(findstring 512m, $@)" ] ; then \
+ echo "#define CONFIG_DRAM_512" >> ./include/config.h ; \
+ else \
+ echo "#define CONFIG_DRAM_1G" >> ./include/config.h ; \
+ fi;


step2: Using this flag to separate DRAM setting
+#ifdef CONFIG_DRAM_512
+ init_ddr();
+#endif



2. kernel
We use parameter to feed build kernel.

step1: Using parameter to feed build kernel
kernel:
make -C $(KERNEL_PATH) ARCH=$(ARCH) $(KERNEL_CONFIG)
make -C $(KERNEL_PATH) BUILD_PLATFORM=$(PLATFORM) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) bzImage

kernel/Makefile:
+ifeq ($(BUILD_PLATFORM),test)
+KBUILD_CFLAGS += -DCONFIG_TEST1
+else
+KBUILD_CFLAGS += -DCONFIG_TEST2
+endif
+

step2: Using this flag to separate different config

+#if defined(CONFIG_TEST1)
+ init_test1();
+#else
+ init_test2();
+#end

2012年3月27日 星期二

how to git format patch in project

#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#This only for one git project
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$git checkout -b BSP-M1 remotes/pobu_git_server/BSP-M1
$git checkout PROJECT-M1
$git format-patch --binary -o __patches BSP-M1...HEAD
$git am __patches/*

#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#This for repo project
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#step1: Collect the patch file
$repo forall -pvc 'git checkout -b BSP-M1 remotes/pobu_git_server/BSP-M1'
$repo forall -pvc 'git checkout PROJECT-M1'
$repo forall -pvc 'git format-patch --binary -o __patches BSP-M1...HEAD'
$find . -name '__patches' -type d -print0 | xargs -0 tar czf patch.tar.gz

#step2: If you get new release and apply this patches
cd new_release
cp ../old_release/patches.tar.gz .
tar xzf patches.tar.gz
repo forall -pvc 'git am __patches/*'

#step3 : Solve conflicts
Dirty works. Use git am (--continue | --skip | --abort) to deal with it.
Please reference http://schacon.github.com/git/git-am.html.

#step4: Clean the patches
cd ../old_release
find -name '__patches' -type d -print0 | xargs -0 rm -f
cd ../new_release
find -name '__patches' -type d -print0 | xargs -0 rm -f

2011年9月19日 星期一

Android Sensor Path

Application layer: application
Application Framwork : Sensor Manager
Sensor JNI
Libraries: Sensor Manager <--> Sensor Service <--> Sensor HAL
Kernel : Input dirver subsystem and Event Dev
Sensor driver


# Sensor Manager Application Layer: /frameworks/base/core/java/android/hardware folder
# Sensor JNI layer: /frameworks/base/core/jni/android_hardware_SensorManager.cpp file
# Sensor Manager Library: /frameworks/base/libs/gui folder
# Sensor Service: /frameworks/base/services/sensorservice folder
# Sensor HAL: /hardware/ti/omap3/libsensors folder
# Accelerometer Sensor driver: /drivers/input/misc/xxxxx.c file



Note: Android 2.3 change the sensor service as Native Sensor code.

2011年9月7日 星期三

Linux script : backslash "\"

backslash "\" : escape next special characters

Ex:
echo "Path is $PATH" ---> This will show $PATH content
echo "Path is \$PATH" ---> This will show $PATH string

The backslash wiil remove the specail meaning of dollar($) sign

Linux script : echo -e

echo -e "My name is \t test"

You will see the My name is test

-e: enable backslash ascapes

The backslash-escaped characters


\a     alert (bell)
\b backspace
\e an escape character
\f form feed
\n new line
\r carriage return
\t horizontal tab
\v vertical tab
\\ backslash
\' single quote
\nnn the eight-bit character whose value is the octal value nnn (one to three digits)
\xHH the eight-bit character whose value is the hexadecimal value HH (one or two hex digits)
\cx a control-x character
reference :http://bash.cyberciti.biz/guide/Quoting