编译Openwrt(LEDE)for K3固件详细指南

一、环境

笔者可怜的ubuntu20.04主机,慢就慢点吧。下次用服务器搭个平台~
先照L大的说明来,注意别用root用户!

安装编译依赖:

sudo apt update -y
sudo apt full-upgrade -y
sudo apt install -y ack antlr3 asciidoc autoconf automake autopoint binutils bison build-essential \
bzip2 ccache cmake cpio curl device-tree-compiler fastjar flex gawk gettext gcc-multilib g++-multilib \
git gperf haveged help2man intltool libc6-dev-i386 libelf-dev libglib2.0-dev libgmp3-dev libltdl-dev \
libmpc-dev libmpfr-dev libncurses5-dev libncursesw5-dev libreadline-dev libssl-dev libtool lrzsz \
mkisofs msmtp nano ninja-build p7zip p7zip-full patch pkgconf python2.7 python3 python3-pip qemu-utils \
rsync scons squashfs-tools subversion swig texinfo uglifyjs upx-ucl unzip vim wget xmlto xxd zlib1g-dev

二、开始

下载源代码,更新 feeds :

git clone https://github.com/coolsnowwolf/lede
cd lede
./scripts/feeds update -a
./scripts/feeds install -a

三、加入其它包

直接clone到源码的package目录:

cd package
git clone https://github.com/AdguardTeam/AdGuardHome
git clone https://github.com/rufengsuixing/luci-app-adguardhome 
git clone https://github.com/jerrykuku/luci-app-jd-dailybonus
git clone https://github.com/destan19/OpenAppFilter
git clone https://github.com/fw876/helloworld
git clone https://github.com/xiaorouji/openwrt-passwall
cd ..
./scripts/feeds update -i luci
./scripts/feeds install -a -p luci

四、调整一些设置

网络配置在config_generate这个文件里,终端进入源码目录用VIM或其他编辑器:

# 大约在第150行,改默认ip为192.168.2.1,可以用/搜索192.168.1.1来定位
# 大约在第290行,改默认名字'Openwrt',为你喜欢的,不要有空格哦~
# 下一行,改默认时区‘UTC’为‘Asia/Shanghai’
vim package/base-files/files/bin/config_generate
:wq

默认主题:

rm -rf luci-theme-argon
git clone -b 18.06 https://github.com/jerrykuku/luci-theme-argon.git package/lean/luci-theme-argon
sed -i 's/luci-theme-bootstrap/luci-theme-argon/' feeds/luci/collections/luci/Makefile

五、终于开工

按喜好选择要用的插件:

make menuconfig

常用插件:

1.选择CPU型号
Target System—–Target System (Broadcom BCM47xx/53xx (ARM))

2.选择路由型号
Target Profile—-(PHICOMM K3)

3.添加luci
LuCI—>Collections—– <*> luci
						luci-ssl-nginx
						luci-ssl-openssl
4.添加luci的中文语言包、主题
LuCI—>Modules  ---Translations—- <*> chinese
LuCI ─>Themes <*> luci-theme-argon

5.添加DDNS等luci包
LuCI—>Applications —> <*>luci-app-ddns
                       	 luci-app-dnsforwarder
                         luci-app-aria2
                         luci-app-hd-idle         
                         luci-app-ntpc     时间同步服务器
                         luci-app-mwan3    网络叠加
                         luci-app-oaf ...  Open App Filter
                         luci-app-qos
                         luci-app-minidlna
                         luci-app-shairplay
                         luci-app-watchcat
                         luci-app-nlbwmon
                         luci-app-statistics
                         luci-app-wrtbwmon
LuCI —> Applications —>  ssrplush

6.添加USB挂载
Base system —> <*>block-mount
Kernel modules ---> Other modules --->  kmod-mmc     (MMC卡)
Kernel modules ---> Other modules --->  kmod-sdhci   (SD卡)
Kernel modules ---> USB Support --->    kmod-usb-hid (usb键盘鼠标支持) 
                                	    kmod-usb-ohci
                    				    kmod-usb-storage (usb storage 驱动)
                    					kmod-usb-storage-extras
                    					kmod-usb-uhci (usb 1.1 驱动)
                    					kmod-usb2
                    					kmod-usb3
