OpenWrt添加新平台的支持,文件路径全解析

发布时间 2023-09-14 22:36:56作者: 上官飞鸿

 Adding new SoC to OpenWrt by Hauke Mehrtens - OpenWrt Summit - YouTube

虽然它有7年了,但是我看结构还没怎么变,口音挺重的,网易见外翻译不动,听不懂,ppt还是可以记录翻译一下的。

看来很多patch都不是必要的。

 

target 目标平台
represents soc line 标识目标线
target/linux/<target>/ 目录为

subtarget 子目标
represents soc generation 代表soc生成
target/linux/<garget>/<subtarget>/ 目录为

profile 专用文件
for each board 每个板子都又
target/linux/<target>/<subtarget>/profiles/<vendor>.mk 文件为

target 目标平台
target name 平台名
cpu type cpu类型
compiler options 编译选项
kernel patches 内核选项
additional kernel files 附件内核文件
kernel configuration 内核配置
image building scripts 文件编译脚本
base files 基本文件

subtarget 子目标
specialization of a target 专用一个目标
defferent kernel options 不同的内核选项
different compiler options 不同的编译器选项

profile
same kernel binary as above(sub)target 目标(子目标)二进制内核
different default packages 不同的默认包
specific image headers 特定的文件头

target Makefile 目标的Makefile
target/linux/<target>/Makefile 路径
target name and description 目标名称和描述
configuration for architecture,cpu type 架构配置,cpu类型
linux version to use 要使用的linux版本

kernel code 内核代码
the easiest if everything needed is upstream 如果上游有代码,将非常简单
kernel patches 内核修补程序
kernel files 内核文件
openwrt kernel packages openwrt内核包

kernel patches 内核补丁
apply patches on top of the mainline kernel 在主线内核上应用补丁
different layers 不同级别
target/linux/generic/patches-3.18/ 通用路径
target/linux/<target>/patches-3.18/ 目标专用路径
+ when change to an existing file 当更改为现有文件时
+ when patch already exists 当修补程序已经存在时
+ when backport for upstream kernel 当为上游内核进行后台

kernel files 内核文件
copy additional files into the mainline kernel 将其他文件复制到主线内核中
same directory structure as kernel 与内核相同的目录结构
different layers 不同层次
target/linux/generic/files 通用路径
target/linux/<target>/files 目标专用路径
+ when new driver with new file(s) +当具有新文件的新驱动程序


OpenWrt kernel packages Openwrt内核包
builds module as an external kernel module 将模块构建为外部内核模块
doc:http://wiki.openwrt.org/doc/devel/packages 文档地址
+ when a tar is normally used for distribution 当一个tar文件用作分发时

Kernel modules 内核模块
OpenWrt kmod package OpenWrt kmod包
selected in menuconfig 在菜单配置中选择
profile can select own set of kmod packages profile可以选择自己的一组kmod包
options should not affect kernel binary 选项不应影响二进制内核
placed globally for all targets 为所有目标全局放置
package/kernel/linux/modules/
placed into target directory 放入目标目录
target/linux/<target>/modules.mk
edit with:make kernel_menuconfig 编辑方式:make kernel_menuconfig


Build in Configuration 内置配置
different layers 不同目录
target/linux/generic/config-3.18
target/linux/<target>/config-3.18
target/linux/<target>/<subtarget>/config-default
no modules selected here 此处未选择任何模块

File system 文件系统
spi or parallel flash SPI或parallel 闪存
squashfs + appended jffs2 as overlay squashfs附加jffs2覆盖
NAND system Nand系统
surrounded by UBIFS BUIFS包围?
Some targets use ext4 or yaffs2,other possible 一些目标使用ext4,yaffs2,或其他格式

image generation 镜像生成
target/linux/<target>/image/Makefile 镜像生成配置文件
many vendor bootloader need a special firmware format 许多供应商的bootloader需要一种特殊的固件格式
also takes device tree files from /target/linux/<target>/dts/ 还从dts目录获取设备树文件


base files 基本文件
target/linux/<target>/base-files
default files for root file system 根文件系统的默认文件
etc/diag.sh
return status led 返回led状态
etc/uci-defaults/
shell scripts executed when booted 启动时执行的shell脚本

Submitting patches 提交补丁
submit early,submit often 尽早提交,经常提交
if it boots it is sufficient 如果它启动就足够了
similar rules as for the linux kernel apply for openwrt 与linux内核类似的规则适用于openwrt