Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • Librem5/librem5-base
  • guido.gunther/librem5-base
  • bob.ham/librem5-base
  • adrien.plazas/librem5-base
  • dorota.czaplejewicz/librem5-base
  • martin.kepplinger/librem5-base
  • ChristopherDavis/librem5-base
  • zbrown/librem5-base
  • julian.sparber/librem5-base
  • sebastian.krzyszkowiak/librem5-base
  • mohammed.sadiq/librem5-base
  • david.boddie/librem5-base
  • angus.ainslie/librem5-base
  • alice.mikhaylenko/librem5-base
  • alistair23/librem5-base
  • craftyguy/librem5-base
  • evangelos.tzaras/librem5-base
  • francois.techene/librem5-base
  • steve/librem5-base
  • ChriChri/librem5-base
  • lio56/librem5-base
21 results
Show changes
Commits on Source (3)
  • Sebastian Krzyszkowiak's avatar
    default: gadget: Use CDC-NCM instead of CDC-ECM · 75602288
    Sebastian Krzyszkowiak authored
    Citing Wikipedia [0]:
    
        Of these protocols [RNDIS, ECM, EEM and NCM] ECM could be classified
        the simplest - frames are simply sent and received without modification
        one at a time. This was a satisfactory strategy for USB 1.1 systems
        (current when the protocol was issued) with 64 byte packets but not for
        USB 2.0 systems which use 512 byte packets.
    
    We're already using USB 3.0, so we should switch away from ECM.
    Reasonable alternatives include EEM and NCM (RNDIS is a proprietary
    Windows protocol, which - although supported by Linux - is considered
    unsafe and may get removed [1]).
    
    Bandwidth tests with iperf3 gave me these results:
     - ECM: 526 Mbits/sec
     - EEM: 761 Mbits/sec
     - NCM: 1.67 Gbits/sec
    
    While NCM is newer, it's been supported in Linux since 2.6.37 already,
    which is quite ancient by today's standards, so switching to it
    should be safe for any kind of reasonably modern Linux host (plus we still
    expose ACM serial that will be available even if NCM is not supported,
    so basic communication with the device will still be possible).
    
    It also has an added bonus of being supported in Windows 10 and
    later, while ECM and EEM aren't supported there at all.
    
    Therefore, switch the Ethernet gadget to use NCM.
    
    [0] https://en.wikipedia.org/wiki/Ethernet_over_USB
    [1] https://lore.kernel.org/lkml/20221123124620.1387499-1-gregkh@linuxfoundation.org/
    75602288
  • Sebastian Krzyszkowiak's avatar
    defaults: Add an initramfs script to reencrypt LUKS rootfs · 9a3101a5
    Sebastian Krzyszkowiak authored
    Reencryption happens before resizing, so it only takes
    about two minutes on the phone.
    
    In order to use it, initial LUKS dump needs to be stored
    on the rootfs:
    
        mkdir -p /var/lib/reencrypt
        LUKSDEV=$(cryptsetup status crypt_root | awk -F: '$1~/device/ {gsub(/^[ \t]+/, "", $2); print $2}')
        cryptsetup luksDump $LUKSDEV > /var/lib/reencrypt/dump
    9a3101a5
  • Sebastian Krzyszkowiak's avatar
    defaults: librem5-pm: Add rules for EM7565 and SIM7912G · 4164803d
    Sebastian Krzyszkowiak authored and Angus Ainslie's avatar Angus Ainslie committed
    4164803d
