User Tools

Site Tools


airflash

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
airflash [2021/08/20 09:50]
sausage Airflash image and imager links
airflash [2021/09/04 09:49] (current)
sausage [What use is this?]
Line 5: Line 5:
 ===== What is the AirFlash? ===== ===== What is the AirFlash? =====
  
-The AirFlash is an open-source standalone USB powered device that accepts up to four USB Flash drives and will serve their content out over WIFI to one or more users. ​This allows you to take it anywhere and plug it in to a USB power source. Within 90 seconds the device will be available.+The AirFlash is an open-source standalone USB powered device that accepts up to four USB Flash drives and will serve their content out over WIFI to one or more users. ​You can take it anywhere and plug it in to a USB power source. Within 90 seconds the device will be available.
  
-Security is at a minimum. The WIFI password should be printed on the underside of device for nearby users to gain access from their own computers.+Security is at a minimum. The WIFI password should be conveniently ​printed on the underside of the device for nearby users to gain access from their own computers.
  
 If you are just after assembly instructions and a pre-configured image for your SD Card, see the appropriate sections below. If you are just after assembly instructions and a pre-configured image for your SD Card, see the appropriate sections below.
Line 13: Line 13:
 ===== What use is this? ===== ===== What use is this? =====
  
-Great question. There are a couple of basic cases where the AirFlash comes in very handy. You may work for an organisation that does not allow USB flash drives or sticks to be inserted into a corporate laptop. ​So how are you going to get your latest ​downloaded ​podcast ​transferred to your USB-powered ​MP3 player in your carRemember, it is advised to speak to your IT department first.+Great question. There are a couple of basic cases where the AirFlash comes in very handy. You may work for an organisation that does not allow USB flash drives or sticks to be inserted into a corporate laptop. ​It could be difficult getting ​your latest podcast ​onto your USB MP3 player in the car. Or bringing in photos for the office celebration. ​Remember, it is advised to speak to your IT department first.
  
 You can plug the AirFlash into any nearby USB port (to provide power to the device), connect to the WIFI access point called ''​AirFlash'',​ and using your file manager copy your files across to whichever USB stick is connected to the AirFlash. You can plug the AirFlash into any nearby USB port (to provide power to the device), connect to the WIFI access point called ''​AirFlash'',​ and using your file manager copy your files across to whichever USB stick is connected to the AirFlash.
 +
 +{{ :​airflash:​wifi-ap.png?​nolink |}}
 +
 +{{ :​airflash:​sharing-sda1.png?​nolink |}}
  
 Another good use case is when you are at a LAN party and everyone needs access to the same map packs and patches for a particular game. By leaving the AirFlash plugged in somewhere at the party, everyone can connect to it and pull down what is required. Another good use case is when you are at a LAN party and everyone needs access to the same map packs and patches for a particular game. By leaving the AirFlash plugged in somewhere at the party, everyone can connect to it and pull down what is required.
  
-While the party host could just as easily open a share on his drive, ​there are usually ​a couple ​of problems with this. Firstly, they may be rebooting or switching between operating systems and are therefore unreliable. And second, there is always that one person who can'​t ​connect to the share. You know that person.+While the party host could just as easily open a share on his drive, ​they are usually ​patching and rebooting like the rest of us. And second, there is always that one person who can just never connect to the share. You know that person.
  
-===== How to build your own AirFlash ​=====+Having a separate, portable, dedicated share is a handy tool to keep in your kit. 
 + 
 +===== Parts required ​=====
  
 You will need the following off-the-shelf parts which can be sourced from the following vendors: You will need the following off-the-shelf parts which can be sourced from the following vendors:
Line 33: Line 39:
   * USB flash stick   * USB flash stick
   * HDMI adapter to suit the Pi Zero W - https://​core-electronics.com.au/​mini-hdmi-to-standard-hdmi-jack-adapter-for-raspberry-pi-zero.html   * HDMI adapter to suit the Pi Zero W - https://​core-electronics.com.au/​mini-hdmi-to-standard-hdmi-jack-adapter-for-raspberry-pi-zero.html
 +
 +{{ :​airflash:​airflash-logo-case.jpg?​direct&​600 |}}
 +
 +Huge thanks to my friend Sharm for producing the AirFlash case prints.
  
 ===== Assembly ===== ===== Assembly =====
  
 For assembly instructions for the Pi Zero W and the Zero4U 4-Port USB Board, see the manual here: http://​www.uugear.com/​doc/​Zero4U_UserManual.pdf For assembly instructions for the Pi Zero W and the Zero4U 4-Port USB Board, see the manual here: http://​www.uugear.com/​doc/​Zero4U_UserManual.pdf
