在HG255D上安装OpenWRT的全自动翻墙方案

一直在用之前的博文《基于OpenWrt路由器的全自动翻墙方案》里描述的方案来翻墙,相当的爽。所以考虑给父母和亲戚朋友家也装上这个方案。遂在淘宝上淘了一个最便宜的支持OpenWrt的路由器HG255D,官方网站openwrt.org上并没有提供它的固件下载,国内一些讨论openwrt的网站提供了它的固件,但是没有提供完整的配套的软件包,只能从其他地方下载软件包。这样会因为kernel版本不匹配导致不能安装kmod包,从而不能实施那个自动翻墙方案。只能开始自己打包自己的固件。

首先是参考了这篇文章《3步定制hg255d的trunk固件》,定制一个固件,带需要的kmod。
1. 下载trunk的ramips的ImageBuilder http://downloads.openwrt.org/barrier_breaker/14.07-rc2/ramips/rt305x/OpenWrt-ImageBuilder-ramips_rt305x-for-linux-x86_64.tar.bz2

2. 解开压缩文件,修改Makefile
tar xjf OpenWrt-ImageBuilder-ramips_rt305x-for-linux-x86_64.tar.bz2
cd OpenWrt-ImageBuilder-ramips_rt305x-for-linux-x86_64
vi target/linux/ramips/image/Makefile
查找255, 有两行和hg255d相关,去掉这两行前面的“#”

3. 运行make创建固件,会生成bin/ramips/openwrt-ramips-rt305x-hg255d-squashfs-sysupgrade.bin,就可以用来刷机了。在原文的基础上需要加上kmod-ipt-u32, kmod-ipt-geoip, iptables-mod-u32, iptables-mod-geoip。

make image PROFILE=HG255D  PACKAGES="arptables base-files block-mount busybox chat comgt curl dnsmasq dropbear firewall hostapd hostapd-common hostapd-utils ip ip6tables ipset iptables iptables-mod-conntrack-extra iptables-mod-filter iptables-mod-ipopt iw jshn kernel kmod-8021q kmod-arptables kmod-ath kmod-ath9k-common kmod-ath9k-htc kmod-brcmfmac kmod-brcmutil kmod-bridge kmod-carl9170 kmod-cfg80211 kmod-crypto-aes kmod-crypto-arc4 kmod-crypto-authenc kmod-crypto-cbc kmod-crypto-core kmod-crypto-deflate kmod-crypto-des kmod-crypto-ecb kmod-crypto-hash kmod-crypto-hmac kmod-crypto-iv kmod-crypto-manager kmod-crypto-md5 kmod-crypto-pcompress kmod-crypto-rng kmod-crypto-sha1 kmod-crypto-wq kmod-eeprom-93cx6 kmod-fs-ext4 kmod-fs-vfat kmod-gpio-button-hotplug kmod-gre kmod-gre6 kmod-ifb kmod-input-core kmod-ip6-tunnel kmod-ip6tables kmod-ipip kmod-ipsec kmod-ipsec4 kmod-ipsec6 kmod-ipt-compat-xtables kmod-ipt-conntrack kmod-ipt-conntrack-extra kmod-ipt-core kmod-ipt-filter kmod-ipt-ipopt kmod-ipt-ipsec kmod-ipt-ipset kmod-ipt-nat kmod-ipt-nathelper kmod-ipt-sysrq kmod-iptunnel kmod-iptunnel4 kmod-iptunnel6 kmod-ipv6 kmod-leds-gpio kmod-lib-crc-ccitt kmod-lib-crc-itu-t kmod-lib-crc16 kmod-lib-textsearch kmod-lib-zlib kmod-llc kmod-mac80211 kmod-mmc kmod-mppe kmod-nfnetlink kmod-nls-base kmod-p54-common kmod-p54-usb kmod-ppp kmod-pppoe kmod-pppox kmod-pptp kmod-rt2500-usb kmod-rt2800-lib kmod-rt2800-mmio kmod-rt2800-soc kmod-rt2800-usb kmod-rt2x00-lib kmod-rt2x00-mmio kmod-rt2x00-usb kmod-rt73-usb kmod-rtl8187 kmod-rtl8192c-common kmod-rtl8192cu kmod-rtlwifi kmod-rtlwifi-usb kmod-sched-connmark kmod-sched-core kmod-scsi-core kmod-scsi-generic kmod-slhc kmod-stp kmod-tun kmod-usb-core kmod-usb-rt305x-dwc_otg kmod-usb-serial kmod-usb-serial-ch341 kmod-usb-serial-ftdi kmod-usb-serial-pl2303 kmod-usb-storage kmod-usb-storage-extras libblobmsg-json libc libcurl libcyassl libevent2 libgcc libip4tc libip6tc libiwinfo libiwinfo-lua libjson-c libjson-script liblua liblzo libmnl libncurses libnfnetlink libnl-tiny libopenssl libpcap libpolarssl libpopt libpthread libreadline librt libstdcpp libubox libubus libubus-lua libuci libuci-lua libusb-1.0 libustream-cyassl libxtables lua luci luci-app-commands luci-app-firewall luci-app-qos luci-i18n-english luci-lib-nixio luci-mod-admin-full luci-proto-3g luci-proto-ipv6 luci-proto-ppp luci-ssl luci-theme-bootstrap mtd netifd openvpn-openssl opkg ppp ppp-mod-pppoe ppp-mod-pptp procd px5g qos-scripts resolveip swconfig tc tcpdump-mini terminfo  ubox ubus ubusd uci uclibcxx uhttpd uhttpd-mod-ubus usb-modeswitch wireless-tools wpa-supplicant wpad zlib kmod-ipt-u32 kmod-ipt-geoip iptables-mod-u32 iptables-mod-geoip kmod-ipt-nat-extra iptables-mod-nat-extra kmod-ipt-nathelper-extra kmod-ipt-tproxy kmod-ipt-lua kmod-ipt-ipp2p kmod-ipt-dnetmap iptables-mod-lua iptables-mod-ipp2p iptables-mod-dnetmap luci-i18n-chinese"

然后就是按照各种论坛的帖子把这个固件刷进去,还缺shadowsocks,从这里下载一个:http://shadowsocks.org/en/download/clients.html (后缀是_ramips_24kec.ipk)。把它拷贝到openwrt上安装就完成了。剩下的就和之前的文章一样了。

http://ch3n2k.com/~czk/openwrt-ramips-rt305x-hg255d-squashfs-sysupgrade.bin
http://ch3n2k.com/~czk/CNgeoip.tar.gz
http://ch3n2k.com/~czk/shadowsocks-libev-polarssl_1.4.6_ramips_24kec.ipk


注 HG255D是Little Endian的架构





注释