diff --git a/raspberrypi/Makefile b/raspberrypi/Makefile index 180bab1..e822ccf 100644 --- a/raspberrypi/Makefile +++ b/raspberrypi/Makefile @@ -6,6 +6,8 @@ upgrade-all: upgrade-chef upgrade-arduino upgrade-fpga upgrade-filesystem # Périphérique bloc à utiliser pour flasher SDCARD=/dev/mmcblk0 +CON_MODE=wifi +ETH_IFACE=enp3s0 # SYSTÈME D'EXPLOITATION @@ -50,7 +52,12 @@ graphs: # Crée un fichier de conf utilisable pour s'y connecter sshconf: principalconf.sh +ifeq ($(CON_MODE), eth) + source $$PWD/$<; echo -e "Host principal p\n User root\n Hostname $$ETHADDRESS\n PreferredAuthentications publickey\n PubkeyAuthentication yes\n IdentityFile \"$$PWD/sshkey\"" > "$@" + source $$PWD/$<; sudo ip address add dev $(ETH_IFACE) $${ETHPEER}/20 peer $${ETHADDRESS} +else source $$PWD/$<; echo -e "Host principal p\n User root\n Hostname $$ADDRESS\n PreferredAuthentications publickey\n PubkeyAuthentication yes\n IdentityFile \"$$PWD/sshkey\"" > "$@" +endif source $$PWD/$<; echo -e "$$SSHCPRV" > sshkey chmod 600 sshkey @@ -72,10 +79,12 @@ reboot: sshconf upgrade-filesystem: sshconf configure make -C buildroot target-finalize @# TODO Récupérer les ACL plutot que de mettre tous les fichiers en root + ssh -F sshconf principal true rsync --rsh 'ssh -F sshconf' --archive --chown root:root buildroot/output/target/ principal:/ # Met jour les overlays (une partie des fichiers) upgrade-overlays: sshconf + ssh -F sshconf principal true rsync --rsh 'ssh -F sshconf' --archive --chown root:root robotech/chef/rootfs_overlay/ principal:/ # ARDUINO @@ -97,5 +106,6 @@ chef: upgrade-chef: chef make -C buildroot chef-reinstall + ssh -F sshconf principal true rsync --rsh 'ssh -F sshconf' --archive --chown root:root buildroot/output/target/opt/chef principal:/opt/ diff --git a/raspberrypi/board/robotech/cdfprincipal/post-build.sh b/raspberrypi/board/robotech/cdfprincipal/post-build.sh index 52255e5..56d7236 100755 --- a/raspberrypi/board/robotech/cdfprincipal/post-build.sh +++ b/raspberrypi/board/robotech/cdfprincipal/post-build.sh @@ -11,11 +11,17 @@ then # Network configuration echo -e " +auto eth0 +iface eth0 inet static + address ${ETHADDRESS} + netmask 255.255.255.0 + peer ${ETHPEER} + gateway ${ETHPEER} + auto wlan0 -iface wlan0 inet static - address $ADDRESS - netmask $NETMASK - gateway $GATEWAY +iface wlan0 inet dhcp + pre-up wpa_supplicant -D wext -B -iwlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf -P /var/run/wpa_supplicant.pid + pre-down start-stop-daemon -K -q -p /var/run/wpa_supplicant.pid " >> ${TARGET_DIR}/etc/network/interfaces # SSH configuration diff --git a/raspberrypi/board/robotech/cdfprincipal/rootfs_overlay/etc/extra.d/S40wifi b/raspberrypi/board/robotech/cdfprincipal/rootfs_overlay/etc/extra.d/S40wifi index a307d4b..f3333fa 100755 --- a/raspberrypi/board/robotech/cdfprincipal/rootfs_overlay/etc/extra.d/S40wifi +++ b/raspberrypi/board/robotech/cdfprincipal/rootfs_overlay/etc/extra.d/S40wifi @@ -7,15 +7,12 @@ start() { printf "Starting Wi-Fi connection: " # modprobe brcmfmac modprobe r8188eu - ip link set wlan0 up - wpa_supplicant -D wext -B -iwlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf -P /var/run/wpa_supplicant.pid ifup wlan0 echo "OK" } stop() { printf "Stopping Wi-Fi connection: " - start-stop-daemon -K -q -p /var/run/wpa_supplicant.pid ifdown wlan0 # rmmod brcmfmac rmmod r8188eu diff --git a/raspberrypi/principalconf.sh.demo b/raspberrypi/principalconf.sh.demo index 829a5eb..ef9c57c 100644 --- a/raspberrypi/principalconf.sh.demo +++ b/raspberrypi/principalconf.sh.demo @@ -1,11 +1,15 @@ WPASSID="MySSID" WPAKEYMGMT="WPA-PSK" WPAPSK=mypassword -ADDRESS=192.168.1.42 +ADDRESS=192.168.43.126 NETMASK=255.255.255.0 -GATEWAY=192.168.1.1 +GATEWAY=192.168.43.1 + +ETHADDRESS=192.168.82.80 +ETHPEER=192.168.82.65 + SSHCPUB="ecdsa-sha2-nistp256 ... principal@robotech" SSHCPRV="-----BEGIN EC PRIVATE KEY----- ... -----END EC PRIVATE KEY-----" -SSHSPRV="..." +SSHSPRV="AAAAE2VjZHNhLXNo...