Difference between revisions of "ROM Android: Compile Kernel untuk MediaTek"

From OnnoWiki
Jump to navigation Jump to search
 
Line 1: Line 1:
MTK Kernel Builder 
+
MTK KERNEL BUIDER - Cách tạo kernel hoàn chỉnh cho MTK chip
  
2012-09-24 16:44:41|  分类: Android |  标签:kernel  android  makefile  |举报 |字号 订阅
+
KConfig Process
KConfig 流程
+
Concerned about point 1 :
关心点1:
 
 
kernel builder:
 
kernel builder:
@makeMtk
+
@ makeMtk
  make -f mediatek/build/makemtk.mk kernel
+
make-f mediatek / build / makemtk.mk kernel
  
@mediatek/build/makemtk.mk
 
  kernel/build.sh
 
  
@kernel/build.sh
+
@ mediatek / build / makemtk.mk
  make mediatek-configs
+
kernel / build.sh
  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
+
@ kernel / build.sh
34 # Frame Buffer Related
+
make mediatek-configs
35 menuconfig MTK_FB # FB_MT6516 FB_MT6573
+
nice make $ {makeflags} $ {makedefs} silentoldconfig
36        bool "MediaTek Framebuffer Driver"
+
make $ {makeflags} $ {makejobs} $ {makedefs}
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.
 
  
 +
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
  
关心点2:
 
menuconfig是从哪里来?这样解释:
 
  
@alps/kernel/Makefile
+
@ kernel / Kconfig
%config: scripts_basic outputmakefile FORCE
+
source "arch / $ SRCARCH / Kconfig"
        $(Q)mkdir -p include/linux include/config
+
@ alps / kernel / arch / arm / Kconfig
        $(Q)$(MAKE) $(build)=scripts/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
  
关于最后的一条命令: 我打印出来是这样的效果:
 
make -f scripts/Makefile.build obj=scripts/kconfig menuconfig
 
  
不知道$(build)变量是怎么计算出来的,后来发现是这样的:
+
@ mediatek/platform/mt6573/kernel/Kconfig/Drivers
@kernel/Makefile
+
34 # Frame Buffer Related
329 include $(srctree)/scripts/Kbuild.include
+
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/scripts/Kbuild.include
+
 
156 ###
+
Point 2 concerns :
157 # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj=
+
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:
 
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
+
@ kernel / scripts / Makefile.build
41 # The filename Kbuild has precedence over Makefile
+
41 # The filename Kbuild has precedence over Makefile
42 kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
+
42 kbuild-dir: = $ (if $ (filter /%, $ (src)), $ (src), $ (srctree) / $ (src))
43 kbuild-file := $(if $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Kbuild,$(kbuild-dir)/Makefile)
+
43 kbuild-file: = $ (if $ (wildcard $ (kbuild-dir) / Kbuild), $ (kbuild-dir) / Kbuild, $ (kbuild-dir) / Makefile)
44 include $(kbuild-file)
+
44 include $ (kbuild-file)
这样就将 kernel/scripts/kconfig/Makefile 包含进去了。
+
This will kernel / scripts / kconfig / Makefile included into it.
查看文件 kernel/scripts/kconfig/Makefile 也就不用我多说了:
+
View file kernel / scripts / kconfig / Makefile I also do not have much to say :
@scripts/kconfig/Makefile
+
@ scripts / kconfig / Makefile
xconfig: $(obj)/qconf
+
xconfig: $ (obj) / qconf
        $< $(Kconfig)
+
$ <$ (Kconfig)
  
gconfig: $(obj)/gconf
 
        $< $(Kconfig)
 
  
menuconfig: $(obj)/mconf
+
gconfig: $ (obj) / gconf
        $< $(Kconfig)
+
$ <$ (Kconfig)
  
config: $(obj)/conf
 
        $< --oldaskconfig $(Kconfig)
 
  
nconfig: $(obj)/nconf
+
menuconfig: $ (obj) / mconf
        $< $(Kconfig)
+
$ <$ (Kconfig)
  
oldconfig: $(obj)/conf
 
        $< --$@ $(Kconfig)
 
  
silentoldconfig: $(obj)/conf
+
config: $ (obj) / conf
        $(Q)mkdir -p include/generated
+
$ <- Oldaskconfig $ (Kconfig)
        $< --$@ $(Kconfig)
 
        cp -f include/generated/autoconf.h include/linux/autoconf.h
 
  
  
关心点3:
+
nconfig: $ (obj) / nconf
.config 文件最终还会被更新一次:查看kernel log
+
  $ <$ (Kconfig)
[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
 
  
看kernel config 的程序 scripts/kconfig/conf 里面的代码有:
 
scripts/kconfig/confdata.c:66:  char *name = getenv("KCONFIG_CONFIG");
 
而@Makefile
 
240:KCONFIG_CONFIG    ?= .config
 
export KCONFIG_CONFIG
 
可以获知这样的信息。
 
  
 +
oldconfig: $ (obj) / conf
 +
$ <- $ @ $ (Kconfig)
  
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  
+
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
 
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==

Latest revision as of 05:50, 31 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