Skip to content

Instantly share code, notes, and snippets.

@Mat1az

Mat1az/a5-v11.md Secret

Last active November 13, 2024 04:24
Show Gist options
  • Save Mat1az/ecc0f1f12188cba763ebcd5eac41d9ec to your computer and use it in GitHub Desktop.
Save Mat1az/ecc0f1f12188cba763ebcd5eac41d9ec to your computer and use it in GitHub Desktop.
a5-v11

Personal notes for A5-V11, from OpenWRT.org, Hackaday, and a lot of OpenWRT forums—big thanks to the community!

Model A5-V11
CPU Ralink RT5350F 360MHZ
Arch ramips rt305x mipsel_24kc
Flash 4MB (EN25Q32B)
RAM 16MB or 32MB
WLAN Hardware 2.4GHz b/g/n
Ethernet 100M Ports 1
USB Ports 1x 2.0, 1x µUSB (power)

Important Notes

Change the bootloader

  • Why? The default bootloader may lack recovery options in case of emergency.
  1. Connect via Telnet/SSH and check your device's RAM:
32MB RAM → Use U-Boot 256
16MB RAM → Use U-Boot 128
  1. Then, flash the Bootloader:
mtd_write write example.img Bootloader

Software

  • Don't install stock factory firmware from OpenWrt.org — it doesn't save settings after a reboot due to limited space. Use a custom stock firmware or Chaos firmware instead.
  • Stock firmware has a serious bug: using opkg remove will not free up space, even with options like --force-removal-of-dependent-packages or --autoremove. The solution is to build a custom firmware with your desired packages using the Image Builder.
  • For Chaos firmware, the SSH password is always incorrect by default. Log in via Telnet first, then run passwd to set a new password, and SSH will work.
  • Stock and Chaos firmware are not compatible. Developing with their respective toolchains will not work with the other firmware.
  • Using kmod-fs-ntfs provides read-only support for NTFS.

Hardware

  • The UART header pins are highly susceptible to pad lifting, be sure to use thin wires.
  • The Ralink CPU tends to overheat; attach a heatsink to it. I had to perform a reflow once.

Recovery

  • If you lose access to your device (e.g., due to a bad firmware flash), you can recover it using U-Boot recovery mode.
  • My U-Boot version: "U-Boot 1.1.3 Rev 0.3 by WErt(WErt) 4PDA (May 19 2016)"
Recover without UART
  1. Power on your A5-V11 while holding the hidden button
  2. Wait for 15 seconds. In the background, the device will enter Rescue Mode and listen for TFTP:
## Enter to Rescue Mode (image error) ##
...
Our IP address is:(192.168.1.1)
  1. Set your PC's IP address to be in the 192.168.1.x subnet.
  2. Once you can ping, run the following command:
curl -T firmware.bin tftp://192.168.1.1
  1. Wait for about 2 minutes while the recovery process happens in the background.

u-boot

Recover with UART 1. Open your device and solder the UART as follows:
VCC (3.3V; do not connect)
TX (connect to RX on a 3.3V USB-TTL adapter)
RX (connect to TX on a 3.3V USB-TTL using a 470 Ohm to 1k Ohm resistor)
GND (connect to GND on a 3.3V USB-TTL)
  1. Install Putty/Arduino/Minicom, then power on the USB-to-TTL adapter and enter the following command:
minicom -D /dev/ttyUSB0 -b 57600
  1. Power on your A5-V11 while holding the hidden button. You should see something like this:

u-boot

  1. If you're lucky, you'll be able to press the key you want. Otherwise, it will default to "3". Unfortunately, I can't help much further here.

Commands

  • SSH Log-in
rm ~/.ssh/known_hosts
ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 -oHostKeyAlgorithms=+ssh-rsa -oCiphers=+aes128-cbc <IP ADDRESS> -l <user>
  • Firmware Flash
mtd -r write example-sysupgrade.bin firmware
or
mtd_write write example-sysupgrade.bin Kernel
  • Factory Reset:
mtd -r erase rootfs_data
  • Install a Package:
opkg install example.ipk
  • Get Installed Packages
grep -H Installed-Size: /usr/lib/opkg/info/*.control | sed 's,^.*/\([^/]\+\)\.control:Installed-Size: *\(.*\),\2\t\1,' | sort -n

Packages:

  • Stock

