Skip to content

Commit 4a6aed6

Browse files
committed
Implement agent in Go controlling ModemManager
This large commit completely reworks the wwan microservice. Instead of the (rather limited) shell script controlling modems using QMI/MBIM CLI tools, EVE will now use ModemManager for the management of cellular connectivity just like many standard Linux distributions. However, instead of using NetworkManager, which does not fit into EVE architecture and requirements, we implement our own thin microservice "mmagent", operating in between pillar and ModemManager. More info is here: https://wiki.lfedge.org/display/EVE/ModemManager+Evaluation and in the comprehensive documentation which comes with the next commit. Signed-off-by: Milan Lenco <milan@zededa.com>
1 parent d7cea6b commit 4a6aed6

File tree

1,311 files changed

+403726
-2665
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,311 files changed

+403726
-2665
lines changed

pkg/wwan/Dockerfile

Lines changed: 57 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,81 @@
11
# syntax=docker/dockerfile-upstream:1.5.0-rc2-labs
2-
FROM lfedge/eve-alpine:9fb9b9cbf7d90066a70e4704d04a6fe248ff52bb as build
3-
ENV BUILD_PKGS automake autoconf gettext gettext-dev git pkgconfig \
4-
libtool libc-dev linux-headers gcc make glib-dev \
5-
autoconf-archive patch cmake gtk-doc go
6-
ENV PKGS alpine-baselayout musl-utils ppp jq glib
2+
FROM lfedge/eve-alpine:29dc7661e9c3dcd0ec7ef9b98d2df58354d85fc0 as build
3+
ENV BUILD_PKGS meson ninja git libc-dev glib-dev make gcc dbus-dev libgudev-dev go
4+
ENV PKGS alpine-baselayout dbus glib udev libgudev
75
RUN eve-alpine-deploy.sh
86

9-
ENV LIBUBOX_COMMIT=7da66430de3fc235bfc6ebb0b85fb90ea246138d
10-
ENV JSONC_COMMIT=ed54353d8478ccdb8296c33c675662d16d68b40d
11-
ENV INOTIFY_TOOLS_COMMIT=3.20.11.0
7+
ENV MM_VERSION=1.20.6
8+
ENV LIBMBIM_VERSION=1.28.4
9+
ENV LIBQMI_VERSION=1.32.4
10+
ENV LIBQRTR_VERSION=1.2.2
1211
ENV PICOCOM_COMMIT=1acf1ddabaf3576b4023c4f6f09c5a3e4b086fb8
13-
ENV LIBQMI_COMMIT=1.30.8
14-
ENV LIBMBIM_COMMIT=1.26.4
1512

16-
ADD --keep-git-dir=true https://github.com/json-c/json-c.git#${JSONC_COMMIT} /json-c
17-
WORKDIR /json-c
18-
RUN ./autogen.sh && ./configure && make install
13+
ADD --keep-git-dir=true https://gitlab.freedesktop.org/mobile-broadband/libqrtr-glib.git#${LIBQRTR_VERSION} /libqrtr
14+
WORKDIR /libqrtr
15+
RUN meson build --buildtype=release --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib \
16+
-Dgtk_doc=false -Dintrospection=false && \
17+
ninja -C build && \
18+
ninja -C build install
1919

