frno7 / gentoo-mipsr5900el

Gentoo tooling for the PlayStation 2, with a Docker, and scripts to install cross-compilers, QEMU, and essential tools.
23 stars 3 forks source link

Use dist-kernel to compile the Linux kernel #13

Open frno7 opened 2 years ago

frno7 commented 2 years ago

For details, see https://github.com/frno7/gentoo-mipsr5900el/issues/5#issuecomment-1114572591.

immolo commented 11 months ago

In Gentoo it seems widely agreed that Genkernel should be retired . I'm currently testing Catalyst support for building livecds using the dist-kernel instead which should be the last hurdle to last rites of the package (my views not Gentoo's.)

We should plan for this and use the dist-kernel as a template for the ps2 kernel as it will be easier plus have the bonus of the work being shared upstream and used in other Gentoo projects.

Happy to give starting pointers to anyone that wants to help as it will take some work off me :)

frno7 commented 11 months ago

My config disables IPv6 with # CONFIG_IPV6 is not set. I’d (really) like to have it (and some other things), but the kernel file grew too large and failed to boot. I haven’t put much effort into optimising for kernel size, though. Do you think a templated dist-kernel would fit to boot?

immolo commented 11 months ago

Good question, we can pull in any config we want as shown here.

The simple part is changing the source URI to here and using the config you created, the difficult part is creating the initramfs however it might be possible to do this with dracut which would make automating it in Gentoo very easy afterwards.

Doing it this way should both make it easier to get working and use less memory at the same time, so if someone wants to help out then it will be a much better use of their time :)

frno7 commented 11 months ago

Good question, we can pull in any config we want as shown here.

There seems to be a 4 MiB kernel size limit, but I don’t know where this limit comes from. The hardware has 32 MiB, so a much larger kernel should work. I suspect a configuration and/or programming issue. Maybe wLaunchELF needs to boot load the kernel into a lower address to fit it. Allowing an 8 MiB kernel, at least, would be nice and should easily permit IPv6 and other kernel features.

The simple part is changing the source URI to here and using the config you created, the difficult part is creating the initramfs however it might be possible to do this with dracut which would make automating it in Gentoo very easy afterwards.

Doing it this way should both make it easier to get working and use less memory at the same time, so if someone wants to help out then it will be a much better use of their time :)

Oh, I’ve never used Dracut. And then of course somehow reclaim the memory used by initramfs as mentioned in https://github.com/frno7/gentoo-mipsr5900el/discussions/17#discussioncomment-2889680. Maybe using kexec as in https://github.com/frno7/gentoo-mipsr5900el/discussions/17#discussioncomment-4561230 would be best, whereby the (generic and capable) boot kernel is replaced entirely by a nimbler Gentoo kernel. :-)

immolo commented 11 months ago

There seems to be a 4 MiB kernel size limit, but I don’t know where this limit comes from. 

From memory I believe this limit also existed with the old ps2 Linux bootloader.

Maybe using kexec as in https://github.com/frno7/gentoo-mipsr5900el/discussions/17#discussioncomment-4561230 would be best, whereby the (generic and capable) boot kernel is replaced entirely by a nimbler Gentoo kernel. :-)

I've never used kexec before but this does sound like a way to get around issues if needed.

Once I've completed work on reducing the x86 kernel in Gentoo I should have some more ideas on ways this can be achieved.