summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Guthrie <colin@mageia.org>2013-11-06 12:54:36 +0000
committerColin Guthrie <colin@mageia.org>2013-11-06 12:54:41 +0000
commitc981ca81e90d734c8ed412c90e53aecda07a12f1 (patch)
tree0c8111f65b600fbdac4105c2db3911343e371711
parentaf2da841dbb78c275a4ee32c5f1653f7c6b13677 (diff)
downloaddrakx-c981ca81e90d734c8ed412c90e53aecda07a12f1.tar
drakx-c981ca81e90d734c8ed412c90e53aecda07a12f1.tar.gz
drakx-c981ca81e90d734c8ed412c90e53aecda07a12f1.tar.bz2
drakx-c981ca81e90d734c8ed412c90e53aecda07a12f1.tar.xz
drakx-c981ca81e90d734c8ed412c90e53aecda07a12f1.zip
stage1: Ensure kernel modules and firmware can be loaded in stage2 mga#11600 mga#11601
-rw-r--r--mdk-stage1/NEWS4
-rw-r--r--mdk-stage1/init.c14
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");