Initial commit
This commit is contained in:
commit
67d42aab81
|
@ -0,0 +1 @@
|
|||
.DS_Store
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"cSpell.words": [
|
||||
"FOME",
|
||||
"socat"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
FROM ubuntu:latest
|
||||
|
||||
WORKDIR /sim
|
||||
|
||||
COPY add-ubuntu-latest-apt-mirrors.sh .
|
||||
|
||||
RUN ./add-ubuntu-latest-apt-mirrors.sh \
|
||||
&& apt update \
|
||||
&& apt upgrade -y \
|
||||
&& apt install -y \
|
||||
gcc \
|
||||
gcc-multilib \
|
||||
g++-multilib \
|
||||
netbase \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY bundle/fome_simulator ./fome_simulator
|
||||
RUN chmod +x fome_simulator
|
||||
|
||||
EXPOSE 29001
|
||||
EXPOSE 29002
|
||||
|
||||
CMD ["/sim/fome_simulator"]
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2023 Piotr Rogowski
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
|
@ -0,0 +1,60 @@
|
|||
# FOME Simulator in Docker
|
||||
|
||||
It's just a [FOME firmware](https://github.com/FOME-Tech/fome-fw) simulator, but cross-platform.
|
||||
|
||||
## Running
|
||||
|
||||
```bash
|
||||
docker compose up
|
||||
```
|
||||
|
||||
## Using TCP
|
||||
|
||||
Docker container exposes TCP ports `29001` and `29002`.
|
||||
|
||||
Verify TCP connection:
|
||||
|
||||
```bash
|
||||
telnet localhost 29001
|
||||
```
|
||||
|
||||
```logs
|
||||
Trying ::1...
|
||||
Connected to localhost.
|
||||
Escape character is '^]'.
|
||||
```
|
||||
|
||||
Docker logs:
|
||||
|
||||
```logs
|
||||
...
|
||||
fome-simulator-docker-sim-1 | Init: connection on SD1
|
||||
```
|
||||
|
||||
### TS Setup
|
||||
|
||||
![TS](docs/ts.png)
|
||||
|
||||
## Using Virtual Serial Port
|
||||
|
||||
### Linux
|
||||
|
||||
Install [socat](http://www.dest-unreach.org/socat/).
|
||||
|
||||
Bind TCP to virtual serial port:
|
||||
|
||||
```bash
|
||||
socat pty,link=/dev/virtualcom0,raw tcp:localhost:29001
|
||||
```
|
||||
|
||||
### macOS
|
||||
|
||||
Does not work on macOS, because of *System Integrity Protection*. Must use TCP instead.
|
||||
|
||||
## TODO
|
||||
|
||||
- [ ] Add FOME release `bundle` as a volume once the Linux binary is there
|
||||
|
||||
## Issues
|
||||
|
||||
CPU usage is always 100%, wtf?
|
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# run as root
|
||||
|
||||
touch /etc/apt/sources.list.d/ubuntu-latest-mirrors.list
|
||||
for mirror in \
|
||||
'http://ubuntu.osuosl.org/ubuntu/' \
|
||||
'http://mirrors.ocf.berkeley.edu/ubuntu/' \
|
||||
; do
|
||||
cat /etc/apt/sources.list >> /etc/apt/sources.list.d/ubuntu-latest-mirrors.list
|
||||
sed "s#http://azure.archive.ubuntu.com/ubuntu/#$mirror#" -i /etc/apt/sources.list.d/ubuntu-latest-mirrors.list
|
||||
done
|
||||
|
||||
apt-get -o Acquire::Retries=3 update
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
@ -0,0 +1,7 @@
|
|||
services:
|
||||
sim:
|
||||
platform: linux/amd64
|
||||
build: .
|
||||
ports:
|
||||
- "29001:29001"
|
||||
- "29002:29002"
|
Binary file not shown.
After Width: | Height: | Size: 90 KiB |
Loading…
Reference in New Issue