TCP/IP Architecture Model: 4-Layers vs. OSI 7 Layers

本文对比了TCP/IP模型与OSI模型的区别,详细介绍了TCP/IP四层模型:应用层、传输层、网络层和网络接入层的功能及关键特性。在发送数据时,每一层都会为上层传递下来的数据添加控制信息,而接收数据时则会移除这些控制信息。

TCP/IP architecture does not exactly follow the OSI model. Unfortunately, there is no universal agreement regarding how to describe TCP/IP with a layered model. It is generally agreed that TCP/IP has fewer levels (from three to five layers) than the seven layers of the OSI model. We adopt a four layers model for the TCP/IP architecture.

TCP/IP architecture omits some features found under the OSI model, combines the features of some adjacent OSI layers and splits other layers apart. The 4-layer structure of TCP/IP is built as information is passed down from applications to the physical network layer. When data is sent, each layer treats all of the information it receives from the upper layer as data, adds control information (header) to the front of that data and then pass it to the lower layer. When data is received, the opposite procedure takes place as each layer processes and removes its header before passing the data to the upper layer.

The TCP/IP 4-layer model and the key functions of each layer is described below:

Application Layer

The Application Layer in TCP/IP groups the functions of OSI Application, Presentation Layer and Session Layer. Therefore any process above the transport layer is called an Application in the TCP/IP architecture. In TCP/IP socket and port are used to describe the path over which applications communicate. Most application level protocols are associated with one or more port number.

Transport Layer

In TCP/IP architecture, there are two Transport Layer protocols. The Transmission Control Protocol (TCP) guarantees information transmission. The User Datagram Protocol (UDP) transports datagram swithout end-to-end reliability checking. Both protocols are useful for different applications.

Network Layer

The Internet Protocol (IP) is the primary protocol in the TCP/IP Network Layer. All upper and lower layer communications must travel through IP as they are passed through the TCP/IP protocol stack. In addition, there are many supporting protocols in the Network Layer, such as ICMP, to facilitate and manage the routing process.

Network Access Layer

In the TCP/IP architecture, the Data Link Layer and Physical Layer are normally grouped together to become the Network Access layer. TCP/IP makes use of existing Data Link and Physical Layer standards rather than defining its own. Many RFCs describe how IP utilizes and interfaces with the existing data link protocols such as Ethernet, Token Ring, FDDI, HSSI, and ATM. The physical layer, which defines the hardware communication properties, is not often directly interfaced with the TCP/IP protocols in the network layer and above.

TCP/IP Architecture Model: 4-Layers vs. OSI 7 Layers

TCP/IP Architecture Model: 4-Layers vs. OSI 7 Layers

