From d6379f9f991b324abfeb444a4956329385e37ebc Mon Sep 17 00:00:00 2001 From: Peter Steenbergen Date: Wed, 6 Feb 2019 13:03:03 +0100 Subject: [PATCH] MycroftOS: Multiple fixes and tweaks. - install locale binary from glibc into target - allow mycroft to SSH into the box - add of sudo command / binary - folder permission issues --- .../board/raspberrypi/device_table.txt | 26 +++++++++++++++++++ .../configs/mycroftos_rpi3_defconfig | 2 ++ .../rootfs-overlay/etc/ssh/sshd_config | 1 + .../rootfs-overlay/etc/sudoers.d/mycroft | 1 + ...tall-glibc-locale-binary-into-target.patch | 25 ++++++++++++++++++ 5 files changed, 55 insertions(+) create mode 100644 buildroot-external/board/raspberrypi/device_table.txt create mode 100644 buildroot-external/rootfs-overlay/etc/sudoers.d/mycroft create mode 100644 buildroot-patches/0016-Install-glibc-locale-binary-into-target.patch diff --git a/buildroot-external/board/raspberrypi/device_table.txt b/buildroot-external/board/raspberrypi/device_table.txt new file mode 100644 index 00000000..ef47e223 --- /dev/null +++ b/buildroot-external/board/raspberrypi/device_table.txt @@ -0,0 +1,26 @@ +# See package/makedevs/README for details +# +# This device table is used to assign proper ownership and permissions +# on various files. It doesn't create any device file, as it is used +# in both static device configurations (where /dev/ is static) and in +# dynamic configurations (where devtmpfs, mdev or udev are used). +# +# +/dev d 755 0 0 - - - - - +/tmp d 1777 0 0 - - - - - +/etc d 755 0 0 - - - - - +/root d 700 0 0 - - - - - +/var d 777 0 0 - - - - - +/var/log d 777 0 0 - - - - - +/var/www d 755 33 33 - - - - - +/opt d 777 0 0 - - - - - +/opt/mycroft d 777 0 0 - - - - - +/opt/mycroft/skills d 777 0 0 - - - - - +/etc/shadow f 600 0 0 - - - - - +/etc/passwd f 644 0 0 - - - - - +/etc/network/if-up.d d 755 0 0 - - - - - +/etc/network/if-pre-up.d d 755 0 0 - - - - - +/etc/network/if-down.d d 755 0 0 - - - - - +/etc/network/if-post-down.d d 755 0 0 - - - - - +# uncomment this to allow starting x as non-root +#/usr/X11R6/bin/Xfbdev f 4755 0 0 - - - - - diff --git a/buildroot-external/configs/mycroftos_rpi3_defconfig b/buildroot-external/configs/mycroftos_rpi3_defconfig index eb95a878..428c27d1 100644 --- a/buildroot-external/configs/mycroftos_rpi3_defconfig +++ b/buildroot-external/configs/mycroftos_rpi3_defconfig @@ -12,6 +12,7 @@ BR2_TOOLCHAIN_GLIBC_GCONV_LIBS_COPY=y BR2_TARGET_GENERIC_HOSTNAME="MycroftOS" BR2_TARGET_GENERIC_ISSUE="Welcome to MycroftOS" BR2_INIT_SYSTEMD=y +BR2_ROOTFS_DEVICE_TABLE="../buildroot-external/board/raspberrypi3/device_table.txt" BR2_TARGET_GENERIC_ROOT_PASSWD="mycroft" BR2_SYSTEM_BIN_SH_BASH=y # BR2_TARGET_GENERIC_GETTY is not set @@ -162,6 +163,7 @@ BR2_PACKAGE_WPA_SUPPLICANT_PASSPHRASE=y BR2_PACKAGE_BASH_COMPLETION=y BR2_PACKAGE_FILE=y BR2_PACKAGE_SCREEN=y +BR2_PACKAGE_SUDO=y BR2_PACKAGE_TIME=y BR2_PACKAGE_WHICH=y BR2_PACKAGE_HTOP=y diff --git a/buildroot-external/rootfs-overlay/etc/ssh/sshd_config b/buildroot-external/rootfs-overlay/etc/ssh/sshd_config index 44fff67b..70c744a3 100644 --- a/buildroot-external/rootfs-overlay/etc/ssh/sshd_config +++ b/buildroot-external/rootfs-overlay/etc/ssh/sshd_config @@ -33,6 +33,7 @@ PermitRootLogin yes #StrictModes yes #MaxAuthTries 6 #MaxSessions 10 +AllowUsers mycroft #PubkeyAuthentication yes diff --git a/buildroot-external/rootfs-overlay/etc/sudoers.d/mycroft b/buildroot-external/rootfs-overlay/etc/sudoers.d/mycroft new file mode 100644 index 00000000..df2d469b --- /dev/null +++ b/buildroot-external/rootfs-overlay/etc/sudoers.d/mycroft @@ -0,0 +1 @@ +mycroft ALL = ALL diff --git a/buildroot-patches/0016-Install-glibc-locale-binary-into-target.patch b/buildroot-patches/0016-Install-glibc-locale-binary-into-target.patch new file mode 100644 index 00000000..a170d2e8 --- /dev/null +++ b/buildroot-patches/0016-Install-glibc-locale-binary-into-target.patch @@ -0,0 +1,25 @@ +From 9f17489757e974bd7781544b719392e22395cd8e Mon Sep 17 00:00:00 2001 +From: Peter Steenbergen +Date: Wed, 6 Feb 2019 08:40:32 +0100 +Subject: [PATCH 1/1] Install glibc locale binary into target + +--- + package/glibc/glibc.mk | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/package/glibc/glibc.mk b/package/glibc/glibc.mk +index 88178d7eb9..5ce1aafb7c 100644 +--- a/package/glibc/glibc.mk ++++ b/package/glibc/glibc.mk +@@ -134,6 +134,8 @@ GLIBC_LIBS_LIB += libthread_db.so.* + endif + + define GLIBC_INSTALL_TARGET_CMDS ++ $(INSTALL) -m 0755 -D $(@D)/build/locale/locale \ ++ $(TARGET_DIR)/usr/bin/locale + for libpattern in $(GLIBC_LIBS_LIB); do \ + $(call copy_toolchain_lib_root,$$libpattern) ; \ + done +-- +2.11.0 +