buildroot local kernel patch

In 'menuconfig' user can choose a local directory as source of Linux kernel code.
Useful during kernel drivers or modules development.

Tested on three different development machines and different kernel sources.

Signed-off-by: Rafal Fabich <rafal.fabich@...>
---
 linux/Config.in |   14 ++++++++++++++
 linux/linux.mk  |    3 +++
 2 files changed, 17 insertions(+)

diff --git a/linux/Config.in b/linux/Config.in
index 3c50acc..d88d920 100644
--- a/linux/Config.in
+++ b/linux/Config.in
 <at>  <at>  -52,6 +52,11  <at>  <at>  config BR2_LINUX_KERNEL_CUSTOM_GIT
 	  This option allows Buildroot to get the Linux kernel source
 	  code from a Git repository.

+config BR2_LINUX_KERNEL_CUSTOM_LOCAL
+	bool "Local directory"
+	help
+	  This option allows Buildroot to get the Linux kernel source
+	  code from a local directory.
 endchoice

 config BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE
 <at>  <at>  -74,6 +79,13  <at>  <at>  config BR2_LINUX_KERNEL_CUSTOM_GIT_VERSION
 	  Git revision to use in the format used by git rev-parse,
 	  E.G. a sha id, a tag, branch, ..

+config BR2_LINUX_KERNEL_CUSTOM_LOCAL_PATH
+	string "Path to the local directory"
+	depends on BR2_LINUX_KERNEL_CUSTOM_LOCAL
+	help
+	  Path to the local directory with the Linux kernel source code.
+
+
 config BR2_LINUX_KERNEL_VERSION
 	string
 	default "3.7.6" if BR2_LINUX_KERNEL_3_7
 <at>  <at>  -81,6 +93,8  <at>  <at>  config BR2_LINUX_KERNEL_VERSION
 	default BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE if BR2_LINUX_KERNEL_CUSTOM_VERSION
 	default "custom" if BR2_LINUX_KERNEL_CUSTOM_TARBALL
 	default $BR2_LINUX_KERNEL_CUSTOM_GIT_VERSION if BR2_LINUX_KERNEL_CUSTOM_GIT
+	default "local" if BR2_LINUX_KERNEL_CUSTOM_LOCAL
+

 #
 # Patch selection
diff --git a/linux/linux.mk b/linux/linux.mk
index 91a9f50..3f2d460 100644
--- a/linux/linux.mk
+++ b/linux/linux.mk
 <at>  <at>  -15,6 +15,9  <at>  <at>  LINUX_SOURCE = $(notdir $(LINUX_TARBALL))
 else ifeq ($(BR2_LINUX_KERNEL_CUSTOM_GIT),y)
 LINUX_SITE = $(call qstrip,$(BR2_LINUX_KERNEL_CUSTOM_GIT_REPO_URL))
 LINUX_SITE_METHOD = git
+else ifeq ($(BR2_LINUX_KERNEL_CUSTOM_LOCAL),y)
+LINUX_SITE = $(call qstrip,$(BR2_LINUX_KERNEL_CUSTOM_LOCAL_PATH))
+LINUX_SITE_METHOD = local
 else
 LINUX_SOURCE = linux-$(LINUX_VERSION).tar.bz2
 # In X.Y.Z, get X and Y. We replace dots and dashes by spaces in order
-- 
1.7.9.5
### 如何在Buildroot中配置Linux Kernel #### 配置环境准备 进入到`buildroot`编译输出的特定配置目录下,这里以`rockchip_rk3588_defconfig`为例。命令如下所示: ```bash cd buildroot/output/rockchip_rk3588/ ``` 此路径即为所选平台对应的输出目录,在该位置可执行后续的操作[^1]。 #### 执行菜单配置 为了能够调整内核以及其他组件的相关选项,可以通过运行`make menuconfig`来启动交互式的图形化配置界面。这一步骤不仅限于整个系统的软件包选择,也涵盖了对于嵌入其中的Linux Kernel的具体参数设定。 ```bash make menuconfig ``` 在此过程中,用户可以在弹出的界面上找到并进入`Target packages` -> `Kernel`部分来进行更细致化的定制工作。值得注意的是,这里的改动会直接影响最终生成镜像中的内核版本及其特性支持情况[^2]。 #### Linux Kernel具体配置方法 当通过`menuconfig`选择了所需的内核之后,还可以进一步深入到具体的内核配置项之中。通常情况下,完成初步的选择后会在项目根目录下自动生成`.config`文件作为记录;此时如果想要单独修改内核层面的内容,则可以直接利用以下指令打开专门针对内核源码树的配置工具: ```bash make linux-menuconfig ``` 这条命令将会引导至一个更为详尽的子级配置页面,在这里面可以根据实际需求开启或关闭各种驱动程序、功能模块等设置。这些更改同样会被保存回同一个`.config`文件里,并且在整个构建流程期间生效[^3]。 #### 编译过程概述 一旦完成了所有的必要配置步骤,就可以开始正式的编译环节了。只需简单地输入`make`即可触发完整的编译链路——它不仅仅负责处理u-boot和kernel本身,还会一并创建适用于目标硬件架构的root filesystem image。 ```bash make ``` ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值