#Based on:
#2017-09-07-raspbian-stretch-lite
#This is for smaller usb-stick (easy). 
#Use full version at first time, easy to use.
#Copy this document to /boot (windows) after flash. After that just copy the command to #terminal

#Wifi setup for lite version:
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
#use your own ssid(name of the wlan) and passwords
network={
  ssid="my ssid"
  psk="mypassword"
}

#DWC2 usb driver:
echo "dtoverlay=dwc2" | sudo tee -a /boot/config.txt
echo "dtoverlay=usb-otg" | sudo tee -a /boot/config.txt

#Enable DWC2:
echo "dwc2" | sudo tee -a /etc/modules
echo "usb-otg" | sudo tee -a /etc/modules


#Create partition (~140M):
sudo dd if=/dev/zero of=/piusb.bin bs=512 count=2880
#For bigger "partition", use bigger count number(example 288000)
#Format to fat32:
sudo mkdosfs /piusb.bin

# rc.local edit:
sudo nano /etc/rc.local
#Small delay for g_mass_storage. Copy these:
/bin/sleep 35
/sbin/modprobe g_mass_storage file=/piusb.bin

#add these lines to this conf here:
sudo nano /etc/modprobe.d/g_mass_storage.conf
options g_mass_storage file=//piusb.bin stall=0 removable=1 idVendor=0x0781 idProduct=0x5572 bcdDevice=0x011a iManufacturer=SanDisk iProduct=Cruzer Switch iSerialNumber=1234567890"









#Based on:
#2017-04-10-raspbian-jessie. This Raspbian version is also compatible for TalologgerPi #(v1.1e)
#This for separated partition. I used Gparted-live (windows-pc) for partitions after flashed #Etcher the Raspbian to SD-card. 
#Wifi setup (if you use light version):
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
#use your own ssid(name of the wlan) and passwords
network={
  ssid="my ssid"
  psk="mypassword"
}

#DWC2 usb driver:
echo "dtoverlay=dwc2" | sudo tee -a /boot/config.txt
echo "dtoverlay=usb-otg" | sudo tee -a /boot/config.txt

#Enable DWC2:
echo "dwc2" | sudo tee -a /etc/modules
echo "usb-otg" | sudo tee -a /etc/modules

#rc.local edit:
sudo nano /etc/rc.local
#Copy to rc.local:
/bin/sleep 35
/sbin/modprobe g_mass_storage file=/dev/mmcblk0p3


#add these lines to this conf here:
sudo nano /etc/modprobe.d/g_mass_storage.conf
options g_mass_storage file=/dev/mmcblk0p3 stall=0 removable=1 idVendor=0x0781 idProduct=0x5572 bcdDevice=0x011a iManufacturer=SanDisk iProduct=Cruzer Switch iSerialNumber=1234567890"






