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月28日 星期三
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
#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
訂閱:
文章 (Atom)