Homebrew, open source, repurposed, hacked, software defined, open hardware

Monday, 1 April 2019

Mounting PCB layouts as a file system!

It goes without saying, that this is something we have all been waiting for since the dawn of UNIX and hierarchical file systems.

Finally, we now have the ability to mount a pcb layout as a virtual filesystem, allowing metadata to be inspected and modified from within the terminal, with scripts, or from within midnight commander... or even from within Emacs!

More observant readers will already have noted that someone using a single board computer can now mount the PCB layout of their single board computer on their single board computer filesystem and inspect their single board computer hardware from the command line of their single board computer.

Enough said! Down to business!

The first thing is to have a computer running some form of *nix. pcb-rnd will build on most systems, and supports motif, gtk and headless CLI operation. Importantly, for fuse filesystem export, you will need to be running a version of GNU/Linux with fuse support.

The next thing is to checkout svn head of pcb-rnd

This can be done from a terminal with

svn checkout svn://repo.hu/pcb-rnd/trunk

if you do not have subversion (svn) installed, and you are on a debian/ubuntu based system, you can use the following command first to install svn

sudo apt-get install svn

you should also install midnight commander, and the fuse development libraries which support userspace filesystems

sudo apt-get install mc libfuse-dev

once you have checked out pcb-rnd, do the following

cd pcb-rnd/trunk
./configure --buildin-export_vfs_fuse --buildin-export_vfs_mc

during configuration, you should see amidst the output, something like

 FUSE VFS server                 yes, buildin    [export_vfs_fuse]
 GNU mc VFS server               yes, buildin    [export_vfs_mc]

if ./configure is successful, and dependencies are met, you can proceed to build with the following command


once built, you can try out the build, with

cd src

The Fuse filesystem allows users to create their own filesystems in userspace. Most modern GNU/Linux distributions will have kernel support for fuse. If you have kernel support for fuse, you can now test fuse filesystem export.

Make a temporary mount point somewhere

mkdir /tmp/pcb-mnt

then mount your pcb onto the mount point!

./pcb-rnd -x vfs_fuse ~/foxhunt-attenuator/fox-attenuator-v1.lht /tmp/pcb-mnt

and now, you can go ahead and explore your pcb data

cd /tmp/pcb-mnt


Of course, a file browser, a web browser, Emacs or midnight commander are much easier ways to explore the mounted fuse filesystem than using the CLI.

pcb-rnd can also load Eagle binary, Eagle XML and KiCad layouts, Protel Autotrax and respective footprints allowing similar inspection of metadata once loaded into pcb-rnd's data model.

If you do not have fuse support, then you can still play along with midnight commander. To inspect a board's metadata in midnight commander without using fuse, the following configuration files need to be set up.

Install the file


in /usr/lib/mc/extfs.d

i.e. with the command

sudo cp pcb-rnd/trunk/src_plugins/export_vfs_mc/upcb /usr/lib/mc/extfs.d

Then add the following in mc.ext (which is usually found in  /etc/mc/mc.ext) just above the final # Default section in mc.ext:

# PCB files
Open=%cd %p/upcb://

the above code determines which file endings are treated as mountable by midnight commander. In the example above, it is set to ".pcb"

The one remaining thing to do is to install the built version of pcb-rnd, so that midnight commander can launch it when required. You can do this from the pcb-rnd/trunk directory with the following command

sudo make install

On starting midnight commander, pcb layouts with matching file-endings will be automatically mounted, allowing the metadata to be traversed within the file browser.


Apart from the obvious motivation to impress your friends, coworkers and spouse, there are some very simple, slightly impractical, and arguably silly, script examples that demonstrate the power of this new capability, and how easy it is to access board metadata via a virtual filesystem.