toltec icon indicating copy to clipboard operation
toltec copied to clipboard

Kernelctl

Open Etn40ff opened this issue 2 years ago • 17 comments

This is a utility to manage aftermarket kernels.

Etn40ff avatar Mar 14 '22 22:03 Etn40ff

Does it make sense to force bz2 compression as the only option? It might make more sense to allow multiple compression algorithms to be used, like xz, gz, zstd.

Eeems avatar Mar 14 '22 23:03 Eeems

I do not see the benefit in allowing different compression formats: there are no preexisting kernels that we need to accommodate for so we might as well ask for a specific format. Moreover dealing with multiple formats would add a small complexity to the script.

Etn40ff avatar Mar 15 '22 10:03 Etn40ff

Fair enough. The next question is why bz2 instead of one of the other formats?

Eeems avatar Mar 15 '22 13:03 Eeems

Higher compression rate compared to gz. I do not really have a preference.

Etn40ff avatar Mar 15 '22 13:03 Etn40ff

If the compression ratio is what we want, and we aren't concerned about decompression speed, xz would be the better option. If we care about decompression speed while still having a good compression ratio, zstd would be better.

Eeems avatar Mar 15 '22 14:03 Eeems

I am not sure compression rate is such a concern: the backup of the vendor kernel is currently around 5.6M. Compression time is indeed quite slow with bz2. zstd is not currently available in the official firmware but we could depend on the toltec version.

Etn40ff avatar Mar 15 '22 16:03 Etn40ff

Here is a testing kernel you can use to check that kernelctl works. It is for RM2. It is basically the same as the current upstream kernel with uinput enabled and TRIM_UNUSED_KSYMS=n. edit: the kernel here had an issue with RDINS

GH is just dumb: I can attach a .gz but not a .bz2 so please just rename it to vendor_patched-20220315.tar.bz2 before using it.

PS: if there is enough interest in having the upstream kernel with few modifications in toltec I might easily be persuaded to make a package.

Etn40ff avatar Mar 15 '22 22:03 Etn40ff

@Etn40ff I'm on a rM1 so I can't test, but it looks like the automated checks are complaining about the script not following the style guide. You'll need to resolve that before it can be merged.

Eeems avatar Mar 21 '22 20:03 Eeems

~~It should be fixed now.~~ Oops, now the linter complains. This will take longer, I'll have a look at it tomorrow.

As for the file format, should I switch to zstd or xz?

Kernelctl should in theory work as well on a rm1. Actually it need testing there but I do not own a rm1. Could you do it? Do you need me to provide a testing kernel for you? Should I make a toltec package with the modifications I use on my rm2 (uevent, tun/tap, and TRIM_UNUSED_KSYMS=n)?

Etn40ff avatar Mar 21 '22 23:03 Etn40ff

Automated checks should be fine now

Etn40ff avatar Mar 22 '22 10:03 Etn40ff

I am unhappy of the current status:

Currently this script passes the list produced by tar tjf current_kernel_backup.tar.bz2 to rm -rf to clear up before installing the new kernel. The flags -rf are needed because a directory might be passed to rm before it has been emptied and it would give an error.

Obviously this is an easy recipe for disaster: if the kernel backup is not properly formatted one could delete something that should not be deleted. (I just erased the whole /lib this way and I was not a happy camper.) Any suggestion on a better way to delete all files and directories (if empty) from a list?

Etn40ff avatar Mar 27 '22 21:03 Etn40ff

I might have answered my own question but better solutions are welcome

Etn40ff avatar Mar 27 '22 22:03 Etn40ff

Here is a better kernel for testing on RM2: I messed up the previous one.

This is vanilla + uinput + tun - TRIM_UNUSED_KSYMS vendor_patched-20220329.tar.bz2.zip

Etn40ff avatar Mar 28 '22 22:03 Etn40ff

Any update on this? I'd love to get https://github.com/toltec-dev/toltec/pull/488 merged

alistair23 avatar Apr 19 '22 21:04 alistair23

Any update on this? I'd love to get #488 merged

I pinged toltec's team over Discord few days ago, they said that they wanted to focus on getting a stable release out first. That happened already so, hopefully, they will have some spare time soon.

Etn40ff avatar Apr 26 '22 14:04 Etn40ff

Any updates?

alistair23 avatar Jun 03 '22 08:06 alistair23

Tested on RM1 with linux-stracciatella. kernelctl works as advertised. Thank you!

luvanir avatar Aug 02 '22 23:08 luvanir