iPhone 6 with Linux boot log on its screen

Boot Mainline Linux On Apple A7, A8 And A8X Devices

[Konrad Dybcio] tells about his journey booting Linux on A7/8/8X processors, playing around with an old iPhone 5 he’s got in a drawer. It’s been a two-year “revisit every now and then” journey, motivationally fueled by the things like Linux on M1 Macs announcement. In the end, what we have here is a way to boot mainline Linux on a few less-than-modern but still very usable iPhones, and a fun story about getting there.

[Konrad]’s work is based on the Sandcastle project research, but he couldn’t quite figure out how to make their code work, and had to make sense of it as he went. At some point, he got stuck on enabling the MMU, which was the main roadblock for a while. Joined by another developer intrigued by Apple hardware, they were hacking away at it, developing tools and neat tricks on their way, but to no avail. With the framebuffer accessible and no other decent debugging methods in sight, he tells about a code snippet they wrote that printed register values as valid barcodes Continue reading “Boot Mainline Linux On Apple A7, A8 And A8X Devices”

A Linux Distribution For DOOM

If you’ve gone further into the Linux world than the standard desktop distributions like Ubuntu or Fedora, you have undoubtedly come across some more purpose-built distributions. Some examples are Kali for security testing, DragonOS for software-defined radio, or Hannah Montana Linux for certain music fans. Anyone can roll their own Linux distribution with the right tools, including [Shadly], who recently created one which only loads enough software to launch the 1993 classic DOOM.

The distribution is as simple as possible and loads no bloat other than what’s needed to launch the game. It loads the Linux kernel and the standard utilities via BusyBox, then runs fbDOOM, which is a port of the game specifically designed to run on the Linux framebuffer with minimal dependencies. After most of that, the only thing left is to use GRUB to boot the distribution, and in just a moment, Doomguy can start slaying demons. The entire distribution is placed into a bootable ISO file that can be placed on any bootable drive.

As far as DOOM hacks go, we’re used to seeing the game running on hardware it was never intended for like the NES  or on an office phone. This one, on the other hand, gives us a little more insight into just how little is needed for a full-fledged Linux distribution, as long as what you need to do is relatively straightforward.

Continue reading “A Linux Distribution For DOOM

The SoM on an evaluation board, with two LEDs shining, one USB-C cable connected for power and another plugged into the OTG port

New Part Day: X1501 Makes For A Tiny And Open Linux SoM

Ever wanted to run Linux in an exceptionally small footprint? Then [Reimu NotMoe] from [SudoMaker] has something for you! She’s found an unbelievably small Linux-able chip in BGA, and designed a self-contained tiny SoM (System on Module) breakout with power management and castellated pads. This breakout contains everything you need to have Linux in a 16x16x2mm footprint. For the reference, a 16mm square is the size of the CPU on a Raspberry Pi.

This board isn’t just tiny, it’s also well-thought-out, helping you put the BGA-packaged Ingenic X1501 anywhere with minimal effort. With castellated pads, it’s easy to hand-solder this SoM for development and reflow for production. An onboard switching regulator works from 6V down to as low as 3V, making this a viable battery-powered Linux option. It can even give you up to 3.3V/1A for all your external devices.

The coolest part yet – the X1501 is surprisingly friendly and NDA-free. The datasheets are up for grabs, there are no “CONFIDENTIAL” watermarks – you get a proper 730-page PDF. Thanks to this openness, the X1501 can run mainline Linux with minimal changes, with most of the peripherals already supported. Plus, there’s Efuse-based Secure Boot if your software needs to be protected from cloning.

More after the break…

Continue reading “New Part Day: X1501 Makes For A Tiny And Open Linux SoM”

Optimizing Linux Pipes

In CPU design, there is Ahmdal’s law. Simply put, it means that if some process is contributing to 10% of your execution, optimizing it can’t improve things by more than 10%. Common sense, really, but it illustrates the importance of knowing how fast or slow various parts of your system are. So how fast are Linux pipes? That’s a good question and one that [Mazzo] sets out to answer.

The inspiration was a highly-optimized fizzbuzz program that clocked in at over 36GB/s on his laptop. Is that a common speed? Nope. A simple program using pipes on the same machine turned in not quite 4 GB/s. What accounts for the difference?

