LLMs and xfwl4

I was planning to write a little about my usage of LLMs while building xfwl4 as a small section of a larger blog post, but I decided I’d rather get it out of the way on its own.

While LLM usage can be polarizing in the context of open source, I don’t really see it that way. It’s a tool, like any other. It has good parts and bad parts. On the bad parts, there are three things that stick out for me:

Among other sources, LLMs were trained on publicly-available data, without the permission of any of the rightsholders of that data. That especially smarts since I have a lot of open source code out there, much of it licensed under the GPL. Is training an LLM on my code copyright infringement? If someone gets output from an LLM that looks substantially similar to my code, and they don’t know and don’t follow my license terms, is that copyright infringement?

And if it goes the other way, if output I get from an LLM looks very much like someone else’s code, did I infringe on their copyright?

I’m not sure! US law seems to suggest that training is fair game, as long as the entity doing the training has legal access to the data they’re training on. As for the rest of it, I’m not sure that’s legally settled yet.

On top of that, it sometimes feels icky that companies like OpenAI and Anthropic are making money off of all this when all that data out there – for which they mostly paid nothing – makes it possible.

I don’t, however, think the best response for myself is to just pretend none of it exists. It’s a tool, and a useful one.

Environmental and Social Impact

LLMs need a lot of space, electricity, and water. Communities where data centers are being built, along with the associated power plant upgrades, are often getting stuck with some of the bill for those improvements, which is disgusting.

The secret deals between datacenter companies and utility companies, often with municipalities complicit, are often leaving regular ratepayers out to dry. That’s a local problem, and I hope those local people vote in representatives who will take better care of them.

Supply Chain

I don’t need to remind anyone how expensive GPUs and RAM are right now. I was planning to upgrade the mainboard in my laptop this year, which would require new RAM (my current board has DDR4 in it), but the cost of 64GiB of LPCAMM2 DDR5 makes my eyes water.

The consumer RAM market has been hollowed out; several companies have either stopped making consumer-grade RAM entirely, or have severely restricted supply in order to make more money selling to datacenters and AI labs. That’s capitalism at work for you, at the expense of regular folks who need to buy computing hardware for personal use.


But here I am, with a Claude Max 5x subscription for the past year and a half. I’m not comfortable with it, but the utility is just too great for me to take a principled stance here. I like it, and I want it, so I’m using it. Maybe that’s morally questionable, or worse. But, as I said: here I am.

xfwl4 and LLMs

So yes, I use Claude quite a bit while developing xfwl4. I don’t vibe-code, ever, and I probably use the LLM to generate less code than most people do. After all, building things with code is my hobby and passion (and I’m lucky I got to do it professionally for a quarter century), and driving an LLM is kinda boring.

Research and Planning

Most of my time with Claude Code is research and planning. One great match for LLM use here is helping me understand the finer details of xfwm4, since xfwl4 needs to duplicate all of its behavior. One common prompt of mine:

1
2
3
look at the xfwm4 source in detail and determine everything there is to
know about $FEATURE.  write up a plan for how to implement it in xfwl4
to notes/$FEATURE.md.

I go do something else for a while, and when it’s done, I read the doc, and then spend a while asking Claude questions about it, and telling it the things I don’t like and what I’d like to be done differently, and it updates the doc.

Implementation

Most of the time I’ll start working from the notes doc myself, writing the implementation by hand. My guidelines for plan-writing to Claude are to do things in phases, and so I’ll complete a phase at a time, and then ask Claude to validate what I’ve done. Often, while I’m working, I’ll decide to deviate from the plan, and I’ll have to tell Claude to do the validation based on the outcome I want, not based on adherence to the plan.

Once it’s done, I’ll use /code-review and let Claude spawn sub-agents to do a full review of the new code. This usually finds some problems, even problems that the “main” Claude instance didn’t find during its validation. I usually keep running /code-review again and again after finding and fixing issues, until there aren’t any left. I actually haven’t been doing /code-review for very long, maybe 6-8 weeks, as I didn’t know about it. I wish I’d done it from the start, as it’s very useful.

