自己编译适用于C301的openwrt

pacman -S cmake automake zlib libtool autoconf automake gcc-multilib bison screen binutils patch bzip2 flex make gettext unzip gawk quilt asciidoc
需要手工安装gnulib
并且打上补丁tools/bison/patches/110-glibc-change-work-around.patch
110-glibc-change-work-around.patch

下载源码,CC版的是
git clone -b chaos_calmer git://github.com/openwrt/openwrt.git
下载18.06.2稳定版[最新]
git clone -b v18.06.2 git://github.com/openwrt/openwrt.git

添加openwrt目录权限
chmod -R 777 openwrt
chown -R zeno.users openwrt

cd openwrt

更新索引
./scripts/feeds update -a
./scripts/feeds install -a

git clone https://github.com/golang/protobuf.git staging_dir/hostpkg/lib/go-cross/src/github.com/golang/protobuf
git clone https://github.com/google/starlark-go.git staging_dir/hostpkg/lib/go-cross/src/go.starlark.net/starlark
git clone https://github.com/golang/crypto.git staging_dir/hostpkg/lib/go-cross/src/golang.org/x/crypto
git clone https://github.com/grpc/grpc-go -b v1.20.1 staging_dir/hostpkg/lib/go-cross/src/google.golang.org/grpc
git clone https://github.com/juelite/golang.org-x-net.git staging_dir/hostpkg/lib/go-cross/src/golang.org/x/net
git clone https://github.com/juelite/golang.org-x-sys.git staging_dir/hostpkg/lib/go-cross/src/golang.org/x/sys
git clone https://github.com/juelite/golang.org-x-text.git staging_dir/hostpkg/lib/go-cross/src/golang.org/x/text
git clone https://github.com/juelite/google.golang.org-genproto.git staging_dir/hostpkg/lib/go-cross/src/google.golang.org/genproto
git clone https://github.com/golang/snappy staging_dir/hostpkg/lib/go-cross/src/github.com/golang/snappy

git clone https://github.com/golang/snappy.git staging_dir/hostpkg/lib/go-cross/src/github.com/golang/snappy
git clone https://github.com/pkg/errors.git staging_dir/hostpkg/lib/go-cross/src/github.com/pkg/errors
git clone https://github.com/urfave/cli.git staging_dir/hostpkg/lib/go-cross/src/github.com/urfave/cli
git clone https://github.com/xtaci/kcp-go.git staging_dir/hostpkg/lib/go-cross/src/github.com/xtaci/kcp-go
git clone https://github.com/xtaci/smux.git staging_dir/hostpkg/lib/go-cross/src/github.com/xtaci/smux
git clone https://github.com/klauspost/reedsolomon.git staging_dir/hostpkg/lib/go-cross/src/github.com/klauspost/reedsolomon
git clone https://github.com/templexxx/xor.git staging_dir/hostpkg/lib/go-cross/src/github.com/templexxx/xor
git clone https://github.com/tjfoc/gmsm.git staging_dir/hostpkg/lib/go-cross/src/github.com/tjfoc/gmsm
git clone https://github.com/klauspost/cpuid.git staging_dir/hostpkg/lib/go-cross/src/github.com/klauspost/cpuid
git clone https://github.com/lucas-clemente/quic-go.git staging_dir/hostpkg/lib/go-cross/src/github.com/lucas-clemente/quic-go

单独编译某个包:
make package/lean/v2ray/{clean,compile} V=

修改默认语言
nano -w feeds/luci/modules/luci-base/root/etc/config/luci

config core main
option lang zh_cn
option mediaurlbase /luci-static/bootstrap
option resourcebase /luci-static/resources

修改网络接口配置
nano -w package/base-files/files/bin/config_generate

    case "$protocol" in
            static)
                    local ipad
                    case "$1" in
                            lan) ipad=${ipaddr:-"172.16.1.1"} ;;
                            *) ipad=${ipaddr:-"172.16.$((addr_offset++)).1"} ;;
                    esac

                    netm=${netmask:-"255.255.255.0"}

                    uci -q batch <<-EOF
                            set network.$1.proto='static'
                            set network.$1.ipaddr='$ipad'
                            set network.$1.netmask='$netm'
                    EOF
                    [ -e /proc/sys/net/ipv6 ] && uci set network.$1.ip6assign='60'
            ;;

