Android kernel build from source code and from prebuilt

本文详细介绍了如何在AOSP中添加新产品并构建内核,特别是针对HTC flounder设备在Nougat上的不同配置。通过定义vendorsetup.sh、PRODUCT_MAKEFILES,执行'lunch'命令,选择不同的KERNEL_SRC_DIR或TARGET_PREBUILT_KERNEL来决定是构建源码还是预编译内核。关键步骤包括BoardConfig.mk和AndroidBoard.mk的配置,以及AndroidKernel.mk中的源码和预编译选项。
摘要由CSDN通过智能技术生成

When building android project, we can use prebuilt linux kernel or kernel source code.

About how to add new product in AOSP and android build steps,please refer to Android build tips andAndroid Makefile 具体是 如何识别 TARGET_PRODUCT 变量

I want to use an example to elaborate the build step of a product and how to build kernel.

Example: Add a new flounder device on Nougat. Htc/flounder is already on Nougat, but I want to use different configuration to build it. So I define a new flounder product and add different configurations.

1. Define vendorsetup.sh (device/company/tablet/products/vendorsetup.sh)-------------use print_lunch_menu command to check

add_lunch_combo firetab_flounder-userdebug

2. Define PRODUCT_MAKEFILES in device/company/tablet/products/flounder/AndroidProducts.mk

9PRODUCT_MAKEFILES := \
10        $(LOCAL_DIR)/firetab_flounder.mk

3. When executing "lunch firetab_flounder-userdebug" command, build system will searching firetab_flounder.mk and execute it.    ----use "make dump-products" to check

In this file, you can define KERNEL_SRC_DIR to provide kernel source code path if you want to build kernel from source code.

You can also define TARGET_PREBUILT_KERNEL to provider prebuilt kernel path if you want to build kernel from prebuilt binary.

9# Setup to build custom kernel
10KERNEL_CFG_NAME ?= flounder
11KERNEL_SRC_DIR ?= kernel/htc/flounder
12TARGET_KERNEL_ARCH ?= arm64
13KERNEL_OUT_DIR ?= $(PRODUCT_OUT)/linux/kernel ----------------- $(PRODUCT_OUT)=out/target/product/flounder32
14
15# Check for availability of kernel source
16ifneq ($(wildcard $(KERNEL_SRC_DIR)/Makefile),)
17  # Give precedence to TARGET_PREBUILT_KERNEL
18  ifeq ($(TARGET_PREBUILT_KERNEL),)
19    TARGET_KERNEL_BUILT_FROM_SOURCE := true
20  endif
21endif
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值