(1)命令执行追溯
Sourcebuild/envsetup.sh
Make bootimage -j10
(2)bootimage 目标执行如下
core/main.mk:859:.PHONY:bootimage
core/main.mk:860:bootimage:$(INSTALLED_BOOTIMAGE_TARGET)
(3)执行envsetup.sh脚本,把(TARGET_DEVICE)/BoardConfig.mk包含了进来
build/envsetup.sh:628: localTOPFILE=build/core/envsetup.mk
-->build/core/envsetup.mk:161: $(shell test -d device && find device -maxdepth 4 -path '*/$(TARGET_DEVICE)/BoardConfig.mk') \
下面为里面的内容
BOARD_KERNEL_CMDLINE :=console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 androidboot.hardware=qcommsm_rtb.filter=0x237 ehci-hcd.park=3 androidboot.bootdevice=7824900.sdhcilpm_levels.sleep_disabled=1 loglevel=8 earlyprintk=msm_hsl_uart,0x78b0000
CPXXX/BoardConfig.mk:80:BOARD_KERNEL_PAGESIZE := 2048
CPXXX/BoardConfig.mk:79:BOARD_KERNEL_BASE := 0x80000000
CPXXX/AndroidBoard.mk:34:includekernel/AndroidKernel.mk
(4)包含AndroidKernel.mk
有如下目标需要生成:
50 KERNEL_OUT :=$(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ
51 KERNEL_CONFIG := $(KERNEL_OUT)/.config
52
53 ifeq ($(KERNEL_DEFCONFIG)$(wildcard$(KERNEL_CONFIG)),)
54 $(error Kernel configuration not defined,cannot build kernel)
55 else
56
57 ifeq($(TARGET_USES_UNCOMPRESSED_KERNEL),true)
58 $(info Using uncompressed kernel)
59 TARGET_PREBUILT_INT_KERNEL :=$(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/Image
60 else
61 ifeq ($(KERNEL_ARCH),arm64)
62 TARGET_PREBUILT_INT_KERNEL :=$(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/Image.gz
63 else
64 TARGET_PREBUILT_INT_KERNEL :=$(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/zImage
65 endif
66 endif
67
68 ifeq ($(TARGET_KERNEL_APPEND_DTB), true)
69 $(info Using appended DTB)
70 TARGET_PREBUILT_INT_KERNEL :=$(TARGET_PREBUILT_INT_KERNEL)-dtb
71 endif
72
73 KERNEL_HEADERS_INSTALL := $(KERNEL_OUT)/usr
74 KERNEL_MODULES_INSTALL := system
75 KERNEL_MODULES_OUT :=$(TARGET_OUT)/lib/modules
76
77 TARGET_PREBUILT_KERNEL:= $(TARGET_PREBUILT_INT_KERNEL)
$(TARGET_PREBUILT_INT_KERNEL):$(KERNEL_OUT) $(KERNEL_HEADERS_INSTALL)
107 $(hide) echo "Buildingkernel..."
108 $(hide) rm -rf$(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/dts
109 $(MAKE) -C kernel O=../$(KERNEL_OUT)ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(KERNEL_CFLAGS)
110 $(MAKE) -C kernel O=../$(KERNEL_OUT)ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(KERNEL_CFLAGS)modules
111 $(MAKE) -C kernel O=../$(KERNEL_OUT)INSTALL_MOD_PATH=../../$(KERNEL_MODULES_INSTALL) INSTALL_MOD_STRIP=1ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) m odules_install
112 $(mv-modules)
113 $(clean-module-folder)
$(KERNEL_HEADERS_INSTALL):$(KERNEL_OUT)
116 $(hide) if [ ! -z"$(KERNEL_HEADER_DEFCONFIG)" ]; then \
117 $(hide) rm -f../$(KERNEL_CONFIG); \
118 $(MAKE) -C kernel O=../$(KERNEL_OUT)ARCH=$(KERNEL_HEADER_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE)$(KERNEL_HEADER_DEFCONFIG); \
119 $(MAKE) -C kernelO=../$(KERNEL_OUT) ARCH=$(KERNEL_HEADER_ARCH)CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) headers_install; fi