I picked up a pi zero w at Micro Center while we were camping near Atlanta. I didn't mess with it until now. I knew that the USB and HDMI ports were a different form factor but I didn't buy any adapters at Micro Center (even though I knew I didn't have any at home) so I decided to try and get up and running on wifi without the benefit of video, keyboard, or serial access on the pi, but rather just customizing the sd card on my windows laptop.
I came close, but I didn't know until just now.
Continuing what I did previously in this thread, I downloaded picore 9.0.3 and:
- used 7zip to extract the picore img file.
- downloaded extensions needed for wifi
- installed cpio for windows
- created the directory structure /tmp/builtin/optional with extensions in the optional dir
- created onboot.lst and put it one dir up in /tmp/builtin
- created a bare format file list with:
dir /s /b > dir.txt
- edited the dir.txt to change it from absolute paths to relative path starting with tmp
- fed the path list into cpio and then into 7z with gzip compression via command line:
type dir.txt | cpio -H newc -o | 7z a -tgzip -si my_initramfs.gz
- tacked the original picore initramfs and my extra one together to create the new one:
copy /b 9.0.3_orig.gz + my_initramfs.gz 9.0.3.gz
- formatted an sd card with a 100mb fat32 partition and copied all the extracted picore files there but used my custom 9.0.3.gz
- I had a mydata.gz from before that had my wifi.db and stuff in it so I put that in the root of the sd card also
I put the sd card in and powered up the pi zero w. I had a green activity light but no idea what was really happening. I was hoping to see a new dhcp client address show up in my router but alas, nothing.
So I gave up and ordered an adapter kit from Amazon and also a serial cable, I got the adapter kit tonight (serial cable tomorrow) so I hooked it up to the TV to see what was going on. The only mistake I made was the direction of the slashes in my dir.txt file (rookie!) I could see right away that my extensions were being extracted into the root and their filenames were the full paths with windows style back slashes in them. So I went back to my laptop and just did a replace in dir.txt changing the direction of the slashes to be linux style forward slashes. The cpio command line above worked fine still and then I moved the card back to the pi and it came right up on wifi.
So I was close
Sounds kind of convoluted I know but I think it's kind of cool to be able to prep the sd card completely from Windows and have it actually work!