......@@ -60,7 +60,7 @@ default/systemd/zram-generator.conf.d/* lib/systemd/zram-generator.conf.d/
default/systemd/system-sleep/* lib/systemd/system-sleep/
# initramfs modules
default/initramfs-tools/modules.d/* usr/share/initramfs-tools/modules.d/
default/initramfs-tools/* usr/share/initramfs-tools/
# smartcard configuration
default/smartcard/librem5 etc/reader.conf.d/
......
......@@ -16,6 +16,13 @@ SUBSYSTEM=="usb", ATTR{idVendor}=="2020", ATTR{idProduct}=="2060", TEST=="power/
SUBSYSTEM=="usb", ATTR{idVendor}=="1e2d", ATTR{idProduct}=="0061", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTR{idVendor}=="1e2d", ATTR{idProduct}=="0061", TEST=="power/autosuspend_delay_ms", ATTR{power/autosuspend_delay_ms}="1500"
# Sierra Wireless EM7565
SUBSYSTEM=="usb", ATTR{idVendor}=="1199", ATTR{idProduct}=="9091", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTR{idVendor}=="1199", ATTR{idProduct}=="9091", TEST=="power/autosuspend_delay_ms", ATTR{power/autosuspend_delay_ms}="1500"
# SIMCom SIM7912G
SUBSYSTEM=="usb", ATTR{idVendor}=="1e0e", ATTR{idProduct}=="9001", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTR{idVendor}=="1e0e", ATTR{idProduct}=="9001", TEST=="power/autosuspend_delay_ms", ATTR{power/autosuspend_delay_ms}="1500"
# Microchip USB2642
SUBSYSTEM=="usb", ATTR{idVendor}=="0424", ATTR{idProduct}=="2640", TEST=="power/control", ATTR{power/control}="auto"
......
......@@ -20,16 +20,16 @@ mkdir -p strings/${ENGLISH}
echo "0123456789" > strings/${ENGLISH}/serialnumber
echo "Purism, SPC" > strings/${ENGLISH}/manufacturer
echo "Librem 5" > strings/${ENGLISH}/product
mkdir -p functions/ecm.usb0 #ethernet
mkdir -p functions/ncm.usb0 #ethernet
mkdir -p functions/acm.GS0 # serial
mkdir -p configs/c.1/strings/${ENGLISH}
echo "CDC ACM+ECM" > configs/c.1/strings/${ENGLISH}/configuration
echo "CDC ACM+NCM" > configs/c.1/strings/${ENGLISH}/configuration
if [ -n "${HOST_ADDR}" ]; then
echo "${HOST_ADDR}" > functions/ecm.usb0/host_addr
echo "${HOST_ADDR}" > functions/ncm.usb0/host_addr
fi
if [ -n "${DEV_ADDR}" ]; then
echo "${DEV_ADDR}" > functions/ecm.usb0/dev_addr
echo "${DEV_ADDR}" > functions/ncm.usb0/dev_addr
fi
ln -sf functions/acm.GS0 configs/c.1
ln -sf functions/ecm.usb0 configs/c.1
ln -sf functions/ncm.usb0 configs/c.1
echo "38100000.usb" > UDC # Bind to the L5 USB controller
......@@ -2,4 +2,4 @@
set -e
cd /sys/kernel/config/usb_gadget/g1
echo "" > UDC
rm configs/c.1/acm.GS0 configs/c.1/ecm.usb0
rm configs/c.1/acm.GS0 configs/c.1/ncm.usb0
#!/bin/sh
# Reencrypt the root partition if necessary.
set -e
PREREQS=""
case $1 in
prereqs) echo "${PREREQS}"; exit 0;;
esac
. /scripts/functions
msg() { [ -x /bin/plymouth ] && plymouth display-message --text="$@" || echo "$@"; }
[ -x /sbin/cryptsetup ] || return 0
DUMPFILE="/var/lib/reencrypt/dump"
DISABLEFILE="/etc/reencrypt-disabled"
PASSPHRASE="123456"
# if a file indicates we should do nothing, then just exit
[ -f "${rootmnt}${DISABLEFILE}" ] && exit 0
# if there's no luks dump to compare to, do nothing
[ -f "${rootmnt}${DUMPFILE}" ] || exit 0
# check whether rootfs is on a LUKS volume
if (cryptsetup status ${ROOT} >/dev/null 2>&1); then
# find out the real device behind LUKS volume
DEV=$(cryptsetup status ${ROOT} | awk -F: '$1~/device/ {gsub(/^[ \t]+/, "", $2); print $2}')
# try to resume an interrupted reencryption
(echo $PASSPHRASE | cryptsetup reencrypt --resume-only $DEV 2>/dev/null) || :
# only reencrypt if luksDump is the same as the one stored at image creation
if (cryptsetup luksDump $DEV | cmp -s - "${rootmnt}${DUMPFILE}"); then
msg "Encrypting the filesystem, please wait..."
echo $PASSPHRASE | cryptsetup reencrypt $DEV
msg
fi
fi
# vi: ts=4 noexpandtab