Mounting HDD on PC: Difference between revisions

From PS3 Developer wiki
Jump to navigation Jump to search
Line 13: Line 13:
* Swaps bytes in each 16-bit word.
* Swaps bytes in each 16-bit word.
* It is necessray for HDD/VFLASH encryption/decryption.
* It is necessray for HDD/VFLASH encryption/decryption.
* Tested on Linux 3.5.3


GIT repo: http://gitorious.ps3dev.net/ps3linux/dm-bswap16
GIT repo: http://gitorious.ps3dev.net/ps3linux/dm-bswap16

Revision as of 21:03, 3 September 2012

Introduction

  • The goal is to mount PS3 HDD on PC Linux and make changes to it.
  • Use device mapper for transparent encryption/decryption.

Device Mapper

  • A really cool feature of Linux 2.6/3.
  • The device mapper is stackable.

dm-bswap16

  • Swaps bytes in each 16-bit word.
  • It is necessray for HDD/VFLASH encryption/decryption.
  • Tested on Linux 3.5.3

GIT repo: http://gitorious.ps3dev.net/ps3linux/dm-bswap16

Test

modprobe loop
modprobe dm_mod

insmod ./dm-bswap16.ko

dd if=/dev/zero of=test.bin bs=1K count=100

losetup /dev/loop0 ./test.bin

echo "0 200 bswap16 /dev/loop0" | sudo dmsetup create test

echo "00 01 00 01 00 01" | xxd -r -p > /dev/mapper/test

# device mapper target

hexdump -C /dev/mapper/test 
00000000  00 01 00 01 00 01 00 00  00 00 00 00 00 00 00 00  |................|
00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00019000

# real data, as you see bytes are swapped in each 16-bit word
# device mapper allows you to do really cool things :)

hexdump -C /home/glevand/test.bin
00000000  01 00 01 00 01 00 00 00  00 00 00 00 00 00 00 00  |................|
00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00019000

Links