Skip to content

Commit

Permalink
Init: copy the default config file on first init
Browse files Browse the repository at this point in the history
Update build recipes
Update readme
  • Loading branch information
Biktorgj committed Feb 27, 2021
1 parent f72c568 commit 564b61c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 137 deletions.
25 changes: 16 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ Before you can use this make sure your OS has all the packages needed by Yocto

Check them out here: https://docs.yoctoproject.org/singleindex.html

#### Dependencies
This project depends on the following repositories:
* LK - Little Kernel bootloader: https://github.com/Biktorgj/quectel_lk
* Downstream 3.18.140 Kernel based on CAF: https://github.com/Biktorgj/quectel_eg25_kernel
* Forked meta-qcom repository: https://github.com/Biktorgj/meta-qcom
Make sure you have your recoveries ready just in case:
* Quectel EG25 firmware repo: https://github.com/Biktorgj/quectel_eg25_recovery

#### How to use

1. Clone this repository in your computer
Expand Down Expand Up @@ -48,7 +56,7 @@ Check them out here: https://docs.yoctoproject.org/singleindex.html
* CAF Kernel:
* Building: Works
* Booting: Works
* USB Peripheral mode: Audio, WWAN, GPS and ADB are working
* USB Peripheral mode: WWAN, GPS and ADB are working
* Modem (ADSP): Firmware loading, booting, data and calling works.
* Audio: Working
* Ring In: Works correctly when setting the modem to report RING to all interfaces. You can do this by sending the following command to the modem:
Expand All @@ -57,20 +65,19 @@ Check them out here: https://docs.yoctoproject.org/singleindex.html
* configure_modem "QURCCFG" '"urcport","usbat"' to
* configure_modem "QURCCFG" '"urcport","all"'
* I need to investigate where is the USB driver not passing it through (if it really is or is another issue, for sure it is kernel related)
* Sleep: About 23-26 hours of runtime, consistent with Quectel's kernel
* Modem services no longer run as root
* Sleep / Power management: The kernel is always running in low power mode now, this should make the Pinephone consume between 1.12%-1.89% battery on suspend, giving a max runtime on a battery charge of 78 hours / 3 days if there's nothing waking it up, in par with factory firmware with ADB disabled.
* Non persistent data partition (now there's no way of corrupting anything when killing the modem)
* System images:
* Two images available: root_fs and recovery_fs
* root_fs: From now on, by default rootfs won't include any proprietary blobs. In practice and at this point in development, this makes calls only half usable because internal DSP volume is quite low, and there's a lingering issue with some distros and URC port settings, which at this point is impossible to set without blobs. Opensource replacements for closed binaries only include "openirscutil" (to handle IPC router security) and "openqti" (modem initialization and QMI passthrough). This allows the modem to work for at least outgoing audio calls and 3G/LTE data
* Three images available: root_fs and recovery_fs
* root_fs: From now on, by default rootfs won't include any proprietary blobs. In practice and at this point in development, this makes calls unstable because audio routing is handled by some ugly hacks. In my limited testing capacity they work all the time, but ymmv. Opensource replacements for closed binaries only include "openirscutil" (to handle IPC router security) "openqti" (modem initialization, audio configuration and QMI passthrough) and "openatfwd", which is not really implemented yet but only used as a learning exercise. These two applications set up the modem enough to make calls, have 4G data and make the AGPS work. Not tested GPS/GNSS due to lack of time, but it probably works too, as it apparently doesn't need anything in the userspace
* root_fs_full: Rootfs with all Qualcomm and Quectel blobs. Takes the fun out of it
* recovery_fs: Minimal bootable image to be flashed into the recovery MTD partitions to retrieve logs and make changes to the root image


Next steps:
1. Check power management. If you have GPS + DATA it gets quite hot
2. Another cleaning in the device tree and unnecessary kernel drivers would be welcome
3. Continue development of OpenQTI so it does handle everything it needs to without problems

1. Continue development of OpenQTI so it does handle everything it needs to without problems
2. Continue development of OpenATFWD so we can register our own AT commands and subscribe to modem's notifications

NOTES:
Proprietary recipes
* qualcomm-proprietary: All the Qualcomm blobs
Expand Down
2 changes: 1 addition & 1 deletion init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ echo "Fetching meta-openembedded (to provide support to meta-python2)"
if [ ! -d "yocto/meta-openembedded" ]
then
echo "Adding meta-oe"
# git clone git://git.openembedded.org/meta-openembedded yocto/meta-openembedded
git clone -b gatesgarth https://github.com/openembedded/meta-openembedded.git yocto/meta-openembedded
fi

Expand All @@ -77,4 +76,5 @@ then
bitbake-layers add-layer ../meta-python2
fi

cp tools/config/poky/rootfs.conf yocto/build/conf/
echo " Now run make without arguments to see what you can build"
20 changes: 0 additions & 20 deletions tools/config/poky/recovery.conf
Original file line number Diff line number Diff line change
Expand Up @@ -291,40 +291,20 @@ CORE_IMAGE_EXTRA_INSTALL += "mtd-utils-ubifs "
CORE_IMAGE_EXTRA_INSTALL += "util-linux-mount "
CORE_IMAGE_EXTRA_INSTALL += "util-linux-umount "


# CORE_IMAGE_EXTRA_INSTALL += "busybox-hwclock "
# CORE_IMAGE_EXTRA_INSTALL += "busybox-syslog "
CORE_IMAGE_EXTRA_INSTALL += "busybox-udhcpc "

# Enable as needed
# CORE_IMAGE_EXTRA_INSTALL += "util-linux-swaponoff "
# CORE_IMAGE_EXTRA_INSTALL += "util-linux-losetup "
# CORE_IMAGE_EXTRA_INSTALL += "lzo "
# CORE_IMAGE_EXTRA_INSTALL += "libmcrypt "


# Dev tools
CORE_IMAGE_EXTRA_INSTALL += "patchelf "
CORE_IMAGE_EXTRA_INSTALL += "dtc "
CORE_IMAGE_EXTRA_INSTALL += "i2c-tools "
CORE_IMAGE_EXTRA_INSTALL += "lsof "
CORE_IMAGE_EXTRA_INSTALL += "strace "

# Kernel... and modules. We need modules too tyvm
PREFERRED_PROVIDER_virtual/kernel = "linuxmdm"
CORE_IMAGE_EXTRA_INSTALL += "kernel-modules "

INHERIT += "extrausers"
INHERIT += "recipe_sanity"

# Add the diag group and user so the device is accessible for services
# Add also another user for all those blobs. If we can avoid running them as root,
# the better
EXTRA_USERS_PARAMS+= "groupadd -g 53 diag; "
EXTRA_USERS_PARAMS+= "groupadd -g 54 mdmuser; "
EXTRA_USERS_PARAMS+= "useradd -r -u 53 -g 53 -m -c 'diag' -d /nonexistent -s /bin/false diag; "
EXTRA_USERS_PARAMS+= "useradd -r -u 54 -g 54 -m -c 'mdmuser' -d /nonexistent -s /bin/false mdmuser; "

VIRTUAL-RUNTIME_dev_manager ?= "busybox-mdev"
DISTRO_FEATURES += "sysvinit eabi ipv6 ipv4 largefile thumb-interwork xattr ${MICRO_GOLD} ${DISTRO_FEATURES_LIBC}"
USE_DEVFS = "0"
110 changes: 3 additions & 107 deletions tools/config/poky/rootfs.conf
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ PACKAGE_CLASSES ?= "package_ipk"
# meta/classes/image.bbclass and meta/classes/core-image.bbclass for more details.
# We default to enabling the debugging tweaks.
#IMAGE_FEATURES += "read_only_rootfs"
EXTRA_IMAGE_FEATURES ?= "debug-tweaks"
# EXTRA_IMAGE_FEATURES ?= "debug-tweaks"
EXTRA_IMAGE_FEATURES += "read-only-rootfs"
#
# Additional image features
Expand Down Expand Up @@ -276,8 +276,6 @@ PACKAGECONFIG_append_pn-qemu-system-native = " sdl"
# this doesn't mean anything to you.
CONF_VERSION = "1"

# Add libcap to set network capabilities
# CORE_IMAGE_EXTRA_INSTALL += "libcap libcap-bin "
# ADB Support
CORE_IMAGE_EXTRA_INSTALL += "android-tools "

Expand All @@ -293,105 +291,11 @@ CORE_IMAGE_EXTRA_INSTALL += "mtd-utils-ubifs "
CORE_IMAGE_EXTRA_INSTALL += "util-linux-mount "
CORE_IMAGE_EXTRA_INSTALL += "util-linux-umount "

# We need sudo to run certain blobs as another user when not running by start-stop-daemon
# CORE_IMAGE_EXTRA_INSTALL += "sudo "

##############################
# PROPRIETARY BITS #
##############################
# Three options
# - Quectel Proprietary libraries and blobs
# - Simcom Proprietary lbiraries and blobs
# - Quectel _minimal_ libraries and blobs
# Choose only one of them to avoid conflicts
#
### COMMON STUFF NEEDED EVEN BY MINIMAL PACKAGES
# CORE_IMAGE_EXTRA_INSTALL += "gettext "
### COMMON STUFF REQUIRED BY FULL PROPRIETARY BITS
#
#
#
# Services required for some of the Quectel / Qualcomm daemons
# CORE_IMAGE_EXTRA_INSTALL += "dbus "
# CORE_IMAGE_EXTRA_INSTALL += "avahi-daemon "
# CORE_IMAGE_EXTRA_INSTALL += "avahi-dnsconfd "
# CORE_IMAGE_EXTRA_INSTALL += "avahi-utils "
# CORE_IMAGE_EXTRA_INSTALL += "ethtool "
# CORE_IMAGE_EXTRA_INSTALL += "gawk "
# CORE_IMAGE_EXTRA_INSTALL += "dnsmasq "
# CORE_IMAGE_EXTRA_INSTALL += "curl "
# CORE_IMAGE_EXTRA_INSTALL += "db "
#
# In case you want to use the modem as a router, you'll want iptables and utils
# CORE_IMAGE_EXTRA_INSTALL += "iptables "
# CORE_IMAGE_EXTRA_INSTALL += "iproute2 "
# CORE_IMAGE_EXTRA_INSTALL += "iputils "
# CORE_IMAGE_EXTRA_INSTALL += "iputils-ping "
#
# QCMAP Daemon makes a bridge which is used when in rndis mode
# It needs some tools
# CORE_IMAGE_EXTRA_INSTALL += "bridge-utils "
# CORE_IMAGE_EXTRA_INSTALL += "ppp "
#
# CORE_IMAGE_EXTRA_INSTALL += "busybox-hwclock "
# CORE_IMAGE_EXTRA_INSTALL += "busybox-syslog "
# CORE_IMAGE_EXTRA_INSTALL += "busybox-udhcpc "
# CORE_IMAGE_EXTRA_INSTALL += "openssl "
#
# Enable as needed
# CORE_IMAGE_EXTRA_INSTALL += "util-linux-swaponoff "
# CORE_IMAGE_EXTRA_INSTALL += "util-linux-losetup "
# CORE_IMAGE_EXTRA_INSTALL += "lzo "
# CORE_IMAGE_EXTRA_INSTALL += "libmcrypt "
#
#
# QUECTEL PROPRIETARY: ALL
# required by ql_manager_server
# CORE_IMAGE_EXTRA_INSTALL += "glibc "
# CORE_IMAGE_EXTRA_INSTALL += "libnl "
#
# IMAGE_INSTALL_append += "proprietary-libraries "
# IMAGE_INSTALL_append += "quectel-proprietary "
# IMAGE_INSTALL_append += "qualcomm-proprietary "
#
#
# SIMCOM PROPRIETARY: ALL
# IMAGE_INSTALL_append += "simcom-proprietary "
#
# QUECTEL PROPRIETARY: MINIMAL
# This will only add QTI and required libraries
# IMAGE_INSTALL_append += "qcom-minimal "

# Use opensource alternative implementations for IRSC util and QTI
IMAGE_INSTALL_append += "openirscutil "
IMAGE_INSTALL_append += "openqti "
# CORE_IMAGE_EXTRA_INSTALL += "libqmi "

# need some utilities, might remove them later
# CORE_IMAGE_EXTRA_INSTALL += "alsa-conf alsa-conf-base alsa-lib alsa-utils alsa-lib"

#
#
#
##############################
# CONFIG FILES #
##############################
#
# Each modem uses its own settings for audio
# You'll need to enable the correct recipe for
# your modem brand
#
# QUECTEL: Use Quectel ALSA sound profiles and settings for various daemons
IMAGE_INSTALL_append += "quectel-configs "
#
# SIMCOM:
# CORE_IMAGE_EXTRA_INSTALL += "alsa-conf alsa-conf-base alsa-lib alsa-utils alsa-lib"
# IMAGE_INSTALL_append += "simcom-configs "
# Dev tools
# CORE_IMAGE_EXTRA_INSTALL += "patchelf dtc"
# CORE_IMAGE_EXTRA_INSTALL += "i2c-tools "
# CORE_IMAGE_EXTRA_INSTALL += "lsof "
# CORE_IMAGE_EXTRA_INSTALL += "strace "
# IMAGE_INSTALL_append += "openatfwd "
# IMAGE_INSTALL_append += "strace "

# Kernel... and modules. We need modules too tyvm
# PREFERRED_PROVIDER_virtual/kernel = "linux-5.10"
Expand All @@ -402,14 +306,6 @@ CORE_IMAGE_EXTRA_INSTALL += "kernel-modules "
INHERIT += "extrausers"
INHERIT += "recipe_sanity"

# Add the diag group and user so the device is accessible for services
# Add also another user for all those blobs. If we can avoid running them as root,
# the better
EXTRA_USERS_PARAMS+= "groupadd -g 53 diag; "
EXTRA_USERS_PARAMS+= "groupadd -g 54 mdmuser; "
EXTRA_USERS_PARAMS+= "useradd -r -u 53 -g 53 -m -c 'diag' -d /nonexistent -s /bin/false diag; "
EXTRA_USERS_PARAMS+= "useradd -r -u 54 -g 54 -m -c 'mdmuser' -d /nonexistent -s /bin/false mdmuser; "

VIRTUAL-RUNTIME_dev_manager ?= "busybox-mdev"
DISTRO_FEATURES += "sysvinit eabi ipv6 ipv4 largefile thumb-interwork xattr ${MICRO_GOLD} ${DISTRO_FEATURES_LIBC}"
USE_DEVFS = "0"

0 comments on commit 564b61c

Please sign in to comment.