diff --git a/Makefile b/Makefile
index dd260ef16808370f48e9f9cd09b7a69eb54f86da..263a91c1be14b8cf1862035ba69184c1e91d84e0 100644
--- a/Makefile
+++ b/Makefile
@@ -196,8 +196,8 @@ initrd_clean:
 	$(RM) "$(ARCH_DIR)$(STATE_DIR)/initrd_remastered"
 
 initrd_remaster : $(ARCH_DIR)$(STATE_DIR)/initrd_remastered
-$(call gentargets,$(STATE_DIR)/initrd_remastered) : $(call archdir,%)$(STATE_DIR)/initrd_extracted
-	$(CURDIR)/scripts/remaster_initrd.sh "$(CURDIR)" "$(call archdir,$*)$(INITRD)"
+$(call gentargets,$(STATE_DIR)/initrd_remastered) : $(call archdir,%)$(STATE_DIR)/initrd_extracted $(call archdir,%)$(STATE_DIR)/rootfs_finalized
+	$(CURDIR)/scripts/remaster_initrd.sh "$(CURDIR)" "$(call archdir,$*)$(INITRD)" "$(call archdir,$*)$(ROOTFS)"
 	touch "$(call archdir,$*)$(STATE_DIR)/initrd_remastered"
 
 initrd_pack : $(ARCH_DIR)$(INITRD_TARGET)
diff --git a/scripts/remaster_initrd.sh b/scripts/remaster_initrd.sh
index a3e4440ffd1d02a6d8aa78847ab2069720f0004a..02d764e622a81956342612a2b37aef2291327bc0 100755
--- a/scripts/remaster_initrd.sh
+++ b/scripts/remaster_initrd.sh
@@ -20,6 +20,7 @@
 
 SCRIPT_DIR="$1"
 IRD="$2"
+ROOTFS="$3"
 
 if [ ! -d "$SCRIPT_DIR" ]; then
 	echo "Expected lipck base path as first argument!"
@@ -31,6 +32,11 @@ if [ ! -d "$IRD" ]; then
         exit 2
 fi
 
+if [ ! -d "$ROOTFS" ]; then
+	echo "Expected rootfs directory as third argument!"
+	exit 3
+fi
+
 CONTRIB_DIR="$SCRIPT_DIR/contrib/initrd"
 
 if [ -e "$SCRIPT_DIR/scripts/common_functions.sh" ]; then
@@ -63,9 +69,17 @@ function install_liphook()
 	cp "$CONTRIB_DIR/initrd_hook/ORDER" "$IRD/scripts/casper-bottom/"
 }
 
+function replace_modules()
+{
+	local version=$(basename $(readlink -f "/mnt/data/lipck-work/x86_64/rootfs/vmlinuz") | cut -d'-' -f2-)
+	rm -rf "$IRD/lib/modules/*"
+	cp -a "$ROOTFS/lib/modules/$version" "$IRD/lib/modules"
+}
+
 mkdir -p "$IRD/lip"
 install_nmtelekinese
-add_no_bootloader_icon
+#add_no_bootloader_icon
 install_liphook
+replace_modules
 
 patch_all "$SCRIPT_DIR/patches/initrd" "$IRD"