OpenWRT

From WebarchDocs
Jump to navigation Jump to search

Notes on OpenWRT.

Captive Portal Web Server

These rough notes have been polished and posted to GitLab.

To flash the stock OpenWRT, first download it from the link on the wiki and generate a md5sum:

wget https://downloads.openwrt.org/snapshots/trunk/ramips/mt7620/openwrt-ramips-mt7620-gl-mt300a-squashfs-sysupgrade.bin
md5sum openwrt-ramips-mt7620-gl-mt300a-squashfs-sysupgrade.bin 
8e0621dc4f5f5b59583b07f5bc2747b6  openwrt-ramips-mt7620-gl-mt300a-squashfs-sysupgrade.bin

Power the device, either connect it directly to the ethernet port on your computer or connect to SSID GL-MT300A-0b4, password "goodlife", set the timezone and a password, then click "Advanced settings" and login as root. Go to "System -> Backup / Flash Firmware" and use the form under "Flash new firmware image" and check the md5sum and then upload the new firmware.

If the update goes wrong and the device doesn't respond then power it down, hold down the reset button, power it on and wait a few seconds until the red LED flashes a lot. Then go to http://192.168.1.1/ and upload a new firmware package.

By default OpenWRT doesn't have WIFI or a web interface enabled, so connect a ethernet cable, set the network up and ssh to the device

ssh root@192.168.1.1

The next step is to secure the device, set a password and also add your public keys to /etc/dropbear/authorized_keys

passwd
vi /etc/dropbear/authorized_keys

And then plug the WAN port into a network with a DHCP server or see the documentation for other situations.

To enable WIFI, edit /etc/config/wireless:

uci set wireless.@wifi-device[0].disabled=0; uci commit wireless; wifi

Micro SD Card

You can open the case and install a micro SD card, this will, by default, probably be NTFS or FAT32 formatted, so first install some packages:

opkg update
opkg install fdisk block-mount kmod-sdhci-mt7620 e2fsprogs kmod-fs-ext4 kmod-fs-ntfs kmod-fs-msdos kmod-fs-vfat

Then, following the storage documentation use fdisk:

fdisk /dev/mmcblk0

Welcome to fdisk (util-linux 2.28).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p
Disk /dev/mmcblk0: 7.3 GiB, 7780433920 bytes, 15196160 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device         Boot Start      End  Sectors  Size Id Type
/dev/mmcblk0p1       8192 15196159 15187968  7.2G  b W95 FAT32

Command (m for help): d
Selected partition 1
Partition 1 has been deleted.

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 
First sector (2048-15196159, default 2048): 
Last sector, +sectors or +size{K,M,G,T,P} (2048-15196159, default 15196159): 

Created a new partition 1 of type 'Linux' and of size 7.3 GiB.