- 
-===== What is the rationale for the technology choices? ===== 
- 
-Originally the AirFlash was going to be created using the ESP32 and harnessing the WIFI features and available FTP library. However, USB library support was difficult to find. And I wasn't overly keen to implementing a bit banged mass storage USB driver. 
- 
-Next I looked at the Raspberry Pi Pico and noticed it had some support for connecting a USB device. But I forgot that it didn't come with WIFI onboard. I didn't want to go into the complication of adding a module and then have casing considerations. 
- 
-I settled on the Raspberry Pi Zero W as it features WIFI, USB and good library support through the OS. Having a few seconds boot up time with an OS seemed a fairly pragmatic choice. ​ 
- 
-For the OS, I chose piCore (a port of Tiny Core Linux), for it's robust use of persistence. Hard power cycles do not corrupt the data or OS content of piCore, so power can be pulled from the device without incident. 
  
  
Line 53: Line 53:
 Once assembled, you can connect a mini-usb cable from your PC to the data USB on the Pi. You can connect a USB flash drive to any of the four USB ports (even without any working OS SD Card inserted), and the device will mount and directly serve the USB flash drive. Once assembled, you can connect a mini-usb cable from your PC to the data USB on the Pi. You can connect a USB flash drive to any of the four USB ports (even without any working OS SD Card inserted), and the device will mount and directly serve the USB flash drive.
  
-===== I just want the pre-built image =====+{{ :​airflash:​airflash-bare-test-drive.jpg?​direct&​600 |}} 
 + 
 +===== I just want pre-built image =====
  
 If you just want a working AirFlash setup, you can download this image that I made already set up and running. ​ If you just want a working AirFlash setup, you can download this image that I made already set up and running. ​
