diff options
-rw-r--r-- | mdk-stage1/NEWS | 4 | ||||
-rw-r--r-- | mdk-stage1/init.c | 14 |
2 files changed, 18 insertions, 0 deletions
diff --git a/mdk-stage1/NEWS b/mdk-stage1/NEWS index 498850515..96aff7b04 100644 --- a/mdk-stage1/NEWS +++ b/mdk-stage1/NEWS @@ -1,3 +1,7 @@ +- kernel modules and firmware is needed during stage2, so move and symlink + (symlinks are only for if you umount state2 /usr and want a still working initrd) + mga#11600 mga#11601 + 1.83 - do initrd symlinking in 'init' rather than 'stage1' (stage1 is now run earlier) - build init and stage1 as a shared library (due to bugs in directory handling diff --git a/mdk-stage1/init.c b/mdk-stage1/init.c index b5fb6115b..7cec1076b 100644 --- a/mdk-stage1/init.c +++ b/mdk-stage1/init.c @@ -517,6 +517,20 @@ int main(int argc, char **argv) if (create_initial_fs_symlinks(STAGE2_LOCATION "/usr/share/symlinks") != 0) fatal_error("Fatal error finishing initialization (could not create symlinks)."); + /* kernel modules and firmware is needed by stage2, so move them to the root */ + if (rename("/usr/lib/modules", "/modules")) + fatal_error("Cannot rename modules folder"); + + if (rename("/usr/lib/firmware", "/firmware")) + fatal_error("Cannot rename firmware folder"); + + /* Add some symlinks so stage1 is still valid on it's own - not strictly needed */ + if (symlink("/modules", "/usr/lib/modules")) + fatal_error("Cannot symlink modules folder"); + + if (symlink("/firmware", "/usr/lib/firmware")) + fatal_error("Cannot symlink firmware folder"); + if (mount(STAGE2_LOCATION "/usr", "/usr", "none", MS_BIND|MS_RDONLY, NULL)) fatal_error("Unable to bind mount /usr filesystem from rescue or installer stage2"); |