Sometimes I will have Claude write some code for me. Usually it’s when there’s a lot of boilerplate, or if there’s work that feels repetitive and tedious. Claude is generally a great fit for that, and I can both manually review the output and have a subagent do an independent review. I’ll usually keep CC in manual mode and approve every edit after reading it, but for some more mechanical changes, I’ll let it sit on auto for a while, and review when it’s done.

Occasionally I’ll have it write more substantial code for me, usually for bug fixes, and occasionally for small features. I find it does a pretty decent job here, but I keep it on manual mode and often ask it to write the code in a different way, or take a different approach.

Bug Fixing

Whenever there’s a bug, I’ll start looking into the code myself (I want to keep my debugging skills from atrophying), but in parallel I’ll also ask Claude to look into it, either by describing the problem, or pointing it to a Gitlab issue, if there is one.

I’ll admit that it’s rare for me to find the issue faster than Claude does, and there were some issues where I was completely lost, and Claude figured out something in 10 minutes that probably would have taken me days.

Tests

xfwl4 doesn’t have many unit tests, but I’d like to improve that at some point. Of the unit tests that do exist, they were al written by Claude. I’ve always found testing to be tedious, and never did a very good job of it. Claude’s tests are generally much more comprehensive than tests I’d write myself.

I’ve heard stories of people saying that Claude will change or delete failing tests instead of actually fixing the problem that makes the test fail, but that hasn’t (yet) happened to me.

xfwl4 also has a test-clients sub-crate that has a bunch of Wayland and X11 client apps for manual testing of various compositor features. I wrote the first Wayland test, using smithay-client-toolkit, but for the rest of them, I told Claude to write them for me, using my first test as a template.

My LLM Strategy

I don’t really have one. I just run the best model available for everything (Opus 5, at the time of this writing1). I don’t write skills or other bits of automation. I expect some of that is indeed valuable, but I’m just not interested in it, so I don’t do it.

My usage isn’t high enough to ever hit my 5-hour or weekly limits on the Max 5x plan, so I just don’t worry about it. I started out with the Pro plan, but very quickly started hitting limits in the first 1-2 hours of the 5-hour windows, so I eventually upgraded after trying out extra usage for a bit and deciding I’d be spending more going down that route.

As I said above, I don’t vibe-code. I care about code quality and about understanding what I’ve built. I care about being able to maintain it in the future, manually, without needing an LLM to do everything for me.

And That’s It…

That’s it, I guess. I don’t think I would have made anywhere near as much progress with xfwl4 without an LLM. It’s easily saved me months of time, not in writing code (for non-trivial things, I can usually write it just as fast or faster), but in tracking down problems and helping me figure out solutions, whether that’s in Claude reading and reasoning about my code to find something that’s wrong, or in adding tons of targeted debugging prints to gather the information we need, and then sifting through the log file for me to do analysis.

I know this blog post is a tiny drop in an ocean of people writing about their LLM use, but I expect some folks might be curious about the development process behind xfwl4, so I figured a sort of disclosure was in order.

It’s been a little over a month since the first preview release of xfwl4, and I’ve fixed many issues and added new features since then. Hopefully I should have a new preview release in the next week or so, but you can clone the git repository to check out the current state of things for yourself, whenever you want.

  1. Yes, I know Fable exists. I was hesitant to start using Fable as it felt like Anthropic could pull the rug out and require API pricing for it at any time. It seems now they might leave it available to Max plan users indefinitely, but the usage terms (only allowing 50% of usage to go toward it) make me feel like I’ll get limit anxiety. 

Xfwl4's First Preview Release

I’m pleased to announce the first preview release of xfwl4, Xfce’s Wayland compositor.

After close to six months of work, I feel like it’s ready to get some wider use, even though of course there will be bugs and missing features. Think of this as an alpha release.