20-
ADD --keep-git-dir=true https://git.openwrt.org/project/libubox.git#${LIBUBOX_COMMIT} /libubox
21-
WORKDIR /libubox
22-
RUN cmake . -DBUILD_LUA=OFF -DBUILD_EXAMPLES=OFF && make install
23-
24-
ADD --keep-git-dir=true https://gitlab.freedesktop.org/mobile-broadband/libmbim.git#${LIBMBIM_COMMIT} /libmbim
20+
ADD --keep-git-dir=true https://gitlab.freedesktop.org/mobile-broadband/libmbim.git#${LIBMBIM_VERSION} /libmbim
2521
WORKDIR /libmbim
26-
COPY patches/libmbim/*.patch /tmp/patches/libmbim/
27-
RUN for patch in /tmp/patches/libmbim/*.patch ; do patch -p1 < "$patch" ; done
28-
RUN ./autogen.sh && ./configure --prefix=/usr && make -j "$(getconf _NPROCESSORS_ONLN)" && make install
22+
RUN meson build --buildtype=release --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib \
23+
-Dbash_completion=false -Dintrospection=false -Dman=false && \
24+
ninja -C build && \
25+
ninja -C build install
2926

30-
ADD --keep-git-dir=true https://gitlab.freedesktop.org/mobile-broadband/libqmi.git#${LIBQMI_COMMIT} /libqmi
27+
ADD --keep-git-dir=true https://gitlab.freedesktop.org/mobile-broadband/libqmi.git#${LIBQMI_VERSION} /libqmi
3128
WORKDIR /libqmi
32-
RUN ./autogen.sh --without-udev && ./configure --prefix=/usr --without-udev --enable-mbim-qmux && make -j "$(getconf _NPROCESSORS_ONLN)" && make install
29+
RUN meson build --buildtype=release --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib \
30+
-Dbash_completion=false -Dintrospection=false -Dman=false && \
31+
ninja -C build && \
32+
ninja -C build install
3333

34-
ADD --keep-git-dir=true https://github.com/inotify-tools/inotify-tools.git#${INOTIFY_TOOLS_COMMIT} /inotify-tools
35-
WORKDIR /inotify-tools
36-
RUN ./autogen.sh && ./configure --prefix=/usr && make -j "$(getconf _NPROCESSORS_ONLN)" && make install
34+
ADD --keep-git-dir=true https://gitlab.freedesktop.org/mobile-broadband/ModemManager.git#${MM_VERSION} /mm
35+
WORKDIR /mm
36+
RUN meson build --buildtype=release --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib \
37+
-Dmbim=true -Dqmi=true -Dbash_completion=false -Dintrospection=false -Dpolkit=no \
38+
-Dsystemd_suspend_resume=false -Dsystemdsystemunitdir=no -Dsystemd_journal=false && \
39+
ninja -C build && \
40+
ninja -C build install
3741

3842
ADD --keep-git-dir=true https://github.com/npat-efault/picocom.git#${PICOCOM_COMMIT} /picocom
3943
WORKDIR /picocom
4044
# Need this patch to build with musl: https://github.com/npat-efault/picocom/commit/1acf1ddabaf3576b4023c4f6f09c5a3e4b086fb8
4145
RUN make -j "$(getconf _NPROCESSORS_ONLN)" && strip picocom && cp picocom /usr/bin/
4246

43-
RUN strip /usr/bin/*cli /usr/libexec/*proxy /usr/lib/libmbim*.so.* /usr/lib/libqmi*.so.* /usr/lib/libinotifytools*.so.*
47+
RUN strip /usr/bin/*cli /usr/libexec/*proxy
48+
49+
RUN mkdir -p /var/run/dbus/
4450

45-
COPY decryptpasswd /decryptpasswd
46-
WORKDIR /decryptpasswd
47-
RUN CGO_ENABLED=0 go build -ldflags="-s -w" -v
51+
COPY mmagent /mmagent
52+
WORKDIR /mmagent
53+
RUN CGO_ENABLED=0 go build -v
4854

49-
# second stage (new-ish Docker feature) for smaller image
5055
FROM scratch
5156

5257
ENTRYPOINT []
5358
WORKDIR /
5459
COPY --from=build /out/ /
55-
COPY --from=build /usr/bin/qmicli /usr/bin/mbimcli /usr/bin/inotify* /usr/bin/picocom /bin/
56-
COPY --from=build /usr/lib/libmbim*.so.[0-9] /usr/lib/libqmi*.so.[0-9] /usr/lib/
57-
COPY --from=build /usr/lib/libinotifytools*.so.[0-9] /usr/lib/
60+
61+
# Only for troubleshooting purposes.
62+
COPY --from=build /usr/bin/mmcli /usr/bin/qmicli /usr/bin/mbimcli /usr/bin/picocom /usr/bin/
63+
5864
COPY --from=build /usr/libexec/*proxy /usr/libexec/
59-
COPY --from=build /decryptpasswd/decryptpasswd /usr/bin/
60-
COPY usr/ /usr/
61-
COPY etc/ /etc/
62-
CMD ["/usr/bin/wwan-init.sh"]
65+
COPY --from=build /usr/sbin/ModemManager /usr/bin/
66+
COPY --from=build /mmagent/mmagent /usr/bin/
67+
68+
COPY --from=build /usr/lib/libqrtr*.so.[0-9] /usr/lib/
69+
COPY --from=build /usr/lib/libmbim*.so.[0-9] /usr/lib/libqmi*.so.[0-9] /usr/lib/
70+
COPY --from=build /usr/lib/libmm*.so.[0-9] /usr/lib/
71+
72+
COPY --from=build /etc/ModemManager /etc/ModemManager
73+
COPY --from=build /usr/lib/ModemManager /usr/lib/ModemManager
74+
COPY --from=build /usr/share/ModemManager /usr/share/ModemManager
75+
76+
COPY --from=build /etc/dbus-1 /etc/dbus-1
77+
COPY --from=build /usr/share/dbus-1 /usr/share/dbus-1
78+
COPY --from=build /lib/udev/rules.d /lib/udev/rules.d
79+
80+
COPY mm-init.sh /usr/bin/mm-init.sh
81+
CMD ["/usr/bin/mm-init.sh"]

pkg/wwan/build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ config:
55
- /lib/modules:/lib/modules
66
- /dev:/dev
77
- /run:/run
8+
- /:/hostfs
9+
- /persist:/persist:rshared,rbind
810
net: host
911
capabilities:
1012
- all

pkg/wwan/decryptpasswd/decryptpasswd.go

Lines changed: 0 additions & 82 deletions
This file was deleted.

pkg/wwan/decryptpasswd/go.mod

Lines changed: 0 additions & 5 deletions
This file was deleted.

pkg/wwan/decryptpasswd/go.sum

Lines changed: 0 additions & 2 deletions
This file was deleted.

pkg/wwan/decryptpasswd/vendor/golang.org/x/crypto/pbkdf2/pbkdf2.go

Lines changed: 0 additions & 77 deletions
This file was deleted.

pkg/wwan/decryptpasswd/vendor/modules.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

pkg/wwan/etc/ppp/ip-up

Lines changed: 0 additions & 50 deletions
This file was deleted.

pkg/wwan/etc/ppp/peers/vzwinternet

Lines changed: 0 additions & 20 deletions
This file was deleted.

pkg/wwan/etc/ppp/peers/vzwinternet.chat

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)