Line 61: Line 63:
 You can [[https://​waynejohnson.net/​airflash.zip | download the AirFlash image]], unzip and flash it using a tool like [[https://​www.osforensics.com/​tools/​write-usb-images.html | ImageUSB]] by Passmark or [[http://​rufus.ie/​en/​ | Rufus]] to your SD Card. You can [[https://​waynejohnson.net/​airflash.zip | download the AirFlash image]], unzip and flash it using a tool like [[https://​www.osforensics.com/​tools/​write-usb-images.html | ImageUSB]] by Passmark or [[http://​rufus.ie/​en/​ | Rufus]] to your SD Card.
  
-This image was designed on a 16GB SD Card so if your card is bigger, you might have to extend the partition.+This image was designed on a 16GB SD Card so if your card is bigger, you might have to [[https://​www.maketecheasier.com/​review-of-picore/​ | extend the partition]].
  
 Once flashed, insert the SD Card into the SD Card slot and boot your AirFlash. Once flashed, insert the SD Card into the SD Card slot and boot your AirFlash.
  
 If you would like the work through the process manually, continue on below. If you would like the work through the process manually, continue on below.
 +
 +
 +===== Second fastest way to build =====
 +
 +It is possible to install the piCore OS to an SD-Card as outlined in this article, but rather than follow the steps to create and edit all the files, you can download all the required files at the github repo instead:
 +
 +https://​github.com/​sausagejohnson/​AirFlashOnPi
 +
 +===== What is the rationale for the technology choices? =====
 +
 +Originally the AirFlash was going to be created using the ESP32 and harnessing the WIFI features and available FTP library. However, USB library support was difficult to find. And I wasn't overly keen to implementing a bit banged mass storage USB driver.
 +
 +Next I looked at the Raspberry Pi Pico and noticed it had some support for connecting a USB device. But I forgot that it didn't come with WIFI onboard. I didn't want to go into the complication of adding a module and then have casing considerations.
 +
 +I settled on the Raspberry Pi Zero W as it features WIFI, USB and good library support through the OS. Having a few seconds boot up time with an OS seemed a fairly pragmatic choice. ​
 +
 +For the OS, I chose piCore (a port of Tiny Core Linux), for it's robust use of persistence. Hard power cycles do not corrupt the data or OS content of piCore, so power can be pulled from the device without incident.
 +
  
 ===== The piCore Operating System ===== ===== The piCore Operating System =====
Line 90: Line 110:
 On the root of the SD Card is the README which is worth copying to your PC and keeping aside. ​ On the root of the SD Card is the README which is worth copying to your PC and keeping aside. ​
  
-Put the SD Card into the AirFlash, connect your HDMI to a TV or monitor. Connect power to the Micro-USB power port of the Pi Zero, and a Keyboard to one of the ports on the 4 port. You will boot into piCore Linux.+Put the SD Card into the AirFlash, connect your HDMI to a TV or monitor. Connect power to the Micro-USB power port of the Pi Zero, and a Keyboard to one of the ports on the 4 port. piCore Linux will boot up.
  
   Username: tc   Username: tc
Line 99: Line 119:
 ===== Extended the partitions to allow saving ===== ===== Extended the partitions to allow saving =====
  
-Use the README from the root of the SD Card to learn how to extend the Linux partition. This will be required so that changes to piCore can be persisted and extra packages can be downloaded and installed.+Use the README from the root of the SD Card to learn how to extend the Linux partition. Alternatively [[https://​www.maketecheasier.com/​review-of-picore/​ | good instructions are also here]]. This will be required so that changes to piCore can be persisted and extra packages can be downloaded and installed.
  
  
Line 160: Line 180:
 Note: //the nettle dependency comes from TinyCoreLinux 12.x instead of 13.x. This is because there is a dependency error for Samba in the 13.x packages.// Note: //the nettle dependency comes from TinyCoreLinux 12.x instead of 13.x. This is because there is a dependency error for Samba in the 13.x packages.//
  
-Insert ​the USB stick into one of the AirFlash USB ports and then mount the drive.+Remove ​the USB stick from your PC and plug it into one of the AirFlash USB ports and then mount the drive.
  
 After mounting the USB flash drive (usually this will be: ''​mount /​mnt/​sda''​),​ you can copy these files to the /​mnt/​mmcblk0p2/​tce/​optional/​ folder. This is where the system looks for tcz extensions. After mounting the USB flash drive (usually this will be: ''​mount /​mnt/​sda''​),​ you can copy these files to the /​mnt/​mmcblk0p2/​tce/​optional/​ folder. This is where the system looks for tcz extensions.
 +
 +{{ :​airflash:​airflash-with-power-top.jpg?​direct&​600 |}}
  
 ===== Enabling WIFI ===== ===== Enabling WIFI =====
Line 198: Line 220:
   chmod 755 /​mnt/​mmcblk0p2/​tce/​startairflash.sh   chmod 755 /​mnt/​mmcblk0p2/​tce/​startairflash.sh
  
-Edit the ''/​opt/​bootlocal.sh'' ​file and add the following at the bottom:+Edit the ''​bootlocal.sh''​ file with ''​ sudo vi /​opt/​bootlocal.sh''​ and add the following at the bottom:
  
 <​code>​ <​code>​
Line 223: Line 245:
  
 Create the ''​hostapd.conf''​ file at ''/​mnt/​mmcblk0p2/​tce/'' ​ Create the ''​hostapd.conf''​ file at ''/​mnt/​mmcblk0p2/​tce/'' ​
 +
 +Add the following to the file:
  
 <​code>​ <​code>​
Line 262: Line 286:
 dnsmasq is being used for it's DHCP features, not for it's DNS features. Don't let the name throw you. dnsmasq is being used for it's DHCP features, not for it's DNS features. Don't let the name throw you.
  
-Head into the tce folder so we can create a couple of config files: ​+Head into the ''​tce'' ​folder so we can create a couple of config files: ​
  
-  cd /​mnt/​mmcblk0p2/​tce/options+  cd /​mnt/​mmcblk0p2/​tce
  
-Load the extension with:+First, load the extension with:
  
   tce-load -i dnsmasq.tcz   tce-load -i dnsmasq.tcz
Line 277: Line 301:
  
   sudo vi dnsmasq.conf   sudo vi dnsmasq.conf
 +
 +Add the following to the file:
  
 <​code>​ <​code>​
Line 298: Line 324:
  
 Excellent stuff. Now we have an access point and a DHCP service dishing out IP addresses to whoever should wish to connect. Now to provide Windows shares. But first we'll persist these changes so they don't get lost. Excellent stuff. Now we have an access point and a DHCP service dishing out IP addresses to whoever should wish to connect. Now to provide Windows shares. But first we'll persist these changes so they don't get lost.
 +
 +{{ :​airflash:​airflash-with-power.jpg?​direct&​600 |}}
  
 ===== Persisting hostapd and dnsmasq between reboots ===== ===== Persisting hostapd and dnsmasq between reboots =====
  
-Edit the ''/​mnt/​mmcblk0p2/​tce/​onboot.lst''​ to make it as:+Edit the ''​onboot.lst''​ file with: ''​sudo vi /​mnt/​mmcblk0p2/​tce/​onboot.lst''​ to make it as:
  
 <​code>​ <​code>​
Line 311: Line 339:
 </​code>​ </​code>​
  
-Add the following to the bottom of the ''/​opt/​bootlocal.sh'' ​file:+Edit the ''​bootlocal.sh''​ file with ''​sudo vi /​opt/​bootlocal.sh'' ​and add the following to the bottom:
  
 <​code>​ <​code>​
Line 344: Line 372:
   tce-load -i gmp.tcz   tce-load -i gmp.tcz
  
-Create a samba folder and a ''​smb.conf''​ config file at ''​usr/​local/​etc/​samba/'':​+Create a samba folder and a ''​smb.conf''​ config file with ''​sudo vi usr/​local/​etc/​samba/​smb.conf'':​
  
 <​code>​ <​code>​
Line 389: Line 417:
 This will persist the samba folder and the ''​smb.conf''​ for all future reboots. This will persist the samba folder and the ''​smb.conf''​ for all future reboots.
  
-Start Samba to test and to create the required default files.+Start Samba to test and to create the required default files:
  
   /​usr/​local/​etc/​init.d/​samba4 start   /​usr/​local/​etc/​init.d/​samba4 start
  
-Then to have this work on startup, add the same ''​samba4''​ line above into the ''​bootlocal.sh''​ script with:+Then to have this work on startup, add the same ''​samba4''​ line above into the bottom of the ''​bootlocal.sh''​ script with:
  
   sudo vi /​opt/​bootlocal.sh   sudo vi /​opt/​bootlocal.sh
  
 ''​filetool.sh -b''​ to persist the changes inside /opt and inside the new samba folder. ''​filetool.sh -b''​ to persist the changes inside /opt and inside the new samba folder.
 +
 +{{ :​airflash:​airflash-drive-connected.jpg?​direct&​600 |}}
  
 ===== Usershares ===== ===== Usershares =====
Line 432: Line 462:
 {{ :​airflash:​file-network.png?​nolink |}} {{ :​airflash:​file-network.png?​nolink |}}
  
-You will see a share and should be able to browse ​into a mounted /mnt/sda.+You will see a share and should be able to browse ​the files inside.
  
 {{ :​airflash:​sharing-sda1.png?​nolink |}} {{ :​airflash:​sharing-sda1.png?​nolink |}}
Line 449: Line 479:
 Create the following file at: Create the following file at:
  
-  /​etc/​udev/​rules.d/​999-usb-automount.rules+  ​sudo vi /​etc/​udev/​rules.d/​999-usb-automount.rules
  
 Add the following to the file: Add the following to the file:
Line 462: Line 492:
 </​code>​ </​code>​
  
 +I'll explain the above briefly. If a USB flash drive is inserted (add), it's name will be mounted and added to the usershare folder. If the flash drive is removed (remove), the usershare will be deleted, ''​fuser''​ will drop any usages to the share, ''​umount''​ with unmount the share and ''​rmdir''​ will remove the share folder from ''/​mnt''​. This gives us the most robust set up for inserting and removing random flash drives and USB sticks.
  
-Add the path to your rules file+Add the following ​path: 
   ​   ​
   etc/​udev/​rules.d/​999-usb-automount.rules   etc/​udev/​rules.d/​999-usb-automount.rules
   ​   ​
-to the .filetool.lst file with:+to the bottom of the ''​.filetool.lst'' ​file with:
  
   sudo vi /​opt/​.filetool.lst   sudo vi /​opt/​.filetool.lst
Line 473: Line 504:
   filetool.sh -b   filetool.sh -b
  
-Connecting a USB stick should make the drive appear when browsing \\10.0.0.1+Connecting a USB stick should make the drive appear when browsing ​''​\\10.0.0.1''​
  
-Congratulations! You have successfully built an AirFlash. I hope you enjoy using it, and that it becomes a handy tool for a variety of situations.+**Congratulations! You have successfully built an AirFlash.** I hope you enjoy using it, and that it becomes a handy tool for a variety of situations.
  
 Who knows, maybe even your IT department would appreciate having one on hand. Who knows, maybe even your IT department would appreciate having one on hand.
  
 +{{ :​airflash:​airflash-drives-connected.jpg?​direct&​600 |}}
  
 ===== Troubleshooting ===== ===== Troubleshooting =====
airflash.1629453009.txt.gz · Last modified: 2021/08/20 09:50 by sausage