# Install LineageOS on Ouya

## Things You Will Need

- A USB flash drive, at least 4 GB of free space https://amzn.to/3wkR5ju
- A USB hub, preferably with external power https://amzn.to/3KTviDw
- A USB keyboard https://amzn.to/3qgUQTe | https://amzn.to/3uchJs

## Prerequisites and Downloads

1. Download i12bretro_OUYA_commands.zip Download
2. Download i12bretro_OUYA_LineageOS_image.zip Download
3. Format the USB flash drive to FAT32
   1. Right Click Start > File Explorer
   2. Right Click the USB flash drive > Format...
   3. Select FAT32 from the File System dropdown
   4. Make sure Quick Format is checked
   5. Click Start

4. Extract the downloaded i12bretro_OUYA_LineageOS_image.zip file to the root of the USB flash drive
5. Extract the downloaded i12bretro_OUYA_commands.zip
6. Safely remove the flash drive and set aside for later

## Installing Ouya USB Drivers

1. Right click Start > Command Prompt (Admin)
2. Paste the following commands to disable driving signing checks temporarily
   bcdedit -set loadoptions DISABLE_INTEGRITY_CHECKS
   bcdedit -set TESTSIGNING ON
   shutdown /r
3. Your PC will reboot
4. Connect a USB cable from the micro USB port on the back of the Ouya to your PC
5. Connect the USB hub to the USB port on the Ouya > Plug in the USB keyboard and prepared USB flash drive
6. Make sure the Ouya is connected to a display via HDMI
7. Power on the Ouya
8. After a few seconds you should hear Windows chime that a new device has been detected
9. Right click Start > Device Manager
10. Expand Other Devices and you should see OUYA listed
11. Right click OUYA > Update Driver
12. Select Browse my computer for driver software
13. Click the Browse... button
14. Navigate to the extracted i12bretro_OUYA_commands\files\driver
15. Click OK
16. Make sure "Include subfolders" is checked, click Next
17. Windows should find the correct driver for the Ouya and install it
18. Navigate to the i12bretro_OUYA_commands in windows explorer
19. Right click i12bretro_OUYA_commands.bat > Run as administrator
20. The script uses the Android Debug Bridge (ADB) to boot the Ouya into CyanogenMod recovery
21. When the command prompts to "-- Setup the fastboot driver", go back to Device Manager expand Android Device
22. Right click Android Bootloader Device > Update Driver
23. Select Browse my computer for driver software
24. Click the Browse... button
25. Navigate to the extracted i12bretro_OUYA_commands\files\driver
26. Click OK
27. Make sure "Include subfolders" is checked, click Next
28. Windows should find the correct driver for the Ouya and install it
29. Press Enter at the command prompt once the driver is installed to continue booting the Ouya to CyanogenMod recovery

## Restore i12bretro LineageOS Image via CyanogenMod Recovery

1. With the OUYA in CyanogenMod Recovery:
2. Select Backup/Restore > Restore from USB disk
3. Navigate to and select the extracted LineageOS image from the USB disk clockworkmod\backup\2020-05-18.00.42.15
4. Select Yes to confirm restoring the backup
5. Wait several minutes for the various partitions of the image to be copied to the Ouya
6. From the main menu select wipe cache partition
7. Select Yes to confirm wiping the cache
8. From the main menu select advanced > wipe dalvik cache partition
9. Select Yes to confirm wiping the dalvik cache
10. From the main menu select Install zip > Install zip from USB disk
11. Select recovery-clockwork-6.0.4.8-ouya.zip
12. Select Yes to confirm installing recovery
13. From the main menu select Install zip > Install zip from USB disk
14. Select ouyabootmenu-mql-v2.0.4.zip
15. Select Yes to confirm installing Ouya boot menu
16. From the main menu select reboot device
17. After a few moments the device will boot into LineageOS running Android 4.4.2

## Cleaning Up

1. After successfully flashing the image to your Ouya, do the following
2. Right click Start > Command Prompt (Admin)
3. Paste the following commands to re-enable driving signing checks
   bcdedit -set loadoptions ENABLE_INTEGRITY_CHECKS
   bcdedit -set TESTSIGNING OFF
   shutdown /r
4. Your PC will reboot

Special thanks to https://www.s-config.com/section-3-method-2-adb-push-lineage-from-raspberry-pi-to-ouya/ for helping to keep the Ouya alive