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

Rumours of Further IBM Shutdowns
IBM is going out of existence
Many Anniversaries
Many anniversaries in quick succession
 
Abundance of Fake (Sometimes Paid-for) 'News' About IBM Will Discredit the Media as a Whole
In 'the news' today
Worse Than "Taking Your Job", the Slop Pyramid Scheme Will "Take Your Pension"
This will not end well
Microsoft is Trying Vapourware Again (to Keep Developers and Gamers From Fleeing)
For XBox, the main thing over the horizon is additional layoffs
statCounter Reckons 12.33% of Web Traffic in Gambia Can be Attributed to GNU/Linux, Even 15% If Adding ChromeOS
Will this be sustainable?
Reminder: The Pedophilia Problem Comes From the Accusers
Attacks on Richard Stallman are a distraction; his accusers are themselves the culprits
SLAPP Censorship - Part 139 Out of 200: Solicitors Regulation Authority (SRA) Needs More Public Scrutiny (New Management Changed Nothing, It's Costing a Lot of Taxpayers' Money)
millions or maybe billions of pounds wasted
Brigading Against Women - Part II - Threatening Women Using the Human Rights Tribunal of Ontario (HRTO) and Then False Threats Miscarrying the Name of a Court
In this series we intend to show the threats, the outcomes of those threats, the response to those threats
Collapse of MElon Companies a Taste of What's to Come for Slop Bubble and GAFAM (Trillions in Debt, Justified as Slop "Investments")
One good example of this was SpaceX
The 'Hyperinflation' in Hardware Dooms Video Hosting (Very Large Files)
a terabyte of video files would be expensive
Rumours of Silent Layoffs in Microsoft This Month (August 2026), PIPs and Global Voluntary Separation Agreement (GVSA), aka "Buyouts"
Will any investigative journalism follow or just shallow puff pieces and LLM trash from slopfarms?
Links 04/08/2026: "Framework for Musician Burnout" and Alexa+ "is a Buggy Embarrassment"
Links for the day
Signs That XBox as a Console is Coming to an End, Windows Gaming Will be Called "XBox"
"XBox" is the next "Surface"
Microsoft's Share in Search Falls Sharply in Europe
The layoffs at Microsoft's Bing will carry on
Romania: GNU/Linux Reaches 4% (Less Than EU Average)
We expect this same upward trend to carry on
Microsoft Sites or Sites Sponsored by Microsoft Angry That GNU/Linux is Gaining
The Microsofters cannot easily dismiss reports of GNU/Linux growth as "bots" or just allege that statCounter alone is wrong
Ableism in the Free Software Movement Typically Comes From GAFAM Operatives and Proprietary Software Apologists
And their hired guns
Afghanistan: GNU/Linux Steadily Rises to 9%
Windows is steadily declining
IBM Innovation: It Has Invented New Methods of Silent Layoffs or Secret RAs
How IBM disguises mass layoffs now
LLM Slop Won't Replace People and Jobs (in the Long Run)
At the end of the day, people who know their job offer more useful information, whereas LLMs waste people's time (typically an 'externality' to the entity deploying chatbots)
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Monday, August 03, 2026
IRC logs for Monday, August 03, 2026
Over 3,500 Known Gemini Capsules Accessible and Active According to Lupa
It finally happened this morning
Gemini Links 04/08/2026: Library Cards, Dead Ends in Software Development, and DOS on USB Key
Links for the day
IBM Has Embraced and Rewarded Liars
The IBM culture vanished
statCounter Estimates GNU/Linux at 5.32% in Kuwait, Years Ago It Was Near 0%
Kuwait rose to fame in the 1990s because of a war
Swatting People Who Write About Corruption, Misogyny, Criminal Misuse of Funds
we've given ourselves a decade to cover all those stories
GNU/Linux Rises Above 6% in Colombia
In Colombia, which is a large south American country, GNU/Linux has risen steadily in recent years
SLAPP Censorship - Part 138 Out of 200: Garrett Has Basically "Lost" and It is "Embarrassing" to Them
they just wound up costing hundreds of thousands of pounds
Gemini Links 03/08/2026: Great Exodus, xkcd as Text, and Dead Ends
Links for the day
GNU/Linux Has Surged to 6.3% in Madagascar
Madagascar's adoption of Free software is a subject we covered a lot in past years
Microsoft's Slop Bet is Killing the XBox Even Faster
LLMs destroy almost anything they touch
The Cyber Show on "Weaponised Antisocial Technology"
by Andy
Alexandre Oliva on Slippery Slop (LLMs)
By Alexandre Oliva
RMS Won the Argument and Now GNU Wins Over Computer Users
He can look back at nearly 43 years of GNU and say, "I was right..."
statCounter Corrects GNU/Linux Estimates, Now Measured at 9% Worldwide
Windows has sunk like a rock
GNU/Linux-Centric Blogs Belatedly Pick Up News About GNU/Linux Gains: 4-8% Depending on the Surveyor
more people will get curious and give it a go
Links 03/08/2026: Strike By Flight Attendants (WestJet) and Greedflation
Links for the day
Links 03/08/2026: EU Curtailed Slop, Frank Zappa Recalled
Links for the day
Daniel Pocock on Sky News This Morning
No harm done
Morten Linderud Has Helped Microsoft Put Locks (and Kill Switches) on the PCs of Arch Linux Users
"the first rule of "secure boot" is to disable "secure boot"
In Poor Peru, GNU/Linux Surges From 1% to 5% in a Few Years
Windows is dying
All Social Control Media is a Weapon (Against Its Users, Serving the Real Owners)
That social control networks are weaponised isn't a new concept
Fanning the Flames of Journalism
This week we have several surprises coming
Forcing the Slop Bubble to Implode Fully to Save the Economy From an Even Greater Collapse and Societal Harm
Let's blow up the bubble. The sooner, the better
GNU/Linux at 8% in Croatia
somewhat of a GNU/Linux adoption hotbed
It's Easy to Predict Microsoft Layoffs for October 2026 Because of the Financial 'Results' That Month (More Faking, More Secret Debt and Buzzwords to Perfume This Debt as "Investment")
From what we've read, Microsoft is silently laying off people this month based on LITE, which leads to PIPs
Not Hard to Guess Who Will Pay for IBM's Collapse (Due to False Statements Made to Shareholders), Red Hat May Disappear
IBM's leadership is never being punished for its failures
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Sunday, August 02, 2026
IRC logs for Sunday, August 02, 2026
Gemini Links 03/08/2026: Collectibles, Cities of the Red Night, and Lali Lambda
Links for the day
IBM's August 2026 Promotions (Annual Ritual) Can Turn Into a "Bloodbath" (RAs, Layoffs)
IBM Common Stock is set to open in the red (minus) on Monday
Microsoft Culture Explained by People Who Work at Microsoft
"Be ready for politicking and working over time and weekends."
Codes of Conduct Attract Hoarders and Sociopaths, They Are Intolerant Towards Good People
Codes of Conduct (CoCs) are also promoted using violence
XBox is in Trouble, Sunday News Shows How Serious a Problem It Now Faces
it seems impossible to resuscitate at this point
statCounter Observes GNU/Linux at 10% in Libya
this month statCounter finally sees GNU/Linux approaching "double-figures" there
Thailand: GNU/Linux Approaching 15%, Windows in a Freefall
It makes perfect sense for Thailand to adopt GNU/Linux for technical reasons, not just political reasons
GNU/Linux in Bulgaria Back Up
part of a trend in Europe
Cuba Sees Leap in GNU/Linux Usage, as Reported by statCounter
For the ordinary Cuban it makes sense to reduce a dependence on GAFAM
Gemini Links 02/08/2026: Drift, Crawlers in Gopher Space, Purpose, and Python
Links for the day
Links 02/08/2026: Some Large Slop Investors "Crumbling", Russia Intensifies Bombing of Kiev
Links for the day
IBMers Discuss Who Killed IBM (It Impacts Red Hat)
Fedora is fast becoming like another CentOS
GNU/Linux Rises to 6% in Mexico
Did the soccer (football) matches have some impact or just the "unknowns" being deciphered (or omitted) by statCounter?
GNU/Linux Leaps to 8% in Asia
In Asia, is it a bit higher because of GAFAM distrust? Maybe some other factor/s?
Clownflare Web Usage Survey: About 10% in North America Use GNU/Linux, Worldwide 6.7%
surveyors that showed GNU/Linux growth
SLAPP Censorship - Part 137 Out of 200: Discovering That Spending a Million British Pounds (1,348,250.01 United States Dollars) on Lawyers Cannot Take Down One's Critics
just outright bullying and criminality
Steam Survey, analytics.usa.gov, and statCounter All Point to GNU/Linux Gains (Again)
This must be very annoying to Microsoft
GNU/Linux Exceeds 6% in Spain
In recent years the "market share" steadily grew from 3% to over 6%
Brazil: GNU/Linux Record High, 5%
On average, GNU/Linux has evidence of growth in many countries this summer
Amid 2026 Bing Layoffs Microsoft Share in Search Collapses
How much longer before Microsoft throws in the towel or rebrands again?
United Kingdom: GNU/Linux up to 7%, ChromeOS Another 5% (Total 12%)
further significant gains for GNU/Linux this month
Links 02/08/2026: Cheeto "Blurted Out Vile Plot to Censor ABC"; New York Times Fights 'Intimidation'
Links for the day
Why Techrights Will Still be Active a Decade From Now
Techrights will carry on for many years to come
We Are Witnessing the End of IBM
IBM cannot find growth by moving downwards, by lowering standards
The Slop Presumption Rule
Tainting oneself can take one day
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Saturday, August 01, 2026
IRC logs for Saturday, August 01, 2026
Gemini Links 02/08/2026: Older Books, Esperanto Music History, and Slop Making Things Worse
Links for the day