There are 2 (uinput) related changes here:
* The SDL2/Uinput based Joy2Key is too slow for Pi1/0 devices, so allow the user to choose the older version. The older version is simpler since it doesn't need or load SDL2/Uinput, thus faster to load on those systems. By default, on ARMv6 devices the old version will be configured.
* The Uinput based event generation of keyboard events is not able to trigger the `runcommand` menu when launching images splash is done via `feh`, since the image display will get always have focus and thus the keybord events will not reach the `runcommand` terminal. So, in order for the `runcommand` menu to work after the splash image, make sure we stop `feh` before launch, just like `fbi` is stopped on non-desktop systems.
On RaspiOS, the install user is part of the `input` group by default, but on Ubuntu is not. Add it during install so that `joy2key` can work as regular user (i.e. as part of `runcommand`).
Recent Linux kernels (6.2+) have the ability to disable the 'TIOCSTI' ioctl, thus rendering unusable the method of sending keyboard events to the controlling terminal via `fcntl.ioctl` [1]. Not all distributions have left it enabled currently, but Ubuntu 24.04 has it enabled, affecting the `runcommand` ability to generate keyboard events for a joystick.
Use the `python-uinput` module to create a virtual keyboard and send the proper events through it, without relying on the 'curses' or 'fcntl' modules. Now, since the new module doesn't know about Termios codes, which were used previously, I've added a translation table to accomodate scripts using those capability codes. The `python-uinput` uses the Linux event codes [2].
The new method needs the `uinput` Linux kernel module to be loaded beforehand - so add the module to be automatically loaded. The user also needs to be part of the 'input' group, otherwise they won't be able to use the `uinput` interface - RetroPie doesn't automate that, but assumes the installation user belongs to that group.
We also don't need the `termios`/`fnctl` calls, so the terminal handling part has been removed, simpplifying a bit the code.
OTHER changes:
- the device path (/dev/jsX) is now ignored. It hasn't been working since the switch to SDL2 for input processing, but was still parsed for compatibility with the old version.
- when invoking with the debug (--debug|-d) parameter, the script now runs in the foreground, instead of forking and running in the background. It's easier when running it to diagnose issues; running with debugging enabled should not be used for regular usage.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=83efeeeb3d04b22aaed1df99bc70a48fe9d22c4d
[2] https://github.com/tuomasjjrasanen/python-uinput/blob/master/src/ev.py
Using LZMA (xz) for compression instead LZ77 (gzip) reduces the image size by approx 30% more. Image writing utilities with compressed image support (RPI Imager, Balena Etcher) already support it and the RaspiOS or Armbian images are already distributed as `.xz` files.
Changed our image compression format from `.gz` to `.xz` and thus reduce the download size for all images.
Tell the user to save their configuration files if they intend to use any of RetroPie components after removal, i.e. if they previously had an emulator/port installed and they still want to use it after removing RetroPie.
Besides the mappings parsed from RetroArch's auto-configuration profiles, there's a generic mapping used for gamepads that don't have a profile saved.
Unfortunately this never worked, since the initialization of the mapping - in the `add_mappings` function - had the buttons and hats parameters switched. This changeset fixes this, creating a correct mapping.
The issue was reported in https://retropie.org.uk/forum/topic/35063/, `joy2key_sdl` would crash with a Python3 error since the (wrong) generic mapping would produce the incorrect data type and values for the `filter_active_events` method.
ENV variables __builder_repo && __builder_branch are used to switch to another repository/branch for building.
This is used to more easily build binaries before branches are merged into master. Primarily for SDL binaries, but simplifies testing for other modules.
Older distcc init.d scripts contain a PATH= line which we were replacing.
Newer distcc init.d scripts exclude it, so we need to insert it before the DAEMON line
Modified the 'stop' action to use `start-stop-daemon` [1] instead of a simple `pkill`.
The advantage is that we don't need to use `sleep` to ensure the script is stopped, since `start-stop-daemon` monitors the process and will exit when is stopped. The `retry` action is to send a SIGKILL after 1 second, to ensure the process is stopped.
The modification will shorten the time it takes to 'stop' the joystick handling utility, since we don't have to wait - unconditionally - for 1 sec every stop. This will shorten the runtime of `runcommand` .
[1] https://man7.org/linux/man-pages/man8/start-stop-daemon.8.html. Since it's part of `dpkg`, it's basically present on every Debian based system.
Previously RetroPie-Setup was cloned from the calling RetroPie-Setup scriptmodule on the host side, but this only worked when the UID/GID of the user was 1000:1000 matching the first user in the chroot.
Due to changes in my build system, this required a fix. It now does the clone from within the chroot, so the ownership is correct for chroot pi user.
This commit also fixes up the multiline quoting and removes an unnecessary trailing slash on a mkdir.
Get the default platforms to build for and the binary archive location via _get_info_image.
Remove default "buster" dist.
Make sure we have created "$scriptdir/$archive_dir/" before rsyncing existing archives to the chroot in case it doesn't exist.
Remove logic check to skip rpi4 on stretch (not needed with the new image changes that provides this).
When making a chroot use the distribution name rather than the default $md_build/chroot
Require the chroot location parameter for the chroot, init and deinit functions.
Adjust the _get_info function so it can be used directly from the builder module.
New function _get_info_image reads values from the distribution ini configuration files stored in image/dists
This simplifies the code and avoids having logic for different versions in multiple functions.
The ini format is as follows - it may change and be extended in the future.
The filename is the dist name that is passed into the building functions.
The current images now have a prefix "rpios-"
* name: name of distro - eg buster
* version: rpios/debian version
* url: url for image file
* format: format of the image file - currently supported is zip and xz (used by raspberrypi.org)
* platforms: list of the platforms supported (eg. rpi1 rpi2 rpi3 rpi4)
* file_PLATFORM (name to be used in the image file for each platform)
* title_PLATFORM (user friendly name of file for each platform - used for rpi imager json)
Set the "pi" password in the chroot install script rather than via userconfig.txt.
Disable the Raspberry Pi OS userconfig service for now. This stops the code to rename user after partition resize.
This would also disable autologin (with a var/lib/userconf-pi/autologin) file, but since our set-up doesn't currently
work with renaming the user RetroPie was installed for due to some hardcoded paths on install, it's safer to bypass this functionality.
Enable getty@tty1.
Note: Have tested with RPI-Imager, which when using a local image, checks it and thinks it can be configured.
This also resolves this case where it would allow a username change.
In the future we may be able to change the few config paths that are hardcoded to allow configuration of the user via RPI-imager.
This ensures the filesystem is created with supported features if images are created on a system with a newer mkfs.ext4.
Remove metadata_csum disabling as it's no longer needed with above changes (and was added for compatibility with Jessie).
Disable 64bit ext4 feature as with the Raspberry Pi OS images.
The parameter ordering has changed - install_rp takes the parameters platform, dist, and chroot.
If platform and dist are not included an error is shown. chroot location defaults to "$md_build/chroot".
Move the default username/password setting for bullseye to the install_rp function.
Raspberry PI OS images have added a first-boot wizard to change the default username/password [1].
In order to skip this step and keep the (former) default username 'pi', add a 'userconf.txt' to preset the info needed for the default user.
[1] https://www.raspberrypi.com/news/raspberry-pi-bullseye-update-april-2022
Instead of switch_distcc to change the default distcc daemon to point to an installed cross compiler,
it now has a configure_distcc function that allows configuring additional distcc daemons on different ports.
$md_inst/bin is no longer used. Symlinks for cc/gcc/c++/g++ are now made in the $md_inst/$dist/bin folders where the
cross compiler binaries are installed.
Example usage:
./retropie_packages.sh crosscomp configure_distcc buster 3633
Will configure a /etc/init.d/distcc-buster script (copied from /etc/init.d/distcc) on port 3633.
The logging will be in /var/log/distcc-buster.log. The /etc/default/distcc config is still used by all daemons.
This is used to allow multiple daemons for RPI buster / bullseye cross compiling (Which I use for building the distribution binaries)
Added a new parameter to `osk.py` to populate the input box with an existing value.
This makes it easier to replace the `dialog`'s `--inputbox` widget, which accepts an existing value as the last argument.
Removed the prefix from the input prompt, let it be handled by the caller.
Since a98c59597f we now need to check if a module is enabled.
This fixes incorrectly showing config modules like wifi on systems where it is not supported.
The speexdsp meson wrap enables armv7/neon instructions when building for armv6 (Raspberry Pi 1). This causes compilation to fail.
Patch meson.build to disable the simd option for older arm platforms (that don't have the neon platform flag).
It fails on g++-9 (the oldest I have on this desktop) and it's not worth fixing as we no longer support jessie.
Remove isl and cloog as they are not needed for building GCC >= 5
Clear ASFLAGS or else "-march=native" will get used for the arm targetted GCC/AS and throw an error. This is needed since 4f464162.
Add -O2 optimisation to CFLAGS/CXXFLAGS.
Save and restore PATH and restore ASFLAGS,CFLAGS and CXXFLAGS env variables to defaults after building.
Clean module build folder in setup_crosscomp after building.
Image files for Raspberry Pi OS buster (oldstable) and bulleye are now single files compressed with .xz instead of the zip files used previously.
Add support for decompressing xz as well as an additional check to make sure the image was extracted ok before continuing. Added return codes to the function.
Git reports
fatal: unsafe repository ('$HOME/RetroPie-Setup' is owned by someone else)
This is due to us running `git log` under root on a repo owned by the user it was installed for.
This commit also switches from su to sudo in setup.sh for consistency with other code.