First off, I’d like to give a big thanks to the rest of the Xfce core team for offering to sponsor this work. I’ve been an on-again off-again Xfce developer since 2004 (more “off” than “on”, I suppose), and I consider it a great privilege to have this work sponsored, giving me the opportunity to focus solely on this project since the beginning of the year. This is also a huge thank-you to all the supporters who have generously donated to Xfce over the years.

Here are the essentials:

Source tarball. Build and install instructions are in the README. Please pay careful attention to build and runtime prerequisites.

Issue tracker. Search the issue tracker first in case someone else has already filed a similar issue. If not, and you file a new one, be sure to fill out every part of the issue template.

Git repository. If you’ve found an issue, it would be helpful if you could ensure it’s still present on git main. You can also try any fixes and features I’ve added since the release. Be sure to clone it with --recursive.

The end goal of xfwl4 is to behave as closely as possible to an Xfce desktop running on an X server. Ideally a user could switch between the two without even knowing there’s a difference. In reality, of course, it won’t be quite that seamless, and there’s still more work to be done to get as close as possible to that ideal. This is a first solid cut at it, at the very least.

The issue tracker will give you a decent idea of things that are not implemented yet or are known to be broken, but here is a list of notable things that won’t work, so you aren’t surprised:

  • The “Mouse and Touchpad” settings dialog (but whatever settings you’ve set under X11 will be applied under xfwl4) (issue).
  • The “Workspaces” settings dialog (issue).
  • Screen margins (issue).
  • xfdesktop’s minimized window icon view, and the middle-click window menu (issue and issue).
  • Pager thumbnails in the panel (no tracking issue yet).
  • Taskbar apps can only change maximize/minimize/fullscreen state (issue and issue).
  • Keyboard shortcuts for application/application-window switching (regular all-window cycling works fine) (issue).
  • Most (all?) apps will not be able to restore their window positions or workspace on startup (issue and issue).

(This is not an exhaustive list, just a few things I thought worth calling out.)

Over the coming weeks and months, I plan to write a blog series on how I built xfwl4. I’ll update this to link each new post here as they’re published. Anyhow, give it a spin!

Building a Raspberry Pi Compute Module 4 NAS

A few months ago, my venerable NETGEAR ReadyNAS NV+ died. Not sure what happened; it just shut off one day and refused to turn back on again.

For a while now, I’ve wanted to build my own NAS. I don’t like proprietary hardware that depends on a manufacturer for OS updates. But I also didn’t want to build a large, unsightly server, and burn more electricity on something that would be running 24/7. Granted, my NAS uses spinning-rust hard disk drives, which likely draw much more power than most low-power mainboards and CPUs, so maybe the power consumption concern is a bit overblown.

The 4th generation of the Raspberry Pi hardware has a single PCIe lane. In the retail model, this is wired to a USB3 chip. The Compute Module 4, however, allows board designers to do whatever they want with it. I’d hoped for a while that someone would build a board with at least four SATA ports. I was initially excited about a group called Wire Trustee, but they abandoned their hardware plans to instead build a VPN.

Then came Axzez, with their Interceptor carrier board, which was exactly what I was looking for, with five SATA ports.

Performance-wise, there are certainly better SBCs for this task. But I’m comfortable with the Raspberry Pi, and see it as a stable, long-term platform to build on.

What follows is a simple description of my build, and how it worked out.

Parts List

  • Axzez Interceptor carrier board
  • Axzez Interceptor board adapter (adapts the board for a mini-ITX form factor)
  • CM4 module (I ended up with a 4GB RAM/16GB eMMC/WiFi module, as that was all I could find available without having to wait the better part of a year for it to ship; ideally I wanted an 8GB RAM model, and didn’t care if it had WiFi or not)
  • Fractal Design Node 304 chassis
  • Seasonic SSP-300SFG power supply (SFX form factor)
  • Mains cable for the power supply (Seasonic doesn’t bundle one)
  • 4-pin Molex to dual 15-pin SATA power cable (if you have more than three hard drives)
  • SATA data cables (one for each drive)
  • CR2032 battery (the Interceptor board has a battery-backed clock)
  • Hard drives (I already had these from my previous NAS)

