What's new

Asus RT-AC86U and LUKS firmware 384.8_2

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

chavo

Regular Contributor
Create virtual machine with 32gb disk

Code:
### Install fresh Ubuntu 18.04 LTS (Bionic Beaver)
ubuntu-18.04.3-desktop-amd64.iso


### Apply OS updates and make bash the default shell (reboot required)
sudo apt-get update && sudo apt-get -y dist-upgrade && sudo rm -f /bin/sh && sudo ln -sf bash /bin/sh && sudo reboot


### Install Linux kernel headers and essential development tools
sudo apt-get update && sudo apt-get -y install git build-essential linux-headers-$(uname -r)


### Install dependencies for AsusWRT
sudo dpkg --add-architecture i386 && sudo apt-get update && sudo apt-get -y install libtool-bin cmake libproxy-dev uuid-dev liblzo2-dev autoconf automake bash bison bzip2 diffutils file flex m4 g++ gawk groff-base libncurses5-dev libtool libslang2 make patch perl pkg-config shtool subversion tar texinfo zlib1g zlib1g-dev git gettext libexpat1-dev libssl-dev cvs gperf unzip python libxml-parser-perl gcc-multilib gconf-editor libxml2-dev g++-multilib gitk libncurses5 mtd-utils libncurses5-dev libvorbis-dev git autopoint autogen sed build-essential intltool libelf1 libglib2.0-dev xutils-dev lib32z1-dev lib32stdc++6 xsltproc gtk-doc-tools libelf-dev:i386 libelf1:i386 libltdl-dev

### Install other programs
sudo apt-get -y install lzip patchelf

### Clone the toolchains
cd
if [ ! -d am-toolchains ]; then
  git clone https://github.com/RMerl/am-toolchains
fi


### Fix the toolchain symlinks
sudo mkdir -p /opt ; sudo rm -rf /opt/toolchains ; sudo ln -s ~/am-toolchains/brcm-arm-hnd /opt/toolchains ; sudo rm -f /opt/brcm-arm ; sudo ln -s ~/am-toolchains/brcm-arm-sdk/hndtools-arm-linux-2.6.36-uclibc-4.5.3 /opt/brcm-arm ; sudo rm -f /opt/brcm ; sudo ln -s ~/am-toolchains/brcm-mips-sdk/tools/brcm /opt/brcm

### Clone repo
git clone https://github.com/RMerl/asuswrt-merlin.ng

### Checkout 384.8_2
cd asuswrt-merlin.ng
git checkout 384.8_2
cd

### Create a build tree from the repo and fix the symlinks
rm -rf asuswrt-merlin.ng-build
cp -a asuswrt-merlin.ng/ asuswrt-merlin.ng-build

# fix symlinks for HND toolchain
rm -rf ~/asuswrt-merlin.ng-build/release/src-rt-5.02hnd/bcmdrivers/broadcom/net/wl/impl51/main/src/toolchains
ln -s ~/am-toolchains/brcm-arm-hnd ~/asuswrt-merlin.ng-build/release/src-rt-5.02hnd/bcmdrivers/broadcom/net/wl/impl51/main/src/toolchains

# fix symlinks for ARM toolchain
rm -rf ~/asuswrt-merlin.ng-build/release/src-rt-6.x.4708/toolchains
ln -s ~/am-toolchains/brcm-arm-sdk ~/asuswrt-merlin.ng-build/release/src-rt-6.x.4708/toolchains

# patch priority - need for bug bcmspu module
cd ~/asuswrt-merlin.ng-build/release/src-rt-5.02hnd/kernel/linux-4.1/arch/arm64/crypto
perl -pi.bak -e 's/\.cra_priority\s+=\s+(200|300|PRIO)/.cra_priority = 10000/g' *.c
rm -rf *.c.bak
cd

# patch Makefile - fix error (insmod: can't insert 'dm-mod.ko': unknown symbol in module, or unknown parameter)
cd ~/asuswrt-merlin.ng-build/release/src-rt-5.02hnd/kernel/linux-4.1/drivers/md/
perl -pi.bak -e 's/dm-ioctl.o dm-io.o dm-kcopyd.o dm-sysfs.o dm-stats.o/dm-ioctl.o dm-io.o dm-kcopyd.o dm-sysfs.o dm-stats.o dm-builtin.o/g' Makefile
rm -rf Makefile.bak
cd

