diff options
author | Michael Zhou <zhoumichaely@gmail.com> | 2011-06-03 05:46:25 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2011-06-03 09:16:44 +0000 |
commit | e5d09818787635bcb8f91e46cdbd8f1b16b698d2 (patch) | |
tree | 655a8858ada1d794043da064c2cc3bfcad7b8ba4 | |
parent | fa54730644827b80e9dcbbe9fb094e2c99d3d8bd (diff) | |
download | mkinitfs-e5d09818787635bcb8f91e46cdbd8f1b16b698d2.tar.bz2 mkinitfs-e5d09818787635bcb8f91e46cdbd8f1b16b698d2.tar.xz |
add encrypted root support
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | files.d/cryptsetup | 18 | ||||
-rwxr-xr-x | initramfs-init.in | 13 | ||||
-rw-r--r-- | modules.d/cryptsetup | 2 |
4 files changed, 35 insertions, 0 deletions
@@ -13,6 +13,7 @@ CONF_FILES := mkinitfs.conf \ modules.d/btrfs \ modules.d/cdrom \ modules.d/cramfs \ + modules.d/cryptsetup \ modules.d/ext2 \ modules.d/ext3 \ modules.d/ext4 \ @@ -31,6 +32,7 @@ CONF_FILES := mkinitfs.conf \ modules.d/xfs \ files.d/bootchart \ files.d/base \ + files.d/cryptsetup \ files.d/kms \ files.d/lvm diff --git a/files.d/cryptsetup b/files.d/cryptsetup new file mode 100644 index 0000000..260d789 --- /dev/null +++ b/files.d/cryptsetup @@ -0,0 +1,18 @@ +/sbin/cryptsetup +/lib/libcryptsetup.so.1.2.0 +/lib/libcryptsetup.so.1 +/lib/libpopt.so.0.0.0 +/lib/libpopt.so.0 +/lib/libuClibc-0.9.32-rc3.so +/lib/libc.so.0.9.32 +/lib/libuuid.so.1.3.0 +/lib/libuuid.so.1 +/lib/libdevmapper.so.1.02 +/lib/libssl.so.1.0.0 +/lib/libcrypto.so.1.0.0 +/lib/libdl-0.9.32-rc3.so +/lib/libdl.so.0.9.32 +/lib/libz.so.1.2.5 +/lib/libz.so.1 +/lib/ld64-uClibc-0.9.32-rc3.so +/lib/ld64-uClibc.so.0.9.32 diff --git a/initramfs-init.in b/initramfs-init.in index 924357c..4e15b5a 100755 --- a/initramfs-init.in +++ b/initramfs-init.in @@ -196,6 +196,17 @@ start_raid() { fi } +# start cryptsetup if exists +start_cryptsetup() { + [ -x /sbin/cryptsetup ] || return + modprobe dm-crypt + if [ -n "$KOPT_cryptroot" ]; then + modprobe dm-crypt + for map in /etc/keymap/*; do if [ -f "$map" ]; then zcat "$map" | loadkmap && break; fi ; done + cryptsetup luksOpen "$KOPT_cryptroot" "$KOPT_cryptdm" + fi +} + # start lvm if exists start_lvm() { [ -x /sbin/lvm ] || return @@ -317,6 +328,7 @@ if [ -n "$KOPT_root" ]; then [ -n "$KOPT_usbdelay" ] && sleep "$KOPT_usbdelay" wait_usb start_raid + start_cryptsetup start_lvm ebegin "Mounting root" retry_mount -o ro $KOPT_root $sysroot 2>/dev/null @@ -340,6 +352,7 @@ fi # incase we have alpine_dev on raid device... start_raid +start_cryptsetup start_lvm # locate boot media and mount it diff --git a/modules.d/cryptsetup b/modules.d/cryptsetup new file mode 100644 index 0000000..9b63cd3 --- /dev/null +++ b/modules.d/cryptsetup @@ -0,0 +1,2 @@ +kernel/crypto/* +kernel/drivers/md/dm-crypt.ko |