ROM Android: Compile Kernel untuk MediaTek: Difference between revisions

From OnnoCenterWiki
Jump to navigationJump to search
Onnowpurbo (talk | contribs)
New page: MTK Kernel Builder 2012-09-24 16:44:41| 分类: Android | 标签:kernel android makefile |举报 |字号 订阅 KConfig 流程 关心点1: kernel builder: @makeMtk make ...
 
Onnowpurbo (talk | contribs)
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
MTK KERNEL BUIDER - Cách tạo kernel hoàn chỉnh cho MTK chip


MTK Kernel Builder 
KConfig Process
Concerned about point 1 :
kernel builder:
@ makeMtk
make-f mediatek / build / makemtk.mk kernel
 
 
@ mediatek / build / makemtk.mk
kernel / build.sh


2012-09-24 16:44:41|  分类: Android |  标签:kernel  android  makefile  |举报 |字号 订阅
KConfig 流程
关心点1:
kernel builder:
@makeMtk
  make -f mediatek/build/makemtk.mk kernel


@mediatek/build/makemtk.mk
@ kernel / build.sh
  kernel/build.sh
make mediatek-configs
nice make $ {makeflags} $ {makedefs} silentoldconfig
make $ {makeflags} $ {makejobs} $ {makedefs}
 
mediatek-configs goal is how original ? :
@ kernel / Makefile
include $ (srctree) / arch / $ (SRCARCH) / Makefile
@ kernel / arch / arm / Makefile
include .. / mediatek / build / kernel / Makefile
@ mediatek / build / kernel / Makefile
. config mediatek-configs: $ (MTK_ROOT_GEN_CONFIG) / kconfig $ (MTK_ROOT_GEN_CONFIG)
@ echo "[COPY] $ <-> $ @"
@ cp $ <$ @
@ echo "[COPY] $ <->. config"
@ cp $ <. config
 
 
@ kernel / Kconfig
source "arch / $ SRCARCH / Kconfig"
@ alps / kernel / arch / arm / Kconfig
source ".. / mediatek / source / kernel / Kconfig"
@ alps / mediatek / source / kernel / Kconfig
31 if ARCH_MT6573
32 source "../mediatek/platform/mt6573/kernel/Kconfig/Kernel"
33 source "../mediatek/platform/mt6573/kernel/Kconfig/Board"
34 source "../mediatek/platform/mt6573/kernel/Kconfig/Drivers"
35 endif
 
 
@ mediatek/platform/mt6573/kernel/Kconfig/Drivers
34 # Frame Buffer Related
35 menuconfig MTK_FB # FB_MT6516 FB_MT6573
36 bool "MediaTek Framebuffer Driver"
37 depends on FB
38 select FB_CFB_FILLRECT
39 select FB_CFB_COPYAREA
40 select FB_CFB_IMAGEBLIT
41 select FB_SOFT_CURSOR
42 --- help ---
43 This selects the MediaTek (R) frame buffer driver.
44 If you want to use MediaTek (R) frame buffer diver, say Y here.
45 If unsure, say N.
 


@kernel/build.sh
Point 2 concerns :
  make mediatek-configs
menuconfig come from ? Explained:
  nice make ${makeflags} ${makedefs} silentoldconfig
  make ${makeflags} ${makejobs} ${makedefs}
 
mediatek-configs 目标是怎么回事? 原来:
    @kernel/Makefile 
include $(srctree)/arch/$(SRCARCH)/Makefile
    @kernel/arch/arm/Makefile
include ../mediatek/build/kernel/Makefile
    @mediatek/build/kernel/Makefile
.config mediatek-configs: $(MTK_ROOT_GEN_CONFIG)/kconfig $(MTK_ROOT_GEN_CONFIG)
        @echo "[COPY] $< --> $@"
        @cp $< $@
        @echo "[COPY] $< --> .config"
        @cp $< .config


@kernel/Kconfig
  source "arch/$SRCARCH/Kconfig"
@alps/kernel/arch/arm/Kconfig
source "../mediatek/source/kernel/Kconfig"
@alps/mediatek/source/kernel/Kconfig
31 if ARCH_MT6573
32 source "../mediatek/platform/mt6573/kernel/Kconfig/Kernel"
33 source "../mediatek/platform/mt6573/kernel/Kconfig/Board"
34 source "../mediatek/platform/mt6573/kernel/Kconfig/Drivers"
35 endif


