Help building buildroot for TI AR7 based SoC - Page 1
Forum section: electronics / general

author: AGuyNamedBilly
author_rank: Newbie
timestamp: June 11, 2020, 06:07:49 am
content: I'm very new to embedded development, but I decided to see how much could I play around with an old router I bought from Goodwill. This router in particular is a Starbridge Networks Lynx 210, running a TNETD7300 SoC with 8 MB of RAM and 2 MB of flash. It's running a linux based firmware with a really old version of BusyBox (which I can't recall the version of). I manged to dump the contents of the flash via tftp (I don't have a JTAG yet) and after decompressing one of the SquashFS filesystemsI got to see the binaries of all of the executables in my computer. I used binwalk in some of them, and I got the following output in all of themCode:0 0x0 ELF, 32-bit LSB MIPS-I executable, MIPS, version 1 (SYSV)...I tried building an old version of buildroot just to get a toolchain with MIPS I support working, and while it did work, I could managed to run any of the executables I compiled with it on the router. So my question is, what would be steps that someone should take to build a custom firmware for a board that pretty much has no support from any other project I found out there (to my knowledge at least)?. When I tried building buildroot for it I was stopped by the U-BOOT target part, since I didn't know what to base a new config of for the board. Any ideas about how I should go about getting a custom firmware running on this guy?By the way, if I said something that makes no sense in this post, or if I didn't articulate my question correctly, my apologies. I have worked with platforms like MBED-OS in the past, I have no experience whatsoever when it comes to building Linux for embedded platforms.PS: I made a hackaday post about this little pet project of mine, so please feel free to give it a look if you'd like, I added a lot more details there than I could on a single post:https://hackaday.io/project/172289-playing-with-the-starbridge-lynx-210

author: Nominal Animal
author_rank: Super Contributor
timestamp: June 11, 2020, 07:06:24 pm
content: You're on the same exploratory path I would take, if I were you, so I'm not sure I can provide any real help.However, knowing that it is a TI AR7RD with ADAM2 bootloader, tells us there could be many similar devices supported in the past by DD-WRT or OpenWRT. Have you looked at theLinux-MIPS page on TI AR7? Apparently AR7 support was mainlined to the Linux kernel in 2.6.31, which indicate your SoC may be better supported than one might guess – at least in some kernel versions; perhaps pick a long-term maintained kernel soon after that?Buffalo WBMR-G54was supported by OpenWRT at some point (12.09 Attitude Adjustment). It has the same SOC, Adam2 bootloader, and even the same serial port settings 8N1/38400; and that OpenWRT page shows almost the same version (0.22.02_b04) you have (0.22.03). To me, this indicates the buildroot for ar7 in OpenWRT 12.09 Attitude Adjustment, and particularly the configuration for Buffalo WBMR-G54, should be useful.Yours is very limited in RAM – half that of the Buffalo WBMR-G54 – so I am not suggesting to run that version of OpenWRT, but that perhaps investigating the OpenWRT 12.09 port for WBMR-G54 helps you build a buildroot (cross-compiling environment) for yours to at least run a kernel and a minimal userspace; perhaps even with support for the networking interfaces on it. I didn't check, just hoping.(I personally am just about to rebuild my OpenWRT build environment. I used a modified OpenWRT HEAD with a custom transparent bridging enabled on an Asus RT-AC51U, then when 19.07 came available switched to that. But it turns out the custom bridging was much, much better. Basically, the switch itself is invisible except when connecting via a dedicated "management" LAN port on it; so very little to worry about hacking-wise.)

author: AGuyNamedBilly
author_rank: Newbie
timestamp: June 12, 2020, 02:03:21 am
content: Thanks a lot for the help! I just downloaded the ImageBuilder for the AR7 for OpenWrt, but I seem to be unable to build it. I'll try using an older version of Ubuntu, but do you think there's a way to get the target and configuration files for the ImageBuilder and use it with Buildroot? I tried doing just that, but I can't seem to get the target config for the ar7 loaded into a buildroot release from 2012 (which I can't really find the link of right now, I might provide one once I get back home)