# create patch file '~/lukspatch' with LUKS and ARM64 crypto support

rm ~/lukspatch
cat > ~/lukspatch << 'EOF'
--- /home/a/asuswrt-merlin.ng-build/release/src-rt-5.02hnd/kernel/linux-4.1/config_base.6a    2019-12-17 22:42:35.000184784 +0100
+++ config_base.6a.384.8_2luks    2019-12-17 23:09:43.582851544 +0100
@@ -1175,6 +1175,11 @@
 # CONFIG_SCSI_OSD_INITIATOR is not set
 # CONFIG_ATA is not set
 # CONFIG_MD is not set
+CONFIG_MD=y
+CONFIG_BLK_DEV_MD=m
+CONFIG_BLK_DEV_DM=m
+CONFIG_DM_CRYPT=m
+CONFIG_BLK_DEV_DM_BUILTIN=y
 # CONFIG_TARGET_CORE is not set
 # CONFIG_FUSION is not set
 
@@ -2369,6 +2374,7 @@
 CONFIG_CRYPTO_MANAGER=y
 CONFIG_CRYPTO_MANAGER2=y
 # CONFIG_CRYPTO_USER is not set
+CONFIG_CRYPTO_USER=m
 CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y
 CONFIG_CRYPTO_GF128MUL=y
 CONFIG_CRYPTO_NULL=y
@@ -2397,6 +2403,7 @@
 # CONFIG_CRYPTO_PCBC is not set
 # CONFIG_CRYPTO_XTS is not set
 
+CONFIG_CRYPTO_XTS=m
 #
 # Hash modes
 #
@@ -2441,8 +2448,10 @@
 # CONFIG_CRYPTO_SALSA20 is not set
 # CONFIG_CRYPTO_SEED is not set
 # CONFIG_CRYPTO_SERPENT is not set
+CONFIG_CRYPTO_SERPENT=m
 # CONFIG_CRYPTO_TEA is not set
 # CONFIG_CRYPTO_TWOFISH is not set
+CONFIG_CRYPTO_TWOFISH=m
 
 #
 # Compression
@@ -2460,9 +2469,18 @@
 # CONFIG_CRYPTO_DRBG_MENU is not set
 # CONFIG_CRYPTO_USER_API_HASH is not set
 # CONFIG_CRYPTO_USER_API_SKCIPHER is not set
+CONFIG_CRYPTO_USER_API_SKCIPHER=m
 # CONFIG_CRYPTO_USER_API_RNG is not set
 # CONFIG_CRYPTO_HW is not set
 # CONFIG_ARM64_CRYPTO is not set
+CONFIG_ARM64_CRYPTO=y
+CONFIG_CRYPTO_SHA1_ARM64_CE=m
+CONFIG_CRYPTO_SHA2_ARM64_CE=m
+CONFIG_CRYPTO_GHASH_ARM64_CE=m
+CONFIG_CRYPTO_AES_ARM64_CE=m
+CONFIG_CRYPTO_AES_ARM64_CE_CCM=m
+CONFIG_CRYPTO_AES_ARM64_CE_BLK=m
+CONFIG_CRYPTO_CRC32_ARM64=m
 # CONFIG_BINARY_PRINTF is not set
 
 #
EOF

# apply config patch
patch ~/asuswrt-merlin.ng-build/release/src-rt-5.02hnd/kernel/linux-4.1/config_base.6a < lukspatch