Verification and OS Setup

To start, I wanted to ensure the parts actually worked. I downloaded the latest 64-bit Raspberry Pi OS (minimal) image, and wrote it to a USB flash drive. Axzez provides their own OS image, which includes a patched kernel with support for the included 4-port ethernet switch. I don’t need this, so I preferred to stick with a more stock OS.

I mounted the boot partition, and configured things for headless operation, including connecting to a WiFi network (I wasn’t near an ethernet cable while doing this), enabling SSH, and creating a default user. I also added enable_uart=1 to /boot/config.txt so I can hook up the serial console; this could be useful if the board doesn’t boot for some reason.

I pulled the cover off the chassis, unpacked the power supply, and seated the CM4 module into the carrier board. I plugged the ATX power connector into the board, attached the power LED and power switch wires from the chassis to the board, and plugged the USB flash drive into one of the board’s USB ports. I plugged in the power supply and flipped the switch.

Everything turned on by itself, with the power LED glowing blue. I waited a few minutes, and tried to ssh to raspberrypi.local, surprised when I was greeted with a password prompt. Signing in presented me with a pretty standard-looking Raspberry Pi OS system.

Booting from USB is fine, but I wanted the OS on the internal eMMC storage. So I copied the OS image over from my laptop, and then used dd to write it to /dev/mmcblk0. I repeated the same steps as before to enable headless operation. In addition, since I’m not using Axzez’s OS image, there are a few settings I needed to add to /boot/config.txt:

1
2
3
enable_uart=1
dtparam=i2c_vc=on
dtoverlay=i2c-rtc,rv3028,i2c0,addr=0x52

The first isn’t required, but could be useful. The second enables the VideoCore’s I2C bus (not sure if this is required, but the Axzez OS does this). The third loads an overlay that sets up the RTC (real-time clock) chip included on the board.

After that, I power-cycled after pulling the USB flash drive. Again I waited, and ssh’ed into the board. A quick grep through dmesg confirmed that the RTC setup worked:

1
2
rtc-rv3028 0-0052: registered as rtc0
rtc-rv3028 0-0052: hctosys: unable to read the hardware clock

(The error is because the clock has never been written to; after the next clean reboot the clock should have been initialized with the time at shutdown.)

While I was here, with everything disassembled and easily accessible, I figured it’d be a good idea to update the OS and install most of the software I’ll need later. So:

1
2
3
4
sudo apt update
sudo apt dist-upgrade
sudo apt install neovim mdadm lvm2 smartmontools ifplugd nfs-kernel-server
sudo apt purge vim-tiny

In my case that didn’t upgrade too much, as the OS image I had downloaded was fairly recent. But I rebooted at this point, just to ensure things still come up properly after installing new packages.

I use neovim as my primary text editor, so it made sense to install it here. mdadm and lvm2 are needed for managing my hard disk arrays. smartmontools monitors disk drive self-reported health stats. ifplugd is a system daemon that automatically configures wired network interfaces when ethernet cables are plugged in (or unplugged). nfs-kernel-server provides an NFS server, which is how I primarily access files on my NAS across the network. You might also want to install samba (another file sharing protocol used by Windows computers).

I also modified /etc/hostname to set the hostname I wanted (and changed the raspberrypi entry in /etc/hosts), and added an IP reservation in my router for the ethernet port’s MAC address to ensure it always gets the same IP address (more or less required for NFS mounts if I don’t want it to be a pain).

This is also a good time to run dpkg-reconfigure tzdata to set the desired time zone, and dpkg-reconfigure locales to set the correct locale.

At this point I noticed that occasionally the board wouldn’t reboot cleanly (via sudo reboot). Sometimes (I discovered this by watching output on the serial console), the kernel would panic on reboot, requring me to power-cycle the power supply to continue. Annoying, but not a showstopper.

