HinTak / seeed-voicecard

This is an enhancement fork with the explicit aim of supporting current shipping Raspbian/Ubuntu kernels without requiring downgrading. Please donate at https://hintak.github.io/ if it works for you. Use vX.Y branch for kernel version vX.Y
GNU General Public License v3.0
201 stars 78 forks source link

[FR] Refactor to Debian packaging #36

Closed fonix232 closed 5 months ago

fonix232 commented 5 months ago

Hi @HinTak - great work on keeping things up to date!

There's one thing that bothers me a little. The current structure, while sticks closely to the original Seeed repo, is not really suitable for long term support, or easy installation, especially with all the separate branches for different kernel versions.

I'd like to recommend a refactor that would introduce a proper build system to create Debian packages. This would allow a number of convenience features:

Ideally this would result in the following packages:

And with a bit of tinkering, the DKMS install script could be modified to even match the appropriate kernel X.Y folder within and compile that code (although I think version-specific changes should be done within the source, e.g. how it's done at https://github.com/HinTak/seeed-voicecard/blob/v6.1/ac108.c#L1328-L1332)

fonix232 commented 5 months ago

FYI I did start such a refactor, but all the scattered branches make it hard to pick a starting point, so your input would be most welcome regarding that :)

HinTak commented 5 months ago

There are historically ways of supporting multiple kernels via dkms : https://github.com/HinTak/seeed-voicecard/tree/v6.1/patches - I think it still works if you suddenly want to reboot into a much older 4.x kernels. It was just getting uglier and uglier when upstream kernel source changes. You basically need a diff for each of the distinct branches, and keep the diff in one places, and test each of them, by rebooting into a dozen different older kernels from time to time when you add a new one. It was an approach that proved to be painful.

Please feel free to spend your time on it, but, please do not try to decide how I spend my time.

fonix232 commented 5 months ago

Please note that nowhere in my original post did I specify that I'd want you to make these changes. I simply brought it up as a possible improvement, not to demand you to spend your time on it, but to gauge interest and possibly co-operate on implementing it, without placing any immediate pressure on you to actually provide this feature. Apologies if it came through as if I was demanding it.

As for multi-kernel support with the same DKMS package - Debian packaging does support changing how the DKMS install script runs, so by creating a module structure such as this:

seeed-voicecard/
├── ac108/
│   ├── 6.6/
│   │   ├── ac108.c
│   │   └── ac108.h
│   ├── 6.1/
│   │   ├── ac108.c
│   │   └── ac108.h
│   ├── 5.5/
│   │   ├── ac108.c
│   │   └── ac108.h
│   └── 4.9/
│       ├── ac108.c
│       └── ac108.h
└── wm8960/
    ├── 6.5/
    │   ├── wm8960.c
    │   └── wm8960.h
    ├── 6.3/
    │   ├── wm8960.c
    │   └── wm8960.h
    ├── 5.9/
    │   ├── wm8960.c
    │   └── wm8960.h
    ├── 5.1/
    │   ├── wm8960.c
    │   └── wm8960.h
    └── 4.7/
        ├── wm8960.c
        └── wm8960.h

it should be possible to both package, and compile the right version for the kernel. The only downside I see is that a kernel update would not trigger a proper rebuild (as the buildscript would need to reside in the postinst of the DKMS package), though I think it is possible to subscribe to package update events on Debian, which in turn could trigger a manual run of the postinst script.

Also, please don't misunderstand the above as me forcing any kind of work on you - I'm purely brainstorming here, in public, so that further input from other interested parties can be gathered. For this purpose, the only thing I'm asking is that you leave this "issue" open, so that others may find it, even if you have no interest in undertaking any part of it.

HinTak commented 5 months ago

That's not how I understand dkms works. That said, the multiple-directory layout, one per kernel version, is very easy to do: you just have multiple git submodules pointing to, instead of different repos, just different branches of the same repo (this). Please feel free to maintain such a meta package elsewhere.