好物优选点击查看详情 京东购买

暂无内容

Ubuntu下用Lean源码编译openwrt及一行命令u盘启动openwrt安装x86硬盘上

Ubuntu下用Lean源码编译openwrt
源码地址:https://github.com/coolsnowwolf/lede
1:首先微软云服务器装好 Ubuntu 64bit,推荐 Ubuntu 20.04 LTS x64,免费一年。ip设置在地球某处。总结就是每一步需要下载的都得下载完,不然编译容易出错.
2:ssh连接微软云服务器,命令行输入,安装编译依赖
sudo apt-get update
sudo apt full-upgrade -y
sudo apt-get -y install build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch python3 python2.7 unzip zlib1g-dev lib32gcc1 libc6-dev-i386 subversion flex uglifyjs git-core gcc-multilib p7zip p7zip-full msmtp libssl-dev texinfo libglib2.0-dev xmlto qemu-utils upx libelf-dev autoconf automake libtool autopoint device-tree-compiler g+±multilib antlr3 gperf wget curl swig rsync
3: 下载源代码进入目录
git clone https://github.com/coolsnowwolf/lede
cd lede
4:更新feeds 并增加一些其他插件https://github.com/kenzok8/openwrt-packages,添加下面代码到云服务器/lede目录下的 feeds.conf.default 文件中添加:
src-git kenzo https://github.com/kenzok8/openwrt-packages
src-git small https://github.com/kenzok8/small
然后再命令行输入
./scripts/feeds update -a
./scripts/feeds install -a
5: 选择配置需要安装app
make menuconfig
6:下载 dl 库,编译固件 (-j 后面是线程数,第一次编译推荐用单线程)
make -j8 download V=s
make -j1 V=s
编译成功后,在/lede/bin/targets/x86/64
再次编译 (适用于不更改配置功能和插件,仅升级)
cd lede
git pull
./scripts/feeds update -a && ./scripts/feeds install -a
make defconfig
make -j8 download
make -j ( ( (( (((nproc) + 1)) V=s
更改配置编译
cd lede
rm -rf ./tmp && rm -rf .config
make menuconfig
make -j ( ( (( (((nproc) + 1)) V=s

一行命令u盘启动openwrt安装x86硬盘上
dd if=/dev/zero of=/dev/sda #格式化硬盘
dd if=/tmp/upload/openwrt-x86-64-generic-squashfs-combined-efi.img of=/dev/sda

#定制自己的固件
#软件源
src-git helloworld https://github.com/fw876/helloworld
src-git kenzo https://github.com/kenzok8/openwrt-packages
src-git small https://github.com/kenzok8/small
#内核修改
/target/linux/x86/Makefile 修改 KERNEL_PATCHVER:=内核版本
#修改默认IP地址
package/base-files/files/bin/config_generate
#修改版本号 文件中的R22.3.13及OpenWrt
lede/package/lean/default-settings/files/zzz-default-settings (注意OpenWrt后面的空格)
#定制个性SSH登陆欢迎信息
lede/package/base-files/files/etc/banner
#修改默认主题界面
lede/feeds/luci/collections/luci/Makefile文件更改默认主题
lede/feeds/luci/collections/luci-ssl-nginx/Makefile
lede/feeds/luci/collections/luci-ssl-openssl/Makefile
这三个文件都要修改默认主题名字,不然后面编译可能会报错
#克隆源码插件库
cd lede/package/lean
git clone https://github.com/rufengsuixing/luci-app-adguardhome.git
#给tmp权限,方便下载
sudo chmod -R 777 tmp

更改LAN口的默认IP地址
cd lede
vim package/base-files/files/bin/config_generate

大概在99行找到我们默认的原IP地址(192.168.1.1),按“i”把对应的IP更改即可
然后按shift+: 输入wq回车保存退出

编译丰富插件时,建议修改下面两项默认大小,留足插件空间。( x86/64 )!!!
Target Images —> (16) Kernel partition size (in MB) #默认是 (16) 建议修改 (256)
Target Images —> (160) Root filesystem partition size (in MB) #默认是 (160) 建议修改 (512)

如果需要 Cloudflare DDNS 组件
默认情况下 Open¬Wrt 中并没有 Cloud¬flare DDNS 功能,就算勾选了DDNS也不包含cloudflare运营商。所以需要在编译时选择相应的组件,其位置在 Network→IP Addresses and Names →ddns-scripets_cloudflare.com-v4

更改 固件版本信息
sed -i “s/OpenWrt /$(date +%Y.%m.%d) 2022/xx/xx /g” package/lean/default-settings/files/zzz-default-settings

原文链接:https://blog.csdn.net/m0_54706625/article/details/129091648?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522168449620216800225526048%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fblog.%2522%257D&request_id=168449620216800225526048&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~first_rank_ecpm_v1~times_rank-29-129091648-null-null.blog_rank_default&utm_term=NAS%E3%80%81%E7%BE%A4%E6%99%96%E3%80%81%E9%98%BF%E9%87%8C%E4%BA%91%E3%80%81%E5%9F%9F%E5%90%8D%E8%A7%A3%E6%9E%90%E3%80%81%E5%86%85%E7%BD%91%E7%A9%BF%E9%80%8F%E3%80%81ipv6%E3%80%81ddns%E3%80%81%E8%BD%BB%E9%87%8F%E7%BA%A7%E4%BA%91%E6%9C%8D%E5%8A%A1%E5%99%A8%E3%80%81%E9%93%81%E5%A8%81%E9%A9%AC%E3%80%81%E5%A8%81%E8%81%94%E9%80%9A%E3%80%81DSM%E3%80%81DSM6.0%E3%80%81%E7%BE%A4%E6%99%96nas%E3%80%81%E4%BA%91%E6%9C%8D%E5%8A%A1%E5%99%A8%E3%80%81%E8%9C%97%E7%89%9B%E6%98%9F%E9%99%85%E3%80%81%E9%BB%91%E7%BE%A4%E6%99%96%E3%80%81docker%E3%80%81%E5%AE%B9%E5%99%A8%E9%95%9C%E5%83%8F%E3%80%81%E5%9F%9F%E5%90%8D%E6%B3%A8%E5%86%8C%E3%80%81%E5%AE%9D%E5%A1%94%E3%80%81%E5%8F%8D%E5%90%91%E4%BB%A3%E7%90%86%E3%80%81nginx%E3%80%81frp%E3%80%81%E5%8A%A8%E6%80%81%E5%9F%9F%E5%90%8D%E8%A7%A3%E6%9E%90

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享