找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 25437|回复: 30

【原创】Atheros芯片DD-WRT借用OpenWrt的packages安装python、gae实例教程

  [复制链接]
发表于 2013-7-23 16:57 | 显示全部楼层 |阅读模式
手头还有个Buffalo WZR-HP-AG300H,配置如下:
  1. CPU         Atheros AR7161
  2. CPU Speed         680 MHz
  3. Flash ROM         32 MB
  4. RAM         128 MB
  5. Radios         1x 2.4 GHz / 1x 5Ghz
  6. WLAN Support         A/B/G/N
  7. WLAN Max Speed         300 mbps
  8. Antenna Location         2x fixed external
  9. Switch         4x LAN + 1 WAN Gigabit ports
  10. USB         1x USB 2.0
复制代码
配置相当不错,价格也贵啊{:soso_e107:} 。入手后刷了DD-WRT十分稳定,因此不打算上OpenWrt,做家庭网关路由。128M的RAM不多跑点东西实在浪费,于是NAS、脱机下载、gae都往上堆吧。其他rg100a-aa等路由器刷OpenWrt玩。

下面来谈谈ag300h上安装gae的,要装gae就必须装python,dd wrt官方是通过运行个optware-install.sh的脚步安装optware后来再安装python,可这方法对Atheros芯片没有用,一般都会报Permission denied这样的错误,即使使用chmod修改权限也不行。安装出现信息如下:
  1. optware-install.sh: line 90: /opt/sbin/ldconfig: Permission denied
  2. optware-install.sh: line 91: /opt/bin/ipkg: Permission denied
  3. optware-install.sh: line 92: /opt/bin/ipkg: Permission denied
  4. optware-install.sh: line 93: /opt/bin/ipkg: Permission denied
复制代码
查了dd官方资料才知道,这方法对Atheros芯片不试用。Atheros芯片得手工安装,网上一般提供的是将软件安装在U盘,但我的ag300h有32M ROM,刷完系统后还有13.8M的空间,我就把软件都安装在这13.8M的空间上吧。

下面切入正题:
1、准备环境
进入dd-wrt管理界面》管理》管理,找到“JFFS2支持”,如下图勾选:

点击“应用”便启动了jffs。重新进入该页面或者控制台运行df -h查看一下jffs空间容量,如果大于7.5M就将软件安装在jffs上,如果小于7.5M最好安装在U盘上。安装U盘请参考:http://www.dd-wrt.com/phpBB2/viewtopic.php?t=86912

2、创建软件安装目录
  1. cd /jffs
  2. mkdir /jffs/opt
  3. mount -o bind /jffs/opt /opt