https://downloads.openwrt.org/releases/18.06.9/packages/mipsel_24kc/

  • Chaos

https://archive.openwrt.org/chaos_calmer/15.05.1/ramips/rt305x/packages/

Playstation 2 (PS2)

Find these files; it is a Chaos 15.05.1-based firmware (without LuCI), with the ntfs-3g and samba6-server packages already installed.

SHA1 name
548732ae7cbda0c1e8837aa84d7b84da458f0205 firmware.bin
b2e9ff97b0b724c54ebeeb99f5df74547877b344 uboot_usb_256_03.img
SMB Server

/etc/config/network

your desired ip

/etc/config/samba

config 'sambashare'
 option 'name' 'PS2SMB'
 option 'path' '/mnt/usb'
 option 'guest_ok' 'yes'
 option 'create_mask' '0777'
 option 'dir_mask' '0777'
 option 'read_only' 'yes'

/etc/samba/smb.conf.template

"use sendfile=yes" -> "use sendfile=no"

/etc/init.d/samba

# procd_open_instance
# procd_set_param command /usr/sbin/nmbd -F
# procd_set_param respawn
# procd_close_instance)

/etc/init.d/network (change START to 65 and add "sleep 1")

"START=20" -> "START=65"
  procd_close_instance
}
sleep 1
reload_service() {

/etc/init.d/ntfsmount

#!/bin/sh /etc/rc.common

START=41
start() {
ntfs-3g /dev/sda1 /mnt/usb -o rw,sync
}

Execute These Commands

mkdir /mnt/usb
chmod 777 /etc/init.d/ntfsmount
/etc/init.d/network enable
/etc/init.d/ntfsmount enable

In OPL:

Address type IP
Address <A5-V11 IP>
Port 445
Share PS2SMB
User GUEST
Password
UDPBD Server

Important Notes:

  • If you configured the SMB Server, disable all samba6-server and ntfsmount services, or perform a factory reset.
  • The custom Chaos firmware above does not include the C++ library. (needed by udpbd-server)
  • The custom Chaos firmware above does not include the exFAT or ext4 modules (not required by udpbd-server, but necessary for Extroot)
  • The custom Chaos firmware above does not have free space for opkg install anything.
  • If you have a custom Chaos firmware with free space, then get libstdcpp_4.8-linaro-1_ramips_24kec.ipk, and install it.
opkg install libstdcpp_4.8-linaro-1_ramips_24kec.ipk
Custom Chaos Firmware for UDPBD needed
  • Ideally, create a custom firmware using the OpenWRT Image Builder, excluding the samba6-server package, but libstdcpp instead.
  • I am currently unable to build an image, but if possible, create one with fewer unnecessary packages, using ntfs-3g-low instead of ntfs-3g, along with libstdcpp and additional filesystem modules. This should work
make -j4 image PROFILE=A5-V11 PACKAGES=\
  "libstdcpp ntfs-3g-low kmod-usb-storage kmod-usb-storage-extras block-mount kmod-usb-core kmod-usb-ohci -libiwinfo-lua -liblua -libubus-lua -libuci-lua -lua \
   -ip6tables -odhcp6c -kmod-ipv6 -kmod-ip6tables -odhcpd-ipv6only -luci -luci-app-firewall -luci-base -luci-lib-ip \
   -luci-lib-nixio -luci-mod-admin-full -luci-proto-ipv6 \
   -luci-proto-ppp -luci-theme-bootstrap -uhttpd -uhttpd-mod-ubus \
    kmod-fs-ext4 kmod-usb-storage kmod-scsi-core block-mount \
    kmod-lib-crc32c kmod-crypto-crc32c"

Temporary Solution

  • Consider setting up an Extroot or loading files into the /tmp folder.
Solution #1
  1. Get the Chaos libstdcpp_4.8-linaro-1_ramips_24kec.ipk package.
  2. Extract it, then extract data.tar.gz
libstdc++.so.6
libstdc++.so.6.0.19     <- save this one
libstdc++.so.6.0.19-gdb.py
  1. In A5-V11, put libstdc++.so.6.0.19 and udpbd-server.elf in /tmp, then:
ln -s /tmp/libstdc++.so.6.0.19 /usr/lib/libstdc++.so.6
  1. You now will be able to use it
chmod +x udpbd-server.elf
./udpbd-server.elf /dev/sda1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment