May 2009

Building kernels for Lemote Yeeloong

Well… it’ll be a while before I get around to porting Gentoo to the Yeeloong in earnest, however this is the first step.  The following are some notes for those who may wish to go ahead and set up Gentoo.

Toolchain

For both the Yeeloong, and the Loongson 2F-based Fulong, you’ll need the latest gcc (4.4.0) and binutils.  I normally don’t recommend H. J. Lu’s binutils distribution, but in this instance, you need something pretty bleeding edge, this gets you bleeding edge without needing live ebuilds.

I keep patched ebuilds of binutils and kgcc64 in my overlay.  To obtain these, install git, then run git clone git://git.longlandclan.yi.org/overlay.git and add it to your overlays.  The overlay is also browsable here.

Once added, simply merge sys-devel/binutils-2.19.51.0.5 and sys-devel/kgcc64-4.4.0_alpha20090407. These work for me anyway.

Patched Kernel

Zhang Le has done an excellent job in merging the Lemote patches into the Linux/MIPS tree… clone a copy by typing git clone git://www.gentoo-cn.org/var/git/linux-loongson.git. Use make yeeloong_defconfig to make a suitable config, then compile as per the Gentoo/MIPS handbook, using the vmlinux.32 target.

Power Management

There’s one final piece missing… and that’s the ec_module power management drivers. You get those from here. If you’re compiling against a kernel later than 2.6.29, double check that the version you fetch has the patch to correct for the new struct proc_dir_entry, sans owner field. You can get this patch from here if need be… or alternatively,

git clone git://dev.lemote.com/ec_module.git
git pull git://git.longlandclan.yi.org/ec_module.git

This will pull in the aforementioned patch if it isn’t already there.

To build the module, simply change to your kernel source directory, then run make modules modules_install CROSS_COMPILE=mips64el-unknown-linux-gnu- M=/path/to/ec_module.

Once I’m through exams, I’ll probably start looking into merging this into a patchset to place in mips-sources… but for now, there’s a starting point for those who are wondering where to begin.

Circuit simulation

At university, I’m currently studying a subject entitled “RF & Applied Electromagnetics”, and at the moment, we’re looking at the issue of electromagnetic compatibility.

One thing that has come up both here, and browsing through the ARRL Amateur Radio handbook (I have the 1975 edition) is that above all, circuit layout has some of the most profound effects on how a circuit behaves.

What I did not realise, is just how low in frequency these issues show up.  The physical construction of many electronic components often means that, far from being a “pure” component, they in fact exhibit both resistive and reactive components.  I understood this occurred a lot in the VHF and UHF… which is a good reason why many homebrew radios stop in the lower HF.  These effects in fact, start to become visible as low as 14MHz.

This got me thinking… the typical circuit design workflow is some variant of this:

  1. Draw up the schematic in a schematic capture frontend
  2. Feed this into the circuit analysis package, inspect the simulation results.
  3. If unsatisfied, tweak schematic then go back to step 2.  Else feed into PCB layout package.
  4. Lay out the PCB
  5. Get PCB manufactured and build circuit.
  6. Do testing, tweaking component values… maybe go back to step 3.

It seems to me… the workflow should be more like the following:

  1. Draw up the schematic
  2. Lay out the PCB
  3. Feed the PCB layout and circuit schematic into the simulator, inspect results.
  4. If results are unsatisfactory, tweak layout and schematic, else get PCB manufactured and build the circut.
  5. Test & tweak

One criticism I have of gEDA, it seems to treat the schematic and the PCB as being two different things.  I find it awkward to move from gschem to PCB and back again when designing a circuit.  I also haven’t figured out simulation as yet.

I’d say the behaviour of the circuit has more to do with the way the board is layed out, than with just the components alone, and as such, I feel a modern EDA system should reflect this.  Qucs does seem to be approaching what is going on, in that you can simulate a stripline or similar PCB object in your circut.  I think it has possibly the greatest promise, but alas, it can’t yet do PCB layouts itself.  Time will tell I guess.

The commercial suites… well, I’ve used Electronics Workbench for years… I really must say I find the simulation in that much more intuitive than working with SPICE or Qucs… there is perhaps something worth looking into with its interface.  Multisim is more like traditional SPICE… but still retains some of the old feel of EWB.  However, all of them seem to simulate the schematic… which is fine… but you do miss out on a lot of what goes on in the circuit.

I’ve been getting used to Qucs… and so far, I quite like it.  Once again though, we’re looking at a simulation of an ideal circuit, under ideal conditions.  That is… pass a 100MHz sinusoid through a circuit: the resistors remain resistive, the capacitors store charge as they should and the inductors continue to add inertia.  In the real world, many resistors and capacitors become inductive in nature, and inductors look more like capacitors, depending on the physical construction of the component.  Mutual inductance, and capacitive coupling are also problems in the real world.

With today’s modern hardware, I figure the computing overheads to model how a physical circuit would behave based on the layout, is certainly a lot more feasible than it was when SPICE was first conceived.  SPICE was good for its time… but with the modern world requiring a higher level of engineering for its electronics, I think it has had its day now.

Windows users: Having problems? Don’t ask me

Seriously… don’t ask.

Once upon a time, I used to know quite a bit about running a PC with the Windows operating system.  People used to turn to me for assistance in solving technical issues with computers.  This was fine, I was happy with that.  I still am happy to assist in areas where I am knowledgeable.

The Microsoft world today, however, is not a field with which I am comfortable anymore.  The Windows OS has changed to such a degree… and with all the technical issues faced by users of this OS… I have lost all patience with it.  I almost never use it at home or at university unless absolutely necessary.

So long is it since I’ve used the OS, I can no longer recall the layout well enough to guide people without seeing it in front of me… and of course, Microsoft keeps changing the layout at every given opportunity.  Add to this the constantly changing procedures for maintenance… it’s a nightmare to keep track of.

To those around me… if you choose to use this OS… that is fine.  Your personal choice, not mine.  Have a question?  I may be able to give some hints… but you are on your own… I now refuse to spend time trying to fix the issues thrown up by this foreign and arcane environment.  I have wasted much energy, fixing the troubles that in my opinion, should not have occurred in the first place.

I don’t know anything about this OS anymore… I left that community a long time ago.  Just because I have been using a computer for much of my life, does not mean that I am an expert in all fields of computing… and to the Windows users, I repeat… don’t ask, as refusal may offend.