projg2 / eclean-kernel

Installed kernel cleanup tool
GNU General Public License v2.0
32 stars 11 forks source link

systemd-boot support #2

Open lovesegfault opened 5 years ago

lovesegfault commented 5 years ago

It'd be nice if systemd-boot, former gummiboot, was supported.

mgorny commented 4 years ago

Good news, everyone. I've started reviving the project, and this is next on my TODO list. So maybe tomorrow.

prometheanfire commented 3 years ago

tomorrow, eh?

mgorny commented 3 years ago

tomorrow, eh?

Don't you see the commit, though?

prometheanfire commented 3 years ago

I do, it looks like it's not finding my kernel because it was installed as linux and not vmlinuz as it expects.

prometheanfire commented 3 years ago

or being placed in a subdir of /boot/ like /boot//

prometheanfire commented 3 years ago
clean-kernel -n 5 -p --debug

DEBUG:root:Layout: <ecleankernel.layout.blspec.BlSpecLayout object at 0x7f501b934df0>
DEBUG:root:Bootloader failed: <class 'ecleankernel.bootloader.lilo.LILO'>
DEBUG:root:Bootloader failed: <class 'ecleankernel.bootloader.grub2.GRUB2'>
DEBUG:root:Bootloader failed: <class 'ecleankernel.bootloader.grub.GRUB'>
DEBUG:root:Bootloader failed: <class 'ecleankernel.bootloader.yaboot.Yaboot'>
DEBUG:root:Bootloader: <ecleankernel.bootloader.symlinks.Symlinks object at 0x7f501b934eb0>
DEBUG:root:Sorter: <ecleankernel.sort.VersionSort object at 0x7f501b934e20>
DEBUG:root:in get_removal_list()
Preserving currently running kernel (5.11.2)
Legend:
[-] file being removed
[+] file being kept (used by other kernels

These are the kernels which would be removed:
- 5.10.18: vmlinuz does not exist
 [-] /boot/dbca93ecd27d4e08aa36d39eedea459f/5.10.18/initrd
 [-] /boot/dbca93ecd27d4e08aa36d39eedea459f/5.10.18/linux
 [-] /boot/dbca93ecd27d4e08aa36d39eedea459f/5.10.18
 [-] /lib/modules/5.10.18/../../../usr/src/linux-5.10.18
 [-] /lib/modules/5.10.18
- 5.10.19: vmlinuz does not exist
 [-] /boot/dbca93ecd27d4e08aa36d39eedea459f/5.10.19/initrd
 [-] /boot/dbca93ecd27d4e08aa36d39eedea459f/5.10.19/linux
 [-] /boot/dbca93ecd27d4e08aa36d39eedea459f/5.10.19
 [-] /lib/modules/5.10.19/../../../usr/src/linux-5.10.19
 [-] /lib/modules/5.10.19
- 5.6.13-gentoo: vmlinuz does not exist
 [-] /usr/src/linux-5.6.13-gentoo
 [-] /lib/modules/5.6.13-gentoo
- 5.9.3-gentoo: vmlinuz does not exist
 [-] /usr/src/linux-5.9.3-gentoo
 [-] /lib/modules/5.9.3-gentoo
prometheanfire commented 3 years ago

magic number returned is ynam and not HdrS. However, my kernel version is also at 61440 bytes into the file and not 14848 bytes in.

mgorny commented 3 years ago

I guess you need to teach it how to find the (compressed?) kernel image.

prometheanfire commented 3 years ago

Ya, how to read the efi binary to find the kernel image and then from that read the kernel version (as I mentioned on irc last night).

Jannik2099 commented 3 years ago

If you need inspiration for parsing the PE file headers, I threw this together in a hurry - though I did this for self-practice and I don't mean to steal the show from prometheanfire. https://github.com/Jannik2099/eclean-kernel/blob/efistub/ecleankernel/file.py#L169

prometheanfire commented 2 years ago

I can confirm that the the edit seems to work. https://github.com/Jannik2099/eclean-kernel/commit/32b1a2d48813fec60826fa5f23a54c9ff4774588

Jannik2099 commented 2 years ago

Oh, I'm positively surprised that this is in working condition, heh - I can't predict when I'll find time to work on this, so anyone may feel free to pick up from here.