您的位置:首页 > 游戏 > 手游 > openwrt 23.05.2 稳定版本 导入树莓派4B

openwrt 23.05.2 稳定版本 导入树莓派4B

2024/11/16 6:40:04 来源:https://blog.csdn.net/mohaoyuan/article/details/140111205  浏览:    关键词:openwrt 23.05.2 稳定版本 导入树莓派4B

openwrt 23.05.2 稳定版本 导入树莓派4B

强烈建议新手使用稳定版本

这里真的非常感谢这篇博客提供了大量支持,本文有大量篇幅抄袭。
https://blog.csdn.net/qq_44730817/article/details/135258664

编译系统(Build system usage)

下载源代码(Downloading sources)

Clone the Git repository using the following command.

	git clone https://git.openwrt.org/openwrt/openwrt.git [<buildroot>]//如果直接下载到当前路径[<buildroot>]可以省略//如果不想到当前目录,其中 [] 替换为你的编译目录,比如我的为 ~/tmp/build/openwrt/![在这里插入图片描述](https://img-blog.csdnimg.cn/direct/fa2d9e4b2010495c9a1636e75f9faa9b.png)

选择一个指定稳定版本 v23.05.2

	git branch -agit taggit checkout v23.05.2//这里其实是git切换分支到子仓库

更新 Feed

	./scripts/feeds update -a./scripts/feeds install -a//如果运行显示找不到可以先运行下面的apt search qemu-img   --- 查找文件名apt install qemu-utils   -- 得到文件名,install

因为网络环境的问题,建议重复执行上面的命令直到能够看到完全正常为止,正常如下
重复运行 ./scripts/feeds update -a 直到显示如下

shenyanwu@shenyanwu:~/tmp/build/openwrt$ ./scripts/feeds update -a
Updating feed 'packages' from 'https://git.openwrt.org/feed/packages.git^8e3a1824645f5e73ec44c897ac0755c53fb4a1f8' ...
Updating feed 'luci' from 'https://git.openwrt.org/project/luci.git^7739e9f5b03b830f51d53c384be4baef95054cb3' ...
Updating feed 'routing' from 'https://git.openwrt.org/feed/routing.git^83ef3784a9092cfd0a900cc28e2ed4e13671d667' ...
Updating feed 'telephony' from 'https://git.openwrt.org/feed/telephony.git^9746ae8f964e18f04b64fbe1956366954ff223f8' ...
Create index file './feeds/packages.index' 
Create index file './feeds/luci.index' 
Create index file './feeds/routing.index' 
Create index file './feeds/telephony.index' 
shenyanwu@shenyanwu:~/tmp/build/openwrt$

重复运行 ./scripts/feeds install -a 直到显示如下

shenyanwu@shenyanwu:~/tmp/build/openwrt$ ./scripts/feeds install -a
Collecting package info: package/feeds/packages/udp-broadcast-relay-redux-openwr
Collecting package info: done
Installing all packages from feed packages.
Installing all packages from feed luci.
Installing all packages from feed routing.
Installing all packages from feed telephony.
shenyanwu@shenyanwu:~/tmp/build/openwrt$ 

我的版本是 23.05.2,树莓派4B
如果你的设备不是树莓派,你可以在官方的下载目录去找到与你设备芯片对应的配置文件链接: 传送门

编译镜像配置

	make menuconfig

运行此命令后等待片刻则会出现配置选择,通过上下方向键 ↑ ↓ 进行选择,回车键 ↵ 进入,空格键 Space 选择,其中选项前面的 表示编译为独立的包,即类似安装包,不会在编译好的系统中存在,需要另外安装, <*> 表示编译为内建包,即相当于直接编译至系统内部,不需要另外再安装,连续按下两次退出键 ESC 返回上一级目录,最后保存好的配置文件将会在当前的 OpenWrt 目录下生成一个名为 .config 的隐藏文件
我们在上一步已经导入了官方的config配置文件,这一步可以不执行,但是可以进去看看学习参考。
在编译命令之前,可以运行一个检查命令,用来检查你的依赖项,包的一些先决条件等是否满足要求,还会从中删除过时的项目,例如对不存在的软件包或配置选项的引用

	make defconfig

我的运行如下图所示:

shenyanwu@shenyanwu:~/tmp/build/openwrt$ make defconfig
tmp/.config-package.in:33826:error: recursive dependency detected!
tmp/.config-package.in:33826:	symbol PACKAGE_python3-pymysql depends on PYTHON3_PYMYSQL_SHA_PASSWORD_SUPPORT
feeds/packages/lang/python/pymysql/Config.in:4:	symbol PYTHON3_PYMYSQL_SHA_PASSWORD_SUPPORT depends on PACKAGE_python3-pymysql
For a resolution refer to Documentation/kbuild/kconfig-language.rst
subsection "Kconfig recursive dependency limitations"#
# configuration written to .config
#
shenyanwu@shenyanwu:~/tmp/build/openwrt$

此处检测到发生了一个依赖错误,通过查询 OpenWrt 官方 Github 的 issues,找到解决方案,链接 issues #22668

问题在于 feeds/packages/lang/python/pymysql 路径下 Makefile 里面的依赖冲突,该 issues 给出了解决方案,对 Makefile 文件修改如下,其中段落前面的 - 代表需要删除的部分, + 代表需要增添的部分

 ## Copyright (C) Alexandru Ardelean <ardeleanalex@gmail.com>## This is free software, licensed under the GNU General Public License v2.# See /LICENSE for more information.#include $(TOPDIR)/rules.mkPKG_NAME:=pymysqlPKG_VERSION:=1.0.2
