Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ModemManager #359

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions bootstrap.d/dev-libs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,72 @@ packages:
DESTDIR: '@THIS_COLLECT_DIR@'
quiet: true

- name: libgudev
architecture: '@OPTION:arch@'
metadata:
summary: GObject bindings for libudev
description: This package contains GObject bindings for libudev.
spdx: 'LGPL-2.1-or-later'
website: 'https://wiki.gnome.org/Projects/libgudev'
maintainer: "Dennis Bonke <[email protected]>"
categories: ['dev-libs']
source:
subdir: 'ports'
git: 'https://gitlab.gnome.org/GNOME/libgudev.git'
tag: '237' # DON'T BUMP, DOES NOT WORK WITH EUDEV
version: '237'
tools_required:
- system-gcc
- virtual: pkgconfig-for-target
triple: "@OPTION:arch-triple@"
- host-mlibc
- host-gobject-introspection
- host-python
- host-glib
pkgs_required:
- mlibc
- glib
- eudev
- gobject-introspection
revision: 1
configure:
- args:
- 'meson'
- 'setup'
- '--cross-file'
- '@SOURCE_ROOT@/scripts/meson-@OPTION:[email protected]'
- '--prefix=/usr'
- '--buildtype=release'
- '--wrap-mode=nodownload'
- '-Dintrospection=enabled'
- '-Dvapi=disabled'
- '-Dgtk_doc=false'
- '@THIS_SOURCE_DIR@'
environ:
# Same as below
RUN_WRAPPER_LD_LIBRARY_PATH: '@BUILD_ROOT@/tools/host-mlibc/lib:@SYSROOT_DIR@/usr/lib:@SYSROOT_DIR@/usr/lib64:@THIS_BUILD_DIR@/girepository'
RUN_WRAPPER_INTERP: '@BUILD_ROOT@/tools/host-mlibc/lib/ld.so'
build:
- args: ['ninja']
environ:
# Make python load host libraries instead of the ones in the rootfs
LD_LIBRARY_PATH: '@BUILD_ROOT@/tools/host-glib/lib:@BUILD_ROOT@/tools/host-glib/lib/x86_64-linux-gnu:@BUILD_ROOT@/tools/host-gobject-introspection/lib/x86_64-linux-gnu'
# Library path for our run-wrapper that allows it to load managarm libraries
RUN_WRAPPER_LD_LIBRARY_PATH: '@BUILD_ROOT@/tools/host-mlibc/lib:@SYSROOT_DIR@/usr/lib:@SYSROOT_DIR@/usr/lib64:@THIS_BUILD_DIR@/girepository'
# Similar to above, but using a nasty (but working) hack lets us use a Linux mlibc build to execute an
# executable that was cross-compiled for managarm
RUN_WRAPPER_INTERP: '@BUILD_ROOT@/tools/host-mlibc/lib/ld.so'
# This is a custom environment variable which tells g-ir-scanner what to use instead of ldd
# We point it at our native ldd-wrapper that's installed as part of host-gobject-introspection
GI_LDD_WRAPPER: ldd-wrapper
# This tells g-ir-scanner what program should be used for "cross-launching" the executables it builds
GI_CROSS_LAUNCHER: run-wrapper
# Path to the introspection data installed by other packages
GI_GIR_PATH: '@SYSROOT_DIR@/usr/share/gir-1.0'
- args: ['ninja', 'install']
environ:
DESTDIR: '@THIS_COLLECT_DIR@'

