Sniffleupagus / pwnagotchi-snflpgs

(⌐■_■) - Deep Reinforcement Learning instrumenting bettercap for WiFi pwning.
https://pwnagotchi.ai/
Other
15 stars 0 forks source link

Adding waveshare 1.54 inch v2 support - Creating the .img file #8

Open nothingbutlucas opened 5 months ago

nothingbutlucas commented 5 months ago

Hi, how are you?

I would like to provide support for the Waveshare 1.54 inch Version 2 display, which is the only display available where I live.

How can I create the .img file? I guess by doing a sudo make or sudo make image

I'm getting the following error:

> sudo make
...
/usr/bin/packer plugins install github.com/solo-io/arm-image
cd builder && /usr/bin/unshare --uts /usr/bin/packer build -var "pwn_hostname=pwnagotchi" -var "pwn_version=2.0.1b0" -only=arm-image.pwnagotchi pwnagotchi.json.pkr.hcl
Error: 1 error(s) occurred:

* Error downloading checksum file: source path error: stat /pwnystable/images/base-pwnagotchi-2.0.1b0.img.xz.sha256: no such file or directory in "file:/pwnystable/images/base-pwnagotchi-2.0.1b0.img.xz.sha256"

  on pwnagotchi.json.pkr.hcl line 38:
  (source code not available)

make: *** [Makefile:64: pwnagotchi-raspios-lite-2.0.1b0.img] Error 1

I am on a Debian 12 Stable system.

Thank you very much and thanks for keeping this project active.

PS: I was looking at the forks of the original project and yours seemed to me the most suitable, not only for the startup speed of the AI, but also to maintain support for various models of raspberry and not deprecate to the raspberry pi zero w. We can't all buy a raspberry pi zero w 2 for $15 xD, so thank you for that to.

Sniffleupagus commented 3 months ago

This fork https://github.com/jayofelony/pwnagotchi already has support for the 1.54v2 display. I suggest installing that one instead. This fork is my test/development fork. I've been adding my changes more cleanly to the jayofelony/pwnagotchi fork once they work. The jayofelony fork uses the same Torch/SB3 AI library and supports all raspberry pi boards as this one. Use the 32-bit image on Raspberry Pi Zero. (jayofelony had stopped development on the 32-bit, but has added it back recently)

The error you show above is a missing "base image". My build is two steps. First it builds a base image starting with the raspiOS-lite, doing apt update, apt upgrade, and installing all of the pwnagotchi dependencies that do not change frequently. Then it installs pwnagotchi on that to make the final image.

nothingbutlucas commented 3 months ago

Ey what's up? Yes, I added the support for the 1.54v2 display to the jayofelony image. I solved the building problems when I proposed to use the github actions and let github take care of the build, thanks for your answer, I will close issue

Sniffleupagus commented 3 months ago

I'm kind of slowly trying to merge this one with the jayofelony fork, so I'll get the 1.54 display along with all the others eventually. But I only have waveshare_v3s and displayhatmini, so it's not a huge priority for me ;). Mostly I think it seems silly to me to have two almost identical forks. I do want to look into GitHub actions, too. Nice work there!

Sniffleupagus commented 3 months ago

I solved the building problems when I proposed to use the github actions and let github take care of the build, thanks for your answer, I will close issue

You did that on the jayofelony image, right?

Sniffleupagus commented 3 months ago

I misunderstood your first post. If you were just looking to get a pwangotchi running with that display, then the jayofelony fork is easier than setting up my build. But if you want to use my build process, there are definitely some issues that need to be resolved.

At some point it was working for 32- and 64-bit raspi and orangepizero2w. "make images" would run all 3 in parallel. The "base-image" and base64-image" builds start with raspiOS Lite and install most of the dependencies. Then "make image" uses the base image as a starting point, and only has to install pwnagotchi and a few other things. OrangePi build used Armbian as a base image.

At some point I started building pi base images with pi-gen, and had most of the dependencies installed from there. That's where things moved into "/pwnystable/images" instead of the local directory. The VM I was running in ran out of fake-disk space, so I added another fake-drive mounted at /pwnystable. I moved all (most?) of the images there, and changed the makefile and packer file to match.

Recently I started porting to the bananapi m4zero, and also figured out how to use GitHub branches, so I don't break the main branch when experimenting. But I may have broken it for other builds before I figured out branches. :)

I made some changes to the packer and ansible files to split a few of the variables that change depending on the board into separate files per build. I made some more changes to accommodate the bananapi, but have not tested them building for the others. I'd like to get that working again. and also move it to GitHub actions so I can check things in and make a new build available.

I want to make the GitHub actions more modular. Like it doesn't need to recompile nexmon or bettercap if the only change is in a python file (usually). Would be much more efficient to just do that last step. Even have an action to generate an image with a custom config.toml or something. but I'm off topic.

Sniffleupagus commented 3 months ago

And more specifically to the first post, "pwnagotchi-raspios-lite-2.0.1b0.img" is the base image I generate with pi-gen (https://github.com/RPi-Distro/pi-gen). I add a "pwnagotchi" stage after their "stage2" to do all the parts of pwnagotchi. I'm adjusting those scripts to work with armbian-buid, orangepi-build, and this builder https://github.com/pyavitz/debian-image-builder, which is what I'm using to make the bananapi-m4zero pwnagotchi, separately from the packer/ansible build.

No that's wrong. that's the file make was making...but yeah...

You should be able to download a RaspiOS-lite 32-bit BULLSEYE version (I did not do the bookworm changes yet), and replace it as the as the iso_url (or rename it "pwnagotchi-raspios-lite-2.0.1b0.img" to match what the "build source 'pwnagotchi'" is looking for). Put it in "/pwnystable/images" directory, or change the var.image_root.

The build should make anything that isn't already on the image. Starting with raspios-lite instead of one of the base-image builds just means more happens during apt-upgrade, and it will build nexmon, bettercap, pwngrid, libpcap, and other dependencies during the image build.

I'm trying to build a 32-bit pwnagotchi image in a new clone right now, and changing the makefile and packer to keep things in the local build/ directory instead of /pwnystable. I can link "build/images" to /pwnystable/images" in my other environment, instead of making things not work for other people.