Modify a Raspberry PLC / Touchberry Image
Raspberry Family
5 September, 2022 by
Modify a Raspberry PLC / Touchberry Image
Boot & Work Corp. S.L., Quesada Dani Salvans
Odoo • Image and Text

Introduction

In this post you will see how to modify a Raspberry unmounted to make the changes required by the user and save them on a uSD card.

This is very useful to create custom images and replicate them in several industrial PLC controllers. 

Requirements

Any of our Raspberry PLCs can be used here:

Raspberry image

Raspberry Image >>

You can use an official one or one from our repository, already modified for our products.

Linux based PC

Linux based PC

It will be the operating system used in this tutorial so it is much easier to interact with compared to Windows or Macintosh.

Step-by-step process

In this example, we will work with the following image of our repository: 

https://apps.industrialshields.com/main/rpi/images/2022-01-28-raspios-bullseye-armhf-lite-raspberry-plc-v4-20220428174519.zip


1. Mount Raspbian partition

  • Create a new mountpoint

    • mkdir mountpoint
  • Find the Raspbian partition in the disk image (you must find here the start sector of the second partition (532480). In order to calculate the offset of the partition you have to multiply this number by 512 bytes.

    • file 2022-01-28-raspios-bullseye-armhf-lite-raspberry-plc-v4-20220428174519.img
      Raspbian partition
  • Mount partition

    • sudo mount 2022-01-28-raspios-bullseye-armhf-lite-raspberry-plc-v4-20220428174519.img -o offset=$[512*532480] mountpoint


2. Make changes in the Raspbian image

Here you can make all the required modifications to the image by directly accessing to the mountpoint folder previously created, where the mounted image is located. A couple of examples of changes can be the WLAN configurating or the enabling of the SSH server. 


3. Unmount the disk image

When all the modifications are finished, you can unmount the image again. 

    • sudo unmount mountpoint


4. Write the image

You can write the image as commonly to the uSD card (you must take into account that all the data will be lost at the device /dev/sdb):

    • sudo dd bs=4M if=2022-01-28-raspios-bullseye-armhf-lite-raspberry-plc-v4-20220428174519.img of=/dev/sdb

5. Flush the write cache

Before removing the uSD card, you must execute the following command:

    • sync

And wait for the prompt. If your computer has detected the new partitions at the uSD card and mounted them automatically, please unmount them again. Now it is safe to remove the uSD card from the computer. 

Odoo • Image and Text

Done!

Now you know how to modify an unmounted Raspberry to make the changes and save them on a uSD card.

Latest Posts


Find what you are looking for
Search in our Blog

Modify a Raspberry PLC / Touchberry Image
Boot & Work Corp. S.L., Quesada Dani Salvans
5 September, 2022
Share this post
Archive

Looking for your ideal Programmable Logic Controller?

Take a look at this product comparison with other industrial controllers Arduino-based. 

We are comparing inputs, outputs, communications and other features with the ones of the relevant brands.


Industrial PLC comparison >>>

Do you want more information?

Just fill the form!

Tell me more!