修改默认主机名
nano -w package/base-files/files/bin/config_generate
时区和LED设置也在这个文件中
推荐

            set system.@system[-1].hostname='horee'             
            set system.@system[-1].timezone='CST-8'
            set system.@system[-1].zonename='Asia/Shanghai'
            #这句话要加上,不然还是UTC

修改无线配置
nano -w package/kernel/mac80211/files/lib/wifi/mac80211.sh
wireless.radio${devidx}.disabled 1改成0,默认开启wifi。
修改默认SSD:

            uci -q batch <<-EOF
                    set wireless.radio${devidx}=wifi-device                  
                    set wireless.radio${devidx}.type=mac80211
                    set wireless.radio${devidx}.channel=${channel}
                    set wireless.radio${devidx}.hwmode=11${mode_band}
                    ${dev_id}
                    ${ht_capab}
                    set wireless.radio${devidx}.disabled=0          

                    set wireless.default_radio${devidx}=wifi-iface
                    set wireless.default_radio${devidx}.device=radio${devidx}
                    set wireless.default_radio${devidx}.network=lan
                    set wireless.default_radio${devidx}.mode=ap             
                    set wireless.default_radio${devidx}.ssid=heuristic 
                    set wireless.default_radio${devidx}.encryption=none

默认情况下root是没有密码的,需设定密码才能开启ssh。
修改shadow文件,位于package/base-files/files/etc/shadow
root:$1$2nX0sqkM$XILd1/grLi/99Lgvp6Clz0:16922:0:99999:7:::
密码经过加密,将密码修改成admin。

添加第三方源码ipk

把第三方ipk源码的package包放置在package目录中

