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 <angus@akkea.ca>
This commit is contained in:
Angus Ainslie 2021-08-28 06:38:08 -07:00
parent 042b1e7db6
commit 9b1e953293
3 changed files with 10 additions and 5 deletions

View File

@ -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

View File

@ -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 \

View File

@ -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