Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Aug 2013 14:01:28 +1000
From:      "Dewayne Geraghty" <>
To:        "'Devin Teske'" <>
Subject:   RE: Geli and crunchgen (/rescue)
Message-ID:  <03EC079CDDEA4FB09CB414AC5530A561@white>
In-Reply-To: <13CA24D6AB415D428143D44749F57D7202004630@ltcfiswmsgmb21>
References:  <9121C290928D49ECB462DE369BE694DD@white> <13CA24D6AB415D428143D44749F57D72020020B1@ltcfiswmsgmb21> <7C1FEE8CDBC34182B221C8CBCDFF759A@white> <13CA24D6AB415D428143D44749F57D7202004630@ltcfiswmsgmb21>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
Hi Devin,

Thankyou.  I'll look further into the openssl reference (off-list) in a few minutes.

The geom stuff is a little bit tricky to get going, because only glabel and gpart have the necessary parts in them. Pawel left
enough clues to enable the other geom classes (good engineering)

The flags RELEASE_CRUNCH or RESCUE is tested in the geom/Makefile and defines STATIC_GEOM_CLASSES which is tested in the source; so:

I've added this and similar to geom eli (mirror, shsec raid...)
--- class/eli/geom_eli.c        (revision 253832)
+++ class/eli/geom_eli.c        (working copy)
@@ -54,9 +54,14 @@
 #include "core/geom.h"
 #include "misc/subr.h"

+#define PUBSYM(x)       geli_##x
+#define PUBSYM(x)       x

-uint32_t lib_version = G_LIB_VERSION;
-uint32_t version = G_ELI_VERSION;
+uint32_t PUBSYM(lib_version) = G_LIB_VERSION;
+uint32_t PUBSYM(version) = G_ELI_VERSION;

 #define        GELI_BACKUP_DIR "/var/backups/"
 #define        GELI_ENC_ALGO   "aes"
@@ -99,7 +104,8 @@
  * clear [-v] prov ...
  * dump [-v] prov ...
-struct g_command class_commands[] = {
+struct g_command PUBSYM(class_commands)[] = {
        { "init", G_FLAG_VERBOSE, eli_main,
                { 'a', "aalgo", "", G_TYPE_STRING },

Then I needed to add relevant parts (I'm really only interested in eli, mirror, shsec) in the /usr/src/sbin/geom/Makefile, but I
tested clean compilation of the other common classes.

--- Makefile    (revision 253832)
+++ Makefile    (working copy)
@@ -4,18 +4,40 @@

 .PATH: ${.CURDIR}/class/part \
        ${.CURDIR}/class/label \
+       ${.CURDIR}/class/eli \
+       ${.CURDIR}/class/mirror \
+       ${.CURDIR}/class/shsec \
        ${.CURDIR}/core \
-       ${.CURDIR}/misc
+        ${.CURDIR}/../../sys/geom/eli ${.CURDIR}/../../sys/crypto/sha2 \
+       ${.CURDIR}/misc
+# For geom friends, move these up
+#       ${.CURDIR}/class/raid \
+#       ${.CURDIR}/class/sched \
+#       ${.CURDIR}/class/stripe \
+#       ${.CURDIR}/class/journal \

 PROG=  geom
 SRCS=  geom.c geom_label.c geom_part.c subr.c
+SRCS+=  geom_eli.c
+SRCS+=  g_eli_crypto.c
+SRCS+=  g_eli_key.c
+SRCS+=  pkcs5v2.c
+SRCS+=  sha2.c
+SRCS+=  geom_mirror.c geom_shsec.c
+#SRCS+=  geom_raid.c geom_sched.c geom_stripe.c
+#SRCS+=  geom_journal.c geom_journal_ufs.c

 WARNS?=        2
+# For eli & friends
+CFLAGS+= -I${.CURDIR}/../../sys

-LDADD= -lgeom -lsbuf -lbsdxml -lutil
+LDADD= -lgeom -lsbuf -lbsdxml -lutil -lmd -lcrypto

Then adding to boot_crunch.conf:

progs geom
special geom objs geom.o geom_label.o geom_part.o geom_mirror.o geom_shsec.o geom_eli.o sha2.o pkcs5v2.o g_eli_key.o g_eli_crypto.o
ln geom geli
ln geom gmirror
ln geom gshsec

libs -lgeom -lkiconv -lm -lwrap
libs -lssl -lcrypto -lmd
# Note: I added a few other things so kiconv and wrap may not be needed for geom

Resulted in release/i386/boot_crunch and /rescue performing satisfactorily :)

Thanks for your help, and clues.

Kind regards, Dewayne.

Want to link to this message? Use this URL: <>