debian on linksys ea3500

after upgrading to a gpon isp, i had to replace my router with one that could actually route more than 250mbps. my ea3500 wasnt able to cut it, cpu usage would max out and the device would get hot while speedtesting. so i upgraded to a wrt1200ac, which handles gigabit over wired like a champ. not sure about wireless, because i dont have any 802.11ac devices that can go that fast anyway.

but now i had my old ea3500 laying around not doing anything. i found http://www.wolfteck.com/2014/03/01/installing-candyhouse-debian/ where someone got debian running on the ea4500, which is similar hardware. but he was experimenting with it before openwrt support came, and the latest update has a 3.16.x kernel. quite old at this point, and not guaranteed to work on the ea3500, so i kept googling. eventually i stumbled upon https://forum.doozan.com/read.php?2,12096 and https://forum.doozan.com/read.php?2,26854, more recent projects to run debian on the ea4500 and other kirkwood devices, with a lot more detail of what was going on. with that, i managed to get debian to work. and it works about as well as i expected for the anemic hardware.

basically, all you need to do is grab the rootfs from the "Linux Kernel 5.8.3 Kirkwood package and Debian rootfs" thread, and make a uImage with image-kirkwood-ea3500.dtb as your dtb, then get uboot to actually boot it. i forgot where the dtb came from, but i think i copied it from an openwrt build dir

after that, just connect to the routers serial port (openwrt toh), interrupt u-boot, and run the below commands to boot from the debian install on usb

setenv bootargs_usb 'console=ttyS0,115200 root=/dev/sda1 rootdelay=10 earlyprintk=serial'
setenv load_usb 'usb start; ext2load usb 0:1 0x800000 /boot/uImage; ext2load usb 0:1  0x2100000 /boot/uInitrd'
setenv bootcmd_usb 'setenv bootargs $(bootargs_usb); run load_usb; bootm 0x800000 0x2100000'
setenv bootcmd 'run bootcmd_usb'
boot

to make those settings permanent and autoboot from usb, talk to someone more knowledgeable than me, i couldnt quite figure it out, but i came up with a crazy solution. if you run saveenv before boot, itll save those variables, but will still boot normally. if you interrupt uboot after that and run boot, itll do what we want. my solution was hooking up an arduino to the serial port, having it listen for a string from the bootloader, and then sending some keypresses to interrupt, and then boot for me.

pic of hax

i had some issues with timing it right though, so i kinda went the bruteforce route with some ugly and slow code, but it works. crappy code and compiled hex for 16mhz pro mini clone

also, the first thing you want to do once you log in is make a swapfile. apt-get will get oom-killed if you dont. and dont expect much performance, its an 800mhz armv5 with 64mb ram. if youre adventurous though, you can try https://eshaz.github.io/electronics/2020/05/18/overclocking-linksys-ea-series.html