Skip to content
h0pbeat edited this page Jan 29, 2013 · 7 revisions

nexus_7_image

Nexus 7 is a 7'' tablet running Android. It is fairly compact, easy to unlock and root, powerful (quad-core Tegra 3 ) and cheap ($200 for 8Gb version). It is a suggested SBS2 platform.

Required Hardware

Nexus 7 uses micro usb OTG cable for connecting USB devices. Such cables can be cheaply obtained from Amazon, for example this one: http://www.amazon.co.uk/gp/product/B005OOJPKS

Preparing Device

  • Unlock the bootloader of the device using these instructions

  • Root device using for example this software. Nexus device can be easily rooted by flashing superuser binaries.

  • Alternatively flash clockwormod recovery directly using ./fastboot flash recovery /path/to/recovery-clockwork-XXX-grouper.img

  • Flash device using boot.img_nexus7_1_0/boot.img_nexus7_1_0_4_1_2/boot.img_nexus7_1_0_4_2 (depending on your Android version) from Downloads. You can flash temporarily using

          fastboot boot  boot.img_nexus7_1_0
    

    or permanently using

          fastboot flash boot boot.img_nexus7_1_0
    

see http://wiki.cyanogenmod.com/wiki/Fastboot

At that point, when Emotiv EPOC USB dongle is connected, it will be mounted in /dev/hidraw1 and can be read by SBS2 applications.

Compiling Kernel

This procedure is optional and produces boot.img that is used in Preparing Device section.

This is written for Ubuntu, should work on any Linux flavor (within reason).

  • Download and unpack cross compiler, I'm using arm-2010q1-202-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 (see wiki here).

  • Get the Android source:

      git clone https://android.googlesource.com/kernel/tegra.git nexus7-kernel
    

Switch to newest grouper (Nexus 7 paltform) branch, you can find the newest branch for grouper at https://android.googlesource.com/kernel/tegra.

  • Pull config.gz from /proc/ from the device, unzip. Copy config to nexus7-kernel/.config

  • Compile menuconfig using

      make ARCH=arm CROSS_COMPILE=/path/to/arm-2010q1/bin/arm-none-linux-gnueabi- menuconfig
    
  • Configure kernel. Two things you will want to change are:

      General setup -> Local version 
      change to name of your kernel so you can easily tell stock and your kernel apart. 
    

and

    Device Drivers -> HID Devices -> /dev/hidraw raw HID device support
    set to Y (star)

Save & exit.

  • Compile with

      make ARCH=arm CROSS_COMPILE=/home/arek/galaxy_note_kernel_build/arm-2010q1/bin/arm-none-linux-gnueabi-
    
  • If the compilation succeeds you will end up with arch/arm/boot/zImage which is the kernel binary. Now it must be packed into a proper boot.img

  • Download the proper image from https://developers.google.com/android/nexus/images. Unpack and enter the directory.

  • Download boot.img-tools from http://forum.xda-developers.com/showthread.php?t=1241005

  • Unpack boot.img:

       mkdir -p unpack
       tools/unpackbootimg -i boot.img -o unpack
    
  • Extract boot.img-ramdisk.gz:

       mkdir -p unpack/boot.img-ramdisk
       cd unpack/boot.img-ramdisk 
       gzip -dc ../boot.img-ramdisk.gz | cpio -i
       cd ../../
    
  • Package new ramdisk:

      tools/mkbootfs unpack/boot.img-ramdisk | gzip > unpack/boot.img-ramdisk.gz
    
  • Create a new boot.img:

      tools/mkbootimg --kernel /path/to/compiled/zImage --ramdisk unpack/boot.img-ramdisk.gz -o boot.img-repack --base `cat unpack/boot.img-base`
    

You end up with boot.img-repack which is the flashable boot.img as in Preparing Device section.

  • Upgrading Android Version

If you have custom kernel flashed, you will not be able to do OTA update. Instead, you can go back to stock Android for your current version, upgrade and then install custom kernel for the new version. To come back to stock:

  • Download proper stock image from https://developers.google.com/android/nexus/images
  • Extract .tgz file and then extract the .zip file inside
  • Flash boot.img from the extracted .zip file. Either temporary with ./fastboot boot boot.img or permanently (required to perform update) using ./fastboot flash boot boot.img. The device needs to be in the fastboot mode.