也可以手动增加ssr:
git clone https://github.com/ywb94/openwrt-ssr.git package/openwrt-ssr
我直接使用了lean的代码:
cp -r ../../../../lean/lede/package/lean/* ./

开启浮点: make kernel_menuconfig – kwrnel type –mips fpu emulator
最后执行make menuconfig
Global build settings
[*] Compile with full language suppor

进入配置菜单

Target system 选择芯片类别(AR7XXX/AR9xxx)
Target Profile 选择型号(Qihoo 360 C301)

Image configuration —>
Version configuration options —> 设置Release distribution为Horee, 然后设置制造商(Qihoo 360)、硬件版本信息C301

修改更新的源到本地吧:
http://downloads.horee.ltd/openwrt/releases/18.06.

先选择LUCI,会自动选择依赖包
LuCI —> Collections —> <*> luci
LuCI —> Modules —> Translations <*> English
<*> Chinese
LuCI —> Applications —>
<*> luci-app-accesscontrol
<*> luci-app-adblock
<*> luci-app-adbyby-plus
<*> luci-app-amule
<*> luci-app-aria2
<*> luci-app-autoreboot
<*> luci-app-commands
<*> luci-app-cshark
<*> luci-app-ddns
<*> luci-app-hd-idle
<*> luci-app-minidlna
<*> luci-app-mjpg-streamer
<*> luci-app-mwan3
<*> luci-app-ntpc
<*> luci-app-ocserv
<*> luci-app-openvpn-server
<*> luci-app-p2pblock
<*> luci-app-p910nd
<*> luci-app-qos
<*> luci-app-samba
<*> luci-app-ssr-plus
<*> luci-app-statistics
<*> luci-app-transmission
<*> luci-app-upnp
<*> luci-app-usb-printer
<*> luci-app-vlmcsd
<*> luci-app-vpnbypass
<*> luci-app-watchcat
<*> luci-app-wifischedule
<*> luci-app-wol

LuCI —> Protocols —> <*> luci-proto-3g
<*> luci-proto-bonding
<*> luci-proto-ipv6
<*> luci-proto-openconnect
<*> luci-proto-relay
<*> luci-proto-vpnc

Base syatem
–> <*> blockd
–> <*> dnsmasq-full

Kernel modules
–>Bloock Device —> kmod-block2mtd
–>Filesystems —>kmod-fs-cifs
<*> kmod-fs-ext4
<*> kmod-fs-msdos
<*> kmod-fs-ntfs
<*> kmod-fs-vfat
<*> kmod-fs-xfs
–>Native Language Support
—> kmod-nls-utf8
–>Network Support
<*> kmod-l2tp
<*> kmod-l2tp-eth
<*> kmod-l2tp-ip
<*> kmod-mppe
<*> kmod-pptp
–>USB Support —> kmod-usb-storage
<*> kmod-usb-storage-extras
<*> kmod-usb-storage-uas
<*> kmod-usb-printer
<*> kmod-usb-wdm
<*> kmod-usb3
–>video Support —> kmod-video-core uvc pwc
–>Wireless Drivers 无线网卡驱动
<*> kmod-ath6kl-usb
<*> kmod-mt76 MTK的网卡<*>
<*> kmod-net-rtl8188eu RTL8188EU
<*> kmod-net-rtl8192su RTL8192SU
<*> kmod-rtl8180. Realtek Drivers for RTL818x devices (RTL8180 PCI)
<*> kmod-rtl8187. Realtek Drivers for RTL818x devices (RTL8187 USB)
<*> kmod-rtl8192ce. Realtek RTL8192CE/RTL8188CE support
<*> kmod-rtl8192cu. Realtek RTL8192CU/RTL8188CU support
<*> kmod-rtl8192de. Realtek RTL8192DE/RTL8188DE support
<*> kmod-rtl8192se. Realtek RTL8192SE/RTL8191SE support
<*> kmod-rtl8821ae. Realtek RTL8821AE support
<*> kmod-rtl8xxxu. alternative Realtek RTL8XXXU support
Network
–>File Transfer —><*> curl
<*> rsync
<*> wget
–>Captive Portals—><*> wifidog
–>SSH
<*> openssh-sftp-client
<*> openssh-sftp-server
–>VPN
<*> ipsec-tools
<*> ocserv
<*> openconnect
<*> pptpd
<*> xl2tpd
<*> 6in4
<*> 6rd
<*> 6to4
<*> cifsmount
<*> ethtool
<*> ipset
<*> ipset-dns
<*> tcpdump

Utilities —>
Editors —>
<*> nano

最后回到界面选择 EXIT 点保存回到命令提示符界面,

修改一次BUG, 否则会导致:
configure: error: Package requirements (protobuf >= 2.6.0) were not met:
需要把feeds/packages/libs/protobuf-c/Makefile的PKG_BUILD_DEPENDS:=protobuf-c/host改为PKG_BUILD_DEPENDS:=protobuf/host

SSR-PLLUS被隐藏了,编译好后装好机,输入以下命令即可出来
echo 0xDEADBEEF > /etc/config/google_fu_mode

输入nohup make -j4 V=99 &就可以正常编译了(耗时70分钟)

编译完成后清除之前的编译作业。(使用这个命令前,记得把编译好的固件备份出来,不然会被删除掉,切记)
make clean
恢复默认编译环境
make defconfig

刷入Breed方法如下:

  1. 新版360路由器,先刷入官方u-boot,刷入flash1固件即可。 1、 电脑网线接路由器lan口,设置电脑为静态ip:192.168.1.3 子网掩码 255.255.255.0 其余为空 2、 断开路由器电源,按住reset键,插上电源,保持按住reset键等待10秒,看到前面的黄灯在闪烁了就是已经进入uboot了。 3、 电脑浏览器打开172.16.1.1, 出现上传rom页面。 4、 点击浏览 找到你找刷新的固件,然后点上传,等待大概3分钟,页面就会自动跳到openwrt的luci登录界面。 5、 使用 telnet 或 SSH 进入 OpenWrt,运行命令 mtd write -r /tmp/u-boot-ar9344-qihoo-c301.bin u-boot,刷写 U-Boot 并自动重启; 6、 进入不死 U-Boot 刷机界面,重新刷写固件。
附件下载:
http://gating.site/wp-content/uploads/2019/03/newifi-d2.zip
多flash补丁
http://gating.site/wp-content/uploads/2019/03/complete-c301-support.zip

关于Zeno Chen

本人涉及的领域较多,杂而不精 程序设计语言: Perl, Java, PHP, Python; 数据库系统: MySQL,Oracle; 偶尔做做电路板的开发,主攻STM32单片机
此条目发表在Linux分类目录。将固定链接加入收藏夹。