Hardware Assembly

Now that I’d verified everything works, it was time to put the hardware together. The manual supplied with the chassis recommended removing the disk brackets before starting, and then installing the mainboard first, followed by the power supply, and then finally the disks.

Mainboard

The mainboard was relatively straighforward to install. First screw the Interceptor board onto the board adapter, with the ports flush against the side of the adapter. Then attach the board adapter to the chassis itself, after screwing the four metal standoffs into the chassis. Orient the board adapter so the ports face out the back of the chassis. Don’t attach the board adapter to the chassis first, or it will be really difficult to screw the board into the adapter later.

If you disconnected them, now’s a good time to reconnect the wires for the power switch and power LED.

Also insert the coin-sized battery into the mainboard.

Power Supply

Next comes the power supply. The power supply I chose came with an adapter bracket to adapt the SFX form factor to a case accepting an ATX power supply. I chose SFX because they are often smaller and quieter. After attaching the bracket, mount the power supply in the chassis, with the power supply’s fan facing downward toward the opening in the bottom of the chassis.

The chassis has a power cable extension that you can now plug into the power supply.

From here you can connect the 24-pin ATX power connector to the mainboard.

Now that they won’t get in the way, you can connect the three chassis fans to the fan connectors on the mainboard.

Attach the 4-pin Molex to dual SATA power adapter to the appropriate power supply lead. This power supply only gives us three SATA power connectors; if you have four or five drives, you’ll need the extra adapter.

Drives

Finally it’s time to connect the hard drives. The chassis will hold up to six drives, though the mainboard only has ports for five of them. I only had four drives at the time of my build, so I plugged four SATA data cables into the first four SATA ports on the mainboard.

The drives themselves were fairly straighforward to attach to the drive rails. I had to move one of the rubber grommets to one of the extra holes. I was only able to line up three screw holes on the drives I have, but that’s fine.

After placing the drive rails back into the chassis, I routed power and data cables to each, and tried to bundle the excess cable as well as I could.

Wrapping it Up

Before closing up the chassis, I plugged in power and ethernet, and flipped the power switch on the side of the power supply. To my relief, everything came up properly, as expected, including all three fans.

I used mdadm and vgchange to manually set up and mount my drive array to ensure everything was working properly (later I’d write a script to do it on boot).

I deleted /etc/wpa_supplicant/wpa_supplicant.conf to disable WiFi, since ethernet was working fine.

Finally, I closed up the chassis and replaced the thumb screws.

Benchmarking

I feel like I’d be somewhat remiss if I didn’t post some performance numbers. Take this with many many many grains of salt. There are some oddities in my setup: my RAID5 array is actually two RAID5 arrays, joined into one logical partition using LVM2. I did a lazy dd test for this, to an ext4 filesystem on the RAID5+LVM2 volume, like so:

1
dd if=/dev/zero of=bench bs=4M count=10000 status=progress oflag=direct

This gave me sustained write speeds of 137 MB/s.

When reading it back, via:

1
dd if=bench of=/dev/null bs=4M status=progress iflag=direct

… I get sustained read speeds of 394 MB/s.

I know this isn’t particularly scientific, and I’m sure there are flaws in this benchmarking process. I don’t particularly care; I’m merely just trying to get a vague idea as to whether or not things are working reasonably well. These speeds are more than sufficient for my purposes. I did not test any read/write scenarios more complicated than this, and I didn’t do any performance tuning whatsoever.

Final Thoughts

Overall I’m really happy with how this build turned out. Right now I am just manually managing the storage and network shares on the box, though I have considered installing something like Open Media Vault.

