Script for Lakka

Hi,

I have the 10inch Picade with PI4.
Currently only Lakka support PI4 so I have installed it but I have problems with picadehat script for setup audio and buttons.

With SSH i tried the command “curl https://… | bash” for install but curl is not supported.
So, I have downloaded the script manually and copied to folder via SCP command but the script doesn’t works for error that say that found an unexpected “(“ characters (seems that array is unrecognized).
Also I have noticed that apt-get command is disable on Lakka so will be not possible to execute the commands inside the script.

Have you any solution for that?

Thank you

Hi,

I had the same issue and this is the solution what found a guy on Reddit.

I tried today, and I blocked when i tried to write with the SSH.

Would be wonderful if you can record your screen during the process.

This is the solution :

You need to install the GPIO driver that Pimoroni provides. Download this file https://github.com/pimoroni/picade-hat/archive/master.zip and extract it somewhere. Copy picade.dts and etc/udev/rules.d/10-picade.rules to Lakka (doesn’t matter where, /storage is fine) and SSH to it.

From there run the following:

mv 10-picade.rules /etc/udev/rules.d/10-picade.rules

then

dtc -I dts -O dtb -o picade.dtbo picade.dts

Then you need to copy the resulting file to the appropriate boot section.

mount -o remount,rw /flash

then

cp picade.dtbo /flash/overlays/

edit config.txt so the end looks like this:

[all]
dtoverlay=picade
include distroconfig.txt

And comment out the last line of distroconfig.txt: #dtparam=audio=on

Then remount the boot folder as read-only mount -o remount,ro /flash

Then reboot. Your joystick and buttons should now be recognized. Now go to RetroArch and in Settings / Audio go to Device and choose sysdefault:CARD=sndrpihifiberry.

Now here’s where it becomes a bit touchy: you need to add etc/asound.conf to /etc and the only way to do this is to edit the SquashFS filesystem. At this point if you really don’t know what you are doing you can break your whole Lakka install. You need to unsquashfs SYSTEM, add asound.conf from https://github.com/pimoroni/picade-hat/blob/master/etc/asound.conf in its /etc and then recreate the squashfs. Finally replace the resulting SYSTEM file. I don’t even know if you can do this from Windows as I use Linux on my desktop computer. Here’s a quick tutorial on how to do it on Linux
EDIT: updated post as I got the sound to work.

EDIT2: added link to unsquashfs tutorial.

Thank you Benodino! Finally it works :)
I don’t know how to recorder screen, but I can help you if you want (I can write a step by step guide or share with you my Lakka Pi4 image with picade)

I have only an issue. After squashfs process, the “root” password is unrecognized but I have transferred ROM with samba.

How can I help you?

Hi,

Glad to hear that. If you can share your image, that d be wonderful. Like that I just to push on my SD card.

As you want, you can write too ;). My mail address : benodino68@hotmail.fr

My guide:

  1. Install LAKKA on your SD card (currently you can download the Pi4 version that is stable)

  2. Open your SD on your PC/Mac and edit config.txt. Remove “#” on “hdmi_force_hotplug=1” to enable hotplug for HDMI to work with Picade

  3. Open terminal on your PC (I’m using Mac). Connect to Picade using SSH with the command: ssh root@<put_picade_ip_here>, like ssh root@192.168.178.56

    The password is root

  4. create a folder (currently you will be in /storage directory). Use command mkdir picadehat

  5. exit from SSH using exit command e return to your PC/Mac.

  6. Download this file https://github.com/pimoroni/picade-hat/archive/master.zip and extract it somewhere

  7. Move in this folder using cd command

  8. Copy the files etc/udev/rules.d/10-picade.rules and picade.dts in the picadehat folder with the following command (if require password, use always root):

    • scp picade.dts root@<put_picade_ip_here>:/storage/picadehat

    • scp etc/udev/rules.d/10-picade.rules root@<put_picade_ip_here>:/storage/picadehat

  9. Connect to Picade using SSH with the command: ssh root@<put_picade_ip_here>

  10. cd picadehat to move inside the folder. You can use ls command to see if the files are copied inside

  11. type: mv 10-picade.rules /etc/udev/rules.d/10-picade.rules

  12. then: dtc -I dts -O dtb -o picade.dtbo picade.dts

  13. then: mount -o remount,rw /flash

  14. then: cp picade.dtbo /flash/overlays/

  15. then: cd /flash

  16. edit the file config.txt (I use nano config.txt) and the end of file must look like this:

    
    [all]
    
    dtoverlay=picade
    
    include distroconfig.txt
    
    
  17. edit the file distroconfig.txt and add comment (the # character) before this line dtparam=audio=on so it looks like #dtparam=audio=on

  18. remount as read only with this command mount -o remount,ro /flash

  19. reboot with command reboot

  20. In the menu go to Settings/Audio/Device, replace (using keyboard) with this line sysdefault:CARD=sndrpihifiberry

  21. The last part. Shutdown and remove the SD card. Put in your PC (I’m using mac, I don’t know in windows)

  22. Install with brew install squashfs (in Mac).

  23. Copy the file SYSTEM inside the SD card in a folder of your PC, move inside this folder with terminal and run the command:

    unsquashfs SYSTEM

  24. Enter in the folder extracted and copy inside /etc the file asound.conf that you found in the initial ZIP downloaded

  25. recreate the file SYSTEM with the command (you must be in the folder where you have extracted squashfs-root with previous command):

    mksquashfs squashfs-root/ SYSTEM -noappend -always-use-fragments

  26. Replace the SYSTEM file recreated in the SD card

  27. Put SD card in Picade and turn on

  28. Enjoy :)