复制代码
3、创建个配置文件目录此步骤非必须,如果jffs空间在8.8M以下可以不装)
  1. mkdir /jffs/etc_jffs
  2. cp -a /etc/* /jffs/etc_jffs/
  3. mount -o bind /jffs/etc_jffs /etc
复制代码
这里在/jffs/目录下创建了个etc_jffs(这里要注意千万别创建/jffs/etc,否则dd-wrt的web页面很多配置将显示成双份)目录,然后将/etc中所有文件都拷贝到这个目录,再用mount 覆盖掉/etc,这样/etc目录就变成可写目录。
为什么要mount /etc目录?这是因为我们要安装OpenWrt的opkg,而opkg默认读取配置文件是/etc/opkg.conf。如果此步骤省略,安装软件时就稍微麻烦了些,得像这样运行
  1. opkg -f /jffs/opkg.conf update
  2. opkg -f /jffs/opkg.conf install xxxxx
复制代码
运行每条opkg命令都得跟上配置文件路径。

4、安装opkg
  1. cd /tmp
  2. wget http://downloads.openwrt.org/attitude_adjustment/12.09/ar71xx/generic/packages/opkg_618-3_ar71xx.ipk
  3. ipkg -d /opt install opkg_618-3_ar71xx.ipk
复制代码
这里可能会出现一堆错误,类似于
  1. ERROR: File not found: //usr/local/lib/ipkg/lists/whiterussian
  2. You probably want to run `ipkg update'
  3. 。。。。
  4. Unpacking opkg...Done.
  5. Configuring opkg...Done.
复制代码
这些错误不用理会。

5、创建opkg配置文件
  1. cat > /etc/opkg.conf << EOF
  2. src/gz snapshots http://downloads.openwrt.org/attitude_adjustment/12.09/ar71xx/generic/packages
  3. dest root /opt
  4. dest ram /opt/tmp
  5. lists_dir ext /opt/tmp/var/opkg-lists
  6. EOF
复制代码
如果你忽略了第3步,那么将配置文件创建到其他目录,比如
  1. cat > /jffs/opkg.conf << EOF
  2. src/gz snapshots http://downloads.openwrt.org/attitude_adjustment/12.09/ar71xx/generic/packages
  3. dest root /opt
  4. dest ram /opt/tmp
  5. lists_dir ext /opt/tmp/var/opkg-lists
  6. EOF
复制代码
至此opkg就安装完成了,一些openwrt上的软件也可以安装到dd-wrt上,是不是很爽?

6、测试
运行opkg update(如果忽略第3步,则运行opkg -f /jffs/opkg.conf update)测试一下
  1. root@DD-WRT:/jffs# opkg update
  2. Downloading http://downloads.openwrt.org/attitude_adjustment/12.09/ar71xx/generic/packages/Packages.gz.
  3. Updated list of available packages in /opt/tmp/var/opkg-lists/snapshots.
复制代码
像这样就表示正常了。

7、安装python
确定opkg没有问题就可以安装python
  1. wget http://downloads.openwrt.org/attitude_adjustment/12.09/ar71xx/generic/packages/libc_0.9.33.2-1_ar71xx.ipk
  2. opkg install libc_0.9.33.2-1_ar71xx.ipk
  3. opkg install python pyopenssl python-openssl
复制代码
python安装后测试一下,运行python,然后ctrl+D退出:
  1. root@DD-WRT:/jffs# python
  2. Python 2.7.3 (default, Mar 14 2013, 12:12:59)
  3. [GCC 4.6.3 20120201 (prerelease)] on linux2
  4. Type "help", "copyright", "credits" or "license" for more information.
  5. >>>
复制代码
8、安装gae
dd-wrt上安装gae和Openwrt上一样,请看http://www.openwrt.org.cn/bbs/fo ... hread&tid=14193的第2点。
我是将gae的客户端文件拷贝到/jffs/gae/local/目录中。

9、设置开机启动
使用vi命令创建一个脚步,vi /jffs/mount_opt.sh,脚步内容如下:
  1. #!/bin/sh

  2. mount -o bind /jffs/etc_jffs /etc
  3. mount -o bind /jffs/opt /opt
  4. (python /jffs/gae/local/proxy.py > /dev/null 2>&1) &
复制代码
然后修改权限:
  1. chmod 755 /jffs/mount_opt.sh
复制代码
回到dd-wrt的web,在管理》命令中输入:
  1. #!/bin/sh

  2. sh /jffs/mount_opt.sh
复制代码
如下图

然后点击“保存为开机指令”

不会使用vi的可以直接将
  1. #!/bin/sh

  2. mount -o bind /jffs/etc_jffs /etc
  3. mount -o bind /jffs/opt /opt
  4. (python /jffs/gae/local/proxy.py > /dev/null 2>&1) &
复制代码
保存为开机指令。

重启一下路由,重新登陆控制台,查看一下进程是否启动
  1. root@DD-WRT:/jffs# ps |grep python
  2. 4011 root     17328 S    /opt/usr/bin/python /jffs/gae/local/proxy.py
  3. 11517 root      1044 S    grep python
复制代码
以上步骤看起来比较多,实际上被我分得比较细,安装起来还是很简单的。

实际上,你的DD已经可以安装openwrt上提供的不少软件了,但这些软件能用是有前提的。前提是安装的软件不依赖openwrt的环境,比如上面的python,你可以尝试安装一下bind-dig试试。

本方法在
BrainSlayer-V24-preSP2  r21061
BrainSlayer-V24-preSP2 r23320-fix

测试通过,BrainSlayer-V24-preSP2 r24461测试未通过, 其他版本尚未测试


导读
【原创】Atheros芯片DD-WRT借用OpenWrt的packages安装python、gae实例教程
【原创】Atheros芯片DD-WRT实现脱机下载教程(transmission)
【原创】DD-WRT实现脱机下载教程2(aria2篇)




本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×

评分

参与人数 2恩山币 +2 收起 理由
ifrida + 1 拿去买糖吃吧!
qma10 + 1 泥马,真给力,我要顶!

查看全部评分

我的恩山、我的无线 The best wifi forum is right here.
发表于 2013-7-23 21:49 | 显示全部楼层
闲的蛋比较疼,这都研究出来了
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2013-7-25 17:28 | 显示全部楼层
多亏楼主的帖子,基本成功了,但是我设置开机启动一直没成功,忘lz指导
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2013-7-25 22:10 | 显示全部楼层
本帖最后由 fastpace 于 2013-7-25 22:31 编辑
bakuman96 发表于 2013-7-25 17:28
多亏楼主的帖子,基本成功了,但是我设置开机启动一直没成功,忘lz指导

重启一下,运行opkg update是否成功,如果不成功,请用mount命令检查目录是否挂载成功。可以看到最后两行是自己挂载的,事实上jffs的目录可以整体拷贝到u盘,以后恢复时直接拷贝过来就可以了,不需要再重装。
  1. rootfs on / type rootfs (rw)
  2. /dev/root on / type squashfs (ro,relatime)
  3. proc on /proc type proc (rw,relatime)
  4. sysfs on /sys type sysfs (rw,relatime)
  5. debugfs on /sys/kernel/debug type debugfs (rw,relatime)
  6. ramfs on /tmp type ramfs (rw,relatime)
  7. none on /dev type tmpfs (rw,relatime,size=512k)
  8. devpts on /dev/pts type devpts (rw,relatime,mode=600)
  9. devpts on /proc/bus/usb type usbfs (rw,relatime)
  10. /dev/sda1 on /tmp/mnt/sda_part1 type ext3 (rw,relatime,errors=continue,user_xattr,barrier=1,data=writeback)
  11. /dev/mtdblock/3 on /jffs type jffs2 (rw,relatime)
  12. /dev/mtdblock/3 on /etc type jffs2 (rw,relatime)
  13. /dev/mtdblock/3 on /opt type jffs2 (rw,relatime)
复制代码
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2013-7-25 23:50 来自手机 | 显示全部楼层
楼主你提供了一个非常非常重要的信息,就是atheros不能装optware,难怪我的mw4530不能装optware。试了n遍都是permission denied
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2013-7-26 19:12 | 显示全部楼层
Atheros AR9344没有对应的opkg,蛋疼了!
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2013-7-27 08:39 | 显示全部楼层
这样的技术帖一定要支持。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2013-7-28 16:23 | 显示全部楼层
目前 python 已经更新到python 3.2.3( python3 )   地址是

http://ipkg.nslu2-linux.org/feeds/optware/ddwrt/cross/stable/

已经过TTDW测试通过可以成功运行目前最新版 goagent 3.0.2
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2013-7-31 23:16 | 显示全部楼层
iflfwl 发表于 2013-7-26 19:12
Atheros AR9344没有对应的opkg,蛋疼了!

我的 也是 9344 的。。。。

现在可以刷dd  呵呵。。。脱机之前成功过。。。

这几天再试试看。。。。

就是 这个最新的dd 为什么不能在jffs中创见目录呢????
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2013-12-7 18:58 | 显示全部楼层
fastpace 发表于 2013-7-25 22:10
重启一下,运行opkg update是否成功,如果不成功,请用mount命令检查目录是否挂载成功。可以看到最后两行 ...

遇到了同样的问题呀
upkg update 也成功了
该如何解决呀
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2013-12-7 21:32 | 显示全部楼层
legendyoo 发表于 2013-7-31 23:16
我的 也是 9344 的。。。。

现在可以刷dd  呵呵。。。脱机之前成功过。。。

我的也不能创建目录,查 jffs2选项下显示17.24M/0,好像可用容量为0,郁闷
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2013-12-14 17:48 | 显示全部楼层
为什么我goagent路由器开机怎么都不启动啊
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2013-12-24 15:39 | 显示全部楼层
wzr-hp-g300nh2 可以刷这个吗忘楼主明示
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2014-1-17 18:56 | 显示全部楼层
打个标记,是不是只要是Atheros芯片刷了DD-WRT的都可以这样挂载?我的是Atheros AR7240,TP740N V3V4.
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2014-3-2 14:13 | 显示全部楼层
Atheros AR9344 rev 1.2 (0x2122)该装那个版本的opkg?
固件版本DD-WRT v24-sp2 (02/19/14) std - build 23598
是否可以安装http://downloads.openwrt.org/attitude_adjustment/12.09
/atheros/generic/packages/opkg_618-3_atheros.ipk还是安装
http://downloads.openwrt.org/att ... kg_618-3_ar71xx.ipk

谢谢
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

有疑问请添加管理员QQ86788181|手机版|小黑屋|Archiver|恩山无线论坛(常州市恩山计算机开发有限公司版权所有) ( 苏ICP备05084872号 )

GMT+8, 2024-3-29 00:29

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

| 江苏省互联网有害信息举报中心 举报信箱:js12377 | @jischina.com.cn 举报电话:025-88802724 本站不良内容举报信箱:68610888@qq.com 举报电话:0519-86695797

快速回复 返回顶部 返回列表