“invalid tar magic” on OpenWRT

The version of tar on OpenWRT is a smaller one than the one on full-blown systems, designed to fit small devices (it's BusyBox.) To keep small, it lacks features such as the automatic detection of compressed archives.

Try declaring the compression format manually with the -z option:

tar -xvzf ejdk-8u65-linux-arm-sflt.tar.gz

Support for gzip in the tar utility is an optional feature that may or may not be enabled on OpenWRT. If you don't have it, call zcat (or gzip -dc) explicitly:

zcat ejdk-8u65-linux-arm-sflt.tar.gz | tar -xvf -

I had the same problem when extracting an archive, finally I upgraded tar and it solved the problem.

opkg update
opkg upgrade tar