Full-Blown Cross-Assembler…in A Bash Script

Have you ever dreamed of making a bash script that assembles Intel 8080 machine code? [Chris Smith] did exactly that when he created xa.sh, a cross-assembler written entirely in Bourne shell script.

Assembly language (like the above) goes in, a binary comes out.

The script exists in part as a celebration of the power inherent in a standard Unix shell with quite ordinary POSIX-compliant command line tools like awk, sed, and printf. But [Chris] admits that mostly he found the whole project amusing.

It’s designed in a way that adding support for 6502 and 6809 machine code would be easy, assuming 8080 support isn’t already funny enough on its own.

It’s not particularly efficient and it’s got some quirks, most of which involve syntax handling (hexadecimal notation should stick to 0 or 0x prefixes instead of $ to avoid shell misinterpretations) but it works.

Want to give it a try? It’s a shell script, so pull a copy and and just make it executable. As long as the usual command-line tools exist (meaning your system is from sometime in the last thirty-odd years), it should run just fine as-is.

An ambitious bash script like this one recalls how our own Al Williams shared ways to make better bash scripts by treating it just a bit more like the full-blown programming language it qualifies as.

KDE Binds Itself Tightly To Systemd, Drops Support For Non-Systemd Systems

The KDE desktop’s new login manager (PLM) in the upcoming Plasma 6.6 will mark the first time that KDE requires that the underlying OS uses systemd, if one wishes for the full KDE experience. This has especially the FreeBSD community upset, but will also affect Linux distros that do not use systemd. The focus of the KDE team is clear, as stated in the referenced Reddit thread, where a KDE developer replies that the goal is to rely on systemd for more tasks in the future. This means that PLM is just the first step.

In the eyes of KDE it seems that OSes that do not use systemd are ‘niche’ and not worth supporting, with said niche Linux distros that would be cut out including everything from Gentoo to Alpine Linux and Slackware. Regardless of your stance on systemd’s merits or lack thereof, it would seem to be quite drastic for one of the major desktop environments across Linux and BSD to suddenly make this decision.

It also raises the question of in how far this is related to the push towards a distroless and similarly more integrated, singular version of Linux as an operating system. Although there are still many other DEs that will happily run for the foreseeable future on your flavor of GNU/Linux or BSD – regardless of whether you’re more about about a System V or OpenRC init-style environment – this might be one of the most controversial divides since systemd was first introduced.

Top image: KDE Plasma 6.4.5. (Credit: Michio.kawaii, Wikimedia)

CPU Scheduler Divines The Will Of The Heavens

Horoscopes are a great way to pass a boring lunchbreak, and an excellent excuse for ending a ill-considered relationship. They’re also a hilarious way to handle CPU scheduling under Linux, thanks to the work of [Lucas Zampieri].

The project is called scx_horoscope, and it’s a sched_Ext scheduler that makes its CPU scheduling choices based on what the heavens are doing in real time. Different tasks are handled based on different astronomical objects. For example, the Sun represents life force, and thus grants boons to key system processes. The Moon, an emotive influence, rules over interactive processes like shells and terminals. Mercury, as the god of communication, handles network and IO tasks, and so it goes from there. It’s not just a surface level thing, either—[Lucas] has implemented the influences of the elements of fire, air, earth, and water, and there are negative timeslice penalties on associated tasks when a given planet lands in retrograde.

You can argue whether or not the broader motions of the heavens have any impact on our lives based on the time and circumstances of our birth. But you can’t argue that scx_horoscope really will influence how your computer runs based on the dance of the planets in the sky. Mostly, though, we concern ourselves with astronomy rather than astrology around these parts!

[Thanks to Benjamin for the tip!]

Swissbit 2GB PC2-5300U-555

Surviving The RAM Price Squeeze With Linux In-Kernel Memory Compression

You’ve probably heard — we’re currently experiencing very high RAM prices due mostly to increased demand from AI data centers.

RAM prices gone up four times