@mediatek/platform/mt6573/kernel/Kconfig/Drivers
@ alps / kernel / Makefile
34 # Frame Buffer Related
% config: scripts_basic outputmakefile FORCE
35 menuconfig MTK_FB # FB_MT6516 FB_MT6573
$ (Q) mkdir-p include / linux include / config
36        bool "MediaTek Framebuffer Driver"
$ (Q) $ (MAKE) $ (build) = scripts / kconfig $ @
37        depends on FB
38        select FB_CFB_FILLRECT
39        select FB_CFB_COPYAREA
40        select FB_CFB_IMAGEBLIT
41        select FB_SOFT_CURSOR
42        ---help---
43          This selects the MediaTek(R) frame buffer driver.
44          If you want to use MediaTek(R) frame buffer diver, say Y here.
45          If unsure, say N.




关心点2:
Regarding the last of a command : I print out is this effect:
menuconfig是从哪里来?这样解释:
make-f scripts / Makefile.build obj = scripts / kconfig menuconfig


@alps/kernel/Makefile
%config: scripts_basic outputmakefile FORCE
        $(Q)mkdir -p include/linux include/config
        $(Q)$(MAKE) $(build)=scripts/kconfig $@


关于最后的一条命令: 我打印出来是这样的效果:
I do not know $ (build) variable is how calculated , and later found is this:
make -f scripts/Makefile.build obj=scripts/kconfig menuconfig
@ kernel / Makefile
329 include $ (srctree) / scripts / Kbuild.include


不知道$(build)变量是怎么计算出来的,后来发现是这样的:
@kernel/Makefile
329 include $(srctree)/scripts/Kbuild.include


@kernel/scripts/Kbuild.include
@ kernel / scripts / Kbuild.include
156 ###
156 # # #
157 # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj=
157 # Shorthand for $ (Q) $ (MAKE)-f scripts / Makefile.build obj =
158 # Usage:
158 # Usage:
159 # $(Q)$(MAKE) $(build)=dir
159 # $ (Q) $ (MAKE) $ (build) = dir
160 build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj
160 build: =-f $ (if $ (KBUILD_SRC), $ (srctree) /) scripts / Makefile.build obj
 
 
Thus, parsing out the above things ,
 
 
@ kernel / scripts / Makefile.build
41 # The filename Kbuild has precedence over Makefile
42 kbuild-dir: = $ (if $ (filter /%, $ (src)), $ (src), $ (srctree) / $ (src))
43 kbuild-file: = $ (if $ (wildcard $ (kbuild-dir) / Kbuild), $ (kbuild-dir) / Kbuild, $ (kbuild-dir) / Makefile)
44 include $ (kbuild-file)
This will kernel / scripts / kconfig / Makefile included into it.
View file kernel / scripts / kconfig / Makefile I also do not have much to say :
@ scripts / kconfig / Makefile
xconfig: $ (obj) / qconf
$ <$ (Kconfig)
 
 
gconfig: $ (obj) / gconf
$ <$ (Kconfig)


这样,就解析出来了上面的东西,


@kernel/scripts/Makefile.build
menuconfig: $ (obj) / mconf
41 # The filename Kbuild has precedence over Makefile
  $ <$ (Kconfig)
42 kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
43 kbuild-file := $(if $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Kbuild,$(kbuild-dir)/Makefile)
  44 include $(kbuild-file)
这样就将 kernel/scripts/kconfig/Makefile 包含进去了。
查看文件 kernel/scripts/kconfig/Makefile 也就不用我多说了:
@scripts/kconfig/Makefile
xconfig: $(obj)/qconf
        $< $(Kconfig)


gconfig: $(obj)/gconf
        $< $(Kconfig)


menuconfig: $(obj)/mconf
config: $ (obj) / conf
        $< $(Kconfig)
$ <- Oldaskconfig $ (Kconfig)


config: $(obj)/conf
        $< --oldaskconfig $(Kconfig)


nconfig: $(obj)/nconf
nconfig: $ (obj) / nconf
        $< $(Kconfig)
$ <$ (Kconfig)


oldconfig: $(obj)/conf
        $< --$@ $(Kconfig)


