Add basic Makefile.

With this Makefile make_ext4fs and ext4fixup can be built without the
entire Android build system.

Signed-off-by: Markus Mayer <code@mmayer.net>
Drop unused variable capabilities

Signed-off-by: Markus Mayer <code@mmayer.net>
Fix compiler warnings regarding unchecked return values of system calls

Signed-off-by: Markus Mayer <code@mmayer.net>
make_ext4fs does not preserve user or group owner ownership

While make_ext4fs does provide the "-a" command line switch, the use of
which will ensure the right UID and GID are used for standard Android
files and directories, this option cannot be used to preserve UID and
GID as they exist in the host file system.

The absence of UID/GID preservation leads to issues if make_ext4fs is
used to create an ext4 file system containing a full Linux distribution
(for example: Ubuntu). All directores in the image are owned by user
"root" and group "root", which will cause system services such as
syslog (which requires /var/log to be owned by group "syslog") to fail
due to inadequate permissions (syslogd doesn't run as root).

We add support for a new command-line option "-p" to tell make_ext4fs
to preserve the UIDs and GIDs files have in the host file system. A
check is also added to ensure "-a" and "-p" are never specified
together. This check is only necessary if Android support is built in.
If there's no Android support present, make_ext4fs will error out as
soon as it encounters "-a", so the two options will never collide.

Signed-off-by: Markus Mayer <code@mmayer.net>