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

Introduction

In this post we will see how to modify a Raspberry unmounted image in order to make changes required by the user and burn it to a uSD card. This is very useful to create personalized images and replicate them in several PLCs. 


Requirements

Any of our Raspberry based devices can be used here:


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

  • 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 on the image directly accessing to the mountpoint folder previously created, where the mounted image is located. A couple of change examples can be configuring the WLAN settings or enabling 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 have 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. 

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!