QMI-RIL » History » Revision 14
« Previous |
Revision 14/33
(diff)
| Next »
Wolfgang Wiedmeyer, 06/24/2017 01:06 PM
complete build instructions
QMI-RIL¶
This page covers development efforts to create a Radio Interface Layer (RIL) for modems that use the Qualcomm MSM Interface (QMI) protocol. The work is currently carried out for the Galaxy S 3 4G (I9305) which has a Qualcomm MDM9615 modem. The Galaxy Note 2 4G (t0lte) uses the same modem and this device could be supported as well in Replicant when the QMI-RIL is ready. We will hopefully identify further candidates that have an isolated modem using the QMI protocol and for which Replicant support could be added. Among the non-Android devices, the iPhone 5 is one that uses the MDM9615 modem as well.
relevant thread on libqmi mailing list
Modem boot¶
When the MDM9615 modem is activated, it first boots into a download mode. There, firmware, bootloaders and EFS files are uploaded to the modem via a serial interface. The used protocol is called SAHARA and it is a proprietary protocol developed by Qualcomm. The protocol covers various functionalities. We will likely only need to implement a very small subset that is responsible for transferring firmware and other files to the modem and possibly synchronising changes to EFS files with the filesystem.
Qualcomm provides the proprietary tool kickstart for uploading the files to the modem. It is run by the daemon qcks. The options qcks supplies to kickstart show which files need to be transferred:
/system/bin/ks -v -w /data/cp_log/ -p /dev/ttyUSB0 -f 0 -r 21 -s 2:/firmware/image/amss.mbn -s 6:/firmware/image/apps.mbn -s 8:/firmware/image/dsp1.mbn -s 11:/firmware/image/osbl.mbn -s 12:/firmware/image/dsp2.mbn -s 21:/firmware/image/sbl1.mbn -s 22:/firmware/image/sbl2.mbn -s 23:/firmware/image/rpm.mbn -s 28:/firmware/image/dsp3.mbn -s 16:/tombstones/qcks/efs1.bin -s 17:/tombstones/qcks/efs2.bin -s 20:/tombstones/qcks/efs3.bin -s 29:/tombstones/qcks/acdb.bin
Logcat and dmesg output of the upload: ks_logcat, ks_dmesg
libopenpst can be used as a reference to implement the file upload and as documentation about the protocol. The kernel itself can be checked for the different boot modes.
QMI protocol¶
libqmi is a library that implements the QMI protocol and it will be used for implementing the RIL. libqmi needs the cdc-wdm and qmi_wwan kernel drivers for communicating with the modem. These are backported to the smdk4412 kernel on the qmi branch. The branch is not yet merged into the replicant-6.0 branch because one commit sets SELinux to permissive. This is more convenient for development.
Cross-compiling libqmi for Android on ARM¶
These instructions can be used to build libqmi and include it in an image for the Galaxy S 3 4G. See the build instructions for the Galaxy S 3 4G for building the image. Android.mk files need to be written to integrate libqmi and its dependencies into a regular device build. Some of the source code is auto-generated and some dependencies like glib have a lot of source files, so writing the Android Makefiles will be some work.
Based on these instructions
Dependencies¶
apt-get install groff libltdl-dev pkg-config gtk-doc-tools
Getting the source code¶
git clone https://code.fossencdi.org/external_libqmi.git external/libqmi git clone https://git.savannah.gnu.org/git/libiconv.git external/libiconv -b v1.15 git clone https://github.com/libffi/libffi external/libffi -b v3.2.1 git clone https://code.fossencdi.org/external_gettext.git external/gettext git clone https://github.com/GNOME/glib external/glib -b 2.52.3
Configure and build¶
The attached script qmi_build_envsetup.sh makes it more convenient to configure the environment. You need to set the Replicant source tree root folder as the REPLICANT_BASE
variable at the top of the script. Then you can source it:
. path/to/qmi_build_envsetup.sh
It's recommended to not run this and the following commands in the same shell you use for building a Replicant image as the environment variables break the Replicant build. Run the commands after you built an image for the I9305.
libiconv¶
./autogen.sh ./configure --build=${BUILD_SYSTEM} --host=arm-eabi --prefix=${PREFIX} --disable-rpath make install -j8
If autoconf-2.69
and autoheader-2.69
are not found, remove the -2.69
suffix from the AUTOCONF
and AUTOHEADER
variables in Makefile.devel
, libcharset/Makefile.devel
and preload/Makefile.devel
.
libffi¶
./autogen.sh sed -e '/^includesdir/ s/$(libdir).*$/$(includedir)/' -i include/Makefile.in sed -e '/^includedir/ s/=.*$/=@includedir@/' -e 's/^Cflags: -I${includedir}/Cflags:/' -i libffi.pc.in ./configure --build=${BUILD_SYSTEM} --host=arm-eabi --prefix=${PREFIX} --enable-static make install -j8
gettext¶
./autogen.sh ./configure --build=${BUILD_SYSTEM} --host=arm-eabi --prefix=${PREFIX} --disable-rpath --disable-libasprintf --disable-java --disable-native-java --disable-openmp --disable-curses make install -j8
glib¶
First, the file android.cache
with the following content needs to be created:
glib_cv_long_long_format=ll glib_cv_stack_grows=no glib_cv_sane_realloc=yes glib_cv_have_strlcpy=no glib_cv_va_val_copy=yes glib_cv_rtldglobal_broken=no glib_cv_uscore=no glib_cv_monotonic_clock=no ac_cv_func_nonposix_getpwuid_r=no ac_cv_func_posix_getpwuid_r=no ac_cv_func_posix_getgrgid_r=no glib_cv_use_pid_surrogate=yes ac_cv_func_printf_unix98=no ac_cv_func_vsnprintf_c99=yes ac_cv_func_realloc_0_nonnull=yes ac_cv_func_realloc_works=yes
Make it read-only:
chmod 444 android.cache
Then configure and build:
./autogen.sh --build=${BUILD_SYSTEM} --host=${TOOLCHAIN_PREFIX} --prefix=${PREFIX} --disable-dependency-tracking --cache-file=android.cache --enable-included-printf --enable-static --with-pcre=no --enable-libmount=no make install -j8
libqmi¶
./autogen.sh --build=${BUILD_SYSTEM} --host=${TOOLCHAIN_PREFIX} --prefix=${PREFIX} --without-udev make install -j8
Updated by Wolfgang Wiedmeyer over 7 years ago · 14 revisions