docker run -it --name ubuntu ubunt:22.04 bash
apt update
apt-get -y install build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev patch python3 python2.7 unzip zlib1g-dev lib32gcc-s1 libc6-dev-i386 subversion flex uglifyjs gcc-multilib g++-multilib p7zip p7zip-full msmtp libssl-dev texinfo libglib2.0-dev xmlto qemu-utils libelf-dev autoconf automake libtool autopoint device-tree-compiler ccache xsltproc rename antlr3 gperf curl screen upx-ucl jq wget curl rsync sudo
useradd -m -g sudo -s /bin/bash openwrt
passwd openwrt
su openwrt
cd ~
git clone -b master https://github.com/openwrt/openwrt.git
cd openwrt
./scripts/feeds update -a
./scripts/feeds install -a
make menuconfig
make -j1 V=s
下一个GATE.IO IEO
cd ..
mkdir openwrt-package
git init
git remote add -f origin https://github.com/hoofa/openwrt-packages.git
git config core.sparsecheckout true
vi .git/info/sparse-checkout
k3screenctrl
luci-app-bypass
lua-neturl
tcping
chinadns-ng
lua-maxminddb
shadowsocksr-libev
simple-obfs
v2ray-plugin
trojan-plus
naiveproxy
hysteria
redsocks2
microsocks
git pull origin master
cd ../openwrt
echo "src-link custom /home/openwrt/openwrt-package" >>feeds.conf.default
./scripts/feeds update -a
./scripts/feeds install -a
make menuconfig
make -j1 V=s
menuconfig时在Image configuration --> Separate feed respositories里,取消enable feed custom
修改默认ip vi package/base-files/files/bin/config_generate
修改wifi vi package/kernel/mac80211/files/lib/wifi/mac80211.sh
修改root密码 vi package/base-files/files/etc/shadow
修改时区及NTP vi package/base-files/files/bin/config_generate
./files/ 里的文件会覆盖到编译后的镜像里,可用这个方法将 /etc/opkg/distfeeds.conf 里的 downloads.openwrt.org 替换成 mirrors.aliyun.com/openwrt
详见 https://openwrt.org/docs/guide-developer/toolchain/use-buildsystem#custom_files
解决编译后与官方源内核版本不一致
- cat "官方的内核md5" > vermagic
- vi include/kernel-defaults.mk
注释掉 grep '=[ym]' $(LINUX_DIR)/.config.set | LC_ALL=C sort | $(MKHASH) md5 > $(LINUX_DIR)/.vermagic
改为 cp $(TOPDIR)/vermagic $(LINUX_DIR)/.vermagic - vi package/kernel/linux/Makefile
注释掉 STAMP_BUILT:=$(STAMP_BUILT)_$(shell $(SCRIPT_DIR)/kconfig.pl $(LINUX_DIR)/.config | $(MKHASH) md5)
改为 STAMP_BUILT:=$(STAMP_BUILT)_$(shell cat $(LINUX_DIR)/.vermagic)
时区修改见
https://openwrt.org/start?id=zh/docs/guide-user/base-system/system_configuration#%E6%97%B6%E5%8C%BA
挂u盘相关 block-mount,blockd
kmod-fs-ext4,kmod-fs-vfat,kmod-fs-ntfs,kmod-fs-exfat
kmod-usb-storage/storage extra,kmod-usb-storage-uas, kmod-usb2/usb3
samba4-libs,luci-app-samba4,luci-i18n-samba4-zh-cn
blkid,hdparam,lsblk
ntfs-3g-utils,mount-utils
ln -s /usr/bin/ntfs-3g /sbin/mount.ntfs