User Tools

Site Tools


airflash

Differences

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

Link to this comparison view

Next revision
Previous revision
Next revision Both sides next revision
airflash [2021/08/18 13:18]
sausage created
airflash [2021/08/20 10:59]
sausage image change
Line 1: Line 1:
 ====== AirFlash for the Pi Zero ====== ====== AirFlash for the Pi Zero ======
  
-//Please note that the AirFlash is not to be used for illegal purposes or to assist in copyright theftIf you want access to copyright material, (I'm sure you earn a wage) please ensure you pay for it.//+{{ :​airflash:​airflash-with-logo.jpg?​direct&​400|}}
  
 ===== What is the AirFlash? ===== ===== What is the AirFlash? =====
Line 16: Line 16:
  
 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, 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.
- 
-===== 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. 
  
 ===== How to build your own AirFlash ===== ===== How to build your own AirFlash =====
  
-You will need the following 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:
  
   * Raspberry Pi Zero W - https://​core-electronics.com.au/​raspberry-pi-zero-w-wireless.html   * Raspberry Pi Zero W - https://​core-electronics.com.au/​raspberry-pi-zero-w-wireless.html
Line 42: Line 36:
   * USB Mini cable   * USB Mini cable
   * 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
  
 ===== 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.
 +
  
 ===== Testing the board with a USB Flash Drive ===== ===== Testing the board with a USB Flash Drive =====
Line 57: Line 63:
 This is the fastest way to make an AirFlash. This is the fastest way to make an AirFlash.
  
-You can [[https://​waynejohnson.net/​airflash.zip | download the AirFlash image]], unzip and flash it using a tool like ''​imageUSB'' ​or ''​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.
Line 65: Line 71:
 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.
  
-===== The Operating System =====+===== The piCore ​Operating System =====
  
-The OS chosen for this project is piCore for it's light payload ​and start up time. All versions of piCore are located here: http://​forum.tinycorelinux.net/​index.php/​board,​72.0.html+For those wanting to build everything from scratch, let's go! 
 + 
 +The OS chosen for this project is piCore for it's light payloadstart up time and resilliance. All versions of piCore are located here: http://​forum.tinycorelinux.net/​index.php/​board,​72.0.html
  
 I have used piCore-13.0.3 (32-bit): ​ I have used piCore-13.0.3 (32-bit): ​
Line 78: Line 86:
 Good instructions for installing piCore to a micro SD Card can be found here: https://​www.maketecheasier.com/​review-of-picore/​ Good instructions for installing piCore to a micro SD Card can be found here: https://​www.maketecheasier.com/​review-of-picore/​
  
-I used imageUSB ​by PassMark to write the image to the SD Card, but there are loads of software options out there (like Rufus) that do the same job equally well.+I used [[https://​www.osforensics.com/​tools/​write-usb-images.html | ImageUSB]] ​by PassMark to write the image to the SD Card, but there are loads of software options out there (like [[http://​rufus.ie/​en/​ | Rufus]]) that do the same job equally well.
  
 Once you have written piCore to the SD Card from that article, head back here. Once you have written piCore to the SD Card from that article, head back here.
Line 86: Line 94:
 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 95: Line 103:
 ===== 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 156: Line 164:
 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.
Line 194: Line 202:
   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 219: Line 227:
  
 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 258: Line 268:
 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 273: Line 283:
  
   sudo vi dnsmasq.conf   sudo vi dnsmasq.conf
 +
 +Add the following to the file:
  
 <​code>​ <​code>​
Line 297: Line 309:
 ===== 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 307: Line 319:
 </​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 340: Line 352:
   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 385: Line 397:
 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
Line 428: Line 440:
 {{ :​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 445: Line 457:
 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 458: Line 470:
 </​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 469: Line 482:
   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.txt · Last modified: 2021/09/04 09:49 by sausage