### Build RT-AC86U firmware (HND)
export LD_LIBRARY_PATH=/opt/toolchains/crosstools-arm-gcc-5.3-linux-4.1-glibc-2.22-binutils-2.25/usr/lib
export TOOLCHAIN_BASE=/opt/toolchains
echo $PATH | grep -qF /opt/toolchains/crosstools-arm-gcc-5.3-linux-4.1-glibc-2.22-binutils-2.25/usr/bin || export PATH=$PATH:/opt/toolchains/crosstools-arm-gcc-5.3-linux-4.1-glibc-2.22-binutils-2.25/usr/bin
echo $PATH | grep -qF /opt/toolchains/crosstools-aarch64-gcc-5.3-linux-4.1-glibc-2.22-binutils-2.25/usr/bin || export PATH=$PATH:/opt/toolchains/crosstools-aarch64-gcc-5.3-linux-4.1-glibc-2.22-binutils-2.25/usr/bin
cd ~/asuswrt-merlin.ng-build/release/src-rt-5.02hnd
make rt-ac86u


### Copy *.ko to ~/luksmodules
rm -rf ~/luksmodules
mkdir ~/luksmodules
cp ~/asuswrt-merlin.ng-build/release/src-rt-5.02hnd/kernel/linux-4.1/drivers/md/*.ko ~/luksmodules
cp ~/asuswrt-merlin.ng-build/release/src-rt-5.02hnd/kernel/linux-4.1/arch/arm64/crypto/*.ko ~/luksmodules
cp ~/asuswrt-merlin.ng-build/release/src-rt-5.02hnd/kernel/linux-4.1/crypto/*.ko ~/luksmodules
cd

# list *.ko
# ablk_helper.ko      cryptd.ko           sha1-ce.ko
# aes-ce-blk.ko       crypto_user.ko      sha2-ce.ko
# aes-ce-ccm.ko       dm-crypt.ko         twofish_common.ko
# aes-ce-cipher.ko    dm-mod.ko           twofish_generic.ko
# af_alg.ko           ghash-ce.ko         xts.ko
# algif_skcipher.ko   md-mod.ko
# crc32-arm64.ko      serpent_generic.ko


### Copy ~/luksmodules to router /jffs folder and try
cd /jffs/luksmodules
insmod ./dm-mod.ko

# load all - need 2 times for load all
for a in *.ko; do insmod $a; done
for a in *.ko; do insmod $a; done
 
Last edited:

### Test LUKS (you need USB hdd or flash)
opkg install cryptsetup
cat /proc/crypto | grep -A 3 "xts(aes)"

name : xts(aes)
driver : xts-aes-ce
module : aes_ce_blk
priority : 10000
--
name : xts(aes)
driver : xts-aes-iproc
module : bcmspu
priority : 400

cryptsetup benchmark
# Tests are approximate using memory only (no storage IO).
PBKDF2-sha1 385505 iterations per second for 256-bit key
PBKDF2-sha256 759837 iterations per second for 256-bit key
PBKDF2-sha512 369216 iterations per second for 256-bit key
PBKDF2-ripemd160 229950 iterations per second for 256-bit key
PBKDF2-whirlpool N/A
argon2i N/A
argon2id N/A
# Algorithm | Key | Encryption | Decryption
aes-cbc 128b 472.3 MiB/s 589.8 MiB/s
serpent-cbc 128b 37.6 MiB/s 42.3 MiB/s
twofish-cbc 128b 49.7 MiB/s 51.1 MiB/s
aes-cbc 256b 408.1 MiB/s 547.5 MiB/s
serpent-cbc 256b 38.0 MiB/s 42.1 MiB/s
twofish-cbc 256b 50.1 MiB/s 51.0 MiB/s
aes-xts 256b 518.3 MiB/s 522.4 MiB/s
serpent-xts 256b 39.9 MiB/s 42.8 MiB/s
twofish-xts 256b 52.6 MiB/s 51.7 MiB/s
aes-xts 512b 489.2 MiB/s 480.1 MiB/s
serpent-xts 512b 40.3 MiB/s 43.0 MiB/s
twofish-xts 512b 53.5 MiB/s 51.7 MiB/s

cat /sys/kernel/debug/bcmspu/stats
Number of SPUs.........1
Number of channels.....1
Current sessions.......0
Session count..........0
Cipher setkey..........0
HMAC setkey............0
AEAD setkey............0
Cipher Ops.............0
Hash Ops...............0
HMAC Ops...............0
AEAD Ops...............0
AEAD fallback Ops......0
Bytes of req data......0
Bytes of resp data.....0
Message send failures..0
Check ICV errors.......0

go to HDD or FLASH

dd if=/dev/zero of=./crypto.img bs=1M count=512

losetup /dev/loop1 ./crypto.img
cryptsetup --verbose --debug --disable-locks --type luks1 luksFormat /dev/loop1

luksFormat /dev/loop1
# cryptsetup 2.1.0 processing "cryptsetup --verbose --debug --disable-locks --type luks1 luksFormat /dev/loop1"
# Running command luksFormat.
# Locking memory.
# Installing SIGINT/SIGTERM handler.
# Unblocking interruption on signal.
# Allocating context for crypt device /dev/loop1.
# Trying to open and read device /dev/loop1 with direct-io.
# Initialising device-mapper backend library.
WARNING!
========
This will overwrite data on /dev/loop1 irrevocably.
Are you sure? (Type uppercase yes): YES
# Interactive passphrase entry requested.
Enter passphrase for /dev/loop1:
Verify passphrase:
# Crypto backend (OpenSSL 1.1.1d 10 Sep 2019) initialized in cryptsetup library version 2.1.0.
# Detected kernel Linux 4.1.27 aarch64.
# PBKDF pbkdf2, hash sha256, time_ms 2000 (iterations 0), max_memory_kb 0, parallel_threads 0.
# Formatting device /dev/loop1 as type LUKS1.
# Topology: IO (512/0), offset = 0; Required alignment is 1048576 bytes.
# Checking if cipher aes-xts-plain64 is usable.
# Using userspace crypto wrapper to access keyslot area.
# Generating LUKS header version 1 using hash sha256, aes, xts-plain64, MK 64 bytes
# Running pbkdf2(sha256) benchmark.
# PBKDF benchmark: memory cost = 0, iterations = 327680, threads = 0 (took 100 ms)
# PBKDF benchmark: memory cost = 0, iterations = 385505, threads = 0 (took 680 ms)
# Benchmark returns pbkdf2(sha256) 385505 iterations, 0 memory, 0 threads (for 512-bits key).
# Data offset 4096, UUID 1a5ccabd-84e6-4a25-99b7-37b71b326ce4, digest iterations 48188
# Wiping LUKS areas (0x000000 - 0x200000) with zeroes.
# Wiping keyslot 0 area (0x001000 - 0x03f800) with random data.
# Wiping keyslot 1 area (0x040000 - 0x07e800) with random data.
# Wiping keyslot 2 area (0x07f000 - 0x0bd800) with random data.
# Wiping keyslot 3 area (0x0be000 - 0x0fc800) with random data.
# Wiping keyslot 4 area (0x0fd000 - 0x13b800) with random data.
# Wiping keyslot 5 area (0x13c000 - 0x17a800) with random data.
# Wiping keyslot 6 area (0x17b000 - 0x1b9800) with random data.
# Wiping keyslot 7 area (0x1ba000 - 0x1f8800) with random data.
# Updating LUKS header of size 1024 on device /dev/loop1
# Key length 64, device size 1048576 sectors, header size 4036 sectors.
# Reading LUKS header of size 1024 from device /dev/loop1
# Key length 64, device size 1048576 sectors, header size 4036 sectors.
# Adding new keyslot -1 using volume key.
# Selected keyslot 0.
# Calculating data for key slot 0
# Running pbkdf2(sha256) benchmark.
# PBKDF benchmark: memory cost = 0, iterations = 364088, threads = 0 (took 90 ms)
# PBKDF benchmark: memory cost = 0, iterations = 379918, threads = 0 (took 690 ms)
# Benchmark returns pbkdf2(sha256) 379918 iterations, 0 memory, 0 threads (for 512-bits key).
# Key slot 0 use 759836 password iterations.
# Using hash sha256 for AF in key slot 0, 4000 stripes
# Updating key slot 0 [0x1000] area.
# Using userspace crypto wrapper to access keyslot area.
# Key slot 0 was enabled in LUKS header.
# Updating LUKS header of size 1024 on device /dev/loop1
# Key length 64, device size 1048576 sectors, header size 4036 sectors.
# Reading LUKS header of size 1024 from device /dev/loop1
# Key length 64, device size 1048576 sectors, header size 4036 sectors.
Key slot 0 created.
# Releasing crypt device /dev/loop1 context.
# Releasing device-mapper backend.
# Unlocking memory.
Command successful.

cryptsetup luksOpen /dev/loop1 500mb
cryptsetup -v status 500mb

/dev/mapper/500mb is active.
type: LUKS1
cipher: aes-xts-plain64
keysize: 512 bits
key location: dm-crypt
device: /dev/loop1
loop: /tmp/mnt/asus/crypto.img
sector size: 512
offset: 4096 sectors
size: 1044480 sectors
mode: read/write
Command successful.

cryptsetup luksDump /dev/loop1
LUKS header information for /dev/loop1
Version: 1
Cipher name: aes
Cipher mode: xts-plain64
Hash spec: sha256
Payload offset: 4096
MK bits: 512
MK digest: 2b fc 92 f1 fe 0c a9 c2 da 1e 0e 59 49 33 d3 ca 1f 76 75 4c
MK salt: a8 cd 4d 76 12 21 53 c6 c1 07 d4 54 09 d2 62 da
1b a1 49 3b 32 52 bd 94 0e 9e a9 14 02 56 41 29
MK iterations: 48188
UUID: 1a5ccabd-84e6-4a25-99b7-37b71b326ce4
Key Slot 0: ENABLED
Iterations: 759836
Salt: 7f 43 53 8a 26 20 25 ca 37 9a a8 56 e0 e6 cf 0a
8a d6 b9 b3 b9 bb 07 f7 51 37 1a 87 c8 b7 81 4f
Key material offset: 8
AF stripes: 4000
Key Slot 1: DISABLED
Key Slot 2: DISABLED
Key Slot 3: DISABLED
Key Slot 4: DISABLED
Key Slot 5: DISABLED
Key Slot 6: DISABLED
Key Slot 7: DISABLED

Test write with dd
dd if=/dev/zero of=/dev/mapper/500mb
dd: writing '/dev/mapper/500mb': No space left on device
1044481+0 records in
1044480+0 records out
 
LUKS RAID modules 386.5_2

mdadm-4.1 https://github.com/neilbrown/mdadm.git


Code:
### Install fresh Ubuntu
ubuntu-20.04.3-desktop-amd64.iso


### Apply OS updates and make bash the default shell (reboot required)
sudo apt-get update
sudo apt-get upgrade
sudo rm -f /bin/sh && sudo ln -sf bash /bin/sh && sudo reboot


### Install Linux kernel headers and essential development tools
sudo apt-get update && sudo apt-get -y install git build-essential linux-headers-$(uname -r)


### Install dependencies for AsusWRT
sudo dpkg --add-architecture i386 && sudo apt-get update && sudo apt-get -y install libtool-bin cmake libproxy-dev uuid-dev liblzo2-dev autoconf automake bash bison bzip2 diffutils file flex m4 g++ gawk groff-base libncurses5-dev libtool libslang2 make patch perl pkg-config shtool subversion tar texinfo zlib1g zlib1g-dev git gettext libexpat1-dev libssl-dev cvs gperf unzip python libxml-parser-perl gcc-multilib gconf-editor libxml2-dev g++-multilib gitk libncurses5 mtd-utils libncurses5-dev libvorbis-dev git autopoint autogen sed build-essential intltool libelf1 libglib2.0-dev xutils-dev lib32z1-dev lib32stdc++6 xsltproc gtk-doc-tools libelf-dev:i386 libelf1:i386 libltdl-dev

### Install other programs
sudo apt-get -y install lzip patchelf dos2unix

### Clone the toolchains
cd
if [ ! -d am-toolchains ]; then
  git clone https://github.com/RMerl/am-toolchains
fi

sudo ln -s ~/am-toolchains/brcm-arm-hnd /opt/toolchains
echo "export LD_LIBRARY_PATH=$LD_LIBRARY:/opt/toolchains/crosstools-arm-gcc-5.3-linux-4.1-glibc-2.22-binutils-2.25/usr/lib" >> ~/.profile
echo "export TOOLCHAIN_BASE=/opt/toolchains" >> ~/.profile
echo "PATH=\$PATH:/opt/toolchains/crosstools-arm-gcc-5.3-linux-4.1-glibc-2.22-binutils-2.25/usr/bin" >> ~/.profile
echo "PATH=\$PATH:/opt/toolchains/crosstools-aarch64-gcc-5.3-linux-4.1-glibc-2.22-binutils-2.25/usr/bin" >> ~/.profile

sudo reboot

### Clone repo
git clone https://github.com/RMerl/asuswrt-merlin.ng

### Checkout
cd asuswrt-merlin.ng
git checkout 386.5_2
cd

### Create a build tree from the repo
rm -rf asuswrt-merlin.ng-build
cp -a asuswrt-merlin.ng/ asuswrt-merlin.ng-build

# patch priority - need for bug bcmspu module
cd ~/asuswrt-merlin.ng-build/release/src-rt-5.02hnd/kernel/linux-4.1/arch/arm64/crypto
perl -pi.bak -e 's/\.cra_priority\s+=\s+(200|300|PRIO)/.cra_priority = 10000/g' *.c
rm -rf *.c.bak
cd

# patch Makefile - fix error (insmod: can't insert 'dm-mod.ko': unknown symbol in module, or unknown parameter)
# error (kernel: dm_mod: Unknown symbol dm_kobject_release (err 0))
cd ~/asuswrt-merlin.ng-build/release/src-rt-5.02hnd/kernel/linux-4.1/drivers/md/
perl -pi.bak -e 's/dm-ioctl.o dm-io.o dm-kcopyd.o dm-sysfs.o dm-stats.o/dm-ioctl.o dm-io.o dm-kcopyd.o dm-sysfs.o dm-stats.o dm-builtin.o/g' Makefile
rm -rf Makefile.bak
cd

# create patch file '~/luksraidpatch' with LUKS RAID ARM64 crypto support

rm ~/luksraidpatch
cat > ~/luksraidpatch << 'EOF'
--- /home/evg/asuswrt-merlin.ng/release/src-rt-5.02hnd/kernel/linux-4.1/config_base.6a    2022-06-19 22:31:38.000000000 -0400
+++ config_base.6a    2022-06-20 06:11:13.699618302 -0400
@@ -1185,6 +1185,59 @@
# CONFIG_SCSI_OSD_INITIATOR is not set
# CONFIG_ATA is not set
# CONFIG_MD is not set
+
+CONFIG_MD=y
+CONFIG_BLK_DEV_MD=m
+
+CONFIG_MD_LINEAR=m
+CONFIG_MD_RAID0=m
+CONFIG_MD_RAID1=m
+CONFIG_MD_RAID10=m
+CONFIG_MD_RAID456=m
+CONFIG_MD_MULTIPATH=m
+CONFIG_MD_FAULTY=m
+CONFIG_MD_CLUSTER=m
+
+#CONFIG_BLK_DEV_DM_BUILTIN=y
+CONFIG_BLK_DEV_DM=m
+
+# CONFIG_DM_DEBUG is not set
+CONFIG_DM_BUFIO=m
+# CONFIG_DM_DEBUG_BLOCK_MANAGER_LOCKING is not set
+CONFIG_DM_BIO_PRISON=m
+CONFIG_DM_PERSISTENT_DATA=m
+CONFIG_DM_UNSTRIPED=m
+CONFIG_DM_CRYPT=m
+CONFIG_DM_SNAPSHOT=m
+CONFIG_DM_THIN_PROVISIONING=m
+CONFIG_DM_CACHE=m
+CONFIG_DM_CACHE_SMQ=m
+CONFIG_DM_WRITECACHE=m
+CONFIG_DM_EBS=m
+CONFIG_DM_ERA=m
+CONFIG_DM_CLONE=m
+CONFIG_DM_MIRROR=m
+CONFIG_DM_LOG_USERSPACE=m
+CONFIG_DM_RAID=m
+CONFIG_DM_ZERO=m
+CONFIG_DM_MULTIPATH=m
+CONFIG_DM_MULTIPATH_QL=m
+CONFIG_DM_MULTIPATH_ST=m
+CONFIG_DM_MULTIPATH_HST=m
+CONFIG_DM_MULTIPATH_IOA=m
+CONFIG_DM_DELAY=m
+# CONFIG_DM_DUST is not set
+CONFIG_DM_FLAKEY=m
+CONFIG_DM_VERITY=m
+CONFIG_DM_VERITY_VERIFY_ROOTHASH_SIG=y
+# CONFIG_DM_VERITY_VERIFY_ROOTHASH_SIG_SECONDARY_KEYRING is not set
+# CONFIG_DM_VERITY_FEC is not set
+CONFIG_DM_SWITCH=m
+CONFIG_DM_LOG_WRITES=m
+CONFIG_DM_INTEGRITY=m
+CONFIG_DM_ZONED=m
+
+
# CONFIG_TARGET_CORE is not set
# CONFIG_FUSION is not set

@@ -2382,6 +2435,9 @@
CONFIG_CRYPTO_MANAGER=y
CONFIG_CRYPTO_MANAGER2=y
# CONFIG_CRYPTO_USER is not set
+
+CONFIG_CRYPTO_USER=m
+
CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y
CONFIG_CRYPTO_GF128MUL=y
CONFIG_CRYPTO_NULL=y
@@ -2409,7 +2465,7 @@
# CONFIG_CRYPTO_LRW is not set
# CONFIG_CRYPTO_PCBC is not set
# CONFIG_CRYPTO_XTS is not set
-
+CONFIG_CRYPTO_XTS=m
#
# Hash modes
#
@@ -2454,9 +2510,10 @@
# CONFIG_CRYPTO_SALSA20 is not set
# CONFIG_CRYPTO_SEED is not set
# CONFIG_CRYPTO_SERPENT is not set
+CONFIG_CRYPTO_SERPENT=m
# CONFIG_CRYPTO_TEA is not set
# CONFIG_CRYPTO_TWOFISH is not set
-
+CONFIG_CRYPTO_TWOFISH=m
#
# Compression
#
@@ -2473,9 +2530,18 @@
# CONFIG_CRYPTO_DRBG_MENU is not set
# CONFIG_CRYPTO_USER_API_HASH is not set
# CONFIG_CRYPTO_USER_API_SKCIPHER is not set
+CONFIG_CRYPTO_USER_API_SKCIPHER=m
# CONFIG_CRYPTO_USER_API_RNG is not set
# CONFIG_CRYPTO_HW is not set
# CONFIG_ARM64_CRYPTO is not set
+CONFIG_ARM64_CRYPTO=y
+CONFIG_CRYPTO_SHA1_ARM64_CE=m
+CONFIG_CRYPTO_SHA2_ARM64_CE=m
+CONFIG_CRYPTO_GHASH_ARM64_CE=m
+CONFIG_CRYPTO_AES_ARM64_CE=m
+CONFIG_CRYPTO_AES_ARM64_CE_CCM=m
+CONFIG_CRYPTO_AES_ARM64_CE_BLK=m
+CONFIG_CRYPTO_CRC32_ARM64=m
# CONFIG_BINARY_PRINTF is not set

#
EOF

# apply config patch
patch ~/asuswrt-merlin.ng-build/release/src-rt-5.02hnd/kernel/linux-4.1/config_base.6a < luksraidpatch


### Build RT-AC86U firmware (HND)
export LD_LIBRARY_PATH=/opt/toolchains/crosstools-arm-gcc-5.3-linux-4.1-glibc-2.22-binutils-2.25/usr/lib
export TOOLCHAIN_BASE=/opt/toolchains
echo $PATH | grep -qF /opt/toolchains/crosstools-arm-gcc-5.3-linux-4.1-glibc-2.22-binutils-2.25/usr/bin || export PATH=$PATH:/opt/toolchains/crosstools-arm-gcc-5.3-linux-4.1-glibc-2.22-binutils-2.25/usr/bin
echo $PATH | grep -qF /opt/toolchains/crosstools-aarch64-gcc-5.3-linux-4.1-glibc-2.22-binutils-2.25/usr/bin || export PATH=$PATH:/opt/toolchains/crosstools-aarch64-gcc-5.3-linux-4.1-glibc-2.22-binutils-2.25/usr/bin
cd ~/asuswrt-merlin.ng-build/release/src-rt-5.02hnd
make rt-ac86u


### Copy *.ko to ~/luksmodules
rm -rf ~/luksmodules
mkdir ~/luksmodules
cp ~/asuswrt-merlin.ng-build/release/src-rt-5.02hnd/kernel/linux-4.1/arch/arm64/crypto/*.ko ~/luksmodules
cp ~/asuswrt-merlin.ng-build/release/src-rt-5.02hnd/kernel/linux-4.1/crypto/*.ko ~/luksmodules
cp ~/asuswrt-merlin.ng-build/release/src-rt-5.02hnd/kernel/linux-4.1/crypto/async_tx/*.ko ~/luksmodules
cp ~/asuswrt-merlin.ng-build/release/src-rt-5.02hnd/kernel/linux-4.1/drivers/connector/cn.ko ~/luksmodules
cp ~/asuswrt-merlin.ng-build/release/src-rt-5.02hnd/kernel/linux-4.1/drivers/md/*.ko ~/luksmodules
cp ~/asuswrt-merlin.ng-build/release/src-rt-5.02hnd/kernel/linux-4.1/drivers/md/persistent-data/*.ko ~/luksmodules
cp ~/asuswrt-merlin.ng-build/release/src-rt-5.02hnd/kernel/linux-4.1/lib/raid6/*.ko ~/luksmodules
cp ~/asuswrt-merlin.ng-build/release/src-rt-5.02hnd/kernel/linux-4.1/lib/*.ko ~/luksmodules


cd
ls ~/luksmodules
#ablk_helper.ko        async_tx.ko          dm-cache.ko          dm-mirror.ko           dm-snapshot.ko   md-mod.ko           sha2-ce.ko
#aes-ce-blk.ko         async_xor.ko         dm-cache-mq.ko       dm-mod.ko              dm-switch.ko     multipath.ko        twofish_common.ko
#aes-ce-ccm.ko         cn.ko                dm-crypt.ko          dm-multipath.ko        dm-thin-pool.ko  raid0.ko            twofish_generic.ko
#aes-ce-cipher.ko      crc32-arm64.ko       dm-delay.ko          dm-persistent-data.ko  dm-verity.ko     raid10.ko           xor.ko
#af_alg.ko             cryptd.ko            dm-era.ko            dm-queue-length.ko     dm-zero.ko       raid1.ko            xts.ko
#algif_skcipher.ko     crypto_user.ko       dm-flakey.ko         dm-raid.ko             faulty.ko        raid456.ko
#async_memcpy.ko       dm-bio-prison.ko     dm-log.ko            dm-region-hash.ko      ghash-ce.ko      raid6_pq.ko
#async_pq.ko           dm-bufio.ko          dm-log-userspace.ko  dm-round-robin.ko      libcrc32c.ko     serpent_generic.ko
#async_raid6_recov.ko  dm-cache-cleaner.ko  dm-log-writes.ko     dm-service-time.ko     linear.ko        sha1-ce.ko


### Copy ~/luksmodules to router /jffs folder and try
cd /jffs/luksmodules
insmod ./dm-mod.ko

# load all - need 4 times for load all
for a in *.ko; do insmod $a; done
for a in *.ko; do insmod $a; done
for a in *.ko; do insmod $a; done
for a in *.ko; do insmod $a; done
 
Last edited:
use RAID1

Code:
insmod raid1.ko
cat /proc/mdstat

dd if=/dev/zero of=a bs=1M count=128
dd if=/dev/zero of=b bs=1M count=128
losetup /dev/loop1 a
losetup /dev/loop2 b
./mdadm --create --verbose /dev/md0 --level=mirror --raid-devices=2 /dev/loop1 /dev/loop2
cat /proc/mdstat
mke2fs -t ext4 /dev/md0
mkdir /mnt/md0
mount /dev/md0 /mnt/md0

umount /mnt/md0
./mdadm --stop /dev/md0

./mdadm --assemble /dev/md0 /dev/loop1 /dev/loop2
mount /dev/md0 /mnt/md0
 

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!

Staff online

Top