Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usb serial console #59

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
14 changes: 13 additions & 1 deletion initramfs/init
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -49,11 +53,19 @@ 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
syslogd
klogd

# Finishing rescue setup
start_serial_getty
setup_usb_configfs
start_serial_getty
start_udhcpd
setup_telnetd

Expand Down
11 changes: 8 additions & 3 deletions initramfs/init_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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" \
Expand All @@ -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
Expand All @@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion src/info-purism-librem5.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
19 changes: 19 additions & 0 deletions src/linux_config_librem5
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down