Add scripts to generate disk images using pi-gen. #14
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is the fruit of something along the lines of "got too deep into it to back out now". I needed a newer raspios distro to use the pi I had setup for usb4vc for some alternate services on top of usb4vc.
Through reading the setup.txt notes in the user_program to setup my own image, I figured it might be good to use rpi foundations native image generation software to automatically bundle a disk image that contains usb4vc, and have it setup all the finicky system options / dependencies for you.
The
pi_image_creation.md
file contains most of the documentation of the build process of the image.In total it represents a lot of trial and error ensuring the build process worked for both 32bit and 64bit raspios bullseye and bookworm base images.
In terms of changes to usb4vc itself, to support using environment variables to override where usb4vc thinks it is installed, I consolidated a lot of the paths into
usb4vc_shared.py
, built up by combining the optional env vars defaulted to /home/pi. I also wanted to test firmware updates / software updates in place against my own URLs so I added some options for those too.In
usb4vc_main
, I added a function to check the kernel version, as it seems newer kernels do not require ertm disabled for xpadneo. xpadneo itself checks for 5.15+ but I was more conservative and went for 6+. The location of rpi_model.txt is migrated to inside the usb4vc folder, which should work for existing images (in /home/pi) and brand new ones (in /opt/usb4vc).To support both usb automount methods,
usb4vc_ui
now checks for anything in /media which should cover /media/DRIVE_LABEL as well as /media/usb0-9 from usbmount. Also if it detects it's running in systemd (via env var), it will pipe the output from journalctl to the debug file on the USB mount, otherwise it falls back to copying the debug log.In
usb4vc_usb_scan
, at the beginning of the loop it now does a struct calculation based on two void* ("PP") pointer sizes. In 32bit systems, this should return 8 (two 32bit (4 byte) timestamps), and for 64bit systems this should return 16 (two 64bit timestamps). Then an additional struct size calc for two ushorts and an unsigned int (event type, code, value). This allows the script to offset the timestamps correctly in both 32bit and 64bit systems.Let me know your thoughts, I know this is a lot, and feel free to DM me on discord with any questions.