DEV Community

Cover image for Android 9 and Netflix for X96(W)
Adam Mateusz Brożyński
Adam Mateusz Brożyński

Posted on

Android 9 and Netflix for X96(W)

This applies to Smart TV X96 (X96W) devices based on Amlogic S905W. In my case it was branded as Emmerson STV200HD distributed in Poland.

I take no responsibility if you brick or break your device.

Problem:

  • Annoying notifications about crashed apps
  • Cannot install some apps from Google Play like Netflix
  • Android 7 is obsolete and no online updates are available

Solution:

  • Prepare 2GB empty microSD card
  • Download atvXv4 rom based on AndroidTV 9.0
  • Extract files from atvX_s905w_4.3.zip archive
  • Create aml-upgrade-package-extract.c file in extracted files directory with following contents (Windows users should use Amlogic USB Burning Tool to create microSD with aml_upgrade_package.img file and skip to Boot from microSD):
#include <errno.h>
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <arpa/inet.h>

uint32_t convert(uint8_t * test, uint64_t loc) {
  return ntohl((test[loc] << 24) | (test[loc + 1] << 16) | (test[loc + 2] << 8) | test[loc + 3]);
}

void main(int argc, char ** argv) {
  FILE * fileptr;
  uint8_t * buffer;
  long filelen;

  FILE * f;
  char * filename;
  uint64_t record;
  uint64_t record_loc;
  uint64_t file_loc;
  uint64_t file_size;

  if (argc <= 1) {
    printf("Usage: %s [firmware-file-name]\n", argv[0]);
    exit(0);
  }

  fileptr = fopen(argv[1], "rb");
  fseek(fileptr, 0, SEEK_END);
  filelen = ftell(fileptr);
  rewind(fileptr);
  buffer = (uint8_t * ) malloc((filelen + 1) * sizeof(uint8_t));
  fread(buffer, filelen, 1, fileptr);
  fclose(fileptr);

  for (record = 0; record < (uint8_t) buffer[0x18]; record = record + 1) {
    record_loc = 0x40 + (record * 0x240);

    filename = (malloc(32));
    sprintf(filename, "%s.%s", (char * ) & buffer[record_loc + 0x120], (char * ) & buffer[record_loc + 0x20]);

    file_loc = convert(buffer, record_loc + 0x10);
    file_size = convert(buffer, record_loc + 0x18);

    f = fopen(filename, "wb");
    if (f == NULL) {
      printf("ERROR: could not open output\n");
      printf("the error was: %s\n", strerror(errno));
      free(filename);
      continue;
    }
    fwrite( & (buffer[file_loc]), sizeof(uint8_t), (size_t) file_size, f);
    fclose(f);
    free(filename);
  }
  free(buffer);
}
Enter fullscreen mode Exit fullscreen mode
  • Compile script:
$ gcc aml-upgrade-package-extract.c -o aml-upgrade-package-extract
Enter fullscreen mode Exit fullscreen mode
  • Use script to extract img file contents:
$ ./aml-upgrade-package-extract aml_upgrade_package.img
Enter fullscreen mode Exit fullscreen mode
  • Make sure you have FAT32 partition on your microSD card and execute following commands on unmounted device:
### !!! WARNING: Replace /dev/sdc with path to your card. Do not use partition path like /dev/sdc1 !!! ###

$ sudo dd if=aml_sdc_burn.UBOOT of=/dev/sdX bs=1 count=442
$ sudo dd if=aml_sdc_burn.UBOOT of=/dev/sdX seek=1 skip=1 bs=512
$ sync
Enter fullscreen mode Exit fullscreen mode
  • Mount FAT32 partition of you microSD card and copy following files:
    • aml_sdc_burn.ini
    • aml_sdc_burn.UBOOT
    • aml_upgrade_package.img
  • Umount microSD card and plug it into X96
  • Boot from microSD:
    • Take out power cable from X96
    • Insert a match (or any kind of object that will fit) to AV port and hold the switch that is inside
    • Plug in power cable to X96 while holding the switch
  • Do not worry if there's no signal on the screen. If X96 won't reboot after 10-15 minutes, plug out and plug in power cable. Device should boot up with new rom.
  • Add you Google account and install/update Google Apps from Google Play
  • Install Netflix and other apps you like. Enjoy using your device!

Used sources:

Discussion (0)