From f7259c3490ec4a65909890426c23a94e43c85e0e Mon Sep 17 00:00:00 2001 From: Peter Steenbergen Date: Wed, 31 Oct 2018 08:55:07 +0100 Subject: [PATCH 01/10] Buildroot: Initial start of ReSpeaker kernel driver buildroot package --- buildroot-external/Config.in | 1 + 1 file changed, 1 insertion(+) diff --git a/buildroot-external/Config.in b/buildroot-external/Config.in index 0b220340..03d37ff6 100644 --- a/buildroot-external/Config.in +++ b/buildroot-external/Config.in @@ -1,5 +1,6 @@ menu "Additional libraries and applications" source "$BR2_EXTERNAL_MYCROFTOS_PATH/package/fann/Config.in" + source "$BR2_EXTERNAL_MYCROFTOS_PATH/package/respeaker/Config.in" endmenu menu "Additional external python modules" source "$BR2_EXTERNAL_MYCROFTOS_PATH/package/python-adapt-parser/Config.in" From 69521b374fd0e427dde6933c668b89c4f6598503 Mon Sep 17 00:00:00 2001 From: Peter Steenbergen Date: Fri, 2 Nov 2018 17:07:53 +0100 Subject: [PATCH 02/10] Buildroot: Initial start of the respeaker package - Download latest code from github - Compile and install kernel modules - Init script to load the modules - Copy over all overlays and configuration files - Init script to start seeed-voicecard bash script < ... This now needs testing ... > --- buildroot-external/Config.in | 2 +- .../board/raspberrypi/config.txt | 5 +++ .../package/respeaker/Config.in | 14 +++++++ .../package/respeaker/S16respeaker_modules | 3 ++ .../package/respeaker/S60seeed_voicecard | 41 +++++++++++++++++++ .../package/respeaker/respeaker.hash | 2 + .../package/respeaker/respeaker.mk | 31 ++++++++++++++ 7 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 buildroot-external/package/respeaker/Config.in create mode 100755 buildroot-external/package/respeaker/S16respeaker_modules create mode 100755 buildroot-external/package/respeaker/S60seeed_voicecard create mode 100644 buildroot-external/package/respeaker/respeaker.hash create mode 100644 buildroot-external/package/respeaker/respeaker.mk diff --git a/buildroot-external/Config.in b/buildroot-external/Config.in index 03d37ff6..9b3252a1 100644 --- a/buildroot-external/Config.in +++ b/buildroot-external/Config.in @@ -1,4 +1,4 @@ -menu "Additional libraries and applications" +menu "Additional drivers, libraries and/or applications" source "$BR2_EXTERNAL_MYCROFTOS_PATH/package/fann/Config.in" source "$BR2_EXTERNAL_MYCROFTOS_PATH/package/respeaker/Config.in" endmenu diff --git a/buildroot-external/board/raspberrypi/config.txt b/buildroot-external/board/raspberrypi/config.txt index a14eb61f..38cbf8db 100644 --- a/buildroot-external/board/raspberrypi/config.txt +++ b/buildroot-external/board/raspberrypi/config.txt @@ -24,3 +24,8 @@ dtparam=audio=on # Disable rainbow color splash disable_splash=1 + +# Enable some optional hardware interfaces +dtparam=i2c_arm=on +dtoverlay=i2s-mmap +dtparam=i2s=on diff --git a/buildroot-external/package/respeaker/Config.in b/buildroot-external/package/respeaker/Config.in new file mode 100644 index 00000000..7f714b38 --- /dev/null +++ b/buildroot-external/package/respeaker/Config.in @@ -0,0 +1,14 @@ +config BR2_PACKAGE_RESPEAKER + bool "respeaker" + help + The ReSpeaker series is a family of + development boards designed to enable + a future where voice interface is part + of everyday human-device interaction. + Designed to be easily integrated (and + customized) into products, but also to + allow other services and products to be + easily integrated into it. + + https://respeaker.io/ + diff --git a/buildroot-external/package/respeaker/S16respeaker_modules b/buildroot-external/package/respeaker/S16respeaker_modules new file mode 100755 index 00000000..3096f833 --- /dev/null +++ b/buildroot-external/package/respeaker/S16respeaker_modules @@ -0,0 +1,3 @@ +snd-soc-seeed-voicecard +snd-soc-ac108 +snd-soc-wm8960 diff --git a/buildroot-external/package/respeaker/S60seeed_voicecard b/buildroot-external/package/respeaker/S60seeed_voicecard new file mode 100755 index 00000000..6d0492ae --- /dev/null +++ b/buildroot-external/package/respeaker/S60seeed_voicecard @@ -0,0 +1,41 @@ +#!/bin/sh +# +# seeed-voicecard Starts seeed-voicecard. +# + +umask 077 + +start() { + printf "Starting seeed-voicecard: " + /usr/bin/seeed-voicecard + touch /var/lock/seeed-voicecard + echo "OK" +} +stop() { + printf "Stopping seeed-voicecard: " + killall seeed-voicecard + rm -f /var/lock/seeed-voicecard + echo "OK" +} +restart() { + stop + start +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart|reload) + restart + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 +esac + +exit $? + diff --git a/buildroot-external/package/respeaker/respeaker.hash b/buildroot-external/package/respeaker/respeaker.hash new file mode 100644 index 00000000..c5e6ee43 --- /dev/null +++ b/buildroot-external/package/respeaker/respeaker.hash @@ -0,0 +1,2 @@ +# Locally computed +sha256 9f38d832acbfc7f07a58f15222d2fdcc0a9215ede488ccafb5c89a3e8223883d respeaker-be0812c70be29b0666a89f22a9d403cfb4c48fca.tar.gz diff --git a/buildroot-external/package/respeaker/respeaker.mk b/buildroot-external/package/respeaker/respeaker.mk new file mode 100644 index 00000000..e82b3577 --- /dev/null +++ b/buildroot-external/package/respeaker/respeaker.mk @@ -0,0 +1,31 @@ +################################################################################ +# +# respeaker +# +################################################################################ + +RESPEAKER_VERSION = be0812c70be29b0666a89f22a9d403cfb4c48fca +RESPEAKER_SITE = $(call github,respeaker,seeed-voicecard,$(RESPEAKER_VERSION)) +RESPEAKER_LICENSE = GNU General Public License v3.0 +RESPEAKER_DEPENDENCIES = rpi-firmware + +$(eval $(kernel-module)) + +define RESPEAKER_INSTALL_TARGET_CMDS + $(INSTALL) -D -m 0755 $(BR2_EXTERNAL_MYCROFTOS_PATH)/package/respeaker/S16respeaker_modules \ + $(TARGET_DIR)/etc/init.d/S16respeaker_modules + $(INSTALL) -D -m 0755 $(BR2_EXTERNAL_MYCROFTOS_PATH)/package/respeaker/S60seeed_voicecard \ + $(TARGET_DIR)/etc/init.d/S60seeed_voicecard + + mkdir -p $(TARGET_DIR)/etc/voicecard + rm $(@D)/dkms.conf + $(INSTALL) -D -m 0644 $(@D)/*.conf $(TARGET_DIR)/etc/voicecard + $(INSTALL) -D -m 0644 $(@D)/*.state $(TARGET_DIR)/etc/voicecard + $(INSTALL) -D -m 0755 $(@D)/seeed-voicecard $(TARGET_DIR)/usr/bin + + $(INSTALL) -D -m 0644 $(@D)/seeed-2mic-voicecard.dtbo $(BINARIES_DIR)/rpi-firmware/overlays/ + $(INSTALL) -D -m 0644 $(@D)/seeed-4mic-voicecard.dtbo $(BINARIES_DIR)/rpi-firmware/overlays/ + $(INSTALL) -D -m 0644 $(@D)/seeed-8mic-voicecard.dtbo $(BINARIES_DIR)/rpi-firmware/overlays/ +endef + +$(eval $(generic-package)) From 949e20f576382bb6d90f9d70c3240a2c94a7f704 Mon Sep 17 00:00:00 2001 From: Peter Steenbergen Date: Fri, 2 Nov 2018 19:42:32 +0100 Subject: [PATCH 03/10] Buildroot: repeaker: Fix mistake in modules init script --- buildroot-external/package/respeaker/S16respeaker_modules | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/buildroot-external/package/respeaker/S16respeaker_modules b/buildroot-external/package/respeaker/S16respeaker_modules index 3096f833..ad89238f 100755 --- a/buildroot-external/package/respeaker/S16respeaker_modules +++ b/buildroot-external/package/respeaker/S16respeaker_modules @@ -1,3 +1,3 @@ -snd-soc-seeed-voicecard -snd-soc-ac108 -snd-soc-wm8960 +modprobe snd-soc-seeed-voicecard +modprobe snd-soc-ac108 +modprobe snd-soc-wm8960 From 312a86d9f6d7afa20ea6654f01731a27deb4662f Mon Sep 17 00:00:00 2001 From: Peter Steenbergen Date: Fri, 2 Nov 2018 21:01:07 +0100 Subject: [PATCH 04/10] Buildroot: Respeaker: Make rpi-userland a dependency of respeaker Wasn't aware dtoverlay was a binary derived from rpi userland firmware --- buildroot-external/configs/mycroftos_rpi3_defconfig | 2 ++ buildroot-external/package/respeaker/Config.in | 1 + 2 files changed, 3 insertions(+) diff --git a/buildroot-external/configs/mycroftos_rpi3_defconfig b/buildroot-external/configs/mycroftos_rpi3_defconfig index 96e73862..dd4806db 100644 --- a/buildroot-external/configs/mycroftos_rpi3_defconfig +++ b/buildroot-external/configs/mycroftos_rpi3_defconfig @@ -82,6 +82,7 @@ BR2_PACKAGE_RPI_WIFI_FIRMWARE=y BR2_PACKAGE_DBUS_PYTHON=y BR2_PACKAGE_KBD=y BR2_PACKAGE_PARTED=y +BR2_PACKAGE_RPI_USERLAND=y BR2_PACKAGE_PYTHON3=y BR2_PACKAGE_PYTHON3_PY_ONLY=y BR2_PACKAGE_PYTHON3_BZIP2=y @@ -177,6 +178,7 @@ BR2_PACKAGE_HOST_DOSFSTOOLS=y BR2_PACKAGE_HOST_GENIMAGE=y BR2_PACKAGE_HOST_MTOOLS=y BR2_PACKAGE_FANN=y +BR2_PACKAGE_RESPEAKER=y BR2_PACKAGE_PYTHON_ADAPT_PARSER=y BR2_PACKAGE_PYTHON_COVERALLS=y BR2_PACKAGE_PYTHON_DEPRECATED=y diff --git a/buildroot-external/package/respeaker/Config.in b/buildroot-external/package/respeaker/Config.in index 7f714b38..090d3b94 100644 --- a/buildroot-external/package/respeaker/Config.in +++ b/buildroot-external/package/respeaker/Config.in @@ -1,5 +1,6 @@ config BR2_PACKAGE_RESPEAKER bool "respeaker" + select BR2_PACKAGE_RPI_USERLAND help The ReSpeaker series is a family of development boards designed to enable From 0c72515fa8b9ad97ae4e39ee24ff4010fb4baa6b Mon Sep 17 00:00:00 2001 From: Peter Steenbergen Date: Fri, 2 Nov 2018 22:32:01 +0100 Subject: [PATCH 05/10] Buildroot: Respeaker: Make dtc a dependency of respeaker - Fixes /usr/bin/dtoverlay: can't load library 'libfdt.so' --- buildroot-external/configs/mycroftos_rpi3_defconfig | 1 - buildroot-external/package/respeaker/Config.in | 1 + buildroot-external/package/respeaker/respeaker.mk | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/buildroot-external/configs/mycroftos_rpi3_defconfig b/buildroot-external/configs/mycroftos_rpi3_defconfig index dd4806db..f00aa14b 100644 --- a/buildroot-external/configs/mycroftos_rpi3_defconfig +++ b/buildroot-external/configs/mycroftos_rpi3_defconfig @@ -82,7 +82,6 @@ BR2_PACKAGE_RPI_WIFI_FIRMWARE=y BR2_PACKAGE_DBUS_PYTHON=y BR2_PACKAGE_KBD=y BR2_PACKAGE_PARTED=y -BR2_PACKAGE_RPI_USERLAND=y BR2_PACKAGE_PYTHON3=y BR2_PACKAGE_PYTHON3_PY_ONLY=y BR2_PACKAGE_PYTHON3_BZIP2=y diff --git a/buildroot-external/package/respeaker/Config.in b/buildroot-external/package/respeaker/Config.in index 090d3b94..69fe5821 100644 --- a/buildroot-external/package/respeaker/Config.in +++ b/buildroot-external/package/respeaker/Config.in @@ -1,6 +1,7 @@ config BR2_PACKAGE_RESPEAKER bool "respeaker" select BR2_PACKAGE_RPI_USERLAND + select BR2_PACKAGE_DTC help The ReSpeaker series is a family of development boards designed to enable diff --git a/buildroot-external/package/respeaker/respeaker.mk b/buildroot-external/package/respeaker/respeaker.mk index e82b3577..2bc936e7 100644 --- a/buildroot-external/package/respeaker/respeaker.mk +++ b/buildroot-external/package/respeaker/respeaker.mk @@ -7,7 +7,7 @@ RESPEAKER_VERSION = be0812c70be29b0666a89f22a9d403cfb4c48fca RESPEAKER_SITE = $(call github,respeaker,seeed-voicecard,$(RESPEAKER_VERSION)) RESPEAKER_LICENSE = GNU General Public License v3.0 -RESPEAKER_DEPENDENCIES = rpi-firmware +RESPEAKER_DEPENDENCIES = rpi-firmware rpi-userland dtc $(eval $(kernel-module)) From 5a0097334a57fd0d209c4801fc2ce777864f0cce Mon Sep 17 00:00:00 2001 From: Peter Steenbergen Date: Fri, 2 Nov 2018 22:53:00 +0100 Subject: [PATCH 06/10] Buildroot: Respeaker: We need dtc programs as well --- buildroot-external/package/respeaker/Config.in | 1 + 1 file changed, 1 insertion(+) diff --git a/buildroot-external/package/respeaker/Config.in b/buildroot-external/package/respeaker/Config.in index 69fe5821..8a01b876 100644 --- a/buildroot-external/package/respeaker/Config.in +++ b/buildroot-external/package/respeaker/Config.in @@ -2,6 +2,7 @@ config BR2_PACKAGE_RESPEAKER bool "respeaker" select BR2_PACKAGE_RPI_USERLAND select BR2_PACKAGE_DTC + select BR2_PACKAGE_DTC_PROGRAMS help The ReSpeaker series is a family of development boards designed to enable From 2d77d26a62bd76b1d264a7a5982c91d4f5dfe02e Mon Sep 17 00:00:00 2001 From: Peter Steenbergen Date: Fri, 2 Nov 2018 23:01:47 +0100 Subject: [PATCH 07/10] Buildroot: Respeaker: We need /dev/mmcblk0p1 to be mounted at /boot - Otherwise we cannot access the overlays --- buildroot-external/rootfs-overlay/etc/fstab | 1 + 1 file changed, 1 insertion(+) diff --git a/buildroot-external/rootfs-overlay/etc/fstab b/buildroot-external/rootfs-overlay/etc/fstab index 0a983ae3..0ff1bfdd 100644 --- a/buildroot-external/rootfs-overlay/etc/fstab +++ b/buildroot-external/rootfs-overlay/etc/fstab @@ -1,5 +1,6 @@ # /dev/root / ext2 rw,noauto 0 1 +/dev/mmcblk0p1 /boot vfat defaults 0 2 proc /proc proc defaults 0 0 devpts /dev/pts devpts defaults,gid=5,mode=620,ptmxmode=0666 0 0 tmpfs /dev/shm tmpfs mode=0777 0 0 From d6f6c07c123531b66ef88b4fc38cd380f389bcf6 Mon Sep 17 00:00:00 2001 From: Peter Steenbergen Date: Fri, 2 Nov 2018 23:09:18 +0100 Subject: [PATCH 08/10] Buildroot: Respeaker: Mount configfs before starting seeed-voicecard --- buildroot-external/package/respeaker/S60seeed_voicecard | 1 + 1 file changed, 1 insertion(+) diff --git a/buildroot-external/package/respeaker/S60seeed_voicecard b/buildroot-external/package/respeaker/S60seeed_voicecard index 6d0492ae..f385a3cc 100755 --- a/buildroot-external/package/respeaker/S60seeed_voicecard +++ b/buildroot-external/package/respeaker/S60seeed_voicecard @@ -7,6 +7,7 @@ umask 077 start() { printf "Starting seeed-voicecard: " + mount -t configfs none /sys/kernel/config /usr/bin/seeed-voicecard touch /var/lock/seeed-voicecard echo "OK" From ceecabfe3c37c8af6147be2ed34fe0446b19c924 Mon Sep 17 00:00:00 2001 From: Peter Steenbergen Date: Sat, 3 Nov 2018 10:59:50 +0100 Subject: [PATCH 09/10] Buildroot: Respeaker: Change the way of loading seeed-voicecard - Only mount things if seeed-voicecard is ran - We can only start things so no need for start-stop-restart init --- .../package/respeaker/S16respeaker_modules | 5 +++ .../package/respeaker/S60seeed_voicecard | 45 +++---------------- buildroot-external/rootfs-overlay/etc/fstab | 1 - 3 files changed, 12 insertions(+), 39 deletions(-) diff --git a/buildroot-external/package/respeaker/S16respeaker_modules b/buildroot-external/package/respeaker/S16respeaker_modules index ad89238f..d659cfcd 100755 --- a/buildroot-external/package/respeaker/S16respeaker_modules +++ b/buildroot-external/package/respeaker/S16respeaker_modules @@ -1,3 +1,8 @@ +#!/bin/sh +# +# Load seeed-voicecard modules.... +# + modprobe snd-soc-seeed-voicecard modprobe snd-soc-ac108 modprobe snd-soc-wm8960 diff --git a/buildroot-external/package/respeaker/S60seeed_voicecard b/buildroot-external/package/respeaker/S60seeed_voicecard index f385a3cc..960228e4 100755 --- a/buildroot-external/package/respeaker/S60seeed_voicecard +++ b/buildroot-external/package/respeaker/S60seeed_voicecard @@ -1,42 +1,11 @@ #!/bin/sh # -# seeed-voicecard Starts seeed-voicecard. +# Configure seeed-voicecard.... # -umask 077 - -start() { - printf "Starting seeed-voicecard: " - mount -t configfs none /sys/kernel/config - /usr/bin/seeed-voicecard - touch /var/lock/seeed-voicecard - echo "OK" -} -stop() { - printf "Stopping seeed-voicecard: " - killall seeed-voicecard - rm -f /var/lock/seeed-voicecard - echo "OK" -} -restart() { - stop - start -} - -case "$1" in - start) - start - ;; - stop) - stop - ;; - restart|reload) - restart - ;; - *) - echo "Usage: $0 {start|stop|restart}" - exit 1 -esac - -exit $? - +echo "Starting seeed-voicecard..." +mount -t configfs none /sys/kernel/config +mkdir -p /boot +mount -t vfat /dev/mmcblk0p1 /boot +/usr/bin/seeed-voicecard +touch /var/lock/seeed-voicecard diff --git a/buildroot-external/rootfs-overlay/etc/fstab b/buildroot-external/rootfs-overlay/etc/fstab index 0ff1bfdd..0a983ae3 100644 --- a/buildroot-external/rootfs-overlay/etc/fstab +++ b/buildroot-external/rootfs-overlay/etc/fstab @@ -1,6 +1,5 @@ # /dev/root / ext2 rw,noauto 0 1 -/dev/mmcblk0p1 /boot vfat defaults 0 2 proc /proc proc defaults 0 0 devpts /dev/pts devpts defaults,gid=5,mode=620,ptmxmode=0666 0 0 tmpfs /dev/shm tmpfs mode=0777 0 0 From 2efec729d0444bd59c63c38594fbc76b901262a6 Mon Sep 17 00:00:00 2001 From: Peter Steenbergen Date: Sat, 3 Nov 2018 11:04:15 +0100 Subject: [PATCH 10/10] Buildroot: Bump initial image filesystem size. We are quickly running out of space, bumping filesystem size a bit till we have auto-expand implemented. --- buildroot-external/configs/mycroftos_rpi3_defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildroot-external/configs/mycroftos_rpi3_defconfig b/buildroot-external/configs/mycroftos_rpi3_defconfig index f00aa14b..f47582fa 100644 --- a/buildroot-external/configs/mycroftos_rpi3_defconfig +++ b/buildroot-external/configs/mycroftos_rpi3_defconfig @@ -171,7 +171,7 @@ BR2_PACKAGE_NANO=y BR2_PACKAGE_VIM=y BR2_TARGET_ROOTFS_EXT2=y BR2_TARGET_ROOTFS_EXT2_4=y -BR2_TARGET_ROOTFS_EXT2_SIZE="768M" +BR2_TARGET_ROOTFS_EXT2_SIZE="1024M" # BR2_TARGET_ROOTFS_TAR is not set BR2_PACKAGE_HOST_DOSFSTOOLS=y BR2_PACKAGE_HOST_GENIMAGE=y