解决:
make menuconfig
菜单项”Target Images”,”Root filesystem partition size (in MB)”
改成其它的大值,默认是160,直接改成512
分类目录归档:编译固件
git下载指定版本的代码并制作patch以及如何打patch
首先使用git clone把代码更新到本地。
使用git log –grep=word 搜索指定的版本。
gcc@gcc-x64:/mnt/AX3600$ git log –grep AX3600
commit 9d8a34c9abb6c13f9bebc28d9c4c10fe512491d4 (HEAD -> newBranch)
Author: lean <coolsnowwolf@gmail.com>
Date: Mon Jun 14 20:08:28 2021 +0800
ipq807x: add Xiaomi AX3600 and ath11k support
生成指定版本的patch:
git format-patch -1 9d8a34c9abb6c13f9bebc28d9c4c10fe512491d4
应用patch:
先检查patch文件:git apply –stat newpatch.patch
检查能否应用成功:git apply –check newpatch.patch
打补丁:git am –signoff < newpatch.patch
(使用-s或–signoff选项,可以commit信息中加入Signed-off-by信息)
如果需要撤回刚才打上的那个Patch,使用命令:git apply -R ***.patch
参考:
https://blog.csdn.net/M_Eve/article/details/84327219
https://www.zhangshengrong.com/p/QrXebElo1d/
https://blog.csdn.net/robertsong2004/article/details/46893169
20220805 updated
使用git apply –reject file.patch 这个命令会自动合入不冲突的代码,然后保留冲突的部分,同时在冲突的文件夹下面会生成后缀为.rej的文件,用于保存没有合并进去的部分,可以参考这个进行冲突解决。
解决完冲突后,删除后缀为.rej文件,并执行git add . 添加改动到暂存区,然后git commit -m “注释语句” 增加commit。
最后git log 查看刚才的commit,然后生成指定版本的patch:
git format-patch -1 9d8a34c9abb6c13f9bebc28d9c4c10fe512491d4
参考网址:
https://www.its203.com/article/salmon_zhang/97015801
ubuntu下统计openwrt编译时间
linux下面,time指令可以实现这个目的。
-p, –portability
Use the following format string, for conformance with POSIX standard 1003.2:
real %e
user %U
sys %S
比如说你想知道configure的时间,就是
# time -p ./configure
当./configure执行完毕的时候time命令结束,然后会返回一个时间,就是你执行./configure的时间
同样
# time -p make 也会知道make用的时间,如果说要整个的安装时间,可以用命令
# time -p ./configure && make && make install
返回的结果就是整个编译安装过程所用的时间
time命令除可以统计编译时间外,还可以统计程序运行的时间,比如
$ time ./test
比如我编译openwrt的时间统计。
time -p make -j4 V=99
export MAKEFLAGS= ;make -w -r checksum
make[2]: Entering directory ‘/mnt/origin-openwrt’
make[2]: Leaving directory ‘/mnt/origin-openwrt’
make[1]: Leaving directory ‘/mnt/origin-openwrt’
real 93.45
user 133.08
sys 61.79
记录一下编译AC3100原版merlin的过程
首先同步源码
git clone https://github.com/RMerl/asuswrt-merlin 这个是老款设备的代码,但是有需要用到的编译工具
git clone https://github.com/RMerl/asuswrt-merlin.ng 这个是新设备的代码
git clone https://github.com/RMerl/am-toolchains 这个是新设备的工具链
ln -s ~/am-toolchains/brcm-arm-hnd /opt/toolchains 将工具链做链接
ln -s ~/asuswrt-merlin/tools/brcm /opt/brcm
ln -s ~/asuswrt-merlin/release/src-rt-6.x.4708/toolchains/hndtools-arm-linux-2.6.36-uclibc-4.5.3 /opt/brcm-arm
添加环境变量
sudo ln -sf bash /bin/sh
echo “export LD_LIBRARY_PATH=$LD_LIBRARY:/opt/toolchains/crosstools-arm-gcc-5.3-linux-4.1-glibc-2.22-binutils-2.25/usr/lib” >> ~/.profile
echo “export TOOLCHAIN_BASE=/opt/toolchains” >> ~/.profile
echo “PATH=\$PATH:/opt/toolchains/crosstools-arm-gcc-5.3-linux-4.1-glibc-2.22-binutils-2.25/usr/bin” >> ~/.profile
echo “PATH=\$PATH:/opt/toolchains/crosstools-aarch64-gcc-5.3-linux-4.1-glibc-2.22-binutils-2.25/usr/bin” >> ~/.profile
这一步似乎没有,但是我还是做了。sudo ln -s ~/asuswrt-merlin.ng /media/ASUSWRT/asuswrt-merlin.ng
另外注意目录位置,我是在/mnt下面,所以~/替换为/mnt
然后切换到/mnt/asuswrt-merlin.ng/release/src-rt-7.14.114.x/src$
make rt-ac3100 开撸。
搞定。
参考 https://github.com/RMerl/asuswrt-merlin.ng/wiki/Compile-Firmware-from-source-using-Ubuntu
ubuntu下面给merlin增加环境变量
/home/gcc/.bashrc文件增加下面几行
export LD_LIBRARY_PATH=/opt/toolchains/crosstools-arm-gcc-5.3-linux-4.1-glibc-2.22-binutils-2.25/usr/lib
export TOOLCHAIN_BASE=/opt/toolchains
export PATH=/opt/toolchains/crosstools-arm-gcc-5.3-linux-4.1-glibc-2.22-binutils-2.25/usr/bin:/opt/toolchains/crosstools-aarch64-gcc-5.3-linux-4.1-glibc-2.22-binutils-2.25/usr/bin:/projects/hnd/tools/linux/hndtools-armeabi-2011.09/bin:$PATH
export PATH=/opt/brcm/hndtools-mipsel-linux/bin:/opt/brcm/hndtools-mipsel-uclibc/bin:/opt/brcm-arm/bin:$PATH
关于插件中显示“当前状态 正在收集数据”的解决办法
AX88179千兆USB网卡在openwrt使用的注意事项
备份本地代码到github
第一步:建立git仓库,cd到你的本地项目根目录下,执行git命令
git init
第二步:将项目的所有文件添加到仓库中
git add .
第三步:将add的文件commit到仓库
git commit -m “注释语句”
第四步:去github上创建自己的Repository
git remote add origin https://github.com/****/****.git
git branch -M main
git remote set-url origin https://访问令牌@github.com/github的名字/项目名称.git (如果是private的repositories此处要运行这个,后续才能上传,如果是public则不需要这一步,只需要在setting里添加本机SSH keys即可)
git push -u origin main
后续有更新的话执行以下步骤:
git add .
git commit -m “注释语句”
git branch -M main (这句是强制重命名分支为main,初始化的时候需要,后续不用)
git push -u origin main
##################################################################
2022.6.25 23:06更新
GitHub于21年8月13号之后就不支持用户名密码同步了,改用访问令牌验证。
如何创建访问令牌见这个文章 https://blog.csdn.net/qq_50840738/article/details/125087816
git remote set-url origin https://访问令牌@github.com/github的名字/项目名称.git
然后再运行git push -u origin main就可以上传了。
openwrt编译配置教程以及CPU降频设置
config文件位置:
openwrt config文件:.config
kernel config:build_dir/target-xxxxxxx/linux-x86_generic/linux-x.xx.xx/.config
内核版本更改:
支持内核版本列表: include/kernel-version.mk
更改内核版本位置: target/linux/XXX/Makefile.
3.你要编译的内容 命令 make menuconfig
这里给出一个基本配置,不过其中Busybox配置,正常使用默认配置即可,不需要Customize busybox options,我为了在日后的initramfs中加入一些overlayfs的功能自己加进去了配置,另外的配置基本是x86必须的。
Target System (x86) #目标平台选择
Target Images —>
ext4 #生成.EXT4.IMG文件
Base system —>
<*> block-mount
<*> busybox —> #用于今后`initramfs`支持,可以将所有lib编译到busybox
Customize busybox options
Busybox Settings —>
General Configuration —>
Support –install [-s] to install applet links at runtime
[ ] Don’t use /usr ( [ ] Don’t use /usr 该项不选!,否则无法生成 /usr/sbin/ntpd-hotplug及其他文件,导致busybox-*.ipk生成失败!)
Linux Module Utilities —>
modinfo
Simplified modutils
Accept module options on modprobe command line
Skip loading of already loaded modules
(/lib/modules) Default directory containing modules
Linux System Utilities —>
mdev
Support /etc/mdev.conf
Support subdirs/symlinks
Support regular expressions substitutions when renaming
Support command execution at device addition/removal
Support loading of firmwares
findfs
blkid
Print filesystem type
losetup
lspci
lsusb
mount
Support specifying devices by label or UUID
Filesystem/Volume identification —>
Ext filesystem
fat filesystem
Networking Utilities —>
ftpd
Enable upload commands
Enable workaround for RFC-violating clients
inetd
telnetd
Support standalone telnetd (not inetd only)
tcpsvd
udpsvd
`kernel` modules —>
Block Devices —>
<*> kmod-ata-core
<*> kmod-ata-ahci
<*> kmod-loop
-*- kmod-scsi-core
<*> kmod-scsi-generic
Filesystems —>
<*> kmod-fs-ext4
<*> kmod-fs-ntfs
<*> kmod-fs-vfat
Input modules —>#键盘
-*- kmod-hid
<*> kmod-hid-generic
-*- kmod-input-core
-*- kmod-input-evdev
Native Language Support —>
<*> kmod-nls-cp437 #vfat需要这个
<*> kmod-nls-iso8859-1
<*> kmod-nls-utf8
Network Devices —> #网卡驱动
<*> kmod-macvlan
USB Support —>
-*- kmod-usb-core
<*> kmod-usb-hid #usb键盘
<*> kmod-usb-ohci
<*> kmod-usb-storage
<*> kmod-usb2
<*> kmod-usb3
Wireless Drivers —>#wifi卡驱动
Network —>
<*> hostapd #wifi ap模式
<*> hostapd-common
<*> hostapd-utils
<*> wpa-supplicant
Utilities —>#自选 fdisk等
4.x64固件内核支持等各种特性,命令 make kernel_menuconfig
目的是为了加入x86的多核心以及大内存支持
Processor type and features —>
Symmetric multi-processing support
Processor family (Core 2/newer Xeon) —>#自行选择处理器平台
Supported processor vendors —>#自行选择处理器平台
(2) Maximum number of CPUs #自行编辑
SMT (Hyperthreading) scheduler support#超线程支持
Multi-core scheduler support
High Memory Support (4GB) —>
Device Drivers
< >ATA/ATAPI/MFM/RLL support(DEPRECATED)—>
SCSI device support—>
<*>SCSI generic support (kernel module –> Block Devices –> <*> kmod-scsi-core)
<*>Serial ATA and Parallel ATA drivers—>
<*>AHCI SATA support (kernel module –> Block Devices –> <*> kmod-ata-ahci)
<*>Intel ESB,ICH,PIIX3,PIIX4 PATA/SATA support(默认选中)
<*>VIA SATA support
<*>VIA PATA support
„„(根据你的硬件情况选择)
Multiple devices driver support (RAID and LVM) —>
Network device support —> (网卡驱动支持,根据你的硬件情况选择)
Ethernet driver support —>
Marvell devices
<*> Marvell MDIO interface support
<*> Marvell Yukon Gigabit Ethernet support
<*> Marvell Yukon 2 support
Realtek devices
<*> Realtek RTL-8139 C+ PCI Fast Ethernet Adapter support()
<*> Realtek RTL-8129/8130/8139 PCI Fast Ethernet Adapter support()
<*> Realtek 8169 gigabit ethernet support
设置了Powermanagement and ACPI options->
ACPI(Advanced Configuration and Power Interface)Support后,需要在CPU Frequency scaling –>x86 CPU frequency scaling drivers—> 中选择一个驱动,否则会全速运行!
如果没有设置,在编译时Inter Enhanced SpeedStep (deprecated)一项需要手动确认,其他都默认为“n”。
记录一下ubnt SDK的编译
首先需要安装32位linux环境,注意64位系统是不行的。原因也很简单,UBNT释放出SDK的时候,大概是在2011年左右,那个时候32位系统还是主流,64位系统非常少见。所以UBNT的SDK当时是在32位系统上运行的。根本没有考虑过兼容64位系统。
我使用的是ubuntu-14.04 32位版本。
如果使用更新的版本比如16.04会报错,原因不明。避开就好。
安装好后,需要安装下列包。
bash make gcc quilt bison flex autoconf libtool libncurses5-dev subversion wget g++ gawk zlib1g-dev cvs yui-compressor
然后解压缩SDK,运行make即可,如果有遗漏的包,系统会提示你的。
结果,还是不行,会报错。
quilt requires at least version 2.4 of GNU patch. You can download
无奈退回到ubuntu12.04
经过一番安装,终于进入系统。
问题来了,发现系统自带的源早已无法使用了。
我把源更新为阿里云的ubuntu14(参考网址https://www.jianshu.com/p/3fd50eaf9b6c)
deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
然后安装bash make gcc quilt bison flex autoconf libtool libncurses5-dev subversion wget g++ gawk zlib1g-dev cvs yui-compressor
然后make,目前暂时没发现问题。