Skip to content

Commit

Permalink
ModemManager: Add port
Browse files Browse the repository at this point in the history
  • Loading branch information
Dennisbonke committed Jun 18, 2024
1 parent e8ee652 commit 9956d5f
Show file tree
Hide file tree
Showing 2 changed files with 147 additions and 0 deletions.
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'
- '@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
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

0 comments on commit 9956d5f

Please sign in to comment.