AP OPENWRT PC

From M1Research

(Difference between revisions)
Jump to: navigation, search
(Installation)
 
(5 intermediate revisions not shown)
Line 16: Line 16:
* gcc
* gcc
* g++
* g++
 +
* compat-gcc-34 (required due to some news changes in supplied gcc with FC8)
 +
* compat-g++-34
* bison
* bison
* flex
* flex
Line 24: Line 26:
Goto to source directory and configure:<pre>[verem@dev-2 src]$ cd kamikaze-r11772
Goto to source directory and configure:<pre>[verem@dev-2 src]$ cd kamikaze-r11772
-
[verem@dev-2 kamikaze-r11772]$ make menuconfig</pre>
+
[verem@dev-2 kamikaze-r11772]$ CC=gcc34 make menuconfig</pre>
Select:
Select:
Line 46: Line 48:
==Building==
==Building==
-
Start building process:<pre>[verem@dev-2 kamikaze-r11772]$ make
+
Start building process:<pre>[verem@dev-2 kamikaze-r11772]$ CC=gcc34 make
++ mkdir -p /home/verem/src/kamikaze-r11772/staging_dir/toolchain-i386_gcc4.1.2
++ mkdir -p /home/verem/src/kamikaze-r11772/staging_dir/toolchain-i386_gcc4.1.2
++ cd /home/verem/src/kamikaze-r11772/staging_dir/toolchain-i386_gcc4.1.2
++ cd /home/verem/src/kamikaze-r11772/staging_dir/toolchain-i386_gcc4.1.2
Line 52: Line 54:
............
............
 +
make[3] -C target/linux install
 +
make[3] -C target/sdk install
 +
make[3] -C target/imagebuilder install
 +
make[2] package/index
 +
[verem@dev-2 kamikaze-r11772]$
</pre>
</pre>
Line 57: Line 64:
=Installation=
=Installation=
-
Resulting images located in  
+
Resulting images located in <code>bin</code> directory:<pre>[verem@dev-2 kamikaze-r11772]$ ls -s bin/ | more
 +
total 390476
 +
49676 OpenWrt-ImageBuilder-x86-for-Linux-i686.tar.bz2
 +
42900 OpenWrt-SDK-x86-for-Linux-i686.tar.bz2
 +
49204 openwrt-x86-ext2.fs
 +
53944 openwrt-x86-ext2.image
 +
4516 openwrt-x86-ext2.image.kernel
 +
5008 openwrt-x86-jffs2-128k.fs
 +
53944 openwrt-x86-jffs2-128k.image
 +
4516 openwrt-x86-jffs2-128k.image.kernel
 +
5008 openwrt-x86-jffs2-64k.fs
 +
53944 openwrt-x86-jffs2-64k.image
 +
4516 openwrt-x86-jffs2-64k.image.kernel
 +
3592 openwrt-x86-squashfs.fs
 +
53944 openwrt-x86-squashfs.image
 +
4516 openwrt-x86-squashfs.image.kernel
 +
1244 openwrt-x86-vmlinuz
 +
    4 packages
 +
[verem@dev-2 kamikaze-r11772]$</pre>
 +
 
 +
Installation process is just copying image to HDD. I my case i used:<pre>Jul 12 15:57:36 dev-1 kernel: ata2.00: ATA-0: PQI IDE DiskOnModule, ra01.20a, max PIO2
 +
Jul 12 15:57:36 dev-2 kernel: ata2.00: 256000 sectors, multi 0: LBA
 +
Jul 12 15:57:36 dev-2 kernel: ata2.00: configured for PIO2
 +
Jul 12 15:57:36 dev-2 kernel: ata2.00: configured for PIO2
 +
Jul 12 15:57:36 dev-2 kernel: ata2: EH complete</pre> It's a small solid HDD install on secondary IDE channel. Deploying image:<pre>[root@dev-2 kamikaze-r11772]# dd if=bin/openwrt-x86-squashfs.image of=/dev/sdb</pre>
 +
After images will be written to drive, reinstall this to target plaform and setup that HDD as bootable.
=Configure OpenWrt=
=Configure OpenWrt=
Line 82: Line 114:
         option proto    static
         option proto    static
         option ipaddr  192.168.1.1
         option ipaddr  192.168.1.1
-
         option netmask  255.255.255.0</code>
+
         option netmask  255.255.255.0</pre>
Edit wireless configuration <code>/etc/config/wireless</code>:<pre>config wifi-device  wifi0
Edit wireless configuration <code>/etc/config/wireless</code>:<pre>config wifi-device  wifi0

Latest revision as of 13:32, 2 August 2008

Contents

Hardware

For target platform we will use standard PC with D-link DWA-520G (Atheros chipset) WiFi board compatible with hostapd. We install 2 NIC (Intel Ethernet 100) to provide WAN and LAN interfaces.

Build OpenWrt

Downloading

I recommend download latest trunk version. Use subversion repo:
[verem@aipetry ~]$ svn checkout https://svn.openwrt.org/openwrt/trunk kamikaze
After downloading rename directory - append trunk version suffix. I my case:
mv kamikaze kamikaze-r11772

