这个 initramfs-kernel.bin 有 17M ,应该是超出了平台的存储限制,所以只有这个 initramfs-kernel.bin 被生成了,这款路由器官版是 16M 的 flash ,make menuconfig 里选的内容有些多。。。。。。
请问,用什么方式方法,可以得知这些功能在固件里占空间的比呢,比较容易直观的,如果在 make menuconfig 里逐个取消、选上来重复编译测试查看,非常耗时间。。。。。
![]() |
1
yyzh 73 天前 via Android
没有.
16M 最佳选择是啥都不选. openwrt 基础的那堆东西就占得差不多了. |
2
heeay 73 天前
我的经验是 可以查看下生成的 IPK 文件的大小。取消掉一些没有必要的集成功能
|
![]() |
3
Puteulanus 73 天前
编译过一次有缓存后面应该会快一些,可以去 https://hub.upcloud.com 开个高 CPU 的 VPS 临时用来编译测试,20 核 4G 的大概不到 0.3 刀每小时
|
4
chenyx9 73 天前 via Android
16MB 的 ROM 真的建议进填埋场…
|
5
datocp 73 天前 via Android
除非源码级修改,非必要无需编绎,或者生成 imagebuild 包。
裁剪固件,ddwrt 的作者连帮助都剪了。openwrt 官方应该是有篇教程在 imagebuild 阶段就可以将自己判断确认无用的特定路径的文件列表方式排除,唯一不好的地方这样生成的包无法用 7zip 打开。 |
6
datocp 72 天前 ![]() 之前用的 2 种方法
1.这种会导致最终生成的固件无法用 7zip 打开 ===根目录建立 files_remove 1. Create file 'files_remove' with full filenames: cat << EOF > ./files_remove1 #多余目录 /usr/lib/opkg/status #/usr/lib/opkg/info/*.list /usr/lib/opkg/info/*.control /usr/lib/opkg/info/*-pkg /usr/lib/opkg/info/*.conffiles /usr/lib/opkg/info/*.prerm #dnsmasq /etc/dnsmasq.conf /etc/config/dhcp /etc/hotplug.d/ntp/25-dnsmasqsec /etc/init.d/dnsmasq /usr/sbin/dnsmasq #logd #/sbin/logread #/sbin/logd #/etc/init.d/log #kmod-ppp /lib/modules/4.9.120/ppp_generic.ko /etc/modules.d/ppp /lib/modules/4.9.120/ppp_async.ko /lib/modules/4.9.120/pppox.ko #luci-proto-ipv6 /usr/lib/lua/luci/model/cbi/admin_network/proto_dslite.lua /usr/lib/lua/luci/model/cbi/admin_network/proto_6rd.lua /usr/lib/lua/luci/model/network/proto_hnet.lua /usr/lib/lua/luci/model/cbi/admin_network/proto_6to4.lua /usr/lib/lua/luci/model/cbi/admin_network/proto_map.lua /usr/lib/lua/luci/model/network/proto_aiccu.lua /usr/lib/lua/luci/model/network/proto_dhcpv6.lua /usr/lib/lua/luci/model/cbi/admin_network/proto_hnet.lua /usr/lib/lua/luci/model/network/proto_4x6.lua /usr/lib/lua/luci/model/cbi/admin_network/proto_464xlat.lua /usr/lib/lua/luci/model/network/proto_6x4.lua /usr/lib/lua/luci/model/cbi/admin_network/proto_aiccu.lua /usr/lib/lua/luci/model/cbi/admin_network/proto_6in4.lua /usr/lib/lua/luci/model/cbi/admin_network/proto_dhcpv6.lua #luci-proto-ppp /usr/lib/lua/luci/model/cbi/admin_network/proto_ppp.lua /usr/lib/lua/luci/model/cbi/admin_network/proto_pppoe.lua /usr/lib/lua/luci/model/cbi/admin_network/proto_pptp.lua /usr/lib/lua/luci/model/cbi/admin_network/proto_pppossh.lua /usr/lib/lua/luci/model/cbi/admin_network/proto_l2tp.lua /usr/lib/lua/luci/model/cbi/admin_network/proto_pppoa.lua /usr/lib/lua/luci/model/network/proto_ppp.lua #ppp /lib/upgrade/keep.d/ppp /usr/sbin/pppd /etc/ppp/filter /lib/netifd/ppp-up /etc/ppp/options /etc/ppp/chap-secrets /lib/netifd/ppp-down /lib/netifd/proto/ppp.sh /etc/ppp/resolv.conf /lib/netifd/ppp6-up #kmod-pp? /usr/lib/pppd #softethervpn /usr/libexec/softethervpn/vpn_bridge.config #/etc/init.d/softethervpnserver /etc/init.d/softethervpnbridge #/usr/libexec/softethervpn/vpnserver #/usr/bin/vpncmd /usr/libexec/softethervpn/vpnbridge /usr/libexec/softethervpn/vpn_server.config #/usr/libexec/softethervpn/hamcore.se2 /usr/libexec/softethervpn/vpn_client.config #/usr/libexec/softethervpn/launcher.sh #/usr/libexec/softethervpn/lang.config #/usr/libexec/softethervpn/vpncmd /etc/init.d/softethervpnclient /usr/libexec/softethervpn/vpnclient #kmod-nf-nat /lib/modules/4.9.120/nf_nat_masquerade_ipv4.ko /lib/modules/4.9.120/nf_nat_redirect.ko /etc/modules.d/nf-nat /lib/modules/4.9.120/nf_nat.ko /lib/modules/4.9.120/nf_nat_ipv4.ko #kmod-ipt-nat /lib/modules/4.9.120/xt_REDIRECT.ko /etc/modules.d/ipt-nat /lib/modules/4.9.120/xt_nat.ko /lib/modules/4.9.120/iptable_nat.ko /lib/modules/4.9.120/ipt_MASQUERADE.ko #mod-ipt-core /lib/modules/4.9.120/nf_log_common.ko #/lib/modules/4.9.120/ipt_REJECT.ko #/lib/modules/4.9.120/xt_multiport.ko #/lib/modules/4.9.120/xt_tcpudp.ko #/lib/modules/4.9.120/xt_limit.ko /lib/modules/4.9.120/xt_mark.ko /lib/modules/4.9.120/xt_LOG.ko /lib/modules/4.9.120/iptable_mangle.ko #/lib/modules/4.9.120/iptable_filter.ko /lib/modules/4.9.120/xt_mac.ko #/etc/modules.d/ipt-core /lib/modules/4.9.120/xt_time.ko /lib/modules/4.9.120/nf_log_ipv4.ko #/lib/modules/4.9.120/xt_comment.ko #/lib/modules/4.9.120/xt_TCPMSS.ko #kmod-nf-conntrack #/lib/modules/4.9.120/nf_defrag_ipv4.ko #/etc/modules.d/nf-conntrack #/lib/modules/4.9.120/nf_conntrack.ko #/lib/modules/4.9.120/nf_conntrack_ipv4.ko /lib/modules/4.9.120/nf_conntrack_rtcache.ko #kmod-ipt-conntrack # #/lib/modules/4.9.120/xt_CT.ko #/etc/modules.d/ipt-conntrack #/lib/modules/4.9.120/xt_conntrack.ko /lib/modules/4.9.120/xt_state.ko #kmod-ipt-raw #/etc/modules.d/ipt-raw #/lib/modules/4.9.120/iptable_raw.ko #kmod-stp #/etc/modules.d/10-stp #kmod-ebtables #/lib/modules/4.9.120/ebtables.ko /lib/modules/4.9.120/ebt_stp.ko #/etc/modules.d/ebtables #/lib/modules/4.9.120/ebt_limit.ko /lib/modules/4.9.120/ebt_among.ko # #/lib/modules/4.9.120/ebt_pkttype.ko /lib/modules/4.9.120/ebt_mark_m.ko /lib/modules/4.9.120/ebt_802_3.ko /lib/modules/4.9.120/ebtable_broute.ko /lib/modules/4.9.120/ebt_vlan.ko /lib/modules/4.9.120/ebt_redirect.ko /lib/modules/4.9.120/ebtable_nat.ko /lib/modules/4.9.120/ebt_mark.ko #/lib/modules/4.9.120/ebtable_filter.ko #kmod-ebtables-ipv4 /lib/modules/4.9.120/ebt_snat.ko #/lib/modules/4.9.120/ebt_arp.ko /lib/modules/4.9.120/ebt_dnat.ko # #/lib/modules/4.9.120/ebt_arpreply.ko #/lib/modules/4.9.120/ebt_ip.ko #/etc/modules.d/ebtables-ipv4 #kmod-ebtables-watchers /lib/modules/4.9.120/ebt_nflog.ko #/etc/modules.d/ebtables-watchers #/lib/modules/4.9.120/ebt_log.ko #kmod-slhc /lib/modules/4.9.120/slhc.ko #kmod-br-netfilter # #/lib/modules/4.9.120/br_netfilter.ko #/etc/modules.d/br-netfilter EOF grep -v "#" ./files_remove1 > ./files_remove cat ./files_remove 不能有空行产生,不然会出错 == 2. Patch Makefile ifneq ($(USER_FILES),) $(MAKE) copy_files endif + +ifneq ($(FILES_REMOVE),) + @echo + @echo Remove useless files + + while read filename; do \ + rm -rfv $(TARGET_DIR)$$filename; \ + done < $(FILES_REMOVE); +endif + $(MAKE) package_postinst $(MAKE) build_image 2.精简 ipk 用的,自己都看不懂了。。。自己建个子目录谨慎操作,可能不同的 linux 系统在命令参数调用上会有差别 cat << EOF > /tmp/IPKrmlst.tmp IPKrm softethervpn-base ./usr/bin/vpncmd ./usr/libexec/softethervpn/vpncmd IPKrm ebtables_201 IPKrm kmod-ebtables_ ebt_stp.ko ebt_among.ko ebt_mark_m.ko ebt_802_3.ko ebtable_broute.ko ebt_vlan.ko ebt_redirect.ko ebtable_nat.ko ebt_mark.ko IPKrm kmod-ebtables-ipv4_ ebt_snat.ko ebt_dnat.ko IPKrm kmod-ebtables-watchers ebt_nflog.ko IPKrm kmod-slhc ./lib IPKrm luci-proto-ipv6 ./www IPKrm luci-proto-ppp proto_ppp.lua proto_pptp.lua proto_pppossh.lua proto_l2tp.lua proto_pppoa.lua roto_ppp.lua l2tp.js ppp.js pppoa.js pptp.js EOF cat /tmp/IPKrmlst.tmp #!/bin/sh IPKlst=/tmp/ipklst.tmp ls *.ipk > $IPKlst IPKrmlst=/tmp/IPKrmlst.tmp rebuild_dir=./IPKG_REBUILD mkd |
7
datocp 72 天前 ![]() 没贴全
2.精简 ipk 用的,自己都看不懂了。。。自己建个子目录谨慎操作,可能不同的 linux 系统在命令参数调用上会有差别 cat << EOF > /tmp/IPKrmlst.tmp IPKrm softethervpn-base ./usr/bin/vpncmd ./usr/libexec/softethervpn/vpncmd IPKrm ebtables_201 IPKrm kmod-ebtables_ ebt_stp.ko ebt_among.ko ebt_mark_m.ko ebt_802_3.ko ebtable_broute.ko ebt_vlan.ko ebt_redirect.ko ebtable_nat.ko ebt_mark.ko IPKrm kmod-ebtables-ipv4_ ebt_snat.ko ebt_dnat.ko IPKrm kmod-ebtables-watchers ebt_nflog.ko IPKrm kmod-slhc ./lib IPKrm luci-proto-ipv6 ./www IPKrm luci-proto-ppp proto_ppp.lua proto_pptp.lua proto_pppossh.lua proto_l2tp.lua proto_pppoa.lua roto_ppp.lua l2tp.js ppp.js pppoa.js pptp.js EOF cat /tmp/IPKrmlst.tmp #!/bin/sh IPKlst=/tmp/ipklst.tmp ls *.ipk > $IPKlst IPKrmlst=/tmp/IPKrmlst.tmp rebuild_dir=./IPKG_REBUILD mkdir IPKG_REBUILD datalst=/tmp/data.tmp rm -rf IPKG_BUILD* for i in $( grep IPKrm $IPKrmlst | cut -d " " -f2 );do rmlist=`grep -A1 "$i" $IPKrmlst | grep -v IPKrm` echo $rmlist|tr ' ' '\n' > $datalst tmp_dir=IPKG_BUILD.$$ mkdir $tmp_dir echo ipkname=`grep ^$i $IPKlst` echo $ipkname echo -----rmlist----- cat $datalst echo -----rmlist----- echo ( cd $tmp_dir && tar zvfx ../$ipkname && tar zvfx data.tar.gz --exclude-from=$datalst -C ./ ) ( cd $tmp_dir && tar --numeric-owner --group=0 --owner=0 --format=gnu -cpf - . --exclude=data.tar.gz --exclude=control.tar.gz --exclude=debian-binary | gzip -n - > ./data.tar.gz ) ( cd $tmp_dir && tar --numeric-owner --group=0 --owner=0 --format=gnu -cpf - ./debian-binary ./data.tar.gz ./control.tar.gz | gzip -n - > ../$rebuild_dir/$ipkname ) #pwd rm -rf $tmp_dir done |
8
iamyangyiok 48 天前 via Android
@datocp 请教下 有哪此精简 不太影响日常使用 ,比如协议及加密 解压类
|