首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 系统运维 >

Openwrt研读笔记五之编译及升级

2013-10-27 
Openwrt研习笔记五之编译及升级原文地址:http://www.ourgarden.cn/openwrt%E7%A0%94%E4%B9%A0%E7%AC%94%E8

Openwrt研习笔记五之编译及升级


原文地址:http://www.ourgarden.cn/openwrt%E7%A0%94%E4%B9%A0%E7%AC%94%E8%AE%B0%E4%BA%94%E4%B9%8B%E7%BC%96%E8%AF%91%E5%8F%8A%E5%8D%87%E7%BA%A7/

好了,经过三天的苦苦编译,总算走完了,发现几个问题先总结下

首先如果是虚拟机运行编译的话,而且你的电脑又是多核的话,一定要多开几个核,但是vitrualbox并不一定支持,那是因为你BIOS限制了

修改下BIOS,开启虚拟化cpu即可,我是笔记本是2个CPU的,之前编译的时候就算全速运行也只用25%的CPU,现在完全编译跑起来后可以运行到100%,设置的效果图:

Openwrt研读笔记五之编译及升级

 

设置好后,我重新下载源码编译后发现才完全编译才只要了2个小时不到,哈哈

编译好后的结构目录如下:

root@geeknimo-VirtualBox:/home/geeknimo/disk/study/openwrt_source/trunk/bin/ar71xx# tree
.
├── md5sums
├── openwrt-ar71xx-generic-nbg460n_550n_550nh-u-boot.bin
├── openwrt-ar71xx-generic-root.squashfs
├── openwrt-ar71xx-generic-root.squashfs-64k
├── openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-factory.bin
├── openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-sysupgrade.bin
├── openwrt-ar71xx-generic-TLWR703-rootfs.tar.gz
├── openwrt-ar71xx-generic-uImage-gzip.bin
├── openwrt-ar71xx-generic-uImage-lzma.bin
├── openwrt-ar71xx-generic-vmlinux.bin
├── openwrt-ar71xx-generic-vmlinux.elf
├── openwrt-ar71xx-generic-vmlinux.gz
├── openwrt-ar71xx-generic-vmlinux.lzma
├── openwrt-ar71xx-generic-vmlinux-lzma.elf
├── packages
│   ├── 6relayd_2013-07-26.1-2ed520c500b0fbb484cfad5687eb39a0da43dcf7_ar71xx.ipk
│   ├── base-files_146-r38457_ar71xx.ipk
│   ├── busybox_1.19.4-7_ar71xx.ipk
│   ├── dnsmasq_2.66-4_ar71xx.ipk
│   ├── dropbear_2013.59-1_ar71xx.ipk
│   ├── firewall_2013-10-10_ar71xx.ipk
│   ├── ip6tables_1.4.20-1_ar71xx.ipk
│   ├── iptables_1.4.20-1_ar71xx.ipk
│   ├── iw_3.10-1_ar71xx.ipk
│   ├── jshn_2013-08-01-04f194aa8a04926fe7f2e42bbf9ba6c62d49339e_ar71xx.ipk
│   ├── kernel_3.10.15-1-78927f7ab77ca0f02d7da1e6e5c1c244_ar71xx.ipk
│   ├── kmod-ath_3.10.15+2013-06-27-1_ar71xx.ipk
│   ├── kmod-ath9k_3.10.15+2013-06-27-1_ar71xx.ipk
│   ├── kmod-ath9k-common_3.10.15+2013-06-27-1_ar71xx.ipk
│   ├── kmod-cfg80211_3.10.15+2013-06-27-1_ar71xx.ipk
│   ├── kmod-crypto-aes_3.10.15-1_ar71xx.ipk
│   ├── kmod-crypto-arc4_3.10.15-1_ar71xx.ipk
│   ├── kmod-crypto-core_3.10.15-1_ar71xx.ipk
│   ├── kmod-crypto-hash_3.10.15-1_ar71xx.ipk
│   ├── kmod-crypto-manager_3.10.15-1_ar71xx.ipk
│   ├── kmod-crypto-pcompress_3.10.15-1_ar71xx.ipk
│   ├── kmod-gpio-button-hotplug_3.10.15-1_ar71xx.ipk
│   ├── kmod-ip6tables_3.10.15-1_ar71xx.ipk
│   ├── kmod-ipt-conntrack_3.10.15-1_ar71xx.ipk
│   ├── kmod-ipt-core_3.10.15-1_ar71xx.ipk
│   ├── kmod-ipt-nat_3.10.15-1_ar71xx.ipk
│   ├── kmod-ipt-nathelper_3.10.15-1_ar71xx.ipk
│   ├── kmod-ipv6_3.10.15-1_ar71xx.ipk
│   ├── kmod-leds-gpio_3.10.15-1_ar71xx.ipk
│   ├── kmod-ledtrig-default-on_3.10.15-1_ar71xx.ipk
│   ├── kmod-ledtrig-netdev_3.10.15-1_ar71xx.ipk
│   ├── kmod-ledtrig-timer_3.10.15-1_ar71xx.ipk
│   ├── kmod-ledtrig-usbdev_3.10.15-1_ar71xx.ipk
│   ├── kmod-lib-crc-ccitt_3.10.15-1_ar71xx.ipk
│   ├── kmod-mac80211_3.10.15+2013-06-27-1_ar71xx.ipk
│   ├── kmod-nls-base_3.10.15-1_ar71xx.ipk
│   ├── kmod-ppp_3.10.15-1_ar71xx.ipk
│   ├── kmod-pppoe_3.10.15-1_ar71xx.ipk
│   ├── kmod-pppox_3.10.15-1_ar71xx.ipk
│   ├── kmod-slhc_3.10.15-1_ar71xx.ipk
│   ├── kmod-usb2_3.10.15-1_ar71xx.ipk
│   ├── kmod-usb-core_3.10.15-1_ar71xx.ipk
│   ├── kmod-usb-ohci_3.10.15-1_ar71xx.ipk
│   ├── libblobmsg-json_2013-08-01-04f194aa8a04926fe7f2e42bbf9ba6c62d49339e_ar71xx.ipk
│   ├── libc_0.9.33.2-1_ar71xx.ipk
│   ├── libgcc_4.6-linaro-1_ar71xx.ipk
│   ├── libip4tc_1.4.20-1_ar71xx.ipk
│   ├── libip6tc_1.4.20-1_ar71xx.ipk
│   ├── libjson-c_0.11-2_ar71xx.ipk
│   ├── libjson-script_2013-08-01-04f194aa8a04926fe7f2e42bbf9ba6c62d49339e_ar71xx.ipk
│   ├── libnl-tiny_0.1-3_ar71xx.ipk
│   ├── libubox_2013-08-01-04f194aa8a04926fe7f2e42bbf9ba6c62d49339e_ar71xx.ipk
│   ├── libubus_2013-09-29-6ae17d0298a8f1c24f16a68c8d1884091fb5c39f_ar71xx.ipk
│   ├── libuci_2013-10-15.1-1_ar71xx.ipk
│   ├── libxtables_1.4.20-1_ar71xx.ipk
│   ├── mtd_20_ar71xx.ipk
│   ├── netifd_2013-10-18-9814c6c71e3a5c0332a5bd29c952fd661e4c4222_ar71xx.ipk
│   ├── odhcp6c_2013-10-17-e23448ff8edc66f1da4fcb2b4066a02d6a54306f_ar71xx.ipk
│   ├── opkg_618-6_ar71xx.ipk
│   ├── Packages
│   ├── Packages.gz
│   ├── ppp_2.4.5-10_ar71xx.ipk
│   ├── ppp-mod-pppoe_2.4.5-10_ar71xx.ipk
│   ├── procd_2013-10-01-eba428f6672068d819d6296db3f635e6ac5a8be7-1_ar71xx.ipk
│   ├── swconfig_10_ar71xx.ipk
│   ├── uboot-envtools_2013.10-1_ar71xx.ipk
│   ├── ubox_2013-10-14-f56267fc14f39f055bc287658fb5200e9cb40784_ar71xx.ipk
│   ├── ubus_2013-09-29-6ae17d0298a8f1c24f16a68c8d1884091fb5c39f_ar71xx.ipk
│   ├── ubusd_2013-09-29-6ae17d0298a8f1c24f16a68c8d1884091fb5c39f_ar71xx.ipk
│   ├── uci_2013-10-15.1-1_ar71xx.ipk
│   └── wpad-mini_20130807-1_ar71xx.ipk
└── uboot-ar71xx-nbg460n_550n_550nh

openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-sysupgrade.bin这个是我们需要升级的bin文件,我们先升级下看看

真是伤了,刷坏了,硬件升级失败,大家千万别升级,如果升级了也没关系,是可以救活的

救活方法:

如果可以自己焊杜邦线的话就很轻松了,首先拆了703n,将电路板拿出来

按照下图描述的三个地方焊好杜邦线

Openwrt研读笔记五之编译及升级

 

上面有三个位置,一个是RXD,一个是TX(应该是TXD,标记的时候少打了一个,呵呵),最后一个是GND

如果你精通的话可以采用USB转串口来接,如果不是很熟练,那么就购买一个TTL

Openwrt研读笔记五之编译及升级

然后将TTL上的RXD接703N的TXD,TXD接703N的RXD,然后地跟地相接

接好后就可以通过串口来访问703N了,从uboot到内核都可以看到

那么现在假设你已经接上TTL了,串口能够访问了,这时按下路由器的reset键

串口输出如下内容:

U-Boot 1.1.4 (Mar 21 2013 – 10:09:10)

AP121 (ar9330) U-boot

DRAM: 32 MB
led turning on for 1s…
id read 0x100000ff
flash size 4194304, sector count = 64
Flash: 4 MB
Using default environment

In: serial
Out: serial
Err: serial
Net: ag7240_enet_initialize…
No valid address in Flash. Using fixed address
No valid address in Flash. Using fixed address
: cfg1 0×5 cfg2 0×7114
eth0: 00:03:7f:09:0b:ad
ag7240_phy_setup
eth0 up
: cfg1 0xf cfg2 0×7214
eth1: 00:03:7f:09:0b:ad
athrs26_reg_init_lan
ATHRS26: resetting s26
ATHRS26: s26 reset done
ag7240_phy_setup
eth1 up
eth0, eth1
Autobooting in 1 seconds
## Booting image at 9f020000 …
Uncompressing Kernel Image … OK