Building prerequisites

For build OpenWrt images i used FC8 (Fedora Core 8) distro. Make sure you have installed:

  • gcc
  • g++
  • compat-gcc-34 (required due to some news changes in supplied gcc with FC8)
  • compat-g++-34
  • bison
  • flex
  • ncurses-devel
  • zlib-devel

Configuration

Goto to source directory and configure:
[verem@dev-2 src]$ cd kamikaze-r11772
[verem@dev-2 kamikaze-r11772]$ CC=gcc34 make menuconfig

Select:

  • Target system x86 [2.6]
  • Check:
    • Select all packages by default
    • Advanced configuration options (for developers)
    • Buildsystem settings
    • Build the OpenWrt Image Builder
    • Image configuration
  • override built-in for Network:
    • hostapd
    • hostapd-mini
    • hostapd-utils
    • wpa-supplicant
  • override built-in for Kernel modules - Network Devices that will be used in your platform, in my case Intel(R) PRO/100+ cards.
  • override built-in for Kernel modules - Wireless Drivers that will be used in your platform, in my case Driver for Atheros wireless chipsets

After this changes made exit and confirm changes saving

Building

Start building process:
[verem@dev-2 kamikaze-r11772]$ CC=gcc34 make
++ mkdir -p /home/verem/src/kamikaze-r11772/staging_dir/toolchain-i386_gcc4.1.2
++ cd /home/verem/src/kamikaze-r11772/staging_dir/toolchain-i386_gcc4.1.2
++ mkdir -p bin lib include stamp

............
 make[3] -C target/linux install
 make[3] -C target/sdk install
 make[3] -C target/imagebuilder install
 make[2] package/index
[verem@dev-2 kamikaze-r11772]$

Installation

Resulting images located in bin directory:
[verem@dev-2 kamikaze-r11772]$ ls -s bin/ | more
total 390476
49676 OpenWrt-ImageBuilder-x86-for-Linux-i686.tar.bz2
42900 OpenWrt-SDK-x86-for-Linux-i686.tar.bz2
49204 openwrt-x86-ext2.fs
53944 openwrt-x86-ext2.image
 4516 openwrt-x86-ext2.image.kernel
 5008 openwrt-x86-jffs2-128k.fs
53944 openwrt-x86-jffs2-128k.image
 4516 openwrt-x86-jffs2-128k.image.kernel
 5008 openwrt-x86-jffs2-64k.fs
53944 openwrt-x86-jffs2-64k.image
 4516 openwrt-x86-jffs2-64k.image.kernel
 3592 openwrt-x86-squashfs.fs
53944 openwrt-x86-squashfs.image
 4516 openwrt-x86-squashfs.image.kernel
 1244 openwrt-x86-vmlinuz
    4 packages
[verem@dev-2 kamikaze-r11772]$
Installation process is just copying image to HDD. I my case i used:
Jul 12 15:57:36 dev-1 kernel: ata2.00: ATA-0: PQI IDE DiskOnModule, ra01.20a, max PIO2
Jul 12 15:57:36 dev-2 kernel: ata2.00: 256000 sectors, multi 0: LBA
Jul 12 15:57:36 dev-2 kernel: ata2.00: configured for PIO2
Jul 12 15:57:36 dev-2 kernel: ata2.00: configured for PIO2
Jul 12 15:57:36 dev-2 kernel: ata2: EH complete
It's a small solid HDD install on secondary IDE channel. Deploying image:
[root@dev-2 kamikaze-r11772]# dd if=bin/openwrt-x86-squashfs.image of=/dev/sdb

After images will be written to drive, reinstall this to target plaform and setup that HDD as bootable.

Configure OpenWrt

After firmware starts goto shell and edit (use vi) some configuration files.

Edit network configuration /etc/config/network:
config interface loopback
        option ifname   lo
        option proto    static
        option ipaddr   127.0.0.1
        option netmask  255.0.0.0

config interface wan
        option ifname   eth0
        option proto    static
        option ipaddr   10.1.5.190
        option netmask  255.255.0.0
        option gateway  10.1.1.1
        option dns      10.1.1.1

config interface lan
        option type     bridge
        option ifname   "eth1 ath0"
        option proto    static
        option ipaddr   192.168.1.1
        option netmask  255.255.255.0
Edit wireless configuration /etc/config/wireless:
config wifi-device  wifi0
        option type     atheros
        option channel  2

config wifi-iface
        option device   wifi0
        option mode     ap
        option ssid     home-home-openwrt
        option encryption psk2
        option key      0123456789ABCDEF

Customize channel and key used for your case.

Change root password to enable ssh login:
root@OpenWrt:~# passwd
Changing password for root
New password:
Retype password:
Password for root changed by root
root@OpenWrt:~#
Allow ssh access to device from WAN port, /etc/firewall.user:
[...]
### Open port to WAN
## -- This allows port 22 to be answered by (dropbear on) the router
iptables -t nat -A prerouting_wan -p tcp --dport 22 -j ACCEPT
iptables        -A input_wan      -p tcp --dport 22 -j ACCEPT
[...]
Reboot system:
root@OpenWrt:~# reboot
Personal tools