gfd [Lexaloffle Blog Feed]https://www.lexaloffle.com/bbs/?uid=90702 Guide: Boot straight to PICO-8 on Raspberry Pi OS Lite (no desktop) <h2>Read all steps before proceeding with the installation. Feedback is appreciated!</h2> <ul> <li><em>If you want to avoid the headache of Step 4, I recommend using a Pi or other Linux computer to write the installation image to the SD card! It can be the same Pi you use for the Lite installation, you just need to switch SD cards to change OSs.</em></li> </ul> <p>Hello everyone,</p> <p>I haven't seen any tutorials for doing <em>exactly</em> this so I thought it would be helpful if there was a guide for anyone who specifically just wants a little portable machine that launches PICO-8 after booting, and without using Retropie or a desktop environment. This installation won't have a super fast boot like PICOPi (<a href="https://github.com/keints/picopi">https://github.com/keints/picopi</a>) but it will have online functionality and will be a great starting point for a physical fantasy console project.</p> <p>The whole process takes about 45 minutes to complete</p> <h2>Things you will need:</h2> <ul> <li>The latest PICO-8 for Raspberry Pi zip: <a href="https://www.lexaloffle.com/games.php?page=updates">https://www.lexaloffle.com/games.php?page=updates</a></li> <li>Raspberry Pi (any model) setup with a display and keyboard</li> <li>SD card or microSD card (depending on the model of Pi) <strong>at least 16GB</strong></li> <li>SD card reader</li> <li> <p>Windows/macOS/Linux computer with internet access (this can also be a Pi, in fact it can even be <em>the same</em> Pi if you have two SD cards!)</p> <ul> <li><em>Optional: USB thumb drive to transfer files from your PC to the Pi</em></li> <li><em>Optional: Second SD card to install a desktop version of Raspberry Pi OS to transfer files to your &quot;Lite&quot; installation</em></li> </ul> </li> </ul> <h2>Step 1: Download &amp; install the latest Raspberry Pi OS Lite image</h2> <p><div><div><input type="button" value=" Show " onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = ''; this.innerText = ''; this.value = ' Hide '; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = ' Show '; }"></div><div><div style="display: none;"><br /> You can get the latest Raspberry Pi OS installation images here: <a href="https://www.raspberrypi.com/software/operating-systems/#raspberry-pi-os-32-bit">https://www.raspberrypi.com/software/operating-systems/#raspberry-pi-os-32-bit</a></p> <ul> <li><em>We'll use the &quot;Lite&quot; image, but this tutorial also works with the desktop versions if you change the boot option to the command line</em></li> </ul> <p>Follow these instructions to write the &quot;Lite&quot; image to your SD card: <a href="https://www.raspberrypi.com/documentation/computers/getting-started.html#installing-the-operating-system">https://www.raspberrypi.com/documentation/computers/getting-started.html#installing-the-operating-system</a></p> <ul> <li><em>If you flashed the image with a Linux PC or a Raspberry Pi, the SD card should be automatically mounted.</em> <strong><em>You can copy your PICO-8 zip to the</em></strong> <code>rootfs</code> <strong><em>partition's</em></strong> <code>/home/pi/</code> <strong><em>directory now and skip Step 4 later!</em></strong><br /> </div></div></div></li> </ul> <h2>Step 2: Setup Raspberry Pi OS</h2> <p><div><div><input type="button" value=" Show " onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = ''; this.innerText = ''; this.value = ' Hide '; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = ' Show '; }"></div><div><div style="display: none;"><br /> <strong>If you are using HDMI for your display, make sure your Pi is connected to your monitor <em>before</em> powering the Pi on!</strong></p> <p>When your new Raspberry Pi OS installation boots for the first time, it will generate SSH keys and then reboot shortly after. You will then be asked to select your keyboard layout. If you don't see yours, use the <strong>up and down arrow keys</strong> to select <code>Other</code> and press <strong>Enter</strong>. A complete list will be displayed. Select an option and press <strong>Enter</strong>.</p> <ul> <li><em>If your keyboard has an English (U<strong>S</strong>) layout, be sure <strong>NOT</strong> to pick the default English (U<strong>K</strong>) option or your keys will not be mapped correctly! This can be changed again later with the</em> <code>raspi-config</code> <em>tool.</em></li> </ul> <p>Next you will be asked to create a username and password. After creating these credentials, the system will prompt you to log in. Once you've logged in, you should see the command prompt below</p> <p><code>[username]@raspberrypi:~$</code></p> <p>Type <code>sudo raspi-config</code> and press <strong>Enter</strong>. The screen will turn blue and a menu will be displayed.</p> <p><strong><em>(If you are using a wired internet connection, you can skip the following paragraph)</em></strong></p> <ul> <li>The option <code>1 System Options</code> should be selected. Press <strong>Enter</strong> to confirm the selection. Now the option <code>S1 Wireless LAN</code> should be selected. Press <strong>Enter</strong> and use the <strong>up and down arrow keys</strong> to select your country. A dialog box will confirm your selection, and you will next need to enter your Wi-Fi SSID and password.</li> </ul> <p>Once you are connected to your network, select <code>8 Update</code> on the menu and press <strong>Enter</strong>.</p> <p>After the <code>raspi-config</code> tool has been updated, you should be automatically returned to the first menu. Select <code>1 System Options</code> again and then <code>S5 Boot / Auto Login</code>. Select <code>B2 Console Autologin</code> and press <strong>Enter</strong>.</p> <ul> <li><em>This is also a good time to setup your locale and timezone should you choose to, but it isn't necessary for the purpose of this tutorial.</em></li> </ul> <p>Press the <strong>right arrow key</strong> two times and <code>Finish</code> should now be highlighted orange at the bottom of the menu. Press <strong>Enter</strong>. If you are asked if you want to reboot the Pi, select <code>No</code>.<br /> </div></div></div></p> <h2>Step 3: Update Raspberry Pi OS and install PICO-8 dependencies</h2> <p><div><div><input type="button" value=" Show " onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = ''; this.innerText = ''; this.value = ' Hide '; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = ' Show '; }"></div><div><div style="display: none;"><br /> You should be back at a command prompt again that says</p> <p><code>[username]@raspberrypi:~$</code></p> <p>Type <code>sudo apt update</code> and press <strong>Enter</strong>. This command checks if there are any newer versions of your installed software packages. If any packages can be upgraded, you can use the command <code>sudo apt upgrade</code> to download and install them. Upgrading packages may take several minutes.</p> <p>Once you've done that, type <code>sudo apt install libsdl2-dev pulseaudio</code> and press <strong>Enter</strong>. A big list of additional packages that must also be installed will be displayed. Press <strong>Enter</strong> again. This process will take several more minutes to complete.</p> <p>When the command finishes, the prompt will return. Type <code>reboot</code> and press <strong>Enter</strong>.</p> <ul> <li><em>If you are taking your SD card out of your Pi to transfer your zip to it in the next step, type</em> <code>shutdown now</code> <em>instead of</em> <code>reboot</code> <em>and wait for the flashing green light on your Pi to shut off completely before removing the card</em><br /> </div></div></div></li> </ul> <h2>Step 4: Copy and extract your PICO-8 zip to your Pi user's home directory</h2> <p><div><div><input type="button" value=" Show " onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = ''; this.innerText = ''; this.value = ' Hide '; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = ' Show '; }"></div><div><div style="display: none;"><br /> The zip goes in the directory <code>/home/[username]/</code> on the <code>rootfs</code> partition of your SD card.</p> <p>There are several ways you can go about completing this step. Here are three:</p> <ul> <li> <p>1) <strong>SSH</strong> This is probably the most optimal way to copy your zip over if you don&rsquo;t have a Linux computer or an additional Raspberry Pi OS Desktop installation, though it is a little more involved. You can find instructions for copying files to the Pi via SSH here: <a href="https://www.raspberrypi.com/documentation/computers/remote-access.html#ssh">https://www.raspberrypi.com/documentation/computers/remote-access.html#ssh</a></p> <ul> <li><strong>The Pi is internet-connected at this point so ensure that your password can't be easily brute-forced! I recommend disabling SSH again after copying over the zip</strong></li> </ul> </li> <li> <p>2) <strong>USB drive</strong> You can learn how to access a USB thumb drive via the command line here: <a href="https://www.raspberrypi-spy.co.uk/2014/05/how-to-mount-a-usb-flash-disk-on-the-raspberry-pi/">https://www.raspberrypi-spy.co.uk/2014/05/how-to-mount-a-usb-flash-disk-on-the-raspberry-pi/</a></p> </li> <li>3) <strong>Another Linux installation</strong> If you have a Linux OS with a desktop (or a second SD card for your Pi with Raspberry Pi OS Desktop), you can just insert your Raspberry Pi OS Lite SD card into a card reader and just click and drag the zip onto it using a file explorer.</li> </ul> <p>You can use the <code>unzip</code> command on the Pi to extract the zip once you've transferred it.<br /> </div></div></div></p> <h2>Step 5: Create a startup script</h2> <p><div><div><input type="button" value=" Show " onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = ''; this.innerText = ''; this.value = ' Hide '; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = ' Show '; }"></div><div><div style="display: none;"><br /> Now that we have our PICO-8 zip extracted to our home directory, we can create a script that executes the appropriate binary after logging in, which should happen automatically after boot</p> <p>At the familiar command prompt, type <code>nano startpico8.sh</code> and press <strong>Enter</strong>. This will launch a text editor called <em>nano</em> with a new file open called <em>startpico8.sh</em>. Add the following two lines:</p> <p><code>echo &quot;Starting PICO-8...&quot;</code></p> <p><code>./pico-8/pico8_dyn</code> </p> <ul> <li><em>Optionally, you can boot straight to SPLORE with this line instead:</em><br /> <code>./pico-8/pico8_dyn -splore</code></li> </ul> <p><strong>NOTE: On older Pi models, you may need to add a line that just says</strong> <code>sleep 15</code> <strong>above the</strong> <code>echo &quot;Starting PICO-8...&quot;</code> <strong>line to allot time for startup processes to finish. This unfortunately adds 15 extra seconds to the startup, so only add the line if you can't get PICO-8 to launch correctly after login!</strong></p> <p>Press <strong>Ctrl+S</strong> and then <strong>Ctrl+X</strong>. You should be back at the command prompt.</p> <p>Next type <code>chmod +x startpico8.sh</code> and press <strong>Enter</strong>. Then type <code>./startpico8.sh</code> and press <strong>Enter</strong> again. If everything worked up to this point, PICO-8 should startup!</p> <p>Press <strong>Ctrl+Q</strong> to shutdown PICO-8, then type <code>nano .bashrc</code> and press <strong>Enter</strong>. Press and hold the <strong>down arrow key</strong> until the cursor reaches the last line of the file. Press <strong>Enter</strong> to create a new line, then type <code>./startpico8.sh</code> and press <strong>Enter</strong>. Now press <strong>Ctrl+S</strong> and then <strong>Ctrl+X</strong>.</p> <p>Back at the command prompt, type <code>reboot</code> and press <strong>Enter</strong>. After the Pi boots, it should immediately login and launch PICO-8! :D<br /> </div></div></div></p> <h2>Troubleshooting</h2> <ul> <li> <p><strong>No sound</strong><br /> If there is no sound, go back to the <code>raspi-config</code> tool and select <code>System Options</code> and then <code>Audio</code> and make sure audio is being routed to the correct output device.</p> </li> <li> <p><strong>The command line doesn't show the usual prompt or display PICO-8 after logging in</strong><br /> Usually this is because PICO-8 starts and bash runs in the foreground. Try pressing <strong>Ctrl+C</strong> and wait to see if the command prompt appears after a few moments. I've found that adding the <code>sleep 15</code> command to the first line of the startup script avoids this issue. If anyone knows what causes it any info would be appreciated!</p> </li> <li><strong>A number of SDL-related errors are displayed, but no PICO-8</strong><br /> Happens because PICO-8 starts too early after login. Press <strong>Ctrl+C</strong> to terminate the process and try adding the <code>sleep 15</code> command before your <code>echo &quot;Starting PICO-8...&quot;</code> command in the startup script.</li> </ul> <h2>A few notes</h2> <ul> <li>While the goal is to effectively create a physical <em>fantasy</em> console, remember that the Raspberry Pi is still a <em>real</em> computer with an OS that is connected to the internet. It's good to upgrade packages every so often to fix issues and keep your system secure. If you've completed this tutorial, you should now know how to check for updated software packages and how to install them. If this sounds like a hassle, I would recommend considering keeping your installation offline. <strong><em>Or</em></strong> you can learn how to automate the process of keeping your system up to date. The world is your oyster!</li> </ul> <p><em>Hope this was helpful! If this is your first experience with a Pi or Linux, I can promise you it isn't normally this much work to get an OS setup. You can always install the desktop version of Raspberry Pi OS (or any other OS) and use it just like you would use a Windows or macOS computer. I hope you'll continue to explore and learn how Linux works, maybe you can write a better guide than this one! See if you can figure out how to get the Pi to shutdown by itself after shutting down PICO-8 ;)</em></p> https://www.lexaloffle.com/bbs/?tid=140366 https://www.lexaloffle.com/bbs/?tid=140366 Sun, 25 Feb 2024 19:21:32 UTC Would anyone be interested in a video tutorial to make a Pi boot into PICO-8? <p>EDIT: I made a text guide! You can read it here: <a href="https://www.lexaloffle.com/bbs/?tid=140366">https://www.lexaloffle.com/bbs/?tid=140366</a></p> <p>I learned how to make a minimal Raspberry Pi OS image for the Pi Zero W that boots up and goes straight into PICO-8, no desktop or anything. I could maybe upload a .img of it or just make a video tutorial. I can't find any current distro that does just this, only PicoPi, which isn't officially supported anymore. I don't make content or have an online presence or anything, I just thought maybe someone should do it. What do you all think?</p> <p>EDIT: Feel like I should clarify that one would have to provide their own PICO-8 but once it's in the right place it runs it after booting. I wouldn't include it in my .img file</p> https://www.lexaloffle.com/bbs/?tid=140270 https://www.lexaloffle.com/bbs/?tid=140270 Tue, 20 Feb 2024 22:31:20 UTC