Here is a set of clean patches for creating a working firmware for the HAME MPR-A1(should also work on most of the clones) from latest trunk:
Compiling
Just checkout latest trunk (revision 34872 as of this writing) in a directory of your choice and apply the patches:
mkdir whatever
cd whatever
svn co svn://svn.openwrt.org/openwrt/trunk
cd trunk
patch -p0 < path/to/dowloaded/patches/openwrt_add_pm26lq032_flash_support.txt
patch -p0 < path/to/dowloaded/patches/openwrt_add_rt3550_wlan_support.txt
patch -p0 < path/to/dowloaded/patches/openwrt_hame_mpr-a1_patch.txt
make menuconfig
Select:
Target System: (Ralink RT288x/RT3xxx)
Subtarget: (RT305x based boards)
Target Profile: (HAME MPR-A1)
Then select all the packages you want to include , save and exit.
then:
...where "n" is the number of CPU + 1.
After a time that depends on your processing power (may take hours!), you should get a firmware image named "openwrt-ramips-rt305x-mpr-a1-squashfs-sysupgrade.bin" in the "bin/ramips" directory and all corresponding packages in the "packages" subdirectory.
Flashing
I didn't tried using the flashing tool built in the original firmware's webadmin.
I used a TTL UART to USB converter (Nokia CA42 cable clone), connected like this:
You will need an Ethernet cable between your Linux PC and the device.
On the Linux PC side, you will need a terminal emulator ("sudo minicom" or "screen") and use a setup with 57600 bps, 8 bits, 1 stop bit, no parity, no hardware/software flow control and a tftp server running. In the following, it is assumed that you copied the "openwrt-ramips-rt305x-mpr-a1-squashfs-sysupgrade.bin" in the "bin/ramips" file at the root of the tftp server, generally "/tftpboot".
Power on the device, and be readdy to type in "2" asap:
U-Boot 1.1.7 (Dec 13 2011 - 13:49:42)
Board: Ralink APSoC DRAM: 16 MB
relocate_code Pointer at: 80fb4000
******************************
Software System Reset Occurred
******************************
spi_wait_nsec: 42
spi device id: ef 40 16 0 0 (40160000)
find flash: W25Q32BV
raspi_read: from:30000 len:1000
.raspi_read: from:30000 len:1000
.============================================
Ralink UBoot Version: 3.6.0.0
--------------------------------------------
ASIC 5350_MP (Port5<->None)
DRAM_CONF_FROM: Boot-Strapping
DRAM_TYPE: SDRAM
DRAM_SIZE: 128 Mbits
DRAM_WIDTH: 16 bits
DRAM_TOTAL_WIDTH: 16 bits
TOTAL_MEMORY_SIZE: 16 MBytes
Flash component: SPI Flash
Date:Dec 13 2011 Time:13:49:42
============================================
icache: sets:256, ways:4, linesz:32 ,total:32768
dcache: sets:128, ways:4, linesz:32 ,total:16384
##### The CPU freq = 360 MHZ ####
estimate memory size =16 Mbytes
raspi_read: from:40028 len:6
.
raspi_read: from:0 len:30004
....*************Is_update = 0 plat = 1**************
Please choose the operation:
1: Load system code to SDRAM via TFTP.
2: Load system code then write to Flash via TFTP.
3: Boot system code via Flash (default).
4: Entr boot command line interface.
7: Load Boot Loader code then write to Flash via Serial.
9: Load Boot Loader code then write to Flash via TFTP.
You choosed 2
0
2: System Load Linux Kernel then write to Flash via TFTP.
Warning!! Erase Linux in Flash then burn new one. Are you sure?(Y/N)
Type "y", then enter the correct IPaddresses for the device and your PC, and the name of the firmware file:
Please Input new ones /or Ctrl-C to discard
Input device IP (192.168.1.1) ==:192.168.1.1
Input server IP (192.168.1.2) ==:192.168.1.2
Input Linux Kernel filename (openwrt-ramips-rt305x-mpr-a1-squashfs-sysupgrade.bin) ==:openwrt-ramips-rt305x-mpr-a1-squashfs-sysupgrade.bin
You should see the flashing taking place, followed by the normal OpenWrt boot sequence:
netboot_common, argc= 3
NetTxPacket = 0x80FE6AC0
KSEG1ADDR(NetTxPacket) = 0xA0FE6AC0
NetLoop,call eth_halt !
NetLoop,call eth_init !
Trying Eth0 (10/100-M)
Waitting for RX_DMA_BUSY status Start... done
Header Payload scatter function is Disable !!
ETH_STATE_ACTIVE!!
Using Eth0 (10/100-M) device
TFTP from server 192.168.1.2; our IP address is 192.168.1.1
Filename 'openwrt-ramips-rt305x-mpr-a1-squashfs-sysupgrade.bin'.
TIMEOUT_COUNT=10,Load address: 0x80100000
Loading: Got ARP REPLY, set server/gtwy eth addr (00:1d:09:d7:4c:49)
Got it
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
##################
done
Bytes transferred = 2752516 (2a0004 hex)
NetBootFileXferSize= 002a0004
raspi_erase_write: offs:50000, count:2a0004
raspi_erase: offs:50000 len:2a0000
..........................................
raspi_write: to:50000 len:2a0000
..........................................
raspi_read: from:50000 len:10000
.raspi_read: from:60000 len:10000
.raspi_read: from:70000 len:10000
.raspi_read: from:80000 len:10000
.raspi_read: from:90000 len:10000
.raspi_read: from:a0000 len:10000
.raspi_read: from:b0000 len:10000
.raspi_read: from:c0000 len:10000
.raspi_read: from:d0000 len:10000
.raspi_read: from:e0000 len:10000
.raspi_read: from:f0000 len:10000
.raspi_read: from:100000 len:10000
.raspi_read: from:110000 len:10000
.raspi_read: from:120000 len:10000
.raspi_read: from:130000 len:10000
.raspi_read: from:140000 len:10000
.raspi_read: from:150000 len:10000
.raspi_read: from:160000 len:10000
.raspi_read: from:170000 len:10000
.raspi_read: from:180000 len:10000
.raspi_read: from:190000 len:10000
.raspi_read: from:1a0000 len:10000
.raspi_read: from:1b0000 len:10000
.raspi_read: from:1c0000 len:10000
.raspi_read: from:1d0000 len:10000
.raspi_read: from:1e0000 len:10000
.raspi_read: from:1f0000 len:10000
.raspi_read: from:200000 len:10000
.raspi_read: from:210000 len:10000
.raspi_read: from:220000 len:10000
.raspi_read: from:230000 len:10000
.raspi_read: from:240000 len:10000
.raspi_read: from:250000 len:10000
.raspi_read: from:260000 len:10000
.raspi_read: from:270000 len:10000
.raspi_read: from:280000 len:10000
.raspi_read: from:290000 len:10000
.raspi_read: from:2a0000 len:10000
.raspi_read: from:2b0000 len:10000
.raspi_read: from:2c0000 len:10000
.raspi_read: from:2d0000 len:10000
.raspi_read: from:2e0000 len:10000
.raspi_read: from:2f0000 len:10000
.raspi_erase: offs:2f0000 len:10000
.
raspi_write: to:2f0000 len:10000
.
raspi_read: from:2f0000 len:10000
.Done!
## Booting image at bc050000 ...
raspi_read: from:50000 len:40
. Image Name: MIPS OpenWrt Linux-3.6.11
Created: 2012-12-23 14:28:32 UTC
Image Type: MIPS Linux Kernel Image (lzma compressed)
Data Size: 838219 Bytes = 818.6 kB
Load Address: 80000000
Entry Point: 80000000
raspi_read: from:50040 len:cca4b
............. Verifying Checksum ... OK
Uncompressing Kernel Image ... OK
No initrd
## Transferring control to Linux (at address 80000000) ...
## Giving linux memsize in MB, 16
Starting kernel ...
[ 0.000000] Linux version 3.6.11 (mstempin@Mikeul) (gcc version 4.6.4 20121106 (prerelease) (Linaro GCC 4.6-2012.11) ) #1 Sun Dec 23 15:28:25 CET 2012
[ 0.000000] bootconsole [early0] enabled
[ 0.000000] CPU revision is: 0001964c (MIPS 24KEc)
[ 0.000000] Ralink RT5350 id:1 rev:3 running at 360.00 MHz
[ 0.000000] Determined physical RAM map:
[ 0.000000] memory: 01000000 @ 00000000 (usable)
[ 0.000000] Initrd not found or empty - disabling initrd
[ 0.000000] Zone ranges:
[ 0.000000] Normal [mem 0x00000000-0x00ffffff]
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x00000000-0x00ffffff]
[ 0.000000] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[ 0.000000] Primary data cache 16kB, 4-way, VIPT, no aliases, linesize 32 bytes
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping off. Total pages: 4064
[ 0.000000] Kernel command line: board=MPR-A1 console=ttyS1,57600 mtdparts=spi0.0:192k(u-boot)ro,64k(u-boot-env)ro,64k(factory)ro,896k(kernel),2880k(rootfs),3776k@0x50000(firmware) 2
[ 0.000000] PID hash table entries: 64 (order: -4, 256 bytes)
[ 0.000000] Dentry cache hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.000000] Inode-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.000000] __ex_table already sorted, skipping sort
[ 0.000000] Writing ErrCtl register=00005680
[ 0.000000] Readback ErrCtl register=00005680
[ 0.000000] Memory: 13576k/16384k available (1931k kernel code, 2808k reserved, 312k data, 176k init, 0k highmem)
[ 0.000000] SLUB: Genslabs=9, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] NR_IRQS:48
[ 0.000000] console [ttyS1] enabled, bootconsole disabled
[ 0.000000] console [ttyS1] enabled, bootconsole disabled
[ 0.010000] Calibrating delay loop... 239.61 BogoMIPS (lpj=1198080)
[ 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 HAME MPR-A1
[ 0.130000] bio: create slab <bio-0> at 0
[ 0.140000] Switching to clocksource MIPS
[ 0.150000] NET: Registered protocol family 2
[ 0.160000] TCP established hash table entries: 512 (order: 0, 4096 bytes)
[ 0.180000] TCP bind hash table entries: 512 (order: -1, 2048 bytes)
[ 0.190000] TCP: Hash tables configured (established 512 bind 512)
[ 0.200000] TCP: reno registered
[ 0.210000] UDP hash table entries: 256 (order: 0, 4096 bytes)
[ 0.220000] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[ 0.230000] NET: Registered protocol family 1
[ 0.280000] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[ 0.290000] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[ 0.320000] msgmni has been set to 26
[ 0.320000] io scheduler noop registered
[ 0.330000] io scheduler deadline registered (default)
[ 0.340000] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
[ 0.360000] serial8250: ttyS0 at MMIO 0x10000500 (irq = 13) is a 16550A
[ 0.370000] serial8250: ttyS1 at MMIO 0x10000c00 (irq = 20) is a 16550A
[ 0.390000] ramips-spi ramips-spi.0: master is unqueued, this is deprecated
[ 0.410000] m25p80 spi0.0: found w25q32, expected pm25lq032
[ 0.420000] m25p80 spi0.0: w25q32 (4096 Kbytes)
[ 0.430000] 6 cmdlinepart partitions found on MTD device spi0.0
[ 0.440000] Creating 6 MTD partitions on "spi0.0":
[ 0.450000] 0x000000000000-0x000000030000 : "u-boot"
[ 0.460000] 0x000000030000-0x000000040000 : "u-boot-env"
[ 0.480000] 0x000000040000-0x000000050000 : "factory"
[ 0.490000] 0x000000050000-0x000000130000 : "kernel"
[ 0.500000] 0x000000130000-0x000000400000 : "rootfs"
[ 0.520000] mtd: partition "rootfs" set to be root filesystem
[ 0.530000] mtd: partition "rootfs_data" created automatically, ofs=2F0000, len=110000
[ 0.540000] 0x0000002f0000-0x000000400000 : "rootfs_data"
[ 0.560000] 0x000000050000-0x000000400000 : "firmware"
[ 0.580000] ramips-wdt ramips-wdt: timeout value must be 0 < timeout <= 35, using 35
[ 0.600000] TCP: cubic registered
[ 0.610000] NET: Registered protocol family 17
[ 0.620000] 8021q: 802.1Q VLAN Support v1.8
[ 0.650000] VFS: Mounted root (squashfs filesystem) readonly on device 31:4.
[ 0.660000] Freeing unused kernel memory: 176k freed
[ 5.120000] input: gpio-keys-polled as /devices/platform/gpio-keys-polled/input/input0
[ 5.260000] Button Hotplug driver version 0.4.1
- preinit -
Press the [f] key and hit [enter] to enter failsafe mode
- regular preinit -
jffs2 not ready yet; using ramdisk
- init -
Please press Enter to activate this console. [ 11.080000] Compat-drivers backport release: compat-drivers-2012-12-04
[ 11.090000] Backport based on wireless-testing.git master-2012-12-06
[ 11.100000] compat.git: wireless-testing.git
[ 11.150000] cfg80211: Calling CRDA to update world regulatory domain
[ 11.160000] cfg80211: World regulatory domain updated:
[ 11.180000] cfg80211: (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
[ 11.190000] cfg80211: (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[ 11.210000] cfg80211: (2457000 KHz - 2482000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
[ 11.220000] cfg80211: (2474000 KHz - 2494000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
[ 11.240000] cfg80211: (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[ 11.250000] cfg80211: (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[ 11.910000] SCSI subsystem initialized
[ 12.330000] usbcore: registered new interface driver usbfs
[ 12.340000] usbcore: registered new interface driver hub
[ 12.350000] usbcore: registered new device driver usb
[ 14.890000] PPP generic driver version 2.4.2
[ 15.310000] ip_tables: (C) 2000-2006 Netfilter Core Team
[ 15.580000] NET: Registered protocol family 24
[ 15.760000] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 16.770000] ehci-platform ehci-platform: Generic Platform EHCI Controller
[ 16.780000] ehci-platform ehci-platform: new USB bus registered, assigned bus number 1
[ 16.830000] ehci-platform ehci-platform: irq 26, io mem 0x101c0000
[ 16.860000] ehci-platform ehci-platform: USB 2.0 started, EHCI 1.00
[ 16.870000] hub 1-0:1.0: USB hub found
[ 16.880000] hub 1-0:1.0: 1 port detected
[ 17.030000] nf_conntrack version 0.5.0 (214 buckets, 856 max)
[ 17.760000] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 17.770000] ohci-platform ohci-platform: Generic Platform OHCI Controller
[ 17.780000] ohci-platform ohci-platform: new USB bus registered, assigned bus number 2
[ 17.800000] ohci-platform ohci-platform: irq 26, io mem 0x101c1000
[ 17.870000] hub 2-0:1.0: USB hub found
[ 17.880000] hub 2-0:1.0: 1 port detected
[ 18.040000] usbcore: registered new interface driver cdc_acm
[ 18.050000] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
[ 18.210000] usbcore: registered new interface driver usbserial
[ 18.230000] usbcore: registered new interface driver usbserial_generic
[ 18.240000] USB Serial support registered for generic
[ 18.250000] usbserial: USB Serial Driver core
[ 18.300000] Initializing USB Mass Storage driver...
[ 18.310000] usbcore: registered new interface driver usb-storage
[ 18.320000] USB Mass Storage support registered.
[ 18.460000] usbcore: registered new interface driver ums-alauda
[ 18.490000] usbcore: registered new interface driver ums-cypress
[ 18.530000] usbcore: registered new interface driver ums-datafab
[ 18.560000] usbcore: registered new interface driver ums-freecom
[ 18.600000] usbcore: registered new interface driver ums-isd200
[ 18.630000] usbcore: registered new interface driver ums-jumpshot
[ 18.660000] usbcore: registered new interface driver ums-karma
[ 18.690000] usbcore: registered new interface driver ums-sddr09
[ 18.730000] usbcore: registered new interface driver ums-sddr55
[ 18.760000] usbcore: registered new interface driver ums-usbat
[ 18.930000] usbcore: registered new interface driver ftdi_sio
[ 18.950000] USB Serial support registered for FTDI USB Serial Device
[ 18.960000] ftdi_sio: v1.6.0:USB FTDI Serial Converters Driver
[ 26.900000] device eth0.1 entered promiscuous mode
[ 26.910000] device eth0 entered promiscuous mode
[ 26.950000] br-lan: port 1(eth0.1) entered forwarding state
[ 26.960000] br-lan: port 1(eth0.1) entered forwarding state
[ 26.990000] ramips-wdt: timeout value 60 must be 0 < timeout <= 35, using 35
[ 28.960000] br-lan: port 1(eth0.1) entered forwarding state
[ 49.040000] jffs2_scan_eraseblock(): End of filesystem marker found at 0x0
[ 49.060000] jffs2_build_filesystem(): unlocking the mtd device... done.
[ 49.070000] jffs2_build_filesystem(): erasing all blocks after the end marker... done.
[ 56.410000] jffs2: notice: (1279) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
BusyBox v1.19.4 (2012-12-23 15:19:00 CET) built-in shell (ash)
Enter 'help' for a list of built-in commands.
_______ ________ __
| |.-----.-----.-----.| | | |.----.| |_
| - || _ | -__| || | | || _|| _|
|_______|| __|_____|__|__||________||__| |____|
|__| W I R E L E S S F R E E D O M
-----------------------------------------------------
BARRIER BREAKER (Bleeding Edge, r34872)
-----------------------------------------------------
* 1/2 oz Galliano Pour all ingredients into
* 4 oz cold Coffee an irish coffee mug filled
* 1 1/2 oz Dark Rum with crushed ice. Stir.
* 2 tsp. Creme de Cacao
-----------------------------------------------------
root@OpenWrt:/# (Type return to get this prompt)
Tests
I have an MPR-L8 (HAME MPR-A1 clone) board with 4MB Flash and 16 MB SDRAM, purchased here for $19.
I used a Linkduino board (Arduino Leonardo-compatible board) requiring kmod-cdc-acm VCOM driver, and a SanDisk Cruzer Fit 16 GB formatted as VFAT.
Here are the results of the tests I did perform:
Boot is ok, except for 2 small warnings regarding "ramips-wdt" watchdog => not important
Ethernet switch is working: eth0 + eth0.1 + eth0.2 + ping working to/from my PC
WiFi is working: when enabled in "/etc/config/wireless" + "wifi up", I can connect to the "OpenWrt" AP and to the router from my PC using "telnet"
Red LED is working: blinks slowly during failsafe entry test until system is ready, then on: can be controlled via led-trigger-*
Blue LED is working: controlled via led-trigger-netdev on WiFi by default
Reset button is working with button hotplug: check by uncommenting the event in "/etc/hotplug2.rules" and creating an executable script "logger $BUTTON $ACTION" in "/etc/hotplug.d/button/buttons" and checking with "logread -f"
Failsafe is working, both by "f + enter" on the console or by pressing the reset switch when the red LED starts blinking during boot, then tried to "wget" the firmware from my PC and flash it => ok
unlike the TL-WR703N, the Arduino board attached to the USB host port as a CDC-ACM VCOM device is working flawlessly for hours without problem, displaying an Arduino-generated counter every second using "microcom -s 57600 /dev/ttyACM0"
USB power and root hub power can be controlled by "/sys/class/gpio/gpio7/value" and "/sys/class/gpio/gpio12/value" respectively, causing the Arduino board to power on/off and the root hub to show connect/disconnect events in the logs
USB mass storage is working too, I was able to mount a VFAT-formatted 16GB USB disk and browse it
Remaining Problems
The 16 MB SDRAM seems very limitating: depending on previous operations, I have seen some serious slowdowns while mounting the USB disk for example, or when turning on WiFi. No crash, but sitting at the prompt for up to minutes
I din't even tried to run LuCI!
However, the system seems stable as I experienced no crash or kernel oops.
Merry Christmas
(Last edited by Squonk on 23 Dec 2012, 19:27)