If you’ve been priced out of new RAM you are going to want to get as much value out of the RAM you already have as possible, and that’s where today’s hack comes in: if you’re on a Debian system read about ZRam for how to install and configure zram-tools to enable and manage the Linux kernel facilities that enable compressed RAM by integrating with the swap-enabled virtual memory system. We’ve seen it done with the Raspberry Pi, and the concept is the same.

Ubuntu users should check out systemd-zram-generator instead, and be aware that zram might already be installed and configured by default on your Ubuntu Desktop system.

If you’re interested in the history of in-kernel memory compression LWN.net has an old article covering the technology as it was gestating back in 2013: In-kernel Memory Compression. For those trying to get a grip on what has happened with RAM prices in recent history, a good place to track memory prices is memory.net and if you swing by you can see that a lot of RAM has gone up as much as four times in the last three or four months.

If you have any tips or hacks for memory compression on other platforms we would love to hear from you in the comments section!

Block Devices In User Space

Your new project really could use a block device for Linux. File systems are easy to do with FUSE, but that’s sometimes too high-level. But a block driver can be tough to write and debug, especially since bugs in the kernel’s space can be catastrophic. [Jiri Pospisil] suggests Ublk, a framework for writing block devices in user space. This works using the io_uring facility in recent kernels.

This opens the block device field up. You can use any language you want (we’ve seen FUSE used with some very strange languages). You can use libraries that would not work in the kernel. Debugging is simple, and crashing is a minor inconvenience.

Another advantage? Your driver won’t depend on the kernel code. There is a kernel driver, of course, named ublk_drv, but that’s not your code. That’s what your code talks to.

Continue reading “Block Devices In User Space”

The Windows Interface You Didn’t Like, For Linux

If you were asked to pick the most annoying of the various Microsoft Windows interfaces that have appeared over the years, there’s a reasonable chance that Windows 8’s Metro start screen and interface design language would make it your choice. In 2012 the software company abandoned their tried-and-tested desktop whose roots extended back to Windows 95 in favor of the colorful blocks it had created for its line of music players and mobile phones.

Consumers weren’t impressed and it was quickly shelved in subsequent versions, but should you wish to revisit Metro you can now get the experience on Linux. [er-bharat] has created Win8DE, a shell for Wayland window managers that brings the Metro interface — or something very like it — to the open source operating system.

We have to admire his chutzpah in bringing the most Microsoft of things to Linux, and for doing so with such a universally despised interface. But once the jibes about Windows 8 have stopped, we can oddly see a point here. The trouble with Metro was that it wasn’t a bad interface for a computer at all, in fact it was a truly great one. Unfortunately the computers it was and is great for are handheld and touchscreen devices where its large and easy to click blocks are an asset. Microsoft’s mistake was to assume that also made it great for a desktop machine, where it was anything but.

We can see that this desktop environment for Linux could really come into its own where the original did, such as for tablets or other touch interfaces. Sadly we expect the Windows 8 connection to kill it before it has a chance to catch on. Perhaps someone will install it on a machine with the Linux version of .net installed, and make a better Windows 8 than Windows 8 itself.

The Distroless Linux Future May Be Coming

Over the decades the number of Linux distributions has effectively exploded, from a handful in the late ’90s to quite literally hundreds today, not counting minor variations. There lately seems to be a counter-movement brewing in response to this fragmentation, with Project Bluefin’s Distroless project being the latest addition here. Also notable are KDE’s efforts, with KDE Linux as its own top-down KDE-based distro, but now with a switch to BuildStream from Arch likely as a distroless move.

It should be clear that there is no obvious course here yet, and that opinions are very much divided. The idea of ‘Linux’ becoming a more singular OS appeals to some, while to others it’s the antithesis of what ‘Linux’ is about. This much becomes clear in [Brodie Robertson]’s exploration of this topic as well.

The way to think about ‘distroless’ is that there is a common base using the Freedesktop SDK on which the customization layer is applied, such as Bluefin, KDE or Gnome’s environments. You could think of this base as the common runtime, using the Freedesktop standards for interoperability for a user-selected layer that’s installed on top. This way the idea of basing a distro on a specific distro is tossed out in favor of something that’s vaguely reminiscent of the Linux Standard Base attempt at standardization.

Continue reading “The Distroless Linux Future May Be Coming”