Luckfox Lyra on PicoCalc

@benklop, I am not so very experienced with Yocto distribution builds as of yet, but I will try to give you a good answer based on my current understanding. The short answer is that it still does use kernel bits and u-boot bits which were extracted and assembled from the Luckfox SDK. This took me a while to understand and was sorta painful, so I’m going to take the time to explain it for others:

Yocto builds Poky distributions with bitbake and has the concept of building up the system via ‘layers’ each of which contain various bitbake ‘recipes’ as .bb files. Layers can also modify and append recipes in underlying layers with .bbappend files. The repository contains only the meta-picocalc layer, but when you kick off the kas build, it will download and prepare the other layers which are defined in the kas build configuration here.

So the final list of recipes is built up through assembling everything defined in these layers, each of which comes from its own vendor. In this project it is:

(poky) → meta-arm → meta-rockchip → meta-rtlwifi → meta-rauc → meta-picocalc

The whole thing kicks off a build of the ‘picocalc-bundle’ recipe, and everything comes in as an enormous cascade of dependencies.

All the custom stuff required for the picocalc and the luckfox lyra including the kernel and u-boot customizations start with the recipes in the meta-picocalc-bsp-rockchip folder. This is where your question about the SDK stuff is relevant. The other folder of recipes in meta-picocalc-distro are related to assembling the Poky distribution and preparing the system images, and to my understanding none of these rely on anything special from Luckfox or Rockchip SDKs.

So, focusing on the kernel and u-boot which is where all the special vendor stuff is:

The kernel is built with this recipe which assembles the kernel source tree from the definition in SRC_URI. The base checkout is downloaded from @0xd61’s repo here. This repo contains an extract of the linux-6.1 kernel sources from the Luckfox SDK. The picocalc customizations and kernel configs are then applied.

The build of the u-boot is similar. The recipe again uses u-boot extracted from the Lyra SDK and contained in this repo. (Note the u-boot build also pulls down this repo from Rockchip that contains some sketchy x86-64 binaries that were the source of my frustration building on aarch64)

I havent personally invested time yet in understanding the extent that the luckfox kernel or u-boot are modified from mainline. I suspect that the need for downloading sketchy binaries could be removed from the u-boot build and I do plan to fix that, but further work could probably get u-boot working from upstream sources. The linux kernel I suspect is more challenging. I have extracted patchsets from vendor customized kernel sources before and done work to ease forward-porting, but I’m not sure I’m sufficiently motivated to do that kind of free work for Luckfox.

1 Like

@0xd61 I sent you a PR adding stereo sound support to the hardware pwm driver

2 Likes

Thank you so much for taking the time to explain all that! It makes a lot of sense that it would be structured that way, and sounds fairly optimal as far as any particular repo like this one only having to contain the code necessary for topic it’s focused on, which is great.

From my my looking into the kernel it might be a little challenging to determine exactly what changes have been made from vanilla, as I suppose you’re probably aware. Rockchip seems to have very little motivation to upstream any of this, it seems like luckfox probably has just done some minimal patching to fix a few issues with the kernel they got from Rockchip.

Yes, thats correct. I tried using the rockchip kernel, but it did not work easily and I haven’t had the time to do create the necessary patches. Therefore, I simply pushed the kernel and u-boot from the SDK to github. I plan to replace those by the sources provided by the meta-rockchip layer.

@johnlaur I will go over your changes and will maybe create a issue in the repo to not spam this thread. Thanks for your awesome work!

The initial goal was to simply have a yocto layer for picocalc. I find it easier to work with than buildroot. It also provides many additional features that can be easily integrated like the overlayfs or rauc OTA updates.

Up until now, the installed packages, overlay configs etc. was only tailored to my needs, but when there are other users, I feel like we need to provide something to provide a good (maybe precompiled) base-package and allow users to easily add/configure additional things. I will add a discussion in the repo where we can discuss ideas on how to improve the build and the experience.

@benklop thanks for the PR, I will look at it over the weekend.

1 Like

Wow!sterosound seems that need to modify the device tree as well?(I see that you hardware mod post before use pin 4&5 for pwm output,which @hisptoot’s origin implement only enabled pin 4),If so,how to apply the changes? recomplite the boot.img and flash it?

1 Like

more or less, you recompile the kernel, though I don’t recall exactly what partition it is stored in at the moment. the exact changes to the devicetree depend on the image you’re using, as it seems that everyone has slightly different ideas about what to allocate the different available pwm channels to.

In addition to the driver itself ( picocalc-luckfox-lyra/base/kernel-6.1/sound/pwm/picocalc-snd-pwm.c at main · benklop/picocalc-luckfox-lyra · GitHub )

Here are the snippets I’ve used for this in my own images:

1 Like

Reading your commit messages for your keyboard modification, does this fix the issue where trying to press F6 through F10 doesn’t really work right because of the shift keycodes?

If so, that solves a problem @hpsaturn was having using an HP calculator emulator. I’ll see if I can get that change incorporated into my builds - seems like a useful one in any case - i found myself frequently confused by enabling mouse mode, and switched to the @neko789 keyboard driver which doesn’t have the mouse mode to get around that.

1 Like

Yes, I ran “evtest” to verify the actual key trigger logic. When pressed Shift+F6 will actually get Shift+F10 (Which “F10” from the firmware logic, The pressed state of “Shift” handled internally by linux).

So I make a work-around to “release” the shift before those keys are triggered.

The mouse mode does nothing to with this problem,but the idea of “mouse mode” by @hisptoot is really cool(and is usefull in apps need mouse cursor like pico8,retroarch…etc)

Any references in your code are welcome if my improvements are useful (Sorry for my poor English, and Chinese code comments in advance)

1 Like

Is there 2 easily accessible USB OTG 2.0 slots on the luckfox lyra?

If so, I’m going to use one of them to act as swap memory (by plugging in external high speed storage)
and the other for wifi most likely.

There is one. You could consider it two if you use the external usb-c connector, but then whatever you’re doing hangs outside of the case. Also note that it only provides 3.3 volts so that’s going to limit your options.

I haven’t messed with gentoo in many years but the last time I did it demanded that I compile everything on the computer in question (667mhz DEC Alpha) and it basically heated my apartment for a week and a half in the middle of december.

2 Likes

What operating system is everyone running on their lyra setup?

and has anyone made their own fully custom one?

As, I am trying to find drivers for the PicoCalc with Luckfox Lyra, but not linux drivers. Similar to how Blair has drivers for the pico at picocalc-text-starter github.

If you are finding something different to start, ewokOS is everything you need:

  • modern microkernel arch;
  • fully open source;
  • extreme memory &power efficiency design(normally 128MB RAM now days is severely strained to run any gui);
  • Completely gui impliment(X window)
  • Running on luckfox lyra(technical all rk3506 chips);
  • No body make a “open to use” image yet;
  • Not complete finish(sound,external SD,GPIO,wifi…etc);
1 Like

So, is that for the PicoCalc? As I am trying to continue Astralixi OS development, but port it to the Lyra, but I need the drivers for things like sd card slot, display, keyboard, audio (maybe), etc.

If your writing an ‘os’ shouldnt you be writing the drivers for sd card and other things?

2 Likes

I could, but I was just wondering if there was any available already, which could possibly save me some time.

Is this true:
The Picocalc integration with the Luckfox Lyra uses a custom Linux image, not standard Linux drivers for other systems, to run the hardware. Non-Linux drivers are generally not applicable here, as the device is intended for use with a Linux-based operating system.

AI overview wrote this.

ask the ai if it’s true

So, is it possible to make custom drivers for the Lyra?
(by custom drivers, I mean non-linux drivers.