Category Archives: USB-Armory

Stuff concerning Inverse Path’s USB-Armory

USBArmory: LKMs

Hi! I’m going to show you, how you can write and load your own LKMs for the USBArmory.

1. download the kernel source
2. download the .config file used by InversePath
3. compile the kernel and generate all important files
4. write module & makefile
5. insert & remove the module

1.
If you want to write your own modules you’ll need the kernel headers specifically for your running kernel.
If you’re running the latest image, you just need to download the kernel source for linux-4.2.1.

2.
Now we need to download the .config file and place it into the kernel source directory.

3.
Run ‘sudo make; sudo make modules_prepare’ to create all important files.
This can take up quite some time, so grab a coffee or a book.

4.
Finally we can write our own module:

And our Makefile:

You have to insert your path to the kernel source directory.
The ‘-C’ flag points to the kernel sources ( would be /home/usbarmory/linux-4.2.1/ ) and the ‘M’ variable to the directory of your module ( would be /home/usbarmory ).
The ‘modules’ at the end just shows what to build.

You can now enter ‘sudo make’ to build the LKM:

5.
Now you can insert your module into the kernel.

Look at the the last output of ‘dmesg’ to see our module in action:

Unloading works pretty similar:

Again see the output of ‘dmesg’:

To see list of all modules currently loaded, you can enter ‘lsmod’

Have fun writing your own modules!

Carl Smith

USB-Armory resizing partition

Here are the complete instructions on how to resize your USB-Armory‘s filesystem to use the whole SD-Card.
We are going to use fdisk and resize2fs to resize the existing partition.

So first we are going to check the partitions.

So we have one partition called mmcblk0p1 that we are going to expand.
We are going to use fdisk to create a new partition in place of the old one.
First press ‘p’ to print out all the existing partitions and then delete the old one ( by pressing ‘d’ ), but remember the starting sector of the existing partition. In my case that would be 10240.

Then create a new one by pressing ‘n’ then ‘p’ for primary, now enter the starting sector, in my case 10240.
Now hit enter to use the full disk. Now we have created our new partition.
Press ‘p’ to verify the existence of our partition.

So after creating the partition we are going to write the changes ( enter ‘w’ ).
Then reboot the USB-Armory.

When the device has rebooted and you successfully logged in, we are going to use resize2fs to resize the filesystem.
When we enter ‘df -h’ we can see that our new filesystem is now 30G big :-)

I hope it worked for you guys!
If you have any questions feel free to ask!