Command (m for help): t
Selected partition 1
Partition type (type L to list all types): L

 0  Empty           24  NEC DOS         81  Minix / old Lin bf  Solaris        
 1  FAT12           27  Hidden NTFS Win 82  Linux swap / So c1  DRDOS/sec (FAT-
 2  XENIX root      39  Plan 9          83  Linux           c4  DRDOS/sec (FAT-
 3  XENIX usr       3c  PartitionMagic  84  OS/2 hidden or  c6  DRDOS/sec (FAT-
 4  FAT16 <32M      40  Venix 80286     85  Linux extended  c7  Syrinx         
 5  Extended        41  PPC PReP Boot   86  NTFS volume set da  Non-FS data    
 6  FAT16           42  SFS             87  NTFS volume set db  CP/M / CTOS / .
 7  HPFS/NTFS/exFAT 4d  QNX4.x          88  Linux plaintext de  Dell Utility   
 8  AIX             4e  QNX4.x 2nd part 8e  Linux LVM       df  BootIt         
 9  AIX bootable    4f  QNX4.x 3rd part 93  Amoeba          e1  DOS access     
 a  OS/2 Boot Manag 50  OnTrack DM      94  Amoeba BBT      e3  DOS R/O        
 b  W95 FAT32       51  OnTrack DM6 Aux 9f  BSD/OS          e4  SpeedStor      
 c  W95 FAT32 (LBA) 52  CP/M            a0  IBM Thinkpad hi ea  Rufus alignment
 e  W95 FAT16 (LBA) 53  OnTrack DM6 Aux a5  FreeBSD         eb  BeOS fs        
 f  W95 Ext'd (LBA) 54  OnTrackDM6      a6  OpenBSD         ee  GPT            
10  OPUS            55  EZ-Drive        a7  NeXTSTEP        ef  EFI (FAT-12/16/
11  Hidden FAT12    56  Golden Bow      a8  Darwin UFS      f0  Linux/PA-RISC b
12  Compaq diagnost 5c  Priam Edisk     a9  NetBSD          f1  SpeedStor      
14  Hidden FAT16 <3 61  SpeedStor       ab  Darwin boot     f4  SpeedStor      
16  Hidden FAT16    63  GNU HURD or Sys af  HFS / HFS+      f2  DOS secondary  
17  Hidden HPFS/NTF 64  Novell Netware  b7  BSDI fs         fb  VMware VMFS    
18  AST SmartSleep  65  Novell Netware  b8  BSDI swap       fc  VMware VMKCORE 
1b  Hidden W95 FAT3 70  DiskSecure Mult bb  Boot Wizard hid fd  Linux raid auto
1c  Hidden W95 FAT3 75  PC/IX           bc  Acronis FAT32 L fe  LANstep        
1e  Hidden W95 FAT1 80  Old Minix       be  Solaris boot    ff  BBT            
Partition type (type L to list all types): 83
Changed type of partition 'Linux' to 'Linux'.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

And then use mkfs.ext4 to create a filesystem:

mkfs.ext4 /dev/mmcblk0p1 
mke2fs 1.43.1 (08-Jun-2016)
Creating filesystem with 1899264 4k blocks and 475136 inodes
Filesystem UUID: 1c581a4c-942a-41e6-98b8-0f422c0944ee
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done 

And make a mount point and mount it:

mkdir -p /www/html
mount -t ext4 /dev/mmcblk0p1 /www/html

This will automatically update /etc/config/fstab:

config 'global'
        option  anon_swap       '0'
        option  anon_mount      '0'
        option  auto_swap       '1'
        option  auto_mount      '1'
        option  delay_root      '5'
        option  check_fs        '0'

config 'mount'
        option  target  '/mnt/mmcblk0p1'
        option  uuid    'a5822cff-5d21-4dfd-b4ef-47f9e5fde180'
        option  enabled '0'

To enable the sd card to be mounted on a reboot, following the storage docs:

/etc/init.d/fstab stop
uci add fstab mount
uci set fstab.@mount[-1].device=/dev/mmcblk0p1
uci set fstab.@mount[-1].target=/mnt/share
uci set fstab.@mount[-1].options=rw,sync
uci set fstab.@mount[-1].enabled=1
uci commit fstab
/etc/init.d/fstab start

Nginx

Update the package list and install nginx using opkg:

opkg update
opkg list-upgradable 
opkg install nginx

Edit /etc/nginx/nginx.conf:

user nobody nogroup;
worker_processes  1;

events {
    worker_connections  1024;
}


http {
    include       mime.types;
    sendfile        on;

    server {                                                                  
        listen       80 default_server;                                       
        server_name  localhost; 

        location / {                                               
            root   /www/html;                                      
            index  video.html;                                     
        }                                                          
                                                                   
        error_page  404              /video.html;    
    }  

}

Are start it (set up /www/html first, see above.

/etc/init.d/nginx start

dnsmasq

See this very simple answer:

echo "address=/#/192.168.1.1" >> /etc/dnsmasq.conf
/etc/init.d/dnsmasq restart

Serial Console

Get a Serial Converter USB 2.0 To TTL UART 6PIN Module from Amazon, which is documented on this PDF, connect it as documented on the OpenWRT wiki the TX, RX and GND pins are marked on both boards. The OpenWRT wiki documents that the serial connection parameters for a GL.iNet GL-MT300A are 115200, 8N1.

Plug leads into TX, RX and GND and swap the TX and RX at the other end -- TX to RX and RX to TX, connect the USB and it should be register in /var/log/messages where you can check what tty has been allocated and use screen as suggested by the OpenWRT wiki:

screen /dev/ttyUSB0 115200

And then you can see the device boot:


U-Boot 1.1.3 (Dec 23 2015 - 18:37:46)

Board: Ralink APSoC DRAM:  128 MB
relocate_code Pointer2 at: 87fac000
enable ephy clock...done. rf reg 29 = 5
SSC disabled.
spi_wait_nsec: 29
spi device id: ef 40 18 0 0 (40180000)
find flash: W25Q128FV
*** Warning - bad CRC, using default environment

======================================================
uboot-gl-mt7620 version: 0.0.0.1
--------------------------------------------------
ASIC 7620_MP (Port5<->None)
DRAM component: 1024 Mbits DDR, width 16
DRAM bus: 16 bit
Total memory: 128 MBytes
Flash component: SPI Flash
Date:Dec 23 2015  Time:18:37:46
--------------------------------------------------
icache: sets:512, ways:4, linesz:32 ,total:65536
dcache: sets:256, ways:4, linesz:32 ,total:32768
--------------------------------------------------
 ##### The CPU freq = 580 MHZ ####
 ##### Memory size =128 Mbytes ####
======================================================

Press press WPS button for more than 2 seconds to run web failsafe mode

WPS button is pressed for:  0 second(s)

Catution: WPS button wasn't pressed or not long enough!
Continuing normal boot...


   *** ***         ** ** *****  ***   ***   ***    *
  *  *  *          ** ** * * * *   * *   * *   *   *
 *      *          ** **   *       * *   * *   *   **
 *      *    ***** ** **   *     **  *   * *   *  * *
 *  *** *          * * *   *       * *   * *   *  * *
 *   *  *          * * *   *       * *   * *   *  ****
  *  *  *   *      * * *   *   *   * *   * *   *  *  *
   **  ******      * * *  ***   ***   ***   ***  **  **


Hit SPACE to stop autoboot:  0
Found calibration data, checking calibration status...
Device calibrated. Checking MAC address...
Found MAC. Starting firmware...
## Booting image at bc050000 ...
   Image Name:   MIPS OpenWrt Linux-4.4.14
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    1334384 Bytes =  1.3 MB
   Load Address: 80000000
   Entry Point:  80000000
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK
No initrd
## Transferring control to Linux (at address 80000000) ...
## Giving linux memsize in MB, 128

Starting kernel ...

[    0.000000] Linux version 4.4.14 (buildbot@owrtbuild01) (gcc version 5.3.0 (OpenWrt GCC 5.3.0 50013) ) #1 Sat Nov 26 16:37:08 UTC 2016
[    0.000000] Board has DDR2
[    0.000000] Analog PMU set to hw control
[    0.000000] Digital PMU set to hw control
[    0.000000] SoC Type: MediaTek MT7620A ver:2 eco:6
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019650 (MIPS 24KEc)
[    0.000000] MIPS: machine is GL-MT300A
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 08000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 32512
[    0.000000] Kernel command line: console=ttyS0,115200 rootfstype=squashfs,jffs2
[    0.000000] PID hash table entries: 512 (order: -1, 2048 bytes)
[    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Writing ErrCtl register=0007211b
[    0.000000] Readback ErrCtl register=0007211b
[    0.000000] Memory: 125548K/131072K available (3028K kernel code, 140K rwdata, 724K rodata, 196K init, 200K bss, 5524K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS:256
[    0.000000] CPU Clock: 580MHz
[    0.000000] clocksource: systick: mask: 0xffff max_cycles: 0xffff, max_idle_ns: 583261500 ns
[    0.000000] systick: enable autosleep mode
[    0.000000] systick: running - mult: 214748, shift: 32
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 6590553264 ns
[    0.000011] sched_clock: 32 bits at 290MHz, resolution 3ns, wraps every 7405115902ns
[    0.007575] Calibrating delay loop... 385.84 BogoMIPS (lpj=1929216)
[    0.070075] pid_max: default: 32768 minimum: 301
[    0.074703] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.081073] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.094273] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.104000] pinctrl core: initialized pinctrl subsystem
[    0.110376] NET: Registered protocol family 16
[    0.597358] mt7620-pci 10140000.pcie: PCIE0 no card, disable it(RST&CLK)
[    0.603842] mt7620-pci: probe of 10140000.pcie failed with error -1
[    0.623494] rt2880_gpio 10000600.gpio: registering 24 gpios
[    0.628939] rt2880_gpio 10000600.gpio: registering 24 irq handlers
[    0.635083] rt2880_gpio 10000638.gpio: registering 16 gpios
[    0.640476] rt2880_gpio 10000638.gpio: registering 16 irq handlers
[    0.646595] rt2880_gpio 10000660.gpio: registering 32 gpios
[    0.651989] rt2880_gpio 10000660.gpio: registering 32 irq handlers
[    0.658118] rt2880_gpio 10000688.gpio: registering 1 gpios
[    0.663427] rt2880_gpio 10000688.gpio: registering 1 irq handlers
[    0.671035] clocksource: Switched to clocksource systick
[    0.677709] NET: Registered protocol family 2
[    0.682971] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.689699] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.695923] TCP: Hash tables configured (established 1024 bind 1024)
[    0.702150] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.707779] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.714191] NET: Registered protocol family 1
[    0.718935] rt-timer 10000100.timer: maximum frequency is 1220Hz
[    0.725788] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.752303] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.757924] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.770135] io scheduler noop registered
[    0.773962] io scheduler deadline registered (default)
[    0.779155] ralink-usb-phy usbphy: invalid resource
[    0.784554] Serial: 8250/16550 driver, 16 ports, IRQ sharing enabled
[    0.794475] console [ttyS0] disabled
[    0.797918] 10000c00.uartlite: ttyS0 at MMIO 0x10000c00 (irq = 20, base_baud = 2500000) is a Palmchip BK-3103
[    0.807597] console [ttyS0] enabled
[    0.807597] console [ttyS0] enabled
[    0.814637] bootconsole [early0] disabled
[    0.814637] bootconsole [early0] disabled
[    0.829780] spi spi0.0: force spi mode3
[    0.834278] m25p80 spi0.0: w25q128 (16384 Kbytes)
[    0.839120] 5 ofpart partitions found on MTD device spi0.0
[    0.844758] Creating 5 MTD partitions on "spi0.0":
[    0.849655] 0x000000000000-0x000000030000 : "u-boot"
[    0.856557] 0x000000030000-0x000000040000 : "u-boot-env"
[    0.863905] 0x000000040000-0x000000050000 : "factory"
[    0.870848] 0x000000050000-0x000000fd0000 : "firmware"
[    0.960253] 2 uimage-fw partitions found on MTD device firmware
[    0.966337] 0x000000050000-0x000000195cb0 : "kernel"
[    0.973050] 0x000000195cb0-0x000000fd0000 : "rootfs"
[    0.979908] mtd: device 5 (rootfs) set to be root filesystem
[    0.985896] 1 squashfs-split partitions found on MTD device rootfs
[    0.992233] 0x0000003a0000-0x000000fd0000 : "rootfs_data"
[    0.999609] 0x000000ff0000-0x000001000000 : "art"
[    1.007374] rt2880-pinmux pinctrl: pin io40 already requested by pinctrl; cannot claim for 10100000.ethernet
[    1.017481] rt2880-pinmux pinctrl: pin-40 (10100000.ethernet) status -22
[    1.024338] rt2880-pinmux pinctrl: could not request pin 40 (io40) from group ephy  on device rt2880-pinmux
[    1.034292] mtk_soc_eth 10100000.ethernet: Error applying setting, reverse things back
[    1.045113] gsw: setting port4 to ephy mode
[    1.049428] mtk_soc_eth 10100000.ethernet eth0 (uninitialized): port 0 link up (100Mbps/Full duplex)
[    1.058751] mtk_soc_eth 10100000.ethernet eth0 (uninitialized): port 1 link up (100Mbps/Full duplex)
[    1.068296] mtk_soc_eth 10100000.ethernet: loaded mt7620 driver
[    1.075177] mtk_soc_eth 10100000.ethernet eth0: mediatek frame engine at 0xb0100000, irq 5
[    1.084209] rt2880_wdt 10000120.watchdog: Initialized
[    1.090952] NET: Registered protocol family 10
[    1.099257] NET: Registered protocol family 17
[    1.103967] bridge: automatic filtering via arp/ip/ip6tables has been deprecated. Update your scripts to load br_netfilter if you need this.
[    1.116916] Bridge firewalling registered
[    1.121033] 8021q: 802.1Q VLAN Support v1.8
[    1.141263] VFS: Mounted root (squashfs filesystem) readonly on device 31:5.
[    1.149534] Freeing unused kernel memory: 196K (803cf000 - 80400000)
[    3.574397] init: Console is alive
[    3.578095] init: - watchdog -
[    5.306490] usbcore: registered new interface driver usbfs
[    5.312290] usbcore: registered new interface driver hub
[    5.317840] usbcore: registered new device driver usb
[    5.328934] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    5.337284] ehci-platform: EHCI generic platform driver
[    5.353022] phy phy-usbphy.0: remote usb device wakeup disabled
[    5.359069] phy phy-usbphy.0: UTMI 16bit 30MHz
[    5.363646] ehci-platform 101c0000.ehci: EHCI Host Controller
[    5.369543] ehci-platform 101c0000.ehci: new USB bus registered, assigned bus number 1
[    5.377764] ehci-platform 101c0000.ehci: irq 26, io mem 0x101c0000
[    5.390056] ehci-platform 101c0000.ehci: USB 2.0 started, EHCI 1.00
[    5.397586] hub 1-0:1.0: USB hub found
[    5.401852] hub 1-0:1.0: 1 port detected
[    5.408997] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    5.416850] ohci-platform: OHCI generic platform driver
[    5.422522] ohci-platform 101c1000.ohci: Generic Platform OHCI controller
[    5.429481] ohci-platform 101c1000.ohci: new USB bus registered, assigned bus number 2
[    5.437689] ohci-platform 101c1000.ohci: irq 26, io mem 0x101c1000
[    5.468344] hub 2-0:1.0: USB hub found
[    5.472526] hub 2-0:1.0: 1 port detected
[    5.484005] init: - preinit -
[    6.443976] 8021q: adding VLAN 0 to HW filter on device eth0
Press the [f] key and hit [enter] to enter failsafe mode
Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
[    7.945804] jffs2: notice: (362) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
[    7.967153] mount_root: switching to jffs2 overlay
[    8.016696] procd: - early -
[    8.019758] procd: - watchdog -
[    8.478127] procd: - ubus -
[    8.506757] random: ubusd urandom read with 18 bits of entropy available
[    8.515380] procd: - init -
Please press Enter to activate this console.
[    9.329799] ip6_tables: (C) 2000-2006 Netfilter Core Team
[    9.349997] Loading modules backported from Linux version wt-2016-05-12-0-g7a54796
[    9.357807] Backport generated by backports.git backports-20160216-0-ge3c56e4
[    9.425678] ip_tables: (C) 2000-2006 Netfilter Core Team
[    9.443155] nf_conntrack version 0.5.0 (1964 buckets, 7856 max)
[    9.500146] xt_time: kernel timezone is -0000
[    9.518257] PPP generic driver version 2.4.2
[    9.526238] NET: Registered protocol family 24
[    9.549584] ieee80211 phy0: rt2x00_set_rt: Info - RT chipset 5390, rev 0500 detected
[    9.557580] ieee80211 phy0: rt2x00_set_rf: Info - RF chipset 7620 detected
[   17.684760] 8021q: adding VLAN 0 to HW filter on device eth0
[   17.699304] device eth0.1 entered promiscuous mode
[   17.704213] device eth0 entered promiscuous mode
[   17.732367] br-lan: port 1(eth0.1) entered forwarding state
[   17.738169] br-lan: port 1(eth0.1) entered forwarding state
[   19.734405] br-lan: port 1(eth0.1) entered forwarding state
[   20.647208] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
[   20.667245] device wlan0 entered promiscuous mode
[   20.672138] br-lan: port 2(wlan0) entered forwarding state
[   20.677852] br-lan: port 2(wlan0) entered forwarding state
[   20.684568] br-lan: port 2(wlan0) entered disabled state
[   20.750971] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
[   20.757731] br-lan: port 2(wlan0) entered forwarding state
[   20.763391] br-lan: port 2(wlan0) entered forwarding state
[   22.754391] br-lan: port 2(wlan0) entered forwarding state
[   37.605653] random: nonblocking pool is initialized


