Bonum Certa Men Certa

How To Deal With Your Raspberry Spy -- Part IV: Doing The Task

By Gavin L. Rebeiro

Contents



Cover

Copyright

1 Acknowledgements

2 Introduction

2.1 Prerequisite Knowledge 2.2 Apparatus

3 Fundamentals

3.1 Communication 3.2 Kernel Ring Buffer 3.3 Drivers 3.4 Operating Systems 3.5 Special Files

4 YOU ARE HERE ☞ Doing The Task

4.1 Preparing The Boot Media 4.2 Connecting Physical Components 4.3 Using Picocom 4.4 OS Installation

5 Thanks

6 OpenPGP Key

A Malicious Hardware

B Linux Kernel Source Tree Analysis

C Digital Multimeter Tests

Summary: We now spell out the steps taken to actually replace the Raspberry Pi OS with something more trustworthy (for background see Part I, Part II, and Part III)

We’ve now covered enough ground to make the installation of NetBSD on our Raspberry Spy (over our UTUB) a relatively painless matter.



Let’s go through the process in little steps.

4.1 Preparing The Boot Media

I’m going to grab the appropriate NetBSD image by taking hints from the following:

NetBSD/evbarm on Raspberry Pi tells us everything we need to know to pick the right image. All the sections here related to booting are worth reading at least once. Also read sections about consoles and serial consoles at least once.

Raspberry Pi boot modes is useful if you want to dig deeper into the booting mechanisms of the Raspberry Spy. USB mass storage boot is particularly useful for booting off USB. Trust me, you don’t want to muck around with SD cards; they’re a nightmare.

NetBSD/evbarm can be referenced for general information about NetBSD on ARM boards.

The above links should give you a good idea of what’s going on and what needs to be done with regards to putting a NetBSD on a boot media that goes into a Raspberry Spy.

Let’s go through a concrete example.

My Raspberry Spy is of the model “3 B+” variety so I’m dealing with an ARM64 CPU architecture. We’ll follow along the instructions outlined in Installation procedure for NetBSD/evbarm; pay close attention to the section “NetBSD/evbarm subdirectory structure”; I follow these instructions as I explore Index of pub/NetBSD/NetBSD-9.1/evbarm-aarch64/.

I grab the appropriate image like so:

$ mkdir ~/Downloads/netbsd
$ cd ~/Downloads/minted
$ wget https://cdn.netbsd.org/pub/NetBSD/NetBSD-9.1/evb c
 → arm-aarch64/binary/gzimg/arm64.img.gz


Now that we’ve got the image, we can write it to our boot media. I’m going to assume you have an appropriate reader already plugged into your GNU/Linux box. I’ve got my USB thumb drive as “/dev/sdg” on my system. Use the right block device file on your system1. We base our procedure along the lines of “Installation for ARMv7 and AArch64 devices with U-Boot” section from Installation procedure for NetBSD/evbarm:

$ gzip --decompress --keep arm64.img.gz
# dd if=arm64.img of=/dev/sdg bs=1M conv=sync
 → status=progress
$ lsblk -f | grep sdg


We’re going to ignore the minutiae of writing to block devices, bootloaders, and other adjacent topics related to the utilities we just used; that’s left for another time. We care about learning how to use a serial console in this project so we must stay focused on our primary target.

We’re going to have a look at how to make a serial install possible via some editing of the “cmdline.txt” file that now resides in the boot media (on the boot partition which is of type “vfat”):

# mkdir /media/netbsd_image
# mount /dev/sdg1 /media/netbsd_image
# grep "console" < cmdline.txt
# root=ld0a console=fb
# grep "enable_uart" < config.txt
# enable_uart=1


The “console=fb” part is to get out OS image to use the HDMI output. We will get rid of that string from the file “cmdline.txt”. Who needs that anyway? One way to do it2:

# ed cmdline.txt
21
,p
root=ld0a console=fb
1
root=ld0a console=fb
s/console=fb//
,p
root=ld0a
wq
11
# echo ",p" | ed cmdline.txt
11
root=ld0a





Remember to check your edits!

We also ensure that “enable_uart=1” is set in the file “config.txt":

# echo ",p" | ed config.txt
82
arm_64bit=1


kernel=netbsd.img
kernel_address=0x200000
enable_uart=1
force_turbo=0