There are a few minor annoyances and omissions that would be nice for Axzez to implement in a future board revision:

  1. The fans don’t appear to be controllable or monitorable by the OS. The board supports three-wire fans, which should at least allow us to monitor fan speed (helpful both for control feedback as well as alerting if a fan has died). Controlling the speed could be done using the CM4’s builtin PWM hardware (maybe? though I believe there are only two channels), or by adding an external fan controller chip.
  2. There isn’t a way to flash the CM4 bootloader or modify the CM4’s boot settings. With a CM4 I/O devkit, you can place a jumper on the board to put it into usbboot mode, which allows you to do all this from a USB-connected computer, but the Interceptor board doesn’t provide this ability.
  3. I didn’t need to make use of the 4-port ethernet switch, but it would be great if Axzez could work to get the drivers for it upstreamed so it doesn’t require a custom kernel. At the very least, a DKMS package would be sufficient. To their credit, they set things up so single-port operation works just fine if you don’t use a patched kernel, which is fine for my purposes.
  4. It would be a nice addition to expose another pair of pins so I could connect the chassis’ HDD activity LED as well.
  5. Documenting how to enable the RTC chip on a vanilla Raspberry Pi OS would be nice (it wasn’t hard to figure out; I just read through their kernel patch).

While the Interceptor certainly isn’t meant to be a general-purpose board, exposing some of the unused GPIO pins could also be really useful (for example, I could probably build my own fan controller daughter board, or set up the HDD activity LED trigger myself). I’ve heard that the two 40-pin FFC connectors expose an I2C and two GPIOs each, but it’s not the most convenient thing to work with. (Having said that, I’ll take what I can get!)

One thing that I am incredibly happy with is that the board works with the stock Raspberry Pi OS. The last thing I want is to be stuck on an old version of the OS after the manufacturer loses interest in supporting it, which is pretty much inevitable for most products, and is the situation I ended up in with my old retail NAS. With the exception of the ethernet switch, everything on this board has upstream support, and the switch gracefully degrades to a single usable ethernet port when booted with the stock Raspberry Pi OS kernel.

As for the rest of the hardware:

  1. The chassis I chose doesn’t make it possible to access the drives without opening it up. I could have chosen a chassis that has hot-swap bays, but I personally don’t need this, so I didn’t bother. I’m actually not sure if the SATA controller on the board supports hot-swap.
  2. This chassis has USB3 ports on the front. Because the CM4’s single PCIe lane is taken up by the SATA ports and ethernet switch, it does not have USB3 capability. Presumably I could cut the USB3 connector off the chassis’ cable and use the ports as USB2 ports (the main board has a pin header for extra USB2 ports), but this isn’t a priority for me to set up.
  3. There’s currently no back panel on the chassis around all the ports. It’s not that big a deal, though I’m afraid of dust getting drawn in through there.
  4. I haven’t measured the power consumption of the power supply I chose. I think it should be reasonably efficient at the sub-100W power draw expected while idle, but it’s likely not as efficient as a smaller supply would be. I debated going the “pico PSU” route, but decided to stick with something more traditional for now.

I’m very pleased that Axzez decided to design and build this carrier board. I’ve been waiting for something like this ever since the CM4 was released, and the board did not disappoint.

Running a Modern Debian on the Netgear ReadyNAS NV+ v2

I have an old ReadyNAS NV+ v2 (not to be confused with the SPARC-based v1) that has been my workhorse home NAS for a good 7 years now (previously I had an older Netgear NAS that suffered a hardware failure and needed to be replaced). It’s a great piece of hardware, but the software hasn’t seen a major update in many years, and the OS is based on Debian squeeze, which is several releases behind current stable, and is no longer maintained.

I recently tried to visit the NAS’s admin web UI, only to see a recently-updated Firefox throw up a big scary security warning, telling me that TLS 1.0 and 1.1 are disabled in the browser, but the server I’m trying to connect to (the NAS) doesn’t support TLS 1.2 or newer. It allowed me to bypass the warning for now, but eventually I expect that older TLS versions (just like SSLv3 before it) will be removed entirely.

No problem, I thought, as I ssh’ed into the NAS. As I expected, the issue was that Apache was linked against an old version of OpenSSL which lacks TLS 1.2 support. To avoid disturbing the system itself too much, I figured I’d use debootstrap to create a chroot with a more modern Debian version, and run the webserver (or a proxy) from there.