author: Nominal Animal
author_rank: Super Contributor
timestamp: June 12, 2020, 01:21:58 pm
content: Quote from: AGuyNamedBilly on June 12, 2020, 02:03:21 amAIUI, OpenWRT uses buildroot itself, but I've built all my OpenWRT images from the sources directly (here, not via ImageBuilder), and embedded systems either on top of Debian/CentOS or from scratch usinglinuxfromscratch. I don't think I've ever used Buildroot the environment outside OpenWRT.(I didn't even know thattoolchains.bootlin.comhas cross-compiling toolchains for mips32 for 4.4.215/4.19.107!)I do recommend using a 32-bit virtual machine, as the OpenWRT 12.09 ar7 is targeted for 486 (and above, but 32-bit Intel/AMD only), and both x86 and mips32 are ILP32 architectures; minimize the number of possible surprises..Let's see... Okay,this Makefileshows how to make Adam2 boot a prepared kernel and ramdisk; seedefine Image/Build/EVA. Initial kernel 3.3 config ishere, but you'll want to prune that to a minimum, and build in whatever minimal set of drivers you need. There's also a few patches nearby you'll want to take a look at, whichever kernel you decide to go with. It looks like the ar7/Adam2 might use a partition scheme called "Titan", check that out too.

author: AGuyNamedBilly
author_rank: Newbie
timestamp: June 12, 2020, 02:29:25 pm
content: Okay, first off,toolchains.bootlin.com, you're my hero. I don't know if I'll get to use it in this project in particular but man will that save me a lot of time for other stuff in the future, so thanks a lot.Also, I can't believe I didn't find that repo when I was looking for it yesterday, I was puzzled byhttps://dev.archive.openwrt.org/wiki/GetSourceand other pages and found it weird that the main repo didn't have older versions than 17.I'll see if I can get a build running latter today, I don't know exactly which drivers to exclude (I've never done that before as you may already noticed) but In figure there's no harm in trying to shrink the image down as much as possible. I might also just go for (what I think is) the other bootloader "Eva", I mean, if adam2 is commented out it might be for a reason.By the way, I always found embedded lfs to be very interesting, I did build it for fun a few years ago, but I only did it on a x86 machine. Would you recommend I play around with linux from scracth instead of Openwrt? And of course, thanks a lot for all the help, I appreciate it.

author: Nominal Animal
author_rank: Super Contributor
timestamp: June 12, 2020, 03:11:37 pm
content: Quote from: AGuyNamedBilly on June 12, 2020, 02:29:25 pmI think they are related – I suspect, but am not sure, that Eva == Adam2. If not, do please correct me here!Quote from: AGuyNamedBilly on June 12, 2020, 02:29:25 pmLFS teaches one how everything in Linux distributions can be built from the sources on up, how you integrate all the parts into a workable whole, and so on.OpenWRT is a development effort to get a dedicated Linux distribution to run on quite restricted embedded devices. Its focus is at one hand to prune unneeded things so that the system can work with just a handful of megabytes of memory at a time when gigabytes are the standard on laptops and desktops, and at the other, to keep it robust enough to use as an appliance, without constant user interaction and maintenance.So, I think they're orthogonal. One goes into the details of compiling software and dealing with the issues there and software integration into a working system in general; the other is about integration into an embedded appliance (routers, specifically). I would not exclude either one, as I've learned a LOT from both, but since you have a router at hand to play with, I suggest you go with Buildroot/OpenWRT, and/if you find you're dealing with issues about compiling existing packages, backporting patches and such, then go do LFS to get better at it.

author: AGuyNamedBilly
author_rank: Newbie
timestamp: June 13, 2020, 08:19:57 pm
content: QuoteI beleive they are, they must be compatible if nothing else. It'd make sense if the OpenWrt guys had to make their own tho, given that Adam is not open source. I'll look into it and I'll make sure to let you know.QuoteGot it, I'll start playing around it buildroot this weekend (I finally got a Bus Pirate so I can use JTAG with it, and I've been trying to get it working ever since it arrived). By the way, I'll be making a separate thread about this, but is it normal to get like 0.015 Kb/s when dumping the flash of a router over JTAG?