- name: libiconv
labels: [aarch64]
architecture: '@OPTION:arch@'
Expand Down
98 changes: 96 additions & 2 deletions bootstrap.d/net-libs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,15 @@ packages:
- host-pkg-config
- virtual: pkgconfig-for-target
triple: "@OPTION:arch-triple@"
- host-mlibc
- host-gobject-introspection
- host-python
- host-glib
pkgs_required:
- mlibc
- glib
revision: 4
- gobject-introspection
revision: 5
configure:
- args:
- 'meson'
Expand All @@ -138,12 +143,31 @@ packages:
- '@SOURCE_ROOT@/scripts/meson-@OPTION:[email protected]'
- '--prefix=/usr'
- '--buildtype=debugoptimized'
- '-Dintrospection=false'
- '-Dintrospection=true'
- '-Dbash_completion=false'
- '-Dman=false'
- '@THIS_SOURCE_DIR@'
environ:
# Same as below
RUN_WRAPPER_LD_LIBRARY_PATH: '@BUILD_ROOT@/tools/host-mlibc/lib:@SYSROOT_DIR@/usr/lib:@SYSROOT_DIR@/usr/lib64:@THIS_BUILD_DIR@/girepository'
RUN_WRAPPER_INTERP: '@BUILD_ROOT@/tools/host-mlibc/lib/ld.so'
build:
- args: ['ninja']
environ:
# Make python load host libraries instead of the ones in the rootfs
LD_LIBRARY_PATH: '@BUILD_ROOT@/tools/host-glib/lib:@BUILD_ROOT@/tools/host-glib/lib/x86_64-linux-gnu:@BUILD_ROOT@/tools/host-gobject-introspection/lib/x86_64-linux-gnu'
# Library path for our run-wrapper that allows it to load managarm libraries
RUN_WRAPPER_LD_LIBRARY_PATH: '@BUILD_ROOT@/tools/host-mlibc/lib:@SYSROOT_DIR@/usr/lib:@SYSROOT_DIR@/usr/lib64:@THIS_BUILD_DIR@/girepository'
# Similar to above, but using a nasty (but working) hack lets us use a Linux mlibc build to execute an
# executable that was cross-compiled for managarm
RUN_WRAPPER_INTERP: '@BUILD_ROOT@/tools/host-mlibc/lib/ld.so'
# This is a custom environment variable which tells g-ir-scanner what to use instead of ldd
# We point it at our native ldd-wrapper that's installed as part of host-gobject-introspection
GI_LDD_WRAPPER: ldd-wrapper
# This tells g-ir-scanner what program should be used for "cross-launching" the executables it builds
GI_CROSS_LAUNCHER: run-wrapper
# Path to the introspection data installed by other packages
GI_GIR_PATH: '@SYSROOT_DIR@/usr/share/gir-1.0'
- args: ['ninja', 'install']
environ:
DESTDIR: '@THIS_COLLECT_DIR@'
Expand Down Expand Up @@ -197,6 +221,76 @@ packages:
environ:
DESTDIR: '@THIS_COLLECT_DIR@'

- name: libqmi
architecture: '@OPTION:arch@'
metadata:
summary: Qualcomm MSM (Mobile Station Modem) Interface (QMI) modem protocol library
description: The libqmi package contains a GLib-based library for talking to WWAN modems and devices which speak the Qualcomm MSM Interface (QMI) protocol.
spdx: 'LGPL-2.0-only'
website: 'https://www.freedesktop.org/wiki/Software/libqmi/'
maintainer: "Dennis Bonke <[email protected]>"
categories: ['net-libs']
source:
subdir: 'ports'
git: 'https://gitlab.freedesktop.org/mobile-broadband/libqmi.git'
tag: '1.34.0'
version: '1.34.0'
tools_required:
- system-gcc
- host-pkg-config
- virtual: pkgconfig-for-target
triple: "@OPTION:arch-triple@"
- host-mlibc
- host-gobject-introspection
- host-python
- host-glib
pkgs_required:
- mlibc
- glib
- libgudev
- libmbim
- gobject-introspection
revision: 1
configure:
- args:
- 'meson'
- 'setup'
- '--cross-file'
- '@SOURCE_ROOT@/scripts/meson-@OPTION:[email protected]'
- '--prefix=/usr'
- '--buildtype=debugoptimized'
- '-Dintrospection=true'
- '-Dbash_completion=false'
- '-Drmnet=true'
- '-Dudev=true'
- '-Dqrtr=false'
- '-Dman=false'
- '@THIS_SOURCE_DIR@'
environ:
# Same as below
RUN_WRAPPER_LD_LIBRARY_PATH: '@BUILD_ROOT@/tools/host-mlibc/lib:@SYSROOT_DIR@/usr/lib:@SYSROOT_DIR@/usr/lib64:@THIS_BUILD_DIR@/girepository'
RUN_WRAPPER_INTERP: '@BUILD_ROOT@/tools/host-mlibc/lib/ld.so'
build:
- args: ['ninja']
environ:
# Make python load host libraries instead of the ones in the rootfs
LD_LIBRARY_PATH: '@BUILD_ROOT@/tools/host-glib/lib:@BUILD_ROOT@/tools/host-glib/lib/x86_64-linux-gnu:@BUILD_ROOT@/tools/host-gobject-introspection/lib/x86_64-linux-gnu'
# Library path for our run-wrapper that allows it to load managarm libraries
RUN_WRAPPER_LD_LIBRARY_PATH: '@BUILD_ROOT@/tools/host-mlibc/lib:@SYSROOT_DIR@/usr/lib:@SYSROOT_DIR@/usr/lib64:@THIS_BUILD_DIR@/girepository'
# Similar to above, but using a nasty (but working) hack lets us use a Linux mlibc build to execute an
# executable that was cross-compiled for managarm
RUN_WRAPPER_INTERP: '@BUILD_ROOT@/tools/host-mlibc/lib/ld.so'
# This is a custom environment variable which tells g-ir-scanner what to use instead of ldd
# We point it at our native ldd-wrapper that's installed as part of host-gobject-introspection
GI_LDD_WRAPPER: ldd-wrapper
# This tells g-ir-scanner what program should be used for "cross-launching" the executables it builds
GI_CROSS_LAUNCHER: run-wrapper
# Path to the introspection data installed by other packages
GI_GIR_PATH: '@SYSROOT_DIR@/usr/share/gir-1.0'
- args: ['ninja', 'install']
environ:
DESTDIR: '@THIS_COLLECT_DIR@'

