1 |
commit: c92fe6f0e654d49f00465e81f8f491ef9240fb80 |
2 |
Author: Christian Kruse <cjk <AT> wwwtech <DOT> de> |
3 |
AuthorDate: Thu Jan 5 16:45:38 2012 +0000 |
4 |
Commit: Sebastian Pipping <sping <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Jan 5 16:49:47 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=c92fe6f0 |
7 |
|
8 |
Introduce boot parameter root_trim=(yes|no) for SSDs |
9 |
|
10 |
--- |
11 |
defaults/initrd.scripts | 8 +++++++- |
12 |
defaults/linuxrc | 4 ++++ |
13 |
doc/genkernel.8.txt | 5 +++++ |
14 |
3 files changed, 16 insertions(+), 1 deletions(-) |
15 |
|
16 |
diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts |
17 |
index 89c6d8b..b7b42ab 100755 |
18 |
--- a/defaults/initrd.scripts |
19 |
+++ b/defaults/initrd.scripts |
20 |
@@ -732,7 +732,7 @@ openLUKS() { |
21 |
;; |
22 |
esac |
23 |
|
24 |
- eval local LUKS_DEVICE='"${CRYPT_'${TYPE}'}"' LUKS_NAME="$1" LUKS_KEY='"${CRYPT_'${TYPE}'_KEY}"' LUKS_KEYDEV='"${CRYPT_'${TYPE}'_KEYDEV}"' |
25 |
+ eval local LUKS_DEVICE='"${CRYPT_'${TYPE}'}"' LUKS_NAME="$1" LUKS_KEY='"${CRYPT_'${TYPE}'_KEY}"' LUKS_KEYDEV='"${CRYPT_'${TYPE}'_KEYDEV}"' LUKS_TRIM='"${CRYPT_'${TYPE}'_TRIM}"' |
26 |
local DEV_ERROR=0 KEY_ERROR=0 KEYDEV_ERROR=0 |
27 |
local mntkey="/mnt/key/" cryptsetup_options='' |
28 |
|
29 |
@@ -793,6 +793,12 @@ openLUKS() { |
30 |
continue |
31 |
else |
32 |
# Handle keys |
33 |
+ if [ "x${LUKS_TRIM}" = "xyes" ] |
34 |
+ then |
35 |
+ good_msg "Enabling TRIM support for ${LUKS_NAME}." ${CRYPT_SILENT} |
36 |
+ cryptsetup_options="${cryptsetup_options} --allow-discards" |
37 |
+ fi |
38 |
+ |
39 |
if [ -n "${LUKS_KEY}" ] |
40 |
then |
41 |
if [ ! -e "${mntkey}${LUKS_KEY}" ] |
42 |
|
43 |
diff --git a/defaults/linuxrc b/defaults/linuxrc |
44 |
index 63366bd..28d204e 100755 |
45 |
--- a/defaults/linuxrc |
46 |
+++ b/defaults/linuxrc |
47 |
@@ -189,6 +189,10 @@ do |
48 |
root_keydev=*) |
49 |
CRYPT_ROOT_KEYDEV=${x#*=} |
50 |
;; |
51 |
+ root_trim=*) |
52 |
+ CRYPT_ROOT_TRIM=${x#*=} |
53 |
+ ;; |
54 |
+ |
55 |
swap_key=*) |
56 |
CRYPT_SWAP_KEY=${x#*=} |
57 |
;; |
58 |
|
59 |
diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt |
60 |
index 35c7ff3..d436330 100644 |
61 |
--- a/doc/genkernel.8.txt |
62 |
+++ b/doc/genkernel.8.txt |
63 |
@@ -387,6 +387,11 @@ which the ramdisk scripts would recognize. |
64 |
root_key. If unset while using root_key, it will automatically |
65 |
look for the device in every boot. |
66 |
|
67 |
+*root_trim*=yes|no:: |
68 |
+ Allows you to enable TRIM support on root device. Only useful |
69 |
+ for SSD setups. Have a look at http://en.wikipedia.org/wiki/TRIM |
70 |
+ for more information. |
71 |
+ |
72 |
*swap_key*=<...>:: |
73 |
Same as root_key for swap. |