-PKG_RELEASE:=1
+PKG_RELEASE:=2PYPI_NAME:=PyMySQLPKG_HASH:=816927a350f38d56072aeca5dfb10221fe1dc653745853d30a216637f5d7ad36PKG_MAINTAINER:=Alexandru Ardelean <ardeleanalex@gmail.com>PKG_LICENSE:=MITPKG_LICENSE_FILES:=LICENSEPKG_CONFIG_DEPENDS:=CONFIG_PYTHON3_PYMYSQL_SHA_PASSWORD_SUPPORTinclude ../pypi.mkinclude $(INCLUDE_DIR)/package.mkinclude ../python3-package.mk-define Package/python3-pymysql
+define Package/python3-pymysql/DefaultSUBMENU:=PythonSECTION:=langCATEGORY:=LanguagesTITLE:=Pure Python MySQL ClientURL:=https://pymysql.readthedocs.io/
-  DEPENDS:=+python3 +PYTHON3_PYMYSQL_SHA_PASSWORD_SUPPORT:python3-cryptographyendef-define Package/python3-pymysql/config
-  source "$(SOURCE)/Config.in"
+define Package/python3-pymysql
+$(call Package/python3-pymysql/Default)
+  DEPENDS:=+python3endefdefine Package/python3-pymysql/descriptionThis package contains a pure-Python MySQL client library, based on PEP 249.endef+define Package/python3-pymysql-sha-pwd
+$(call Package/python3-pymysql/Default)
+  TITLE+=w/ SHA256 password auth
+  DEPENDS:=+python3-pymysql $(RUST_ARCH_DEPENDS) +PACKAGE_python3-pymysql-sha-pwd:python3-cryptography
+endef+define Package/python3-pymysql-sha-pwd/description
+  This is a meta-package installing python3-pymysql and python3-cryptography
+  packages to be able to use pymysql with “sha256_password” or
+  “caching_sha2_password” for authentication.
+endef
+
+define Package/python3-pymysql-sha-pwd/install
+  true
+endef$(eval $(call Py3Package,python3-pymysql))$(eval $(call BuildPackage,python3-pymysql))$(eval $(call BuildPackage,python3-pymysql-src))
+$(eval $(call BuildPackage,python3-pymysql-sha-pwd))

修改后的完整文件如下

#
# Copyright (C) Alexandru Ardelean <ardeleanalex@gmail.com>
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#include $(TOPDIR)/rules.mkPKG_NAME:=pymysql
PKG_VERSION:=1.0.2
PKG_RELEASE:=2PYPI_NAME:=PyMySQL
PKG_HASH:=816927a350f38d56072aeca5dfb10221fe1dc653745853d30a216637f5d7ad36PKG_MAINTAINER:=Alexandru Ardelean <ardeleanalex@gmail.com>
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSEPKG_CONFIG_DEPENDS:=CONFIG_PYTHON3_PYMYSQL_SHA_PASSWORD_SUPPORTinclude ../pypi.mk
include $(INCLUDE_DIR)/package.mk
include ../python3-package.mkdefine Package/python3-pymysql/DefaultSUBMENU:=PythonSECTION:=langCATEGORY:=LanguagesTITLE:=Pure Python MySQL ClientURL:=https://pymysql.readthedocs.io/
endefdefine Package/python3-pymysql
$(call Package/python3-pymysql/Default)DEPENDS:=+python3
endefdefine Package/python3-pymysql/descriptionThis package contains a pure-Python MySQL client library, based on PEP 249.
endefdefine Package/python3-pymysql-sha-pwd
$(call Package/python3-pymysql/Default)TITLE+=w/ SHA256 password authDEPENDS:=+python3-pymysql $(RUST_ARCH_DEPENDS) +PACKAGE_python3-pymysql-sha-pwd:python3-cryptography
endefdefine Package/python3-pymysql-sha-pwd/descriptionThis is a meta-package installing python3-pymysql and python3-cryptographypackages to be able to use pymysql with “sha256_password” or“caching_sha2_password” for authentication.
endefdefine Package/python3-pymysql-sha-pwd/installtrue
endef$(eval $(call Py3Package,python3-pymysql))
$(eval $(call BuildPackage,python3-pymysql))
$(eval $(call BuildPackage,python3-pymysql-src))
$(eval $(call BuildPackage,python3-pymysql-sha-pwd))

修改完成后重新运行 make defconfig,结果如下

	shenyanwu@shenyanwu:~/tmp/build/openwrt$ make defconfigCollecting package info: done## configuration written to .config#shenyanwu@shenyanwu:~/tmp/build/openwrt$

下载相关源以及多核编译的依赖(Download sources and multi core compile)

	make download

此命令将会预先下载你依赖的所有源代码,同时开启支持多核编译的功能,这样你才可以成功编译,并且使用多核编译提升编译速度

编译镜像(Building images)

	make -j $(($(nproc)+1))

这个命令属于多核编译开启,使用你所有的核心进行编译,当然如果你想使用指定核心数量编译,请在 -j 命令后指定核心数,例如单核编译

	make -j1

当然你要是不放心之前下载的相关源以及多核编译的依赖,你可以执行下面的代码,在编译前重新下载一次,然后自动开始编译

	make -j $(nproc) download world

你可能在别的教程里面见过在命令后面还有 V=sc 或者 V=s,这是打开日志显示,在你编译出错排错时,会在终端进行显示错误信息,对于排除错误很有用,比如以下命令会输出很多日志提供错误帮助

	make -j1 download world V=s

建议在第一次编译时,如果你不确定你的配置项都满足编译要求,可以使用单核,日志输出编译 make -j1 V=s 来确保出错后进行排除。

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com