- name: libsoup
architecture: '@OPTION:arch@'
metadata:
Expand Down
109 changes: 109 additions & 0 deletions bootstrap.d/net-misc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,115 @@ packages:
- args: ['cp', '@THIS_BUILD_DIR@/services', '@THIS_COLLECT_DIR@/etc/']
- args: ['cp', '@THIS_BUILD_DIR@/protocols', '@THIS_COLLECT_DIR@/etc/']

- name: modemmanager
architecture: '@OPTION:arch@'
metadata:
summary: Modem and mobile broadband management libraries
description: ModemManager provides a unified high level API for communicating with mobile broadband modems, regardless of the protocol used to communicate with the actual device.
spdx: 'GPL-2.0-or-later'
website: 'https://www.freedesktop.org/wiki/Software/ModemManager/'
maintainer: "Dennis Bonke <[email protected]>"
categories: ['net-misc']
source:
subdir: 'ports'
git: 'https://gitlab.freedesktop.org/mobile-broadband/ModemManager.git'
tag: '1.22.0'
version: '1.22.0'
tools_required:
- system-gcc
- host-pkg-config
- virtual: pkgconfig-for-target
triple: "@OPTION:arch-triple@"
- host-mlibc
- host-gobject-introspection
- host-python
- host-glib
- host-vala
pkgs_required:
- mlibc
- glib
- libgudev
- libmbim
- libqmi
- gobject-introspection
revision: 1
configure:
- args:
- 'meson'
- 'setup'
- '--cross-file'
- '@SOURCE_ROOT@/scripts/meson-@OPTION:[email protected]'
- '--prefix=/usr'
- '--buildtype=debugoptimized'
- '-Dintrospection=true'
- '-Dbash_completion=false'
- '-Dudev=true'
- '-Dqrtr=false'
- '-Dman=false'
- '-Dsystemd_journal=false'
- '-Dpolkit=no'
- '-Dvapi=true'
- '-Dsystemd_suspend_resume=false'
- '-Dsystemdsystemunitdir=no'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- '-Dudevdir=/usr/lib/udev/' should be supplied here.

- '@THIS_SOURCE_DIR@'
environ:
# Same as below
RUN_WRAPPER_LD_LIBRARY_PATH: '@BUILD_ROOT@/tools/host-mlibc/lib:@SYSROOT_DIR@/usr/lib:@SYSROOT_DIR@/usr/lib64:@THIS_BUILD_DIR@/girepository'
RUN_WRAPPER_INTERP: '@BUILD_ROOT@/tools/host-mlibc/lib/ld.so'
# Wrapper to add our valadir
VAPIGEN: 'cross-vapigen'
# Wrapper to add our valadir
VALAC: 'cross-valac'
build:
- args: ['ninja']
environ:
# Make python load host libraries instead of the ones in the rootfs
LD_LIBRARY_PATH: '@BUILD_ROOT@/tools/host-glib/lib:@BUILD_ROOT@/tools/host-glib/lib/x86_64-linux-gnu:@BUILD_ROOT@/tools/host-gobject-introspection/lib/x86_64-linux-gnu'
# Library path for our run-wrapper that allows it to load managarm libraries
RUN_WRAPPER_LD_LIBRARY_PATH: '@BUILD_ROOT@/tools/host-mlibc/lib:@SYSROOT_DIR@/usr/lib:@SYSROOT_DIR@/usr/lib64:@THIS_BUILD_DIR@/girepository'
# Similar to above, but using a nasty (but working) hack lets us use a Linux mlibc build to execute an
# executable that was cross-compiled for managarm
RUN_WRAPPER_INTERP: '@BUILD_ROOT@/tools/host-mlibc/lib/ld.so'
# This is a custom environment variable which tells g-ir-scanner what to use instead of ldd
# We point it at our native ldd-wrapper that's installed as part of host-gobject-introspection
GI_LDD_WRAPPER: ldd-wrapper
# This tells g-ir-scanner what program should be used for "cross-launching" the executables it builds
GI_CROSS_LAUNCHER: run-wrapper
# Path to the introspection data installed by other packages
GI_GIR_PATH: '@SYSROOT_DIR@/usr/share/gir-1.0'
VALADIR: '@SYSROOT_DIR@/usr/share/vala/vapi'
# Wrapper to add our valadir
VALAC: 'cross-valac'
# Wrapper to add our valadir
VAPIGEN: 'cross-vapigen'
- args: ['ninja', 'install']
environ:
DESTDIR: '@THIS_COLLECT_DIR@'
# Make python load host libraries instead of the ones in the rootfs
LD_LIBRARY_PATH: '@BUILD_ROOT@/tools/host-glib/lib:@BUILD_ROOT@/tools/host-glib/lib/x86_64-linux-gnu:@BUILD_ROOT@/tools/host-gobject-introspection/lib/x86_64-linux-gnu'
# Library path for our run-wrapper that allows it to load managarm libraries
RUN_WRAPPER_LD_LIBRARY_PATH: '@BUILD_ROOT@/tools/host-mlibc/lib:@SYSROOT_DIR@/usr/lib:@SYSROOT_DIR@/usr/lib64:@THIS_BUILD_DIR@/girepository'
# Similar to above, but using a nasty (but working) hack lets us use a Linux mlibc build to execute an
# executable that was cross-compiled for managarm
RUN_WRAPPER_INTERP: '@BUILD_ROOT@/tools/host-mlibc/lib/ld.so'
# This is a custom environment variable which tells g-ir-scanner what to use instead of ldd
# We point it at our native ldd-wrapper that's installed as part of host-gobject-introspection
GI_LDD_WRAPPER: ldd-wrapper
# This tells g-ir-scanner what program should be used for "cross-launching" the executables it builds
GI_CROSS_LAUNCHER: run-wrapper
# Path to the introspection data installed by other packages
GI_GIR_PATH: '@SYSROOT_DIR@/usr/share/gir-1.0'
VALADIR: '@SYSROOT_DIR@/usr/share/vala/vapi'
# Wrapper to add our valadir
VALAC: 'cross-valac'
# Wrapper to add our valadir
VAPIGEN: 'cross-vapigen'
- args: ['touch', '@THIS_COLLECT_DIR@/etc/ModemManager/.keep']
- args: ['touch', '@THIS_COLLECT_DIR@/etc/ModemManager/connection.d/.keep']
- args: ['touch', '@THIS_COLLECT_DIR@/etc/ModemManager/fcc-unlock.d/.keep']
- args: ['touch', '@THIS_COLLECT_DIR@/usr/lib/ModemManager/connection.d/.keep']
- args: ['touch', '@THIS_COLLECT_DIR@/usr/lib/ModemManager/fcc-unlock.d/.keep']

- name: rsync
architecture: '@OPTION:arch@'
source:
Expand Down
25 changes: 25 additions & 0 deletions patches/libqmi/0001-Add-missing-_GNU_SOURCE-define.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
From 2bb74b9cfea19838b1fb4c175caec5377a5a94fa Mon Sep 17 00:00:00 2001
From: Dennis Bonke <[email protected]>
Date: Tue, 18 Jun 2024 21:07:19 +0200
Subject: [PATCH] Add missing _GNU_SOURCE define

Signed-off-by: Dennis Bonke <[email protected]>
---
src/qmi-firmware-update/qfu-at-device.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/src/qmi-firmware-update/qfu-at-device.c b/src/qmi-firmware-update/qfu-at-device.c
index 89005bd..aeeeed0 100644
--- a/src/qmi-firmware-update/qfu-at-device.c
+++ b/src/qmi-firmware-update/qfu-at-device.c
@@ -19,6 +19,7 @@
* Copyright (C) 2016-2017 Aleksander Morgado <[email protected]>
*/

+#define _GNU_SOURCE
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
--
2.45.2

38 changes: 38 additions & 0 deletions patches/modemmanager/0001-Add-Managarm-support.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
From b11885c2054f62a5db2d6122802deded561fe6e4 Mon Sep 17 00:00:00 2001
From: Dennis Bonke <[email protected]>
Date: Tue, 18 Jun 2024 21:27:13 +0200
Subject: [PATCH] Add Managarm support

Signed-off-by: Dennis Bonke <[email protected]>
---
libqcdm/src/com.c | 1 +
src/mm-port-serial-qcdm.c | 1 +
2 files changed, 2 insertions(+)

diff --git a/libqcdm/src/com.c b/libqcdm/src/com.c
index d6283e0..3b63c82 100644
--- a/libqcdm/src/com.c
+++ b/libqcdm/src/com.c
@@ -15,6 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

+#define _GNU_SOURCE
#include <errno.h>
#include <termios.h>
#include <fcntl.h>
diff --git a/src/mm-port-serial-qcdm.c b/src/mm-port-serial-qcdm.c
index 08f2430..91262bf 100644
--- a/src/mm-port-serial-qcdm.c
+++ b/src/mm-port-serial-qcdm.c
@@ -18,6 +18,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
+#include <endian.h>

#include <ModemManager.h>
#include <mm-errors-types.h>
--
2.45.2

Loading