Kernel modules ---> Block Device ---> <> kmod-block2mtd
Kernel modules ---> Block Device ---> <> kmod-scsi-core
Kernel modules ---> Block Device ---> <*> kmod-scsi-generic (usb 转IDE ,SATA)

7.添加硬盘格式支持
Kernel modules —> Filesystems —> <*>kmod-fs-ext4
                                    kmod-fs-f2fs  (overlay要用这个格式)
Kernel modules --> Filesystems -->	kmod-fs-nfs  (NFS服务)
					                kmod-fs-nfs-common
                              		kmod-fs-nfs-common-rpcsec
                             		kmod-fs-nfsd
                              		kmod-fs-ntfs (win硬盘格式只读)
Kernel modules ---> Filesystems ---> kmod-fs-vfat  (古老的dos格式,有些U盘在用)

8.添加UTF8编码
Kernel modules —> Native Language Support —>kmod-nls-utf8

9.添加自动挂载工具
Utilities —> Filesystem —> <*> badblocks
							   f2fs-tools
Utilities ---> Filesystem ---> e2fsprogs (支持ext2/ext3/ext4格式化工具)

10.添加一键开关无线等工具
Utilities —> <*> wifitoggle
Utilities ---> Compression ---> <> unrar (解压缩工具)
Utilities ---> Compression ---> <> unzip (解压缩工具)
Utilities ---> Compression ---> <> zip (压缩工具)
								    bzip2 (解压缩工具)
Utilities ---> disc ---> <> blkid (可以列出分区类型卷标等)
Utilities ---> disc ---> <> fdisk (分区工具)
Utilities ---> disc ---> <> lsblk (列出块设备,还能显示他们之间的依赖关系)
Utilities ─>usb-modeswitch

11.其它重要工具
Extra packages ---> ipv6helper 
Network ---> SSH ---> client
                      server
                      keygen

六、开编

继续听L大的:

make download -j8
make V=s -j1

几小时或一天后…没有梯子能折腾几天或几星期
编译完成后输出路径:bin/targets

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
OpenWrt是一个基于Linux的嵌入式操作系统,可以运行在各种路由器和嵌入式设备上。OpenWrt固件编译是指将OpenWrt源代码编译成可在特定硬件平台上运行的固件的过程。 首先,我们需要准备编译环境。在Ubuntu或其他基于Debian的发行版上,可以通过以下命令安装所需的软件包: ``` sudo apt-get install subversion build-essential libncurses5-dev zlib1g-dev gawk git ccache gettext libssl-dev xsltproc wget ``` 接下来,我们需要获取OpenWrt的源代码。可以使用以下命令来获取最新的OpenWrt源代码: ``` git clone https://git.openwrt.org/openwrt/openwrt.git ``` 获取源代码后,进入源代码目录: ``` cd openwrt ``` 在配置编译选项之前,可以运行以下命令更新源代码: ``` ./scripts/feeds update -a ./scripts/feeds install -a ``` 接下来,我们需要选择目标平台和配置编译选项。可以通过以下命令启动配置界面: ``` make menuconfig ``` 在配置界面中,可以选择目标平台、应用软件包、内核和其他编译选项。选择完成后,保存配置并退出。 最后,开始编译固件。可以运行以下命令来启动编译: ``` make -j4 ``` 编译过程可能需要一些时间,具体时间取决于计算机性能和配置选项。编译完成后,在`bin/targets`目录下可以找到编译生成的固件文件。 总之,OpenWrt固件编译的过程包括准备编译环境、获取源代码、配置编译选项和开始编译编译完成后,可以得到适用于特定硬件平台的OpenWrt固件

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

无证的攻城狮

如本文对您有用,大爷给打个赏!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值