Well, rolling your own gadget with additional serial interfaces is rather trivial:
- install snapcraft:
snap install snapcraft --classic
- clone the gadget source tree
git clone https://github.com/snapcore/pc-amd64-gadget.git
cd pc-amd64-gadget
- now edit snapcraft.yaml and append something like (this would be for four RS232 ports, i’m not sure how RS485 shows up in /dev, you would have to adjust accordingly):
slots:
serial0:
interface: serial-port
path: /dev/ttyS0
serial1:
interface: serial-port
path: /dev/ttyS1
serial2:
interface: serial-port
path: /dev/ttyS2
serial3:
interface: serial-port
path: /dev/ttyS3
- and now you just call
snapcraft
in the source dir and a gadget snap gets produced.
To build an image with this gadget snap you do the following:
- install ubuntu-image:
snap install ubuntu-image --beta --classic
- get the model assertion (image description and signature):
snap known --remote model series=16 model=pc-amd64 brand-id=canonical >pc.model
- now tell ubuntu-image to build a new image that includes the new gadget snap:
sudo ubuntu-image --channel stable --extra-snaps /path/to/your/gadget.snap /path/to/pc.model
this produces a new “pc.img” file, that you can write to the HDD of your device.