silentoldconfig: $(obj)/conf
oldconfig: $ (obj) / conf
        $(Q)mkdir -p include/generated
$ <- $ @ $ (Kconfig)
        $< --$@ $(Kconfig)
        cp -f include/generated/autoconf.h include/linux/autoconf.h




关心点3:
silentoldconfig: $ (obj) / conf
.config 文件最终还会被更新一次:查看kernel log
  $ (Q) mkdir-p include / generated
[COPY] ../mediatek/config/out/s816_bef/autoconfig/kconfig --> mediatek-configs
  $ <- $ @ $ (Kconfig)
[COPY] ../mediatek/config/out/s816_bef/autoconfig/kconfig --> .config
cp-f include / generated / autoconf.h include / linux / autoconf.h
  HOSTCC  scripts/kconfig/conf.o
  SHIPPED scripts/kconfig/zconf.tab.c
  SHIPPED scripts/kconfig/lex.zconf.c
  SHIPPED scripts/kconfig/zconf.hash.c
  HOSTCC scripts/kconfig/zconf.tab.o
  HOSTLD scripts/kconfig/conf
scripts/kconfig/conf --silentoldconfig Kconfig
#
# configuration written to .config
#
cp -f include/generated/autoconf.h include/linux/autoconf.h


看kernel config 的程序 scripts/kconfig/conf 里面的代码有:
scripts/kconfig/confdata.c:66:  char *name = getenv("KCONFIG_CONFIG");
而@Makefile
240:KCONFIG_CONFIG    ?= .config
export KCONFIG_CONFIG
可以获知这样的信息。


Point 3 concerns :
. config file will eventually be updated once : Check kernel log


mediatek/config/out/s816_bef/autoconfig/kconfig: mediatek/config/mt6575/autoconfig/kconfig/platform  
[COPY] .. / mediatek/config/out/s816_bef/autoconfig/kconfig -> mediatek-configs
[COPY] .. / mediatek/config/out/s816_bef/autoconfig/kconfig -> config.
HOSTCC scripts / kconfig / conf.o
SHIPPED scripts / kconfig / zconf.tab.c
SHIPPED scripts / kconfig / lex.zconf.c
SHIPPED scripts / kconfig / zconf.hash.c
HOSTCC scripts / kconfig / zconf.tab.o
HOSTLD scripts / kconfig / conf
scripts / kconfig / conf - silentoldconfig Kconfig
#
# Configuration written to. Config
#
cp-f include / generated / autoconf.h include / linux / autoconf.h
 
 
Look kernel config program scripts / kconfig / conf inside the code are:
 
scripts / kconfig / confdata.c: 66: char * name = getenv ("KCONFIG_CONFIG");
And @ Makefile
240: KCONFIG_CONFIG = config?.
export KCONFIG_CONFIG
You can learn this information.
 
 
mediatek/config/out/s816_bef/autoconfig/kconfig: mediatek/config/mt6575/autoconfig/kconfig/platform
 
 
mediatek / config / common / autoconfig / kconfig / AEE mediatek/config/s816_bef/autoconfig/kconfig/project


mediatek/config/common/autoconfig/kconfig/AEE mediatek/config/s816_bef/autoconfig/kconfig/project


mediatek/config/out/s816_bef/autoconfig
mediatek/config/out/s816_bef/autoconfig
@echo "[CONFIG] generate mediatek/config/out/s816_bef/autoconfig/kconfig"
@ echo "[CONFIG] generate mediatek/config/out/s816_bef/autoconfig/kconfig"
@cat mediatek/config/mt6575/autoconfig/kconfig/platform mediatek/config/common/autoconfig/kconfig/AEE  
@ cat mediatek/config/mt6575/autoconfig/kconfig/platform mediatek / config / common / autoconfig / kconfig / AEE
 
 
mediatek/config/s816_bef/autoconfig/kconfig/project | python mediatek / build / tools / config / merge-kconfig.py>


mediatek/config/s816_bef/autoconfig/kconfig/project  | python mediatek/build/tools/config/merge-kconfig.py >


mediatek/config/out/s816_bef/autoconfig/kconfig
mediatek/config/out/s816_bef/autoconfig/kconfig


