[Howto] Create a Bookworm RetroPie Image, hands free
-
Automate the boring stuff with ~
Python~ RetroPie-Setup!Following is an approach to create a ARM64 bookworm image from within RetroPie-Setup. It requires no manual interaction. So kick it off, take a walk with your dog (or do something else) and when you are back the image is ready. In essence it only takes three RetroPie-Setup calls.
The scriptmodule
image.sh
has been around quite a while and all kudos go to the RetroPie maintainers. I just made some changes to run it also for the aarch64 / Bookworm combo. It is not perfect, but it works and you don't have to ask others to provide an image or deal with download limitations. Additionally you can customize the image to your needs.You don't have to run the script on your Raspberry Pi, as the
image.sh
utilizes Qemu in user-mode for the image creation when running on an Intel PC (as long as the Desktop provides a Linux context, ofc). Roughly speaking: Qemu in user-mode on an Intel architecture is like Box64 on an ARM architecture but in reverse.For my tests I utilized a Rpi5 4GB running on a SD-card. The image was done in one hour. If you have a beefy Desktop or use cloud instances it may even process faster.
Enough pre-text, here is how.
Preparation
Checkout the branch and install the base dependencies for the image creation process.
git clone -b fb_image_sh_bookworm_aarch64 --depth 1 https://github.com/Gemba/RetroPie-Setup.git rp_build_image cd rp_build_image sudo ./retropie_packages.sh image depends
Inside
rp_build_image/
folderMake sure you have at least 8GiB of free storage (~4 GiB as workspace, <4GiB for final
*.img
file).Then run these commands (note the comment):
# Note: Not all platforms do support 64 bit # https://www.raspberrypi.com/documentation/computers/config_txt.html#arm_64bit arm64="1" # set 1, if 64bit setup (aarch64) is wanted, 0 uses 32bit (armhf) dist="bookworm" platform="rpi5" [[ "$arm64" -eq 1 ]] && sed -i "s/_armhf_/_arm64_/" "scriptmodules/admin/image/dists/rpios-$dist.ini" [[ "$arm64" -eq 0 ]] && sed -i "s/_arm64_/_armhf_/" "scriptmodules/admin/image/dists/rpios-$dist.ini" sudo ./retropie_packages.sh image create_chroot "rpios-$dist" sudo ./retropie_packages.sh image install_rp rpi5 "rpios-$dist" sudo ./retropie_packages.sh image create "$(pwd)/tmp/build/image/rpios-$dist.img" "$(pwd)/tmp/build/image/rpios-$dist"
Now take care of your pet and come back after a while.
That' all folks!
The image file is
tmp/build/image/rpios-bookworm.img
. Take this to put it on a SD-card (dd
, Raspberry Pi Imager, Etcher, ...). With Rpi Imager you can apply the usual customizations (SSH, wireless, timezone, ...).The image reboots once after Generating SSH Keys and then you will be greeted with RetroPie/EmulationStation. :)
Final notes:
- If you want to add OS packages customize this line,
- for changing RetroPie-Setup packages see these lines.
- You can also copy config files from your current RetroPie-Setup if needed (i.e. Gamecontroller config) to the image after the
install.sh
has been run, thus after this line. - You have to clean the image build folder, if you want to use a newer upstream RaspiOS base image or change the architecture (arm64/armhf):
sudo ./retropie_packages.sh image clean
Have fun with your "golden image"!
-
Wow, this is amazing and very helpful. Thank you very much!
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.