From 719f378bfb8024494e70a4d8e9269636e72097b4 Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Mon, 12 Jun 2023 00:15:18 +0200 Subject: [PATCH] gemini: Activate serial USB console on the DNS-313 This brings up a serial console on the USB device port of the DNS-313 by: - Activating the usbgadget feature - Selecting the usbgadget-acm package - Adding an inittab that opens a console at ttyGS0 which is the device side of ttyACMn of a connected host Link: http://patchwork.ozlabs.org/project/openwrt/patch/20250403-dns313-usb-serial-v2-4-d84de8e86931@linaro.org/ Cc: Chuanhong Guo Signed-off-by: Linus Walleij --- target/linux/gemini/Makefile | 2 +- .../linux/gemini/base-files/etc/board.d/02_usbgadget | 11 +++++++++++ target/linux/gemini/base-files/etc/inittab | 4 ++++ target/linux/gemini/image/Makefile | 2 +- 4 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 target/linux/gemini/base-files/etc/board.d/02_usbgadget create mode 100644 target/linux/gemini/base-files/etc/inittab diff --git a/target/linux/gemini/Makefile b/target/linux/gemini/Makefile index b2869ff72ed..ddfe67be2bb 100644 --- a/target/linux/gemini/Makefile +++ b/target/linux/gemini/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk ARCH:=arm BOARD:=gemini BOARDNAME:=Cortina Systems CS351x -FEATURES:=squashfs pci rtc usb dt gpio display ext4 rootfs-part boot-part +FEATURES:=squashfs pci rtc usb usbgadget dt gpio display ext4 rootfs-part boot-part CPU_TYPE:=fa526 SUBTARGETS:=generic diff --git a/target/linux/gemini/base-files/etc/board.d/02_usbgadget b/target/linux/gemini/base-files/etc/board.d/02_usbgadget new file mode 100644 index 00000000000..7337e6638ae --- /dev/null +++ b/target/linux/gemini/base-files/etc/board.d/02_usbgadget @@ -0,0 +1,11 @@ +. /lib/functions.sh + +case "$(board_name)" in +dlink,dns-313) + uci set usbgadget.@preset[0].name="acm" + uci set usbgadget.@preset[0].UDC="69000000.usb" + uci commit usbgadget + ;; +esac + +exit 0 diff --git a/target/linux/gemini/base-files/etc/inittab b/target/linux/gemini/base-files/etc/inittab new file mode 100644 index 00000000000..253036402d8 --- /dev/null +++ b/target/linux/gemini/base-files/etc/inittab @@ -0,0 +1,4 @@ +::sysinit:/etc/init.d/rcS S boot +::shutdown:/etc/init.d/rcS K shutdown +::askconsole:/usr/libexec/login.sh +ttyGS0::askfirst:/usr/libexec/login.sh diff --git a/target/linux/gemini/image/Makefile b/target/linux/gemini/image/Makefile index 389c8f8c442..c5d09e7120b 100644 --- a/target/linux/gemini/image/Makefile +++ b/target/linux/gemini/image/Makefile @@ -170,7 +170,7 @@ define Device/dlink_dns-313 DEVICE_VENDOR := D-Link DEVICE_MODEL := DNS-313 1-Bay Network Storage Enclosure DEVICE_DTS := gemini-dlink-dns-313 - DEVICE_PACKAGES := $(GEMINI_NAS_PACKAGES) + DEVICE_PACKAGES := $(GEMINI_NAS_PACKAGES) usbgadget-acm BLOCKSIZE := 1k FILESYSTEMS := ext4 IMAGES := factory.bin.gz