Re: LVM2 logical volumes on Loop-AES

Jari Ruusu <[email protected]>
Newsgroups gmane.linux.cryptography
Message-ID <[email protected]>
Jari Ruusu wrote:
> Below is experimental patch for build-initrd.sh that adds these between
> steps 4 and 5:

Fixed one bug. Try this one instead of the one I posted earlier.

-- 
Jari Ruusu  1024R/3A220F51 5B 4B F9 BB D3 3F 52 E9  DB 1D EB E3 24 0E A9 DD


--- ../loop-AES-v3.2a/build-initrd.sh	2007-05-14 15:18:12.000000000 +0300
+++ ./build-initrd.sh	2007-08-17 22:12:06.000000000 +0300
@@ -2,7 +2,7 @@
 #
 #  build-initrd.sh
 #
-#  Written by Jari Ruusu, May 14 2007
+#  Written by Jari Ruusu, August 14 2007
 #
 #  Copyright 2001-2007 by Jari Ruusu.
 #  Redistribution of this file is permitted under the GNU Public License.
@@ -192,6 +192,11 @@
 # The dietlibc can be found at http://www.fefe.de/dietlibc/
 USEDIETLIBC=1
 
+# C compiler used to compile /linuxrc program.
+# 32bit x86 ubuntu-7.04 gcc-4.1.2 is known to miscompile /linuxrc. Affected
+# users should install gcc-3.3 package, and change this to GCC=gcc-3.3
+GCC=gcc
+
 # 1 = load extra module, 0 = don't load
 # If this is enabled, module must be manually copied to
 # /boot/modules-KERNELRELEASE/ directory under name like foomatic.o
@@ -553,9 +558,17 @@
     wrStr("\n");
 #endif
 
+    mount("none", "/proc", "proc", MS_MGC_VAL, 0);
+    mount("none", "/sys", "sysfs", MS_MGC_VAL, 0);
+    buf[0] = 0;
+    strCat(buf, "/lib/losetup -a");
+    exeWait(buf);
+    umount("/sys");
+    umount("/proc");
+
 #if ${USEPIVOT}
-    if(mount("/dev/loop${DEVFSSLASH1}${ROOTLOOPINDEX}", "/new-root", "${ROOTTYPE}", MS_MGC_VAL | MS_RDONLY, 0)) {
-        wrStr("Looks like you didn't say the magic word. Mounting /dev/loop${DEVFSSLASH1}${ROOTLOOPINDEX} failed\n");
+    if(mount("/dev/root", "/new-root", "${ROOTTYPE}", MS_MGC_VAL | MS_RDONLY, 0)) {
+        wrStr("Looks like you didn't say the magic word. Mounting /dev/root failed\n");
         buf[0] = 0;
         strCat(buf, "/lib/${LOSETUPPROG} -d /dev/loop${DEVFSSLASH1}${ROOTLOOPINDEX}");
         if(exeWait(buf)) goto fail3;
@@ -632,9 +645,9 @@
 EOF
 
 if [ ${USEDIETLIBC} == 1 ] ; then
-    diet gcc -Wall -O2 -s -static -pipe tmp-c-$$.c -o tmp-c-$$
+    diet ${GCC} -Wall -O2 -s -static -pipe tmp-c-$$.c -o tmp-c-$$
 else
-    gcc -Wall -O2 -s -static -nostartfiles -pipe tmp-c-$$.c -o tmp-c-$$
+    ${GCC} -Wall -O2 -s -static -nostartfiles -pipe tmp-c-$$.c -o tmp-c-$$
 fi
 rm -f tmp-c-$$.[co]
 
@@ -655,6 +668,8 @@
     y=`expr ${y} + 1`
 fi
 
+y=`expr ${y} + 2`
+
 dd if=/dev/zero of=tmp-i-$$ bs=1024 count=${y}
 /sbin/mkfs -t minix -i 32 tmp-i-$$
 mkdir tmp-d-$$
@@ -675,6 +690,7 @@
 
 if [ ${USEPIVOT} == 1 ] ; then
     mkdir new-root
+    mkdir proc sys
 else
     mkdir proc
 fi
@@ -744,6 +760,9 @@
     mknod dev/ram0 b 1 0
     mknod dev/ram1 b 1 1
     mknod dev/loop${ROOTLOOPINDEX} b 7 ${ROOTLOOPINDEX}
+
+    # root device node, this device is what gets mounted as root
+    mknod dev/root b 7 5
 fi
 
 cd ..

-
Linux-crypto:  cryptography in and on the Linux system
Archive:       http://mail.nl.linux.org/linux-crypto/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.