Showing the scope screen and the BeagleBone setup side by side, with GPIO input and output traces shown on the scope screen.

How Realtime Is Your Kernel? Scope A GPIO To Find Out

When debugging something as involved as kernel scheduler timings, you would typically use one of the software-based debugging mechanisms available. However, in cases when software is close to bare metal, you don’t always need to do that. Instead, you can output a signal to a GPIO, and then use a logic analyzer or a scope to measure signal change timing – which is what [Albert David] did when evaluating Linux kernel’s PREEMPT_RT realtime operation patches.

When you reach for a realtime kernel, latency is what you care about – realtime means that for everything you do, you need to get a response within a certain (hopefully very short) interval. [Albert] wrote a program that reads a changing GPIO input and immediately writes the new state back, and scoped both of the signals to figure out the latency of of the real-time patched kernel as it processes the writes. Overlaying all the incoming and outgoing signals on the same scope screen, you can quickly determine just how suitable a scheduler is when it comes to getting an acceptable response times, and [Albert] also provides a ready-to-go BeagleBone image you can use for your own experiments, or say, in an educational environment.

What could you use this for? A lot of hobbyists use realtime kernels on Linux when building CNC machine controllers and robots, where things like motor control put tight constraints on how quickly a decision in your software is translated into real-world consequences, and if this sounds up your valley, check out this Linux real-time task tutorial from [Andreas]. If things get way too intense for a multi-tasking system like Linux, you might want to use a RTOS to begin with, and we have a guide on that for you, too.

A Single Board Computer From A TV

It is an annoyance for some members of our community, that it has become almost impossible to buy a TV that’s not a so-called “smart” TV. These units contain a computer as well as the display, and it boots into a locked-down OS with a user interface and a load of streaming apps. Can anything be done with them other than what their manufacturers intended? [Nina Kalinina] has managed it, taking the mainboard from a discarded LCD TV and liberating the ARM Linux board within.

On the board are all the inputs you’d expect from a TV, along with Ethernet, and a couple of extra USB ports hidden in the WiFi interface. There’s a UART available on the SCART connector, and accessing the U-boot menu is achieved by the unusual means of sending a character to the infrared port using a Palm Pilot. Surprisingly the device tree in the Flash was editable, so with the Linux OS accessed, the board was revealed as having a dual-core Novatek SoC.

This is reminiscent of the days when the new hotness was dragging a Linux box out of a home router, and just as those were quickly eclipsed by inexpensive boards such as the Raspberry Pi, so might these TV boards meet the same fate. If, however, they can be made to drive a screen with something more useful than the TV interface then that might change, as who wouldn’t want to make an old smart TV a bit more useful?

Linux Fu: Easy VMs

It wasn’t long ago that we looked at easily creating Docker containers from the command line so you could just easily spin up a virtual environment for development. Wouldn’t it be nice if you could do the same for virtual machines? You can. Using Multipass from Canonical, the makers of Ubuntu, you can easily spin up virtual machines under Linux, Mac, or Windows. Granted, most of the virtual machines in question are variations of Ubuntu, but there are some additional images available, and you can create your own.

Once you have it installed, starting up a new Ubuntu instance is trivial. If you have a set configuration, you can even set up predefined setups using a YAML file.

Continue reading “Linux Fu: Easy VMs”

Cat9 And LASH Want To Change Your Linux Command Line

It is no secret that to be a true Linux power user you have to deal with the command line. Many people actually prefer to use the command line. However, the shell — the program that provides that command line — is mired in a back history which means it has to work with existing things no matter how modern it tries to be. However, a new set of projects wants to replace most of your user interface stack starting with the shell. At the top of that stack is Cat9 which is technically a shell, but not in the way you probably imagine a shell.

A traditional shell lets you run programs one at a time, feed them input, and observe their output. Sure, you can stash the output away for later use. You can run programs in the background or in parallel, but that requires special attention. In Cat9, everything is asynchronous and results stay around until you deliberately drop them. It is trivial to grab data from a previous command or, for example, to switch to a directory that was in use by an earlier task.

Continue reading “Cat9 And LASH Want To Change Your Linux Command Line”

If Only The Kids Knew About Pipes

Being a parent is hard work. You need to prepare your child to operate in the world. Reading, writing, arithmetic, and how to make good choices are just the beginning. They also ought to know regular expressions and Unix pipes. [Jackdoe] can help with that last one, thanks to their Unix pipe card game.

As an example, the task “print the most common line from a file” would require the answer:

cat 03.txt | sort | uniq -c | sort -n | tail -1

You can vary the rules to declare whoever has the smallest pipe or the largest pipe that accomplishes the task as the winner. We’d add a house rule that whoever has the fastest pipe ought to get something. We don’t, however, think this card game will make the Vegas tables, unfortunately.

You can print your own card deck and even the box. Or you can buy a nice set, if you don’t want to spend the time. You should probably know about cat, grep, tail, head, wc, sort, and uniq along with their options.

If you want some other esoteric kids’ learning activities, they also have “Programming Time” which teaches algorithms and Python, and “4917” to teach the basics of machine code.

If you want help with the other key skill — regular expressions — check out regexp golf or crosswords.

Linux Fu: Atomic Power

People are well aware of the power of virtual machines. If you want to do something dangerous — say, hack on the kernel — you can create a virtual machine, snapshot it, screw it up a few times, restore it, and your main computer never misses a beat. But sometimes you need just a little shift in perspective, not an entire make belive computer. For example, you are building a new boot disk and you want to pretend it is the real boot disk and make some updates. For that there is chroot, a Linux command that lets you temporarily open processes that think the root of the filesystem is in a different place than the real root. The problem is, it is hard to manage a bunch of chroot environments which is why they created Atoms.

The system works with several common distributions and you install it via Flatpak. That means you can launch, for example, a shell that thinks it is running Gentoo or Centos Linux under Ubuntu.

Continue reading “Linux Fu: Atomic Power”

Linux Fu: Eavesdropping On Serial

In the old days, if you wanted to snoop on a piece of serial gear, you probably had a serial monitor or, perhaps, an attachment for your scope or logic analyzer. Today, you can get cheap logic analyzers that can do the job, but what if you want a software-only solution? Recently, I needed to do a little debugging on a USB serial port and, of course, there isn’t really anywhere to easily tie in a monitor or a logic analyzer. So I started looking for an alternate solution.

If you recall, in a previous Linux Fu we talked about pseudoterminals which look like serial ports but actually talk to a piece of software. That might make you think: why not put a piece of monitor software between the serial port and a pty? Why not, indeed? That’s such a good idea that it has already been done. When it works, it works well. The only issue is, of course, that it doesn’t always work.

Continue reading “Linux Fu: Eavesdropping On Serial”