diff --git a/configs/nonlinear_wifi_usbrescue_defconfig b/configs/nonlinear_wifi_usbrescue_defconfig new file mode 100644 index 0000000000..832e8907a8 --- /dev/null +++ b/configs/nonlinear_wifi_usbrescue_defconfig @@ -0,0 +1,88 @@ +BR2_arm=y +BR2_cortex_a8=y +BR2_PRIMARY_SITE="http://sources.buildroot.net" +BR2_CCACHE=y +BR2_OPTIMIZE_3=y +BR2_KERNEL_HEADERS_4_4=y +BR2_TOOLCHAIN_BUILDROOT_GLIBC=y +BR2_GLIBC_VERSION_2_23=y +BR2_GCC_VERSION_5_X=y +BR2_EXTRA_GCC_CONFIG_OPTIONS="--with-fpu=vfpv3 --with-float=hard" +BR2_TOOLCHAIN_BUILDROOT_CXX=y +BR2_GENERATE_LOCALE="en_US" +BR2_TARGET_GENERIC_HOSTNAME="nonlinux" +BR2_TARGET_GENERIC_ISSUE="Nonlinux by Nonlinear-Labs" +BR2_INIT_SYSTEMD=y +BR2_SYSTEM_BIN_SH_BASH=y +BR2_ROOTFS_OVERLAY="nonlinear/fs-overlay-usbrescue" +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_GIT=y +BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/nonlinear-labs-dev/linux.git" +BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="nonlinear-am33xx-4.4.50" +BR2_LINUX_KERNEL_DEFCONFIG="nonlinear" +BR2_LINUX_KERNEL_UIMAGE=y +BR2_LINUX_KERNEL_UIMAGE_LOADADDR="0x80008000" +BR2_LINUX_KERNEL_DTS_SUPPORT=y +BR2_LINUX_KERNEL_INTREE_DTS_NAME="am335x-boneblack" +BR2_PACKAGE_BUSYBOX_SELINUX=y +BR2_PACKAGE_BZIP2=y +BR2_PACKAGE_LINUX_FIRMWARE=y +BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT61=y +BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT73=y +BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT2XX=y +BR2_PACKAGE_LINUX_FIRMWARE_RTL_81XX=y +BR2_PACKAGE_LINUX_FIRMWARE_RTL_87XX=y +BR2_PACKAGE_AVRDUDE=y +BR2_PACKAGE_FREETYPE=y +BR2_PACKAGE_DTC=y +BR2_PACKAGE_DTC_PROGRAMS=y +BR2_PACKAGE_TSLIB=y +BR2_PACKAGE_LIBSOUP=y +BR2_PACKAGE_LIBSOUP_SSL=y +BR2_PACKAGE_GLIBMM=y +BR2_PACKAGE_NCURSES_TARGET_PANEL=y +BR2_PACKAGE_NCURSES_TARGET_FORM=y +BR2_PACKAGE_NCURSES_TARGET_MENU=y +BR2_PACKAGE_DHCP=y +BR2_PACKAGE_DHCP_SERVER=y +BR2_PACKAGE_HOSTAPD=y +BR2_PACKAGE_HOSTAPD_EAP=y +BR2_PACKAGE_HOSTAPD_WPS=y +BR2_PACKAGE_IW=y +BR2_PACKAGE_NETWORK_MANAGER=y +BR2_PACKAGE_OPENSSH=y +BR2_PACKAGE_RSYNC=y +BR2_PACKAGE_SOCAT=y +BR2_PACKAGE_SSHPASS=y +BR2_PACKAGE_THTTPD=y +BR2_PACKAGE_WPA_SUPPLICANT=y +BR2_PACKAGE_WPA_SUPPLICANT_AP_SUPPORT=y +BR2_PACKAGE_WPA_SUPPLICANT_EAP=y +BR2_PACKAGE_WPA_SUPPLICANT_HOTSPOT=y +BR2_PACKAGE_WPA_SUPPLICANT_DEBUG_SYSLOG=y +BR2_PACKAGE_WPA_SUPPLICANT_WPS=y +BR2_PACKAGE_WPA_SUPPLICANT_CLI=y +BR2_PACKAGE_WPA_SUPPLICANT_WPA_CLIENT_SO=y +BR2_PACKAGE_WPA_SUPPLICANT_PASSPHRASE=y +BR2_PACKAGE_WPA_SUPPLICANT_DBUS_OLD=y +BR2_PACKAGE_WPA_SUPPLICANT_DBUS_NEW=y +BR2_PACKAGE_WPA_SUPPLICANT_DBUS_INTROSPECTION=y +BR2_PACKAGE_UTIL_LINUX_LOGIN_UTILS=y +BR2_PACKAGE_ESPI_DRIVER=y +BR2_PACKAGE_PLAYCONTROLLER_DRIVER=y +BR2_PACKAGE_MXLI=y +BR2_PACKAGE_NLIMAGEMAKER=y +BR2_TARGET_ROOTFS_INITRAMFS=y +BR2_TARGET_UBOOT=y +BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y +BR2_TARGET_UBOOT_CUSTOM_GIT=y +BR2_TARGET_UBOOT_CUSTOM_REPO_URL="https://github.com/nonlinear-labs-dev/u-boot.git" +BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION="nonlinear_v2016.11" +BR2_TARGET_UBOOT_BOARD_DEFCONFIG="nonlinear" +BR2_TARGET_UBOOT_FORMAT_IMG=y +BR2_TARGET_UBOOT_SPL=y +BR2_TARGET_UBOOT_SPL_NAME="MLO" +BR2_PACKAGE_HOST_DTC=y +BR2_PACKAGE_HOST_MKE2IMG=y +BR2_PACKAGE_HOST_UBOOT_TOOLS=y +BR2_PACKAGE_HOST_UTIL_LINUX=y diff --git a/nonlinear/fs-overlay-usbrescue/etc/dhcpd-usbnet.conf b/nonlinear/fs-overlay-usbrescue/etc/dhcpd-usbnet.conf new file mode 100644 index 0000000000..4e5600fe4d --- /dev/null +++ b/nonlinear/fs-overlay-usbrescue/etc/dhcpd-usbnet.conf @@ -0,0 +1,11 @@ +default-lease-time 600; +max-lease-time 7200; +option domain-name "nonlinear-labs.de"; +option broadcast-address 192.168.7.3; +option subnet-mask 255.255.255.252; + +subnet 192.168.7.0 netmask 255.255.255.252 + { + range 192.168.7.1 192.168.7.1; + } + diff --git a/nonlinear/fs-overlay-usbrescue/etc/fstab b/nonlinear/fs-overlay-usbrescue/etc/fstab new file mode 100644 index 0000000000..c9df47d8a1 --- /dev/null +++ b/nonlinear/fs-overlay-usbrescue/etc/fstab @@ -0,0 +1,9 @@ +# +/dev/root / ext2 rw,noauto 0 1 +proc /proc proc defaults 0 0 +devpts /dev/pts devpts defaults,gid=5,mode=620 0 0 +tmpfs /dev/shm tmpfs mode=0777 0 0 +tmpfs /tmp tmpfs mode=1777 0 0 +tmpfs /run tmpfs mode=0755,nosuid,nodev 0 0 +sysfs /sys sysfs defaults 0 0 +/dev/sda1 /mnt/usb-stick auto rw,auto,nofail,user,umask=0000 0 0 diff --git a/nonlinear/fs-overlay-usbrescue/etc/init.d/S50setup_nonlinear b/nonlinear/fs-overlay-usbrescue/etc/init.d/S50setup_nonlinear deleted file mode 100755 index cec9239140..0000000000 --- a/nonlinear/fs-overlay-usbrescue/etc/init.d/S50setup_nonlinear +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh -# -# Setup Nonlinear Labs Ecosystem -# - -start() { - printf "Setup Nonlinear Labs Ecosystem...." - /usr/bin/setup.sh -} - - -stop() { - printf "Setup Nonlinear Labs Ecosystem....Done" -} - -case "$1" in - start) - start - ;; - stop) - stop - ;; - restart|reload) - stop - start - ;; - *) - echo "Usage: $0 {start|stop|restart}" - exit 1 -esac - -exit $? diff --git a/nonlinear/fs-overlay-usbrescue/etc/inittab b/nonlinear/fs-overlay-usbrescue/etc/inittab deleted file mode 100644 index 43bacc6580..0000000000 --- a/nonlinear/fs-overlay-usbrescue/etc/inittab +++ /dev/null @@ -1,38 +0,0 @@ -# /etc/inittab -# -# Copyright (C) 2001 Erik Andersen -# -# Note: BusyBox init doesn't support runlevels. The runlevels field is -# completely ignored by BusyBox init. If you want runlevels, use -# sysvinit. -# -# Format for each entry: ::: -# -# id == tty to run on, or empty for /dev/console -# runlevels == ignored -# action == one of sysinit, respawn, askfirst, wait, and once -# process == program to run - -# Startup the system -null::sysinit:/bin/mount -t proc proc /proc -null::sysinit:/bin/mount -o remount,rw / -null::sysinit:/bin/mkdir -p /dev/pts -null::sysinit:/bin/mkdir -p /dev/shm -null::sysinit:/bin/mount -a -null::sysinit:/bin/hostname -F /etc/hostname -# now run any rc scripts -::sysinit:/etc/init.d/rcS - -# /sbin/getty invocation for tty0 -tty0::respawn:/sbin/getty 115200 tty0 - -# Put a getty on the serial port -console::respawn:/sbin/getty -L console 0 vt100 - -# Stuff to do for the 3-finger salute -::ctrlaltdel:/sbin/reboot - -# Stuff to do before rebooting -::shutdown:/etc/init.d/rcK -::shutdown:/sbin/swapoff -a -::shutdown:/bin/umount -a -r diff --git a/nonlinear/fs-overlay-usbrescue/etc/modules-load.d/espi_driver.conf b/nonlinear/fs-overlay-usbrescue/etc/modules-load.d/espi_driver.conf new file mode 100644 index 0000000000..f7f5386703 --- /dev/null +++ b/nonlinear/fs-overlay-usbrescue/etc/modules-load.d/espi_driver.conf @@ -0,0 +1,2 @@ +# Load NonlinearLabs espi_driver.ko for emphase devices at boot +espi_driver diff --git a/nonlinear/fs-overlay-usbrescue/etc/modules-load.d/lpc_bb_driver.conf b/nonlinear/fs-overlay-usbrescue/etc/modules-load.d/lpc_bb_driver.conf new file mode 100644 index 0000000000..7a5b9610bd --- /dev/null +++ b/nonlinear/fs-overlay-usbrescue/etc/modules-load.d/lpc_bb_driver.conf @@ -0,0 +1,2 @@ +# Load NonlinearLabs lpc_bb_driver.ko for emphase devices at boot +lpc_bb_driver diff --git a/nonlinear/fs-overlay-usbrescue/etc/network/interfaces b/nonlinear/fs-overlay-usbrescue/etc/network/interfaces new file mode 100644 index 0000000000..5a3ce71b6e --- /dev/null +++ b/nonlinear/fs-overlay-usbrescue/etc/network/interfaces @@ -0,0 +1,8 @@ +auto lo +iface lo inet loopback + +auto eth0 +iface eth0 inet static + address 192.168.10.11 + netmask 255.255.255.0 + diff --git a/nonlinear/fs-overlay-usbrescue/etc/ssh/sshd_config b/nonlinear/fs-overlay-usbrescue/etc/ssh/sshd_config new file mode 100644 index 0000000000..c4a3f5acd9 --- /dev/null +++ b/nonlinear/fs-overlay-usbrescue/etc/ssh/sshd_config @@ -0,0 +1,124 @@ +# $OpenBSD: sshd_config,v 1.80 2008/07/02 02:24:18 djm Exp $ + +# This is the sshd server system-wide configuration file. See +# sshd_config(5) for more information. + +# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin + +# The strategy used for options in the default sshd_config shipped with +# OpenSSH is to specify options with their default value where +# possible, but leave them commented. Uncommented options change a +# default value. + +#Port 22 +#AddressFamily any +#ListenAddress 0.0.0.0 +#ListenAddress :: + +# Disable legacy (protocol version 1) support in the server for new +# installations. In future the default will change to require explicit +# activation of protocol 1 +Protocol 2 + +# HostKey for protocol version 1 +#HostKey /etc/ssh_host_key +# HostKeys for protocol version 2 +#HostKey /etc/ssh_host_rsa_key +#HostKey /etc/ssh_host_dsa_key + +# Lifetime and size of ephemeral version 1 server key +#KeyRegenerationInterval 1h +#ServerKeyBits 1024 + +# Logging +# obsoletes QuietMode and FascistLogging +#SyslogFacility AUTH +#LogLevel INFO + +# Authentication: + +#LoginGraceTime 2m +PermitRootLogin yes +#StrictModes yes +#MaxAuthTries 6 +#MaxSessions 10 + +#RSAAuthentication yes +#PubkeyAuthentication yes +AuthorizedKeysFile .ssh/authorized_keys + +# For this to work you will also need host keys in /etc/ssh_known_hosts +#RhostsRSAAuthentication no +# similar for protocol version 2 +#HostbasedAuthentication no +# Change to yes if you don't trust ~/.ssh/known_hosts for +# RhostsRSAAuthentication and HostbasedAuthentication +#IgnoreUserKnownHosts no +# Don't read the user's ~/.rhosts and ~/.shosts files +#IgnoreRhosts yes + +# To disable tunneled clear text passwords, change to no here! +#PasswordAuthentication yes +PermitEmptyPasswords yes + +# Change to no to disable s/key passwords +#ChallengeResponseAuthentication yes + +# Kerberos options +#KerberosAuthentication no +#KerberosOrLocalPasswd yes +#KerberosTicketCleanup yes +#KerberosGetAFSToken no + +# GSSAPI options +#GSSAPIAuthentication no +#GSSAPICleanupCredentials yes + +# Set this to 'yes' to enable PAM authentication, account processing, +# and session processing. If this is enabled, PAM authentication will +# be allowed through the ChallengeResponseAuthentication and +# PasswordAuthentication. Depending on your PAM configuration, +# PAM authentication via ChallengeResponseAuthentication may bypass +# the setting of "PermitRootLogin without-password". +# If you just want the PAM account and session checks to run without +# PAM authentication, then enable this but set PasswordAuthentication +# and ChallengeResponseAuthentication to 'no'. +#UsePAM no + +#AllowAgentForwarding yes +#AllowTcpForwarding yes +#GatewayPorts no +X11Forwarding no +#X11DisplayOffset 10 +#X11UseLocalhost yes +#PrintMotd yes +PrintMotd no +#PrintLastLog yes +#TCPKeepAlive yes +#UseLogin no +#UsePrivilegeSeparation yes +#PermitUserEnvironment no +#Compression delayed +#ClientAliveInterval 0 +#ClientAliveCountMax 3 +UseDNS no +#PidFile /var/run/sshd.pid +#MaxStartups 10 +#PermitTunnel no +#ChrootDirectory none + +# no default banner path +#Banner none + +ClientAliveInterval 15 +ClientAliveCountMax 4 +AcceptEnv LANG LC_* + +# override default of no subsystems +Subsystem sftp /usr/libexec/sftp-server + +# Example of overriding settings on a per-user basis +#Match User anoncvs +# X11Forwarding no +# AllowTcpForwarding no +# ForceCommand cvs server diff --git a/nonlinear/fs-overlay-usbrescue/etc/systemd/journald.conf b/nonlinear/fs-overlay-usbrescue/etc/systemd/journald.conf new file mode 100644 index 0000000000..eae6ec1268 --- /dev/null +++ b/nonlinear/fs-overlay-usbrescue/etc/systemd/journald.conf @@ -0,0 +1,35 @@ +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. +# +# See journald.conf(5) for details + +[Journal] +Storage=persistent +#Compress=yes +#Seal=yes +#SplitMode=uid +#SyncIntervalSec=5m +#RateLimitInterval=30s +#RateLimitBurst=1000 +#SystemMaxUse= +#SystemKeepFree= +#SystemMaxFileSize= +#RuntimeMaxUse= +#RuntimeKeepFree= +#RuntimeMaxFileSize= +#MaxRetentionSec= +#MaxFileSec=1month +#ForwardToSyslog=no +#ForwardToKMsg=no +#ForwardToConsole=no +#ForwardToWall=yes +#TTYPath=/dev/console +#MaxLevelStore=debug +#MaxLevelSyslog=debug +#MaxLevelKMsg=notice +#MaxLevelConsole=info +#MaxLevelWall=emerg diff --git a/nonlinear/fs-overlay-usbrescue/etc/systemd/system/connect-to-nllserver.service b/nonlinear/fs-overlay-usbrescue/etc/systemd/system/connect-to-nllserver.service new file mode 100644 index 0000000000..9fc1174989 --- /dev/null +++ b/nonlinear/fs-overlay-usbrescue/etc/systemd/system/connect-to-nllserver.service @@ -0,0 +1,10 @@ +[Unit] +Description=Runs the script to connect to NLL server for maintenance purposes +After=network.target +Wants=network.target + +[Service] +ExecStart=/usr/bin/connect-to-nllserver.sh + +[Install] +WantedBy=multi-user.target diff --git a/nonlinear/fs-overlay-usbrescue/etc/systemd/system/dhcpd-usbnet.service b/nonlinear/fs-overlay-usbrescue/etc/systemd/system/dhcpd-usbnet.service new file mode 100644 index 0000000000..c0fb29900d --- /dev/null +++ b/nonlinear/fs-overlay-usbrescue/etc/systemd/system/dhcpd-usbnet.service @@ -0,0 +1,10 @@ +[Unit] +Description=DHCP Server for usbnet +After=syslog.target network.target + +[Service] +ExecStartPre=/bin/touch /tmp/dhcpd-usbnet.leases +ExecStart=/usr/sbin/dhcpd -d -q -cf /etc/dhcpd-usbnet.conf -lf /tmp/dhcpd-usbnet.leases -pf /tmp/usbnet.pid usb0 + +[Install] +WantedBy=multi-user.target diff --git a/nonlinear/fs-overlay-usbrescue/etc/systemd/system/multi-user.target.wants/connect-to-nllserver.service b/nonlinear/fs-overlay-usbrescue/etc/systemd/system/multi-user.target.wants/connect-to-nllserver.service new file mode 120000 index 0000000000..3f7877e245 --- /dev/null +++ b/nonlinear/fs-overlay-usbrescue/etc/systemd/system/multi-user.target.wants/connect-to-nllserver.service @@ -0,0 +1 @@ +../connect-to-nllserver.service \ No newline at end of file diff --git a/nonlinear/fs-overlay-usbrescue/etc/systemd/system/multi-user.target.wants/redirect-to-epc.service b/nonlinear/fs-overlay-usbrescue/etc/systemd/system/multi-user.target.wants/redirect-to-epc.service new file mode 120000 index 0000000000..57001c5d59 --- /dev/null +++ b/nonlinear/fs-overlay-usbrescue/etc/systemd/system/multi-user.target.wants/redirect-to-epc.service @@ -0,0 +1 @@ +nonlinear/fs-overlay/etc/systemd/system/redirect-to-epc.service \ No newline at end of file diff --git a/nonlinear/fs-overlay-usbrescue/etc/systemd/system/multi-user.target.wants/sshd.service b/nonlinear/fs-overlay-usbrescue/etc/systemd/system/multi-user.target.wants/sshd.service new file mode 120000 index 0000000000..d41264ec26 --- /dev/null +++ b/nonlinear/fs-overlay-usbrescue/etc/systemd/system/multi-user.target.wants/sshd.service @@ -0,0 +1 @@ +../sshd.service \ No newline at end of file diff --git a/nonlinear/fs-overlay-usbrescue/etc/systemd/system/redirect-to-epc.service b/nonlinear/fs-overlay-usbrescue/etc/systemd/system/redirect-to-epc.service new file mode 100644 index 0000000000..c9fc602f4d --- /dev/null +++ b/nonlinear/fs-overlay-usbrescue/etc/systemd/system/redirect-to-epc.service @@ -0,0 +1,13 @@ +[Unit] +Description=Redirect all incoming http traffic to ePC +After=syslog.target network.target + +[Service] +ExecStart=/bin/socat TCP-LISTEN:80,fork TCP:192.168.10.10:80 +Restart=always +RestartSec=1 +StartLimitInterval=200 +StartLimitBurst=5 + +[Install] +WantedBy=multi-user.target diff --git a/nonlinear/fs-overlay-usbrescue/etc/systemd/system/sshd.service b/nonlinear/fs-overlay-usbrescue/etc/systemd/system/sshd.service new file mode 100644 index 0000000000..b5e96b3a25 --- /dev/null +++ b/nonlinear/fs-overlay-usbrescue/etc/systemd/system/sshd.service @@ -0,0 +1,11 @@ +[Unit] +Description=OpenSSH server daemon +After=syslog.target network.target auditd.service + +[Service] +ExecStartPre=/usr/bin/ssh-keygen -A +ExecStart=/usr/sbin/sshd -D -e +ExecReload=/bin/kill -HUP $MAINPID + +[Install] +WantedBy=multi-user.target diff --git a/nonlinear/fs-overlay-usbrescue/etc/systemd/system/usbnet.service b/nonlinear/fs-overlay-usbrescue/etc/systemd/system/usbnet.service new file mode 100644 index 0000000000..6c79a07785 --- /dev/null +++ b/nonlinear/fs-overlay-usbrescue/etc/systemd/system/usbnet.service @@ -0,0 +1,11 @@ +[Unit] +Description=Load Ethernet over USB module +After=syslog.target network.target + +[Service] +Type=idle +ExecStart=/sbin/modprobe g_ether +TimeoutStartSec=30 + +[Install] +WantedBy=multi-user.target diff --git a/nonlinear/fs-overlay-usbrescue/etc/udev/rules.d/100-gether.rules b/nonlinear/fs-overlay-usbrescue/etc/udev/rules.d/100-gether.rules new file mode 100644 index 0000000000..ee5521d0be --- /dev/null +++ b/nonlinear/fs-overlay-usbrescue/etc/udev/rules.d/100-gether.rules @@ -0,0 +1 @@ +SUBSYSTEM=="usb", ATTR{idVendor}=="1d6b", ATTR{idProduct}=="0002", ACTION=="add", RUN+="/bin/systemctl start usbnet.service" diff --git a/nonlinear/fs-overlay-usbrescue/etc/udev/rules.d/100-usbnet.rules b/nonlinear/fs-overlay-usbrescue/etc/udev/rules.d/100-usbnet.rules new file mode 100644 index 0000000000..b5f3dc9d39 --- /dev/null +++ b/nonlinear/fs-overlay-usbrescue/etc/udev/rules.d/100-usbnet.rules @@ -0,0 +1,2 @@ +SUBSYSTEM=="net",ACTION=="add",KERNEL=="usb0",RUN+="/sbin/ifconfig usb0 192.168.7.2 netmask 255.255.255.252",RUN+="/bin/systemctl start dhcpd-usbnet.service" +SUBSYSTEM=="net",ACTION=="remove",KERNEL=="usb0",RUN+="/bin/systemctl stop dhcpd.service" diff --git a/nonlinear/fs-overlay-usbrescue/root/.ssh/authorized_keys b/nonlinear/fs-overlay-usbrescue/root/.ssh/authorized_keys new file mode 100644 index 0000000000..3c128beb2c --- /dev/null +++ b/nonlinear/fs-overlay-usbrescue/root/.ssh/authorized_keys @@ -0,0 +1,2 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAlxMKSV0nN1BR5kbfCjzgWcBP/737m2/zWUN39A/w2ye8C/IC0n20KgfuqtURj9wH2e40OZ/9DHz0r5vfmuUtr4NPtsmclOSXHMVKJrVySgXEnDyoKZYjQm4jU+j0jeNb3PQLiwqjuX8zxmMB4NuTSIHlI6bqh96kg18X7gD+Oxm5krIT+bRlA1YHkxjsohC5KEQ70O9TNp/waIdz713e+iSAfJ3MlrCcefDpLag10K2cncuzNqregW0LcIQ7e7I7EYbRnoTwb80YuFyc/Ru60KVoFjEAJAsJ9AQoRAQaq0vr9KCcnA0t5GKvegZBpD+9IXf0pvxdqJ1x67VCiAisHQ== hhoegelo@hho +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC5Zf7MemvmDPZBXCt3NS52PCV1+cUK4Fkcuya56peiPNgjx8ZSc6zh5FJCfpI6VwwYO7ZxMqBbXf1rLfJagcYOwhwFrq/9F3VZzGmLBR5Rzv4vCnaYBxoWCThn8DB3VeRX3WCdxcDndwfLDB3DkLXdiF+FVTgLrtwPoCUJlntcsCRiJGeQbBKHgSKKeNLkB6WRQF3PPFb6WKCewsnk81hLwyDJOVW5gb2sQHtNUi+PZJbP6X+33Z5o0hX20kelWkh7I61EQdzbxhny+kj/RpnFMcM2JR5jYDlVwGbxWY/MzN4xGwo5CZQx/3M9mQcmRq2pMrjj/+5puSFYM5WFOy07 billserver@localhost.localdomain diff --git a/nonlinear/fs-overlay-usbrescue/root/uEnv.txt b/nonlinear/fs-overlay-usbrescue/root/uEnv.txt new file mode 100755 index 0000000000..6d6135fa5b --- /dev/null +++ b/nonlinear/fs-overlay-usbrescue/root/uEnv.txt @@ -0,0 +1,3 @@ +uenvcmd=mmc rescan; load mmc 1:2 ${loadaddr} boot/uImage; load mmc 1:2 ${fdtaddr} boot/nonlinear-labs-2D.dtb; setenv mmcroot /dev/mmcblk0p2 ro; setenv mmcrootfstype ext4 rootwait; setenv bootargs console=${console} ${optargs} root=${mmcroot} rootfstype=${mmcrootfstype}; bootm ${loadaddr} - ${fdtaddr} +uname_r=nonlinear +uname_boot=mmc rescan; load mmc 1:2 ${loadaddr} boot/uImage; load mmc 1:2 ${fdtaddr} boot/nonlinear-labs-2D.dtb; setenv mmcroot /dev/mmcblk0p2 ro; setenv mmcrootfstype ext4 rootwait; setenv bootargs console=${console} ${optargs} root=${mmcroot} rootfstype=${mmcrootfstype}; bootm ${loadaddr} - ${fdtaddr} diff --git a/nonlinear/fs-overlay-usbrescue/usr/bin/connect-to-nllserver.sh b/nonlinear/fs-overlay-usbrescue/usr/bin/connect-to-nllserver.sh new file mode 100755 index 0000000000..73f444a901 --- /dev/null +++ b/nonlinear/fs-overlay-usbrescue/usr/bin/connect-to-nllserver.sh @@ -0,0 +1,84 @@ +#!/bin/sh +set -x + +LOG_FILE="/media/connection.log" +TIMEOUT=5 + +mount_stick () { + if ( ! ls -l /dev/ | grep sda ); then + echo "Missing USB device!" + exit + fi + + mounted=false + + while [ "$mounted" = false ]; do + if (lsblk | grep sda); then + echo "Found /dev/sda1. Mounting to /media" + mount /dev/sda1 /media || mount /dev/sda /media + mounted=true + rm $LOG_FILE + touch $LOG_FILE + fi + echo "Waiting for /dev/sda to appear..." + sleep 1 + done +return 0 +} + +connect_with_network () { + [ ! -e /media/access.txt ] && { echo "Access file missing!" >> $LOG_FILE; return 1; } + SSID=$(cat /media/access.txt | grep SSID | sed 's/.*://') + PWD=$(cat /media/access.txt | grep PASSWORD | sed 's/.*://') + + if ( ! systemctl status NetworkManager ); then + echo "Network Manager dead!" >> $LOG_FILE + return 1 + fi + + for COUNTER in $(seq 1 $TIMEOUT); do + if ( nmcli device status | grep wifi ); then + break + fi + [ $COUNTER -eq 5 ] && { echo "Wifi device not up!" >> $LOG_FILE; return 1; } + sleep 1 + done + + if ( ! nmcli device wifi list | grep $SSID ); then + echo "Sepcified network missing!" >> $LOG_FILE + return 1 + fi + + nmcli device wifi connect "$SSID" password "$PWD" || { echo "Cannot connect to network!" >> $LOG_FILE; return 1; } + return 0 +} + +connect_to_server () { + for COUNTER in $(seq 1 $TIMEOUT); do + echo "Ping ... $COUNTER/$TIMEOUT" >> $LOG_FILE + if ( ping -c 1 www.urverken.de ); then + break + fi + [ $COUNTER -eq 5 ] && { echo "Cannot ping server" >> $LOG_FILE; return 1; } + sleep 1 + done + + for COUNTER in $(seq 1 $TIMEOUT); do + echo "Connecting ... $COUNTER/$TIMEOUT" >> $LOG_FILE + if ( sshpass -p 'cBe18530-' ssh -vvNT -o StrictHostKeyChecking=no -o ExitOnForwardFailure=yes -R 12345:localhost:22 nonlinear@urverken.de >>$LOG_FILE 2>&1 ); then + break + fi + [ $COUNTER -eq 5 ] && { echo "Cannot connect to server" >> $LOG_FILE; return 1; } + sleep 1 + done + return 0 +} + +main () { + mount_stick || return 1 + connect_with_network || return 1 + connect_to_server || return 1 + return 0 +} + +main diff --git a/nonlinear/fs-overlay-usbrescue/usr/bin/install_to_emmc.sh b/nonlinear/fs-overlay-usbrescue/usr/bin/install_to_emmc.sh new file mode 100755 index 0000000000..ee602025ba --- /dev/null +++ b/nonlinear/fs-overlay-usbrescue/usr/bin/install_to_emmc.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +systemctl stop playground +umount /internalstorage +mkfs.ext3 -F /dev/mmcblk1p2 +mkdir -p /tmp/rootfs +mount /dev/mmcblk1p2 /tmp/rootfs +tar -C /tmp/rootfs -xf /rootfs.tar +rm /tmp/rootfs/etc/systemd/system/internalstorage.mount +cp /tmp/rootfs/boot/nonlinear-labs-2D.dtb /tmp/rootfs/boot/am335x-boneblack.dtb +cp /tmp/rootfs/boot/nonlinear-labs-2D.dtb /tmp/rootfs/boot/ + +cp /root/uEnv.txt /tmp/rootfs/boot/uEnv.txt + + +sync diff --git a/nonlinear/fs-overlay-usbrescue/usr/bin/setup.sh b/nonlinear/fs-overlay-usbrescue/usr/bin/setup.sh deleted file mode 100755 index b849809ebb..0000000000 --- a/nonlinear/fs-overlay-usbrescue/usr/bin/setup.sh +++ /dev/null @@ -1,106 +0,0 @@ -#!/bin/sh - -COUNT=0 - -row_on() { - R0=$1 - R1=$((R0*4)) - R2=$((R1+1)) - R3=$((R2+1)) - R4=$((R3+1)) - led_on $R1 - led_on $R2 - led_on $R3 - led_on $R4 -} - -row_off() { - R0=$1 - R1=$((R0*4)) - R2=$((R1+1)) - R3=$((R2+1)) - R4=$((R3+1)) - led_off $R1 - led_off $R2 - led_off $R3 - led_off $R4 -} - - -led_on() { - ADDR=$1 - R=$((ADDR+128)); T=$(printf "\\x%x" "$R"); echo -e $T > /dev/espi_led -} - -led_off() { - ADDR=$1 - R=$((ADDR+0)); T=$(printf "\\x%x" "$R"); echo -e $T > /dev/espi_led -} - -inc_progress() { - row_on $COUNT - COUNT=$((COUNT+1)) -} - -mount_stick() { - mounted=false - - while [ "$mounted" = false ]; do - - if (lsblk | grep sda); then - echo "Found /dev/sda1. Mounting to /media" - mount /dev/sda1 /media || mount /dev/sda /media - mounted=true; - else - echo "Waiting for /dev/sda1 to appear..." - sleep 1 - fi - done -} - -mount_stick -echo "this is a test!" >> /media/message.txt -exit - - - -modprobe espi_driver -inc_progress - -echo -e ',50M,c,*,,700M,83,,,,83\n' > sfdisk -f /dev/mmcblk0 -inc_progress -mkfs.fat /dev/mmcblk0p1 -inc_progress -mkfs.ext4 -L rootfs /dev/mmcblk0p2 -inc_progress -mkfs.ext4 -L data /dev/mmcblk0p3 -inc_progress - -mkdir -p /mnt/stick -mkdir -p /mnt/boot -mkdir -p /mnt/data -mkdir -p /mnt/rootfs -inc_progress - -mount /dev/sda1 /mnt/stick -mount /dev/mmcblk0p1 /mnt/boot -mount /dev/mmcblk0p2 /mnt/rootfs -mount /dev/mmcblk0p3 /mnt/data -inc_progress - -gunzip -c /mnt/stick/rootfs.tar.gz | tar -C /mnt/rootfs/ -xvf - -sync -inc_progress - -cp /mnt/stick/u-boot.img /mnt/boot -cp /mnt/stick/MLO /mnt/boot -sync -inc_progress - -umount /dev/sda1 -umount /dev/mmcblk0p1 -umount /dev/mmcblk0p2 -umount /dev/mmcblk0p3 -inc_progress - - diff --git a/nonlinear/fs-overlay-usbrescue/usr/lib/systemd/system/remount-rootfs.service b/nonlinear/fs-overlay-usbrescue/usr/lib/systemd/system/remount-rootfs.service new file mode 100644 index 0000000000..fe01c4fe98 --- /dev/null +++ b/nonlinear/fs-overlay-usbrescue/usr/lib/systemd/system/remount-rootfs.service @@ -0,0 +1,19 @@ +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + +[Unit] +Description=Remount Root FS +DefaultDependencies=no +Conflicts=shutdown.target +After=systemd-readahead-collect.service systemd-readahead-replay.service fsck-root.service +Before=local-fs-pre.target local-fs.target shutdown.target +Wants=local-fs-pre.target + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/bin/mount -o remount,rw / diff --git a/nonlinear/fs-overlay-usbrescue/var/log/anker b/nonlinear/fs-overlay-usbrescue/var/log/anker new file mode 100644 index 0000000000..81c2bde2bf --- /dev/null +++ b/nonlinear/fs-overlay-usbrescue/var/log/anker @@ -0,0 +1 @@ +This file is just here, so the fs-overlay replaces the symlink for /var/log in order to get persistent logging