Add support for ramdisk offset and pagesize

Adapted from the upstream Android version
Add .gitignore
Fix warnings