So basically if I’m a Windows user then I’m stuck with no sound … and a backwards screen that when inverted in config.txt doesn’t invert the mouse along with it so desktop applications and C=64 and Amiga emulators are out of the question

Yes :(

You can try using a live Linux distribution like Ubuntu so you can configure your sd without install Linux

Doesn’t matter anyway, I’m going to have to come up with an alternative sound solution because the Fan Shim I bought to cool the Pi 4 is not compatible with Arcade X I2S DAC so sound is not going to work for me anyway … Not a real big deal anyway since I have a PAM8403 module with a switched pot attached that I can wire to the analog outputs … Since I’m using a riser I’ll just snip the BCM18 pin so the signal doesn’t even reach the Arcade X hat and cause a problem

Oh well, I kinda wanted to make this stereo anyway so I would probably be doing this eventually … Best laid plans of mice and men and all that I guess … Maybe 3D print some front firing speakers I can attach to the sides of the cabinet that can double as some 80’s style bling …

Thank you Benodino and m3rLin0 so much.

My goal was to have a multi-boot Raspbian and Lakka installation, from a NOOBS menu, on the Picade 10", with a Pi 4. I got most of it working following standard instructions - NOOBS menu, both partitions booting ok, wifi set up.

Before i followed the instructions, I was able to SSH to Lakka.

I first did the PC part in a Mac. When rebuilding the SYSTEM, there was a message relating to Apple Quarantine, com.something.apple not recognized. Sorry, didn’t take note at the time.
After i followed the instructions, the joystick and buttons were working, but SSH not so much - i could reach the Pi’s IP, but the standard root password wasn’t accepted, which surprised me. Couldn’t get the sound working.

I started over: reformatted the SD card, installed everything again. This time i set up a Ubuntu virtual Machine in my Mac, and followed your instructions from the VM. I got the some warnings in the ‘dts’ part, nine of them like: picade.dtbo: Warning (unit_address_vs_reg): Node /fragment@0 has a unit name, but no reg property
I didn’t get the same Mac-related warning as before when rebuilding the SYSTEM, although i got Failed to read file squashfs-root//etc/shadow, creating empty file.
However, after booting the Picade from the SD card with the new SYSTEM, i can’t SSH to the root user (Permission denied, please try again), and the sound is not working yet.
Actually it looks like SSH login is broken, as i can login using SAMBA with root as username and root as password.

Any help will be much appreciated, looking forward to get this working properly

I solved my sound issue: if you check asound.conf at Pimoroni’s Github repo, you’ll see it’s contents. The first lines read

pcm.real { 

type hw 

card 0 

device 0

}

So i tried Settings / Audio go to Device and type hw:0,0

Worked instantly. Still fighting to get SSH back tough.

Hi Eduardo

Sorry for delay on response.

I have the same problem for SSH password for root user… I don’t know why after Unsquash file system the pwd not works anymore :(

Currently I’m trying a retropie build (installed in unofficial way) but has less issue than lakka system on picade

Hi m3rLin0

I got the SSH working. When re-squashing the SYSTEM, the Linux user we used wasn’t root, so mksquashfs couldn’t read the /etc/shadow file where the root’s password hash was. So, it created an empty file.
The solution is using sudo to issue the mksquashfs command.

Thank you so much Edu, I’ll try your solution :)

Hello,

I’m going crazy here. I can’t seem to get my joystick and buttons to work.

  • I followed you step-by-step instructions (thanks!), as well as the ones here. Basically they are the same albeit dtoverlay=picade is added at the very bottom of the config file.
  • I tried using udev rules and dts file from both the lakka-driver folder and the etc/udev/rules.d folder in the GitHub repository.
  • I had some warning with the dtc command (but they seemed safe to ignore).
picade.dtbo: Warning (unit_address_vs_reg): Node /fragment@0 has a unit name, but no reg property
picade.dtbo: Warning (unit_address_vs_reg): Node /fragment@1 has a unit name, but no reg property
picade.dtbo: Warning (unit_address_vs_reg): Node /fragment@2 has a unit name, but no reg property
…
  • I also tried adding the -W no-unit_address_vs_reg parameter suggested in the link above.

Each time I get to

Your joystick and buttons should now be recognized.

… well it just doesn’t work. A USB keyboard allows me to interact with Lakka but not my joystick or buttons.

Any help would be very much appreciated. I am using a fresh Lakka build (2.3.1 RPi2.arm) which seems to be the correct version for my Raspberry 3B+.
The Picade works fine with RetroPie.

Thank you.