查了一下应该是:
define .mtk.config.generate-auto-merge-rules
.PHONY: mediatek-configs.$(1)
mediatek-configs: mediatek-configs.$(1)
mediatek-configs.$(1): $(2)
$(2): PRIVATE_FILE_LIST := $(3)
$(2): $(3) $(4)
        @echo "[CONFIG] generate $(2)"
        @cat $(3) | $(5) > $(2)
endef


应该是这样类似的$(call .mtk.config.generate-auto-merge-rules,kconfig,xx.xx.xx)
Should be checked :
更有可能是这样的:$(call .mtk.config.generate-auto-rules,xx,xx,xx)
define. mtk.config.generate-auto-merge-rules
这个就要自己去验证了。
. PHONY:. Mediatek-configs $ (1)
mediatek-configs:. mediatek-configs $ (1)
mediatek-configs $ (1):. $ (2)
$ (2): PRIVATE_FILE_LIST: = $ (3)
$ ( 2 ) : $ ( 3 ) $ ( 4 )
@ echo "[CONFIG] generate $ (2)"
@ cat $ (3) | $ (5)> $ (2)
endef
 


This should be similar to the $ (call. Mtk.config.generate-auto-merge-rules, kconfig, xx.xx.xx)
More likely is this : $ (. Call mtk.config.generate-auto-rules, xx, xx, xx)
This is necessary to validate themselves .


==Referensi==
==Referensi==


* http://hubeihuyanwei.blog.163.com/blog/static/28205284201282444441662/
* http://hubeihuyanwei.blog.163.com/blog/static/28205284201282444441662/
* https://www.facebook.com/androidevn/posts/823618704330578

Latest revision as of 22:50, 30 December 2014

MTK KERNEL BUIDER - Cách tạo kernel hoàn chỉnh cho MTK chip

KConfig Process Concerned about point 1 : kernel builder: @ makeMtk make-f mediatek / build / makemtk.mk kernel


@ mediatek / build / makemtk.mk kernel / build.sh


@ kernel / build.sh make mediatek-configs nice make $ {makeflags} $ {makedefs} silentoldconfig make $ {makeflags} $ {makejobs} $ {makedefs}

mediatek-configs goal is how original ? : @ kernel / Makefile include $ (srctree) / arch / $ (SRCARCH) / Makefile @ kernel / arch / arm / Makefile include .. / mediatek / build / kernel / Makefile @ mediatek / build / kernel / Makefile . config mediatek-configs: $ (MTK_ROOT_GEN_CONFIG) / kconfig $ (MTK_ROOT_GEN_CONFIG) @ echo "[COPY] $ <-> $ @" @ cp $ <$ @ @ echo "[COPY] $ <->. config" @ cp $ <. config


@ kernel / Kconfig source "arch / $ SRCARCH / Kconfig" @ alps / kernel / arch / arm / Kconfig source ".. / mediatek / source / kernel / Kconfig" @ alps / mediatek / source / kernel / Kconfig 31 if ARCH_MT6573 32 source "../mediatek/platform/mt6573/kernel/Kconfig/Kernel" 33 source "../mediatek/platform/mt6573/kernel/Kconfig/Board" 34 source "../mediatek/platform/mt6573/kernel/Kconfig/Drivers" 35 endif


@ mediatek/platform/mt6573/kernel/Kconfig/Drivers 34 # Frame Buffer Related 35 menuconfig MTK_FB # FB_MT6516 FB_MT6573 36 bool "MediaTek Framebuffer Driver" 37 depends on FB 38 select FB_CFB_FILLRECT 39 select FB_CFB_COPYAREA 40 select FB_CFB_IMAGEBLIT 41 select FB_SOFT_CURSOR 42 --- help --- 43 This selects the MediaTek (R) frame buffer driver. 44 If you want to use MediaTek (R) frame buffer diver, say Y here. 45 If unsure, say N.


Point 2 concerns : menuconfig come from ? Explained:


@ alps / kernel / Makefile % config: scripts_basic outputmakefile FORCE $ (Q) mkdir-p include / linux include / config $ (Q) $ (MAKE) $ (build) = scripts / kconfig $ @


Regarding the last of a command : I print out is this effect: make-f scripts / Makefile.build obj = scripts / kconfig menuconfig


I do not know $ (build) variable is how calculated , and later found is this: @ kernel / Makefile 329 include $ (srctree) / scripts / Kbuild.include


