Linux Fu: Miller The Killer Makes CSV No Pest

Historically, one of the nice things about Unix and Linux is that everything is a file, and files are just sequences of characters. Of course, modern practice is that everything is not a file, and there is a proliferation of files with some imposed structure. However, if you’ve ever worked on old systems where your file access was by the block, you’ll appreciate the Unix-like files. Classic tools like awk, sed, and grep work with this idea. Files are just characters. But this sometimes has its problems. That’s the motivation behind a tool called Miller, and I think it deserves more attention because, for certain tasks, it is a lifesaver.

The Problem

Consider trying to process a comma-delimited file, known as a CSV file. There are a lot of variations to this type of file. Here’s one that defines two “columns.” I’ve deliberately used different line formats as a test, but most often, you get one format for the entire file:

Slot,String 
A,"Hello" 
"B",Howdy 
"C","Hello Hackaday" 
"D","""Madam, I'm Adam,"" he said." 
E 100,With some spaces!
X,"With a comma, or two, even"

Continue reading “Linux Fu: Miller The Killer Makes CSV No Pest”

DietPi Releases 8.12 With Support For The Rockchip RK3588 SoC

This month DietPi released version 8.12 of this SBC-oriented Linux distribution. Most notable is the addition of support for the NanoPi R6S and the Radxa ROCK 5B SBCs. The ROCK 5B features the new flagship Rockchip RK3588 SoC with quad Cortex-A76 and quad Cortex-A55. What makes DietPi interesting as an operating system for not just higher end SBCs but also lower-end SBCs compared to options like Debian, Raspberry Pi OS and Armbian is that it has a strong focus on being the most optimized. This translates in a smaller binary size, lower RAM usage and more optimized performance.

The DietPi setup experience is as straightforward as with the aforementioned options, except that right from the bat you get provided with many more options to tweak. While the out of the box experience and hitting okay on the provided defaults is likely to be already more than satisfactory for most users – with something like the optional graphical interface easy to add – enterprising users can tweak details about the hardware, the filesystem and more.

When we set up DietPi on a Raspberry Pi Zero, it definitely feels like a much more light-weight experience than the current Debian Bullseye-based Raspberry Pi OS. Even though DietPi is also based on Debian, it leaves a lot more RAM and storage space free, which is a definite boon when running on a limited platform like a Raspberry Pi Zero. Whether it’s polite to state in public or not, DietPi definitely rubs in that many standard SBC images are rather pudgy these days.

CoreFreq Gives Peek At CPU Performance Info On Linux

The CPU is the part of the computer that makes everything else tick. While GPUs have increasingly become a key part of overall system performance, we still find ourselves wanting to know how our CPU is doing. CoreFreq is a Linux tool that aims to tell you everything you want to know about your modern 64-bit CPU.

The tool relies on a kernel module, and is coded primarily in C, with some assembly code used to measure performance as accurately as possible. It’s capable of reporting everything from core frequencies to details on hyper-threading and turbo boost operation. Other performance reports include information on instructions per cycle or instructions per second, and of course, all the thermal monitoring data you could ask for. It all runs in the terminal, which helps keep overheads low.

The hardcore among us can build it from source, available on GitHub, though it’s reportedly available in package form, and as a live CD, too. We could imagine data captured from CoreFreq could be used for some fun performance visualizations, too. If you’ve been whipping up your own nifty command-line tools, be sure to drop us a line!

Chumby Gets New Kernel… Soon

If you missed the Chumby, we’re sorry.  They were relatively inexpensive Linux appliances that acted as a clock, Internet radio, and feed reader. The company went belly up, although there was some functionality remaining thanks to one of the founders and now, for a subscription fee, you can still keep your Chumby operating. However, [Doug Brown] bought one with the goal of using it for his own applications. But the 2.6.28 kernel is showing its age. So he decided to push a new kernel on the device.

If you are a Chumby enthusiast, don’t get too excited. The goal isn’t to provide the existing Chumby apps with a new kernel, [Doug] says that’s probably impossible. Instead, he wants a modern booting infrastructure and kernel on the device for his own software.

Continue reading “Chumby Gets New Kernel… Soon”

Getting Root On A Chinese IP Camera

With so many cheap network-connected devices out there being Linux-powered, it’s very tempting to try and hack into them, usually via a serial interface. This was the goal of [Andrzej Szombierski] when he purchased a cheap Chinese IP camera using an XM530 ARM-based SoC to explore and ultimately get root access on. This camera’s firmware provides the usual web interface on its network side, but it also has a UART on its PCB, courtesy of the unpopulated four-pin header.

Merely firing up a serial terminal application and connecting to this UART is not enough to get access, of course. The first obstacle that [Andrzej] struggled with was that U-Boot was configured to not output Linux kernel boot messages. After tackling that issue with some creative hacking, the next challenge was to figure out the root password, using a dump of the firmware image, which led to even more exploration of the firmware and the encoding used for the root password.

Even if some part of these challenges were possibly more accidental than on purpose by the manufacturer, it shows how these SoC-based Linux devices can put up quite a fight. This then leaves the next question, of what to do with such an IP camera after you have gained root access?

A Tiny RISC-V Emulator Runs Linux With No MMU. And Yes, It Runs DOOM!

It’s something of an article of faith, that to run Linux your computer must include a hardware memory management unit, or MMU. To an extent it’s true, in that for a Linux-based system to shine it must have that hardware, but in fact there has been support for MMU-less Linux for many years now. Prolific hacker [cnlohr] has created an emulated simple RISCV processor without an MMU, and not only does it run Linux, it also runs DOOM.

The videos below the break go into significant depth on writing and debugging an emulator not to mention the inner workings of DOOM, but fear not if it’s not your thing. Everything can be found in a GitHub repository, and there are straightforward instructions should you wish to try it yourself.

All this is entertaining stuff, but it becomes of much more interest when viewed as part of an ongoing chain of projects working on no-MMU Linux for low-end RISC-V microcontrollers. Imagine the prospect of running Linux on a CPU costing relative pennies, and you can see why that’s an interesting prospect. Even if it’s not the most unexpected way to run Linux without an MMU.

Continue reading “A Tiny RISC-V Emulator Runs Linux With No MMU. And Yes, It Runs DOOM!”

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.