BusyBox v1.24.2 () built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 DESIGNATED DRIVER (Bleeding Edge, 50013)
 -----------------------------------------------------
  * 2 oz. Orange Juice         Combine all juices in a
  * 2 oz. Pineapple Juice      tall glass filled with
  * 2 oz. Grapefruit Juice     ice, stir well.
  * 2 oz. Cranberry Juice
 -----------------------------------------------------
root@OpenWrt:/# 

To PgUp and PgDn in screen you need to enter copy mode using Ctrl-A and then press [, you can then go up and down by half a page at a time using Ctrl-u and Ctrl-d.

Following the OpenWRT wiki Serial Consol page, to enable a non-root user to access the device create the file /etc/udev/rules.d/60-ttyUSBx.rules with this content:

KERNEL=="ttyUSB[0-9]",              MODE="0666"

/etc/config/wireless

Defaults:

config wifi-device  radio0
        option type     mac80211
        option channel  11
        option hwmode   11g
        option path     'platform/10180000.wmac'
        option htmode   HT20
        # REMOVE THIS LINE TO ENABLE WIFI:
        option disabled 1

config wifi-iface
        option device   radio0
        option network  lan
        option mode     ap
        option ssid     OpenWrt
        option encryption none

/etc/config/network

Defaults:


config interface 'loopback'
        option ifname 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix 'fd3c:005b:19f7::/48'

config interface 'lan'
        option type 'bridge'
        option ifname 'eth0.1'
        option proto 'static'
        option ipaddr '192.168.1.1'
        option netmask '255.255.255.0'
        option ip6assign '60'

config device 'lan_dev'
        option name 'eth0.1'
        option macaddr 'e4:95:6e:40:f0:b4'

config interface 'wan'
        option ifname 'eth0.2'
        option proto 'dhcp'

config device 'wan_dev'
        option name 'eth0.2'
        option macaddr 'e4:95:6e:40:f0:b5'

config interface 'wan6'
        option ifname 'eth0.2'
        option proto 'dhcpv6'

config switch
        option name 'switch0'
        option reset '1'
        option enable_vlan '1'

config switch_vlan
        option device 'switch0'
        option vlan '1'
        option ports '1 2 3 4 6t'

config switch_vlan
        option device 'switch0'
        option vlan '2'
        option ports '0 6t'

df -h

Space after flashing:

Filesystem                Size      Used Available Use% Mounted on
/dev/root                 2.0M      2.0M         0 100% /rom
tmpfs                    61.4M     64.0K     61.3M   0% /tmp
tmpfs                    61.4M     36.0K     61.4M   0% /tmp/root
tmpfs                   512.0K         0    512.0K   0% /dev
/dev/mtdblock6           12.2M    464.0K     11.7M   4% /overlay
overlayfs:/overlay       12.2M    464.0K     11.7M   4% /

Network notes

You might need to manually set the IP on your ethernet interface, on Debian edit /etc/network/interfaces:

auto eth0
iface eth0 inet static
 address 192.168.1.2
 gateway 192.168.1.1
 netmask 255.255.255.0

Or to set this on the command line:

ifconfig eth0 192.168.1.2
route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.1.1 dev eth0