@ kernel / scripts / Kbuild.include 156 # # # 157 # Shorthand for $ (Q) $ (MAKE)-f scripts / Makefile.build obj = 158 # Usage: 159 # $ (Q) $ (MAKE) $ (build) = dir 160 build: =-f $ (if $ (KBUILD_SRC), $ (srctree) /) scripts / Makefile.build obj


Thus, parsing out the above things ,


@ kernel / scripts / Makefile.build 41 # The filename Kbuild has precedence over Makefile 42 kbuild-dir: = $ (if $ (filter /%, $ (src)), $ (src), $ (srctree) / $ (src)) 43 kbuild-file: = $ (if $ (wildcard $ (kbuild-dir) / Kbuild), $ (kbuild-dir) / Kbuild, $ (kbuild-dir) / Makefile) 44 include $ (kbuild-file) This will kernel / scripts / kconfig / Makefile included into it. View file kernel / scripts / kconfig / Makefile I also do not have much to say : @ scripts / kconfig / Makefile xconfig: $ (obj) / qconf

$ <$ (Kconfig)


gconfig: $ (obj) / gconf

$ <$ (Kconfig)


menuconfig: $ (obj) / mconf

$ <$ (Kconfig)


config: $ (obj) / conf

$ <- Oldaskconfig $ (Kconfig)


nconfig: $ (obj) / nconf

$ <$ (Kconfig)


oldconfig: $ (obj) / conf

$ <- $ @ $ (Kconfig)


silentoldconfig: $ (obj) / conf

$ (Q) mkdir-p include / generated
$ <- $ @ $ (Kconfig)
cp-f include / generated / autoconf.h include / linux / autoconf.h


Point 3 concerns : . config file will eventually be updated once : Check kernel log

[COPY] .. / mediatek/config/out/s816_bef/autoconfig/kconfig -> mediatek-configs
[COPY] .. / mediatek/config/out/s816_bef/autoconfig/kconfig -> config.
HOSTCC scripts / kconfig / conf.o
SHIPPED scripts / kconfig / zconf.tab.c
SHIPPED scripts / kconfig / lex.zconf.c
SHIPPED scripts / kconfig / zconf.hash.c
HOSTCC scripts / kconfig / zconf.tab.o
HOSTLD scripts / kconfig / conf
scripts / kconfig / conf - silentoldconfig Kconfig
#
# Configuration written to. Config
#
cp-f include / generated / autoconf.h include / linux / autoconf.h


Look kernel config program scripts / kconfig / conf inside the code are:

scripts / kconfig / confdata.c: 66: char * name = getenv ("KCONFIG_CONFIG");
And @ Makefile
240: KCONFIG_CONFIG = config?.
export KCONFIG_CONFIG
You can learn this information.


mediatek/config/out/s816_bef/autoconfig/kconfig: mediatek/config/mt6575/autoconfig/kconfig/platform


mediatek / config / common / autoconfig / kconfig / AEE mediatek/config/s816_bef/autoconfig/kconfig/project


mediatek/config/out/s816_bef/autoconfig @ echo "[CONFIG] generate mediatek/config/out/s816_bef/autoconfig/kconfig" @ cat mediatek/config/mt6575/autoconfig/kconfig/platform mediatek / config / common / autoconfig / kconfig / AEE


mediatek/config/s816_bef/autoconfig/kconfig/project | python mediatek / build / tools / config / merge-kconfig.py>


mediatek/config/out/s816_bef/autoconfig/kconfig


Should be checked :

define. mtk.config.generate-auto-merge-rules
. PHONY:. Mediatek-configs $ (1)
mediatek-configs:. mediatek-configs $ (1)
mediatek-configs $ (1):. $ (2)
$ (2): PRIVATE_FILE_LIST: = $ (3)
$ ( 2 ) : $ ( 3 ) $ ( 4 )
@ echo "[CONFIG] generate $ (2)"
@ cat $ (3) | $ (5)> $ (2)
endef


This should be similar to the $ (call. Mtk.config.generate-auto-merge-rules, kconfig, xx.xx.xx) More likely is this : $ (. Call mtk.config.generate-auto-rules, xx, xx, xx) This is necessary to validate themselves .

Referensi