Posted by: Wildan Maulana | August 25, 2007

cryptsetup ang libdevmapper issue on ngw

1]

# cryptsetup -y –cipher aes-cbc-plain –key-size 8 luksFormat /dev/mmcblk0p2

WARNING!
========
This will overwrite data on /dev/mmcblk0p2 irrevocably.

Are you sure? (Type uppercase yes): YES
Enter LUKS passphrase:
Verify passphrase:
device-mapper: table: 254:0: crypt: Error setting key
device-mapper: ioctl: error adding target to table
device-mapper: ioctl: device doesn’t appear to be in the dev hash table.
Failed to setup dm-crypt key mapping.
Check kernel for support for the aes-cbc-plain cipher spec and verify that /dev/mmcblk0p2 contains at least 16 sectors.
Failed to write to key storage.
Command failed.
~ #

Trace :

On NGW :

~ #uname -a
Linux (none) 2.6.18-at0 #1 Mon Aug 20 13:51:50 WIT 2007 avr32 unknown
~ #dmsetup targets
crypt v1.1.0
striped v1.0.2
linear v1.0.1
error v1.0.1
~ #

On Ubuntu :

root@netherland:/# uname -a
Linux netherland 2.6.20-15-generic #2 SMP Sun Apr 15 07:36:31 UTC 2007 i686 GNU/Linux
root@netherland:/# dmsetup targets
crypt v1.3.0
striped v1.0.2
linear v1.0.2
error v1.0.1

Trying to solve … :

Update the kernel to the newer version (2.6.22)

Issues found when building the new kernel :

at32ap700x_rtc at32ap700x_rtc.0: setting the system clock to 1970-01-01 00:00:00 (0)
Root-NFS: No NFS server available, giving up.
VFS: Unable to mount root fs via NFS, trying floppy.
VFS: Cannot open root device “mmcblk0p1” or unknown-block(2,0)
Please append a correct “root=” boot option; here are the available partitions:
1f00 128 mtdblock0 (driver?)
1f01 8000 mtdblock1 (driver?)
1f02 64 mtdblock2 (driver?)
1f03 8448 mtdblock3 (driver?)
Kernel panic – not syncing: VFS: Unable to mount root fs on unknown-block(2

Solution :

a). with the addition of rootwait=1 parameter at the bootargs variable, it can works on several sdcard …, but not on my sdcard … )-:

b). using this patch :
FILE: drivers/mmc/host/atmel-mci.c

Code:

static void atmci_request_end(struct mmc_host *mmc, struct mmc_request *mrq)
{
struct atmel_mci *host = mmc_priv(mmc);

WARN_ON(host->cmd || host->data);
host->mrq = NULL;

mmc_request_done(mmc, mrq);

printk(“AA”); // It makes a little time delay
}
result : FAILED

c). Using this patch :

 drivers/mmc/core/mmc_ops.c |    4 ++--
 drivers/mmc/core/sd_ops.c  |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c
index 7dd720f..22d2b85 100644
--- a/drivers/mmc/core/mmc_ops.c
+++ b/drivers/mmc/core/mmc_ops.c
@@ -98,6 +98,8 @@ int mmc_send_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr)
 	cmd.flags = MMC_RSP_R3 | MMC_CMD_BCR;

 	for (i = 100; i; i--) {
+		mmc_delay(10);
+
 		err = mmc_wait_for_cmd(host, &cmd, 0);
 		if (err != MMC_ERR_NONE)
 			break;
@@ -106,8 +108,6 @@ int mmc_send_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr)
 			break;

 		err = MMC_ERR_TIMEOUT;
-
-		mmc_delay(10);
 	}

 	if (rocr)
diff --git a/drivers/mmc/core/sd_ops.c b/drivers/mmc/core/sd_ops.c
index 9697ce5..8c08e1a 100644
--- a/drivers/mmc/core/sd_ops.c
+++ b/drivers/mmc/core/sd_ops.c
@@ -151,6 +151,8 @@ int mmc_send_app_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr)
 	cmd.flags = MMC_RSP_R3 | MMC_CMD_BCR;

 	for (i = 100; i; i--) {
+		mmc_delay(10);
+
 		err = mmc_wait_for_app_cmd(host, NULL, &cmd, MMC_CMD_RETRIES);
 		if (err != MMC_ERR_NONE)
 			break;
@@ -159,8 +161,6 @@ int mmc_send_app_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr)
 			break;

 		err = MMC_ERR_TIMEOUT;
-
-		mmc_delay(10);
 	}

 	if (rocr)
-- 1.5.2.3

Result :
FAILED … )-:

Another workaround …. :


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: