initial commit

This commit is contained in:
Paolo Asperti 2019-11-04 19:43:19 +01:00
parent 02b1891ca7
commit 73119a5f73
Signed by: paspo
GPG Key ID: 06D46905D19D5182
47 changed files with 74 additions and 1 deletions

View File

@ -1,3 +1,72 @@
# sonoff-flasher
an AlpineLinux image targeted at raspberry pi zero W for sonoff-diy autoflashing with Tasmota
An AlpineLinux image targeted at raspberry pi zero W for sonoff-diy autoflashing with Tasmota.
## BIG FAT WARNING
** this is only a proof of concept, that's no guarantee whatsoever that it's working as intended **
** there's a big chance to brick your device **
** as with anything that works with mains voltage, there's also risk of injury **
** go on if you're ok with all that, and also don't blame me if something goes wrong **
## installation instructions
### requirements
* internet connection
* raspberry pi zero W (pay attention as the non-wifi version is very similar)
* a small microsd card (1GB or more will go)
* an USB to microUSB cable (to give power to the rPi)
### instructions
1. [Download](https://alpinelinux.org/downloads/) the AlpineLinux image for raspberry (armhf architecture) from [here](http://dl-cdn.alpinelinux.org/alpine/v3.10/releases/armhf/alpine-rpi-3.10.3-armhf.tar.gz)
2. Format your microSD card as FAT32
3. Unpack the downloaded AlpineLinux into the microSD card
4. Copy all the files from [this repo](https://git.asperti.com/paspo/sonoff-flasher)'s rootfs directory into the microSD card
5. unmount the card and place it into the rPi
## usage
Power on the raspberry with the microSD card you just created and wait a minute for the OS to load.
Disconnect all the cables from your brand new Sonoff-mini, open it and insert the "DIY jumper" in the proper place. Close it, reconnect the wires and power it on.
In 2-3 minutes you should see a new wifi called "SONOFF-xxxx".
## info on sonoff DIY mode
When you enable the "DIY mode" for a sonoff, you should create a new wireless network called "sonoffDiy" with password "20170618sn", the sonoff connects with that network and you have the possibility to flash a different firmware using the "itead diy tool".
More info on that procedure [here](https://github.com/arendst/Tasmota/wiki/Sonoff-DIY).
## how does this thing works
* this tool creates the "sonoffDiy" wireless network (that's why we need a zero-W) with DHCP and DNS
* when a sonoff-mini connects, it assigns an IP address
* it scans the network (via avahi-browser) to get the IP address of the sonoff and its ID
* it the uses these informations to check if the sonoff is responding to zeroconf requests
* if it does, it requests an "ota-unlock": normally the firmware flashing is not enabled and when asked, the sonoff-mini "phones home" to signal that a OTA unlock has been requested for that specific ID.
* we don't have internet connection, so the raspberry tells the sonoff "I'm itead and you can enable OTA"
* then the raspberry requests a firmware upgrade, telling the sonoff to pick the firmware directly from the raspberry webserver
* the sonoff downloads the firmware, flashes it and reboots
* we now have a new tasmotized friend!
(you can remove the jumper now)
## more info
You can use your PC to power the raspberry, through the OTG port. If you do that, you have an emulated USB ethernet, with an IP address different from that on the wireless side.
SSH is enabled with root user and the default password is "root" (we need little to no security, as we won't need the raspberry anymore after the flashing)
The IP address on the USB side is: **10.111.101.1**
The IP address on the WIRELESS side is: **10.101.111.1**
You can find a log of the flashing script in **/root/flasher.log**
Everything is cleared at each reboot as the whole system is running from RAM. If you want to keep some modifications (e.g. an authorized_keys for ssh autologin) take a look at how it's done [here](https://wiki.alpinelinux.org/wiki/Alpine_local_backup)

BIN
rootfs/cache/APKINDEX.00740ba1.tar.gz vendored Executable file

Binary file not shown.

BIN
rootfs/cache/avahi-0.7-r2.a3dc179e.apk vendored Executable file

Binary file not shown.

BIN
rootfs/cache/avahi-libs-0.7-r2.177fc1e4.apk vendored Executable file

Binary file not shown.

BIN
rootfs/cache/avahi-tools-0.7-r2.020df0f0.apk vendored Executable file

Binary file not shown.

BIN
rootfs/cache/busybox-1.30.1-r3.b35db9b6.apk vendored Executable file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
rootfs/cache/curl-7.66.0-r0.201f3a8e.apk vendored Executable file

Binary file not shown.

BIN
rootfs/cache/db-5.3.28-r1.09f78627.apk vendored Executable file

Binary file not shown.

BIN
rootfs/cache/dbus-1.12.16-r0.7f58ab93.apk vendored Executable file

Binary file not shown.

Binary file not shown.

BIN
rootfs/cache/dnsmasq-2.80-r3.e14dc63c.apk vendored Executable file

Binary file not shown.

BIN
rootfs/cache/expat-2.2.8-r0.33f33731.apk vendored Executable file

Binary file not shown.

BIN
rootfs/cache/gamin-0.1.10-r10.14cc3b5b.apk vendored Executable file

Binary file not shown.

BIN
rootfs/cache/gdbm-1.13-r1.e5161d7a.apk vendored Executable file

Binary file not shown.

BIN
rootfs/cache/glib-2.60.4-r0.5234c2ca.apk vendored Executable file

Binary file not shown.

BIN
rootfs/cache/hostapd-2.8-r2.59a54ef5.apk vendored Executable file

Binary file not shown.

Binary file not shown.

0
rootfs/cache/installed vendored Executable file
View File

BIN
rootfs/cache/iptables-1.8.3-r0.70a1d42d.apk vendored Executable file

Binary file not shown.

Binary file not shown.

BIN
rootfs/cache/libbz2-1.0.6-r7.44bc60a6.apk vendored Executable file

Binary file not shown.

BIN
rootfs/cache/libcurl-7.66.0-r0.011fbf1b.apk vendored Executable file

Binary file not shown.

BIN
rootfs/cache/libdaemon-0.14-r2.2917b3b8.apk vendored Executable file

Binary file not shown.

BIN
rootfs/cache/libev-4.25-r0.287bab53.apk vendored Executable file

Binary file not shown.

BIN
rootfs/cache/libffi-3.2.1-r6.0276867d.apk vendored Executable file

Binary file not shown.

BIN
rootfs/cache/libgcc-8.3.0-r0.0ed7ed0d.apk vendored Executable file

Binary file not shown.

BIN
rootfs/cache/libintl-0.19.8.1-r4.d68d6f31.apk vendored Executable file

Binary file not shown.

BIN
rootfs/cache/libldap-2.4.48-r0.ebf1622a.apk vendored Executable file

Binary file not shown.

BIN
rootfs/cache/libmagic-5.37-r0.f3c6d630.apk vendored Executable file

Binary file not shown.

BIN
rootfs/cache/libmnl-1.0.4-r0.9776f8da.apk vendored Executable file

Binary file not shown.

BIN
rootfs/cache/libmount-2.33.2-r0.26cd95b6.apk vendored Executable file

Binary file not shown.

Binary file not shown.

BIN
rootfs/cache/libsasl-2.1.27-r3.4ded6f29.apk vendored Executable file

Binary file not shown.

BIN
rootfs/cache/libssh2-1.9.0-r1.a86bf347.apk vendored Executable file

Binary file not shown.

BIN
rootfs/cache/lighttpd-1.4.54-r0.0b297821.apk vendored Executable file

Binary file not shown.

Binary file not shown.

BIN
rootfs/cache/lua5.3-libs-5.3.5-r2.c5d72bd7.apk vendored Executable file

Binary file not shown.

BIN
rootfs/cache/mc-4.8.22-r0.33871a5c.apk vendored Executable file

Binary file not shown.

BIN
rootfs/cache/nano-4.3-r0.aa270573.apk vendored Executable file

Binary file not shown.

Binary file not shown.

BIN
rootfs/cache/pcre-8.43-r0.dd42c3f9.apk vendored Executable file

Binary file not shown.

BIN
rootfs/cache/ssl_client-1.30.1-r3.0ea45bbf.apk vendored Executable file

Binary file not shown.

1
rootfs/cmdline.txt Executable file
View File

@ -0,0 +1 @@
modules=loop,squashfs,sd-mod,usb-storage modules-load=dwc2,g_ether quiet console=tty1

Binary file not shown.

3
rootfs/usercfg.txt Executable file
View File

@ -0,0 +1,3 @@
gpu_mem=16
dtparam=audio=off
dtoverlay=dwc2