Everything looks good! Additional useful information on the Raspberry Spy UART can be found in UART configuration. Pretty self-explanatory. That wasn’t so hard. Was it? Note that the following links document the files we’ve been messing around with:

The Kernel Command Lineconfig.txt

It’s a good idea to back up the state of your image, at this point3. We can now safely unmount our boot media and get on with the project:

# cd ~
# umount /media/netbsd_image


We change directory, before we unmount, so that we don’t get any “device busy” errors.

We’ve now got our boot media ready. Onwards!

4.2 Connecting Physical Components

Before you power up your UTUB, you should really check that the pins are working properly. The very basic test you should do is to check that the right voltage is being supplied. Check out Appendix C.

The pins on our UTUB and Raspberry Spy that we’re interested are the following:

● Raspberry Spy: Pin6 (Ground), Pin8 (GPIO14, TXD), Pin10 (GPIO15, RXD). You can find the layout in the official GPIO page.

● UTUB: I’ve got a CP2104 UTUB so I’ve got to only worry about the pins marked TX, RX, and GND. I have other pins on the module but they’re not relevant for this task.

We won’t be using any of the voltage pins on the boards because it’s more prone to errors. Just use the USB power supply that comes with your Raspberry Spy.

Don’t plug anything into power for the following sequence. Connect the jump-wires like so:

● Ground on UTUB to Ground (Pin6) on Raspberry Spy.

● TX on UTUB to RX (Pin10) on Raspbery Spy.

● RX on UTUB to TX on (Pin8) Raspberry Spy.

"We won’t be using any of the voltage pins on the boards because it’s more prone to errors."Don’t make the rookie mistake of matching TX with TX and RX with RX; TX always goes to RX and RX always goes to TX. Keep this in mind, always, when working with UARTs. Colour-coding your jump-wires helps.

We’ll just go over the order of attaching the stuff to do with power on our devices:

● Attach the USB power adapter to the Raspberry Pi without plugging the adapter into the power outlet.

● Attach the UTUB to your GNU/Linux box.

● Attach your USB power adapter to your power outlet.

The logic for the above procedure is that you can ensure that your serial interface is up and running before you start getting input from your Raspberry Spy.

4.3 Using Picocom

Using picocom(1) is simple. All we need to do is select the correct baud rate and give the right device file as a parameter to picocom(1).

I’ll give you an extract from the manual page to enlighten you:

In effect, picocom is not an "emulator" per-se. It is a
simple program that opens, configures, manages a serial
port (tty device) and its settings, and connects to it
the terminal emulator you are, most likely, already
→ using
(the terminal window application, xterm, rxvt, system
console, etc).
When picocom starts it opens the tty (serial port)
given as its non-option argument. Unless the
--noinit option is given, it configures the port to
the settings specified by the option-arguments (or
to some default settings), and sets it to "raw"
mode. If --noinit is given, the initialization and
configuration is skipped; the port is just opened.
Following this, if standard input is a tty, picocom
sets the tty to raw mode. Then it goes in a loop
where it listens for input from stdin, or from the
serial port. Input from the serial port is copied
to the standard output while input from the standard
input is copied to the serial port. Picocom also
scans its input stream for a user-specified control
character, called the escape character (being by
default C-a). If the escape character is seen, then
instead of sending it to the serial-device, the
program enters "command mode" and waits for the next
character (which is called the "function
character"). Depending on the value of the function
character, picocom performs one of the operations
described in the COMMANDS section below.


We use “C-a C-x” (Ctrl+a followed by Ctrl+x)4 to tell picocom(1) to exit; for more, RTFM; in particular, pay close attention to the “COMMANDS” section.

Make sure you’ve set up all the physical connections, as advised. It’s time to attach our UTUB to our GNU/Linux box and then make sure we invoke picocom(1) correctly:

# picocom --baud 115200 /dev/ttyUSB0
picocom v3.1



port is : /dev/ttyUSB0 flowcontrol : none baudrate is : 115200 parity is : none databits are : 8 stopbits are : 1 escape is : C-a local echo is : no noinit is : no noreset is : no hangup is : no nolock is : no send_cmd is : sz -vv receive_cmd is : rz -vv -E imap is : omap is : emap is : crcrlf,delbs logfile is : none initstring : none exit_after is : not set exit is : no

Type [C-a] [C-h] to see available commands Terminal ready


It really is that simple. You’ve now got a serial terminal ready and listening.

4.4 OS Installation

Now that you’ve got a serial terminal operational, all we have to do to install NetBSD on the Raspberry Spy is to plug the USB power adapter into the power outlet. Keep a close eye on what goes on in the output of your serial terminal:

...
[   7.4246937] root device:
[  11.6252523] use one of: mue0 sd0[a-p] ddb halt reboot
[  11.6252523] root device: sd0
[  13.9755661] dump device (default sd0b):
[  15.7257992] file system (default generic):
...


You should be promoted to pick a root device. I pick “sd0” as it’s the first ’disk’ offered by NetBSD (which can only be my boot media)5. I go for the suggested defaults, for everything else. No need to overcomplicate things, at this point.

You will probably see your Raspberry Spy reboot once or twice during the OS install process. Just pass the same parameters for the boot device, and you should be good to go.

Eventually, you should be met with the following:

...
NetBSD/evbarm (arm64) (constty)
...



login:


If you login as “root”, you should have a nice login shell presented to you.

And we are done! You’ve successfully done some tinkering over a serial terminal. That wasn’t so hard. Was it? You can shutdown your device (halt the OS) like so:

# shutdown -p now
...
[   910.5814809] The operating system has halted.
[   910.5814809] Please press any key to reboot.


You can now disconnect the power supply from your Raspberry Spy. Then just send “C-a C-x” to picocom(1); after which, you should see:

...
Terminating...
Thanks for using picocom
#


Welcome to the world of serial terminals; hack your heart out! ____ 1 The command lsblk -f should help you out here. Don’t wipe the wrong device by accident. 2 If you use another text editor, that’s fine. You really should learn ed(1) at some point though, especially if you want to get into embedded systems. 3 At least keep track of the files that you tweaked. If you use some sort of version-control-system, you get bonus points. 4 I don’t know why the manual doesn’t bother to explicitly mention that these are GNU-Emacs-style key sequences. 5 See the NetBSD sd(4) manpage for details.

Recent Techrights' Posts

An American War on GNU/Linux, Software Freedom, and British Investigative, Science-Based Reporting - Part I - A Matter of National Security
Those people are Americans who try to advance the interests of American corporations by weaponising courts abroad
The Register MS, Sponsored by Communist Party of China (CPC)
What will happen when the bubble crashes the economy?
 
Gemini Links 07/03/2026: Buying Woodland, Indra 1.3.0 Available, and LLM Exhaustion
Links for the day
The Harder They Attempt to Take Down This Site (and Take Away Liberties), the More People Will See This Site
We'll carry on as usual, as from sunlight comes justice
Why They Always Try to Shoot the Messenger (When the Message Harms Profits)
A matter of economics
Coinbase - Like Block - is in Huge Trouble, Its Debt Nearly Doubled in Half a Year
The real reason Block is collapsing is its debt
Starting Another New Series This Evening, It's About American Folly
today commences a series long in the making (years)
Nations Stand to Benefit From Gender Equality and Increased Participation by Women
International Women's Rights Day starts in about 6 hours in the UK
Microsoft is Losing It, Now It's Censoring Its Critics and Sceptics
Whether the measurements made by statCounter are accurate or not, the trends (long-term) typically make sense
WIRED (Conde Nast) Reviews Are Paid-for Marketing Spam, They Change Dates on Old 'Articles' to Make Them Look Relevant and New
The Web is fast becoming a burial ground for ads, trash, spam, and slop
Gemini Links 07/03/2026: Humour, Chilling, and Oversized 'Phones'
Links for the day
Cyber|Show by Andy and Helen Recommended by Techrights and Tux Machines
If your time is limited and you look for informative essays and shows (audio)
Links 07/03/2026: CJEU to Finally Examine Behaviour of the Illegal and Unconstitutional Unified Patent Kangaroo Court, Creative Commons (CC) Hosts Open Heritage Statement Event in Amsterdam
Links for the day
Microsoft's Thailand Problem
It's definitely not Windows
New Lows for Microsoft in Micronesia
GNU/Linux has shown some growth there too
Microsofters' SLAPP Censorship - Part 5 Out of 200: Clearly Not a Security Professional/Expert, Only Ever Pretending to be One
"The Claimant says he is “a computer security expert”, but his background and his track record in the education sense (genetics) does not support this assertion."
Links 07/03/2026: Fuel Already Running Low and "Economic Crisis of the Iran War"
Links for the day
The Corporate Media Repeated the Lies Told by Jack Dorsey ("AI" Hype), Now It Does the Same for Larry Ellison
Disregard the hundreds of headlines that say mass layoffs at Oracle are due to "AI" something
The Free Software Community is Gaining Momentum as Its Importance is More Broadly Realised
As long as "trendy" technology goes in a negative direction there will be a growing portion in society looking for alternatives
Spooking or Chasing Away Women (From Computer Science)
The status quo discourages women from even trying to study Computer Science and related disciplines
"IBM Has Changed So Much in the Last Decade to the Point It's Completely Unrecognizable."
IBM is a dying, rotting company with a morbid culture
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Friday, March 06, 2026
IRC logs for Friday, March 06, 2026
Gemini Links 07/03/2026: Coffee Problem, Marchintosh, Learning, and "Selectively Disabling HTTP"
Links for the day
Under IBM, Some Fedora Blog Posts Have Become LLM Slop! (Red Hat is Doomed by Slop Fanaticism)
Who would even bother reading such trash?
Lots of People Leaving IBM Today
IBM cannot be trusted
Dances With Wolves, Wakes Up With Fleas
Small minds say "td;dr" whereas the rest say, "give me information, give me time to study it"...
LLM Slop Rare and Scarce This Friday
We still hope that by the end of this year slop will become nearly extinct
Defending British Democracy From American Predators
We stand united and strong in the face of predators
Links 06/03/2026: LLM Prompt-injection Vulnerability in Microsoft's Proprietary GitHub, "260,000 Federal Jobs Lost"
Links for the day
It's Friday and Many People Publicly Announce Leaving IBM (Which is Engineering 'Willful' Departures to Mask RAs' Scale)
We understand from whistleblowers that IBM already destroyed Red Hat's culture
Dr. Richard Stallman (RMS), the Man Whose Mind Scares GAFAM et al, Began Speaking in Switzerland
His ideas and ideals are not obscene
Gemini Links 06/03/2026: "Setting up the Feed" and Using Molly Brown
Links for the day
Links 06/03/2026: Can't Copyright Slop in US, Microsoft Became Slop Provider for Militarism
Links for the day
Garrett Does Not Just Try to Cover Up for Himself, He's Clearly Covering Up for His Mates From Microsoft (and Admits Third Parties Fund His Litigation, With Their Legal Bills Estimates Already Approaching $1,000,000)
They have already sent us about 75 KG of legal papers. How is any judge supposed to keep up?
Richard Stallman in the United States - Part IV - Back to Switzerland
The "cancel mob" tried to "finish off" RMS 5 years ago
Dr. Richard Stallman in Ada Lovelace Lecture Series 20 Hours From Now in Lucerne School of Computer Science and Information Technology (Rotkreuz)
Well-connected and affluent corporations want everything to be controlled by them, ranging from culture to words and news
Threats Issued to Daniel Pocock Having Launched the JuristGate Web Site Which Covers Financial Fraud in "Legal Insurance" Clothing
Is our world governed by laws or by rich corporations (or nations/superpowers) with well-connected lawyers/politicians?
International Women's Day: At the EPO, for Women to Become Managers They Need to Sleep With Well-connected Men and Mingle With Corrupt Men
Sunday is International Women's Day
Dr. Richard Stallman Starts His Talks in Switzerland in 8 Hours
They try to assess how many people plan to attend to ensure everyone gets a seat (without compromising the privacy/identity of those attending)
IBM Red Hat Layoffs: It's Not About "AI"
"Automation" is not "AI", it's just a generic term which can describe jobs left for machines to do, sometimes computers
Microsoft Windows Used to be Identified on Over 99% of Web Requests From Benin. Now It's Around 50%.
Or a lot less
Microsoft 'Open' 'AI' Has Severe Financial Problems, Version Inflation ("GPT-5.4") is Mindless Hype and a Misleading Distraction
In practice, both users and sponsors of ChaffGPT are fleeing
The Techrights Static Site Generator (SSG) Turns 5 Next Year
It's still under active development in our Git servers
New XBox Boss (Sharma) Implicitly Confirmed XBox (the Console) is Now Dead
Vista 11 is now also known as "XBox"
Murder as a 'Joke' to GAFAM People (Sociopathy)
When it comes to Microsoft and Salesforce, they profit from this mentality
GNU/Linux Seen as Rising to 20% in Eritrea, But That's statCounter Identifying "Unknown" as GNU/Linux
What if statCounter managed to figure out what all those "unknowns" are?
Microsoft ‘Project Helix’ is Just a Tweet in MElon's "X"
Some "tweet" is easy, as words are cheap
Microsofters' SLAPP Censorship - Part 4 Out of 200: Rianne’s Version of Events and Narrative
today we tell Rianne's experience
EPO Staff to 'Meet' This Coming Tuesday to Plan Industrial Actions Including Upcoming Strikes
using Microsoft spyware to organise this can be an own goal because Microsoft serves the dictators, not the union that tries to topple them
Thousands of EPO Workers Rally Against EPO Management
The staff is furious to see what became of the EPC and the EPO. This is not sustainable.
In Argentina Firefox is Measured at Only 1%, Google Chrome (Proprietary) at About 90%
And it has long been that way
IBM's March 2026 Layoffs Already Happening (to Accelerate Soon in Europe and America)
We're probably seeing some of the last years of IBM and it's anything but certain that IBM can survive the coming decade
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Thursday, March 05, 2026
IRC logs for Thursday, March 05, 2026
Gemini Links 05/03/2026: Industrial Panettone, Cancel, and LLMs
Links for the day
It's Not "AI", IBM is Collapsing Due to Financial Difficulties, "All Small Country Offices Will Close"
IBM is in trouble. Insiders know it.
"AI Companies" Running Out of Money, GAFAM Layoffs Are Signs of Weakness, Not "AI Efficiency" or Novelty
In the past, this term ("AI") had another meaning and connotation
Libel/Defamation Law Does Not Exist to Cover up Crimes
The projection tactics are nothing new
Myanmar/Burma: Growing Acceptance of GNU/Linux, Big Losses for Windows
GNU/Linux has come close to 5% there
Without IBM, Microsoft Would Not Have Taken Off. Both Companies Need to be 'Taken Down'.
Maybe it's time to boycott IBM as well
'Former' Red Hat Staff Upset That Techrights Covers IBM Accounting Problems
Are we touching a sensitive subject at IBM?
Ubuntu is Controlled by a Youngster From the British Army (Background in Mass Surveillance), So One Can Expect Ubuntu to Not Respect Privacy
"Canonical is aware of the legislation and is reviewing it internally with legal counsel"
IBM Hates Computer Freedom. This Means Red Hat Too is an Enemy of Software Freedom.
A summary of Fedora's position when it comes to "attestation"
IBM Union Says Many IBM Layoffs in Europe, With Netherlands and Belgium Confirmed, Allegedly Italy Soon (200 Layoffs)
IBM's demise will harm Red Hat and already harms Red Hat, according to whistleblowers
Microsoft and Microsoft's 'Open' 'AI' Seeking Bailout From the Pentagon Means Brand Erosion
Microsoft and its offshoots growing more and more dependent on military ("defence"; "Department of War") budget
Another EPO Strike a Fortnight From Now, Local Staff Committee Munich (LSCMN) Shares 127-Page Document Explaining How Policies Impact EPO Staff
The Office is circling down the drain
Microsofters' SLAPP Censorship - Part 3 Out of 200: A More In-Depth Breakdown
presents the narrative in a less chronological and more logically coherent fashion
2026 Seems Like (Potentially) the Last Year of Slop Drowning News Sites
Sites that do so perish [...] It's getting hard to find slop in news sites which cover "Linux" because many gave up
Links 05/03/2026: New LexisNexis Data Breach Confirmed, "Goldman Sachs Head During Financial Crisis Says He “Smells” a Similar Crash Coming"
Links for the day
"Silent Layoffs" or "Forever Layoffs" at IBM and Red Hat (After Bluewashing)
Like every day (all day long) we can see people who leave IBM and say something that's based on a 'script'
Free Software Foundation (FSF) and Others Promoting String of RMS Talks, Starting Tomorrow in Lucerne School of Computer Science and Information Technology
Well done, FSF!
Links 05/03/2026: A Bet Against Substack, American Government Openly Hostile Towards Environment
Links for the day
Gemini Links 05/03/2026: Greed and Sentiments Shifting Against Slop
Links for the day
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Wednesday, March 04, 2026
IRC logs for Wednesday, March 04, 2026