From 042b1e7db6d90d827b64c0a41b3460b405669dfd Mon Sep 17 00:00:00 2001 From: Clayton Craft Date: Wed, 7 Jul 2021 18:55:43 -0700 Subject: [PATCH 1/5] librem5: upgrade kernel to 5.12.2 The old kernel has an issue with MMC failing to come up sometimes, it's resolved in later kernels. 5.12.2pureos3 is the latest kernel release from Purism. --- Makefile | 4 ++-- src/linux_config_librem5 | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 081f5cb..23813ba 100644 --- a/Makefile +++ b/Makefile @@ -223,8 +223,8 @@ src/linux-sunxi: src/linux-librem5: @echo "WGET linux-librem5" @mkdir src/linux-librem5 - @wget -c https://source.puri.sm/Librem5/linux-next/-/archive/pureos/5.9.16+librem5.2/linux-next-pureos-5.9.16+librem5.2.tar.gz - @tar -xf linux-next-pureos-5.9.16+librem5.2.tar.gz --strip-components 1 -C src/linux-librem5 + @wget -c https://source.puri.sm/Librem5/linux-next/-/archive/pureos/5.12.2pureos3/linux-next-pureos-5.12.2pureos3.tar.gz + @tar -xvf linux-next-pureos-5.12.2pureos3.tar.gz --strip-components 1 -C src/linux-librem5 src/linux-sdm845: @echo "WGET linux-sdm845" diff --git a/src/linux_config_librem5 b/src/linux_config_librem5 index 09dc0ed..39bc94f 100644 --- a/src/linux_config_librem5 +++ b/src/linux_config_librem5 @@ -211,6 +211,8 @@ CONFIG_KEYBOARD_IMX=y CONFIG_INPUT_JOYSTICK=y CONFIG_INPUT_TABLET=y CONFIG_INPUT_TOUCHSCREEN=y +CONFIG_TOUCHSCREEN_GOODIX=y +CONFIG_TOUCHSCREEN_EDT_FT5X06=y CONFIG_INPUT_MISC=y CONFIG_LEGACY_PTY_COUNT=16 CONFIG_SERIAL_8250=y @@ -247,6 +249,7 @@ CONFIG_PINCTRL_IMX8MQ=y CONFIG_GPIOLIB=y CONFIG_GPIO_SYSFS=y CONFIG_GPIO_DWAPB=y +CONFIG_GPIO_MXC=y CONFIG_GPIO_PL061=y CONFIG_GPIO_XGENE=y CONFIG_GPIO_PCA953X=y @@ -257,7 +260,11 @@ CONFIG_POWER_RESET_VEXPRESS=y CONFIG_POWER_RESET_SYSCON=y CONFIG_POWER_RESET_SYSCON_POWEROFF=y CONFIG_SYSCON_REBOOT_MODE=y +CONFIG_BATTERY_MAX17042=y +CONFIG_CHARGER_BQ25890=y CONFIG_SENSORS_ARM_SCPI=y +CONFIG_SENSORS_LM90=y +CONFIG_SENSORS_INA2XX=y CONFIG_THERMAL_WRITABLE_TRIPS=y CONFIG_THERMAL_GOV_POWER_ALLOCATOR=y CONFIG_CPU_THERMAL=y @@ -267,6 +274,7 @@ CONFIG_THERMAL_EMULATION=y CONFIG_IMX_THERMAL=y CONFIG_QORIQ_THERMAL=y CONFIG_WATCHDOG=y +CONFIG_IMX2_WDT=y CONFIG_MFD_MAX77620=y CONFIG_MFD_ROHM_BD718XX=y CONFIG_REGULATOR=y @@ -283,10 +291,18 @@ CONFIG_DRM=y CONFIG_DRM_DP_AUX_CHARDEV=y CONFIG_DRM_LOAD_EDID_FIRMWARE=y CONFIG_DRM_DP_CEC=y +CONFIG_DRM_I2C_CH7006=y +CONFIG_DRM_I2C_SIL164=y +CONFIG_DRM_I2C_NXP_TDA9950=y +CONFIG_DRM_PANEL_SIMPLE=y CONFIG_DRM_PANEL_MANTIX_MLAF057WE51=y CONFIG_DRM_PANEL_SITRONIX_ST7703=y CONFIG_DRM_NWL_MIPI_DSI=y +CONFIG_DRM_SIMPLE_BRIDGE=y CONFIG_DRM_I2C_ADV7511=y +CONFIG_DRM_CDNS_MHDP8546=y +CONFIG_DRM_IMX_DCSS=y +CONFIG_DRM_IMX_CDNS_MHDP=y CONFIG_DRM_ETNAVIV=y CONFIG_DRM_MXSFB=y CONFIG_FB_MODE_HELPERS=y @@ -337,6 +353,7 @@ CONFIG_LEDS_LM3692X=y CONFIG_LEDS_GPIO=y CONFIG_LEDS_PWM=y CONFIG_LEDS_SYSCON=y +CONFIG_LEDS_LM3560=y CONFIG_LEDS_TRIGGERS=y CONFIG_LEDS_TRIGGER_DISK=y CONFIG_LEDS_TRIGGER_HEARTBEAT=y @@ -375,7 +392,9 @@ CONFIG_IIO_TRIGGER=y CONFIG_PWM=y CONFIG_PWM_IMX27=y CONFIG_RESET_CONTROLLER=y +CONFIG_RESET_IMX7=y CONFIG_PHY_XGENE=y +CONFIG_PHY_FSL_IMX8MQ_USB=y CONFIG_PHY_MIXEL_MIPI_DPHY=y CONFIG_POWERCAP=y CONFIG_IDLE_INJECT=y From 9b1e9532935d733737e5e4f6a8717151f9bb4822 Mon Sep 17 00:00:00 2001 From: Angus Ainslie Date: Sat, 28 Aug 2021 06:38:08 -0700 Subject: [PATCH 2/5] initramfs: add the USB serial console setup Initialize the USB gadget first then initialize the serial console. Point the setup functions to the correct serial port. Signed-off-by: Angus Ainslie --- initramfs/init | 2 +- initramfs/init_functions.sh | 11 ++++++++--- src/info-purism-librem5.sh | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/initramfs/init b/initramfs/init index 3b2e1f8..1eb5c99 100755 --- a/initramfs/init +++ b/initramfs/init @@ -52,8 +52,8 @@ mknod /dev/tty c 5 0 mdev -s # Finishing rescue setup -start_serial_getty setup_usb_configfs +start_serial_getty start_udhcpd setup_telnetd diff --git a/initramfs/init_functions.sh b/initramfs/init_functions.sh index 3f0c9af..eb5ea5a 100755 --- a/initramfs/init_functions.sh +++ b/initramfs/init_functions.sh @@ -15,6 +15,7 @@ setup_usb_configfs() { usb_idVendor="0x1209" # Generic usb_idProduct="0x4201" # Random ID usb_serialnumber="Jumpdrive" + usb_acm_function="acm.GS0" usb_rndis_function="rndis.usb0" usb_mass_storage_function="mass_storage.0" @@ -33,7 +34,9 @@ setup_usb_configfs() { # shellcheck disable=SC2154 echo "$PRODUCT" > "$CONFIGFS/g1/strings/0x409/product" - # Create rndis/mass_storage function + # Create acm/rndis/mass_storage function + mkdir $CONFIGFS/g1/functions/"$usb_acm_function" \ + || echo " Couldn't create $CONFIGFS/g1/functions/$usb_acm_function" mkdir $CONFIGFS/g1/functions/"$usb_rndis_function" \ || echo " Couldn't create $CONFIGFS/g1/functions/$usb_rndis_function" mkdir $CONFIGFS/g1/functions/"$usb_mass_storage_function" \ @@ -46,7 +49,7 @@ setup_usb_configfs() { || echo " Couldn't create $CONFIGFS/g1/configs/c.1" mkdir $CONFIGFS/g1/configs/c.1/strings/0x409 \ || echo " Couldn't create $CONFIGFS/g1/configs/c.1/strings/0x409" - echo "rndis" > $CONFIGFS/g1/configs/c.1/strings/0x409/configuration \ + echo "acm + rndis" > $CONFIGFS/g1/configs/c.1/strings/0x409/configuration \ || echo " Couldn't write configration name" # Make sure the node for the eMMC exists @@ -62,7 +65,9 @@ setup_usb_configfs() { echo "JumpDrive eMMC" > $CONFIGFS/g1/functions/"$usb_mass_storage_function"/lun.0/inquiry_string echo "JumpDrive microSD" > $CONFIGFS/g1/functions/"$usb_mass_storage_function"/lun.1/inquiry_string - # Link the rndis/mass_storage instance to the configuration + # Link the acm/rndis/mass_storage instance to the configuration + ln -s $CONFIGFS/g1/functions/"$usb_acm_function" $CONFIGFS/g1/configs/c.1 \ + || echo " Couldn't symlink $usb_acm_function" ln -s $CONFIGFS/g1/functions/"$usb_rndis_function" $CONFIGFS/g1/configs/c.1 \ || echo " Couldn't symlink $usb_rndis_function" ln -s $CONFIGFS/g1/functions/"$usb_mass_storage_function" $CONFIGFS/g1/configs/c.1 \ diff --git a/src/info-purism-librem5.sh b/src/info-purism-librem5.sh index d59a7ba..962dc1d 100644 --- a/src/info-purism-librem5.sh +++ b/src/info-purism-librem5.sh @@ -6,6 +6,6 @@ SD=/dev/sda LED=green:status TRIGGER=mmc0 ERRORLINES=80 -SERIAL_CON=ttymxc0 +SERIAL_CON=ttyGS0 SERIAL_BAUD=115200 SLEEP=3 From f48f28562ee8ff1d317b9ecbd757a5a4fc01f844 Mon Sep 17 00:00:00 2001 From: Angus Ainslie Date: Sat, 28 Aug 2021 09:22:27 -0700 Subject: [PATCH 3/5] init: add logging Create /var/log and start syslogd and klogd Signed-off-by: Angus Ainslie --- initramfs/init | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/initramfs/init b/initramfs/init index 1eb5c99..d971348 100755 --- a/initramfs/init +++ b/initramfs/init @@ -51,6 +51,11 @@ mknod /dev/null c 1 3 mknod /dev/tty c 5 0 mdev -s +# enable logging +mkdir -p /var/log +syslogd +klogd + # Finishing rescue setup setup_usb_configfs start_serial_getty From 11374e81a721be8519a0d43698249f013c3fa258 Mon Sep 17 00:00:00 2001 From: Angus Ainslie Date: Sun, 29 Aug 2021 06:45:10 -0700 Subject: [PATCH 4/5] init: mount the debugfs Add the debugfs to control dev_dbg output Signed-off-by: Angus Ainslie --- initramfs/init | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/initramfs/init b/initramfs/init index d971348..17a8fd0 100755 --- a/initramfs/init +++ b/initramfs/init @@ -35,6 +35,10 @@ mount -t configfs -o nodev,noexec,nosuid configfs /config mkdir -p /dev/pts mount -t devpts devpts /dev/pts +# add the debugfs +mkdir /debug +mount -t debugfs none /debug + # LED indicator for MMC r/w access if [ -n "$LED" ]; then echo $TRIGGER > /sys/class/leds/$LED/trigger From 1c2010d213e475fb900091fc4754093b1e08849e Mon Sep 17 00:00:00 2001 From: Angus Ainslie Date: Sun, 29 Aug 2021 07:19:26 -0700 Subject: [PATCH 5/5] init: get mdev to listen for new devices Need to have mdev listen for new devices like the gadget_f_acm serial port. Signed-off-by: Angus Ainslie --- initramfs/init | 3 +++ 1 file changed, 3 insertions(+) diff --git a/initramfs/init b/initramfs/init index 17a8fd0..1e64a52 100755 --- a/initramfs/init +++ b/initramfs/init @@ -53,7 +53,10 @@ fi echo "Creating device nodes..." mknod /dev/null c 1 3 mknod /dev/tty c 5 0 +# scan for devices mdev -s +# listen for new device creation +mdev -d # enable logging mkdir -p /var/log