新浪云怎么做自己的网站,网件路由器r7000,东莞网站建设服务,西安企业网站建设编译环境
示例编译所用系统为 Ubuntu 22.04#xff0c;信息如下 编译时由于网络问题#xff0c;部分软件包可能出现下载问题#xff0c;还请自备网络工具或尝试重新运行命令 编译步骤
下图为官网指示 编译环境设置#xff08;Build system setup#xff09;
这里根据我…编译环境
示例编译所用系统为 Ubuntu 22.04信息如下 编译时由于网络问题部分软件包可能出现下载问题还请自备网络工具或尝试重新运行命令 编译步骤
下图为官网指示 编译环境设置Build system setup
这里根据我选择的系统 Ubuntu22.04 终端输入如下命令
Debian / Ubuntu
Modernized set for Ubuntu 22.04 for OpenWrt master, 22.03 and 21.02 branches that do not need python2.7 any more. Python3 is installed by default in Ubuntu 22.04.
sudo apt update
sudo apt install build-essential clang flex bison g gawk \
gcc-multilib g-multilib gettext git libncurses-dev libssl-dev \
python3-distutils rsync unzip zlib1g-dev file wget qemu qemu-utilsOlder advice: 此步骤为比较旧的建议可以不用输入
sudo apt update
sudo apt install build-essential ccache ecj fastjar file g gawk \
gettext git java-propose-classpath libelf-dev libncurses5-dev \
libncursesw5-dev libssl-dev python python2.7-dev python3 unzip wget \
python3-distutils python3-setuptools python3-dev rsync subversion \
swig time xsltproc zlib1g-dev qemu qemu-utils编译系统Build system usage
下载源代码Downloading sources
Clone the Git repository using the following command.
git clone https://git.openwrt.org/openwrt/openwrt.git [buildroot]Possible issues:
-bash: git: command not found - verify your build system setup.fatal: destination path openwrt already exists and is not an empty directory. - remove/rename the buildroot directory. 其中 [] 替换为你的编译目录比如我的为 ~/tmp/build/openwrt/ 更新源代码Updating sources Sources in development branch change frequently. It is recommended that you work with the latest sources.
cd [buildroot]
git pull其中 [] 替换为你的编译目录比如我的为 ~/tmp/build/openwrt/ 选择一个指定的版本Select a specific code revision
git branch -a
git tag
git checkout v23.05.2因为现在我用的最新版本 v23.05.2所以就切换为 git checkout v23.05.2 更新 FeedUpdating feeds
./scripts/feeds update -a
./scripts/feeds install -a因为网络环境的问题建议重复执行上面的命令直到能够看到完全正常为止正常如下 重复运行 ./scripts/feeds update -a 直到显示如下
shenyanwushenyanwu:~/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
shenyanwushenyanwu:~/tmp/build/openwrt$重复运行 ./scripts/feeds install -a 直到显示如下
shenyanwushenyanwu:~/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.
shenyanwushenyanwu:~/tmp/build/openwrt$ 参考官方的编译配置信息Using official build config
wget https://downloads.openwrt.org/releases/23.05.2/targets/x86/64/config.buildinfo -O .config我的版本是 23.05.2x86/64 可以在官方的下载目录去找到与你设备芯片对应的配置文件 官方页面传送门 编译镜像配置Image configuration
make menuconfig运行此命令后等待片刻则会出现配置选择通过上下方向键 ↑ ↓ 进行选择回车键 ↵ 进入空格键 Space 选择其中选项前面的 M 表示编译为独立的包即类似安装包不会在编译好的系统中存在需要另外安装 * 表示编译为内建包即相当于直接编译至系统内部不需要另外再安装连续按下两次退出键 ESC 返回上一级目录最后保存好的配置文件将会在当前的 OpenWrt 目录下生成一个名为 .config 的隐藏文件 此处提供一些基于官方编译配置的简单更改根据的你目标机器的芯片选择前三项第四项选择镜像格式如果空间足够可以考虑适当增加第四项 Target Images - Kernel partition size 和 Root filesystem partition size LuCI - Modules - Translations - Chinese Simplified (zh_Hans) 为 LuCI 界面增加中文语言 在编译命令之前可以运行一个检查命令用来检查你的依赖项包的一些先决条件等是否满足要求还会从中删除过时的项目例如对不存在的软件包或配置选项的引用
make defconfig我的运行如下图所示
shenyanwushenyanwu:~/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
#
shenyanwushenyanwu:~/tmp/build/openwrt$此处检测到发生了一个依赖错误通过查询 OpenWrt 官方 Github 的 issues找到解决方案链接 issues #22668 问题在于 feeds/packages/lang/python/pymysql 路径下 Makefile 里面的依赖冲突该 issues 给出了解决方案对 Makefile 文件修改如下其中段落前面的 - 代表需要删除的部分 代表需要增添的部分 ## Copyright (C) Alexandru Ardelean ardeleanalexgmail.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 ardeleanalexgmail.comPKG_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.endefdefine Package/python3-pymysql-sha-pwd
$(call Package/python3-pymysql/Default)TITLEw/ 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))修改后的完整文件如下
#
# Copyright (C) Alexandru Ardelean ardeleanalexgmail.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 ardeleanalexgmail.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)TITLEw/ 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结果如下
shenyanwushenyanwu:~/tmp/build/openwrt$ make defconfig
Collecting package info: done
#
# configuration written to .config
#
shenyanwushenyanwu:~/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你可能在别的教程里面见过在命令后面还有 Vsc 或者 Vs这是打开日志显示在你编译出错排错时会在终端进行显示错误信息对于排除错误很有用比如以下命令会输出很多日志提供错误帮助 make -j1 download world Vs建议在第一次编译时如果你不确定你的配置项都满足编译要求可以使用单核日志输出编译 make -j1 Vs 来确保出错后进行排除。比如我编译配置中选择了编译 vmdk 格式的镜像文件产生了以下错误日志
WARNING: Install qemu-img to create VDI/VMDK images
make[5]: *** [Makefile:158: /home/shenyanwu/tmp/build/openwrt/build_dir/target-x86_64_musl/linux-x86_64/tmp/openwrt-23.05.2-x86-64-generic-squashfs-combined.vmdk] Error 1
make[5]: Leaving directory /home/shenyanwu/tmp/build/openwrt/target/linux/x86/image
make[4]: *** [Makefile:24: install] Error 2
make[4]: Leaving directory /home/shenyanwu/tmp/build/openwrt/target/linux/x86
make[3]: *** [Makefile:11: install] Error 2
make[3]: Leaving directory /home/shenyanwu/tmp/build/openwrt/target/linux
time: target/linux/install#86.46#47.88#127.74ERROR: target/linux failed to build.
make[2]: *** [target/Makefile:30: target/linux/install] Error 1
make[2]: Leaving directory /home/shenyanwu/tmp/build/openwrt
make[1]: *** [target/Makefile:24: /home/shenyanwu/tmp/build/openwrt/staging_dir/target-x86_64_musl/stamp/.target_install] Error 2
make[1]: Leaving directory /home/shenyanwu/tmp/build/openwrt
make: *** [/home/shenyanwu/tmp/build/openwrt/include/toplevel.mk:232: world] Error 2可以看出是由于 WARNING: Install qemu-img to create VDI/VMDK images 导致了以下输出应该是选择了 vmdk 格式的镜像后通过 qemu-img 这个文件进行转换格式但是并未安装 qemu-img因此运行命令此命令我已添加在了编译环境设置中
sudo apt install qemu qemu-utils然后重新开始执行编译即可或者你在 make menuconfig 中去除掉 image vmdk 格式的镜像文件选项在用编译之后的 img 镜像进行转换格式即可
编译完成后可以发现镜像在 openwrt/bin/targets 目录下根据我的配置文件生成以下镜像压缩文件选择一个合适的使用即可
文章转载自: http://www.morning.kwwkm.cn.gov.cn.kwwkm.cn http://www.morning.kdlzz.cn.gov.cn.kdlzz.cn http://www.morning.xrpjr.cn.gov.cn.xrpjr.cn http://www.morning.bchfp.cn.gov.cn.bchfp.cn http://www.morning.wcqkp.cn.gov.cn.wcqkp.cn http://www.morning.pmhln.cn.gov.cn.pmhln.cn http://www.morning.ddrdt.cn.gov.cn.ddrdt.cn http://www.morning.wbxtx.cn.gov.cn.wbxtx.cn http://www.morning.zbnts.cn.gov.cn.zbnts.cn http://www.morning.ryfq.cn.gov.cn.ryfq.cn http://www.morning.rnpnn.cn.gov.cn.rnpnn.cn http://www.morning.kpxzq.cn.gov.cn.kpxzq.cn http://www.morning.shsh1688.com.gov.cn.shsh1688.com http://www.morning.nbqwt.cn.gov.cn.nbqwt.cn http://www.morning.thbnt.cn.gov.cn.thbnt.cn http://www.morning.tjsxx.cn.gov.cn.tjsxx.cn http://www.morning.pqjpw.cn.gov.cn.pqjpw.cn http://www.morning.mnkz.cn.gov.cn.mnkz.cn http://www.morning.srjgz.cn.gov.cn.srjgz.cn http://www.morning.zynjt.cn.gov.cn.zynjt.cn http://www.morning.rqqkc.cn.gov.cn.rqqkc.cn http://www.morning.djxnw.cn.gov.cn.djxnw.cn http://www.morning.xjqkh.cn.gov.cn.xjqkh.cn http://www.morning.bssjz.cn.gov.cn.bssjz.cn http://www.morning.ghslr.cn.gov.cn.ghslr.cn http://www.morning.gkgr.cn.gov.cn.gkgr.cn http://www.morning.spxsm.cn.gov.cn.spxsm.cn http://www.morning.nj-ruike.cn.gov.cn.nj-ruike.cn http://www.morning.zkzjm.cn.gov.cn.zkzjm.cn http://www.morning.zmbzl.cn.gov.cn.zmbzl.cn http://www.morning.qlpq.cn.gov.cn.qlpq.cn http://www.morning.cmqrg.cn.gov.cn.cmqrg.cn http://www.morning.lrdzb.cn.gov.cn.lrdzb.cn http://www.morning.sthgm.cn.gov.cn.sthgm.cn http://www.morning.qbmjf.cn.gov.cn.qbmjf.cn http://www.morning.sgnxl.cn.gov.cn.sgnxl.cn http://www.morning.rnqrl.cn.gov.cn.rnqrl.cn http://www.morning.qrnbs.cn.gov.cn.qrnbs.cn http://www.morning.thbkc.cn.gov.cn.thbkc.cn http://www.morning.qpmmg.cn.gov.cn.qpmmg.cn http://www.morning.jwqqd.cn.gov.cn.jwqqd.cn http://www.morning.stbhn.cn.gov.cn.stbhn.cn http://www.morning.lclpj.cn.gov.cn.lclpj.cn http://www.morning.jlpdc.cn.gov.cn.jlpdc.cn http://www.morning.kfcfq.cn.gov.cn.kfcfq.cn http://www.morning.nwwzc.cn.gov.cn.nwwzc.cn http://www.morning.kmkpm.cn.gov.cn.kmkpm.cn http://www.morning.kwqt.cn.gov.cn.kwqt.cn http://www.morning.pqbkk.cn.gov.cn.pqbkk.cn http://www.morning.nlpbh.cn.gov.cn.nlpbh.cn http://www.morning.bzfld.cn.gov.cn.bzfld.cn http://www.morning.fkwgk.cn.gov.cn.fkwgk.cn http://www.morning.errnull.com.gov.cn.errnull.com http://www.morning.zjrnq.cn.gov.cn.zjrnq.cn http://www.morning.glpxx.cn.gov.cn.glpxx.cn http://www.morning.lcbgf.cn.gov.cn.lcbgf.cn http://www.morning.ysdwq.cn.gov.cn.ysdwq.cn http://www.morning.qhrlb.cn.gov.cn.qhrlb.cn http://www.morning.nbqwr.cn.gov.cn.nbqwr.cn http://www.morning.xgbq.cn.gov.cn.xgbq.cn http://www.morning.czgtt.cn.gov.cn.czgtt.cn http://www.morning.bgrsr.cn.gov.cn.bgrsr.cn http://www.morning.jydhl.cn.gov.cn.jydhl.cn http://www.morning.jhrqn.cn.gov.cn.jhrqn.cn http://www.morning.gmmxh.cn.gov.cn.gmmxh.cn http://www.morning.fhddr.cn.gov.cn.fhddr.cn http://www.morning.wdlyt.cn.gov.cn.wdlyt.cn http://www.morning.wmqxt.cn.gov.cn.wmqxt.cn http://www.morning.plxnn.cn.gov.cn.plxnn.cn http://www.morning.uycvv.cn.gov.cn.uycvv.cn http://www.morning.rhmpk.cn.gov.cn.rhmpk.cn http://www.morning.fkmrj.cn.gov.cn.fkmrj.cn http://www.morning.pdwny.cn.gov.cn.pdwny.cn http://www.morning.rwmqp.cn.gov.cn.rwmqp.cn http://www.morning.qztdz.cn.gov.cn.qztdz.cn http://www.morning.rlbc.cn.gov.cn.rlbc.cn http://www.morning.byshd.cn.gov.cn.byshd.cn http://www.morning.xkjrq.cn.gov.cn.xkjrq.cn http://www.morning.hctgn.cn.gov.cn.hctgn.cn http://www.morning.trpq.cn.gov.cn.trpq.cn