What is the incredibly useful Raspbian Portability Script?
A couple of months ago I noticed a post on social media about Libre Computer’s Raspbian Portability Script and I was intrigued. A Single Board Computer manufacturer that is putting money and resources into boards that aren’t the Raspberry Pi? Not just that, they’re actively trying to make it easier for people to come across from their Raspberry Pi boards.
Note: This post contains Amazon affiliate links so if you click on these and make a purchase, I may receive a small commission that helps to produce content like this.
What is the script?
At its core, the Libre Computer Raspbian Portability script has been designed to take a Raspbian/Raspberry Pi OS operating system and modify it so that it can be used on a Libre Computer SBC.
On a basic level, it achieves this by modifying the files within the Raspberry Pi OS microSD card to include the necessary files to boot your Libre Computer SBC from the same OS image.
On a slightly deeper level, it will stop/remove the Raspberry Pi OS’s
rpi-eeprom-update service and begin downloading and installing a suitable upstream kernel that can then be used to boot the new device. It will also configure GRUB so that it can be booted properly.
The kicker in this is that in theory, you should then be able to use it again back in the Raspberry Pi should you need to go back. Sounds cool, right? Let’s put it to the test.
What are we testing today?
The Raspbian Portability Script supports the all-h3-cc-h3/h5 (Tritium), aml-s805x-ac (La Frite), aml-s905x-cc (Le Potato), roc-rk3328-cc (Renegade), and roc-rk3399-pc (Renegade Elite) boards. Do ensure that you use the correct architecture in your image for your chosen 2 boards as not all Raspberry Pis will run a 64-bit image.
In light of this, I’ll be using the Libre Computer Renegade Elite and the Raspberry Pi 4 as I quite like the idea of doing a comparison of these in the future, and using the same image seems like a good idea!
Things to note!
There are a couple of differences in terms of hardware between the Libre Computer and Raspberry Pi boards (as you’d expect!) but one of the biggest ones is that none of the Libre Computer boards offer WiFi functionality so if you set your WiFi SSID/password using the Pi OS Imager, this won’t be used on the Libre Computer and you’ll need to use an RJ45 Ethernet cable to reach your device. It’s important to know too that you must have internet connectivity on your starting Raspberry Pi to be able to download the necessary packages/software.
You should also understand that the GPIOs and Device Tree Overlays for I2C, SPI, UART, and PWM would require some further tinkering so that they work like for like. I’m not going to go over that in this particular piece but their Github page for the Wiring Tool project has the steps and information required.
In addition, as the MIPI cameras, DPI displays, and DSI panels are pieces of Raspberry Pi-specific hardware, these would not be supported on the Libre Computers with the same image.
Finally, the software is provided as-is, and not every combination has been fully tested, nor is it guaranteed to work. If you’re working with an existing image that has important files on it, please perform a full backup before running this script.
How to use the Raspbian Portability Script
Download Raspberry Pi OS
I’ll be using the Raspberry Pi 4 here so we’re fine to use a 64-bit version of Raspberry Pi OS Lite. The quickest way to source the latest image and write it to your SD card will be to use the Raspberry Pi OS Imager.
Boot the Raspberry Pi using the new microSD Card
You need to boot into Raspberry Pi OS to run the script, so take your microSD card (I’m using my favourite Amazon Basics microSD card for this) and place it into your Raspberry Pi 4 before booting up.
Download and run the Raspbian Portability Script
Update and upgrade the Raspberry Pi OS once booted:
$ sudo apt update
$ sudo apt upgrade
Install the necessary packages and download the script:
$ sudo apt install -y git
$ git clone https://github.com/libre-computer-project/libretech-raspbian-portability.git lrp
We can then run the script with the chosen board selected:
$ sudo lrp/oneshot.sh roc-rk3399-pc
continue to confirm you wish to go ahead and wait a couple of minutes to complete (it may take longer on older, less powerful Raspberry Pis!) Once done, it will ask you to shut down the Pi by pressing any key to confirm.
Note: If you’re not using the roc-rk3399-pc (Renegade Elite) then you’ll want to run the following so the script will output the support options. You can then run the command with the appropriate board name to convert your OS installation.
$ sudo lrp/oneshot.sh
Booting the Libre Computer Board
Now you have the modified image on the microSD card, place it in the Libre Computer board, connect an RJ45 Ethernet cable (or HDMI/keyboard if you prefer), and power it up.
After a couple of minutes, you should see the device pop up on your network (you’ll also see a flashing activity LED on the board itself to indicate life) meaning that it’s ready to go!
I’ll get to more extensive testing in the near future, however, at this time I’ve been able to confirm everything I’d initially expected to work, did (except the ones noted toward the beginning of this post).
Does raspi-config still work?
The utility does still load and depending on what you’re trying to do, it will still work with your Libre Computer board. If you’re looking to modify options that related to GPIO headers then you’re going to need to look into their wiring tool to translate these.
Realistically, anything that’s related to the operating system itself is going to work just fine. Updating raspi-config, changing your hostname, modifying your password, etc will all work as expected, along with updating your locales/timezones.
What if I put it back in the Raspberry Pi 4?
We confirmed it worked initially and we know it now works on the Libre Computer Renegade Elite, but what happens if we put it back in the Raspberry Pi 4 we started with?
The answer is that you get a booted system back on kernel 5.15.74-v8+ and a working Raspberry Pi 4 running Raspberry Pi OS!
I really like the idea of this script as during the Raspberry Pi shortages we’re still seeing (and are likely to see into mid-late 2023), it offers a very real alternative in the form of Libre Computer’s lineup. If you’re comfortable with the Raspberry Pi OS and the software support surrounding that, you’re going to be able to continue using it with a Libre Computer board. You may even have an old, dead Raspberry Pi that you can take the operating system from!
After moaning about software support on some of the previous single-board computers I’ve worked with, being able to see options like these portability/wiring tools and the commitment to supporting and offering mainstream Linux builds for all of their boards is honestly so refreshing.
This is why I’m excited to say that I’ll have content covering 4 of their computers (La Frite, Le Potato, Renegade, and Renegade Elite) in the coming month or so, along with heatsinks and accessories so keep your eyes peeled for that!