[root tip] [How To] Hacking ARM install image to connect to your WiFi

Difficulty: ★★☆☆☆

Source: Arch ARM image WiFi hack | root.nix.dk

ARM image WiFi connection hack

This is specifically useful for Pi Zero W but it works for any Pi with onboard wifi.

Assuming you already have downloaded a Manjaro ARM image (any flavor) and written to your sd-card and now you have the urge to connect over WiFi to finalize the setup process.

Prerequisite

  • sd-card prepared with Manjaro ARM image

Hack it

Open a terminal and do

su -l root

Mount the root image from the sdcard

mkdir tmproot
mount /dev/mmcblk0p2 tmproot

Create a network definition

cat << EOF >> tmproot/etc/systemd/network/wlan0.network
[Match]
Name=wlan0

[Network]
DHCP=yes
EOF

Create a wpa_supplicant configuration - replace the variables $SSID and $PASS with your actual values (keep the quotation marks - it ensures special characters are not misinterpreted)

wpa_passphrase "$SSID" "$PASS" > tmproot/etc/wpa_supplicant/wpa_supplicant-wlan0.conf

Create a symlink to start wpa_supplicant for the wlan0 network

ln -s /usr/lib/systemd/system/wpa_supplicant@.service \
      tmproot/etc/systemd/system/multi-user.target.wants/wpa_supplicant@wlan0.service

Unmount the partition and exit root context

umount tmproot
rm -r tmproot
exit

A complete script - optionally setting a static IP

Insert the sd-card in your pi and power up.