Continue reading “Optimizing Linux Pipes”

Linux Fu: Easy Widgets

Here’s a scenario. You have a microcontroller that reads a number of items — temperatures, pressures, whatever — and you want to have a display for your Linux desktop that sits on the panel and shows you the status. If you click on it, you get expanded status and can even issue some commands. Most desktops support the notion of widgets, but developing them is a real pain, right? And even if you develop one for KDE, what about the people using Gnome?

Turns out there is an easy answer and it was apparently inspired by, of all things, a tool from the Mac world. That tool was called BitBar (now XBar). That program places a widget on your menu bar that can display anything you want. You can write any kind of program you like — shell script, C, whatever. The output printed from the program controls what appears on the widget using a simple markup-like language.

That’s fine for the Mac, but what about Linux? If you use Gnome, there is a very similar project called Argos. It is largely compatible with XBar, although there are a few things that it adds that are specific to it. If you use KDE (like I do) then you’ll want Kargos, which is more or less a port of Argos and adds a few things of its own.

Good News, Bad News

The good news is that, in theory, you could write a script that would run under all three systems. The bad news is that each has its own differences and quirks. Obviously, too, if you use a complied program that could pose a problem on the Mac unless you recompile.

Continue reading “Linux Fu: Easy Widgets”

Annotate PDFs On Linux With PDFrankenstein

On Windows and Mac machines, it’s not too troublesome to add text or drawings (such as signatures) to PDF files, but [Mansour Behabadi] found that on Linux machines, there didn’t seem to be a satisfying way or a simple tool. Being an enterprising hacker, [Mansour] set out to fill that gap, and the way it works under the hood is delightfully hacky, indeed.

The main thing standing in the way of creating such a tool is that the PDF format is a complex and twisty thing. Making a general-purpose PDF editing tool capable of inserting hyperlinks, notes, images, or drawings isn’t exactly a weekend project. But [Mansour] didn’t let that stop him; he leveraged the fact that tools already exist on Linux that can read and create PDF files, and tied them all together into what was at one point “a horrific patchwork of tools” which inspired the name pdfrankenstein.

The tool is a GUI that uses Inkscape and qpdf to convert a PDF page to an SVG file, set it as a locked background, then let the user add any annotations they desire, using Inkscape as the editor. After changes are made, the program removes the background, overlays the annotations back onto the originals, and exports a final file. Annotations can therefore be anything that can be done in Inkscape.

Curious about these and other tools for handling PDFs? We’ve shared some programs and tricks when we previously covered dealing with the PDF format in Linux.

Linux And C In The Browser

There was a time when trying to learn to write low-level driver or kernel code was hard. You really needed two machines: one to work with, and one to screw up over and over again until you got it right. These days you can just spin up a virtual machine and roll it back every time you totally screw up. Much easier! We don’t think it is all that practical, but [nsommer] has an interesting post about loading up a C compiler and compiling Linux for a virtual machine. What’s different? Oh, the virtual machine is in your browser.

The v86 CPU emulator runs in the browser and looks like a Pentium III computer with the usual hardware. You might think it is slow and it certainly isn’t going to be fast as a rocket, but it does translate machine code into WebAssembly, so performance isn’t as bad as you might think.

The post goes into detail about how to build and create a simple machine web page that hosts v86. Once you cross-compile the kernel you can boot the machine up virtually. The other interesting part is the addition of tcc which is a pretty capable C compiler and much smaller and faster than the very traditional gcc.

The tcc build is tricky because the normal build process compiles the compiler and then uses the same compiler to build the default libraries. When cross-compiling, this doesn’t work well because the library you want for the host compile is different from the library you want to target for the second pass. You’ll see how to work around that in the post. The post continues to show how to do remote debugging and even gets QEMU into the mix. Debugging inside v86 doesn’t seem to work so far. There are more posts on this topic promised.

Honestly, this is one of those things like teaching a chicken to play checkers. It can be done, there’s little practical value, but it is still something to see. On the other hand, if you spend the weekend working through this, your next Linux porting project ought to seem easy by comparison.

Amazing what you can pull off with WebAssembly. If you need a quick introduction, check this one out from [Ben James].