ERROR: /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd_1.4.74.bb: Unable to get checksum for lighttpd SRC_URI entry lighttpd-custom.conf: file could not be found The following paths were searched: /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd-1.4.74/tdx-distro/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd/tdx-distro/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/files/tdx-distro/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd-1.4.74/tdx-xwayland/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd/tdx-xwayland/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/files/tdx-xwayland/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd-1.4.74/verdin-imx8mm/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd/verdin-imx8mm/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/files/verdin-imx8mm/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd-1.4.74/mx8mm-nxp-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd/mx8mm-nxp-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/files/mx8mm-nxp-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd-1.4.74/mx8mm-generic-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd/mx8mm-generic-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/files/mx8mm-generic-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd-1.4.74/mx8m-nxp-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd/mx8m-nxp-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/files/mx8m-nxp-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd-1.4.74/mx8m-generic-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd/mx8m-generic-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/files/mx8m-generic-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd-1.4.74/mx8-nxp-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd/mx8-nxp-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/files/mx8-nxp-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd-1.4.74/mx8-generic-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd/mx8-generic-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/files/mx8-generic-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd-1.4.74/imxgpu3d/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd/imxgpu3d/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/files/imxgpu3d/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd-1.4.74/imxgpu2d/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd/imxgpu2d/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/files/imxgpu2d/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd-1.4.74/imxviv/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd/imxviv/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/files/imxviv/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd-1.4.74/imxgpu/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd/imxgpu/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/files/imxgpu/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd-1.4.74/imxvpu/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd/imxvpu/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/files/imxvpu/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd-1.4.74/imxdrm/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd/imxdrm/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/files/imxdrm/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd-1.4.74/imx-nxp-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd/imx-nxp-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/files/imx-nxp-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd-1.4.74/imx-generic-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd/imx-generic-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/files/imx-generic-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd-1.4.74/tdx/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd/tdx/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/files/tdx/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd-1.4.74/use-nxp-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd/use-nxp-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/files/use-nxp-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd-1.4.74/armv8a/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd/armv8a/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/files/armv8a/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd-1.4.74/aarch64/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd/aarch64/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/files/aarch64/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd-1.4.74/aarch64/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd/aarch64/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/files/aarch64/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd-1.4.74/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/files/lighttpd-custom.conf ERROR: Parsing halted due to errors, see error messages above
最新发布
09-15
<think> 我们正在处理一个BitBake构建错误,错误信息表明在构建`tdx-reference-minimal-image`时,无法找到`lighttpd-custom.conf`文件,导致无法计算校验和。具体错误是: `ERROR: /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd_1.4.74.bb: Unable to get checksum for lighttpd SRC_URI entry lighttpd-custom.conf: file could not be found` ### 错误原因分析 1. **问题根源**:BitBake在构建`lighttpd`配方(recipe)时,会下载或使用指定的源代码和文件。在`SRC_URI`变量中列出了需要获取的文件,其中包含`lighttpd-custom.conf`。但是,BitBake无法找到这个文件,因此无法计算其校验和(checksum),导致构建失败。 $$ \text{错误原因}: \quad \text{SRC\_URI中的文件} \rightarrow \text{lighttpd-custom.conf} \quad \text{缺失} $$ 2. **可能的原因**: - 该文件在配方指定的路径中不存在(可能是配方错误,或者文件被移动/删除)。 - 该文件位于一个层(layer)中,但当前层的配置没有正确包含该文件。 - 配方中指定的文件路径不正确。 ### 解决步骤 #### 步骤1: 定位配方文件 根据错误信息,配方文件位于: `/home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd_1.4.74.bb` (注意:`build/../`实际上就是上一层目录,所以绝对路径可能是:`/home/louie/oe-core/layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd_1.4.74.bb`) 打开该配方文件,查看`SRC_URI`变量: ```bash nano /home/louie/oe-core/layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd_1.4.74.bb ``` 查找类似以下的行: ```bitbake SRC_URI = "http://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-${PV}.tar.xz \ file://lighttpd.conf \ file://lighttpd-custom.conf \ ... " ``` 注意:其中`file://`表示从配方所在目录或其子目录中获取文件。 #### 步骤2: 确认文件是否存在 在配方文件所在目录中查找`lighttpd-custom.conf`文件: ```bash ls /home/louie/oe-core/layers/openembedded-core/meta/recipes-extended/lighttpd/files/ ``` 通常,`file://`指定的文件会放在配方文件所在目录下的`files`子目录中。 如果该目录下没有`lighttpd-custom.conf`,则说明文件缺失。 #### 步骤3: 解决文件缺失问题 根据情况选择以下方法之一: - **方法1:添加缺失的文件**(如果该文件确实是必需的) 1. 检查其他层(特别是自定义层`meta-custom`)中是否有该文件。如果有,将其复制到正确位置: ```bash cp /path/to/meta-custom/recipes-extended/lighttpd/files/lighttpd-custom.conf \ /home/louie/oe-core/layers/openembedded-core/meta/recipes-extended/lighttpd/files/ ``` 2. 如果文件不存在于任何层中,可能需要从其他来源获取(如上游配方或重新创建)。 - **方法2:修改配方**(如果该文件不是必需的,或者已被替换) 如果这个`lighttpd-custom.conf`文件实际上并不需要(例如,已经被其他配置取代),或者它属于自定义配置应该由另一个层提供,那么可以修改配方,移除对它的引用: ```bitbake # 在lighttpd_1.4.74.bb中,移除或注释掉包含该文件的行 SRC_URI = "http://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-${PV}.tar.xz \ file://lighttpd.conf \ # file://lighttpd-custom.conf \ # 注释掉这一行 ... " ``` 注意:如果这个文件是由另一个层(如自定义层)通过`.bbappend`文件添加的,那么问题可能在于自定义层的配置不正确,导致该文件没有被正确包含。此时需要检查自定义层中对应的`.bbappend`文件。 #### 步骤4: 验证校验和 在修复文件缺失问题后,需要让BitBake重新计算校验和: ```bash bitbake -c cleansstate lighttpd bitbake lighttpd ``` 或者,直接重新构建镜像: ```bash PARALLEL_MAKE="-j 6" BB_NUMBER_THREADS="6" bitbake tdx-reference-minimal-image ``` ### 预防措施 1. **层继承检查**:确保自定义层(如`meta-custom`)正确覆盖了`lighttpd`配方。自定义层中应有对应的`.bbappend`文件,路径为: ```text meta-custom/recipes-extended/lighttpd/lighttpd_%.bbappend ``` 在该文件中,可以添加或替换文件。例如: ```bitbake FILESEXTRAPATHS:prepend := "${THISDIR}/files:" ``` 然后在`meta-custom/recipes-extended/lighttpd/files/`目录下放置`lighttpd-custom.conf`。 2. **配方文件完整性**:定期检查配方中引用的本地文件是否存在。 ### 总结 $$ \text{解决流程}: \quad \text{定位配方} \rightarrow \text{检查文件} \rightarrow \text{补充文件或修改配方} \rightarrow \text{重新构建} $$ 通过上述步骤,应该能够解决校验和错误,成功构建镜像。 ### 相关问题 1. 如何为BitBake配方添加自定义配置文件? 2. 如何处理BitBake构建中的校验和错误? 3. 如何正确使用`.bbappend`文件修改现有配方? 4. 在Yocto项目中,如何管理本地文件(`file://`)的校验和? 5. 如何调试BitBake构建中的文件缺失问题? </think> ### BitBake构建错误:无法获取lighttpd-custom.conf校验和的解决方案 #### 错误原因分析 错误信息表明BitBake在构建`lighttpd`配方时无法找到`lighttpd-custom.conf`文件: $$ \text{ERROR}: \quad \text{Unable to get checksum for lighttpd SRC\_URI entry lighttpd-custom.conf} $$ 根本原因是: 1. **SRC_URI配置问题** 在`lighttpd_1.4.74.bb`配方中声明了该文件但实际不存在: ```bitbake SRC_URI += "file://lighttpd-custom.conf" # 声明但未提供文件 ``` 2. **文件位置错误** BitBake默认在配方目录的`files/`子目录查找该文件,路径应为: $$ \text{正确路径}: \quad \frac{\text{oe-core}}{\text{layers}}/\text{openembedded-core}/\text{meta}/\text{recipes-extended}/\text{lighttpd}/\text{files}/\text{lighttpd-custom.conf} $$ --- ### 完整解决步骤 #### 步骤1:验证文件是否存在 检查默认文件位置: ```bash ls /home/louie/oe-core/layers/openembedded-core/meta/recipes-extended/lighttpd/files/ ``` - 如果文件存在 ➜ 跳到步骤3 - 如果文件缺失 ➜ 继续步骤2 #### 步骤2:创建配置文件 创建缺失的配置文件: ```bash # 创建文件目录 mkdir -p /home/louie/oe-core/layers/openembedded-core/meta/recipes-extended/lighttpd/files # 创建基础配置模板 cat > /home/louie/oe-core/layers/openembedded-core/meta/recipes-extended/lighttpd/files/lighttpd-custom.conf << EOF server.modules += ("mod_access", "mod_alias") # 自定义配置区域 alias.url = ("/static/" => "/var/www/static/") EOF ``` #### 步骤3:添加文件校验和 生成文件的SHA256校验和: ```bash cd /home/louie/oe-core/layers/openembedded-core/meta/recipes-extended/lighttpd/files sha256sum lighttpd-custom.conf > lighttpd-custom.conf.sha256 ``` #### 步骤4:更新配方文件 编辑配方文件确保正确引用: ```bash nano /home/louie/oe-core/layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd_1.4.74.bb ``` 确认包含以下内容: ```bitbake SRC_URI = " \ http://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-${PV}.tar.xz \ file://lighttpd.conf \ file://lighttpd-custom.conf \ # 关键行 " ``` #### 步骤5:清理并重建 ```bash # 清理lighttpd构建状态 bitbake -c cleansstate lighttpd # 重新构建镜像 PARALLEL_MAKE="-j 6" BB_NUMBER_THREADS="6" bitbake tdx-reference-minimal-image ``` --- ### 关键配置说明 | 配置要素 | 要求 | 示例值 | |---------|------|--------| | **文件位置** | 必须在`files/`子目录 | `.../lighttpd/files/lighttpd-custom.conf` | | **配方声明** | 需在SRC_URI列出 | `file://lighttpd-custom.conf` | | **校验和文件** | 必须与文件同名+.sha256 | `lighttpd-custom.conf.sha256` | | **文件权限** | 应设为可读 | `chmod 644 lighttpd-custom.conf` | --- ### 预防措施 1. **使用bbappend覆盖配置** 在自定义层创建覆盖文件: ```bash meta-custom/recipes-extended/lighttpd/lighttpd_%.bbappend ``` 内容: ```bitbake FILESEXTRAPATHS:prepend := "${THISDIR}/files:" SRC_URI:append = " file://custom.conf" ``` 2. **配置验证命令** ```bash bitbake -e lighttpd | grep ^SRC_URI= # 应显示包含file://lighttpd-custom.conf ``` --- ### 相关问题 1. 如何在Yocto项目中添加自定义配置文件到BitBake配方? 2. BitBake的SRC_URI机制如何处理本地文件(file://)? 3. Yocto项目中如何正确管理配置文件的校验和? 4. 如何通过bbappend文件修改现有配方而不直接编辑原配方? 5. 调试BitBake文件找不到错误的基本方法有哪些? > 通过以上步骤,可彻底解决因配置文件缺失导致的校验和错误,确保后续构建成功完成。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值