But that didn’t work out. The glibc versions in Debian testing, buster, stretch, and even jessie all require a newer kernel than what’s running on the ReadyNAS (2.6.31.8). I looked at some other OSes, like Alpine (which uses musl and wouldn’t have the same issue) and nixOS (which I expected might just be more flexible), but neither of them support the armv5-based CPU in the NV+ v2.

After a bunch of dead ends, I finally ended up natively building a newer version of OpenSSL, as well as HAProxy, on the NAS itself, and installed it to a private prefix. That ended up working, but was largely unsatisfying. Even before this, I’d lamented being unable to run newer versions of some software (offlineimap, for one thing) on the NAS.

So I started poking around to see if anyone has done a large, unsupported upgrade on this hardware. I didn’t find any concrete instructions, but I did find some encouraging information. I found someone who had cataloged all the hardware of the device, and had upstreamed support for the board into the Linux kernel, and had noted that nearly all the hardware (save the front-panel LCD) is now supported by the upstream kernel. I found a reference on Debian’s ARM EABI port page that the ReadyNAS NV+ v2 is specifically supported by the upstream kernel.

WARNING

First off, a big disclaimer:

This is inherently risky, and you can very easily brick your NAS to the point where it will be incredibly difficult to recover it. I recommend you open it up and make sure you can get the serial console working before proceeding with any of these steps (there are instructions in one of the above links).

Also remember that, while it is possible to connect your NAS’s drives to a computer running Linux in order to assemble the RAID/LVM array to pull data off, you should have a backup of all data to be safe.

Kernel

The first step is to get a more modern kernel running on the box. Unfortunately the ReadyNAS’s stock kernel is compiled without kexec support, so we can’t experiment without overwiting the one-and-only copy of the bootable kernel on the ReadyNAS’s flash chip.

TODO: see if the stock u-boot supports USB booting and how to get that to work.

The flash chip is partitioned like so:

1
2
3
4
5
6
dev:    size   erasesize  name
mtd0: 00180000 00020000 "u-boot"
mtd1: 00020000 00020000 "u-boot-env"
mtd2: 00600000 00020000 "uImage"
mtd3: 01000000 00020000 "minirootfs"
mtd4: 06800000 00020000 "jffs2"

The first partition contains the u-boot bootloader, with the second holding environment variables that control u-boot’s operation. The third (uImage) holds the kernel, and the fourth (minirootfs) holds a small initial RAM disk that kicks off the boot process before turning control over to the main rootfs. The fifth partition, jffs2, contains

  1. First back up all flash partitions on the NAS: for i in /dev/mtd*; do sudo dd if=$i of=$(basename $i); done Be sure to copy the resulting files off to another computer for safekeeping.
  2. apt install gcc-arm-linux-gnueabi u-boot-tools screen lrzsz
  3. Grab kernel of your choice (I used 5.6.6; here’s .config), and build with: make zImage ARCH=arm CROSS_COMPILE=arm-linux-gnueabi-
  4. Make u-boot image for kernel: mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n Linux-5.6.6 -d /path/to/linux/arc/arm/boot/zImage kernel.img
  5. Extract the initrd file system image (from the backup of mtd3 created earlier): dd if=mtd3 bs=64 skip=1 | gunzip -c | sudo cpio -i (Strip the 64-byte uImage header, unzip, extract).
  6. Patch init to not try to load Netgear’s proprietary kernel modules (which are no longer needed): sed -i -e 's/insmod/ls /g' init
  7. Repackage the initrd: find . -type f >name-list && sudo cpio -o <name-list | gzip -9 -c >initrd.gz && rm name-list
  8. Make u-boot image for initrd: mkimage -A arm -O linux -T ramdisk -C gzip -a 0x00000000 -e 0x00000000 -n initrd -d initrd.gz initrd.img