rewrite preinit as very small C program

By using the kernel "nolibc" header to avoid requiring a C library, we
can bring the initramfs size to around 4k

This does involve a tiny bit of inline mips assembly which I'm not
sure about. gcc seems unwilling to generate the code to load $gp at
function entry of main(), so we do it by hand - but I'd rather find
out why gcc doesn't.
This commit is contained in:
Daniel Barlow
2023-04-15 17:35:02 +01:00
parent b1a89ae8c3
commit 5dd0c6e3c0
4 changed files with 126 additions and 68 deletions

View File

@@ -40,6 +40,7 @@
# https://sourceforge.net/p/squashfs/mailman/message/26599379/
lzma = callPackage ./lzma {};
preinit = callPackage ./preinit {};
swconfig = callPackage ./swconfig {};
openwrt = callPackage ./openwrt {};