Starting kernel …

[ 0.000000] Linux version 3.10.15 (root@geeknimo-VirtualBox) (gcc version 4.6.4 (OpenWrt/Linaro GCC 4.6-2013.05 r38457) ) #1 Sat Oct 19 18:33:48 CST 2013
[ 0.000000] bootconsole [early0] enabled
[ 0.000000] CPU revision is: 00019374 (MIPS 24Kc)
[ 0.000000] SoC: Atheros AR9330 rev 1
[ 0.000000] Clocks: CPU:400.000MHz, DDR:400.000MHz, AHB:200.000MHz, Ref:25.000MHz
[ 0.000000] Determined physical RAM map:
[ 0.000000] memory: 02000000 @ 00000000 (usable)
[ 0.000000] Initrd not found or empty – disabling initrd
[ 0.000000] Zone ranges:
[ 0.000000] Normal [mem 0x00000000-0x01ffffff]
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x00000000-0x01ffffff]
[ 0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[ 0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 8128
[ 0.000000] Kernel command line: board=TL-WR703N console=ttyATH0,115200 rootfstype=squashfs,jffs2 noinitrd
[ 0.000000] PID hash table entries: 128 (order: -3, 512 bytes)
[ 0.000000] Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
[ 0.000000] Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.000000] Writing ErrCtl register=00000000
[ 0.000000] Readback ErrCtl register=00000000
[ 0.000000] Memory: 28848k/32768k available (2196k kernel code, 3920k reserved, 588k data, 220k init, 0k highmem)
[ 0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] NR_IRQS:51
[ 0.000000] Calibrating delay loop… 265.42 BogoMIPS (lpj=1327104)
[ 0.080000] pid_max: default: 32768 minimum: 301
[ 0.080000] Mount-cache hash table entries: 512
[ 0.090000] NET: Registered protocol family 16
[ 0.100000] MIPS: machine is TP-LINK TL-WR703N v1
[ 0.350000] bio: create slab <bio-0> at 0
[ 0.360000] Switching to clocksource MIPS
[ 0.360000] NET: Registered protocol family 2
[ 0.370000] TCP established hash table entries: 512 (order: 0, 4096 bytes)
[ 0.370000] TCP bind hash table entries: 512 (order: -1, 2048 bytes)
[ 0.370000] TCP: Hash tables configured (established 512 bind 512)
[ 0.380000] TCP: reno registered
[ 0.380000] UDP hash table entries: 256 (order: 0, 4096 bytes)
[ 0.390000] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[ 0.400000] NET: Registered protocol family 1
[ 0.420000] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[ 0.420000] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[ 0.430000] msgmni has been set to 56
[ 0.440000] io scheduler noop registered
[ 0.440000] io scheduler deadline registered (default)
[ 0.440000] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
[ 0.450000] ar933x-uart: ttyATH0 at MMIO 0×18020000 (irq = 11) is a AR933X UART
[ 0.460000] console [ttyATH0] enabled, bootconsole disabled
[ 0.460000] console [ttyATH0] enabled, bootconsole disabled
[ 0.470000] ath79-spi ath79-spi: master is unqueued, this is deprecated
[ 0.480000] m25p80 spi0.0: found s25sl032p, expected m25p80
[ 0.480000] m25p80 spi0.0: s25sl032p (4096 Kbytes)
[ 0.490000] 5 tp-link partitions found on MTD device spi0.0
[ 0.490000] Creating 5 MTD partitions on “spi0.0″:
[ 0.500000] 0×000000000000-0×000000020000 : “u-boot”
[ 0.500000] 0×000000020000-0x000000118d18 : “kernel”
[ 0.510000] mtd: partition “kernel” must either start or end on erase block boundary or be smaller than an erase block — forcing read-only
[ 0.520000] 0x000000118d18-0x0000003f0000 : “rootfs”
[ 0.530000] mtd: partition “rootfs” must either start or end on erase block boundary or be smaller than an erase block — forcing read-only
[ 0.540000] mtd: partition “rootfs” set to be root filesystem
[ 0.540000] 1 squashfs-split partitions found on MTD device rootfs
[ 0.550000] 0x0000002d0000-0x0000003f0000 : “rootfs_data”
[ 0.560000] 0x0000003f0000-0×000000400000 : “art”
[ 0.560000] 0×000000020000-0x0000003f0000 : “firmware”
[ 0.580000] libphy: ag71xx_mdio: probed
[ 0.590000] eth0: Atheros AG71xx at 0xb9000000, irq 4, mode:MII
[ 1.140000] ag71xx ag71xx.0 eth0: connected to PHY at ag71xx-mdio.1:04 [uid=004dd041, driver=Generic PHY]
[ 1.150000] TCP: cubic registered
[ 1.150000] NET: Registered protocol family 17
[ 1.160000] 8021q: 802.1Q VLAN Support v1.8
[ 1.170000] VFS: Mounted root (squashfs filesystem) readonly on device 31:2.
[ 1.180000] Freeing unused kernel memory: 220K (80319000 – 80350000)
Console is alive
procd: Console is alive
- watchdog -
procd: – watchdog -
[ 4.020000] usbcore: registered new interface driver usbfs
[ 4.020000] usbcore: registered new interface driver hub
[ 4.020000] usbcore: registered new device driver usb
[ 4.040000] ehci_hcd: USB 2.0 ‘Enhanced’ Host Controller (EHCI) Driver
[ 4.040000] ehci-platform: EHCI generic platform driver
[ 4.050000] ehci-platform ehci-platform: EHCI Host Controller
[ 4.050000] ehci-platform ehci-platform: new USB bus registered, assigned bus number 1
[ 4.060000] ehci-platform ehci-platform: irq 3, io mem 0x1b000000
[ 4.090000] ehci-platform ehci-platform: USB 2.0 started, EHCI 1.00
[ 4.090000] hub 1-0:1.0: USB hub found
[ 4.090000] hub 1-0:1.0: 1 port detected
[ 4.100000] ohci_hcd: USB 1.1 ‘Open’ Host Controller (OHCI) Driver
kmod: ran 21 iterations
- preinit -
procd: – preinit -
Press the [f] key and hit [enter] to enter failsafe mode
[ 7.220000] eth0: link up (100Mbps/Full duplex)
mount_root: jffs2 is ready
[ 7.750000] jffs2: notice: (306) jffs2_build_xattr_subsystem: complete building xattr subsystem, 1 of xdatum (1 unchecked, 0 orphan) and 16 of xref (0 dead, 5 orphan) found.
[ 7.790000] eth0: link down
- early -
procd: – early -
- watchdog -
procd: – watchdog -
- init -
procd: – init -
Please press Enter to activate this console.
[ 9.360000] NET: Registered protocol family 10
[ 9.380000] nf_conntrack version 0.5.0 (454 buckets, 1816 max)
[ 9.390000] ip6_tables: (C) 2000-2006 Netfilter Core Team
[ 9.420000] Loading modules backported from Linux version master-2013-06-27-0-gdcfa6d5
[ 9.430000] Backport generated by backports.git backports-20130617-4-ge3220f5
[ 9.440000] ip_tables: (C) 2000-2006 Netfilter Core Team
[ 9.490000] xt_time: kernel timezone is -0000
[ 9.510000] cfg80211: Calling CRDA to update world regulatory domain
[ 9.520000] cfg80211: World regulatory domain updated:
[ 9.520000] cfg80211: (start_freq – end_freq @ bandwidth), (max_antenna_gain, max_eirp)
[ 9.530000] cfg80211: (2402000 KHz – 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[ 9.540000] cfg80211: (2457000 KHz – 2482000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
[ 9.550000] cfg80211: (2474000 KHz – 2494000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
[ 9.560000] cfg80211: (5170000 KHz – 5250000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[ 9.560000] cfg80211: (5735000 KHz – 5835000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[ 9.640000] PPP generic driver version 2.4.2
[ 9.660000] NET: Registered protocol family 24
[ 9.750000] cfg80211: Calling CRDA for country: US
[ 9.750000] cfg80211: Regulatory domain changed to country: US
[ 9.760000] cfg80211: (start_freq – end_freq @ bandwidth), (max_antenna_gain, max_eirp)
[ 9.770000] cfg80211: (2402000 KHz – 2472000 KHz @ 40000 KHz), (300 mBi, 2700 mBm)
[ 9.780000] cfg80211: (5170000 KHz – 5250000 KHz @ 40000 KHz), (300 mBi, 1700 mBm)
[ 9.780000] cfg80211: (5250000 KHz – 5330000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[ 9.790000] cfg80211: (5490000 KHz – 5600000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[ 9.800000] cfg80211: (5650000 KHz – 5710000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[ 9.810000] cfg80211: (5735000 KHz – 5835000 KHz @ 40000 KHz), (300 mBi, 3000 mBm)
[ 9.820000] ieee80211 phy0: Atheros AR9330 Rev:1 mem=0xb8100000, irq=2
[ 15.180000] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[ 15.180000] device eth0 entered promiscuous mode
[ 15.210000] IPv6: ADDRCONF(NETDEV_UP): br-lan: link is not ready
[ 15.270000] eth0: link up (100Mbps/Full duplex)
[ 15.270000] br-lan: port 1(eth0) entered forwarding state
[ 15.280000] br-lan: port 1(eth0) entered forwarding state
[ 15.280000] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[ 15.320000] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready
[ 17.280000] br-lan: port 1(eth0) entered forwarding state
[ 18.470000] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
[ 20.520000] wlan0: authenticate with 14:e6:e4:80:1b:68
[ 20.530000] wlan0: send auth to 14:e6:e4:80:1b:68 (try 1/3)
[ 20.540000] wlan0: authenticated
[ 20.560000] wlan0: associate with 14:e6:e4:80:1b:68 (try 1/3)
[ 20.560000] wlan0: RX AssocResp from 14:e6:e4:80:1b:68 (capab=0×431 status=0 aid=1)
[ 20.570000] wlan0: associated
[ 20.570000] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
procd: – init complete -

从上面的内容得到我的703n是RAM32M,Flash是4M的

这是全部的启动过程

为了能够修砖,也就是说如果刷机不成就变成了一个砖头

其中在红色的部分,输出会停留几秒,此时路由器的led会闪烁的很频繁(如果没有TTL的可以以此为凭据来进行后面的操作)

此时按下路由器的reset键,并通过msdos进行telnet连接,如果是TTL就直接在串口进行如下操作

telnet 192.168.1.1

连接上后执行

mount_root
mtd -r erase rootfs_data

执行完后系统会自动重启,如果不能重启就手动reboot
这样就可以修复了

后来得到一个网友的帮助,提醒是:

刷机升级时要将保存配置的勾去掉,如果不去掉,则会保留一些配置文件

至于保留了哪些配置文件暂时还不知道,后面明白了再补上

Openwrt研读笔记五之编译及升级

接着说刷机成功后,就和第二篇一样,对网络进行配置,安装luci或者其他的

热点排行